summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/linux_builds.yml6
-rw-r--r--CHANGELOG.md2
-rw-r--r--COPYRIGHT.txt5
-rw-r--r--core/config/project_settings.cpp98
-rw-r--r--core/config/project_settings.h3
-rw-r--r--core/core_bind.cpp20
-rw-r--r--core/core_bind.h4
-rw-r--r--core/core_constants.cpp83
-rw-r--r--core/crypto/crypto.cpp39
-rw-r--r--core/crypto/crypto.h34
-rw-r--r--core/debugger/script_debugger.cpp4
-rw-r--r--core/debugger/script_debugger.h1
-rw-r--r--core/doc_data.cpp12
-rw-r--r--core/doc_data.h2
-rw-r--r--core/error/error_macros.cpp4
-rw-r--r--core/error/error_macros.h48
-rw-r--r--core/extension/extension_api_dump.cpp15
-rw-r--r--core/extension/gdextension_interface.cpp23
-rw-r--r--core/extension/gdextension_interface.h6
-rw-r--r--core/input/input.cpp18
-rw-r--r--core/input/input.h2
-rw-r--r--core/input/input_event.cpp127
-rw-r--r--core/input/input_event.h8
-rw-r--r--core/io/dtls_server.cpp2
-rw-r--r--core/io/dtls_server.h2
-rw-r--r--core/io/http_client.cpp2
-rw-r--r--core/io/http_client.h3
-rw-r--r--core/io/http_client_tcp.cpp33
-rw-r--r--core/io/http_client_tcp.h7
-rw-r--r--core/io/image.cpp46
-rw-r--r--core/io/image.h18
-rw-r--r--core/io/image_loader.cpp4
-rw-r--r--core/io/image_loader.h2
-rw-r--r--core/io/json.cpp33
-rw-r--r--core/io/json.h9
-rw-r--r--core/io/marshalls.h2
-rw-r--r--core/io/packet_peer_dtls.cpp2
-rw-r--r--core/io/packet_peer_dtls.h2
-rw-r--r--core/io/resource.cpp43
-rw-r--r--core/io/resource.h2
-rw-r--r--core/io/resource_format_binary.cpp97
-rw-r--r--core/io/resource_format_binary.h5
-rw-r--r--core/io/resource_loader.cpp27
-rw-r--r--core/io/resource_loader.h4
-rw-r--r--core/io/resource_saver.cpp7
-rw-r--r--core/io/resource_saver.h1
-rw-r--r--core/io/stream_peer_tls.cpp20
-rw-r--r--core/io/stream_peer_tls.h11
-rw-r--r--core/math/a_star.cpp50
-rw-r--r--core/math/a_star.h2
-rw-r--r--core/math/a_star_grid_2d.cpp16
-rw-r--r--core/math/a_star_grid_2d.h2
-rw-r--r--core/math/basis.cpp25
-rw-r--r--core/math/basis.h4
-rw-r--r--core/math/bvh.h10
-rw-r--r--core/math/bvh_abb.h2
-rw-r--r--core/math/bvh_split.inc8
-rw-r--r--core/math/color.cpp2
-rw-r--r--core/math/delaunay_3d.h12
-rw-r--r--core/math/expression.cpp9
-rw-r--r--core/math/face3.cpp40
-rw-r--r--core/math/face3.h5
-rw-r--r--core/math/geometry_2d.cpp35
-rw-r--r--core/math/geometry_2d.h1
-rw-r--r--core/math/geometry_3d.cpp171
-rw-r--r--core/math/geometry_3d.h2
-rw-r--r--core/math/transform_2d.cpp45
-rw-r--r--core/math/transform_2d.h1
-rw-r--r--core/math/triangle_mesh.cpp196
-rw-r--r--core/math/triangle_mesh.h2
-rw-r--r--core/object/make_virtuals.py4
-rw-r--r--core/object/object.cpp6
-rw-r--r--core/object/object.h29
-rw-r--r--core/object/script_language.cpp39
-rw-r--r--core/object/script_language.h9
-rw-r--r--core/object/script_language_extension.h1
-rw-r--r--core/object/undo_redo.cpp3
-rw-r--r--core/object/worker_thread_pool.cpp12
-rw-r--r--core/os/keyboard.cpp119
-rw-r--r--core/os/keyboard.h89
-rw-r--r--core/os/mutex.h5
-rw-r--r--core/os/os.cpp26
-rw-r--r--core/os/os.h10
-rw-r--r--core/os/rw_lock.h38
-rw-r--r--core/os/semaphore.h29
-rw-r--r--core/register_core_types.cpp1
-rw-r--r--core/string/ustring.cpp20
-rw-r--r--core/string/ustring.h1
-rw-r--r--core/templates/local_vector.h64
-rw-r--r--core/variant/array.cpp147
-rw-r--r--core/variant/array.h11
-rw-r--r--core/variant/container_type_validate.h11
-rw-r--r--core/variant/dictionary.cpp10
-rw-r--r--core/variant/dictionary.h2
-rw-r--r--core/variant/typed_array.h42
-rw-r--r--core/variant/variant.cpp40
-rw-r--r--core/variant/variant.h2
-rw-r--r--core/variant/variant_call.cpp19
-rw-r--r--core/variant/variant_internal.h19
-rw-r--r--core/variant/variant_parser.cpp148
-rw-r--r--core/variant/variant_setget.cpp25
-rw-r--r--core/variant/variant_utility.cpp7
-rw-r--r--doc/classes/@GlobalScope.xml469
-rw-r--r--doc/classes/AABB.xml2
-rw-r--r--doc/classes/AStarGrid2D.xml8
-rw-r--r--doc/classes/AcceptDialog.xml4
-rw-r--r--doc/classes/AnimatableBody3D.xml1
-rw-r--r--doc/classes/AnimatedSprite2D.xml102
-rw-r--r--doc/classes/AnimatedSprite3D.xml104
-rw-r--r--doc/classes/Animation.xml15
-rw-r--r--doc/classes/AnimationNode.xml28
-rw-r--r--doc/classes/AnimationNodeBlendSpace1D.xml14
-rw-r--r--doc/classes/AnimationNodeOneShot.xml6
-rw-r--r--doc/classes/AnimationNodeStateMachinePlayback.xml17
-rw-r--r--doc/classes/AnimationNodeStateMachineTransition.xml5
-rw-r--r--doc/classes/AnimationNodeTransition.xml18
-rw-r--r--doc/classes/AnimationPlayer.xml33
-rw-r--r--doc/classes/AnimationTree.xml17
-rw-r--r--doc/classes/Area2D.xml5
-rw-r--r--doc/classes/Area3D.xml6
-rw-r--r--doc/classes/Array.xml52
-rw-r--r--doc/classes/ArrayMesh.xml13
-rw-r--r--doc/classes/AudioStreamPlaybackPolyphonic.xml61
-rw-r--r--doc/classes/AudioStreamPlayer.xml6
-rw-r--r--doc/classes/AudioStreamPlayer2D.xml6
-rw-r--r--doc/classes/AudioStreamPlayer3D.xml6
-rw-r--r--doc/classes/AudioStreamPolyphonic.xml17
-rw-r--r--doc/classes/Callable.xml10
-rw-r--r--doc/classes/CanvasItem.xml15
-rw-r--r--doc/classes/CharacterBody3D.xml5
-rw-r--r--doc/classes/CollisionObject3D.xml1
-rw-r--r--doc/classes/CollisionPolygon3D.xml1
-rw-r--r--doc/classes/CollisionShape3D.xml1
-rw-r--r--doc/classes/Color.xml2
-rw-r--r--doc/classes/ConfirmationDialog.xml4
-rw-r--r--doc/classes/Control.xml17
-rw-r--r--doc/classes/Cubemap.xml8
-rw-r--r--doc/classes/CubemapArray.xml8
-rw-r--r--doc/classes/Curve2D.xml2
-rw-r--r--doc/classes/Curve3D.xml2
-rw-r--r--doc/classes/DTLSServer.xml6
-rw-r--r--doc/classes/Dictionary.xml16
-rw-r--r--doc/classes/DisplayServer.xml18
-rw-r--r--doc/classes/EditorCommandPalette.xml2
-rw-r--r--doc/classes/EditorImportPlugin.xml4
-rw-r--r--doc/classes/EditorPlugin.xml2
-rw-r--r--doc/classes/EditorSettings.xml18
-rw-r--r--doc/classes/EditorTranslationParserPlugin.xml3
-rw-r--r--doc/classes/Expression.xml2
-rw-r--r--doc/classes/FileSystemDock.xml5
-rw-r--r--doc/classes/GPUParticles2D.xml4
-rw-r--r--doc/classes/HTTPClient.xml7
-rw-r--r--doc/classes/HTTPRequest.xml21
-rw-r--r--doc/classes/HashingContext.xml11
-rw-r--r--doc/classes/HeightMapShape3D.xml4
-rw-r--r--doc/classes/Image.xml10
-rw-r--r--doc/classes/ImporterMesh.xml10
-rw-r--r--doc/classes/Input.xml11
-rw-r--r--doc/classes/InputEventKey.xml52
-rw-r--r--doc/classes/InputEventWithModifiers.xml6
-rw-r--r--doc/classes/JSON.xml14
-rw-r--r--doc/classes/Label3D.xml12
-rw-r--r--doc/classes/Light3D.xml2
-rw-r--r--doc/classes/LightmapGI.xml18
-rw-r--r--doc/classes/LineEdit.xml89
-rw-r--r--doc/classes/Marshalls.xml2
-rw-r--r--doc/classes/Material.xml6
-rw-r--r--doc/classes/Mesh.xml13
-rw-r--r--doc/classes/MultiplayerAPI.xml4
-rw-r--r--doc/classes/Mutex.xml4
-rw-r--r--doc/classes/NavigationAgent2D.xml36
-rw-r--r--doc/classes/NavigationAgent3D.xml36
-rw-r--r--doc/classes/NavigationLink2D.xml10
-rw-r--r--doc/classes/NavigationLink3D.xml10
-rw-r--r--doc/classes/NavigationServer2D.xml30
-rw-r--r--doc/classes/NavigationServer3D.xml30
-rw-r--r--doc/classes/Node.xml5
-rw-r--r--doc/classes/OS.xml4
-rw-r--r--doc/classes/Object.xml48
-rw-r--r--doc/classes/PacketPeerDTLS.xml7
-rw-r--r--doc/classes/ParticleProcessMaterial.xml3
-rw-r--r--doc/classes/Performance.xml2
-rw-r--r--doc/classes/PhysicalBone3D.xml1
-rw-r--r--doc/classes/PhysicsBody3D.xml3
-rw-r--r--doc/classes/PhysicsServer2D.xml18
-rw-r--r--doc/classes/PhysicsServer3D.xml26
-rw-r--r--doc/classes/ProjectSettings.xml58
-rw-r--r--doc/classes/Projection.xml2
-rw-r--r--doc/classes/Rect2i.xml6
-rw-r--r--doc/classes/RemoteTransform2D.xml6
-rw-r--r--doc/classes/RenderingServer.xml22
-rw-r--r--doc/classes/Resource.xml3
-rw-r--r--doc/classes/ResourceFormatLoader.xml7
-rw-r--r--doc/classes/RichTextLabel.xml15
-rw-r--r--doc/classes/RigidBody3D.xml1
-rw-r--r--doc/classes/Semaphore.xml4
-rw-r--r--doc/classes/Shader.xml10
-rw-r--r--doc/classes/Signal.xml4
-rw-r--r--doc/classes/SpriteBase3D.xml15
-rw-r--r--doc/classes/StaticBody3D.xml5
-rw-r--r--doc/classes/StreamPeerTLS.xml18
-rw-r--r--doc/classes/String.xml8
-rw-r--r--doc/classes/StringName.xml8
-rw-r--r--doc/classes/StyleBox.xml37
-rw-r--r--doc/classes/StyleBoxTexture.xml59
-rw-r--r--doc/classes/SurfaceTool.xml4
-rw-r--r--doc/classes/SystemFont.xml6
-rw-r--r--doc/classes/TLSOptions.xml53
-rw-r--r--doc/classes/TextEdit.xml103
-rw-r--r--doc/classes/TextServer.xml11
-rw-r--r--doc/classes/TextServerExtension.xml2
-rw-r--r--doc/classes/Texture2D.xml6
-rw-r--r--doc/classes/Texture2DArray.xml8
-rw-r--r--doc/classes/Texture3D.xml6
-rw-r--r--doc/classes/TileData.xml2
-rw-r--r--doc/classes/TileMap.xml16
-rw-r--r--doc/classes/TileSet.xml19
-rw-r--r--doc/classes/Tree.xml10
-rw-r--r--doc/classes/Tween.xml20
-rw-r--r--doc/classes/UndoRedo.xml8
-rw-r--r--doc/classes/VehicleBody3D.xml1
-rw-r--r--doc/classes/VideoStream.xml14
-rw-r--r--doc/classes/VideoStreamPlayback.xml104
-rw-r--r--doc/classes/Viewport.xml3
-rw-r--r--doc/classes/VisualInstance3D.xml2
-rw-r--r--doc/classes/VisualShaderNode.xml7
-rw-r--r--doc/classes/VisualShaderNodeDerivativeFunc.xml15
-rw-r--r--doc/classes/Window.xml10
-rw-r--r--doc/classes/XRController3D.xml31
-rw-r--r--doc/classes/XRPositionalTracker.xml12
-rw-r--r--doc/translations/ar.po6
-rw-r--r--doc/translations/ca.po6
-rw-r--r--doc/translations/classes.pot10
-rw-r--r--doc/translations/cs.po6
-rw-r--r--doc/translations/de.po6
-rw-r--r--doc/translations/el.po6
-rw-r--r--doc/translations/es.po17
-rw-r--r--doc/translations/et.po6
-rw-r--r--doc/translations/fa.po6
-rw-r--r--doc/translations/fi.po6
-rw-r--r--doc/translations/fil.po6
-rw-r--r--doc/translations/fr.po16
-rw-r--r--doc/translations/gl.po6
-rw-r--r--doc/translations/hi.po6
-rw-r--r--doc/translations/hu.po6
-rw-r--r--doc/translations/id.po6
-rw-r--r--doc/translations/is.po6
-rw-r--r--doc/translations/it.po6
-rw-r--r--doc/translations/ja.po6
-rw-r--r--doc/translations/ko.po15
-rw-r--r--doc/translations/lt.po6
-rw-r--r--doc/translations/lv.po6
-rw-r--r--doc/translations/mr.po6
-rw-r--r--doc/translations/nb.po6
-rw-r--r--doc/translations/ne.po6
-rw-r--r--doc/translations/nl.po6
-rw-r--r--doc/translations/pl.po6
-rw-r--r--doc/translations/pt.po91
-rw-r--r--doc/translations/pt_BR.po80
-rw-r--r--doc/translations/ro.po6
-rw-r--r--doc/translations/ru.po267
-rw-r--r--doc/translations/sk.po6
-rw-r--r--doc/translations/sr_Cyrl.po6
-rw-r--r--doc/translations/sv.po6
-rw-r--r--doc/translations/th.po6
-rw-r--r--doc/translations/tl.po6
-rw-r--r--doc/translations/tr.po6
-rw-r--r--doc/translations/uk.po111
-rw-r--r--doc/translations/vi.po6
-rw-r--r--doc/translations/zh_CN.po611
-rw-r--r--doc/translations/zh_TW.po59
-rw-r--r--drivers/alsa/asound-so_wrap.c96
-rw-r--r--drivers/alsa/asound-so_wrap.h40
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.cpp4
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp169
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.h15
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp11
-rw-r--r--drivers/gles3/shader_gles3.cpp2
-rw-r--r--drivers/gles3/shaders/scene.glsl13
-rw-r--r--drivers/gles3/shaders/skeleton.glsl17
-rw-r--r--drivers/gles3/storage/config.cpp4
-rw-r--r--drivers/gles3/storage/config.h3
-rw-r--r--drivers/gles3/storage/light_storage.h2
-rw-r--r--drivers/gles3/storage/material_storage.cpp13
-rw-r--r--drivers/gles3/storage/mesh_storage.cpp25
-rw-r--r--drivers/gles3/storage/mesh_storage.h2
-rw-r--r--drivers/gles3/storage/texture_storage.cpp64
-rw-r--r--drivers/gles3/storage/texture_storage.h37
-rw-r--r--drivers/gles3/storage/utilities.cpp3
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp2
-rw-r--r--drivers/pulseaudio/pulse-so_wrap.c152
-rw-r--r--drivers/pulseaudio/pulse-so_wrap.h110
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp110
-rw-r--r--drivers/vulkan/vulkan_context.cpp133
-rw-r--r--drivers/vulkan/vulkan_context.h1
-rw-r--r--drivers/windows/file_access_windows.cpp45
-rw-r--r--drivers/windows/file_access_windows.h6
-rw-r--r--editor/action_map_editor.cpp8
-rw-r--r--editor/animation_bezier_editor.cpp25
-rw-r--r--editor/animation_bezier_editor.h5
-rw-r--r--editor/animation_track_editor.cpp96
-rw-r--r--editor/animation_track_editor.h15
-rw-r--r--editor/array_property_edit.cpp300
-rw-r--r--editor/code_editor.cpp5
-rw-r--r--editor/connections_dialog.cpp402
-rw-r--r--editor/connections_dialog.h35
-rw-r--r--editor/create_dialog.cpp7
-rw-r--r--editor/create_dialog.h3
-rw-r--r--editor/debugger/script_editor_debugger.cpp38
-rw-r--r--editor/debugger/script_editor_debugger.h2
-rw-r--r--editor/dependency_editor.cpp12
-rw-r--r--editor/dictionary_property_edit.cpp176
-rw-r--r--editor/doc_tools.cpp16
-rw-r--r--editor/editor_data.cpp18
-rw-r--r--editor/editor_data.h3
-rw-r--r--editor/editor_feature_profile.cpp2
-rw-r--r--editor/editor_file_system.cpp36
-rw-r--r--editor/editor_file_system.h4
-rw-r--r--editor/editor_help.cpp6
-rw-r--r--editor/editor_inspector.cpp17
-rw-r--r--editor/editor_inspector.h9
-rw-r--r--editor/editor_node.cpp634
-rw-r--r--editor/editor_node.h50
-rw-r--r--editor/editor_plugin.cpp5
-rw-r--r--editor/editor_plugin.h3
-rw-r--r--editor/editor_properties.cpp79
-rw-r--r--editor/editor_properties.h5
-rw-r--r--editor/editor_properties_array_dict.cpp158
-rw-r--r--editor/editor_properties_array_dict.h2
-rw-r--r--editor/editor_property_name_processor.cpp1
-rw-r--r--editor/editor_quick_open.cpp14
-rw-r--r--editor/editor_quick_open.h1
-rw-r--r--editor/editor_resource_picker.cpp117
-rw-r--r--editor/editor_resource_picker.h8
-rw-r--r--editor/editor_run.cpp4
-rw-r--r--editor/editor_settings.cpp7
-rw-r--r--editor/editor_spin_slider.cpp8
-rw-r--r--editor/editor_themes.cpp127
-rw-r--r--editor/editor_title_bar.cpp2
-rw-r--r--editor/editor_title_bar.h2
-rw-r--r--editor/editor_toaster.cpp10
-rw-r--r--editor/editor_zoom_widget.cpp20
-rw-r--r--editor/event_listener_line_edit.cpp36
-rw-r--r--editor/export/editor_export.cpp29
-rw-r--r--editor/export/editor_export_platform.cpp104
-rw-r--r--editor/export/editor_export_platform.h3
-rw-r--r--editor/export/editor_export_plugin.cpp12
-rw-r--r--editor/export/editor_export_plugin.h18
-rw-r--r--editor/export/editor_export_preset.cpp105
-rw-r--r--editor/export/editor_export_preset.h26
-rw-r--r--editor/export/project_export.cpp154
-rw-r--r--editor/export/project_export.h12
-rw-r--r--editor/filesystem_dock.cpp98
-rw-r--r--editor/filesystem_dock.h4
-rw-r--r--editor/icons/BoneMapHumanBody.svg27
-rw-r--r--editor/icons/BoneMapHumanFace.svg2
-rw-r--r--editor/icons/BoneMapHumanLeftHand.svg2
-rw-r--r--editor/icons/BoneMapHumanRightHand.svg2
-rw-r--r--editor/icons/Keyboard.svg2
-rw-r--r--editor/icons/KeyboardError.svg1
-rw-r--r--editor/icons/KeyboardLabel.svg1
-rw-r--r--editor/icons/KeyboardPhysical.svg2
-rw-r--r--editor/icons/UseBlendDisable.svg1
-rw-r--r--editor/icons/UseBlendEnable.svg1
-rw-r--r--editor/import/editor_import_collada.cpp2
-rw-r--r--editor/import/resource_importer_layered_texture.cpp124
-rw-r--r--editor/import/resource_importer_layered_texture.h2
-rw-r--r--editor/import/resource_importer_scene.cpp14
-rw-r--r--editor/import/resource_importer_scene.h18
-rw-r--r--editor/import/resource_importer_texture.cpp130
-rw-r--r--editor/import/scene_import_settings.cpp2
-rw-r--r--editor/input_event_configuration_dialog.cpp156
-rw-r--r--editor/input_event_configuration_dialog.h17
-rw-r--r--editor/inspector_dock.cpp3
-rw-r--r--editor/multi_node_edit.cpp10
-rw-r--r--editor/plugin_config_dialog.cpp4
-rw-r--r--editor/plugin_config_dialog.h2
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp16
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.h2
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp1
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp2
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp33
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp100
-rw-r--r--editor/plugins/animation_state_machine_editor.h22
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp13
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp4
-rw-r--r--editor/plugins/bit_map_editor_plugin.cpp2
-rw-r--r--editor/plugins/bone_map_editor_plugin.cpp12
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp135
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h12
-rw-r--r--editor/plugins/dedicated_server_export_plugin.cpp139
-rw-r--r--editor/plugins/dedicated_server_export_plugin.h58
-rw-r--r--editor/plugins/gradient_editor.cpp183
-rw-r--r--editor/plugins/lightmap_gi_editor_plugin.cpp56
-rw-r--r--editor/plugins/navigation_link_2d_editor_plugin.cpp36
-rw-r--r--editor/plugins/navigation_link_2d_editor_plugin.h4
-rw-r--r--editor/plugins/node_3d_editor_gizmos.cpp68
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp26
-rw-r--r--editor/plugins/node_3d_editor_plugin.h1
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp18
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.h5
-rw-r--r--editor/plugins/script_editor_plugin.cpp6
-rw-r--r--editor/plugins/script_editor_plugin.h3
-rw-r--r--editor/plugins/script_text_editor.cpp8
-rw-r--r--editor/plugins/shader_editor_plugin.cpp44
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.cpp140
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp565
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.h51
-rw-r--r--editor/plugins/text_shader_editor.cpp5
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp43
-rw-r--r--editor/plugins/texture_region_editor_plugin.h5
-rw-r--r--editor/plugins/theme_editor_plugin.cpp10
-rw-r--r--editor/plugins/tiles/tile_atlas_view.cpp41
-rw-r--r--editor/plugins/tiles/tile_atlas_view.h5
-rw-r--r--editor/plugins/tiles/tile_data_editors.cpp109
-rw-r--r--editor/plugins/tiles/tile_data_editors.h4
-rw-r--r--editor/plugins/tiles/tile_map_editor.cpp64
-rw-r--r--editor/plugins/tiles/tile_map_editor.h3
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.cpp81
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.h4
-rw-r--r--editor/plugins/tiles/tile_set_editor.cpp41
-rw-r--r--editor/plugins/tiles/tile_set_editor.h2
-rw-r--r--editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp25
-rw-r--r--editor/plugins/tiles/tile_set_scenes_collection_source_editor.h2
-rw-r--r--editor/plugins/tiles/tiles_editor_plugin.cpp4
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp189
-rw-r--r--editor/plugins/visual_shader_editor_plugin.h11
-rw-r--r--editor/plugins/voxel_gi_editor_plugin.cpp29
-rw-r--r--editor/progress_dialog.cpp11
-rw-r--r--editor/progress_dialog.h2
-rw-r--r--editor/project_converter_3_to_4.cpp420
-rw-r--r--editor/project_converter_3_to_4.h16
-rw-r--r--editor/register_editor_types.cpp2
-rw-r--r--editor/scene_tree_dock.cpp17
-rw-r--r--editor/scene_tree_editor.cpp4
-rw-r--r--editor/translations/af.po2
-rw-r--r--editor/translations/ar.po14
-rw-r--r--editor/translations/az.po2
-rw-r--r--editor/translations/bg.po2
-rw-r--r--editor/translations/bn.po17
-rw-r--r--editor/translations/br.po2
-rw-r--r--editor/translations/ca.po2
-rw-r--r--editor/translations/cs.po524
-rw-r--r--editor/translations/da.po2
-rw-r--r--editor/translations/de.po29
-rw-r--r--editor/translations/editor.pot6
-rw-r--r--editor/translations/el.po356
-rw-r--r--editor/translations/en_Shaw.po2
-rw-r--r--editor/translations/eo.po2
-rw-r--r--editor/translations/es.po65
-rw-r--r--editor/translations/es_AR.po22
-rw-r--r--editor/translations/et.po15
-rw-r--r--editor/translations/eu.po2
-rw-r--r--editor/translations/fa.po63
-rw-r--r--editor/translations/fi.po2
-rw-r--r--editor/translations/fil.po2
-rw-r--r--editor/translations/fr.po605
-rw-r--r--editor/translations/ga.po2
-rw-r--r--editor/translations/gl.po2
-rw-r--r--editor/translations/he.po249
-rw-r--r--editor/translations/hi.po2
-rw-r--r--editor/translations/hr.po11
-rw-r--r--editor/translations/hu.po2
-rw-r--r--editor/translations/id.po12
-rw-r--r--editor/translations/ig.po2
-rw-r--r--editor/translations/is.po2
-rw-r--r--editor/translations/it.po12
-rw-r--r--editor/translations/ja.po453
-rw-r--r--editor/translations/ka.po2
-rw-r--r--editor/translations/km.po2
-rw-r--r--editor/translations/ko.po64
-rw-r--r--editor/translations/lt.po2
-rw-r--r--editor/translations/lv.po2
-rw-r--r--editor/translations/mk.po2
-rw-r--r--editor/translations/ml.po2
-rw-r--r--editor/translations/mr.po2
-rw-r--r--editor/translations/ms.po2
-rw-r--r--editor/translations/nb.po112
-rw-r--r--editor/translations/nl.po2
-rw-r--r--editor/translations/pl.po1014
-rw-r--r--editor/translations/pr.po2
-rw-r--r--editor/translations/pt.po70
-rw-r--r--editor/translations/pt_BR.po97
-rw-r--r--editor/translations/ro.po435
-rw-r--r--editor/translations/ru.po2
-rw-r--r--editor/translations/si.po2
-rw-r--r--editor/translations/sk.po11
-rw-r--r--editor/translations/sl.po2
-rw-r--r--editor/translations/sq.po2
-rw-r--r--editor/translations/sr_Cyrl.po2
-rw-r--r--editor/translations/sr_Latn.po2
-rw-r--r--editor/translations/sv.po54
-rw-r--r--editor/translations/te.po2
-rw-r--r--editor/translations/th.po2
-rw-r--r--editor/translations/tl.po2
-rw-r--r--editor/translations/tr.po2
-rw-r--r--editor/translations/uk.po135
-rw-r--r--editor/translations/ur_PK.po2
-rw-r--r--editor/translations/vi.po2
-rw-r--r--editor/translations/zh_CN.po49
-rw-r--r--editor/translations/zh_HK.po2
-rw-r--r--editor/translations/zh_TW.po110
-rw-r--r--main/main.cpp68
-rwxr-xr-xmisc/scripts/codespell.sh4
-rw-r--r--modules/astcenc/SCsub55
-rw-r--r--modules/astcenc/config.py6
-rw-r--r--modules/astcenc/image_compress_astcenc.cpp290
-rw-r--r--modules/astcenc/image_compress_astcenc.h39
-rw-r--r--modules/astcenc/register_types.cpp48
-rw-r--r--modules/astcenc/register_types.h39
-rw-r--r--modules/basis_universal/register_types.cpp53
-rw-r--r--modules/csg/csg_shape.cpp4
-rw-r--r--modules/cvtt/image_compress_cvtt.cpp2
-rw-r--r--modules/cvtt/image_compress_cvtt.h2
-rw-r--r--modules/enet/doc_classes/ENetConnection.xml12
-rw-r--r--modules/enet/enet_connection.cpp14
-rw-r--r--modules/enet/enet_connection.h4
-rw-r--r--modules/enet/enet_multiplayer_peer.cpp2
-rw-r--r--modules/etcpak/image_compress_etcpak.cpp28
-rw-r--r--modules/etcpak/image_compress_etcpak.h8
-rw-r--r--modules/gdscript/doc_classes/@GDScript.xml17
-rw-r--r--modules/gdscript/doc_classes/GDScript.xml6
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.cpp2
-rw-r--r--modules/gdscript/gdscript.cpp222
-rw-r--r--modules/gdscript/gdscript.h4
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp816
-rw-r--r--modules/gdscript/gdscript_analyzer.h31
-rw-r--r--modules/gdscript/gdscript_byte_codegen.cpp101
-rw-r--r--modules/gdscript/gdscript_byte_codegen.h25
-rw-r--r--modules/gdscript/gdscript_codegen.h6
-rw-r--r--modules/gdscript/gdscript_compiler.cpp61
-rw-r--r--modules/gdscript/gdscript_disassembler.cpp21
-rw-r--r--modules/gdscript/gdscript_editor.cpp3
-rw-r--r--modules/gdscript/gdscript_function.h10
-rw-r--r--modules/gdscript/gdscript_parser.cpp221
-rw-r--r--modules/gdscript/gdscript_parser.h12
-rw-r--r--modules/gdscript/gdscript_tokenizer.cpp62
-rw-r--r--modules/gdscript/gdscript_tokenizer.h7
-rw-r--r--modules/gdscript/gdscript_vm.cpp87
-rw-r--r--modules/gdscript/gdscript_warning.cpp26
-rw-r--r--modules/gdscript/gdscript_warning.h6
-rw-r--r--modules/gdscript/language_server/gdscript_text_document.cpp1
-rw-r--r--modules/gdscript/register_types.cpp5
-rw-r--r--modules/gdscript/tests/gdscript_test_runner.cpp32
-rw-r--r--modules/gdscript/tests/gdscript_test_runner.h4
-rw-r--r--modules/gdscript/tests/gdscript_test_runner_suite.h3
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/annotation_non_constant_parameter.gd6
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/annotation_non_constant_parameter.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/assymetric_assignment_bad.gd3
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/assymetric_assignment_bad.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/cast_enum_bad_enum.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/cast_enum_bad_int.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/enum_class_var_assign_with_wrong_enum_type.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/enum_class_var_init_with_wrong_enum_type.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/enum_function_parameter_wrong_type.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/enum_function_return_wrong_type.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/enum_local_var_assign_outer_with_wrong_enum_type.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/enum_local_var_assign_with_wrong_enum_type.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/enum_local_var_init_with_wrong_enum_type.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/enum_preload_unnamed_assign_to_named.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/enum_unnamed_assign_to_named.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_local_variable.gd3
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_local_variable.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_member_variable.gd5
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_member_variable.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_parameter.gd5
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_parameter.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/invalid_array_index.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/lambda_wrong_return.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/match_with_subscript.gd5
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/match_with_subscript.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/match_with_variable_expression.gd5
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/match_with_variable_expression.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/preload_enum_error.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/typed_array_assign_differently_typed.gd4
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/typed_array_assign_differently_typed.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/typed_array_assignment.gd (renamed from modules/gdscript/tests/scripts/analyzer/typed_array_assignment.gd)0
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/typed_array_assignment.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/typed_array_init_with_unconvertable_in_literal.gd4
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/typed_array_init_with_unconvertable_in_literal.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/typed_array_pass_differently_to_typed.gd7
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/typed_array_pass_differently_to_typed.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/allow_void_function_to_return_void.gd20
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/allow_void_function_to_return_void.out10
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.gd10
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.out1
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/assignments_with_untyped.gd5
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/assignments_with_untyped.out1
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/assymetric_assignment_good.gd16
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/assymetric_assignment_good.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/const_conversions.gd24
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/const_conversions.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/hard_variants.gd32
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/hard_variants.out5
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/return_conversions.gd34
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/return_conversions.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/typed_array_as_default_parameter.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/typed_array_usage.gd204
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/typed_array_usage.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/vararg_call.gd6
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/vararg_call.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/warning_ignore_annotation.gd6
-rw-r--r--modules/gdscript/tests/scripts/analyzer/typed_array_assignment.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/warnings/cast_enum_bad_enum.gd (renamed from modules/gdscript/tests/scripts/analyzer/errors/cast_enum_bad_enum.gd)0
-rw-r--r--modules/gdscript/tests/scripts/analyzer/warnings/cast_enum_bad_enum.out6
-rw-r--r--modules/gdscript/tests/scripts/analyzer/warnings/cast_enum_bad_int.gd (renamed from modules/gdscript/tests/scripts/analyzer/errors/cast_enum_bad_int.gd)0
-rw-r--r--modules/gdscript/tests/scripts/analyzer/warnings/cast_enum_bad_int.out6
-rw-r--r--modules/gdscript/tests/scripts/analyzer/warnings/lambda_unused_arg.out2
-rw-r--r--modules/gdscript/tests/scripts/parser/errors/class_name_after_annotation.gd2
-rw-r--r--modules/gdscript/tests/scripts/parser/errors/class_name_after_annotation.out2
-rw-r--r--modules/gdscript/tests/scripts/parser/errors/identifier_similar_to_keyword.gd3
-rw-r--r--modules/gdscript/tests/scripts/parser/errors/identifier_similar_to_keyword.out2
-rw-r--r--modules/gdscript/tests/scripts/parser/features/arrays_dictionaries_nested_const.gd2
-rw-r--r--modules/gdscript/tests/scripts/parser/features/export_enum.gd15
-rw-r--r--modules/gdscript/tests/scripts/parser/features/export_enum.out7
-rw-r--r--modules/gdscript/tests/scripts/parser/features/export_variable.gd2
-rw-r--r--modules/gdscript/tests/scripts/parser/features/match.gd2
-rw-r--r--modules/gdscript/tests/scripts/parser/features/match.out1
-rw-r--r--modules/gdscript/tests/scripts/parser/features/match_with_variables.gd22
-rw-r--r--modules/gdscript/tests/scripts/parser/features/match_with_variables.out5
-rw-r--r--modules/gdscript/tests/scripts/parser/features/nested_match.gd7
-rw-r--r--modules/gdscript/tests/scripts/parser/features/nested_match.out1
-rw-r--r--modules/gdscript/tests/scripts/parser/features/unicode_identifiers.gd35
-rw-r--r--modules/gdscript/tests/scripts/parser/features/unicode_identifiers.out14
-rw-r--r--modules/gdscript/tests/scripts/parser/warnings/confusable_identifier.gd5
-rw-r--r--modules/gdscript/tests/scripts/parser/warnings/confusable_identifier.out6
-rw-r--r--modules/gdscript/tests/scripts/parser/warnings/enum_assign_int_without_casting.out8
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/constant_array_push_back.gd4
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/constant_array_push_back.out7
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/constant_dictionary_erase.gd4
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/constant_dictionary_erase.out7
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/non_static_method_call_on_native_class.gd6
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/non_static_method_call_on_native_class.out6
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_basic_to_typed.gd4
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_basic_to_typed.out6
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_differently_typed.gd4
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_differently_typed.out6
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_basic_to_typed.gd7
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_basic_to_typed.out6
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_differently_to_typed.gd7
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_differently_to_typed.out6
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/await_on_void.gd2
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.gd10
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.out2
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/does_not_override_temp_values.gd4
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/gdscript.gd4
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/standalone-calls-do-not-write-to-nil.gd10
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/typed_array_init_with_untyped_in_literal.gd6
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/typed_array_init_with_untyped_in_literal.out2
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/use_conversion_assign_with_variant_value.gd2
-rw-r--r--modules/gltf/doc_classes/GLTFDocument.xml1
-rw-r--r--modules/gltf/doc_classes/GLTFState.xml19
-rw-r--r--modules/gltf/editor/editor_scene_importer_blend.cpp8
-rw-r--r--modules/gltf/editor/editor_scene_importer_fbx.cpp2
-rw-r--r--modules/gltf/editor/editor_scene_importer_gltf.cpp26
-rw-r--r--modules/gltf/editor/editor_scene_importer_gltf.h2
-rw-r--r--modules/gltf/gltf_document.cpp267
-rw-r--r--modules/gltf/gltf_document.h12
-rw-r--r--modules/gltf/gltf_state.cpp7
-rw-r--r--modules/gltf/gltf_state.h26
-rw-r--r--modules/mbedtls/dtls_server_mbedtls.cpp20
-rw-r--r--modules/mbedtls/dtls_server_mbedtls.h8
-rw-r--r--modules/mbedtls/packet_peer_mbed_dtls.cpp16
-rw-r--r--modules/mbedtls/packet_peer_mbed_dtls.h4
-rw-r--r--modules/mbedtls/stream_peer_mbedtls.cpp43
-rw-r--r--modules/mbedtls/stream_peer_mbedtls.h4
-rw-r--r--modules/mbedtls/tls_context_mbedtls.cpp47
-rw-r--r--modules/mbedtls/tls_context_mbedtls.h10
-rw-r--r--modules/minimp3/doc_classes/AudioStreamMP3.xml8
-rw-r--r--modules/minimp3/resource_importer_mp3.cpp2
-rw-r--r--modules/mono/csharp_script.cpp68
-rw-r--r--modules/mono/csharp_script.h2
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Bar.cs4
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/EventSignals.cs2
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedFields.cs20
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs20
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Foo.cs2
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Generic.cs6
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Methods.cs2
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/MoreExportedFields.cs2
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Common.cs8
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs2
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotClasses.cs4
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotEnums.cs43
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs4
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalType.cs14
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalUtils.cs36
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MustBeVariantAnalyzer.cs24
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs6
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs33
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs2
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs2
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs4
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs4
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs4
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs2
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs8
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/HotReloadAssemblyWatcher.cs4
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs4
-rw-r--r--modules/mono/editor/bindings_generator.cpp337
-rw-r--r--modules/mono/editor/bindings_generator.h73
-rw-r--r--modules/mono/editor/script_templates/CharacterBody2D/basic_movement.cs8
-rw-r--r--modules/mono/editor/script_templates/CharacterBody3D/basic_movement.cs14
-rw-r--r--modules/mono/editor/script_templates/EditorScenePostImport/basic_import_script.cs2
-rw-r--r--modules/mono/editor/script_templates/EditorScenePostImport/no_comments.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotPlugins/GodotPlugins.csproj1
-rw-r--r--modules/mono/glue/GodotSharp/GodotPlugins/Main.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs (renamed from modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs)372
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs131
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/AssemblyHasScriptsAttribute.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GodotClassNameAttribute.cs24
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/MustBeVariantAttribute.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/RpcAttribute.cs (renamed from modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/RPCAttribute.cs)10
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ScriptPathAttribute.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/SignalAttribute.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ToolAttribute.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs305
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs33
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/GodotSerializationInfo.cs4
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs58
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.cs8
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.generics.cs38
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs442
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs50
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs225
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Dispatcher.cs5
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/DisposablesTracker.cs14
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/GodotObjectExtensions.cs86
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/ObjectExtensions.cs48
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs450
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs (renamed from modules/mono/glue/GodotSharp/GodotSharp/Core/Object.base.cs)26
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.exceptions.cs (renamed from modules/mono/glue/GodotSharp/GodotSharp/Core/Object.exceptions.cs)2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs11
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTaskScheduler.cs7
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs1128
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs112
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropStructs.cs103
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropUtils.cs14
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs44
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs24
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.extended.cs18
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs82
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.generic.cs62
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs87
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs254
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs172
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/RID.cs42
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs97
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2I.cs (renamed from modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs)263
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Rid.cs104
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Signal.cs7
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/SignalAwaiter.cs6
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs131
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs251
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs212
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Variant.cs132
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs196
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs (renamed from modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs)278
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs264
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs (renamed from modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs)342
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs310
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs (renamed from modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4i.cs)360
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj21
-rw-r--r--modules/mono/glue/runtime_interop.cpp41
-rw-r--r--modules/mono/utils/naming_utils.cpp293
-rw-r--r--modules/mono/utils/naming_utils.h (renamed from editor/array_property_edit.h)43
-rw-r--r--modules/multiplayer/editor/replication_editor.cpp2
-rw-r--r--modules/multiplayer/scene_replication_interface.cpp2
-rw-r--r--modules/navigation/editor/navigation_mesh_editor_plugin.cpp30
-rw-r--r--modules/navigation/godot_navigation_server.cpp84
-rw-r--r--modules/navigation/godot_navigation_server.h15
-rw-r--r--modules/navigation/nav_link.cpp8
-rw-r--r--modules/navigation/nav_link.h16
-rw-r--r--modules/navigation/nav_map.cpp65
-rw-r--r--modules/navigation/nav_utils.h2
-rw-r--r--modules/navigation/navigation_mesh_generator.cpp8
-rw-r--r--modules/navigation/rvo_agent.cpp32
-rw-r--r--modules/navigation/rvo_agent.h13
-rw-r--r--modules/noise/doc_classes/Noise.xml4
-rw-r--r--modules/noise/doc_classes/NoiseTexture2D.xml4
-rw-r--r--modules/noise/noise.cpp77
-rw-r--r--modules/noise/noise.h4
-rw-r--r--modules/noise/noise_texture_2d.cpp20
-rw-r--r--modules/noise/noise_texture_2d.h4
-rw-r--r--modules/ogg/ogg_packet_sequence.cpp2
-rw-r--r--modules/openxr/doc_classes/OpenXRAction.xml4
-rw-r--r--modules/openxr/doc_classes/OpenXRInterface.xml21
-rw-r--r--modules/openxr/extensions/openxr_opengl_extension.cpp2
-rw-r--r--modules/openxr/openxr_api.cpp2
-rw-r--r--modules/openxr/openxr_api.h2
-rw-r--r--modules/openxr/openxr_interface.cpp36
-rw-r--r--modules/openxr/openxr_interface.h4
-rw-r--r--modules/openxr/register_types.cpp4
-rw-r--r--modules/raycast/raycast_occlusion_cull.cpp4
-rw-r--r--modules/text_server_adv/text_server_adv.cpp108
-rw-r--r--modules/text_server_adv/text_server_adv.h2
-rw-r--r--modules/text_server_fb/text_server_fb.cpp27
-rw-r--r--modules/theora/doc_classes/VideoStreamTheora.xml15
-rw-r--r--modules/theora/video_stream_theora.cpp31
-rw-r--r--modules/theora/video_stream_theora.h15
-rw-r--r--modules/vorbis/resource_importer_ogg_vorbis.cpp2
-rw-r--r--modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml10
-rw-r--r--modules/websocket/doc_classes/WebSocketPeer.xml5
-rw-r--r--modules/websocket/emws_peer.cpp6
-rw-r--r--modules/websocket/emws_peer.h2
-rw-r--r--modules/websocket/websocket_multiplayer_peer.cpp27
-rw-r--r--modules/websocket/websocket_multiplayer_peer.h8
-rw-r--r--modules/websocket/websocket_peer.cpp2
-rw-r--r--modules/websocket/websocket_peer.h2
-rw-r--r--modules/websocket/wsl_peer.cpp15
-rw-r--r--modules/websocket/wsl_peer.h5
-rw-r--r--modules/webxr/doc_classes/WebXRInterface.xml2
-rw-r--r--modules/webxr/webxr_interface_js.cpp12
-rw-r--r--platform/android/android_input_handler.cpp19
-rw-r--r--platform/android/android_input_handler.h2
-rw-r--r--platform/android/android_keys_utils.cpp38
-rw-r--r--platform/android/android_keys_utils.h3
-rw-r--r--platform/android/audio_driver_opensl.cpp2
-rw-r--r--platform/android/display_server_android.cpp13
-rw-r--r--platform/android/export/export_plugin.cpp41
-rw-r--r--platform/android/export/export_plugin.h3
-rw-r--r--platform/android/export/gradle_export_util.cpp11
-rw-r--r--platform/android/java/app/AndroidManifest.xml9
-rw-r--r--platform/android/java/editor/src/dev/res/values/strings.xml2
-rw-r--r--platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt50
-rw-r--r--platform/android/java/editor/src/main/res/values/strings.xml2
-rw-r--r--platform/android/java/lib/res/values/strings.xml2
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java30
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/Godot.java38
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotHost.java22
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotIO.java1
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotLib.java2
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java10
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java22
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/io/directory/AssetsDirectoryAccess.kt4
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix.java2
-rw-r--r--platform/android/java_godot_lib_jni.cpp4
-rw-r--r--platform/android/java_godot_lib_jni.h2
-rw-r--r--platform/android/java_godot_wrapper.cpp19
-rw-r--r--platform/android/java_godot_wrapper.h4
-rw-r--r--platform/android/os_android.cpp16
-rw-r--r--platform/android/os_android.h3
-rw-r--r--platform/ios/SCsub1
-rw-r--r--platform/ios/detect.py12
-rw-r--r--platform/ios/display_layer.h3
-rw-r--r--platform/ios/display_layer.mm29
-rw-r--r--platform/ios/display_server_ios.h10
-rw-r--r--platform/ios/display_server_ios.mm79
-rw-r--r--platform/ios/export/export_plugin.cpp1
-rw-r--r--platform/ios/godot_view.mm18
-rw-r--r--platform/ios/key_mapping_ios.h (renamed from editor/dictionary_property_edit.h)38
-rw-r--r--platform/ios/key_mapping_ios.mm186
-rw-r--r--platform/ios/keyboard_input_view.mm18
-rw-r--r--platform/ios/view_controller.mm59
-rw-r--r--platform/linuxbsd/SCsub1
-rw-r--r--platform/linuxbsd/crash_handler_linuxbsd.cpp6
-rw-r--r--platform/linuxbsd/dbus-so_wrap.c6
-rw-r--r--platform/linuxbsd/dbus-so_wrap.h6
-rw-r--r--platform/linuxbsd/detect.py68
-rw-r--r--platform/linuxbsd/export/export_plugin.cpp4
-rw-r--r--platform/linuxbsd/fontconfig-so_wrap.c195
-rw-r--r--platform/linuxbsd/fontconfig-so_wrap.h76
-rw-r--r--platform/linuxbsd/libudev-so_wrap.c10
-rw-r--r--platform/linuxbsd/libudev-so_wrap.h10
-rw-r--r--platform/linuxbsd/speechd-so_wrap.c39
-rw-r--r--platform/linuxbsd/speechd-so_wrap.h18
-rw-r--r--platform/linuxbsd/x11/display_server_x11.cpp488
-rw-r--r--platform/linuxbsd/x11/display_server_x11.h28
-rw-r--r--platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.c6
-rw-r--r--platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.h6
-rw-r--r--platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c10
-rw-r--r--platform/linuxbsd/x11/dynwrappers/xext-so_wrap.h10
-rw-r--r--platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c6
-rw-r--r--platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.h6
-rw-r--r--platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.c6
-rw-r--r--platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.h6
-rw-r--r--platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.c10
-rw-r--r--platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.h10
-rw-r--r--platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.c6
-rw-r--r--platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.h6
-rw-r--r--platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.c6
-rw-r--r--platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.h6
-rw-r--r--platform/linuxbsd/x11/key_mapping_x11.cpp3026
-rw-r--r--platform/linuxbsd/x11/key_mapping_x11.h19
-rw-r--r--platform/linuxbsd/xkbcommon-so_wrap.c1015
-rw-r--r--platform/linuxbsd/xkbcommon-so_wrap.h380
-rw-r--r--platform/macos/detect.py3
-rw-r--r--platform/macos/display_server_macos.h5
-rw-r--r--platform/macos/display_server_macos.mm26
-rw-r--r--platform/macos/export/export_plugin.cpp42
-rw-r--r--platform/macos/gl_manager_macos_legacy.h5
-rw-r--r--platform/macos/gl_manager_macos_legacy.mm5
-rw-r--r--platform/macos/godot_application.h1
-rw-r--r--platform/macos/godot_application.mm74
-rw-r--r--platform/macos/godot_content_view.h6
-rw-r--r--platform/macos/godot_content_view.mm164
-rw-r--r--platform/macos/godot_menu_delegate.mm2
-rw-r--r--platform/macos/joypad_macos.cpp2
-rw-r--r--platform/macos/key_mapping_macos.h10
-rw-r--r--platform/macos/key_mapping_macos.mm717
-rw-r--r--platform/web/api/web_tools_editor_plugin.cpp2
-rw-r--r--platform/web/api/web_tools_editor_plugin.h2
-rw-r--r--platform/web/display_server_web.cpp19
-rw-r--r--platform/web/dom_keys.inc56
-rw-r--r--platform/web/export/editor_http_server.h3
-rw-r--r--platform/web/http_client_web.cpp10
-rw-r--r--platform/web/http_client_web.h2
-rw-r--r--platform/windows/display_server_windows.cpp217
-rw-r--r--platform/windows/display_server_windows.h6
-rw-r--r--platform/windows/export/export_plugin.cpp4
-rw-r--r--platform/windows/gl_manager_windows.h1
-rw-r--r--platform/windows/joypad_windows.cpp4
-rw-r--r--platform/windows/key_mapping_windows.cpp788
-rw-r--r--platform/windows/key_mapping_windows.h2
-rw-r--r--platform/windows/os_windows.cpp10
-rw-r--r--scene/2d/animated_sprite_2d.cpp308
-rw-r--r--scene/2d/animated_sprite_2d.h32
-rw-r--r--scene/2d/area_2d.cpp22
-rw-r--r--scene/2d/area_2d.h6
-rw-r--r--scene/2d/audio_listener_2d.cpp4
-rw-r--r--scene/2d/audio_listener_2d.h2
-rw-r--r--scene/2d/audio_stream_player_2d.cpp24
-rw-r--r--scene/2d/audio_stream_player_2d.h2
-rw-r--r--scene/2d/back_buffer_copy.cpp1
-rw-r--r--scene/2d/camera_2d.cpp1
-rw-r--r--scene/2d/collision_object_2d.cpp21
-rw-r--r--scene/2d/collision_object_2d.h7
-rw-r--r--scene/2d/collision_polygon_2d.cpp16
-rw-r--r--scene/2d/collision_shape_2d.cpp1
-rw-r--r--scene/2d/gpu_particles_2d.cpp2
-rw-r--r--scene/2d/joint_2d.cpp1
-rw-r--r--scene/2d/light_2d.cpp2
-rw-r--r--scene/2d/marker_2d.cpp1
-rw-r--r--scene/2d/navigation_agent_2d.cpp40
-rw-r--r--scene/2d/navigation_agent_2d.h10
-rw-r--r--scene/2d/navigation_link_2d.cpp79
-rw-r--r--scene/2d/navigation_link_2d.h17
-rw-r--r--scene/2d/navigation_region_2d.cpp1
-rw-r--r--scene/2d/physics_body_2d.cpp4
-rw-r--r--scene/2d/ray_cast_2d.cpp1
-rw-r--r--scene/2d/remote_transform_2d.cpp1
-rw-r--r--scene/2d/shape_cast_2d.cpp4
-rw-r--r--scene/2d/shape_cast_2d.h2
-rw-r--r--scene/2d/skeleton_2d.cpp4
-rw-r--r--scene/2d/tile_map.cpp86
-rw-r--r--scene/2d/visible_on_screen_notifier_2d.cpp1
-rw-r--r--scene/3d/area_3d.cpp20
-rw-r--r--scene/3d/area_3d.h6
-rw-r--r--scene/3d/audio_stream_player_3d.cpp32
-rw-r--r--scene/3d/audio_stream_player_3d.h2
-rw-r--r--scene/3d/bone_attachment_3d.cpp5
-rw-r--r--scene/3d/camera_3d.cpp4
-rw-r--r--scene/3d/collision_object_3d.cpp38
-rw-r--r--scene/3d/collision_object_3d.h7
-rw-r--r--scene/3d/collision_polygon_3d.cpp12
-rw-r--r--scene/3d/collision_shape_3d.cpp10
-rw-r--r--scene/3d/decal.cpp4
-rw-r--r--scene/3d/label_3d.cpp65
-rw-r--r--scene/3d/label_3d.h18
-rw-r--r--scene/3d/light_3d.cpp13
-rw-r--r--scene/3d/lightmap_gi.cpp21
-rw-r--r--scene/3d/lightmap_gi.h2
-rw-r--r--scene/3d/navigation_agent_3d.cpp40
-rw-r--r--scene/3d/navigation_agent_3d.h10
-rw-r--r--scene/3d/navigation_link_3d.cpp98
-rw-r--r--scene/3d/navigation_link_3d.h17
-rw-r--r--scene/3d/physics_body_3d.cpp17
-rw-r--r--scene/3d/soft_body_3d.cpp13
-rw-r--r--scene/3d/sprite_3d.cpp394
-rw-r--r--scene/3d/sprite_3d.h51
-rw-r--r--scene/3d/visual_instance_3d.cpp12
-rw-r--r--scene/3d/visual_instance_3d.h2
-rw-r--r--scene/3d/voxel_gi.cpp2
-rw-r--r--scene/3d/xr_nodes.cpp37
-rw-r--r--scene/3d/xr_nodes.h9
-rw-r--r--scene/animation/animation_blend_space_1d.cpp180
-rw-r--r--scene/animation/animation_blend_space_1d.h17
-rw-r--r--scene/animation/animation_blend_tree.cpp286
-rw-r--r--scene/animation/animation_blend_tree.h64
-rw-r--r--scene/animation/animation_node_state_machine.cpp171
-rw-r--r--scene/animation/animation_node_state_machine.h27
-rw-r--r--scene/animation/animation_player.cpp366
-rw-r--r--scene/animation/animation_player.h31
-rw-r--r--scene/animation/animation_tree.cpp456
-rw-r--r--scene/animation/animation_tree.h46
-rw-r--r--scene/animation/root_motion_view.cpp3
-rw-r--r--scene/animation/tween.cpp8
-rw-r--r--scene/audio/audio_stream_player.cpp11
-rw-r--r--scene/audio/audio_stream_player.h1
-rw-r--r--scene/gui/base_button.cpp7
-rw-r--r--scene/gui/button.cpp6
-rw-r--r--scene/gui/code_edit.cpp2
-rw-r--r--scene/gui/color_picker.cpp88
-rw-r--r--scene/gui/color_picker.h8
-rw-r--r--scene/gui/control.cpp38
-rw-r--r--scene/gui/control.h10
-rw-r--r--scene/gui/dialogs.cpp4
-rw-r--r--scene/gui/graph_edit.cpp33
-rw-r--r--scene/gui/graph_edit.h5
-rw-r--r--scene/gui/item_list.cpp6
-rw-r--r--scene/gui/item_list.h1
-rw-r--r--scene/gui/line_edit.cpp253
-rw-r--r--scene/gui/line_edit.h6
-rw-r--r--scene/gui/menu_bar.cpp8
-rw-r--r--scene/gui/popup.cpp6
-rw-r--r--scene/gui/popup_menu.cpp6
-rw-r--r--scene/gui/rich_text_label.cpp94
-rw-r--r--scene/gui/rich_text_label.h15
-rw-r--r--scene/gui/scroll_bar.cpp6
-rw-r--r--scene/gui/separator.cpp2
-rw-r--r--scene/gui/slider.cpp6
-rw-r--r--scene/gui/spin_box.cpp2
-rw-r--r--scene/gui/subviewport_container.cpp41
-rw-r--r--scene/gui/subviewport_container.h3
-rw-r--r--scene/gui/text_edit.cpp235
-rw-r--r--scene/gui/text_edit.h7
-rw-r--r--scene/gui/tree.cpp10
-rw-r--r--scene/gui/video_stream_player.cpp7
-rw-r--r--scene/gui/video_stream_player.h1
-rw-r--r--scene/gui/view_panner.cpp84
-rw-r--r--scene/gui/view_panner.h16
-rw-r--r--scene/main/canvas_item.cpp86
-rw-r--r--scene/main/canvas_item.h14
-rw-r--r--scene/main/http_request.cpp21
-rw-r--r--scene/main/http_request.h8
-rw-r--r--scene/main/multiplayer_api.cpp2
-rw-r--r--scene/main/node.cpp30
-rw-r--r--scene/main/node.h1
-rw-r--r--scene/main/viewport.cpp75
-rw-r--r--scene/main/viewport.h2
-rw-r--r--scene/main/window.cpp101
-rw-r--r--scene/main/window.h9
-rw-r--r--scene/register_scene_types.cpp6
-rw-r--r--scene/resources/animation.cpp85
-rw-r--r--scene/resources/animation.h3
-rw-r--r--scene/resources/audio_stream_polyphonic.cpp274
-rw-r--r--scene/resources/audio_stream_polyphonic.h119
-rw-r--r--scene/resources/camera_attributes.cpp4
-rw-r--r--scene/resources/capsule_shape_2d.cpp2
-rw-r--r--scene/resources/circle_shape_2d.cpp1
-rw-r--r--scene/resources/convex_polygon_shape_2d.cpp9
-rw-r--r--scene/resources/default_theme/default_theme.cpp24
-rw-r--r--scene/resources/environment.cpp12
-rw-r--r--scene/resources/font.cpp38
-rw-r--r--scene/resources/font.h8
-rw-r--r--scene/resources/immediate_mesh.cpp20
-rw-r--r--scene/resources/importer_mesh.cpp37
-rw-r--r--scene/resources/material.cpp127
-rw-r--r--scene/resources/material.h8
-rw-r--r--scene/resources/mesh.cpp25
-rw-r--r--scene/resources/mesh.h2
-rw-r--r--scene/resources/mesh_library.cpp3
-rw-r--r--scene/resources/packed_scene.cpp36
-rw-r--r--scene/resources/packed_scene.h2
-rw-r--r--scene/resources/polygon_path_finder.cpp4
-rw-r--r--scene/resources/primitive_meshes.cpp2
-rw-r--r--scene/resources/primitive_meshes.h2
-rw-r--r--scene/resources/rectangle_shape_2d.cpp6
-rw-r--r--scene/resources/resource_format_text.cpp107
-rw-r--r--scene/resources/resource_format_text.h4
-rw-r--r--scene/resources/shader.cpp39
-rw-r--r--scene/resources/shader.h52
-rw-r--r--scene/resources/shader_include.cpp12
-rw-r--r--scene/resources/shader_include.h3
-rw-r--r--scene/resources/skeleton_modification_2d_stackholder.cpp2
-rw-r--r--scene/resources/skeleton_modification_stack_2d.cpp2
-rw-r--r--scene/resources/sprite_frames.cpp6
-rw-r--r--scene/resources/sprite_frames.h8
-rw-r--r--scene/resources/style_box.cpp208
-rw-r--r--scene/resources/style_box.h59
-rw-r--r--scene/resources/surface_tool.cpp74
-rw-r--r--scene/resources/surface_tool.h15
-rw-r--r--scene/resources/text_paragraph.cpp38
-rw-r--r--scene/resources/texture.cpp85
-rw-r--r--scene/resources/texture.h19
-rw-r--r--scene/resources/tile_set.cpp161
-rw-r--r--scene/resources/tile_set.h11
-rw-r--r--scene/resources/video_stream.cpp198
-rw-r--r--scene/resources/video_stream.h76
-rw-r--r--scene/resources/visual_shader.cpp3
-rw-r--r--scene/resources/visual_shader_nodes.cpp498
-rw-r--r--scene/resources/visual_shader_nodes.h14
-rw-r--r--scene/resources/world_2d.cpp18
-rw-r--r--scene/resources/world_2d.h2
-rw-r--r--scene/resources/world_3d.cpp17
-rw-r--r--scene/resources/world_3d.h2
-rw-r--r--scene/resources/world_boundary_shape_2d.cpp7
-rw-r--r--servers/display_server.cpp3
-rw-r--r--servers/navigation_server_2d.cpp55
-rw-r--r--servers/navigation_server_2d.h16
-rw-r--r--servers/navigation_server_3d.cpp20
-rw-r--r--servers/navigation_server_3d.h16
-rw-r--r--servers/physics_2d/godot_area_2d.cpp25
-rw-r--r--servers/physics_2d/godot_area_2d.h10
-rw-r--r--servers/physics_3d/gjk_epa.cpp6
-rw-r--r--servers/physics_3d/godot_area_3d.cpp25
-rw-r--r--servers/physics_3d/godot_area_3d.h10
-rw-r--r--servers/physics_3d/godot_body_pair_3d.cpp14
-rw-r--r--servers/physics_3d/godot_body_pair_3d.h8
-rw-r--r--servers/physics_3d/godot_collision_solver_3d.cpp17
-rw-r--r--servers/physics_3d/godot_collision_solver_3d.h4
-rw-r--r--servers/physics_3d/godot_collision_solver_3d_sat.cpp103
-rw-r--r--servers/physics_3d/godot_physics_server_3d.cpp2
-rw-r--r--servers/physics_3d/godot_physics_server_3d.h2
-rw-r--r--servers/physics_3d/godot_shape_3d.cpp33
-rw-r--r--servers/physics_3d/godot_soft_body_3d.cpp93
-rw-r--r--servers/physics_3d/godot_space_3d.cpp6
-rw-r--r--servers/physics_server_2d.cpp3
-rw-r--r--servers/physics_server_2d.h3
-rw-r--r--servers/physics_server_3d.cpp3
-rw-r--r--servers/physics_server_3d.h3
-rw-r--r--servers/rendering/dummy/storage/mesh_storage.h1
-rw-r--r--servers/rendering/dummy/storage/texture_storage.h1
-rw-r--r--servers/rendering/renderer_canvas_cull.cpp35
-rw-r--r--servers/rendering/renderer_canvas_cull.h2
-rw-r--r--servers/rendering/renderer_rd/cluster_builder_rd.cpp46
-rw-r--r--servers/rendering/renderer_rd/cluster_builder_rd.h95
-rw-r--r--servers/rendering/renderer_rd/environment/gi.cpp14
-rw-r--r--servers/rendering/renderer_rd/environment/sky.cpp27
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp97
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp2
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp51
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp1
-rw-r--r--servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp6
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_render_rd.cpp22
-rw-r--r--servers/rendering/renderer_rd/shader_rd.cpp3
-rw-r--r--servers/rendering/renderer_rd/shaders/effects/ss_effects_downsample.glsl2
-rw-r--r--servers/rendering/renderer_rd/shaders/effects/ssao.glsl8
-rw-r--r--servers/rendering/renderer_rd/shaders/effects/ssao_importance_map.glsl4
-rw-r--r--servers/rendering/renderer_rd/shaders/effects/ssao_interleave.glsl4
-rw-r--r--servers/rendering/renderer_rd/shaders/effects/ssil.glsl6
-rw-r--r--servers/rendering/renderer_rd/shaders/effects/ssil_blur.glsl4
-rw-r--r--servers/rendering/renderer_rd/shaders/effects/ssil_importance_map.glsl4
-rw-r--r--servers/rendering/renderer_rd/shaders/effects/ssil_interleave.glsl4
-rw-r--r--servers/rendering/renderer_rd/shaders/environment/sdfgi_direct_light.glsl10
-rw-r--r--servers/rendering/renderer_rd/shaders/environment/sdfgi_preprocess.glsl26
-rw-r--r--servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl36
-rw-r--r--servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered_inc.glsl7
-rw-r--r--servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl14
-rw-r--r--servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile_inc.glsl7
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl9
-rw-r--r--servers/rendering/renderer_rd/shaders/skeleton.glsl17
-rw-r--r--servers/rendering/renderer_rd/storage_rd/light_storage.cpp17
-rw-r--r--servers/rendering/renderer_rd/storage_rd/light_storage.h2
-rw-r--r--servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp39
-rw-r--r--servers/rendering/renderer_rd/storage_rd/mesh_storage.h10
-rw-r--r--servers/rendering/renderer_rd/storage_rd/particles_storage.cpp8
-rw-r--r--servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp12
-rw-r--r--servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.h4
-rw-r--r--servers/rendering/renderer_rd/storage_rd/texture_storage.cpp29
-rw-r--r--servers/rendering/renderer_rd/storage_rd/texture_storage.h4
-rw-r--r--servers/rendering/renderer_rd/storage_rd/utilities.cpp4
-rw-r--r--servers/rendering/renderer_scene_cull.cpp32
-rw-r--r--servers/rendering/renderer_viewport.cpp16
-rw-r--r--servers/rendering/renderer_viewport.h6
-rw-r--r--servers/rendering/rendering_server_default.h2
-rw-r--r--servers/rendering/shader_compiler.cpp45
-rw-r--r--servers/rendering/shader_compiler.h1
-rw-r--r--servers/rendering/shader_language.cpp77
-rw-r--r--servers/rendering/shader_preprocessor.cpp168
-rw-r--r--servers/rendering/shader_preprocessor.h5
-rw-r--r--servers/rendering/storage/mesh_storage.h1
-rw-r--r--servers/rendering/storage/texture_storage.h1
-rw-r--r--servers/rendering_server.cpp29
-rw-r--r--servers/rendering_server.h12
-rw-r--r--servers/text/text_server_extension.cpp4
-rw-r--r--servers/text/text_server_extension.h4
-rw-r--r--servers/text_server.cpp116
-rw-r--r--servers/text_server.h7
-rw-r--r--servers/xr/xr_positional_tracker.cpp8
-rw-r--r--servers/xr_server.h2
-rw-r--r--tests/core/input/test_input_event_key.h7
-rw-r--r--tests/core/input/test_input_event_mouse.h81
-rw-r--r--tests/core/io/test_file_access.h4
-rw-r--r--tests/core/io/test_image.h5
-rw-r--r--tests/core/math/test_geometry_3d.h8
-rw-r--r--tests/core/math/test_transform_2d.h13
-rw-r--r--tests/core/object/test_class_db.h4
-rw-r--r--tests/core/variant/test_variant.h190
-rw-r--r--tests/scene/test_arraymesh.h21
-rw-r--r--tests/scene/test_code_edit.h2
-rw-r--r--tests/scene/test_primitives.h2
-rw-r--r--tests/test_main.cpp1
-rw-r--r--thirdparty/README.md12
-rw-r--r--thirdparty/astcenc/LICENSE.txt175
-rw-r--r--thirdparty/astcenc/astcenc.h815
-rw-r--r--thirdparty/astcenc/astcenc_averages_and_directions.cpp995
-rw-r--r--thirdparty/astcenc/astcenc_block_sizes.cpp1184
-rw-r--r--thirdparty/astcenc/astcenc_color_quantize.cpp2071
-rw-r--r--thirdparty/astcenc/astcenc_color_unquantize.cpp941
-rw-r--r--thirdparty/astcenc/astcenc_compress_symbolic.cpp1455
-rw-r--r--thirdparty/astcenc/astcenc_compute_variance.cpp472
-rw-r--r--thirdparty/astcenc/astcenc_decompress_symbolic.cpp623
-rw-r--r--thirdparty/astcenc/astcenc_diagnostic_trace.cpp230
-rw-r--r--thirdparty/astcenc/astcenc_diagnostic_trace.h219
-rw-r--r--thirdparty/astcenc/astcenc_entry.cpp1427
-rw-r--r--thirdparty/astcenc/astcenc_find_best_partitioning.cpp780
-rw-r--r--thirdparty/astcenc/astcenc_ideal_endpoints_and_weights.cpp1663
-rw-r--r--thirdparty/astcenc/astcenc_image.cpp558
-rw-r--r--thirdparty/astcenc/astcenc_integer_sequence.cpp739
-rw-r--r--thirdparty/astcenc/astcenc_internal.h2196
-rw-r--r--thirdparty/astcenc/astcenc_internal_entry.h273
-rw-r--r--thirdparty/astcenc/astcenc_mathlib.cpp48
-rw-r--r--thirdparty/astcenc/astcenc_mathlib.h476
-rw-r--r--thirdparty/astcenc/astcenc_mathlib_softfloat.cpp411
-rw-r--r--thirdparty/astcenc/astcenc_partition_tables.cpp481
-rw-r--r--thirdparty/astcenc/astcenc_percentile_tables.cpp1251
-rw-r--r--thirdparty/astcenc/astcenc_pick_best_endpoint_format.cpp1350
-rw-r--r--thirdparty/astcenc/astcenc_platform_isa_detection.cpp166
-rw-r--r--thirdparty/astcenc/astcenc_quantization.cpp904
-rw-r--r--thirdparty/astcenc/astcenc_symbolic_physical.cpp534
-rw-r--r--thirdparty/astcenc/astcenc_vecmathlib.h570
-rw-r--r--thirdparty/astcenc/astcenc_vecmathlib_avx2_8.h1204
-rw-r--r--thirdparty/astcenc/astcenc_vecmathlib_common_4.h423
-rw-r--r--thirdparty/astcenc/astcenc_vecmathlib_neon_4.h1072
-rw-r--r--thirdparty/astcenc/astcenc_vecmathlib_none_4.h1169
-rw-r--r--thirdparty/astcenc/astcenc_vecmathlib_sse_4.h1283
-rw-r--r--thirdparty/astcenc/astcenc_weight_align.cpp479
-rw-r--r--thirdparty/astcenc/astcenc_weight_quant_xfer_tables.cpp147
-rw-r--r--thirdparty/astcenc/patches/fix-build-no-ssse3.patch81
-rw-r--r--thirdparty/enet/enet/godot_ext.h4
-rw-r--r--thirdparty/enet/godot.cpp22
-rw-r--r--thirdparty/linuxbsd_headers/README.md69
-rw-r--r--thirdparty/linuxbsd_headers/X11/X.h717
-rw-r--r--thirdparty/linuxbsd_headers/X11/XF86keysym.h467
-rw-r--r--thirdparty/linuxbsd_headers/X11/XKBlib.h1149
-rw-r--r--thirdparty/linuxbsd_headers/X11/Xatom.h79
-rw-r--r--thirdparty/linuxbsd_headers/X11/Xcursor/Xcursor.h500
-rw-r--r--thirdparty/linuxbsd_headers/X11/Xdefs.h108
-rw-r--r--thirdparty/linuxbsd_headers/X11/Xfuncproto.h229
-rw-r--r--thirdparty/linuxbsd_headers/X11/Xfuncs.h69
-rw-r--r--thirdparty/linuxbsd_headers/X11/Xlib.h4025
-rw-r--r--thirdparty/linuxbsd_headers/X11/Xosdefs.h116
-rw-r--r--thirdparty/linuxbsd_headers/X11/Xutil.h838
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/XI2.h259
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/XInput2.h657
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/XKB.h786
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/XKBstr.h643
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/Xext.h53
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/Xfixes.h279
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/Xge.h57
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/Xinerama.h74
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/Xrandr.h587
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/Xrender.h528
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/randr.h208
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/randrproto.h1152
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/render.h210
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/renderproto.h661
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/shape.h152
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/shapeconst.h55
-rw-r--r--thirdparty/linuxbsd_headers/X11/extensions/xfixeswire.h149
-rw-r--r--thirdparty/linuxbsd_headers/X11/keysym.h74
-rw-r--r--thirdparty/linuxbsd_headers/X11/keysymdef.h2502
-rw-r--r--thirdparty/linuxbsd_headers/alsa/alisp.h55
-rw-r--r--thirdparty/linuxbsd_headers/alsa/asoundef.h310
-rw-r--r--thirdparty/linuxbsd_headers/alsa/asoundlib.h65
-rw-r--r--thirdparty/linuxbsd_headers/alsa/conf.h212
-rw-r--r--thirdparty/linuxbsd_headers/alsa/control.h622
-rw-r--r--thirdparty/linuxbsd_headers/alsa/control_external.h286
-rw-r--r--thirdparty/linuxbsd_headers/alsa/error.h85
-rw-r--r--thirdparty/linuxbsd_headers/alsa/global.h161
-rw-r--r--thirdparty/linuxbsd_headers/alsa/hwdep.h169
-rw-r--r--thirdparty/linuxbsd_headers/alsa/input.h83
-rw-r--r--thirdparty/linuxbsd_headers/alsa/mixer.h317
-rw-r--r--thirdparty/linuxbsd_headers/alsa/mixer_abst.h112
-rw-r--r--thirdparty/linuxbsd_headers/alsa/output.h86
-rw-r--r--thirdparty/linuxbsd_headers/alsa/patches/use-standard-poll-h.diff11
-rw-r--r--thirdparty/linuxbsd_headers/alsa/pcm.h1327
-rw-r--r--thirdparty/linuxbsd_headers/alsa/pcm_external.h70
-rw-r--r--thirdparty/linuxbsd_headers/alsa/pcm_extplug.h206
-rw-r--r--thirdparty/linuxbsd_headers/alsa/pcm_ioplug.h234
-rw-r--r--thirdparty/linuxbsd_headers/alsa/pcm_old.h230
-rw-r--r--thirdparty/linuxbsd_headers/alsa/pcm_plugin.h202
-rw-r--r--thirdparty/linuxbsd_headers/alsa/pcm_rate.h153
-rw-r--r--thirdparty/linuxbsd_headers/alsa/rawmidi.h159
-rw-r--r--thirdparty/linuxbsd_headers/alsa/seq.h739
-rw-r--r--thirdparty/linuxbsd_headers/alsa/seq_event.h325
-rw-r--r--thirdparty/linuxbsd_headers/alsa/seq_midi_event.h65
-rw-r--r--thirdparty/linuxbsd_headers/alsa/seqmid.h490
-rw-r--r--thirdparty/linuxbsd_headers/alsa/sound/asoc.h543
-rw-r--r--thirdparty/linuxbsd_headers/alsa/sound/asound_fm.h134
-rw-r--r--thirdparty/linuxbsd_headers/alsa/sound/emu10k1.h349
-rw-r--r--thirdparty/linuxbsd_headers/alsa/sound/hdsp.h113
-rw-r--r--thirdparty/linuxbsd_headers/alsa/sound/hdspm.h229
-rw-r--r--thirdparty/linuxbsd_headers/alsa/sound/sb16_csp.h115
-rw-r--r--thirdparty/linuxbsd_headers/alsa/sound/sscape_ioctl.h21
-rw-r--r--thirdparty/linuxbsd_headers/alsa/sound/tlv.h100
-rw-r--r--thirdparty/linuxbsd_headers/alsa/sound/type_compat.h42
-rw-r--r--thirdparty/linuxbsd_headers/alsa/timer.h259
-rw-r--r--thirdparty/linuxbsd_headers/alsa/topology.h1096
-rw-r--r--thirdparty/linuxbsd_headers/alsa/use-case.h432
-rw-r--r--thirdparty/linuxbsd_headers/alsa/version.h15
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-address.h86
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-arch-deps.h61
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-bus.h95
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-connection.h526
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-errors.h90
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-macros.h240
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-memory.h73
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-message.h377
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-misc.h59
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-pending-call.h98
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-protocol.h481
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-server.h125
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-shared.h136
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-signature.h95
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-syntax.h58
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-threads.h189
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus-types.h156
-rw-r--r--thirdparty/linuxbsd_headers/dbus/dbus.h104
-rw-r--r--thirdparty/linuxbsd_headers/fontconfig/fcfreetype.h59
-rw-r--r--thirdparty/linuxbsd_headers/fontconfig/fcprivate.h127
-rw-r--r--thirdparty/linuxbsd_headers/fontconfig/fontconfig.h1067
-rw-r--r--thirdparty/linuxbsd_headers/pulse/cdecl.h40
-rw-r--r--thirdparty/linuxbsd_headers/pulse/channelmap.h366
-rw-r--r--thirdparty/linuxbsd_headers/pulse/context.h291
-rw-r--r--thirdparty/linuxbsd_headers/pulse/def.h1052
-rw-r--r--thirdparty/linuxbsd_headers/pulse/direction.h35
-rw-r--r--thirdparty/linuxbsd_headers/pulse/error.h37
-rw-r--r--thirdparty/linuxbsd_headers/pulse/ext-device-manager.h130
-rw-r--r--thirdparty/linuxbsd_headers/pulse/ext-device-restore.h110
-rw-r--r--thirdparty/linuxbsd_headers/pulse/ext-stream-restore.h109
-rw-r--r--thirdparty/linuxbsd_headers/pulse/format.h262
-rw-r--r--thirdparty/linuxbsd_headers/pulse/gccmacro.h132
-rw-r--r--thirdparty/linuxbsd_headers/pulse/glib-mainloop.h67
-rw-r--r--thirdparty/linuxbsd_headers/pulse/introspect.h760
-rw-r--r--thirdparty/linuxbsd_headers/pulse/mainloop-api.h124
-rw-r--r--thirdparty/linuxbsd_headers/pulse/mainloop-signal.h64
-rw-r--r--thirdparty/linuxbsd_headers/pulse/mainloop.h131
-rw-r--r--thirdparty/linuxbsd_headers/pulse/operation.h64
-rw-r--r--thirdparty/linuxbsd_headers/pulse/proplist.h409
-rw-r--r--thirdparty/linuxbsd_headers/pulse/pulseaudio.h180
-rw-r--r--thirdparty/linuxbsd_headers/pulse/rtclock.h38
-rw-r--r--thirdparty/linuxbsd_headers/pulse/sample.h354
-rw-r--r--thirdparty/linuxbsd_headers/pulse/scache.h124
-rw-r--r--thirdparty/linuxbsd_headers/pulse/simple.h159
-rw-r--r--thirdparty/linuxbsd_headers/pulse/stream.h831
-rw-r--r--thirdparty/linuxbsd_headers/pulse/subscribe.h83
-rw-r--r--thirdparty/linuxbsd_headers/pulse/thread-mainloop.h317
-rw-r--r--thirdparty/linuxbsd_headers/pulse/timeval.h87
-rw-r--r--thirdparty/linuxbsd_headers/pulse/utf8.h54
-rw-r--r--thirdparty/linuxbsd_headers/pulse/util.h59
-rw-r--r--thirdparty/linuxbsd_headers/pulse/version.h70
-rw-r--r--thirdparty/linuxbsd_headers/pulse/volume.h436
-rw-r--r--thirdparty/linuxbsd_headers/pulse/xmalloc.h105
-rw-r--r--thirdparty/linuxbsd_headers/speechd/libspeechd.h248
-rw-r--r--thirdparty/linuxbsd_headers/speechd/libspeechd_version.h31
-rw-r--r--thirdparty/linuxbsd_headers/speechd/spd_audio_plugin.h75
-rw-r--r--thirdparty/linuxbsd_headers/speechd/speechd_defines.h34
-rw-r--r--thirdparty/linuxbsd_headers/speechd/speechd_types.h119
-rw-r--r--thirdparty/linuxbsd_headers/udev/libudev.h208
-rw-r--r--thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-compat.h98
-rw-r--r--thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-compose.h500
-rw-r--r--thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-keysyms.h3248
-rw-r--r--thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-names.h45
-rw-r--r--thirdparty/linuxbsd_headers/xkbcommon/xkbcommon.h1954
1357 files changed, 104562 insertions, 19808 deletions
diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml
index 84fdb2180b..bfda7c72f8 100644
--- a/.github/workflows/linux_builds.yml
+++ b/.github/workflows/linux_builds.yml
@@ -82,10 +82,8 @@ jobs:
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
# The actual dependencies
- sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \
- libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev \
- libdbus-1-dev libudev-dev libxi-dev libxrandr-dev yasm xvfb wget unzip \
- llvm libspeechd-dev speech-dispatcher fontconfig libfontconfig-dev
+ sudo apt-get install build-essential pkg-config libgl1-mesa-dev libglu-dev \
+ xvfb wget unzip llvm
- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 820a85c3fc..9f2449546e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -404,7 +404,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
#### Shaders
-- Removed `SCREEN_TEXTURE` and `DEPTH_TEXTURE` in favour of uniform hints `hint_screen_texture` and `hint_depth_texture`.
+- Removed `SCREEN_TEXTURE` and `DEPTH_TEXTURE` in favor of uniform hints `hint_screen_texture` and `hint_depth_texture`.
### Fixed
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt
index 7fe45657bc..8a966dcb05 100644
--- a/COPYRIGHT.txt
+++ b/COPYRIGHT.txt
@@ -141,6 +141,11 @@ Comment: AMD FidelityFX Super Resolution
Copyright: 2021, Advanced Micro Devices, Inc.
License: Expat
+Files: ./thirdparty/astcenc/
+Comment: Arm ASTC Encoder
+Copyright: 2011-2023, Arm Limited
+License: Apache-2.0
+
Files: ./thirdparty/basis_universal/
Comment: Basis Universal
Copyright: 2022, Binomial LLC.
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index de27b6d5ac..b63fbde7a0 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -1069,23 +1069,6 @@ Variant _GLOBAL_DEF(const PropertyInfo &p_info, const Variant &p_default, bool p
return ret;
}
-Vector<String> ProjectSettings::get_optimizer_presets() const {
- List<PropertyInfo> pi;
- ProjectSettings::get_singleton()->get_property_list(&pi);
- Vector<String> names;
-
- for (const PropertyInfo &E : pi) {
- if (!E.name.begins_with("optimizer_presets/")) {
- continue;
- }
- names.push_back(E.name.get_slicec('/', 1));
- }
-
- names.sort();
-
- return names;
-}
-
void ProjectSettings::_add_property_info_bind(const Dictionary &p_info) {
ERR_FAIL_COND(!p_info.has("name"));
ERR_FAIL_COND(!p_info.has("type"));
@@ -1154,7 +1137,7 @@ Array ProjectSettings::get_global_class_list() {
Ref<ConfigFile> cf;
cf.instantiate();
- if (cf->load(get_project_data_path().path_join("global_script_class_cache.cfg")) == OK) {
+ if (cf->load(get_global_class_list_path()) == OK) {
script_classes = cf->get_value("", "list");
} else {
#ifndef TOOLS_ENABLED
@@ -1165,11 +1148,15 @@ Array ProjectSettings::get_global_class_list() {
return script_classes;
}
+String ProjectSettings::get_global_class_list_path() const {
+ return get_project_data_path().path_join("global_script_class_cache.cfg");
+}
+
void ProjectSettings::store_global_class_list(const Array &p_classes) {
Ref<ConfigFile> cf;
cf.instantiate();
cf->set_value("", "list", p_classes);
- cf->save(get_project_data_path().path_join("global_script_class_cache.cfg"));
+ cf->save(get_global_class_list_path());
}
bool ProjectSettings::has_custom_feature(const String &p_feature) const {
@@ -1249,12 +1236,9 @@ ProjectSettings::ProjectSettings() {
singleton = this;
GLOBAL_DEF_BASIC("application/config/name", "");
- GLOBAL_DEF_BASIC("application/config/name_localized", Dictionary());
- custom_prop_info["application/config/name_localized"] = PropertyInfo(Variant::DICTIONARY, "application/config/name_localized", PROPERTY_HINT_LOCALIZABLE_STRING);
- GLOBAL_DEF_BASIC("application/config/description", "");
- custom_prop_info["application/config/description"] = PropertyInfo(Variant::STRING, "application/config/description", PROPERTY_HINT_MULTILINE_TEXT);
- GLOBAL_DEF_BASIC("application/run/main_scene", "");
- custom_prop_info["application/run/main_scene"] = PropertyInfo(Variant::STRING, "application/run/main_scene", PROPERTY_HINT_FILE, "*.tscn,*.scn,*.res");
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::DICTIONARY, "application/config/name_localized", PROPERTY_HINT_LOCALIZABLE_STRING), Dictionary());
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "application/config/description", PROPERTY_HINT_MULTILINE_TEXT), "");
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "application/run/main_scene", PROPERTY_HINT_FILE, "*.tscn,*.scn,*.res"), "");
GLOBAL_DEF("application/run/disable_stdout", false);
GLOBAL_DEF("application/run/disable_stderr", false);
GLOBAL_DEF_RST("application/config/use_hidden_project_data_directory", true);
@@ -1266,22 +1250,15 @@ ProjectSettings::ProjectSettings() {
// - Have a 16:9 aspect ratio,
// - Have both dimensions divisible by 8 to better play along with video recording,
// - Be displayable correctly in windowed mode on a 1366×768 display (tested on Windows 10 with default settings).
- GLOBAL_DEF_BASIC("display/window/size/viewport_width", 1152);
- custom_prop_info["display/window/size/viewport_width"] = PropertyInfo(Variant::INT, "display/window/size/viewport_width", PROPERTY_HINT_RANGE, "0,7680,1,or_greater"); // 8K resolution
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "display/window/size/viewport_width", PROPERTY_HINT_RANGE, "0,7680,1,or_greater"), 1152); // 8K resolution
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "display/window/size/viewport_height", PROPERTY_HINT_RANGE, "0,4320,1,or_greater"), 648); // 8K resolution
- GLOBAL_DEF_BASIC("display/window/size/viewport_height", 648);
- custom_prop_info["display/window/size/viewport_height"] = PropertyInfo(Variant::INT, "display/window/size/viewport_height", PROPERTY_HINT_RANGE, "0,4320,1,or_greater"); // 8K resolution
-
- GLOBAL_DEF_BASIC("display/window/size/mode", 0);
- custom_prop_info["display/window/size/mode"] = PropertyInfo(Variant::INT, "display/window/size/mode", PROPERTY_HINT_ENUM, "Windowed,Minimized,Maximized,Fullscreen,Exclusive Fullscreen");
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "display/window/size/mode", PROPERTY_HINT_ENUM, "Windowed,Minimized,Maximized,Fullscreen,Exclusive Fullscreen"), 0);
// Keep the enum values in sync with the `DisplayServer::SCREEN_` enum.
- GLOBAL_DEF_BASIC("display/window/size/initial_screen", -2);
- String screen_hints = "Primary Monitor:-2"; // Note: Main Window Monitor:-1 is not used for the main window, skip it.
- for (int i = 0; i < 64; i++) {
- screen_hints += ",Monitor " + itos(i + 1) + ":" + itos(i);
- }
- custom_prop_info["display/window/size/initial_screen"] = PropertyInfo(Variant::INT, "display/window/size/initial_screen", PROPERTY_HINT_ENUM, screen_hints);
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "display/window/size/initial_position_type", PROPERTY_HINT_ENUM, "Absolute,Primary Screen Center,Other Screen Center"), 1);
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::VECTOR2I, "display/window/size/initial_position"), Vector2i());
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "display/window/size/initial_screen", PROPERTY_HINT_RANGE, "0,64,1,or_greater"), 0);
GLOBAL_DEF_BASIC("display/window/size/resizable", true);
GLOBAL_DEF_BASIC("display/window/size/borderless", false);
@@ -1290,20 +1267,15 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF("display/window/size/extend_to_title", false);
GLOBAL_DEF("display/window/size/no_focus", false);
- GLOBAL_DEF("display/window/size/window_width_override", 0);
- custom_prop_info["display/window/size/window_width_override"] = PropertyInfo(Variant::INT, "display/window/size/window_width_override", PROPERTY_HINT_RANGE, "0,7680,1,or_greater"); // 8K resolution
- GLOBAL_DEF("display/window/size/window_height_override", 0);
- custom_prop_info["display/window/size/window_height_override"] = PropertyInfo(Variant::INT, "display/window/size/window_height_override", PROPERTY_HINT_RANGE, "0,4320,1,or_greater"); // 8K resolution
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "display/window/size/window_width_override", PROPERTY_HINT_RANGE, "0,7680,1,or_greater"), 0); // 8K resolution
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "display/window/size/window_height_override", PROPERTY_HINT_RANGE, "0,4320,1,or_greater"), 0); // 8K resolution
GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true);
GLOBAL_DEF("display/window/energy_saving/keep_screen_on.editor", false);
- GLOBAL_DEF_BASIC("audio/buses/default_bus_layout", "res://default_bus_layout.tres");
- custom_prop_info["audio/buses/default_bus_layout"] = PropertyInfo(Variant::STRING, "audio/buses/default_bus_layout", PROPERTY_HINT_FILE, "*.tres");
- GLOBAL_DEF_RST("audio/general/2d_panning_strength", 0.5f);
- custom_prop_info["audio/general/2d_panning_strength"] = PropertyInfo(Variant::FLOAT, "audio/general/2d_panning_strength", PROPERTY_HINT_RANGE, "0,2,0.01");
- GLOBAL_DEF_RST("audio/general/3d_panning_strength", 0.5f);
- custom_prop_info["audio/general/3d_panning_strength"] = PropertyInfo(Variant::FLOAT, "audio/general/3d_panning_strength", PROPERTY_HINT_RANGE, "0,2,0.01");
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "audio/buses/default_bus_layout", PROPERTY_HINT_FILE, "*.tres"), "res://default_bus_layout.tres");
+ GLOBAL_DEF_RST(PropertyInfo(Variant::FLOAT, "audio/general/2d_panning_strength", PROPERTY_HINT_RANGE, "0,2,0.01"), 0.5f);
+ GLOBAL_DEF_RST(PropertyInfo(Variant::FLOAT, "audio/general/3d_panning_strength", PROPERTY_HINT_RANGE, "0,2,0.01"), 0.5f);
PackedStringArray extensions;
extensions.push_back("gd");
@@ -1314,11 +1286,13 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF("editor/run/main_run_args", "");
- GLOBAL_DEF("editor/script/search_in_file_extensions", extensions);
- custom_prop_info["editor/script/search_in_file_extensions"] = PropertyInfo(Variant::PACKED_STRING_ARRAY, "editor/script/search_in_file_extensions");
+ GLOBAL_DEF(PropertyInfo(Variant::PACKED_STRING_ARRAY, "editor/script/search_in_file_extensions"), extensions);
- GLOBAL_DEF("editor/script/templates_search_path", "res://script_templates");
- custom_prop_info["editor/script/templates_search_path"] = PropertyInfo(Variant::STRING, "editor/script/templates_search_path", PROPERTY_HINT_DIR);
+ GLOBAL_DEF(PropertyInfo(Variant::STRING, "editor/script/templates_search_path", PROPERTY_HINT_DIR), "res://script_templates");
+
+ // For correct doc generation.
+ GLOBAL_DEF("editor/naming/default_signal_callback_name", "_on_{node_name}_{signal_name}");
+ GLOBAL_DEF("editor/naming/default_signal_callback_to_self_name", "_on_{signal_name}");
_add_builtin_input_map();
@@ -1330,21 +1304,13 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF("physics/2d/run_on_separate_thread", false);
GLOBAL_DEF("physics/3d/run_on_separate_thread", false);
- GLOBAL_DEF("debug/settings/profiler/max_functions", 16384);
- custom_prop_info["debug/settings/profiler/max_functions"] = PropertyInfo(Variant::INT, "debug/settings/profiler/max_functions", PROPERTY_HINT_RANGE, "128,65535,1");
-
- GLOBAL_DEF("compression/formats/zstd/long_distance_matching", Compression::zstd_long_distance_matching);
- custom_prop_info["compression/formats/zstd/long_distance_matching"] = PropertyInfo(Variant::BOOL, "compression/formats/zstd/long_distance_matching");
- GLOBAL_DEF("compression/formats/zstd/compression_level", Compression::zstd_level);
- custom_prop_info["compression/formats/zstd/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/zstd/compression_level", PROPERTY_HINT_RANGE, "1,22,1");
- GLOBAL_DEF("compression/formats/zstd/window_log_size", Compression::zstd_window_log_size);
- custom_prop_info["compression/formats/zstd/window_log_size"] = PropertyInfo(Variant::INT, "compression/formats/zstd/window_log_size", PROPERTY_HINT_RANGE, "10,30,1");
-
- GLOBAL_DEF("compression/formats/zlib/compression_level", Compression::zlib_level);
- custom_prop_info["compression/formats/zlib/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/zlib/compression_level", PROPERTY_HINT_RANGE, "-1,9,1");
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "debug/settings/profiler/max_functions", PROPERTY_HINT_RANGE, "128,65535,1"), 16384);
- GLOBAL_DEF("compression/formats/gzip/compression_level", Compression::gzip_level);
- custom_prop_info["compression/formats/gzip/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/gzip/compression_level", PROPERTY_HINT_RANGE, "-1,9,1");
+ GLOBAL_DEF(PropertyInfo(Variant::BOOL, "compression/formats/zstd/long_distance_matching"), Compression::zstd_long_distance_matching);
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "compression/formats/zstd/compression_level", PROPERTY_HINT_RANGE, "1,22,1"), Compression::zstd_level);
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "compression/formats/zstd/window_log_size", PROPERTY_HINT_RANGE, "10,30,1"), Compression::zstd_window_log_size);
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "compression/formats/zlib/compression_level", PROPERTY_HINT_RANGE, "-1,9,1"), Compression::zlib_level);
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "compression/formats/gzip/compression_level", PROPERTY_HINT_RANGE, "-1,9,1"), Compression::gzip_level);
GLOBAL_DEF("debug/settings/crash_handler/message",
String("Please include this when reporting the bug to the project developer."));
diff --git a/core/config/project_settings.h b/core/config/project_settings.h
index 29c495c46b..70f697741f 100644
--- a/core/config/project_settings.h
+++ b/core/config/project_settings.h
@@ -143,6 +143,7 @@ public:
Variant get_setting(const String &p_setting, const Variant &p_default_value = Variant()) const;
Array get_global_class_list();
void store_global_class_list(const Array &p_classes);
+ String get_global_class_list_path() const;
bool has_setting(String p_var) const;
String localize_path(const String &p_path) const;
@@ -178,8 +179,6 @@ public:
const HashMap<StringName, PropertyInfo> &get_custom_property_info() const;
uint64_t get_last_saved_time() { return last_save_time; }
- Vector<String> get_optimizer_presets() const;
-
List<String> get_input_presets() const { return input_presets; }
Variant get_setting_with_override(const StringName &p_name) const;
diff --git a/core/core_bind.cpp b/core/core_bind.cpp
index 96e1da9dde..c752bdd057 100644
--- a/core/core_bind.cpp
+++ b/core/core_bind.cpp
@@ -717,7 +717,7 @@ TypedArray<PackedVector2Array> Geometry2D::decompose_polygon_in_convex(const Vec
TypedArray<PackedVector2Array> Geometry2D::merge_polygons(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b) {
Vector<Vector<Point2>> polys = ::Geometry2D::merge_polygons(p_polygon_a, p_polygon_b);
- Array ret;
+ TypedArray<PackedVector2Array> ret;
for (int i = 0; i < polys.size(); ++i) {
ret.push_back(polys[i]);
@@ -739,7 +739,7 @@ TypedArray<PackedVector2Array> Geometry2D::clip_polygons(const Vector<Vector2> &
TypedArray<PackedVector2Array> Geometry2D::intersect_polygons(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b) {
Vector<Vector<Point2>> polys = ::Geometry2D::intersect_polygons(p_polygon_a, p_polygon_b);
- Array ret;
+ TypedArray<PackedVector2Array> ret;
for (int i = 0; i < polys.size(); ++i) {
ret.push_back(polys[i]);
@@ -750,7 +750,7 @@ TypedArray<PackedVector2Array> Geometry2D::intersect_polygons(const Vector<Vecto
TypedArray<PackedVector2Array> Geometry2D::exclude_polygons(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b) {
Vector<Vector<Point2>> polys = ::Geometry2D::exclude_polygons(p_polygon_a, p_polygon_b);
- Array ret;
+ TypedArray<PackedVector2Array> ret;
for (int i = 0; i < polys.size(); ++i) {
ret.push_back(polys[i]);
@@ -761,7 +761,7 @@ TypedArray<PackedVector2Array> Geometry2D::exclude_polygons(const Vector<Vector2
TypedArray<PackedVector2Array> Geometry2D::clip_polyline_with_polygon(const Vector<Vector2> &p_polyline, const Vector<Vector2> &p_polygon) {
Vector<Vector<Point2>> polys = ::Geometry2D::clip_polyline_with_polygon(p_polyline, p_polygon);
- Array ret;
+ TypedArray<PackedVector2Array> ret;
for (int i = 0; i < polys.size(); ++i) {
ret.push_back(polys[i]);
@@ -772,7 +772,7 @@ TypedArray<PackedVector2Array> Geometry2D::clip_polyline_with_polygon(const Vect
TypedArray<PackedVector2Array> Geometry2D::intersect_polyline_with_polygon(const Vector<Vector2> &p_polyline, const Vector<Vector2> &p_polygon) {
Vector<Vector<Point2>> polys = ::Geometry2D::intersect_polyline_with_polygon(p_polyline, p_polygon);
- Array ret;
+ TypedArray<PackedVector2Array> ret;
for (int i = 0; i < polys.size(); ++i) {
ret.push_back(polys[i]);
@@ -783,7 +783,7 @@ TypedArray<PackedVector2Array> Geometry2D::intersect_polyline_with_polygon(const
TypedArray<PackedVector2Array> Geometry2D::offset_polygon(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type) {
Vector<Vector<Point2>> polys = ::Geometry2D::offset_polygon(p_polygon, p_delta, ::Geometry2D::PolyJoinType(p_join_type));
- Array ret;
+ TypedArray<PackedVector2Array> ret;
for (int i = 0; i < polys.size(); ++i) {
ret.push_back(polys[i]);
@@ -794,7 +794,7 @@ TypedArray<PackedVector2Array> Geometry2D::offset_polygon(const Vector<Vector2>
TypedArray<PackedVector2Array> Geometry2D::offset_polyline(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type, PolyEndType p_end_type) {
Vector<Vector<Point2>> polys = ::Geometry2D::offset_polyline(p_polygon, p_delta, ::Geometry2D::PolyJoinType(p_join_type), ::Geometry2D::PolyEndType(p_end_type));
- Array ret;
+ TypedArray<PackedVector2Array> ret;
for (int i = 0; i < polys.size(); ++i) {
ret.push_back(polys[i]);
@@ -1105,8 +1105,8 @@ void Semaphore::wait() {
semaphore.wait();
}
-Error Semaphore::try_wait() {
- return semaphore.try_wait() ? OK : ERR_BUSY;
+bool Semaphore::try_wait() {
+ return semaphore.try_wait();
}
void Semaphore::post() {
@@ -1125,7 +1125,7 @@ void Mutex::lock() {
mutex.lock();
}
-Error Mutex::try_lock() {
+bool Mutex::try_lock() {
return mutex.try_lock();
}
diff --git a/core/core_bind.h b/core/core_bind.h
index c0c87fd009..8852463234 100644
--- a/core/core_bind.h
+++ b/core/core_bind.h
@@ -361,7 +361,7 @@ class Mutex : public RefCounted {
public:
void lock();
- Error try_lock();
+ bool try_lock();
void unlock();
};
@@ -373,7 +373,7 @@ class Semaphore : public RefCounted {
public:
void wait();
- Error try_wait();
+ bool try_wait();
void post();
};
diff --git a/core/core_constants.cpp b/core/core_constants.cpp
index edb72f73cb..b1f56539e5 100644
--- a/core/core_constants.cpp
+++ b/core/core_constants.cpp
@@ -274,14 +274,9 @@ void register_global_constants() {
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_7);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_8);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_9);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SUPER_L);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SUPER_R);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MENU);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HYPER_L);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HYPER_R);
+ BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HYPER);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HELP);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DIRECTION_L);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DIRECTION_R);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BACK);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, FORWARD);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, STOP);
@@ -289,11 +284,6 @@ void register_global_constants() {
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, VOLUMEDOWN);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, VOLUMEMUTE);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, VOLUMEUP);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BASSBOOST);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BASSUP);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BASSDOWN);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, TREBLEUP);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, TREBLEDOWN);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIAPLAY);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIASTOP);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIAPREVIOUS);
@@ -392,72 +382,12 @@ void register_global_constants() {
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BAR);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BRACERIGHT);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ASCIITILDE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, NOBREAKSPACE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, EXCLAMDOWN);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CENT);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, STERLING);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CURRENCY);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, YEN);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BROKENBAR);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SECTION);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DIAERESIS);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, COPYRIGHT);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ORDFEMININE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, GUILLEMOTLEFT);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, NOTSIGN);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HYPHEN);
- BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_REGISTERED, KEY_REGISTERED);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MACRON);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DEGREE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PLUSMINUS);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, TWOSUPERIOR);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, THREESUPERIOR);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ACUTE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MU);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PARAGRAPH);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PERIODCENTERED);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CEDILLA);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ONESUPERIOR);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MASCULINE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, GUILLEMOTRIGHT);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ONEQUARTER);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ONEHALF);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, THREEQUARTERS);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, QUESTIONDOWN);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, AGRAVE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, AACUTE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ACIRCUMFLEX);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ATILDE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ADIAERESIS);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ARING);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, AE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CCEDILLA);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, EGRAVE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, EACUTE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ECIRCUMFLEX);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, EDIAERESIS);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, IGRAVE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, IACUTE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ICIRCUMFLEX);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, IDIAERESIS);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ETH);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, NTILDE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, OGRAVE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, OACUTE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, OCIRCUMFLEX);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, OTILDE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ODIAERESIS);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MULTIPLY);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, OOBLIQUE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UGRAVE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UACUTE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UCIRCUMFLEX);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UDIAERESIS);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, YACUTE);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, THORN);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SSHARP);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DIVISION);
- BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, YDIAERESIS);
+ BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, GLOBE);
+ BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KEYBOARD);
+ BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, JIS_EISU);
+ BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, JIS_KANA);
BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(KeyModifierMask, KEY_CODE_MASK, CODE_MASK);
BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(KeyModifierMask, KEY_MODIFIER_MASK, MODIFIER_MASK);
@@ -656,7 +586,8 @@ void register_global_constants() {
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_CLASS_IS_ENUM);
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NIL_IS_VARIANT);
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_ARRAY);
- BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE);
+ BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_ALWAYS_DUPLICATE);
+ BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NEVER_DUPLICATE);
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_HIGH_END_GFX);
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT);
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT);
diff --git a/core/crypto/crypto.cpp b/core/crypto/crypto.cpp
index cbb18a277f..939c1c298f 100644
--- a/core/crypto/crypto.cpp
+++ b/core/crypto/crypto.cpp
@@ -65,6 +65,45 @@ void X509Certificate::_bind_methods() {
ClassDB::bind_method(D_METHOD("load", "path"), &X509Certificate::load);
}
+/// TLSOptions
+
+Ref<TLSOptions> TLSOptions::client(Ref<X509Certificate> p_trusted_chain, const String &p_common_name_override) {
+ Ref<TLSOptions> opts;
+ opts.instantiate();
+ opts->trusted_ca_chain = p_trusted_chain;
+ opts->common_name = p_common_name_override;
+ opts->verify_mode = TLS_VERIFY_FULL;
+ return opts;
+}
+
+Ref<TLSOptions> TLSOptions::client_unsafe(Ref<X509Certificate> p_trusted_chain) {
+ Ref<TLSOptions> opts;
+ opts.instantiate();
+ opts->trusted_ca_chain = p_trusted_chain;
+ if (p_trusted_chain.is_null()) {
+ opts->verify_mode = TLS_VERIFY_NONE;
+ } else {
+ opts->verify_mode = TLS_VERIFY_CERT;
+ }
+ return opts;
+}
+
+Ref<TLSOptions> TLSOptions::server(Ref<CryptoKey> p_own_key, Ref<X509Certificate> p_own_certificate) {
+ Ref<TLSOptions> opts;
+ opts.instantiate();
+ opts->server_mode = true;
+ opts->own_certificate = p_own_certificate;
+ opts->private_key = p_own_key;
+ opts->verify_mode = TLS_VERIFY_NONE;
+ return opts;
+}
+
+void TLSOptions::_bind_methods() {
+ ClassDB::bind_static_method("TLSOptions", D_METHOD("client", "trusted_chain", "common_name_override"), &TLSOptions::client, DEFVAL(Ref<X509Certificate>()), DEFVAL(String()));
+ ClassDB::bind_static_method("TLSOptions", D_METHOD("client_unsafe", "trusted_chain"), &TLSOptions::client_unsafe, DEFVAL(Ref<X509Certificate>()));
+ ClassDB::bind_static_method("TLSOptions", D_METHOD("server", "key", "certificate"), &TLSOptions::server);
+}
+
/// HMACContext
void HMACContext::_bind_methods() {
diff --git a/core/crypto/crypto.h b/core/crypto/crypto.h
index 981f67883c..999fe076d6 100644
--- a/core/crypto/crypto.h
+++ b/core/crypto/crypto.h
@@ -67,6 +67,40 @@ public:
virtual Error save(String p_path) = 0;
};
+class TLSOptions : public RefCounted {
+ GDCLASS(TLSOptions, RefCounted);
+
+public:
+ enum TLSVerifyMode {
+ TLS_VERIFY_NONE = 0,
+ TLS_VERIFY_CERT = 1,
+ TLS_VERIFY_FULL = 2,
+ };
+
+private:
+ bool server_mode = false;
+ String common_name;
+ TLSVerifyMode verify_mode = TLS_VERIFY_FULL;
+ Ref<X509Certificate> trusted_ca_chain;
+ Ref<X509Certificate> own_certificate;
+ Ref<CryptoKey> private_key;
+
+protected:
+ static void _bind_methods();
+
+public:
+ static Ref<TLSOptions> client(Ref<X509Certificate> p_trusted_chain = Ref<X509Certificate>(), const String &p_common_name_override = String());
+ static Ref<TLSOptions> client_unsafe(Ref<X509Certificate> p_trusted_chain);
+ static Ref<TLSOptions> server(Ref<CryptoKey> p_own_key, Ref<X509Certificate> p_own_certificate);
+
+ TLSVerifyMode get_verify_mode() const { return verify_mode; }
+ String get_common_name() const { return common_name; }
+ Ref<X509Certificate> get_trusted_ca_chain() const { return trusted_ca_chain; }
+ Ref<X509Certificate> get_own_certificate() const { return own_certificate; }
+ Ref<CryptoKey> get_private_key() const { return private_key; }
+ bool is_server() const { return server_mode; }
+};
+
class HMACContext : public RefCounted {
GDCLASS(HMACContext, RefCounted);
diff --git a/core/debugger/script_debugger.cpp b/core/debugger/script_debugger.cpp
index 8af1573bff..32725b76c1 100644
--- a/core/debugger/script_debugger.cpp
+++ b/core/debugger/script_debugger.cpp
@@ -73,10 +73,6 @@ bool ScriptDebugger::is_breakpoint(int p_line, const StringName &p_source) const
return breakpoints[p_line].has(p_source);
}
-bool ScriptDebugger::is_breakpoint_line(int p_line) const {
- return breakpoints.has(p_line);
-}
-
String ScriptDebugger::breakpoint_find_source(const String &p_source) const {
return p_source;
}
diff --git a/core/debugger/script_debugger.h b/core/debugger/script_debugger.h
index c7aa90027b..edce089179 100644
--- a/core/debugger/script_debugger.h
+++ b/core/debugger/script_debugger.h
@@ -64,7 +64,6 @@ public:
void insert_breakpoint(int p_line, const StringName &p_source);
void remove_breakpoint(int p_line, const StringName &p_source);
bool is_breakpoint(int p_line, const StringName &p_source) const;
- bool is_breakpoint_line(int p_line) const;
void clear_breakpoints();
const HashMap<int, HashSet<StringName>> &get_breakpoints() const { return breakpoints; }
diff --git a/core/doc_data.cpp b/core/doc_data.cpp
index f90dbe1423..5e09e560d5 100644
--- a/core/doc_data.cpp
+++ b/core/doc_data.cpp
@@ -30,6 +30,14 @@
#include "doc_data.h"
+String DocData::get_default_value_string(const Variant &p_value) {
+ if (p_value.get_type() == Variant::ARRAY) {
+ return Variant(Array(p_value, 0, StringName(), Variant())).get_construct_string().replace("\n", " ");
+ } else {
+ return p_value.get_construct_string().replace("\n", " ");
+ }
+}
+
void DocData::return_doc_from_retinfo(DocData::MethodDoc &p_method, const PropertyInfo &p_retinfo) {
if (p_retinfo.type == Variant::INT && p_retinfo.hint == PROPERTY_HINT_INT_IS_POINTER) {
p_method.return_type = p_retinfo.hint_string;
@@ -105,7 +113,7 @@ void DocData::property_doc_from_scriptmemberinfo(DocData::PropertyDoc &p_propert
p_property.getter = p_memberinfo.getter;
if (p_memberinfo.has_default_value && p_memberinfo.default_value.get_type() != Variant::OBJECT) {
- p_property.default_value = p_memberinfo.default_value.get_construct_string().replace("\n", "");
+ p_property.default_value = get_default_value_string(p_memberinfo.default_value);
}
p_property.overridden = false;
@@ -148,7 +156,7 @@ void DocData::method_doc_from_methodinfo(DocData::MethodDoc &p_method, const Met
int default_arg_index = i - (p_methodinfo.arguments.size() - p_methodinfo.default_arguments.size());
if (default_arg_index >= 0) {
Variant default_arg = p_methodinfo.default_arguments[default_arg_index];
- argument.default_value = default_arg.get_construct_string().replace("\n", "");
+ argument.default_value = get_default_value_string(default_arg);
}
p_method.arguments.push_back(argument);
}
diff --git a/core/doc_data.h b/core/doc_data.h
index 1cf4e4f206..c503a4e0d6 100644
--- a/core/doc_data.h
+++ b/core/doc_data.h
@@ -516,6 +516,8 @@ public:
}
};
+ static String get_default_value_string(const Variant &p_value);
+
static void return_doc_from_retinfo(DocData::MethodDoc &p_method, const PropertyInfo &p_retinfo);
static void argument_doc_from_arginfo(DocData::ArgumentDoc &p_argument, const PropertyInfo &p_arginfo);
static void property_doc_from_scriptmemberinfo(DocData::PropertyDoc &p_property, const ScriptMemberInfo &p_memberinfo);
diff --git a/core/error/error_macros.cpp b/core/error/error_macros.cpp
index ddfee3fc5d..8376c0aaf8 100644
--- a/core/error/error_macros.cpp
+++ b/core/error/error_macros.cpp
@@ -118,11 +118,11 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co
void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const char *p_message, bool p_editor_notify, bool p_fatal) {
String fstr(p_fatal ? "FATAL: " : "");
String err(fstr + "Index " + p_index_str + " = " + itos(p_index) + " is out of bounds (" + p_size_str + " = " + itos(p_size) + ").");
- _err_print_error(p_function, p_file, p_line, err.utf8().get_data(), p_message);
+ _err_print_error(p_function, p_file, p_line, err.utf8().get_data(), p_message, p_editor_notify, ERR_HANDLER_ERROR);
}
void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const String &p_message, bool p_editor_notify, bool p_fatal) {
- _err_print_index_error(p_function, p_file, p_line, p_index, p_size, p_index_str, p_size_str, p_message.utf8().get_data(), p_fatal);
+ _err_print_index_error(p_function, p_file, p_line, p_index, p_size, p_index_str, p_size_str, p_message.utf8().get_data(), p_editor_notify, p_fatal);
}
void _err_flush_stdout() {
diff --git a/core/error/error_macros.h b/core/error/error_macros.h
index 63a2d22416..65804b7796 100644
--- a/core/error/error_macros.h
+++ b/core/error/error_macros.h
@@ -189,12 +189,12 @@ void _err_flush_stdout();
* Ensures an integer index `m_index` is less than `m_size` and greater than or equal to 0.
* If not, the application crashes.
*/
-#define CRASH_BAD_INDEX(m_index, m_size) \
- if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
- _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), "", true); \
- _err_flush_stdout(); \
- GENERATE_TRAP(); \
- } else \
+#define CRASH_BAD_INDEX(m_index, m_size) \
+ if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
+ _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), "", false, true); \
+ _err_flush_stdout(); \
+ GENERATE_TRAP(); \
+ } else \
((void)0)
/**
@@ -204,12 +204,12 @@ void _err_flush_stdout();
* Ensures an integer index `m_index` is less than `m_size` and greater than or equal to 0.
* If not, prints `m_msg` and the application crashes.
*/
-#define CRASH_BAD_INDEX_MSG(m_index, m_size, m_msg) \
- if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
- _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg, true); \
- _err_flush_stdout(); \
- GENERATE_TRAP(); \
- } else \
+#define CRASH_BAD_INDEX_MSG(m_index, m_size, m_msg) \
+ if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
+ _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg, false, true); \
+ _err_flush_stdout(); \
+ GENERATE_TRAP(); \
+ } else \
((void)0)
// Unsigned integer index out of bounds error macros.
@@ -292,12 +292,12 @@ void _err_flush_stdout();
* Ensures an unsigned integer index `m_index` is less than `m_size`.
* If not, the application crashes.
*/
-#define CRASH_BAD_UNSIGNED_INDEX(m_index, m_size) \
- if (unlikely((m_index) >= (m_size))) { \
- _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), "", true); \
- _err_flush_stdout(); \
- GENERATE_TRAP(); \
- } else \
+#define CRASH_BAD_UNSIGNED_INDEX(m_index, m_size) \
+ if (unlikely((m_index) >= (m_size))) { \
+ _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), "", false, true); \
+ _err_flush_stdout(); \
+ GENERATE_TRAP(); \
+ } else \
((void)0)
/**
@@ -307,12 +307,12 @@ void _err_flush_stdout();
* Ensures an unsigned integer index `m_index` is less than `m_size`.
* If not, prints `m_msg` and the application crashes.
*/
-#define CRASH_BAD_UNSIGNED_INDEX_MSG(m_index, m_size, m_msg) \
- if (unlikely((m_index) >= (m_size))) { \
- _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg, true); \
- _err_flush_stdout(); \
- GENERATE_TRAP(); \
- } else \
+#define CRASH_BAD_UNSIGNED_INDEX_MSG(m_index, m_size, m_msg) \
+ if (unlikely((m_index) >= (m_size))) { \
+ _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg, false, true); \
+ _err_flush_stdout(); \
+ GENERATE_TRAP(); \
+ } else \
((void)0)
// Null reference error macros.
diff --git a/core/extension/extension_api_dump.cpp b/core/extension/extension_api_dump.cpp
index 7be14b741d..e26ead6d8c 100644
--- a/core/extension/extension_api_dump.cpp
+++ b/core/extension/extension_api_dump.cpp
@@ -82,6 +82,11 @@ static String get_property_info_type_name(const PropertyInfo &p_info) {
return get_builtin_or_variant_type_name(p_info.type);
}
+static String get_type_meta_name(const GodotTypeInfo::Metadata metadata) {
+ static const char *argmeta[11] = { "none", "int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64", "float", "double" };
+ return argmeta[metadata];
+}
+
Dictionary GDExtensionAPIDump::generate_extension_api() {
Dictionary api_dump;
@@ -840,6 +845,10 @@ Dictionary GDExtensionAPIDump::generate_extension_api() {
d3["type"] = get_property_info_type_name(pinfo);
+ if (mi.get_argument_meta(i) > 0) {
+ d3["meta"] = get_type_meta_name((GodotTypeInfo::Metadata)mi.get_argument_meta(i));
+ }
+
if (i == -1) {
d2["return_value"] = d3;
} else {
@@ -884,8 +893,7 @@ Dictionary GDExtensionAPIDump::generate_extension_api() {
d3["type"] = get_property_info_type_name(pinfo);
if (method->get_argument_meta(i) > 0) {
- static const char *argmeta[11] = { "none", "int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64", "float", "double" };
- d3["meta"] = argmeta[method->get_argument_meta(i)];
+ d3["meta"] = get_type_meta_name(method->get_argument_meta(i));
}
if (i >= 0 && i >= (method->get_argument_count() - default_args.size())) {
@@ -929,6 +937,9 @@ Dictionary GDExtensionAPIDump::generate_extension_api() {
Dictionary d3;
d3["name"] = F.arguments[i].name;
d3["type"] = get_property_info_type_name(F.arguments[i]);
+ if (F.get_argument_meta(i) > 0) {
+ d3["meta"] = get_type_meta_name((GodotTypeInfo::Metadata)F.get_argument_meta(i));
+ }
arguments.push_back(d3);
}
if (arguments.size()) {
diff --git a/core/extension/gdextension_interface.cpp b/core/extension/gdextension_interface.cpp
index 4df3df160f..3bea013fab 100644
--- a/core/extension/gdextension_interface.cpp
+++ b/core/extension/gdextension_interface.cpp
@@ -722,16 +722,16 @@ static uint64_t gdextension_file_access_get_buffer(GDExtensionConstObjectPtr p_i
return fa->get_buffer(p_dst, p_length);
}
-static int64_t gdextension_worker_thread_pool_add_native_group_task(GDExtensionObjectPtr p_instance, void (*p_func)(void *, uint32_t), void *p_userdata, int p_elements, int p_tasks, bool p_high_priority, GDExtensionConstStringPtr p_description) {
+static int64_t gdextension_worker_thread_pool_add_native_group_task(GDExtensionObjectPtr p_instance, void (*p_func)(void *, uint32_t), void *p_userdata, int p_elements, int p_tasks, GDExtensionBool p_high_priority, GDExtensionConstStringPtr p_description) {
WorkerThreadPool *p = (WorkerThreadPool *)p_instance;
const String *description = (const String *)p_description;
- return (int64_t)p->add_native_group_task(p_func, p_userdata, p_elements, p_tasks, p_high_priority, *description);
+ return (int64_t)p->add_native_group_task(p_func, p_userdata, p_elements, p_tasks, static_cast<bool>(p_high_priority), *description);
}
-static int64_t gdextension_worker_thread_pool_add_native_task(GDExtensionObjectPtr p_instance, void (*p_func)(void *), void *p_userdata, bool p_high_priority, GDExtensionConstStringPtr p_description) {
+static int64_t gdextension_worker_thread_pool_add_native_task(GDExtensionObjectPtr p_instance, void (*p_func)(void *), void *p_userdata, GDExtensionBool p_high_priority, GDExtensionConstStringPtr p_description) {
WorkerThreadPool *p = (WorkerThreadPool *)p_instance;
const String *description = (const String *)p_description;
- return (int64_t)p->add_native_task(p_func, p_userdata, p_high_priority, *description);
+ return (int64_t)p->add_native_task(p_func, p_userdata, static_cast<bool>(p_high_priority), *description);
}
/* Packed array functions */
@@ -856,6 +856,19 @@ static GDExtensionVariantPtr gdextension_array_operator_index_const(GDExtensionC
return (GDExtensionVariantPtr)&self->operator[](p_index);
}
+void gdextension_array_ref(GDExtensionTypePtr p_self, GDExtensionConstTypePtr p_from) {
+ Array *self = (Array *)p_self;
+ const Array *from = (const Array *)p_from;
+ self->_ref(*from);
+}
+
+void gdextension_array_set_typed(GDExtensionTypePtr p_self, uint32_t p_type, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstVariantPtr p_script) {
+ Array *self = reinterpret_cast<Array *>(p_self);
+ const StringName *class_name = reinterpret_cast<const StringName *>(p_class_name);
+ const Variant *script = reinterpret_cast<const Variant *>(p_script);
+ self->set_typed(p_type, *class_name, *script);
+}
+
/* Dictionary functions */
static GDExtensionVariantPtr gdextension_dictionary_operator_index(GDExtensionTypePtr p_self, GDExtensionConstVariantPtr p_key) {
@@ -1129,6 +1142,8 @@ void gdextension_setup_interface(GDExtensionInterface *p_interface) {
gde_interface.array_operator_index = gdextension_array_operator_index;
gde_interface.array_operator_index_const = gdextension_array_operator_index_const;
+ gde_interface.array_ref = gdextension_array_ref;
+ gde_interface.array_set_typed = gdextension_array_set_typed;
/* Dictionary functions */
diff --git a/core/extension/gdextension_interface.h b/core/extension/gdextension_interface.h
index a16eef2fcf..876a09beff 100644
--- a/core/extension/gdextension_interface.h
+++ b/core/extension/gdextension_interface.h
@@ -520,8 +520,8 @@ typedef struct {
/* WorkerThreadPool extra utilities */
- int64_t (*worker_thread_pool_add_native_group_task)(GDExtensionObjectPtr p_instance, void (*p_func)(void *, uint32_t), void *p_userdata, int p_elements, int p_tasks, bool p_high_priority, GDExtensionConstStringPtr p_description);
- int64_t (*worker_thread_pool_add_native_task)(GDExtensionObjectPtr p_instance, void (*p_func)(void *), void *p_userdata, bool p_high_priority, GDExtensionConstStringPtr p_description);
+ int64_t (*worker_thread_pool_add_native_group_task)(GDExtensionObjectPtr p_instance, void (*p_func)(void *, uint32_t), void *p_userdata, int p_elements, int p_tasks, GDExtensionBool p_high_priority, GDExtensionConstStringPtr p_description);
+ int64_t (*worker_thread_pool_add_native_task)(GDExtensionObjectPtr p_instance, void (*p_func)(void *), void *p_userdata, GDExtensionBool p_high_priority, GDExtensionConstStringPtr p_description);
/* Packed array functions */
@@ -551,6 +551,8 @@ typedef struct {
GDExtensionVariantPtr (*array_operator_index)(GDExtensionTypePtr p_self, GDExtensionInt p_index); // p_self should be an Array ptr
GDExtensionVariantPtr (*array_operator_index_const)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); // p_self should be an Array ptr
+ void (*array_ref)(GDExtensionTypePtr p_self, GDExtensionConstTypePtr p_from); // p_self should be an Array ptr
+ void (*array_set_typed)(GDExtensionTypePtr p_self, uint32_t p_type, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstVariantPtr p_script); // p_self should be an Array ptr
/* Dictionary functions */
diff --git a/core/input/input.cpp b/core/input/input.cpp
index 1846692bec..aa89facdd7 100644
--- a/core/input/input.cpp
+++ b/core/input/input.cpp
@@ -93,6 +93,7 @@ void Input::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_anything_pressed"), &Input::is_anything_pressed);
ClassDB::bind_method(D_METHOD("is_key_pressed", "keycode"), &Input::is_key_pressed);
ClassDB::bind_method(D_METHOD("is_physical_key_pressed", "keycode"), &Input::is_physical_key_pressed);
+ ClassDB::bind_method(D_METHOD("is_key_label_pressed", "keycode"), &Input::is_key_label_pressed);
ClassDB::bind_method(D_METHOD("is_mouse_button_pressed", "button"), &Input::is_mouse_button_pressed);
ClassDB::bind_method(D_METHOD("is_joy_button_pressed", "device", "button"), &Input::is_joy_button_pressed);
ClassDB::bind_method(D_METHOD("is_action_pressed", "action", "exact_match"), &Input::is_action_pressed, DEFVAL(false));
@@ -250,6 +251,11 @@ bool Input::is_physical_key_pressed(Key p_keycode) const {
return physical_keys_pressed.has(p_keycode);
}
+bool Input::is_key_label_pressed(Key p_keycode) const {
+ _THREAD_SAFE_METHOD_
+ return key_label_pressed.has(p_keycode);
+}
+
bool Input::is_mouse_button_pressed(MouseButton p_button) const {
_THREAD_SAFE_METHOD_
return mouse_button_mask.has_flag(mouse_button_to_mask(p_button));
@@ -343,8 +349,8 @@ float Input::get_axis(const StringName &p_negative_action, const StringName &p_p
Vector2 Input::get_vector(const StringName &p_negative_x, const StringName &p_positive_x, const StringName &p_negative_y, const StringName &p_positive_y, float p_deadzone) const {
Vector2 vector = Vector2(
- get_action_raw_strength(p_positive_x) - get_action_raw_strength(p_negative_x),
- get_action_raw_strength(p_positive_y) - get_action_raw_strength(p_negative_y));
+ get_action_strength(p_positive_x) - get_action_strength(p_negative_x),
+ get_action_strength(p_positive_y) - get_action_strength(p_negative_y));
if (p_deadzone < 0.0f) {
// If the deadzone isn't specified, get it from the average of the actions.
@@ -499,6 +505,13 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em
physical_keys_pressed.erase(k->get_physical_keycode());
}
}
+ if (k.is_valid() && !k->is_echo() && k->get_key_label() != Key::NONE) {
+ if (k->is_pressed()) {
+ key_label_pressed.insert(k->get_key_label());
+ } else {
+ key_label_pressed.erase(k->get_key_label());
+ }
+ }
Ref<InputEventMouseButton> mb = p_event;
@@ -944,6 +957,7 @@ void Input::release_pressed_events() {
keys_pressed.clear();
physical_keys_pressed.clear();
+ key_label_pressed.clear();
joy_buttons_pressed.clear();
_joy_axis.clear();
diff --git a/core/input/input.h b/core/input/input.h
index 7ccdd0017d..c254650ef8 100644
--- a/core/input/input.h
+++ b/core/input/input.h
@@ -84,6 +84,7 @@ public:
private:
BitField<MouseButtonMask> mouse_button_mask;
+ RBSet<Key> key_label_pressed;
RBSet<Key> physical_keys_pressed;
RBSet<Key> keys_pressed;
RBSet<JoyButton> joy_buttons_pressed;
@@ -251,6 +252,7 @@ public:
bool is_anything_pressed() const;
bool is_key_pressed(Key p_keycode) const;
bool is_physical_key_pressed(Key p_keycode) const;
+ bool is_key_label_pressed(Key p_keycode) const;
bool is_mouse_button_pressed(MouseButton p_button) const;
bool is_joy_button_pressed(int p_device, JoyButton p_button) const;
bool is_action_pressed(const StringName &p_action, bool p_exact = false) const;
diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp
index 0dd7fdc19b..5a9ec74184 100644
--- a/core/input/input_event.cpp
+++ b/core/input/input_event.cpp
@@ -285,6 +285,8 @@ void InputEventWithModifiers::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_meta_pressed", "pressed"), &InputEventWithModifiers::set_meta_pressed);
ClassDB::bind_method(D_METHOD("is_meta_pressed"), &InputEventWithModifiers::is_meta_pressed);
+ ClassDB::bind_method(D_METHOD("get_modifiers_mask"), &InputEventWithModifiers::get_modifiers_mask);
+
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "command_or_control_autoremap"), "set_command_or_control_autoremap", "is_command_or_control_autoremap");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "alt_pressed"), "set_alt_pressed", "is_alt_pressed");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shift_pressed"), "set_shift_pressed", "is_shift_pressed");
@@ -328,6 +330,15 @@ Key InputEventKey::get_keycode() const {
return keycode;
}
+void InputEventKey::set_key_label(Key p_key_label) {
+ key_label = p_key_label;
+ emit_changed();
+}
+
+Key InputEventKey::get_key_label() const {
+ return key_label;
+}
+
void InputEventKey::set_physical_keycode(Key p_keycode) {
physical_keycode = p_keycode;
emit_changed();
@@ -363,13 +374,72 @@ Key InputEventKey::get_physical_keycode_with_modifiers() const {
return physical_keycode | (int64_t)get_modifiers_mask();
}
+Key InputEventKey::get_key_label_with_modifiers() const {
+ return key_label | get_modifiers_mask();
+}
+
+String InputEventKey::as_text_physical_keycode() const {
+ String kc;
+
+ if (physical_keycode != Key::NONE) {
+ kc = keycode_get_string(physical_keycode);
+ } else {
+ kc = "(" + RTR("Unset") + ")";
+ }
+
+ if (kc.is_empty()) {
+ return kc;
+ }
+
+ String mods_text = InputEventWithModifiers::as_text();
+ return mods_text.is_empty() ? kc : mods_text + "+" + kc;
+}
+
+String InputEventKey::as_text_keycode() const {
+ String kc;
+
+ if (keycode != Key::NONE) {
+ kc = keycode_get_string(keycode);
+ } else {
+ kc = "(" + RTR("Unset") + ")";
+ }
+
+ if (kc.is_empty()) {
+ return kc;
+ }
+
+ String mods_text = InputEventWithModifiers::as_text();
+ return mods_text.is_empty() ? kc : mods_text + "+" + kc;
+}
+
+String InputEventKey::as_text_key_label() const {
+ String kc;
+
+ if (key_label != Key::NONE) {
+ kc = keycode_get_string(key_label);
+ } else {
+ kc = "(" + RTR("Unset") + ")";
+ }
+
+ if (kc.is_empty()) {
+ return kc;
+ }
+
+ String mods_text = InputEventWithModifiers::as_text();
+ return mods_text.is_empty() ? kc : mods_text + "+" + kc;
+}
+
String InputEventKey::as_text() const {
String kc;
- if (keycode == Key::NONE) {
+ if (keycode == Key::NONE && physical_keycode == Key::NONE && key_label != Key::NONE) {
+ kc = keycode_get_string(key_label) + " (Unicode)";
+ } else if (keycode != Key::NONE) {
+ kc = keycode_get_string(keycode);
+ } else if (physical_keycode != Key::NONE) {
kc = keycode_get_string(physical_keycode) + " (" + RTR("Physical") + ")";
} else {
- kc = keycode_get_string(keycode);
+ kc = "(" + RTR("Unset") + ")";
}
if (kc.is_empty()) {
@@ -386,11 +456,16 @@ String InputEventKey::to_string() {
String kc = "";
String physical = "false";
- if (keycode == Key::NONE) {
+
+ if (keycode == Key::NONE && physical_keycode == Key::NONE && unicode != 0) {
+ kc = "U+" + String::num_uint64(unicode, 16) + " (" + String::chr(unicode) + ")";
+ } else if (keycode != Key::NONE) {
+ kc = itos((int64_t)keycode) + " (" + keycode_get_string(keycode) + ")";
+ } else if (physical_keycode != Key::NONE) {
kc = itos((int64_t)physical_keycode) + " (" + keycode_get_string(physical_keycode) + ")";
physical = "true";
} else {
- kc = itos((int64_t)keycode) + " (" + keycode_get_string(keycode) + ")";
+ kc = "(" + RTR("Unset") + ")";
}
String mods = InputEventWithModifiers::as_text();
@@ -435,11 +510,16 @@ bool InputEventKey::action_match(const Ref<InputEvent> &p_event, bool p_exact_ma
}
bool match;
- if (keycode != Key::NONE) {
+ if (keycode == Key::NONE && physical_keycode == Key::NONE && key_label != Key::NONE) {
+ match = key_label == key->key_label;
+ } else if (keycode != Key::NONE) {
match = keycode == key->keycode;
+ } else if (physical_keycode != Key::NONE) {
+ match = physical_keycode == key->physical_keycode;
} else {
- match = get_physical_keycode() == key->get_physical_keycode();
+ match = false;
}
+
Key action_mask = (Key)(int64_t)get_modifiers_mask();
Key key_mask = (Key)(int64_t)key->get_modifiers_mask();
if (key->is_pressed()) {
@@ -470,12 +550,17 @@ bool InputEventKey::is_match(const Ref<InputEvent> &p_event, bool p_exact_match)
return false;
}
- if (keycode == Key::NONE) {
- return physical_keycode == key->physical_keycode &&
+ if (keycode == Key::NONE && physical_keycode == Key::NONE && key_label != Key::NONE) {
+ return (key_label == key->key_label) &&
(!p_exact_match || get_modifiers_mask() == key->get_modifiers_mask());
- } else {
- return keycode == key->keycode &&
+ } else if (keycode != Key::NONE) {
+ return (keycode == key->keycode) &&
(!p_exact_match || get_modifiers_mask() == key->get_modifiers_mask());
+ } else if (physical_keycode != Key::NONE) {
+ return (physical_keycode == key->physical_keycode) &&
+ (!p_exact_match || get_modifiers_mask() == key->get_modifiers_mask());
+ } else {
+ return false;
}
}
@@ -488,6 +573,9 @@ void InputEventKey::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_physical_keycode", "physical_keycode"), &InputEventKey::set_physical_keycode);
ClassDB::bind_method(D_METHOD("get_physical_keycode"), &InputEventKey::get_physical_keycode);
+ ClassDB::bind_method(D_METHOD("set_key_label", "key_label"), &InputEventKey::set_key_label);
+ ClassDB::bind_method(D_METHOD("get_key_label"), &InputEventKey::get_key_label);
+
ClassDB::bind_method(D_METHOD("set_unicode", "unicode"), &InputEventKey::set_unicode);
ClassDB::bind_method(D_METHOD("get_unicode"), &InputEventKey::get_unicode);
@@ -495,10 +583,16 @@ void InputEventKey::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_keycode_with_modifiers"), &InputEventKey::get_keycode_with_modifiers);
ClassDB::bind_method(D_METHOD("get_physical_keycode_with_modifiers"), &InputEventKey::get_physical_keycode_with_modifiers);
+ ClassDB::bind_method(D_METHOD("get_key_label_with_modifiers"), &InputEventKey::get_key_label_with_modifiers);
+
+ ClassDB::bind_method(D_METHOD("as_text_keycode"), &InputEventKey::as_text_keycode);
+ ClassDB::bind_method(D_METHOD("as_text_physical_keycode"), &InputEventKey::as_text_physical_keycode);
+ ClassDB::bind_method(D_METHOD("as_text_key_label"), &InputEventKey::as_text_key_label);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
ADD_PROPERTY(PropertyInfo(Variant::INT, "keycode"), "set_keycode", "get_keycode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "physical_keycode"), "set_physical_keycode", "get_physical_keycode");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "key_label"), "set_key_label", "get_key_label");
ADD_PROPERTY(PropertyInfo(Variant::INT, "unicode"), "set_unicode", "get_unicode");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "echo"), "set_echo", "is_echo");
}
@@ -1405,7 +1499,18 @@ bool InputEventAction::action_match(const Ref<InputEvent> &p_event, bool p_exact
}
String InputEventAction::as_text() const {
- return vformat(RTR("Input Action %s was %s"), action, pressed ? "pressed" : "released");
+ const List<Ref<InputEvent>> *events = InputMap::get_singleton()->action_get_events(action);
+ if (!events) {
+ return String();
+ }
+
+ for (const Ref<InputEvent> &E : *events) {
+ if (E.is_valid()) {
+ return E->as_text();
+ }
+ }
+
+ return String();
}
String InputEventAction::to_string() {
diff --git a/core/input/input_event.h b/core/input/input_event.h
index 2d7a72e327..797761b208 100644
--- a/core/input/input_event.h
+++ b/core/input/input_event.h
@@ -153,6 +153,7 @@ class InputEventKey : public InputEventWithModifiers {
Key keycode = Key::NONE; // Key enum, without modifier masks.
Key physical_keycode = Key::NONE;
+ Key key_label = Key::NONE;
uint32_t unicode = 0; ///unicode
bool echo = false; /// true if this is an echo key
@@ -170,6 +171,9 @@ public:
void set_physical_keycode(Key p_keycode);
Key get_physical_keycode() const;
+ void set_key_label(Key p_key_label);
+ Key get_key_label() const;
+
void set_unicode(char32_t p_unicode);
char32_t get_unicode() const;
@@ -178,12 +182,16 @@ public:
Key get_keycode_with_modifiers() const;
Key get_physical_keycode_with_modifiers() const;
+ Key get_key_label_with_modifiers() const;
virtual bool action_match(const Ref<InputEvent> &p_event, bool p_exact_match, float p_deadzone, bool *r_pressed, float *r_strength, float *r_raw_strength) const override;
virtual bool is_match(const Ref<InputEvent> &p_event, bool p_exact_match = true) const override;
virtual bool is_action_type() const override { return true; }
+ virtual String as_text_physical_keycode() const;
+ virtual String as_text_keycode() const;
+ virtual String as_text_key_label() const;
virtual String as_text() const override;
virtual String to_string() override;
diff --git a/core/io/dtls_server.cpp b/core/io/dtls_server.cpp
index c542e394a1..07d62d3a8d 100644
--- a/core/io/dtls_server.cpp
+++ b/core/io/dtls_server.cpp
@@ -48,6 +48,6 @@ bool DTLSServer::is_available() {
}
void DTLSServer::_bind_methods() {
- ClassDB::bind_method(D_METHOD("setup", "key", "certificate", "chain"), &DTLSServer::setup, DEFVAL(Ref<X509Certificate>()));
+ ClassDB::bind_method(D_METHOD("setup", "server_options"), &DTLSServer::setup);
ClassDB::bind_method(D_METHOD("take_connection", "udp_peer"), &DTLSServer::take_connection);
}
diff --git a/core/io/dtls_server.h b/core/io/dtls_server.h
index e749e6968b..f3fbde3c15 100644
--- a/core/io/dtls_server.h
+++ b/core/io/dtls_server.h
@@ -47,7 +47,7 @@ public:
static bool is_available();
static DTLSServer *create();
- virtual Error setup(Ref<CryptoKey> p_key, Ref<X509Certificate> p_cert, Ref<X509Certificate> p_ca_chain = Ref<X509Certificate>()) = 0;
+ virtual Error setup(Ref<TLSOptions> p_options) = 0;
virtual void stop() = 0;
virtual Ref<PacketPeerDTLS> take_connection(Ref<PacketPeerUDP> p_peer) = 0;
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 829abdc614..190edbfb82 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -138,7 +138,7 @@ PackedStringArray HTTPClient::_get_response_headers() {
}
void HTTPClient::_bind_methods() {
- ClassDB::bind_method(D_METHOD("connect_to_host", "host", "port", "use_tls", "verify_host"), &HTTPClient::connect_to_host, DEFVAL(-1), DEFVAL(false), DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("connect_to_host", "host", "port", "tls_options"), &HTTPClient::connect_to_host, DEFVAL(-1), DEFVAL(Ref<TLSOptions>()));
ClassDB::bind_method(D_METHOD("set_connection", "connection"), &HTTPClient::set_connection);
ClassDB::bind_method(D_METHOD("get_connection"), &HTTPClient::get_connection);
ClassDB::bind_method(D_METHOD("request_raw", "method", "url", "headers", "body"), &HTTPClient::_request_raw);
diff --git a/core/io/http_client.h b/core/io/http_client.h
index 853ea7f472..9e018182e3 100644
--- a/core/io/http_client.h
+++ b/core/io/http_client.h
@@ -31,6 +31,7 @@
#ifndef HTTP_CLIENT_H
#define HTTP_CLIENT_H
+#include "core/crypto/crypto.h"
#include "core/io/ip.h"
#include "core/io/stream_peer.h"
#include "core/io/stream_peer_tcp.h"
@@ -168,7 +169,7 @@ public:
Error verify_headers(const Vector<String> &p_headers);
virtual Error request(Method p_method, const String &p_url, const Vector<String> &p_headers, const uint8_t *p_body, int p_body_size) = 0;
- virtual Error connect_to_host(const String &p_host, int p_port = -1, bool p_tls = false, bool p_verify_host = true) = 0;
+ virtual Error connect_to_host(const String &p_host, int p_port = -1, Ref<TLSOptions> p_tls_options = Ref<TLSOptions>()) = 0;
virtual void set_connection(const Ref<StreamPeer> &p_connection) = 0;
virtual Ref<StreamPeer> get_connection() const = 0;
diff --git a/core/io/http_client_tcp.cpp b/core/io/http_client_tcp.cpp
index 5cdb13fa06..3788fa501e 100644
--- a/core/io/http_client_tcp.cpp
+++ b/core/io/http_client_tcp.cpp
@@ -39,29 +39,31 @@ HTTPClient *HTTPClientTCP::_create_func() {
return memnew(HTTPClientTCP);
}
-Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, bool p_tls, bool p_verify_host) {
+Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, Ref<TLSOptions> p_options) {
close();
conn_port = p_port;
conn_host = p_host;
+ tls_options = p_options;
ip_candidates.clear();
- tls = p_tls;
- tls_verify_host = p_verify_host;
-
String host_lower = conn_host.to_lower();
if (host_lower.begins_with("http://")) {
conn_host = conn_host.substr(7, conn_host.length() - 7);
+ tls_options.unref();
} else if (host_lower.begins_with("https://")) {
- tls = true;
+ if (tls_options.is_null()) {
+ tls_options = TLSOptions::client();
+ }
conn_host = conn_host.substr(8, conn_host.length() - 8);
}
+ ERR_FAIL_COND_V(tls_options.is_valid() && tls_options->is_server(), ERR_INVALID_PARAMETER);
ERR_FAIL_COND_V(conn_host.length() < HOST_MIN_LEN, ERR_INVALID_PARAMETER);
if (conn_port < 0) {
- if (tls) {
+ if (tls_options.is_valid()) {
conn_port = PORT_HTTPS;
} else {
conn_port = PORT_HTTP;
@@ -70,11 +72,11 @@ Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, bool p_tl
connection = tcp_connection;
- if (tls && https_proxy_port != -1) {
+ if (tls_options.is_valid() && https_proxy_port != -1) {
proxy_client.instantiate(); // Needs proxy negotiation.
server_host = https_proxy_host;
server_port = https_proxy_port;
- } else if (!tls && http_proxy_port != -1) {
+ } else if (tls_options.is_null() && http_proxy_port != -1) {
server_host = http_proxy_host;
server_port = http_proxy_port;
} else {
@@ -107,7 +109,7 @@ Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, bool p_tl
void HTTPClientTCP::set_connection(const Ref<StreamPeer> &p_connection) {
ERR_FAIL_COND_MSG(p_connection.is_null(), "Connection is not a reference to a valid StreamPeer object.");
- if (tls) {
+ if (tls_options.is_valid()) {
ERR_FAIL_NULL_MSG(Object::cast_to<StreamPeerTLS>(p_connection.ptr()),
"Connection is not a reference to a valid StreamPeerTLS object.");
}
@@ -156,7 +158,7 @@ Error HTTPClientTCP::request(Method p_method, const String &p_url, const Vector<
}
String uri = p_url;
- if (!tls && http_proxy_port != -1) {
+ if (tls_options.is_null() && http_proxy_port != -1) {
uri = vformat("http://%s:%d%s", conn_host, conn_port, p_url);
}
@@ -181,7 +183,7 @@ Error HTTPClientTCP::request(Method p_method, const String &p_url, const Vector<
}
}
if (add_host) {
- if ((tls && conn_port == PORT_HTTPS) || (!tls && conn_port == PORT_HTTP)) {
+ if ((tls_options.is_valid() && conn_port == PORT_HTTPS) || (tls_options.is_null() && conn_port == PORT_HTTP)) {
// Don't append the standard ports.
request += "Host: " + conn_host + "\r\n";
} else {
@@ -316,7 +318,7 @@ Error HTTPClientTCP::poll() {
return OK;
} break;
case StreamPeerTCP::STATUS_CONNECTED: {
- if (tls && proxy_client.is_valid()) {
+ if (tls_options.is_valid() && proxy_client.is_valid()) {
Error err = proxy_client->poll();
if (err == ERR_UNCONFIGURED) {
proxy_client->set_connection(tcp_connection);
@@ -357,13 +359,12 @@ Error HTTPClientTCP::poll() {
return ERR_CANT_CONNECT;
} break;
}
- } else if (tls) {
+ } else if (tls_options.is_valid()) {
Ref<StreamPeerTLS> tls_conn;
if (!handshaking) {
// Connect the StreamPeerTLS and start handshaking.
tls_conn = Ref<StreamPeerTLS>(StreamPeerTLS::create());
- tls_conn->set_blocking_handshake_enabled(false);
- Error err = tls_conn->connect_to_stream(tcp_connection, tls_verify_host, conn_host);
+ Error err = tls_conn->connect_to_stream(tcp_connection, conn_host, tls_options);
if (err != OK) {
close();
status = STATUS_TLS_HANDSHAKE_ERROR;
@@ -421,7 +422,7 @@ Error HTTPClientTCP::poll() {
case STATUS_BODY:
case STATUS_CONNECTED: {
// Check if we are still connected.
- if (tls) {
+ if (tls_options.is_valid()) {
Ref<StreamPeerTLS> tmp = connection;
tmp->poll();
if (tmp->get_status() != StreamPeerTLS::STATUS_CONNECTED) {
diff --git a/core/io/http_client_tcp.h b/core/io/http_client_tcp.h
index 97ac2d76a7..6060c975bc 100644
--- a/core/io/http_client_tcp.h
+++ b/core/io/http_client_tcp.h
@@ -33,6 +33,8 @@
#include "http_client.h"
+#include "core/crypto/crypto.h"
+
class HTTPClientTCP : public HTTPClient {
private:
Status status = STATUS_DISCONNECTED;
@@ -46,11 +48,10 @@ private:
String http_proxy_host;
int https_proxy_port = -1; // Proxy server for https requests.
String https_proxy_host;
- bool tls = false;
- bool tls_verify_host = false;
bool blocking = false;
bool handshaking = false;
bool head_request = false;
+ Ref<TLSOptions> tls_options;
Vector<uint8_t> response_str;
@@ -79,7 +80,7 @@ public:
Error request(Method p_method, const String &p_url, const Vector<String> &p_headers, const uint8_t *p_body, int p_body_size) override;
- Error connect_to_host(const String &p_host, int p_port = -1, bool p_tls = false, bool p_verify_host = true) override;
+ Error connect_to_host(const String &p_host, int p_port = -1, Ref<TLSOptions> p_tls_options = Ref<TLSOptions>()) override;
void set_connection(const Ref<StreamPeer> &p_connection) override;
Ref<StreamPeer> get_connection() const override;
void close() override;
diff --git a/core/io/image.cpp b/core/io/image.cpp
index 9408a9c103..736a3ec82e 100644
--- a/core/io/image.cpp
+++ b/core/io/image.cpp
@@ -78,6 +78,10 @@ const char *Image::format_names[Image::FORMAT_MAX] = {
"ETC2_RGB8A1",
"ETC2_RA_AS_RG",
"FORMAT_DXT5_RA_AS_RG",
+ "ASTC_4x4",
+ "ASTC_4x4_HDR",
+ "ASTC_8x8",
+ "ASTC_8x8_HDR",
};
SavePNGFunc Image::save_png_func = nullptr;
@@ -2187,16 +2191,16 @@ void Image::initialize_data(int p_width, int p_height, bool p_use_mipmaps, Forma
int size = _get_dst_image_size(p_width, p_height, p_format, mm, p_use_mipmaps ? -1 : 0);
if (unlikely(p_data.size() != size)) {
- String description_mipmaps;
+ String description_mipmaps = get_format_name(p_format) + " ";
if (p_use_mipmaps) {
const int num_mipmaps = get_image_required_mipmaps(p_width, p_height, p_format);
if (num_mipmaps != 1) {
- description_mipmaps = vformat("with %d mipmaps", num_mipmaps);
+ description_mipmaps += vformat("with %d mipmaps", num_mipmaps);
} else {
- description_mipmaps = "with 1 mipmap";
+ description_mipmaps += "with 1 mipmap";
}
} else {
- description_mipmaps = "without mipmaps";
+ description_mipmaps += "without mipmaps";
}
const String description = vformat("%dx%dx%d (%s)", p_width, p_height, get_format_pixel_size(p_format), description_mipmaps);
ERR_FAIL_MSG(vformat("Expected Image data size of %s = %d bytes, got %d bytes instead.", description, size, p_data.size()));
@@ -2618,35 +2622,35 @@ Error Image::decompress() {
return OK;
}
-Error Image::compress(CompressMode p_mode, CompressSource p_source, float p_lossy_quality, ASTCFormat p_astc_format) {
+Error Image::compress(CompressMode p_mode, CompressSource p_source, ASTCFormat p_astc_format) {
ERR_FAIL_INDEX_V_MSG(p_mode, COMPRESS_MAX, ERR_INVALID_PARAMETER, "Invalid compress mode.");
ERR_FAIL_INDEX_V_MSG(p_source, COMPRESS_SOURCE_MAX, ERR_INVALID_PARAMETER, "Invalid compress source.");
- return compress_from_channels(p_mode, detect_used_channels(p_source), p_lossy_quality, p_astc_format);
+ return compress_from_channels(p_mode, detect_used_channels(p_source), p_astc_format);
}
-Error Image::compress_from_channels(CompressMode p_mode, UsedChannels p_channels, float p_lossy_quality, ASTCFormat p_astc_format) {
+Error Image::compress_from_channels(CompressMode p_mode, UsedChannels p_channels, ASTCFormat p_astc_format) {
ERR_FAIL_COND_V(data.is_empty(), ERR_INVALID_DATA);
switch (p_mode) {
case COMPRESS_S3TC: {
ERR_FAIL_COND_V(!_image_compress_bc_func, ERR_UNAVAILABLE);
- _image_compress_bc_func(this, p_lossy_quality, p_channels);
+ _image_compress_bc_func(this, p_channels);
} break;
case COMPRESS_ETC: {
ERR_FAIL_COND_V(!_image_compress_etc1_func, ERR_UNAVAILABLE);
- _image_compress_etc1_func(this, p_lossy_quality);
+ _image_compress_etc1_func(this);
} break;
case COMPRESS_ETC2: {
ERR_FAIL_COND_V(!_image_compress_etc2_func, ERR_UNAVAILABLE);
- _image_compress_etc2_func(this, p_lossy_quality, p_channels);
+ _image_compress_etc2_func(this, p_channels);
} break;
case COMPRESS_BPTC: {
ERR_FAIL_COND_V(!_image_compress_bptc_func, ERR_UNAVAILABLE);
- _image_compress_bptc_func(this, p_lossy_quality, p_channels);
+ _image_compress_bptc_func(this, p_channels);
} break;
case COMPRESS_ASTC: {
ERR_FAIL_COND_V(!_image_compress_bptc_func, ERR_UNAVAILABLE);
- _image_compress_astc_func(this, p_lossy_quality, p_astc_format);
+ _image_compress_astc_func(this, p_astc_format);
} break;
case COMPRESS_MAX: {
ERR_FAIL_V(ERR_INVALID_PARAMETER);
@@ -3000,11 +3004,11 @@ ImageMemLoadFunc Image::_webp_mem_loader_func = nullptr;
ImageMemLoadFunc Image::_tga_mem_loader_func = nullptr;
ImageMemLoadFunc Image::_bmp_mem_loader_func = nullptr;
-void (*Image::_image_compress_bc_func)(Image *, float, Image::UsedChannels) = nullptr;
-void (*Image::_image_compress_bptc_func)(Image *, float, Image::UsedChannels) = nullptr;
-void (*Image::_image_compress_etc1_func)(Image *, float) = nullptr;
-void (*Image::_image_compress_etc2_func)(Image *, float, Image::UsedChannels) = nullptr;
-void (*Image::_image_compress_astc_func)(Image *, float, Image::ASTCFormat) = nullptr;
+void (*Image::_image_compress_bc_func)(Image *, Image::UsedChannels) = nullptr;
+void (*Image::_image_compress_bptc_func)(Image *, Image::UsedChannels) = nullptr;
+void (*Image::_image_compress_etc1_func)(Image *) = nullptr;
+void (*Image::_image_compress_etc2_func)(Image *, Image::UsedChannels) = nullptr;
+void (*Image::_image_compress_astc_func)(Image *, Image::ASTCFormat) = nullptr;
void (*Image::_image_decompress_bc)(Image *) = nullptr;
void (*Image::_image_decompress_bptc)(Image *) = nullptr;
void (*Image::_image_decompress_etc1)(Image *) = nullptr;
@@ -3426,8 +3430,8 @@ void Image::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_invisible"), &Image::is_invisible);
ClassDB::bind_method(D_METHOD("detect_used_channels", "source"), &Image::detect_used_channels, DEFVAL(COMPRESS_SOURCE_GENERIC));
- ClassDB::bind_method(D_METHOD("compress", "mode", "source", "lossy_quality", "astc_format"), &Image::compress, DEFVAL(COMPRESS_SOURCE_GENERIC), DEFVAL(0.7), DEFVAL(ASTC_FORMAT_4x4));
- ClassDB::bind_method(D_METHOD("compress_from_channels", "mode", "channels", "lossy_quality", "astc_format"), &Image::compress_from_channels, DEFVAL(0.7), DEFVAL(ASTC_FORMAT_4x4));
+ ClassDB::bind_method(D_METHOD("compress", "mode", "source", "astc_format"), &Image::compress, DEFVAL(COMPRESS_SOURCE_GENERIC), DEFVAL(ASTC_FORMAT_4x4));
+ ClassDB::bind_method(D_METHOD("compress_from_channels", "mode", "channels", "astc_format"), &Image::compress_from_channels, DEFVAL(ASTC_FORMAT_4x4));
ClassDB::bind_method(D_METHOD("decompress"), &Image::decompress);
ClassDB::bind_method(D_METHOD("is_compressed"), &Image::is_compressed);
@@ -3547,11 +3551,11 @@ void Image::_bind_methods() {
BIND_ENUM_CONSTANT(ASTC_FORMAT_8x8);
}
-void Image::set_compress_bc_func(void (*p_compress_func)(Image *, float, UsedChannels)) {
+void Image::set_compress_bc_func(void (*p_compress_func)(Image *, UsedChannels)) {
_image_compress_bc_func = p_compress_func;
}
-void Image::set_compress_bptc_func(void (*p_compress_func)(Image *, float, UsedChannels)) {
+void Image::set_compress_bptc_func(void (*p_compress_func)(Image *, UsedChannels)) {
_image_compress_bptc_func = p_compress_func;
}
diff --git a/core/io/image.h b/core/io/image.h
index 29ceb9478f..8e353a8bb7 100644
--- a/core/io/image.h
+++ b/core/io/image.h
@@ -149,11 +149,11 @@ public:
static ImageMemLoadFunc _tga_mem_loader_func;
static ImageMemLoadFunc _bmp_mem_loader_func;
- static void (*_image_compress_bc_func)(Image *, float, UsedChannels p_channels);
- static void (*_image_compress_bptc_func)(Image *, float p_lossy_quality, UsedChannels p_channels);
- static void (*_image_compress_etc1_func)(Image *, float);
- static void (*_image_compress_etc2_func)(Image *, float, UsedChannels p_channels);
- static void (*_image_compress_astc_func)(Image *, float, ASTCFormat p_format);
+ static void (*_image_compress_bc_func)(Image *, UsedChannels p_channels);
+ static void (*_image_compress_bptc_func)(Image *, UsedChannels p_channels);
+ static void (*_image_compress_etc1_func)(Image *);
+ static void (*_image_compress_etc2_func)(Image *, UsedChannels p_channels);
+ static void (*_image_compress_astc_func)(Image *, ASTCFormat p_format);
static void (*_image_decompress_bc)(Image *);
static void (*_image_decompress_bptc)(Image *);
@@ -368,8 +368,8 @@ public:
COMPRESS_SOURCE_MAX,
};
- Error compress(CompressMode p_mode, CompressSource p_source = COMPRESS_SOURCE_GENERIC, float p_lossy_quality = 0.7, ASTCFormat p_astc_format = ASTC_FORMAT_4x4);
- Error compress_from_channels(CompressMode p_mode, UsedChannels p_channels, float p_lossy_quality = 0.7, ASTCFormat p_astc_format = ASTC_FORMAT_4x4);
+ Error compress(CompressMode p_mode, CompressSource p_source = COMPRESS_SOURCE_GENERIC, ASTCFormat p_astc_format = ASTC_FORMAT_4x4);
+ Error compress_from_channels(CompressMode p_mode, UsedChannels p_channels, ASTCFormat p_astc_format = ASTC_FORMAT_4x4);
Error decompress();
bool is_compressed() const;
@@ -391,8 +391,8 @@ public:
Rect2i get_used_rect() const;
Ref<Image> get_region(const Rect2i &p_area) const;
- static void set_compress_bc_func(void (*p_compress_func)(Image *, float, UsedChannels));
- static void set_compress_bptc_func(void (*p_compress_func)(Image *, float, UsedChannels));
+ static void set_compress_bc_func(void (*p_compress_func)(Image *, UsedChannels));
+ static void set_compress_bptc_func(void (*p_compress_func)(Image *, UsedChannels));
static String get_format_name(Format p_format);
Error load_png_from_buffer(const Vector<uint8_t> &p_array);
diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp
index 17fb199811..c6452f1033 100644
--- a/core/io/image_loader.cpp
+++ b/core/io/image_loader.cpp
@@ -135,10 +135,6 @@ void ImageLoader::remove_image_format_loader(Ref<ImageFormatLoader> p_loader) {
loader.erase(p_loader);
}
-const Vector<Ref<ImageFormatLoader>> &ImageLoader::get_image_format_loaders() {
- return loader;
-}
-
void ImageLoader::cleanup() {
while (loader.size()) {
remove_image_format_loader(loader[0]);
diff --git a/core/io/image_loader.h b/core/io/image_loader.h
index 1473f24186..ac51f13376 100644
--- a/core/io/image_loader.h
+++ b/core/io/image_loader.h
@@ -98,8 +98,6 @@ public:
static void add_image_format_loader(Ref<ImageFormatLoader> p_loader);
static void remove_image_format_loader(Ref<ImageFormatLoader> p_loader);
- static const Vector<Ref<ImageFormatLoader>> &get_image_format_loaders();
-
static void cleanup();
};
diff --git a/core/io/json.cpp b/core/io/json.cpp
index ca29534c35..448e39b2c3 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -30,6 +30,7 @@
#include "json.h"
+#include "core/config/engine.h"
#include "core/string/print_string.h"
const char *JSON::tk_name[TK_MAX] = {
@@ -506,6 +507,7 @@ Error JSON::_parse_object(Dictionary &object, const char32_t *p_str, int &index,
void JSON::set_data(const Variant &p_data) {
data = p_data;
+ text.clear();
}
Error JSON::_parse_string(const String &p_json, Variant &r_ret, String &r_err_str, int &r_err_line) {
@@ -539,14 +541,21 @@ Error JSON::_parse_string(const String &p_json, Variant &r_ret, String &r_err_st
return err;
}
-Error JSON::parse(const String &p_json_string) {
+Error JSON::parse(const String &p_json_string, bool p_keep_text) {
Error err = _parse_string(p_json_string, data, err_str, err_line);
if (err == Error::OK) {
err_line = 0;
}
+ if (p_keep_text) {
+ text = p_json_string;
+ }
return err;
}
+String JSON::get_parsed_text() const {
+ return text;
+}
+
String JSON::stringify(const Variant &p_var, const String &p_indent, bool p_sort_keys, bool p_full_precision) {
Ref<JSON> jason;
jason.instantiate();
@@ -565,10 +574,11 @@ Variant JSON::parse_string(const String &p_json_string) {
void JSON::_bind_methods() {
ClassDB::bind_static_method("JSON", D_METHOD("stringify", "data", "indent", "sort_keys", "full_precision"), &JSON::stringify, DEFVAL(""), DEFVAL(true), DEFVAL(false));
ClassDB::bind_static_method("JSON", D_METHOD("parse_string", "json_string"), &JSON::parse_string);
- ClassDB::bind_method(D_METHOD("parse", "json_string"), &JSON::parse);
+ ClassDB::bind_method(D_METHOD("parse", "json_text", "keep_text"), &JSON::parse, DEFVAL(false));
ClassDB::bind_method(D_METHOD("get_data"), &JSON::get_data);
ClassDB::bind_method(D_METHOD("set_data", "data"), &JSON::set_data);
+ ClassDB::bind_method(D_METHOD("get_parsed_text"), &JSON::get_parsed_text);
ClassDB::bind_method(D_METHOD("get_error_line"), &JSON::get_error_line);
ClassDB::bind_method(D_METHOD("get_error_message"), &JSON::get_error_message);
@@ -592,13 +602,20 @@ Ref<Resource> ResourceFormatLoaderJSON::load(const String &p_path, const String
Ref<JSON> json;
json.instantiate();
- Error err = json->parse(FileAccess::get_file_as_string(p_path));
+ Error err = json->parse(FileAccess::get_file_as_string(p_path), Engine::get_singleton()->is_editor_hint());
if (err != OK) {
- if (r_error) {
- *r_error = err;
+ String err_text = "Error parsing JSON file at '" + p_path + "', on line " + itos(json->get_error_line()) + ": " + json->get_error_message();
+
+ if (Engine::get_singleton()->is_editor_hint()) {
+ // If running on editor, still allow opening the JSON so the code editor can edit it.
+ WARN_PRINT(err_text);
+ } else {
+ if (r_error) {
+ *r_error = err;
+ }
+ ERR_PRINT(err_text);
+ return Ref<Resource>();
}
- ERR_PRINT("Error parsing JSON file at '" + p_path + "', on line " + itos(json->get_error_line()) + ": " + json->get_error_message());
- return Ref<Resource>();
}
if (r_error) {
@@ -628,7 +645,7 @@ Error ResourceFormatSaverJSON::save(const Ref<Resource> &p_resource, const Strin
Ref<JSON> json = p_resource;
ERR_FAIL_COND_V(json.is_null(), ERR_INVALID_PARAMETER);
- String source = JSON::stringify(json->get_data(), "\t", false, true);
+ String source = json->get_parsed_text().is_empty() ? JSON::stringify(json->get_data(), "\t", false, true) : json->get_parsed_text();
Error err;
Ref<FileAccess> file = FileAccess::open(p_path, FileAccess::WRITE, &err);
diff --git a/core/io/json.h b/core/io/json.h
index d66a4e24a3..a21cc542fd 100644
--- a/core/io/json.h
+++ b/core/io/json.h
@@ -36,8 +36,8 @@
#include "core/io/resource_saver.h"
#include "core/variant/variant.h"
-class JSON : public RefCounted {
- GDCLASS(JSON, RefCounted);
+class JSON : public Resource {
+ GDCLASS(JSON, Resource);
enum TokenType {
TK_CURLY_BRACKET_OPEN,
@@ -65,6 +65,7 @@ class JSON : public RefCounted {
Variant value;
};
+ String text;
Variant data;
String err_str;
int err_line = 0;
@@ -83,7 +84,9 @@ protected:
static void _bind_methods();
public:
- Error parse(const String &p_json_string);
+ Error parse(const String &p_json_string, bool p_keep_text = false);
+ String get_parsed_text() const;
+
static String stringify(const Variant &p_var, const String &p_indent = "", bool p_sort_keys = true, bool p_full_precision = false);
static Variant parse_string(const String &p_json_string);
diff --git a/core/io/marshalls.h b/core/io/marshalls.h
index 5e760c7565..6f015ac386 100644
--- a/core/io/marshalls.h
+++ b/core/io/marshalls.h
@@ -44,7 +44,7 @@ typedef uint32_t uintr_t;
#endif
/**
- * Miscellaneous helpers for marshalling data types, and encoding
+ * Miscellaneous helpers for marshaling data types, and encoding
* in an endian independent way
*/
diff --git a/core/io/packet_peer_dtls.cpp b/core/io/packet_peer_dtls.cpp
index c0998f10bc..18bef3ff3c 100644
--- a/core/io/packet_peer_dtls.cpp
+++ b/core/io/packet_peer_dtls.cpp
@@ -48,7 +48,7 @@ bool PacketPeerDTLS::is_available() {
void PacketPeerDTLS::_bind_methods() {
ClassDB::bind_method(D_METHOD("poll"), &PacketPeerDTLS::poll);
- ClassDB::bind_method(D_METHOD("connect_to_peer", "packet_peer", "validate_certs", "for_hostname", "valid_certificate"), &PacketPeerDTLS::connect_to_peer, DEFVAL(true), DEFVAL(String()), DEFVAL(Ref<X509Certificate>()));
+ ClassDB::bind_method(D_METHOD("connect_to_peer", "packet_peer", "hostname", "client_options"), &PacketPeerDTLS::connect_to_peer, DEFVAL(Ref<TLSOptions>()));
ClassDB::bind_method(D_METHOD("get_status"), &PacketPeerDTLS::get_status);
ClassDB::bind_method(D_METHOD("disconnect_from_peer"), &PacketPeerDTLS::disconnect_from_peer);
diff --git a/core/io/packet_peer_dtls.h b/core/io/packet_peer_dtls.h
index 5ba1faed7c..3990a851f7 100644
--- a/core/io/packet_peer_dtls.h
+++ b/core/io/packet_peer_dtls.h
@@ -53,7 +53,7 @@ public:
};
virtual void poll() = 0;
- virtual Error connect_to_peer(Ref<PacketPeerUDP> p_base, bool p_validate_certs = true, const String &p_for_hostname = String(), Ref<X509Certificate> p_ca_certs = Ref<X509Certificate>()) = 0;
+ virtual Error connect_to_peer(Ref<PacketPeerUDP> p_base, const String &p_hostname, Ref<TLSOptions> p_options = Ref<TLSOptions>()) = 0;
virtual void disconnect_from_peer() = 0;
virtual Status get_status() const = 0;
diff --git a/core/io/resource.cpp b/core/io/resource.cpp
index 2d6f09725f..4abcbffb61 100644
--- a/core/io/resource.cpp
+++ b/core/io/resource.cpp
@@ -260,15 +260,35 @@ Ref<Resource> Resource::duplicate(bool p_subresources) const {
}
Variant p = get(E.name);
- if ((p.get_type() == Variant::DICTIONARY || p.get_type() == Variant::ARRAY)) {
- r->set(E.name, p.duplicate(p_subresources));
- } else if (p.get_type() == Variant::OBJECT && (p_subresources || (E.usage & PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE))) {
- Ref<Resource> sr = p;
- if (sr.is_valid()) {
- r->set(E.name, sr->duplicate(p_subresources));
+ switch (p.get_type()) {
+ case Variant::Type::DICTIONARY:
+ case Variant::Type::ARRAY:
+ case Variant::Type::PACKED_BYTE_ARRAY:
+ case Variant::Type::PACKED_COLOR_ARRAY:
+ case Variant::Type::PACKED_INT32_ARRAY:
+ case Variant::Type::PACKED_INT64_ARRAY:
+ case Variant::Type::PACKED_FLOAT32_ARRAY:
+ case Variant::Type::PACKED_FLOAT64_ARRAY:
+ case Variant::Type::PACKED_STRING_ARRAY:
+ case Variant::Type::PACKED_VECTOR2_ARRAY:
+ case Variant::Type::PACKED_VECTOR3_ARRAY: {
+ r->set(E.name, p.duplicate(p_subresources));
+ } break;
+
+ case Variant::Type::OBJECT: {
+ if (!(E.usage & PROPERTY_USAGE_NEVER_DUPLICATE) && (p_subresources || (E.usage & PROPERTY_USAGE_ALWAYS_DUPLICATE))) {
+ Ref<Resource> sr = p;
+ if (sr.is_valid()) {
+ r->set(E.name, sr->duplicate(p_subresources));
+ }
+ } else {
+ r->set(E.name, p);
+ }
+ } break;
+
+ default: {
+ r->set(E.name, p);
}
- } else {
- r->set(E.name, p);
}
}
@@ -385,10 +405,6 @@ void Resource::set_as_translation_remapped(bool p_remapped) {
ResourceCache::lock.unlock();
}
-bool Resource::is_translation_remapped() const {
- return remapped_list.in_list();
-}
-
#ifdef TOOLS_ENABLED
//helps keep IDs same number when loading/saving scenes. -1 clears ID and it Returns -1 when no id stored
void Resource::set_id_for_path(const String &p_path, const String &p_id) {
@@ -481,9 +497,6 @@ void ResourceCache::clear() {
resources.clear();
}
-void ResourceCache::reload_externals() {
-}
-
bool ResourceCache::has(const String &p_path) {
lock.lock();
diff --git a/core/io/resource.h b/core/io/resource.h
index 22ce5cef43..5135664f36 100644
--- a/core/io/resource.h
+++ b/core/io/resource.h
@@ -136,7 +136,6 @@ public:
#endif
void set_as_translation_remapped(bool p_remapped);
- bool is_translation_remapped() const;
virtual RID get_rid() const; // some resources may offer conversion to RID
@@ -164,7 +163,6 @@ class ResourceCache {
friend void register_core_types();
public:
- static void reload_externals();
static bool has(const String &p_path);
static Ref<Resource> get_ref(const String &p_path);
static void get_cached_resources(List<Ref<Resource>> *p_resources);
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 45e1301930..c0463de427 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -91,7 +91,8 @@ enum {
// Version 2: added 64 bits support for float and int.
// Version 3: changed nodepath encoding.
// Version 4: new string ID for ext/subresources, breaks forward compat.
- FORMAT_VERSION = 4,
+ // Version 5: Ability to store script class in the header.
+ FORMAT_VERSION = 5,
FORMAT_VERSION_CAN_RENAME_DEPS = 1,
FORMAT_VERSION_NO_NODEPATH_PROPERTY = 3,
};
@@ -661,10 +662,6 @@ Error ResourceLoaderBinary::parse_variant(Variant &r_v) {
return OK; //never reach anyway
}
-void ResourceLoaderBinary::set_local_path(const String &p_local_path) {
- res_path = p_local_path;
-}
-
Ref<Resource> ResourceLoaderBinary::get_resource() {
return resource;
}
@@ -1013,6 +1010,10 @@ void ResourceLoaderBinary::open(Ref<FileAccess> p_f, bool p_no_resources, bool p
uid = ResourceUID::INVALID_ID;
}
+ if (flags & ResourceFormatSaverBinaryInstance::FORMAT_FLAG_HAS_SCRIPT_CLASS) {
+ script_class = get_unicode_string();
+ }
+
for (int i = 0; i < ResourceFormatSaverBinaryInstance::RESERVED_FIELDS; i++) {
f->get_32(); //skip a few reserved fields
}
@@ -1117,6 +1118,57 @@ String ResourceLoaderBinary::recognize(Ref<FileAccess> p_f) {
return get_unicode_string();
}
+String ResourceLoaderBinary::recognize_script_class(Ref<FileAccess> p_f) {
+ error = OK;
+
+ f = p_f;
+ uint8_t header[4];
+ f->get_buffer(header, 4);
+ if (header[0] == 'R' && header[1] == 'S' && header[2] == 'C' && header[3] == 'C') {
+ // Compressed.
+ Ref<FileAccessCompressed> fac;
+ fac.instantiate();
+ error = fac->open_after_magic(f);
+ if (error != OK) {
+ f.unref();
+ return "";
+ }
+ f = fac;
+
+ } else if (header[0] != 'R' || header[1] != 'S' || header[2] != 'R' || header[3] != 'C') {
+ // Not normal.
+ error = ERR_FILE_UNRECOGNIZED;
+ f.unref();
+ return "";
+ }
+
+ bool big_endian = f->get_32();
+ f->get_32(); // use_real64
+
+ f->set_big_endian(big_endian != 0); //read big endian if saved as big endian
+
+ uint32_t ver_major = f->get_32();
+ f->get_32(); // ver_minor
+ uint32_t ver_fmt = f->get_32();
+
+ if (ver_fmt > FORMAT_VERSION || ver_major > VERSION_MAJOR) {
+ f.unref();
+ return "";
+ }
+
+ get_unicode_string(); // type
+
+ f->get_64(); // Metadata offset
+ uint32_t flags = f->get_32();
+ f->get_64(); // UID
+
+ if (flags & ResourceFormatSaverBinaryInstance::FORMAT_FLAG_HAS_SCRIPT_CLASS) {
+ return get_unicode_string();
+ } else {
+ return String();
+ }
+}
+
Ref<Resource> ResourceFormatLoaderBinary::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) {
if (r_error) {
*r_error = ERR_FILE_CANT_OPEN;
@@ -1299,6 +1351,9 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
fw->store_32(flags);
fw->store_64(uid_data);
+ if (flags & ResourceFormatSaverBinaryInstance::FORMAT_FLAG_HAS_SCRIPT_CLASS) {
+ save_ustring(fw, get_ustring(f));
+ }
for (int i = 0; i < ResourceFormatSaverBinaryInstance::RESERVED_FIELDS; i++) {
fw->store_32(0); // reserved
@@ -1420,6 +1475,18 @@ String ResourceFormatLoaderBinary::get_resource_type(const String &p_path) const
return ClassDB::get_compatibility_remapped_class(r);
}
+String ResourceFormatLoaderBinary::get_resource_script_class(const String &p_path) const {
+ Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
+ if (f.is_null()) {
+ return ""; //could not read
+ }
+
+ ResourceLoaderBinary loader;
+ loader.local_path = ProjectSettings::get_singleton()->localize_path(p_path);
+ loader.res_path = loader.local_path;
+ return loader.recognize_script_class(f);
+}
+
ResourceUID::ID ResourceFormatLoaderBinary::get_resource_uid(const String &p_path) const {
String ext = p_path.get_extension().to_lower();
if (!ClassDB::is_resource_extension(ext)) {
@@ -2037,15 +2104,31 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const Ref<Re
save_unicode_string(f, _resource_get_class(p_resource));
f->store_64(0); //offset to import metadata
+
+ String script_class;
{
uint32_t format_flags = FORMAT_FLAG_NAMED_SCENE_IDS | FORMAT_FLAG_UIDS;
#ifdef REAL_T_IS_DOUBLE
format_flags |= FORMAT_FLAG_REAL_T_IS_DOUBLE;
#endif
+ if (!p_resource->is_class("PackedScene")) {
+ Ref<Script> s = p_resource->get_script();
+ if (s.is_valid()) {
+ script_class = s->get_global_name();
+ if (!script_class.is_empty()) {
+ format_flags |= ResourceFormatSaverBinaryInstance::FORMAT_FLAG_HAS_SCRIPT_CLASS;
+ }
+ }
+ }
+
f->store_32(format_flags);
}
ResourceUID::ID uid = ResourceSaver::get_resource_id_for_path(p_path, true);
f->store_64(uid);
+ if (!script_class.is_empty()) {
+ save_unicode_string(f, script_class);
+ }
+
for (int i = 0; i < ResourceFormatSaverBinaryInstance::RESERVED_FIELDS; i++) {
f->store_32(0); // reserved
}
@@ -2298,6 +2381,10 @@ Error ResourceFormatSaverBinaryInstance::set_uid(const String &p_path, ResourceU
fw->store_32(flags);
fw->store_64(p_uid);
+ if (flags & ResourceFormatSaverBinaryInstance::FORMAT_FLAG_HAS_SCRIPT_CLASS) {
+ save_ustring(fw, get_ustring(f));
+ }
+
//rest of file
uint8_t b = f->get_8();
while (!f->eof_reached()) {
diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h
index 2e8988005f..add7cdf297 100644
--- a/core/io/resource_format_binary.h
+++ b/core/io/resource_format_binary.h
@@ -65,6 +65,7 @@ class ResourceLoaderBinary {
bool using_named_scene_ids = false;
bool using_uids = false;
+ String script_class;
bool use_sub_threads = false;
float *progress = nullptr;
Vector<ExtResource> external_resources;
@@ -92,7 +93,6 @@ class ResourceLoaderBinary {
HashMap<String, Ref<Resource>> dependency_cache;
public:
- void set_local_path(const String &p_local_path);
Ref<Resource> get_resource();
Error load();
void set_translation_remapped(bool p_remapped);
@@ -100,6 +100,7 @@ public:
void set_remaps(const HashMap<String, String> &p_remaps) { remaps = p_remaps; }
void open(Ref<FileAccess> p_f, bool p_no_resources = false, bool p_keep_uuid_paths = false);
String recognize(Ref<FileAccess> p_f);
+ String recognize_script_class(Ref<FileAccess> p_f);
void get_dependencies(Ref<FileAccess> p_f, List<String> *p_dependencies, bool p_add_types);
void get_classes_used(Ref<FileAccess> p_f, HashSet<StringName> *p_classes);
@@ -113,6 +114,7 @@ public:
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;
+ virtual String get_resource_script_class(const String &p_path) const;
virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes);
virtual ResourceUID::ID get_resource_uid(const String &p_path) const;
virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
@@ -165,6 +167,7 @@ public:
FORMAT_FLAG_NAMED_SCENE_IDS = 1,
FORMAT_FLAG_UIDS = 2,
FORMAT_FLAG_REAL_T_IS_DOUBLE = 4,
+ FORMAT_FLAG_HAS_SCRIPT_CLASS = 8,
// Amount of reserved 32-bit fields in resource header
RESERVED_FIELDS = 11
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 946c31cf0d..7447119ab7 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -99,6 +99,12 @@ String ResourceFormatLoader::get_resource_type(const String &p_path) const {
return ret;
}
+String ResourceFormatLoader::get_resource_script_class(const String &p_path) const {
+ String ret;
+ GDVIRTUAL_CALL(_get_resource_script_class, p_path, ret);
+ return ret;
+}
+
ResourceUID::ID ResourceFormatLoader::get_resource_uid(const String &p_path) const {
int64_t uid = ResourceUID::INVALID_ID;
GDVIRTUAL_CALL(_get_resource_uid, p_path, uid);
@@ -184,6 +190,7 @@ void ResourceFormatLoader::_bind_methods() {
GDVIRTUAL_BIND(_recognize_path, "path", "type");
GDVIRTUAL_BIND(_handles_type, "type");
GDVIRTUAL_BIND(_get_resource_type, "path");
+ GDVIRTUAL_BIND(_get_resource_script_class, "path");
GDVIRTUAL_BIND(_get_resource_uid, "path");
GDVIRTUAL_BIND(_get_dependencies, "path", "add_types");
GDVIRTUAL_BIND(_rename_dependencies, "path", "renames");
@@ -764,6 +771,19 @@ String ResourceLoader::get_resource_type(const String &p_path) {
return "";
}
+String ResourceLoader::get_resource_script_class(const String &p_path) {
+ String local_path = _validate_local_path(p_path);
+
+ for (int i = 0; i < loader_count; i++) {
+ String result = loader[i]->get_resource_script_class(local_path);
+ if (!result.is_empty()) {
+ return result;
+ }
+ }
+
+ return "";
+}
+
ResourceUID::ID ResourceLoader::get_resource_uid(const String &p_path) {
String local_path = _validate_local_path(p_path);
@@ -1011,13 +1031,6 @@ bool ResourceLoader::add_custom_resource_format_loader(String script_path) {
return true;
}
-void ResourceLoader::remove_custom_resource_format_loader(String script_path) {
- Ref<ResourceFormatLoader> custom_loader = _find_custom_resource_format_loader(script_path);
- if (custom_loader.is_valid()) {
- remove_resource_format_loader(custom_loader);
- }
-}
-
void ResourceLoader::set_create_missing_resources_if_class_unavailable(bool p_enable) {
create_missing_resources_if_class_unavailable = p_enable;
}
diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h
index 41ba0dc6e6..eb8155e046 100644
--- a/core/io/resource_loader.h
+++ b/core/io/resource_loader.h
@@ -54,6 +54,7 @@ protected:
GDVIRTUAL2RC(bool, _recognize_path, String, StringName)
GDVIRTUAL1RC(bool, _handles_type, StringName)
GDVIRTUAL1RC(String, _get_resource_type, String)
+ GDVIRTUAL1RC(String, _get_resource_script_class, String)
GDVIRTUAL1RC(ResourceUID::ID, _get_resource_uid, String)
GDVIRTUAL2RC(Vector<String>, _get_dependencies, String, bool)
GDVIRTUAL1RC(Vector<String>, _get_classes_used, String)
@@ -71,6 +72,7 @@ public:
virtual bool handles_type(const String &p_type) const;
virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes);
virtual String get_resource_type(const String &p_path) const;
+ virtual String get_resource_script_class(const String &p_path) const;
virtual ResourceUID::ID get_resource_uid(const String &p_path) const;
virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
virtual Error rename_dependencies(const String &p_path, const HashMap<String, String> &p_map);
@@ -175,6 +177,7 @@ public:
static void remove_resource_format_loader(Ref<ResourceFormatLoader> p_format_loader);
static void get_classes_used(const String &p_path, HashSet<StringName> *r_classes);
static String get_resource_type(const String &p_path);
+ static String get_resource_script_class(const String &p_path);
static ResourceUID::ID get_resource_uid(const String &p_path);
static void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
static Error rename_dependencies(const String &p_path, const HashMap<String, String> &p_map);
@@ -225,7 +228,6 @@ public:
static ResourceLoaderImport import;
static bool add_custom_resource_format_loader(String script_path);
- static void remove_custom_resource_format_loader(String script_path);
static void add_custom_loaders();
static void remove_custom_loaders();
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index 9809b9a48f..b8201cc6b9 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -250,13 +250,6 @@ bool ResourceSaver::add_custom_resource_format_saver(String script_path) {
return true;
}
-void ResourceSaver::remove_custom_resource_format_saver(String script_path) {
- Ref<ResourceFormatSaver> custom_saver = _find_custom_resource_format_saver(script_path);
- if (custom_saver.is_valid()) {
- remove_resource_format_saver(custom_saver);
- }
-}
-
void ResourceSaver::add_custom_savers() {
// Custom resource savers exploits global class names
diff --git a/core/io/resource_saver.h b/core/io/resource_saver.h
index 2043947963..9e88b2086b 100644
--- a/core/io/resource_saver.h
+++ b/core/io/resource_saver.h
@@ -101,7 +101,6 @@ public:
static void set_get_resource_id_for_path(ResourceSaverGetResourceIDForPath p_callback);
static bool add_custom_resource_format_saver(String script_path);
- static void remove_custom_resource_format_saver(String script_path);
static void add_custom_savers();
static void remove_custom_savers();
};
diff --git a/core/io/stream_peer_tls.cpp b/core/io/stream_peer_tls.cpp
index 71fadd1d30..69877974e6 100644
--- a/core/io/stream_peer_tls.cpp
+++ b/core/io/stream_peer_tls.cpp
@@ -41,31 +41,17 @@ StreamPeerTLS *StreamPeerTLS::create() {
return nullptr;
}
-bool StreamPeerTLS::available = false;
-
bool StreamPeerTLS::is_available() {
- return available;
-}
-
-void StreamPeerTLS::set_blocking_handshake_enabled(bool p_enabled) {
- blocking_handshake = p_enabled;
-}
-
-bool StreamPeerTLS::is_blocking_handshake_enabled() const {
- return blocking_handshake;
+ return _create != nullptr;
}
void StreamPeerTLS::_bind_methods() {
ClassDB::bind_method(D_METHOD("poll"), &StreamPeerTLS::poll);
- ClassDB::bind_method(D_METHOD("accept_stream", "stream", "private_key", "certificate", "chain"), &StreamPeerTLS::accept_stream, DEFVAL(Ref<X509Certificate>()));
- ClassDB::bind_method(D_METHOD("connect_to_stream", "stream", "validate_certs", "for_hostname", "valid_certificate"), &StreamPeerTLS::connect_to_stream, DEFVAL(false), DEFVAL(String()), DEFVAL(Ref<X509Certificate>()));
+ ClassDB::bind_method(D_METHOD("accept_stream", "stream", "server_options"), &StreamPeerTLS::accept_stream);
+ ClassDB::bind_method(D_METHOD("connect_to_stream", "stream", "common_name", "client_options"), &StreamPeerTLS::connect_to_stream, DEFVAL(Ref<TLSOptions>()));
ClassDB::bind_method(D_METHOD("get_status"), &StreamPeerTLS::get_status);
ClassDB::bind_method(D_METHOD("get_stream"), &StreamPeerTLS::get_stream);
ClassDB::bind_method(D_METHOD("disconnect_from_stream"), &StreamPeerTLS::disconnect_from_stream);
- ClassDB::bind_method(D_METHOD("set_blocking_handshake_enabled", "enabled"), &StreamPeerTLS::set_blocking_handshake_enabled);
- ClassDB::bind_method(D_METHOD("is_blocking_handshake_enabled"), &StreamPeerTLS::is_blocking_handshake_enabled);
-
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "blocking_handshake"), "set_blocking_handshake_enabled", "is_blocking_handshake_enabled");
BIND_ENUM_CONSTANT(STATUS_DISCONNECTED);
BIND_ENUM_CONSTANT(STATUS_HANDSHAKING);
diff --git a/core/io/stream_peer_tls.h b/core/io/stream_peer_tls.h
index 6666107ad8..5894abb7a4 100644
--- a/core/io/stream_peer_tls.h
+++ b/core/io/stream_peer_tls.h
@@ -41,10 +41,6 @@ protected:
static StreamPeerTLS *(*_create)();
static void _bind_methods();
- static bool available;
-
- bool blocking_handshake = true;
-
public:
enum Status {
STATUS_DISCONNECTED,
@@ -54,12 +50,9 @@ public:
STATUS_ERROR_HOSTNAME_MISMATCH
};
- void set_blocking_handshake_enabled(bool p_enabled);
- bool is_blocking_handshake_enabled() const;
-
virtual void poll() = 0;
- virtual Error accept_stream(Ref<StreamPeer> p_base, Ref<CryptoKey> p_key, Ref<X509Certificate> p_cert, Ref<X509Certificate> p_ca_chain = Ref<X509Certificate>()) = 0;
- virtual Error connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs = false, const String &p_for_hostname = String(), Ref<X509Certificate> p_valid_cert = Ref<X509Certificate>()) = 0;
+ virtual Error accept_stream(Ref<StreamPeer> p_base, Ref<TLSOptions> p_options) = 0;
+ virtual Error connect_to_stream(Ref<StreamPeer> p_base, const String &p_common_name, Ref<TLSOptions> p_options) = 0;
virtual Status get_status() const = 0;
virtual Ref<StreamPeer> get_stream() const = 0;
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index a54804c5dc..f0f160940d 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -106,11 +106,11 @@ void AStar3D::remove_point(int64_t p_id) {
bool p_exists = points.lookup(p_id, p);
ERR_FAIL_COND_MSG(!p_exists, vformat("Can't remove point. Point with id: %d doesn't exist.", p_id));
- for (OAHashMap<int64_t, Point *>::Iterator it = p->neighbours.iter(); it.valid; it = p->neighbours.next_iter(it)) {
+ for (OAHashMap<int64_t, Point *>::Iterator it = p->neighbors.iter(); it.valid; it = p->neighbors.next_iter(it)) {
Segment s(p_id, (*it.key));
segments.erase(s);
- (*it.value)->neighbours.remove(p->id);
+ (*it.value)->neighbors.remove(p->id);
(*it.value)->unlinked_neighbours.remove(p->id);
}
@@ -118,7 +118,7 @@ void AStar3D::remove_point(int64_t p_id) {
Segment s(p_id, (*it.key));
segments.erase(s);
- (*it.value)->neighbours.remove(p->id);
+ (*it.value)->neighbors.remove(p->id);
(*it.value)->unlinked_neighbours.remove(p->id);
}
@@ -138,10 +138,10 @@ void AStar3D::connect_points(int64_t p_id, int64_t p_with_id, bool bidirectional
bool to_exists = points.lookup(p_with_id, b);
ERR_FAIL_COND_MSG(!to_exists, vformat("Can't connect points. Point with id: %d doesn't exist.", p_with_id));
- a->neighbours.set(b->id, b);
+ a->neighbors.set(b->id, b);
if (bidirectional) {
- b->neighbours.set(a->id, a);
+ b->neighbors.set(a->id, a);
} else {
b->unlinked_neighbours.set(a->id, a);
}
@@ -155,7 +155,7 @@ void AStar3D::connect_points(int64_t p_id, int64_t p_with_id, bool bidirectional
if (element) {
s.direction |= element->direction;
if (s.direction == Segment::BIDIRECTIONAL) {
- // Both are neighbours of each other now
+ // Both are neighbors of each other now
a->unlinked_neighbours.remove(b->id);
b->unlinked_neighbours.remove(a->id);
}
@@ -183,9 +183,9 @@ void AStar3D::disconnect_points(int64_t p_id, int64_t p_with_id, bool bidirectio
// Erase the directions to be removed
s.direction = (element->direction & ~remove_direction);
- a->neighbours.remove(b->id);
+ a->neighbors.remove(b->id);
if (bidirectional) {
- b->neighbours.remove(a->id);
+ b->neighbors.remove(a->id);
if (element->direction != Segment::BIDIRECTIONAL) {
a->unlinked_neighbours.remove(b->id);
b->unlinked_neighbours.remove(a->id);
@@ -226,7 +226,7 @@ Vector<int64_t> AStar3D::get_point_connections(int64_t p_id) {
Vector<int64_t> point_list;
- for (OAHashMap<int64_t, Point *>::Iterator it = p->neighbours.iter(); it.valid; it = p->neighbours.next_iter(it)) {
+ for (OAHashMap<int64_t, Point *>::Iterator it = p->neighbors.iter(); it.valid; it = p->neighbors.next_iter(it)) {
point_list.push_back((*it.key));
}
@@ -327,7 +327,7 @@ bool AStar3D::_solve(Point *begin_point, Point *end_point) {
bool found_route = false;
- Vector<Point *> open_list;
+ LocalVector<Point *> open_list;
SortArray<Point *, SortPoints> sorter;
begin_point->g_score = 0;
@@ -335,19 +335,19 @@ bool AStar3D::_solve(Point *begin_point, Point *end_point) {
open_list.push_back(begin_point);
while (!open_list.is_empty()) {
- Point *p = open_list[0]; // The currently processed point
+ Point *p = open_list[0]; // The currently processed point.
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
+ sorter.pop_heap(0, open_list.size(), open_list.ptr()); // Remove the current point from the open list.
open_list.remove_at(open_list.size() - 1);
- p->closed_pass = pass; // Mark the point as closed
+ p->closed_pass = pass; // Mark the point as closed.
- for (OAHashMap<int64_t, Point *>::Iterator it = p->neighbours.iter(); it.valid; it = p->neighbours.next_iter(it)) {
- Point *e = *(it.value); // The neighbour point
+ for (OAHashMap<int64_t, Point *>::Iterator it = p->neighbors.iter(); it.valid; it = p->neighbors.next_iter(it)) {
+ Point *e = *(it.value); // The neighbor point.
if (!e->enabled || e->closed_pass == pass) {
continue;
@@ -370,9 +370,9 @@ bool AStar3D::_solve(Point *begin_point, Point *end_point) {
e->f_score = e->g_score + _estimate_cost(e->id, end_point->id);
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());
+ sorter.push_heap(0, open_list.size() - 1, 0, e, open_list.ptr());
} else {
- sorter.push_heap(0, open_list.find(e), 0, e, open_list.ptrw());
+ sorter.push_heap(0, open_list.find(e), 0, e, open_list.ptr());
}
}
}
@@ -794,7 +794,7 @@ bool AStar2D::_solve(AStar3D::Point *begin_point, AStar3D::Point *end_point) {
bool found_route = false;
- Vector<AStar3D::Point *> open_list;
+ LocalVector<AStar3D::Point *> open_list;
SortArray<AStar3D::Point *, AStar3D::SortPoints> sorter;
begin_point->g_score = 0;
@@ -802,19 +802,19 @@ bool AStar2D::_solve(AStar3D::Point *begin_point, AStar3D::Point *end_point) {
open_list.push_back(begin_point);
while (!open_list.is_empty()) {
- AStar3D::Point *p = open_list[0]; // The currently processed point
+ AStar3D::Point *p = open_list[0]; // The currently processed point.
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
+ sorter.pop_heap(0, open_list.size(), open_list.ptr()); // Remove the current point from the open list.
open_list.remove_at(open_list.size() - 1);
- p->closed_pass = astar.pass; // Mark the point as closed
+ p->closed_pass = astar.pass; // Mark the point as closed.
- for (OAHashMap<int64_t, AStar3D::Point *>::Iterator it = p->neighbours.iter(); it.valid; it = p->neighbours.next_iter(it)) {
- AStar3D::Point *e = *(it.value); // The neighbour point
+ for (OAHashMap<int64_t, AStar3D::Point *>::Iterator it = p->neighbors.iter(); it.valid; it = p->neighbors.next_iter(it)) {
+ AStar3D::Point *e = *(it.value); // The neighbor point.
if (!e->enabled || e->closed_pass == astar.pass) {
continue;
@@ -837,9 +837,9 @@ bool AStar2D::_solve(AStar3D::Point *begin_point, AStar3D::Point *end_point) {
e->f_score = e->g_score + _estimate_cost(e->id, end_point->id);
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());
+ sorter.push_heap(0, open_list.size() - 1, 0, e, open_list.ptr());
} else {
- sorter.push_heap(0, open_list.find(e), 0, e, open_list.ptrw());
+ sorter.push_heap(0, open_list.find(e), 0, e, open_list.ptr());
}
}
}
diff --git a/core/math/a_star.h b/core/math/a_star.h
index a475e4f2fc..fc4bb09f03 100644
--- a/core/math/a_star.h
+++ b/core/math/a_star.h
@@ -52,7 +52,7 @@ class AStar3D : public RefCounted {
real_t weight_scale = 0;
bool enabled = false;
- OAHashMap<int64_t, Point *> neighbours = 4u;
+ OAHashMap<int64_t, Point *> neighbors = 4u;
OAHashMap<int64_t, Point *> unlinked_neighbours = 4u;
// Used for pathfinding.
diff --git a/core/math/a_star_grid_2d.cpp b/core/math/a_star_grid_2d.cpp
index 30d50073d7..139dc3afb1 100644
--- a/core/math/a_star_grid_2d.cpp
+++ b/core/math/a_star_grid_2d.cpp
@@ -265,7 +265,7 @@ AStarGrid2D::Point *AStarGrid2D::_jump(Point *p_from, Point *p_to) {
return nullptr;
}
-void AStarGrid2D::_get_nbors(Point *p_point, List<Point *> &r_nbors) {
+void AStarGrid2D::_get_nbors(Point *p_point, LocalVector<Point *> &r_nbors) {
bool ts0 = false, td0 = false,
ts1 = false, td1 = false,
ts2 = false, td2 = false,
@@ -378,7 +378,7 @@ bool AStarGrid2D::_solve(Point *p_begin_point, Point *p_end_point) {
bool found_route = false;
- Vector<Point *> open_list;
+ LocalVector<Point *> open_list;
SortArray<Point *, SortPoints> sorter;
p_begin_point->g_score = 0;
@@ -394,14 +394,14 @@ bool AStarGrid2D::_solve(Point *p_begin_point, Point *p_end_point) {
break;
}
- sorter.pop_heap(0, open_list.size(), open_list.ptrw()); // Remove the current point from the open list.
+ sorter.pop_heap(0, open_list.size(), open_list.ptr()); // Remove the current point from the open list.
open_list.remove_at(open_list.size() - 1);
p->closed_pass = pass; // Mark the point as closed.
- List<Point *> nbors;
+ LocalVector<Point *> nbors;
_get_nbors(p, nbors);
- for (List<Point *>::Element *E = nbors.front(); E; E = E->next()) {
- Point *e = E->get(); // The neighbour point.
+
+ for (Point *e : nbors) {
real_t weight_scale = 1.0;
if (jumping_enabled) {
@@ -433,9 +433,9 @@ bool AStarGrid2D::_solve(Point *p_begin_point, Point *p_end_point) {
e->f_score = e->g_score + _estimate_cost(e->id, p_end_point->id);
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());
+ sorter.push_heap(0, open_list.size() - 1, 0, e, open_list.ptr());
} else {
- sorter.push_heap(0, open_list.find(e), 0, e, open_list.ptrw());
+ sorter.push_heap(0, open_list.find(e), 0, e, open_list.ptr());
}
}
}
diff --git a/core/math/a_star_grid_2d.h b/core/math/a_star_grid_2d.h
index 6b9012a5e3..e4e62ec360 100644
--- a/core/math/a_star_grid_2d.h
+++ b/core/math/a_star_grid_2d.h
@@ -124,7 +124,7 @@ private: // Internal routines.
return &points[p_y][p_x];
}
- void _get_nbors(Point *p_point, List<Point *> &r_nbors);
+ void _get_nbors(Point *p_point, LocalVector<Point *> &r_nbors);
Point *_jump(Point *p_from, Point *p_to);
bool _solve(Point *p_begin_point, Point *p_end_point);
diff --git a/core/math/basis.cpp b/core/math/basis.cpp
index 39e383fb49..234a4ddb79 100644
--- a/core/math/basis.cpp
+++ b/core/math/basis.cpp
@@ -36,23 +36,6 @@
#define cofac(row1, col1, row2, col2) \
(rows[row1][col1] * rows[row2][col2] - rows[row1][col2] * rows[row2][col1])
-void Basis::from_z(const Vector3 &p_z) {
- if (Math::abs(p_z.z) > (real_t)Math_SQRT12) {
- // choose p in y-z plane
- real_t a = p_z[1] * p_z[1] + p_z[2] * p_z[2];
- real_t k = 1.0f / Math::sqrt(a);
- rows[0] = Vector3(0, -p_z[2] * k, p_z[1] * k);
- rows[1] = Vector3(a * k, -p_z[0] * rows[0][2], p_z[0] * rows[0][1]);
- } else {
- // choose p in x-y plane
- real_t a = p_z.x * p_z.x + p_z.y * p_z.y;
- real_t k = 1.0f / Math::sqrt(a);
- rows[0] = Vector3(-p_z.y * k, p_z.x * k, 0);
- rows[1] = Vector3(-p_z.z * rows[0].y, p_z.z * rows[0].x, a * k);
- }
- rows[2] = p_z;
-}
-
void Basis::invert() {
real_t co[3] = {
cofac(1, 1, 2, 2), cofac(1, 2, 2, 0), cofac(1, 0, 2, 1)
@@ -271,14 +254,6 @@ float Basis::get_uniform_scale() const {
return (rows[0].length() + rows[1].length() + rows[2].length()) / 3.0f;
}
-void Basis::make_scale_uniform() {
- float l = (rows[0].length() + rows[1].length() + rows[2].length()) / 3.0f;
- for (int i = 0; i < 3; i++) {
- rows[i].normalize();
- rows[i] *= l;
- }
-}
-
Basis Basis::scaled_local(const Vector3 &p_scale) const {
return (*this) * Basis::from_scale(p_scale);
}
diff --git a/core/math/basis.h b/core/math/basis.h
index b3197dbc84..bbc1d40469 100644
--- a/core/math/basis.h
+++ b/core/math/basis.h
@@ -56,8 +56,6 @@ struct _NO_DISCARD_ Basis {
_FORCE_INLINE_ real_t determinant() const;
- void from_z(const Vector3 &p_z);
-
void rotate(const Vector3 &p_axis, real_t p_angle);
Basis rotated(const Vector3 &p_axis, real_t p_angle) const;
@@ -101,8 +99,6 @@ struct _NO_DISCARD_ Basis {
void scale_orthogonal(const Vector3 &p_scale);
Basis scaled_orthogonal(const Vector3 &p_scale) const;
-
- void make_scale_uniform();
float get_uniform_scale() const;
Vector3 get_scale() const;
diff --git a/core/math/bvh.h b/core/math/bvh.h
index 9de704834b..ea8289607e 100644
--- a/core/math/bvh.h
+++ b/core/math/bvh.h
@@ -444,9 +444,7 @@ private:
params.result_array = nullptr;
params.subindex_array = nullptr;
- for (unsigned int n = 0; n < changed_items.size(); n++) {
- const BVHHandle &h = changed_items[n];
-
+ for (const BVHHandle &h : changed_items) {
// use the expanded aabb for pairing
const BOUNDS &expanded_aabb = tree._pairs[h.id()].expanded_aabb;
BVHABB_CLASS abb;
@@ -465,9 +463,7 @@ private:
params.result_count_overall = 0; // might not be needed
tree.cull_aabb(params, false);
- for (unsigned int i = 0; i < tree._cull_hits.size(); i++) {
- uint32_t ref_id = tree._cull_hits[i];
-
+ for (const uint32_t ref_id : tree._cull_hits) {
// don't collide against ourself
if (ref_id == changed_item_ref_id) {
continue;
@@ -784,7 +780,7 @@ private:
if (p_thread_safe) {
_mutex = p_mutex;
- if (_mutex->try_lock() != OK) {
+ if (!_mutex->try_lock()) {
WARN_PRINT("Info : multithread BVH access detected (benign)");
_mutex->lock();
}
diff --git a/core/math/bvh_abb.h b/core/math/bvh_abb.h
index 32b011bd3b..fb0207e0bd 100644
--- a/core/math/bvh_abb.h
+++ b/core/math/bvh_abb.h
@@ -87,7 +87,7 @@ struct BVH_ABB {
return -neg_max - min;
}
- POINT calculate_centre() const {
+ POINT calculate_center() const {
return POINT((calculate_size() * 0.5) + min);
}
diff --git a/core/math/bvh_split.inc b/core/math/bvh_split.inc
index 180bbfb511..875abedb70 100644
--- a/core/math/bvh_split.inc
+++ b/core/math/bvh_split.inc
@@ -25,7 +25,7 @@ void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, u
return;
}
- POINT centre = full_bound.calculate_centre();
+ POINT center = full_bound.calculate_center();
POINT size = full_bound.calculate_size();
int order[POINT::AXIS_COUNT];
@@ -43,7 +43,7 @@ void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, u
for (int a = 0; a < num_a; a++) {
uint32_t ind = group_a[a];
- if (temp_bounds[ind].min.coord[split_axis] > centre.coord[split_axis]) {
+ if (temp_bounds[ind].min.coord[split_axis] > center.coord[split_axis]) {
// add to b
group_b[num_b++] = ind;
@@ -75,7 +75,7 @@ void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, u
for (int a = 0; a < num_a; a++) {
uint32_t ind = group_a[a];
- if (temp_bounds[ind].min.coord[split_axis] > centre.coord[split_axis]) {
+ if (temp_bounds[ind].min.coord[split_axis] > center.coord[split_axis]) {
count++;
}
}
@@ -100,7 +100,7 @@ void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, u
for (int a = 0; a < num_a; a++) {
uint32_t ind = group_a[a];
- if (temp_bounds[ind].min.coord[split_axis] > centre.coord[split_axis]) {
+ if (temp_bounds[ind].min.coord[split_axis] > center.coord[split_axis]) {
// add to b
group_b[num_b++] = ind;
diff --git a/core/math/color.cpp b/core/math/color.cpp
index 5bae8d25d6..3e5fa7b402 100644
--- a/core/math/color.cpp
+++ b/core/math/color.cpp
@@ -194,7 +194,7 @@ void Color::set_hsv(float p_h, float p_s, float p_v, float p_alpha) {
a = p_alpha;
if (p_s == 0.0f) {
- // Achromatic (grey)
+ // Achromatic (gray)
r = g = b = p_v;
return;
}
diff --git a/core/math/delaunay_3d.h b/core/math/delaunay_3d.h
index 8ca38d571a..55923e0133 100644
--- a/core/math/delaunay_3d.h
+++ b/core/math/delaunay_3d.h
@@ -313,20 +313,20 @@ public:
//remove simplex and continue
simplex_list.erase(simplex->SE);
- for (uint32_t k = 0; k < simplex->grid_positions.size(); k++) {
- Vector3i p = simplex->grid_positions[k].pos;
- acceleration_grid[p.x][p.y][p.z].erase(simplex->grid_positions[k].E);
+ for (const GridPos &gp : simplex->grid_positions) {
+ Vector3i p = gp.pos;
+ acceleration_grid[p.x][p.y][p.z].erase(gp.E);
}
memdelete(simplex);
}
E = N;
}
- for (uint32_t j = 0; j < triangles.size(); j++) {
- if (triangles[j].bad) {
+ for (const Triangle &triangle : triangles) {
+ if (triangle.bad) {
continue;
}
- Simplex *new_simplex = memnew(Simplex(triangles[j].triangle[0], triangles[j].triangle[1], triangles[j].triangle[2], i));
+ Simplex *new_simplex = memnew(Simplex(triangle.triangle[0], triangle.triangle[1], triangle.triangle[2], i));
circum_sphere_compute(points, new_simplex);
new_simplex->SE = simplex_list.push_back(new_simplex);
{
diff --git a/core/math/expression.cpp b/core/math/expression.cpp
index da52bb9465..d1ec987d56 100644
--- a/core/math/expression.cpp
+++ b/core/math/expression.cpp
@@ -434,14 +434,13 @@ Error Expression::_get_token(Token &r_token) {
}
return OK;
- } else if (is_ascii_char(cchar) || is_underscore(cchar)) {
- String id;
- bool first = true;
+ } else if (is_unicode_identifier_start(cchar)) {
+ String id = String::chr(cchar);
+ cchar = GET_CHAR();
- while (is_ascii_char(cchar) || is_underscore(cchar) || (!first && is_digit(cchar))) {
+ while (is_unicode_identifier_continue(cchar)) {
id += String::chr(cchar);
cchar = GET_CHAR();
- first = false;
}
str_ofs--; //go back one
diff --git a/core/math/face3.cpp b/core/math/face3.cpp
index e53bbf872b..1dff0ee4a6 100644
--- a/core/math/face3.cpp
+++ b/core/math/face3.cpp
@@ -120,36 +120,6 @@ bool Face3::is_degenerate() const {
return (normal.length_squared() < (real_t)CMP_EPSILON2);
}
-Face3::Side Face3::get_side_of(const Face3 &p_face, ClockDirection p_clock_dir) const {
- int over = 0, under = 0;
-
- Plane plane = get_plane(p_clock_dir);
-
- for (int i = 0; i < 3; i++) {
- const Vector3 &v = p_face.vertex[i];
-
- if (plane.has_point(v)) { //coplanar, don't bother
- continue;
- }
-
- if (plane.is_point_over(v)) {
- over++;
- } else {
- under++;
- }
- }
-
- if (over > 0 && under == 0) {
- return SIDE_OVER;
- } else if (under > 0 && over == 0) {
- return SIDE_UNDER;
- } else if (under == 0 && over == 0) {
- return SIDE_COPLANAR;
- } else {
- return SIDE_SPANNING;
- }
-}
-
Vector3 Face3::get_random_point_inside() const {
real_t a = Math::random(0.0, 1.0);
real_t b = Math::random(0.0, 1.0);
@@ -164,20 +134,10 @@ Plane Face3::get_plane(ClockDirection p_dir) const {
return Plane(vertex[0], vertex[1], vertex[2], p_dir);
}
-Vector3 Face3::get_median_point() const {
- return (vertex[0] + vertex[1] + vertex[2]) / 3.0f;
-}
-
real_t Face3::get_area() const {
return vec3_cross(vertex[0] - vertex[1], vertex[0] - vertex[2]).length() * 0.5f;
}
-ClockDirection Face3::get_clock_dir() const {
- Vector3 normal = vec3_cross(vertex[0] - vertex[1], vertex[0] - vertex[2]);
- //printf("normal is %g,%g,%g x %g,%g,%g- wtfu is %g\n",tofloat(normal.x),tofloat(normal.y),tofloat(normal.z),tofloat(vertex[0].x),tofloat(vertex[0].y),tofloat(vertex[0].z),tofloat( normal.dot( vertex[0] ) ) );
- return (normal.dot(vertex[0]) >= 0) ? CLOCKWISE : COUNTERCLOCKWISE;
-}
-
bool Face3::intersects_aabb(const AABB &p_aabb) const {
/** TEST PLANE **/
if (!p_aabb.intersects_plane(get_plane())) {
diff --git a/core/math/face3.h b/core/math/face3.h
index 3d87de03dc..3dd47d0226 100644
--- a/core/math/face3.h
+++ b/core/math/face3.h
@@ -57,19 +57,14 @@ struct _NO_DISCARD_ Face3 {
Plane get_plane(ClockDirection p_dir = CLOCKWISE) const;
Vector3 get_random_point_inside() const;
- Side get_side_of(const Face3 &p_face, ClockDirection p_clock_dir = CLOCKWISE) const;
-
bool is_degenerate() const;
real_t get_area() const;
- Vector3 get_median_point() const;
Vector3 get_closest_point_to(const Vector3 &p_point) const;
bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection = nullptr) const;
bool intersects_segment(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection = nullptr) const;
- ClockDirection get_clock_dir() const; ///< todo, test if this is returning the proper clockwisity
-
void get_support(const Vector3 &p_normal, const Transform3D &p_transform, Vector3 *p_vertices, int *p_count, int p_max) const;
void project_range(const Vector3 &p_normal, const Transform3D &p_transform, real_t &r_min, real_t &r_max) const;
diff --git a/core/math/geometry_2d.cpp b/core/math/geometry_2d.cpp
index a0b76d31cb..74cb92539a 100644
--- a/core/math/geometry_2d.cpp
+++ b/core/math/geometry_2d.cpp
@@ -320,41 +320,6 @@ Vector<Vector<Point2>> Geometry2D::_polypath_offset(const Vector<Point2> &p_poly
return polypaths;
}
-Vector<Point2i> Geometry2D::pack_rects(const Vector<Size2i> &p_sizes, const Size2i &p_atlas_size) {
- Vector<stbrp_node> nodes;
- nodes.resize(p_atlas_size.width);
-
- stbrp_context context;
- stbrp_init_target(&context, p_atlas_size.width, p_atlas_size.height, nodes.ptrw(), p_atlas_size.width);
-
- Vector<stbrp_rect> rects;
- rects.resize(p_sizes.size());
-
- for (int i = 0; i < p_sizes.size(); i++) {
- rects.write[i].id = 0;
- rects.write[i].w = p_sizes[i].width;
- rects.write[i].h = p_sizes[i].height;
- rects.write[i].x = 0;
- rects.write[i].y = 0;
- rects.write[i].was_packed = 0;
- }
-
- int res = stbrp_pack_rects(&context, rects.ptrw(), rects.size());
- if (res == 0) { //pack failed
- return Vector<Point2i>();
- }
-
- Vector<Point2i> ret;
- ret.resize(p_sizes.size());
-
- for (int i = 0; i < p_sizes.size(); i++) {
- Point2i r(rects[i].x, rects[i].y);
- ret.write[i] = r;
- }
-
- return ret;
-}
-
Vector<Vector3i> Geometry2D::partial_pack_rects(const Vector<Vector2i> &p_sizes, const Size2i &p_atlas_size) {
Vector<stbrp_node> nodes;
nodes.resize(p_atlas_size.width);
diff --git a/core/math/geometry_2d.h b/core/math/geometry_2d.h
index b55aecf85e..0e5702e0af 100644
--- a/core/math/geometry_2d.h
+++ b/core/math/geometry_2d.h
@@ -464,7 +464,6 @@ public:
static Vector<Vector<Vector2>> decompose_polygon_in_convex(Vector<Point2> polygon);
static void make_atlas(const Vector<Size2i> &p_rects, Vector<Point2i> &r_result, Size2i &r_size);
- static Vector<Point2i> pack_rects(const Vector<Size2i> &p_sizes, const Size2i &p_atlas_size);
static Vector<Vector3i> partial_pack_rects(const Vector<Vector2i> &p_sizes, const Size2i &p_atlas_size);
private:
diff --git a/core/math/geometry_3d.cpp b/core/math/geometry_3d.cpp
index c04fe7320d..590483bf20 100644
--- a/core/math/geometry_3d.cpp
+++ b/core/math/geometry_3d.cpp
@@ -141,21 +141,19 @@ real_t Geometry3D::get_closest_distance_between_segments(const Vector3 &p_p0, co
void Geometry3D::MeshData::optimize_vertices() {
HashMap<int, int> vtx_remap;
- for (uint32_t i = 0; i < faces.size(); i++) {
- for (uint32_t j = 0; j < faces[i].indices.size(); j++) {
- int idx = faces[i].indices[j];
- if (!vtx_remap.has(idx)) {
+ for (MeshData::Face &face : faces) {
+ for (int &index : face.indices) {
+ if (!vtx_remap.has(index)) {
int ni = vtx_remap.size();
- vtx_remap[idx] = ni;
+ vtx_remap[index] = ni;
}
-
- faces[i].indices[j] = vtx_remap[idx];
+ index = vtx_remap[index];
}
}
- for (uint32_t i = 0; i < edges.size(); i++) {
- int a = edges[i].vertex_a;
- int b = edges[i].vertex_b;
+ for (MeshData::Edge &edge : edges) {
+ int a = edge.vertex_a;
+ int b = edge.vertex_b;
if (!vtx_remap.has(a)) {
int ni = vtx_remap.size();
@@ -166,8 +164,8 @@ void Geometry3D::MeshData::optimize_vertices() {
vtx_remap[b] = ni;
}
- edges[i].vertex_a = vtx_remap[a];
- edges[i].vertex_b = vtx_remap[b];
+ edge.vertex_a = vtx_remap[a];
+ edge.vertex_b = vtx_remap[b];
}
LocalVector<Vector3> new_vertices;
@@ -198,149 +196,6 @@ struct _FaceClassify {
_FaceClassify() {}
};
-static bool _connect_faces(_FaceClassify *p_faces, int len, int p_group) {
- // Connect faces, error will occur if an edge is shared between more than 2 faces.
- // Clear connections.
-
- bool error = false;
-
- for (int i = 0; i < len; i++) {
- for (int j = 0; j < 3; j++) {
- p_faces[i].links[j].clear();
- }
- }
-
- for (int i = 0; i < len; i++) {
- if (p_faces[i].group != p_group) {
- continue;
- }
- for (int j = i + 1; j < len; j++) {
- if (p_faces[j].group != p_group) {
- continue;
- }
-
- for (int k = 0; k < 3; k++) {
- Vector3 vi1 = p_faces[i].face.vertex[k];
- Vector3 vi2 = p_faces[i].face.vertex[(k + 1) % 3];
-
- for (int l = 0; l < 3; l++) {
- Vector3 vj2 = p_faces[j].face.vertex[l];
- Vector3 vj1 = p_faces[j].face.vertex[(l + 1) % 3];
-
- if (vi1.distance_to(vj1) < 0.00001f &&
- vi2.distance_to(vj2) < 0.00001f) {
- if (p_faces[i].links[k].face != -1) {
- ERR_PRINT("already linked\n");
- error = true;
- break;
- }
- if (p_faces[j].links[l].face != -1) {
- ERR_PRINT("already linked\n");
- error = true;
- break;
- }
-
- p_faces[i].links[k].face = j;
- p_faces[i].links[k].edge = l;
- p_faces[j].links[l].face = i;
- p_faces[j].links[l].edge = k;
- }
- }
- if (error) {
- break;
- }
- }
- if (error) {
- break;
- }
- }
- if (error) {
- break;
- }
- }
-
- for (int i = 0; i < len; i++) {
- p_faces[i].valid = true;
- for (int j = 0; j < 3; j++) {
- if (p_faces[i].links[j].face == -1) {
- p_faces[i].valid = false;
- }
- }
- }
- return error;
-}
-
-static bool _group_face(_FaceClassify *p_faces, int len, int p_index, int p_group) {
- if (p_faces[p_index].group >= 0) {
- return false;
- }
-
- p_faces[p_index].group = p_group;
-
- for (int i = 0; i < 3; i++) {
- ERR_FAIL_INDEX_V(p_faces[p_index].links[i].face, len, true);
- _group_face(p_faces, len, p_faces[p_index].links[i].face, p_group);
- }
-
- return true;
-}
-
-Vector<Vector<Face3>> Geometry3D::separate_objects(Vector<Face3> p_array) {
- Vector<Vector<Face3>> objects;
-
- int len = p_array.size();
-
- const Face3 *arrayptr = p_array.ptr();
-
- Vector<_FaceClassify> fc;
-
- fc.resize(len);
-
- _FaceClassify *_fcptr = fc.ptrw();
-
- for (int i = 0; i < len; i++) {
- _fcptr[i].face = arrayptr[i];
- }
-
- bool error = _connect_faces(_fcptr, len, -1);
-
- ERR_FAIL_COND_V_MSG(error, Vector<Vector<Face3>>(), "Invalid geometry.");
-
- // Group connected faces in separate objects.
-
- int group = 0;
- for (int i = 0; i < len; i++) {
- if (!_fcptr[i].valid) {
- continue;
- }
- if (_group_face(_fcptr, len, i, group)) {
- group++;
- }
- }
-
- // Group connected faces in separate objects.
-
- for (int i = 0; i < len; i++) {
- _fcptr[i].face = arrayptr[i];
- }
-
- if (group >= 0) {
- objects.resize(group);
- Vector<Face3> *group_faces = objects.ptrw();
-
- for (int i = 0; i < len; i++) {
- if (!_fcptr[i].valid) {
- continue;
- }
- if (_fcptr[i].group >= 0 && _fcptr[i].group < group) {
- group_faces[_fcptr[i].group].push_back(_fcptr[i].face);
- }
- }
- }
-
- return objects;
-}
-
/*** GEOMETRY WRAPPER ***/
enum _CellFlags {
@@ -816,10 +671,10 @@ Geometry3D::MeshData Geometry3D::build_convex_mesh(const Vector<Plane> &p_planes
MeshData::Face face;
// Add face indices.
- for (uint32_t j = 0; j < vertices.size(); j++) {
+ for (const Vector3 &vertex : vertices) {
int idx = -1;
for (uint32_t k = 0; k < mesh.vertices.size(); k++) {
- if (mesh.vertices[k].distance_to(vertices[j]) < 0.001f) {
+ if (mesh.vertices[k].distance_to(vertex) < 0.001f) {
idx = k;
break;
}
@@ -827,7 +682,7 @@ Geometry3D::MeshData Geometry3D::build_convex_mesh(const Vector<Plane> &p_planes
if (idx == -1) {
idx = mesh.vertices.size();
- mesh.vertices.push_back(vertices[j]);
+ mesh.vertices.push_back(vertex);
}
face.indices.push_back(idx);
diff --git a/core/math/geometry_3d.h b/core/math/geometry_3d.h
index 6759db5766..99c554fe05 100644
--- a/core/math/geometry_3d.h
+++ b/core/math/geometry_3d.h
@@ -532,8 +532,6 @@ public:
return clipped;
}
- static Vector<Vector<Face3>> separate_objects(Vector<Face3> p_array);
-
// Create a "wrap" that encloses the given geometry.
static Vector<Face3> wrap_geometry(Vector<Face3> p_array, real_t *p_error = nullptr);
diff --git a/core/math/transform_2d.cpp b/core/math/transform_2d.cpp
index 6a7ee32230..96010b4096 100644
--- a/core/math/transform_2d.cpp
+++ b/core/math/transform_2d.cpp
@@ -221,12 +221,6 @@ Transform2D Transform2D::operator*(const Transform2D &p_transform) const {
return t;
}
-Transform2D Transform2D::basis_scaled(const Size2 &p_scale) const {
- Transform2D copy = *this;
- copy.scale_basis(p_scale);
- return copy;
-}
-
Transform2D Transform2D::scaled(const Size2 &p_scale) const {
// Equivalent to left multiplication
Transform2D copy = *this;
@@ -269,39 +263,12 @@ real_t Transform2D::basis_determinant() const {
return columns[0].x * columns[1].y - columns[0].y * columns[1].x;
}
-Transform2D Transform2D::interpolate_with(const Transform2D &p_transform, const real_t p_c) const {
- //extract parameters
- Vector2 p1 = get_origin();
- Vector2 p2 = p_transform.get_origin();
-
- real_t r1 = get_rotation();
- real_t r2 = p_transform.get_rotation();
-
- Size2 s1 = get_scale();
- Size2 s2 = p_transform.get_scale();
-
- //slerp rotation
- Vector2 v1(Math::cos(r1), Math::sin(r1));
- Vector2 v2(Math::cos(r2), Math::sin(r2));
-
- real_t dot = v1.dot(v2);
-
- dot = CLAMP(dot, (real_t)-1.0, (real_t)1.0);
-
- Vector2 v;
-
- if (dot > 0.9995f) {
- v = v1.lerp(v2, p_c).normalized(); //linearly interpolate to avoid numerical precision issues
- } else {
- real_t angle = p_c * Math::acos(dot);
- Vector2 v3 = (v2 - v1 * dot).normalized();
- v = v1 * Math::cos(angle) + v3 * Math::sin(angle);
- }
-
- //construct matrix
- Transform2D res(v.angle(), p1.lerp(p2, p_c));
- res.scale_basis(s1.lerp(s2, p_c));
- return res;
+Transform2D Transform2D::interpolate_with(const Transform2D &p_transform, const real_t p_weight) const {
+ return Transform2D(
+ Math::lerp_angle(get_rotation(), p_transform.get_rotation(), p_weight),
+ get_scale().lerp(p_transform.get_scale(), p_weight),
+ Math::lerp_angle(get_skew(), p_transform.get_skew(), p_weight),
+ get_origin().lerp(p_transform.get_origin(), p_weight));
}
void Transform2D::operator*=(const real_t p_val) {
diff --git a/core/math/transform_2d.h b/core/math/transform_2d.h
index 2a0917c63f..4a17a9db37 100644
--- a/core/math/transform_2d.h
+++ b/core/math/transform_2d.h
@@ -85,7 +85,6 @@ struct _NO_DISCARD_ Transform2D {
_FORCE_INLINE_ const Vector2 &get_origin() const { return columns[2]; }
_FORCE_INLINE_ void set_origin(const Vector2 &p_origin) { columns[2] = p_origin; }
- Transform2D basis_scaled(const Size2 &p_scale) const;
Transform2D scaled(const Size2 &p_scale) const;
Transform2D scaled_local(const Size2 &p_scale) const;
Transform2D translated(const Vector2 &p_offset) const;
diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp
index 4b6921d38b..0da1b8c7ad 100644
--- a/core/math/triangle_mesh.cpp
+++ b/core/math/triangle_mesh.cpp
@@ -182,90 +182,6 @@ void TriangleMesh::create(const Vector<Vector3> &p_faces, const Vector<int32_t>
valid = true;
}
-Vector3 TriangleMesh::get_area_normal(const AABB &p_aabb) const {
- uint32_t *stack = (uint32_t *)alloca(sizeof(int) * max_depth);
-
- enum {
- TEST_AABB_BIT = 0,
- VISIT_LEFT_BIT = 1,
- VISIT_RIGHT_BIT = 2,
- VISIT_DONE_BIT = 3,
- VISITED_BIT_SHIFT = 29,
- NODE_IDX_MASK = (1 << VISITED_BIT_SHIFT) - 1,
- VISITED_BIT_MASK = ~NODE_IDX_MASK,
-
- };
-
- int n_count = 0;
- Vector3 n;
-
- int level = 0;
-
- const Triangle *triangleptr = triangles.ptr();
- // const Vector3 *verticesr = vertices.ptr();
- const BVH *bvhptr = bvh.ptr();
-
- int pos = bvh.size() - 1;
-
- stack[0] = pos;
- while (true) {
- uint32_t node = stack[level] & NODE_IDX_MASK;
- const BVH &b = bvhptr[node];
- bool done = false;
-
- switch (stack[level] >> VISITED_BIT_SHIFT) {
- case TEST_AABB_BIT: {
- if (!b.aabb.intersects(p_aabb)) {
- stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
- } else {
- if (b.face_index >= 0) {
- const Triangle &s = triangleptr[b.face_index];
- n += s.normal;
- n_count++;
-
- stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
-
- } else {
- stack[level] = (VISIT_LEFT_BIT << VISITED_BIT_SHIFT) | node;
- }
- }
- continue;
- }
- case VISIT_LEFT_BIT: {
- stack[level] = (VISIT_RIGHT_BIT << VISITED_BIT_SHIFT) | node;
- level++;
- stack[level] = b.left | TEST_AABB_BIT;
- continue;
- }
- case VISIT_RIGHT_BIT: {
- stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
- level++;
- stack[level] = b.right | TEST_AABB_BIT;
- continue;
- }
- case VISIT_DONE_BIT: {
- if (level == 0) {
- done = true;
- break;
- } else {
- level--;
- }
- continue;
- }
- }
-
- if (done) {
- break;
- }
- }
-
- if (n_count > 0) {
- n /= n_count;
- }
-
- return n;
-}
-
bool TriangleMesh::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_point, Vector3 &r_normal, int32_t *r_surf_index) const {
uint32_t *stack = (uint32_t *)alloca(sizeof(int) * max_depth);
@@ -468,118 +384,6 @@ bool TriangleMesh::intersect_ray(const Vector3 &p_begin, const Vector3 &p_dir, V
return inters;
}
-bool TriangleMesh::intersect_convex_shape(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count) const {
- uint32_t *stack = (uint32_t *)alloca(sizeof(int) * max_depth);
-
- //p_fully_inside = true;
-
- enum {
- TEST_AABB_BIT = 0,
- VISIT_LEFT_BIT = 1,
- VISIT_RIGHT_BIT = 2,
- VISIT_DONE_BIT = 3,
- VISITED_BIT_SHIFT = 29,
- NODE_IDX_MASK = (1 << VISITED_BIT_SHIFT) - 1,
- VISITED_BIT_MASK = ~NODE_IDX_MASK,
-
- };
-
- int level = 0;
-
- const Triangle *triangleptr = triangles.ptr();
- const Vector3 *vertexptr = vertices.ptr();
- const BVH *bvhptr = bvh.ptr();
-
- int pos = bvh.size() - 1;
-
- stack[0] = pos;
- while (true) {
- uint32_t node = stack[level] & NODE_IDX_MASK;
- const BVH &b = bvhptr[node];
- bool done = false;
-
- switch (stack[level] >> VISITED_BIT_SHIFT) {
- case TEST_AABB_BIT: {
- if (!b.aabb.intersects_convex_shape(p_planes, p_plane_count, p_points, p_point_count)) {
- stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
- } else {
- if (b.face_index >= 0) {
- const Triangle &s = triangleptr[b.face_index];
-
- for (int j = 0; j < 3; ++j) {
- const Vector3 &point = vertexptr[s.indices[j]];
- const Vector3 &next_point = vertexptr[s.indices[(j + 1) % 3]];
- Vector3 res;
- bool over = true;
- for (int i = 0; i < p_plane_count; i++) {
- const Plane &p = p_planes[i];
-
- if (p.intersects_segment(point, next_point, &res)) {
- bool inisde = true;
- for (int k = 0; k < p_plane_count; k++) {
- if (k == i) {
- continue;
- }
- const Plane &pp = p_planes[k];
- if (pp.is_point_over(res)) {
- inisde = false;
- break;
- }
- }
- if (inisde) {
- return true;
- }
- }
-
- if (p.is_point_over(point)) {
- over = false;
- break;
- }
- }
- if (over) {
- return true;
- }
- }
-
- stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
-
- } else {
- stack[level] = (VISIT_LEFT_BIT << VISITED_BIT_SHIFT) | node;
- }
- }
- continue;
- }
- case VISIT_LEFT_BIT: {
- stack[level] = (VISIT_RIGHT_BIT << VISITED_BIT_SHIFT) | node;
- level++;
- stack[level] = b.left | TEST_AABB_BIT;
- continue;
- }
- case VISIT_RIGHT_BIT: {
- stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
- level++;
- stack[level] = b.right | TEST_AABB_BIT;
- continue;
- }
- case VISIT_DONE_BIT: {
- if (level == 0) {
- done = true;
- break;
- } else {
- level--;
- }
- continue;
- }
- }
-
- if (done) {
- break;
- }
- }
-
- return false;
-}
-
bool TriangleMesh::inside_convex_shape(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count, Vector3 p_scale) const {
uint32_t *stack = (uint32_t *)alloca(sizeof(int) * max_depth);
diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h
index 728fd600d5..24fc12dda9 100644
--- a/core/math/triangle_mesh.h
+++ b/core/math/triangle_mesh.h
@@ -84,9 +84,7 @@ public:
bool is_valid() const;
bool intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_point, Vector3 &r_normal, int32_t *r_surf_index = nullptr) const;
bool intersect_ray(const Vector3 &p_begin, const Vector3 &p_dir, Vector3 &r_point, Vector3 &r_normal, int32_t *r_surf_index = nullptr) const;
- bool intersect_convex_shape(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count) const;
bool inside_convex_shape(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count, Vector3 p_scale = Vector3(1, 1, 1)) const;
- Vector3 get_area_normal(const AABB &p_aabb) const;
Vector<Face3> get_faces() const;
const Vector<Triangle> &get_triangles() const { return triangles; }
diff --git a/core/object/make_virtuals.py b/core/object/make_virtuals.py
index 0ee95835a6..18f27ae4a4 100644
--- a/core/object/make_virtuals.py
+++ b/core/object/make_virtuals.py
@@ -72,6 +72,7 @@ def generate_version(argcount, const=False, returns=False):
s = s.replace("$RVOID", "(void)r_ret;") # If required, may lead to uninitialized errors
s = s.replace("$CALLPTRRETDEF", "PtrToArg<m_ret>::EncodeT ret;")
method_info += "\tmethod_info.return_val = GetTypeInfo<m_ret>::get_class_info();\\\n"
+ method_info += "\tmethod_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\\\n"
else:
s = s.replace("$RET", "")
s = s.replace("$RVOID", "")
@@ -113,6 +114,9 @@ def generate_version(argcount, const=False, returns=False):
)
callptrargsptr += "&argval" + str(i + 1)
method_info += "\tmethod_info.arguments.push_back(GetTypeInfo<m_type" + str(i + 1) + ">::get_class_info());\\\n"
+ method_info += (
+ "\tmethod_info.arguments_metadata.push_back(GetTypeInfo<m_type" + str(i + 1) + ">::METADATA);\\\n"
+ )
if argcount:
callsiargs += "};\\\n"
diff --git a/core/object/object.cpp b/core/object/object.cpp
index 2cb56dfe6c..57aa1339ec 100644
--- a/core/object/object.cpp
+++ b/core/object/object.cpp
@@ -499,7 +499,7 @@ void Object::get_property_list(List<PropertyInfo> *p_list, bool p_reversed) cons
_get_property_listv(p_list, p_reversed);
if (!is_class("Script")) { // can still be set, but this is for user-friendliness
- p_list->push_back(PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script", PROPERTY_USAGE_DEFAULT));
+ p_list->push_back(PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_NEVER_DUPLICATE));
}
if (script_instance && !p_reversed) {
@@ -1549,7 +1549,9 @@ void Object::_bind_methods() {
#define BIND_OBJ_CORE_METHOD(m_method) \
::ClassDB::add_virtual_method(get_class_static(), m_method, true, Vector<String>(), true);
- BIND_OBJ_CORE_METHOD(MethodInfo("_notification", PropertyInfo(Variant::INT, "what")));
+ MethodInfo notification_mi("_notification", PropertyInfo(Variant::INT, "what"));
+ notification_mi.arguments_metadata.push_back(GodotTypeInfo::Metadata::METADATA_INT_IS_INT32);
+ BIND_OBJ_CORE_METHOD(notification_mi);
BIND_OBJ_CORE_METHOD(MethodInfo(Variant::BOOL, "_set", PropertyInfo(Variant::STRING_NAME, "property"), PropertyInfo(Variant::NIL, "value")));
#ifdef TOOLS_ENABLED
MethodInfo miget("_get", PropertyInfo(Variant::STRING_NAME, "property"));
diff --git a/core/object/object.h b/core/object/object.h
index f78c7c34fd..5ec69a371b 100644
--- a/core/object/object.h
+++ b/core/object/object.h
@@ -109,15 +109,16 @@ enum PropertyUsageFlags {
PROPERTY_USAGE_CLASS_IS_ENUM = 1 << 16,
PROPERTY_USAGE_NIL_IS_VARIANT = 1 << 17,
PROPERTY_USAGE_ARRAY = 1 << 18, // Used in the inspector to group properties as elements of an array.
- PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE = 1 << 19, // If the object is duplicated also this property will be duplicated.
- PROPERTY_USAGE_HIGH_END_GFX = 1 << 20,
- PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT = 1 << 21,
- PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT = 1 << 22,
- PROPERTY_USAGE_KEYING_INCREMENTS = 1 << 23, // Used in inspector to increment property when keyed in animation player.
- PROPERTY_USAGE_DEFERRED_SET_RESOURCE = 1 << 24, // when loading, the resource for this property can be set at the end of loading.
- PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT = 1 << 25, // For Object properties, instantiate them when creating in editor.
- PROPERTY_USAGE_EDITOR_BASIC_SETTING = 1 << 26, //for project or editor settings, show when basic settings are selected.
- PROPERTY_USAGE_READ_ONLY = 1 << 27, // Mark a property as read-only in the inspector.
+ PROPERTY_USAGE_ALWAYS_DUPLICATE = 1 << 19, // When duplicating a resource, always duplicate, even with subresource duplication disabled.
+ PROPERTY_USAGE_NEVER_DUPLICATE = 1 << 20, // When duplicating a resource, never duplicate, even with subresource duplication enabled.
+ PROPERTY_USAGE_HIGH_END_GFX = 1 << 21,
+ PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT = 1 << 22,
+ PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT = 1 << 23,
+ PROPERTY_USAGE_KEYING_INCREMENTS = 1 << 24, // Used in inspector to increment property when keyed in animation player.
+ PROPERTY_USAGE_DEFERRED_SET_RESOURCE = 1 << 25, // when loading, the resource for this property can be set at the end of loading.
+ PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT = 1 << 26, // For Object properties, instantiate them when creating in editor.
+ PROPERTY_USAGE_EDITOR_BASIC_SETTING = 1 << 27, //for project or editor settings, show when basic settings are selected.
+ PROPERTY_USAGE_READ_ONLY = 1 << 28, // Mark a property as read-only in the inspector.
PROPERTY_USAGE_DEFAULT = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR,
PROPERTY_USAGE_NO_EDITOR = PROPERTY_USAGE_STORAGE,
@@ -222,6 +223,16 @@ struct MethodInfo {
int id = 0;
List<PropertyInfo> arguments;
Vector<Variant> default_arguments;
+ int return_val_metadata = 0;
+ Vector<int> arguments_metadata;
+
+ int get_argument_meta(int p_arg) const {
+ ERR_FAIL_COND_V(p_arg < -1 || p_arg > arguments.size(), 0);
+ if (p_arg == -1) {
+ return return_val_metadata;
+ }
+ return arguments_metadata.size() > p_arg ? arguments_metadata[p_arg] : 0;
+ }
inline bool operator==(const MethodInfo &p_method) const { return id == p_method.id; }
inline bool operator<(const MethodInfo &p_method) const { return id == p_method.id ? (name < p_method.name) : (id < p_method.id); }
diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp
index 66ef418e42..61f5cfc22a 100644
--- a/core/object/script_language.cpp
+++ b/core/object/script_language.cpp
@@ -245,9 +245,12 @@ void ScriptServer::thread_exit() {
}
HashMap<StringName, ScriptServer::GlobalScriptClass> ScriptServer::global_classes;
+HashMap<StringName, Vector<StringName>> ScriptServer::inheriters_cache;
+bool ScriptServer::inheriters_cache_dirty = true;
void ScriptServer::global_classes_clear() {
global_classes.clear();
+ inheriters_cache.clear();
}
void ScriptServer::add_global_class(const StringName &p_class, const StringName &p_base, const StringName &p_language, const String &p_path) {
@@ -257,16 +260,44 @@ void ScriptServer::add_global_class(const StringName &p_class, const StringName
g.path = p_path;
g.base = p_base;
global_classes[p_class] = g;
+ inheriters_cache_dirty = true;
}
void ScriptServer::remove_global_class(const StringName &p_class) {
global_classes.erase(p_class);
+ inheriters_cache_dirty = true;
+}
+
+void ScriptServer::get_inheriters_list(const StringName &p_base_type, List<StringName> *r_classes) {
+ if (inheriters_cache_dirty) {
+ inheriters_cache.clear();
+ for (const KeyValue<StringName, GlobalScriptClass> &K : global_classes) {
+ if (!inheriters_cache.has(K.value.base)) {
+ inheriters_cache[K.value.base] = Vector<StringName>();
+ }
+ inheriters_cache[K.value.base].push_back(K.key);
+ }
+ for (KeyValue<StringName, Vector<StringName>> &K : inheriters_cache) {
+ K.value.sort_custom<StringName::AlphCompare>();
+ }
+ inheriters_cache_dirty = false;
+ }
+
+ if (!inheriters_cache.has(p_base_type)) {
+ return;
+ }
+
+ const Vector<StringName> &v = inheriters_cache[p_base_type];
+ for (int i = 0; i < v.size(); i++) {
+ r_classes->push_back(v[i]);
+ }
}
void ScriptServer::remove_global_class_by_path(const String &p_path) {
for (const KeyValue<StringName, GlobalScriptClass> &kv : global_classes) {
if (kv.value.path == p_path) {
global_classes.erase(kv.key);
+ inheriters_cache_dirty = true;
return;
}
}
@@ -338,6 +369,14 @@ void ScriptServer::save_global_classes() {
ProjectSettings::get_singleton()->store_global_class_list(gcarr);
}
+bool ScriptServer::has_global_classes() {
+ return !global_classes.is_empty();
+}
+
+String ScriptServer::get_global_class_cache_file_path() {
+ return ProjectSettings::get_singleton()->get_global_class_list_path();
+}
+
////////////////////
Variant ScriptInstance::call_const(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
diff --git a/core/object/script_language.h b/core/object/script_language.h
index 02d1880dc2..b1393c7196 100644
--- a/core/object/script_language.h
+++ b/core/object/script_language.h
@@ -56,10 +56,12 @@ class ScriptServer {
struct GlobalScriptClass {
StringName language;
String path;
- String base;
+ StringName base;
};
static HashMap<StringName, GlobalScriptClass> global_classes;
+ static HashMap<StringName, Vector<StringName>> inheriters_cache;
+ static bool inheriters_cache_dirty;
public:
static ScriptEditRequestFunction edit_request_func;
@@ -87,7 +89,10 @@ public:
static StringName get_global_class_base(const String &p_class);
static StringName get_global_class_native_base(const String &p_class);
static void get_global_class_list(List<StringName> *r_global_classes);
+ static void get_inheriters_list(const StringName &p_base_type, List<StringName> *r_classes);
static void save_global_classes();
+ static bool has_global_classes();
+ static String get_global_class_cache_file_path();
static void init_languages();
static void finish_languages();
@@ -120,7 +125,7 @@ public:
virtual bool can_instantiate() const = 0;
virtual Ref<Script> get_base_script() const = 0; //for script inheritance
-
+ virtual StringName get_global_name() const = 0;
virtual bool inherits_script(const Ref<Script> &p_script) const = 0;
virtual StringName get_instance_base_type() const = 0; // this may not work in all scripts, will return empty if so
diff --git a/core/object/script_language_extension.h b/core/object/script_language_extension.h
index 912f2218c4..8e162a1b0f 100644
--- a/core/object/script_language_extension.h
+++ b/core/object/script_language_extension.h
@@ -53,6 +53,7 @@ protected:
public:
EXBIND0RC(bool, can_instantiate)
EXBIND0RC(Ref<Script>, get_base_script)
+ EXBIND0RC(StringName, get_global_name)
EXBIND1RC(bool, inherits_script, const Ref<Script> &)
EXBIND0RC(StringName, get_instance_base_type)
diff --git a/core/object/undo_redo.cpp b/core/object/undo_redo.cpp
index e84933eb69..077929351e 100644
--- a/core/object/undo_redo.cpp
+++ b/core/object/undo_redo.cpp
@@ -99,8 +99,7 @@ void UndoRedo::create_action(const String &p_name, MergeMode p_mode) {
}
}
- for (unsigned int i = 0; i < to_remove.size(); i++) {
- List<Operation>::Element *E = to_remove[i];
+ for (List<Operation>::Element *E : to_remove) {
// Delete all object references
E->get().delete_reference();
E->erase();
diff --git a/core/object/worker_thread_pool.cpp b/core/object/worker_thread_pool.cpp
index fc907b2301..721c8d0a10 100644
--- a/core/object/worker_thread_pool.cpp
+++ b/core/object/worker_thread_pool.cpp
@@ -377,11 +377,11 @@ void WorkerThreadPool::wait_for_group_task_completion(GroupID p_group) {
Group *group = *groupp;
if (group->low_priority_native_tasks.size() > 0) {
- for (uint32_t i = 0; i < group->low_priority_native_tasks.size(); i++) {
- group->low_priority_native_tasks[i]->low_priority_thread->wait_to_finish();
- native_thread_allocator.free(group->low_priority_native_tasks[i]->low_priority_thread);
+ for (Task *task : group->low_priority_native_tasks) {
+ task->low_priority_thread->wait_to_finish();
+ native_thread_allocator.free(task->low_priority_thread);
task_mutex.lock();
- task_allocator.free(group->low_priority_native_tasks[i]);
+ task_allocator.free(task);
task_mutex.unlock();
}
@@ -449,8 +449,8 @@ void WorkerThreadPool::finish() {
task_available_semaphore.post();
}
- for (uint32_t i = 0; i < threads.size(); i++) {
- threads[i].thread.wait_to_finish();
+ for (ThreadData &data : threads) {
+ data.thread.wait_to_finish();
}
threads.clear();
diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp
index 5183b77cb1..25a4b320cd 100644
--- a/core/os/keyboard.cpp
+++ b/core/os/keyboard.cpp
@@ -127,14 +127,9 @@ static const _KeyCodeText _keycodes[] = {
{Key::KP_7 ,"Kp 7"},
{Key::KP_8 ,"Kp 8"},
{Key::KP_9 ,"Kp 9"},
- {Key::SUPER_L ,"Super L"},
- {Key::SUPER_R ,"Super R"},
{Key::MENU ,"Menu"},
- {Key::HYPER_L ,"Hyper L"},
- {Key::HYPER_R ,"Hyper R"},
+ {Key::HYPER ,"Hyper"},
{Key::HELP ,"Help"},
- {Key::DIRECTION_L ,"Direction L"},
- {Key::DIRECTION_R ,"Direction R"},
{Key::BACK ,"Back"},
{Key::FORWARD ,"Forward"},
{Key::STOP ,"Stop"},
@@ -142,11 +137,6 @@ static const _KeyCodeText _keycodes[] = {
{Key::VOLUMEDOWN ,"VolumeDown"},
{Key::VOLUMEMUTE ,"VolumeMute"},
{Key::VOLUMEUP ,"VolumeUp"},
- {Key::BASSBOOST ,"BassBoost"},
- {Key::BASSUP ,"BassUp"},
- {Key::BASSDOWN ,"BassDown"},
- {Key::TREBLEUP ,"TrebleUp"},
- {Key::TREBLEDOWN ,"TrebleDown"},
{Key::MEDIAPLAY ,"MediaPlay"},
{Key::MEDIASTOP ,"MediaStop"},
{Key::MEDIAPREVIOUS ,"MediaPrevious"},
@@ -174,6 +164,10 @@ static const _KeyCodeText _keycodes[] = {
{Key::LAUNCHD ,"LaunchD"},
{Key::LAUNCHE ,"LaunchE"},
{Key::LAUNCHF ,"LaunchF"},
+ {Key::GLOBE ,"Globe"},
+ {Key::KEYBOARD ,"On-screen keyboard"},
+ {Key::JIS_EISU ,"JIS Eisu"},
+ {Key::JIS_KANA ,"JIS Kana"},
{Key::UNKNOWN ,"Unknown"},
{Key::SPACE ,"Space"},
{Key::EXCLAM ,"Exclam"},
@@ -244,72 +238,6 @@ static const _KeyCodeText _keycodes[] = {
{Key::BAR ,"Bar"},
{Key::BRACERIGHT ,"BraceRight"},
{Key::ASCIITILDE ,"AsciiTilde"},
- {Key::NOBREAKSPACE ,"NoBreakSpace"},
- {Key::EXCLAMDOWN ,"ExclamDown"},
- {Key::CENT ,"Cent"},
- {Key::STERLING ,"Sterling"},
- {Key::CURRENCY ,"Currency"},
- {Key::YEN ,"Yen"},
- {Key::BROKENBAR ,"BrokenBar"},
- {Key::SECTION ,"Section"},
- {Key::DIAERESIS ,"Diaeresis"},
- {Key::COPYRIGHT ,"Copyright"},
- {Key::ORDFEMININE ,"Ordfeminine"},
- {Key::GUILLEMOTLEFT ,"GuillemotLeft"},
- {Key::NOTSIGN ,"NotSign"},
- {Key::HYPHEN ,"Hyphen"},
- {Key::KEY_REGISTERED ,"Registered"},
- {Key::MACRON ,"Macron"},
- {Key::DEGREE ,"Degree"},
- {Key::PLUSMINUS ,"PlusMinus"},
- {Key::TWOSUPERIOR ,"TwoSuperior"},
- {Key::THREESUPERIOR ,"ThreeSuperior"},
- {Key::ACUTE ,"Acute"},
- {Key::MU ,"Mu"},
- {Key::PARAGRAPH ,"Paragraph"},
- {Key::PERIODCENTERED ,"PeriodCentered"},
- {Key::CEDILLA ,"Cedilla"},
- {Key::ONESUPERIOR ,"OneSuperior"},
- {Key::MASCULINE ,"Masculine"},
- {Key::GUILLEMOTRIGHT ,"GuillemotRight"},
- {Key::ONEQUARTER ,"OneQuarter"},
- {Key::ONEHALF ,"OneHalf"},
- {Key::THREEQUARTERS ,"ThreeQuarters"},
- {Key::QUESTIONDOWN ,"QuestionDown"},
- {Key::AGRAVE ,"Agrave"},
- {Key::AACUTE ,"Aacute"},
- {Key::ACIRCUMFLEX ,"AcircumFlex"},
- {Key::ATILDE ,"Atilde"},
- {Key::ADIAERESIS ,"Adiaeresis"},
- {Key::ARING ,"Aring"},
- {Key::AE ,"Ae"},
- {Key::CCEDILLA ,"Ccedilla"},
- {Key::EGRAVE ,"Egrave"},
- {Key::EACUTE ,"Eacute"},
- {Key::ECIRCUMFLEX ,"Ecircumflex"},
- {Key::EDIAERESIS ,"Ediaeresis"},
- {Key::IGRAVE ,"Igrave"},
- {Key::IACUTE ,"Iacute"},
- {Key::ICIRCUMFLEX ,"Icircumflex"},
- {Key::IDIAERESIS ,"Idiaeresis"},
- {Key::ETH ,"Eth"},
- {Key::NTILDE ,"Ntilde"},
- {Key::OGRAVE ,"Ograve"},
- {Key::OACUTE ,"Oacute"},
- {Key::OCIRCUMFLEX ,"Ocircumflex"},
- {Key::OTILDE ,"Otilde"},
- {Key::ODIAERESIS ,"Odiaeresis"},
- {Key::MULTIPLY ,"Multiply"},
- {Key::OOBLIQUE ,"Ooblique"},
- {Key::UGRAVE ,"Ugrave"},
- {Key::UACUTE ,"Uacute"},
- {Key::UCIRCUMFLEX ,"Ucircumflex"},
- {Key::UDIAERESIS ,"Udiaeresis"},
- {Key::YACUTE ,"Yacute"},
- {Key::THORN ,"Thorn"},
- {Key::SSHARP ,"Ssharp"},
- {Key::DIVISION ,"Division"},
- {Key::YDIAERESIS ,"Ydiaeresis"},
{Key::NONE ,nullptr}
/* clang-format on */
};
@@ -378,14 +306,9 @@ bool keycode_has_unicode(Key p_keycode) {
case Key::F33:
case Key::F34:
case Key::F35:
- case Key::SUPER_L:
- case Key::SUPER_R:
case Key::MENU:
- case Key::HYPER_L:
- case Key::HYPER_R:
+ case Key::HYPER:
case Key::HELP:
- case Key::DIRECTION_L:
- case Key::DIRECTION_R:
case Key::BACK:
case Key::FORWARD:
case Key::STOP:
@@ -393,11 +316,6 @@ bool keycode_has_unicode(Key p_keycode) {
case Key::VOLUMEDOWN:
case Key::VOLUMEMUTE:
case Key::VOLUMEUP:
- case Key::BASSBOOST:
- case Key::BASSUP:
- case Key::BASSDOWN:
- case Key::TREBLEUP:
- case Key::TREBLEDOWN:
case Key::MEDIAPLAY:
case Key::MEDIASTOP:
case Key::MEDIAPREVIOUS:
@@ -426,6 +344,10 @@ bool keycode_has_unicode(Key p_keycode) {
case Key::LAUNCHD:
case Key::LAUNCHE:
case Key::LAUNCHF:
+ case Key::GLOBE:
+ case Key::KEYBOARD:
+ case Key::JIS_EISU:
+ case Key::JIS_KANA:
return false;
default: {
}
@@ -522,3 +444,24 @@ int keycode_get_value_by_index(int p_index) {
const char *keycode_get_name_by_index(int p_index) {
return _keycodes[p_index].text;
}
+
+char32_t fix_unicode(char32_t p_char) {
+ if (p_char >= 0x20 && p_char != 0x7F) {
+ return p_char;
+ }
+ return 0;
+}
+
+Key fix_keycode(char32_t p_char, Key p_key) {
+ if (p_char >= 0x20 && p_char <= 0x7E) {
+ return (Key)String::char_uppercase(p_char);
+ }
+ return p_key;
+}
+
+Key fix_key_label(char32_t p_char, Key p_key) {
+ if (p_char >= 0x20 && p_char != 0x7F) {
+ return (Key)String::char_uppercase(p_char);
+ }
+ return p_key;
+}
diff --git a/core/os/keyboard.h b/core/os/keyboard.h
index c78fa2a631..84017e89a6 100644
--- a/core/os/keyboard.h
+++ b/core/os/keyboard.h
@@ -124,14 +124,9 @@ enum class Key {
KP_7 = SPECIAL | 0x8D,
KP_8 = SPECIAL | 0x8E,
KP_9 = SPECIAL | 0x8F,
- SUPER_L = SPECIAL | 0x40,
- SUPER_R = SPECIAL | 0x41,
MENU = SPECIAL | 0x42,
- HYPER_L = SPECIAL | 0x43,
- HYPER_R = SPECIAL | 0x44,
+ HYPER = SPECIAL | 0x43,
HELP = SPECIAL | 0x45,
- DIRECTION_L = SPECIAL | 0x46,
- DIRECTION_R = SPECIAL | 0x47,
BACK = SPECIAL | 0x48,
FORWARD = SPECIAL | 0x49,
STOP = SPECIAL | 0x4A,
@@ -139,11 +134,6 @@ enum class Key {
VOLUMEDOWN = SPECIAL | 0x4C,
VOLUMEMUTE = SPECIAL | 0x4D,
VOLUMEUP = SPECIAL | 0x4E,
- BASSBOOST = SPECIAL | 0x4F,
- BASSUP = SPECIAL | 0x50,
- BASSDOWN = SPECIAL | 0x51,
- TREBLEUP = SPECIAL | 0x52,
- TREBLEDOWN = SPECIAL | 0x53,
MEDIAPLAY = SPECIAL | 0x54,
MEDIASTOP = SPECIAL | 0x55,
MEDIAPREVIOUS = SPECIAL | 0x56,
@@ -173,7 +163,12 @@ enum class Key {
LAUNCHE = SPECIAL | 0x6E,
LAUNCHF = SPECIAL | 0x6F,
- UNKNOWN = SPECIAL | 0xFFFFFF,
+ GLOBE = SPECIAL | 0x70,
+ KEYBOARD = SPECIAL | 0x71,
+ JIS_EISU = SPECIAL | 0x72,
+ JIS_KANA = SPECIAL | 0x73,
+
+ UNKNOWN = SPECIAL | 0x7FFFFF,
/* PRINTABLE LATIN 1 CODES */
@@ -246,74 +241,8 @@ enum class Key {
BAR = 0x007C,
BRACERIGHT = 0x007D,
ASCIITILDE = 0x007E,
- NOBREAKSPACE = 0x00A0,
- EXCLAMDOWN = 0x00A1,
- CENT = 0x00A2,
- STERLING = 0x00A3,
- CURRENCY = 0x00A4,
YEN = 0x00A5,
- BROKENBAR = 0x00A6,
SECTION = 0x00A7,
- DIAERESIS = 0x00A8,
- COPYRIGHT = 0x00A9,
- ORDFEMININE = 0x00AA,
- GUILLEMOTLEFT = 0x00AB,
- NOTSIGN = 0x00AC,
- HYPHEN = 0x00AD,
- KEY_REGISTERED = 0x00AE, // "REGISTERED" is a reserved word on Windows.
- MACRON = 0x00AF,
- DEGREE = 0x00B0,
- PLUSMINUS = 0x00B1,
- TWOSUPERIOR = 0x00B2,
- THREESUPERIOR = 0x00B3,
- ACUTE = 0x00B4,
- MU = 0x00B5,
- PARAGRAPH = 0x00B6,
- PERIODCENTERED = 0x00B7,
- CEDILLA = 0x00B8,
- ONESUPERIOR = 0x00B9,
- MASCULINE = 0x00BA,
- GUILLEMOTRIGHT = 0x00BB,
- ONEQUARTER = 0x00BC,
- ONEHALF = 0x00BD,
- THREEQUARTERS = 0x00BE,
- QUESTIONDOWN = 0x00BF,
- AGRAVE = 0x00C0,
- AACUTE = 0x00C1,
- ACIRCUMFLEX = 0x00C2,
- ATILDE = 0x00C3,
- ADIAERESIS = 0x00C4,
- ARING = 0x00C5,
- AE = 0x00C6,
- CCEDILLA = 0x00C7,
- EGRAVE = 0x00C8,
- EACUTE = 0x00C9,
- ECIRCUMFLEX = 0x00CA,
- EDIAERESIS = 0x00CB,
- IGRAVE = 0x00CC,
- IACUTE = 0x00CD,
- ICIRCUMFLEX = 0x00CE,
- IDIAERESIS = 0x00CF,
- ETH = 0x00D0,
- NTILDE = 0x00D1,
- OGRAVE = 0x00D2,
- OACUTE = 0x00D3,
- OCIRCUMFLEX = 0x00D4,
- OTILDE = 0x00D5,
- ODIAERESIS = 0x00D6,
- MULTIPLY = 0x00D7,
- OOBLIQUE = 0x00D8,
- UGRAVE = 0x00D9,
- UACUTE = 0x00DA,
- UCIRCUMFLEX = 0x00DB,
- UDIAERESIS = 0x00DC,
- YACUTE = 0x00DD,
- THORN = 0x00DE,
- SSHARP = 0x00DF,
-
- DIVISION = 0x00F7,
- YDIAERESIS = 0x00FF,
- END_LATIN1 = 0x0100,
};
enum class KeyModifierMask {
@@ -407,4 +336,8 @@ int keycode_get_count();
int keycode_get_value_by_index(int p_index);
const char *keycode_get_name_by_index(int p_index);
+char32_t fix_unicode(char32_t p_char);
+Key fix_keycode(char32_t p_char, Key p_key);
+Key fix_key_label(char32_t p_char, Key p_key);
+
#endif // KEYBOARD_H
diff --git a/core/os/mutex.h b/core/os/mutex.h
index c91917a9a1..ceedcb235a 100644
--- a/core/os/mutex.h
+++ b/core/os/mutex.h
@@ -31,7 +31,6 @@
#ifndef MUTEX_H
#define MUTEX_H
-#include "core/error/error_list.h"
#include "core/typedefs.h"
#include <mutex>
@@ -49,8 +48,8 @@ public:
mutex.unlock();
}
- _ALWAYS_INLINE_ Error try_lock() const {
- return mutex.try_lock() ? OK : ERR_BUSY;
+ _ALWAYS_INLINE_ bool try_lock() const {
+ return mutex.try_lock();
}
};
diff --git a/core/os/os.cpp b/core/os/os.cpp
index c6fa8d307b..ef7d860d19 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -203,16 +203,26 @@ uint64_t OS::get_embedded_pck_offset() const {
}
// Helper function to ensure that a dir name/path will be valid on the OS
-String OS::get_safe_dir_name(const String &p_dir_name, bool p_allow_dir_separator) const {
+String OS::get_safe_dir_name(const String &p_dir_name, bool p_allow_paths) const {
+ String safe_dir_name = p_dir_name;
Vector<String> invalid_chars = String(": * ? \" < > |").split(" ");
- if (p_allow_dir_separator) {
+ if (p_allow_paths) {
// Dir separators are allowed, but disallow ".." to avoid going up the filesystem
invalid_chars.push_back("..");
+ safe_dir_name = safe_dir_name.replace("\\", "/").strip_edges();
} else {
invalid_chars.push_back("/");
+ invalid_chars.push_back("\\");
+ safe_dir_name = safe_dir_name.strip_edges();
+
+ // These directory names are invalid.
+ if (safe_dir_name == ".") {
+ safe_dir_name = "dot";
+ } else if (safe_dir_name == "..") {
+ safe_dir_name = "twodots";
+ }
}
- String safe_dir_name = p_dir_name.replace("\\", "/").strip_edges();
for (int i = 0; i < invalid_chars.size(); i++) {
safe_dir_name = safe_dir_name.replace(invalid_chars[i], "-");
}
@@ -543,6 +553,16 @@ void OS::add_frame_delay(bool p_can_draw) {
}
}
+OS::PreferredTextureFormat OS::get_preferred_texture_format() const {
+#if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || defined(_M_ARM64)
+ return PREFERRED_TEXTURE_FORMAT_ETC2_ASTC; // By rule, ARM hardware uses ETC texture compression.
+#elif defined(__x86_64__) || defined(_M_X64) || defined(i386) || defined(__i386__) || defined(__i386) || defined(_M_IX86)
+ return PREFERRED_TEXTURE_FORMAT_S3TC_BPTC; // By rule, X86 hardware prefers S3TC and derivatives.
+#else
+ return PREFERRED_TEXTURE_FORMAT_S3TC_BPTC; // Override in platform if needed.
+#endif
+}
+
OS::OS() {
singleton = this;
diff --git a/core/os/os.h b/core/os/os.h
index 4818e9281a..d77890d89d 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -238,7 +238,7 @@ public:
virtual uint64_t get_embedded_pck_offset() const;
- String get_safe_dir_name(const String &p_dir_name, bool p_allow_dir_separator = false) const;
+ String get_safe_dir_name(const String &p_dir_name, bool p_allow_paths = false) const;
virtual String get_godot_dir_name() const;
virtual String get_data_path() const;
@@ -290,6 +290,14 @@ public:
virtual Vector<String> get_granted_permissions() const { return Vector<String>(); }
virtual void process_and_drop_events() {}
+
+ enum PreferredTextureFormat {
+ PREFERRED_TEXTURE_FORMAT_S3TC_BPTC,
+ PREFERRED_TEXTURE_FORMAT_ETC2_ASTC
+ };
+
+ virtual PreferredTextureFormat get_preferred_texture_format() const;
+
OS();
virtual ~OS();
};
diff --git a/core/os/rw_lock.h b/core/os/rw_lock.h
index e290b7c00b..a232fcb1ce 100644
--- a/core/os/rw_lock.h
+++ b/core/os/rw_lock.h
@@ -31,7 +31,7 @@
#ifndef RW_LOCK_H
#define RW_LOCK_H
-#include "core/error/error_list.h"
+#include "core/typedefs.h"
#include <shared_mutex>
@@ -39,34 +39,34 @@ class RWLock {
mutable std::shared_timed_mutex mutex;
public:
- // Lock the rwlock, block if locked by someone else
- void read_lock() const {
+ // Lock the RWLock, block if locked by someone else.
+ _ALWAYS_INLINE_ void read_lock() const {
mutex.lock_shared();
}
- // Unlock the rwlock, let other threads continue
- void read_unlock() const {
+ // Unlock the RWLock, let other threads continue.
+ _ALWAYS_INLINE_ void read_unlock() const {
mutex.unlock_shared();
}
- // Attempt to lock the rwlock, OK on success, ERR_BUSY means it can't lock.
- Error read_try_lock() const {
- return mutex.try_lock_shared() ? OK : ERR_BUSY;
+ // Attempt to lock the RWLock for reading. True on success, false means it can't lock.
+ _ALWAYS_INLINE_ bool read_try_lock() const {
+ return mutex.try_lock_shared();
}
- // Lock the rwlock, block if locked by someone else
- void write_lock() {
+ // Lock the RWLock, block if locked by someone else.
+ _ALWAYS_INLINE_ void write_lock() {
mutex.lock();
}
- // Unlock the rwlock, let other thwrites continue
- void write_unlock() {
+ // Unlock the RWLock, let other threads continue.
+ _ALWAYS_INLINE_ void write_unlock() {
mutex.unlock();
}
- // Attempt to lock the rwlock, OK on success, ERR_BUSY means it can't lock.
- Error write_try_lock() {
- return mutex.try_lock() ? OK : ERR_BUSY;
+ // Attempt to lock the RWLock for writing. True on success, false means it can't lock.
+ _ALWAYS_INLINE_ bool write_try_lock() {
+ return mutex.try_lock();
}
};
@@ -74,11 +74,11 @@ class RWLockRead {
const RWLock &lock;
public:
- RWLockRead(const RWLock &p_lock) :
+ _ALWAYS_INLINE_ RWLockRead(const RWLock &p_lock) :
lock(p_lock) {
lock.read_lock();
}
- ~RWLockRead() {
+ _ALWAYS_INLINE_ ~RWLockRead() {
lock.read_unlock();
}
};
@@ -87,11 +87,11 @@ class RWLockWrite {
RWLock &lock;
public:
- RWLockWrite(RWLock &p_lock) :
+ _ALWAYS_INLINE_ RWLockWrite(RWLock &p_lock) :
lock(p_lock) {
lock.write_lock();
}
- ~RWLockWrite() {
+ _ALWAYS_INLINE_ ~RWLockWrite() {
lock.write_unlock();
}
};
diff --git a/core/os/semaphore.h b/core/os/semaphore.h
index 6a290f21c6..a992a4587d 100644
--- a/core/os/semaphore.h
+++ b/core/os/semaphore.h
@@ -39,32 +39,33 @@
class Semaphore {
private:
- mutable std::mutex mutex_;
- mutable std::condition_variable condition_;
- mutable unsigned long count_ = 0; // Initialized as locked.
+ mutable std::mutex mutex;
+ mutable std::condition_variable condition;
+ mutable uint32_t count = 0; // Initialized as locked.
public:
_ALWAYS_INLINE_ void post() const {
- std::lock_guard<decltype(mutex_)> lock(mutex_);
- ++count_;
- condition_.notify_one();
+ std::lock_guard lock(mutex);
+ count++;
+ condition.notify_one();
}
_ALWAYS_INLINE_ void wait() const {
- std::unique_lock<decltype(mutex_)> lock(mutex_);
- while (!count_) { // Handle spurious wake-ups.
- condition_.wait(lock);
+ std::unique_lock lock(mutex);
+ while (!count) { // Handle spurious wake-ups.
+ condition.wait(lock);
}
- --count_;
+ count--;
}
_ALWAYS_INLINE_ bool try_wait() const {
- std::lock_guard<decltype(mutex_)> lock(mutex_);
- if (count_) {
- --count_;
+ std::lock_guard lock(mutex);
+ if (count) {
+ count--;
return true;
+ } else {
+ return false;
}
- return false;
}
};
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 700174bdae..a374e7c009 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -209,6 +209,7 @@ void register_core_types() {
GDREGISTER_CLASS(AESContext);
ClassDB::register_custom_instance_class<X509Certificate>();
ClassDB::register_custom_instance_class<CryptoKey>();
+ GDREGISTER_ABSTRACT_CLASS(TLSOptions);
ClassDB::register_custom_instance_class<HMACContext>();
ClassDB::register_custom_instance_class<Crypto>();
ClassDB::register_custom_instance_class<StreamPeerTLS>();
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp
index 9e468f7075..b34d9f3271 100644
--- a/core/string/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -4342,6 +4342,9 @@ bool String::is_valid_html_color() const {
return Color::html_is_valid(*this);
}
+// Changes made to the set of invalid filename characters must also be reflected in the String documentation for is_valid_filename.
+static const char *invalid_filename_characters = ": / \\ ? * \" | % < >";
+
bool String::is_valid_filename() const {
String stripped = strip_edges();
if (*this != stripped) {
@@ -4352,7 +4355,22 @@ bool String::is_valid_filename() const {
return false;
}
- return !(find(":") != -1 || find("/") != -1 || find("\\") != -1 || find("?") != -1 || find("*") != -1 || find("\"") != -1 || find("|") != -1 || find("%") != -1 || find("<") != -1 || find(">") != -1);
+ Vector<String> chars = String(invalid_filename_characters).split(" ");
+ for (const String &ch : chars) {
+ if (contains(ch)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+String String::validate_filename() const {
+ Vector<String> chars = String(invalid_filename_characters).split(" ");
+ String name = strip_edges();
+ for (int i = 0; i < chars.size(); i++) {
+ name = name.replace(chars[i], "_");
+ }
+ return name;
}
bool String::is_valid_ip_address() const {
diff --git a/core/string/ustring.h b/core/string/ustring.h
index 6338f1d3cd..1582504c57 100644
--- a/core/string/ustring.h
+++ b/core/string/ustring.h
@@ -433,6 +433,7 @@ public:
static const String invalid_node_name_characters;
String validate_node_name() const;
String validate_identifier() const;
+ String validate_filename() const;
bool is_valid_identifier() const;
bool is_valid_int() const;
diff --git a/core/templates/local_vector.h b/core/templates/local_vector.h
index 55761bb604..5311a94987 100644
--- a/core/templates/local_vector.h
+++ b/core/templates/local_vector.h
@@ -169,6 +169,70 @@ public:
return data[p_index];
}
+ struct Iterator {
+ _FORCE_INLINE_ T &operator*() const {
+ return *elem_ptr;
+ }
+ _FORCE_INLINE_ T *operator->() const { return elem_ptr; }
+ _FORCE_INLINE_ Iterator &operator++() {
+ elem_ptr++;
+ return *this;
+ }
+ _FORCE_INLINE_ Iterator &operator--() {
+ elem_ptr--;
+ return *this;
+ }
+
+ _FORCE_INLINE_ bool operator==(const Iterator &b) const { return elem_ptr == b.elem_ptr; }
+ _FORCE_INLINE_ bool operator!=(const Iterator &b) const { return elem_ptr != b.elem_ptr; }
+
+ Iterator(T *p_ptr) { elem_ptr = p_ptr; }
+ Iterator() {}
+ Iterator(const Iterator &p_it) { elem_ptr = p_it.elem_ptr; }
+
+ private:
+ T *elem_ptr = nullptr;
+ };
+
+ struct ConstIterator {
+ _FORCE_INLINE_ const T &operator*() const {
+ return *elem_ptr;
+ }
+ _FORCE_INLINE_ const T *operator->() const { return elem_ptr; }
+ _FORCE_INLINE_ ConstIterator &operator++() {
+ elem_ptr++;
+ return *this;
+ }
+ _FORCE_INLINE_ ConstIterator &operator--() {
+ elem_ptr--;
+ return *this;
+ }
+
+ _FORCE_INLINE_ bool operator==(const ConstIterator &b) const { return elem_ptr == b.elem_ptr; }
+ _FORCE_INLINE_ bool operator!=(const ConstIterator &b) const { return elem_ptr != b.elem_ptr; }
+
+ ConstIterator(const T *p_ptr) { elem_ptr = p_ptr; }
+ ConstIterator() {}
+ ConstIterator(const ConstIterator &p_it) { elem_ptr = p_it.elem_ptr; }
+
+ private:
+ const T *elem_ptr = nullptr;
+ };
+
+ _FORCE_INLINE_ Iterator begin() {
+ return Iterator(data);
+ }
+ _FORCE_INLINE_ Iterator end() {
+ return Iterator(data + size());
+ }
+
+ _FORCE_INLINE_ ConstIterator begin() const {
+ return ConstIterator(ptr());
+ }
+ _FORCE_INLINE_ ConstIterator end() const {
+ return ConstIterator(ptr() + size());
+ }
+
void insert(U p_pos, T p_val) {
ERR_FAIL_UNSIGNED_INDEX(p_pos, count + 1);
if (p_pos == count) {
diff --git a/core/variant/array.cpp b/core/variant/array.cpp
index f8af78f3c1..d3c5ca801f 100644
--- a/core/variant/array.cpp
+++ b/core/variant/array.cpp
@@ -64,7 +64,7 @@ void Array::_ref(const Array &p_from) const {
_unref();
- _p = p_from._p;
+ _p = _fp;
}
void Array::_unref() const {
@@ -191,62 +191,73 @@ uint32_t Array::recursive_hash(int recursion_count) const {
return hash_fmix32(h);
}
-bool Array::_assign(const Array &p_array) {
- bool can_convert = p_array._p->typed.type == Variant::NIL;
- can_convert |= _p->typed.type == Variant::STRING && p_array._p->typed.type == Variant::STRING_NAME;
- can_convert |= _p->typed.type == Variant::STRING_NAME && p_array._p->typed.type == Variant::STRING;
+void Array::operator=(const Array &p_array) {
+ if (this == &p_array) {
+ return;
+ }
+ _ref(p_array);
+}
+
+void Array::assign(const Array &p_array) {
+ const ContainerTypeValidate &typed = _p->typed;
+ const ContainerTypeValidate &source_typed = p_array._p->typed;
- if (_p->typed.type != Variant::OBJECT && _p->typed.type == p_array._p->typed.type) {
- //same type or untyped, just reference, should be fine
- _ref(p_array);
- } else if (_p->typed.type == Variant::NIL) { //from typed to untyped, must copy, but this is cheap anyway
+ if (typed == source_typed || typed.type == Variant::NIL || (source_typed.type == Variant::OBJECT && typed.can_reference(source_typed))) {
+ // from same to same or
+ // from anything to variants or
+ // from subclasses to base classes
_p->array = p_array._p->array;
- } else if (can_convert) { //from untyped to typed, must try to check if they are all valid
- if (_p->typed.type == Variant::OBJECT) {
- //for objects, it needs full validation, either can be converted or fail
- for (int i = 0; i < p_array._p->array.size(); i++) {
- const Variant &element = p_array._p->array[i];
- if (element.get_type() != Variant::OBJECT || !_p->typed.validate_object(element, "assign")) {
- return false;
- }
- }
- _p->array = p_array._p->array; //then just copy, which is cheap anyway
+ return;
+ }
- } else {
- //for non objects, we need to check if there is a valid conversion, which needs to happen one by one, so this is the worst case.
- Vector<Variant> new_array;
- new_array.resize(p_array._p->array.size());
- for (int i = 0; i < p_array._p->array.size(); i++) {
- Variant src_val = p_array._p->array[i];
- if (src_val.get_type() == _p->typed.type) {
- new_array.write[i] = src_val;
- } else if (Variant::can_convert_strict(src_val.get_type(), _p->typed.type)) {
- Variant *ptr = &src_val;
- Callable::CallError ce;
- Variant::construct(_p->typed.type, new_array.write[i], (const Variant **)&ptr, 1, ce);
- if (ce.error != Callable::CallError::CALL_OK) {
- ERR_FAIL_V_MSG(false, "Unable to convert array index " + itos(i) + " from '" + Variant::get_type_name(src_val.get_type()) + "' to '" + Variant::get_type_name(_p->typed.type) + "'.");
- }
- } else {
- ERR_FAIL_V_MSG(false, "Unable to convert array index " + itos(i) + " from '" + Variant::get_type_name(src_val.get_type()) + "' to '" + Variant::get_type_name(_p->typed.type) + "'.");
- }
+ const Variant *source = p_array._p->array.ptr();
+ int size = p_array._p->array.size();
+
+ if ((source_typed.type == Variant::NIL && typed.type == Variant::OBJECT) || (source_typed.type == Variant::OBJECT && source_typed.can_reference(typed))) {
+ // from variants to objects or
+ // from base classes to subclasses
+ for (int i = 0; i < size; i++) {
+ const Variant &element = source[i];
+ if (element.get_type() != Variant::NIL && (element.get_type() != Variant::OBJECT || !typed.validate_object(element, "assign"))) {
+ ERR_FAIL_MSG(vformat(R"(Unable to convert array index %i from "%s" to "%s".)", i, Variant::get_type_name(element.get_type()), Variant::get_type_name(typed.type)));
}
+ }
+ _p->array = p_array._p->array;
+ return;
+ }
- _p->array = new_array;
+ Vector<Variant> array;
+ array.resize(size);
+ Variant *data = array.ptrw();
+
+ if (source_typed.type == Variant::NIL && typed.type != Variant::OBJECT) {
+ // from variants to primitives
+ for (int i = 0; i < size; i++) {
+ const Variant *value = source + i;
+ if (value->get_type() == typed.type) {
+ data[i] = *value;
+ continue;
+ }
+ if (!Variant::can_convert_strict(value->get_type(), typed.type)) {
+ ERR_FAIL_MSG("Unable to convert array index " + itos(i) + " from '" + Variant::get_type_name(value->get_type()) + "' to '" + Variant::get_type_name(typed.type) + "'.");
+ }
+ Callable::CallError ce;
+ Variant::construct(typed.type, data[i], &value, 1, ce);
+ ERR_FAIL_COND_MSG(ce.error, vformat(R"(Unable to convert array index %i from "%s" to "%s".)", i, Variant::get_type_name(value->get_type()), Variant::get_type_name(typed.type)));
+ }
+ } else if (Variant::can_convert_strict(source_typed.type, typed.type)) {
+ // from primitives to different convertable primitives
+ for (int i = 0; i < size; i++) {
+ const Variant *value = source + i;
+ Callable::CallError ce;
+ Variant::construct(typed.type, data[i], &value, 1, ce);
+ ERR_FAIL_COND_MSG(ce.error, vformat(R"(Unable to convert array index %i from "%s" to "%s".)", i, Variant::get_type_name(value->get_type()), Variant::get_type_name(typed.type)));
}
- } else if (_p->typed.can_reference(p_array._p->typed)) { //same type or compatible
- _ref(p_array);
} else {
- ERR_FAIL_V_MSG(false, "Assignment of arrays of incompatible types.");
+ ERR_FAIL_MSG(vformat(R"(Cannot assign contents of "Array[%s]" to "Array[%s]".)", Variant::get_type_name(source_typed.type), Variant::get_type_name(typed.type)));
}
- return true;
-}
-void Array::operator=(const Array &p_array) {
- if (this == &p_array) {
- return;
- }
- _ref(p_array);
+ _p->array = array;
}
void Array::push_back(const Variant &p_value) {
@@ -269,7 +280,15 @@ void Array::append_array(const Array &p_array) {
Error Array::resize(int p_new_size) {
ERR_FAIL_COND_V_MSG(_p->read_only, ERR_LOCKED, "Array is in read-only state.");
- return _p->array.resize(p_new_size);
+ Variant::Type &variant_type = _p->typed.type;
+ int old_size = _p->array.size();
+ Error err = _p->array.resize_zeroed(p_new_size);
+ if (!err && variant_type != Variant::NIL && variant_type != Variant::OBJECT) {
+ for (int i = old_size; i < p_new_size; i++) {
+ VariantInternal::initialize(&_p->array.write[i], variant_type);
+ }
+ }
+ return err;
}
Error Array::insert(int p_pos, const Variant &p_value) {
@@ -403,24 +422,22 @@ Array Array::duplicate(bool p_deep) const {
Array Array::recursive_duplicate(bool p_deep, int recursion_count) const {
Array new_arr;
+ new_arr._p->typed = _p->typed;
if (recursion_count > MAX_RECURSION) {
ERR_PRINT("Max recursion reached");
return new_arr;
}
- int element_count = size();
- new_arr.resize(element_count);
- new_arr._p->typed = _p->typed;
if (p_deep) {
recursion_count++;
+ int element_count = size();
+ new_arr.resize(element_count);
for (int i = 0; i < element_count; i++) {
new_arr[i] = get(i).recursive_duplicate(true, recursion_count);
}
} else {
- for (int i = 0; i < element_count; i++) {
- new_arr[i] = get(i);
- }
+ new_arr._p->array = _p->array;
}
return new_arr;
@@ -737,11 +754,7 @@ Array::Array(const Array &p_from, uint32_t p_type, const StringName &p_class_nam
_p = memnew(ArrayPrivate);
_p->refcount.init();
set_typed(p_type, p_class_name, p_script);
- _assign(p_from);
-}
-
-bool Array::typed_assign(const Array &p_other) {
- return _assign(p_other);
+ assign(p_from);
}
void Array::set_typed(uint32_t p_type, const StringName &p_class_name, const Variant &p_script) {
@@ -763,6 +776,10 @@ bool Array::is_typed() const {
return _p->typed.type != Variant::NIL;
}
+bool Array::is_same_typed(const Array &p_other) const {
+ return _p->typed == p_other._p->typed;
+}
+
uint32_t Array::get_typed_builtin() const {
return _p->typed.type;
}
@@ -775,15 +792,9 @@ Variant Array::get_typed_script() const {
return _p->typed.script;
}
-void Array::set_read_only(bool p_enable) {
- if (p_enable == bool(_p->read_only != nullptr)) {
- return;
- }
- if (p_enable) {
+void Array::make_read_only() {
+ if (_p->read_only == nullptr) {
_p->read_only = memnew(Variant);
- } else {
- memdelete(_p->read_only);
- _p->read_only = nullptr;
}
}
diff --git a/core/variant/array.h b/core/variant/array.h
index 3728c22fe0..4ef8ba8ce7 100644
--- a/core/variant/array.h
+++ b/core/variant/array.h
@@ -43,13 +43,11 @@ class Callable;
class Array {
mutable ArrayPrivate *_p;
- void _ref(const Array &p_from) const;
void _unref() const;
-protected:
- bool _assign(const Array &p_array);
-
public:
+ void _ref(const Array &p_from) const;
+
Variant &operator[](int p_idx);
const Variant &operator[](int p_idx) const;
@@ -68,6 +66,7 @@ public:
uint32_t recursive_hash(int recursion_count) const;
void operator=(const Array &p_array);
+ void assign(const Array &p_array);
void push_back(const Variant &p_value);
_FORCE_INLINE_ void append(const Variant &p_value) { push_back(p_value); } //for python compatibility
void append_array(const Array &p_array);
@@ -120,14 +119,14 @@ public:
const void *id() const;
- bool typed_assign(const Array &p_other);
void set_typed(uint32_t p_type, const StringName &p_class_name, const Variant &p_script);
bool is_typed() const;
+ bool is_same_typed(const Array &p_other) const;
uint32_t get_typed_builtin() const;
StringName get_typed_class_name() const;
Variant get_typed_script() const;
- void set_read_only(bool p_enable);
+ void make_read_only();
bool is_read_only() const;
Array(const Array &p_base, uint32_t p_type, const StringName &p_class_name, const Variant &p_script);
diff --git a/core/variant/container_type_validate.h b/core/variant/container_type_validate.h
index 377be03bdf..796b66dc77 100644
--- a/core/variant/container_type_validate.h
+++ b/core/variant/container_type_validate.h
@@ -74,8 +74,15 @@ struct ContainerTypeValidate {
return true;
}
+ _FORCE_INLINE_ bool operator==(const ContainerTypeValidate &p_type) const {
+ return type == p_type.type && class_name == p_type.class_name && script == p_type.script;
+ }
+ _FORCE_INLINE_ bool operator!=(const ContainerTypeValidate &p_type) const {
+ return type != p_type.type || class_name != p_type.class_name || script != p_type.script;
+ }
+
// Coerces String and StringName into each other when needed.
- _FORCE_INLINE_ bool validate(Variant &inout_variant, const char *p_operation = "use") {
+ _FORCE_INLINE_ bool validate(Variant &inout_variant, const char *p_operation = "use") const {
if (type == Variant::NIL) {
return true;
}
@@ -102,7 +109,7 @@ struct ContainerTypeValidate {
return validate_object(inout_variant, p_operation);
}
- _FORCE_INLINE_ bool validate_object(const Variant &p_variant, const char *p_operation = "use") {
+ _FORCE_INLINE_ bool validate_object(const Variant &p_variant, const char *p_operation = "use") const {
ERR_FAIL_COND_V(p_variant.get_type() != Variant::OBJECT, false);
#ifdef DEBUG_ENABLED
diff --git a/core/variant/dictionary.cpp b/core/variant/dictionary.cpp
index f87064a0d1..0429508cc5 100644
--- a/core/variant/dictionary.cpp
+++ b/core/variant/dictionary.cpp
@@ -333,15 +333,9 @@ Dictionary Dictionary::duplicate(bool p_deep) const {
return recursive_duplicate(p_deep, 0);
}
-void Dictionary::set_read_only(bool p_enable) {
- if (p_enable == bool(_p->read_only != nullptr)) {
- return;
- }
- if (p_enable) {
+void Dictionary::make_read_only() {
+ if (_p->read_only == nullptr) {
_p->read_only = memnew(Variant);
- } else {
- memdelete(_p->read_only);
- _p->read_only = nullptr;
}
}
bool Dictionary::is_read_only() const {
diff --git a/core/variant/dictionary.h b/core/variant/dictionary.h
index e6d8ebe25b..8935d35ed9 100644
--- a/core/variant/dictionary.h
+++ b/core/variant/dictionary.h
@@ -86,7 +86,7 @@ public:
Dictionary duplicate(bool p_deep = false) const;
Dictionary recursive_duplicate(bool p_deep, int recursion_count) const;
- void set_read_only(bool p_enable);
+ void make_read_only();
bool is_read_only() const;
const void *id() const;
diff --git a/core/variant/typed_array.h b/core/variant/typed_array.h
index 5aeabbacf8..03e557819b 100644
--- a/core/variant/typed_array.h
+++ b/core/variant/typed_array.h
@@ -40,14 +40,9 @@
template <class T>
class TypedArray : public Array {
public:
- template <class U>
- _FORCE_INLINE_ void operator=(const TypedArray<U> &p_array) {
- static_assert(__is_base_of(T, U));
- _assign(p_array);
- }
-
_FORCE_INLINE_ void operator=(const Array &p_array) {
- _assign(p_array);
+ ERR_FAIL_COND_MSG(!is_same_typed(p_array), "Cannot assign an array with a different element type.");
+ _ref(p_array);
}
_FORCE_INLINE_ TypedArray(const Variant &p_variant) :
Array(Array(p_variant), Variant::OBJECT, T::get_class_static(), Variant()) {
@@ -62,22 +57,23 @@ public:
//specialization for the rest of variant types
-#define MAKE_TYPED_ARRAY(m_type, m_variant_type) \
- template <> \
- class TypedArray<m_type> : public Array { \
- public: \
- _FORCE_INLINE_ void operator=(const Array &p_array) { \
- _assign(p_array); \
- } \
- _FORCE_INLINE_ TypedArray(const Variant &p_variant) : \
- Array(Array(p_variant), m_variant_type, StringName(), Variant()) { \
- } \
- _FORCE_INLINE_ TypedArray(const Array &p_array) : \
- Array(p_array, m_variant_type, StringName(), Variant()) { \
- } \
- _FORCE_INLINE_ TypedArray() { \
- set_typed(m_variant_type, StringName(), Variant()); \
- } \
+#define MAKE_TYPED_ARRAY(m_type, m_variant_type) \
+ template <> \
+ class TypedArray<m_type> : public Array { \
+ public: \
+ _FORCE_INLINE_ void operator=(const Array &p_array) { \
+ ERR_FAIL_COND_MSG(!is_same_typed(p_array), "Cannot assign an array with a different element type."); \
+ _ref(p_array); \
+ } \
+ _FORCE_INLINE_ TypedArray(const Variant &p_variant) : \
+ Array(Array(p_variant), m_variant_type, StringName(), Variant()) { \
+ } \
+ _FORCE_INLINE_ TypedArray(const Array &p_array) : \
+ Array(p_array, m_variant_type, StringName(), Variant()) { \
+ } \
+ _FORCE_INLINE_ TypedArray() { \
+ set_typed(m_variant_type, StringName(), Variant()); \
+ } \
};
MAKE_TYPED_ARRAY(bool, Variant::BOOL)
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp
index ca42738b05..672b030806 100644
--- a/core/variant/variant.cpp
+++ b/core/variant/variant.cpp
@@ -3492,6 +3492,46 @@ bool Variant::hash_compare(const Variant &p_variant, int recursion_count) const
}
}
+bool Variant::identity_compare(const Variant &p_variant) const {
+ if (type != p_variant.type) {
+ return false;
+ }
+
+ switch (type) {
+ case OBJECT: {
+ return _get_obj().obj == p_variant._get_obj().obj;
+ } break;
+
+ case DICTIONARY: {
+ const Dictionary &l = *(reinterpret_cast<const Dictionary *>(_data._mem));
+ const Dictionary &r = *(reinterpret_cast<const Dictionary *>(p_variant._data._mem));
+ return l.id() == r.id();
+ } break;
+
+ case ARRAY: {
+ const Array &l = *(reinterpret_cast<const Array *>(_data._mem));
+ const Array &r = *(reinterpret_cast<const Array *>(p_variant._data._mem));
+ return l.id() == r.id();
+ } break;
+
+ case PACKED_BYTE_ARRAY:
+ case PACKED_INT32_ARRAY:
+ case PACKED_INT64_ARRAY:
+ case PACKED_FLOAT32_ARRAY:
+ case PACKED_FLOAT64_ARRAY:
+ case PACKED_STRING_ARRAY:
+ case PACKED_VECTOR2_ARRAY:
+ case PACKED_VECTOR3_ARRAY:
+ case PACKED_COLOR_ARRAY: {
+ return _data.packed_array == p_variant._data.packed_array;
+ } break;
+
+ default: {
+ return hash_compare(p_variant);
+ }
+ }
+}
+
bool StringLikeVariantComparator::compare(const Variant &p_lhs, const Variant &p_rhs) {
if (p_lhs.hash_compare(p_rhs)) {
return true;
diff --git a/core/variant/variant.h b/core/variant/variant.h
index fff59c43a6..b2f31a6d57 100644
--- a/core/variant/variant.h
+++ b/core/variant/variant.h
@@ -655,6 +655,7 @@ public:
static bool has_indexing(Variant::Type p_type);
static Variant::Type get_indexed_element_type(Variant::Type p_type);
+ static uint32_t get_indexed_element_usage(Variant::Type p_type);
typedef void (*ValidatedIndexedSetter)(Variant *base, int64_t index, const Variant *value, bool *oob);
typedef void (*ValidatedIndexedGetter)(const Variant *base, int64_t index, Variant *value, bool *oob);
@@ -747,6 +748,7 @@ public:
uint32_t recursive_hash(int recursion_count) const;
bool hash_compare(const Variant &p_variant, int recursion_count = 0) const;
+ bool identity_compare(const Variant &p_variant) const;
bool booleanize() const;
String stringify(int recursion_count = 0) const;
String to_json_string() const;
diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp
index 2cc0b3a8d7..0c0c8f657a 100644
--- a/core/variant/variant_call.cpp
+++ b/core/variant/variant_call.cpp
@@ -1695,6 +1695,7 @@ static void _register_variant_builtin_methods() {
bind_string_method(json_escape, sarray(), varray());
bind_string_method(validate_node_name, sarray(), varray());
+ bind_string_method(validate_filename, sarray(), varray());
bind_string_method(is_valid_identifier, sarray(), varray());
bind_string_method(is_valid_int, sarray(), varray());
@@ -2135,7 +2136,7 @@ static void _register_variant_builtin_methods() {
bind_static_method(Projection, create_depth_correction, sarray("flip_y"), varray());
bind_static_method(Projection, create_light_atlas_rect, sarray("rect"), varray());
bind_static_method(Projection, create_perspective, sarray("fovy", "aspect", "z_near", "z_far", "flip_fov"), varray(false));
- bind_static_method(Projection, create_perspective_hmd, sarray("fovy", "aspect", "z_near", "z_far", "flip_fov", "eye", "intraocular_dist", " convergence_dist"), varray());
+ bind_static_method(Projection, create_perspective_hmd, sarray("fovy", "aspect", "z_near", "z_far", "flip_fov", "eye", "intraocular_dist", "convergence_dist"), varray());
bind_static_method(Projection, create_for_hmd, sarray("eye", "aspect", "intraocular_dist", "display_width", "display_to_lens", "oversample", "z_near", "z_far"), varray());
bind_static_method(Projection, create_orthogonal, sarray("left", "right", "bottom", "top", "z_near", "z_far"), varray());
bind_static_method(Projection, create_orthogonal_aspect, sarray("size", "aspect", "z_near", "z_far", "flip_fov"), varray(false));
@@ -2179,6 +2180,8 @@ static void _register_variant_builtin_methods() {
bind_method(Dictionary, values, sarray(), varray());
bind_method(Dictionary, duplicate, sarray("deep"), varray(false));
bind_method(Dictionary, get, sarray("key", "default"), varray(Variant()));
+ bind_method(Dictionary, make_read_only, sarray(), varray());
+ bind_method(Dictionary, is_read_only, sarray(), varray());
/* Array */
@@ -2186,6 +2189,7 @@ static void _register_variant_builtin_methods() {
bind_method(Array, is_empty, sarray(), varray());
bind_method(Array, clear, sarray(), varray());
bind_method(Array, hash, sarray(), varray());
+ bind_method(Array, assign, sarray("array"), varray());
bind_method(Array, push_back, sarray("value"), varray());
bind_method(Array, push_front, sarray("value"), varray());
bind_method(Array, append, sarray("value"), varray());
@@ -2220,13 +2224,12 @@ static void _register_variant_builtin_methods() {
bind_method(Array, all, sarray("method"), varray());
bind_method(Array, max, sarray(), varray());
bind_method(Array, min, sarray(), varray());
- bind_method(Array, typed_assign, sarray("array"), varray());
- bind_method(Array, set_typed, sarray("type", "class_name", "script"), varray());
bind_method(Array, is_typed, sarray(), varray());
+ bind_method(Array, is_same_typed, sarray("array"), varray());
bind_method(Array, get_typed_builtin, sarray(), varray());
bind_method(Array, get_typed_class_name, sarray(), varray());
bind_method(Array, get_typed_script, sarray(), varray());
- bind_method(Array, set_read_only, sarray("enable"), varray());
+ bind_method(Array, make_read_only, sarray(), varray());
bind_method(Array, is_read_only, sarray(), varray());
/* Byte Array */
@@ -2400,7 +2403,7 @@ static void _register_variant_builtin_methods() {
bind_method(PackedStringArray, remove_at, sarray("index"), varray());
bind_method(PackedStringArray, insert, sarray("at_index", "value"), varray());
bind_method(PackedStringArray, fill, sarray("value"), varray());
- bind_method(PackedStringArray, resize, sarray("new_size"), varray());
+ bind_methodv(PackedStringArray, resize, &PackedStringArray::resize_zeroed, sarray("new_size"), varray());
bind_method(PackedStringArray, clear, sarray(), varray());
bind_method(PackedStringArray, has, sarray("value"), varray());
bind_method(PackedStringArray, reverse, sarray(), varray());
@@ -2424,7 +2427,7 @@ static void _register_variant_builtin_methods() {
bind_method(PackedVector2Array, remove_at, sarray("index"), varray());
bind_method(PackedVector2Array, insert, sarray("at_index", "value"), varray());
bind_method(PackedVector2Array, fill, sarray("value"), varray());
- bind_method(PackedVector2Array, resize, sarray("new_size"), varray());
+ bind_methodv(PackedVector2Array, resize, &PackedVector2Array::resize_zeroed, sarray("new_size"), varray());
bind_method(PackedVector2Array, clear, sarray(), varray());
bind_method(PackedVector2Array, has, sarray("value"), varray());
bind_method(PackedVector2Array, reverse, sarray(), varray());
@@ -2448,7 +2451,7 @@ static void _register_variant_builtin_methods() {
bind_method(PackedVector3Array, remove_at, sarray("index"), varray());
bind_method(PackedVector3Array, insert, sarray("at_index", "value"), varray());
bind_method(PackedVector3Array, fill, sarray("value"), varray());
- bind_method(PackedVector3Array, resize, sarray("new_size"), varray());
+ bind_methodv(PackedVector3Array, resize, &PackedVector3Array::resize_zeroed, sarray("new_size"), varray());
bind_method(PackedVector3Array, clear, sarray(), varray());
bind_method(PackedVector3Array, has, sarray("value"), varray());
bind_method(PackedVector3Array, reverse, sarray(), varray());
@@ -2472,7 +2475,7 @@ static void _register_variant_builtin_methods() {
bind_method(PackedColorArray, remove_at, sarray("index"), varray());
bind_method(PackedColorArray, insert, sarray("at_index", "value"), varray());
bind_method(PackedColorArray, fill, sarray("value"), varray());
- bind_method(PackedColorArray, resize, sarray("new_size"), varray());
+ bind_methodv(PackedColorArray, resize, &PackedColorArray::resize_zeroed, sarray("new_size"), varray());
bind_method(PackedColorArray, clear, sarray(), varray());
bind_method(PackedColorArray, has, sarray("value"), varray());
bind_method(PackedColorArray, reverse, sarray(), varray());
diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h
index 21e1d21342..0d55ee4ae2 100644
--- a/core/variant/variant_internal.h
+++ b/core/variant/variant_internal.h
@@ -58,7 +58,13 @@ public:
init_basis(v);
break;
case Variant::TRANSFORM3D:
- init_transform(v);
+ init_transform3d(v);
+ break;
+ case Variant::PROJECTION:
+ init_projection(v);
+ break;
+ case Variant::COLOR:
+ init_color(v);
break;
case Variant::STRING_NAME:
init_string_name(v);
@@ -209,13 +215,12 @@ public:
// Should be in the same order as Variant::Type for consistency.
// Those primitive and vector types don't need an `init_` method:
- // Nil, bool, float, Vector2/i, Rect2/i, Vector3/i, Plane, Quat, Color, RID.
+ // Nil, bool, float, Vector2/i, Rect2/i, Vector3/i, Plane, Quat, RID.
// Object is a special case, handled via `object_assign_null`.
_FORCE_INLINE_ static void init_string(Variant *v) {
memnew_placement(v->_data._mem, String);
v->type = Variant::STRING;
}
-
_FORCE_INLINE_ static void init_transform2d(Variant *v) {
v->_data._transform2d = (Transform2D *)Variant::Pools::_bucket_small.alloc();
memnew_placement(v->_data._transform2d, Transform2D);
@@ -231,7 +236,7 @@ public:
memnew_placement(v->_data._basis, Basis);
v->type = Variant::BASIS;
}
- _FORCE_INLINE_ static void init_transform(Variant *v) {
+ _FORCE_INLINE_ static void init_transform3d(Variant *v) {
v->_data._transform3d = (Transform3D *)Variant::Pools::_bucket_medium.alloc();
memnew_placement(v->_data._transform3d, Transform3D);
v->type = Variant::TRANSFORM3D;
@@ -241,6 +246,10 @@ public:
memnew_placement(v->_data._projection, Projection);
v->type = Variant::PROJECTION;
}
+ _FORCE_INLINE_ static void init_color(Variant *v) {
+ memnew_placement(v->_data._mem, Color);
+ v->type = Variant::COLOR;
+ }
_FORCE_INLINE_ static void init_string_name(Variant *v) {
memnew_placement(v->_data._mem, StringName);
v->type = Variant::STRING_NAME;
@@ -1191,7 +1200,7 @@ struct VariantInitializer<Basis> {
template <>
struct VariantInitializer<Transform3D> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_transform(v); }
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_transform3d(v); }
};
template <>
struct VariantInitializer<Projection> {
diff --git a/core/variant/variant_parser.cpp b/core/variant/variant_parser.cpp
index 87874deb8d..a40fcfbd47 100644
--- a/core/variant/variant_parser.cpp
+++ b/core/variant/variant_parser.cpp
@@ -910,7 +910,6 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
bool at_key = true;
String key;
- Token token2;
bool need_comma = false;
while (true) {
@@ -920,18 +919,18 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
if (at_key) {
- Error err = get_token(p_stream, token2, line, r_err_str);
+ Error err = get_token(p_stream, token, line, r_err_str);
if (err != OK) {
return err;
}
- if (token2.type == TK_PARENTHESIS_CLOSE) {
+ if (token.type == TK_PARENTHESIS_CLOSE) {
value = ref.is_valid() ? Variant(ref) : Variant(obj);
return OK;
}
if (need_comma) {
- if (token2.type != TK_COMMA) {
+ if (token.type != TK_COMMA) {
r_err_str = "Expected '}' or ','";
return ERR_PARSE_ERROR;
} else {
@@ -940,31 +939,31 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
}
- if (token2.type != TK_STRING) {
+ if (token.type != TK_STRING) {
r_err_str = "Expected property name as string";
return ERR_PARSE_ERROR;
}
- key = token2.value;
+ key = token.value;
- err = get_token(p_stream, token2, line, r_err_str);
+ err = get_token(p_stream, token, line, r_err_str);
if (err != OK) {
return err;
}
- if (token2.type != TK_COLON) {
+ if (token.type != TK_COLON) {
r_err_str = "Expected ':'";
return ERR_PARSE_ERROR;
}
at_key = false;
} else {
- Error err = get_token(p_stream, token2, line, r_err_str);
+ Error err = get_token(p_stream, token, line, r_err_str);
if (err != OK) {
return err;
}
Variant v;
- err = parse_value(token2, v, p_stream, line, r_err_str, p_res_parser);
+ err = parse_value(token, v, p_stream, line, r_err_str, p_res_parser);
if (err) {
return err;
}
@@ -1026,6 +1025,89 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
}
+ } else if (id == "Array") {
+ Error err = OK;
+
+ get_token(p_stream, token, line, r_err_str);
+ if (token.type != TK_BRACKET_OPEN) {
+ r_err_str = "Expected '['";
+ return ERR_PARSE_ERROR;
+ }
+
+ get_token(p_stream, token, line, r_err_str);
+ if (token.type != TK_IDENTIFIER) {
+ r_err_str = "Expected type identifier";
+ return ERR_PARSE_ERROR;
+ }
+
+ static HashMap<StringName, Variant::Type> builtin_types;
+ if (builtin_types.is_empty()) {
+ for (int i = 1; i < Variant::VARIANT_MAX; i++) {
+ builtin_types[Variant::get_type_name((Variant::Type)i)] = (Variant::Type)i;
+ }
+ }
+
+ Array array = Array();
+ bool got_bracket_token = false;
+ if (builtin_types.has(token.value)) {
+ array.set_typed(builtin_types.get(token.value), StringName(), Variant());
+ } else if (token.value == "Resource" || token.value == "SubResource" || token.value == "ExtResource") {
+ Variant resource;
+ err = parse_value(token, resource, p_stream, line, r_err_str, p_res_parser);
+ if (err) {
+ if (token.value == "Resource" && err == ERR_PARSE_ERROR && r_err_str == "Expected '('" && token.type == TK_BRACKET_CLOSE) {
+ err = OK;
+ r_err_str = String();
+ array.set_typed(Variant::OBJECT, token.value, Variant());
+ got_bracket_token = true;
+ } else {
+ return err;
+ }
+ } else {
+ Ref<Script> script = resource;
+ if (script.is_valid() && script->is_valid()) {
+ array.set_typed(Variant::OBJECT, script->get_instance_base_type(), script);
+ }
+ }
+ } else if (ClassDB::class_exists(token.value)) {
+ array.set_typed(Variant::OBJECT, token.value, Variant());
+ }
+
+ if (!got_bracket_token) {
+ get_token(p_stream, token, line, r_err_str);
+ if (token.type != TK_BRACKET_CLOSE) {
+ r_err_str = "Expected ']'";
+ return ERR_PARSE_ERROR;
+ }
+ }
+
+ get_token(p_stream, token, line, r_err_str);
+ if (token.type != TK_PARENTHESIS_OPEN) {
+ r_err_str = "Expected '('";
+ return ERR_PARSE_ERROR;
+ }
+
+ get_token(p_stream, token, line, r_err_str);
+ if (token.type != TK_BRACKET_OPEN) {
+ r_err_str = "Expected '['";
+ return ERR_PARSE_ERROR;
+ }
+
+ Array values;
+ err = _parse_array(values, p_stream, line, r_err_str, p_res_parser);
+ if (err) {
+ return err;
+ }
+
+ get_token(p_stream, token, line, r_err_str);
+ if (token.type != TK_PARENTHESIS_CLOSE) {
+ r_err_str = "Expected ')'";
+ return ERR_PARSE_ERROR;
+ }
+
+ array.assign(values);
+
+ value = array;
} else if (id == "PackedByteArray" || id == "PoolByteArray" || id == "ByteArray") {
Vector<uint8_t> args;
Error err = _parse_construct<uint8_t>(p_stream, args, line, r_err_str);
@@ -1843,6 +1925,38 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
} break;
case Variant::ARRAY: {
+ Array array = p_variant;
+ if (array.get_typed_builtin() != Variant::NIL) {
+ p_store_string_func(p_store_string_ud, "Array[");
+
+ Variant::Type builtin_type = (Variant::Type)array.get_typed_builtin();
+ StringName class_name = array.get_typed_class_name();
+ Ref<Script> script = array.get_typed_script();
+
+ if (script.is_valid()) {
+ String resource_text = String();
+ if (p_encode_res_func) {
+ resource_text = p_encode_res_func(p_encode_res_ud, script);
+ }
+ if (resource_text.is_empty() && script->get_path().is_resource_file()) {
+ resource_text = "Resource(\"" + script->get_path() + "\")";
+ }
+
+ if (!resource_text.is_empty()) {
+ p_store_string_func(p_store_string_ud, resource_text);
+ } else {
+ ERR_PRINT("Failed to encode a path to a custom script for an array type.");
+ p_store_string_func(p_store_string_ud, class_name);
+ }
+ } else if (class_name != StringName()) {
+ p_store_string_func(p_store_string_ud, class_name);
+ } else {
+ p_store_string_func(p_store_string_ud, Variant::get_type_name(builtin_type));
+ }
+
+ p_store_string_func(p_store_string_ud, "](");
+ }
+
if (recursion_count > MAX_RECURSION) {
ERR_PRINT("Max recursion reached");
p_store_string_func(p_store_string_ud, "[]");
@@ -1850,7 +1964,6 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
recursion_count++;
p_store_string_func(p_store_string_ud, "[");
- Array array = p_variant;
int len = array.size();
for (int i = 0; i < len; i++) {
if (i > 0) {
@@ -1862,11 +1975,14 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
p_store_string_func(p_store_string_ud, "]");
}
+ if (array.get_typed_builtin() != Variant::NIL) {
+ p_store_string_func(p_store_string_ud, ")");
+ }
+
} break;
case Variant::PACKED_BYTE_ARRAY: {
p_store_string_func(p_store_string_ud, "PackedByteArray(");
- String s;
Vector<uint8_t> data = p_variant;
int len = data.size();
const uint8_t *ptr = data.ptr();
@@ -1954,15 +2070,11 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
int len = data.size();
const String *ptr = data.ptr();
- String s;
- //write_string("\n");
-
for (int i = 0; i < len; i++) {
if (i > 0) {
p_store_string_func(p_store_string_ud, ", ");
}
- String str = ptr[i];
- p_store_string_func(p_store_string_ud, "\"" + str.c_escape() + "\"");
+ p_store_string_func(p_store_string_ud, "\"" + ptr[i].c_escape() + "\"");
}
p_store_string_func(p_store_string_ud, ")");
@@ -2010,9 +2122,9 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
if (i > 0) {
p_store_string_func(p_store_string_ud, ", ");
}
-
p_store_string_func(p_store_string_ud, rtos_fix(ptr[i].r) + ", " + rtos_fix(ptr[i].g) + ", " + rtos_fix(ptr[i].b) + ", " + rtos_fix(ptr[i].a));
}
+
p_store_string_func(p_store_string_ud, ")");
} break;
diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp
index a74556d88f..30fb5d0e9f 100644
--- a/core/variant/variant_setget.cpp
+++ b/core/variant/variant_setget.cpp
@@ -151,8 +151,8 @@ void unregister_named_setters_getters() {
bool Variant::has_member(Variant::Type p_type, const StringName &p_member) {
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, false);
- for (uint32_t i = 0; i < variant_setters_getters_names[p_type].size(); i++) {
- if (variant_setters_getters_names[p_type][i] == p_member) {
+ for (const StringName &member : variant_setters_getters_names[p_type]) {
+ if (member == p_member) {
return true;
}
}
@@ -172,8 +172,8 @@ Variant::Type Variant::get_member_type(Variant::Type p_type, const StringName &p
}
void Variant::get_member_list(Variant::Type p_type, List<StringName> *r_members) {
- for (uint32_t i = 0; i < variant_setters_getters_names[p_type].size(); i++) {
- r_members->push_back(variant_setters_getters_names[p_type][i]);
+ for (const StringName &member : variant_setters_getters_names[p_type]) {
+ r_members->push_back(member);
}
}
@@ -389,6 +389,7 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
v.write[index] = PtrToArg<m_elem_type>::convert(member); \
} \
static Variant::Type get_index_type() { return GetTypeInfo<m_elem_type>::VARIANT_TYPE; } \
+ static uint32_t get_index_usage() { return GetTypeInfo<m_elem_type>::get_class_info().usage; } \
static uint64_t get_indexed_size(const Variant *base) { return VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); } \
};
@@ -460,6 +461,7 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
v.write[index] = PtrToArg<m_elem_type>::convert(member); \
} \
static Variant::Type get_index_type() { return GetTypeInfo<m_elem_type>::VARIANT_TYPE; } \
+ static uint32_t get_index_usage() { return GetTypeInfo<m_elem_type>::get_class_info().usage; } \
static uint64_t get_indexed_size(const Variant *base) { return VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); } \
};
@@ -515,6 +517,7 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
v[index] = PtrToArg<m_elem_type>::convert(member); \
} \
static Variant::Type get_index_type() { return GetTypeInfo<m_elem_type>::VARIANT_TYPE; } \
+ static uint32_t get_index_usage() { return GetTypeInfo<m_elem_type>::get_class_info().usage; } \
static uint64_t get_indexed_size(const Variant *base) { return m_max; } \
};
@@ -564,6 +567,7 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
v m_accessor[index] = PtrToArg<m_elem_type>::convert(member); \
} \
static Variant::Type get_index_type() { return GetTypeInfo<m_elem_type>::VARIANT_TYPE; } \
+ static uint32_t get_index_usage() { return GetTypeInfo<m_elem_type>::get_class_info().usage; } \
static uint64_t get_indexed_size(const Variant *base) { return m_max; } \
};
@@ -613,6 +617,7 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
v.m_set(index, PtrToArg<m_elem_type>::convert(member)); \
} \
static Variant::Type get_index_type() { return GetTypeInfo<m_elem_type>::VARIANT_TYPE; } \
+ static uint32_t get_index_usage() { return GetTypeInfo<m_elem_type>::get_class_info().usage; } \
static uint64_t get_indexed_size(const Variant *base) { return m_max; } \
};
@@ -683,6 +688,7 @@ struct VariantIndexedSetGet_Array {
v.set(index, PtrToArg<Variant>::convert(member));
}
static Variant::Type get_index_type() { return Variant::NIL; }
+ static uint32_t get_index_usage() { return PROPERTY_USAGE_NIL_IS_VARIANT; }
static uint64_t get_indexed_size(const Variant *base) { return 0; }
};
@@ -768,6 +774,7 @@ struct VariantIndexedSetGet_String {
}
}
static Variant::Type get_index_type() { return Variant::STRING; }
+ static uint32_t get_index_usage() { return PROPERTY_USAGE_DEFAULT; }
static uint64_t get_indexed_size(const Variant *base) { return VariantInternal::get_string(base)->length(); }
};
@@ -812,6 +819,7 @@ struct VariantIndexedSetGet_String {
v[index] = PtrToArg<Variant>::convert(member); \
} \
static Variant::Type get_index_type() { return Variant::NIL; } \
+ static uint32_t get_index_usage() { return PROPERTY_USAGE_DEFAULT; } \
static uint64_t get_indexed_size(const Variant *base) { return VariantGetInternalPtr<m_base_type>::get_ptr(base)->size(); } \
};
@@ -852,7 +860,8 @@ struct VariantIndexedSetterGetterInfo {
uint64_t (*get_indexed_size)(const Variant *base) = nullptr;
- Variant::Type index_type;
+ Variant::Type index_type = Variant::NIL;
+ uint32_t index_usage = PROPERTY_USAGE_DEFAULT;
bool valid = false;
};
@@ -872,6 +881,7 @@ static void register_indexed_member(Variant::Type p_type) {
sgi.ptr_getter = T::ptr_get;
sgi.index_type = T::get_index_type();
+ sgi.index_usage = T::get_index_usage();
sgi.get_indexed_size = T::get_indexed_size;
sgi.valid = true;
@@ -920,6 +930,11 @@ Variant::Type Variant::get_indexed_element_type(Variant::Type p_type) {
return variant_indexed_setters_getters[p_type].index_type;
}
+uint32_t Variant::get_indexed_element_usage(Variant::Type p_type) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, PROPERTY_USAGE_DEFAULT);
+ return variant_indexed_setters_getters[p_type].index_usage;
+}
+
Variant::ValidatedIndexedSetter Variant::get_member_validated_indexed_setter(Variant::Type p_type) {
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, nullptr);
return variant_indexed_setters_getters[p_type].validated_setter;
diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp
index fe7150bca9..042ebe368a 100644
--- a/core/variant/variant_utility.cpp
+++ b/core/variant/variant_utility.cpp
@@ -1007,9 +1007,14 @@ struct VariantUtilityFunctions {
static inline uint64_t rid_allocate_id() {
return RID_AllocBase::_gen_id();
}
+
static inline RID rid_from_int64(uint64_t p_base) {
return RID::from_uint64(p_base);
}
+
+ static inline bool is_same(const Variant &p_a, const Variant &p_b) {
+ return p_a.identity_compare(p_b);
+ }
};
#ifdef DEBUG_METHODS_ENABLED
@@ -1601,6 +1606,8 @@ void Variant::_register_variant_utility_functions() {
FUNCBINDR(rid_allocate_id, Vector<String>(), Variant::UTILITY_FUNC_TYPE_GENERAL);
FUNCBINDR(rid_from_int64, sarray("base"), Variant::UTILITY_FUNC_TYPE_GENERAL);
+
+ FUNCBINDR(is_same, sarray("a", "b"), Variant::UTILITY_FUNC_TYPE_GENERAL);
}
void Variant::_unregister_variant_utility_functions() {
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 7e7cb07cef..0d6524ccbe 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -442,9 +442,14 @@
<param index="0" name="variable" type="Variant" />
<description>
Returns the integer hash of the passed [param variable].
- [codeblock]
+ [codeblocks]
+ [gdscript]
print(hash("a")) # Prints 177670
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ GD.Print(GD.Hash("a")); // Prints 177670
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="instance_from_id">
@@ -452,13 +457,29 @@
<param index="0" name="instance_id" type="int" />
<description>
Returns the [Object] that corresponds to [param instance_id]. All Objects have a unique instance ID. See also [method Object.get_instance_id].
- [codeblock]
+ [codeblocks]
+ [gdscript]
var foo = "bar"
+
func _ready():
var id = get_instance_id()
var inst = instance_from_id(id)
print(inst.foo) # Prints bar
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ public partial class MyNode : Node
+ {
+ public string Foo { get; set; } = "bar";
+
+ public override void _Ready()
+ {
+ ulong id = GetInstanceId();
+ var inst = (MyNode)InstanceFromId(Id);
+ GD.Print(inst.Foo); // Prints bar
+ }
+ }
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="inverse_lerp">
@@ -525,6 +546,31 @@
Returns [code]true[/code] if [param x] is a NaN ("Not a Number" or invalid) value.
</description>
</method>
+ <method name="is_same">
+ <return type="bool" />
+ <param index="0" name="a" type="Variant" />
+ <param index="1" name="b" type="Variant" />
+ <description>
+ Returns [code]true[/code], for value types, if [param a] and [param b] share the same value. Returns [code]true[/code], for reference types, if the references of [param a] and [param b] are the same.
+ [codeblock]
+ # Vector2 is a value type
+ var vec2_a = Vector2(0, 0)
+ var vec2_b = Vector2(0, 0)
+ var vec2_c = Vector2(1, 1)
+ is_same(vec2_a, vec2_a) # true
+ is_same(vec2_a, vec2_b) # true
+ is_same(vec2_a, vec2_c) # false
+
+ # Array is a reference type
+ var arr_a = []
+ var arr_b = []
+ is_same(arr_a, arr_a) # true
+ is_same(arr_a, arr_b) # false
+ [/codeblock]
+ These are [Variant] value types: [code]null[/code], [bool], [int], [float], [String], [StringName], [Vector2], [Vector2i], [Vector3], [Vector3i], [Vector4], [Vector4i], [Rect2], [Rect2i], [Transform2D], [Transform3D], [Plane], [Quaternion], [AABB], [Basis], [Projection], [Color], [NodePath], [RID], [Callable] and [Signal].
+ These are [Variant] reference types: [Object], [Dictionary], [Array], [PackedByteArray], [PackedInt32Array], [PackedInt64Array], [PackedFloat32Array], [PackedFloat64Array], [PackedStringArray], [PackedVector2Array], [PackedVector3Array] and [PackedColorArray].
+ </description>
+ </method>
<method name="is_zero_approx">
<return type="bool" />
<param index="0" name="x" type="float" />
@@ -764,10 +810,16 @@
<method name="print" qualifiers="vararg">
<description>
Converts one or more arguments of any type to string in the best way possible and prints them to the console.
- [codeblock]
+ [codeblocks]
+ [gdscript]
var a = [1, 2, 3]
print("a", "b", a) # Prints ab[1, 2, 3]
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ var a = new Godot.Collections.Array { 1, 2, 3 };
+ GD.Print("a", "b", a); // Prints ab[1, 2, 3]
+ [/csharp]
+ [/codeblocks]
[b]Note:[/b] Consider using [method push_error] and [method push_warning] to print error and warning messages instead of [method print] or [method print_rich]. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed.
</description>
</method>
@@ -775,9 +827,14 @@
<description>
Converts one or more arguments of any type to string in the best way possible and prints them to the console. The following BBCode tags are supported: b, i, u, s, indent, code, url, center, right, color, bgcolor, fgcolor. Color tags only support named colors such as [code]red[/code], [i]not[/i] hexadecimal color codes. Unsupported tags will be left as-is in standard output.
When printing to standard output, the supported subset of BBCode is converted to ANSI escape codes for the terminal emulator to display. Displaying ANSI escape codes is currently only supported on Linux and macOS. Support for ANSI escape codes may vary across terminal emulators, especially for italic and strikethrough.
- [codeblock]
+ [codeblocks]
+ [gdscript]
print_rich("[code][b]Hello world![/b][/code]") # Prints out: [b]Hello world![/b]
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ GD.PrintRich("[code][b]Hello world![/b][/code]"); // Prints out: [b]Hello world![/b]
+ [/csharp]
+ [/codeblocks]
[b]Note:[/b] Consider using [method push_error] and [method push_warning] to print error and warning messages instead of [method print] or [method print_rich]. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed.
</description>
</method>
@@ -789,53 +846,86 @@
<method name="printerr" qualifiers="vararg">
<description>
Prints one or more arguments to strings in the best way possible to standard error line.
- [codeblock]
+ [codeblocks]
+ [gdscript]
printerr("prints to stderr")
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ GD.PrintErr("prints to stderr");
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="printraw" qualifiers="vararg">
<description>
Prints one or more arguments to strings in the best way possible to the OS terminal. Unlike [method print], no newline is automatically added at the end.
- [codeblock]
+ [codeblocks]
+ [gdscript]
printraw("A")
printraw("B")
printraw("C")
# Prints ABC to terminal
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ GD.PrintRaw("A");
+ GD.PrintRaw("B");
+ GD.PrintRaw("C");
+ // Prints ABC to terminal
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="prints" qualifiers="vararg">
<description>
Prints one or more arguments to the console with a space between each argument.
- [codeblock]
+ [codeblocks]
+ [gdscript]
prints("A", "B", "C") # Prints A B C
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ GD.PrintS("A", "B", "C"); // Prints A B C
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="printt" qualifiers="vararg">
<description>
Prints one or more arguments to the console with a tab between each argument.
- [codeblock]
+ [codeblocks]
+ [gdscript]
printt("A", "B", "C") # Prints A B C
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ GD.PrintT("A", "B", "C"); // Prints A B C
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="push_error" qualifiers="vararg">
<description>
Pushes an error message to Godot's built-in debugger and to the OS terminal.
- [codeblock]
+ [codeblocks]
+ [gdscript]
push_error("test error") # Prints "test error" to debugger and terminal as error call
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ GD.PushError("test error"); // Prints "test error" to debugger and terminal as error call
+ [/csharp]
+ [/codeblocks]
[b]Note:[/b] This function does not pause project execution. To print an error message and pause project execution in debug builds, use [code]assert(false, "test error")[/code] instead.
</description>
</method>
<method name="push_warning" qualifiers="vararg">
<description>
Pushes a warning message to Godot's built-in debugger and to the OS terminal.
- [codeblock]
+ [codeblocks]
+ [gdscript]
push_warning("test warning") # Prints "test warning" to debugger and terminal as warning call
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ GD.PushWarning("test warning"); // Prints "test warning" to debugger and terminal as warning call
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="rad_to_deg">
@@ -868,9 +958,14 @@
<return type="float" />
<description>
Returns a random floating point value between [code]0.0[/code] and [code]1.0[/code] (inclusive).
- [codeblock]
+ [codeblocks]
+ [gdscript]
randf() # Returns e.g. 0.375671
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ GD.Randf(); // Returns e.g. 0.375671
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="randf_range">
@@ -879,10 +974,16 @@
<param index="1" name="to" type="float" />
<description>
Returns a random floating point value between [param from] and [param to] (inclusive).
- [codeblock]
+ [codeblocks]
+ [gdscript]
randf_range(0, 20.5) # Returns e.g. 7.45315
randf_range(-10, 10) # Returns e.g. -3.844535
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ GD.RandRange(0.0, 20.5); // Returns e.g. 7.45315
+ GD.RandRange(-10.0, 10.0); // Returns e.g. -3.844535
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="randfn">
@@ -897,12 +998,20 @@
<return type="int" />
<description>
Returns a random unsigned 32-bit integer. Use remainder to obtain a random value in the interval [code][0, N - 1][/code] (where N is smaller than 2^32).
- [codeblock]
+ [codeblocks]
+ [gdscript]
randi() # Returns random integer between 0 and 2^32 - 1
randi() % 20 # Returns random integer between 0 and 19
randi() % 100 # Returns random integer between 0 and 99
randi() % 100 + 1 # Returns random integer between 1 and 100
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ GD.Randi(); // Returns random integer between 0 and 2^32 - 1
+ GD.Randi() % 20; // Returns random integer between 0 and 19
+ GD.Randi() % 100; // Returns random integer between 0 and 99
+ GD.Randi() % 100 + 1; // Returns random integer between 1 and 100
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="randi_range">
@@ -911,10 +1020,16 @@
<param index="1" name="to" type="int" />
<description>
Returns a random signed 32-bit integer between [param from] and [param to] (inclusive). If [param to] is lesser than [param from], they are swapped.
- [codeblock]
+ [codeblocks]
+ [gdscript]
randi_range(0, 1) # Returns either 0 or 1
randi_range(-10, 1000) # Returns random integer between -10 and 1000
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ GD.RandRange(0, 1); // Returns either 0 or 1
+ GD.RandRange(-10, 1000); // Returns random integer between -10 and 1000
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="randomize">
@@ -985,14 +1100,24 @@
<param index="0" name="base" type="int" />
<description>
Sets the seed for the random number generator to [param base]. Setting the seed manually can ensure consistent, repeatable results for most random functions.
- [codeblock]
+ [codeblocks]
+ [gdscript]
var my_seed = "Godot Rocks".hash()
seed(my_seed)
var a = randf() + randi()
seed(my_seed)
var b = randf() + randi()
# a and b are now identical
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ ulong mySeed = (ulong)GD.Hash("Godot Rocks");
+ GD.Seed(mySeed);
+ var a = GD.Randf() + GD.Randi();
+ GD.Seed(mySeed);
+ var b = GD.Randf() + GD.Randi();
+ // a and b are now identical
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="sign">
@@ -1154,11 +1279,18 @@
<param index="0" name="string" type="String" />
<description>
Converts a formatted [param string] that was returned by [method var_to_str] to the original [Variant].
- [codeblock]
+ [codeblocks]
+ [gdscript]
var a = '{ "a": 1, "b": 2 }' # a is a String
var b = str_to_var(a) # b is a Dictionary
print(b["a"]) # Prints 1
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ string a = "{ \"a\": 1, \"b\": 2 }"; // a is a string
+ var b = GD.StrToVar(a).AsGodotDictionary(); // b is a Dictionary
+ GD.Print(b["a"]); // Prints 1
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="tan">
@@ -1218,15 +1350,21 @@
<param index="0" name="variable" type="Variant" />
<description>
Converts a [Variant] [param variable] to a formatted [String] that can then be parsed using [method str_to_var].
- [codeblock]
- a = { "a": 1, "b": 2 }
+ [codeblocks]
+ [gdscript]
+ var a = { "a": 1, "b": 2 }
print(var_to_str(a))
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ var a = new Godot.Collections.Dictionary { ["a"] = 1, ["b"] = 2 };
+ GD.Print(GD.VarToStr(a));
+ [/csharp]
+ [/codeblocks]
Prints:
[codeblock]
{
- "a": 1,
- "b": 2
+ "a": 1,
+ "b": 2
}
[/codeblock]
</description>
@@ -1767,30 +1905,15 @@
<constant name="KEY_KP_9" value="4194447" enum="Key">
Number 9 on the numeric keypad.
</constant>
- <constant name="KEY_SUPER_L" value="4194368" enum="Key">
- Left Super key (Windows key).
- </constant>
- <constant name="KEY_SUPER_R" value="4194369" enum="Key">
- Right Super key (Windows key).
- </constant>
<constant name="KEY_MENU" value="4194370" enum="Key">
Context menu key.
</constant>
- <constant name="KEY_HYPER_L" value="4194371" enum="Key">
- Left Hyper key.
- </constant>
- <constant name="KEY_HYPER_R" value="4194372" enum="Key">
- Right Hyper key.
+ <constant name="KEY_HYPER" value="4194371" enum="Key">
+ Hyper key. (On Linux/X11 only).
</constant>
<constant name="KEY_HELP" value="4194373" enum="Key">
Help key.
</constant>
- <constant name="KEY_DIRECTION_L" value="4194374" enum="Key">
- Left Direction key.
- </constant>
- <constant name="KEY_DIRECTION_R" value="4194375" enum="Key">
- Right Direction key.
- </constant>
<constant name="KEY_BACK" value="4194376" enum="Key">
Media back key. Not to be confused with the Back button on an Android device.
</constant>
@@ -1812,21 +1935,6 @@
<constant name="KEY_VOLUMEUP" value="4194382" enum="Key">
Volume up key.
</constant>
- <constant name="KEY_BASSBOOST" value="4194383" enum="Key">
- Bass Boost key.
- </constant>
- <constant name="KEY_BASSUP" value="4194384" enum="Key">
- Bass up key.
- </constant>
- <constant name="KEY_BASSDOWN" value="4194385" enum="Key">
- Bass down key.
- </constant>
- <constant name="KEY_TREBLEUP" value="4194386" enum="Key">
- Treble up key.
- </constant>
- <constant name="KEY_TREBLEDOWN" value="4194387" enum="Key">
- Treble down key.
- </constant>
<constant name="KEY_MEDIAPLAY" value="4194388" enum="Key">
Media play key.
</constant>
@@ -1911,7 +2019,7 @@
<constant name="KEY_LAUNCHF" value="4194415" enum="Key">
Launch Shortcut F key.
</constant>
- <constant name="KEY_UNKNOWN" value="16777215" enum="Key">
+ <constant name="KEY_UNKNOWN" value="8388607" enum="Key">
Unknown key.
</constant>
<constant name="KEY_SPACE" value="32" enum="Key">
@@ -2121,203 +2229,23 @@
<constant name="KEY_ASCIITILDE" value="126" enum="Key">
~ key.
</constant>
- <constant name="KEY_NOBREAKSPACE" value="160" enum="Key">
- Non-breakable space key.
- </constant>
- <constant name="KEY_EXCLAMDOWN" value="161" enum="Key">
- ¡ key.
- </constant>
- <constant name="KEY_CENT" value="162" enum="Key">
- ¢ key.
- </constant>
- <constant name="KEY_STERLING" value="163" enum="Key">
- £ key.
- </constant>
- <constant name="KEY_CURRENCY" value="164" enum="Key">
- ¤ key.
- </constant>
<constant name="KEY_YEN" value="165" enum="Key">
Â¥ key.
</constant>
- <constant name="KEY_BROKENBAR" value="166" enum="Key">
- ¦ key.
- </constant>
<constant name="KEY_SECTION" value="167" enum="Key">
§ key.
</constant>
- <constant name="KEY_DIAERESIS" value="168" enum="Key">
- ¨ key.
- </constant>
- <constant name="KEY_COPYRIGHT" value="169" enum="Key">
- © key.
- </constant>
- <constant name="KEY_ORDFEMININE" value="170" enum="Key">
- ª key.
- </constant>
- <constant name="KEY_GUILLEMOTLEFT" value="171" enum="Key">
- « key.
- </constant>
- <constant name="KEY_NOTSIGN" value="172" enum="Key">
- ¬ key.
- </constant>
- <constant name="KEY_HYPHEN" value="173" enum="Key">
- Soft hyphen key.
- </constant>
- <constant name="KEY_REGISTERED" value="174" enum="Key">
- ® key.
- </constant>
- <constant name="KEY_MACRON" value="175" enum="Key">
- ¯ key.
- </constant>
- <constant name="KEY_DEGREE" value="176" enum="Key">
- ° key.
- </constant>
- <constant name="KEY_PLUSMINUS" value="177" enum="Key">
- ± key.
- </constant>
- <constant name="KEY_TWOSUPERIOR" value="178" enum="Key">
- ² key.
- </constant>
- <constant name="KEY_THREESUPERIOR" value="179" enum="Key">
- ³ key.
- </constant>
- <constant name="KEY_ACUTE" value="180" enum="Key">
- ´ key.
- </constant>
- <constant name="KEY_MU" value="181" enum="Key">
- µ key.
- </constant>
- <constant name="KEY_PARAGRAPH" value="182" enum="Key">
- ¶ key.
- </constant>
- <constant name="KEY_PERIODCENTERED" value="183" enum="Key">
- · key.
- </constant>
- <constant name="KEY_CEDILLA" value="184" enum="Key">
- ¸ key.
- </constant>
- <constant name="KEY_ONESUPERIOR" value="185" enum="Key">
- ¹ key.
- </constant>
- <constant name="KEY_MASCULINE" value="186" enum="Key">
- º key.
- </constant>
- <constant name="KEY_GUILLEMOTRIGHT" value="187" enum="Key">
- » key.
- </constant>
- <constant name="KEY_ONEQUARTER" value="188" enum="Key">
- ¼ key.
- </constant>
- <constant name="KEY_ONEHALF" value="189" enum="Key">
- ½ key.
- </constant>
- <constant name="KEY_THREEQUARTERS" value="190" enum="Key">
- ¾ key.
- </constant>
- <constant name="KEY_QUESTIONDOWN" value="191" enum="Key">
- ¿ key.
- </constant>
- <constant name="KEY_AGRAVE" value="192" enum="Key">
- À key.
- </constant>
- <constant name="KEY_AACUTE" value="193" enum="Key">
- Ã key.
- </constant>
- <constant name="KEY_ACIRCUMFLEX" value="194" enum="Key">
- Â key.
- </constant>
- <constant name="KEY_ATILDE" value="195" enum="Key">
- Ã key.
+ <constant name="KEY_GLOBE" value="4194416" enum="Key">
+ "Globe" key on Mac / iPad keyboard.
</constant>
- <constant name="KEY_ADIAERESIS" value="196" enum="Key">
- Ä key.
+ <constant name="KEY_KEYBOARD" value="4194417" enum="Key">
+ "On-screen keyboard" key iPad keyboard.
</constant>
- <constant name="KEY_ARING" value="197" enum="Key">
- Ã… key.
+ <constant name="KEY_JIS_EISU" value="4194418" enum="Key">
+ 英数 key on Mac keyboard.
</constant>
- <constant name="KEY_AE" value="198" enum="Key">
- Æ key.
- </constant>
- <constant name="KEY_CCEDILLA" value="199" enum="Key">
- Ç key.
- </constant>
- <constant name="KEY_EGRAVE" value="200" enum="Key">
- È key.
- </constant>
- <constant name="KEY_EACUTE" value="201" enum="Key">
- É key.
- </constant>
- <constant name="KEY_ECIRCUMFLEX" value="202" enum="Key">
- Ê key.
- </constant>
- <constant name="KEY_EDIAERESIS" value="203" enum="Key">
- Ë key.
- </constant>
- <constant name="KEY_IGRAVE" value="204" enum="Key">
- Ì key.
- </constant>
- <constant name="KEY_IACUTE" value="205" enum="Key">
- Ã key.
- </constant>
- <constant name="KEY_ICIRCUMFLEX" value="206" enum="Key">
- ÃŽ key.
- </constant>
- <constant name="KEY_IDIAERESIS" value="207" enum="Key">
- Ã key.
- </constant>
- <constant name="KEY_ETH" value="208" enum="Key">
- Ã key.
- </constant>
- <constant name="KEY_NTILDE" value="209" enum="Key">
- Ñ key.
- </constant>
- <constant name="KEY_OGRAVE" value="210" enum="Key">
- Ã’ key.
- </constant>
- <constant name="KEY_OACUTE" value="211" enum="Key">
- Ó key.
- </constant>
- <constant name="KEY_OCIRCUMFLEX" value="212" enum="Key">
- Ô key.
- </constant>
- <constant name="KEY_OTILDE" value="213" enum="Key">
- Õ key.
- </constant>
- <constant name="KEY_ODIAERESIS" value="214" enum="Key">
- Ö key.
- </constant>
- <constant name="KEY_MULTIPLY" value="215" enum="Key">
- × key.
- </constant>
- <constant name="KEY_OOBLIQUE" value="216" enum="Key">
- Ø key.
- </constant>
- <constant name="KEY_UGRAVE" value="217" enum="Key">
- Ù key.
- </constant>
- <constant name="KEY_UACUTE" value="218" enum="Key">
- Ú key.
- </constant>
- <constant name="KEY_UCIRCUMFLEX" value="219" enum="Key">
- Û key.
- </constant>
- <constant name="KEY_UDIAERESIS" value="220" enum="Key">
- Ü key.
- </constant>
- <constant name="KEY_YACUTE" value="221" enum="Key">
- Ã key.
- </constant>
- <constant name="KEY_THORN" value="222" enum="Key">
- Þ key.
- </constant>
- <constant name="KEY_SSHARP" value="223" enum="Key">
- ß key.
- </constant>
- <constant name="KEY_DIVISION" value="247" enum="Key">
- ÷ key.
- </constant>
- <constant name="KEY_YDIAERESIS" value="255" enum="Key">
- ÿ key.
+ <constant name="KEY_JIS_KANA" value="4194419" enum="Key">
+ ã‹ãª key on Mac keyboard.
</constant>
<constant name="KEY_CODE_MASK" value="8388607" enum="KeyModifierMask" is_bitfield="true">
Key Code mask.
@@ -2719,7 +2647,7 @@
Additionally, other keywords can be included: [code]"exp"[/code] for exponential range editing, [code]"radians"[/code] for editing radian angles in degrees, [code]"degrees"[/code] to hint at an angle and [code]"hide_slider"[/code] to hide the slider.
</constant>
<constant name="PROPERTY_HINT_ENUM" value="2" enum="PropertyHint">
- Hints that an [int], [float], or [String] property is an enumerated value to pick in a list specified via a hint string.
+ Hints that an [int] or [String] property is an enumerated value to pick in a list specified via a hint string.
The hint string is a comma separated list of names such as [code]"Hello,Something,Else"[/code]. Whitespaces are [b]not[/b] removed from either end of a name. For integer and float properties, the first name in the list has value 0, the next 1, and so on. Explicit values can also be specified by appending [code]:integer[/code] to the name, e.g. [code]"Zero,One,Three:3,Four,Six:6"[/code].
</constant>
<constant name="PROPERTY_HINT_ENUM_SUGGESTION" value="3" enum="PropertyHint">
@@ -2874,25 +2802,28 @@
<constant name="PROPERTY_USAGE_ARRAY" value="262144" enum="PropertyUsageFlags" is_bitfield="true">
The property is an array.
</constant>
- <constant name="PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE" value="524288" enum="PropertyUsageFlags" is_bitfield="true">
- If the property is a [Resource], a new copy of it is always created when calling [method Node.duplicate] or [method Resource.duplicate].
+ <constant name="PROPERTY_USAGE_ALWAYS_DUPLICATE" value="524288" enum="PropertyUsageFlags" is_bitfield="true">
+ When duplicating a resource with [method Resource.duplicate], and this flag is set on a property of that resource, the property should always be duplicated, regardless of the [code]subresources[/code] bool parameter.
+ </constant>
+ <constant name="PROPERTY_USAGE_NEVER_DUPLICATE" value="1048576" enum="PropertyUsageFlags" is_bitfield="true">
+ When duplicating a resource with [method Resource.duplicate], and this flag is set on a property of that resource, the property should never be duplicated, regardless of the [code]subresources[/code] bool parameter.
</constant>
- <constant name="PROPERTY_USAGE_HIGH_END_GFX" value="1048576" enum="PropertyUsageFlags" is_bitfield="true">
+ <constant name="PROPERTY_USAGE_HIGH_END_GFX" value="2097152" enum="PropertyUsageFlags" is_bitfield="true">
The property is only shown in the editor if modern renderers are supported (GLES3 is excluded).
</constant>
- <constant name="PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT" value="2097152" enum="PropertyUsageFlags" is_bitfield="true">
+ <constant name="PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT" value="4194304" enum="PropertyUsageFlags" is_bitfield="true">
</constant>
- <constant name="PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT" value="4194304" enum="PropertyUsageFlags" is_bitfield="true">
+ <constant name="PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT" value="8388608" enum="PropertyUsageFlags" is_bitfield="true">
</constant>
- <constant name="PROPERTY_USAGE_KEYING_INCREMENTS" value="8388608" enum="PropertyUsageFlags" is_bitfield="true">
+ <constant name="PROPERTY_USAGE_KEYING_INCREMENTS" value="16777216" enum="PropertyUsageFlags" is_bitfield="true">
</constant>
- <constant name="PROPERTY_USAGE_DEFERRED_SET_RESOURCE" value="16777216" enum="PropertyUsageFlags" is_bitfield="true">
+ <constant name="PROPERTY_USAGE_DEFERRED_SET_RESOURCE" value="33554432" enum="PropertyUsageFlags" is_bitfield="true">
</constant>
- <constant name="PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT" value="33554432" enum="PropertyUsageFlags" is_bitfield="true">
+ <constant name="PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT" value="67108864" enum="PropertyUsageFlags" is_bitfield="true">
</constant>
- <constant name="PROPERTY_USAGE_EDITOR_BASIC_SETTING" value="67108864" enum="PropertyUsageFlags" is_bitfield="true">
+ <constant name="PROPERTY_USAGE_EDITOR_BASIC_SETTING" value="134217728" enum="PropertyUsageFlags" is_bitfield="true">
</constant>
- <constant name="PROPERTY_USAGE_READ_ONLY" value="134217728" enum="PropertyUsageFlags" is_bitfield="true">
+ <constant name="PROPERTY_USAGE_READ_ONLY" value="268435456" enum="PropertyUsageFlags" is_bitfield="true">
The property is read-only in the [EditorInspector].
</constant>
<constant name="PROPERTY_USAGE_DEFAULT" value="6" enum="PropertyUsageFlags" is_bitfield="true">
diff --git a/doc/classes/AABB.xml b/doc/classes/AABB.xml
index ca454cafa3..2c5337eea3 100644
--- a/doc/classes/AABB.xml
+++ b/doc/classes/AABB.xml
@@ -66,7 +66,7 @@
[/gdscript]
[csharp]
// position (-3, 2, 0), size (1, 1, 1)
- var box = new AABB(new Vector3(-3, 2, 0), new Vector3(1, 1, 1));
+ var box = new Aabb(new Vector3(-3, 2, 0), new Vector3(1, 1, 1));
// position (-3, -1, 0), size (3, 4, 2), so we fit both the original AABB and Vector3(0, -1, 2)
var box2 = box.Expand(new Vector3(0, -1, 2));
[/csharp]
diff --git a/doc/classes/AStarGrid2D.xml b/doc/classes/AStarGrid2D.xml
index 32599d7f7d..b253a33377 100644
--- a/doc/classes/AStarGrid2D.xml
+++ b/doc/classes/AStarGrid2D.xml
@@ -17,11 +17,11 @@
[/gdscript]
[csharp]
AStarGrid2D astarGrid = new AStarGrid2D();
- astarGrid.Size = new Vector2i(32, 32);
- astarGrid.CellSize = new Vector2i(16, 16);
+ astarGrid.Size = new Vector2I(32, 32);
+ astarGrid.CellSize = new Vector2I(16, 16);
astarGrid.Update();
- GD.Print(astarGrid.GetIdPath(Vector2i.Zero, new Vector2i(3, 4))); // prints (0, 0), (1, 1), (2, 2), (3, 3), (3, 4)
- GD.Print(astarGrid.GetPointPath(Vector2i.Zero, new Vector2i(3, 4))); // prints (0, 0), (16, 16), (32, 32), (48, 48), (48, 64)
+ GD.Print(astarGrid.GetIdPath(Vector2I.Zero, new Vector2I(3, 4))); // prints (0, 0), (1, 1), (2, 2), (3, 3), (3, 4)
+ GD.Print(astarGrid.GetPointPath(Vector2I.Zero, new Vector2I(3, 4))); // prints (0, 0), (16, 16), (32, 32), (48, 48), (48, 64)
[/csharp]
[/codeblocks]
</description>
diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml
index 4da9e41ca8..c0e5d6ad07 100644
--- a/doc/classes/AcceptDialog.xml
+++ b/doc/classes/AcceptDialog.xml
@@ -53,7 +53,7 @@
<return type="void" />
<param index="0" name="button" type="Control" />
<description>
- Removes the [param button] from the dialog. Does NOT free the [param button]. The [param button] must be a [Button] added with [method add_button] or [method add_cancel_button] method. After removal, pressing the [param button] will no longer emit this dialog's [signal custom_action] or [signal cancelled] signals.
+ Removes the [param button] from the dialog. Does NOT free the [param button]. The [param button] must be a [Button] added with [method add_button] or [method add_cancel_button] method. After removal, pressing the [param button] will no longer emit this dialog's [signal custom_action] or [signal canceled] signals.
</description>
</method>
</methods>
@@ -81,7 +81,7 @@
<member name="wrap_controls" type="bool" setter="set_wrap_controls" getter="is_wrapping_controls" overrides="Window" default="true" />
</members>
<signals>
- <signal name="cancelled">
+ <signal name="canceled">
<description>
Emitted when the dialog is closed or the button created with [method add_cancel_button] is pressed.
</description>
diff --git a/doc/classes/AnimatableBody3D.xml b/doc/classes/AnimatableBody3D.xml
index 2a08c4c8f1..0733780bf7 100644
--- a/doc/classes/AnimatableBody3D.xml
+++ b/doc/classes/AnimatableBody3D.xml
@@ -7,6 +7,7 @@
Animatable body for 3D physics.
An animatable body can't be moved by external forces or contacts, but can be moved by script or animation to affect other bodies in its path. It is ideal for implementing moving objects in the environment, such as moving platforms or doors.
When the body is moved manually, either from code or from an [AnimationPlayer] (with [member AnimationPlayer.playback_process_mode] set to [code]physics[/code]), the physics will automatically compute an estimate of their linear and angular velocity. This makes them very useful for moving platforms or other AnimationPlayer-controlled objects (like a door, a bridge that opens, etc).
+ [b]Warning:[/b] With a non-uniform scale this node will probably not function as expected. Please make sure to keep its scale uniform (i.e. the same on all axes), and change the size(s) of its collision shape(s) instead.
</description>
<tutorials>
<link title="3D Physics Tests Demo">https://godotengine.org/asset-library/asset/675</link>
diff --git a/doc/classes/AnimatedSprite2D.xml b/doc/classes/AnimatedSprite2D.xml
index cd9c0cee98..9872c59990 100644
--- a/doc/classes/AnimatedSprite2D.xml
+++ b/doc/classes/AnimatedSprite2D.xml
@@ -5,34 +5,82 @@
</brief_description>
<description>
[AnimatedSprite2D] is similar to the [Sprite2D] node, except it carries multiple textures as animation frames. Animations are created using a [SpriteFrames] resource, which allows you to import image files (or a folder containing said files) to provide the animation frames for the sprite. The [SpriteFrames] resource can be configured in the editor via the SpriteFrames bottom panel.
- After setting up [member frames], [method play] may be called. It's also possible to select an [member animation] and toggle [member playing], even within the editor.
- To pause the current animation, set [member playing] to [code]false[/code]. Alternatively, setting [member speed_scale] to [code]0[/code] also preserves the current frame's elapsed time.
</description>
<tutorials>
<link title="2D Sprite animation">$DOCS_URL/tutorials/2d/2d_sprite_animation.html</link>
<link title="2D Dodge The Creeps Demo">https://godotengine.org/asset-library/asset/515</link>
</tutorials>
<methods>
+ <method name="get_playing_speed" qualifiers="const">
+ <return type="float" />
+ <description>
+ Returns the actual playing speed of current animation or [code]0[/code] if not playing. This speed is the [member speed_scale] property multiplied by [code]custom_speed[/code] argument specified when calling the [method play] method.
+ Returns a negative value if the current animation is playing backwards.
+ </description>
+ </method>
+ <method name="is_playing" qualifiers="const">
+ <return type="bool" />
+ <description>
+ Returns [code]true[/code] if an animation is currently playing (even if [member speed_scale] and/or [code]custom_speed[/code] are [code]0[/code]).
+ </description>
+ </method>
+ <method name="pause">
+ <return type="void" />
+ <description>
+ Pauses the currently playing animation. The [member frame] and [member frame_progress] will be kept and calling [method play] or [method play_backwards] without arguments will resume the animation from the current playback position.
+ See also [method stop].
+ </description>
+ </method>
<method name="play">
<return type="void" />
- <param index="0" name="anim" type="StringName" default="&amp;&quot;&quot;" />
- <param index="1" name="backwards" type="bool" default="false" />
+ <param index="0" name="name" type="StringName" default="&amp;&quot;&quot;" />
+ <param index="1" name="custom_speed" type="float" default="1.0" />
+ <param index="2" name="from_end" type="bool" default="false" />
+ <description>
+ Plays the animation with key [param name]. If [param custom_speed] is negative and [param from_end] is [code]true[/code], the animation will play backwards (which is equivalent to calling [method play_backwards]).
+ If this method is called with that same animation [param name], or with no [param name] parameter, the assigned animation will resume playing if it was paused.
+ </description>
+ </method>
+ <method name="play_backwards">
+ <return type="void" />
+ <param index="0" name="name" type="StringName" default="&amp;&quot;&quot;" />
+ <description>
+ Plays the animation with key [param name] in reverse.
+ This method is a shorthand for [method play] with [code]custom_speed = -1.0[/code] and [code]from_end = true[/code], so see its description for more information.
+ </description>
+ </method>
+ <method name="set_frame_and_progress">
+ <return type="void" />
+ <param index="0" name="frame" type="int" />
+ <param index="1" name="progress" type="float" />
<description>
- Plays the animation named [param anim]. If no [param anim] is provided, the current animation is played. If [param backwards] is [code]true[/code], the animation is played in reverse.
- [b]Note:[/b] If [member speed_scale] is negative, the animation direction specified by [param backwards] will be inverted.
+ The setter of [member frame] resets the [member frame_progress] to [code]0.0[/code] implicitly, but this method avoids that.
+ This is useful when you want to carry over the current [member frame_progress] to another [member frame].
+ [b]Example:[/b]
+ [codeblocks]
+ [gdscript]
+ # Change the animation with keeping the frame index and progress.
+ var current_frame = animated_sprite.get_frame()
+ var current_progress = animated_sprite.get_frame_progress()
+ animated_sprite.play("walk_another_skin")
+ animated_sprite.set_frame_and_progress(current_frame, current_progress)
+ [/gdscript]
+ [/codeblocks]
</description>
</method>
<method name="stop">
<return type="void" />
<description>
- Stops the current [member animation] at the current [member frame].
- [b]Note:[/b] This method resets the current frame's elapsed time and removes the [code]backwards[/code] flag from the current [member animation] (if it was previously set by [method play]). If this behavior is undesired, set [member playing] to [code]false[/code] instead.
+ Stops the currently playing animation. The animation position is reset to [code]0[/code] and the [code]custom_speed[/code] is reset to [code]1.0[/code]. See also [method pause].
</description>
</method>
</methods>
<members>
<member name="animation" type="StringName" setter="set_animation" getter="get_animation" default="&amp;&quot;default&quot;">
- The current animation from the [member frames] resource. If this value changes, the [code]frame[/code] counter is reset.
+ The current animation from the [member sprite_frames] resource. If this value is changed, the [member frame] counter and the [member frame_progress] are reset.
+ </member>
+ <member name="autoplay" type="String" setter="set_autoplay" getter="get_autoplay" default="&quot;&quot;">
+ The key of the animation to play when the scene loads.
</member>
<member name="centered" type="bool" setter="set_centered" getter="is_centered" default="true">
If [code]true[/code], texture will be centered.
@@ -44,32 +92,46 @@
If [code]true[/code], texture is flipped vertically.
</member>
<member name="frame" type="int" setter="set_frame" getter="get_frame" default="0">
- The displayed animation frame's index.
+ The displayed animation frame's index. Setting this property also resets [member frame_progress]. If this is not desired, use [method set_frame_and_progress].
</member>
- <member name="frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames">
- The [SpriteFrames] resource containing the animation(s). Allows you the option to load, edit, clear, make unique and save the states of the [SpriteFrames] resource.
+ <member name="frame_progress" type="float" setter="set_frame_progress" getter="get_frame_progress" default="0.0">
+ The progress value between [code]0.0[/code] and [code]1.0[/code] until the current frame transitions to the next frame. If the animation is playing backwards, the value transitions from [code]1.0[/code] to [code]0.0[/code].
</member>
<member name="offset" type="Vector2" setter="set_offset" getter="get_offset" default="Vector2(0, 0)">
The texture's drawing offset.
</member>
- <member name="playing" type="bool" setter="set_playing" getter="is_playing" default="false">
- If [code]true[/code], the [member animation] is currently playing. Setting this property to [code]false[/code] pauses the current animation. Use [method stop] to stop the animation at the current frame instead.
- [b]Note:[/b] Unlike [method stop], changing this property to [code]false[/code] preserves the current frame's elapsed time and the [code]backwards[/code] flag of the current [member animation] (if it was previously set by [method play]).
- [b]Note:[/b] After a non-looping animation finishes, the property still remains [code]true[/code].
- </member>
<member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0">
- The animation speed is multiplied by this value. If set to a negative value, the animation is played in reverse. If set to [code]0[/code], the animation is paused, preserving the current frame's elapsed time.
+ The speed scaling ratio. For example, if this value is [code]1[/code], then the animation plays at normal speed. If it's [code]0.5[/code], then it plays at half speed. If it's [code]2[/code], then it plays at double speed.
+ If set to a negative value, the animation is played in reverse. If set to [code]0[/code], the animation will not advance.
+ </member>
+ <member name="sprite_frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames">
+ The [SpriteFrames] resource containing the animation(s). Allows you the option to load, edit, clear, make unique and save the states of the [SpriteFrames] resource.
</member>
</members>
<signals>
+ <signal name="animation_changed">
+ <description>
+ Emitted when [member animation] changes.
+ </description>
+ </signal>
<signal name="animation_finished">
<description>
- Emitted when the animation reaches the end, or the start if it is played in reverse. If the animation is looping, this signal is emitted at the end of each loop.
+ Emitted when the animation reaches the end, or the start if it is played in reverse. When the animation finishes, it pauses the playback.
+ </description>
+ </signal>
+ <signal name="animation_looped">
+ <description>
+ Emitted when the animation loops.
</description>
</signal>
<signal name="frame_changed">
<description>
- Emitted when [member frame] changed.
+ Emitted when [member frame] changes.
+ </description>
+ </signal>
+ <signal name="sprite_frames_changed">
+ <description>
+ Emitted when [member sprite_frames] changes.
</description>
</signal>
</signals>
diff --git a/doc/classes/AnimatedSprite3D.xml b/doc/classes/AnimatedSprite3D.xml
index 4837ae715f..c39bb99827 100644
--- a/doc/classes/AnimatedSprite3D.xml
+++ b/doc/classes/AnimatedSprite3D.xml
@@ -4,59 +4,121 @@
2D sprite node in 3D world, that can use multiple 2D textures for animation.
</brief_description>
<description>
- [AnimatedSprite3D] is similar to the [Sprite3D] node, except it carries multiple textures as animation [member frames]. Animations are created using a [SpriteFrames] resource, which allows you to import image files (or a folder containing said files) to provide the animation frames for the sprite. The [SpriteFrames] resource can be configured in the editor via the SpriteFrames bottom panel.
- After setting up [member frames], [method play] may be called. It's also possible to select an [member animation] and toggle [member playing], even within the editor.
- To pause the current animation, set [member playing] to [code]false[/code]. Alternatively, setting [member speed_scale] to [code]0[/code] also preserves the current frame's elapsed time.
+ [AnimatedSprite3D] is similar to the [Sprite3D] node, except it carries multiple textures as animation [member sprite_frames]. Animations are created using a [SpriteFrames] resource, which allows you to import image files (or a folder containing said files) to provide the animation frames for the sprite. The [SpriteFrames] resource can be configured in the editor via the SpriteFrames bottom panel.
</description>
<tutorials>
<link title="2D Sprite animation (also applies to 3D)">$DOCS_URL/tutorials/2d/2d_sprite_animation.html</link>
</tutorials>
<methods>
+ <method name="get_playing_speed" qualifiers="const">
+ <return type="float" />
+ <description>
+ Returns the actual playing speed of current animation or [code]0[/code] if not playing. This speed is the [member speed_scale] property multiplied by [code]custom_speed[/code] argument specified when calling the [method play] method.
+ Returns a negative value if the current animation is playing backwards.
+ </description>
+ </method>
+ <method name="is_playing" qualifiers="const">
+ <return type="bool" />
+ <description>
+ Returns [code]true[/code] if an animation is currently playing (even if [member speed_scale] and/or [code]custom_speed[/code] are [code]0[/code]).
+ </description>
+ </method>
+ <method name="pause">
+ <return type="void" />
+ <description>
+ Pauses the currently playing animation. The [member frame] and [member frame_progress] will be kept and calling [method play] or [method play_backwards] without arguments will resume the animation from the current playback position.
+ See also [method stop].
+ </description>
+ </method>
<method name="play">
<return type="void" />
- <param index="0" name="anim" type="StringName" default="&amp;&quot;&quot;" />
- <param index="1" name="backwards" type="bool" default="false" />
+ <param index="0" name="name" type="StringName" default="&amp;&quot;&quot;" />
+ <param index="1" name="custom_speed" type="float" default="1.0" />
+ <param index="2" name="from_end" type="bool" default="false" />
+ <description>
+ Plays the animation with key [param name]. If [param custom_speed] is negative and [param from_end] is [code]true[/code], the animation will play backwards (which is equivalent to calling [method play_backwards]).
+ If this method is called with that same animation [param name], or with no [param name] parameter, the assigned animation will resume playing if it was paused.
+ </description>
+ </method>
+ <method name="play_backwards">
+ <return type="void" />
+ <param index="0" name="name" type="StringName" default="&amp;&quot;&quot;" />
+ <description>
+ Plays the animation with key [param name] in reverse.
+ This method is a shorthand for [method play] with [code]custom_speed = -1.0[/code] and [code]from_end = true[/code], so see its description for more information.
+ </description>
+ </method>
+ <method name="set_frame_and_progress">
+ <return type="void" />
+ <param index="0" name="frame" type="int" />
+ <param index="1" name="progress" type="float" />
<description>
- Plays the animation named [param anim]. If no [param anim] is provided, the current animation is played. If [param backwards] is [code]true[/code], the animation is played in reverse.
- [b]Note:[/b] If [member speed_scale] is negative, the animation direction specified by [param backwards] will be inverted.
+ The setter of [member frame] resets the [member frame_progress] to [code]0.0[/code] implicitly, but this method avoids that.
+ This is useful when you want to carry over the current [member frame_progress] to another [member frame].
+ [b]Example:[/b]
+ [codeblocks]
+ [gdscript]
+ # Change the animation with keeping the frame index and progress.
+ var current_frame = animated_sprite.get_frame()
+ var current_progress = animated_sprite.get_frame_progress()
+ animated_sprite.play("walk_another_skin")
+ animated_sprite.set_frame_and_progress(current_frame, current_progress)
+ [/gdscript]
+ [/codeblocks]
</description>
</method>
<method name="stop">
<return type="void" />
<description>
- Stops the current [member animation] at the current [member frame].
- [b]Note:[/b] This method resets the current frame's elapsed time and removes the [code]backwards[/code] flag from the current [member animation] (if it was previously set by [method play]). If this behavior is undesired, set [member playing] to [code]false[/code] instead.
+ Stops the currently playing animation. The animation position is reset to [code]0[/code] and the [code]custom_speed[/code] is reset to [code]1.0[/code]. See also [method pause].
</description>
</method>
</methods>
<members>
<member name="animation" type="StringName" setter="set_animation" getter="get_animation" default="&amp;&quot;default&quot;">
- The current animation from the [code]frames[/code] resource. If this value changes, the [code]frame[/code] counter is reset.
+ The current animation from the [member sprite_frames] resource. If this value is changed, the [member frame] counter and the [member frame_progress] are reset.
</member>
- <member name="frame" type="int" setter="set_frame" getter="get_frame" default="0">
- The displayed animation frame's index.
+ <member name="autoplay" type="String" setter="set_autoplay" getter="get_autoplay" default="&quot;&quot;">
+ The key of the animation to play when the scene loads.
</member>
- <member name="frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames">
- The [SpriteFrames] resource containing the animation(s).
+ <member name="frame" type="int" setter="set_frame" getter="get_frame" default="0">
+ The displayed animation frame's index. Setting this property also resets [member frame_progress]. If this is not desired, use [method set_frame_and_progress].
</member>
- <member name="playing" type="bool" setter="set_playing" getter="is_playing" default="false">
- If [code]true[/code], the [member animation] is currently playing. Setting this property to [code]false[/code] pauses the current animation. Use [method stop] to stop the animation at the current frame instead.
- [b]Note:[/b] Unlike [method stop], changing this property to [code]false[/code] preserves the current frame's elapsed time and the [code]backwards[/code] flag of the current [member animation] (if it was previously set by [method play]).
- [b]Note:[/b] After a non-looping animation finishes, the property still remains [code]true[/code].
+ <member name="frame_progress" type="float" setter="set_frame_progress" getter="get_frame_progress" default="0.0">
+ The progress value between [code]0.0[/code] and [code]1.0[/code] until the current frame transitions to the next frame. If the animation is playing backwards, the value transitions from [code]1.0[/code] to [code]0.0[/code].
</member>
<member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0">
- The animation speed is multiplied by this value. If set to a negative value, the animation is played in reverse. If set to [code]0[/code], the animation is paused, preserving the current frame's elapsed time.
+ The speed scaling ratio. For example, if this value is [code]1[/code], then the animation plays at normal speed. If it's [code]0.5[/code], then it plays at half speed. If it's [code]2[/code], then it plays at double speed.
+ If set to a negative value, the animation is played in reverse. If set to [code]0[/code], the animation will not advance.
+ </member>
+ <member name="sprite_frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames">
+ The [SpriteFrames] resource containing the animation(s). Allows you the option to load, edit, clear, make unique and save the states of the [SpriteFrames] resource.
</member>
</members>
<signals>
+ <signal name="animation_changed">
+ <description>
+ Emitted when [member animation] changes.
+ </description>
+ </signal>
<signal name="animation_finished">
<description>
- Emitted when the animation reaches the end, or the start if it is played in reverse. If the animation is looping, this signal is emitted at the end of each loop.
+ Emitted when the animation reaches the end, or the start if it is played in reverse. When the animation finishes, it pauses the playback.
+ </description>
+ </signal>
+ <signal name="animation_looped">
+ <description>
+ Emitted when the animation loops.
</description>
</signal>
<signal name="frame_changed">
<description>
- Emitted when [member frame] changed.
+ Emitted when [member frame] changes.
+ </description>
+ </signal>
+ <signal name="sprite_frames_changed">
+ <description>
+ Emitted when [member sprite_frames] changes.
</description>
</signal>
</signals>
diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml
index c0626dcfe4..74ee13a3d2 100644
--- a/doc/classes/Animation.xml
+++ b/doc/classes/Animation.xml
@@ -104,6 +104,13 @@
[param stream] is the [AudioStream] resource to play. [param start_offset] is the number of seconds cut off at the beginning of the audio stream, while [param end_offset] is at the ending.
</description>
</method>
+ <method name="audio_track_is_use_blend" qualifiers="const">
+ <return type="bool" />
+ <param index="0" name="track_idx" type="int" />
+ <description>
+ Returns [code]true[/code] if the track at [code]idx[/code] will be blended with other animations.
+ </description>
+ </method>
<method name="audio_track_set_key_end_offset">
<return type="void" />
<param index="0" name="track_idx" type="int" />
@@ -131,6 +138,14 @@
Sets the stream of the key identified by [param key_idx] to value [param stream]. The [param track_idx] must be the index of an Audio Track.
</description>
</method>
+ <method name="audio_track_set_use_blend">
+ <return type="void" />
+ <param index="0" name="track_idx" type="int" />
+ <param index="1" name="enable" type="bool" />
+ <description>
+ Sets whether the track will be blended with other animations. If [code]true[/code], the audio playback volume changes depending on the blend value.
+ </description>
+ </method>
<method name="bezier_track_get_key_in_handle" qualifiers="const">
<return type="Vector2" />
<param index="0" name="track_idx" type="int" />
diff --git a/doc/classes/AnimationNode.xml b/doc/classes/AnimationNode.xml
index a33ec2f6dc..bc65e6013b 100644
--- a/doc/classes/AnimationNode.xml
+++ b/doc/classes/AnimationNode.xml
@@ -49,6 +49,13 @@
When inheriting from [AnimationRootNode], implement this virtual method to return whether the blend tree editor should display filter editing on this node.
</description>
</method>
+ <method name="_is_parameter_read_only" qualifiers="virtual const">
+ <return type="bool" />
+ <param index="0" name="parameter" type="StringName" />
+ <description>
+ When inheriting from [AnimationRootNode], implement this virtual method to return whether the [param parameter] is read-only. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees.
+ </description>
+ </method>
<method name="_process" qualifiers="virtual const">
<return type="float" />
<param index="0" name="time" type="float" />
@@ -61,10 +68,10 @@
</description>
</method>
<method name="add_input">
- <return type="void" />
+ <return type="bool" />
<param index="0" name="name" type="String" />
<description>
- Adds an input to the node. This is only useful for nodes created for use in an [AnimationNodeBlendTree].
+ Adds an input to the node. This is only useful for nodes created for use in an [AnimationNodeBlendTree]. If the addition fails, returns [code]false[/code].
</description>
</method>
<method name="blend_animation">
@@ -108,13 +115,20 @@
Blend another animation node (in case this node contains children animation nodes). This function is only useful if you inherit from [AnimationRootNode] instead, else editors will not display your node for addition.
</description>
</method>
+ <method name="find_input" qualifiers="const">
+ <return type="int" />
+ <param index="0" name="name" type="String" />
+ <description>
+ Returns the input index which corresponds to [param name]. If not found, returns [code]-1[/code].
+ </description>
+ </method>
<method name="get_input_count" qualifiers="const">
<return type="int" />
<description>
Amount of inputs in this node, only useful for nodes that go into [AnimationNodeBlendTree].
</description>
</method>
- <method name="get_input_name">
+ <method name="get_input_name" qualifiers="const">
<return type="String" />
<param index="0" name="input" type="int" />
<description>
@@ -150,6 +164,14 @@
Adds or removes a path for the filter.
</description>
</method>
+ <method name="set_input_name">
+ <return type="bool" />
+ <param index="0" name="input" type="int" />
+ <param index="1" name="name" type="String" />
+ <description>
+ Sets the name of the input at the given [param input] index. If the setting fails, returns [code]false[/code].
+ </description>
+ </method>
<method name="set_parameter">
<return type="void" />
<param index="0" name="name" type="StringName" />
diff --git a/doc/classes/AnimationNodeBlendSpace1D.xml b/doc/classes/AnimationNodeBlendSpace1D.xml
index 0f1ce127cd..9a7872f50e 100644
--- a/doc/classes/AnimationNodeBlendSpace1D.xml
+++ b/doc/classes/AnimationNodeBlendSpace1D.xml
@@ -67,6 +67,9 @@
</method>
</methods>
<members>
+ <member name="blend_mode" type="int" setter="set_blend_mode" getter="get_blend_mode" enum="AnimationNodeBlendSpace1D.BlendMode" default="0">
+ Controls the interpolation between animations. See [enum BlendMode] constants.
+ </member>
<member name="max_space" type="float" setter="set_max_space" getter="get_max_space" default="1.0">
The blend space's axis's upper limit for the points' position. See [method add_blend_point].
</member>
@@ -84,4 +87,15 @@
Label of the virtual axis of the blend space.
</member>
</members>
+ <constants>
+ <constant name="BLEND_MODE_INTERPOLATED" value="0" enum="BlendMode">
+ The interpolation between animations is linear.
+ </constant>
+ <constant name="BLEND_MODE_DISCRETE" value="1" enum="BlendMode">
+ The blend space plays the animation of the node the blending position is closest to. Useful for frame-by-frame 2D animations.
+ </constant>
+ <constant name="BLEND_MODE_DISCRETE_CARRY" value="2" enum="BlendMode">
+ Similar to [constant BLEND_MODE_DISCRETE], but starts the new animation at the last animation's playback position.
+ </constant>
+ </constants>
</class>
diff --git a/doc/classes/AnimationNodeOneShot.xml b/doc/classes/AnimationNodeOneShot.xml
index 14abc34992..9e8193868c 100644
--- a/doc/classes/AnimationNodeOneShot.xml
+++ b/doc/classes/AnimationNodeOneShot.xml
@@ -28,6 +28,12 @@
</member>
</members>
<constants>
+ <constant name="ONE_SHOT_REQUEST_NONE" value="0" enum="OneShotRequest">
+ </constant>
+ <constant name="ONE_SHOT_REQUEST_FIRE" value="1" enum="OneShotRequest">
+ </constant>
+ <constant name="ONE_SHOT_REQUEST_ABORT" value="2" enum="OneShotRequest">
+ </constant>
<constant name="MIX_MODE_BLEND" value="0" enum="MixMode">
</constant>
<constant name="MIX_MODE_ADD" value="1" enum="MixMode">
diff --git a/doc/classes/AnimationNodeStateMachinePlayback.xml b/doc/classes/AnimationNodeStateMachinePlayback.xml
index 8f53ef0dcf..17a946bb3e 100644
--- a/doc/classes/AnimationNodeStateMachinePlayback.xml
+++ b/doc/classes/AnimationNodeStateMachinePlayback.xml
@@ -38,6 +38,12 @@
Returns the playback position within the current animation state.
</description>
</method>
+ <method name="get_fading_from_node" qualifiers="const">
+ <return type="StringName" />
+ <description>
+ Returns the starting state of currently fading animation.
+ </description>
+ </method>
<method name="get_travel_path" qualifiers="const">
<return type="PackedStringArray" />
<description>
@@ -50,11 +56,19 @@
Returns [code]true[/code] if an animation is playing.
</description>
</method>
+ <method name="next">
+ <return type="void" />
+ <description>
+ If there is a next path by travel or auto advance, immediately transitions from the current state to the next state.
+ </description>
+ </method>
<method name="start">
<return type="void" />
<param index="0" name="node" type="StringName" />
+ <param index="1" name="reset" type="bool" default="true" />
<description>
Starts playing the given animation.
+ If [param reset] is [code]true[/code], the animation is played from the beginning.
</description>
</method>
<method name="stop">
@@ -66,8 +80,11 @@
<method name="travel">
<return type="void" />
<param index="0" name="to_node" type="StringName" />
+ <param index="1" name="reset_on_teleport" type="bool" default="true" />
<description>
Transitions from the current state to another one, following the shortest path.
+ If the path does not connect from the current state, the animation will play after the state teleports.
+ If [param reset_on_teleport] is [code]true[/code], the animation is played from the beginning when the travel cause a teleportation.
</description>
</method>
</methods>
diff --git a/doc/classes/AnimationNodeStateMachineTransition.xml b/doc/classes/AnimationNodeStateMachineTransition.xml
index 814b2d0052..bccab4613a 100644
--- a/doc/classes/AnimationNodeStateMachineTransition.xml
+++ b/doc/classes/AnimationNodeStateMachineTransition.xml
@@ -15,7 +15,7 @@
$animation_tree.set("parameters/conditions/idle", is_on_floor and (linear_velocity.x == 0))
[/gdscript]
[csharp]
- GetNode&lt;AnimationTree&gt;("animation_tree").Set("parameters/conditions/idle", IsOnFloor &amp;&amp; (LinearVelocity.x == 0));
+ GetNode&lt;AnimationTree&gt;("animation_tree").Set("parameters/conditions/idle", IsOnFloor &amp;&amp; (LinearVelocity.X == 0));
[/csharp]
[/codeblocks]
</member>
@@ -28,6 +28,9 @@
<member name="priority" type="int" setter="set_priority" getter="get_priority" default="1">
Lower priority transitions are preferred when travelling through the tree via [method AnimationNodeStateMachinePlayback.travel] or [member advance_mode] is set to [constant ADVANCE_MODE_AUTO].
</member>
+ <member name="reset" type="bool" setter="set_reset" getter="is_reset" default="true">
+ If [code]true[/code], the destination animation is played back from the beginning when switched.
+ </member>
<member name="switch_mode" type="int" setter="set_switch_mode" getter="get_switch_mode" enum="AnimationNodeStateMachineTransition.SwitchMode" default="0">
The transition type.
</member>
diff --git a/doc/classes/AnimationNodeTransition.xml b/doc/classes/AnimationNodeTransition.xml
index f6e2fc5eb2..a067b0a9ba 100644
--- a/doc/classes/AnimationNodeTransition.xml
+++ b/doc/classes/AnimationNodeTransition.xml
@@ -12,16 +12,18 @@
<link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link>
</tutorials>
<methods>
- <method name="get_input_caption" qualifiers="const">
- <return type="String" />
+ <method name="is_input_reset" qualifiers="const">
+ <return type="bool" />
<param index="0" name="input" type="int" />
<description>
+ Returns whether the animation restarts when the animation transitions from the other animation.
</description>
</method>
<method name="is_input_set_as_auto_advance" qualifiers="const">
<return type="bool" />
<param index="0" name="input" type="int" />
<description>
+ Returns [code]true[/code] if auto-advance is enabled for the given [param input] index.
</description>
</method>
<method name="set_input_as_auto_advance">
@@ -29,24 +31,24 @@
<param index="0" name="input" type="int" />
<param index="1" name="enable" type="bool" />
<description>
+ Enables or disables auto-advance for the given [param input] index. If enabled, state changes to the next input after playing the animation once. If enabled for the last input state, it loops to the first.
</description>
</method>
- <method name="set_input_caption">
+ <method name="set_input_reset">
<return type="void" />
<param index="0" name="input" type="int" />
- <param index="1" name="caption" type="String" />
+ <param index="1" name="enable" type="bool" />
<description>
+ If [code]true[/code], the destination animation is restarted when the animation transitions.
</description>
</method>
</methods>
<members>
- <member name="enabled_inputs" type="int" setter="set_enabled_inputs" getter="get_enabled_inputs" default="0">
+ <member name="input_count" type="int" setter="set_input_count" getter="get_input_count" default="0">
The number of enabled input ports for this node.
</member>
- <member name="from_start" type="bool" setter="set_from_start" getter="is_from_start" default="true">
- If [code]true[/code], the destination animation is played back from the beginning when switched.
- </member>
<member name="xfade_curve" type="Curve" setter="set_xfade_curve" getter="get_xfade_curve">
+ Determines how cross-fading between animations is eased. If empty, the transition will be linear.
</member>
<member name="xfade_time" type="float" setter="set_xfade_time" getter="get_xfade_time" default="0.0">
Cross-fading time (in seconds) between each animation connected to the inputs.
diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml
index 304caeef43..25e4a4549d 100644
--- a/doc/classes/AnimationPlayer.xml
+++ b/doc/classes/AnimationPlayer.xml
@@ -15,6 +15,17 @@
<link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link>
</tutorials>
<methods>
+ <method name="_post_process_key_value" qualifiers="virtual const">
+ <return type="Variant" />
+ <param index="0" name="animation" type="Animation" />
+ <param index="1" name="track" type="int" />
+ <param index="2" name="value" type="Variant" />
+ <param index="3" name="object" type="Object" />
+ <param index="4" name="object_idx" type="int" />
+ <description>
+ A virtual function for processing after key getting during playback.
+ </description>
+ </method>
<method name="add_animation_library">
<return type="int" enum="Error" />
<param index="0" name="name" type="StringName" />
@@ -102,13 +113,14 @@
<param index="0" name="anim_from" type="StringName" />
<param index="1" name="anim_to" type="StringName" />
<description>
- Gets the blend time (in seconds) between two animations, referenced by their keys.
+ Returns the blend time (in seconds) between two animations, referenced by their keys.
</description>
</method>
<method name="get_playing_speed" qualifiers="const">
<return type="float" />
<description>
- Gets the actual playing speed of current animation or 0 if not playing. This speed is the [member playback_speed] property multiplied by [code]custom_speed[/code] argument specified when calling the [method play] method.
+ Returns the actual playing speed of current animation or [code]0[/code] if not playing. This speed is the [member speed_scale] property multiplied by [code]custom_speed[/code] argument specified when calling the [method play] method.
+ Returns a negative value if the current animation is playing backwards.
</description>
</method>
<method name="get_queue">
@@ -134,7 +146,7 @@
<method name="is_playing" qualifiers="const">
<return type="bool" />
<description>
- Returns [code]true[/code] if playing an animation.
+ Returns [code]true[/code] if an animation is currently playing (even if [member speed_scale] and/or [code]custom_speed[/code] are [code]0[/code]).
</description>
</method>
<method name="pause">
@@ -152,7 +164,7 @@
<param index="3" name="from_end" type="bool" default="false" />
<description>
Plays the animation with key [param name]. Custom blend times and speed can be set. If [param custom_speed] is negative and [param from_end] is [code]true[/code], the animation will play backwards (which is equivalent to calling [method play_backwards]).
- The [AnimationPlayer] keeps track of its current or last played animation with [member assigned_animation]. If this method is called with that same animation [param name], or with no [param name] parameter, the assigned animation will resume playing if it was paused, or restart if it was stopped (see [method stop] for both pause and stop). If the animation was already playing, it will keep playing.
+ The [AnimationPlayer] keeps track of its current or last played animation with [member assigned_animation]. If this method is called with that same animation [param name], or with no [param name] parameter, the assigned animation will resume playing if it was paused.
[b]Note:[/b] The animation will be updated the next time the [AnimationPlayer] is processed. If other variables are updated at the same time this is called, they may be updated too early. To perform the update immediately, call [code]advance(0)[/code].
</description>
</method>
@@ -210,7 +222,7 @@
<return type="void" />
<param index="0" name="keep_state" type="bool" default="false" />
<description>
- Stops the currently playing animation. The animation position is reset to [code]0[/code] and the playback speed is reset to [code]1.0[/code]. See also [method pause].
+ Stops the currently playing animation. The animation position is reset to [code]0[/code] and the [code]custom_speed[/code] is reset to [code]1.0[/code]. See also [method pause].
If [param keep_state] is [code]true[/code], the animation state is not updated visually.
[b]Note:[/b] The method / audio / animation playback tracks will not be processed by this method.
</description>
@@ -220,6 +232,10 @@
<member name="assigned_animation" type="String" setter="set_assigned_animation" getter="get_assigned_animation">
If playing, the the current animation's key, otherwise, the animation last played. When set, this changes the animation, but will not play it unless already playing. See also [member current_animation].
</member>
+ <member name="audio_max_polyphony" type="int" setter="set_audio_max_polyphony" getter="get_audio_max_polyphony" default="32">
+ The number of possible simultaneous sounds for each of the assigned AudioStreamPlayers.
+ For example, if this value is [code]32[/code] and the animation has two audio tracks, the two [AudioStreamPlayer]s assigned can play simultaneously up to [code]32[/code] voices each.
+ </member>
<member name="autoplay" type="String" setter="set_autoplay" getter="get_autoplay" default="&quot;&quot;">
The key of the animation to play when the scene loads.
</member>
@@ -249,9 +265,6 @@
<member name="playback_process_mode" type="int" setter="set_process_callback" getter="get_process_callback" enum="AnimationPlayer.AnimationProcessCallback" default="1">
The process notification in which to update animations.
</member>
- <member name="playback_speed" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0">
- The speed scaling ratio. For example, if this value is 1, then the animation plays at normal speed. If it's 0.5, then it plays at half speed. If it's 2, then it plays at double speed.
- </member>
<member name="reset_on_save" type="bool" setter="set_reset_on_save_enabled" getter="is_reset_on_save_enabled" default="true">
This is used by the editor. If set to [code]true[/code], the scene will be saved with the effects of the reset animation (the animation with the key [code]"RESET"[/code]) applied as if it had been seeked to time 0, with the editor keeping the values that the scene had before saving.
This makes it more convenient to preview and edit animations in the editor, as changes to the scene will not be saved as long as they are set in the reset animation.
@@ -259,6 +272,10 @@
<member name="root_node" type="NodePath" setter="set_root" getter="get_root" default="NodePath(&quot;..&quot;)">
The node from which node path references will travel.
</member>
+ <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0">
+ The speed scaling ratio. For example, if this value is [code]1[/code], then the animation plays at normal speed. If it's [code]0.5[/code], then it plays at half speed. If it's [code]2[/code], then it plays at double speed.
+ If set to a negative value, the animation is played in reverse. If set to [code]0[/code], the animation will not advance.
+ </member>
</members>
<signals>
<signal name="animation_changed">
diff --git a/doc/classes/AnimationTree.xml b/doc/classes/AnimationTree.xml
index a17a727d7e..86562c340d 100644
--- a/doc/classes/AnimationTree.xml
+++ b/doc/classes/AnimationTree.xml
@@ -12,6 +12,17 @@
<link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link>
</tutorials>
<methods>
+ <method name="_post_process_key_value" qualifiers="virtual const">
+ <return type="Variant" />
+ <param index="0" name="animation" type="Animation" />
+ <param index="1" name="track" type="int" />
+ <param index="2" name="value" type="Variant" />
+ <param index="3" name="object" type="Object" />
+ <param index="4" name="object_idx" type="int" />
+ <description>
+ A virtual function for processing after key getting during playback.
+ </description>
+ </method>
<method name="advance">
<return type="void" />
<param index="0" name="delta" type="float" />
@@ -99,12 +110,16 @@
<member name="anim_player" type="NodePath" setter="set_animation_player" getter="get_animation_player" default="NodePath(&quot;&quot;)">
The path to the [AnimationPlayer] used for animating.
</member>
+ <member name="audio_max_polyphony" type="int" setter="set_audio_max_polyphony" getter="get_audio_max_polyphony" default="32">
+ The number of possible simultaneous sounds for each of the assigned AudioStreamPlayers.
+ For example, if this value is [code]32[/code] and the animation has two audio tracks, the two [AudioStreamPlayer]s assigned can play simultaneously up to [code]32[/code] voices each.
+ </member>
<member name="process_callback" type="int" setter="set_process_callback" getter="get_process_callback" enum="AnimationTree.AnimationProcessCallback" default="1">
The process mode of this [AnimationTree]. See [enum AnimationProcessCallback] for available modes.
</member>
<member name="root_motion_track" type="NodePath" setter="set_root_motion_track" getter="get_root_motion_track" default="NodePath(&quot;&quot;)">
The path to the Animation track used for root motion. Paths must be valid scene-tree paths to a node, and must be specified starting from the parent node of the node that will reproduce the animation. To specify a track that controls properties or bones, append its name after the path, separated by [code]":"[/code]. For example, [code]"character/skeleton:ankle"[/code] or [code]"character/mesh:transform/local"[/code].
- If the track has type [constant Animation.TYPE_POSITION_3D], [constant Animation.TYPE_ROTATION_3D] or [constant Animation.TYPE_SCALE_3D] the transformation will be cancelled visually, and the animation will appear to stay in place. See also [method get_root_motion_position], [method get_root_motion_rotation], [method get_root_motion_scale] and [RootMotionView].
+ If the track has type [constant Animation.TYPE_POSITION_3D], [constant Animation.TYPE_ROTATION_3D] or [constant Animation.TYPE_SCALE_3D] the transformation will be canceled visually, and the animation will appear to stay in place. See also [method get_root_motion_position], [method get_root_motion_rotation], [method get_root_motion_scale] and [RootMotionView].
</member>
<member name="tree_root" type="AnimationNode" setter="set_tree_root" getter="get_tree_root">
The root animation node of this [AnimationTree]. See [AnimationNode].
diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml
index 3f76cc16ec..8a98921a60 100644
--- a/doc/classes/Area2D.xml
+++ b/doc/classes/Area2D.xml
@@ -87,8 +87,9 @@
<member name="gravity_point_center" type="Vector2" setter="set_gravity_point_center" getter="get_gravity_point_center" default="Vector2(0, 1)">
If gravity is a point (see [member gravity_point]), this will be the point of attraction.
</member>
- <member name="gravity_point_distance_scale" type="float" setter="set_gravity_point_distance_scale" getter="get_gravity_point_distance_scale" default="0.0">
- The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance.
+ <member name="gravity_point_unit_distance" type="float" setter="set_gravity_point_unit_distance" getter="get_gravity_point_unit_distance" default="0.0">
+ The distance at which the gravity strength is equal to [member gravity]. For example, on a planet 100 pixels in radius with a surface gravity of 4.0 px/s², set the [member gravity] to 4.0 and the unit distance to 100.0. The gravity will have falloff according to the inverse square law, so in the example, at 200 pixels from the center the gravity will be 1.0 px/s² (twice the distance, 1/4th the gravity), at 50 pixels it will be 16.0 px/s² (half the distance, 4x the gravity), and so on.
+ The above is true only when the unit distance is a positive number. When this is set to 0.0, the gravity will be constant regardless of distance.
</member>
<member name="gravity_space_override" type="int" setter="set_gravity_space_override_mode" getter="get_gravity_space_override_mode" enum="Area2D.SpaceOverride" default="0">
Override mode for gravity calculations within this area. See [enum SpaceOverride] for possible values.
diff --git a/doc/classes/Area3D.xml b/doc/classes/Area3D.xml
index 8923ac8aae..bd046b7cb8 100644
--- a/doc/classes/Area3D.xml
+++ b/doc/classes/Area3D.xml
@@ -7,6 +7,7 @@
3D area that detects [CollisionObject3D] nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping) and route audio to custom audio buses.
To give the area its shape, add a [CollisionShape3D] or a [CollisionPolygon3D] node as a [i]direct[/i] child (or add multiple such nodes as direct children) of the area.
[b]Warning:[/b] See [ConcavePolygonShape3D] (also called "trimesh") for a warning about possibly unexpected behavior when using that shape for an area.
+ [b]Warning:[/b] With a non-uniform scale this node will probably not function as expected. Please make sure to keep its scale uniform (i.e. the same on all axes), and change the size(s) of its collision shape(s) instead.
</description>
<tutorials>
<link title="3D Platformer Demo">https://godotengine.org/asset-library/asset/125</link>
@@ -85,8 +86,9 @@
<member name="gravity_point_center" type="Vector3" setter="set_gravity_point_center" getter="get_gravity_point_center" default="Vector3(0, -1, 0)">
If gravity is a point (see [member gravity_point]), this will be the point of attraction.
</member>
- <member name="gravity_point_distance_scale" type="float" setter="set_gravity_point_distance_scale" getter="get_gravity_point_distance_scale" default="0.0">
- The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance.
+ <member name="gravity_point_unit_distance" type="float" setter="set_gravity_point_unit_distance" getter="get_gravity_point_unit_distance" default="0.0">
+ The distance at which the gravity strength is equal to [member gravity]. For example, on a planet 100 meters in radius with a surface gravity of 4.0 m/s², set the [member gravity] to 4.0 and the unit distance to 100.0. The gravity will have falloff according to the inverse square law, so in the example, at 200 meters from the center the gravity will be 1.0 m/s² (twice the distance, 1/4th the gravity), at 50 meters it will be 16.0 m/s² (half the distance, 4x the gravity), and so on.
+ The above is true only when the unit distance is a positive number. When this is set to 0.0, the gravity will be constant regardless of distance.
</member>
<member name="gravity_space_override" type="int" setter="set_gravity_space_override_mode" getter="get_gravity_space_override_mode" enum="Area3D.SpaceOverride" default="0">
Override mode for gravity calculations within this area. See [enum SpaceOverride] for possible values.
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml
index 21ccf79fe2..213a2254af 100644
--- a/doc/classes/Array.xml
+++ b/doc/classes/Array.xml
@@ -59,14 +59,14 @@
<param index="2" name="class_name" type="StringName" />
<param index="3" name="script" type="Variant" />
<description>
- Creates a typed array from the [param base] array. The base array can't be already typed. See [method set_typed] for more details.
+ Creates a typed array from the [param base] array.
</description>
</constructor>
<constructor name="Array">
<return type="Array" />
<param index="0" name="from" type="Array" />
<description>
- Constructs an [Array] as a copy of the given [Array].
+ Returns the same array as [param from]. If you need a copy of the array, use [method duplicate].
</description>
</constructor>
<constructor name="Array">
@@ -200,6 +200,13 @@
[/codeblock]
</description>
</method>
+ <method name="assign">
+ <return type="void" />
+ <param index="0" name="array" type="Array" />
+ <description>
+ Assigns elements of another [param array] into the array. Resizes the array to match [param array]. Performs type conversions if the array is typed.
+ </description>
+ </method>
<method name="back" qualifiers="const">
<return type="Variant" />
<description>
@@ -392,7 +399,14 @@
<method name="is_read_only" qualifiers="const">
<return type="bool" />
<description>
- Returns [code]true[/code] if the array is read-only. See [method set_read_only]. Arrays are automatically read-only if declared with [code]const[/code] keyword.
+ Returns [code]true[/code] if the array is read-only. See [method make_read_only]. Arrays are automatically read-only if declared with [code]const[/code] keyword.
+ </description>
+ </method>
+ <method name="is_same_typed" qualifiers="const">
+ <return type="bool" />
+ <param index="0" name="array" type="Array" />
+ <description>
+ Returns [code]true[/code] if the array is typed the same as [param array].
</description>
</method>
<method name="is_typed" qualifiers="const">
@@ -401,6 +415,12 @@
Returns [code]true[/code] if the array is typed. Typed arrays can only store elements of their associated type and provide type safety for the [code][][/code] operator. Methods of typed array still return [Variant].
</description>
</method>
+ <method name="make_read_only">
+ <return type="void" />
+ <description>
+ Makes the array read-only, i.e. disabled modifying of the array's elements. Does not apply to nested content, e.g. content of nested arrays.
+ </description>
+ </method>
<method name="map" qualifiers="const">
<return type="Array" />
<param index="0" name="method" type="Callable" />
@@ -524,23 +544,6 @@
Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array.
</description>
</method>
- <method name="set_read_only">
- <return type="void" />
- <param index="0" name="enable" type="bool" />
- <description>
- Makes the [Array] read-only, i.e. disabled modifying of the array's elements. Does not apply to nested content, e.g. content of nested arrays.
- </description>
- </method>
- <method name="set_typed">
- <return type="void" />
- <param index="0" name="type" type="int" />
- <param index="1" name="class_name" type="StringName" />
- <param index="2" name="script" type="Variant" />
- <description>
- Makes the [Array] typed. The [param type] should be one of the [enum Variant.Type] constants. [param class_name] is optional and can only be provided for [constant TYPE_OBJECT]. [param script] can only be provided if [param class_name] is not empty.
- The method fails if an array is already typed.
- </description>
- </method>
<method name="shuffle">
<return type="void" />
<description>
@@ -620,13 +623,6 @@
[/codeblocks]
</description>
</method>
- <method name="typed_assign">
- <return type="bool" />
- <param index="0" name="array" type="Array" />
- <description>
- Assigns a different [Array] to this array reference. It the array is typed, the new array's type must be compatible and its elements will be automatically converted.
- </description>
- </method>
</methods>
<operators>
<operator name="operator !=">
@@ -679,7 +675,7 @@
</description>
</operator>
<operator name="operator []">
- <return type="void" />
+ <return type="Variant" />
<param index="0" name="index" type="int" />
<description>
Returns a reference to the element of type [Variant] at the specified location. Arrays start at index 0. [param index] can be a zero or positive value to start from the beginning, or a negative value to start from the end. Out-of-bounds array access causes a run-time error, which will result in an error being printed and the project execution pausing if run from the editor.
diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml
index f7764d5e32..6dc66194b8 100644
--- a/doc/classes/ArrayMesh.xml
+++ b/doc/classes/ArrayMesh.xml
@@ -65,11 +65,15 @@
<param index="1" name="arrays" type="Array" />
<param index="2" name="blend_shapes" type="Array[]" default="[]" />
<param index="3" name="lods" type="Dictionary" default="{}" />
- <param index="4" name="compress_flags" type="int" enum="Mesh.ArrayFormat" default="0" />
+ <param index="4" name="flags" type="int" enum="Mesh.ArrayFormat" default="0" />
<description>
- Creates a new surface.
- Surfaces are created to be rendered using a [param primitive], which may be any of the types defined in [enum Mesh.PrimitiveType]. (As a note, when using indices, it is recommended to only use points, lines, or triangles.) [method Mesh.get_surface_count] will become the [code]surf_idx[/code] for this new surface.
- The [param arrays] argument is an array of arrays. See [enum Mesh.ArrayType] for the values used in this array. For example, [code]arrays[0][/code] is the array of vertices. That first vertex sub-array is always required; the others are optional. Adding an index array puts this function into "index mode" where the vertex and other arrays become the sources of data and the index array defines the vertex order. All sub-arrays must have the same length as the vertex array (or be an exact multiple of the vertex array's length, when multiple elements of a sub-array correspond to a single vertex) or be empty, except for [constant Mesh.ARRAY_INDEX] if it is used.
+ Creates a new surface. [method Mesh.get_surface_count] will become the [code]surf_idx[/code] for this new surface.
+ Surfaces are created to be rendered using a [param primitive], which may be any of the values defined in [enum Mesh.PrimitiveType].
+ The [param arrays] argument is an array of arrays. Each of the [constant Mesh.ARRAY_MAX] elements contains an array with some of the mesh data for this surface as described by the corresponding member of [enum Mesh.ArrayType] or [code]null[/code] if it is not used by the surface. For example, [code]arrays[0][/code] is the array of vertices. That first vertex sub-array is always required; the others are optional. Adding an index array puts this surface into "index mode" where the vertex and other arrays become the sources of data and the index array defines the vertex order. All sub-arrays must have the same length as the vertex array (or be an exact multiple of the vertex array's length, when multiple elements of a sub-array correspond to a single vertex) or be empty, except for [constant Mesh.ARRAY_INDEX] if it is used.
+ The [param blend_shapes] argument is an array of vertex data for each blend shape. Each element is an array of the same structure as [param arrays], but [constant Mesh.ARRAY_VERTEX], [constant Mesh.ARRAY_NORMAL], and [constant Mesh.ARRAY_TANGENT] are set if and only if they are set in [param arrays] and all other entries are [code]null[/code].
+ The [param lods] argument is a dictionary with [float] keys and [PackedInt32Array] values. Each entry in the dictionary represents a LOD level of the surface, where the value is the [constant Mesh.ARRAY_INDEX] array to use for the LOD level and the key is roughly proportional to the distance at which the LOD stats being used. I.e., increasing the key of a LOD also increases the distance that the objects has to be from the camera before the LOD is used.
+ The [param flags] argument is the bitwise or of, as required: One value of [enum Mesh.ArrayCustomFormat] left shifted by [code]ARRAY_FORMAT_CUSTOMn_SHIFT[/code] for each custom channel in use, [constant Mesh.ARRAY_FLAG_USE_DYNAMIC_UPDATE], [constant Mesh.ARRAY_FLAG_USE_8_BONE_WEIGHTS], or [constant Mesh.ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY].
+ [b]Note:[/b] When using indices, it is recommended to only use points, lines, or triangles.
</description>
</method>
<method name="clear_blend_shapes">
@@ -202,6 +206,7 @@
Overrides the [AABB] with one defined by user for use with frustum culling. Especially useful to avoid unexpected culling when using a shader to offset vertices.
</member>
<member name="shadow_mesh" type="ArrayMesh" setter="set_shadow_mesh" getter="get_shadow_mesh">
+ An optional mesh which is used for rendering shadows and can be used for the depth prepass. Can be used to increase performance of shadow rendering by using a mesh that only contains vertex position data (without normals, UVs, colors, etc.).
</member>
</members>
</class>
diff --git a/doc/classes/AudioStreamPlaybackPolyphonic.xml b/doc/classes/AudioStreamPlaybackPolyphonic.xml
new file mode 100644
index 0000000000..8b0951153b
--- /dev/null
+++ b/doc/classes/AudioStreamPlaybackPolyphonic.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="AudioStreamPlaybackPolyphonic" inherits="AudioStreamPlayback" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
+ <brief_description>
+ Playback instance for [AudioStreamPolyphonic].
+ </brief_description>
+ <description>
+ Playback instance for [AudioStreamPolyphonic]. After setting the [code]stream[/code] property of [AudioStreamPlayer], [AudioStreamPlayer2D], or [AudioStreamPlayer3D], the playback instance can be obtained by calling [method AudioStreamPlayer.get_stream_playback], [method AudioStreamPlayer2D.get_stream_playback] or [method AudioStreamPlayer3D.get_stream_playback] methods.
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ <method name="is_stream_playing" qualifiers="const">
+ <return type="bool" />
+ <param index="0" name="stream" type="int" />
+ <description>
+ Return true whether the stream associated with an integer ID is still playing. Check [method play_stream] for information on when this ID becomes invalid.
+ </description>
+ </method>
+ <method name="play_stream">
+ <return type="int" />
+ <param index="0" name="stream" type="AudioStream" />
+ <param index="1" name="from_offset" type="float" default="0" />
+ <param index="2" name="volume_db" type="float" default="0" />
+ <param index="3" name="pitch_scale" type="float" default="1.0" />
+ <description>
+ Play an [AudioStream] at a given offset, volume and pitch scale. Playback starts immediately.
+ The return value is an unique integer ID that is associated to this playback stream and which can be used to control it.
+ This ID becomes invalid when the stream ends (if it does not loop), when the [AudioStreamPlaybackPolyphonic] is stopped, or when [method stop_stream] is called.
+ This function returns [constant INVALID_ID] if the amount of streams currently playing equals [member AudioStreamPolyphonic.polyphony]. If you need a higher amount of maximum polyphony, raise this value.
+ </description>
+ </method>
+ <method name="set_stream_pitch_scale">
+ <return type="void" />
+ <param index="0" name="stream" type="int" />
+ <param index="1" name="pitch_scale" type="float" />
+ <description>
+ Change the stream pitch scale. The [param stream] argument is an integer ID returned by [method play_stream].
+ </description>
+ </method>
+ <method name="set_stream_volume">
+ <return type="void" />
+ <param index="0" name="stream" type="int" />
+ <param index="1" name="volume_db" type="float" />
+ <description>
+ Change the stream volume (in db). The [param stream] argument is an integer ID returned by [method play_stream].
+ </description>
+ </method>
+ <method name="stop_stream">
+ <return type="void" />
+ <param index="0" name="stream" type="int" />
+ <description>
+ Stop a stream. The [param stream] argument is an integer ID returned by [method play_stream], which becomes invalid after calling this function.
+ </description>
+ </method>
+ </methods>
+ <constants>
+ <constant name="INVALID_ID" value="-1">
+ Returned by [method play_stream] in case it could not allocate a stream for playback.
+ </constant>
+ </constants>
+</class>
diff --git a/doc/classes/AudioStreamPlayer.xml b/doc/classes/AudioStreamPlayer.xml
index 06e183f4e2..9b3a4f7bba 100644
--- a/doc/classes/AudioStreamPlayer.xml
+++ b/doc/classes/AudioStreamPlayer.xml
@@ -28,6 +28,12 @@
Returns the [AudioStreamPlayback] object associated with this [AudioStreamPlayer].
</description>
</method>
+ <method name="has_stream_playback">
+ <return type="bool" />
+ <description>
+ Returns whether the [AudioStreamPlayer] can return the [AudioStreamPlayback] object or not.
+ </description>
+ </method>
<method name="play">
<return type="void" />
<param index="0" name="from_position" type="float" default="0.0" />
diff --git a/doc/classes/AudioStreamPlayer2D.xml b/doc/classes/AudioStreamPlayer2D.xml
index 81755b580f..18869e87cb 100644
--- a/doc/classes/AudioStreamPlayer2D.xml
+++ b/doc/classes/AudioStreamPlayer2D.xml
@@ -25,6 +25,12 @@
Returns the [AudioStreamPlayback] object associated with this [AudioStreamPlayer2D].
</description>
</method>
+ <method name="has_stream_playback">
+ <return type="bool" />
+ <description>
+ Returns whether the [AudioStreamPlayer] can return the [AudioStreamPlayback] object or not.
+ </description>
+ </method>
<method name="play">
<return type="void" />
<param index="0" name="from_position" type="float" default="0.0" />
diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml
index f711210ca1..d5a06dcad6 100644
--- a/doc/classes/AudioStreamPlayer3D.xml
+++ b/doc/classes/AudioStreamPlayer3D.xml
@@ -25,6 +25,12 @@
Returns the [AudioStreamPlayback] object associated with this [AudioStreamPlayer3D].
</description>
</method>
+ <method name="has_stream_playback">
+ <return type="bool" />
+ <description>
+ Returns whether the [AudioStreamPlayer] can return the [AudioStreamPlayback] object or not.
+ </description>
+ </method>
<method name="play">
<return type="void" />
<param index="0" name="from_position" type="float" default="0.0" />
diff --git a/doc/classes/AudioStreamPolyphonic.xml b/doc/classes/AudioStreamPolyphonic.xml
new file mode 100644
index 0000000000..baa1fc7037
--- /dev/null
+++ b/doc/classes/AudioStreamPolyphonic.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="AudioStreamPolyphonic" inherits="AudioStream" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
+ <brief_description>
+ AudioStream that lets the user play custom streams at any time from code, simultaneously using a single player.
+ </brief_description>
+ <description>
+ AudioStream that lets the user play custom streams at any time from code, simultaneously using a single player.
+ Playback control is done via the [AudioStreamPlaybackPolyphonic] instance set inside the player, which can be obtained via [method AudioStreamPlayer.get_stream_playback], [method AudioStreamPlayer2D.get_stream_playback] or [method AudioStreamPlayer3D.get_stream_playback] methods. Obtaining the playback instance is only valid after the [code]stream[/code] property is set as an [AudioStreamPolyphonic] in those players.
+ </description>
+ <tutorials>
+ </tutorials>
+ <members>
+ <member name="polyphony" type="int" setter="set_polyphony" getter="get_polyphony" default="32">
+ Maximum amount of simultaneous streams that can be played.
+ </member>
+ </members>
+</class>
diff --git a/doc/classes/Callable.xml b/doc/classes/Callable.xml
index 79e65f3472..8fc44d7536 100644
--- a/doc/classes/Callable.xml
+++ b/doc/classes/Callable.xml
@@ -18,17 +18,19 @@
callable.call("invalid") # Invalid call, should have at least 2 arguments.
[/gdscript]
[csharp]
- public void PrintArgs(object arg1, object arg2, object arg3 = null)
+ // Default parameter values are not supported.
+ public void PrintArgs(Variant arg1, Variant arg2, Variant arg3 = default)
{
GD.PrintS(arg1, arg2, arg3);
}
public void Test()
{
- Callable callable = new Callable(this, nameof(PrintArgs));
- callable.Call("hello", "world"); // Prints "hello world null".
+ // Invalid calls fail silently.
+ Callable callable = new Callable(this, MethodName.PrintArgs);
+ callable.Call("hello", "world"); // Default parameter values are not supported, should have 3 arguments.
callable.Call(Vector2.Up, 42, callable); // Prints "(0, -1) 42 Node(Node.cs)::PrintArgs".
- callable.Call("invalid"); // Invalid call, should have at least 2 arguments.
+ callable.Call("invalid"); // Invalid call, should have 3 arguments.
}
[/csharp]
[/codeblocks]
diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml
index 5279574d5a..c3c768c12d 100644
--- a/doc/classes/CanvasItem.xml
+++ b/doc/classes/CanvasItem.xml
@@ -42,10 +42,11 @@
<param index="3" name="end_angle" type="float" />
<param index="4" name="point_count" type="int" />
<param index="5" name="color" type="Color" />
- <param index="6" name="width" type="float" default="1.0" />
+ <param index="6" name="width" type="float" default="-1.0" />
<param index="7" name="antialiased" type="bool" default="false" />
<description>
- Draws an unfilled arc between the given angles. The larger the value of [param point_count], the smoother the curve. See also [method draw_circle].
+ Draws an unfilled arc between the given angles with a uniform [param color] and [param width] and optional antialiasing (supported only for positive [param width]). The larger the value of [param point_count], the smoother the curve. See also [method draw_circle].
+ If [param width] is negative, then the arc is drawn using [constant RenderingServer.PRIMITIVE_LINE_STRIP]. This means that when the CanvasItem is scaled, the arc will remain thin. If this behavior is not desired, then pass a positive [param width] like [code]1.0[/code].
The arc is drawn from [param start_angle] towards the value of [param end_angle] so in clockwise direction if [code]start_angle &lt; end_angle[/code] and counter-clockwise otherwise. Passing the same angles but in reversed order will produce the same arc. If absolute difference of [param start_angle] and [param end_angle] is greater than [constant @GDScript.TAU] radians, then a full circle arc is drawn (i.e. arc will not overlap itself).
</description>
</method>
@@ -243,20 +244,22 @@
<return type="void" />
<param index="0" name="points" type="PackedVector2Array" />
<param index="1" name="color" type="Color" />
- <param index="2" name="width" type="float" default="1.0" />
+ <param index="2" name="width" type="float" default="-1.0" />
<param index="3" name="antialiased" type="bool" default="false" />
<description>
- Draws interconnected line segments with a uniform [param color] and [param width] and optional antialiasing. When drawing large amounts of lines, this is faster than using individual [method draw_line] calls. To draw disconnected lines, use [method draw_multiline] instead. See also [method draw_polygon].
+ Draws interconnected line segments with a uniform [param color] and [param width] and optional antialiasing (supported only for positive [param width]). When drawing large amounts of lines, this is faster than using individual [method draw_line] calls. To draw disconnected lines, use [method draw_multiline] instead. See also [method draw_polygon].
+ If [param width] is negative, the polyline is drawn using [constant RenderingServer.PRIMITIVE_LINE_STRIP]. This means that when the CanvasItem is scaled, the polyline will remain thin. If this behavior is not desired, then pass a positive [param width] like [code]1.0[/code].
</description>
</method>
<method name="draw_polyline_colors">
<return type="void" />
<param index="0" name="points" type="PackedVector2Array" />
<param index="1" name="colors" type="PackedColorArray" />
- <param index="2" name="width" type="float" default="1.0" />
+ <param index="2" name="width" type="float" default="-1.0" />
<param index="3" name="antialiased" type="bool" default="false" />
<description>
- Draws interconnected line segments with a uniform [param width] and segment-by-segment coloring, and optional antialiasing. Colors assigned to line segments match by index between [param points] and [param colors]. When drawing large amounts of lines, this is faster than using individual [method draw_line] calls. To draw disconnected lines, use [method draw_multiline_colors] instead. See also [method draw_polygon].
+ Draws interconnected line segments with a uniform [param width] and segment-by-segment coloring, and optional antialiasing (supported only for positive [param width]). Colors assigned to line segments match by index between [param points] and [param colors]. When drawing large amounts of lines, this is faster than using individual [method draw_line] calls. To draw disconnected lines, use [method draw_multiline_colors] instead. See also [method draw_polygon].
+ If [param width] is negative, then the polyline is drawn using [constant RenderingServer.PRIMITIVE_LINE_STRIP]. This means that when the CanvasItem is scaled, the polyline will remain thin. If this behavior is not desired, then pass a positive [param width] like [code]1.0[/code].
</description>
</method>
<method name="draw_primitive">
diff --git a/doc/classes/CharacterBody3D.xml b/doc/classes/CharacterBody3D.xml
index 821117122c..2ff207acb7 100644
--- a/doc/classes/CharacterBody3D.xml
+++ b/doc/classes/CharacterBody3D.xml
@@ -5,8 +5,9 @@
</brief_description>
<description>
Character bodies are special types of bodies that are meant to be user-controlled. They are not affected by physics at all; to other types of bodies, such as a rigid body, these are the same as a [AnimatableBody3D]. However, they have two main uses:
- [b]Kinematic characters:[/b] Character bodies have an API for moving objects with walls and slopes detection ([method move_and_slide] method), in addition to collision detection (also done with [method PhysicsBody3D.move_and_collide]). This makes them really useful to implement characters that move in specific ways and collide with the world, but don't require advanced physics.
- [b]Kinematic motion:[/b] Character bodies can also be used for kinematic motion (same functionality as [AnimatableBody3D]), which allows them to be moved by code and push other bodies on their path.
+ [i]Kinematic characters:[/i] Character bodies have an API for moving objects with walls and slopes detection ([method move_and_slide] method), in addition to collision detection (also done with [method PhysicsBody3D.move_and_collide]). This makes them really useful to implement characters that move in specific ways and collide with the world, but don't require advanced physics.
+ [i]Kinematic motion:[/i] Character bodies can also be used for kinematic motion (same functionality as [AnimatableBody3D]), which allows them to be moved by code and push other bodies on their path.
+ [b]Warning:[/b] With a non-uniform scale this node will probably not function as expected. Please make sure to keep its scale uniform (i.e. the same on all axes), and change the size(s) of its collision shape(s) instead.
</description>
<tutorials>
<link title="Kinematic character (2D)">$DOCS_URL/tutorials/physics/kinematic_character_2d.html</link>
diff --git a/doc/classes/CollisionObject3D.xml b/doc/classes/CollisionObject3D.xml
index 31b5842930..01b0d88326 100644
--- a/doc/classes/CollisionObject3D.xml
+++ b/doc/classes/CollisionObject3D.xml
@@ -5,6 +5,7 @@
</brief_description>
<description>
CollisionObject3D is the base class for physics objects. It can hold any number of collision [Shape3D]s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject3D can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the [code]shape_owner_*[/code] methods.
+ [b]Warning:[/b] With a non-uniform scale this node will probably not function as expected. Please make sure to keep its scale uniform (i.e. the same on all axes), and change the size(s) of its collision shape(s) instead.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/CollisionPolygon3D.xml b/doc/classes/CollisionPolygon3D.xml
index 7d718cff27..29e55367a8 100644
--- a/doc/classes/CollisionPolygon3D.xml
+++ b/doc/classes/CollisionPolygon3D.xml
@@ -6,6 +6,7 @@
<description>
Allows editing a concave or convex collision polygon's vertices on a selected plane. Can also set a depth perpendicular to that plane. This class is only available in the editor. It will not appear in the scene tree at run-time. Creates several [ConvexPolygonShape3D]s at run-time to represent the original polygon using convex decomposition.
[b]Note:[/b] Since this is an editor-only helper, properties modified during gameplay will have no effect.
+ [b]Warning:[/b] A non-uniformly scaled CollisionPolygon3D node will probably not function as expected. Please make sure to keep its scale uniform (i.e. the same on all axes), and change its [member polygon]'s vertices instead.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/CollisionShape3D.xml b/doc/classes/CollisionShape3D.xml
index 304b46ba27..c5d05670e9 100644
--- a/doc/classes/CollisionShape3D.xml
+++ b/doc/classes/CollisionShape3D.xml
@@ -6,6 +6,7 @@
<description>
Editor facility for creating and editing collision shapes in 3D space. Set the [member shape] property to configure the shape. [b]IMPORTANT[/b]: this is an Editor-only helper to create shapes, use [method CollisionObject3D.shape_owner_get_shape] to get the actual shape.
You can use this node to represent all sorts of collision shapes, for example, add this to an [Area3D] to give it a detection shape, or add it to a [PhysicsBody3D] to create a solid object.
+ [b]Warning:[/b] A non-uniformly scaled CollisionShape3D node will probably not function as expected. Please make sure to keep its scale uniform (i.e. the same on all axes), and change the size of its [member shape] resource instead.
</description>
<tutorials>
<link title="Physics introduction">$DOCS_URL/tutorials/physics/physics_introduction.html</link>
diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml
index d1387d088d..57278d9241 100644
--- a/doc/classes/Color.xml
+++ b/doc/classes/Color.xml
@@ -101,7 +101,7 @@
<return type="Color" />
<param index="0" name="over" type="Color" />
<description>
- Returns a new color resulting from overlaying this color over the given color. In a painting program, you can imagine it as the [param over] color painted over this colour (including alpha).
+ Returns a new color resulting from overlaying this color over the given color. In a painting program, you can imagine it as the [param over] color painted over this color (including alpha).
[codeblocks]
[gdscript]
var bg = Color(0.0, 1.0, 0.0, 0.5) # Green with alpha of 50%
diff --git a/doc/classes/ConfirmationDialog.xml b/doc/classes/ConfirmationDialog.xml
index 48b4df9126..ac2ea5be17 100644
--- a/doc/classes/ConfirmationDialog.xml
+++ b/doc/classes/ConfirmationDialog.xml
@@ -8,10 +8,10 @@
To get cancel action, you can use:
[codeblocks]
[gdscript]
- get_cancel_button().pressed.connect(self.cancelled)
+ get_cancel_button().pressed.connect(self.canceled)
[/gdscript]
[csharp]
- GetCancelButton().Pressed += Cancelled;
+ GetCancelButton().Pressed += Canceled;
[/csharp]
[/codeblocks]
</description>
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index 75afb0cdbf..0d675112b8 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -196,12 +196,12 @@
</description>
</method>
<method name="_structured_text_parser" qualifiers="virtual const">
- <return type="Vector2i[]" />
+ <return type="Vector3i[]" />
<param index="0" name="args" type="Array" />
<param index="1" name="text" type="String" />
<description>
User defined BiDi algorithm override function.
- Returns an [Array] of [Vector2i] text ranges, in the left-to-right order. Ranges should cover full source [param text] without overlaps. BiDi algorithm will be used on each range separately.
+ Returns an [Array] of [Vector3i] text ranges and text base directions, in the left-to-right order. Ranges should cover full source [param text] without overlaps. BiDi algorithm will be used on each range separately.
</description>
</method>
<method name="accept_event">
@@ -383,7 +383,9 @@
<method name="get_global_rect" qualifiers="const">
<return type="Rect2" />
<description>
- Returns the position and size of the control relative to the [CanvasLayer]. See [member global_position] and [member size].
+ Returns the position and size of the control relative to the containing canvas. See [member global_position] and [member size].
+ [b]Note:[/b] If the node itself or any parent [CanvasItem] between the node and the canvas have a non default rotation or skew, the resulting size is likely not meaningful.
+ [b]Note:[/b] Setting [member Viewport.gui_snap_controls_to_pixels] to [code]true[/code] can lead to rounding inaccuracies between the displayed control and the returned [Rect2].
</description>
</method>
<method name="get_minimum_size" qualifiers="const">
@@ -414,7 +416,9 @@
<method name="get_rect" qualifiers="const">
<return type="Rect2" />
<description>
- Returns the position and size of the control relative to the top-left corner of the parent Control. See [member position] and [member size].
+ Returns the position and size of the control in the coordinate system of the containing node. See [member position], [member scale] and [member size].
+ [b]Note:[/b] If [member rotation] is not the default rotation, the resulting size is not meaningful.
+ [b]Note:[/b] Setting [member Viewport.gui_snap_controls_to_pixels] to [code]true[/code] can lead to rounding inaccuracies between the displayed control and the returned [Rect2].
</description>
</method>
<method name="get_screen_position" qualifiers="const">
@@ -895,6 +899,7 @@
<param index="0" name="position" type="Vector2" />
<description>
Moves the mouse cursor to [param position], relative to [member position] of this [Control].
+ [b]Note:[/b] [method warp_mouse] is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web.
</description>
</method>
</methods>
@@ -991,7 +996,7 @@
By default, the node's pivot is its top-left corner. When you change its [member rotation] or [member scale], it will rotate or scale around this pivot. Set this property to [member size] / 2 to pivot around the Control's center.
</member>
<member name="position" type="Vector2" setter="_set_position" getter="get_position" default="Vector2(0, 0)">
- The node's position, relative to its parent. It corresponds to the rectangle's top-left corner. The property is not affected by [member pivot_offset].
+ The node's position, relative to its containing node. It corresponds to the rectangle's top-left corner. The property is not affected by [member pivot_offset].
</member>
<member name="rotation" type="float" setter="set_rotation" getter="get_rotation" default="0.0">
The node's rotation around its pivot, in radians. See [member pivot_offset] to change the pivot's position.
@@ -1008,7 +1013,7 @@
The [Node] which must be a parent of the focused [Control] for the shortcut to be activated. If [code]null[/code], the shortcut can be activated when any control is focused (a global shortcut). This allows shortcuts to be accepted only when the user has a certain area of the GUI focused.
</member>
<member name="size" type="Vector2" setter="_set_size" getter="get_size" default="Vector2(0, 0)">
- The size of the node's bounding rectangle, in pixels. [Container] nodes update this property automatically.
+ The size of the node's bounding rectangle, in the node's coordinate system. [Container] nodes update this property automatically.
</member>
<member name="size_flags_horizontal" type="int" setter="set_h_size_flags" getter="get_h_size_flags" enum="Control.SizeFlags" default="1">
Tells the parent [Container] nodes how they should resize and place the node on the X axis. Use one of the [enum SizeFlags] constants to change the flags. See the constants to learn what each does.
diff --git a/doc/classes/Cubemap.xml b/doc/classes/Cubemap.xml
index 46ddede9b1..01ec4c40d7 100644
--- a/doc/classes/Cubemap.xml
+++ b/doc/classes/Cubemap.xml
@@ -11,4 +11,12 @@
</description>
<tutorials>
</tutorials>
+ <methods>
+ <method name="create_placeholder" qualifiers="const">
+ <return type="Resource" />
+ <description>
+ Creates a placeholder version of this resource ([PlaceholderCubemap]).
+ </description>
+ </method>
+ </methods>
</class>
diff --git a/doc/classes/CubemapArray.xml b/doc/classes/CubemapArray.xml
index 2fd55b66c6..1b410671c1 100644
--- a/doc/classes/CubemapArray.xml
+++ b/doc/classes/CubemapArray.xml
@@ -12,4 +12,12 @@
</description>
<tutorials>
</tutorials>
+ <methods>
+ <method name="create_placeholder" qualifiers="const">
+ <return type="Resource" />
+ <description>
+ Creates a placeholder version of this resource ([PlaceholderCubemapArray]).
+ </description>
+ </method>
+ </methods>
</class>
diff --git a/doc/classes/Curve2D.xml b/doc/classes/Curve2D.xml
index b5e75dff68..fe597d0955 100644
--- a/doc/classes/Curve2D.xml
+++ b/doc/classes/Curve2D.xml
@@ -162,6 +162,8 @@
<param index="0" name="max_stages" type="int" default="5" />
<param index="1" name="tolerance_length" type="float" default="20.0" />
<description>
+ Returns a list of points along the curve, with almost uniform density. [param max_stages] controls how many subdivisions a curve segment may face before it is considered approximate enough. Each subdivision splits the segment in half, so the default 5 stages may mean up to 32 subdivisions per curve segment. Increase with care!
+ [param tolerance_length] controls the maximal distance between two neighboring points, before the segment has to be subdivided.
</description>
</method>
</methods>
diff --git a/doc/classes/Curve3D.xml b/doc/classes/Curve3D.xml
index 362d792b39..72ac95a700 100644
--- a/doc/classes/Curve3D.xml
+++ b/doc/classes/Curve3D.xml
@@ -198,7 +198,7 @@
<param index="1" name="tolerance_length" type="float" default="0.2" />
<description>
Returns a list of points along the curve, with almost uniform density. [param max_stages] controls how many subdivisions a curve segment may face before it is considered approximate enough. Each subdivision splits the segment in half, so the default 5 stages may mean up to 32 subdivisions per curve segment. Increase with care!
- [param tolerance_length] controls the maximal distance between two neighbouring points, before the segment has to be subdivided.
+ [param tolerance_length] controls the maximal distance between two neighboring points, before the segment has to be subdivided.
</description>
</method>
</methods>
diff --git a/doc/classes/DTLSServer.xml b/doc/classes/DTLSServer.xml
index 457513b8aa..a3a0b0456c 100644
--- a/doc/classes/DTLSServer.xml
+++ b/doc/classes/DTLSServer.xml
@@ -148,11 +148,9 @@
<methods>
<method name="setup">
<return type="int" enum="Error" />
- <param index="0" name="key" type="CryptoKey" />
- <param index="1" name="certificate" type="X509Certificate" />
- <param index="2" name="chain" type="X509Certificate" default="null" />
+ <param index="0" name="server_options" type="TLSOptions" />
<description>
- Setup the DTLS server to use the given [param key] and provide the given [param certificate] to clients. You can pass the optional [param chain] parameter to provide additional CA chain information along with the certificate.
+ Setup the DTLS server to use the given [param server_options]. See [method TLSOptions.server].
</description>
</method>
<method name="take_connection">
diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml
index 5f99ba82b8..1591aa59bf 100644
--- a/doc/classes/Dictionary.xml
+++ b/doc/classes/Dictionary.xml
@@ -42,7 +42,7 @@
You can access a dictionary's value by referencing its corresponding key. In the above example, [code]points_dict["White"][/code] will return [code]50[/code]. You can also write [code]points_dict.White[/code], which is equivalent. However, you'll have to use the bracket syntax if the key you're accessing the dictionary with isn't a fixed string (such as a number or variable).
[codeblocks]
[gdscript]
- @export(String, "White", "Yellow", "Orange") var my_color
+ @export_enum("White", "Yellow", "Orange") var my_color: String
var points_dict = {"White": 50, "Yellow": 75, "Orange": 100}
func _ready():
# We can't use dot syntax here as `my_color` is a variable.
@@ -153,7 +153,7 @@
<return type="Dictionary" />
<param index="0" name="from" type="Dictionary" />
<description>
- Returns the same array as [param from]. If you need a copy of the array, use [method duplicate].
+ Returns the same dictionary as [param from]. If you need a copy of the dictionary, use [method duplicate].
</description>
</constructor>
</constructors>
@@ -271,12 +271,24 @@
Returns [code]true[/code] if the dictionary is empty (its size is [code]0[/code]). See also [method size].
</description>
</method>
+ <method name="is_read_only" qualifiers="const">
+ <return type="bool" />
+ <description>
+ Returns [code]true[/code] if the dictionary is read-only. See [method make_read_only]. Dictionaries are automatically read-only if declared with [code]const[/code] keyword.
+ </description>
+ </method>
<method name="keys" qualifiers="const">
<return type="Array" />
<description>
Returns the list of keys in the dictionary.
</description>
</method>
+ <method name="make_read_only">
+ <return type="void" />
+ <description>
+ Makes the dictionary read-only, i.e. disables modification of the dictionary's contents. Does not apply to nested content, e.g. content of nested dictionaries.
+ </description>
+ </method>
<method name="merge">
<return type="void" />
<param index="0" name="dictionary" type="Dictionary" />
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml
index 832adb6e98..6f4a7fc13d 100644
--- a/doc/classes/DisplayServer.xml
+++ b/doc/classes/DisplayServer.xml
@@ -190,6 +190,7 @@
<description>
Adds a new checkable item with text [param label] to the global menu with ID [param menu_root].
Returns index of the inserted item, it's not guaranteed to be the same as [param index] value.
+ [b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag].
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
@@ -211,6 +212,7 @@
<description>
Adds a new checkable item with text [param label] and icon [param icon] to the global menu with ID [param menu_root].
Returns index of the inserted item, it's not guaranteed to be the same as [param index] value.
+ [b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag].
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
@@ -232,6 +234,7 @@
<description>
Adds a new item with text [param label] and icon [param icon] to the global menu with ID [param menu_root].
Returns index of the inserted item, it's not guaranteed to be the same as [param index] value.
+ [b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag].
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
@@ -254,6 +257,7 @@
Adds a new radio-checkable item with text [param label] and icon [param icon] to the global menu with ID [param menu_root].
Returns index of the inserted item, it's not guaranteed to be the same as [param index] value.
[b]Note:[/b] Radio-checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See [method global_menu_set_item_checked] for more info on how to control it.
+ [b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag].
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
@@ -274,6 +278,7 @@
<description>
Adds a new item with text [param label] to the global menu with ID [param menu_root].
Returns index of the inserted item, it's not guaranteed to be the same as [param index] value.
+ [b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag].
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
@@ -285,7 +290,7 @@
<method name="global_menu_add_multistate_item">
<return type="int" />
<param index="0" name="menu_root" type="String" />
- <param index="1" name="labe" type="String" />
+ <param index="1" name="label" type="String" />
<param index="2" name="max_states" type="int" />
<param index="3" name="default_state" type="int" />
<param index="4" name="callback" type="Callable" />
@@ -294,10 +299,11 @@
<param index="7" name="accelerator" type="int" enum="Key" default="0" />
<param index="8" name="index" type="int" default="-1" />
<description>
- Adds a new item with text [param labe] to the global menu with ID [param menu_root].
+ Adds a new item with text [param label] to the global menu with ID [param menu_root].
Contrarily to normal binary items, multistate items can have more than two states, as defined by [param max_states]. Each press or activate of the item will increase the state by one. The default value is defined by [param default_state].
Returns index of the inserted item, it's not guaranteed to be the same as [param index] value.
[b]Note:[/b] By default, there's no indication of the current item state, it should be changed manually.
+ [b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag].
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
@@ -319,6 +325,7 @@
Adds a new radio-checkable item with text [param label] to the global menu with ID [param menu_root].
Returns index of the inserted item, it's not guaranteed to be the same as [param index] value.
[b]Note:[/b] Radio-checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See [method global_menu_set_item_checked] for more info on how to control it.
+ [b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag].
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
@@ -562,6 +569,7 @@
<param index="2" name="callback" type="Callable" />
<description>
Sets the callback of the item at index [param idx]. Callback is emitted when an item is pressed.
+ [b]Note:[/b] The [param callback] Callable needs to accept exactly one Variant parameter, the parameter passed to the Callable will be the value passed to the tag parameter when the menu item was created.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
@@ -623,6 +631,7 @@
<param index="2" name="key_callback" type="Callable" />
<description>
Sets the callback of the item at index [param idx]. Callback is emitted when its accelerator is activated.
+ [b]Note:[/b] The [param key_callback] Callable needs to accept exactly one Variant parameter, the parameter passed to the Callable will be the value passed to the tag parameter when the menu item was created.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
@@ -1090,6 +1099,7 @@
<param index="0" name="position" type="Vector2i" />
<description>
Sets the mouse cursor position to the given [param position] relative to an origin at the upper left corner of the currently focused game Window Manager window.
+ [b]Note:[/b] [method warp_mouse] is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web.
</description>
</method>
<method name="window_can_draw" qualifiers="const">
@@ -1434,9 +1444,9 @@
<param index="0" name="vsync_mode" type="int" enum="DisplayServer.VSyncMode" />
<param index="1" name="window_id" type="int" default="0" />
<description>
- Sets the V-Sync mode of the given window.
+ Sets the V-Sync mode of the given window. See also [member ProjectSettings.display/window/vsync/vsync_mode].
See [enum DisplayServer.VSyncMode] for possible values and how they affect the behavior of your application.
- Depending on the platform and used renderer, the engine will fall back to [constant VSYNC_ENABLED], if the desired mode is not supported.
+ Depending on the platform and used renderer, the engine will fall back to [constant VSYNC_ENABLED] if the desired mode is not supported.
</description>
</method>
<method name="window_set_window_buttons_offset">
diff --git a/doc/classes/EditorCommandPalette.xml b/doc/classes/EditorCommandPalette.xml
index 380c79fc1a..448a622ae4 100644
--- a/doc/classes/EditorCommandPalette.xml
+++ b/doc/classes/EditorCommandPalette.xml
@@ -16,7 +16,7 @@
[csharp]
EditorCommandPalette commandPalette = GetEditorInterface().GetCommandPalette();
// ExternalCommand is a function that will be called with the command is executed.
- Callable commandCallable = new Callable(this, nameof(ExternalCommand));
+ Callable commandCallable = new Callable(this, MethodName.ExternalCommand);
commandPalette.AddCommand("command", "test/command", commandCallable)
[/csharp]
[/codeblocks]
diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml
index c395815117..ec9efcc9c4 100644
--- a/doc/classes/EditorImportPlugin.xml
+++ b/doc/classes/EditorImportPlugin.xml
@@ -37,8 +37,8 @@
return [{"name": "my_option", "default_value": false}]
func _import(source_file, save_path, options, platform_variants, gen_files):
- var file = File.new()
- if file.open(source_file, File.READ) != OK:
+ var file = FileAccess.open(source_file, FileAccess.READ)
+ if file == null:
return FAILED
var mesh = ArrayMesh.new()
# Fill the Mesh with data read in "file", left as an exercise to the reader.
diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml
index 370be8e9f3..c097c8f685 100644
--- a/doc/classes/EditorPlugin.xml
+++ b/doc/classes/EditorPlugin.xml
@@ -41,6 +41,7 @@
<param index="0" name="object" type="Variant" />
<description>
This function is used for plugins that edit specific object types (nodes or resources). It requests the editor to edit the given object.
+ [param object] can be [code]null[/code] if the plugin was editing an object, but there is no longer any selected object handled by this plugin. It can be used to cleanup editing state.
</description>
</method>
<method name="_enable_plugin" qualifiers="virtual">
@@ -408,6 +409,7 @@
<description>
Adds a custom type, which will appear in the list of nodes or resources. An icon can be optionally passed.
When a given node or resource is selected, the base type will be instantiated (e.g. "Node3D", "Control", "Resource"), then the script will be loaded and set to this object.
+ [b]Note:[/b] The base type is the base engine class which this type's class hierarchy inherits, not any custom type parent classes.
You can use the virtual method [method _handles] to check if your custom object is being edited by checking the script or using the [code]is[/code] keyword.
During run-time, this will be a simple object with a script so this function does not need to be called then.
[b]Note:[/b] Custom types added this way are not true classes. They are just a helper to create a node with specific script.
diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml
index fca87f6a56..72843eb157 100644
--- a/doc/classes/EditorSettings.xml
+++ b/doc/classes/EditorSettings.xml
@@ -433,12 +433,24 @@
The size to use for port previews in the visual shader uniforms (toggled by clicking the "eye" icon next to an output). The value is defined in pixels at 100% zoom, and will scale with zoom automatically.
</member>
<member name="filesystem/directories/autoscan_project_path" type="String" setter="" getter="">
- The folder where projects should be scanned for (recursively), in a way similar to the project manager's [b]Scan[/b]button. This can be set to the same value as [member filesystem/directories/default_project_path] for convenience.
+ The folder where projects should be scanned for (recursively), in a way similar to the project manager's [b]Scan[/b] button. This can be set to the same value as [member filesystem/directories/default_project_path] for convenience.
[b]Note:[/b] Setting this path to a folder with very large amounts of files/folders can slow down the project manager startup significantly. To keep the project manager quick to start up, it is recommended to set this value to a folder as "specific" as possible.
</member>
<member name="filesystem/directories/default_project_path" type="String" setter="" getter="">
The folder where new projects should be created by default when clicking the project manager's [b]New Project[/b] button. This can be set to the same value as [member filesystem/directories/autoscan_project_path] for convenience.
</member>
+ <member name="filesystem/external_programs/3d_model_editor" type="String" setter="" getter="">
+ The program that opens 3D model scene files when clicking "Open in External Program" option in Filesystem Dock. If not specified, the file will be opened in the system's default program.
+ </member>
+ <member name="filesystem/external_programs/audio_editor" type="String" setter="" getter="">
+ The program that opens audio files when clicking "Open in External Program" option in Filesystem Dock. If not specified, the file will be opened in the system's default program.
+ </member>
+ <member name="filesystem/external_programs/raster_image_editor" type="String" setter="" getter="">
+ The program that opens raster image files when clicking "Open in External Program" option in Filesystem Dock. If not specified, the file will be opened in the system's default program.
+ </member>
+ <member name="filesystem/external_programs/vector_image_editor" type="String" setter="" getter="">
+ The program that opens vector image files when clicking "Open in External Program" option in Filesystem Dock. If not specified, the file will be opened in the system's default program.
+ </member>
<member name="filesystem/file_dialog/display_mode" type="int" setter="" getter="">
The display mode to use in the editor's file dialogs.
- [b]Thumbnails[/b] takes more space, but displays dynamic resource thumbnails, making resources easier to preview without having to open them.
@@ -595,6 +607,10 @@
<member name="interface/theme/draw_extra_borders" type="bool" setter="" getter="">
If [code]true[/code], draws additional borders around interactive UI elements in the editor. This is automatically enabled when using the [b]Black (OLED)[/b] theme preset, as this theme preset uses a fully black background.
</member>
+ <member name="interface/theme/enable_touchscreen_touch_area" type="bool" setter="" getter="">
+ If [code]true[/code], increases the touch area for the UI elements to improve usability on touchscreen devices.
+ [b]Note:[/b] Defaults to [code]true[/code] on touchscreen devices.
+ </member>
<member name="interface/theme/icon_and_font_color" type="int" setter="" getter="">
The icon and font color scheme to use in the editor.
- [b]Auto[/b] determines the color scheme to use automatically based on [member interface/theme/base_color].
diff --git a/doc/classes/EditorTranslationParserPlugin.xml b/doc/classes/EditorTranslationParserPlugin.xml
index df10c645ef..89746363d8 100644
--- a/doc/classes/EditorTranslationParserPlugin.xml
+++ b/doc/classes/EditorTranslationParserPlugin.xml
@@ -15,8 +15,7 @@
extends EditorTranslationParserPlugin
func _parse_file(path, msgids, msgids_context_plural):
- var file = File.new()
- file.open(path, File.READ)
+ var file = FileAccess.open(path, FileAccess.READ)
var text = file.get_as_text()
var split_strs = text.split(",", false)
for s in split_strs:
diff --git a/doc/classes/Expression.xml b/doc/classes/Expression.xml
index 4670e0c382..2c7d83a811 100644
--- a/doc/classes/Expression.xml
+++ b/doc/classes/Expression.xml
@@ -28,7 +28,7 @@
public override void _Ready()
{
- GetNode("LineEdit").TextSubmitted += OnTextEntered;
+ GetNode&lt;LineEdit&gt;("LineEdit").TextSubmitted += OnTextEntered;
}
private void OnTextEntered(string command)
diff --git a/doc/classes/FileSystemDock.xml b/doc/classes/FileSystemDock.xml
index 00f5c7ddff..f76bc2c279 100644
--- a/doc/classes/FileSystemDock.xml
+++ b/doc/classes/FileSystemDock.xml
@@ -51,5 +51,10 @@
<description>
</description>
</signal>
+ <signal name="resource_removed">
+ <param index="0" name="resource" type="Resource" />
+ <description>
+ </description>
+ </signal>
</signals>
</class>
diff --git a/doc/classes/GPUParticles2D.xml b/doc/classes/GPUParticles2D.xml
index c7d10078e8..29779e4a77 100644
--- a/doc/classes/GPUParticles2D.xml
+++ b/doc/classes/GPUParticles2D.xml
@@ -5,7 +5,8 @@
</brief_description>
<description>
2D particle node used to create a variety of particle systems and effects. [GPUParticles2D] features an emitter that generates some number of particles at a given rate.
- Use the [code]process_material[/code] property to add a [ParticleProcessMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles.
+ Use the [member process_material] property to add a [ParticleProcessMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles.
+ 2D particles can optionally collide with [LightOccluder2D] nodes (note: they don't collide with [PhysicsBody2D] nodes).
</description>
<tutorials>
<link title="Particle systems (2D)">$DOCS_URL/tutorials/2d/particle_systems_2d.html</link>
@@ -42,6 +43,7 @@
Number of particles emitted in one emission cycle.
</member>
<member name="collision_base_size" type="float" setter="set_collision_base_size" getter="get_collision_base_size" default="1.0">
+ Multiplier for particle's collision radius. [code]1.0[/code] corresponds to the size of the sprite.
</member>
<member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="GPUParticles2D.DrawOrder" default="1">
Particle draw order. Uses [enum DrawOrder] values.
diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml
index b3ed38d250..b7a5cff694 100644
--- a/doc/classes/HTTPClient.xml
+++ b/doc/classes/HTTPClient.xml
@@ -30,13 +30,10 @@
<return type="int" enum="Error" />
<param index="0" name="host" type="String" />
<param index="1" name="port" type="int" default="-1" />
- <param index="2" name="use_tls" type="bool" default="false" />
- <param index="3" name="verify_host" type="bool" default="true" />
+ <param index="2" name="tls_options" type="TLSOptions" default="null" />
<description>
Connects to a host. This needs to be done before any requests are sent.
- The host should not have http:// prepended but will strip the protocol identifier if provided.
- If no [param port] is specified (or [code]-1[/code] is used), it is automatically set to 80 for HTTP and 443 for HTTPS (if [param use_tls] is enabled).
- [param verify_host] will check the TLS identity of the host if set to [code]true[/code].
+ If no [param port] is specified (or [code]-1[/code] is used), it is automatically set to 80 for HTTP and 443 for HTTPS. You can pass the optional [param tls_options] parameter to customize the trusted certification authorities, or the common name verification when using HTTPS. See [method TLSOptions.client] and [method TLSOptions.client_unsafe].
</description>
</method>
<method name="get_response_body_length" qualifiers="const">
diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml
index c504e26d58..d403acf90c 100644
--- a/doc/classes/HTTPRequest.xml
+++ b/doc/classes/HTTPRequest.xml
@@ -69,7 +69,7 @@
}
// Called when the HTTP request is completed.
- private void HttpRequestCompleted(int result, int response_code, string[] headers, byte[] body)
+ private void HttpRequestCompleted(int result, int responseCode, string[] headers, byte[] body)
{
var json = new JSON();
json.Parse(body.GetStringFromUTF8());
@@ -128,7 +128,7 @@
}
// Called when the HTTP request is completed.
- private void HttpRequestCompleted(int result, int response_code, string[] headers, byte[] body)
+ private void HttpRequestCompleted(int result, int responseCode, string[] headers, byte[] body)
{
if (result != (int)HTTPRequest.Result.Success)
{
@@ -187,9 +187,8 @@
<return type="int" enum="Error" />
<param index="0" name="url" type="String" />
<param index="1" name="custom_headers" type="PackedStringArray" default="PackedStringArray()" />
- <param index="2" name="tls_validate_domain" type="bool" default="true" />
- <param index="3" name="method" type="int" enum="HTTPClient.Method" default="0" />
- <param index="4" name="request_data" type="String" default="&quot;&quot;" />
+ <param index="2" name="method" type="int" enum="HTTPClient.Method" default="0" />
+ <param index="3" name="request_data" type="String" default="&quot;&quot;" />
<description>
Creates request on the underlying [HTTPClient]. If there is no configuration errors, it tries to connect using [method HTTPClient.connect_to_host] and passes parameters onto [method HTTPClient.request].
Returns [constant OK] if request is successfully created. (Does not imply that the server has responded), [constant ERR_UNCONFIGURED] if not in the tree, [constant ERR_BUSY] if still processing previous request, [constant ERR_INVALID_PARAMETER] if given string is not a valid URL format, or [constant ERR_CANT_CONNECT] if not using thread and the [HTTPClient] cannot connect to host.
@@ -201,9 +200,8 @@
<return type="int" enum="Error" />
<param index="0" name="url" type="String" />
<param index="1" name="custom_headers" type="PackedStringArray" default="PackedStringArray()" />
- <param index="2" name="tls_validate_domain" type="bool" default="true" />
- <param index="3" name="method" type="int" enum="HTTPClient.Method" default="0" />
- <param index="4" name="request_data_raw" type="PackedByteArray" default="PackedByteArray()" />
+ <param index="2" name="method" type="int" enum="HTTPClient.Method" default="0" />
+ <param index="3" name="request_data_raw" type="PackedByteArray" default="PackedByteArray()" />
<description>
Creates request on the underlying [HTTPClient] using a raw array of bytes for the request body. If there is no configuration errors, it tries to connect using [method HTTPClient.connect_to_host] and passes parameters onto [method HTTPClient.request].
Returns [constant OK] if request is successfully created. (Does not imply that the server has responded), [constant ERR_UNCONFIGURED] if not in the tree, [constant ERR_BUSY] if still processing previous request, [constant ERR_INVALID_PARAMETER] if given string is not a valid URL format, or [constant ERR_CANT_CONNECT] if not using thread and the [HTTPClient] cannot connect to host.
@@ -227,6 +225,13 @@
The proxy server is unset if [param host] is empty or [param port] is -1.
</description>
</method>
+ <method name="set_tls_options">
+ <return type="void" />
+ <param index="0" name="client_options" type="TLSOptions" />
+ <description>
+ Sets the [TLSOptions] to be used when connecting to an HTTPS server. See [method TLSOptions.client].
+ </description>
+ </method>
</methods>
<members>
<member name="accept_gzip" type="bool" setter="set_accept_gzip" getter="is_accepting_gzip" default="true">
diff --git a/doc/classes/HashingContext.xml b/doc/classes/HashingContext.xml
index 6e3092e618..7c2be6f817 100644
--- a/doc/classes/HashingContext.xml
+++ b/doc/classes/HashingContext.xml
@@ -11,15 +11,14 @@
const CHUNK_SIZE = 102
func hash_file(path):
- var ctx = HashingContext.new()
- var file = File.new()
- # Start a SHA-256 context.
- ctx.start(HashingContext.HASH_SHA256)
# Check that file exists.
- if not file.file_exists(path):
+ if not FileAccess.file_exists(path):
return
+ # Start a SHA-256 context.
+ var ctx = HashingContext.new()
+ ctx.start(HashingContext.HASH_SHA256)
# Open the file to hash.
- file.open(path, File.READ)
+ var file = FileAccess.open(path, FileAccess.READ)
# Update the context after reading each chunk.
while not file.eof_reached():
ctx.update(file.get_buffer(CHUNK_SIZE))
diff --git a/doc/classes/HeightMapShape3D.xml b/doc/classes/HeightMapShape3D.xml
index 206981e547..f34870c500 100644
--- a/doc/classes/HeightMapShape3D.xml
+++ b/doc/classes/HeightMapShape3D.xml
@@ -14,10 +14,10 @@
Height map data, pool array must be of [member map_width] * [member map_depth] size.
</member>
<member name="map_depth" type="int" setter="set_map_depth" getter="get_map_depth" default="2">
- Depth of the height map data. Changing this will resize the [member map_data].
+ Number of vertices in the depth of the height map. Changing this will resize the [member map_data].
</member>
<member name="map_width" type="int" setter="set_map_width" getter="get_map_width" default="2">
- Width of the height map data. Changing this will resize the [member map_data].
+ Number of vertices in the width of the height map. Changing this will resize the [member map_data].
</member>
</members>
</class>
diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml
index 051e087611..5b07124b91 100644
--- a/doc/classes/Image.xml
+++ b/doc/classes/Image.xml
@@ -75,12 +75,10 @@
<return type="int" enum="Error" />
<param index="0" name="mode" type="int" enum="Image.CompressMode" />
<param index="1" name="source" type="int" enum="Image.CompressSource" default="0" />
- <param index="2" name="lossy_quality" type="float" default="0.7" />
- <param index="3" name="astc_format" type="int" enum="Image.ASTCFormat" default="0" />
+ <param index="2" name="astc_format" type="int" enum="Image.ASTCFormat" default="0" />
<description>
Compresses the image to use less memory. Can not directly access pixel data while the image is compressed. Returns error if the chosen compression mode is not available.
The [param mode] parameter helps to pick the best compression method for DXT and ETC2 formats. It is ignored for ASTC compression.
- The [param lossy_quality] parameter is optional for compressors that support it.
For ASTC compression, the [param astc_format] parameter must be supplied.
</description>
</method>
@@ -88,12 +86,10 @@
<return type="int" enum="Error" />
<param index="0" name="mode" type="int" enum="Image.CompressMode" />
<param index="1" name="channels" type="int" enum="Image.UsedChannels" />
- <param index="2" name="lossy_quality" type="float" default="0.7" />
- <param index="3" name="astc_format" type="int" enum="Image.ASTCFormat" default="0" />
+ <param index="2" name="astc_format" type="int" enum="Image.ASTCFormat" default="0" />
<description>
Compresses the image to use less memory. Can not directly access pixel data while the image is compressed. Returns error if the chosen compression mode is not available.
This is an alternative to [method compress] that lets the user supply the channels used in order for the compressor to pick the best DXT and ETC2 formats. For other formats (non DXT or ETC2), this argument is ignored.
- The [param lossy_quality] parameter is optional for compressors that support it.
For ASTC compression, the [param astc_format] parameter must be supplied.
</description>
</method>
@@ -525,7 +521,7 @@
var img = new Image();
img.Create(imgWidth, imgHeight, false, Image.Format.Rgba8);
- img.SetPixelv(new Vector2i(1, 2), Colors.Red); // Sets the color at (1, 2) to red.
+ img.SetPixelv(new Vector2I(1, 2), Colors.Red); // Sets the color at (1, 2) to red.
[/csharp]
[/codeblocks]
This is the same as [method set_pixel], but with a [Vector2i] argument instead of two integer arguments.
diff --git a/doc/classes/ImporterMesh.xml b/doc/classes/ImporterMesh.xml
index b80857a7bf..10479dfcfe 100644
--- a/doc/classes/ImporterMesh.xml
+++ b/doc/classes/ImporterMesh.xml
@@ -27,9 +27,13 @@
<param index="5" name="name" type="String" default="&quot;&quot;" />
<param index="6" name="flags" type="int" default="0" />
<description>
- Creates a new surface, analogous to [method ArrayMesh.add_surface_from_arrays].
- Surfaces are created to be rendered using a [param primitive], which may be any of the types defined in [enum Mesh.PrimitiveType]. (As a note, when using indices, it is recommended to only use points, lines, or triangles.) [method Mesh.get_surface_count] will become the [code]surf_idx[/code] for this new surface.
- The [param arrays] argument is an array of arrays. See [enum Mesh.ArrayType] for the values used in this array. For example, [code]arrays[0][/code] is the array of vertices. That first vertex sub-array is always required; the others are optional. Adding an index array puts this function into "index mode" where the vertex and other arrays become the sources of data and the index array defines the vertex order. All sub-arrays must have the same length as the vertex array (or be an exact multiple of the vertex array's length, when multiple elements of a sub-array correspond to a single vertex) or be empty, except for [constant Mesh.ARRAY_INDEX] if it is used.
+ Creates a new surface. [method Mesh.get_surface_count] will become the [code]surf_idx[/code] for this new surface.
+ Surfaces are created to be rendered using a [param primitive], which may be any of the values defined in [enum Mesh.PrimitiveType].
+ The [param arrays] argument is an array of arrays. Each of the [constant Mesh.ARRAY_MAX] elements contains an array with some of the mesh data for this surface as described by the corresponding member of [enum Mesh.ArrayType] or [code]null[/code] if it is not used by the surface. For example, [code]arrays[0][/code] is the array of vertices. That first vertex sub-array is always required; the others are optional. Adding an index array puts this surface into "index mode" where the vertex and other arrays become the sources of data and the index array defines the vertex order. All sub-arrays must have the same length as the vertex array (or be an exact multiple of the vertex array's length, when multiple elements of a sub-array correspond to a single vertex) or be empty, except for [constant Mesh.ARRAY_INDEX] if it is used.
+ The [param blend_shapes] argument is an array of vertex data for each blend shape. Each element is an array of the same structure as [param arrays], but [constant Mesh.ARRAY_VERTEX], [constant Mesh.ARRAY_NORMAL], and [constant Mesh.ARRAY_TANGENT] are set if and only if they are set in [param arrays] and all other entries are [code]null[/code].
+ The [param lods] argument is a dictionary with [float] keys and [PackedInt32Array] values. Each entry in the dictionary represents a LOD level of the surface, where the value is the [constant Mesh.ARRAY_INDEX] array to use for the LOD level and the key is roughly proportional to the distance at which the LOD stats being used. I.e., increasing the key of a LOD also increases the distance that the objects has to be from the camera before the LOD is used.
+ The [param flags] argument is the bitwise or of, as required: One value of [enum Mesh.ArrayCustomFormat] left shifted by [code]ARRAY_FORMAT_CUSTOMn_SHIFT[/code] for each custom channel in use, [constant Mesh.ARRAY_FLAG_USE_DYNAMIC_UPDATE], [constant Mesh.ARRAY_FLAG_USE_8_BONE_WEIGHTS], or [constant Mesh.ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY].
+ [b]Note:[/b] When using indices, it is recommended to only use points, lines, or triangles.
</description>
</method>
<method name="clear">
diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml
index a0d2d93a7d..70e629974d 100644
--- a/doc/classes/Input.xml
+++ b/doc/classes/Input.xml
@@ -224,11 +224,18 @@
Returns [code]true[/code] if the system knows the specified device. This means that it sets all button and axis indices. Unknown joypads are not expected to match these constants, but you can still retrieve events from them.
</description>
</method>
+ <method name="is_key_label_pressed" qualifiers="const">
+ <return type="bool" />
+ <param index="0" name="keycode" type="int" enum="Key" />
+ <description>
+ Returns [code]true[/code] if you are pressing the key with the [param keycode] printed on it. You can pass a [enum Key] constant or any Unicode character code.
+ </description>
+ </method>
<method name="is_key_pressed" qualifiers="const">
<return type="bool" />
<param index="0" name="keycode" type="int" enum="Key" />
<description>
- Returns [code]true[/code] if you are pressing the key in the current keyboard layout. You can pass a [enum Key] constant.
+ Returns [code]true[/code] if you are pressing the Latin key in the current keyboard layout. You can pass a [enum Key] constant.
[method is_key_pressed] is only recommended over [method is_physical_key_pressed] in non-game applications. This ensures that shortcut keys behave as expected depending on the user's keyboard layout, as keyboard shortcuts are generally dependent on the keyboard layout in non-game applications. If in doubt, use [method is_physical_key_pressed].
[b]Note:[/b] Due to keyboard ghosting, [method is_key_pressed] may return [code]false[/code] even if one of the action's keys is pressed. See [url=$DOCS_URL/tutorials/inputs/input_examples.html#keyboard-events]Input examples[/url] in the documentation for more information.
</description>
@@ -297,6 +304,7 @@
[param hotspot] must be within [param image]'s size.
[b]Note:[/b] [AnimatedTexture]s aren't supported as custom mouse cursors. If using an [AnimatedTexture], only the first frame will be displayed.
[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or [b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] compression mode can't be used for custom cursors.
+ [b]Note:[/b] On the web platform, the maximum allowed cursor image size is 128×128. Cursor images larger than 32×32 will also only be displayed if the mouse cursor image is entirely located within the page for [url=https://chromestatus.com/feature/5825971391299584]security reasons[/url].
</description>
</method>
<method name="set_default_cursor_shape">
@@ -367,6 +375,7 @@
<description>
Sets the mouse position to the specified vector, provided in pixels and relative to an origin at the upper left corner of the currently focused Window Manager game window.
Mouse position is clipped to the limits of the screen resolution, or to the limits of the game window if [enum MouseMode] is set to [constant MOUSE_MODE_CONFINED] or [constant MOUSE_MODE_CONFINED_HIDDEN].
+ [b]Note:[/b] [method warp_mouse] is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web.
</description>
</method>
</methods>
diff --git a/doc/classes/InputEventKey.xml b/doc/classes/InputEventKey.xml
index c3d682de9e..4d10a183d4 100644
--- a/doc/classes/InputEventKey.xml
+++ b/doc/classes/InputEventKey.xml
@@ -5,15 +5,42 @@
</brief_description>
<description>
Stores key presses on the keyboard. Supports key presses, key releases and [member echo] events.
+ [b]Note:[/b] Events received from the keyboard usually have all properties set. Event mappings should have only one of the [member keycode], [member physical_keycode] or [member unicode] set.
+ When events are compared, properties are checked in the following priority - [member keycode], [member physical_keycode] and [member unicode], events with the first matching value will be considered equal.
</description>
<tutorials>
<link title="InputEvent">$DOCS_URL/tutorials/inputs/inputevent.html</link>
</tutorials>
<methods>
+ <method name="as_text_key_label" qualifiers="const">
+ <return type="String" />
+ <description>
+ Returns a [String] representation of the event's [member key_label] and modifiers.
+ </description>
+ </method>
+ <method name="as_text_keycode" qualifiers="const">
+ <return type="String" />
+ <description>
+ Returns a [String] representation of the event's [member keycode] and modifiers.
+ </description>
+ </method>
+ <method name="as_text_physical_keycode" qualifiers="const">
+ <return type="String" />
+ <description>
+ Returns a [String] representation of the event's [member physical_keycode] and modifiers.
+ </description>
+ </method>
+ <method name="get_key_label_with_modifiers" qualifiers="const">
+ <return type="int" enum="Key" />
+ <description>
+ Returns the localized key label combined with modifier keys such as [kbd]Shift[/kbd] or [kbd]Alt[/kbd]. See also [InputEventWithModifiers].
+ To get a human-readable representation of the [InputEventKey] with modifiers, use [code]OS.get_keycode_string(event.get_key_label_with_modifiers())[/code] where [code]event[/code] is the [InputEventKey].
+ </description>
+ </method>
<method name="get_keycode_with_modifiers" qualifiers="const">
<return type="int" enum="Key" />
<description>
- Returns the keycode combined with modifier keys such as [kbd]Shift[/kbd] or [kbd]Alt[/kbd]. See also [InputEventWithModifiers].
+ Returns the Latin keycode combined with modifier keys such as [kbd]Shift[/kbd] or [kbd]Alt[/kbd]. See also [InputEventWithModifiers].
To get a human-readable representation of the [InputEventKey] with modifiers, use [code]OS.get_keycode_string(event.get_keycode_with_modifiers())[/code] where [code]event[/code] is the [InputEventKey].
</description>
</method>
@@ -29,19 +56,36 @@
<member name="echo" type="bool" setter="set_echo" getter="is_echo" default="false">
If [code]true[/code], the key was already pressed before this event. It means the user is holding the key down.
</member>
+ <member name="key_label" type="int" setter="set_key_label" getter="get_key_label" enum="Key" default="0">
+ Represents the localized label printed on the key in the current keyboard layout, which corresponds to one of the [enum Key] constants or any valid Unicode character.
+ For keyboard layouts with a single label on the key, it is equivalent to [member keycode].
+ To get a human-readable representation of the [InputEventKey], use [code]OS.get_keycode_string(event.key_label)[/code] where [code]event[/code] is the [InputEventKey].
+ [codeblock]
+ +-----+ +-----+
+ | Q | | Q | - "Q" - keycode
+ | Й | | ض | - "Й" and "ض" - key_label
+ +-----+ +-----+
+ [/codeblock]
+ </member>
<member name="keycode" type="int" setter="set_keycode" getter="get_keycode" enum="Key" default="0">
- The key keycode, which corresponds to one of the [enum Key] constants. Represent key in the current keyboard layout.
+ Latin label printed on the key in the current keyboard layout, which corresponds to one of the [enum Key] constants.
To get a human-readable representation of the [InputEventKey], use [code]OS.get_keycode_string(event.keycode)[/code] where [code]event[/code] is the [InputEventKey].
+ [codeblock]
+ +-----+ +-----+
+ | Q | | Q | - "Q" - keycode
+ | Й | | ض | - "Й" and "ض" - key_label
+ +-----+ +-----+
+ [/codeblock]
</member>
<member name="physical_keycode" type="int" setter="set_physical_keycode" getter="get_physical_keycode" enum="Key" default="0">
- Key physical keycode, which corresponds to one of the [enum Key] constants. Represent the physical location of a key on the 101/102-key US QWERTY keyboard.
+ Represents the physical location of a key on the 101/102-key US QWERTY keyboard, which corresponds to one of the [enum Key] constants.
To get a human-readable representation of the [InputEventKey], use [code]OS.get_keycode_string(event.keycode)[/code] where [code]event[/code] is the [InputEventKey].
</member>
<member name="pressed" type="bool" setter="set_pressed" getter="is_pressed" default="false">
If [code]true[/code], the key's state is pressed. If [code]false[/code], the key's state is released.
</member>
<member name="unicode" type="int" setter="set_unicode" getter="get_unicode" default="0">
- The key Unicode identifier (when relevant). Unicode identifiers for the composite characters and complex scripts may not be available unless IME input mode is active. See [method Window.set_ime_active] for more information.
+ The key Unicode character code (when relevant), shifted by modifier keys. Unicode character codes for composite characters and complex scripts may not be available unless IME input mode is active. See [method Window.set_ime_active] for more information.
</member>
</members>
</class>
diff --git a/doc/classes/InputEventWithModifiers.xml b/doc/classes/InputEventWithModifiers.xml
index c6311d780c..26b88e6ff2 100644
--- a/doc/classes/InputEventWithModifiers.xml
+++ b/doc/classes/InputEventWithModifiers.xml
@@ -10,6 +10,12 @@
<link title="InputEvent">$DOCS_URL/tutorials/inputs/inputevent.html</link>
</tutorials>
<methods>
+ <method name="get_modifiers_mask" qualifiers="const">
+ <return type="int" enum="KeyModifierMask" />
+ <description>
+ Returns the keycode combination of modifier keys.
+ </description>
+ </method>
<method name="is_command_or_control_pressed" qualifiers="const">
<return type="bool" />
<description>
diff --git a/doc/classes/JSON.xml b/doc/classes/JSON.xml
index 93731cf553..6fe53dfaac 100644
--- a/doc/classes/JSON.xml
+++ b/doc/classes/JSON.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="JSON" inherits="RefCounted" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
+<class name="JSON" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Helper class for creating and parsing JSON data.
</brief_description>
@@ -49,13 +49,21 @@
Returns an empty string if the last call to [method parse] was successful, or the error message if it failed.
</description>
</method>
+ <method name="get_parsed_text" qualifiers="const">
+ <return type="String" />
+ <description>
+ Return the text parsed by [method parse] as long as the function is instructed to keep it.
+ </description>
+ </method>
<method name="parse">
<return type="int" enum="Error" />
- <param index="0" name="json_string" type="String" />
+ <param index="0" name="json_text" type="String" />
+ <param index="1" name="keep_text" type="bool" default="false" />
<description>
- Attempts to parse the [param json_string] provided.
+ Attempts to parse the [param json_text] provided.
Returns an [enum Error]. If the parse was successful, it returns [constant OK] and the result can be retrieved using [member data]. If unsuccessful, use [method get_error_line] and [method get_error_message] for identifying the source of the failure.
Non-static variant of [method parse_string], if you want custom error handling.
+ The optional [param keep_text] argument instructs the parser to keep a copy of the original text. This text can be obtained later by using the [method get_parsed_text] function and is used when saving the resource (instead of generating new text from [member data]).
</description>
</method>
<method name="parse_string" qualifiers="static">
diff --git a/doc/classes/Label3D.xml b/doc/classes/Label3D.xml
index 0cbca2224e..cfb47ff4c3 100644
--- a/doc/classes/Label3D.xml
+++ b/doc/classes/Label3D.xml
@@ -32,9 +32,18 @@
</method>
</methods>
<members>
+ <member name="alpha_antialiasing_edge" type="float" setter="set_alpha_antialiasing_edge" getter="get_alpha_antialiasing_edge" default="0.0">
+ Threshold at which antialiasing will be applied on the alpha channel.
+ </member>
+ <member name="alpha_antialiasing_mode" type="int" setter="set_alpha_antialiasing" getter="get_alpha_antialiasing" enum="BaseMaterial3D.AlphaAntiAliasing" default="0">
+ The type of alpha antialiasing to apply. See [enum BaseMaterial3D.AlphaAntiAliasing].
+ </member>
<member name="alpha_cut" type="int" setter="set_alpha_cut_mode" getter="get_alpha_cut_mode" enum="Label3D.AlphaCutMode" default="0">
The alpha cutting mode to use for the sprite. See [enum AlphaCutMode] for possible values.
</member>
+ <member name="alpha_hash_scale" type="float" setter="set_alpha_hash_scale" getter="get_alpha_hash_scale" default="1.0">
+ The hashing scale for Alpha Hash. Recommended values between [code]0[/code] and [code]2[/code].
+ </member>
<member name="alpha_scissor_threshold" type="float" setter="set_alpha_scissor_threshold" getter="get_alpha_scissor_threshold" default="0.5">
Threshold at which the alpha scissor will discard values.
</member>
@@ -152,5 +161,8 @@
This mode draws fully opaque pixels in the depth prepass. This is slower than [constant ALPHA_CUT_DISABLED] or [constant ALPHA_CUT_DISCARD], but it allows displaying translucent areas and smooth edges while using proper sorting.
[b]Note:[/b] When using text with overlapping glyphs (e.g., cursive scripts), this mode might have transparency sorting issues between the main text and the outline.
</constant>
+ <constant name="ALPHA_CUT_HASH" value="3" enum="AlphaCutMode">
+ This mode draws cuts off all values below a spatially-deterministic threshold, the rest will remain opaque.
+ </constant>
</constants>
</class>
diff --git a/doc/classes/Light3D.xml b/doc/classes/Light3D.xml
index fe7756faaf..95c39d535e 100644
--- a/doc/classes/Light3D.xml
+++ b/doc/classes/Light3D.xml
@@ -80,7 +80,7 @@
A typical household lightbulb can range from around 600 lumens to 1,200 lumens, a candle is about 13 lumens, while a streetlight can be approximately 60,000 lumens.
</member>
<member name="light_intensity_lux" type="float" setter="set_param" getter="get_param">
- Used by [DirectionalLight3D]s when [member ProjectSettings.rendering/lights_and_shadows/use_physical_light_units] is [code]true[/code]. Sets the intensity of the light source measured in Lux. Lux is a measure pf luminous flux per unit area, it is equal to one lumen per square metre. Lux is the measure of how much light hits a surface at a given time.
+ Used by [DirectionalLight3D]s when [member ProjectSettings.rendering/lights_and_shadows/use_physical_light_units] is [code]true[/code]. Sets the intensity of the light source measured in Lux. Lux is a measure of luminous flux per unit area, it is equal to one lumen per square meter. Lux is the measure of how much light hits a surface at a given time.
On a clear sunny day a surface in direct sunlight may be approximately 100,000 lux, a typical room in a home may be approximately 50 lux, while the moonlit ground may be approximately 0.1 lux.
</member>
<member name="light_negative" type="bool" setter="set_negative" getter="is_negative" default="false">
diff --git a/doc/classes/LightmapGI.xml b/doc/classes/LightmapGI.xml
index 53dae1a8e6..723e6bbf21 100644
--- a/doc/classes/LightmapGI.xml
+++ b/doc/classes/LightmapGI.xml
@@ -93,22 +93,28 @@
<constant name="BAKE_ERROR_OK" value="0" enum="BakeError">
Lightmap baking was successful.
</constant>
- <constant name="BAKE_ERROR_NO_LIGHTMAPPER" value="1" enum="BakeError">
+ <constant name="BAKE_ERROR_NO_SCENE_ROOT" value="1" enum="BakeError">
+ Lightmap baking failed because the root node for the edited scene could not be accessed.
+ </constant>
+ <constant name="BAKE_ERROR_FOREIGN_DATA" value="2" enum="BakeError">
+ Lightmap baking failed as the lightmap data resource is embedded in a foreign resource.
+ </constant>
+ <constant name="BAKE_ERROR_NO_LIGHTMAPPER" value="3" enum="BakeError">
Lightmap baking failed as there is no lightmapper available in this Godot build.
</constant>
- <constant name="BAKE_ERROR_NO_SAVE_PATH" value="2" enum="BakeError">
+ <constant name="BAKE_ERROR_NO_SAVE_PATH" value="4" enum="BakeError">
Lightmap baking failed as the [LightmapGIData] save path isn't configured in the resource.
</constant>
- <constant name="BAKE_ERROR_NO_MESHES" value="3" enum="BakeError">
+ <constant name="BAKE_ERROR_NO_MESHES" value="5" enum="BakeError">
Lightmap baking failed as there are no meshes whose [member GeometryInstance3D.gi_mode] is [constant GeometryInstance3D.GI_MODE_STATIC] and with valid UV2 mapping in the current scene. You may need to select 3D scenes in the Import dock and change their global illumination mode accordingly.
</constant>
- <constant name="BAKE_ERROR_MESHES_INVALID" value="4" enum="BakeError">
+ <constant name="BAKE_ERROR_MESHES_INVALID" value="6" enum="BakeError">
Lightmap baking failed as the lightmapper failed to analyze some of the meshes marked as static for baking.
</constant>
- <constant name="BAKE_ERROR_CANT_CREATE_IMAGE" value="5" enum="BakeError">
+ <constant name="BAKE_ERROR_CANT_CREATE_IMAGE" value="7" enum="BakeError">
Lightmap baking failed as the resulting image couldn't be saved or imported by Godot after it was saved.
</constant>
- <constant name="BAKE_ERROR_USER_ABORTED" value="6" enum="BakeError">
+ <constant name="BAKE_ERROR_USER_ABORTED" value="8" enum="BakeError">
The user aborted the lightmap baking operation (typically by clicking the [b]Cancel[/b] button in the progress dialog).
</constant>
<constant name="ENVIRONMENT_MODE_DISABLED" value="0" enum="EnvironmentMode">
diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml
index b8383aaed9..8ed8622030 100644
--- a/doc/classes/LineEdit.xml
+++ b/doc/classes/LineEdit.xml
@@ -61,6 +61,45 @@
<return type="PopupMenu" />
<description>
Returns the [PopupMenu] of this [LineEdit]. By default, this menu is displayed when right-clicking on the [LineEdit].
+ You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see [enum MenuItems]). For example:
+ [codeblocks]
+ [gdscript]
+ func _ready():
+ var menu = get_menu()
+ # Remove all items after "Redo".
+ menu.item_count = menu.get_item_index(MENU_REDO) + 1
+ # Add custom items.
+ menu.add_separator()
+ menu.add_item("Insert Date", MENU_MAX + 1)
+ # Connect callback.
+ menu.id_pressed.connect(_on_item_pressed)
+
+ func _on_item_pressed(id):
+ if id == MENU_MAX + 1:
+ insert_text_at_caret(Time.get_date_string_from_system())
+ [/gdscript]
+ [csharp]
+ public override void _Ready()
+ {
+ var menu = GetMenu();
+ // Remove all items after "Redo".
+ menu.ItemCount = menu.GetItemIndex(LineEdit.MenuItems.Redo) + 1;
+ // Add custom items.
+ menu.AddSeparator();
+ menu.AddItem("Insert Date", LineEdit.MenuItems.Max + 1);
+ // Add event handler.
+ menu.IdPressed += OnItemPressed;
+ }
+
+ public void OnItemPressed(int id)
+ {
+ if (id == LineEdit.MenuItems.Max + 1)
+ {
+ InsertTextAtCaret(Time.GetDateStringFromSystem());
+ }
+ }
+ [/csharp]
+ [/codeblocks]
[b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member Window.visible] property.
</description>
</method>
@@ -296,70 +335,76 @@
<constant name="MENU_REDO" value="6" enum="MenuItems">
Reverse the last undo action.
</constant>
- <constant name="MENU_DIR_INHERITED" value="7" enum="MenuItems">
+ <constant name="MENU_SUBMENU_TEXT_DIR" value="7" enum="MenuItems">
+ ID of "Text Writing Direction" submenu.
+ </constant>
+ <constant name="MENU_DIR_INHERITED" value="8" enum="MenuItems">
Sets text direction to inherited.
</constant>
- <constant name="MENU_DIR_AUTO" value="8" enum="MenuItems">
+ <constant name="MENU_DIR_AUTO" value="9" enum="MenuItems">
Sets text direction to automatic.
</constant>
- <constant name="MENU_DIR_LTR" value="9" enum="MenuItems">
+ <constant name="MENU_DIR_LTR" value="10" enum="MenuItems">
Sets text direction to left-to-right.
</constant>
- <constant name="MENU_DIR_RTL" value="10" enum="MenuItems">
+ <constant name="MENU_DIR_RTL" value="11" enum="MenuItems">
Sets text direction to right-to-left.
</constant>
- <constant name="MENU_DISPLAY_UCC" value="11" enum="MenuItems">
+ <constant name="MENU_DISPLAY_UCC" value="12" enum="MenuItems">
Toggles control character display.
</constant>
- <constant name="MENU_INSERT_LRM" value="12" enum="MenuItems">
+ <constant name="MENU_SUBMENU_INSERT_UCC" value="13" enum="MenuItems">
+ ID of "Insert Control Character" submenu.
+ </constant>
+ <constant name="MENU_INSERT_LRM" value="14" enum="MenuItems">
Inserts left-to-right mark (LRM) character.
</constant>
- <constant name="MENU_INSERT_RLM" value="13" enum="MenuItems">
+ <constant name="MENU_INSERT_RLM" value="15" enum="MenuItems">
Inserts right-to-left mark (RLM) character.
</constant>
- <constant name="MENU_INSERT_LRE" value="14" enum="MenuItems">
+ <constant name="MENU_INSERT_LRE" value="16" enum="MenuItems">
Inserts start of left-to-right embedding (LRE) character.
</constant>
- <constant name="MENU_INSERT_RLE" value="15" enum="MenuItems">
+ <constant name="MENU_INSERT_RLE" value="17" enum="MenuItems">
Inserts start of right-to-left embedding (RLE) character.
</constant>
- <constant name="MENU_INSERT_LRO" value="16" enum="MenuItems">
+ <constant name="MENU_INSERT_LRO" value="18" enum="MenuItems">
Inserts start of left-to-right override (LRO) character.
</constant>
- <constant name="MENU_INSERT_RLO" value="17" enum="MenuItems">
+ <constant name="MENU_INSERT_RLO" value="19" enum="MenuItems">
Inserts start of right-to-left override (RLO) character.
</constant>
- <constant name="MENU_INSERT_PDF" value="18" enum="MenuItems">
+ <constant name="MENU_INSERT_PDF" value="20" enum="MenuItems">
Inserts pop direction formatting (PDF) character.
</constant>
- <constant name="MENU_INSERT_ALM" value="19" enum="MenuItems">
+ <constant name="MENU_INSERT_ALM" value="21" enum="MenuItems">
Inserts Arabic letter mark (ALM) character.
</constant>
- <constant name="MENU_INSERT_LRI" value="20" enum="MenuItems">
+ <constant name="MENU_INSERT_LRI" value="22" enum="MenuItems">
Inserts left-to-right isolate (LRI) character.
</constant>
- <constant name="MENU_INSERT_RLI" value="21" enum="MenuItems">
+ <constant name="MENU_INSERT_RLI" value="23" enum="MenuItems">
Inserts right-to-left isolate (RLI) character.
</constant>
- <constant name="MENU_INSERT_FSI" value="22" enum="MenuItems">
+ <constant name="MENU_INSERT_FSI" value="24" enum="MenuItems">
Inserts first strong isolate (FSI) character.
</constant>
- <constant name="MENU_INSERT_PDI" value="23" enum="MenuItems">
+ <constant name="MENU_INSERT_PDI" value="25" enum="MenuItems">
Inserts pop direction isolate (PDI) character.
</constant>
- <constant name="MENU_INSERT_ZWJ" value="24" enum="MenuItems">
+ <constant name="MENU_INSERT_ZWJ" value="26" enum="MenuItems">
Inserts zero width joiner (ZWJ) character.
</constant>
- <constant name="MENU_INSERT_ZWNJ" value="25" enum="MenuItems">
+ <constant name="MENU_INSERT_ZWNJ" value="27" enum="MenuItems">
Inserts zero width non-joiner (ZWNJ) character.
</constant>
- <constant name="MENU_INSERT_WJ" value="26" enum="MenuItems">
+ <constant name="MENU_INSERT_WJ" value="28" enum="MenuItems">
Inserts word joiner (WJ) character.
</constant>
- <constant name="MENU_INSERT_SHY" value="27" enum="MenuItems">
+ <constant name="MENU_INSERT_SHY" value="29" enum="MenuItems">
Inserts soft hyphen (SHY) character.
</constant>
- <constant name="MENU_MAX" value="28" enum="MenuItems">
+ <constant name="MENU_MAX" value="30" enum="MenuItems">
Represents the size of the [enum MenuItems] enum.
</constant>
<constant name="KEYBOARD_TYPE_DEFAULT" value="0" enum="VirtualKeyboardType">
diff --git a/doc/classes/Marshalls.xml b/doc/classes/Marshalls.xml
index 102e4b75ed..1eeb0be7ce 100644
--- a/doc/classes/Marshalls.xml
+++ b/doc/classes/Marshalls.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Marshalls" inherits="Object" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
- Data transformation (marshalling) and encoding helpers.
+ Data transformation (marshaling) and encoding helpers.
</brief_description>
<description>
Provides data transformation and encoding utility functions.
diff --git a/doc/classes/Material.xml b/doc/classes/Material.xml
index c5d567c1fe..bdd5cee797 100644
--- a/doc/classes/Material.xml
+++ b/doc/classes/Material.xml
@@ -31,6 +31,12 @@
<description>
</description>
</method>
+ <method name="create_placeholder" qualifiers="const">
+ <return type="Resource" />
+ <description>
+ Creates a placeholder version of this resource ([PlaceholderMaterial]).
+ </description>
+ </method>
<method name="inspect_native_shader_code">
<return type="void" />
<description>
diff --git a/doc/classes/Mesh.xml b/doc/classes/Mesh.xml
index 94e80ffb2b..ece3199aab 100644
--- a/doc/classes/Mesh.xml
+++ b/doc/classes/Mesh.xml
@@ -114,6 +114,12 @@
[b]Note:[/b] This method typically returns the vertices in reverse order (e.g. clockwise to counterclockwise).
</description>
</method>
+ <method name="create_placeholder" qualifiers="const">
+ <return type="Resource" />
+ <description>
+ Creates a placeholder version of this resource ([PlaceholderMesh]).
+ </description>
+ </method>
<method name="create_trimesh_shape" qualifiers="const">
<return type="ConcavePolygonShape3D" />
<description>
@@ -227,10 +233,10 @@
Contains custom color channel 3. [PackedByteArray] if [code](format &gt;&gt; [constant ARRAY_FORMAT_CUSTOM3_SHIFT]) &amp; [constant ARRAY_FORMAT_CUSTOM_MASK])[/code] is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RG_HALF] or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise.
</constant>
<constant name="ARRAY_BONES" value="10" enum="ArrayType">
- [PackedFloat32Array] or [PackedInt32Array] of bone indices. Each element is a group of 4 numbers.
+ [PackedFloat32Array] or [PackedInt32Array] of bone indices. Contains either 4 or 8 numbers per vertex depending on the presence of the [constant ARRAY_FLAG_USE_8_BONE_WEIGHTS] flag.
</constant>
<constant name="ARRAY_WEIGHTS" value="11" enum="ArrayType">
- [PackedFloat32Array] of bone weights. Each element in groups of 4 floats.
+ [PackedFloat32Array] or [PackedFloat64Array] of bone weights in the range [code]0.0[/code] to [code]1.0[/code] (inclusive). Contains either 4 or 8 numbers per vertex depending on the presence of the [constant ARRAY_FLAG_USE_8_BONE_WEIGHTS] flag.
</constant>
<constant name="ARRAY_INDEX" value="12" enum="ArrayType">
[PackedInt32Array] of integers used as indices referencing vertices, colors, normals, tangents, and textures. All of those arrays must have the same number of elements as the vertex array. No index can be beyond the vertex array size. When this index array is present, it puts the function into "index mode," where the index selects the *i*'th vertex, normal, tangent, color, UV, etc. This means if you want to have different normals or colors along an edge, you have to duplicate the vertices.
@@ -341,6 +347,9 @@
<constant name="ARRAY_FLAG_USE_8_BONE_WEIGHTS" value="134217728" enum="ArrayFormat" is_bitfield="true">
Flag used to mark that the mesh contains up to 8 bone influences per vertex. This flag indicates that [constant ARRAY_BONES] and [constant ARRAY_WEIGHTS] elements will have double length.
</constant>
+ <constant name="ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY" value="268435456" enum="ArrayFormat" is_bitfield="true">
+ Flag used to mark that the mesh intentionally contains no vertex array.
+ </constant>
<constant name="BLEND_SHAPE_MODE_NORMALIZED" value="0" enum="BlendShapeMode">
Blend shapes are normalized.
</constant>
diff --git a/doc/classes/MultiplayerAPI.xml b/doc/classes/MultiplayerAPI.xml
index 3ce6ce41b4..020ce4f468 100644
--- a/doc/classes/MultiplayerAPI.xml
+++ b/doc/classes/MultiplayerAPI.xml
@@ -138,10 +138,10 @@
Used with [method Node.rpc_config] to disable a method or property for all RPC calls, making it unavailable. Default for all methods.
</constant>
<constant name="RPC_MODE_ANY_PEER" value="1" enum="RPCMode">
- Used with [method Node.rpc_config] to set a method to be callable remotely by any peer. Analogous to the [code]@rpc(any)[/code] annotation. Calls are accepted from all remote peers, no matter if they are node's authority or not.
+ Used with [method Node.rpc_config] to set a method to be callable remotely by any peer. Analogous to the [code]@rpc("any")[/code] annotation. Calls are accepted from all remote peers, no matter if they are node's authority or not.
</constant>
<constant name="RPC_MODE_AUTHORITY" value="2" enum="RPCMode">
- Used with [method Node.rpc_config] to set a method to be callable remotely only by the current multiplayer authority (which is the server by default). Analogous to the [code]@rpc(authority)[/code] annotation. See [method Node.set_multiplayer_authority].
+ Used with [method Node.rpc_config] to set a method to be callable remotely only by the current multiplayer authority (which is the server by default). Analogous to the [code]@rpc("authority")[/code] annotation. See [method Node.set_multiplayer_authority].
</constant>
</constants>
</class>
diff --git a/doc/classes/Mutex.xml b/doc/classes/Mutex.xml
index 74f29bdc48..78694ce813 100644
--- a/doc/classes/Mutex.xml
+++ b/doc/classes/Mutex.xml
@@ -18,9 +18,9 @@
</description>
</method>
<method name="try_lock">
- <return type="int" enum="Error" />
+ <return type="bool" />
<description>
- Tries locking this [Mutex], but does not block. Returns [constant OK] on success, [constant ERR_BUSY] otherwise.
+ Tries locking this [Mutex], but does not block. Returns [code]true[/code] on success, [code]false[/code] otherwise.
[b]Note:[/b] This function returns [constant OK] if the thread already has ownership of the mutex.
</description>
</method>
diff --git a/doc/classes/NavigationAgent2D.xml b/doc/classes/NavigationAgent2D.xml
index b561748b30..6ae4dc4177 100644
--- a/doc/classes/NavigationAgent2D.xml
+++ b/doc/classes/NavigationAgent2D.xml
@@ -4,8 +4,8 @@
2D Agent used in navigation for collision avoidance.
</brief_description>
<description>
- 2D Agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. [NavigationAgent2D] is physics safe.
- [b]Note:[/b] After setting [member target_location] it is required to use the [method get_next_location] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node.
+ 2D Agent that is used in navigation to reach a position while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. [NavigationAgent2D] is physics safe.
+ [b]Note:[/b] After setting [member target_position] it is required to use the [method get_next_path_position] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node.
</description>
<tutorials>
<link title="Using NavigationAgents">$DOCS_URL/tutorials/navigation/navigation_using_navigationagents.html</link>
@@ -14,13 +14,13 @@
<method name="distance_to_target" qualifiers="const">
<return type="float" />
<description>
- Returns the distance to the target location, using the agent's global position. The user must set [member target_location] in order for this to be accurate.
+ Returns the distance to the target position, using the agent's global position. The user must set [member target_position] in order for this to be accurate.
</description>
</method>
<method name="get_current_navigation_path" qualifiers="const">
<return type="PackedVector2Array" />
<description>
- Returns this agent's current path from start to finish in global coordinates. The path only updates when the target location is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_location] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic.
+ Returns this agent's current path from start to finish in global coordinates. The path only updates when the target position is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_path_position] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic.
</description>
</method>
<method name="get_current_navigation_path_index" qualifiers="const">
@@ -35,10 +35,10 @@
Returns the path query result for the path the agent is currently following.
</description>
</method>
- <method name="get_final_location">
+ <method name="get_final_position">
<return type="Vector2" />
<description>
- Returns the reachable final location in global coordinates. This can change if the navigation path is altered in any way. Because of this, it would be best to check this each frame.
+ Returns the reachable final position in global coordinates. This can change if the navigation path is altered in any way. Because of this, it would be best to check this each frame.
</description>
</method>
<method name="get_navigation_layer_value" qualifiers="const">
@@ -54,10 +54,10 @@
Returns the [RID] of the navigation map for this NavigationAgent node. This function returns always the map set on the NavigationAgent node and not the map of the abstract agent on the NavigationServer. If the agent map is changed directly with the NavigationServer API the NavigationAgent node will not be aware of the map change. Use [method set_navigation_map] to change the navigation map for the NavigationAgent and also update the agent on the NavigationServer.
</description>
</method>
- <method name="get_next_location">
+ <method name="get_next_path_position">
<return type="Vector2" />
<description>
- Returns the next location in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent.
+ Returns the next position in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent.
</description>
</method>
<method name="get_rid" qualifiers="const">
@@ -69,19 +69,19 @@
<method name="is_navigation_finished">
<return type="bool" />
<description>
- Returns true if the navigation path's final location has been reached.
+ Returns true if the navigation path's final position has been reached.
</description>
</method>
<method name="is_target_reachable">
<return type="bool" />
<description>
- Returns true if [member target_location] is reachable.
+ Returns true if [member target_position] is reachable.
</description>
</method>
<method name="is_target_reached" qualifiers="const">
<return type="bool" />
<description>
- Returns true if [member target_location] is reached. It may not always be possible to reach the target location. It should always be possible to reach the final location though. See [method get_final_location].
+ Returns true if [member target_position] is reached. It may not always be possible to reach the target position. It should always be possible to reach the final position though. See [method get_final_position].
</description>
</method>
<method name="set_navigation_layer_value">
@@ -127,7 +127,7 @@
The distance threshold before a path point is considered to be reached. This will allow an agent to not have to hit a path point on the path exactly, but in the area. If this value is set to high the NavigationAgent will skip points on the path which can lead to leaving the navigation mesh. If this value is set to low the NavigationAgent will be stuck in a repath loop cause it will constantly overshoot or undershoot the distance to the next point on each physics frame update.
</member>
<member name="path_max_distance" type="float" setter="set_path_max_distance" getter="get_path_max_distance" default="100.0">
- The maximum distance the agent is allowed away from the ideal path to the final location. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path.
+ The maximum distance the agent is allowed away from the ideal path to the final position. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path.
</member>
<member name="path_metadata_flags" type="int" setter="set_path_metadata_flags" getter="get_path_metadata_flags" enum="NavigationPathQueryParameters2D.PathMetadataFlags" default="7">
Additional information to return with the navigation path.
@@ -139,8 +139,8 @@
<member name="target_desired_distance" type="float" setter="set_target_desired_distance" getter="get_target_desired_distance" default="10.0">
The distance threshold before the final target point is considered to be reached. This will allow an agent to not have to hit the point of the final target exactly, but only the area. If this value is set to low the NavigationAgent will be stuck in a repath loop cause it will constantly overshoot or undershoot the distance to the final target point on each physics frame update.
</member>
- <member name="target_location" type="Vector2" setter="set_target_location" getter="get_target_location" default="Vector2(0, 0)">
- The user-defined target location. Setting this property will clear the current navigation path.
+ <member name="target_position" type="Vector2" setter="set_target_position" getter="get_target_position" default="Vector2(0, 0)">
+ The user-defined target position. Setting this property will clear the current navigation path.
</member>
<member name="time_horizon" type="float" setter="set_time_horizon" getter="get_time_horizon" default="1.0">
The minimal amount of time for which this agent's velocities, that are computed with the collision avoidance algorithm, are safe with respect to other agents. The larger the number, the sooner the agent will respond to other agents, but less freedom in choosing its velocities. Must be positive.
@@ -152,7 +152,7 @@
<description>
Notifies when a navigation link has been reached.
The details dictionary may contain the following keys depending on the value of [member path_metadata_flags]:
- - [code]location[/code]: The start location of the link that was reached.
+ - [code]position[/code]: The start position of the link that was reached.
- [code]type[/code]: Always [constant NavigationPathQueryResult2D.PATH_SEGMENT_TYPE_LINK].
- [code]rid[/code]: The [RID] of the link.
- [code]owner[/code]: The object which manages the link (usually [NavigationLink2D]).
@@ -160,7 +160,7 @@
</signal>
<signal name="navigation_finished">
<description>
- Notifies when the final location is reached.
+ Notifies when the final position is reached.
</description>
</signal>
<signal name="path_changed">
@@ -170,7 +170,7 @@
</signal>
<signal name="target_reached">
<description>
- Notifies when the player-defined [member target_location] is reached.
+ Notifies when the player-defined [member target_position] is reached.
</description>
</signal>
<signal name="velocity_computed">
@@ -184,7 +184,7 @@
<description>
Notifies when a waypoint along the path has been reached.
The details dictionary may contain the following keys depending on the value of [member path_metadata_flags]:
- - [code]location[/code]: The location of the waypoint that was reached.
+ - [code]position[/code]: The position of the waypoint that was reached.
- [code]type[/code]: The type of navigation primitive (region or link) that contains this waypoint.
- [code]rid[/code]: The [RID] of the containing navigation primitive (region or link).
- [code]owner[/code]: The object which manages the containing navigation primitive (region or link).
diff --git a/doc/classes/NavigationAgent3D.xml b/doc/classes/NavigationAgent3D.xml
index a1b007ee56..a22cd6dd46 100644
--- a/doc/classes/NavigationAgent3D.xml
+++ b/doc/classes/NavigationAgent3D.xml
@@ -4,8 +4,8 @@
3D Agent used in navigation for collision avoidance.
</brief_description>
<description>
- 3D Agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. [NavigationAgent3D] is physics safe.
- [b]Note:[/b] After setting [member target_location] it is required to use the [method get_next_location] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node.
+ 3D Agent that is used in navigation to reach a position while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. [NavigationAgent3D] is physics safe.
+ [b]Note:[/b] After setting [member target_position] it is required to use the [method get_next_path_position] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node.
</description>
<tutorials>
<link title="Using NavigationAgents">$DOCS_URL/tutorials/navigation/navigation_using_navigationagents.html</link>
@@ -14,13 +14,13 @@
<method name="distance_to_target" qualifiers="const">
<return type="float" />
<description>
- Returns the distance to the target location, using the agent's global position. The user must set [member target_location] in order for this to be accurate.
+ Returns the distance to the target position, using the agent's global position. The user must set [member target_position] in order for this to be accurate.
</description>
</method>
<method name="get_current_navigation_path" qualifiers="const">
<return type="PackedVector3Array" />
<description>
- Returns this agent's current path from start to finish in global coordinates. The path only updates when the target location is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_location] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic.
+ Returns this agent's current path from start to finish in global coordinates. The path only updates when the target position is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_path_position] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic.
</description>
</method>
<method name="get_current_navigation_path_index" qualifiers="const">
@@ -35,10 +35,10 @@
Returns the path query result for the path the agent is currently following.
</description>
</method>
- <method name="get_final_location">
+ <method name="get_final_position">
<return type="Vector3" />
<description>
- Returns the reachable final location in global coordinates. This can change if the navigation path is altered in any way. Because of this, it would be best to check this each frame.
+ Returns the reachable final position in global coordinates. This can change if the navigation path is altered in any way. Because of this, it would be best to check this each frame.
</description>
</method>
<method name="get_navigation_layer_value" qualifiers="const">
@@ -54,10 +54,10 @@
Returns the [RID] of the navigation map for this NavigationAgent node. This function returns always the map set on the NavigationAgent node and not the map of the abstract agent on the NavigationServer. If the agent map is changed directly with the NavigationServer API the NavigationAgent node will not be aware of the map change. Use [method set_navigation_map] to change the navigation map for the NavigationAgent and also update the agent on the NavigationServer.
</description>
</method>
- <method name="get_next_location">
+ <method name="get_next_path_position">
<return type="Vector3" />
<description>
- Returns the next location in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent.
+ Returns the next position in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent.
</description>
</method>
<method name="get_rid" qualifiers="const">
@@ -69,19 +69,19 @@
<method name="is_navigation_finished">
<return type="bool" />
<description>
- Returns true if the navigation path's final location has been reached.
+ Returns true if the navigation path's final position has been reached.
</description>
</method>
<method name="is_target_reachable">
<return type="bool" />
<description>
- Returns true if [member target_location] is reachable.
+ Returns true if [member target_position] is reachable.
</description>
</method>
<method name="is_target_reached" qualifiers="const">
<return type="bool" />
<description>
- Returns true if [member target_location] is reached. It may not always be possible to reach the target location. It should always be possible to reach the final location though. See [method get_final_location].
+ Returns true if [member target_position] is reached. It may not always be possible to reach the target position. It should always be possible to reach the final position though. See [method get_final_position].
</description>
</method>
<method name="set_navigation_layer_value">
@@ -133,7 +133,7 @@
The distance threshold before a path point is considered to be reached. This will allow an agent to not have to hit a path point on the path exactly, but in the area. If this value is set to high the NavigationAgent will skip points on the path which can lead to leaving the navigation mesh. If this value is set to low the NavigationAgent will be stuck in a repath loop cause it will constantly overshoot or undershoot the distance to the next point on each physics frame update.
</member>
<member name="path_max_distance" type="float" setter="set_path_max_distance" getter="get_path_max_distance" default="3.0">
- The maximum distance the agent is allowed away from the ideal path to the final location. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path.
+ The maximum distance the agent is allowed away from the ideal path to the final position. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path.
</member>
<member name="path_metadata_flags" type="int" setter="set_path_metadata_flags" getter="get_path_metadata_flags" enum="NavigationPathQueryParameters3D.PathMetadataFlags" default="7">
Additional information to return with the navigation path.
@@ -145,8 +145,8 @@
<member name="target_desired_distance" type="float" setter="set_target_desired_distance" getter="get_target_desired_distance" default="1.0">
The distance threshold before the final target point is considered to be reached. This will allow an agent to not have to hit the point of the final target exactly, but only the area. If this value is set to low the NavigationAgent will be stuck in a repath loop cause it will constantly overshoot or undershoot the distance to the final target point on each physics frame update.
</member>
- <member name="target_location" type="Vector3" setter="set_target_location" getter="get_target_location" default="Vector3(0, 0, 0)">
- The user-defined target location. Setting this property will clear the current navigation path.
+ <member name="target_position" type="Vector3" setter="set_target_position" getter="get_target_position" default="Vector3(0, 0, 0)">
+ The user-defined target position. Setting this property will clear the current navigation path.
</member>
<member name="time_horizon" type="float" setter="set_time_horizon" getter="get_time_horizon" default="5.0">
The minimal amount of time for which this agent's velocities, that are computed with the collision avoidance algorithm, are safe with respect to other agents. The larger the number, the sooner the agent will respond to other agents, but less freedom in choosing its velocities. Must be positive.
@@ -158,7 +158,7 @@
<description>
Notifies when a navigation link has been reached.
The details dictionary may contain the following keys depending on the value of [member path_metadata_flags]:
- - [code]location[/code]: The start location of the link that was reached.
+ - [code]position[/code]: The start position of the link that was reached.
- [code]type[/code]: Always [constant NavigationPathQueryResult3D.PATH_SEGMENT_TYPE_LINK].
- [code]rid[/code]: The [RID] of the link.
- [code]owner[/code]: The object which manages the link (usually [NavigationLink3D]).
@@ -166,7 +166,7 @@
</signal>
<signal name="navigation_finished">
<description>
- Notifies when the final location is reached.
+ Notifies when the final position is reached.
</description>
</signal>
<signal name="path_changed">
@@ -176,7 +176,7 @@
</signal>
<signal name="target_reached">
<description>
- Notifies when the player-defined [member target_location] is reached.
+ Notifies when the player-defined [member target_position] is reached.
</description>
</signal>
<signal name="velocity_computed">
@@ -190,7 +190,7 @@
<description>
Notifies when a waypoint along the path has been reached.
The details dictionary may contain the following keys depending on the value of [member path_metadata_flags]:
- - [code]location[/code]: The location of the waypoint that was reached.
+ - [code]position[/code]: The position of the waypoint that was reached.
- [code]type[/code]: The type of navigation primitive (region or link) that contains this waypoint.
- [code]rid[/code]: The [RID] of the containing navigation primitive (region or link).
- [code]owner[/code]: The object which manages the containing navigation primitive (region or link).
diff --git a/doc/classes/NavigationLink2D.xml b/doc/classes/NavigationLink2D.xml
index 44d2110a7c..b3f4367675 100644
--- a/doc/classes/NavigationLink2D.xml
+++ b/doc/classes/NavigationLink2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="NavigationLink2D" inherits="Node2D" is_experimental="true" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
- Creates a link between two locations that [NavigationServer2D] can route agents through.
+ Creates a link between two positions that [NavigationServer2D] can route agents through.
</brief_description>
<description>
- Creates a link between two locations that [NavigationServer2D] can route agents through. Links can be used to express navigation methods that aren't just traveling along the surface of the navigation mesh, like zip-lines, teleporters, or jumping across gaps.
+ Creates a link between two positions that [NavigationServer2D] can route agents through. Links can be used to express navigation methods that aren't just traveling along the surface of the navigation mesh, like zip-lines, teleporters, or jumping across gaps.
</description>
<tutorials>
<link title="Using NavigationLinks">$DOCS_URL/tutorials/navigation/navigation_using_navigationlinks.html</link>
@@ -28,12 +28,12 @@
</methods>
<members>
<member name="bidirectional" type="bool" setter="set_bidirectional" getter="is_bidirectional" default="true">
- Whether this link can be traveled in both directions or only from [member start_location] to [member end_location].
+ Whether this link can be traveled in both directions or only from [member start_position] to [member end_position].
</member>
<member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true">
Whether this link is currently active. If [code]false[/code], [method NavigationServer2D.map_get_path] will ignore this link.
</member>
- <member name="end_location" type="Vector2" setter="set_end_location" getter="get_end_location" default="Vector2(0, 0)">
+ <member name="end_position" type="Vector2" setter="set_end_position" getter="get_end_position" default="Vector2(0, 0)">
Ending position of the link.
This position will search out the nearest polygon in the navigation mesh to attach to.
The distance the link will search is controlled by [method NavigationServer2D.map_set_link_connection_radius].
@@ -44,7 +44,7 @@
<member name="navigation_layers" type="int" setter="set_navigation_layers" getter="get_navigation_layers" default="1">
A bitfield determining all navigation layers the link belongs to. These navigation layers will be checked when requesting a path with [method NavigationServer2D.map_get_path].
</member>
- <member name="start_location" type="Vector2" setter="set_start_location" getter="get_start_location" default="Vector2(0, 0)">
+ <member name="start_position" type="Vector2" setter="set_start_position" getter="get_start_position" default="Vector2(0, 0)">
Starting position of the link.
This position will search out the nearest polygon in the navigation mesh to attach to.
The distance the link will search is controlled by [method NavigationServer2D.map_set_link_connection_radius].
diff --git a/doc/classes/NavigationLink3D.xml b/doc/classes/NavigationLink3D.xml
index 4aa5801afb..4dff226042 100644
--- a/doc/classes/NavigationLink3D.xml
+++ b/doc/classes/NavigationLink3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="NavigationLink3D" inherits="Node3D" is_experimental="true" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
- Creates a link between two locations that [NavigationServer3D] can route agents through.
+ Creates a link between two positions that [NavigationServer3D] can route agents through.
</brief_description>
<description>
- Creates a link between two locations that [NavigationServer3D] can route agents through. Links can be used to express navigation methods that aren't just traveling along the surface of the navigation mesh, like zip-lines, teleporters, or jumping across gaps.
+ Creates a link between two positions that [NavigationServer3D] can route agents through. Links can be used to express navigation methods that aren't just traveling along the surface of the navigation mesh, like zip-lines, teleporters, or jumping across gaps.
</description>
<tutorials>
<link title="Using NavigationLinks">$DOCS_URL/tutorials/navigation/navigation_using_navigationlinks.html</link>
@@ -28,12 +28,12 @@
</methods>
<members>
<member name="bidirectional" type="bool" setter="set_bidirectional" getter="is_bidirectional" default="true">
- Whether this link can be traveled in both directions or only from [member start_location] to [member end_location].
+ Whether this link can be traveled in both directions or only from [member start_position] to [member end_position].
</member>
<member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true">
Whether this link is currently active. If [code]false[/code], [method NavigationServer3D.map_get_path] will ignore this link.
</member>
- <member name="end_location" type="Vector3" setter="set_end_location" getter="get_end_location" default="Vector3(0, 0, 0)">
+ <member name="end_position" type="Vector3" setter="set_end_position" getter="get_end_position" default="Vector3(0, 0, 0)">
Ending position of the link.
This position will search out the nearest polygon in the navigation mesh to attach to.
The distance the link will search is controlled by [method NavigationServer3D.map_set_link_connection_radius].
@@ -44,7 +44,7 @@
<member name="navigation_layers" type="int" setter="set_navigation_layers" getter="get_navigation_layers" default="1">
A bitfield determining all navigation layers the link belongs to. These navigation layers will be checked when requesting a path with [method NavigationServer3D.map_get_path].
</member>
- <member name="start_location" type="Vector3" setter="set_start_location" getter="get_start_location" default="Vector3(0, 0, 0)">
+ <member name="start_position" type="Vector3" setter="set_start_position" getter="get_start_position" default="Vector3(0, 0, 0)">
Starting position of the link.
This position will search out the nearest polygon in the navigation mesh to attach to.
The distance the link will search is controlled by [method NavigationServer3D.map_set_link_connection_radius].
diff --git a/doc/classes/NavigationServer2D.xml b/doc/classes/NavigationServer2D.xml
index 1ba949b294..16f6de5238 100644
--- a/doc/classes/NavigationServer2D.xml
+++ b/doc/classes/NavigationServer2D.xml
@@ -41,12 +41,10 @@
<method name="agent_set_callback">
<return type="void" />
<param index="0" name="agent" type="RID" />
- <param index="1" name="object_id" type="int" />
- <param index="2" name="method" type="StringName" />
- <param index="3" name="userdata" type="Variant" default="null" />
+ <param index="1" name="callback" type="Callable" />
<description>
- Sets the callback [param object_id] and [param method] that gets called after each avoidance processing step for the [param agent]. The calculated [code]safe_velocity[/code] will be dispatched with a signal to the object just before the physics calculations.
- [b]Note:[/b] Created callbacks are always processed independently of the SceneTree state as long as the agent is on a navigation map and not freed. To disable the dispatch of a callback from an agent use [method agent_set_callback] again with a [code]0[/code] ObjectID as the [param object_id].
+ Sets the callback that gets called after each avoidance processing step for the [param agent]. The calculated [code]safe_velocity[/code] will be passed as the first parameter just before the physics calculations.
+ [b]Note:[/b] Created callbacks are always processed independently of the SceneTree state as long as the agent is on a navigation map and not freed. To disable the dispatch of a callback from an agent use [method agent_set_callback] again with an empty [Callable].
</description>
</method>
<method name="agent_set_map">
@@ -137,14 +135,14 @@
<method name="link_create">
<return type="RID" />
<description>
- Create a new link between two locations on a map.
+ Create a new link between two positions on a map.
</description>
</method>
- <method name="link_get_end_location" qualifiers="const">
+ <method name="link_get_end_position" qualifiers="const">
<return type="Vector2" />
<param index="0" name="link" type="RID" />
<description>
- Returns the ending location of this [code]link[/code].
+ Returns the ending position of this [code]link[/code].
</description>
</method>
<method name="link_get_enter_cost" qualifiers="const">
@@ -175,11 +173,11 @@
Returns the [code]ObjectID[/code] of the object which manages this link.
</description>
</method>
- <method name="link_get_start_location" qualifiers="const">
+ <method name="link_get_start_position" qualifiers="const">
<return type="Vector2" />
<param index="0" name="link" type="RID" />
<description>
- Returns the starting location of this [code]link[/code].
+ Returns the starting position of this [code]link[/code].
</description>
</method>
<method name="link_get_travel_cost" qualifiers="const">
@@ -204,12 +202,12 @@
Sets whether this [code]link[/code] can be travelled in both directions.
</description>
</method>
- <method name="link_set_end_location">
+ <method name="link_set_end_position">
<return type="void" />
<param index="0" name="link" type="RID" />
- <param index="1" name="location" type="Vector2" />
+ <param index="1" name="position" type="Vector2" />
<description>
- Sets the exit location for the [code]link[/code].
+ Sets the exit position for the [code]link[/code].
</description>
</method>
<method name="link_set_enter_cost">
@@ -244,12 +242,12 @@
Set the [code]ObjectID[/code] of the object which manages this link.
</description>
</method>
- <method name="link_set_start_location">
+ <method name="link_set_start_position">
<return type="void" />
<param index="0" name="link" type="RID" />
- <param index="1" name="location" type="Vector2" />
+ <param index="1" name="position" type="Vector2" />
<description>
- Sets the entry location for this [code]link[/code].
+ Sets the entry position for this [code]link[/code].
</description>
</method>
<method name="link_set_travel_cost">
diff --git a/doc/classes/NavigationServer3D.xml b/doc/classes/NavigationServer3D.xml
index e007c71342..340821d41e 100644
--- a/doc/classes/NavigationServer3D.xml
+++ b/doc/classes/NavigationServer3D.xml
@@ -41,12 +41,10 @@
<method name="agent_set_callback">
<return type="void" />
<param index="0" name="agent" type="RID" />
- <param index="1" name="object_id" type="int" />
- <param index="2" name="method" type="StringName" />
- <param index="3" name="userdata" type="Variant" default="null" />
+ <param index="1" name="callback" type="Callable" />
<description>
- Sets the callback [param object_id] and [param method] that gets called after each avoidance processing step for the [param agent]. The calculated [code]safe_velocity[/code] will be dispatched with a signal to the object just before the physics calculations.
- [b]Note:[/b] Created callbacks are always processed independently of the SceneTree state as long as the agent is on a navigation map and not freed. To disable the dispatch of a callback from an agent use [method agent_set_callback] again with a [code]0[/code] ObjectID as the [param object_id].
+ Sets the callback that gets called after each avoidance processing step for the [param agent]. The calculated [code]safe_velocity[/code] will be passed as the first parameter just before the physics calculations.
+ [b]Note:[/b] Created callbacks are always processed independently of the SceneTree state as long as the agent is on a navigation map and not freed. To disable the dispatch of a callback from an agent use [method agent_set_callback] again with an empty [Callable].
</description>
</method>
<method name="agent_set_map">
@@ -144,14 +142,14 @@
<method name="link_create">
<return type="RID" />
<description>
- Create a new link between two locations on a map.
+ Create a new link between two positions on a map.
</description>
</method>
- <method name="link_get_end_location" qualifiers="const">
+ <method name="link_get_end_position" qualifiers="const">
<return type="Vector3" />
<param index="0" name="link" type="RID" />
<description>
- Returns the ending location of this [code]link[/code].
+ Returns the ending position of this [code]link[/code].
</description>
</method>
<method name="link_get_enter_cost" qualifiers="const">
@@ -182,11 +180,11 @@
Returns the [code]ObjectID[/code] of the object which manages this link.
</description>
</method>
- <method name="link_get_start_location" qualifiers="const">
+ <method name="link_get_start_position" qualifiers="const">
<return type="Vector3" />
<param index="0" name="link" type="RID" />
<description>
- Returns the starting location of this [code]link[/code].
+ Returns the starting position of this [code]link[/code].
</description>
</method>
<method name="link_get_travel_cost" qualifiers="const">
@@ -211,12 +209,12 @@
Sets whether this [code]link[/code] can be travelled in both directions.
</description>
</method>
- <method name="link_set_end_location">
+ <method name="link_set_end_position">
<return type="void" />
<param index="0" name="link" type="RID" />
- <param index="1" name="location" type="Vector3" />
+ <param index="1" name="position" type="Vector3" />
<description>
- Sets the exit location for the [code]link[/code].
+ Sets the exit position for the [code]link[/code].
</description>
</method>
<method name="link_set_enter_cost">
@@ -251,12 +249,12 @@
Set the [code]ObjectID[/code] of the object which manages this link.
</description>
</method>
- <method name="link_set_start_location">
+ <method name="link_set_start_position">
<return type="void" />
<param index="0" name="link" type="RID" />
- <param index="1" name="location" type="Vector3" />
+ <param index="1" name="position" type="Vector3" />
<description>
- Sets the entry location for this [code]link[/code].
+ Sets the entry position for this [code]link[/code].
</description>
</method>
<method name="link_set_travel_cost">
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index 02fd6dae30..7c40c189c0 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -666,7 +666,7 @@
channel = 0,
}
[/codeblock]
- See [enum MultiplayerAPI.RPCMode] and [enum MultiplayerPeer.TransferMode]. An alternative is annotating methods and properties with the corresponding annotation ([code]@rpc(any)[/code], [code]@rpc(authority)[/code]). By default, methods are not exposed to networking (and RPCs).
+ See [enum MultiplayerAPI.RPCMode] and [enum MultiplayerPeer.TransferMode]. An alternative is annotating methods and properties with the corresponding annotation ([code]@rpc("any")[/code], [code]@rpc("authority")[/code]). By default, methods are not exposed to networking (and RPCs).
</description>
</method>
<method name="rpc_id" qualifiers="vararg">
@@ -909,6 +909,9 @@
<constant name="NOTIFICATION_ENABLED" value="29">
Notification received when the node is enabled again after being disabled. See [constant PROCESS_MODE_DISABLED].
</constant>
+ <constant name="NOTIFICATION_NODE_RECACHE_REQUESTED" value="30">
+ Notification received when other nodes in the tree may have been removed/replaced and node pointers may require re-caching.
+ </constant>
<constant name="NOTIFICATION_EDITOR_PRE_SAVE" value="9001">
Notification received right before the scene with the node is saved in the editor. This notification is only sent in the Godot editor and will not occur in exported projects.
</constant>
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index 1bc81ffb42..04895c28a8 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -498,7 +498,7 @@
<description>
Returns [code]true[/code] if the Godot binary used to run the project is a [i]debug[/i] export template, or when running in the editor.
Returns [code]false[/code] if the Godot binary used to run the project is a [i]release[/i] export template.
- To check whether the Godot binary used to run the project is an export template (debug or release), use [code]OS.has_feature("standalone")[/code] instead.
+ To check whether the Godot binary used to run the project is an export template (debug or release), use [code]OS.has_feature("template")[/code] instead.
</description>
</method>
<method name="is_keycode_unicode" qualifiers="const">
@@ -566,7 +566,7 @@
<method name="open_midi_inputs">
<return type="void" />
<description>
- Initialises the singleton for the system MIDI driver.
+ Initializes the singleton for the system MIDI driver.
[b]Note:[/b] This method is implemented on Linux, macOS and Windows.
</description>
</method>
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index a9e17f4666..e4607456ca 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -305,7 +305,7 @@
[/gdscript]
[csharp]
var node = new Node3D();
- node.Call("rotate", new Vector3(1f, 0f, 0f), 1.571f);
+ node.Call(Node3D.MethodName.Rotate, new Vector3(1f, 0f, 0f), 1.571f);
[/csharp]
[/codeblocks]
[b]Note:[/b] In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the [code]MethodName[/code] class to avoid allocating a new [StringName] on each call.
@@ -323,7 +323,7 @@
[/gdscript]
[csharp]
var node = new Node3D();
- node.CallDeferred("rotate", new Vector3(1f, 0f, 0f), 1.571f);
+ node.CallDeferred(Node3D.MethodName.Rotate, new Vector3(1f, 0f, 0f), 1.571f);
[/csharp]
[/codeblocks]
[b]Note:[/b] In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the [code]MethodName[/code] class to avoid allocating a new [StringName] on each call.
@@ -342,7 +342,7 @@
[/gdscript]
[csharp]
var node = new Node3D();
- node.Callv("rotate", new Godot.Collections.Array { new Vector3(1f, 0f, 0f), 1.571f });
+ node.Callv(Node3D.MethodName.Rotate, new Godot.Collections.Array { new Vector3(1f, 0f, 0f), 1.571f });
[/csharp]
[/codeblocks]
[b]Note:[/b] In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the [code]MethodName[/code] class to avoid allocating a new [StringName] on each call
@@ -394,8 +394,8 @@
// This assumes that a `Player` class exists, which defines a `Hit` signal.
var player = new Player();
- // Signals as events (`player.Hit += OnPlayerHit;`) do not support argument binding. You have to use:
- player.Hit.Connect(OnPlayerHit, new Godot.Collections.Array {"sword", 100 });
+ // We can use lambdas when we need to bind additional parameters.
+ player.Hit += () =&gt; OnPlayerHit("sword", 100);
}
private void OnButtonDown()
@@ -405,7 +405,7 @@
private void OnPlayerHit(string weaponType, int damage)
{
- GD.Print(String.Format("Hit with weapon {0} for {1} damage.", weaponType, damage));
+ GD.Print($"Hit with weapon {weaponType} for {damage} damage.");
}
[/csharp]
[/codeblocks]
@@ -431,16 +431,12 @@
public override void _Ready()
{
var button = new Button();
- // Option 1: Object.Connect() with an implicit Callable for the defined function.
- button.Connect("button_down", OnButtonDown);
- // Option 2: Object.connect() with a constructed Callable using a target object and method name.
- button.Connect("button_down", new Callable(self, nameof(OnButtonDown)));
- // Option 3: Signal.connect() with an implicit Callable for the defined function.
- button.ButtonDown.Connect(OnButtonDown);
- // Option 3b: In C#, we can use signals as events and connect with this more idiomatic syntax:
+ // Option 1: In C#, we can use signals as events and connect with this idiomatic syntax:
button.ButtonDown += OnButtonDown;
- // Option 4: Signal.connect() with a constructed Callable using a target object and method name.
- button.ButtonDown.Connect(new Callable(self, nameof(OnButtonDown)));
+ // Option 2: Object.Connect() with a constructed Callable from a method group.
+ button.Connect(Button.SignalName.ButtonDown, Callable.From(OnButtonDown));
+ // Option 3: Object.Connect() with a constructed Callable using a target object and method name.
+ button.Connect(Button.SignalName.ButtonDown, new Callable(this, MethodName.OnButtonDown));
}
private void OnButtonDown()
@@ -458,6 +454,7 @@
func _ready():
# This assumes that a `Player` class exists, which defines a `hit` signal.
var player = Player.new()
+ # Using Callable.bind().
player.hit.connect(_on_player_hit.bind("sword", 100))
# Parameters added when emitting the signal are passed first.
@@ -473,20 +470,19 @@
{
// This assumes that a `Player` class exists, which defines a `Hit` signal.
var player = new Player();
- // Option 1: Using Callable.Bind(). This way we can still use signals as events.
- player.Hit += OnPlayerHit.Bind("sword", 100);
- // Option 2: Using a `binds` Array in Signal.Connect().
- player.Hit.Connect(OnPlayerHit, new Godot.Collections.Array{ "sword", 100 });
+ // Using lambda expressions that create a closure that captures the additional parameters.
+ // The lambda only receives the parameters defined by the signal's delegate.
+ player.Hit += (hitBy, level) =&gt; OnPlayerHit(hitBy, level, "sword", 100);
// Parameters added when emitting the signal are passed first.
- player.EmitSignal("hit", "Dark lord", 5);
+ player.EmitSignal(SignalName.Hit, "Dark lord", 5);
}
// We pass two arguments when emitting (`hit_by`, `level`),
// and bind two more arguments when connecting (`weapon_type`, `damage`).
private void OnPlayerHit(string hitBy, int level, string weaponType, int damage)
{
- GD.Print(String.Format("Hit by {0} (level {1}) with weapon {2} for {3} damage.", hitBy, level, weaponType, damage));
+ GD.Print($"Hit by {hitBy} (level {level}) with weapon {weaponType} for {damage} damage.");
}
[/csharp]
[/codeblocks]
@@ -512,8 +508,8 @@
emit_signal("game_over")
[/gdscript]
[csharp]
- EmitSignal("Hit", "sword", 100);
- EmitSignal("GameOver");
+ EmitSignal(SignalName.Hit, "sword", 100);
+ EmitSignal(SignalName.GameOver);
[/csharp]
[/codeblocks]
[b]Note:[/b] In C#, [param signal] must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the [code]SignalName[/code] class to avoid allocating a new [StringName] on each call.
@@ -581,7 +577,7 @@
var b = node.GetIndexed("position:y"); // b is -10
[/csharp]
[/codeblocks]
- [b]Note:[/b] In C#, [param property_path] must be in snake_case when referring to built-in Godot properties.
+ [b]Note:[/b] In C#, [param property_path] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the [code]PropertyName[/code] class to avoid allocating a new [StringName] on each call.
[b]Note:[/b] This method does not support actual paths to nodes in the [SceneTree], only sub-property paths. In the context of nodes, use [method Node.get_node_and_resource] instead.
</description>
</method>
@@ -868,7 +864,7 @@
GD.Print(node.Position); // Prints (42, -10)
[/csharp]
[/codeblocks]
- [b]Note:[/b] In C#, [param property_path] must be in snake_case when referring to built-in Godot properties.
+ [b]Note:[/b] In C#, [param property_path] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the [code]PropertyName[/code] class to avoid allocating a new [StringName] on each call.
</description>
</method>
<method name="set_message_translation">
@@ -883,7 +879,7 @@
<param index="0" name="name" type="StringName" />
<param index="1" name="value" type="Variant" />
<description>
- Adds or changes the entry [param name] inside the object's metadata. The metadata [param value] can be any [Variant], although some types cannot be serialised correctly.
+ Adds or changes the entry [param name] inside the object's metadata. The metadata [param value] can be any [Variant], although some types cannot be serialized correctly.
If [param value] is [code]null[/code], the entry is removed. This is the equivalent of using [method remove_meta]. See also [method has_meta] and [method get_meta].
[b]Note:[/b] Metadata that has a [param name] starting with an underscore ([code]_[/code]) is considered editor-only. Editor-only metadata is not displayed in the Inspector dock and should not be edited.
</description>
diff --git a/doc/classes/PacketPeerDTLS.xml b/doc/classes/PacketPeerDTLS.xml
index db8403a56b..19c5d0e287 100644
--- a/doc/classes/PacketPeerDTLS.xml
+++ b/doc/classes/PacketPeerDTLS.xml
@@ -14,11 +14,10 @@
<method name="connect_to_peer">
<return type="int" enum="Error" />
<param index="0" name="packet_peer" type="PacketPeerUDP" />
- <param index="1" name="validate_certs" type="bool" default="true" />
- <param index="2" name="for_hostname" type="String" default="&quot;&quot;" />
- <param index="3" name="valid_certificate" type="X509Certificate" default="null" />
+ <param index="1" name="hostname" type="String" />
+ <param index="2" name="client_options" type="TLSOptions" default="null" />
<description>
- Connects a [param packet_peer] beginning the DTLS handshake using the underlying [PacketPeerUDP] which must be connected (see [method PacketPeerUDP.connect_to_host]). If [param validate_certs] is [code]true[/code], [PacketPeerDTLS] will validate that the certificate presented by the remote peer and match it with the [param for_hostname] argument. You can specify a custom [X509Certificate] to use for validation via the [param valid_certificate] argument.
+ Connects a [param packet_peer] beginning the DTLS handshake using the underlying [PacketPeerUDP] which must be connected (see [method PacketPeerUDP.connect_to_host]). You can optionally specify the [param client_options] to be used while verifying the TLS connections. See [method TLSOptions.client] and [method TLSOptions.client_unsafe].
</description>
</method>
<method name="disconnect_from_peer">
diff --git a/doc/classes/ParticleProcessMaterial.xml b/doc/classes/ParticleProcessMaterial.xml
index d4050e3bd1..d046d52ed1 100644
--- a/doc/classes/ParticleProcessMaterial.xml
+++ b/doc/classes/ParticleProcessMaterial.xml
@@ -123,7 +123,8 @@
</member>
<member name="collision_mode" type="int" setter="set_collision_mode" getter="get_collision_mode" enum="ParticleProcessMaterial.CollisionMode" default="0">
The particles' collision mode.
- [b]Note:[/b] Particles can only collide with [GPUParticlesCollision3D] nodes, not [PhysicsBody3D] nodes. To make particles collide with various objects, you can add [GPUParticlesCollision3D] nodes as children of [PhysicsBody3D] nodes.
+ [b]Note:[/b] 3D Particles can only collide with [GPUParticlesCollision3D] nodes, not [PhysicsBody3D] nodes. To make particles collide with various objects, you can add [GPUParticlesCollision3D] nodes as children of [PhysicsBody3D] nodes.
+ [b]Note:[/b] 2D Particles can only collide with [LightOccluder2D] nodes, not [PhysicsBody2D] nodes.
</member>
<member name="collision_use_scale" type="bool" setter="set_collision_use_scale" getter="is_collision_using_scale" default="false">
Should collision take scale into account.
diff --git a/doc/classes/Performance.xml b/doc/classes/Performance.xml
index 6b7daa534e..493af8aff2 100644
--- a/doc/classes/Performance.xml
+++ b/doc/classes/Performance.xml
@@ -45,7 +45,7 @@
[csharp]
public override void _Ready()
{
- var monitorValue = new Callable(this, nameof(GetMonitorValue));
+ var monitorValue = new Callable(this, MethodName.GetMonitorValue);
// Adds monitor with name "MyName" to category "MyCategory".
Performance.AddCustomMonitor("MyCategory/MyMonitor", monitorValue);
diff --git a/doc/classes/PhysicalBone3D.xml b/doc/classes/PhysicalBone3D.xml
index 0768df31cc..f38130fe0c 100644
--- a/doc/classes/PhysicalBone3D.xml
+++ b/doc/classes/PhysicalBone3D.xml
@@ -3,6 +3,7 @@
<brief_description>
</brief_description>
<description>
+ [b]Warning:[/b] With a non-uniform scale this node will probably not function as expected. Please make sure to keep its scale uniform (i.e. the same on all axes), and change the size(s) of its collision shape(s) instead.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/PhysicsBody3D.xml b/doc/classes/PhysicsBody3D.xml
index 2ef54683f2..3e100e3280 100644
--- a/doc/classes/PhysicsBody3D.xml
+++ b/doc/classes/PhysicsBody3D.xml
@@ -4,7 +4,8 @@
Base class for all objects affected by physics in 3D space.
</brief_description>
<description>
- PhysicsBody3D is an abstract base class for implementing a physics body. All *Body types inherit from it.
+ PhysicsBody3D is an abstract base class for implementing a physics body. All *Body3D types inherit from it.
+ [b]Warning:[/b] With a non-uniform scale this node will probably not function as expected. Please make sure to keep its scale uniform (i.e. the same on all axes), and change the size(s) of its collision shape(s) instead.
</description>
<tutorials>
<link title="Physics introduction">$DOCS_URL/tutorials/physics/physics_introduction.html</link>
diff --git a/doc/classes/PhysicsServer2D.xml b/doc/classes/PhysicsServer2D.xml
index f1316fa991..93e88347d4 100644
--- a/doc/classes/PhysicsServer2D.xml
+++ b/doc/classes/PhysicsServer2D.xml
@@ -984,25 +984,23 @@
<constant name="AREA_PARAM_GRAVITY_IS_POINT" value="3" enum="AreaParameter">
Constant to set/get whether the gravity vector of an area is a direction, or a center point.
</constant>
- <constant name="AREA_PARAM_GRAVITY_DISTANCE_SCALE" value="4" enum="AreaParameter">
- Constant to set/get the falloff factor for point gravity of an area. The greater this value is, the faster the strength of gravity decreases with the square of distance.
+ <constant name="AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE" value="4" enum="AreaParameter">
+ Constant to set/get the distance at which the gravity strength is equal to the gravity controlled by [constant AREA_PARAM_GRAVITY]. For example, on a planet 100 pixels in radius with a surface gravity of 4.0 px/s², set the gravity to 4.0 and the unit distance to 100.0. The gravity will have falloff according to the inverse square law, so in the example, at 200 pixels from the center the gravity will be 1.0 px/s² (twice the distance, 1/4th the gravity), at 50 pixels it will be 16.0 px/s² (half the distance, 4x the gravity), and so on.
+ The above is true only when the unit distance is a positive number. When the unit distance is set to 0.0, the gravity will be constant regardless of distance.
</constant>
- <constant name="AREA_PARAM_GRAVITY_POINT_ATTENUATION" value="5" enum="AreaParameter">
- This constant was used to set/get the falloff factor for point gravity. It has been superseded by [constant AREA_PARAM_GRAVITY_DISTANCE_SCALE].
- </constant>
- <constant name="AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE" value="6" enum="AreaParameter">
+ <constant name="AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE" value="5" enum="AreaParameter">
Constant to set/get linear damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values.
</constant>
- <constant name="AREA_PARAM_LINEAR_DAMP" value="7" enum="AreaParameter">
+ <constant name="AREA_PARAM_LINEAR_DAMP" value="6" enum="AreaParameter">
Constant to set/get the linear damping factor of an area.
</constant>
- <constant name="AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE" value="8" enum="AreaParameter">
+ <constant name="AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE" value="7" enum="AreaParameter">
Constant to set/get angular damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values.
</constant>
- <constant name="AREA_PARAM_ANGULAR_DAMP" value="9" enum="AreaParameter">
+ <constant name="AREA_PARAM_ANGULAR_DAMP" value="8" enum="AreaParameter">
Constant to set/get the angular damping factor of an area.
</constant>
- <constant name="AREA_PARAM_PRIORITY" value="10" enum="AreaParameter">
+ <constant name="AREA_PARAM_PRIORITY" value="9" enum="AreaParameter">
Constant to set/get the priority (order of processing) of an area.
</constant>
<constant name="AREA_SPACE_OVERRIDE_DISABLED" value="0" enum="AreaSpaceOverrideMode">
diff --git a/doc/classes/PhysicsServer3D.xml b/doc/classes/PhysicsServer3D.xml
index e62bda0dd3..5b261d8414 100644
--- a/doc/classes/PhysicsServer3D.xml
+++ b/doc/classes/PhysicsServer3D.xml
@@ -1315,37 +1315,35 @@
<constant name="AREA_PARAM_GRAVITY_IS_POINT" value="3" enum="AreaParameter">
Constant to set/get whether the gravity vector of an area is a direction, or a center point.
</constant>
- <constant name="AREA_PARAM_GRAVITY_DISTANCE_SCALE" value="4" enum="AreaParameter">
- Constant to set/get the falloff factor for point gravity of an area. The greater this value is, the faster the strength of gravity decreases with the square of distance.
+ <constant name="AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE" value="4" enum="AreaParameter">
+ Constant to set/get the distance at which the gravity strength is equal to the gravity controlled by [constant AREA_PARAM_GRAVITY]. For example, on a planet 100 meters in radius with a surface gravity of 4.0 m/s², set the gravity to 4.0 and the unit distance to 100.0. The gravity will have falloff according to the inverse square law, so in the example, at 200 meters from the center the gravity will be 1.0 m/s² (twice the distance, 1/4th the gravity), at 50 meters it will be 16.0 m/s² (half the distance, 4x the gravity), and so on.
+ The above is true only when the unit distance is a positive number. When this is set to 0.0, the gravity will be constant regardless of distance.
</constant>
- <constant name="AREA_PARAM_GRAVITY_POINT_ATTENUATION" value="5" enum="AreaParameter">
- This constant was used to set/get the falloff factor for point gravity. It has been superseded by [constant AREA_PARAM_GRAVITY_DISTANCE_SCALE].
- </constant>
- <constant name="AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE" value="6" enum="AreaParameter">
+ <constant name="AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE" value="5" enum="AreaParameter">
Constant to set/get linear damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values.
</constant>
- <constant name="AREA_PARAM_LINEAR_DAMP" value="7" enum="AreaParameter">
+ <constant name="AREA_PARAM_LINEAR_DAMP" value="6" enum="AreaParameter">
Constant to set/get the linear damping factor of an area.
</constant>
- <constant name="AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE" value="8" enum="AreaParameter">
+ <constant name="AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE" value="7" enum="AreaParameter">
Constant to set/get angular damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values.
</constant>
- <constant name="AREA_PARAM_ANGULAR_DAMP" value="9" enum="AreaParameter">
+ <constant name="AREA_PARAM_ANGULAR_DAMP" value="8" enum="AreaParameter">
Constant to set/get the angular damping factor of an area.
</constant>
- <constant name="AREA_PARAM_PRIORITY" value="10" enum="AreaParameter">
+ <constant name="AREA_PARAM_PRIORITY" value="9" enum="AreaParameter">
Constant to set/get the priority (order of processing) of an area.
</constant>
- <constant name="AREA_PARAM_WIND_FORCE_MAGNITUDE" value="11" enum="AreaParameter">
+ <constant name="AREA_PARAM_WIND_FORCE_MAGNITUDE" value="10" enum="AreaParameter">
Constant to set/get the magnitude of area-specific wind force.
</constant>
- <constant name="AREA_PARAM_WIND_SOURCE" value="12" enum="AreaParameter">
+ <constant name="AREA_PARAM_WIND_SOURCE" value="11" enum="AreaParameter">
Constant to set/get the 3D vector that specifies the origin from which an area-specific wind blows.
</constant>
- <constant name="AREA_PARAM_WIND_DIRECTION" value="13" enum="AreaParameter">
+ <constant name="AREA_PARAM_WIND_DIRECTION" value="12" enum="AreaParameter">
Constant to set/get the 3D vector that specifies the direction in which an area-specific wind blows.
</constant>
- <constant name="AREA_PARAM_WIND_ATTENUATION_FACTOR" value="14" enum="AreaParameter">
+ <constant name="AREA_PARAM_WIND_ATTENUATION_FACTOR" value="13" enum="AreaParameter">
Constant to set/get the exponential rate at which wind force decreases with distance from its origin.
</constant>
<constant name="AREA_SPACE_OVERRIDE_DISABLED" value="0" enum="AreaSpaceOverrideMode">
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index de41edc305..95bd060fc6 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -384,6 +384,9 @@
<member name="debug/gdscript/warnings/assert_always_true" type="int" setter="" getter="" default="1">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when an [code]assert[/code] call always evaluates to true.
</member>
+ <member name="debug/gdscript/warnings/confusable_identifier" type="int" setter="" getter="" default="1">
+ When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when an identifier contains characters that can be confused with something else, like when mixing different alphabets.
+ </member>
<member name="debug/gdscript/warnings/constant_used_as_function" type="int" setter="" getter="" default="1">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when a constant is used as a function.
</member>
@@ -405,8 +408,11 @@
<member name="debug/gdscript/warnings/incompatible_ternary" type="int" setter="" getter="" default="1">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when a ternary operator may emit values with incompatible types.
</member>
- <member name="debug/gdscript/warnings/int_assigned_to_enum" type="int" setter="" getter="" default="1">
- When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when trying to assign an integer to a variable that expects an enum value.
+ <member name="debug/gdscript/warnings/int_as_enum_without_cast" type="int" setter="" getter="" default="1">
+ When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when trying to use an integer as an enum without an explicit cast.
+ </member>
+ <member name="debug/gdscript/warnings/int_as_enum_without_match" type="int" setter="" getter="" default="1">
+ When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when trying to use an integer as an enum when there is no matching enum member for that numeric value.
</member>
<member name="debug/gdscript/warnings/integer_division" type="int" setter="" getter="" default="1">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when dividing an integer by another integer (the decimal part will be discarded).
@@ -420,6 +426,9 @@
<member name="debug/gdscript/warnings/redundant_await" type="int" setter="" getter="" default="1">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when a function that is not a coroutine is called with await.
</member>
+ <member name="debug/gdscript/warnings/renamed_in_godot_4_hint" type="bool" setter="" getter="" default="1">
+ When enabled, using a property, enum, or function that was renamed since Godot 3 will produce a hint if an error occurs.
+ </member>
<member name="debug/gdscript/warnings/return_value_discarded" type="int" setter="" getter="" default="0">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively 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>
@@ -468,6 +477,9 @@
<member name="debug/gdscript/warnings/unsafe_property_access" type="int" setter="" getter="" default="0">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when accessing a property whose presence is not guaranteed at compile-time in the class.
</member>
+ <member name="debug/gdscript/warnings/unsafe_void_return" type="int" setter="" getter="" default="0">
+ When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when returning a call from a [code]void[/code] function when such call cannot be guaranteed to be also [code]void[/code].
+ </member>
<member name="debug/gdscript/warnings/unused_local_constant" type="int" setter="" getter="" default="1">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when a local constant is never used.
</member>
@@ -615,8 +627,17 @@
Main window content is expanded to the full size of the window. Unlike a borderless window, the frame is left intact and can be used to resize the window, and the title bar is transparent, but has minimize/maximize/close buttons.
[b]Note:[/b] This setting is implemented only on macOS.
</member>
- <member name="display/window/size/initial_screen" type="int" setter="" getter="" default="-2">
- Main window initial screen.
+ <member name="display/window/size/initial_position" type="Vector2i" setter="" getter="" default="Vector2i(0, 0)">
+ Main window initial position (in virtual desktop coordinates), this settings is used only if [member display/window/size/initial_position_type] is set to "Absolute" ([code]0[/code]).
+ </member>
+ <member name="display/window/size/initial_position_type" type="int" setter="" getter="" default="1">
+ Main window initial position.
+ [code]0[/code] - "Absolute", [member display/window/size/initial_position] is used to set window position.
+ [code]1[/code] - "Primary Screen Center".
+ [code]2[/code] - "Other Screen Center", [member display/window/size/initial_screen] is used to set window position.
+ </member>
+ <member name="display/window/size/initial_screen" type="int" setter="" getter="" default="0">
+ Main window initial screen, this settings is used only if [member display/window/size/initial_position_type] is set to "Other Screen Center" ([code]2[/code]).
</member>
<member name="display/window/size/mode" type="int" setter="" getter="" default="0">
Main window mode. See [enum DisplayServer.WindowMode] for possible values and how each mode behaves.
@@ -650,7 +671,8 @@
<member name="display/window/vsync/vsync_mode" type="int" setter="" getter="" default="1">
Sets the V-Sync mode for the main game window.
See [enum DisplayServer.VSyncMode] for possible values and how they affect the behavior of your application.
- Depending on the platform and used renderer, the engine will fall back to [code]Enabled[/code], if the desired mode is not supported.
+ Depending on the platform and used renderer, the engine will fall back to [code]Enabled[/code] if the desired mode is not supported.
+ [b]Note:[/b] This property is only read when the project starts. To change the V-Sync mode at runtime, call [method DisplayServer.window_set_vsync_mode] instead.
</member>
<member name="dotnet/project/assembly_name" type="String" setter="" getter="" default="&quot;&quot;">
Name of the .NET assembly. This name is used as the name of the [code].csproj[/code] and [code].sln[/code] files. By default, it's set to the name of the project ([member application/config/name]) allowing to change it in the future without affecting the .NET assembly.
@@ -685,10 +707,16 @@
<member name="editor/movie_writer/speaker_mode" type="int" setter="" getter="" default="0">
The speaker mode to use in the recorded audio when writing a movie. See [enum AudioServer.SpeakerMode] for possible values.
</member>
- <member name="editor/node_naming/name_casing" type="int" setter="" getter="" default="0">
+ <member name="editor/naming/default_signal_callback_name" type="String" setter="" getter="" default="&quot;_on_{node_name}_{signal_name}&quot;">
+ The format of the default signal callback name (in the Signal Connection Dialog). The following substitutions are available: [code]{NodeName}[/code], [code]{nodeName}[/code], [code]{node_name}[/code], [code]{SignalName}[/code], [code]{signalName}[/code], and [code]{signal_name}[/code].
+ </member>
+ <member name="editor/naming/default_signal_callback_to_self_name" type="String" setter="" getter="" default="&quot;_on_{signal_name}&quot;">
+ The format of the default signal callback name when a signal connects to the same node that emits it (in the Signal Connection Dialog). The following substitutions are available: [code]{NodeName}[/code], [code]{nodeName}[/code], [code]{node_name}[/code], [code]{SignalName}[/code], [code]{signalName}[/code], and [code]{signal_name}[/code].
+ </member>
+ <member name="editor/naming/node_name_casing" type="int" setter="" getter="" default="0">
When creating node names automatically, set the type of casing in this project. This is mostly an editor setting.
</member>
- <member name="editor/node_naming/name_num_separator" type="int" setter="" getter="" default="0">
+ <member name="editor/naming/node_name_num_separator" type="int" setter="" getter="" default="0">
What to use to separate node name from number. This is mostly an editor setting.
</member>
<member name="editor/run/main_run_args" type="String" setter="" getter="" default="&quot;&quot;">
@@ -2263,20 +2291,12 @@
<member name="rendering/textures/lossless_compression/force_png" type="bool" setter="" getter="" default="false">
If [code]true[/code], the texture importer will import lossless textures using the PNG format. Otherwise, it will default to using WebP.
</member>
- <member name="rendering/textures/vram_compression/import_bptc" type="bool" setter="" getter="" default="false">
- If [code]true[/code], the texture importer will import VRAM-compressed textures using the BPTC algorithm. This texture compression algorithm is only supported on desktop platforms, and only when using the Vulkan renderer.
- [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor (see [member application/config/use_hidden_project_data_directory]).
- </member>
- <member name="rendering/textures/vram_compression/import_etc" type="bool" setter="" getter="" default="false">
- If [code]true[/code], the texture importer will import VRAM-compressed textures using the Ericsson Texture Compression algorithm. This algorithm doesn't support alpha channels in textures.
- [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor (see [member application/config/use_hidden_project_data_directory]).
- </member>
- <member name="rendering/textures/vram_compression/import_etc2" type="bool" setter="" getter="" default="true">
- If [code]true[/code], the texture importer will import VRAM-compressed textures using the Ericsson Texture Compression 2 algorithm. This texture compression algorithm is only supported when using the Vulkan renderer.
+ <member name="rendering/textures/vram_compression/import_etc2_astc" type="bool" setter="" getter="" default="false">
+ If [code]true[/code], the texture importer will import VRAM-compressed textures using the Ericsson Texture Compression 2 algorithm for lower quality textures and normalmaps and Adaptable Scalable Texture Compression algorithm for high quality textures (in 4x4 block size).
[b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor (see [member application/config/use_hidden_project_data_directory]).
</member>
- <member name="rendering/textures/vram_compression/import_s3tc" type="bool" setter="" getter="" default="true">
- If [code]true[/code], the texture importer will import VRAM-compressed textures using the S3 Texture Compression algorithm. This algorithm is only supported on desktop platforms and consoles.
+ <member name="rendering/textures/vram_compression/import_s3tc_bptc" type="bool" setter="" getter="" default="true">
+ If [code]true[/code], the texture importer will import VRAM-compressed textures using the S3 Texture Compression algorithm (DXT1-5) for lower quality textures and the the BPTC algorithm (BC6H and BC7) for high quality textures. This algorithm is only supported on PC desktop platforms and consoles.
[b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor (see [member application/config/use_hidden_project_data_directory]).
</member>
<member name="rendering/textures/webp_compression/compression_method" type="int" setter="" getter="" default="2">
diff --git a/doc/classes/Projection.xml b/doc/classes/Projection.xml
index 602833bca5..99e3f1725f 100644
--- a/doc/classes/Projection.xml
+++ b/doc/classes/Projection.xml
@@ -149,7 +149,7 @@
<param index="4" name="flip_fov" type="bool" />
<param index="5" name="eye" type="int" />
<param index="6" name="intraocular_dist" type="float" />
- <param index="7" name=" convergence_dist" type="float" />
+ <param index="7" name="convergence_dist" type="float" />
<description>
Creates a new [Projection] that projects positions using a perspective projection with the given Y-axis field of view (in degrees), X:Y aspect ratio, and clipping distances. The projection is adjusted for a head-mounted display with the given distance between eyes and distance to a point that can be focused on.
[param eye] creates the projection for the left eye when set to 1, or the right eye when set to 2.
diff --git a/doc/classes/Rect2i.xml b/doc/classes/Rect2i.xml
index 325ead0cfa..80a9b40605 100644
--- a/doc/classes/Rect2i.xml
+++ b/doc/classes/Rect2i.xml
@@ -80,9 +80,9 @@
[/gdscript]
[csharp]
// position (-3, 2), size (1, 1)
- var rect = new Rect2i(new Vector2i(-3, 2), new Vector2i(1, 1));
- // position (-3, -1), size (3, 4), so we fit both rect and Vector2i(0, -1)
- var rect2 = rect.Expand(new Vector2i(0, -1));
+ var rect = new Rect2I(new Vector2I(-3, 2), new Vector2I(1, 1));
+ // position (-3, -1), size (3, 4), so we fit both rect and Vector2I(0, -1)
+ var rect2 = rect.Expand(new Vector2I(0, -1));
[/csharp]
[/codeblocks]
</description>
diff --git a/doc/classes/RemoteTransform2D.xml b/doc/classes/RemoteTransform2D.xml
index 20fa41a3f0..6f100541be 100644
--- a/doc/classes/RemoteTransform2D.xml
+++ b/doc/classes/RemoteTransform2D.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RemoteTransform2D" inherits="Node2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
- RemoteTransform2D pushes its own [Transform2D] to another [CanvasItem] derived Node in the scene.
+ RemoteTransform2D pushes its own [Transform2D] to another [Node2D] derived node in the scene.
</brief_description>
<description>
- RemoteTransform2D pushes its own [Transform2D] to another [CanvasItem] derived Node (called the remote node) in the scene.
- It can be set to update another Node's position, rotation and/or scale. It can use either global or local coordinates.
+ RemoteTransform2D pushes its own [Transform2D] to another [Node2D] derived node (called the remote node) in the scene.
+ It can be set to update another node's position, rotation and/or scale. It can use either global or local coordinates.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml
index 33170e6606..8bb3073000 100644
--- a/doc/classes/RenderingServer.xml
+++ b/doc/classes/RenderingServer.xml
@@ -291,7 +291,7 @@
<param index="0" name="item" type="RID" />
<param index="1" name="points" type="PackedVector2Array" />
<param index="2" name="colors" type="PackedColorArray" />
- <param index="3" name="width" type="float" default="1.0" />
+ <param index="3" name="width" type="float" default="-1.0" />
<param index="4" name="antialiased" type="bool" default="false" />
<description>
</description>
@@ -3245,12 +3245,12 @@
<description>
</description>
</method>
- <method name="viewport_set_disable_environment">
+ <method name="viewport_set_environment_mode">
<return type="void" />
<param index="0" name="viewport" type="RID" />
- <param index="1" name="disabled" type="bool" />
+ <param index="1" name="mode" type="int" enum="RenderingServer.ViewportEnvironmentMode" />
<description>
- If [code]true[/code], rendering of a viewport's environment is disabled.
+ Sets the viewport's environment mode which allows enabling or disabling rendering of 3D environment over 2D canvas. When disabled, 2D will not be affected by the environment. When enabled, 2D will be affected by the environment if the environment background mode is [constant ENV_BG_CANVAS]. The default behaviour is to inherit the setting from the viewport's parent. If the topmost parent is also set to [constant VIEWPORT_ENVIRONMENT_INHERIT], then the behavior will be the same as if it was set to [constant VIEWPORT_ENVIRONMENT_ENABLED].
</description>
</method>
<method name="viewport_set_fsr_sharpness">
@@ -3810,6 +3810,8 @@
</constant>
<constant name="ARRAY_FLAG_USE_8_BONE_WEIGHTS" value="134217728" enum="ArrayFormat" is_bitfield="true">
</constant>
+ <constant name="ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY" value="268435456" enum="ArrayFormat" is_bitfield="true">
+ </constant>
<constant name="PRIMITIVE_POINTS" value="0" enum="PrimitiveType">
Primitive to draw consists of points.
</constant>
@@ -4133,6 +4135,18 @@
<constant name="VIEWPORT_CLEAR_ONLY_NEXT_FRAME" value="2" enum="ViewportClearMode">
The viewport is cleared once, then the clear mode is set to [constant VIEWPORT_CLEAR_NEVER].
</constant>
+ <constant name="VIEWPORT_ENVIRONMENT_DISABLED" value="0" enum="ViewportEnvironmentMode">
+ Disable rendering of 3D environment over 2D canvas.
+ </constant>
+ <constant name="VIEWPORT_ENVIRONMENT_ENABLED" value="1" enum="ViewportEnvironmentMode">
+ Enable rendering of 3D environment over 2D canvas.
+ </constant>
+ <constant name="VIEWPORT_ENVIRONMENT_INHERIT" value="2" enum="ViewportEnvironmentMode">
+ Inherit enable/disable value from parent. If topmost parent is also set to inherit, then this has the same behavior as [constant VIEWPORT_ENVIRONMENT_ENABLED].
+ </constant>
+ <constant name="VIEWPORT_ENVIRONMENT_MAX" value="3" enum="ViewportEnvironmentMode">
+ Max value of [enum ViewportEnvironmentMode] enum.
+ </constant>
<constant name="VIEWPORT_SDF_OVERSIZE_100_PERCENT" value="0" enum="ViewportSDFOversize">
</constant>
<constant name="VIEWPORT_SDF_OVERSIZE_120_PERCENT" value="1" enum="ViewportSDFOversize">
diff --git a/doc/classes/Resource.xml b/doc/classes/Resource.xml
index e533fc1e32..67f466ad4c 100644
--- a/doc/classes/Resource.xml
+++ b/doc/classes/Resource.xml
@@ -24,7 +24,8 @@
<param index="0" name="subresources" type="bool" default="false" />
<description>
Duplicates this resource, returning a new resource with its [code]export[/code]ed or [constant PROPERTY_USAGE_STORAGE] properties copied from the original.
- If [param subresources] is [code]false[/code], a shallow copy is returned. Nested resources within subresources are not duplicated and are shared from the original resource. This behavior can be overridden by the [constant PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE] flag.
+ If [param subresources] is [code]false[/code], a shallow copy is returned; nested resources within subresources are not duplicated and are shared from the original resource. If [param subresources] is [code]true[/code], a deep copy is returned; nested subresources will be duplicated and are not shared.
+ Subresource properties with the [constant PROPERTY_USAGE_ALWAYS_DUPLICATE] flag are always duplicated even with [param subresources] set to [code]false[/code], and properties with the [constant PROPERTY_USAGE_NEVER_DUPLICATE] flag are never duplicated even with [param subresources] set to [code]true[/code].
[b]Note:[/b] For custom resources, this method will fail if [method Object._init] has been defined with required parameters.
</description>
</method>
diff --git a/doc/classes/ResourceFormatLoader.xml b/doc/classes/ResourceFormatLoader.xml
index 2b6376f2cd..bb55123b37 100644
--- a/doc/classes/ResourceFormatLoader.xml
+++ b/doc/classes/ResourceFormatLoader.xml
@@ -38,6 +38,13 @@
Gets the list of extensions for files this loader is able to read.
</description>
</method>
+ <method name="_get_resource_script_class" qualifiers="virtual const">
+ <return type="String" />
+ <param index="0" name="path" type="String" />
+ <description>
+ Returns the script class name associated with the [Resource] under the given [param path]. If the resource has no script or the script isn't a named class, it should return [code]""[/code].
+ </description>
+ </method>
<method name="_get_resource_type" qualifiers="virtual const">
<return type="String" />
<param index="0" name="path" type="String" />
diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml
index 5550bf0955..1ecc8a1d4e 100644
--- a/doc/classes/RichTextLabel.xml
+++ b/doc/classes/RichTextLabel.xml
@@ -8,7 +8,7 @@
[b]Note:[/b] Assignments to [member text] clear the tag stack and reconstruct it from the property's contents. Any edits made to [member text] will erase previous edits made from other manual sources such as [method append_text] and the [code]push_*[/code] / [method pop] methods.
[b]Note:[/b] RichTextLabel doesn't support entangled BBCode tags. For example, instead of using [code][b]bold[i]bold italic[/b]italic[/i][/code], use [code][b]bold[i]bold italic[/i][/b][i]italic[/i][/code].
[b]Note:[/b] [code]push_*/pop[/code] functions won't affect BBCode.
- [b]Note:[/b] Unlike [Label], RichTextLabel doesn't have a [i]property[/i] to horizontally align text to the center. Instead, enable [member bbcode_enabled] and surround the text in a [code][center][/code] tag as follows: [code][center]Example[/center][/code]. There is currently no built-in way to vertically align text either, but this can be emulated by relying on anchors/containers and the [member fit_content_height] property.
+ [b]Note:[/b] Unlike [Label], RichTextLabel doesn't have a [i]property[/i] to horizontally align text to the center. Instead, enable [member bbcode_enabled] and surround the text in a [code][center][/code] tag as follows: [code][center]Example[/center][/code]. There is currently no built-in way to vertically align text either, but this can be emulated by relying on anchors/containers and the [member fit_content] property.
</description>
<tutorials>
<link title="BBCode in RichTextLabel">$DOCS_URL/tutorials/ui/bbcode_in_richtextlabel.html</link>
@@ -251,6 +251,14 @@
Adds a [code][color][/code] tag to the tag stack.
</description>
</method>
+ <method name="push_customfx">
+ <return type="void" />
+ <param index="0" name="effect" type="RichTextEffect" />
+ <param index="1" name="env" type="Dictionary" />
+ <description>
+ Adds a custom effect tag to the tag stack. The effect does not need to be in [member custom_effects]. The environment is directly passed to the effect.
+ </description>
+ </method>
<method name="push_dropcap">
<return type="void" />
<param index="0" name="string" type="String" />
@@ -474,9 +482,8 @@
<member name="deselect_on_focus_loss_enabled" type="bool" setter="set_deselect_on_focus_loss_enabled" getter="is_deselect_on_focus_loss_enabled" default="true">
If [code]true[/code], the selected text will be deselected when focus is lost.
</member>
- <member name="fit_content_height" type="bool" setter="set_fit_content_height" getter="is_fit_content_height_enabled" default="false">
- If [code]true[/code], the label's height will be automatically updated to fit its content.
- [b]Note:[/b] This property is used as a workaround to fix issues with [RichTextLabel] in [Container]s, but it's unreliable in some cases and will be removed in future versions.
+ <member name="fit_content" type="bool" setter="set_fit_content" getter="is_fit_content_enabled" default="false">
+ If [code]true[/code], the label's minimum size will be automatically updated to fit its content, matching the behavior of [Label].
</member>
<member name="hint_underlined" type="bool" setter="set_hint_underline" getter="is_hint_underlined" default="true">
If [code]true[/code], the label underlines hint tags such as [code][hint=description]{text}[/hint][/code].
diff --git a/doc/classes/RigidBody3D.xml b/doc/classes/RigidBody3D.xml
index 8380d56de3..148cdf96ee 100644
--- a/doc/classes/RigidBody3D.xml
+++ b/doc/classes/RigidBody3D.xml
@@ -8,6 +8,7 @@
You can switch the body's behavior using [member lock_rotation], [member freeze], and [member freeze_mode].
[b]Note:[/b] Don't change a RigidBody3D's position every frame or very often. Sporadic changes work fine, but physics runs at a different granularity (fixed Hz) than usual rendering (process callback) and maybe even in a separate thread, so changing this from a process loop may result in strange behavior. 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 function. See [member custom_integrator].
+ [b]Warning:[/b] With a non-uniform scale this node will probably not function as expected. Please make sure to keep its scale uniform (i.e. the same on all axes), and change the size(s) of its collision shape(s) instead.
</description>
<tutorials>
<link title="Physics introduction">$DOCS_URL/tutorials/physics/physics_introduction.html</link>
diff --git a/doc/classes/Semaphore.xml b/doc/classes/Semaphore.xml
index 6b2007363e..d1d126c5cb 100644
--- a/doc/classes/Semaphore.xml
+++ b/doc/classes/Semaphore.xml
@@ -17,9 +17,9 @@
</description>
</method>
<method name="try_wait">
- <return type="int" enum="Error" />
+ <return type="bool" />
<description>
- Like [method wait], but won't block, so if the value is zero, fails immediately and returns [constant ERR_BUSY]. If non-zero, it returns [constant OK] to report success.
+ Like [method wait], but won't block, so if the value is zero, fails immediately and returns [code]false[/code]. If non-zero, it returns [code]true[/code] to report success.
</description>
</method>
<method name="wait">
diff --git a/doc/classes/Shader.xml b/doc/classes/Shader.xml
index 75f835260a..c472ab647e 100644
--- a/doc/classes/Shader.xml
+++ b/doc/classes/Shader.xml
@@ -26,12 +26,12 @@
Returns the shader mode for the shader, either [constant MODE_CANVAS_ITEM], [constant MODE_SPATIAL] or [constant MODE_PARTICLES].
</description>
</method>
- <method name="has_parameter" qualifiers="const">
- <return type="bool" />
- <param index="0" name="name" type="StringName" />
+ <method name="get_shader_uniform_list">
+ <return type="Array" />
+ <param index="0" name="get_groups" type="bool" default="false" />
<description>
- Returns [code]true[/code] if the shader has this param defined as a uniform in its code.
- [b]Note:[/b] [param name] must match the name of the uniform in the code exactly.
+ Get the list of shader uniforms that can be assigned to a [ShaderMaterial], for use with [method ShaderMaterial.set_shader_parameter] and [method ShaderMaterial.get_shader_parameter]. The parameters returned are contained in dictionaries in a similar format to the ones returned by [method Object.get_property_list].
+ If argument [param get_groups] is true, parameter grouping hints will be provided.
</description>
</method>
<method name="set_default_texture_parameter">
diff --git a/doc/classes/Signal.xml b/doc/classes/Signal.xml
index 3412cd2140..71905e8b2e 100644
--- a/doc/classes/Signal.xml
+++ b/doc/classes/Signal.xml
@@ -16,12 +16,12 @@
[/gdscript]
[csharp]
[Signal]
- delegate void Attacked();
+ delegate void AttackedEventHandler();
// Additional arguments may be declared.
// These arguments must be passed when the signal is emitted.
[Signal]
- delegate void ItemDropped(itemName: string, amount: int);
+ delegate void ItemDroppedEventHandler(string itemName, int amount);
[/csharp]
[/codeblocks]
</description>
diff --git a/doc/classes/SpriteBase3D.xml b/doc/classes/SpriteBase3D.xml
index 5fa984e7a0..e1f3a52a1d 100644
--- a/doc/classes/SpriteBase3D.xml
+++ b/doc/classes/SpriteBase3D.xml
@@ -38,9 +38,21 @@
</method>
</methods>
<members>
+ <member name="alpha_antialiasing_edge" type="float" setter="set_alpha_antialiasing_edge" getter="get_alpha_antialiasing_edge" default="0.0">
+ Threshold at which antialiasing will be applied on the alpha channel.
+ </member>
+ <member name="alpha_antialiasing_mode" type="int" setter="set_alpha_antialiasing" getter="get_alpha_antialiasing" enum="BaseMaterial3D.AlphaAntiAliasing" default="0">
+ The type of alpha antialiasing to apply. See [enum BaseMaterial3D.AlphaAntiAliasing].
+ </member>
<member name="alpha_cut" type="int" setter="set_alpha_cut_mode" getter="get_alpha_cut_mode" enum="SpriteBase3D.AlphaCutMode" default="0">
The alpha cutting mode to use for the sprite. See [enum AlphaCutMode] for possible values.
</member>
+ <member name="alpha_hash_scale" type="float" setter="set_alpha_hash_scale" getter="get_alpha_hash_scale" default="1.0">
+ The hashing scale for Alpha Hash. Recommended values between [code]0[/code] and [code]2[/code].
+ </member>
+ <member name="alpha_scissor_threshold" type="float" setter="set_alpha_scissor_threshold" getter="get_alpha_scissor_threshold" default="0.5">
+ Threshold at which the alpha scissor will discard values.
+ </member>
<member name="axis" type="int" setter="set_axis" getter="get_axis" enum="Vector3.Axis" default="2">
The direction in which the front of the texture faces.
</member>
@@ -118,5 +130,8 @@
<constant name="ALPHA_CUT_OPAQUE_PREPASS" value="2" enum="AlphaCutMode">
This mode draws fully opaque pixels in the depth prepass. This is slower than [constant ALPHA_CUT_DISABLED] or [constant ALPHA_CUT_DISCARD], but it allows displaying translucent areas and smooth edges while using proper sorting.
</constant>
+ <constant name="ALPHA_CUT_HASH" value="3" enum="AlphaCutMode">
+ This mode draws cuts off all values below a spatially-deterministic threshold, the rest will remain opaque.
+ </constant>
</constants>
</class>
diff --git a/doc/classes/StaticBody3D.xml b/doc/classes/StaticBody3D.xml
index 0beaa6bb52..7bebd46004 100644
--- a/doc/classes/StaticBody3D.xml
+++ b/doc/classes/StaticBody3D.xml
@@ -7,8 +7,9 @@
Static body for 3D physics.
A static body is a simple body that doesn't move under physics simulation, i.e. it can't be moved by external forces or contacts but its transformation can still be updated manually by the user. It is ideal for implementing objects in the environment, such as walls or platforms. In contrast to [RigidBody3D], it doesn't consume any CPU resources as long as they don't move.
They have extra functionalities to move and affect other bodies:
- [b]Static transform change:[/b] Static bodies can be moved by animation or script. In this case, they are just teleported and don't affect other bodies on their path.
- [b]Constant velocity:[/b] When [member constant_linear_velocity] or [member constant_angular_velocity] is set, static bodies don't move themselves but affect touching bodies as if they were moving. This is useful for simulating conveyor belts or conveyor wheels.
+ [i]Static transform change:[/i] Static bodies can be moved by animation or script. In this case, they are just teleported and don't affect other bodies on their path.
+ [i]Constant velocity:[/i] When [member constant_linear_velocity] or [member constant_angular_velocity] is set, static bodies don't move themselves but affect touching bodies as if they were moving. This is useful for simulating conveyor belts or conveyor wheels.
+ [b]Warning:[/b] With a non-uniform scale this node will probably not function as expected. Please make sure to keep its scale uniform (i.e. the same on all axes), and change the size(s) of its collision shape(s) instead.
</description>
<tutorials>
<link title="3D Physics Tests Demo">https://godotengine.org/asset-library/asset/675</link>
diff --git a/doc/classes/StreamPeerTLS.xml b/doc/classes/StreamPeerTLS.xml
index d1ddb3d441..9e16dc8914 100644
--- a/doc/classes/StreamPeerTLS.xml
+++ b/doc/classes/StreamPeerTLS.xml
@@ -14,22 +14,18 @@
<method name="accept_stream">
<return type="int" enum="Error" />
<param index="0" name="stream" type="StreamPeer" />
- <param index="1" name="private_key" type="CryptoKey" />
- <param index="2" name="certificate" type="X509Certificate" />
- <param index="3" name="chain" type="X509Certificate" default="null" />
+ <param index="1" name="server_options" type="TLSOptions" />
<description>
- Accepts a peer connection as a server using the given [param private_key] and providing the given [param certificate] to the client. You can pass the optional [param chain] parameter to provide additional CA chain information along with the certificate.
+ Accepts a peer connection as a server using the given [param server_options]. See [method TLSOptions.server].
</description>
</method>
<method name="connect_to_stream">
<return type="int" enum="Error" />
<param index="0" name="stream" type="StreamPeer" />
- <param index="1" name="validate_certs" type="bool" default="false" />
- <param index="2" name="for_hostname" type="String" default="&quot;&quot;" />
- <param index="3" name="valid_certificate" type="X509Certificate" default="null" />
+ <param index="1" name="common_name" type="String" />
+ <param index="2" name="client_options" type="TLSOptions" default="null" />
<description>
- Connects to a peer using an underlying [StreamPeer] [param stream]. If [param validate_certs] is [code]true[/code], [StreamPeerTLS] will validate that the certificate presented by the peer matches the [param for_hostname].
- [b]Note:[/b] Specifying a custom [param valid_certificate] is not supported in Web exports due to browsers restrictions.
+ Connects to a peer using an underlying [StreamPeer] [param stream] and verifying the remote certificate is correctly signed for the given [param common_name]. You can pass the optional [param client_options] parameter to customize the trusted certification authorities, or disable the common name verification. See [method TLSOptions.client] and [method TLSOptions.client_unsafe].
</description>
</method>
<method name="disconnect_from_stream">
@@ -57,10 +53,6 @@
</description>
</method>
</methods>
- <members>
- <member name="blocking_handshake" type="bool" setter="set_blocking_handshake_enabled" getter="is_blocking_handshake_enabled" default="true">
- </member>
- </members>
<constants>
<constant name="STATUS_DISCONNECTED" value="0" enum="Status">
A status representing a [StreamPeerTLS] that is disconnected.
diff --git a/doc/classes/String.xml b/doc/classes/String.xml
index 97466e7860..143e1f23e9 100644
--- a/doc/classes/String.xml
+++ b/doc/classes/String.xml
@@ -1002,10 +1002,16 @@
[/codeblocks]
</description>
</method>
+ <method name="validate_filename" qualifiers="const">
+ <return type="String" />
+ <description>
+ Returns a copy of the string with all characters that are not allowed in [method is_valid_filename] replaced with underscores.
+ </description>
+ </method>
<method name="validate_node_name" qualifiers="const">
<return type="String" />
<description>
- Removes all characters that are not allowed in [member Node.name] from the string ([code].[/code] [code]:[/code] [code]@[/code] [code]/[/code] [code]"[/code] [code]%[/code]).
+ Returns a copy of the string with all characters that are not allowed in [member Node.name] removed ([code].[/code] [code]:[/code] [code]@[/code] [code]/[/code] [code]"[/code] [code]%[/code]).
</description>
</method>
<method name="xml_escape" qualifiers="const">
diff --git a/doc/classes/StringName.xml b/doc/classes/StringName.xml
index b46e39b8d7..c103fb2287 100644
--- a/doc/classes/StringName.xml
+++ b/doc/classes/StringName.xml
@@ -909,10 +909,16 @@
[/codeblocks]
</description>
</method>
+ <method name="validate_filename" qualifiers="const">
+ <return type="String" />
+ <description>
+ Returns a copy of the string with all characters that are not allowed in [method is_valid_filename] replaced with underscores.
+ </description>
+ </method>
<method name="validate_node_name" qualifiers="const">
<return type="String" />
<description>
- Removes all characters that are not allowed in [member Node.name] from the string ([code].[/code] [code]:[/code] [code]@[/code] [code]/[/code] [code]"[/code] [code]%[/code]).
+ Returns a copy of the string with all characters that are not allowed in [member Node.name] removed ([code].[/code] [code]:[/code] [code]@[/code] [code]/[/code] [code]"[/code] [code]%[/code]).
</description>
</method>
<method name="xml_escape" qualifiers="const">
diff --git a/doc/classes/StyleBox.xml b/doc/classes/StyleBox.xml
index ff6d4d8821..4a63f4488c 100644
--- a/doc/classes/StyleBox.xml
+++ b/doc/classes/StyleBox.xml
@@ -17,21 +17,16 @@
<description>
</description>
</method>
- <method name="_get_center_size" qualifiers="virtual const">
- <return type="Vector2" />
- <description>
- </description>
- </method>
<method name="_get_draw_rect" qualifiers="virtual const">
<return type="Rect2" />
<param index="0" name="rect" type="Rect2" />
<description>
</description>
</method>
- <method name="_get_style_margin" qualifiers="virtual const">
- <return type="float" />
- <param index="0" name="side" type="int" enum="Side" />
+ <method name="_get_minimum_size" qualifiers="virtual const">
+ <return type="Vector2" />
<description>
+ Virtual method to be implemented by the user. Returns a custom minimum size that the stylebox must respect when drawing. By default [method get_minimum_size] only takes content margins into account. This method can be overridden to add another size restriction. A combination of the default behavior and the output of this method will be used, to account for both sizes.
</description>
</method>
<method name="_test_mask" qualifiers="virtual const">
@@ -50,10 +45,11 @@
The [RID] value can either be the result of [method CanvasItem.get_canvas_item] called on an existing [CanvasItem]-derived node, or directly from creating a canvas item in the [RenderingServer] with [method RenderingServer.canvas_item_create].
</description>
</method>
- <method name="get_center_size" qualifiers="const">
- <return type="Vector2" />
+ <method name="get_content_margin" qualifiers="const">
+ <return type="float" />
+ <param index="0" name="margin" type="int" enum="Side" />
<description>
- Returns the size of this [StyleBox] without the margins.
+ Returns the default margin of the specified [enum Side].
</description>
</method>
<method name="get_current_item_drawn" qualifiers="const">
@@ -62,13 +58,6 @@
Returns the [CanvasItem] that handles its [constant CanvasItem.NOTIFICATION_DRAW] or [method CanvasItem._draw] callback at this moment.
</description>
</method>
- <method name="get_default_margin" qualifiers="const">
- <return type="float" />
- <param index="0" name="margin" type="int" enum="Side" />
- <description>
- Returns the default margin of the specified [enum Side].
- </description>
- </method>
<method name="get_margin" qualifiers="const">
<return type="float" />
<param index="0" name="margin" type="int" enum="Side" />
@@ -89,7 +78,7 @@
Returns the "offset" of a stylebox. This helper function returns a value equivalent to [code]Vector2(style.get_margin(MARGIN_LEFT), style.get_margin(MARGIN_TOP))[/code].
</description>
</method>
- <method name="set_default_margin">
+ <method name="set_content_margin">
<return type="void" />
<param index="0" name="margin" type="int" enum="Side" />
<param index="1" name="offset" type="float" />
@@ -97,7 +86,7 @@
Sets the default value of the specified [enum Side] to [param offset] pixels.
</description>
</method>
- <method name="set_default_margin_all">
+ <method name="set_content_margin_all">
<return type="void" />
<param index="0" name="offset" type="float" />
<description>
@@ -114,21 +103,21 @@
</method>
</methods>
<members>
- <member name="content_margin_bottom" type="float" setter="set_default_margin" getter="get_default_margin" default="-1.0">
+ <member name="content_margin_bottom" type="float" setter="set_content_margin" getter="get_content_margin" default="-1.0">
The bottom margin for the contents of this style box. Increasing this value reduces the space available to the contents from the bottom.
If this value is negative, it is ignored and a child-specific margin is used instead. For example for [StyleBoxFlat] the border thickness (if any) is used instead.
It is up to the code using this style box to decide what these contents are: for example, a [Button] respects this content margin for the textual contents of the button.
[method get_margin] should be used to fetch this value as consumer instead of reading these properties directly. This is because it correctly respects negative values and the fallback mentioned above.
</member>
- <member name="content_margin_left" type="float" setter="set_default_margin" getter="get_default_margin" default="-1.0">
+ <member name="content_margin_left" type="float" setter="set_content_margin" getter="get_content_margin" default="-1.0">
The left margin for the contents of this style box. Increasing this value reduces the space available to the contents from the left.
Refer to [member content_margin_bottom] for extra considerations.
</member>
- <member name="content_margin_right" type="float" setter="set_default_margin" getter="get_default_margin" default="-1.0">
+ <member name="content_margin_right" type="float" setter="set_content_margin" getter="get_content_margin" default="-1.0">
The right margin for the contents of this style box. Increasing this value reduces the space available to the contents from the right.
Refer to [member content_margin_bottom] for extra considerations.
</member>
- <member name="content_margin_top" type="float" setter="set_default_margin" getter="get_default_margin" default="-1.0">
+ <member name="content_margin_top" type="float" setter="set_content_margin" getter="get_content_margin" default="-1.0">
The top margin for the contents of this style box. Increasing this value reduces the space available to the contents from the top.
Refer to [member content_margin_bottom] for extra considerations.
</member>
diff --git a/doc/classes/StyleBoxTexture.xml b/doc/classes/StyleBoxTexture.xml
index aeba777b43..f2f6e59a9e 100644
--- a/doc/classes/StyleBoxTexture.xml
+++ b/doc/classes/StyleBoxTexture.xml
@@ -9,36 +9,36 @@
<tutorials>
</tutorials>
<methods>
- <method name="get_expand_margin_size" qualifiers="const">
+ <method name="get_expand_margin" qualifiers="const">
<return type="float" />
<param index="0" name="margin" type="int" enum="Side" />
<description>
Returns the expand margin size of the specified [enum Side].
</description>
</method>
- <method name="get_margin_size" qualifiers="const">
+ <method name="get_texture_margin" qualifiers="const">
<return type="float" />
<param index="0" name="margin" type="int" enum="Side" />
<description>
Returns the margin size of the specified [enum Side].
</description>
</method>
- <method name="set_expand_margin_all">
+ <method name="set_expand_margin">
<return type="void" />
- <param index="0" name="size" type="float" />
+ <param index="0" name="margin" type="int" enum="Side" />
+ <param index="1" name="size" type="float" />
<description>
- Sets the expand margin to [param size] pixels for all margins.
+ Sets the expand margin to [param size] pixels for the specified [enum Side].
</description>
</method>
- <method name="set_expand_margin_size">
+ <method name="set_expand_margin_all">
<return type="void" />
- <param index="0" name="margin" type="int" enum="Side" />
- <param index="1" name="size" type="float" />
+ <param index="0" name="size" type="float" />
<description>
- Sets the expand margin to [param size] pixels for the specified [enum Side].
+ Sets the expand margin to [param size] pixels for all margins.
</description>
</method>
- <method name="set_margin_size">
+ <method name="set_texture_margin">
<return type="void" />
<param index="0" name="margin" type="int" enum="Side" />
<param index="1" name="size" type="float" />
@@ -46,7 +46,7 @@
Sets the margin to [param size] pixels for the specified [enum Side].
</description>
</method>
- <method name="set_margin_size_all">
+ <method name="set_texture_margin_all">
<return type="void" />
<param index="0" name="size" type="float" />
<description>
@@ -64,48 +64,49 @@
<member name="draw_center" type="bool" setter="set_draw_center" getter="is_draw_center_enabled" default="true">
If [code]true[/code], the nine-patch texture's center tile will be drawn.
</member>
- <member name="expand_margin_bottom" type="float" setter="set_expand_margin_size" getter="get_expand_margin_size" default="0.0">
+ <member name="expand_margin_bottom" type="float" setter="set_expand_margin" getter="get_expand_margin" default="0.0">
Expands the bottom margin of this style box when drawing, causing it to be drawn larger than requested.
</member>
- <member name="expand_margin_left" type="float" setter="set_expand_margin_size" getter="get_expand_margin_size" default="0.0">
+ <member name="expand_margin_left" type="float" setter="set_expand_margin" getter="get_expand_margin" default="0.0">
Expands the left margin of this style box when drawing, causing it to be drawn larger than requested.
</member>
- <member name="expand_margin_right" type="float" setter="set_expand_margin_size" getter="get_expand_margin_size" default="0.0">
+ <member name="expand_margin_right" type="float" setter="set_expand_margin" getter="get_expand_margin" default="0.0">
Expands the right margin of this style box when drawing, causing it to be drawn larger than requested.
</member>
- <member name="expand_margin_top" type="float" setter="set_expand_margin_size" getter="get_expand_margin_size" default="0.0">
+ <member name="expand_margin_top" type="float" setter="set_expand_margin" getter="get_expand_margin" default="0.0">
Expands the top margin of this style box when drawing, causing it to be drawn larger than requested.
</member>
- <member name="margin_bottom" type="float" setter="set_margin_size" getter="get_margin_size" default="0.0">
+ <member name="modulate_color" type="Color" setter="set_modulate" getter="get_modulate" default="Color(1, 1, 1, 1)">
+ Modulates the color of the texture when this style box is drawn.
+ </member>
+ <member name="region_rect" type="Rect2" setter="set_region_rect" getter="get_region_rect" default="Rect2(0, 0, 0, 0)">
+ Species a sub-region of the texture to use.
+ This is equivalent to first wrapping the texture in an [AtlasTexture] with the same region.
+ If empty ([code]Rect2(0, 0, 0, 0)[/code]), the whole texture will be used.
+ </member>
+ <member name="texture" type="Texture2D" setter="set_texture" getter="get_texture">
+ The texture to use when drawing this style box.
+ </member>
+ <member name="texture_margin_bottom" type="float" setter="set_texture_margin" getter="get_texture_margin" default="0.0">
Increases the bottom margin of the 3×3 texture box.
A higher value means more of the source texture is considered to be part of the bottom border of the 3×3 box.
This is also the value used as fallback for [member StyleBox.content_margin_bottom] if it is negative.
</member>
- <member name="margin_left" type="float" setter="set_margin_size" getter="get_margin_size" default="0.0">
+ <member name="texture_margin_left" type="float" setter="set_texture_margin" getter="get_texture_margin" default="0.0">
Increases the left margin of the 3×3 texture box.
A higher value means more of the source texture is considered to be part of the left border of the 3×3 box.
This is also the value used as fallback for [member StyleBox.content_margin_left] if it is negative.
</member>
- <member name="margin_right" type="float" setter="set_margin_size" getter="get_margin_size" default="0.0">
+ <member name="texture_margin_right" type="float" setter="set_texture_margin" getter="get_texture_margin" default="0.0">
Increases the right margin of the 3×3 texture box.
A higher value means more of the source texture is considered to be part of the right border of the 3×3 box.
This is also the value used as fallback for [member StyleBox.content_margin_right] if it is negative.
</member>
- <member name="margin_top" type="float" setter="set_margin_size" getter="get_margin_size" default="0.0">
+ <member name="texture_margin_top" type="float" setter="set_texture_margin" getter="get_texture_margin" default="0.0">
Increases the top margin of the 3×3 texture box.
A higher value means more of the source texture is considered to be part of the top border of the 3×3 box.
This is also the value used as fallback for [member StyleBox.content_margin_top] if it is negative.
</member>
- <member name="modulate_color" type="Color" setter="set_modulate" getter="get_modulate" default="Color(1, 1, 1, 1)">
- Modulates the color of the texture when this style box is drawn.
- </member>
- <member name="region_rect" type="Rect2" setter="set_region_rect" getter="get_region_rect" default="Rect2(0, 0, 0, 0)">
- Species a sub-region of the texture to use.
- This is equivalent to first wrapping the texture in an [AtlasTexture] with the same region.
- </member>
- <member name="texture" type="Texture2D" setter="set_texture" getter="get_texture">
- The texture to use when drawing this style box.
- </member>
</members>
<constants>
<constant name="AXIS_STRETCH_MODE_STRETCH" value="0" enum="AxisStretchMode">
diff --git a/doc/classes/SurfaceTool.xml b/doc/classes/SurfaceTool.xml
index 9d73e9fb39..5b567dbc28 100644
--- a/doc/classes/SurfaceTool.xml
+++ b/doc/classes/SurfaceTool.xml
@@ -133,7 +133,7 @@
<description>
Generates normals from vertices so you do not have to do it manually. If [param flip] is [code]true[/code], the resulting normals will be inverted. [method generate_normals] should be called [i]after[/i] generating geometry and [i]before[/i] committing the mesh using [method commit] or [method commit_to_arrays]. For correct display of normal-mapped surfaces, you will also have to generate tangents using [method generate_tangents].
[b]Note:[/b] [method generate_normals] only works if the primitive type to be set to [constant Mesh.PRIMITIVE_TRIANGLES].
- [b]Note:[/b] [method generate_normals] takes smooth groups into account. If you don't specify any smooth group for each vertex, [method generate_normals] will smooth normals for you.
+ [b]Note:[/b] [method generate_normals] takes smooth groups into account. To generate smooth normals, set the smooth group to a value greater than or equal to [code]0[/code] using [method set_smooth_group] or leave the smooth group at the default of [code]0[/code]. To generate flat normals, set the smooth group to [code]-1[/code] using [method set_smooth_group] prior to adding vertices.
</description>
</method>
<method name="generate_tangents">
@@ -241,7 +241,7 @@
<return type="void" />
<param index="0" name="index" type="int" />
<description>
- Specifies whether the current vertex (if using only vertex arrays) or current index (if also using index arrays) should use smooth normals for normal calculation.
+ Specifies the smooth group to use for the [i]next[/i] vertex. If this is never called, all vertices will have the default smooth group of [code]0[/code] and will be smoothed with adjacent vertices of the same group. To produce a mesh with flat normals, set the smooth group to [code]-1[/code].
</description>
</method>
<method name="set_tangent">
diff --git a/doc/classes/SystemFont.xml b/doc/classes/SystemFont.xml
index 20bfd0d8ae..5e7b79ae97 100644
--- a/doc/classes/SystemFont.xml
+++ b/doc/classes/SystemFont.xml
@@ -43,6 +43,12 @@
<member name="hinting" type="int" setter="set_hinting" getter="get_hinting" enum="TextServer.Hinting" default="1">
Font hinting mode.
</member>
+ <member name="msdf_pixel_range" type="int" setter="set_msdf_pixel_range" getter="get_msdf_pixel_range" default="16">
+ The width of the range around the shape between the minimum and maximum representable signed distance. If using font outlines, [member msdf_pixel_range] must be set to at least [i]twice[/i] the size of the largest font outline. The default [member msdf_pixel_range] value of [code]16[/code] allows outline sizes up to [code]8[/code] to look correct.
+ </member>
+ <member name="msdf_size" type="int" setter="set_msdf_size" getter="get_msdf_size" default="48">
+ Source font size used to generate MSDF textures. Higher values allow for more precision, but are slower to render and require more memory. Only increase this value if you notice a visible lack of precision in glyph rendering.
+ </member>
<member name="multichannel_signed_distance_field" type="bool" setter="set_multichannel_signed_distance_field" getter="is_multichannel_signed_distance_field" default="false">
If set to [code]true[/code], glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data.
</member>
diff --git a/doc/classes/TLSOptions.xml b/doc/classes/TLSOptions.xml
new file mode 100644
index 0000000000..0917bd9bce
--- /dev/null
+++ b/doc/classes/TLSOptions.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="TLSOptions" inherits="RefCounted" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
+ <brief_description>
+ TLS configuration for clients and servers.
+ </brief_description>
+ <description>
+ TLSOptions abstracts the configuration options for the [StreamPeerTLS] and [PacketPeerDTLS] classes.
+ Objects of this class cannot be instantiated directly, and one of the static methods [method client], [method client_unsafe], or [method server] should be used instead.
+ [codeblocks]
+ [gdscript]
+ # Create a TLS client configuration which uses our custom trusted CA chain.
+ var client_trusted_cas = load("res://my_trusted_cas.crt")
+ var client_tls_options = TLSOptions.client(client_trusted_cas)
+
+ # Create a TLS server configuration.
+ var server_certs = load("res://my_server_cas.crt")
+ var server_key = load("res://my_server_key.key")
+ var server_tls_options = TLSOptions.server(server_certs, server_key)
+ [/gdscript]
+ [/codeblocks]
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ <method name="client" qualifiers="static">
+ <return type="TLSOptions" />
+ <param index="0" name="trusted_chain" type="X509Certificate" default="null" />
+ <param index="1" name="common_name_override" type="String" default="&quot;&quot;" />
+ <description>
+ Creates a TLS client configuration which validates certificates and their common names (fully qualified domain names).
+ You can specify a custom [param trusted_chain] of certification authorities (the default CA list will be used if [code]null[/code]), and optionally provide a [param common_name_override] if you expect the certificate to have a common name other then the server FQDN.
+ Note: On the Web plafrom, TLS verification is always enforced against the CA list of the web browser. This is considered a security feature.
+ </description>
+ </method>
+ <method name="client_unsafe" qualifiers="static">
+ <return type="TLSOptions" />
+ <param index="0" name="trusted_chain" type="X509Certificate" default="null" />
+ <description>
+ Creates an [b]unsafe[/b] TLS client configuration where certificate validation is optional. You can optionally provide a valid [param trusted_chain], but the common name of the certififcates will never be checked. Using this configuration for purposes other than testing [b]is not recommended[/b].
+ Note: On the Web plafrom, TLS verification is always enforced against the CA list of the web browser. This is considered a security feature.
+ </description>
+ </method>
+ <method name="server" qualifiers="static">
+ <return type="TLSOptions" />
+ <param index="0" name="key" type="CryptoKey" />
+ <param index="1" name="certificate" type="X509Certificate" />
+ <description>
+ Creates a TLS server configuration using the provided [param key] and [param certificate].
+ Note: The [param certificate] should include the full certificate chain up to the signing CA (certificates file can be concatenated using a general purpose text editor).
+ </description>
+ </method>
+ </methods>
+</class>
diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml
index 1efd0f9326..c309026aaa 100644
--- a/doc/classes/TextEdit.xml
+++ b/doc/classes/TextEdit.xml
@@ -390,6 +390,45 @@
<return type="PopupMenu" />
<description>
Returns the [PopupMenu] of this [TextEdit]. By default, this menu is displayed when right-clicking on the [TextEdit].
+ You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see [enum MenuItems]). For example:
+ [codeblocks]
+ [gdscript]
+ func _ready():
+ var menu = get_menu()
+ # Remove all items after "Redo".
+ menu.item_count = menu.get_item_index(MENU_REDO) + 1
+ # Add custom items.
+ menu.add_separator()
+ menu.add_item("Insert Date", MENU_MAX + 1)
+ # Connect callback.
+ menu.id_pressed.connect(_on_item_pressed)
+
+ func _on_item_pressed(id):
+ if id == MENU_MAX + 1:
+ insert_text_at_caret(Time.get_date_string_from_system())
+ [/gdscript]
+ [csharp]
+ public override void _Ready()
+ {
+ var menu = GetMenu();
+ // Remove all items after "Redo".
+ menu.ItemCount = menu.GetItemIndex(TextEdit.MenuItems.Redo) + 1;
+ // Add custom items.
+ menu.AddSeparator();
+ menu.AddItem("Insert Date", TextEdit.MenuItems.Max + 1);
+ // Add event handler.
+ menu.IdPressed += OnItemPressed;
+ }
+
+ public void OnItemPressed(int id)
+ {
+ if (id == TextEdit.MenuItems.Max + 1)
+ {
+ InsertTextAtCaret(Time.GetDateStringFromSystem());
+ }
+ }
+ [/csharp]
+ [/codeblocks]
[b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member Window.visible] property.
</description>
</method>
@@ -682,7 +721,7 @@
<return type="void" />
<param index="0" name="option" type="int" />
<description>
- Triggers a right-click menu action by the specified index. See [enum MenuItems] for a list of available indexes.
+ Executes a given action as defined in the [enum MenuItems] enum.
</description>
</method>
<method name="merge_gutters">
@@ -696,7 +735,7 @@
<method name="merge_overlapping_carets">
<return type="void" />
<description>
- Merges any overlapping carets. Will favour the newest caret, or the caret with a selection.
+ Merges any overlapping carets. Will favor the newest caret, or the caret with a selection.
[b]Note:[/b] This is not called when a caret changes position but after certain actions, so it is possible to get into a state where carets overlap.
</description>
</method>
@@ -764,18 +803,18 @@
[codeblocks]
[gdscript]
var result = search("print", SEARCH_WHOLE_WORDS, 0, 0)
- if result.x != -1:
+ if result.x != -1:
# Result found.
var line_number = result.y
var column_number = result.x
[/gdscript]
[csharp]
- Vector2i result = Search("print", (uint)TextEdit.SearchFlags.WholeWords, 0, 0);
- if (result.Length &gt; 0)
+ Vector2I result = Search("print", (uint)TextEdit.SearchFlags.WholeWords, 0, 0);
+ if (result.X != -1)
{
// Result found.
- int lineNumber = result.y;
- int columnNumber = result.x;
+ int lineNumber = result.Y;
+ int columnNumber = result.X;
}
[/csharp]
[/codeblocks]
@@ -1224,70 +1263,76 @@
<constant name="MENU_REDO" value="6" enum="MenuItems">
Redoes the previous action.
</constant>
- <constant name="MENU_DIR_INHERITED" value="7" enum="MenuItems">
+ <constant name="MENU_SUBMENU_TEXT_DIR" value="7" enum="MenuItems">
+ ID of "Text Writing Direction" submenu.
+ </constant>
+ <constant name="MENU_DIR_INHERITED" value="8" enum="MenuItems">
Sets text direction to inherited.
</constant>
- <constant name="MENU_DIR_AUTO" value="8" enum="MenuItems">
+ <constant name="MENU_DIR_AUTO" value="9" enum="MenuItems">
Sets text direction to automatic.
</constant>
- <constant name="MENU_DIR_LTR" value="9" enum="MenuItems">
+ <constant name="MENU_DIR_LTR" value="10" enum="MenuItems">
Sets text direction to left-to-right.
</constant>
- <constant name="MENU_DIR_RTL" value="10" enum="MenuItems">
+ <constant name="MENU_DIR_RTL" value="11" enum="MenuItems">
Sets text direction to right-to-left.
</constant>
- <constant name="MENU_DISPLAY_UCC" value="11" enum="MenuItems">
+ <constant name="MENU_DISPLAY_UCC" value="12" enum="MenuItems">
Toggles control character display.
</constant>
- <constant name="MENU_INSERT_LRM" value="12" enum="MenuItems">
+ <constant name="MENU_SUBMENU_INSERT_UCC" value="13" enum="MenuItems">
+ ID of "Insert Control Character" submenu.
+ </constant>
+ <constant name="MENU_INSERT_LRM" value="14" enum="MenuItems">
Inserts left-to-right mark (LRM) character.
</constant>
- <constant name="MENU_INSERT_RLM" value="13" enum="MenuItems">
+ <constant name="MENU_INSERT_RLM" value="15" enum="MenuItems">
Inserts right-to-left mark (RLM) character.
</constant>
- <constant name="MENU_INSERT_LRE" value="14" enum="MenuItems">
+ <constant name="MENU_INSERT_LRE" value="16" enum="MenuItems">
Inserts start of left-to-right embedding (LRE) character.
</constant>
- <constant name="MENU_INSERT_RLE" value="15" enum="MenuItems">
+ <constant name="MENU_INSERT_RLE" value="17" enum="MenuItems">
Inserts start of right-to-left embedding (RLE) character.
</constant>
- <constant name="MENU_INSERT_LRO" value="16" enum="MenuItems">
+ <constant name="MENU_INSERT_LRO" value="18" enum="MenuItems">
Inserts start of left-to-right override (LRO) character.
</constant>
- <constant name="MENU_INSERT_RLO" value="17" enum="MenuItems">
+ <constant name="MENU_INSERT_RLO" value="19" enum="MenuItems">
Inserts start of right-to-left override (RLO) character.
</constant>
- <constant name="MENU_INSERT_PDF" value="18" enum="MenuItems">
+ <constant name="MENU_INSERT_PDF" value="20" enum="MenuItems">
Inserts pop direction formatting (PDF) character.
</constant>
- <constant name="MENU_INSERT_ALM" value="19" enum="MenuItems">
+ <constant name="MENU_INSERT_ALM" value="21" enum="MenuItems">
Inserts Arabic letter mark (ALM) character.
</constant>
- <constant name="MENU_INSERT_LRI" value="20" enum="MenuItems">
+ <constant name="MENU_INSERT_LRI" value="22" enum="MenuItems">
Inserts left-to-right isolate (LRI) character.
</constant>
- <constant name="MENU_INSERT_RLI" value="21" enum="MenuItems">
+ <constant name="MENU_INSERT_RLI" value="23" enum="MenuItems">
Inserts right-to-left isolate (RLI) character.
</constant>
- <constant name="MENU_INSERT_FSI" value="22" enum="MenuItems">
+ <constant name="MENU_INSERT_FSI" value="24" enum="MenuItems">
Inserts first strong isolate (FSI) character.
</constant>
- <constant name="MENU_INSERT_PDI" value="23" enum="MenuItems">
+ <constant name="MENU_INSERT_PDI" value="25" enum="MenuItems">
Inserts pop direction isolate (PDI) character.
</constant>
- <constant name="MENU_INSERT_ZWJ" value="24" enum="MenuItems">
+ <constant name="MENU_INSERT_ZWJ" value="26" enum="MenuItems">
Inserts zero width joiner (ZWJ) character.
</constant>
- <constant name="MENU_INSERT_ZWNJ" value="25" enum="MenuItems">
+ <constant name="MENU_INSERT_ZWNJ" value="27" enum="MenuItems">
Inserts zero width non-joiner (ZWNJ) character.
</constant>
- <constant name="MENU_INSERT_WJ" value="26" enum="MenuItems">
+ <constant name="MENU_INSERT_WJ" value="28" enum="MenuItems">
Inserts word joiner (WJ) character.
</constant>
- <constant name="MENU_INSERT_SHY" value="27" enum="MenuItems">
+ <constant name="MENU_INSERT_SHY" value="29" enum="MenuItems">
Inserts soft hyphen (SHY) character.
</constant>
- <constant name="MENU_MAX" value="28" enum="MenuItems">
+ <constant name="MENU_MAX" value="30" enum="MenuItems">
Represents the size of the [enum MenuItems] enum.
</constant>
<constant name="ACTION_NONE" value="0" enum="EditAction">
diff --git a/doc/classes/TextServer.xml b/doc/classes/TextServer.xml
index d2c6dee373..711fb89217 100644
--- a/doc/classes/TextServer.xml
+++ b/doc/classes/TextServer.xml
@@ -1042,7 +1042,7 @@
</description>
</method>
<method name="parse_structured_text" qualifiers="const">
- <return type="Vector2i[]" />
+ <return type="Vector3i[]" />
<param index="0" name="parser_type" type="int" enum="TextServer.StructuredTextParser" />
<param index="1" name="args" type="Array" />
<param index="2" name="text" type="String" />
@@ -1634,6 +1634,9 @@
<constant name="DIRECTION_RTL" value="2" enum="Direction">
Text is written from right to left.
</constant>
+ <constant name="DIRECTION_INHERITED" value="3" enum="Direction">
+ Text writing direction is the same as base string writing direction. Used for BiDi override only.
+ </constant>
<constant name="ORIENTATION_HORIZONTAL" value="0" enum="Orientation">
Text is written horizontally.
</constant>
@@ -1881,7 +1884,7 @@
Font have fixed-width characters.
</constant>
<constant name="STRUCTURED_TEXT_DEFAULT" value="0" enum="StructuredTextParser">
- Use default behavior. Same as [constant STRUCTURED_TEXT_NONE] unless specified otherwise in the control description.
+ Use default Unicode BiDi algorithm.
</constant>
<constant name="STRUCTURED_TEXT_URI" value="1" enum="StructuredTextParser">
BiDi override for URI.
@@ -1896,8 +1899,8 @@
BiDi override for lists.
Structured text options: list separator [code]String[/code].
</constant>
- <constant name="STRUCTURED_TEXT_NONE" value="5" enum="StructuredTextParser">
- Use default Unicode BiDi algorithm.
+ <constant name="STRUCTURED_TEXT_GDSCRIPT" value="5" enum="StructuredTextParser">
+ BiDi override for GDScript.
</constant>
<constant name="STRUCTURED_TEXT_CUSTOM" value="6" enum="StructuredTextParser">
User defined structured text BiDi override function.
diff --git a/doc/classes/TextServerExtension.xml b/doc/classes/TextServerExtension.xml
index e144b09eb6..f4b306cf96 100644
--- a/doc/classes/TextServerExtension.xml
+++ b/doc/classes/TextServerExtension.xml
@@ -896,7 +896,7 @@
</description>
</method>
<method name="_parse_structured_text" qualifiers="virtual const">
- <return type="Vector2i[]" />
+ <return type="Vector3i[]" />
<param index="0" name="parser_type" type="int" enum="TextServer.StructuredTextParser" />
<param index="1" name="args" type="Array" />
<param index="2" name="text" type="String" />
diff --git a/doc/classes/Texture2D.xml b/doc/classes/Texture2D.xml
index aac197090a..7329ebb868 100644
--- a/doc/classes/Texture2D.xml
+++ b/doc/classes/Texture2D.xml
@@ -74,6 +74,12 @@
Called when a pixel's opaque state in the [Texture2D] is queried at the specified [code](x, y)[/code] position.
</description>
</method>
+ <method name="create_placeholder" qualifiers="const">
+ <return type="Resource" />
+ <description>
+ Creates a placeholder version of this resource ([PlaceholderTexture2D]).
+ </description>
+ </method>
<method name="draw" qualifiers="const">
<return type="void" />
<param index="0" name="canvas_item" type="RID" />
diff --git a/doc/classes/Texture2DArray.xml b/doc/classes/Texture2DArray.xml
index ec00198db1..6c9fb55bef 100644
--- a/doc/classes/Texture2DArray.xml
+++ b/doc/classes/Texture2DArray.xml
@@ -10,4 +10,12 @@
</description>
<tutorials>
</tutorials>
+ <methods>
+ <method name="create_placeholder" qualifiers="const">
+ <return type="Resource" />
+ <description>
+ Creates a placeholder version of this resource ([PlaceholderTexture2DArray]).
+ </description>
+ </method>
+ </methods>
</class>
diff --git a/doc/classes/Texture3D.xml b/doc/classes/Texture3D.xml
index 1a66932d62..d2df82a74d 100644
--- a/doc/classes/Texture3D.xml
+++ b/doc/classes/Texture3D.xml
@@ -47,6 +47,12 @@
Called when the presence of mipmaps in the [Texture3D] is queried.
</description>
</method>
+ <method name="create_placeholder" qualifiers="const">
+ <return type="Resource" />
+ <description>
+ Creates a placeholder version of this resource ([PlaceholderTexture3D]).
+ </description>
+ </method>
<method name="get_data" qualifiers="const">
<return type="Image[]" />
<description>
diff --git a/doc/classes/TileData.xml b/doc/classes/TileData.xml
index f815b8d0c3..bedc52abd1 100644
--- a/doc/classes/TileData.xml
+++ b/doc/classes/TileData.xml
@@ -218,7 +218,7 @@
<member name="terrain_set" type="int" setter="set_terrain_set" getter="get_terrain_set" default="-1">
ID of the terrain set that the tile uses.
</member>
- <member name="texture_offset" type="Vector2i" setter="set_texture_offset" getter="get_texture_offset" default="Vector2i(0, 0)">
+ <member name="texture_origin" type="Vector2i" setter="set_texture_origin" getter="get_texture_origin" default="Vector2i(0, 0)">
Offsets the position of where the tile is drawn.
</member>
<member name="transpose" type="bool" setter="set_transpose" getter="get_transpose" default="false">
diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml
index f67b84f96f..c387bd435b 100644
--- a/doc/classes/TileMap.xml
+++ b/doc/classes/TileMap.xml
@@ -104,7 +104,8 @@
<param index="1" name="coords" type="Vector2i" />
<param index="2" name="use_proxies" type="bool" default="false" />
<description>
- Returns the tile source ID of the cell on layer [param layer] at coordinates [param coords]. If [param use_proxies] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy].
+ Returns the tile source ID of the cell on layer [param layer] at coordinates [param coords]. Returns [code]-1[/code] if the cell does not exist.
+ If [param use_proxies] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy].
</description>
</method>
<method name="get_cell_tile_data" qualifiers="const">
@@ -113,8 +114,17 @@
<param index="1" name="coords" type="Vector2i" />
<param index="2" name="use_proxies" type="bool" default="false" />
<description>
- Returns the [TileData] object associated with the given cell, or [code]null[/code] if the cell is not a [TileSetAtlasSource].
+ Returns the [TileData] object associated with the given cell, or [code]null[/code] if the cell does not exist or is not a [TileSetAtlasSource].
If [param use_proxies] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy].
+ [codeblock]
+ func get_clicked_tile_power():
+ var clicked_cell = tile_map.local_to_map(tile_map.get_local_mouse_position())
+ var data = tile_map.get_cell_tile_data(0, clicked_cell)
+ if data:
+ return data.get_custom_data("power")
+ else:
+ return 0
+ [/codeblock]
</description>
</method>
<method name="get_coords_for_body_rid">
@@ -241,7 +251,7 @@
<param index="0" name="map_position" type="Vector2i" />
<description>
Returns the centered position of a cell in the TileMap's local coordinate space. To convert the returned value into global coordinates, use [method Node2D.to_global]. See also [method local_to_map].
- [b]Note:[/b] This may not correspond to the visual position of the tile, i.e. it ignores the [member TileData.texture_offset] property of individual tiles.
+ [b]Note:[/b] This may not correspond to the visual position of the tile, i.e. it ignores the [member TileData.texture_origin] property of individual tiles.
</description>
</method>
<method name="move_layer">
diff --git a/doc/classes/TileSet.xml b/doc/classes/TileSet.xml
index 7fc6ba8161..a39a43be4c 100644
--- a/doc/classes/TileSet.xml
+++ b/doc/classes/TileSet.xml
@@ -143,6 +143,14 @@
Returns the custom data layers count.
</description>
</method>
+ <method name="get_navigation_layer_layer_value" qualifiers="const">
+ <return type="bool" />
+ <param index="0" name="layer_index" type="int" />
+ <param index="1" name="layer_number" type="int" />
+ <description>
+ Returns whether or not the specified navigation layer of the TileSet navigation data layer identified by the given [param layer_index] is enabled, given a navigation_layers [param layer_number] between 1 and 32.
+ </description>
+ </method>
<method name="get_navigation_layer_layers" qualifiers="const">
<return type="int" />
<param index="0" name="layer_index" type="int" />
@@ -500,6 +508,15 @@
Sets the type of the custom data layer identified by the given index.
</description>
</method>
+ <method name="set_navigation_layer_layer_value">
+ <return type="void" />
+ <param index="0" name="layer_index" type="int" />
+ <param index="1" name="layer_number" type="int" />
+ <param index="2" name="value" type="bool" />
+ <description>
+ Based on [param value], enables or disables the specified navigation layer of the TileSet navigation data layer identified by the given [param layer_index], given a navigation_layers [param layer_number] between 1 and 32.
+ </description>
+ </method>
<method name="set_navigation_layer_layers">
<return type="void" />
<param index="0" name="layer_index" type="int" />
@@ -589,7 +606,7 @@
<param index="0" name="terrain_set" type="int" />
<param index="1" name="mode" type="int" enum="TileSet.TerrainMode" />
<description>
- Sets a terrain mode. Each mode determines which bits of a tile shape is used to match the neighbouring tiles' terrains.
+ Sets a terrain mode. Each mode determines which bits of a tile shape is used to match the neighboring tiles' terrains.
</description>
</method>
</methods>
diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml
index ff5a665bfd..cf28dafcc9 100644
--- a/doc/classes/Tree.xml
+++ b/doc/classes/Tree.xml
@@ -401,7 +401,7 @@
</signal>
<signal name="item_activated">
<description>
- Emitted when an item's label is double-clicked.
+ Emitted when an item is double-clicked, or selected with a [code]ui_accept[/code] input event (e.g. using [kbd]Enter[/kbd] or [kbd]Space[/kbd] on the keyboard).
</description>
</signal>
<signal name="item_collapsed">
@@ -415,14 +415,14 @@
Emitted when a custom button is pressed (i.e. in a [constant TreeItem.CELL_MODE_CUSTOM] mode cell).
</description>
</signal>
- <signal name="item_double_clicked">
+ <signal name="item_edited">
<description>
- Emitted when an item's icon is double-clicked.
+ Emitted when an item is edited.
</description>
</signal>
- <signal name="item_edited">
+ <signal name="item_icon_double_clicked">
<description>
- Emitted when an item is edited.
+ Emitted when an item's icon is double-clicked. For a signal that emits when any part of the item is double-clicked, see [signal item_activated].
</description>
</signal>
<signal name="item_mouse_selected">
diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml
index fc0dd9f05d..9bb92cf362 100644
--- a/doc/classes/Tween.xml
+++ b/doc/classes/Tween.xml
@@ -19,7 +19,7 @@
Tween tween = GetTree().CreateTween();
tween.TweenProperty(GetNode("Sprite"), "modulate", Colors.Red, 1.0f);
tween.TweenProperty(GetNode("Sprite"), "scale", Vector2.Zero, 1.0f);
- tween.TweenCallback(new Callable(GetNode("Sprite").QueueFree));
+ tween.TweenCallback(Callable.From(GetNode("Sprite").QueueFree));
[/csharp]
[/codeblocks]
This sequence will make the [code]$Sprite[/code] node turn red, then shrink, before finally calling [method Node.queue_free] to free the sprite. [Tweener]s are executed one after another by default. This behavior can be changed using [method parallel] and [method set_parallel].
@@ -35,7 +35,7 @@
Tween tween = GetTree().CreateTween();
tween.TweenProperty(GetNode("Sprite"), "modulate", Colors.Red, 1.0f).SetTrans(Tween.TransitionType.Sine);
tween.TweenProperty(GetNode("Sprite"), "scale", Vector2.Zero, 1.0f).SetTrans(Tween.TransitionType.Bounce);
- tween.TweenCallback(new Callable(GetNode("Sprite").QueueFree));
+ tween.TweenCallback(Callable.From(GetNode("Sprite").QueueFree));
[/csharp]
[/codeblocks]
Most of the [Tween] methods can be chained this way too. In the following example the [Tween] is bound to the running script's node and a default transition is set for its [Tweener]s:
@@ -50,7 +50,7 @@
var tween = GetTree().CreateTween().BindNode(this).SetTrans(Tween.TransitionType.Elastic);
tween.TweenProperty(GetNode("Sprite"), "modulate", Colors.Red, 1.0f);
tween.TweenProperty(GetNode("Sprite"), "scale", Vector2.Zero, 1.0f);
- tween.TweenCallback(new Callable(GetNode("Sprite").QueueFree));
+ tween.TweenCallback(Callable.From(GetNode("Sprite").QueueFree));
[/csharp]
[/codeblocks]
Another interesting use for [Tween]s is animating arbitrary sets of objects:
@@ -281,7 +281,7 @@
[/gdscript]
[csharp]
Tween tween = GetTree().CreateTween().SetLoops();
- tween.TweenCallback(new Callable(Shoot)).SetDelay(1.0f);
+ tween.TweenCallback(Callable.From(Shoot)).SetDelay(1.0f);
[/csharp]
[/codeblocks]
[b]Example:[/b] Turning a sprite red and then blue, with 2 second delay:
@@ -294,8 +294,8 @@
[csharp]
Tween tween = GetTree().CreateTween();
Sprite2D sprite = GetNode&lt;Sprite2D&gt;("Sprite");
- tween.TweenCallback(new Callable(() =&gt; sprite.Modulate = Colors.Red)).SetDelay(2.0f);
- tween.TweenCallback(new Callable(() =&gt; sprite.Modulate = Colors.Blue)).SetDelay(2.0f);
+ tween.TweenCallback(Callable.From(() =&gt; sprite.Modulate = Colors.Red)).SetDelay(2.0f);
+ tween.TweenCallback(Callable.From(() =&gt; sprite.Modulate = Colors.Blue)).SetDelay(2.0f);
[/csharp]
[/codeblocks]
</description>
@@ -332,10 +332,10 @@
[csharp]
Tween tween = CreateTween().SetLoops();
tween.TweenProperty(GetNode("Sprite"), "position:x", 200.0f, 1.0f).AsRelative();
- tween.TweenCallback(new Callable(Jump));
+ tween.TweenCallback(Callable.From(Jump));
tween.TweenInterval(2.0f);
tween.TweenProperty(GetNode("Sprite"), "position:x", -200.0f, 1.0f).AsRelative();
- tween.TweenCallback(new Callable(Jump));
+ tween.TweenCallback(Callable.From(Jump));
tween.TweenInterval(2.0f);
[/csharp]
[/codeblocks]
@@ -357,7 +357,7 @@
[/gdscript]
[csharp]
Tween tween = CreateTween();
- tween.TweenMethod(new Callable(() =&gt; LookAt(Vector3.Up)), new Vector3(-1.0f, 0.0f, -1.0f), new Vector3(1.0f, 0.0f, -1.0f), 1.0f); // The LookAt() method takes up vector as second argument.
+ tween.TweenMethod(Callable.From(() =&gt; LookAt(Vector3.Up)), new Vector3(-1.0f, 0.0f, -1.0f), new Vector3(1.0f, 0.0f, -1.0f), 1.0f); // The LookAt() method takes up vector as second argument.
[/csharp]
[/codeblocks]
[b]Example:[/b] Setting the text of a [Label], using an intermediate method and after a delay:
@@ -376,7 +376,7 @@
base._Ready();
Tween tween = CreateTween();
- tween.TweenMethod(new Callable(SetLabelText), 0.0f, 10.0f, 1.0f).SetDelay(1.0f);
+ tween.TweenMethod(Callable.From&lt;int&gt;(SetLabelText), 0.0f, 10.0f, 1.0f).SetDelay(1.0f);
}
private void SetLabelText(int value)
diff --git a/doc/classes/UndoRedo.xml b/doc/classes/UndoRedo.xml
index 42baf7728d..6c151ef958 100644
--- a/doc/classes/UndoRedo.xml
+++ b/doc/classes/UndoRedo.xml
@@ -48,10 +48,10 @@
{
var node = GetNode&lt;Node2D&gt;("MyNode2D");
UndoRedo.CreateAction("Move the node");
- UndoRedo.AddDoMethod(this, nameof(DoSomething));
- UndoRedo.AddUndoMethod(this, nameof(UndoSomething));
- UndoRedo.AddDoProperty(node, "position", new Vector2(100, 100));
- UndoRedo.AddUndoProperty(node, "position", node.Position);
+ UndoRedo.AddDoMethod(this, MethodName.DoSomething);
+ UndoRedo.AddUndoMethod(this, MethodName.UndoSomething);
+ UndoRedo.AddDoProperty(node, Node2D.PropertyName.Position, new Vector2(100, 100));
+ UndoRedo.AddUndoProperty(node, Node2D.PropertyName.Position, node.Position);
UndoRedo.CommitAction();
}
[/csharp]
diff --git a/doc/classes/VehicleBody3D.xml b/doc/classes/VehicleBody3D.xml
index e1689133de..9f905c0ec5 100644
--- a/doc/classes/VehicleBody3D.xml
+++ b/doc/classes/VehicleBody3D.xml
@@ -7,6 +7,7 @@
This node implements all the physics logic needed to simulate a car. It is based on the raycast vehicle system commonly found in physics engines. You will need to add a [CollisionShape3D] for the main body of your vehicle and add [VehicleWheel3D] nodes for the wheels. You should also add a [MeshInstance3D] to this node for the 3D model of your car but this model should not include meshes for the wheels. You should control the vehicle by using the [member brake], [member engine_force], and [member steering] properties and not change the position or orientation of this node directly.
[b]Note:[/b] The origin point of your VehicleBody3D will determine the center of gravity of your vehicle so it is better to keep this low and move the [CollisionShape3D] and [MeshInstance3D] upwards.
[b]Note:[/b] This class has known issues and isn't designed to provide realistic 3D vehicle physics. If you want advanced vehicle physics, you will probably have to write your own physics integration using another [PhysicsBody3D] class.
+ [b]Warning:[/b] With a non-uniform scale this node will probably not function as expected. Please make sure to keep its scale uniform (i.e. the same on all axes), and change the size(s) of its collision shape(s) instead.
</description>
<tutorials>
<link title="3D Truck Town Demo">https://godotengine.org/asset-library/asset/524</link>
diff --git a/doc/classes/VideoStream.xml b/doc/classes/VideoStream.xml
index 2797ad3513..648c3edd73 100644
--- a/doc/classes/VideoStream.xml
+++ b/doc/classes/VideoStream.xml
@@ -8,4 +8,18 @@
</description>
<tutorials>
</tutorials>
+ <methods>
+ <method name="_instantiate_playback" qualifiers="virtual">
+ <return type="VideoStreamPlayback" />
+ <description>
+ Called when the video starts playing, to initialize and return a subclass of [VideoStreamPlayback].
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="file" type="String" setter="set_file" getter="get_file" default="&quot;&quot;">
+ The video file path or URI that this [VideoStream] resource handles.
+ For [VideoStreamTheora], this filename should be an Ogg Theora video file with the [code].ogv[/code] extension.
+ </member>
+ </members>
</class>
diff --git a/doc/classes/VideoStreamPlayback.xml b/doc/classes/VideoStreamPlayback.xml
new file mode 100644
index 0000000000..8d8b4fe5b1
--- /dev/null
+++ b/doc/classes/VideoStreamPlayback.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="VideoStreamPlayback" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
+ <brief_description>
+ Internal class used by [VideoStream] to manage playback state when played from a [VideoStreamPlayer].
+ </brief_description>
+ <description>
+ This class is intended to be overridden by video decoder extensions with custom implementations of [VideoStream].
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ <method name="_get_channels" qualifiers="virtual const">
+ <return type="int" />
+ <description>
+ Returns the number of audio channels.
+ </description>
+ </method>
+ <method name="_get_length" qualifiers="virtual const">
+ <return type="float" />
+ <description>
+ Returns the video duration in seconds, if known, or 0 if unknown.
+ </description>
+ </method>
+ <method name="_get_mix_rate" qualifiers="virtual const">
+ <return type="int" />
+ <description>
+ Returns the audio sample rate used for mixing.
+ </description>
+ </method>
+ <method name="_get_playback_position" qualifiers="virtual const">
+ <return type="float" />
+ <description>
+ Return the current playback timestamp. Called in response to the [member VideoStreamPlayer.stream_position] getter.
+ </description>
+ </method>
+ <method name="_get_texture" qualifiers="virtual const">
+ <return type="Texture2D" />
+ <description>
+ Allocates a [Texture2D] in which decoded video frames will be drawn.
+ </description>
+ </method>
+ <method name="_is_paused" qualifiers="virtual const">
+ <return type="bool" />
+ <description>
+ Returns the paused status, as set by [method _set_paused].
+ </description>
+ </method>
+ <method name="_is_playing" qualifiers="virtual const">
+ <return type="bool" />
+ <description>
+ Returns the playback state, as determined by calls to [method _play] and [method _stop].
+ </description>
+ </method>
+ <method name="_play" qualifiers="virtual">
+ <return type="void" />
+ <description>
+ Called in response to [member VideoStreamPlayer.autoplay] or [method VideoStreamPlayer.play]. Note that manual playback may also invoke [method _stop] multiple times before this method is called. [method _is_playing] should return true once playing.
+ </description>
+ </method>
+ <method name="_seek" qualifiers="virtual">
+ <return type="void" />
+ <param index="0" name="time" type="float" />
+ <description>
+ Seeks to [code]time[/code] seconds. Called in response to the [member VideoStreamPlayer.stream_position] setter.
+ </description>
+ </method>
+ <method name="_set_audio_track" qualifiers="virtual">
+ <return type="void" />
+ <param index="0" name="idx" type="int" />
+ <description>
+ Select the audio track [code]idx[/code]. Called when playback starts, and in response to the [member VideoStreamPlayer.audio_track] setter.
+ </description>
+ </method>
+ <method name="_set_paused" qualifiers="virtual">
+ <return type="void" />
+ <param index="0" name="paused" type="bool" />
+ <description>
+ Set the paused status of video playback. [method _is_paused] must return [code]paused[/code]. Called in response to the [member VideoStreamPlayer.paused] setter.
+ </description>
+ </method>
+ <method name="_stop" qualifiers="virtual">
+ <return type="void" />
+ <description>
+ Stops playback. May be called multiple times before [method _play], or in response to [method VideoStreamPlayer.stop]. [method _is_playing] should return false once stopped.
+ </description>
+ </method>
+ <method name="_update" qualifiers="virtual">
+ <return type="void" />
+ <param index="0" name="delta" type="float" />
+ <description>
+ Ticks video playback for [code]delta[/code] seconds. Called every frame as long as [method _is_paused] and [method _is_playing] return true.
+ </description>
+ </method>
+ <method name="mix_audio">
+ <return type="int" />
+ <param index="0" name="num_frames" type="int" />
+ <param index="1" name="buffer" type="PackedFloat32Array" default="PackedFloat32Array()" />
+ <param index="2" name="offset" type="int" default="0" />
+ <description>
+ Render [code]num_frames[/code] audio frames (of [method _get_channels] floats each) from [code]buffer[/code], starting from index [code]offset[/code] in the array. Returns the number of audio frames rendered, or -1 on error.
+ </description>
+ </method>
+ </methods>
+</class>
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index 236d34383f..ab2de14638 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -55,7 +55,7 @@
<method name="get_final_transform" qualifiers="const">
<return type="Transform2D" />
<description>
- Returns the total transform of the viewport.
+ Returns the transform from the viewport's coordinate system to the embedder's coordinate system.
</description>
</method>
<method name="get_mouse_position" qualifiers="const">
@@ -210,6 +210,7 @@
<param index="0" name="position" type="Vector2" />
<description>
Moves the mouse pointer to the specified position in this [Viewport] using the coordinate system of this [Viewport].
+ [b]Note:[/b] [method warp_mouse] is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web.
</description>
</method>
</methods>
diff --git a/doc/classes/VisualInstance3D.xml b/doc/classes/VisualInstance3D.xml
index e069642e50..3781045c02 100644
--- a/doc/classes/VisualInstance3D.xml
+++ b/doc/classes/VisualInstance3D.xml
@@ -64,7 +64,7 @@
<member name="sorting_offset" type="float" setter="set_sorting_offset" getter="get_sorting_offset" default="0.0">
The sorting offset used by this [VisualInstance3D]. Adjusting it to a higher value will make the [VisualInstance3D] reliably draw on top of other [VisualInstance3D]s that are otherwise positioned at the same spot.
</member>
- <member name="sorting_use_aabb_center" type="bool" setter="set_sorting_use_aabb_center" getter="is_sorting_use_aabb_center" default="true">
+ <member name="sorting_use_aabb_center" type="bool" setter="set_sorting_use_aabb_center" getter="is_sorting_use_aabb_center">
If [code]true[/code], the object is sorted based on the [AABB] center. The object will be sorted based on the global position otherwise.
The [AABB] center based sorting is generally more accurate for 3D models. The position based sorting instead allows to better control the drawing order when working with [GPUParticles3D] and [CPUParticles3D].
</member>
diff --git a/doc/classes/VisualShaderNode.xml b/doc/classes/VisualShaderNode.xml
index f95f871e52..685f5d5eef 100644
--- a/doc/classes/VisualShaderNode.xml
+++ b/doc/classes/VisualShaderNode.xml
@@ -58,13 +58,6 @@
Sets the output port index which will be showed for preview. If set to [code]-1[/code] no port will be open for preview.
</member>
</members>
- <signals>
- <signal name="editor_refresh_request">
- <description>
- Emitted when the node requests an editor refresh. Currently called only in setter of [member VisualShaderNodeTexture.source], [VisualShaderNodeTexture], and [VisualShaderNodeCubemap] (and their derivatives).
- </description>
- </signal>
- </signals>
<constants>
<constant name="PORT_TYPE_SCALAR" value="0" enum="PortType">
Floating-point scalar. Translated to [code]float[/code] type in shader code.
diff --git a/doc/classes/VisualShaderNodeDerivativeFunc.xml b/doc/classes/VisualShaderNodeDerivativeFunc.xml
index 9a1ad53394..4a31969171 100644
--- a/doc/classes/VisualShaderNodeDerivativeFunc.xml
+++ b/doc/classes/VisualShaderNodeDerivativeFunc.xml
@@ -15,6 +15,9 @@
<member name="op_type" type="int" setter="set_op_type" getter="get_op_type" enum="VisualShaderNodeDerivativeFunc.OpType" default="0">
A type of operands and returned value. See [enum OpType] for options.
</member>
+ <member name="precision" type="int" setter="set_precision" getter="get_precision" enum="VisualShaderNodeDerivativeFunc.Precision" default="0">
+ Sets the level of precision to use for the derivative function. See [enum Precision] for options. When using the GL_Compatibility renderer, this setting has no effect.
+ </member>
</members>
<constants>
<constant name="OP_TYPE_SCALAR" value="0" enum="OpType">
@@ -44,5 +47,17 @@
<constant name="FUNC_MAX" value="3" enum="Function">
Represents the size of the [enum Function] enum.
</constant>
+ <constant name="PRECISION_NONE" value="0" enum="Precision">
+ No precision is specified, the GPU driver is allowed to use whatever level of precision it chooses. This is the default option and is equivalent to using [code]dFdx()[/code] or [code]dFdy()[/code] in text shaders.
+ </constant>
+ <constant name="PRECISION_COARSE" value="1" enum="Precision">
+ The derivative will be calculated using the current fragment's neighbors (which may not include the current fragment). This tends to be faster than using [constant PRECISION_FINE], but may not be suitable when more precision is needed. This is equivalent to using [code]dFdxCoarse()[/code] or [code]dFdyCoarse()[/code] in text shaders.
+ </constant>
+ <constant name="PRECISION_FINE" value="2" enum="Precision">
+ The derivative will be calculated using the current fragment and its immediate neighbors. This tends to be slower than using [constant PRECISION_COARSE], but may be necessary when more precision is needed. This is equivalent to using [code]dFdxFine()[/code] or [code]dFdyFine()[/code] in text shaders.
+ </constant>
+ <constant name="PRECISION_MAX" value="3" enum="Precision">
+ Represents the size of the [enum Precision] enum.
+ </constant>
</constants>
</class>
diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml
index da31e6761e..c4ea11ab66 100644
--- a/doc/classes/Window.xml
+++ b/doc/classes/Window.xml
@@ -771,8 +771,16 @@
Right-to-left layout direction.
</constant>
<constant name="WINDOW_INITIAL_POSITION_ABSOLUTE" value="0" enum="WindowInitialPosition">
+ Initial window position is determined by [member position].
</constant>
- <constant name="WINDOW_INITIAL_POSITION_CENTER_SCREEN" value="1" enum="WindowInitialPosition">
+ <constant name="WINDOW_INITIAL_POSITION_CENTER_PRIMARY_SCREEN" value="1" enum="WindowInitialPosition">
+ Initial window position is a center of the primary screen.
+ </constant>
+ <constant name="WINDOW_INITIAL_POSITION_CENTER_MAIN_WINDOW_SCREEN" value="2" enum="WindowInitialPosition">
+ Initial window position is a center of the main window screen.
+ </constant>
+ <constant name="WINDOW_INITIAL_POSITION_CENTER_OTHER_SCREEN" value="3" enum="WindowInitialPosition">
+ Initial window position is a center of [member current_screen] screen.
</constant>
</constants>
<theme_items>
diff --git a/doc/classes/XRController3D.xml b/doc/classes/XRController3D.xml
index 9e192177e5..0b21002893 100644
--- a/doc/classes/XRController3D.xml
+++ b/doc/classes/XRController3D.xml
@@ -13,11 +13,18 @@
<link title="XR documentation index">$DOCS_URL/tutorials/xr/index.html</link>
</tutorials>
<methods>
- <method name="get_axis" qualifiers="const">
- <return type="Vector2" />
+ <method name="get_float" qualifiers="const">
+ <return type="float" />
<param index="0" name="name" type="StringName" />
<description>
- Returns a [Vector2] for the input with the given [param name]. This is used for thumbsticks and thumbpads found on many controllers.
+ Returns a numeric value for the input with the given [param name]. This is used for triggers and grip sensors.
+ </description>
+ </method>
+ <method name="get_input" qualifiers="const">
+ <return type="Variant" />
+ <param index="0" name="name" type="StringName" />
+ <description>
+ Returns a [Variant] for the input with the given [param name]. This works for any input type, the variant will be typed according to the actions configuration.
</description>
</method>
<method name="get_tracker_hand" qualifiers="const">
@@ -26,11 +33,11 @@
Returns the hand holding this controller, if known. See [enum XRPositionalTracker.TrackerHand].
</description>
</method>
- <method name="get_value" qualifiers="const">
- <return type="float" />
+ <method name="get_vector2" qualifiers="const">
+ <return type="Vector2" />
<param index="0" name="name" type="StringName" />
<description>
- Returns a numeric value for the input with the given [param name]. This is used for triggers and grip sensors.
+ Returns a [Vector2] for the input with the given [param name]. This is used for thumbsticks and thumbpads found on many controllers.
</description>
</method>
<method name="is_button_pressed" qualifiers="const">
@@ -54,18 +61,18 @@
Emitted when a button on this controller is released.
</description>
</signal>
- <signal name="input_axis_changed">
+ <signal name="input_float_changed">
<param index="0" name="name" type="String" />
- <param index="1" name="value" type="Vector2" />
+ <param index="1" name="value" type="float" />
<description>
- Emitted when a thumbstick or thumbpad on this controller is moved.
+ Emitted when a trigger or similar input on this controller changes value.
</description>
</signal>
- <signal name="input_value_changed">
+ <signal name="input_vector2_changed">
<param index="0" name="name" type="String" />
- <param index="1" name="value" type="float" />
+ <param index="1" name="value" type="Vector2" />
<description>
- Emitted when a trigger or similar input on this controller changes value.
+ Emitted when a thumbstick or thumbpad on this controller is moved.
</description>
</signal>
</signals>
diff --git a/doc/classes/XRPositionalTracker.xml b/doc/classes/XRPositionalTracker.xml
index db2910f25e..93e6a5497c 100644
--- a/doc/classes/XRPositionalTracker.xml
+++ b/doc/classes/XRPositionalTracker.xml
@@ -92,18 +92,18 @@
Emitted when a button on this tracker is released.
</description>
</signal>
- <signal name="input_axis_changed">
+ <signal name="input_float_changed">
<param index="0" name="name" type="String" />
- <param index="1" name="vector" type="Vector2" />
+ <param index="1" name="value" type="float" />
<description>
- Emitted when a thumbstick or thumbpad on this tracker moves.
+ Emitted when a trigger or similar input on this tracker changes value.
</description>
</signal>
- <signal name="input_value_changed">
+ <signal name="input_vector2_changed">
<param index="0" name="name" type="String" />
- <param index="1" name="value" type="float" />
+ <param index="1" name="vector" type="Vector2" />
<description>
- Emitted when a trigger or similar input on this tracker changes value.
+ Emitted when a thumbstick or thumbpad on this tracker moves.
</description>
</signal>
<signal name="pose_changed">
diff --git a/doc/translations/ar.po b/doc/translations/ar.po
index 751017b573..eb8e6dc7b6 100644
--- a/doc/translations/ar.po
+++ b/doc/translations/ar.po
@@ -30107,7 +30107,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/ca.po b/doc/translations/ca.po
index 1552c15271..cce60f13ac 100644
--- a/doc/translations/ca.po
+++ b/doc/translations/ca.po
@@ -30023,7 +30023,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/classes.pot b/doc/translations/classes.pot
index 40ab5e3413..3c793335e2 100644
--- a/doc/translations/classes.pot
+++ b/doc/translations/classes.pot
@@ -1,6 +1,6 @@
# LANGUAGE translation of the Godot Engine class reference.
-# Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.
-# Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).
+# Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md).
+# Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.
# This file is distributed under the same license as the Godot source code.
#
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
@@ -29900,7 +29900,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/cs.po b/doc/translations/cs.po
index 1bd920e19b..b2072217a1 100644
--- a/doc/translations/cs.po
+++ b/doc/translations/cs.po
@@ -30498,7 +30498,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/de.po b/doc/translations/de.po
index 1533aa651d..14d2291f8c 100644
--- a/doc/translations/de.po
+++ b/doc/translations/de.po
@@ -33701,7 +33701,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/el.po b/doc/translations/el.po
index 13c4fbfe68..63ddea8f7b 100644
--- a/doc/translations/el.po
+++ b/doc/translations/el.po
@@ -29951,7 +29951,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/es.po b/doc/translations/es.po
index 8ed223238d..9462004570 100644
--- a/doc/translations/es.po
+++ b/doc/translations/es.po
@@ -39,12 +39,13 @@
# Keyla Arroyos <keylaarroyos@protonmail.com>, 2022.
# Victor Stancioiu <victorstancioiu@gmail.com>, 2022.
# yohanger <yohangerariel@gmail.com>, 2022.
+# Mateo <mfdez920@gmail.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine class reference\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
-"PO-Revision-Date: 2022-11-29 20:23+0000\n"
-"Last-Translator: yohanger <yohangerariel@gmail.com>\n"
+"PO-Revision-Date: 2023-01-12 06:06+0000\n"
+"Last-Translator: Mateo <mfdez920@gmail.com>\n"
"Language-Team: Spanish <https://hosted.weblate.org/projects/godot-engine/"
"godot-class-reference/es/>\n"
"Language: es\n"
@@ -52,7 +53,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: doc/tools/make_rst.py
msgid "Description"
@@ -751,7 +752,6 @@ msgstr ""
"[/codeblock]"
#: modules/gdscript/doc_classes/@GDScript.xml
-#, fuzzy
msgid ""
"Returns an array of dictionaries representing the current call stack. See "
"also [method print_stack].\n"
@@ -776,7 +776,7 @@ msgid ""
"projects exported in debug mode if not connected to a debugging server."
msgstr ""
"Devuelve un conjunto de diccionarios que representan la pila de llamadas "
-"actual.\n"
+"actual. Véase también [method print_stack].\n"
"[codeblock]\n"
"func _ready():\n"
" foo()\n"
@@ -39560,6 +39560,7 @@ msgid ""
msgstr ""
#: doc/classes/Input.xml
+#, fuzzy
msgid ""
"Sets a custom mouse cursor image, which is only visible inside the game "
"window. The hotspot can also be specified. Passing [code]null[/code] to the "
@@ -39571,7 +39572,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
"Establece una imagen personalizada del cursor del ratón, que sólo es visible "
"dentro de la ventana del juego. También se puede especificar el punto de "
diff --git a/doc/translations/et.po b/doc/translations/et.po
index 7f92671d8f..b7512b6ae5 100644
--- a/doc/translations/et.po
+++ b/doc/translations/et.po
@@ -29913,7 +29913,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/fa.po b/doc/translations/fa.po
index 787c7ff937..ce5dd6b0c2 100644
--- a/doc/translations/fa.po
+++ b/doc/translations/fa.po
@@ -30352,7 +30352,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/fi.po b/doc/translations/fi.po
index fc517a6ff5..0f19296424 100644
--- a/doc/translations/fi.po
+++ b/doc/translations/fi.po
@@ -30034,7 +30034,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/fil.po b/doc/translations/fil.po
index 749fea9ef9..bfa8c75c7a 100644
--- a/doc/translations/fil.po
+++ b/doc/translations/fil.po
@@ -29919,7 +29919,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/fr.po b/doc/translations/fr.po
index 2898e9ec19..a57c138429 100644
--- a/doc/translations/fr.po
+++ b/doc/translations/fr.po
@@ -60,13 +60,14 @@
# Augustin Ambiehl <ambiehlaugustin@gmail.com>, 2022.
# Landry Simo <landrysimo99@gmail.com>, 2022.
# Alexis Coudert <coudert.alex@gmail.com>, 2022.
+# Callim Ethee <callimethee@gmail.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine class reference\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-12-03 00:47+0000\n"
-"Last-Translator: Alexis Coudert <coudert.alex@gmail.com>\n"
+"PO-Revision-Date: 2023-01-01 02:51+0000\n"
+"Last-Translator: Callim Ethee <callimethee@gmail.com>\n"
"Language-Team: French <https://hosted.weblate.org/projects/godot-engine/"
"godot-class-reference/fr/>\n"
"Language: fr\n"
@@ -74,7 +75,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 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: doc/tools/make_rst.py
msgid "Description"
@@ -137,9 +138,8 @@ msgid "Default"
msgstr "Défaut"
#: doc/tools/make_rst.py
-#, fuzzy
msgid "Setter"
-msgstr "Setter"
+msgstr "Donneur"
#: doc/tools/make_rst.py
msgid "value"
@@ -39456,7 +39456,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/gl.po b/doc/translations/gl.po
index 67bd7d902f..9b3ea41370 100644
--- a/doc/translations/gl.po
+++ b/doc/translations/gl.po
@@ -29908,7 +29908,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/hi.po b/doc/translations/hi.po
index 75318a4554..ca1ba04874 100644
--- a/doc/translations/hi.po
+++ b/doc/translations/hi.po
@@ -29907,7 +29907,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/hu.po b/doc/translations/hu.po
index e99babd548..f5a053dfc9 100644
--- a/doc/translations/hu.po
+++ b/doc/translations/hu.po
@@ -29927,7 +29927,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/id.po b/doc/translations/id.po
index ad63a828e5..8a1e757105 100644
--- a/doc/translations/id.po
+++ b/doc/translations/id.po
@@ -30324,7 +30324,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/is.po b/doc/translations/is.po
index 6bf49858f4..0afd2be589 100644
--- a/doc/translations/is.po
+++ b/doc/translations/is.po
@@ -29907,7 +29907,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/it.po b/doc/translations/it.po
index 37488c9ebd..35ff1ac6f3 100644
--- a/doc/translations/it.po
+++ b/doc/translations/it.po
@@ -31127,7 +31127,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/ja.po b/doc/translations/ja.po
index cabf1da54a..2798995dfa 100644
--- a/doc/translations/ja.po
+++ b/doc/translations/ja.po
@@ -33191,7 +33191,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/ko.po b/doc/translations/ko.po
index 72a7780a4c..3b3137f849 100644
--- a/doc/translations/ko.po
+++ b/doc/translations/ko.po
@@ -19,12 +19,13 @@
# ì´ì§€ë¯¼ <jiminaleejung@gmail.com>, 2022.
# nulltable <un5450@naver.com>, 2022.
# Godoto <aicompose@gmail.com>, 2022.
+# 오지훈 <jule1130@naver.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine class reference\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
-"PO-Revision-Date: 2022-10-18 18:00+0000\n"
-"Last-Translator: Godoto <aicompose@gmail.com>\n"
+"PO-Revision-Date: 2023-01-19 14:47+0000\n"
+"Last-Translator: 오지훈 <jule1130@naver.com>\n"
"Language-Team: Korean <https://hosted.weblate.org/projects/godot-engine/"
"godot-class-reference/ko/>\n"
"Language: ko\n"
@@ -32,11 +33,11 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Weblate 4.15-dev\n"
+"X-Generator: Weblate 4.15.1\n"
#: doc/tools/make_rst.py
msgid "Description"
-msgstr "서술"
+msgstr "설명"
#: doc/tools/make_rst.py
msgid "Tutorials"
@@ -30234,7 +30235,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/lt.po b/doc/translations/lt.po
index 1cf0ffef48..c52d238af9 100644
--- a/doc/translations/lt.po
+++ b/doc/translations/lt.po
@@ -29917,7 +29917,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/lv.po b/doc/translations/lv.po
index fd9ddf6f51..bf5aa78341 100644
--- a/doc/translations/lv.po
+++ b/doc/translations/lv.po
@@ -29925,7 +29925,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/mr.po b/doc/translations/mr.po
index 19db2e5f94..71013cc0e7 100644
--- a/doc/translations/mr.po
+++ b/doc/translations/mr.po
@@ -29905,7 +29905,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/nb.po b/doc/translations/nb.po
index 3b7f482e48..6431d1756d 100644
--- a/doc/translations/nb.po
+++ b/doc/translations/nb.po
@@ -29917,7 +29917,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/ne.po b/doc/translations/ne.po
index c616f7b4e1..b043d7c5af 100644
--- a/doc/translations/ne.po
+++ b/doc/translations/ne.po
@@ -29905,7 +29905,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/nl.po b/doc/translations/nl.po
index cf40d032cf..de3a4a7497 100644
--- a/doc/translations/nl.po
+++ b/doc/translations/nl.po
@@ -29978,7 +29978,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/pl.po b/doc/translations/pl.po
index cd2bedd302..a5c59f489b 100644
--- a/doc/translations/pl.po
+++ b/doc/translations/pl.po
@@ -30529,7 +30529,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/pt.po b/doc/translations/pt.po
index d3d9b9aadf..0f7b9f54e3 100644
--- a/doc/translations/pt.po
+++ b/doc/translations/pt.po
@@ -4,7 +4,7 @@
# This file is distributed under the same license as the Godot source code.
#
# Reubens Sanders <reubensst@protonmail.com>, 2021.
-# ssantos <ssantos@web.de>, 2022.
+# ssantos <ssantos@web.de>, 2022, 2023.
# Felipe SiFa <felipe@logus.digital>, 2022.
# Renu <ifpilucas@gmail.com>, 2022.
# Diogo Gomes <dgomes@graphnode.com>, 2022.
@@ -18,7 +18,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Godot Engine class reference\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
-"PO-Revision-Date: 2022-11-18 16:48+0000\n"
+"PO-Revision-Date: 2023-01-11 16:51+0000\n"
"Last-Translator: ssantos <ssantos@web.de>\n"
"Language-Team: Portuguese <https://hosted.weblate.org/projects/godot-engine/"
"godot-class-reference/pt/>\n"
@@ -27,7 +27,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
-"X-Generator: Weblate 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: doc/tools/make_rst.py
msgid "Description"
@@ -394,8 +394,8 @@ msgid ""
"[/codeblock]\n"
"This is the inverse of [method ord]."
msgstr ""
-"Retorna um caractere como uma String de um dado code point Unicode (que é "
-"compatível com ASCII code);\n"
+"Retorna um caractere como uma cadeia de caracteres de um dado code point "
+"Unicode (compatível com ASCII code);\n"
"[codeblock]\n"
"a = char(65) # a é \"A\"\n"
"a = char(65 + 32) # a é \"a\"\n"
@@ -517,15 +517,15 @@ msgid ""
"want a true content-aware comparison, you have to use [code]deep_equal[/"
"code]."
msgstr ""
-"Compara dois valores verificando seu conteúdo real, por meio de recursão em "
-"um [Array] ou [Dictionary] em todos os seus níveis.\n"
-"Esta função se asemelha ou difere de [code]==[/code] de diversas maneiras:\n"
+"Compara dois valores verificando o conteúdo real deles, por meio de recursão "
+"em um [Array] ou [Dictionary] em todos os seus níveis.\n"
+"Esta função compara a [code]==[/code] de diversas maneiras:\n"
"- Para [code]null[/code], [code]int[/code], [code]float[/code], "
"[code]String[/code], [code]Object[/code] e [code] RID[/code] tanto "
"[code]deep_equal[/code] quanto [code]==[/code] funcionam da mesma forma.\n"
"- Para [code]Dictionary[/code], [code]==[/code] considera-se igual se, e "
"somente se, ambas as variáveis apontarem para o mesmo [code]Dictionary[/"
-"code], sem recursão ou checagem de seu conteúdo.\n"
+"code], sem recursão ou checagem do seu conteúdo.\n"
"- Para [code]Array[/code], [code]==[/code] considera igual se, e somente se, "
"cada item no primeiro [code]Array[/code] for igual ao seu homólogo no "
"segundo [ code]Array[/code], conforme informado pelo próprio [code]==[/"
@@ -928,7 +928,7 @@ msgid ""
"[/codeblock]"
msgstr ""
"Retorna o comprimento da Variant [code]var[/code]. Comprimento é a contagem "
-"de caracteres de uma String, contagem de elementos de uma Array, o tamanho "
+"de caracteres de uma cadeia, contagem de elementos de uma Array, o tamanho "
"de um Dicionario, etc.\n"
"[b]Note:[/b] Gera um erro fatal se Variant não puder retornar um "
"comprimento.\n"
@@ -1361,7 +1361,7 @@ msgid ""
"distinguishes them from print messages used for debugging purposes, while "
"also displaying a stack trace when an error or warning is printed."
msgstr ""
-"Converte um ou mais argumentos de qualquer tipo para string da melhor "
+"Converte um ou mais argumentos de qualquer tipo para cadeia da melhor "
"maneira possível e imprime no console\n"
"[codeblock]\n"
"a = [1, 2, 3]\n"
@@ -1370,7 +1370,7 @@ msgstr ""
"[b]Nota:[/b] Considere usar [method push_error] e [method push_warning] para "
"imprimir mensagens de erro e aviso ao invés de [method print]. Isso os "
"distinguirá de impressões com propósito de depuração e também mostrará um "
-"rastreamento de pilha quando um erro ou aviso é impresso ."
+"rastreamento de pilha quando um erro ou aviso é impresso."
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -1890,7 +1890,7 @@ msgid ""
"len(b) # Returns 12\n"
"[/codeblock]"
msgstr ""
-"Converte um ou mais argumentos de quaisquer tipos para string na melhor "
+"Converte um ou mais argumentos de quaisquer tipos para cadeia na melhor "
"maneira possível.\n"
"[codeblock]\n"
"var a = [10, 20, 30]\n"
@@ -1909,7 +1909,7 @@ msgid ""
"print(b[\"a\"]) # Prints 1\n"
"[/codeblock]"
msgstr ""
-"Converte um string formatado que foi retornado por [method var2str] para o "
+"Converte uma cadeia formatada que foi retornada por [method var2str] para o "
"valor original.\n"
"[codeblock]\n"
"a = '{ \"a\": 1, \"b\": 2 }'\n"
@@ -2025,8 +2025,8 @@ msgid ""
" push_error(\"Invalid JSON: \" + v)\n"
"[/codeblock]"
msgstr ""
-"Verifica se [code]json[/code] contém dados JSON válidos. Retorna um String "
-"vazio se válido, ou uma mensagem de erro caso contrário.\n"
+"Verifica se [code]json[/code] contém dados JSON válidos. Retorna uma cadeia "
+"vazia se for válida ou uma mensagem de erro caso contrário.\n"
"[codeblock]\n"
"j = to_json([1, 2, 3])\n"
"v = validate_json(j)\n"
@@ -2062,8 +2062,8 @@ msgid ""
"}\n"
"[/codeblock]"
msgstr ""
-"Converte uma Variant [code]var[/code] para um string formatado que pode ser "
-"convertido de volta com [method str2var].\n"
+"Converte uma Variant [code]var[/code] para uma cadeia formatada que pode ser "
+"convertida de volta com [method str2var].\n"
"[codeblock]\n"
"a = { \"a\": 1, \"b\": 2 }\n"
"print(var2str(a))\n"
@@ -3555,59 +3555,59 @@ msgstr "Máscara da tecla Group Switch."
#: doc/classes/@GlobalScope.xml
msgid "Left mouse button."
-msgstr "Botão esquerdo do mouse."
+msgstr "Botão esquerdo do rato."
#: doc/classes/@GlobalScope.xml
msgid "Right mouse button."
-msgstr "Botão direito do mouse."
+msgstr "Botão direito do rato."
#: doc/classes/@GlobalScope.xml
msgid "Middle mouse button."
-msgstr "Botão central do mouse."
+msgstr "Botão central do rato."
#: doc/classes/@GlobalScope.xml
msgid "Extra mouse button 1 (only present on some mice)."
-msgstr "Primeiro botão extra do mouse (disponível em apenas alguns mouses)."
+msgstr "Primeiro botão extra do rato (disponível em apenas alguns ratos)."
#: doc/classes/@GlobalScope.xml
msgid "Extra mouse button 2 (only present on some mice)."
-msgstr "Segundo botão extra do mouse (disponível em apenas alguns mouses)."
+msgstr "Segundo botão extra do rato (disponível em apenas alguns ratos)."
#: doc/classes/@GlobalScope.xml
msgid "Mouse wheel up."
-msgstr "Roda do mouse para cima."
+msgstr "Roda do rato para cima."
#: doc/classes/@GlobalScope.xml
msgid "Mouse wheel down."
-msgstr "Roda do mouse para baixo."
+msgstr "Roda do rato para baixo."
#: doc/classes/@GlobalScope.xml
msgid "Mouse wheel left button (only present on some mice)."
-msgstr "Botão esquerdo da roda do mouse (disponível em apenas alguns mouses)."
+msgstr "Botão esquerdo da roda do rato (disponível em apenas alguns ratos)."
#: doc/classes/@GlobalScope.xml
msgid "Mouse wheel right button (only present on some mice)."
-msgstr "Botão direito da roda do mouse (disponível em apenas alguns mouses)."
+msgstr "Botão direito da roda do rato (disponível em apenas alguns ratos)."
#: doc/classes/@GlobalScope.xml
msgid "Left mouse button mask."
-msgstr "Máscara do botão esquerdo do mouse."
+msgstr "Máscara do botão esquerdo do rato."
#: doc/classes/@GlobalScope.xml
msgid "Right mouse button mask."
-msgstr "Máscara do botão direito do mouse."
+msgstr "Máscara do botão direito do rato."
#: doc/classes/@GlobalScope.xml
msgid "Middle mouse button mask."
-msgstr "Máscara do botão central do mouse."
+msgstr "Máscara do botão central do rato."
#: doc/classes/@GlobalScope.xml
msgid "Extra mouse button 1 mask."
-msgstr "Máscara do primeiro botão extra do mouse."
+msgstr "Máscara do primeiro botão extra do rato."
#: doc/classes/@GlobalScope.xml
msgid "Extra mouse button 2 mask."
-msgstr "Máscara do segundo botão extra do mouse."
+msgstr "Máscara do segundo botão extra do rato."
#: doc/classes/@GlobalScope.xml
msgid "Invalid button or axis."
@@ -4354,7 +4354,6 @@ msgid ""
msgstr ""
#: doc/classes/@GlobalScope.xml
-#, fuzzy
msgid ""
"Hints that a float property should be edited via an exponential easing "
"function. The hint string can include [code]\"attenuation\"[/code] to flip "
@@ -4362,9 +4361,9 @@ msgid ""
"easing."
msgstr ""
"Sugere que uma propriedade float deve ser editada através de uma função de "
-"suavização. A string de sugestão pode incluir [code]\"attenuation\"[/code] "
-"para virar a curva horizontalmente e/ou [code]\"inout\"[/code] para incluir "
-"também a suavização in/out."
+"flexibilização. A cadeia de sugestão pode incluir [code]\"attenuation\"[/"
+"code] para virar a curva horizontalmente e/ou [code]\"inout\"[/code] para "
+"incluir também a flexibilização in/out."
#: doc/classes/@GlobalScope.xml
msgid "Deprecated hint, unused."
@@ -17844,11 +17843,11 @@ msgstr ""
#: doc/classes/Control.xml
msgid "Sent when the mouse pointer enters the node."
-msgstr "Enviado quando o ponteiro do mouse entra no nó."
+msgstr "Enviado quando o ponteiro do rato entra no nó."
#: doc/classes/Control.xml
msgid "Sent when the mouse pointer exits the node."
-msgstr "Enviado quando o ponteiro do mouse sai do nó."
+msgstr "Enviado quando o ponteiro do rato sai do nó."
#: doc/classes/Control.xml
msgid "Sent when the node grabs focus."
@@ -30979,7 +30978,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
@@ -37028,7 +37031,7 @@ msgstr ""
#: doc/classes/Navigation2DServer.xml doc/classes/NavigationServer.xml
#, fuzzy
msgid "Sets the position of the agent in world space."
-msgstr "Retorna a posição global do mouse."
+msgstr "Retorna a posição global do rato."
#: doc/classes/Navigation2DServer.xml doc/classes/NavigationServer.xml
#, fuzzy
@@ -37256,7 +37259,7 @@ msgstr ""
#: doc/classes/Navigation2DServer.xml doc/classes/NavigationServer.xml
#, fuzzy
msgid "Sets the global transformation for the region."
-msgstr "Retorna a posição global do mouse."
+msgstr "Retorna a posição global do rato."
#: doc/classes/Navigation2DServer.xml doc/classes/NavigationServer.xml
#, fuzzy
@@ -65291,11 +65294,11 @@ msgstr "Emitido quando um item é editado."
#: doc/classes/Tree.xml
msgid "Emitted when an item is edited using the right mouse button."
-msgstr "Emitido quando um item é editado com botão direito do mouse."
+msgstr "Emitido quando um item é editado com botão direito do rato."
#: doc/classes/Tree.xml
msgid "Emitted when an item is selected with the right mouse button."
-msgstr "Emitido quando um item é selecionado com o botão direito do mouse."
+msgstr "Emitido quando um item é selecionado com o botão direito do rato."
#: doc/classes/Tree.xml
msgid "Emitted when an item is selected."
@@ -65310,7 +65313,7 @@ msgstr ""
#: doc/classes/Tree.xml
msgid "Emitted when a left mouse button click does not select any item."
msgstr ""
-"Emitido quando um clique com o botão esquerdo do mouse não seleciona nenhum "
+"Emitido quando um clique com o botão esquerdo do rato não seleciona nenhum "
"item."
#: doc/classes/Tree.xml
diff --git a/doc/translations/pt_BR.po b/doc/translations/pt_BR.po
index 463bc9c957..687566bef1 100644
--- a/doc/translations/pt_BR.po
+++ b/doc/translations/pt_BR.po
@@ -45,12 +45,13 @@
# Mr.Albino <ricmorsoleto@gmail.com>, 2022.
# Zer0-Zer0 <dankmemerson@tutanota.com>, 2022.
# Julio Yagami <juliohenrique31501234@hotmail.com>, 2022.
+# Andrey Gonçalves <kaptaryd@gmail.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine class reference\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
-"PO-Revision-Date: 2022-12-09 19:48+0000\n"
-"Last-Translator: Julio Yagami <juliohenrique31501234@hotmail.com>\n"
+"PO-Revision-Date: 2023-01-09 20:42+0000\n"
+"Last-Translator: Andrey Gonçalves <kaptaryd@gmail.com>\n"
"Language-Team: Portuguese (Brazil) <https://hosted.weblate.org/projects/"
"godot-engine/godot-class-reference/pt_BR/>\n"
"Language: pt_BR\n"
@@ -58,7 +59,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
-"X-Generator: Weblate 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: doc/tools/make_rst.py
msgid "Description"
@@ -860,7 +861,6 @@ msgstr ""
"[/codeblock]"
#: modules/gdscript/doc_classes/@GDScript.xml
-#, fuzzy
msgid ""
"Returns an interpolation or extrapolation factor considering the range "
"specified in [code]from[/code] and [code]to[/code], and the interpolated "
@@ -883,8 +883,26 @@ msgid ""
"See also [method lerp] which performs the reverse of this operation, and "
"[method range_lerp] to map a continuous series of values to another."
msgstr ""
-"Retornar a interpolação ou extrapolação do fator considerando o ranger "
-"específico [code ]para[/code]"
+"Retorna o fator de interpolação ou extrapolação considerando o intervalo "
+"especificado no [code]de[/code] e [code]para[/code], e o valor interpolado "
+"especificado no [code]peso[/code]. O valor retornado irá ser entre "
+"[code]0.0[/code] e [code]1.0[/code] se [code]peso[/code] for entre [code]de[/"
+"code] e [code]para[/code] (inclusivo). Se [code]peso[/code] está fora do "
+"intervalo especificado, então um fator de extrapolação será retornado "
+"(retorna valor menor que [code]0.0[/code] ou maior que [code]1.0[/code]). "
+"Use [method clamp] no resultado do [method inverse_lerp] se isso não for o "
+"desejado.\n"
+"[codeblock]\n"
+"# A razão da interpolação no uso do `lerp()` abaixo é 0.75.\n"
+"var meio = lerp(20, 30, 0.75)\n"
+"#`meio` agora é 27.5.\n"
+"# Agora, vamos fingir que esquecemos a razão original e o queremos de "
+"volta.\n"
+"var razao = inverse_lerp(20, 30, 27.5)\n"
+"#`razao` agora é 0.75.\n"
+"[/codeblock]\n"
+"Veja também o [method lerp] que faz o inverso desta operação, e [method "
+"range_lerp] para mapear uma série contínua de valores uns aos outros."
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -1423,6 +1441,17 @@ msgid ""
"print_stack] will not work in projects exported in release mode, or in "
"projects exported in debug mode if not connected to a debugging server."
msgstr ""
+"Imprime um rastreamento de pilha no local do código atual. Veja também "
+"[method get_stack]\n"
+"A saída no console seria mais ou menos assim:\n"
+"[codeblock]\n"
+"Frame 0 - res://test.gd:16 in function '_process'\n"
+"[/codeblock]\n"
+"[b]Nota:[/b] [method print_stack] só funciona se a instância em execução "
+"estiver conectada a um servidor de depuração (ou seja, uma instância do "
+"editor). [method print_stack] não funcionará em projetos exportados no modo "
+"de lançamento ou em projetos exportados no modo de depuração se não estiver "
+"conectado a um servidor de depuração."
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -4070,74 +4099,105 @@ msgid ""
"down on the key after it \"bottoms out\". This message is different from "
"polyphonic after-touch as it indicates the highest pressure across all keys."
msgstr ""
+"Mensagem de pressão do canal MIDI. Esta mensagem geralmente é enviada ao "
+"pressionar a tecla após ela \"ir de dentro pra fora\". Essa mensagem é "
+"diferente do pós-toque polifônico, pois indica a pressão mais alta em todas "
+"as teclas."
#: doc/classes/@GlobalScope.xml
msgid ""
"MIDI pitch bend message. This message is sent to indicate a change in the "
"pitch bender (wheel or lever, typically)."
msgstr ""
+"Mensagem MIDI de dobra de tom (pitch bend). Esta mensagem é enviada para "
+"indicar uma mudança no dobrador de tom (roda ou alavanca, tipicamente)."
#: doc/classes/@GlobalScope.xml
msgid ""
"MIDI system exclusive message. This has behavior exclusive to the device "
"you're receiving input from. Getting this data is not implemented in Godot."
msgstr ""
+"Mensagem exclusiva do sistema MIDI. Isso tem um comportamento exclusivo do "
+"dispositivo do qual você está recebendo entrada. A obtenção desses dados não "
+"está implementada no Godot."
#: doc/classes/@GlobalScope.xml
msgid ""
"MIDI quarter frame message. Contains timing information that is used to "
"synchronize MIDI devices. Getting this data is not implemented in Godot."
msgstr ""
+"Mensagem MIDI de um quarto de quadro. Contém informações de tempo usadas "
+"para sincronizar dispositivos MIDI. A obtenção desses dados não está "
+"implementada no Godot."
#: doc/classes/@GlobalScope.xml
msgid ""
"MIDI song position pointer message. Gives the number of 16th notes since the "
"start of the song. Getting this data is not implemented in Godot."
msgstr ""
+"Mensagem de ponteiro de posição de música MIDI. Dá o número de semicolcheias "
+"(cada 16ª nota) desde o início da música. A obtenção desses dados não está "
+"implementada no Godot."
#: doc/classes/@GlobalScope.xml
msgid ""
"MIDI song select message. Specifies which sequence or song is to be played. "
"Getting this data is not implemented in Godot."
msgstr ""
+"Mensagem MIDI de seleção de música. Especifica qual sequência ou música será "
+"tocada. A obtenção desses dados não está implementada no Godot."
#: doc/classes/@GlobalScope.xml
msgid ""
"MIDI tune request message. Upon receiving a tune request, all analog "
"synthesizers should tune their oscillators."
msgstr ""
+"Mensagem de solicitação de sintonia MIDI. Ao receber uma solicitação de "
+"sintonia, todos os sintetizadores analógicos devem sintonizar seus "
+"osciladores."
#: doc/classes/@GlobalScope.xml
msgid ""
"MIDI timing clock message. Sent 24 times per quarter note when "
"synchronization is required."
msgstr ""
+"Mensagem de relógio de tempo MIDI. Enviado 24 vezes por semínima quando a "
+"sincronização é necessária."
#: doc/classes/@GlobalScope.xml
msgid ""
"MIDI start message. Start the current sequence playing. This message will be "
"followed with Timing Clocks."
msgstr ""
+"mensagem de início MIDI. Inicie a reprodução da sequência atual. Esta "
+"mensagem será seguida de relógios de temporização."
#: doc/classes/@GlobalScope.xml
msgid "MIDI continue message. Continue at the point the sequence was stopped."
msgstr ""
+"Mensagem de continuação MIDI. Continue no ponto em que a sequência foi "
+"interrompida."
#: doc/classes/@GlobalScope.xml
msgid "MIDI stop message. Stop the current sequence."
-msgstr ""
+msgstr "Mensagem de parada MIDI. Pare a sequência atual."
#: doc/classes/@GlobalScope.xml
msgid ""
"MIDI active sensing message. This message is intended to be sent repeatedly "
"to tell the receiver that a connection is alive."
msgstr ""
+"Mensagem de detecção ativa de MIDI. Esta mensagem deve ser enviada "
+"repetidamente para informar ao receptor que uma conexão está ativa."
#: doc/classes/@GlobalScope.xml
msgid ""
"MIDI system reset message. Reset all receivers in the system to power-up "
"status. It should not be sent on power-up itself."
msgstr ""
+"Mensagem de reinicialização do sistema MIDI. Redefina todos os receptores no "
+"sistema para o status de inicialização. Ele não deve ser enviado no próprio "
+"power-up."
#: doc/classes/@GlobalScope.xml
msgid ""
@@ -31205,7 +31265,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/ro.po b/doc/translations/ro.po
index dd88e8d66b..94c966c61c 100644
--- a/doc/translations/ro.po
+++ b/doc/translations/ro.po
@@ -29940,7 +29940,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/ru.po b/doc/translations/ru.po
index 9d569d7760..b76873e4f1 100644
--- a/doc/translations/ru.po
+++ b/doc/translations/ru.po
@@ -57,12 +57,14 @@
# Handsless coder <yfintktajy1@gmail.com>, 2022.
# Evgeniy Khramov <thejenjagamertjg@gmail.com>, 2022.
# Григорий <bolon667@gmail.com>, 2022.
+# Artur Leonov (Depish) <depish.eskry@yandex.ru>, 2022.
+# Patrik <avdmur@gmail.com>, 2022.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine class reference\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
-"PO-Revision-Date: 2022-12-06 11:48+0000\n"
-"Last-Translator: Григорий <bolon667@gmail.com>\n"
+"PO-Revision-Date: 2022-12-23 10:00+0000\n"
+"Last-Translator: Patrik <avdmur@gmail.com>\n"
"Language-Team: Russian <https://hosted.weblate.org/projects/godot-engine/"
"godot-class-reference/ru/>\n"
"Language: ru\n"
@@ -71,7 +73,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 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: doc/tools/make_rst.py
msgid "Description"
@@ -127,7 +129,7 @@ msgstr "УнаÑледовано:"
#: doc/tools/make_rst.py
msgid "(overrides %s)"
-msgstr "(переназначает %s)"
+msgstr "(переопределÑет %s)"
#: doc/tools/make_rst.py
msgid "Default"
@@ -461,9 +463,9 @@ msgstr ""
"Ограничивает [code]value[/code], Ð²Ð¾Ð·Ð²Ñ€Ð°Ñ‰Ð°Ñ Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ðµ не меньше [code]min[/"
"code] и не больше [code]max[/code].\n"
"[codeblock]\n"
-"a = clamp(1000, 1, 20) # a будет 20\n"
-"a = clamp(-10, 1, 20) # a будет 1\n"
-"a = clamp(15, 1, 20) # a будет 15\n"
+"a = clamp(1000, 1, 20) # вернёт 20\n"
+"a = clamp(-10, 1, 20) # вернёт 1\n"
+"a = clamp(15, 1, 20) # вернёт 15\n"
"[/codeblock]"
#: modules/gdscript/doc_classes/@GDScript.xml
@@ -534,12 +536,12 @@ msgid ""
"a = dectime(60, 10, 0.1)) # a is 59.0\n"
"[/codeblock]"
msgstr ""
-"[b]Примечание:[/b] [code]dectime[/code] был уÑтаревшим и будет удален в "
-"Godot 4.0, пожалуйÑта, иÑпользуйте [метод move_toward] вмеÑто него.\n"
+"[b]Примечание:[/b] [code]dectime[/code] уÑтарел и будет удален в Godot 4.0, "
+"пожалуйÑта, иÑпользуйте [method move_toward] вмеÑто него.\n"
"Возвращает результат [code]value[/code], уменьшенный на [code]step[/code] * "
"[code]amount[/code].\n"
"[codeblock]\n"
-"a = dectime(60, 10, 0.1)) # a равно 59.0\n"
+"a = dectime(60, 10, 0.1)) # вернёт59.0\n"
"[/codeblock]"
#: modules/gdscript/doc_classes/@GDScript.xml
@@ -635,7 +637,7 @@ msgstr ""
"[/codeblock]\n"
"[url=https://raw.githubusercontent.com/godotengine/godot-docs/3.4/img/"
"ease_cheatsheet.png]ease() шпаргалка значений кривой[/url]\n"
-"См. также [метод smoothstep]. ЕÑли вам нужно выполнить более Ñложные "
+"См. также [method smoothstep]. ЕÑли вам нужно выполнить более Ñложные "
"переходы, иÑпользуйте [Tween] или [AnimationPlayer]."
#: modules/gdscript/doc_classes/@GDScript.xml
@@ -766,7 +768,6 @@ msgstr ""
"[/codeblock]"
#: modules/gdscript/doc_classes/@GDScript.xml
-#, fuzzy
msgid ""
"Returns an array of dictionaries representing the current call stack. See "
"also [method print_stack].\n"
@@ -790,22 +791,27 @@ msgid ""
"get_stack] will not work in projects exported in release mode, or in "
"projects exported in debug mode if not connected to a debugging server."
msgstr ""
-"Возвращает маÑÑив Ñловарей, предÑтавлÑющий текущий Ñтек вызовов.\n"
+"Возвращает маÑÑив Ñловарей, предÑтавлÑющий текущий Ñтек вызовов. См. также "
+"[method print_stack].\n"
"[codeblock]\n"
"func _ready():\n"
-" foo()\n"
+"\tfoo()\n"
"\n"
"func foo():\n"
-" bar()\n"
+"\tbar()\n"
"\n"
"func bar():\n"
-" print(get_stack())\n"
+"\tprint(get_stack())\n"
"[/codeblock]\n"
"выведет\n"
"[codeblock]\n"
"[{function:bar, line:12, source:res://script.gd}, {function:foo, line:9, "
"source:res://script.gd}, {function:_ready, line:6, source:res://script.gd}]\n"
-"[/codeblock]"
+"[/codeblock]\n"
+"[b]Примечание:[/b] [method get_stack] работает только при подключенном "
+"Ñервере отладки (например в редакторе). [method get_stack] не будет работать "
+"в проектах, ÑкÑпортированных в режиме release или в проектах "
+"ÑкÑпортированных в режиме debug, еÑли они не подключены к Ñерверу отладки."
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -914,7 +920,8 @@ msgstr ""
"var ratio = inverse_lerp(20, 30, 27.5)\n"
"# `ratio` теперь 0.75.\n"
"[/codeblock]\n"
-"Смотрите также [метод lerp], который выполнÑет обратную Ñтой операцию."
+"Смотрите также [method lerp], который выполнÑет обратную операцию и [method "
+"range_lerp] Ð´Ð»Ñ Ð¾Ñ‚Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð¿Ð¾Ñледовательного Ñ€Ñда значений в другом."
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -1048,23 +1055,23 @@ msgid ""
msgstr ""
"Ð›Ð¸Ð½ÐµÐ¹Ð½Ð°Ñ Ð¸Ð½Ñ‚ÐµÑ€Ð¿Ð¾Ð»ÑÑ†Ð¸Ñ Ð¼ÐµÐ¶Ð´Ñƒ Ð´Ð²ÑƒÐ¼Ñ ÑƒÐ³Ð»Ð°Ð¼Ð¸ (в радианах) по нормализованному "
"значению.\n"
-"Ðналогично [методу lerp], но корректно интерполируетÑÑ, когда углы "
-"оборачивают вокруг [конÑтанты @GDScript.TAU]. Чтобы выполнить упрощенную "
-"интерполÑцию Ñ Ð¿Ð¾Ð¼Ð¾Ñ‰ÑŒÑŽ [метода lerp_angle], объедините его Ñ [методом ease] "
-"или [методом smoothstep].\n"
+"Ðналогично [method lerp], но корректно интерполируетÑÑ, когда углы "
+"оборачивают вокруг [constant @GDScript.TAU]. Чтобы выполнить упрощенную "
+"интерполÑцию Ñ Ð¿Ð¾Ð¼Ð¾Ñ‰ÑŒÑŽ [method lerp_angle], объедините его Ñ [method ease] "
+"или [method smoothstep].\n"
"[codeblock]\n"
"extends Sprite\n"
"var elapsed = 0.0\n"
"func _process(delta):\n"
-" var min_angle = deg2rad(0.0)\n"
-" var max_angle = deg2rad(90.0)\n"
-" rotation = lerp_angle(min_angle, max_angle, elapsed)\n"
-" elapsed += delta\n"
+"\tvar min_angle = deg2rad(0.0)\n"
+"\tvar max_angle = deg2rad(90.0)\n"
+"\trotation = lerp_angle(min_angle, max_angle, elapsed)\n"
+"\telapsed += delta\n"
"[/codeblock]\n"
"[b]Примечание:[/b] Этот метод проходит через кратчайший путь между "
"[code]from[/code] и [code]to[/code]. Тем не менее, еÑли разница между Ñтими "
-"Ð´Ð²ÑƒÐ¼Ñ ÑƒÐ³Ð»Ð°Ð¼Ð¸ и любым целым чиÑлом [code]k[/code] приблизительно [code]PI + "
-"k * TAU[/code], неочевидно в какую Ñторону [/code]из-за ошибок в точноÑти "
+"Ð´Ð²ÑƒÐ¼Ñ ÑƒÐ³Ð»Ð°Ð¼Ð¸ и любым целым чиÑлом [code]k[/code] приблизительно [code]PI + k "
+"* TAU[/code], неочевидно в какую Ñторону [/code]из-за ошибок в точноÑти "
"чиÑел Ñ Ð¿Ð»Ð°Ð²Ð°ÑŽÑ‰ÐµÐ¹ точкой. Ðапример, [code]lerp_angle(0, PI, weight)[/code] "
"оборачиваетÑÑ Ð¿Ñ€Ð¾Ñ‚Ð¸Ð² чаÑовой Ñтрелки, а [code]lerp_angle(0, PI + 5 * TAU, "
"weight)[/code] оборачиваетÑÑ Ð¿Ð¾ чаÑовой."
@@ -1098,6 +1105,7 @@ msgstr ""
"[/codeblock]"
#: modules/gdscript/doc_classes/@GDScript.xml
+#, fuzzy
msgid ""
"Loads a resource from the filesystem located at [code]path[/code]. The "
"resource is loaded on the method call (unless it's referenced already "
@@ -1124,19 +1132,19 @@ msgstr ""
"ÑÑылаютÑÑ Ð² другом меÑте, например, в другом Ñкрипте или в Ñцене), что может "
"вызвать небольшую задержку, оÑобенно при загрузке Ñцен. Чтобы избежать "
"ненужных задержек при многократной загрузке чего-либо, либо Ñохраните реÑÑƒÑ€Ñ "
-"в переменной, либо иÑпользуйте [метод preload].\n"
+"в переменной, либо иÑпользуйте [method preload].\n"
"[b]Примечание: [/b] Пути к реÑурÑам можно получить, щёлкнув правой кнопкой "
"мыши на реÑурÑе в панели Â«Ð¤Ð°Ð¹Ð»Ð¾Ð²Ð°Ñ ÑиÑтема» и выбрав \"Копировать путь\" или "
"перетащив файл из панели Â«Ð¤Ð°Ð¹Ð»Ð¾Ð²Ð°Ñ ÑиÑтема» в Ñценарий.\n"
"[codeblock]\n"
"# Load a scene called main located in the root of the project directory and "
"cache it in a variable.\n"
-"var main = load(\"res://main.tscn\") # main will contain a PackedScene "
-"resource.\n"
+"var main = load(\"res://main.tscn\") # main будет Ñодержать объект "
+"PackedScene.\n"
"[/codeblock]\n"
"[b]Важно:[/b] Путь должен быть абÑолютным, локальный путь проÑто вернет "
"[code]null[/code].\n"
-"Этот метод предÑтавлÑет Ñобой упрощенную верÑию [метода ResourceLoader."
+"Этот метод предÑтавлÑет Ñобой упрощенную верÑию [method ResourceLoader."
"load], который можно иÑпользовать Ð´Ð»Ñ Ð±Ð¾Ð»ÐµÐµ Ñложных Ñценариев."
#: modules/gdscript/doc_classes/@GDScript.xml
@@ -1449,6 +1457,16 @@ msgid ""
"print_stack] will not work in projects exported in release mode, or in "
"projects exported in debug mode if not connected to a debugging server."
msgstr ""
+"Выводит Ñтек вызовов из текущей функции. Смотрите также: [method "
+"get_stack].\n"
+"Вывод в конÑоли будет примерно таким:\n"
+"[codeblock]\n"
+"Frame 0 - res://test.gd:16 in function '_process'\n"
+"[/codeblock]\n"
+"[b]Примечание:[/b] [method print_stack] работает только при подключенном "
+"Ñервере отладки (например в редакторе). [method print_stack] не будет "
+"работать в проектах, ÑкÑпортированных в режиме release или в проектах "
+"ÑкÑпортированных в режиме debug, еÑли они не подключены к Ñерверу отладки."
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -1687,7 +1705,7 @@ msgid ""
"3\n"
"[/codeblock]"
msgstr ""
-"Возвращает маÑÑив Ñ Ð·Ð°Ð´Ð°Ð½Ð½Ñ‹Ð¼ диапазоном. [метод range] может быть вызван "
+"Возвращает маÑÑив Ñ Ð·Ð°Ð´Ð°Ð½Ð½Ñ‹Ð¼ диапазоном. [method range] может быть вызван "
"Ñ‚Ñ€ÐµÐ¼Ñ ÑпоÑобами:\n"
"[code]range(n: int)[/code]: ÐачинаетÑÑ Ñ 0, увеличиваетÑÑ Ñ ÑˆÐ°Ð³Ð¾Ð¼ в 1 и "
"оÑтанавливаетÑÑ [i]перед[/i] [code]n[/code]. Ðргумент [code]n[/code] Ñто "
@@ -1702,16 +1720,16 @@ msgstr ""
"[b]инклюзив[/b] и [b]ÑкÑклюзив[/b], ÑоответÑтвенно. Ðргумент [code]s[/code] "
"[b]может[/b] быть негативным, но не [code]0[/code]. ЕÑли [code]s[/code] Ñто "
"[code]0[/code], будет выведено Ñообщение об ошибке.\n"
-"[метод range] преобразует вÑе аргументы в [int] перед обработкой.\n"
+"[method range] преобразует вÑе аргументы в [int] перед обработкой.\n"
"[b]Примечание:[/b] Возвращает пуÑтой маÑÑив, еÑли ни одно значение не "
"удовлетворÑет ограничению на значение (e.g. [code]range(2, 5, -1)[/code] или "
"[code]range(5, 5, 1)[/code]).\n"
"Примеры:\n"
"[codeblock]\n"
-"print(range(4)) # Prints [0, 1, 2, 3]\n"
-"print(range(2, 5)) # Prints [2, 3, 4]\n"
-"print(range(0, 6, 2)) # Prints [0, 2, 4]\n"
-"print(range(4, 1, -1)) # Prints [4, 3, 2]\n"
+"print(range(4)) # Выведет [0, 1, 2, 3]\n"
+"print(range(2, 5)) # Выведет [2, 3, 4]\n"
+"print(range(0, 6, 2)) # Выведет [0, 2, 4]\n"
+"print(range(4, 1, -1)) # Выведет [4, 3, 2]\n"
"[/codeblock]\n"
"Чтобы выполнить итерацию по [Array] в обратном порÑдке, иÑпользуйте:\n"
"[codeblock]\n"
@@ -1739,6 +1757,18 @@ msgid ""
"For complex use cases where you need multiple ranges, consider using [Curve] "
"or [Gradient] instead."
msgstr ""
+"Ограничивает [code]значение[/code] из диапазона [code][istart, istop][/code] "
+"до диапазона [code][ostart, ostop][/code]. Смотрите также [method lerp] и "
+"[method inverse_lerp]. ЕÑли [code]значение[/code] за пределами [code]"
+"[istart, istop][/code], тогда, выходное значение тоже будет за пределами "
+"[code][ostart, ostop][/code]. ИÑпользуйте [method clamp] Ñо значением "
+"полученным от [method range_lerp] еÑли не хотите выходить за пределы.[/"
+"code]\n"
+"[codeblock]\n"
+"range_lerp(75, 0, 100, -1, 1) # Возвращает 0.5\n"
+"[/codeblock]\n"
+"Ð”Ð»Ñ Ñлучаев где вам нужно неÑколько диапазонов, иÑпользуйте [Curve] или "
+"[Gradient]."
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -1755,10 +1785,10 @@ msgstr ""
"в большую Ñторону.\n"
"[codeblock]\n"
"a = round(2.49) # Возвращает 2.0\n"
-"a = round(2.5) # Возвращает 3.0\n"
+"a = round(2.5)\t# Возвращает 3.0\n"
"a = round(2.51) # Возвращает 3.0\n"
"[/codeblock]\n"
-"См. также[метод floor], [метод ceil], [метод stepify], и [int]."
+"См. также[method floor], [method ceil], [method stepify], и [int]."
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -1852,14 +1882,15 @@ msgstr ""
"S-образной кривой, ÐºÐ¾Ñ‚Ð¾Ñ€Ð°Ñ ÑоответÑтвует значению [code]s[/code] между "
"[code]0[/code] и [code]1[/code].\n"
"S-Ð¾Ð±Ñ€Ð°Ð·Ð½Ð°Ñ ÐºÑ€Ð¸Ð²Ð°Ñ ÑвлÑетÑÑ ÐºÑƒÐ±Ð¸Ñ‡ÐµÑким Ñрмитовым Ñплайном, заданным функцией "
-"[code]f(s) = 3*s^2 - 2*s^3[/code].\n"
+"[code]f(y) = 3*y^2 - 2*y^3[/code], где [code]y = (x-from) / (to-from)[/"
+"code].\n"
"[codeblock]\n"
"smoothstep(0, 2, -5.0) # Возвращает 0.0\n"
"smoothstep(0, 2, 0.5) # Возвращает 0.15625\n"
"smoothstep(0, 2, 1.0) # Возвращает 0.5\n"
"smoothstep(0, 2, 2.0) # Возвращает 1.0\n"
"[/codeblock]\n"
-"Ð’ Ñравнении Ñ [method ease] Ñо значение кривой [code]-1.6521[/code], [метод "
+"Ð’ Ñравнении Ñ [method ease] Ñо значение кривой [code]-1.6521[/code], [method "
"smoothstep] возвращает наиболее плавную кривую без внезапных изменений "
"производной. ЕÑли вам нужно выполнить более продвинутые перемещениÑ, "
"иÑпользуйте [Tween] или [AnimationPlayer].\n"
@@ -1956,8 +1987,8 @@ msgid ""
"print(b[\"a\"]) # Prints 1\n"
"[/codeblock]"
msgstr ""
-"Преобразует форматированную Ñтроку, ÐºÐ¾Ñ‚Ð¾Ñ€Ð°Ñ Ð±Ñ‹Ð»Ð° возвращена [методом "
-"var2str] в иÑходное значение.\n"
+"Преобразует форматированную Ñтроку, ÐºÐ¾Ñ‚Ð¾Ñ€Ð°Ñ Ð±Ñ‹Ð»Ð° возвращена [method var2str] "
+"в иÑходное значение.\n"
"[codeblock]\n"
"a = '{ \"a\": 1, \"b\": 2 }'\n"
"b = str2var(a)\n"
@@ -2265,7 +2296,7 @@ msgid ""
msgstr ""
"ОÑтанавливает выполнение функции и возвращает текущее приоÑтановленное "
"ÑоÑтоÑние вызывающей функции.\n"
-"Ð’Ñ‹Ð·Ñ‹Ð²Ð°ÑŽÑ‰Ð°Ñ Ñ„ÑƒÐ½ÐºÑ†Ð¸Ñ Ð´Ð¾Ð»Ð¶Ð½Ð° вызвать [метод GDScriptFunctionState.resume] на "
+"Ð’Ñ‹Ð·Ñ‹Ð²Ð°ÑŽÑ‰Ð°Ñ Ñ„ÑƒÐ½ÐºÑ†Ð¸Ñ Ð´Ð¾Ð»Ð¶Ð½Ð° вызвать [method GDScriptFunctionState.resume] на "
"ÑоÑтоÑнии Ð´Ð»Ñ Ð²Ð¾Ð·Ð¾Ð±Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñ Ð²Ñ‹Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ. Это аннулирует ÑоÑтоÑние. Внутри "
"возобновленной функции [code]yield()[/code] возвращает вÑе, что было "
"передано в вызов функции [code]resume()[/code].\n"
@@ -2278,21 +2309,21 @@ msgstr ""
"работы функции:\n"
"[codeblock].\n"
"func _ready():\n"
-" yield(countdown(), \"completed\") # ожидание Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð¸Ñ Ñ„ÑƒÐ½ÐºÑ†Ð¸Ð¸ "
+"\tyield(countdown(), \"completed\") # ожидание Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð¸Ñ Ñ„ÑƒÐ½ÐºÑ†Ð¸Ð¸ "
"countdown()\n"
-" print('Ready')\n"
+"\tprint('Ready')\n"
"\n"
"func countdown():\n"
-" yield(get_tree(), \"idle_frame\") # возвращает объект "
+"\tyield(get_tree(), \"idle_frame\") # возвращает объект "
"GDScriptFunctionState Ð´Ð»Ñ Ñ„ÑƒÐ½ÐºÑ†Ð¸Ð¸ _ready()\n"
-" print(3)\n"
-" yield(get_tree().create_timer(1.0), \"timeout\")\n"
-" print(2)\n"
-" yield(get_tree().create_timer(1.0), \"timeout\")\n"
-" print(1)\n"
-" yield(get_tree().create_timer(1.0), \"timeout\")\n"
+"\tprint(3)\n"
+"\tyield(get_tree().create_timer(1.0), \"timeout\")\n"
+"\tprint(2)\n"
+"\tyield(get_tree().create_timer(1.0), \"timeout\")\n"
+"\tprint(1)\n"
+"\tyield(get_tree().create_timer(1.0), \"timeout\")\n"
"\n"
-"# печатает:\n"
+"# выведет:\n"
"# 3\n"
"# 2\n"
"# 1\n"
@@ -13808,6 +13839,7 @@ msgid "Camera node for 2D scenes."
msgstr ""
#: doc/classes/Camera2D.xml
+#, fuzzy
msgid ""
"Camera node for 2D scenes. It forces the screen (current layer) to scroll "
"following this node. This makes it easier (and faster) to program scrollable "
@@ -13836,7 +13868,7 @@ msgstr ""
"Обратите внимание, что положение узла [Camera2D] [code][/code] не отражает "
"фактичеÑкое положение Ñкрана, которое может отличатьÑÑ Ð¸Ð·-за примененного "
"ÑÐ³Ð»Ð°Ð¶Ð¸Ð²Ð°Ð½Ð¸Ñ Ð¸Ð»Ð¸ ограничений. Ð”Ð»Ñ Ð¿Ð¾Ð»ÑƒÑ‡ÐµÐ½Ð¸Ñ Ñ€ÐµÐ°Ð»ÑŒÐ½Ð¾Ð³Ð¾ Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð¼Ð¾Ð¶Ð½Ð¾ "
-"иÑпользовать [метод get_camera_screen_center]."
+"иÑпользовать [method get_camera_screen_center]."
#: doc/classes/Camera2D.xml doc/classes/TileMap.xml doc/classes/TileSet.xml
msgid "2D Isometric Demo"
@@ -16052,11 +16084,11 @@ msgstr ""
"ÑвойÑтва (например, CanvasItem.modulate) могут принимать Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð±Ð¾Ð»ÑŒÑˆÐµ 1 "
"(переÑвет или цвета HDR).\n"
"Ð’Ñ‹ также можете Ñоздать цвет из Ñтандартизированных имен цветов Ñ Ð¿Ð¾Ð¼Ð¾Ñ‰ÑŒÑŽ "
-"[метода @GDScript.ColorN] или непоÑредÑтвенно иÑÐ¿Ð¾Ð»ÑŒÐ·ÑƒÑ Ð¾Ð¿Ñ€ÐµÐ´ÐµÐ»ÐµÐ½Ð½Ñ‹Ðµ здеÑÑŒ "
+"[method @GDScript.ColorN] или непоÑредÑтвенно иÑÐ¿Ð¾Ð»ÑŒÐ·ÑƒÑ Ð¾Ð¿Ñ€ÐµÐ´ÐµÐ»ÐµÐ½Ð½Ñ‹Ðµ здеÑÑŒ "
"цветовые конÑтанты. Стандартизированный набор цветов оÑнован на [url=https://"
"en.wikipedia.org/wiki/X11_color_names]именах цветов X11[/url].\n"
"ЕÑли вы хотите задать Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð² диапазоне от 0 до 255, вам Ñледует "
-"иÑпользовать [метод @GDScript.Color8].\n"
+"иÑпользовать [method @GDScript.Color8].\n"
"[b]Примечание:[/b] Ð’ булевом контекÑте значение Color будет равно "
"[code]false[/code], еÑли оно равно [code]Color(0, 0, 0, 0, 1)[/code] "
"(непрозрачный черный). Ð’ противном Ñлучае значение Color вÑегда будет равно "
@@ -17703,24 +17735,24 @@ msgid ""
msgstr ""
"Виртуальный метод, который должен быть реализован пользователем. ИÑпользуйте "
"Ñтот метод Ð´Ð»Ñ Ð¾Ð±Ñ€Ð°Ð±Ð¾Ñ‚ÐºÐ¸ и приема входных данных на Ñлементах "
-"пользовательÑкого интерфейÑа. См. [метод accept_event].\n"
+"пользовательÑкого интерфейÑа. См. [method accept_event].\n"
"Пример: щелчок по Ñлементу управлениÑ.\n"
"[codeblock].\n"
"func _gui_input(event):\n"
-" if event is InputEventMouseButton:\n"
-" if event.button_index == BUTTON_LEFT and event.pressed:\n"
-" print(\"Ðа Ð¼ÐµÐ½Ñ Ð½Ð°Ð¶Ð°Ð»Ð¸ D:\")\n"
+"\tif event is InputEventMouseButton:\n"
+"\t\tif event.button_index == BUTTON_LEFT and event.pressed:\n"
+"\t\t\tprint(\"Ðа Ð¼ÐµÐ½Ñ Ð½Ð°Ð¶Ð°Ð»Ð¸ D:\")\n"
"[/codeblock].\n"
"Событие не Ñработает, еÑли:\n"
-"* щелчок вне Ñлемента ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ (Ñм. [метод has_point]);\n"
+"* щелчок вне Ñлемента ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ (Ñм. [method has_point]);\n"
"* у Ñлемента ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ [member mouse_filter] уÑтановлено значение [constant "
"MOUSE_FILTER_IGNORE];\n"
"* Ñлемент ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð·Ð°Ð³Ð¾Ñ€Ð¾Ð¶ÐµÐ½ другим [Control] Ñверху, у которого [member "
"mouse_filter] не уÑтановлен на [constant MOUSE_FILTER_IGNORE];\n"
"* родитель Ñлемента ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð¸Ð¼ÐµÐµÑ‚ [member mouse_filter], уÑтановленный на "
"[constant MOUSE_FILTER_STOP] или принÑл Ñобытие;\n"
-"* Ñобытие проиÑходит вне прÑмоугольника родителÑ, и у Ñ€Ð¾Ð´Ð¸Ñ‚ÐµÐ»Ñ Ð²ÐºÐ»ÑŽÑ‡ÐµÐ½ [член "
-"rect_clip_content] или [метод _clips_input].\n"
+"* Ñобытие проиÑходит вне прÑмоугольника родителÑ, и у Ñ€Ð¾Ð´Ð¸Ñ‚ÐµÐ»Ñ Ð²ÐºÐ»ÑŽÑ‡ÐµÐ½ "
+"[member rect_clip_content] или [method _clips_input].\n"
"[b]Примечание:[/b] Положение ÑÐ¾Ð±Ñ‹Ñ‚Ð¸Ñ Ð¾Ñ‚Ð½Ð¾Ñительно начала Ñлемента управлениÑ."
#: doc/classes/Control.xml
@@ -17852,7 +17884,7 @@ msgstr ""
"получении Ñлементов темы Ð´Ð»Ñ Ñлемента управлениÑ.\n"
"[b]Примечание:[/b] Переопределение можно удалить, приÑвоив ему значение "
"[code]null[/code]. Это поведение уÑтарело и будет удалено в верÑии 4.0, "
-"иÑпользуйте [метод remove_stylebox_override] вмеÑто Ñтого.\n"
+"иÑпользуйте [method remove_stylebox_override] вмеÑто Ñтого.\n"
"См. также [метод get_stylebox].\n"
"[b]Пример Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ ÑвойÑтва в StyleBox путем его дублированиÑ:[/b]\n"
"[codeblock]\n"
@@ -17867,7 +17899,7 @@ msgstr ""
"$MyButton.add_stylebox_override(\"normal\", new_stylebox_normal)\n"
"# Удалите переопределение Ñтилей.\n"
"$MyButton.add_stylebox_override(\"normal\", null)\n"
-"[/codeblock]."
+"[/codeblock]"
#: doc/classes/Control.xml
msgid ""
@@ -18583,7 +18615,7 @@ msgstr ""
"необходимое Ð´Ð»Ñ Ð¿Ð¾ÑÐ²Ð»ÐµÐ½Ð¸Ñ Ð²Ñплывающей подÑказки Ñ Ð¿Ð¾Ð¼Ð¾Ñ‰ÑŒÑŽ опции [code]gui/"
"timers/tooltip_delay_sec[/code] в ÐаÑтройках проекта.\n"
"Ð’ÑÐ¿Ð»Ñ‹Ð²Ð°ÑŽÑ‰Ð°Ñ Ð¿Ð¾Ð´Ñказка будет иÑпользовать либо реализацию по умолчанию, либо "
-"пользовательÑкую, которую вы можете Ñоздать, переопределив [метод "
+"пользовательÑкую, которую вы можете Ñоздать, переопределив [method "
"_make_custom_tooltip]. Ð’ÑÐ¿Ð»Ñ‹Ð²Ð°ÑŽÑ‰Ð°Ñ Ð¿Ð¾Ð´Ñказка по умолчанию включает "
"[PopupPanel] и [Label], ÑвойÑтва темы которых можно наÑтроить Ñ Ð¿Ð¾Ð¼Ð¾Ñ‰ÑŒÑŽ "
"методов [Theme] Ñ [code]\"TooltipPanel\"[/code] и [code]\"TooltipLabel\"[/"
@@ -23673,17 +23705,17 @@ msgstr ""
"ÑоÑтоÑние можно было воÑÑтановить при возврате на вкладку). Эти данные "
"автоматичеÑки ÑохранÑÑŽÑ‚ÑÑ Ð´Ð»Ñ ÐºÐ°Ð¶Ð´Ð¾Ð¹ Ñцены в файле [code]editstate[/code] в "
"папке метаданных редактора. ЕÑли вы хотите Ñохранить глобальные (незавиÑимые "
-"от Ñцены) данные редактора Ð´Ð»Ñ Ð²Ð°ÑˆÐµÐ³Ð¾ плагина, вы можете иÑпользовать [метод "
-"get_window_layout] вмеÑто Ñтого.\n"
+"от Ñцены) данные редактора Ð´Ð»Ñ Ð²Ð°ÑˆÐµÐ³Ð¾ плагина, вы можете иÑпользовать "
+"[method get_window_layout] вмеÑто Ñтого.\n"
"ИÑпользуйте [method set_state] Ð´Ð»Ñ Ð²Ð¾ÑÑÑ‚Ð°Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñ Ñохраненного ÑоÑтоÑниÑ.\n"
"[b]Примечание:[/b] Этот метод не Ñледует иÑпользовать Ð´Ð»Ñ ÑÐ¾Ñ…Ñ€Ð°Ð½ÐµÐ½Ð¸Ñ Ð²Ð°Ð¶Ð½Ñ‹Ñ… "
"наÑтроек, которые должны ÑохранÑтьÑÑ Ð² проекте.\n"
"[b]Примечание:[/b] Ð”Ð»Ñ ÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð¾Ð³Ð¾ ÑÐ¾Ñ…Ñ€Ð°Ð½ÐµÐ½Ð¸Ñ Ð¸ воÑÑÑ‚Ð°Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñ ÑоÑтоÑÐ½Ð¸Ñ "
-"необходимо реализовать [метод get_plugin_name].\n"
+"необходимо реализовать [method get_plugin_name].\n"
"[codeblock].\n"
"func get_state():\n"
-" var state = {\"zoom\": zoom, \"preferred_color\": my_color}\n"
-" return state\n"
+"\tvar state = {\"zoom\": zoom, \"preferred_color\": my_color}\n"
+"\treturn state\n"
"[/codeblock]"
#: doc/classes/EditorPlugin.xml
@@ -27854,7 +27886,7 @@ msgstr ""
"Вершины каждого многоугольника будут округлены в ÑоответÑтвии Ñ Ñ‚Ð¸Ð¿Ð¾Ð¼ "
"[code]join_type[/code], Ñм. [enum PolyJoinType].\n"
"В результате операции может быть получен внешний многоугольник (граница) и "
-"внутренний многоугольник (отверÑтие), которые можно отличить, вызвав [метод "
+"внутренний многоугольник (отверÑтие), которые можно отличить, вызвав [method "
"is_polygon_clockwise].\n"
"[b]Примечание:[/b] Ð”Ð»Ñ Ñпециального перевода вершин многоугольника "
"иÑпользуйте метод [method Transform2D.xform]:\n"
@@ -28261,9 +28293,9 @@ msgstr ""
"занимает от 5 до 20 Ñекунд в большинÑтве Ñцен. Уменьшение [member subdiv] "
"может уÑкорить запекание.\n"
"[b]Примечание:[/b] [GeometryInstance]Ñ‹ и [Light]Ñ‹ должны быть полноÑтью "
-"готовы до вызова [метода bake]. ЕÑли вы Ñоздаете их процедурно и некоторые "
+"готовы до вызова [method bake]. ЕÑли вы Ñоздаете их процедурно и некоторые "
"Ñетки или оÑвещение отÑутÑтвуют в вашем запекаемом [GIProbe], иÑпользуйте "
-"[code]call_deferred(\"bake\")[/code] вмеÑто прÑмого вызова [метода bake]."
+"[code]call_deferred(\"bake\")[/code] вмеÑто прÑмого вызова [method bake]."
#: doc/classes/GIProbe.xml
msgid "Calls [method bake] with [code]create_visual_debug[/code] enabled."
@@ -30899,14 +30931,14 @@ msgid ""
"in the URL. See [method String.http_escape] for an example."
msgstr ""
"Создает Ð·Ð°Ð¿Ñ€Ð¾Ñ Ð½Ð° базовом [HTTPClient]. ЕÑли нет ошибок конфигурации, "
-"пытаетÑÑ Ð¿Ð¾Ð´ÐºÐ»ÑŽÑ‡Ð¸Ñ‚ÑŒÑÑ, иÑÐ¿Ð¾Ð»ÑŒÐ·ÑƒÑ [метод HTTPClient.connect_to_host] и "
-"передает параметры в [метод HTTPClient.request].\n"
+"пытаетÑÑ Ð¿Ð¾Ð´ÐºÐ»ÑŽÑ‡Ð¸Ñ‚ÑŒÑÑ, иÑÐ¿Ð¾Ð»ÑŒÐ·ÑƒÑ [method HTTPClient.connect_to_host] и "
+"передает параметры в [method HTTPClient.request].\n"
"Возвращает [constant OK], еÑли Ð·Ð°Ð¿Ñ€Ð¾Ñ ÑƒÑпешно Ñоздан. (Это не означает, что "
-"Ñервер ответил), [конÑтанта ERR_UNCONFIGURED], еÑли не находитÑÑ Ð² дереве, "
-"[конÑтанта ERR_BUSY], еÑли вÑе еще обрабатывает предыдущий запроÑ, "
-"[конÑтанта ERR_INVALID_PARAMETER], еÑли Ð·Ð°Ð´Ð°Ð½Ð½Ð°Ñ Ñтрока не ÑвлÑетÑÑ "
-"правильным форматом URL, или [конÑтанта ERR_CANT_CONNECT], еÑли не "
-"иÑпользуетÑÑ Ð¿Ð¾Ñ‚Ð¾Ðº и [HTTPClient] не может ÑоединитьÑÑ Ñ Ñ…Ð¾Ñтом.\n"
+"Ñервер ответил), [constant ERR_UNCONFIGURED], еÑли не находитÑÑ Ð² дереве, "
+"[constant ERR_BUSY], еÑли вÑе еще обрабатывает предыдущий запроÑ, [constant "
+"ERR_INVALID_PARAMETER], еÑли Ð·Ð°Ð´Ð°Ð½Ð½Ð°Ñ Ñтрока не ÑвлÑетÑÑ Ð¿Ñ€Ð°Ð²Ð¸Ð»ÑŒÐ½Ñ‹Ð¼ форматом "
+"URL, или [constant ERR_CANT_CONNECT], еÑли не иÑпользуетÑÑ Ð¿Ð¾Ñ‚Ð¾Ðº и "
+"[HTTPClient] не может ÑоединитьÑÑ Ñ Ñ…Ð¾Ñтом.\n"
"[b]Примечание:[/b] ЕÑли [code]метод[/code] ÑвлÑетÑÑ [constant HTTPClient."
"METHOD_GET], Ð¿Ð¾Ð»ÐµÐ·Ð½Ð°Ñ Ð½Ð°Ð³Ñ€ÑƒÐ·ÐºÐ°, Ð¾Ñ‚Ð¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð½Ð°Ñ Ñ‡ÐµÑ€ÐµÐ· [code]request_data[/"
"code], может быть проигнорирована Ñервером или даже привеÑти к отклонению "
@@ -32299,7 +32331,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
@@ -34067,38 +34103,38 @@ msgid ""
"[b]Note:[/b] Only available in the HTML5 platform."
msgstr ""
"JavaScriptObject иÑпользуетÑÑ Ð´Ð»Ñ Ð²Ð·Ð°Ð¸Ð¼Ð¾Ð´ÐµÐ¹ÑÑ‚Ð²Ð¸Ñ Ñ Ð¾Ð±ÑŠÐµÐºÑ‚Ð°Ð¼Ð¸ JavaScript, "
-"полученными или Ñозданными Ñ Ð¿Ð¾Ð¼Ð¾Ñ‰ÑŒÑŽ [метода JavaScript.get_interface], "
-"[метода JavaScript.create_object] или [метода JavaScript.create_callback].\n"
+"полученными или Ñозданными Ñ Ð¿Ð¾Ð¼Ð¾Ñ‰ÑŒÑŽ [method JavaScript.get_interface], "
+"[method JavaScript.create_object] или [method JavaScript.create_callback].\n"
"Пример:\n"
"[codeblock]\n"
-"раÑширÑет Node\n"
+"extends Node\n"
"\n"
"var _my_js_callback = JavaScript.create_callback(self, \"myCallback\") # Эта "
"ÑÑылка должна быть Ñохранена\n"
"var console = JavaScript.get_interface(\"console\")\n"
"\n"
"func _init():\n"
-" var buf = JavaScript.create_object(\"ArrayBuffer\", 10) # новый "
+"\tvar buf = JavaScript.create_object(\"ArrayBuffer\", 10) # новый "
"ArrayBuffer(10)\n"
-" print(buf) # печатает [JavaScriptObject:OBJECT_ID]\n"
-" var uint8arr = JavaScript.create_object(\"Uint8Array\", buf) # новый "
+"\tprint(buf) # печатает [JavaScriptObject:OBJECT_ID]\n"
+"\tvar uint8arr = JavaScript.create_object(\"Uint8Array\", buf) # новый "
"Uint8Array(buf)\n"
-" uint8arr[1] = 255\n"
-" prints(uint8arr[1], uint8arr.byteLength) # печатает 255 10\n"
-" console.log(uint8arr) # печатает в конÑоли браузера \"Uint8Array(10) "
-"[ 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\"\n"
+"\tuint8arr[1] = 255\n"
+"\tprints(uint8arr[1], uint8arr.byteLength) # печатает 255 10\n"
+"\tconsole.log(uint8arr) # печатает в конÑоли браузера \"Uint8Array(10) [ 0, "
+"255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\"\n"
"\n"
-" # Эквивалент JavaScript: Array.from(uint8arr).forEach(myCallback)\n"
-" JavaScript.get_interface(\"Array\").from(uint8arr)."
+"\t# Эквивалент JavaScript: Array.from(uint8arr).forEach(myCallback)\n"
+"\tJavaScript.get_interface(\"Array\").from(uint8arr)."
"forEach(_my_js_callback)\n"
"\n"
"func myCallback(args):\n"
-" # Будет вызван Ñ Ð¿Ð°Ñ€Ð°Ð¼ÐµÑ‚Ñ€Ð°Ð¼Ð¸, переданными в обратный вызов \"forEach\".\n"
-" # [0, 0, [JavaScriptObject:1173]]\n"
-" # [255, 1, [JavaScriptObject:1173]]\n"
-" # ...\n"
-" # [0, 9, [JavaScriptObject:1180]]\n"
-" print(args)\n"
+"\t# Будет вызван Ñ Ð¿Ð°Ñ€Ð°Ð¼ÐµÑ‚Ñ€Ð°Ð¼Ð¸, переданными в обратный вызов \"forEach\".\n"
+"\t# [0, 0, [JavaScriptObject:1173]]\n"
+"\t# [255, 1, [JavaScriptObject:1173]]\n"
+"\t# ...\n"
+"\t# [0, 9, [JavaScriptObject:1180]]\n"
+"\tprint(args)\n"
"[/codeblock].\n"
"[b]Примечание:[/b] ДоÑтупно только в платформе HTML5."
@@ -39775,7 +39811,7 @@ msgstr "Возвращает значение задержки данного к
msgid ""
"Returns the normal for the point returned by [method map_get_closest_point]."
msgstr ""
-"Возвращает нормаль Ð´Ð»Ñ Ñ‚Ð¾Ñ‡ÐºÐ¸, возвращенной [методом map_get_closest_point]."
+"Возвращает нормаль Ð´Ð»Ñ Ñ‚Ð¾Ñ‡ÐºÐ¸, возвращенной [method map_get_closest_point]."
#: doc/classes/NavigationServer.xml
msgid ""
@@ -39976,10 +40012,10 @@ msgstr ""
"пирами, чтобы гарантировать, что пропуÑÐºÐ½Ð°Ñ ÑпоÑобноÑть пиров не будет "
"превышена. Параметры пропуÑкной ÑпоÑобноÑти также определÑÑŽÑ‚ размер окна "
"ÑоединениÑ, которое ограничивает количеÑтво надежных пакетов, которые могут "
-"находитьÑÑ Ð² пути в любой момент времени. Возвращает [конÑтанту OK], еÑли "
-"клиент был Ñоздан, [конÑтанту ERR_ALREADY_IN_USE], еÑли данный ÑкземплÑÑ€ "
+"находитьÑÑ Ð² пути в любой момент времени. Возвращает [constant OK], еÑли "
+"клиент был Ñоздан, [constant ERR_ALREADY_IN_USE], еÑли данный ÑкземплÑÑ€ "
"NetworkedMultiplayerENet уже имеет открытое Ñоединение (в Ñтом Ñлучае "
-"необходимо Ñначала вызвать [метод close_connection]) или [конÑтанту "
+"необходимо Ñначала вызвать [method close_connection]) или [constant "
"ERR_CANT_CREATE], еÑли клиент не может быть Ñоздан. ЕÑли указано "
"[code]client_port[/code], клиент также будет Ñлушать указанный порт; Ñто "
"полезно Ð´Ð»Ñ Ð½ÐµÐºÐ¾Ñ‚Ð¾Ñ€Ñ‹Ñ… методов обхода NAT."
@@ -75012,23 +75048,24 @@ msgid ""
"viewport_set_render_direct_to_screen]."
msgstr ""
"Копирует видовой Ñкран в облаÑть Ñкрана, указанную [code]rect[/code]. ЕÑли "
-"[член Viewport.render_direct_to_screen] равен [code]true[/code], то вьюпорт "
-"не иÑпользует фреймбуфер и Ñодержимое вьюпорта выводитÑÑ Ð½ÐµÐ¿Ð¾ÑредÑтвенно на "
-"Ñкран. Однако обратите внимание, что корневой видовой Ñкран риÑуетÑÑ "
-"поÑледним, поÑтому он будет риÑоватьÑÑ Ð¿Ð¾Ð²ÐµÑ€Ñ… Ñкрана. СоответÑтвенно, вы "
-"должны уÑтановить корневой видовой Ñкран на облаÑть, ÐºÐ¾Ñ‚Ð¾Ñ€Ð°Ñ Ð½Ðµ покрывает "
-"облаÑть, к которой вы прикрепили Ñтот видовой Ñкран.\n"
+"[member Viewport.render_direct_to_screen] равен [code]true[/code], то "
+"вьюпорт не иÑпользует фреймбуфер и Ñодержимое вьюпорта выводитÑÑ "
+"непоÑредÑтвенно на Ñкран. Однако обратите внимание, что корневой видовой "
+"Ñкран риÑуетÑÑ Ð¿Ð¾Ñледним, поÑтому он будет риÑоватьÑÑ Ð¿Ð¾Ð²ÐµÑ€Ñ… Ñкрана. "
+"СоответÑтвенно, вы должны уÑтановить корневой видовой Ñкран на облаÑть, "
+"ÐºÐ¾Ñ‚Ð¾Ñ€Ð°Ñ Ð½Ðµ покрывает облаÑть, к которой вы прикрепили Ñтот видовой Ñкран.\n"
"Ðапример, вы можете уÑтановить корневой видовой Ñкран так, чтобы он вообще "
"не отриÑовывалÑÑ, иÑÐ¿Ð¾Ð»ÑŒÐ·ÑƒÑ Ñледующий код:\n"
"[codeblock].\n"
"func _ready():\n"
-" get_viewport().set_attach_to_screen_rect(Rect2())\n"
-" $Viewport.set_attach_to_screen_rect(Rect2(0, 0, 600, 600))\n"
+"\tget_viewport().set_attach_to_screen_rect(Rect2())\n"
+"\t$Viewport.set_attach_to_screen_rect(Rect2(0, 0, 600, 600))\n"
"[/codeblock].\n"
"ИÑпользование Ñтого метода может привеÑти к значительной оптимизации, "
"оÑобенно на уÑтройÑтвах низкого клаÑÑа. Однако за Ñто приходитÑÑ "
"раÑплачиватьÑÑ Ð½ÐµÐ¾Ð±Ñ…Ð¾Ð´Ð¸Ð¼Ð¾Ñтью управлÑть видовыми Ñкранами вручную. Ð”Ð»Ñ "
-"дальнейшей оптимизации Ñмотрите [метод viewport_set_render_direct_to_screen]."
+"дальнейшей оптимизации Ñмотрите [method "
+"viewport_set_render_direct_to_screen]."
#: doc/classes/VisualServer.xml
msgid ""
diff --git a/doc/translations/sk.po b/doc/translations/sk.po
index 3a58e3f2a9..d82d0b12ee 100644
--- a/doc/translations/sk.po
+++ b/doc/translations/sk.po
@@ -29911,7 +29911,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/sr_Cyrl.po b/doc/translations/sr_Cyrl.po
index 2846de07bb..2fccf2bef4 100644
--- a/doc/translations/sr_Cyrl.po
+++ b/doc/translations/sr_Cyrl.po
@@ -29922,7 +29922,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/sv.po b/doc/translations/sv.po
index 65cad9bf8a..b4ec51f179 100644
--- a/doc/translations/sv.po
+++ b/doc/translations/sv.po
@@ -29909,7 +29909,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/th.po b/doc/translations/th.po
index 54fbdbfe27..0ca308df1c 100644
--- a/doc/translations/th.po
+++ b/doc/translations/th.po
@@ -30049,7 +30049,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/tl.po b/doc/translations/tl.po
index a9b6a9e2a9..a3d46e6b1d 100644
--- a/doc/translations/tl.po
+++ b/doc/translations/tl.po
@@ -29997,7 +29997,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/tr.po b/doc/translations/tr.po
index 5d8f2afe29..a41bb69483 100644
--- a/doc/translations/tr.po
+++ b/doc/translations/tr.po
@@ -30744,7 +30744,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/uk.po b/doc/translations/uk.po
index 3714c11d88..6c071cee85 100644
--- a/doc/translations/uk.po
+++ b/doc/translations/uk.po
@@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Godot Engine class reference\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
-"PO-Revision-Date: 2022-11-25 12:13+0000\n"
-"Last-Translator: Лев ДворÑкий <ne3r0n@gmail.com>\n"
+"PO-Revision-Date: 2022-12-28 14:08+0000\n"
+"Last-Translator: KazanskiyMaks <kazanskiy.maks@gmail.com>\n"
"Language-Team: Ukrainian <https://hosted.weblate.org/projects/godot-engine/"
"godot-class-reference/uk/>\n"
"Language: uk\n"
@@ -30,7 +30,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 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: doc/tools/make_rst.py
msgid "Description"
@@ -106,13 +106,11 @@ msgid "Getter"
msgstr "Отримувач"
#: doc/tools/make_rst.py
-#, fuzzy
msgid ""
"This method should typically be overridden by the user to have any effect."
msgstr "Зазвичай, цей метод перевизначаєтьÑÑ ÐºÐ¾Ñ€Ð¸Ñтувачем, щоб він мав вплив."
#: doc/tools/make_rst.py
-#, fuzzy
msgid ""
"This method has no side effects. It doesn't modify any of the instance's "
"member variables."
@@ -120,13 +118,11 @@ msgstr ""
"Цей метод не має побічних ефектів. Ðе змінює ніÑку змінну екземплÑра об'єкта."
#: doc/tools/make_rst.py
-#, fuzzy
msgid ""
"This method accepts any number of arguments after the ones described here."
msgstr "Цей метод приймає будь-Ñке чиÑло аргументів піÑÐ»Ñ Ð¾Ð¿Ð¸Ñаних тут."
#: doc/tools/make_rst.py
-#, fuzzy
msgid "This method is used to construct a type."
msgstr "Цей метод викориÑтовуєтьÑÑ Ð´Ð»Ñ Ð¿Ð¾Ð±ÑƒÐ´Ð¾Ð²Ð¸ типів."
@@ -136,8 +132,8 @@ msgid ""
"This method doesn't need an instance to be called, so it can be called "
"directly using the class name."
msgstr ""
-"Ð”Ð»Ñ Ð²Ð¸ÐºÐ¾Ñ€Ð¸ÑтаннÑ, цей метод не потребує ÑÑ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ Ð¾Ð±'єкта, тому він може "
-"бути викликаним напрÑму вказавши назву клаÑу."
+"Ð”Ð»Ñ Ð²Ð¸ÐºÐ»Ð¸ÐºÑƒ, метод не потребує ÑÑ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ Ð¾Ð±'єкта, тому він може бути "
+"викориÑтаним проÑто вказавши назву клаÑу."
#: doc/tools/make_rst.py
msgid ""
@@ -285,22 +281,22 @@ msgid ""
"[/codeblock]"
msgstr ""
"ПеревірÑÑ”, чи [code]condition[/code] дорівнює [code]true[/code]. Якщо "
-"[code]condition[/code] дорівнює [code]false[/code], буде згенеровано "
-"помилку. Якщо виконуєтьÑÑ Ñƒ редакторі, проєкт буде також призупинено, поки "
-"ви не продовжите його. Може бути викориÑтано, Ñк більш дієва форма [method "
-"push_error] Ð´Ð»Ñ Ð·Ð²Ñ–Ñ‚ÑƒÐ²Ð°Ð½Ð½Ñ Ð¿Ð¾Ð¼Ð¸Ð»Ð¾Ðº розробникам проєкту, або допоміжним "
-"кориÑтувачам.\n"
+"[code]condition[/code] дорівнює [code]false[/code], буде Ñтворено помилку. "
+"Якщо виконуєтьÑÑ Ð² редакторі, проєкт також буде призупинено, поки ви не "
+"відновите його роботу. Можна викориÑтати, Ñк більш дієву форму [method "
+"push_error] Ð´Ð»Ñ Ð·Ð²Ñ–Ñ‚ÑƒÐ²Ð°Ð½Ð½Ñ Ð¿Ð¾Ð¼Ð¸Ð»Ð¾Ðº розробникам проєкту, або кориÑтувачам "
+"Ð´Ð¾Ð¿Ð¾Ð²Ð½ÐµÐ½Ð½Ñ (add-on).\n"
"[b]Ðотатка:[/b] З міркувань продуктивноÑті, код вÑередині [method assert] "
-"виконуєтьÑÑ Ñ‚Ñ–Ð»ÑŒÐºÐ¸ у діагноÑтичних збірках, або коли проєкт виконуєтьÑÑ Ñƒ "
-"редакторі. Ðе викориÑтовуйте код, Ñкий негативно впливає на Ð²Ð¸ÐºÐ¾Ð½Ð°Ð½Ð½Ñ "
-"[method assert]. Інакше, проєкт буде поводити Ñебе інакше, Ñкщо він буде "
-"екÑпортованим у режимі публікації.\n"
+"виконуєтьÑÑ Ñ‚Ñ–Ð»ÑŒÐºÐ¸ у діагноÑтичних збірках, або коли проєкт виконуєтьÑÑ Ð² "
+"редакторі. Ðе включайте в код, де викориÑÑ‚Ð°Ð½Ð½Ñ [method assert] призведе до "
+"побічних ефектів. У противному разі, проєкт буде поводити Ñебе інакше, Ñкщо "
+"він буде екÑпортованим у режимі публікації.\n"
"Якщо задано необов'Ñзковий аргумент [code]message[/code], то він буде "
"показаний у додаток до Ð¿Ð¾Ð²Ñ–Ð´Ð¾Ð¼Ð»ÐµÐ½Ð½Ñ \"Assertion failed\". Ви можете "
-"ÑкориÑтатиÑÑ Ñ†Ð¸Ð¼ Ð´Ð»Ñ Ð½Ð°Ð´Ð°Ð½Ð½Ñ Ð´Ð¾Ð´Ð°Ñ‚ÐºÐ¾Ð²Ð¸Ñ… відомоÑтей щодо того, чому перевірку "
-"не було пройдено.\n"
+"ÑкориÑтатиÑÑ Ñ†Ð¸Ð¼ Ð´Ð»Ñ Ð½Ð°Ð´Ð°Ð½Ð½Ñ Ð´Ð¾Ð´Ð°Ñ‚ÐºÐ¾Ð²Ð¸Ñ… відомоÑтей щодо причини провалу "
+"перевірки.\n"
"[codeblock]\n"
-"# ПрипуÑтимо, що ви хочете, щоб швидкіÑть (speed) була у межах від 0 до 20.\n"
+"# ПрипуÑтимо, ви хочете, щоб швидкіÑть (speed) була у межах від 0 до 20.\n"
"var speed = -10\n"
"assert(speed < 20) # ІÑтина, програма продовжить виконаннÑ\n"
"assert(speed >= 0) # Хиба, програму буде зупинено\n"
@@ -375,6 +371,7 @@ msgstr ""
"полÑрну ÑиÑтему (відÑтань до початку координат та кут)."
#: modules/gdscript/doc_classes/@GDScript.xml
+#, fuzzy
msgid ""
"Rounds [code]s[/code] upward (towards positive infinity), returning the "
"smallest whole number that is not less than [code]s[/code].\n"
@@ -384,6 +381,13 @@ msgid ""
"[/codeblock]\n"
"See also [method floor], [method round], [method stepify], and [int]."
msgstr ""
+"Заокруглює [code]s[/code] вгору (до додатної неÑкінченноÑті), повертаючи "
+"найменше чиÑло, ще не менше за [code]s[/code].\n"
+"[codeblock]\n"
+"a = ceil(1.45) # a дорівнює 2.0\n"
+"a = ceil(1.001) # a дорівнює 2.0\n"
+"[/codeblock]\n"
+"Також переглÑньте [method floor], [method round], [method stepify] та [int]."
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -396,6 +400,13 @@ msgid ""
"[/codeblock]\n"
"This is the inverse of [method ord]."
msgstr ""
+"Повертає Ñимвол, Ñк РÑдок з даного Юнікод коду(що ÑуміÑний з ASCII кодом).\n"
+"[codeblock]\n"
+"a = char(65) # a дорівнює \"A\"\n"
+"a = char(65 + 32) # a дорівнює \"a\"\n"
+"a = char(8364) # a дорівнює \"€\"\n"
+"[/codeblock]\n"
+"Це протилежніÑть до [method ord]."
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -407,6 +418,13 @@ msgid ""
"a = clamp(15, 1, 20) # a is 15\n"
"[/codeblock]"
msgstr ""
+"ЗатиÑкує [code]value[/code] та повертає значеннÑ, що не менше за [code]min[/"
+"code] і не більше за [code]max[/code].\n"
+"[codeblock]\n"
+"a = clamp(1000, 1, 20) # a дорівнює 20\n"
+"a = clamp(-10, 1, 20) # a дорівнює 1\n"
+"a = clamp(15, 1, 20) # a дорівнює 15\n"
+"[/codeblock]"
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -421,6 +439,16 @@ msgid ""
"print(a.length())\n"
"[/codeblock]"
msgstr ""
+"Конвертує один тип в інший у найкращий ÑпоÑіб. Параметр [code]type[/code] "
+"викориÑтовує Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð· [enum Variant.Type].\n"
+"[codeblock]\n"
+"a = Vector2(1, 0)\n"
+"# Виводить 1\n"
+"print(a.length())\n"
+"a = convert(a, TYPE_STRING)\n"
+"# Виводить 6, бо Ñ€Ñдок \"(1, 0)\" ÑкладаєтьÑÑ Ð· 6 Ñимволів\n"
+"print(a.length())\n"
+"[/codeblock]"
#: modules/gdscript/doc_classes/@GDScript.xml
#, fuzzy
@@ -431,11 +459,10 @@ msgid ""
"a = cos(PI) # a is -1.0\n"
"[/codeblock]"
msgstr ""
-"Повертає абÑолютне Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¿Ð°Ñ€Ð°Ð¼ÐµÑ‚Ñ€Ñƒ [code]s[/code] (тобто Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð±ÐµÐ· "
-"знака, працює Ð´Ð»Ñ Ñ†Ñ–Ð»Ð¸Ñ… чиÑел Ñ– чиÑел із рухомою крапкою).\n"
+"Повертає коÑÐ¸Ð½ÑƒÑ ÐºÑƒÑ‚Ð° [code]s[/code] в радіанах.\n"
"[codeblock]\n"
-"# a дорівнює 1\n"
-"a = abs(-1)\n"
+"a = cos(TAU) # a дорівнює 1.0\n"
+"a = cos(PI) # a дорівнює -1.0\n"
"[/codeblock]"
#: modules/gdscript/doc_classes/@GDScript.xml
@@ -452,11 +479,11 @@ msgstr ""
#: modules/gdscript/doc_classes/@GDScript.xml
msgid "Converts from decibels to linear energy (audio)."
-msgstr ""
+msgstr "Перетворює з децибел в лінійну енергію (аудіо)."
#: modules/gdscript/doc_classes/@GDScript.xml
msgid "Deprecated alias for [method step_decimals]."
-msgstr ""
+msgstr "ЗаÑтарілий пÑевдонім Ð´Ð»Ñ [method step_decimals]."
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -468,6 +495,13 @@ msgid ""
"a = dectime(60, 10, 0.1)) # a is 59.0\n"
"[/codeblock]"
msgstr ""
+"[b]Ðотатка:[/b] [code]dectime[/code] заÑтарілий Ñ– буде вилучений в Godot "
+"4.0, натоміÑть краще викориÑтовуйте [method move_toward].\n"
+"Повертає результат [code]value[/code] зменшений на [code]step[/code] * "
+"[code]amount[/code].\n"
+"[codeblock]\n"
+"a = dectime(60, 10, 0.1)) # a дорівнює 59.0\n"
+"[/codeblock]"
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -489,6 +523,23 @@ msgid ""
"want a true content-aware comparison, you have to use [code]deep_equal[/"
"code]."
msgstr ""
+"Порівнює два значеннÑ, шлÑхом порівнÑÐ½Ð½Ñ Ñ—Ñ… реального вміÑту, рекурÑивно Ð´Ð»Ñ "
+"будь-Ñкого [Array] чи [Dictionary] аж до найглибшого рівнÑ.\n"
+"Порівнюючи з [code]==[/code], відмітимо:\n"
+"- Ð”Ð»Ñ [code]null[/code], [code]int[/code], [code]float[/code], [code]String[/"
+"code], [code]Object[/code] та [code]RID[/code] що [code]deep_equal[/code], "
+"що [code]==[/code] працюють однаково.\n"
+"- Ð”Ð»Ñ [code]Dictionary[/code], [code]==[/code] виÑвлÑÑ” рівніÑть тоді й "
+"тільки тоді, коли йде порівнÑÐ½Ð½Ñ Ð· цим Ñамим [code]Dictionary[/code], без "
+"рекурÑÑ–Ñ— чи будь-Ñкого Ð²Ñ€Ð°Ñ…ÑƒÐ²Ð°Ð½Ð½Ñ Ð²Ð¼Ñ–Ñту.\n"
+"- Ð”Ð»Ñ [code]Array[/code], [code]==[/code] виÑвлÑÑ” рівніÑть тоді й тільки "
+"тоді, коли кожний елемент у першому [code]Array[/code] дорівнює відповідному "
+"елементу в другому [code]Array[/code], де порівнÑÐ½Ð½Ñ Ð¿Ñ€Ð¾Ñ…Ð¾Ð´Ð¸Ñ‚ÑŒ через "
+"[code]==[/code]. Це означає, що [code]==[/code] рекурÑивно порівнює "
+"[code]Array[/code], але не [code]Dictionary[/code].\n"
+"Загалом, Ñкщо у Ð²Ð°Ñ Ð¿Ð¾Ñ‚ÐµÐ½Ñ†Ñ–Ð¹Ð½Ð¾ викориÑтовуєтьÑÑ [code]Dictionary[/code], Ñ– "
+"вам потрібно порівнÑÐ½Ð½Ñ Ð· урахуваннÑм вміÑту, викориÑтовуйте "
+"[code]deep_equal[/code]."
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -30098,7 +30149,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/vi.po b/doc/translations/vi.po
index 962440bfab..36ef54b096 100644
--- a/doc/translations/vi.po
+++ b/doc/translations/vi.po
@@ -30410,7 +30410,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
diff --git a/doc/translations/zh_CN.po b/doc/translations/zh_CN.po
index 966ec9b0f9..773dda130e 100644
--- a/doc/translations/zh_CN.po
+++ b/doc/translations/zh_CN.po
@@ -3,7 +3,7 @@
# Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).
# This file is distributed under the same license as the Godot source code.
#
-# Haoyu Qiu <timothyqiu32@gmail.com>, 2020, 2021, 2022.
+# Haoyu Qiu <timothyqiu32@gmail.com>, 2020, 2021, 2022, 2023.
# fangxvan <2661712415@qq.com>, 2020.
# yzt <834950797@qq.com>, 2020.
# 懵逼Kitty <m1330586660@163.com>, 2020, 2021.
@@ -37,7 +37,7 @@
# Juer Genie Whang <2695996944@qq.com>, 2021.
# SimonChang <simon_chang@foxmail.com>, 2021.
# zeng haochen <m18621006730@163.com>, 2021.
-# suplife <2634557184@qq.com>, 2021.
+# suplife <2634557184@qq.com>, 2021, 2023.
# Magian <magian1127@gmail.com>, 2021, 2022.
# ji233 <27987772@qq.com>, 2021.
# 沈士超 <shenshichao920@hotmail.com>, 2021.
@@ -64,7 +64,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Godot Engine class reference\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
-"PO-Revision-Date: 2022-12-12 06:48+0000\n"
+"PO-Revision-Date: 2023-01-09 20:42+0000\n"
"Last-Translator: Haoyu Qiu <timothyqiu32@gmail.com>\n"
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
"godot-engine/godot-class-reference/zh_Hans/>\n"
@@ -73,7 +73,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-"X-Generator: Weblate 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: doc/tools/make_rst.py
msgid "Description"
@@ -730,7 +730,6 @@ msgstr ""
"[/codeblock]"
#: modules/gdscript/doc_classes/@GDScript.xml
-#, fuzzy
msgid ""
"Returns an array of dictionaries representing the current call stack. See "
"also [method print_stack].\n"
@@ -754,7 +753,7 @@ msgid ""
"get_stack] will not work in projects exported in release mode, or in "
"projects exported in debug mode if not connected to a debugging server."
msgstr ""
-"返回一个表示当å‰è°ƒç”¨å †æ ˆçš„字典数组。\n"
+"返回一个表示当å‰è°ƒç”¨å †æ ˆçš„字典数组。å¦è¯·å‚阅 [method print_stack]。\n"
"[codeblock]\n"
"func _ready():\n"
" foo()\n"
@@ -769,7 +768,11 @@ msgstr ""
"[codeblock]\n"
"[{function:bar, line:12, source:res://script.gd}, {function:foo, line:9, "
"source:res://script.gd}, {function:_ready, line:6, source:res://script.gd}]\n"
-"[/codeblock]"
+"[/codeblock]\n"
+"[b]注æ„:[/b]è¿è¡Œä¸­çš„实例连接到调试æœåŠ¡å™¨ï¼ˆä¾‹å¦‚ç¼–è¾‘å™¨å®žä¾‹ï¼‰åŽï¼Œ[method "
+"get_stack] æ‰èƒ½æ­£å¸¸å·¥ä½œã€‚[method get_stack] 无法在使用å‘布模å¼å¯¼å‡ºçš„项目中正"
+"常工作。使用调试模å¼å¯¼å‡ºçš„项目如果没有连接到调试æœåŠ¡å™¨ï¼Œåˆ™è¯¥å‡½æ•°ä¹Ÿæ— æ³•æ­£å¸¸å·¥"
+"作。"
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -1367,6 +1370,15 @@ msgid ""
"print_stack] will not work in projects exported in release mode, or in "
"projects exported in debug mode if not connected to a debugging server."
msgstr ""
+"输出当å‰ä»£ç ä½ç½®çš„æ ˆè¿½è¸ªã€‚å¦è¯·å‚阅 [method get_stack]。\n"
+"控制å°ä¸­çš„输出是类似这样的:\n"
+"[codeblock]\n"
+"Frame 0 - res://test.gd:16 in function '_process'\n"
+"[/codeblock]\n"
+"[b]注æ„:[/b]è¿è¡Œä¸­çš„实例连接到调试æœåŠ¡å™¨ï¼ˆä¾‹å¦‚ç¼–è¾‘å™¨å®žä¾‹ï¼‰åŽï¼Œ[method "
+"print_stack] æ‰èƒ½æ­£å¸¸å·¥ä½œã€‚[method print_stack] 无法在使用å‘布模å¼å¯¼å‡ºçš„项目"
+"中正常工作。使用调试模å¼å¯¼å‡ºçš„项目如果没有连接到调试æœåŠ¡å™¨ï¼Œåˆ™è¯¥å‡½æ•°ä¹Ÿæ— æ³•æ­£"
+"常工作。"
#: modules/gdscript/doc_classes/@GDScript.xml
msgid ""
@@ -4407,6 +4419,18 @@ msgid ""
"[b]Note:[/b] The final colon is required to specify for properly detecting "
"built-in types."
msgstr ""
+"æç¤ºä¸€ä¸ªå±žæ€§ä»£è¡¨ç‰¹å®šçš„类型。如果属性为 [constant TYPE_STRING],则å¯ä»¥é€šè¿‡åˆ›å»º"
+"å¯¹è¯æ¡†è®¾ç½®å…¶ç±»åž‹ã€‚如果你需è¦åˆ›å»ºä¸€ä¸ª [Array] æ¥æ”¾ç½®ç‰¹å®šç±»åž‹çš„元素,则 "
+"[code]hint_string[/code] 必须使用 [code]\":\"[/code] æ¥ç¼–ç åµŒå¥—类型,使用 "
+"[code]\"/\"[/code] æ¥æŒ‡å®š [Resource] 类型。例如:\n"
+"[codeblock]\n"
+"hint_string = \"%s:\" % [TYPE_INT] # 整数数组。\n"
+"hint_string = \"%s:%s:\" % [TYPE_ARRAY, TYPE_REAL] # 浮点数二维数组。\n"
+"hint_string = \"%s/%s:Resource\" % [TYPE_OBJECT, TYPE_OBJECT] # èµ„æºæ•°ç»„。\n"
+"hint_string = \"%s:%s/%s:Resource\" % [TYPE_ARRAY, TYPE_OBJECT, TYPE_OBJECT] "
+"# 资æºäºŒç»´æ•°ç»„。\n"
+"[/codeblock]\n"
+"[b]注æ„:[/b]最åŽçš„冒巿˜¯å¿…须的,å¦åˆ™æ— æ³•正确检测内置类型。"
#: doc/classes/@GlobalScope.xml
msgid "The property is serialized and saved in the scene file (default)."
@@ -8808,7 +8832,6 @@ msgstr ""
"较慢。这是因为所有放置在删除元素之åŽçš„å…ƒç´ éƒ½å¿…é¡»é‡æ–°ç´¢å¼•。"
#: doc/classes/Array.xml
-#, fuzzy
msgid ""
"Assigns the given value to all elements in the array. This can typically be "
"used together with [method resize] to create an array with a given size and "
@@ -8828,7 +8851,9 @@ msgstr ""
"var array = []\n"
"array.resize(10)\n"
"array.fill(0) # å°† 10 个元素都åˆå§‹åŒ–为 0。\n"
-"[/codeblock]"
+"[/codeblock]\n"
+"[b]注æ„:[/b]如果 [code]value[/code] 为引用类型(派生自 [Object]ã€[Array]ã€"
+"[Dictionary] 等),那么会用åŒä¸€ä¸ªå¯¹è±¡çš„引用填充该数组,å³ä¸ä¼šåˆ›å»ºå‰¯æœ¬ã€‚"
#: doc/classes/Array.xml doc/classes/PoolByteArray.xml
#: doc/classes/PoolColorArray.xml doc/classes/PoolIntArray.xml
@@ -9076,7 +9101,6 @@ msgstr ""
"索引之间的å˜åŒ–。"
#: doc/classes/Array.xml
-#, fuzzy
msgid ""
"Sorts the array.\n"
"[b]Note:[/b] The sorting algorithm used is not [url=https://en.wikipedia.org/"
@@ -9092,6 +9116,9 @@ msgid ""
"[/codeblock]"
msgstr ""
"对数组进行排åºã€‚\n"
+"[b]注æ„:[/b]æŽ’åºæ‰€ä½¿ç”¨çš„算法并ä¸[url=https://zh.wikipedia.org/wiki/"
+"%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95#%E7%A9%A9%E5%AE%9A%E6%80%A7]稳定[/url]。"
+"也就是说,使用 [method sort] 时相等的值之间的顺åºå¯èƒ½ä¼šæ”¹å˜ã€‚\n"
"[b]注æ„:[/b]字符串按字æ¯é¡ºåºæŽ’åºï¼ˆä¸Žè‡ªç„¶é¡ºåºç›¸å)。当对一个以数字åºåˆ—结尾的"
"å­—ç¬¦ä¸²æ•°ç»„è¿›è¡ŒæŽ’åºæ—¶ï¼Œè¿™å¯èƒ½ä¼šå¯¼è‡´æ„外的行为。请看下é¢çš„例å­ã€‚\n"
"[codeblock]\n"
@@ -9101,7 +9128,6 @@ msgstr ""
"[/codeblock]"
#: doc/classes/Array.xml
-#, fuzzy
msgid ""
"Sorts the array using a custom method. The arguments are an object that "
"holds the method and the name of such method. The custom method receives two "
@@ -9135,8 +9161,11 @@ msgstr ""
"对于两个元素 [code]a[/code] 和 [code]b[/code],如果给定的方法返回 "
"[code]true[/code],数组中的元素 [code]b[/code] 将排在元素 [code]a[/code] 之"
"åŽã€‚\n"
-"[b]注æ„:[/b]ä½ ä¸èƒ½éšæœºåŒ–è¿”å›žå€¼ï¼Œå› ä¸ºå †æŽ’åºç®—法期望一个确定的结果。而这样åšä¼š"
-"导致æ„外的行为。\n"
+"[b]注æ„:[/b]æŽ’åºæ‰€ä½¿ç”¨çš„算法并ä¸[url=https://zh.wikipedia.org/wiki/"
+"%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95#%E7%A9%A9%E5%AE%9A%E6%80%A7]稳定[/url]。"
+"也就是说,使用 [method sort] 时相等的值之间的顺åºå¯èƒ½ä¼šæ”¹å˜ã€‚\n"
+"[b]注æ„:[/b]ä¸èƒ½éšæœºè¿”å›žä¸€ä¸ªå€¼ï¼Œå› ä¸ºå †æŽ’åºç®—æ³•æœŸæœ›ç¡®å®šçš„ç»“æžœã€‚éšæœºè¿”回一个值"
+"会导致æ„外的行为。\n"
"[codeblock]\n"
"class MyCustomSorter:\n"
" static func sort_ascending(a, b):\n"
@@ -9787,7 +9816,7 @@ msgid ""
"However, at this point in time only one interface can render to an HMD."
msgstr ""
"调用这个æ¥åˆå§‹åŒ–这个接å£ã€‚第一个被åˆå§‹åŒ–的接å£ç¡®å®šä¸ºä¸»æŽ¥å£ï¼Œç”¨äºŽæ¸²æŸ“输出。\n"
-"在åˆå§‹åŒ–了接å£ä¹‹åŽï¼Œéœ€è¦å¯ç”¨è§†çª—çš„ AR/VR 模å¼ï¼Œå°†å¼€å§‹æ¸²æŸ“。\n"
+"在åˆå§‹åŒ–了接å£ä¹‹åŽï¼Œéœ€è¦å¯ç”¨è§†å£çš„ AR/VR 模å¼ï¼Œå°†å¼€å§‹æ¸²æŸ“。\n"
"[b]注æ„:[/b]对于任何使用 Godot 主输出的设备,如移动 VR,你必须在主视å£ä¸Šå¯"
"用 AR/VR 模å¼ã€‚\n"
"如果你为一个处ç†è‡ªå·±è¾“出的平å°è¿™æ ·åšï¼ˆå¦‚ OpenVR),Godot 就会在å±å¹•ä¸Šåªæ˜¾ç¤ºä¸€"
@@ -9844,9 +9873,9 @@ msgid ""
"[method get_render_targetsize]). Using a separate viewport node frees up the "
"main viewport for other purposes."
msgstr ""
-"这个接å£è¾“出到一个外部设备。如果使用主视区,å±å¹•上的输出是一个未ç»ä¿®æ”¹çš„左眼"
-"或å³çœ¼çš„缓冲区,如果没有将视窗尺寸更改为 [method get_render_targetsize] 的相"
-"åŒé•¿å®½æ¯”,则被拉伸。使用一个å•独的视窗节点å¯ä»¥é‡Šæ”¾å‡ºä¸»è§†åŒºï¼Œç”¨äºŽå…¶ä»–用途。"
+"这个接å£è¾“出到一个外部设备。如果使用主视å£ï¼Œå±å¹•上的输出是一个未ç»ä¿®æ”¹çš„左眼"
+"或å³çœ¼çš„缓冲区,如果没有将视å£å°ºå¯¸æ›´æ”¹ä¸º [method get_render_targetsize] 的相"
+"åŒé•¿å®½æ¯”,则被拉伸。使用一个å•独的视å£èŠ‚ç‚¹å¯ä»¥é‡Šæ”¾å‡ºä¸»è§†å£ï¼Œç”¨äºŽå…¶ä»–用途。"
#: doc/classes/ARVRInterface.xml
msgid ""
@@ -12402,14 +12431,13 @@ msgid "Clears the audio sample data buffer."
msgstr "清除音频样本数æ®ç¼“冲区。"
#: doc/classes/AudioStreamGeneratorPlayback.xml
-#, fuzzy
msgid ""
"Returns the number of frames that can be pushed to the audio sample data "
"buffer without overflowing it. If the result is [code]0[/code], the buffer "
"is full."
msgstr ""
-"如果å¯ä»¥å°†å¤§å°ä¸º [code]amount[/code] 的缓冲区推é€åˆ°éŸ³é¢‘采样数æ®ç¼“冲区而ä¸ä½¿å…¶"
-"溢出,则返回 [code]true[/code],å¦åˆ™è¿”回 [code]false[/code]。"
+"返回能够推é€åˆ°éŸ³é¢‘采样数æ®ç¼“冲区而ä¸ä½¿å…¶æº¢å‡ºçš„帧数。如果结果为 [code]0[/"
+"code],则缓冲区已满。"
#: doc/classes/AudioStreamGeneratorPlayback.xml
msgid ""
@@ -13042,7 +13070,6 @@ msgstr ""
"[code]texture(SCREEN_TEXTURE, ...)[/code] 函数在ç€è‰²å™¨è„šæœ¬ä¸­å¯¹å…¶è¿›è¡Œè®¿é—®ã€‚"
#: doc/classes/BackBufferCopy.xml
-#, fuzzy
msgid ""
"Node for back-buffering the currently-displayed screen. The region defined "
"in the [BackBufferCopy] node is buffered with the content of the screen it "
@@ -13055,44 +13082,40 @@ msgid ""
"derived nodes as [i]siblings[/i] to the [BackBufferCopy] node instead of "
"adding them as children."
msgstr ""
-"用于对当å‰å±å¹•显示进行åŽå°ç¼“冲的节点。BackBufferCopy 节点中定义的区域与其覆盖"
-"å±å¹•çš„å†…å®¹ä¸€èµ·ç¼“å†²ï¼Œæˆ–è€…æ ¹æ®æ‹·è´æ¨¡å¼è®¾ç½®çš„æ•´ä¸ªå±å¹•进行缓冲。在ç€è‰²å™¨è„šæœ¬ä¸­ä½¿"
-"用 [code]texture(SCREEN_TEXTURE, ...)[/code] 函数æ¥è®¿é—®ç¼“冲区。\n"
+"ç”¨äºŽå¯¹å½“å‰æ˜¾ç¤ºçš„å±å¹•进行åŽå°ç¼“冲的节点。[BackBufferCopy] 节点中定义的区域与其"
+"覆盖å±å¹•çš„å†…å®¹ä¸€èµ·ç¼“å†²ï¼Œæˆ–è€…æ ¹æ®æ‹·è´æ¨¡å¼è®¾ç½®çš„æ•´ä¸ªå±å¹•进行缓冲。在ç€è‰²å™¨è„šæœ¬"
+"中使用 [code]texture(SCREEN_TEXTURE, ...)[/code] 函数æ¥è®¿é—®ç¼“冲区。\n"
"[b]注æ„:[/b]由于该节点继承自 [Node2D] è€Œéž [Control],锚点和边è·å°†ä¸ä¼šåº”用于"
"从 [Control] 派生的å­èŠ‚ç‚¹ã€‚è¿™åœ¨è°ƒæ•´çª—å£å¤§å°æ—¶å¯èƒ½ä¼šå‡ºçŽ°é—®é¢˜ã€‚ä¸ºé¿å…è¿™ç§æƒ…况,"
-"请将 [Control] 派生节点添加为 BackBufferCopy 节点的[i]åŒçº§[/i],ä¸è¦å°†å®ƒä»¬æ·»"
-"加为其å­èŠ‚ç‚¹ã€‚"
+"请将 [Control] 派生节点添加为 [BackBufferCopy] 节点的[i]åŒçº§[/i],ä¸è¦å°†å®ƒä»¬"
+"添加为其å­èŠ‚ç‚¹ã€‚"
#: doc/classes/BackBufferCopy.xml
msgid "Buffer mode. See [enum CopyMode] constants."
msgstr "缓冲区模å¼ã€‚è§ [enum CopyMode] 常é‡ã€‚"
#: doc/classes/BackBufferCopy.xml
-#, fuzzy
msgid ""
"The area covered by the [BackBufferCopy]. Only used if [member copy_mode] is "
"[constant COPY_MODE_RECT]."
msgstr ""
-"BackBufferCopy è¦†ç›–çš„åŒºåŸŸã€‚åªæœ‰å½“ [member copy_mode] 是 [constant "
+"该 [BackBufferCopy] æ‰€è¦†ç›–çš„åŒºåŸŸã€‚åªæœ‰å½“ [member copy_mode] 为 [constant "
"COPY_MODE_RECT] æ—¶æ‰ä½¿ç”¨ã€‚"
#: doc/classes/BackBufferCopy.xml
-#, fuzzy
msgid ""
"Disables the buffering mode. This means the [BackBufferCopy] node will "
"directly use the portion of screen it covers."
msgstr ""
-"ç¦ç”¨ç¼“冲模å¼ã€‚è¿™æ„å‘³ç€ BackBufferCopy 节点将直接使用它所覆盖的å±å¹•部分。"
+"ç¦ç”¨ç¼“冲模å¼ã€‚è¿™æ„味ç€è¯¥ [BackBufferCopy] 节点将直接使用它所覆盖的å±å¹•部分。"
#: doc/classes/BackBufferCopy.xml
-#, fuzzy
msgid "[BackBufferCopy] buffers a rectangular region."
-msgstr "BackBufferCopy 缓冲一个矩形区域。"
+msgstr "[BackBufferCopy] 缓冲一个矩形区域。"
#: doc/classes/BackBufferCopy.xml
-#, fuzzy
msgid "[BackBufferCopy] buffers the entire screen."
-msgstr "BackBufferCopy 缓冲整个å±å¹•。"
+msgstr "[BackBufferCopy] 缓冲整个å±å¹•。"
#: doc/classes/BakedLightmap.xml
msgid "Prerendered indirect light map for a scene."
@@ -14561,9 +14584,9 @@ msgid ""
"[Viewport] (or higher viewports) can't be displayed."
msgstr ""
"相机是一个特殊节点,用于显示从其当å‰ä½ç½®å¯è§çš„内容。相机在最近的 [Viewport] "
-"节点中注册自己(当树上行)。æ¯ä¸ªè§†åŒºåªèƒ½æ¿€æ´»ä¸€ä¸ªç›¸æœºã€‚如果在树上没有å¯ç”¨çš„视"
-"区,相机将在全局视区中注册。æ¢å¥è¯è¯´ï¼Œç›¸æœºåªæ˜¯ä¸º [Viewport] æä¾› 3D 显示能"
-"力,如果没有,则无法显示在该 [Viewport] 或更高视区中注册的场景。"
+"节点中注册自己(当树上行)。æ¯ä¸ªè§†å£åªèƒ½æ¿€æ´»ä¸€ä¸ªç›¸æœºã€‚如果在树上没有å¯ç”¨çš„视"
+"å£ï¼Œç›¸æœºå°†åœ¨å…¨å±€è§†å£ä¸­æ³¨å†Œã€‚æ¢å¥è¯è¯´ï¼Œç›¸æœºåªæ˜¯ä¸º [Viewport] æä¾› 3D 显示能"
+"力,如果没有,则无法显示在该 [Viewport] 或更高视å£ä¸­æ³¨å†Œçš„场景。"
#: doc/classes/Camera.xml
msgid ""
@@ -14720,7 +14743,7 @@ msgid ""
"[/codeblock]"
msgstr ""
"返回 [Viewport] 矩形中的 2D åæ ‡ï¼Œè¯¥å标映射到世界空间中给定的 3D 点。\n"
-"[b]注æ„:[/b]当使用它æ¥å®šä½ 3D 视区上的 GUI 元素时,如果 3D 点在相机åŽé¢ï¼Œè¯·"
+"[b]注æ„:[/b]当使用它æ¥å®šä½ 3D 视å£ä¸Šçš„ GUI 元素时,如果 3D 点在相机åŽé¢ï¼Œè¯·"
"使用 [method is_position_behind] æ¥é˜²æ­¢å®ƒä»¬æ˜¾ç¤ºã€‚\n"
"[codeblock]\n"
"# 这个代ç å—是继承自 Spatial 的脚本的一部分。\n"
@@ -14768,7 +14791,7 @@ msgstr ""
"[code]_process[/code] 方法中的å˜åŒ–。多普勒效果åªå¯¹ [member "
"AudioStreamPlayer3D.doppler_tracking] 设置为 [constant AudioStreamPlayer3D."
"DOPPLER_TRACKING_DISABLED] 以外的值的 [AudioStreamPlayer3D] 节点进行模拟。\n"
-"[b]注æ„:[/b]è¦åœ¨ç¼–辑器中切æ¢å¤šæ™®å‹’效果预览,使用 3D 视区左上角的é€è§†èœå•,并"
+"[b]注æ„:[/b]è¦åœ¨ç¼–辑器中切æ¢å¤šæ™®å‹’效果预览,使用 3D 视å£å·¦ä¸Šè§’çš„é€è§†èœå•,并"
"切æ¢ä¸º[b]å¯ç”¨å¤šæ™®å‹’[/b]。"
#: doc/classes/Camera.xml
@@ -14816,7 +14839,7 @@ msgstr ""
#: doc/classes/Camera.xml
msgid "The horizontal (X) offset of the camera viewport."
-msgstr "相机视窗的水平(X)åç§»é‡ã€‚"
+msgstr "相机视å£çš„æ°´å¹³ï¼ˆX)åç§»é‡ã€‚"
#: doc/classes/Camera.xml
msgid ""
@@ -14852,7 +14875,7 @@ msgstr ""
#: doc/classes/Camera.xml
msgid "The vertical (Y) offset of the camera viewport."
-msgstr "相机视窗的垂直(Y)åç§»é‡ã€‚"
+msgstr "相机视å£çš„垂直(Y)åç§»é‡ã€‚"
#: doc/classes/Camera.xml
msgid ""
@@ -15023,7 +15046,7 @@ msgstr ""
msgid ""
"Make this the current 2D camera for the scene (viewport and layer), in case "
"there are many cameras in the scene."
-msgstr "使之æˆä¸ºè¯¥åœºæ™¯ï¼ˆè§†åŒºå’Œå›¾å±‚ï¼‰çš„å½“å‰ 2D 相机,以防场景中有很多相机。"
+msgstr "使之æˆä¸ºè¯¥åœºæ™¯ï¼ˆè§†å£å’Œå›¾å±‚ï¼‰çš„å½“å‰ 2D 相机,以防场景中有很多相机。"
#: doc/classes/Camera2D.xml
msgid ""
@@ -15070,7 +15093,7 @@ msgid ""
"or not a [Viewport], uses the default viewport instead."
msgstr ""
"连接到 [Camera2D] 的自定义 [Viewport] 节点。如果为 [code]null[/code] 或者ä¸"
-"是 [Viewport],则使用默认的视区。"
+"是 [Viewport],则使用默认的视å£ã€‚"
#: doc/classes/Camera2D.xml
msgid ""
@@ -15883,11 +15906,11 @@ msgstr "è¿”å›žæ­¤é¡¹ç›®çš„å˜æ¢çŸ©é˜µã€‚"
#: doc/classes/CanvasItem.xml
msgid "Returns the viewport's boundaries as a [Rect2]."
-msgstr "以 [Rect2] å½¢å¼è¿”回视区的边界。"
+msgstr "以 [Rect2] å½¢å¼è¿”回视å£çš„边界。"
#: doc/classes/CanvasItem.xml
msgid "Returns this item's transform in relation to the viewport."
-msgstr "è¿”å›žè¿™ä¸ªé¡¹ç›®ç›¸å¯¹äºŽè§†åŒºçš„å˜æ¢ã€‚"
+msgstr "返回这个项目相对于视å£çš„å˜æ¢ã€‚"
#: doc/classes/CanvasItem.xml
msgid "Returns the [World2D] where this item is in."
@@ -16281,7 +16304,7 @@ msgid ""
"Together with [member follow_viewport_scale] it can be used for a pseudo 3D "
"effect."
msgstr ""
-"å¯ç”¨æ—¶ï¼Œè¯¥ [CanvasLayer] ä¼šä½¿ç”¨è§†åŒºçš„å˜æ¢ï¼Œæ‰€ä»¥å®ƒä¼šéšç›¸æœºç§»åŠ¨ï¼Œè€Œä¸æ˜¯ä¿æŒåœ¨å±"
+"å¯ç”¨æ—¶ï¼Œè¯¥ [CanvasLayer] 会使用视å£çš„å˜æ¢ï¼Œæ‰€ä»¥å®ƒä¼šéšç›¸æœºç§»åŠ¨ï¼Œè€Œä¸æ˜¯ä¿æŒåœ¨å±"
"幕上的æŸä¸ªå›ºå®šä½ç½®ã€‚\n"
"与 [member follow_viewport_scale] é…åˆå¯ä»¥å®žçŽ°ä¼ª 3D 效果。"
@@ -19193,7 +19216,7 @@ msgid ""
msgstr ""
"åŠ è½½æŒ‡å®šä¸ºå‚æ•°çš„é…ç½®æ–‡ä»¶ã€‚è§£æžæ–‡ä»¶çš„内容并将其加载到调用该方法的 "
"[ConfigFile] 对象中。\n"
-"返回 [enum Error] 代ç å¸¸é‡ä¹‹ä¸€ï¼ˆæˆåŠŸæ—¶è¿”å›ž [code]OK[/code])。"
+"返回 [enum Error] 错误ç å¸¸é‡ï¼ˆæˆåŠŸæ—¶ä¸º [code]OK[/code])。"
#: doc/classes/ConfigFile.xml
msgid ""
@@ -19204,7 +19227,7 @@ msgid ""
msgstr ""
"åŠ è½½æŒ‡å®šä¸ºå‚æ•°çš„加密é…置文件,使用æä¾›çš„ [code]key[/code] å¯¹å…¶è§£å¯†ã€‚è§£æžæ–‡ä»¶"
"的内容并将其加载到调用该方法的 [ConfigFile] 对象中。\n"
-"返回 [enum Error] 代ç å¸¸é‡ä¹‹ä¸€ï¼ˆæˆåŠŸæ—¶è¿”å›ž [code]OK[/code])。"
+"返回 [enum Error] 错误ç å¸¸é‡ï¼ˆæˆåŠŸæ—¶ä¸º [code]OK[/code])。"
#: doc/classes/ConfigFile.xml
msgid ""
@@ -19215,7 +19238,7 @@ msgid ""
msgstr ""
"åŠ è½½ä½œä¸ºå‚æ•°çš„加密é…置文件,使用æä¾›çš„ [code]password[/code] 解密。该文件的内"
"容被解æžå¹¶åŠ è½½åˆ°è°ƒç”¨è¯¥æ–¹æ³•çš„ [ConfigFile] 对象中。\n"
-"返回 [enum Error] 代ç å¸¸é‡ä¹‹ä¸€ï¼ˆæˆåŠŸæ—¶è¿”å›ž [code]OK[/code])。"
+"返回 [enum Error] 错误ç å¸¸é‡ï¼ˆæˆåŠŸæ—¶ä¸º [code]OK[/code])。"
#: doc/classes/ConfigFile.xml
msgid ""
@@ -19225,7 +19248,7 @@ msgid ""
msgstr ""
"将传递的字符串解æžä¸ºé…置文件的内容。该字符串被解æžå¹¶åŠ è½½åˆ°è°ƒç”¨è¯¥æ–¹æ³•çš„ "
"ConfigFile 对象中。\n"
-"返回 [enum Error] 常é‡ä¹‹ä¸€ï¼ŒæˆåŠŸæ—¶è¿”å›ž [code]OK[/code]。"
+"返回 [enum Error] 错误ç å¸¸é‡ï¼ˆæˆåŠŸæ—¶ä¸º [code]OK[/code])。"
#: doc/classes/ConfigFile.xml
msgid ""
@@ -19235,7 +19258,7 @@ msgid ""
msgstr ""
"å°† [ConfigFile] 对象的内容ä¿å­˜åˆ°æŒ‡å®šä¸ºå‚数的文件中。输出文件使用 INI æ ·å¼çš„结"
"构。\n"
-"返回 [enum Error] 代ç å¸¸é‡ä¹‹ä¸€ï¼ˆæˆåŠŸæ—¶è¿”å›ž [code]OK[/code])。"
+"返回 [enum Error] 错误ç å¸¸é‡ï¼ˆæˆåŠŸæ—¶ä¸º [code]OK[/code])。"
#: doc/classes/ConfigFile.xml
msgid ""
@@ -19246,7 +19269,7 @@ msgid ""
msgstr ""
"使用æä¾›çš„ [code]key[/code] å°† [ConfigFile] 对象的内容ä¿å­˜åˆ°ä½œä¸ºå‚数指定的 "
"AES-256 加密文件中。输出文件使用 INI æ ·å¼çš„结构。\n"
-"返回 [enum Error] 代ç å¸¸é‡ä¹‹ä¸€ï¼ˆæˆåŠŸæ—¶è¿”å›ž [code]OK[/code])。"
+"返回 [enum Error] 错误ç å¸¸é‡ï¼ˆæˆåŠŸæ—¶ä¸º [code]OK[/code])。"
#: doc/classes/ConfigFile.xml
msgid ""
@@ -19257,7 +19280,7 @@ msgid ""
msgstr ""
"å°† [ConfigFile] 对象的内容ä¿å­˜åˆ°ä½œä¸ºå‚数指定的 AES-256 加密文件中,使用æä¾›"
"的 [code]password[/code]进行加密。输出文件使用 INI 风格的结构。\n"
-"返回 [enum Error] 代ç å¸¸é‡ä¹‹ä¸€ï¼ˆæˆåŠŸæ—¶è¿”å›ž [code]OK[/code])。"
+"返回 [enum Error] 错误ç å¸¸é‡ï¼ˆæˆåŠŸæ—¶ä¸º [code]OK[/code])。"
#: doc/classes/ConfigFile.xml
msgid ""
@@ -19380,7 +19403,7 @@ msgid ""
"code] methods provided by this class."
msgstr ""
"所有 UI 相关节点的基类。[Control] 具有定义其范围的边界矩形ã€ç›¸å¯¹äºŽå…¶çˆ¶æŽ§ä»¶æˆ–"
-"当å‰è§†çª—的锚点ä½ç½®ä»¥åŠè¡¨ç¤ºé”šç‚¹å移的边è·ã€‚当节点ã€å…¶ä»»ä½•父节点或å±å¹•尺寸å‘生"
+"当å‰è§†å£çš„锚点ä½ç½®ä»¥åŠè¡¨ç¤ºé”šç‚¹å移的边è·ã€‚当节点ã€å…¶ä»»ä½•父节点或å±å¹•尺寸å‘生"
"å˜åŒ–时,边è·ä¼šè‡ªåŠ¨æ›´æ–°ã€‚\n"
"更多关于 Godot çš„ UI 系统ã€é”šç‚¹ã€è¾¹è·å’Œå®¹å™¨çš„ä¿¡æ¯ï¼Œè¯·å‚阅手册中的相关教程。è¦"
"æž„å»ºçµæ´»çš„ UIï¼Œæ‚¨éœ€è¦æ··åˆä½¿ç”¨ä»Ž [Control] å’Œ [Container] 节点继承的 UI å…ƒ"
@@ -19557,8 +19580,8 @@ msgid ""
"propagating, even to nodes listening to [method Node._unhandled_input] or "
"[method Node._unhandled_key_input]."
msgstr ""
-"将输入事件标记为已处ç†ã€‚一旦接å—è¾“å…¥äº‹ä»¶ï¼Œå®ƒå°±ä¼šåœæ­¢ä¼ æ’­ï¼Œç”šè‡³ä¼ æ’­åˆ°æ­£åœ¨ä¾¦å¬"
-"[method Node._unhandled_input]或[method Node._unhandled_key_input]的节点。"
+"将输入事件标记为已处ç†ã€‚一旦接å—è¾“å…¥äº‹ä»¶ï¼Œä¼ æ’­å°±ä¼šåœæ­¢ï¼Œä¸ä¼šå†ä¼ æ’­åˆ°æ­£åœ¨ä¾¦å¬ "
+"[method Node._unhandled_input] 和 [method Node._unhandled_key_input] 的节点。"
#: doc/classes/Control.xml
msgid ""
@@ -20647,7 +20670,7 @@ msgid ""
"handled."
msgstr ""
"å…³é—­æ¨¡æ€æŽ§ä»¶æ—¶ï¼Œè¾“å…¥æ˜¯å¦ä¼ æ’­ã€‚\n"
-"如果为 [code]false[/code],事件处ç†å°†åœæ­¢åœ¨è§†åŒºçš„输入事件处ç†ã€‚该视区会先将模"
+"如果为 [code]false[/code],事件处ç†å°†åœæ­¢åœ¨è§†å£çš„输入事件处ç†ã€‚该视å£ä¼šå…ˆå°†æ¨¡"
"æ€æŽ§ä»¶éšè—,然åŽå†å°†è¾“入标记为已处ç†ã€‚"
#: doc/classes/Control.xml
@@ -20800,7 +20823,7 @@ msgstr ""
"这个值进行缩放。\n"
"[b]注æ„:[/b]这个属性主è¦ç”¨äºŽåŠ¨ç”»ç”¨é€”ã€‚å½“æŽ§ä»¶è¢«ç¼©æ”¾æ—¶ï¼ŒæŽ§ä»¶å†…çš„æ–‡æœ¬å°†çœ‹èµ·æ¥æ˜¯"
"åƒç´ åŒ–或模糊的。è¦åœ¨ä½ çš„项目支æŒå¤šç§åˆ†è¾¨çŽ‡ï¼Œè¯·ä½¿ç”¨[url=$DOCS_URL/tutorials/"
-"rendering/multiple_resolutions.html]文档[/url]中æè¿°çš„åˆé€‚的视窗拉伸模å¼ï¼Œè€Œ"
+"rendering/multiple_resolutions.html]文档[/url]中æè¿°çš„åˆé€‚çš„è§†å£æ‹‰ä¼¸æ¨¡å¼ï¼Œè€Œ"
"䏿˜¯å•独缩放控件。\n"
"[b]注æ„:[/b]如果控件节点是 [Container] 节点的å­èŠ‚ç‚¹ï¼Œå½“åœºæ™¯å®žä¾‹åŒ–æ—¶ï¼Œç¼©æ”¾å°†"
"被é‡ç½®ä¸º [code]Vector2(1, 1)[/code]。è¦åœ¨å®žä¾‹åŒ–时设置控件的缩放,使用 "
@@ -24076,7 +24099,7 @@ msgstr ""
#: doc/classes/CylinderShape.xml
msgid "Cylinder shape for collisions."
-msgstr "碰撞用的圆柱体形状。"
+msgstr "用于碰撞的圆柱体形状。"
#: doc/classes/CylinderShape.xml
msgid ""
@@ -24085,6 +24108,9 @@ msgid ""
"engine, there are several known bugs with cylinder collision shapes. Using "
"[CapsuleShape] or [BoxShape] instead is recommended."
msgstr ""
+"用于碰撞的圆柱体形状。\n"
+"[b]注æ„:[/b]使用 GodotPhysics 而éžé»˜è®¤çš„ Bullet 物ç†å¼•擎时,圆柱体碰撞形状存"
+"在已知的问题。推è使用 [CapsuleShape] 或 [BoxShape] 代替。"
#: doc/classes/CylinderShape.xml
msgid "The cylinder's height."
@@ -24665,7 +24691,7 @@ msgstr ""
"将当剿‰“å¼€çš„ç›®å½•æ”¹ä¸ºå‚æ•°ä¼ é€’çš„ç›®å½•ã€‚å‚æ•°å¯ä»¥æ˜¯ç›¸å¯¹äºŽå½“å‰ç›®å½•的(例如 "
"[code]newdir[/code] 或 [code].../newdir[/code]),也å¯ä»¥æ˜¯ç»å¯¹è·¯å¾„(例如 "
"[code]/tmp/newdir[/code] 或 [code]res://somedir/newdir[/code])。\n"
-"返回 [enum Error] 代ç å¸¸é‡ä¹‹ä¸€ï¼ˆ[code]OK[/code] æˆåŠŸæ—¶ï¼‰ã€‚"
+"返回 [enum Error] 错误ç å¸¸é‡ï¼ˆæˆåŠŸæ—¶ä¸º [code]OK[/code])。"
#: doc/classes/Directory.xml
msgid ""
@@ -24677,7 +24703,7 @@ msgid ""
msgstr ""
"å°† [code]from[/code] 文件å¤åˆ¶åˆ° [code]to[/code] 目标ä½ç½®ã€‚ä¸¤ä¸ªå‚æ•°éƒ½åº”该是相"
"对或ç»å¯¹æ–‡ä»¶çš„è·¯å¾„ã€‚å¦‚æžœç›®æ ‡æ–‡ä»¶å­˜åœ¨ä¸”æ²¡æœ‰è®¿é—®ä¿æŠ¤ï¼Œåˆ™ä¼šè¢«è¦†ç›–ã€‚\n"
-"返回 [enum Error] 代ç å¸¸é‡ä¹‹ä¸€ï¼ˆæˆåŠŸæ—¶è¿”å›ž [code]OK[/code])。"
+"返回 [enum Error] 错误ç å¸¸é‡ï¼ˆæˆåŠŸæ—¶ä¸º [code]OK[/code])。"
#: doc/classes/Directory.xml
msgid ""
@@ -24685,8 +24711,8 @@ msgid ""
"call is a directory ([code].[/code] and [code]..[/code] are considered "
"directories)."
msgstr ""
-"返回上一次 [method get_next] 调用处ç†çš„当å‰é¡¹ç›®æ˜¯å¦ä¸ºç›®å½•([code].[/code]å’Œ"
-"[code].[/code]被认为是目录)。"
+"返回上一次 [method get_next] 调用处ç†çš„当å‰é¡¹ç›®æ˜¯å¦ä¸ºç›®å½•([code].[/code] å’Œ "
+"[code].[/code] 属于目录)。"
#: doc/classes/Directory.xml
msgid ""
@@ -24707,16 +24733,16 @@ msgid ""
"Returns the absolute path to the currently opened directory (e.g. "
"[code]res://folder[/code] or [code]C:\\tmp\\folder[/code])."
msgstr ""
-"è¿”å›žå½“å‰æ‰“开目录的ç»å¯¹è·¯å¾„(例如[code]res://文件夹[/code]或[code]C:\\tmp\\æ–‡"
-"件夹[/code])。"
+"è¿”å›žå½“å‰æ‰“开目录的ç»å¯¹è·¯å¾„(例如 [code]res://文件夹[/code] 或 [code]C:"
+"\\tmp\\文件夹[/code])。"
#: doc/classes/Directory.xml
msgid ""
"Returns the currently opened directory's drive index. See [method get_drive] "
"to convert returned index to the name of the drive."
msgstr ""
-"è¿”å›žå½“å‰æ‰“开的目录的驱动器索引。请å‚阅[method get_drive]将返回的索引转æ¢ä¸ºé©±"
-"动器的å称。"
+"è¿”å›žå½“å‰æ‰“开的目录的驱动器索引。请å‚阅 [method get_drive] 将返回的索引转æ¢ä¸º"
+"驱动器的å称。"
#: doc/classes/Directory.xml
msgid ""
@@ -24757,11 +24783,12 @@ msgid ""
"closes the stream automatically (i.e. [method list_dir_end] would not be "
"mandatory in such a case)."
msgstr ""
-"返回当å‰ç›®å½•中的下一个元素(文件或目录)(包括[code].[/code]å’Œ[code].[/"
-"code],除éž[code]skip_navigational[/code]被赋予[method list_dir_begin])。\n"
+"返回当å‰ç›®å½•中的下一个元素(文件或目录。除éžå°† [code]skip_navigational[/"
+"code] 赋予 [method list_dir_begin],å¦åˆ™åŒ…括 [code].[/code] å’Œ [code].[/"
+"code])。\n"
"返回的是文件或目录的åç§°ï¼ˆè€Œä¸æ˜¯å®ƒçš„完整路径)。一旦æµè¢«å®Œå…¨å¤„ç†ï¼Œè¯¥æ–¹æ³•返回"
-"一个空的String,并自动关闭æµï¼ˆå³åœ¨è¿™ç§æƒ…况下,[method list_dir_end]将䏿˜¯å¼ºåˆ¶"
-"性的)。"
+"一个空的 String,并自动关闭æµï¼ˆå³åœ¨è¿™ç§æƒ…况下,[method list_dir_end] 将䏿˜¯å¼º"
+"制性的)。"
#: doc/classes/Directory.xml
msgid ""
@@ -24808,7 +24835,7 @@ msgstr ""
"åˆ›å»ºä¸€ä¸ªç›®å½•ã€‚å‚æ•°å¯ä»¥æ˜¯å½“å‰ç›®å½•的相对路径,也å¯ä»¥æ˜¯ç»å¯¹è·¯å¾„。目标目录应该放"
"置在一个已ç»å­˜åœ¨çš„目录中(如果è¦é€’归创建完整的路径,请å‚阅 [method "
"make_dir_recursive])。\n"
-"返回 [enum Error] 代ç å¸¸é‡ä¹‹ä¸€ï¼ˆæˆåŠŸæ—¶è¿”å›ž [code]OK[/code])。"
+"返回 [enum Error] 错误ç å¸¸é‡ï¼ˆæˆåŠŸæ—¶ä¸º [code]OK[/code])。"
#: doc/classes/Directory.xml
msgid ""
@@ -24817,9 +24844,9 @@ msgid ""
"to the current directory, or an absolute path.\n"
"Returns one of the [enum Error] code constants ([code]OK[/code] on success)."
msgstr ""
-"通过递归调用 [method make_dir]方法,创建一个目标目录和其路径中所有必è¦çš„中间"
+"通过递归调用 [method make_dir] 方法,创建一个目标目录和其路径中所有必è¦çš„中间"
"ç›®å½•ã€‚å‚æ•°å¯ä»¥æ˜¯ç›¸å¯¹äºŽå½“å‰ç›®å½•的,也å¯ä»¥æ˜¯ç»å¯¹è·¯å¾„。\n"
-"返回 [enum Error] 代ç å¸¸é‡ä¹‹ä¸€ï¼ˆæˆåŠŸæ—¶è¿”å›ž [code]OK[/code])。"
+"返回 [enum Error] 错误ç å¸¸é‡ï¼ˆæˆåŠŸæ—¶ä¸º [code]OK[/code])。"
#: doc/classes/Directory.xml
msgid ""
@@ -24833,7 +24860,7 @@ msgstr ""
"folder[/code]),用户目录([code]user:// folder[/code])或以下ä½ç½®çš„ç»å¯¹è·¯å¾„"
"内:用户文件系统(例如 [code]/tmp/folder[/code] 或 [code]C:\\tmp\\folder[/"
"code])。\n"
-"返回 [enum Error] 代ç å¸¸é‡ä¹‹ä¸€ï¼ˆæˆåŠŸæ—¶è¿”å›ž [code]OK[/code])。"
+"返回 [enum Error] 错误ç å¸¸é‡ï¼ˆæˆåŠŸæ—¶ä¸º [code]OK[/code])。"
#: doc/classes/Directory.xml
msgid ""
@@ -24847,7 +24874,7 @@ msgstr ""
"æ°¸ä¹…åˆ é™¤ç›®æ ‡æ–‡ä»¶æˆ–ç©ºç›®å½•ã€‚å‚æ•°å¯ä»¥æ˜¯ç›¸å¯¹äºŽå½“å‰ç›®å½•的,也å¯ä»¥æ˜¯ç»å¯¹è·¯å¾„。如果"
"ç›®æ ‡ç›®å½•ä¸æ˜¯ç©ºçš„,æ“作将失败。\n"
"å¦‚æžœä½ ä¸æƒ³æ°¸ä¹…删除该文件/目录,请使用 [method OS.move_to_trash] 代替。\n"
-"返回 [enum Error] 代ç å¸¸é‡ä¹‹ä¸€ï¼ˆæˆåŠŸæ—¶è¿”å›ž [code]OK[/code])。"
+"返回 [enum Error] 错误ç å¸¸é‡ï¼ˆæˆåŠŸæ—¶ä¸º [code]OK[/code])。"
#: doc/classes/Directory.xml
msgid ""
@@ -24860,7 +24887,7 @@ msgstr ""
"å°† [code]from[/code] 文件或目录é‡å‘½å且移动到 [code]to[/code] ç›®æ ‡ã€‚ä¸¤ä¸ªå‚æ•°"
"都应该是文件或目录的相对路径或ç»å¯¹è·¯å¾„。如果目标文件或目录存在且ä¸å—访问ä¿"
"护,它将被覆盖。\n"
-"返回 [enum Error] 代ç å¸¸é‡ä¹‹ä¸€ï¼ŒæˆåŠŸæ—¶è¿”å›ž [code]OK[/code]。"
+"返回 [enum Error] 错误ç å¸¸é‡ï¼ˆæˆåŠŸæ—¶ä¸º [code]OK[/code])。"
#: doc/classes/DTLSServer.xml
msgid "Helper class to implement a DTLS server."
@@ -25127,7 +25154,7 @@ msgid ""
"This can be a negative number to make the distance between words smaller."
msgstr ""
"空格字符(在 [member extra_spacing_char] 之外)的é¢å¤–é—´è·ï¼Œå•ä½ä¸ºåƒç´ ã€‚\n"
-"è¿™å¯ä»¥æ˜¯è´Ÿæ•°ï¼Œä½¿å­—符之间的è·ç¦»æ›´å°ã€‚"
+"å¯ä»¥æ˜¯è´Ÿæ•°ï¼Œä¼šä½¿å­—符之间的è·ç¦»æ›´å°ã€‚"
#: doc/classes/DynamicFont.xml
msgid "Extra spacing at the top in pixels."
@@ -25166,9 +25193,9 @@ msgid ""
"control whose size changes over time, unless a pixel art aesthetic is "
"desired."
msgstr ""
-"如果为 [code]true[/code],将使用过滤功能。如果字体过度采样被ç¦ç”¨æˆ–无效,这将"
-"使字体在缩放时å˜å¾—模糊,而éžåƒç´ åŒ–ã€‚å½“åœ¨å°ºå¯¸éšæ—¶å˜åŒ–的控件中使用字体时,建议"
-"å¯ç”¨è¿™ä¸ªåŠŸèƒ½ï¼Œé™¤éžæ˜¯åƒç´ è®¾è®¡ã€‚"
+"如果为 [code]true[/code],将使用过滤功能。如果字体过采样被ç¦ç”¨æˆ–无法生效,字"
+"体在缩放时会å˜å¾—模糊,而éžåƒç´ åŒ–ã€‚åœ¨å°ºå¯¸ä¼šéšæ—¶å˜åŒ–的控件中使用字体时,建议å¯"
+"ç”¨è¿™ä¸ªåŠŸèƒ½ï¼Œé™¤éžæƒ³è¦åƒç´ ç”»é£Žæ ¼ã€‚"
#: doc/classes/DynamicFont.xml
msgid ""
@@ -25176,8 +25203,8 @@ msgid ""
"appearance when downscaling it if font oversampling is disabled or "
"ineffective."
msgstr ""
-"如果为 [code]true[/code],将使用 mipmap 多级æ¸è¿œçº¹ç†ã€‚在字体过度采样被ç¦ç”¨æˆ–"
-"æ— æ•ˆæ—¶ï¼Œå¯æ”¹å–„å­—ä½“ç¼©å°æ—¶çš„表现。"
+"如果为 [code]true[/code],将使用 mipmap 多级æ¸è¿œçº¹ç†ã€‚在字体过采样被ç¦ç”¨æˆ–æ— "
+"æ³•ç”Ÿæ•ˆæ—¶ï¼Œå¯æ”¹å–„å­—ä½“ç¼©å°æ—¶çš„表现。"
#: doc/classes/DynamicFont.xml
msgid "Spacing at the top."
@@ -25229,7 +25256,7 @@ msgid ""
"and viewport stretch mode."
msgstr ""
"如果设为比 [code]0.0[/code] 大的值,则会覆盖默认的字体过采样,忽略 [member "
-"SceneTree.use_font_oversampling] çš„å€¼å’Œè§†å£æ‹‰ä¼¸æ¨¡å¼ã€‚"
+"SceneTree.use_font_oversampling] 的值和视å£çš„æ‹‰ä¼¸æ¨¡å¼ã€‚"
#: doc/classes/DynamicFontData.xml
msgid "Disables font hinting (smoother but less crisp)."
@@ -26338,7 +26365,7 @@ msgstr ""
"新)加载场景,渲染网格预览,检查和编辑资æºå’Œå¯¹è±¡ã€‚它å…许自定义窗å£ï¼Œä¿å­˜å’Œ"
"ï¼ˆé‡æ–°ï¼‰åŠ è½½åœºæ™¯ï¼Œæ¸²æŸ“ç½‘æ ¼é¢„è§ˆï¼Œæ£€æŸ¥å’Œç¼–è¾‘èµ„æºå’Œå¯¹è±¡ï¼Œå¹¶æä¾›å¯¹ "
"[EditorSettings]ã€[EditorFileSystem]ã€[EditorResourcePreview]ã€"
-"[ScriptEditor]ã€ç¼–辑器视窗和场景信æ¯çš„访问。\n"
+"[ScriptEditor]ã€ç¼–辑器视å£å’Œåœºæ™¯ä¿¡æ¯çš„访问。\n"
"[b]注æ„:[/b]这个类ä¸åº”该直接实例化。相å,使用 [method EditorPlugin."
"get_editor_interface] 访问å•例。"
@@ -26414,7 +26441,7 @@ msgid ""
msgstr ""
"返回主编辑器控件。将其作为主å±å¹•的父控件。\n"
"[b]注æ„:[/b]è¿™å°†è¿”å›žåŒ…å«æ•´ä¸ªç¼–è¾‘å™¨çš„ä¸»ç¼–è¾‘å™¨æŽ§ä»¶ï¼Œè€Œä¸æ˜¯å…·ä½“çš„ 2D或 3D 视"
-"窗。\n"
+"å£ã€‚\n"
"[b]警告:[/b]删除和释放这个节点将使编辑器的一部分失去作用,并å¯èƒ½å¯¼è‡´å´©æºƒã€‚"
#: doc/classes/EditorInterface.xml
@@ -26734,7 +26761,7 @@ msgid ""
"custom gizmos to the 3D preview viewport for a [Spatial].\n"
"See [method add_inspector_plugin] for an example of how to register a plugin."
msgstr ""
-"注册一个新的 [EditorSpatialGizmoPlugin]。å°å·¥å…·æ’ä»¶å¯ä»¥åœ¨ 3D 预览视区中为 "
+"注册一个新的 [EditorSpatialGizmoPlugin]。å°å·¥å…·æ’ä»¶å¯ä»¥åœ¨ 3D 预览视å£ä¸­ä¸º "
"[Spatial] 添加自定义的å°å·¥å…·ã€‚\n"
"注册æ’ä»¶çš„ç¤ºä¾‹è§ [method add_inspector_plugin]。"
@@ -26830,8 +26857,8 @@ msgid ""
" return false\n"
"[/codeblock]"
msgstr ""
-"引擎会在 2D 编辑器的视区å‘生更新时调用。使用 [code]overlay[/code] [Control] "
-"进行绘制。你å¯ä»¥é€šè¿‡è°ƒç”¨ [method update_overlays] 手动更新视窗。\n"
+"引擎会在 2D 编辑器的视å£å‘生更新时调用。使用 [code]overlay[/code] [Control] "
+"进行绘制。你å¯ä»¥é€šè¿‡è°ƒç”¨ [method update_overlays] 手动更新视å£ã€‚\n"
"[codeblock]\n"
"func forward_canvas_draw_over_viewport(overlay):\n"
" # 在光标ä½ç½®ç”»ä¸€ä¸ªåœ†ã€‚\n"
@@ -26840,7 +26867,7 @@ msgstr ""
"\n"
"func forward_canvas_gui_input(event):\n"
" if event is InputEventMouseMotion:\n"
-" # 当光标被移动时,é‡ç»˜è§†çª—。\n"
+" # 当光标被移动时,é‡ç»˜è§†å£ã€‚\n"
" update_overlays()\n"
" return true\n"
" return false\n"
@@ -26883,7 +26910,7 @@ msgid ""
" return forward\n"
"[/codeblock]"
msgstr ""
-"当当å‰ç¼–辑场景中有一个根节点时被调用,[method handles]实现,在2D视窗中å‘生按"
+"当当å‰ç¼–辑场景中有一个根节点时被调用,[method handles]实现,在2D视å£ä¸­å‘生按"
"键输入[InputEvent]。拦截按键输入[InputEvent],如果[code]return true[/code] "
"[EditorPlugin]消耗键值[code]event[/code],å¦åˆ™å°†é”®å€¼[code]event[/code]转å‘ç»™"
"å…¶ä»–Editor类。例å­:\n"
@@ -26922,9 +26949,9 @@ msgid ""
" return false\n"
"[/codeblock]"
msgstr ""
-"引擎会在 3D 编辑器的视区å‘生更新时调用。使用 [code]overlay[/code] 控件 "
+"引擎会在 3D 编辑器的视å£å‘生更新时调用。使用 [code]overlay[/code] 控件 "
"[Control] 进行绘制。你å¯ä»¥é€šè¿‡è°ƒç”¨ [method update_overlays] 更新覆盖手动更新"
-"视窗。\n"
+"视å£ã€‚\n"
"[codeblock]\n"
"func forward_spatial_draw_over_viewport(overlay):\n"
" # 在光标ä½ç½®ç”»ä¸€ä¸ªåœ†ã€‚\n"
@@ -26932,7 +26959,7 @@ msgstr ""
"\n"
"func forward_spatial_gui_input(camera, event):\n"
" if event is InputEventMouseMotion:\n"
-" # 当光标被移动时,é‡ç»˜è§†çª—。\n"
+" # 当光标被移动时,é‡ç»˜è§†å£ã€‚\n"
" update_overlays()\n"
" return true\n"
" return false\n"
@@ -26975,7 +27002,7 @@ msgid ""
" return forward\n"
"[/codeblock]"
msgstr ""
-"在当å‰ç¼–辑的场景中存在根节点时调用,实现[method handles]并在3D视窗中å‘生按键"
+"在当å‰ç¼–辑的场景中存在根节点时调用,实现[method handles]并在3D视å£ä¸­å‘生按键"
"输入[InputEvent]。拦截按键输入[InputEvent],如果[code]return true[/code],则"
"[EditorPlugin]会使用键值[code]event[/code],å¦åˆ™å°†é”®å€¼[code]event[/code]转å‘"
"到其他Editor类。例å­ï¼š\n"
@@ -27245,7 +27272,7 @@ msgid ""
"once and it will work permanently for this plugin."
msgstr ""
"å¯ç”¨ 2D 编辑器的 [method forward_canvas_force_draw_over_viewport] å’Œ 3D 编辑"
-"器的 [method forward_spatial_force_draw_over_viewport] 在其视窗更新时的调用。"
+"器的 [method forward_spatial_force_draw_over_viewport] åœ¨å…¶è§†å£æ›´æ–°æ—¶çš„调用。"
"ä½ åªéœ€è¦è°ƒç”¨è¿™ä¸ªæ–¹æ³•一次,它就会对这个æ’件永久起作用。"
#: doc/classes/EditorPlugin.xml
@@ -27312,7 +27339,7 @@ msgid ""
"forward_spatial_draw_over_viewport] and [method "
"forward_spatial_force_draw_over_viewport] to be called."
msgstr ""
-"更新 2D 和 3D 编辑器视窗的覆盖层。导致方法 [method "
+"æ›´æ–° 2D å’Œ 3D 编辑器视å£çš„覆盖层。导致方法 [method "
"forward_canvas_draw_over_viewport]ã€[method "
"forward_canvas_force_draw_over_viewport]ã€[method "
"forward_spatial_draw_over_viewport] 和 [method "
@@ -27890,7 +27917,6 @@ msgid "Base script that can be used to add extension functions to the editor."
msgstr "å¯ç”¨äºŽä¸ºç¼–辑器添加扩展功能的基础脚本。"
#: doc/classes/EditorScript.xml
-#, fuzzy
msgid ""
"Scripts extending this class and implementing its [method _run] method can "
"be executed from the Script Editor's [b]File > Run[/b] menu option (or by "
@@ -27927,7 +27953,9 @@ msgstr ""
" print(\"Hello from the Godot Editor!\")\n"
"[/codeblock]\n"
"[b]注æ„:[/b]脚本在编辑器上下文中è¿è¡Œï¼Œè¿™æ„味ç€è¾“出在与编辑器一起å¯åŠ¨çš„æŽ§åˆ¶å°"
-"窗å£ï¼ˆstdoutï¼‰ï¼Œè€Œä¸æ˜¯é€šå¸¸çš„ Godot [b]输出[/b]颿¿ 。"
+"窗å£ï¼ˆstdoutï¼‰ï¼Œè€Œä¸æ˜¯é€šå¸¸çš„ Godot [b]输出[/b]颿¿ 。\n"
+"[b]注æ„:[/b]EditorScript 进行了引用计数,ä¸å†è¢«å¼•用时就会被销æ¯ã€‚在进行异步"
+"æ“作时,如果ä¸å†å­˜åœ¨å¯¹è¯¥è„šæœ¬çš„å¼•ç”¨ï¼Œå°±å¯èƒ½é€ æˆé”™è¯¯ã€‚"
#: doc/classes/EditorScript.xml
msgid "This method is executed by the Editor when [b]File > Run[/b] is used."
@@ -37769,6 +37797,7 @@ msgstr ""
"[b]注æ„:[/b]这个值在 Android å’Œ iOS 上å¯ç«‹å³è¢«ç¡¬ä»¶ä¼ æ„Ÿå™¨çš„值所覆盖。"
#: doc/classes/Input.xml
+#, fuzzy
msgid ""
"Sets a custom mouse cursor image, which is only visible inside the game "
"window. The hotspot can also be specified. Passing [code]null[/code] to the "
@@ -37780,7 +37809,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
"设置一个自定义鼠标光标图åƒï¼Œè¯¥å›¾åƒä»…当游æˆçª—å£å†…å¯è§ã€‚还å¯ä»¥æŒ‡å®šçƒ­ç‚¹ã€‚å°† "
"[code]null[/code] 传递给 image 傿•°å°†é‡ç½®ä¸ºç³»ç»Ÿå…‰æ ‡ã€‚有关详细信æ¯ï¼Œè¯·å‚阅 "
@@ -37801,7 +37834,7 @@ msgid ""
"[b]Note:[/b] This method generates an [InputEventMouseMotion] to update "
"cursor immediately."
msgstr ""
-"è®¾ç½®è¯¥è§†åŒºä¸­ä½¿ç”¨çš„é»˜è®¤å…‰æ ‡å½¢çŠ¶ï¼Œè€Œä¸æ˜¯ [constant CURSOR_ARROW]。\n"
+"设置该视å£ä¸­ä½¿ç”¨çš„é»˜è®¤å…‰æ ‡å½¢çŠ¶ï¼Œè€Œä¸æ˜¯ [constant CURSOR_ARROW]。\n"
"[b]注æ„:[/b]å¦‚æžœè¦æ›´æ”¹ [Control] 节点的默认光标形状,请改用 [member Control."
"mouse_default_cursor_shape]。\n"
"[b]注æ„:[/b]这个方法会生æˆä¸€ä¸ª [InputEventMouseMotion] ä»¥ç«‹å³æ›´æ–°å…‰æ ‡ã€‚"
@@ -41529,7 +41562,6 @@ msgstr ""
"如果为 [code]true[/code]ï¼Œåˆ™å…‰çº¿çš„æ•ˆæžœä¼šé€†è½¬ï¼Œä½¿åŒºåŸŸå˜æš—并投射明亮的阴影。"
#: doc/classes/Light.xml
-#, fuzzy
msgid ""
"The size of the light in Godot units. Only considered in baked lightmaps and "
"only if [member light_bake_mode] is set to [constant BAKE_ALL]. Increasing "
@@ -41540,7 +41572,9 @@ msgid ""
msgstr ""
"ç¯å…‰çš„大å°ï¼Œä½¿ç”¨ Godot çš„å•ä½ã€‚åªåœ¨çƒ˜ç„™çš„光照贴图中考虑,并且åªåœ¨ [member "
"light_bake_mode] 被设置为 [constant BAKE_ALL] 时考虑。增加这个值会使阴影看起"
-"æ¥æ›´æ¨¡ç³Šã€‚è¿™å¯ä»¥åœ¨ä¸€å®šç¨‹åº¦ä¸Šç”¨äºŽæ¨¡æ‹ŸåŒºåŸŸç¯å…‰ã€‚"
+"æ¥æ›´æ¨¡ç³Šã€‚è¿™å¯ä»¥åœ¨ä¸€å®šç¨‹åº¦ä¸Šç”¨äºŽæ¨¡æ‹ŸåŒºåŸŸç¯å…‰ã€‚\n"
+"[b]注æ„:[/b][member light_size] ä¸å— [member Spatial.scale] 的影å“(无论是该"
+"ç¯å…‰çš„缩放还是其父节点的缩放)。"
#: doc/classes/Light.xml
msgid ""
@@ -44044,7 +44078,7 @@ msgid ""
"MeshInstance2D[/b] at the top of the 2D editor viewport."
msgstr ""
"用于在 2D 中显示 [Mesh] 的节点。å¯ä»¥é€šè¿‡ç¼–辑器工具æ ä¸Šçš„工具从现有的 "
-"[Sprite] 构建。选中 [Sprite] 节点,然åŽåœ¨ 2D 编辑器视区顶部选择[b]ç²¾çµ > 转æ¢"
+"[Sprite] 构建。选中 [Sprite] 节点,然åŽåœ¨ 2D 编辑器视å£é¡¶éƒ¨é€‰æ‹©[b]ç²¾çµ > 转æ¢"
"为 MeshInstance2D[/b]。"
#: doc/classes/MeshInstance2D.xml
@@ -45547,7 +45581,6 @@ msgid "3D agent used in navigation for collision avoidance."
msgstr "在导航中用于防撞的 3D 代ç†ã€‚"
#: doc/classes/NavigationAgent.xml
-#, fuzzy
msgid ""
"3D agent that is used in navigation to reach a location while avoiding "
"static and dynamic obstacles. The dynamic obstacles are avoided using RVO "
@@ -45574,7 +45607,9 @@ msgstr ""
"[NavigationAgent] 是物ç†å®‰å…¨çš„。\n"
"[b]注æ„:[/b]使用 [method set_target_location] 之åŽï¼Œå¿…须在æ¯ä¸ªç‰©ç†å¸§ä½¿ç”¨ä¸€"
"次 [method get_next_location] å‡½æ•°æ¥æ›´æ–° NavigationAgent 的内部路径逻辑。这个"
-"函数返回的å‘é‡ä½ç½®åº”该用作该代ç†çš„父节点的下一次移动ä½ç½®ã€‚"
+"函数返回的å‘é‡ä½ç½®åº”该用作该代ç†çš„父节点的下一次移动ä½ç½®ã€‚\n"
+"[b]注æ„:[/b]默认情况下,é¿éšœçš„大强度计算是在å•ç‹¬çš„çº¿ç¨‹ä¸­è¿›è¡Œçš„ã€‚åœ¨ä¸æ”¯æŒå¤šçº¿"
+"程的 HTML5 导出中,则会在主线程中进行,å¯èƒ½å¯¼è‡´æ€§èƒ½é—®é¢˜ã€‚"
#: doc/classes/NavigationAgent.xml doc/classes/NavigationAgent2D.xml
msgid ""
@@ -45867,7 +45902,6 @@ msgid "2D agent used in navigation for collision avoidance."
msgstr "在导航中用于防撞的 2D 代ç†ã€‚"
#: doc/classes/NavigationAgent2D.xml
-#, fuzzy
msgid ""
"2D agent that is used in navigation to reach a location while avoiding "
"static and dynamic obstacles. The dynamic obstacles are avoided using RVO "
@@ -45894,7 +45928,9 @@ msgstr ""
"[NavigationAgent2D] 是物ç†å®‰å…¨çš„。\n"
"[b]注æ„:[/b]使用 [method set_target_location] 之åŽï¼Œå¿…须在æ¯ä¸ªç‰©ç†å¸§ä½¿ç”¨ä¸€"
"次 [method get_next_location] å‡½æ•°æ¥æ›´æ–° NavigationAgent 的内部路径逻辑。这个"
-"函数返回的å‘é‡ä½ç½®åº”该用作该代ç†çš„父节点的下一次移动ä½ç½®ã€‚"
+"函数返回的å‘é‡ä½ç½®åº”该用作该代ç†çš„父节点的下一次移动ä½ç½®ã€‚\n"
+"[b]注æ„:[/b]默认情况下,é¿éšœçš„大强度计算是在å•ç‹¬çš„çº¿ç¨‹ä¸­è¿›è¡Œçš„ã€‚åœ¨ä¸æ”¯æŒå¤šçº¿"
+"程的 HTML5 导出中,则会在主线程中进行,å¯èƒ½å¯¼è‡´æ€§èƒ½é—®é¢˜ã€‚"
#: doc/classes/NavigationAgent2D.xml
msgid ""
@@ -46763,7 +46799,6 @@ msgid "Server interface for low-level 3D navigation access."
msgstr "访问底层 3D 导航的æœåŠ¡å™¨æŽ¥å£ã€‚"
#: doc/classes/NavigationServer.xml
-#, fuzzy
msgid ""
"NavigationServer is the server responsible for all 3D navigation. It handles "
"several objects, namely maps, regions and agents.\n"
@@ -46805,6 +46840,8 @@ msgstr ""
"的速度触å‘回调。\n"
"[b]注æ„:[/b]防撞系统会忽略地区。直接使用修正åŽçš„速度å¯èƒ½ä¼šå°†ä»£ç†æŽ¨åˆ°å¯å¯¼èˆªåŒº"
"åŸŸä¹‹å¤–ã€‚è¿™æ˜¯é˜²æ’žç³»ç»Ÿçš„ç¼ºé™·ï¼Œæ›´å¤æ‚的情况å¯èƒ½éœ€è¦ç”¨åˆ°ç‰©ç†å¼•擎。\n"
+"[b]注æ„:[/b]默认情况下,é¿éšœçš„大强度计算是在å•ç‹¬çš„çº¿ç¨‹ä¸­è¿›è¡Œçš„ã€‚åœ¨ä¸æ”¯æŒå¤šçº¿"
+"程的 HTML5 导出中,则会在主线程中进行,å¯èƒ½å¯¼è‡´æ€§èƒ½é—®é¢˜ã€‚\n"
"æœåŠ¡å™¨ä¼šè®°å½•æ‰€æœ‰çš„è°ƒç”¨ï¼Œåœ¨åŒæ­¥é˜¶æ®µç»Ÿä¸€æ‰§è¡Œã€‚è¿™æ„味ç€ä½ å¯ä»¥æ”¾å¿ƒå¤§èƒ†åœ°ä»Žä»»ä½•线"
"程中请求对地图进行任何修改。"
@@ -50536,9 +50573,9 @@ msgstr ""
"[OccluderShape] 是 [Occluder] 节点所使用的资æºï¼Œç”¨äºŽå‡ ä½•鮿Œ¡å‰”除。\n"
"该多边形必须是凸多边形。多边形顶点的创建与删除å¯ä»¥åœ¨ç¼–辑器的检查器中进行,也"
"å¯ä»¥é€šè¿‡è°ƒç”¨ [code]set_polygon_points[/code] 实现。æ¯ä¸€æ¡è¾¹çš„顶点都å¯ä»¥é€šè¿‡åœ¨"
-"编辑器视窗中拖拽手柄设置。\n"
+"编辑器视å£ä¸­æ‹–拽手柄设置。\n"
"å¦å¤–,æ¯ä¸€ä¸ªå¤šè¾¹å½¢é®æŒ¡å™¨éƒ½å¯ä»¥æ”¯æŒå•个空洞。如果你在编辑器的检查器中为空洞添"
-"加至少三个顶点,就å¯ä»¥åœ¨ç¼–è¾‘å™¨è§†çª—ä¸­æ‹–æ‹½ç©ºæ´žè¾¹ç¼˜é¡¶ç‚¹çš„å¥æŸ„。\n"
+"加至少三个顶点,就å¯ä»¥åœ¨ç¼–辑器视å£ä¸­æ‹–æ‹½ç©ºæ´žè¾¹ç¼˜é¡¶ç‚¹çš„å¥æŸ„。\n"
"一般而言,多边形以åŠç©ºæ´žçš„边数越少,è¿è¡Œæ—¶ç³»ç»Ÿçš„处ç†é€Ÿåº¦å°±è¶Šå¿«ï¼Œæ‰€ä»¥åœ¨å¤§å¤šæ•°"
"情况下你都åªä¼šè®¾ç½® 4 个顶点。"
@@ -50632,7 +50669,6 @@ msgstr ""
"光的衰å‡ï¼ˆä¸‹é™ï¼‰æ›²çº¿ã€‚在[b]检查器[/b]中,通过å³é”®ç‚¹å‡»æ›²çº¿ï¼Œå¯ä»¥èŽ·å¾—è®¸å¤šé¢„è®¾ã€‚"
#: doc/classes/OmniLight.xml
-#, fuzzy
msgid ""
"The light's radius. Note that the effectively lit area may appear to be "
"smaller depending on the [member omni_attenuation] in use. No matter the "
@@ -50641,9 +50677,11 @@ msgid ""
"[b]Note:[/b] [member omni_range] is not affected by [member Spatial.scale] "
"(the light's scale or its parent's scale)."
msgstr ""
-"光的åŠå¾„。请注æ„,有效的照明区域å¯èƒ½çœ‹èµ·æ¥æ›´å°ï¼Œè¿™å–决于使用的 [member "
-"omni_attenuation]ã€‚æ— è®ºä½¿ç”¨ä½•ç§ [member omni_attenuation],光线都ä¸ä¼šåˆ°è¾¾è¿™ä¸ª"
-"åŠå¾„以外的地方。"
+"该ç¯å…‰çš„åŠå¾„。请注æ„,根æ®ä½¿ç”¨çš„ [member omni_attenuation],有效照明区域å¯èƒ½"
+"çœ‹èµ·æ¥æ›´å°ã€‚无论使用 [member omni_attenuation] 为何值,光都ä¸ä¼šåˆ°è¾¾æ­¤èŒƒå›´ä¹‹å¤–"
+"的任何东西。\n"
+"[b]注æ„:[/b][member omni_range] ä¸å— [member Spatial.scale] 的影å“(无论是该"
+"ç¯å…‰çš„缩放还是其父节点的缩放)。"
#: doc/classes/OmniLight.xml
msgid "See [enum ShadowDetail]."
@@ -51297,7 +51335,6 @@ msgid "Returns the audio driver name for the given index."
msgstr "返回给定索引的音频驱动程åºå称。"
#: doc/classes/OS.xml
-#, fuzzy
msgid ""
"Returns the [i]global[/i] cache data directory according to the operating "
"system's standards. On Linux, this path can be overridden by setting the "
@@ -51308,7 +51345,7 @@ msgid ""
"Not to be confused with [method get_user_data_dir], which returns the "
"[i]project-specific[/i] user data path."
msgstr ""
-"æ ¹æ®æ“作系统的标准返回[i]全局[/i]缓存数æ®ç›®å½•。在桌é¢å¹³å°ä¸Šï¼Œå¯ä»¥é€šè¿‡åœ¨å¯åЍ项"
+"æ ¹æ®æ“作系统的标准返回[i]全局[/i]缓存数æ®ç›®å½•。在 Linux 上,å¯ä»¥é€šè¿‡åœ¨å¯åЍ项"
"目之å‰è®¾ç½® [code]XDG_CACHE_HOME[/code] 环境å˜é‡æ¥è¦†ç›–此路径。有关更多信æ¯ï¼Œè¯·"
"å‚阅文档中的 [url=$DOCS_URL/tutorials/io/data_paths.html]《Godot 项目中的文件"
"路径》[/url]。å¦è¯·å‚阅 [method get_config_dir] å’Œ [method get_data_dir]。\n"
@@ -51362,7 +51399,6 @@ msgstr ""
"[/codeblock]"
#: doc/classes/OS.xml
-#, fuzzy
msgid ""
"Returns the [i]global[/i] user configuration directory according to the "
"operating system's standards. On Linux, this path can be overridden by "
@@ -51373,7 +51409,7 @@ msgid ""
"Not to be confused with [method get_user_data_dir], which returns the "
"[i]project-specific[/i] user data path."
msgstr ""
-"æ ¹æ®æ“作系统的标准,返回[i]全局[/i]用户é…置目录。在桌é¢å¹³å°ä¸Šï¼Œè¿™ä¸ªè·¯å¾„å¯ä»¥åœ¨"
+"æ ¹æ®æ“作系统的标准,返回[i]全局[/i]用户é…置目录。在 Linux 上,这个路径å¯ä»¥åœ¨"
"å¯åŠ¨é¡¹ç›®å‰é€šè¿‡è®¾ç½®[code]XDG_CONFIG_HOME[/code]环境å˜é‡æ¥è¦†ç›–。更多信æ¯è¯·å‚è§"
"文档中[url=$DOCS_URL/tutorials/io/data_paths.html]《Godot 项目中的文件路径》"
"[/url]。å¦è¯·å‚阅 [method get_cache_dir] å’Œ [method get_data_dir]。\n"
@@ -51398,7 +51434,6 @@ msgid ""
msgstr "返回当å‰ä½¿ç”¨çš„视频驱动程åºï¼Œä½¿ç”¨[enum VideoDriver]中的一个值。"
#: doc/classes/OS.xml
-#, fuzzy
msgid ""
"Returns the [i]global[/i] user data directory according to the operating "
"system's standards. On Linux, this path can be overridden by setting the "
@@ -51409,7 +51444,7 @@ msgid ""
"Not to be confused with [method get_user_data_dir], which returns the "
"[i]project-specific[/i] user data path."
msgstr ""
-"æ ¹æ®æ“作系统的标准,返回[i]全局[/i]用户数æ®ç›®å½•。在桌é¢å¹³å°ä¸Šï¼Œè¿™ä¸ªè·¯å¾„å¯ä»¥åœ¨"
+"æ ¹æ®æ“作系统的标准,返回[i]全局[/i]用户数æ®ç›®å½•。在 Linux 上,这个路径å¯ä»¥åœ¨"
"å¯åŠ¨é¡¹ç›®å‰é€šè¿‡è®¾ç½®[code]XDG_DATA_HOME[/code]环境å˜é‡æ¥è¦†ç›–。更多信æ¯è¯·å‚è§æ–‡"
"档中[url=$DOCS_URL/tutorials/io/data_paths.html]《Godot 项目中的文件路径》[/"
"url]。å¦è¯·å‚阅 [method get_cache_dir] å’Œ [method get_config_dir]。\n"
@@ -53698,14 +53733,14 @@ msgstr ""
"使用 [code]process_material[/code] 属性添加 [ParticlesMaterial] æ¥é…置粒å­å¤–"
"观和行为。或者,您å¯ä»¥æ·»åŠ ä¸€ä¸ªå°†åº”ç”¨äºŽæ‰€æœ‰ç²’å­çš„ [ShaderMaterial]。\n"
"[b]注æ„:[/b][Particles] 仅在使用 GLES3 渲染器时有效。如果使用 GLES2 渲染器,"
-"请改用 [CPUParticles]。您å¯ä»¥é€šè¿‡é€‰æ‹©èŠ‚ç‚¹ï¼Œå•击 3D 编辑器视窗顶部的"
+"请改用 [CPUParticles]。您å¯ä»¥é€šè¿‡é€‰æ‹©èŠ‚ç‚¹ï¼Œå•击 3D 编辑器视å£é¡¶éƒ¨çš„"
"[b]Particles[/b]èœå•,然åŽé€‰æ‹©[b]转æ¢ä¸º CPUParticles[/b],将 [Particles] 转æ¢"
"为 [CPUParticles]。\n"
"[b]注æ„:[/b]在 macOS 上,渲染 [Particles] 比 [CPUParticles] è¦æ…¢ä¸Šå¾ˆå¤šï¼Œå› ä¸º"
"å˜æ¢å馈是在 CPU ä¸Šå®žçŽ°çš„ï¼Œè€Œä¸æ˜¯ GPU。以 macOS 为目标时,请考虑使用 "
"[CPUParticles]。\n"
"[b]注æ„:[/b]在处ç†ç²’å­èŠ‚ç‚¹åŽï¼Œè®°å¾—é€šè¿‡é€‰æ‹©å®ƒæ¥æ›´æ–°å…¶ [member "
-"visibility_aabb],å•击 3D 编辑器视窗顶部的[b]Particles[/b]èœå•,然åŽé€‰æ‹©[b]生"
+"visibility_aabb],å•击 3D 编辑器视å£é¡¶éƒ¨çš„[b]Particles[/b]èœå•,然åŽé€‰æ‹©[b]生"
"æˆå¯è§ AABB[/b]。å¦åˆ™ï¼Œç²’å­å¯èƒ½ä¼šç”±äºŽç›¸æœºä½ç½®å’Œè§’度的改å˜çªç„¶æ¶ˆå¤±ã€‚"
#: doc/classes/Particles.xml
@@ -53860,15 +53895,14 @@ msgid "Particle systems (2D)"
msgstr "ç²’å­ç³»ç»Ÿï¼ˆ2D)"
#: doc/classes/Particles2D.xml
-#, fuzzy
msgid "2D Particles Demo"
-msgstr "2D å¹³å°è·³è·ƒæ¼”示"
+msgstr "2D ç²’å­æ¼”示"
#: doc/classes/Particles2D.xml
msgid ""
"2D Dodge The Creeps Demo (uses GPUParticles2D for the trail behind the "
"player)"
-msgstr ""
+msgstr "2D Dodge The Creeps 演示(玩家身åŽçš„æ‹–尾使用的是 GPUParticles2D)"
#: doc/classes/Particles2D.xml
msgid "Returns a rectangle containing the positions of all existing particles."
@@ -58119,7 +58153,7 @@ msgid ""
msgstr ""
"Popup 是基本的 [Control]ï¼Œç”¨äºŽæ˜¾ç¤ºå¯¹è¯æ¡†å’Œå¼¹å‡ºçª—å£ã€‚默认情况下,它是一个å­çª—"
"å£å’Œæ¨¡æ€ï¼Œå‚阅 [Control],并具有自定义弹出行为的辅助程åºã€‚所有弹出方法都确ä¿"
-"在视窗中正确放置。"
+"在视å£ä¸­æ­£ç¡®æ”¾ç½®ã€‚"
#: doc/classes/Popup.xml
msgid "Popup (show the control in modal form)."
@@ -60422,7 +60456,7 @@ msgid ""
"default window size. Stretch mode settings also use this as a reference when "
"enabled."
msgstr ""
-"设置游æˆçš„主视窗高度。在桌é¢å¹³å°ä¸Šï¼Œè¿™æ˜¯é»˜è®¤çš„窗å£å¤§å°ã€‚当å¯ç”¨æ‹‰ä¼¸æ¨¡å¼è®¾ç½®"
+"设置游æˆçš„主视å£é«˜åº¦ã€‚在桌é¢å¹³å°ä¸Šï¼Œè¿™æ˜¯é»˜è®¤çš„窗å£å¤§å°ã€‚当å¯ç”¨æ‹‰ä¼¸æ¨¡å¼è®¾ç½®"
"æ—¶ï¼Œä¹Ÿä½¿ç”¨æ­¤å‚æ•°ä½œä¸ºå‚考。"
#: doc/classes/ProjectSettings.xml
@@ -60451,7 +60485,7 @@ msgid ""
"default window size. Stretch mode settings also use this as a reference when "
"enabled."
msgstr ""
-"设置游æˆçš„主视窗宽度。在桌é¢å¹³å°ä¸Šï¼Œè¿™æ˜¯é»˜è®¤çš„窗å£å¤§å°ã€‚当å¯ç”¨æ‹‰ä¼¸æ¨¡å¼è®¾ç½®"
+"设置游æˆçš„主视å£å®½åº¦ã€‚在桌é¢å¹³å°ä¸Šï¼Œè¿™æ˜¯é»˜è®¤çš„窗å£å¤§å°ã€‚当å¯ç”¨æ‹‰ä¼¸æ¨¡å¼è®¾ç½®"
"æ—¶ï¼Œä¹Ÿä½¿ç”¨æ­¤å‚æ•°ä½œä¸ºå‚考。"
#: doc/classes/ProjectSettings.xml
@@ -60585,7 +60619,7 @@ msgid ""
"and is the recommended setting."
msgstr ""
"如果已å¯ç”¨ï¼Œåˆ™ä¼šåœ¨å°† [member Viewport.gui_disable_input] 设为 [code]false[/"
-"code] ç¦ç”¨è§†åŒºçš„ GUI 输入时,将当å‰çš„鼠标悬åœåŠèšç„¦ä¸¢å¼ƒã€‚\n"
+"code] ç¦ç”¨è§†å£çš„ GUI 输入时,将当å‰çš„鼠标悬åœåŠèšç„¦ä¸¢å¼ƒã€‚\n"
"è¿™æ ·çš„è¡Œä¸ºèƒ½å¤Ÿå¸®åŠ©ä¿æŒ GUI 状æ€çš„å¥å£®ï¼Œè¾“å…¥æ¢å¤æ—¶ï¼Œæ— è®ºå½“æ—¶å‘生了什么都ä¸ä¼šäº§"
"生æ„外的结果。\n"
"如果已ç¦ç”¨ï¼Œä¼šä½¿ç”¨æ—§æœ‰è¡Œä¸ºï¼Œé™¤äº†ç¦ç”¨ GUI 输入本身ä¸ä¼šè¿›è¡Œé¢å¤–æ“作。\n"
@@ -60596,8 +60630,8 @@ msgid ""
"If [code]true[/code], swaps OK and Cancel buttons in dialogs on Windows and "
"UWP to follow interface conventions."
msgstr ""
-"如果为 [code]true[/code],在Windowså’ŒUWPçš„å¯¹è¯æ¡†ä¸­äº¤æ¢ç¡®å®šå’Œå–消按钮,以éµå¾ª"
-"ç•Œé¢æƒ¯ä¾‹ã€‚"
+"如果为 [code]true[/code],在 Windows å’Œ UWP çš„å¯¹è¯æ¡†ä¸­äº¤æ¢ç¡®å®šå’Œå–消按钮,以"
+"éµå¾ªç•Œé¢æƒ¯ä¾‹ã€‚"
#: doc/classes/ProjectSettings.xml
msgid ""
@@ -60639,9 +60673,9 @@ msgid ""
"necessary for the internal logic of several [Control]s. The events assigned "
"to the action can however be modified."
msgstr ""
-"默认用于确认焦点按钮ã€èœå•或列表项,或验è¯è¾“入的[InputEventAction]。\n"
-"[b]注æ„:[/b]默认的[code]ui_*[/code]动作ä¸èƒ½è¢«åˆ é™¤ï¼Œå› ä¸ºå®ƒä»¬æ˜¯å‡ ä¸ª[Control]çš„"
-"内部逻辑所必需的。但是,å¯ä»¥ä¿®æ”¹åˆ†é…给该æ“作的事件。"
+"默认用于确认焦点按钮ã€èœå•或列表项,或验è¯è¾“入的 [InputEventAction]。\n"
+"[b]注æ„:[/b]默认的 [code]ui_*[/code] 动作是部分 [Control] 的内部逻辑所必需"
+"的,无法删除。但是å¯ä»¥ä¿®æ”¹åˆ†é…给该动作的事件。"
#: doc/classes/ProjectSettings.xml
msgid ""
@@ -60650,9 +60684,9 @@ msgid ""
"necessary for the internal logic of several [Control]s. The events assigned "
"to the action can however be modified."
msgstr ""
-"é»˜è®¤æ”¾å¼ƒä¸€ä¸ªæ¨¡æ€æˆ–挂起的输入的[InputEventAction]。\n"
-"[b]注æ„:[/b]默认的[code]ui_*[/code]动作ä¸èƒ½è¢«åˆ é™¤ï¼Œå› ä¸ºå®ƒä»¬æ˜¯å‡ ä¸ª[Control]çš„"
-"内部逻辑所必需的。但是,å¯ä»¥ä¿®æ”¹åˆ†é…给该æ“作的事件。"
+"é»˜è®¤ç”¨äºŽæ”¾å¼ƒæ¨¡æ€æˆ–挂起的输入的 [InputEventAction]。\n"
+"[b]注æ„:[/b]默认的 [code]ui_*[/code] 动作是部分 [Control] 的内部逻辑所必需"
+"的,无法删除。但是å¯ä»¥ä¿®æ”¹åˆ†é…给该动作的事件。"
#: doc/classes/ProjectSettings.xml
msgid ""
@@ -60661,9 +60695,9 @@ msgid ""
"necessary for the internal logic of several [Control]s. The events assigned "
"to the action can however be modified."
msgstr ""
-"默认在UI中å‘下移动的[InputEventAction]。\n"
-"[b]注æ„:[/b]默认的[code]ui_*[/code]动作ä¸èƒ½è¢«åˆ é™¤ï¼Œå› ä¸ºå®ƒä»¬æ˜¯å‡ ä¸ª[Control]çš„"
-"内部逻辑所必需的。但是,å¯ä»¥ä¿®æ”¹åˆ†é…给该æ“作的事件。"
+"默认在 UI 中å‘下移动的 [InputEventAction]。\n"
+"[b]注æ„:[/b]默认的 [code]ui_*[/code] 动作是部分 [Control] 的内部逻辑所必需"
+"的,无法删除。但是å¯ä»¥ä¿®æ”¹åˆ†é…给该动作的事件。"
#: doc/classes/ProjectSettings.xml
msgid ""
@@ -60676,8 +60710,8 @@ msgid ""
msgstr ""
"默认[InputEventAction]去[Control]的结æŸä½ç½®(例如[ItemList]或[Tree]中的最åŽä¸€"
"项),匹é…典型桌é¢UI系统中[constant KEY_END]的行为。\n"
-"[b]注æ„:[/b]默认的[code]ui_*[/code]动作ä¸èƒ½è¢«åˆ é™¤ï¼Œå› ä¸ºå®ƒä»¬æ˜¯å‡ ä¸ª[Control]çš„"
-"内部逻辑所必需的。但是,å¯ä»¥ä¿®æ”¹åˆ†é…给该æ“作的事件。"
+"[b]注æ„:[/b]默认的 [code]ui_*[/code] 动作是部分 [Control] 的内部逻辑所必需"
+"的,无法删除。但是å¯ä»¥ä¿®æ”¹åˆ†é…给该动作的事件。"
#: doc/classes/ProjectSettings.xml
msgid ""
@@ -60689,8 +60723,8 @@ msgid ""
msgstr ""
"默认èšç„¦åœºæ™¯ä¸­çš„下一个[Control]çš„[InputEventAction]。焦点行为å¯ä»¥é€šè¿‡[member "
"Control.focus_next]é…置。\n"
-"[b]注æ„:[/b]默认的[code]ui_*[/code]动作ä¸èƒ½è¢«åˆ é™¤ï¼Œå› ä¸ºå®ƒä»¬æ˜¯å‡ ä¸ª[Control]çš„"
-"内部逻辑所必需的。但是,å¯ä»¥ä¿®æ”¹åˆ†é…给该æ“作的事件。"
+"[b]注æ„:[/b]默认的 [code]ui_*[/code] 动作是部分 [Control] 的内部逻辑所必需"
+"的,无法删除。但是å¯ä»¥ä¿®æ”¹åˆ†é…给该动作的事件。"
#: doc/classes/ProjectSettings.xml
msgid ""
@@ -60702,8 +60736,8 @@ msgid ""
msgstr ""
"默认èšç„¦åœºæ™¯ä¸­çš„å‰ä¸€ä¸ª[Control]çš„[InputEventAction]。焦点行为å¯ä»¥é€šè¿‡[member "
"Control.focus_previous]é…置。\n"
-"[b]注æ„:[/b]默认的[code]ui_*[/code]动作ä¸èƒ½è¢«åˆ é™¤ï¼Œå› ä¸ºå®ƒä»¬æ˜¯å‡ ä¸ª[Control]çš„"
-"内部逻辑所必需的。但是,å¯ä»¥ä¿®æ”¹åˆ†é…给该æ“作的事件。"
+"[b]注æ„:[/b]默认的 [code]ui_*[/code] 动作是部分 [Control] 的内部逻辑所必需"
+"的,无法删除。但是å¯ä»¥ä¿®æ”¹åˆ†é…给该动作的事件。"
#: doc/classes/ProjectSettings.xml
msgid ""
@@ -60716,8 +60750,8 @@ msgid ""
msgstr ""
"默认的将进入[Control]的起始ä½ç½®ï¼ˆä¾‹å¦‚[ItemList]或[Tree]中的第一个项目)时的"
"[InputEventAction],与典型的桌é¢UI系统中[constant KEY_HOME]的行为相匹é…。\n"
-"[b]注æ„:[/b]默认的[code]ui_*[/code]动作ä¸èƒ½è¢«åˆ é™¤ï¼Œå› ä¸ºå®ƒä»¬å¯¹äºŽå‡ ä¸ª[Control]"
-"的内部逻辑是必è¦çš„。然而,分é…给动作的事件å¯ä»¥è¢«ä¿®æ”¹ã€‚"
+"[b]注æ„:[/b]默认的 [code]ui_*[/code] 动作ä¸èƒ½è¢«åˆ é™¤ï¼Œå› ä¸ºå®ƒä»¬æ˜¯å‡ ä¸ª "
+"[Control] 的内部逻辑所必需的。然而,分é…给动作的事件å¯ä»¥è¢«ä¿®æ”¹ã€‚"
#: doc/classes/ProjectSettings.xml
msgid ""
@@ -60726,9 +60760,9 @@ msgid ""
"necessary for the internal logic of several [Control]s. The events assigned "
"to the action can however be modified."
msgstr ""
-"默认在UI中å‘左移动的[InputEventAction]。\n"
-"[b]注æ„:[/b]默认的[code]ui_*[/code]动作ä¸èƒ½è¢«åˆ é™¤ï¼Œå› ä¸ºå®ƒä»¬æ˜¯å‡ ä¸ª[Control]çš„"
-"内部逻辑所必需的。但是,å¯ä»¥ä¿®æ”¹åˆ†é…给该æ“作的事件。"
+"默认在 UI 中å‘左移动的[InputEventAction]。\n"
+"[b]注æ„:[/b]默认的 [code]ui_*[/code] 动作是部分 [Control] 的内部逻辑所必需"
+"的,无法删除。但是å¯ä»¥ä¿®æ”¹åˆ†é…给该动作的事件。"
#: doc/classes/ProjectSettings.xml
msgid ""
@@ -60742,8 +60776,8 @@ msgstr ""
"默认的在 [Control](例如 [ItemList] 或 [Tree])中å‘下翻页的 "
"[InputEventAction]ï¼Œä¸Žå…¸åž‹æ¡Œé¢ UI 系统中 [constant KEY_PAGEDOWN] 的行为相匹"
"é…。\n"
-"[b]注æ„:[/b]默认的 [code]ui_*[/code] 动作ä¸èƒ½è¢«åˆ é™¤ï¼Œå› ä¸ºå®ƒä»¬æ˜¯å‡ ä¸ª "
-"[Control] 的内部逻辑所必需的。但是,å¯ä»¥ä¿®æ”¹åˆ†é…给该æ“作的事件。"
+"[b]注æ„:[/b]默认的 [code]ui_*[/code] 动作是部分 [Control] 的内部逻辑所必需"
+"的,无法删除。但是å¯ä»¥ä¿®æ”¹åˆ†é…给该动作的事件。"
#: doc/classes/ProjectSettings.xml
msgid ""
@@ -60757,8 +60791,8 @@ msgstr ""
"默认的在 [Control](例如 [ItemList] 或 [Tree])中å‘上翻页的 "
"[InputEventAction]ï¼Œä¸Žå…¸åž‹æ¡Œé¢ UI 系统中 [constant KEY_PAGEUP] 的行为相匹"
"é…。\n"
-"[b]注æ„:[/b]默认的 [code]ui_*[/code] 动作ä¸èƒ½è¢«åˆ é™¤ï¼Œå› ä¸ºå®ƒä»¬æ˜¯å‡ ä¸ª "
-"[Control] 的内部逻辑所必需的。但是,å¯ä»¥ä¿®æ”¹åˆ†é…给该æ“作的事件。"
+"[b]注æ„:[/b]默认的 [code]ui_*[/code] 动作是部分 [Control] 的内部逻辑所必需"
+"的,无法删除。但是å¯ä»¥ä¿®æ”¹åˆ†é…给该动作的事件。"
#: doc/classes/ProjectSettings.xml
msgid ""
@@ -60767,9 +60801,9 @@ msgid ""
"necessary for the internal logic of several [Control]s. The events assigned "
"to the action can however be modified."
msgstr ""
-"默认在UI中å³ç§»çš„[InputEventAction]。\n"
-"[b]注æ„:[/b]默认的[code]ui_*[/code]动作ä¸èƒ½è¢«åˆ é™¤ï¼Œå› ä¸ºå®ƒä»¬æ˜¯å‡ ä¸ª[Control]çš„"
-"内部逻辑所必需的。但是,å¯ä»¥ä¿®æ”¹åˆ†é…给该æ“作的事件。"
+"默认在 UI 中å³ç§»çš„[InputEventAction]。\n"
+"[b]注æ„:[/b]默认的 [code]ui_*[/code] 动作是部分 [Control] 的内部逻辑所必需"
+"的,无法删除。但是å¯ä»¥ä¿®æ”¹åˆ†é…给该动作的事件。"
#: doc/classes/ProjectSettings.xml
msgid ""
@@ -60780,8 +60814,8 @@ msgid ""
"to the action can however be modified."
msgstr ""
"默认选择[Control](例如[ItemList]或[Tree])中的一个项目[InputEventAction]。\n"
-"[b]注æ„:[/b]默认的[code]ui_*[/code]动作ä¸èƒ½è¢«åˆ é™¤ï¼Œå› ä¸ºå®ƒä»¬æ˜¯å‡ ä¸ª[Control]çš„"
-"内部逻辑所必需的。但是,å¯ä»¥ä¿®æ”¹åˆ†é…给该æ“作的事件。"
+"[b]注æ„:[/b]默认的 [code]ui_*[/code] 动作是部分 [Control] 的内部逻辑所必需"
+"的,无法删除。但是å¯ä»¥ä¿®æ”¹åˆ†é…给该动作的事件。"
#: doc/classes/ProjectSettings.xml
msgid ""
@@ -60790,9 +60824,9 @@ msgid ""
"necessary for the internal logic of several [Control]s. The events assigned "
"to the action can however be modified."
msgstr ""
-"默认在UI中å‘上移动[InputEventAction]。\n"
-"[b]注æ„:[/b]默认的[code]ui_*[/code]动作ä¸èƒ½è¢«åˆ é™¤ï¼Œå› ä¸ºå®ƒä»¬æ˜¯å‡ ä¸ª[Control]çš„"
-"内部逻辑所必需的。但是,å¯ä»¥ä¿®æ”¹åˆ†é…给该æ“作的事件。"
+"默认在 UI 中å‘上移动[InputEventAction]。\n"
+"[b]注æ„:[/b]默认的 [code]ui_*[/code] 动作是部分 [Control] 的内部逻辑所必需"
+"的,无法删除。但是å¯ä»¥ä¿®æ”¹åˆ†é…给该动作的事件。"
#: doc/classes/ProjectSettings.xml
msgid ""
@@ -63204,7 +63238,6 @@ msgstr ""
"的值通常会给出最好的结果。å¦è§ [member rendering/quality/filters/use_fxaa]。"
#: doc/classes/ProjectSettings.xml
-#, fuzzy
msgid ""
"If [code]true[/code], uses a fast post-processing filter to make banding "
"significantly less visible in 3D. 2D rendering is [i]not[/i] affected by "
@@ -63224,13 +63257,18 @@ msgid ""
"debanding at run-time, set [member Viewport.debanding] on the root "
"[Viewport] instead."
msgstr ""
-"如果为 [code]true[/code],则使用快速åŽå¤„ç†è¿‡æ»¤å™¨ä½¿æ¡å¸¦æ˜Žæ˜¾ä¸é‚£ä¹ˆæ˜Žæ˜¾ã€‚在æŸäº›"
-"情况下,去带å¯èƒ½ä¼šå¼•å…¥ç¨å¾®æ˜Žæ˜¾çš„æŠ–动模å¼ã€‚å»ºè®®ä»…åœ¨å®žé™…éœ€è¦æ—¶å¯ç”¨åŽ»æ¡å¸¦ï¼Œå› ä¸º"
-"抖动模å¼ä¼šä½¿æ— æŸåŽ‹ç¼©çš„å±å¹•截图更大。\n"
+"如果为 [code]true[/code]ï¼Œåˆ™ä½¿ç”¨ä¸€ä¸ªå¿«é€Ÿçš„åŽæœŸå¤„ç†æ»¤æ³¢å™¨ï¼Œä½¿ 3D 的带状现象明"
+"显å‡å°‘。2D 渲染[i]ä¸å—[/i]去æ¡å¸¦çš„å½±å“ï¼Œé™¤éž [member Environment."
+"background_mode] 为 [constant Environment.BG_CANVAS]。此时 [member rendering/"
+"quality/intended_usage/framebuffer_allocation] 也必须设为 [b]3D[/b]。\n"
+"在æŸäº›æƒ…况下,去带å¯èƒ½ä¼šå¼•å…¥ç¨å¾®æ˜Žæ˜¾çš„æŠ–动模å¼ã€‚å»ºè®®ä»…åœ¨å®žé™…éœ€è¦æ—¶å¯ç”¨åŽ»æ¡"
+"带,因为抖动模å¼ä¼šä½¿æ— æŸåŽ‹ç¼©çš„å±å¹•截图更大。\n"
"[b]注æ„:[/b]仅在 GLES3 åŽç«¯å¯ç”¨ã€‚[member rendering/quality/depth/hdr] 也必须"
"为 [code]true[/code] æ‰èƒ½ä½¿åŽ»è‰²å¸¦æœ‰æ•ˆã€‚\n"
"[b]注æ„:[/b]已知在移动平å°ä¸Šçš„åŽ»è‰²å¸¦å­˜åœ¨ç ´åæ¸²æŸ“的问题。因此,建议在用于移动"
-"平尿—¶ç¦ç”¨æ­¤é€‰é¡¹ã€‚"
+"平尿—¶ç¦ç”¨æ­¤é€‰é¡¹ã€‚\n"
+"[b]注æ„:[/b]这个属性在项目å¯åŠ¨æ—¶æ˜¯åªè¯»çš„。è¦åœ¨è¿è¡Œæ—¶è®¾ç½®åŽ»æ¡å¸¦ï¼Œè¯·åœ¨æ ¹ "
+"[Viewport] 上设置 [member Viewport.debanding]。"
#: doc/classes/ProjectSettings.xml
msgid ""
@@ -65372,6 +65410,13 @@ msgid ""
"[code]offset[/code], and the character before [code]offset[/code] will be "
"checked for the word boundary [code]\\b[/code]."
msgstr ""
+"在文本中æœç´¢ç¼–译åŽçš„æ¨¡å¼ã€‚如果找到,则将首个匹é…结果放在 [RegExMatch] 容器中"
+"返回,å¦åˆ™è¿”回 [code]null[/code]。\n"
+"æœç´¢çš„范围å¯ä»¥ç”¨ [code]offset[/code] å’Œ [code]end[/code] 指定。å¯ç”¨äºŽåœ¨ä¸Šä¸€æ¬¡"
+"æˆåŠŸæ‰¾åˆ°åŽå†æ¬¡ä½¿ç”¨ç›¸åŒçš„ [code]subject[/code] 调用这个方法,继续寻找匹é…。设"
+"ç½®è¿™äº›å‚æ•°å’Œä¼ å…¥ç¼©çŸ­åŽçš„字符串是ä¸åŒçš„。例如,起点 [code]^[/code] ä¸ä¼šå— "
+"[code]offset[/code] å½±å“,å•è¯è¾¹ç•Œ [code]\\b[/code] 会检查 [code]offset[/"
+"code] 之å‰çš„字符。"
#: modules/regex/doc_classes/RegEx.xml
msgid ""
@@ -65386,9 +65431,15 @@ msgid ""
"[code]offset[/code], and the character before [code]offset[/code] will be "
"checked for the word boundary [code]\\b[/code]."
msgstr ""
+"在文本中æœç´¢ç¼–译åŽçš„æ¨¡å¼ã€‚返回 [RegExMatch] 容器的数组,其中包å«çš„æ˜¯äº’ä¸é‡å "
+"的匹é…结果。如果没有找到匹é…,则返回空数组。\n"
+"æœç´¢çš„范围å¯ä»¥ç”¨ [code]offset[/code] å’Œ [code]end[/code] 指定。å¯ç”¨äºŽåœ¨ä¸Šä¸€æ¬¡"
+"æˆåŠŸæ‰¾åˆ°åŽå†æ¬¡ä½¿ç”¨ç›¸åŒçš„ [code]subject[/code] 调用这个方法,继续寻找匹é…。设"
+"ç½®è¿™äº›å‚æ•°å’Œä¼ å…¥ç¼©çŸ­åŽçš„字符串是ä¸åŒçš„。例如,起点 [code]^[/code] ä¸ä¼šå— "
+"[code]offset[/code] å½±å“,å•è¯è¾¹ç•Œ [code]\\b[/code] 会检查 [code]offset[/"
+"code] 之å‰çš„字符。"
#: modules/regex/doc_classes/RegEx.xml
-#, fuzzy
msgid ""
"Searches the text for the compiled pattern and replaces it with the "
"specified string. Escapes and backreferences such as [code]$1[/code] and "
@@ -65403,10 +65454,14 @@ msgid ""
"[code]offset[/code], and the character before [code]offset[/code] will be "
"checked for the word boundary [code]\\b[/code]."
msgstr ""
-"æœç´¢æ–‡æœ¬ä¸­çš„编译模å¼ï¼Œå¹¶å°†å…¶æ›¿æ¢ä¸ºæŒ‡å®šçš„字符串。诸如 [code]$1[/code] å’Œ "
+"在文本中æœç´¢ç¼–译åŽçš„æ¨¡å¼ï¼Œå¹¶å°†å…¶æ›¿æ¢ä¸ºæŒ‡å®šçš„字符串。诸如 [code]$1[/code] å’Œ "
"[code]$name[/code] 等转义和åå‘å¼•ç”¨ä¼šè¢«å±•å¼€å’Œè§£å†³ã€‚é»˜è®¤æƒ…å†µä¸‹ï¼Œåªæœ‰ç¬¬ä¸€ä¸ªå®žä¾‹"
-"被替æ¢ï¼Œä½†å¯ä»¥å¯¹æ‰€æœ‰å®žä¾‹è¿›è¡Œä¿®æ”¹ï¼ˆå…¨å±€æ›¿æ¢ï¼‰ã€‚å¯ä»¥æŒ‡å®šè¦æœç´¢çš„区域,而ä¸éœ€è¦"
-"修改开始和结æŸé”šçš„ä½ç½®ã€‚"
+"被替æ¢ï¼Œä½†å¯ä»¥å¯¹æ‰€æœ‰å®žä¾‹è¿›è¡Œä¿®æ”¹ï¼ˆå…¨å±€æ›¿æ¢ï¼‰ã€‚\n"
+"æœç´¢çš„范围å¯ä»¥ç”¨ [code]offset[/code] å’Œ [code]end[/code] 指定。å¯ç”¨äºŽåœ¨ä¸Šä¸€æ¬¡"
+"æˆåŠŸæ‰¾åˆ°åŽå†æ¬¡ä½¿ç”¨ç›¸åŒçš„ [code]subject[/code] 调用这个方法,继续寻找匹é…。设"
+"ç½®è¿™äº›å‚æ•°å’Œä¼ å…¥ç¼©çŸ­åŽçš„字符串是ä¸åŒçš„。例如,起点 [code]^[/code] ä¸ä¼šå— "
+"[code]offset[/code] å½±å“,å•è¯è¾¹ç•Œ [code]\\b[/code] 会检查 [code]offset[/"
+"code] 之å‰çš„字符。"
#: modules/regex/doc_classes/RegExMatch.xml
msgid "Contains the results of a [RegEx] search."
@@ -65687,7 +65742,7 @@ msgstr ""
"时,这个方法会被调用。它的行为å¯ä»¥é€šè¿‡è¦†ç›–脚本中的 [method "
"_setup_local_to_scene] 进行定制。\n"
"对于大多数资æºï¼Œè¯¥æ–¹æ³•䏿‰§è¡Œä»»ä½•基本逻辑。[ViewportTexture] 执行自定义逻辑以"
-"正确设置本地视窗中的代ç†çº¹ç†å’Œæ ‡å¿—。"
+"正确设置本地视å£ä¸­çš„代ç†çº¹ç†å’Œæ ‡å¿—。"
#: doc/classes/Resource.xml
msgid ""
@@ -68854,12 +68909,11 @@ msgid ""
"quality/dynamic_fonts/use_oversampling[/code] in [ProjectSettings]. The "
"property can however be overridden at runtime as needed."
msgstr ""
-"为 [code]true[/code] æ—¶å¯ç”¨å­—体过采样。这æ„å‘³ç€æ ¹æ®è§†çª—的缩放比例ä¸åŒï¼Œ"
-"[DynamicFont] 渲染的大å°ä¼šæ¯”é…ç½®å¤§å°æ›´é«˜æˆ–更低。例如,如果视窗的缩放系数为 "
-"1.5,那么é…置为 14 å·å¤§å°çš„字体将会按照 21 å·å¤§å°æ¸²æŸ“([code]14 * 1.5[/"
-"code])。\n"
-"[b]注æ„:[/b]字体过采样仅在视窗拉伸模å¼ä¸º [constant STRETCH_MODE_VIEWPORT] 且"
-"拉伸比例模å¼ä¸æ˜¯ [constant STRETCH_ASPECT_IGNORE] 时有效。\n"
+"为 [code]true[/code] æ—¶å¯ç”¨å­—体过采样。这æ„å‘³ç€æ ¹æ®è§†å£çš„缩放比例ä¸åŒï¼Œ"
+"[DynamicFont] 渲染的大å°ä¼šæ¯”é…ç½®å¤§å°æ›´é«˜æˆ–更低。例如,视å£çš„缩放系数为 1.5 "
+"时,é…置大å°ä¸º 14 的字体将会当作大å°ä¸º 21 渲染([code]14 * 1.5[/code])。\n"
+"[b]注æ„:[/b]åªæœ‰åœ¨è§†å£æ‹‰ä¼¸æ¨¡å¼ä¸º [constant STRETCH_MODE_VIEWPORT] 且拉伸比例"
+"模å¼ä¸æ˜¯ [constant STRETCH_ASPECT_IGNORE] 时,æ‰ä¼šä½¿ç”¨å­—体过采样。\n"
"[b]注æ„:[/b]项目å¯åŠ¨æ—¶ä¼šä¸ºæ´»åŠ¨çš„ [SceneTree] 自动设置该属性,å–值为 "
"[ProjectSettings] çš„ [code]rendering/quality/dynamic_fonts/use_oversampling[/"
"code]。ä¸è¿‡è¿è¡Œæ—¶å¯ä»¥æ ¹æ®éœ€è¦å¯¹è¯¥å±žæ€§è¿›è¡Œè¦†ç›–。"
@@ -68932,7 +68986,7 @@ msgstr "当节点的é…置更改时å‘出。仅在 [code]tool[/code] 模å¼ä¸‹å
#: doc/classes/SceneTree.xml
msgid "Emitted whenever a node is removed from the [SceneTree]."
-msgstr "当从 [SceneTree] 中删除节点时å‘出。"
+msgstr "当从 [SceneTree] 中移除节点时å‘出。"
#: doc/classes/SceneTree.xml
msgid "Emitted whenever a node is renamed."
@@ -68968,15 +69022,15 @@ msgstr "当 [SceneTree] 层次结构å‘生å˜åŒ–(移动或é‡å‘½åå­é¡¹ç­‰ï¼
#: doc/classes/SceneTree.xml
msgid "Call a group with no flags (default)."
-msgstr "对组进行调用时,ä¸ä½¿ç”¨æ ‡å¿—(默认)。"
+msgstr "对分组进行调用时,ä¸ä½¿ç”¨æ ‡å¿—(默认)。"
#: doc/classes/SceneTree.xml
msgid "Call a group in reverse scene order."
-msgstr "对组进行调用时,使用逆场景åºã€‚"
+msgstr "对分组进行调用时,使用逆场景åºã€‚"
#: doc/classes/SceneTree.xml
msgid "Call a group immediately (calls are normally made on idle)."
-msgstr "å¯¹ç»„è¿›è¡Œè°ƒç”¨æ—¶ï¼Œç«‹å³æ‰§è¡Œï¼ˆæ­£å¸¸æƒ…况下是在空闲时调用的)。"
+msgstr "å¯¹åˆ†ç»„è¿›è¡Œè°ƒç”¨æ—¶ï¼Œç«‹å³æ‰§è¡Œï¼ˆæ­£å¸¸æƒ…况下是在空闲时调用的)。"
#: doc/classes/SceneTree.xml
msgid ""
@@ -68985,6 +69039,9 @@ msgid ""
"call is unique or not. Therefore when the same method is called with "
"different arguments, only the first call will be performed."
msgstr ""
+"å³ä¾¿æ‰§è¡Œäº†å¤šæ¬¡è°ƒç”¨ï¼Œä¹Ÿåªå¯¹åˆ†ç»„进行一次调用。\n"
+"[b]注æ„:[/b]确定调用是å¦å”¯ä¸€æ—¶ä¸è€ƒè™‘傿•°ã€‚因此,如果使用ä¸åŒçš„傿•°è°ƒç”¨äº†åŒä¸€"
+"个方法,那么åªä¼šæ‰§è¡Œç¬¬ä¸€ä¸ªè°ƒç”¨ã€‚"
#: doc/classes/SceneTree.xml
msgid "No stretching."
@@ -71377,10 +71434,10 @@ msgstr ""
msgid ""
"Rotation part of the local transformation in degrees, specified in terms of "
"YXZ-Euler angles in the format (X angle, Y angle, Z angle)."
-msgstr "æ—‹è½¬éƒ¨åˆ†å±€éƒ¨å˜æ¢ä¸ºåº¦ï¼ŒæŒ‰ YXZ-Euler è§’æ ¼å¼æŒ‡å®šï¼ˆX è§’ã€Y è§’ã€Z 角)。"
+msgstr ""
+"å±€éƒ¨å˜æ¢çš„æ—‹è½¬éƒ¨åˆ†ï¼Œå•ä½ä¸ºåº¦ï¼Œä»¥ YXZ 欧拉角的形å¼è¡¨ç¤ºï¼ˆX è§’ã€Y è§’ã€Z 角)。"
#: doc/classes/Spatial.xml
-#, fuzzy
msgid ""
"Scale part of the local transformation.\n"
"[b]Note:[/b] Mixed negative scales in 3D are not decomposable from the "
@@ -71392,7 +71449,9 @@ msgid ""
msgstr ""
"å±€éƒ¨å˜æ¢çš„缩放部分。\n"
"[b]注æ„:[/b]3D ä¸­ï¼Œå˜æ¢çŸ©é˜µæ˜¯æ— æ³•分解出正负混åˆçš„缩放的。由于 Godot 中使用å˜"
-"æ¢çŸ©é˜µæ¥è¡¨ç¤ºç¼©æ”¾ï¼Œå¾—到的缩放值è¦ä¹ˆå…¨æ­£ã€è¦ä¹ˆå…¨è´Ÿã€‚"
+"æ¢çŸ©é˜µæ¥è¡¨ç¤ºç¼©æ”¾ï¼Œå¾—到的缩放值è¦ä¹ˆå…¨æ­£ã€è¦ä¹ˆå…¨è´Ÿã€‚\n"
+"[b]注æ„:[/b]并䏿˜¯æ‰€æœ‰èŠ‚ç‚¹çš„å¤–è§‚éƒ½ä¼šè¢« [member scale] 属性缩放。例如,"
+"[Light] 的外观就ä¸å— [member scale] å½±å“。"
#: doc/classes/Spatial.xml
msgid "Local space [Transform] of this node, with respect to the parent node."
@@ -73038,6 +73097,9 @@ msgid ""
"[b]Note:[/b] [member spot_angle] is not affected by [member Spatial.scale] "
"(the light's scale or its parent's scale)."
msgstr ""
+"èšå…‰ç¯çš„角度,å•ä½ä¸ºåº¦ã€‚\n"
+"[b]注æ„:[/b][member spot_angle] ä¸å— [member Spatial.scale] 的影å“(无论是该"
+"ç¯å…‰çš„缩放还是其父节点的缩放)。"
#: doc/classes/SpotLight.xml
msgid "The spotlight's angular attenuation curve."
@@ -73048,7 +73110,6 @@ msgid "The spotlight's light energy attenuation curve."
msgstr "èšå…‰ç¯çš„å…‰é‡è¡°å‡æ›²çº¿ã€‚"
#: doc/classes/SpotLight.xml
-#, fuzzy
msgid ""
"The maximal range that can be reached by the spotlight. Note that the "
"effectively lit area may appear to be smaller depending on the [member "
@@ -73058,8 +73119,10 @@ msgid ""
"(the light's scale or its parent's scale)."
msgstr ""
"èšå…‰ç¯å¯ä»¥è¾¾åˆ°çš„æœ€å¤§èŒƒå›´ã€‚请注æ„,根æ®ä½¿ç”¨çš„ [member spot_attenuation],有效"
-"照明区域å¯èƒ½çœ‹èµ·æ¥æ›´å°ã€‚无论使用[member spot_attenuation],光都ä¸ä¼šåˆ°è¾¾æ­¤èŒƒå›´"
-"之外的任何东西。"
+"照明区域å¯èƒ½çœ‹èµ·æ¥æ›´å°ã€‚无论 [member spot_attenuation] 为何值,光都ä¸ä¼šåˆ°è¾¾æ­¤"
+"范围之外的任何东西。\n"
+"[b]注æ„:[/b][member spot_angle] ä¸å— [member Spatial.scale] 的影å“(无论是该"
+"ç¯å…‰çš„缩放还是其父节点的缩放)。"
#: doc/classes/SpringArm.xml
msgid "A helper node, mostly used in 3rd person cameras."
@@ -76689,7 +76752,7 @@ msgid ""
"Centers the viewport on the line the editing cursor is at. This also resets "
"the [member scroll_horizontal] value to [code]0[/code]."
msgstr ""
-"将视区置于编辑光标所在的行上。这也会将 [member scroll_horizontal] 值é‡ç½®ä¸º "
+"将视å£ç½®äºŽç¼–辑光标所在的行上。这也会将 [member scroll_horizontal] 值é‡ç½®ä¸º "
"[code]0[/code]。"
#: doc/classes/TextEdit.xml
@@ -76723,7 +76786,7 @@ msgid ""
"will center at the cursor position after the move occurs."
msgstr ""
"将光标移动到指定的 [code]column[/code] 索引处。\n"
-"如果 [code]adjust_viewport[/code] 设置为 [code]true[/code],则移动å‘生åŽè§†çª—"
+"如果 [code]adjust_viewport[/code] 设置为 [code]true[/code],则移动å‘生åŽè§†å£"
"将以光标ä½ç½®ä¸ºä¸­å¿ƒã€‚"
#: doc/classes/TextEdit.xml
@@ -76735,7 +76798,7 @@ msgid ""
"[code]line[/code] can be hidden using [method set_line_as_hidden]."
msgstr ""
"在指定的 [code]line[/code] 索引处移动光标。\n"
-"如果 [code]adjust_viewport[/code] 设置为 [code]true[/code],则移动å‘生åŽè§†çª—"
+"如果 [code]adjust_viewport[/code] 设置为 [code]true[/code],则移动å‘生åŽè§†å£"
"将以光标ä½ç½®ä¸ºä¸­å¿ƒã€‚\n"
"如果 [code]can_be_hidden[/code] 设置为 [code]true[/code],则å¯ä»¥ä½¿ç”¨ [method "
"set_line_as_hidden] éšè—指定的 [code]line[/code]。"
@@ -84329,16 +84392,16 @@ msgid ""
"to be upside down. Enabling [member render_target_v_flip] will display the "
"Viewport with the correct orientation."
msgstr ""
-"Viewport 会在å±å¹•上创建ä¸åŒçš„视图,或者是å¦ä¸€ä¸ªè§†çª—中的å­è§†å›¾ã€‚å­ä»£ 2D 节点会"
+"Viewport 会在å±å¹•上创建ä¸åŒçš„视图,或者是å¦ä¸€ä¸ªè§†å£ä¸­çš„å­è§†å›¾ã€‚å­ä»£ 2D 节点会"
"在其上显示,å­ä»£ 3D æ‘„åƒæœºèŠ‚ç‚¹ä¹Ÿä¼šåœ¨å…¶ä¸Šæ¸²æŸ“ã€‚\n"
-"å¦å¤–,视窗å¯ä»¥æœ‰è‡ªå·±çš„ 2D 或 3D 世界,所以它们ä¸ä¼šä¸Žå…¶ä»–视窗共享其所绘制的内"
+"å¦å¤–,视å£å¯ä»¥æœ‰è‡ªå·±çš„ 2D 或 3D 世界,所以它们ä¸ä¼šä¸Žå…¶ä»–视å£å…±äº«å…¶æ‰€ç»˜åˆ¶çš„内"
"容。\n"
-"如果视窗是 [ViewportContainer] çš„å­èŠ‚ç‚¹ï¼Œå®ƒå°†è‡ªåŠ¨å ç”¨å…¶å¤§å°ï¼Œå¦åˆ™å¿…须手动设"
+"å¦‚æžœè§†å£æ˜¯ [ViewportContainer] çš„å­èŠ‚ç‚¹ï¼Œå®ƒå°†è‡ªåŠ¨å ç”¨å…¶å¤§å°ï¼Œå¦åˆ™å¿…须手动设"
"置。\n"
-"视窗也å¯ä»¥é€‰æ‹©æˆä¸ºéŸ³é¢‘监å¬è€…,会根æ®å®ƒçš„ 2D 或 3D æ‘„åƒæœºçš„å­èŠ‚ç‚¹æ¥äº§ç”Ÿä½ç½®éŸ³"
+"视å£ä¹Ÿå¯ä»¥é€‰æ‹©æˆä¸ºéŸ³é¢‘监å¬è€…,会根æ®å®ƒçš„ 2D 或 3D æ‘„åƒæœºçš„å­èŠ‚ç‚¹æ¥äº§ç”Ÿä½ç½®éŸ³"
"频。\n"
-"å¦å¤–,如果设备有多个å±å¹•,视窗å¯ä»¥è¢«åˆ†é…到ä¸åŒçš„å±å¹•。\n"
-"最åŽï¼Œè§†çª—也å¯ä»¥ä½œä¸ºæ¸²æŸ“ç›®æ ‡ï¼Œåœ¨è¿™ç§æƒ…况下,除éžç›¸å…³çš„纹ç†è¢«ç”¨äºŽç»˜åˆ¶ï¼Œå¦åˆ™å®ƒ"
+"å¦å¤–,如果设备有多个å±å¹•,视å£å¯ä»¥è¢«åˆ†é…到ä¸åŒçš„å±å¹•。\n"
+"最åŽï¼Œè§†å£ä¹Ÿå¯ä»¥ä½œä¸ºæ¸²æŸ“ç›®æ ‡ï¼Œåœ¨è¿™ç§æƒ…况下,除éžç›¸å…³çš„纹ç†è¢«ç”¨äºŽç»˜åˆ¶ï¼Œå¦åˆ™å®ƒ"
"们将ä¸å¯è§ã€‚\n"
"[b]注æ„:[/b]默认情况下,Godot 3.x 中新创建的 Viewport 是上下颠倒的。å¯ç”¨ "
"[member render_target_v_flip] å¯ä»¥ä½¿è¯¥ Viewport 使用正确的æœå‘显示。"
@@ -84385,7 +84448,7 @@ msgstr "返回激活的 3D 相机。"
#: doc/classes/Viewport.xml
msgid "Returns the total transform of the viewport."
-msgstr "è¿”å›žè§†çª—çš„æ€»çš„å˜æ¢ã€‚"
+msgstr "返回视å£çš„æ€»çš„å˜æ¢ã€‚"
#: doc/classes/Viewport.xml
msgid "Returns the topmost modal in the stack."
@@ -84399,7 +84462,7 @@ msgstr "返回该 [Viewport] 中鼠标的ä½ç½®ï¼Œä½¿ç”¨è¯¥ [Viewport] çš„åæ ‡
#: doc/classes/Viewport.xml
msgid "Returns information about the viewport from the rendering pipeline."
-msgstr "返回渲染管é“中关于视窗的信æ¯ã€‚"
+msgstr "返回渲染管é“中关于视å£çš„ä¿¡æ¯ã€‚"
#: doc/classes/Viewport.xml
msgid "Returns the [enum ShadowAtlasQuadrantSubdiv] of the specified quadrant."
@@ -84420,7 +84483,7 @@ msgid ""
"img.flip_y()\n"
"[/codeblock]"
msgstr ""
-"返回该视窗的纹ç†ã€‚\n"
+"返回该视å£çš„纹ç†ã€‚\n"
"[b]注æ„:[/b]由于 OpenGL 的工作方å¼ï¼Œäº§ç”Ÿçš„ [ViewportTexture] 是垂直翻转的。"
"ä½ å¯ä»¥åœ¨ [method Texture.get_data] 的结果上使用 [method Image.flip_y] æ¥å°†å…¶"
"翻转回去,例如:\n"
@@ -84459,7 +84522,7 @@ msgid ""
"Alternative to [constant Node.NOTIFICATION_DRAG_BEGIN] and [constant Node."
"NOTIFICATION_DRAG_END] when you prefer polling the value."
msgstr ""
-"å¦‚æžœè¯¥è§†åŒºç›®å‰æ­£åœ¨æ‰§è¡Œæ‹–拽æ“作,则返回 [code]true[/code]。\n"
+"如果该视å£ç›®å‰æ­£åœ¨æ‰§è¡Œæ‹–拽æ“作,则返回 [code]true[/code]。\n"
"如果你更倾å‘于对其进行轮询,那么就å¯ä»¥ä½œä¸º [constant Node."
"NOTIFICATION_DRAG_BEGIN] å’Œ [constant Node.NOTIFICATION_DRAG_END] 的替代å“。"
@@ -84540,7 +84603,6 @@ msgstr ""
"å…¨å±€ç”»å¸ƒå˜æ¢ã€‚"
#: doc/classes/Viewport.xml
-#, fuzzy
msgid ""
"If [code]true[/code], uses a fast post-processing filter to make banding "
"significantly less visible in 3D. 2D rendering is [i]not[/i] affected by "
@@ -84555,9 +84617,13 @@ msgid ""
"[b]Note:[/b] Only available on the GLES3 backend. [member hdr] must also be "
"[code]true[/code] for debanding to be effective."
msgstr ""
-"如果为 [code]true[/code]ï¼Œåˆ™ä½¿ç”¨ä¸€ä¸ªå¿«é€Ÿçš„åŽæœŸå¤„ç†æ»¤æ³¢å™¨ï¼Œä½¿å¸¦çŠ¶çŽ°è±¡æ˜Žæ˜¾å‡"
-"少。在æŸäº›æƒ…况下,去带å¯èƒ½ä¼šå¼•å…¥ç¨å¾®æ˜Žæ˜¾çš„æŠ–动模å¼ã€‚å»ºè®®åªæœ‰åœ¨å®žé™…éœ€è¦æ—¶æ‰å¯"
-"用去带,因为抖动模å¼ä¼šä½¿æ— æŸåŽ‹ç¼©çš„å±å¹•截图å˜å¤§ã€‚\n"
+"如果为 [code]true[/code]ï¼Œåˆ™ä½¿ç”¨ä¸€ä¸ªå¿«é€Ÿçš„åŽæœŸå¤„ç†æ»¤æ³¢å™¨ï¼Œä½¿ 3D 的带状现象明"
+"显å‡å°‘。2D 渲染[i]ä¸å—[/i]去æ¡å¸¦çš„å½±å“ï¼Œé™¤éž [member Environment."
+"background_mode] 为 [constant Environment.BG_CANVAS]。此时 [member usage] 也"
+"必须设为 [constant USAGE_3D]。å¦è¯·å‚阅 [member ProjectSettings.rendering/"
+"quality/filters/use_debanding]。\n"
+"在æŸäº›æƒ…况下,去æ¡å¸¦å¯èƒ½ä¼šå¼•å…¥ç¨å¾®æ˜Žæ˜¾çš„æŠ–åŠ¨å›¾æ¡ˆã€‚å»ºè®®åªæœ‰åœ¨å®žé™…éœ€è¦æ—¶æ‰å¯ç”¨"
+"去æ¡å¸¦ï¼Œå› ä¸ºæŠ–动图案会使无æŸåŽ‹ç¼©çš„å±å¹•截图å˜å¤§ã€‚\n"
"[b]注æ„:[/b]仅在 GLES3 åŽç«¯å¯ç”¨ã€‚[member hdr] 也必须是 [code]true[/code] æ‰"
"能使去色带生效。"
@@ -84566,13 +84632,12 @@ msgid "The overlay mode for test rendered geometry in debug purposes."
msgstr "在调试时,用于测试渲染的几何图形的å åŠ æ¨¡å¼ã€‚"
#: doc/classes/Viewport.xml
-#, fuzzy
msgid ""
"If [code]true[/code], the viewport will disable 3D rendering. To actually "
"disable allocation of 3D buffers, set [member usage] instead."
msgstr ""
-"如果为 [code]true[/code],该视å£å°†ç¦ç”¨ 3D 渲染。对于实际ç¦ç”¨ï¼Œä½¿ç”¨ "
-"[code]usage[/code]。"
+"如果为 [code]true[/code],该视å£å°†ç¦ç”¨ 3D 渲染。è¦å®žé™…ç¦ç”¨ 3D 缓冲区的分é…,"
+"请设置 [member usage]。"
#: doc/classes/Viewport.xml
msgid ""
@@ -84616,7 +84681,7 @@ msgid ""
"[b]Note:[/b] Only available on the GLES3 backend."
msgstr ""
"如果为 [code]true[/code],视å£çš„æ¸²æŸ“将获益于高动æ€èŒƒå›´ç®—法。高动æ€èŒƒå›´å…许视"
-"窗接收 0-1 范围以外的数值。在 Godot 中 HDR 默认使用åŠç²¾åº¦æµ®ç‚¹æ•°ï¼ˆ16 ä½ï¼‰ã€‚è¦"
+"å£æŽ¥æ”¶ 0-1 范围以外的数值。在 Godot 中 HDR 默认使用åŠç²¾åº¦æµ®ç‚¹æ•°ï¼ˆ16 ä½ï¼‰ã€‚è¦"
"使用全精度浮点数(32 ä½ï¼‰ï¼Œè¯·å¯ç”¨ [member use_32_bpc_depth]。\n"
"[b]注æ„:[/b]需è¦å°† [member usage] 设置为 [constant USAGE_3D] 或 [constant "
"USAGE_3D_NO_EFFECTS],因为 HDR 䏿”¯æŒ 2D。\n"
@@ -84635,7 +84700,7 @@ msgid ""
"require input in linear color space!"
msgstr ""
"如果为 [code]true[/code],3D 渲染åŽçš„结果将ä¸ä¼šåº”用线性到 sRGB 的颜色转æ¢ã€‚当"
-"视å£è¢«ç”¨ä½œæ¸²æŸ“目标时,这点很é‡è¦ï¼Œå› ä¸ºæ¸²æŸ“结果会被用作å¦ä¸€ä¸ªè§†çª—中渲染的 3D "
+"视å£è¢«ç”¨ä½œæ¸²æŸ“目标时,这点很é‡è¦ï¼Œå› ä¸ºæ¸²æŸ“结果会被用作å¦ä¸€ä¸ªè§†å£ä¸­æ¸²æŸ“çš„ 3D "
"物体的纹ç†ã€‚如果视å£è¢«ç”¨æ¥åˆ›å»ºä¸åŸºäºŽé¢œè‰²çš„æ•°æ®ï¼Œå™ªå£°ã€é«˜åº¦å›¾ã€é‡‡å›¾ç­‰ï¼Œè¿™ä¹Ÿå¾ˆ"
"é‡è¦ã€‚当视å£è¢«ç”¨ä½œ 2D å¯¹è±¡çš„çº¹ç†æ—¶ï¼Œæˆ–è€…è§†å£æ˜¯ä½ çš„æœ€ç»ˆè¾“出时,请ä¸è¦å¯ç”¨è¿™ä¸ª"
"功能。对于 GLES2 驱动æ¥è¯´ï¼Œè¿™å°†æŠŠ sRGB 输出转æ¢ä¸ºçº¿æ€§è¾“出,这应该åªç”¨äºŽéœ€è¦çº¿"
@@ -84725,7 +84790,7 @@ msgid ""
msgstr ""
"阴影图集的分辨率(用于全å‘光和èšå…‰ï¼‰ã€‚该值将四èˆäº”入到最接近的 2 的幂。\n"
"[b]注æ„:[/b]如果设置为 [code]0[/code],点阴影和方å‘阴影[i]都[/i]å°†ä¸å¯è§ã€‚ç”±"
-"于用户创建的视区默认值为 [code]0[/code],因此必须手动将此值设置为大于 "
+"于用户创建的视å£é»˜è®¤å€¼ä¸º [code]0[/code],因此必须手动将此值设置为大于 "
"[code]0[/code](一般至少是 [code]256[/code])。"
#: doc/classes/Viewport.xml
@@ -84736,7 +84801,7 @@ msgid ""
"Values around [code]0.5[/code] generally give the best results. See also "
"[member fxaa]."
msgstr ""
-"如果设置为大于 [code]0.0[/code] 的值,对比度适应性é”化将被应用到3D视窗中。这"
+"如果设置为大于 [code]0.0[/code] 的值,对比度适应性é”化将被应用到3D视å£ä¸­ã€‚è¿™"
"å…·æœ‰è¾ƒä½Žçš„æ€§èƒ½æˆæœ¬ï¼Œå¯ä»¥ç”¨æ¥æ¢å¤ä½¿ç”¨ FXAA 所æŸå¤±çš„一些é”度。一般æ¥è¯´ï¼Œ"
"[code]0.5[/code] å·¦å³çš„æ•°å€¼å¯ä»¥å¾—到最好的效果。å¦è¯·å‚阅 [member fxaa]。"
@@ -84759,7 +84824,6 @@ msgid ""
msgstr "如果为 [code]true[/code],该视å£åº”ä½¿å…¶èƒŒæ™¯æ¸²æŸ“ä¸ºé€æ˜Žã€‚"
#: doc/classes/Viewport.xml
-#, fuzzy
msgid ""
"The viewport's rendering mode. This controls which buffers are allocated for "
"the viewport (2D only, or 2D + 3D). 2D-only options can reduce memory usage "
@@ -84768,7 +84832,8 @@ msgid ""
"USAGE_2D_NO_SAMPLING], [member hdr] will have no effect when enabled since "
"HDR is not supported for 2D."
msgstr ""
-"视区的渲染模å¼ã€‚\n"
+"该视å£çš„æ¸²æŸ“模å¼ã€‚控制的是为该视å£åˆ†é…哪些缓冲区(仅 2D 或者 2D + 3D)。仅 "
+"2D 的选项能够é™ä½Žå†…å­˜å ç”¨ã€ç•¥å¾®æå‡æ€§èƒ½ï¼Œå°¤å…¶æ˜¯åœ¨ä½Žç«¯è®¾å¤‡ä¸Šã€‚\n"
"[b]注æ„:[/b]如果设为 [constant USAGE_2D] 或 [constant "
"USAGE_2D_NO_SAMPLING],则å¯ç”¨ [member hdr] ä¸ä¼šç”Ÿæ•ˆï¼Œå› ä¸º 2D 䏿”¯æŒ HDR。"
@@ -84783,7 +84848,7 @@ msgid ""
"enable [member debanding] instead.\n"
"[b]Note:[/b] Only available on the GLES3 backend."
msgstr ""
-"如果为 [code]true[/code],分é…该视窗的帧缓冲时将使用完整浮点数精度(32 ä½ï¼‰è€Œ"
+"如果为 [code]true[/code],分é…该视å£çš„帧缓冲时将使用完整浮点数精度(32 ä½ï¼‰è€Œ"
"䏿˜¯åŠæµ®ç‚¹æ•°ç²¾åº¦ï¼ˆ16 ä½ï¼‰ã€‚ä»…åœ¨åŒæ—¶å¯ç”¨ [member hdr] 时有效。\n"
"[b]注æ„:[/b]å¯ç”¨è¿™ä¸ªè®¾ç½®ä¸ä¼šæå‡æ¸²æŸ“è´¨é‡ã€‚ä½¿ç”¨å®Œæ•´æµ®ç‚¹æ•°ç²¾åº¦è¾ƒæ…¢ï¼Œä¸€èˆ¬åªæœ‰è¦"
"求更高精度的高级ç€è‰²å™¨éœ€è¦ä½¿ç”¨ã€‚如果是è¦å‡å°‘æ¡å¸¦æ•ˆåº”,请å¯ç”¨ [member "
@@ -85015,7 +85080,7 @@ msgstr ""
#: doc/classes/ViewportContainer.xml
msgid ""
"If [code]true[/code], the viewport will be scaled to the control's size."
-msgstr "为 [code]true[/code] 时视窗将被缩放到控件的大å°ã€‚"
+msgstr "为 [code]true[/code] 时视å£å°†è¢«ç¼©æ”¾åˆ°æŽ§ä»¶çš„大å°ã€‚"
#: doc/classes/ViewportContainer.xml
msgid ""
@@ -85046,7 +85111,7 @@ msgid ""
msgstr ""
"å°† [Viewport] 节点的内容显示为一个动æ€çš„ [Texture]。å¯ä»¥ç”¨æ¥åœ¨åŒä¸€ä¸ªåœºæ™¯ä¸­æ··"
"åˆæŽ§ä»¶ã€2D å’Œ 3D元素。\n"
-"è¦é€šè¿‡ä»£ç åˆ›å»º ViewportTexture,请使用目标视窗上的 [method Viewport."
+"è¦é€šè¿‡ä»£ç åˆ›å»º ViewportTexture,请使用目标视å£ä¸Šçš„ [method Viewport."
"get_texture] 方法。"
#: doc/classes/ViewportTexture.xml
@@ -85402,6 +85467,8 @@ msgid ""
"value will make the [VisualInstance] reliably draw on top of other "
"[VisualInstance]s that are otherwise positioned at the same spot."
msgstr ""
+"这个 [VisualInstance] 所使用的排åºåç§»é‡ã€‚调高åŽï¼Œè¯¥ [VisualInstance] 会稳定"
+"地绘制在åŒä¸€ä½ç½®çš„å…¶ä»– [VisualInstance] 之上。"
#: doc/classes/VisualInstance.xml
msgid ""
@@ -85411,6 +85478,10 @@ msgid ""
"The position based sorting instead allows to better control the drawing "
"order when working with [Particles] and [CPUParticles]."
msgstr ""
+"如果为 [code]true[/code],则该对象会根æ®å…¶ [AABB] 中心点排åºã€‚å¦åˆ™ä¼šæ ¹æ®å…¶å…¨"
+"å±€ä½ç½®æŽ’åºã€‚\n"
+"对 3D æ¨¡åž‹è€Œè¨€ï¼Œæ ¹æ® [AABB] 的中心点排åºä¸€èˆ¬æ›´ä¸ºç²¾ç¡®ã€‚使用 [Particles] å’Œ "
+"[CPUParticles] 时,根æ®ä½ç½®æŽ’åºèƒ½å¤Ÿæ›´å¥½åœ°æŽ§åˆ¶ç»˜åˆ¶é¡ºåºã€‚"
#: modules/visual_script/doc_classes/VisualScript.xml
msgid "A script implemented in the Visual Script programming environment."
@@ -87417,10 +87488,10 @@ msgstr ""
"VisualServer 是完全ä¸é€æ˜Žçš„,它的内部结构的完全的具体实现ä¸èƒ½è¢«è®¿é—®ã€‚\n"
"VisualServer å¯ä»¥ç”¨æ¥å®Œå…¨ç»•过场景系统。\n"
"å¯ä½¿ç”¨ [code]*_create[/code] 函数创建资æºã€‚\n"
-"所有的对象都被绘制到视窗中。你å¯ä»¥ä½¿ç”¨é™„在 [SceneTree] 上的 [Viewport],或者"
+"所有的对象都被绘制到视å£ä¸­ã€‚ä½ å¯ä»¥ä½¿ç”¨é™„在 [SceneTree] 上的 [Viewport],或者"
"用 [method viewport_create] 自己创建一个。当使用自定义场景或画布时,需è¦ä½¿ç”¨ "
"[method viewport_set_scenario] 或 [method viewport_attach_canvas] 将场景或画"
-"布附加到视窗上。\n"
+"布附加到视å£ä¸Šã€‚\n"
"在 3D 中,所有的视觉对象都必须与一个场景相关è”。场景是世界的一个视觉表现。如"
"果从一个正在è¿è¡Œçš„æ¸¸æˆä¸­è®¿é—®è§†è§‰æœåŠ¡ï¼Œåœºæ™¯å¯ä»¥é€šè¿‡ [method Spatial."
"get_world] 从场景树中的任何 [Spatial] 节点访问。å¦å¤–,å¯ä»¥ç”¨ [method "
@@ -87431,7 +87502,7 @@ msgstr ""
"一个实例。实例也必须使用 [method instance_set_scenario] 附加到场景中,以便å¯"
"è§ã€‚\n"
"在 2D 中,所有å¯è§å¯¹è±¡éƒ½æ˜¯æŸç§å½¢å¼çš„画布项目。为了å¯è§ï¼Œä¸€ä¸ªç”»å¸ƒé¡¹éœ€è¦æ˜¯è¿žæŽ¥"
-"到视窗的画布的å­é¡¹ï¼Œæˆ–è€…å®ƒéœ€è¦æ˜¯æœ€ç»ˆè¿žæŽ¥åˆ°ç”»å¸ƒçš„å¦ä¸€ä¸ªç”»å¸ƒé¡¹çš„å­é¡¹ã€‚"
+"到视å£çš„画布的å­é¡¹ï¼Œæˆ–è€…å®ƒéœ€è¦æ˜¯æœ€ç»ˆè¿žæŽ¥åˆ°ç”»å¸ƒçš„å¦ä¸€ä¸ªç”»å¸ƒé¡¹çš„å­é¡¹ã€‚"
#: doc/classes/VisualServer.xml
msgid "Sets images to be rendered in the window margin."
@@ -87660,7 +87731,7 @@ msgid ""
"Sets the parent for the [CanvasItem]. The parent can be another canvas item, "
"or it can be the root canvas that is attached to the viewport."
msgstr ""
-"设置[CanvasItem]的父级。父级å¯ä»¥æ˜¯å¦ä¸€ä¸ªç”»å¸ƒé¡¹ç›®ï¼Œä¹Ÿå¯ä»¥æ˜¯è¿žæŽ¥åˆ°è§†çª—的根画"
+"设置[CanvasItem]的父级。父级å¯ä»¥æ˜¯å¦ä¸€ä¸ªç”»å¸ƒé¡¹ç›®ï¼Œä¹Ÿå¯ä»¥æ˜¯è¿žæŽ¥åˆ°è§†å£çš„æ ¹ç”»"
"布。"
#: doc/classes/VisualServer.xml
@@ -89743,7 +89814,7 @@ msgid ""
"[/codeblock]"
msgstr ""
"在两个纹ç†ä¹‹é—´åˆ›å»ºæ›´æ–°é“¾ï¼Œä¸Ž [ViewportTexture] 的原ç†ç±»ä¼¼ã€‚基础纹ç†ä¸º "
-"[Viewport] çš„çº¹ç†æ—¶ï¼Œè§†åŒºæ¯æ–°æ¸²æŸ“一帧,代ç†çº¹ç†å°±ä¼šè‡ªåŠ¨æ”¶åˆ°æ›´æ–°ã€‚\n"
+"[Viewport] çš„çº¹ç†æ—¶ï¼Œè§†å£æ¯æ–°æ¸²æŸ“一帧,代ç†çº¹ç†å°±ä¼šè‡ªåŠ¨æ”¶åˆ°æ›´æ–°ã€‚\n"
"例如,此处的代ç ä¼šåˆ©ç”¨ VisualServer API 将一张通用的 [ImageTexture] 链接到 "
"[Viewport] 的纹ç†è¾“出上:\n"
"[codeblock]\n"
@@ -89781,7 +89852,7 @@ msgstr "设置视图的相机。"
#: doc/classes/VisualServer.xml
msgid "Sets a viewport's canvas."
-msgstr "设置视窗的画布。"
+msgstr "设置视å£çš„画布。"
#: doc/classes/VisualServer.xml
msgid ""
@@ -89804,18 +89875,18 @@ msgid ""
"manually. For further optimization, see [method "
"viewport_set_render_direct_to_screen]."
msgstr ""
-"将视窗å¤åˆ¶åˆ°å±å¹•上由 [code]rect[/code] 指定的区域。如果 [member Viewport."
-"render_direct_to_screen] 为 [code]true[/code],那么视窗就ä¸ä¼šä½¿ç”¨å¸§ç¼“冲,视窗"
-"的内容会直接渲染到å±å¹•上。然而,请注æ„,根视窗是最åŽç»˜åˆ¶çš„,因此它将在å±å¹•上"
-"绘制。相应地,你就必须将根视窗设置为一个ä¸è¦†ç›–你所附加的这个视窗的区域。\n"
-"例如,你å¯ä»¥ç”¨ä»¥ä¸‹ä»£ç å°†æ ¹è§†çª—è®¾ç½®ä¸ºå®Œå…¨ä¸æ¸²æŸ“。\n"
+"将视å£å¤åˆ¶åˆ°å±å¹•上由 [code]rect[/code] 指定的区域。如果 [member Viewport."
+"render_direct_to_screen] 为 [code]true[/code],那么视å£å°±ä¸ä¼šä½¿ç”¨å¸§ç¼“冲,视å£"
+"的内容会直接渲染到å±å¹•上。然而,请注æ„ï¼Œæ ¹è§†å£æ˜¯æœ€åŽç»˜åˆ¶çš„,因此它将在å±å¹•上"
+"绘制。相应地,你就必须将根视å£è®¾ç½®ä¸ºä¸€ä¸ªä¸è¦†ç›–你所附加的这个视å£çš„区域。\n"
+"例如,你å¯ä»¥ç”¨ä»¥ä¸‹ä»£ç å°†æ ¹è§†å£è®¾ç½®ä¸ºå®Œå…¨ä¸æ¸²æŸ“。\n"
"[codeblock]\n"
"func _ready():\n"
" get_viewport().set_attach_to_screen_rect(Rect2())\n"
" $Viewport.set_attach_to_screen_rect(Rect2(0, 0, 600, 600))\n"
"[/codeblock]\n"
"使用这个方法å¯ä»¥å¸¦æ¥æ˜Žæ˜¾çš„优化,特别是在低端设备上。然而,它的代价是必须手动"
-"管ç†ä½ çš„视窗。进一步的优化请å‚阅 [method "
+"管ç†ä½ çš„视å£ã€‚进一步的优化请å‚阅 [method "
"viewport_set_render_direct_to_screen]。"
#: doc/classes/VisualServer.xml
@@ -89826,32 +89897,32 @@ msgid ""
"Once finished with your RID, you will want to free the RID using the "
"VisualServer's [method free_rid] static method."
msgstr ""
-"创建一个空视窗并将其添加到 VisualServer 中。å¯ä»¥ç”¨è¿”回的RIDæ¥è®¿é—®å®ƒã€‚这个RID"
+"创建一个空视å£å¹¶å°†å…¶æ·»åŠ åˆ° VisualServer 中。å¯ä»¥ç”¨è¿”回的RIDæ¥è®¿é—®å®ƒã€‚这个RID"
"将用于所有[code]viewport_*[/code] 的VisualServer函数。\n"
"一旦你用完了RID,你è¦ä½¿ç”¨VisualServerçš„[method free_rid]陿€æ–¹æ³•释放RID。"
#: doc/classes/VisualServer.xml
msgid "Detaches the viewport from the screen."
-msgstr "将视窗从å±å¹•上分离。"
+msgstr "将视å£ä»Žå±å¹•上分离。"
#: doc/classes/VisualServer.xml
msgid ""
"Returns a viewport's render information. For options, see the [enum "
"ViewportRenderInfo] constants."
-msgstr "返回视窗的渲染信æ¯ã€‚有关选项,请å‚阅 [enum ViewportRenderInfo] 常é‡ã€‚"
+msgstr "返回视å£çš„æ¸²æŸ“ä¿¡æ¯ã€‚有关选项,请å‚阅 [enum ViewportRenderInfo] 常é‡ã€‚"
#: doc/classes/VisualServer.xml
msgid "Returns the viewport's last rendered frame."
-msgstr "è¿”å›žè§†çª—çš„æœ€åŽæ¸²æŸ“帧。"
+msgstr "返回视å£çš„æœ€åŽæ¸²æŸ“帧。"
#: doc/classes/VisualServer.xml
msgid "Detaches a viewport from a canvas and vice versa."
-msgstr "从画布分离视窗,å之亦然。"
+msgstr "从画布分离视å£ï¼Œå之亦然。"
#: doc/classes/VisualServer.xml
msgid "If [code]true[/code], sets the viewport active, else sets it inactive."
msgstr ""
-"如果为 [code]true[/code],则将视窗设置为活动状æ€ï¼Œå¦åˆ™å°†å…¶è®¾ç½®ä¸ºéžæ´»åŠ¨çŠ¶æ€ã€‚"
+"如果为 [code]true[/code],则将视å£è®¾ç½®ä¸ºæ´»åŠ¨çŠ¶æ€ï¼Œå¦åˆ™å°†å…¶è®¾ç½®ä¸ºéžæ´»åŠ¨çŠ¶æ€ã€‚"
#: doc/classes/VisualServer.xml
msgid ""
@@ -89859,37 +89930,37 @@ msgid ""
"[code]layer[/code] is the actual canvas layer, while [code]sublayer[/code] "
"specifies the stacking order of the canvas among those in the same layer."
msgstr ""
-"设置视窗画布的堆å é¡ºåºã€‚\n"
+"设置视å£ç”»å¸ƒçš„å †å é¡ºåºã€‚\n"
"[code]layer[/code] 是实际的画布层,而 [code]sublayer[/code] 则指定画布在åŒä¸€"
"层中的堆å é¡ºåºã€‚"
#: doc/classes/VisualServer.xml
msgid "Sets the transformation of a viewport's canvas."
-msgstr "è®¾ç½®è§†çª—ç”»å¸ƒçš„å˜æ¢ã€‚"
+msgstr "设置视å£ç”»å¸ƒçš„å˜æ¢ã€‚"
#: doc/classes/VisualServer.xml
msgid ""
"Sets the clear mode of a viewport. See [enum ViewportClearMode] for options."
-msgstr "设置视窗的清除模å¼ã€‚å¯é€‰é¡¹è§ [enum ViewportClearMode]。"
+msgstr "设置视å£çš„æ¸…除模å¼ã€‚å¯é€‰é¡¹è§ [enum ViewportClearMode]。"
#: doc/classes/VisualServer.xml
msgid ""
"Sets the debug draw mode of a viewport. See [enum ViewportDebugDraw] for "
"options."
-msgstr "设置视窗的调试绘图模å¼ã€‚å¯é€‰é¡¹è§ [enum ViewportDebugDraw]。"
+msgstr "设置视å£çš„调试绘图模å¼ã€‚å¯é€‰é¡¹è§ [enum ViewportDebugDraw]。"
#: doc/classes/VisualServer.xml
msgid "If [code]true[/code], a viewport's 3D rendering is disabled."
-msgstr "如果为 [code]true[/code],则视窗的 3D 渲染将ç¦ç”¨ã€‚"
+msgstr "如果为 [code]true[/code],则视å£çš„ 3D 渲染将ç¦ç”¨ã€‚"
#: doc/classes/VisualServer.xml
msgid ""
"If [code]true[/code], rendering of a viewport's environment is disabled."
-msgstr "如果为 [code]true[/code],则ç¦ç”¨è§†çª—环境的渲染。"
+msgstr "如果为 [code]true[/code],则ç¦ç”¨è§†å£çŽ¯å¢ƒçš„æ¸²æŸ“ã€‚"
#: doc/classes/VisualServer.xml
msgid "Sets the viewport's global transformation matrix."
-msgstr "è®¾ç½®è§†çª—çš„å…¨å±€å˜æ¢çŸ©é˜µã€‚"
+msgstr "设置视å£çš„å…¨å±€å˜æ¢çŸ©é˜µã€‚"
#: doc/classes/VisualServer.xml
msgid ""
@@ -89898,13 +89969,13 @@ msgid ""
"viewport_set_use_32_bpc_depth].\n"
"[b]Note:[/b] Only available on the GLES3 backend."
msgstr ""
-"如果为 [code]true[/code],该视区会渲染至高动æ€èŒƒå›´ï¼ˆHDRï¼‰è€Œä¸æ˜¯æ ‡å‡†åЍæ€èŒƒå›´"
+"如果为 [code]true[/code],该视å£ä¼šæ¸²æŸ“至高动æ€èŒƒå›´ï¼ˆHDRï¼‰è€Œä¸æ˜¯æ ‡å‡†åЍæ€èŒƒå›´"
"(SDR)。å¦è¯·å‚阅 [method viewport_set_use_32_bpc_depth]。\n"
"[b]注æ„:[/b]仅在 GLES3 åŽç«¯å¯ç”¨ã€‚"
#: doc/classes/VisualServer.xml
msgid "If [code]true[/code], the viewport's canvas is not rendered."
-msgstr "如果为 [code]true[/code]ï¼Œåˆ™ä¸æ¸²æŸ“视窗的画布。"
+msgstr "如果为 [code]true[/code]ï¼Œåˆ™ä¸æ¸²æŸ“视å£çš„画布。"
#: doc/classes/VisualServer.xml
msgid "Currently unimplemented in Godot 3.x."
@@ -89916,7 +89987,7 @@ msgstr "设置抗锯齿模å¼ã€‚å¯é€‰é¡¹è§ [enum ViewportMSAA]。"
#: doc/classes/VisualServer.xml
msgid "Sets the viewport's parent to another viewport."
-msgstr "设置视窗的父视窗到å¦ä¸€ä¸ªè§†çª—。"
+msgstr "设置视å£çš„父视å£åˆ°å¦ä¸€ä¸ªè§†å£ã€‚"
#: doc/classes/VisualServer.xml
msgid ""
@@ -89933,12 +90004,12 @@ msgid ""
"will be drawn, no automatic scaling is possible, even if your game scene is "
"significantly larger than the window size."
msgstr ""
-"如果为 [code]true[/code],直接将视窗的内容渲染到å±å¹•上。这å…许一个低级别的优"
-"化,你å¯ä»¥è·³è¿‡ç»˜åˆ¶è§†çª—到根视窗。虽然这ç§ä¼˜åŒ–å¯ä»¥æ˜¾è‘—æé«˜é€Ÿåº¦ï¼ˆç‰¹åˆ«æ˜¯åœ¨æ—§è®¾å¤‡"
-"上),但它是以牺牲å¯ç”¨æ€§ä¸ºä»£ä»·çš„。当å¯ç”¨è¿™ä¸ªåŠŸèƒ½æ—¶ï¼Œä½ ä¸èƒ½ä»Žè§†çª—或"
+"如果为 [code]true[/code],直接将视å£çš„内容渲染到å±å¹•上。这å…许一个低级别的优"
+"化,你å¯ä»¥è·³è¿‡ç»˜åˆ¶è§†å£åˆ°æ ¹è§†å£ã€‚虽然这ç§ä¼˜åŒ–å¯ä»¥æ˜¾è‘—æé«˜é€Ÿåº¦ï¼ˆç‰¹åˆ«æ˜¯åœ¨æ—§è®¾å¤‡"
+"上),但它是以牺牲å¯ç”¨æ€§ä¸ºä»£ä»·çš„。当å¯ç”¨è¿™ä¸ªåŠŸèƒ½æ—¶ï¼Œä½ ä¸èƒ½ä»Žè§†å£æˆ–"
"[code]SCREEN_TEXTURE[/code]中读å–。你也会失去æŸäº›çª—å£è®¾ç½®çš„好处,比如å„ç§æ‹‰ä¼¸"
"模å¼ã€‚å¦ä¸€ä¸ªéœ€è¦æ³¨æ„çš„åŽæžœæ˜¯ï¼Œåœ¨2D中,渲染是以窗å£å标进行的,所以如果你有一"
-"个两å€äºŽçª—å£å¤§å°çš„è§†çª—ï¼Œå¹¶ä¸”ä½ è®¾ç½®äº†è¿™ä¸ªï¼Œé‚£ä¹ˆåªæœ‰é€‚åˆçª—å£çš„部分æ‰ä¼šè¢«ç»˜åˆ¶ï¼Œ"
+"个两å€äºŽçª—å£å¤§å°çš„视å£ï¼Œå¹¶ä¸”ä½ è®¾ç½®äº†è¿™ä¸ªï¼Œé‚£ä¹ˆåªæœ‰é€‚åˆçª—å£çš„部分æ‰ä¼šè¢«ç»˜åˆ¶ï¼Œ"
"没有自动缩放的å¯èƒ½ï¼Œå³ä½¿ä½ çš„æ¸¸æˆåœºæ™¯æ˜Žæ˜¾å¤§äºŽçª—å£å¤§å°ã€‚"
#: doc/classes/VisualServer.xml
@@ -89947,7 +90018,7 @@ msgid ""
"The scenario contains information about the [enum ScenarioDebugMode], "
"environment information, reflection atlas etc."
msgstr ""
-"设置一个视窗的场景。\n"
+"设置视å£çš„场景。\n"
"åœºæ™¯åŒ…å« [enum ScenarioDebugMode] 的信æ¯ã€çŽ¯å¢ƒä¿¡æ¯ã€å射图集等。"
#: doc/classes/VisualServer.xml
@@ -89971,31 +90042,31 @@ msgid ""
"[code]0.5[/code] generally give the best results. See also [method "
"viewport_set_use_fxaa]."
msgstr ""
-"为视窗[code]viewport[/code]设定é”化强度[code]intensity[/code]。如果设置为大于"
-"[code]0.0[/code]的值,对比度适应性é”化将被应用到3D视窗中。这具有较低的性能æˆ"
+"为视å£[code]viewport[/code]设定é”化强度[code]intensity[/code]。如果设置为大于"
+"[code]0.0[/code]的值,对比度适应性é”化将被应用到3D视å£ä¸­ã€‚这具有较低的性能æˆ"
"本,å¯ä»¥ç”¨æ¥æ¢å¤ä½¿ç”¨FXAAæ—¶æŸå¤±çš„一些é”度。一般æ¥è¯´ï¼Œ[code]0.5[/code]å·¦å³çš„值"
"å¯ä»¥å¾—到最好的效果。å‚阅[method viewport_set_use_fxaa]。"
#: doc/classes/VisualServer.xml
msgid "Sets the viewport's width and height."
-msgstr "设置视窗的宽度和高度。"
+msgstr "设置视å£çš„宽度和高度。"
#: doc/classes/VisualServer.xml
msgid ""
"If [code]true[/code], the viewport renders its background as transparent."
-msgstr "如果为 [code]true[/code]ï¼Œè§†çª—å°†å…¶èƒŒæ™¯æ¸²æŸ“ä¸ºé€æ˜Žã€‚"
+msgstr "如果为 [code]true[/code],视å£å°†å…¶èƒŒæ™¯æ¸²æŸ“ä¸ºé€æ˜Žã€‚"
#: doc/classes/VisualServer.xml
msgid ""
"Sets when the viewport should be updated. See [enum ViewportUpdateMode] "
"constants for options."
-msgstr "设置应更新视窗的时间。å¯é€‰é¡¹è¯·å‚阅 [enum ViewportUpdateMode] 。"
+msgstr "设置应更新视å£çš„æ—¶é—´ã€‚å¯é€‰é¡¹è¯·å‚阅 [enum ViewportUpdateMode] 。"
#: doc/classes/VisualServer.xml
msgid ""
"Sets the viewport's 2D/3D mode. See [enum ViewportUsage] constants for "
"options."
-msgstr "设置视窗的 2D/3D 模å¼ã€‚é€‰é¡¹è§ [enum ViewportUsage] 常é‡ã€‚"
+msgstr "设置视å£çš„ 2D/3D 模å¼ã€‚é€‰é¡¹è§ [enum ViewportUsage] 常é‡ã€‚"
#: doc/classes/VisualServer.xml
msgid ""
@@ -90005,7 +90076,7 @@ msgid ""
"on the same [Viewport] to set HDR to [code]true[/code].\n"
"[b]Note:[/b] Only available on the GLES3 backend."
msgstr ""
-"如果为 [code]true[/code],分é…该视区的帧缓冲时将使用完整浮点数精度(32 ä½ï¼‰è€Œ"
+"如果为 [code]true[/code],分é…该视å£çš„帧缓冲时将使用完整浮点数精度(32 ä½ï¼‰è€Œ"
"䏿˜¯åŠæµ®ç‚¹æ•°ç²¾åº¦ï¼ˆ16 ä½ï¼‰ã€‚åªæœ‰åœ¨åŒä¸€ä¸ª [Viewport] 上通过 [method "
"viewport_set_use_32_bpc_depth] 将 HDR 设为 [code]true[/code] 时有效。\n"
"[b]注æ„:[/b]仅在 GLES3 åŽç«¯ä¸­å¯ç”¨ã€‚"
@@ -90015,7 +90086,7 @@ msgid ""
"If [code]true[/code], the viewport uses augmented or virtual reality "
"technologies. See [ARVRInterface]."
msgstr ""
-"如果为 [code]true[/code]ï¼Œåˆ™è§†çª—ä½¿ç”¨å¢žå¼ºæˆ–è™šæ‹ŸçŽ°å®žæŠ€æœ¯ã€‚è§ [ARVRInterface]。"
+"如果为 [code]true[/code],则视å£ä½¿ç”¨å¢žå¼ºæˆ–è™šæ‹ŸçŽ°å®žæŠ€æœ¯ã€‚è§ [ARVRInterface]。"
#: doc/classes/VisualServer.xml
msgid ""
@@ -90042,14 +90113,14 @@ msgid ""
"recovered by enabling contrast-adaptive sharpening (see [method "
"viewport_set_sharpen_intensity])."
msgstr ""
-"å¯ç”¨è¯¥è§†çª—的快速近似抗锯齿。FXAA æ˜¯ä¸€ç§æµè¡Œçš„å±å¹•空间抗锯齿方法,它速度快,但"
+"å¯ç”¨è¯¥è§†å£çš„快速近似抗锯齿。FXAA æ˜¯ä¸€ç§æµè¡Œçš„å±å¹•空间抗锯齿方法,它速度快,但"
"会使图åƒçœ‹èµ·æ¥å¾ˆæ¨¡ç³Šï¼Œç‰¹åˆ«æ˜¯åœ¨ä½Žåˆ†è¾¨çŽ‡ä¸‹ã€‚åœ¨ 1440p å’Œ 4K 等高分辨率下,它ä»ç„¶"
"å¯ä»¥å·¥ä½œå¾—比较好。一些æŸå¤±çš„é”度å¯ä»¥é€šè¿‡å¯ç”¨å¯¹æ¯”度适应性é”åŒ–æ¥æ¢å¤ï¼ˆè§ "
"[method viewport_set_sharpen_intensity])。"
#: doc/classes/VisualServer.xml
msgid "If [code]true[/code], the viewport's rendering is flipped vertically."
-msgstr "如果为 [code]true[/code],则视窗的渲染垂直翻转。"
+msgstr "如果为 [code]true[/code],则视å£çš„æ¸²æŸ“垂直翻转。"
#: doc/classes/VisualServer.xml
msgid ""
@@ -90440,33 +90511,33 @@ msgstr "优化阴影贴图的使用,æé«˜æœ‰æ•ˆåˆ†è¾¨çŽ‡ã€‚ä½†å¯èƒ½ä¼šå¯¼è‡´
#: doc/classes/VisualServer.xml
msgid "Do not update the viewport."
-msgstr "ä¸è¦æ›´æ–°è§†çª—。"
+msgstr "ä¸è¦æ›´æ–°è§†å£ã€‚"
#: doc/classes/VisualServer.xml
msgid "Update the viewport once then set to disabled."
-msgstr "更新一次视窗,然åŽè®¾ç½®ä¸ºç¦ç”¨ã€‚"
+msgstr "更新一次视å£ï¼Œç„¶åŽè®¾ç½®ä¸ºç¦ç”¨ã€‚"
#: doc/classes/VisualServer.xml
msgid "Update the viewport whenever it is visible."
-msgstr "åªè¦è§†çª—是å¯è§çš„,就更新视窗。"
+msgstr "åªè¦è§†å£æ˜¯å¯è§çš„,就更新视å£ã€‚"
#: doc/classes/VisualServer.xml
msgid "Always update the viewport."
-msgstr "始终更新视窗。"
+msgstr "始终更新视å£ã€‚"
#: doc/classes/VisualServer.xml
msgid "The viewport is always cleared before drawing."
-msgstr "在绘图之å‰ï¼Œè§†çª—总是被清空。"
+msgstr "在绘图之å‰ï¼Œè§†å£æ€»æ˜¯è¢«æ¸…空。"
#: doc/classes/VisualServer.xml
msgid "The viewport is never cleared before drawing."
-msgstr "在绘图之å‰ï¼Œè§†çª—永远ä¸ä¼šè¢«æ¸…空。"
+msgstr "在绘图之å‰ï¼Œè§†å£æ°¸è¿œä¸ä¼šè¢«æ¸…空。"
#: doc/classes/VisualServer.xml
msgid ""
"The viewport is cleared once, then the clear mode is set to [constant "
"VIEWPORT_CLEAR_NEVER]."
-msgstr "è§†çª—è¢«æ¸…é™¤ä¸€æ¬¡ï¼Œç„¶åŽæ¸…除模å¼è®¾ç½®ä¸º [constant VIEWPORT_CLEAR_NEVER]。"
+msgstr "视å£è¢«æ¸…é™¤ä¸€æ¬¡ï¼Œç„¶åŽæ¸…除模å¼è®¾ç½®ä¸º [constant VIEWPORT_CLEAR_NEVER]。"
#: doc/classes/VisualServer.xml
msgid "Multisample antialiasing is disabled."
@@ -92375,7 +92446,7 @@ msgstr "使用给定的纹ç†ä½œä¸ºæ­¤å‡½æ•°çš„傿•°ã€‚"
#: doc/classes/VisualShaderNodeTexture.xml
msgid "Use the current viewport's texture as the source."
-msgstr "使用当å‰è§†çª—的纹ç†ä½œä¸ºæºã€‚"
+msgstr "使用当å‰è§†å£çš„纹ç†ä½œä¸ºæºã€‚"
#: doc/classes/VisualShaderNodeTexture.xml
msgid ""
diff --git a/doc/translations/zh_TW.po b/doc/translations/zh_TW.po
index a64bd25054..a21d110c05 100644
--- a/doc/translations/zh_TW.po
+++ b/doc/translations/zh_TW.po
@@ -15,12 +15,14 @@
# Otis Kao <momoslim@gmail.com>, 2022.
# YuChiang Chang <chiang.c.tw@gmail.com>, 2022.
# Hugel <qihu@nfschina.com>, 2022.
+# Chih Wei Chien <dppss92132@gmail.com>, 2022.
+# Edison Lee <edisonlee@edisonlee55.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine class reference\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
-"PO-Revision-Date: 2022-10-12 06:50+0000\n"
-"Last-Translator: BinotaLIU <me@binota.org>\n"
+"PO-Revision-Date: 2023-01-15 03:49+0000\n"
+"Last-Translator: Edison Lee <edisonlee@edisonlee55.com>\n"
"Language-Team: Chinese (Traditional) <https://hosted.weblate.org/projects/"
"godot-engine/godot-class-reference/zh_Hant/>\n"
"Language: zh_TW\n"
@@ -28,7 +30,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Weblate 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: doc/tools/make_rst.py
msgid "Description"
@@ -84,7 +86,7 @@ msgstr "繼承自:"
#: doc/tools/make_rst.py
msgid "(overrides %s)"
-msgstr ""
+msgstr "(覆寫 %s)"
#: doc/tools/make_rst.py
msgid "Default"
@@ -126,13 +128,13 @@ msgstr "此方法用於建構型別。"
msgid ""
"This method doesn't need an instance to be called, so it can be called "
"directly using the class name."
-msgstr ""
+msgstr "該方法ä¸éœ€è¦ä½¿ç”¨ä¸€å€‹å¯¦é«”來呼å«ï¼Œæ‰€ä»¥ä»–å¯ä»¥ç›´æŽ¥ä½¿ç”¨ class name 呼å«ã€‚"
#: doc/tools/make_rst.py
msgid ""
"This method describes a valid operator to use with this type as left-hand "
"operand."
-msgstr ""
+msgstr "該方法æè¿°ä¸€å€‹æœ‰æ•ˆçš„é‹ç®—å­ä½¿ç”¨æ­¤åž‹åˆ¥ä½œç‚ºå·¦é‹ç®—值。"
#: modules/gdscript/doc_classes/@GDScript.xml
msgid "Built-in GDScript functions."
@@ -148,7 +150,6 @@ msgstr ""
"供。 (é—œéµå­—:內建ã€å…¨åŸŸå‡½å¼ã€buildinã€build inã€global functions)"
#: modules/gdscript/doc_classes/@GDScript.xml
-#, fuzzy
msgid ""
"Returns a color constructed from integer red, green, blue, and alpha "
"channels. Each channel should have 8 bits of information ranging from 0 to "
@@ -161,12 +162,12 @@ msgid ""
"red = Color8(255, 0, 0)\n"
"[/codeblock]"
msgstr ""
-"回傳以整數紅色ã€ç¶ è‰²ã€è—色與 Alpha é€šé“æ§‹æˆçš„色彩。æ¯å€‹é€šé“éƒ½æ‡‰åŒ…å« 0 至 255 "
-"çš„ 8 ä½å…ƒè³‡è¨Šã€‚\n"
+"回傳以整數紅色ã€ç¶ è‰²ã€è—è‰²èˆ‡é€æ˜Žé€šé“æ§‹æˆçš„色彩。æ¯å€‹é€šé“éƒ½æ‡‰åŒ…å« 0 至 255 çš„ "
+"8 ä½å…ƒè³‡è¨Šã€‚\n"
"[code]r8[/code] 紅色通é“\n"
"[code]g8[/code] 綠色通é“\n"
"[code]b8[/code] è—色通é“\n"
-"[code]a8[/code] Alpha 通é“\n"
+"[code]a8[/code] 逿˜Žé€šé“\n"
"[codeblock]\n"
"red = Color8(255, 0, 0)\n"
"[/codeblock]"
@@ -201,7 +202,6 @@ msgstr ""
"[/codeblock]"
#: modules/gdscript/doc_classes/@GDScript.xml
-#, fuzzy
msgid ""
"Returns the arc cosine of [code]s[/code] in radians. Use to get the angle of "
"cosine [code]s[/code]. [code]s[/code] must be between [code]-1.0[/code] and "
@@ -212,15 +212,15 @@ msgid ""
"c = acos(0.866025)\n"
"[/codeblock]"
msgstr ""
-"回傳以弧度表示的[code]s[/code]çš„å餘弦(cos)值。用於求餘弦(sin)值[code]s[/"
-"code]的夾角。\n"
+"回傳以弧度表示的[code]s[/code]çš„å餘弦(arc cos)值。用於求餘弦(cos)值[code]s[/"
+"code]的夾角。[code]s[/code]必須介於[code]-1.0[/code]與[code]1.0[/code]之間 "
+"(包å«),å¦å‰‡ [method acos] 會回傳 [constant NAN]。\n"
"[codeblock]\n"
-"# c 為0.523599,若以rad2deg(s)æ›ç®—,則為30度\n"
+"# c 為 0.523599,若以 rad2deg(s) æ›ç®—,則為30度\n"
"c = acos(0.866025)\n"
"[/codeblock]"
#: modules/gdscript/doc_classes/@GDScript.xml
-#, fuzzy
msgid ""
"Returns the arc sine of [code]s[/code] in radians. Use to get the angle of "
"sine [code]s[/code]. [code]s[/code] must be between [code]-1.0[/code] and "
@@ -230,7 +230,14 @@ msgid ""
"# s is 0.523599 or 30 degrees if converted with rad2deg(s)\n"
"s = asin(0.5)\n"
"[/codeblock]"
-msgstr "testing"
+msgstr ""
+"回傳以弧度表示的[code]s[/code]çš„åæ­£å¼¦(arc sin)值。用於求正弦 (sin) 值"
+"[code]s[/code]的夾角。[code]s[/code]必須介於[code]-1.0[/code]與[code]1.0[/"
+"code]之間 (包å«),å¦å‰‡ [method asin] 會回傳 [constant NAN]。\n"
+"[codeblock]\n"
+"# c 為 0.523599,若以 rad2deg(s) æ›ç®—,則為 30 度\n"
+"c = asin(0.5)\n"
+"[/codeblock]"
#: modules/gdscript/doc_classes/@GDScript.xml
#, fuzzy
@@ -30066,7 +30073,11 @@ msgid ""
"using an [AnimatedTexture], only the first frame will be displayed.\n"
"[b]Note:[/b] Only images imported with the [b]Lossless[/b], [b]Lossy[/b] or "
"[b]Uncompressed[/b] compression modes are supported. The [b]Video RAM[/b] "
-"compression mode can't be used for custom cursors."
+"compression mode can't be used for custom cursors.\n"
+"[b]Note:[/b] On the web platform, the maximum allowed cursor image size is "
+"128×128. Cursor images larger than 32×32 will also only be displayed if the "
+"mouse cursor image is entirely located within the page for [url=https://"
+"chromestatus.com/feature/5825971391299584]security reasons[/url]."
msgstr ""
#: doc/classes/Input.xml
@@ -41853,7 +41864,7 @@ msgstr ""
#: doc/classes/OS.xml
msgid "Desktop directory path."
-msgstr ""
+msgstr "桌é¢è³‡æ–™å¤¾è·¯å¾‘。"
#: doc/classes/OS.xml
msgid "DCIM (Digital Camera Images) directory path."
@@ -41861,27 +41872,27 @@ msgstr ""
#: doc/classes/OS.xml
msgid "Documents directory path."
-msgstr ""
+msgstr "檔案資料夾路徑。"
#: doc/classes/OS.xml
msgid "Downloads directory path."
-msgstr ""
+msgstr "下載資料夾路徑。"
#: doc/classes/OS.xml
msgid "Movies directory path."
-msgstr ""
+msgstr "影片資料夾路徑。"
#: doc/classes/OS.xml
msgid "Music directory path."
-msgstr ""
+msgstr "音樂資料夾路徑。"
#: doc/classes/OS.xml
msgid "Pictures directory path."
-msgstr ""
+msgstr "圖片資料夾路徑。"
#: doc/classes/OS.xml
msgid "Ringtones directory path."
-msgstr ""
+msgstr "鈴è²è³‡æ–™å¤¾è·¯å¾‘。"
#: doc/classes/OS.xml
msgid "Unknown powerstate."
diff --git a/drivers/alsa/asound-so_wrap.c b/drivers/alsa/asound-so_wrap.c
index 65624bcb70..ffe24d4313 100644
--- a/drivers/alsa/asound-so_wrap.c
+++ b/drivers/alsa/asound-so_wrap.c
@@ -1,12 +1,11 @@
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by /home/hp/Projects/godot/pulse/generate-wrapper.py 0.3 on 2021-02-22 19:22:12
-// flags: /home/hp/Projects/godot/pulse/generate-wrapper.py --include /usr/include/alsa/asoundlib.h --sys-include <alsa/asoundlib.h> --soname libasound.so.2 --init-name asound --omit-prefix snd_pcm_sw_params_set_tstamp_type --omit-prefix snd_pcm_status_get_audio_htstamp_report --omit-prefix snd_pcm_sw_params_get_tstamp_type --omit-prefix snd_pcm_status_set_audio_htstamp_config --output-header asound-so_wrap.h --output-implementation asound-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-12 10:26:13
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/alsa/asoundlib.h --sys-include "thirdparty/linuxbsd_headers/alsa/asoundlib.h" --soname libasound.so.2 --init-name asound --omit-prefix snd_pcm_sw_params_set_tstamp_type --omit-prefix snd_pcm_status_get_audio_htstamp_report --omit-prefix snd_pcm_sw_params_get_tstamp_type --omit-prefix snd_pcm_status_set_audio_htstamp_config --output-header ./drivers/alsa/asound-so_wrap.h --output-implementation ./drivers/alsa/asound-so_wrap.c
//
#include <stdint.h>
#define snd_asoundlib_version snd_asoundlib_version_dylibloader_orig_asound
-#define snd_dlpath snd_dlpath_dylibloader_orig_asound
#define snd_dlopen snd_dlopen_dylibloader_orig_asound
#define snd_dlsym snd_dlsym_dylibloader_orig_asound
#define snd_dlclose snd_dlclose_dylibloader_orig_asound
@@ -40,7 +39,6 @@
#define snd_strerror snd_strerror_dylibloader_orig_asound
#define snd_lib_error_set_handler snd_lib_error_set_handler_dylibloader_orig_asound
#define snd_lib_error_set_local snd_lib_error_set_local_dylibloader_orig_asound
-#define snd_config_topdir snd_config_topdir_dylibloader_orig_asound
#define snd_config_top snd_config_top_dylibloader_orig_asound
#define snd_config_load snd_config_load_dylibloader_orig_asound
#define snd_config_load_override snd_config_load_override_dylibloader_orig_asound
@@ -58,9 +56,6 @@
#define snd_config_expand snd_config_expand_dylibloader_orig_asound
#define snd_config_evaluate snd_config_evaluate_dylibloader_orig_asound
#define snd_config_add snd_config_add_dylibloader_orig_asound
-#define snd_config_add_before snd_config_add_before_dylibloader_orig_asound
-#define snd_config_add_after snd_config_add_after_dylibloader_orig_asound
-#define snd_config_remove snd_config_remove_dylibloader_orig_asound
#define snd_config_delete snd_config_delete_dylibloader_orig_asound
#define snd_config_delete_compound_members snd_config_delete_compound_members_dylibloader_orig_asound
#define snd_config_copy snd_config_copy_dylibloader_orig_asound
@@ -78,7 +73,6 @@
#define snd_config_imake_safe_string snd_config_imake_safe_string_dylibloader_orig_asound
#define snd_config_imake_pointer snd_config_imake_pointer_dylibloader_orig_asound
#define snd_config_get_type snd_config_get_type_dylibloader_orig_asound
-#define snd_config_is_array snd_config_is_array_dylibloader_orig_asound
#define snd_config_set_id snd_config_set_id_dylibloader_orig_asound
#define snd_config_set_integer snd_config_set_integer_dylibloader_orig_asound
#define snd_config_set_integer64 snd_config_set_integer64_dylibloader_orig_asound
@@ -423,7 +417,6 @@
#define snd_pcm_areas_silence snd_pcm_areas_silence_dylibloader_orig_asound
#define snd_pcm_area_copy snd_pcm_area_copy_dylibloader_orig_asound
#define snd_pcm_areas_copy snd_pcm_areas_copy_dylibloader_orig_asound
-#define snd_pcm_areas_copy_wrap snd_pcm_areas_copy_wrap_dylibloader_orig_asound
#define snd_pcm_hook_get_pcm snd_pcm_hook_get_pcm_dylibloader_orig_asound
#define snd_pcm_hook_get_private snd_pcm_hook_get_private_dylibloader_orig_asound
#define snd_pcm_hook_set_private snd_pcm_hook_set_private_dylibloader_orig_asound
@@ -1015,7 +1008,6 @@
#define snd_mixer_selem_id_get_index snd_mixer_selem_id_get_index_dylibloader_orig_asound
#define snd_mixer_selem_id_set_name snd_mixer_selem_id_set_name_dylibloader_orig_asound
#define snd_mixer_selem_id_set_index snd_mixer_selem_id_set_index_dylibloader_orig_asound
-#define snd_mixer_selem_id_parse snd_mixer_selem_id_parse_dylibloader_orig_asound
#define snd_seq_open snd_seq_open_dylibloader_orig_asound
#define snd_seq_open_lconf snd_seq_open_lconf_dylibloader_orig_asound
#define snd_seq_name snd_seq_name_dylibloader_orig_asound
@@ -1284,9 +1276,8 @@
#define snd_midi_event_encode snd_midi_event_encode_dylibloader_orig_asound
#define snd_midi_event_encode_byte snd_midi_event_encode_byte_dylibloader_orig_asound
#define snd_midi_event_decode snd_midi_event_decode_dylibloader_orig_asound
-#include <alsa/asoundlib.h>
+#include "thirdparty/linuxbsd_headers/alsa/asoundlib.h"
#undef snd_asoundlib_version
-#undef snd_dlpath
#undef snd_dlopen
#undef snd_dlsym
#undef snd_dlclose
@@ -1320,7 +1311,6 @@
#undef snd_strerror
#undef snd_lib_error_set_handler
#undef snd_lib_error_set_local
-#undef snd_config_topdir
#undef snd_config_top
#undef snd_config_load
#undef snd_config_load_override
@@ -1338,9 +1328,6 @@
#undef snd_config_expand
#undef snd_config_evaluate
#undef snd_config_add
-#undef snd_config_add_before
-#undef snd_config_add_after
-#undef snd_config_remove
#undef snd_config_delete
#undef snd_config_delete_compound_members
#undef snd_config_copy
@@ -1358,7 +1345,6 @@
#undef snd_config_imake_safe_string
#undef snd_config_imake_pointer
#undef snd_config_get_type
-#undef snd_config_is_array
#undef snd_config_set_id
#undef snd_config_set_integer
#undef snd_config_set_integer64
@@ -1703,7 +1689,6 @@
#undef snd_pcm_areas_silence
#undef snd_pcm_area_copy
#undef snd_pcm_areas_copy
-#undef snd_pcm_areas_copy_wrap
#undef snd_pcm_hook_get_pcm
#undef snd_pcm_hook_get_private
#undef snd_pcm_hook_set_private
@@ -2295,7 +2280,6 @@
#undef snd_mixer_selem_id_get_index
#undef snd_mixer_selem_id_set_name
#undef snd_mixer_selem_id_set_index
-#undef snd_mixer_selem_id_parse
#undef snd_seq_open
#undef snd_seq_open_lconf
#undef snd_seq_name
@@ -2567,8 +2551,7 @@
#include <dlfcn.h>
#include <stdio.h>
const char* (*snd_asoundlib_version_dylibloader_wrapper_asound)( void);
-int (*snd_dlpath_dylibloader_wrapper_asound)( char*, size_t,const char*);
-void* (*snd_dlopen_dylibloader_wrapper_asound)(const char*, int, char*, size_t);
+void* (*snd_dlopen_dylibloader_wrapper_asound)(const char*, int);
void* (*snd_dlsym_dylibloader_wrapper_asound)( void*,const char*,const char*);
int (*snd_dlclose_dylibloader_wrapper_asound)( void*);
int (*snd_async_add_handler_dylibloader_wrapper_asound)( snd_async_handler_t**, int, snd_async_callback_t, void*);
@@ -2601,7 +2584,6 @@ int (*snd_output_flush_dylibloader_wrapper_asound)( snd_output_t*);
const char* (*snd_strerror_dylibloader_wrapper_asound)( int);
int (*snd_lib_error_set_handler_dylibloader_wrapper_asound)( snd_lib_error_handler_t);
snd_local_error_handler_t (*snd_lib_error_set_local_dylibloader_wrapper_asound)( snd_local_error_handler_t);
-const char* (*snd_config_topdir_dylibloader_wrapper_asound)( void);
int (*snd_config_top_dylibloader_wrapper_asound)( snd_config_t**);
int (*snd_config_load_dylibloader_wrapper_asound)( snd_config_t*, snd_input_t*);
int (*snd_config_load_override_dylibloader_wrapper_asound)( snd_config_t*, snd_input_t*);
@@ -2619,9 +2601,6 @@ int (*snd_config_search_definition_dylibloader_wrapper_asound)( snd_config_t*,co
int (*snd_config_expand_dylibloader_wrapper_asound)( snd_config_t*, snd_config_t*,const char*, snd_config_t*, snd_config_t**);
int (*snd_config_evaluate_dylibloader_wrapper_asound)( snd_config_t*, snd_config_t*, snd_config_t*, snd_config_t**);
int (*snd_config_add_dylibloader_wrapper_asound)( snd_config_t*, snd_config_t*);
-int (*snd_config_add_before_dylibloader_wrapper_asound)( snd_config_t*, snd_config_t*);
-int (*snd_config_add_after_dylibloader_wrapper_asound)( snd_config_t*, snd_config_t*);
-int (*snd_config_remove_dylibloader_wrapper_asound)( snd_config_t*);
int (*snd_config_delete_dylibloader_wrapper_asound)( snd_config_t*);
int (*snd_config_delete_compound_members_dylibloader_wrapper_asound)(const snd_config_t*);
int (*snd_config_copy_dylibloader_wrapper_asound)( snd_config_t**, snd_config_t*);
@@ -2639,7 +2618,6 @@ int (*snd_config_imake_string_dylibloader_wrapper_asound)( snd_config_t**,const
int (*snd_config_imake_safe_string_dylibloader_wrapper_asound)( snd_config_t**,const char*,const char*);
int (*snd_config_imake_pointer_dylibloader_wrapper_asound)( snd_config_t**,const char*,const void*);
snd_config_type_t (*snd_config_get_type_dylibloader_wrapper_asound)(const snd_config_t*);
-int (*snd_config_is_array_dylibloader_wrapper_asound)(const snd_config_t*);
int (*snd_config_set_id_dylibloader_wrapper_asound)( snd_config_t*,const char*);
int (*snd_config_set_integer_dylibloader_wrapper_asound)( snd_config_t*, long);
int (*snd_config_set_integer64_dylibloader_wrapper_asound)( snd_config_t*, long long);
@@ -2984,7 +2962,6 @@ int (*snd_pcm_area_silence_dylibloader_wrapper_asound)(const snd_pcm_channel_are
int (*snd_pcm_areas_silence_dylibloader_wrapper_asound)(const snd_pcm_channel_area_t*, snd_pcm_uframes_t, unsigned int, snd_pcm_uframes_t, snd_pcm_format_t);
int (*snd_pcm_area_copy_dylibloader_wrapper_asound)(const snd_pcm_channel_area_t*, snd_pcm_uframes_t,const snd_pcm_channel_area_t*, snd_pcm_uframes_t, unsigned int, snd_pcm_format_t);
int (*snd_pcm_areas_copy_dylibloader_wrapper_asound)(const snd_pcm_channel_area_t*, snd_pcm_uframes_t,const snd_pcm_channel_area_t*, snd_pcm_uframes_t, unsigned int, snd_pcm_uframes_t, snd_pcm_format_t);
-int (*snd_pcm_areas_copy_wrap_dylibloader_wrapper_asound)(const snd_pcm_channel_area_t*, snd_pcm_uframes_t,const snd_pcm_uframes_t,const snd_pcm_channel_area_t*, snd_pcm_uframes_t,const snd_pcm_uframes_t,const unsigned int, snd_pcm_uframes_t,const snd_pcm_format_t);
snd_pcm_t* (*snd_pcm_hook_get_pcm_dylibloader_wrapper_asound)( snd_pcm_hook_t*);
void* (*snd_pcm_hook_get_private_dylibloader_wrapper_asound)( snd_pcm_hook_t*);
void (*snd_pcm_hook_set_private_dylibloader_wrapper_asound)( snd_pcm_hook_t*, void*);
@@ -3576,7 +3553,6 @@ const char* (*snd_mixer_selem_id_get_name_dylibloader_wrapper_asound)(const snd_
unsigned int (*snd_mixer_selem_id_get_index_dylibloader_wrapper_asound)(const snd_mixer_selem_id_t*);
void (*snd_mixer_selem_id_set_name_dylibloader_wrapper_asound)( snd_mixer_selem_id_t*,const char*);
void (*snd_mixer_selem_id_set_index_dylibloader_wrapper_asound)( snd_mixer_selem_id_t*, unsigned int);
-int (*snd_mixer_selem_id_parse_dylibloader_wrapper_asound)( snd_mixer_selem_id_t*,const char*);
int (*snd_seq_open_dylibloader_wrapper_asound)( snd_seq_t**,const char*, int, int);
int (*snd_seq_open_lconf_dylibloader_wrapper_asound)( snd_seq_t**,const char*, int, int, snd_config_t*);
const char* (*snd_seq_name_dylibloader_wrapper_asound)( snd_seq_t*);
@@ -3864,14 +3840,6 @@ int initialize_asound(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// snd_dlpath
- *(void **) (&snd_dlpath_dylibloader_wrapper_asound) = dlsym(handle, "snd_dlpath");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// snd_dlopen
*(void **) (&snd_dlopen_dylibloader_wrapper_asound) = dlsym(handle, "snd_dlopen");
if (verbose) {
@@ -4136,14 +4104,6 @@ int initialize_asound(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// snd_config_topdir
- *(void **) (&snd_config_topdir_dylibloader_wrapper_asound) = dlsym(handle, "snd_config_topdir");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// snd_config_top
*(void **) (&snd_config_top_dylibloader_wrapper_asound) = dlsym(handle, "snd_config_top");
if (verbose) {
@@ -4280,30 +4240,6 @@ int initialize_asound(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// snd_config_add_before
- *(void **) (&snd_config_add_before_dylibloader_wrapper_asound) = dlsym(handle, "snd_config_add_before");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// snd_config_add_after
- *(void **) (&snd_config_add_after_dylibloader_wrapper_asound) = dlsym(handle, "snd_config_add_after");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// snd_config_remove
- *(void **) (&snd_config_remove_dylibloader_wrapper_asound) = dlsym(handle, "snd_config_remove");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// snd_config_delete
*(void **) (&snd_config_delete_dylibloader_wrapper_asound) = dlsym(handle, "snd_config_delete");
if (verbose) {
@@ -4440,14 +4376,6 @@ int initialize_asound(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// snd_config_is_array
- *(void **) (&snd_config_is_array_dylibloader_wrapper_asound) = dlsym(handle, "snd_config_is_array");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// snd_config_set_id
*(void **) (&snd_config_set_id_dylibloader_wrapper_asound) = dlsym(handle, "snd_config_set_id");
if (verbose) {
@@ -7200,14 +7128,6 @@ int initialize_asound(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// snd_pcm_areas_copy_wrap
- *(void **) (&snd_pcm_areas_copy_wrap_dylibloader_wrapper_asound) = dlsym(handle, "snd_pcm_areas_copy_wrap");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// snd_pcm_hook_get_pcm
*(void **) (&snd_pcm_hook_get_pcm_dylibloader_wrapper_asound) = dlsym(handle, "snd_pcm_hook_get_pcm");
if (verbose) {
@@ -11936,14 +11856,6 @@ int initialize_asound(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// snd_mixer_selem_id_parse
- *(void **) (&snd_mixer_selem_id_parse_dylibloader_wrapper_asound) = dlsym(handle, "snd_mixer_selem_id_parse");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// snd_seq_open
*(void **) (&snd_seq_open_dylibloader_wrapper_asound) = dlsym(handle, "snd_seq_open");
if (verbose) {
diff --git a/drivers/alsa/asound-so_wrap.h b/drivers/alsa/asound-so_wrap.h
index 5332d74152..8d12d15ba8 100644
--- a/drivers/alsa/asound-so_wrap.h
+++ b/drivers/alsa/asound-so_wrap.h
@@ -2,13 +2,12 @@
#define DYLIBLOAD_WRAPPER_ASOUND
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by /home/hp/Projects/godot/pulse/generate-wrapper.py 0.3 on 2021-02-22 19:22:12
-// flags: /home/hp/Projects/godot/pulse/generate-wrapper.py --include /usr/include/alsa/asoundlib.h --sys-include <alsa/asoundlib.h> --soname libasound.so.2 --init-name asound --omit-prefix snd_pcm_sw_params_set_tstamp_type --omit-prefix snd_pcm_status_get_audio_htstamp_report --omit-prefix snd_pcm_sw_params_get_tstamp_type --omit-prefix snd_pcm_status_set_audio_htstamp_config --output-header asound-so_wrap.h --output-implementation asound-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-12 10:26:13
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/alsa/asoundlib.h --sys-include "thirdparty/linuxbsd_headers/alsa/asoundlib.h" --soname libasound.so.2 --init-name asound --omit-prefix snd_pcm_sw_params_set_tstamp_type --omit-prefix snd_pcm_status_get_audio_htstamp_report --omit-prefix snd_pcm_sw_params_get_tstamp_type --omit-prefix snd_pcm_status_set_audio_htstamp_config --output-header ./drivers/alsa/asound-so_wrap.h --output-implementation ./drivers/alsa/asound-so_wrap.c
//
#include <stdint.h>
#define snd_asoundlib_version snd_asoundlib_version_dylibloader_orig_asound
-#define snd_dlpath snd_dlpath_dylibloader_orig_asound
#define snd_dlopen snd_dlopen_dylibloader_orig_asound
#define snd_dlsym snd_dlsym_dylibloader_orig_asound
#define snd_dlclose snd_dlclose_dylibloader_orig_asound
@@ -42,7 +41,6 @@
#define snd_strerror snd_strerror_dylibloader_orig_asound
#define snd_lib_error_set_handler snd_lib_error_set_handler_dylibloader_orig_asound
#define snd_lib_error_set_local snd_lib_error_set_local_dylibloader_orig_asound
-#define snd_config_topdir snd_config_topdir_dylibloader_orig_asound
#define snd_config_top snd_config_top_dylibloader_orig_asound
#define snd_config_load snd_config_load_dylibloader_orig_asound
#define snd_config_load_override snd_config_load_override_dylibloader_orig_asound
@@ -60,9 +58,6 @@
#define snd_config_expand snd_config_expand_dylibloader_orig_asound
#define snd_config_evaluate snd_config_evaluate_dylibloader_orig_asound
#define snd_config_add snd_config_add_dylibloader_orig_asound
-#define snd_config_add_before snd_config_add_before_dylibloader_orig_asound
-#define snd_config_add_after snd_config_add_after_dylibloader_orig_asound
-#define snd_config_remove snd_config_remove_dylibloader_orig_asound
#define snd_config_delete snd_config_delete_dylibloader_orig_asound
#define snd_config_delete_compound_members snd_config_delete_compound_members_dylibloader_orig_asound
#define snd_config_copy snd_config_copy_dylibloader_orig_asound
@@ -80,7 +75,6 @@
#define snd_config_imake_safe_string snd_config_imake_safe_string_dylibloader_orig_asound
#define snd_config_imake_pointer snd_config_imake_pointer_dylibloader_orig_asound
#define snd_config_get_type snd_config_get_type_dylibloader_orig_asound
-#define snd_config_is_array snd_config_is_array_dylibloader_orig_asound
#define snd_config_set_id snd_config_set_id_dylibloader_orig_asound
#define snd_config_set_integer snd_config_set_integer_dylibloader_orig_asound
#define snd_config_set_integer64 snd_config_set_integer64_dylibloader_orig_asound
@@ -425,7 +419,6 @@
#define snd_pcm_areas_silence snd_pcm_areas_silence_dylibloader_orig_asound
#define snd_pcm_area_copy snd_pcm_area_copy_dylibloader_orig_asound
#define snd_pcm_areas_copy snd_pcm_areas_copy_dylibloader_orig_asound
-#define snd_pcm_areas_copy_wrap snd_pcm_areas_copy_wrap_dylibloader_orig_asound
#define snd_pcm_hook_get_pcm snd_pcm_hook_get_pcm_dylibloader_orig_asound
#define snd_pcm_hook_get_private snd_pcm_hook_get_private_dylibloader_orig_asound
#define snd_pcm_hook_set_private snd_pcm_hook_set_private_dylibloader_orig_asound
@@ -1017,7 +1010,6 @@
#define snd_mixer_selem_id_get_index snd_mixer_selem_id_get_index_dylibloader_orig_asound
#define snd_mixer_selem_id_set_name snd_mixer_selem_id_set_name_dylibloader_orig_asound
#define snd_mixer_selem_id_set_index snd_mixer_selem_id_set_index_dylibloader_orig_asound
-#define snd_mixer_selem_id_parse snd_mixer_selem_id_parse_dylibloader_orig_asound
#define snd_seq_open snd_seq_open_dylibloader_orig_asound
#define snd_seq_open_lconf snd_seq_open_lconf_dylibloader_orig_asound
#define snd_seq_name snd_seq_name_dylibloader_orig_asound
@@ -1286,9 +1278,8 @@
#define snd_midi_event_encode snd_midi_event_encode_dylibloader_orig_asound
#define snd_midi_event_encode_byte snd_midi_event_encode_byte_dylibloader_orig_asound
#define snd_midi_event_decode snd_midi_event_decode_dylibloader_orig_asound
-#include <alsa/asoundlib.h>
+#include "thirdparty/linuxbsd_headers/alsa/asoundlib.h"
#undef snd_asoundlib_version
-#undef snd_dlpath
#undef snd_dlopen
#undef snd_dlsym
#undef snd_dlclose
@@ -1322,7 +1313,6 @@
#undef snd_strerror
#undef snd_lib_error_set_handler
#undef snd_lib_error_set_local
-#undef snd_config_topdir
#undef snd_config_top
#undef snd_config_load
#undef snd_config_load_override
@@ -1340,9 +1330,6 @@
#undef snd_config_expand
#undef snd_config_evaluate
#undef snd_config_add
-#undef snd_config_add_before
-#undef snd_config_add_after
-#undef snd_config_remove
#undef snd_config_delete
#undef snd_config_delete_compound_members
#undef snd_config_copy
@@ -1360,7 +1347,6 @@
#undef snd_config_imake_safe_string
#undef snd_config_imake_pointer
#undef snd_config_get_type
-#undef snd_config_is_array
#undef snd_config_set_id
#undef snd_config_set_integer
#undef snd_config_set_integer64
@@ -1705,7 +1691,6 @@
#undef snd_pcm_areas_silence
#undef snd_pcm_area_copy
#undef snd_pcm_areas_copy
-#undef snd_pcm_areas_copy_wrap
#undef snd_pcm_hook_get_pcm
#undef snd_pcm_hook_get_private
#undef snd_pcm_hook_set_private
@@ -2297,7 +2282,6 @@
#undef snd_mixer_selem_id_get_index
#undef snd_mixer_selem_id_set_name
#undef snd_mixer_selem_id_set_index
-#undef snd_mixer_selem_id_parse
#undef snd_seq_open
#undef snd_seq_open_lconf
#undef snd_seq_name
@@ -2570,7 +2554,6 @@
extern "C" {
#endif
#define snd_asoundlib_version snd_asoundlib_version_dylibloader_wrapper_asound
-#define snd_dlpath snd_dlpath_dylibloader_wrapper_asound
#define snd_dlopen snd_dlopen_dylibloader_wrapper_asound
#define snd_dlsym snd_dlsym_dylibloader_wrapper_asound
#define snd_dlclose snd_dlclose_dylibloader_wrapper_asound
@@ -2604,7 +2587,6 @@ extern "C" {
#define snd_strerror snd_strerror_dylibloader_wrapper_asound
#define snd_lib_error_set_handler snd_lib_error_set_handler_dylibloader_wrapper_asound
#define snd_lib_error_set_local snd_lib_error_set_local_dylibloader_wrapper_asound
-#define snd_config_topdir snd_config_topdir_dylibloader_wrapper_asound
#define snd_config_top snd_config_top_dylibloader_wrapper_asound
#define snd_config_load snd_config_load_dylibloader_wrapper_asound
#define snd_config_load_override snd_config_load_override_dylibloader_wrapper_asound
@@ -2622,9 +2604,6 @@ extern "C" {
#define snd_config_expand snd_config_expand_dylibloader_wrapper_asound
#define snd_config_evaluate snd_config_evaluate_dylibloader_wrapper_asound
#define snd_config_add snd_config_add_dylibloader_wrapper_asound
-#define snd_config_add_before snd_config_add_before_dylibloader_wrapper_asound
-#define snd_config_add_after snd_config_add_after_dylibloader_wrapper_asound
-#define snd_config_remove snd_config_remove_dylibloader_wrapper_asound
#define snd_config_delete snd_config_delete_dylibloader_wrapper_asound
#define snd_config_delete_compound_members snd_config_delete_compound_members_dylibloader_wrapper_asound
#define snd_config_copy snd_config_copy_dylibloader_wrapper_asound
@@ -2642,7 +2621,6 @@ extern "C" {
#define snd_config_imake_safe_string snd_config_imake_safe_string_dylibloader_wrapper_asound
#define snd_config_imake_pointer snd_config_imake_pointer_dylibloader_wrapper_asound
#define snd_config_get_type snd_config_get_type_dylibloader_wrapper_asound
-#define snd_config_is_array snd_config_is_array_dylibloader_wrapper_asound
#define snd_config_set_id snd_config_set_id_dylibloader_wrapper_asound
#define snd_config_set_integer snd_config_set_integer_dylibloader_wrapper_asound
#define snd_config_set_integer64 snd_config_set_integer64_dylibloader_wrapper_asound
@@ -2987,7 +2965,6 @@ extern "C" {
#define snd_pcm_areas_silence snd_pcm_areas_silence_dylibloader_wrapper_asound
#define snd_pcm_area_copy snd_pcm_area_copy_dylibloader_wrapper_asound
#define snd_pcm_areas_copy snd_pcm_areas_copy_dylibloader_wrapper_asound
-#define snd_pcm_areas_copy_wrap snd_pcm_areas_copy_wrap_dylibloader_wrapper_asound
#define snd_pcm_hook_get_pcm snd_pcm_hook_get_pcm_dylibloader_wrapper_asound
#define snd_pcm_hook_get_private snd_pcm_hook_get_private_dylibloader_wrapper_asound
#define snd_pcm_hook_set_private snd_pcm_hook_set_private_dylibloader_wrapper_asound
@@ -3579,7 +3556,6 @@ extern "C" {
#define snd_mixer_selem_id_get_index snd_mixer_selem_id_get_index_dylibloader_wrapper_asound
#define snd_mixer_selem_id_set_name snd_mixer_selem_id_set_name_dylibloader_wrapper_asound
#define snd_mixer_selem_id_set_index snd_mixer_selem_id_set_index_dylibloader_wrapper_asound
-#define snd_mixer_selem_id_parse snd_mixer_selem_id_parse_dylibloader_wrapper_asound
#define snd_seq_open snd_seq_open_dylibloader_wrapper_asound
#define snd_seq_open_lconf snd_seq_open_lconf_dylibloader_wrapper_asound
#define snd_seq_name snd_seq_name_dylibloader_wrapper_asound
@@ -3849,8 +3825,7 @@ extern "C" {
#define snd_midi_event_encode_byte snd_midi_event_encode_byte_dylibloader_wrapper_asound
#define snd_midi_event_decode snd_midi_event_decode_dylibloader_wrapper_asound
extern const char* (*snd_asoundlib_version_dylibloader_wrapper_asound)( void);
-extern int (*snd_dlpath_dylibloader_wrapper_asound)( char*, size_t,const char*);
-extern void* (*snd_dlopen_dylibloader_wrapper_asound)(const char*, int, char*, size_t);
+extern void* (*snd_dlopen_dylibloader_wrapper_asound)(const char*, int);
extern void* (*snd_dlsym_dylibloader_wrapper_asound)( void*,const char*,const char*);
extern int (*snd_dlclose_dylibloader_wrapper_asound)( void*);
extern int (*snd_async_add_handler_dylibloader_wrapper_asound)( snd_async_handler_t**, int, snd_async_callback_t, void*);
@@ -3883,7 +3858,6 @@ extern int (*snd_output_flush_dylibloader_wrapper_asound)( snd_output_t*);
extern const char* (*snd_strerror_dylibloader_wrapper_asound)( int);
extern int (*snd_lib_error_set_handler_dylibloader_wrapper_asound)( snd_lib_error_handler_t);
extern snd_local_error_handler_t (*snd_lib_error_set_local_dylibloader_wrapper_asound)( snd_local_error_handler_t);
-extern const char* (*snd_config_topdir_dylibloader_wrapper_asound)( void);
extern int (*snd_config_top_dylibloader_wrapper_asound)( snd_config_t**);
extern int (*snd_config_load_dylibloader_wrapper_asound)( snd_config_t*, snd_input_t*);
extern int (*snd_config_load_override_dylibloader_wrapper_asound)( snd_config_t*, snd_input_t*);
@@ -3901,9 +3875,6 @@ extern int (*snd_config_search_definition_dylibloader_wrapper_asound)( snd_confi
extern int (*snd_config_expand_dylibloader_wrapper_asound)( snd_config_t*, snd_config_t*,const char*, snd_config_t*, snd_config_t**);
extern int (*snd_config_evaluate_dylibloader_wrapper_asound)( snd_config_t*, snd_config_t*, snd_config_t*, snd_config_t**);
extern int (*snd_config_add_dylibloader_wrapper_asound)( snd_config_t*, snd_config_t*);
-extern int (*snd_config_add_before_dylibloader_wrapper_asound)( snd_config_t*, snd_config_t*);
-extern int (*snd_config_add_after_dylibloader_wrapper_asound)( snd_config_t*, snd_config_t*);
-extern int (*snd_config_remove_dylibloader_wrapper_asound)( snd_config_t*);
extern int (*snd_config_delete_dylibloader_wrapper_asound)( snd_config_t*);
extern int (*snd_config_delete_compound_members_dylibloader_wrapper_asound)(const snd_config_t*);
extern int (*snd_config_copy_dylibloader_wrapper_asound)( snd_config_t**, snd_config_t*);
@@ -3921,7 +3892,6 @@ extern int (*snd_config_imake_string_dylibloader_wrapper_asound)( snd_config_t**
extern int (*snd_config_imake_safe_string_dylibloader_wrapper_asound)( snd_config_t**,const char*,const char*);
extern int (*snd_config_imake_pointer_dylibloader_wrapper_asound)( snd_config_t**,const char*,const void*);
extern snd_config_type_t (*snd_config_get_type_dylibloader_wrapper_asound)(const snd_config_t*);
-extern int (*snd_config_is_array_dylibloader_wrapper_asound)(const snd_config_t*);
extern int (*snd_config_set_id_dylibloader_wrapper_asound)( snd_config_t*,const char*);
extern int (*snd_config_set_integer_dylibloader_wrapper_asound)( snd_config_t*, long);
extern int (*snd_config_set_integer64_dylibloader_wrapper_asound)( snd_config_t*, long long);
@@ -4266,7 +4236,6 @@ extern int (*snd_pcm_area_silence_dylibloader_wrapper_asound)(const snd_pcm_chan
extern int (*snd_pcm_areas_silence_dylibloader_wrapper_asound)(const snd_pcm_channel_area_t*, snd_pcm_uframes_t, unsigned int, snd_pcm_uframes_t, snd_pcm_format_t);
extern int (*snd_pcm_area_copy_dylibloader_wrapper_asound)(const snd_pcm_channel_area_t*, snd_pcm_uframes_t,const snd_pcm_channel_area_t*, snd_pcm_uframes_t, unsigned int, snd_pcm_format_t);
extern int (*snd_pcm_areas_copy_dylibloader_wrapper_asound)(const snd_pcm_channel_area_t*, snd_pcm_uframes_t,const snd_pcm_channel_area_t*, snd_pcm_uframes_t, unsigned int, snd_pcm_uframes_t, snd_pcm_format_t);
-extern int (*snd_pcm_areas_copy_wrap_dylibloader_wrapper_asound)(const snd_pcm_channel_area_t*, snd_pcm_uframes_t,const snd_pcm_uframes_t,const snd_pcm_channel_area_t*, snd_pcm_uframes_t,const snd_pcm_uframes_t,const unsigned int, snd_pcm_uframes_t,const snd_pcm_format_t);
extern snd_pcm_t* (*snd_pcm_hook_get_pcm_dylibloader_wrapper_asound)( snd_pcm_hook_t*);
extern void* (*snd_pcm_hook_get_private_dylibloader_wrapper_asound)( snd_pcm_hook_t*);
extern void (*snd_pcm_hook_set_private_dylibloader_wrapper_asound)( snd_pcm_hook_t*, void*);
@@ -4858,7 +4827,6 @@ extern const char* (*snd_mixer_selem_id_get_name_dylibloader_wrapper_asound)(con
extern unsigned int (*snd_mixer_selem_id_get_index_dylibloader_wrapper_asound)(const snd_mixer_selem_id_t*);
extern void (*snd_mixer_selem_id_set_name_dylibloader_wrapper_asound)( snd_mixer_selem_id_t*,const char*);
extern void (*snd_mixer_selem_id_set_index_dylibloader_wrapper_asound)( snd_mixer_selem_id_t*, unsigned int);
-extern int (*snd_mixer_selem_id_parse_dylibloader_wrapper_asound)( snd_mixer_selem_id_t*,const char*);
extern int (*snd_seq_open_dylibloader_wrapper_asound)( snd_seq_t**,const char*, int, int);
extern int (*snd_seq_open_lconf_dylibloader_wrapper_asound)( snd_seq_t**,const char*, int, int, snd_config_t*);
extern const char* (*snd_seq_name_dylibloader_wrapper_asound)( snd_seq_t*);
diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp
index 966a09c6c2..e9eb11e2e3 100644
--- a/drivers/coreaudio/audio_driver_coreaudio.cpp
+++ b/drivers/coreaudio/audio_driver_coreaudio.cpp
@@ -283,7 +283,7 @@ void AudioDriverCoreAudio::unlock() {
}
bool AudioDriverCoreAudio::try_lock() {
- return mutex.try_lock() == OK;
+ return mutex.try_lock();
}
void AudioDriverCoreAudio::finish() {
@@ -632,7 +632,7 @@ void AudioDriverCoreAudio::_set_device(const String &device, bool capture) {
ERR_FAIL_COND(result != noErr);
if (capture) {
- // Reset audio input to keep synchronisation.
+ // Reset audio input to keep synchronization.
input_position = 0;
input_size = 0;
}
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index fb338b9849..7f381b3f3e 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -113,16 +113,19 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
// Clear out any state that may have been left from the 3D pass.
reset_canvas();
- if (state.canvas_instance_data_buffers[state.current_buffer].fence != GLsync()) {
+ if (state.canvas_instance_data_buffers[state.current_data_buffer_index].fence != GLsync()) {
GLint syncStatus;
- glGetSynciv(state.canvas_instance_data_buffers[state.current_buffer].fence, GL_SYNC_STATUS, sizeof(GLint), nullptr, &syncStatus);
+ glGetSynciv(state.canvas_instance_data_buffers[state.current_data_buffer_index].fence, GL_SYNC_STATUS, sizeof(GLint), nullptr, &syncStatus);
if (syncStatus == GL_UNSIGNALED) {
// If older than 2 frames, wait for sync OpenGL can have up to 3 frames in flight, any more and we need to sync anyway.
- if (state.canvas_instance_data_buffers[state.current_buffer].last_frame_used < RSG::rasterizer->get_frame_number() - 2) {
+ if (state.canvas_instance_data_buffers[state.current_data_buffer_index].last_frame_used < RSG::rasterizer->get_frame_number() - 2) {
#ifndef WEB_ENABLED
// On web, we do nothing as the glSubBufferData will force a sync anyway and WebGL does not like waiting.
- glClientWaitSync(state.canvas_instance_data_buffers[state.current_buffer].fence, 0, 100000000); // wait for up to 100ms
+ glClientWaitSync(state.canvas_instance_data_buffers[state.current_data_buffer_index].fence, 0, 100000000); // wait for up to 100ms
#endif
+ state.canvas_instance_data_buffers[state.current_data_buffer_index].last_frame_used = RSG::rasterizer->get_frame_number();
+ glDeleteSync(state.canvas_instance_data_buffers[state.current_data_buffer_index].fence);
+ state.canvas_instance_data_buffers[state.current_data_buffer_index].fence = GLsync();
} else {
// Used in last frame or frame before that. OpenGL can get up to two frames behind, so these buffers may still be in use
// Allocate a new buffer and use that.
@@ -130,9 +133,9 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
}
} else {
// Already finished all rendering commands, we can use it.
- state.canvas_instance_data_buffers[state.current_buffer].last_frame_used = RSG::rasterizer->get_frame_number();
- glDeleteSync(state.canvas_instance_data_buffers[state.current_buffer].fence);
- state.canvas_instance_data_buffers[state.current_buffer].fence = GLsync();
+ state.canvas_instance_data_buffers[state.current_data_buffer_index].last_frame_used = RSG::rasterizer->get_frame_number();
+ glDeleteSync(state.canvas_instance_data_buffers[state.current_data_buffer_index].fence);
+ state.canvas_instance_data_buffers[state.current_data_buffer_index].fence = GLsync();
}
}
@@ -279,7 +282,7 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
}
if (light_count > 0) {
- glBindBufferBase(GL_UNIFORM_BUFFER, LIGHT_UNIFORM_LOCATION, state.canvas_instance_data_buffers[state.current_buffer].light_ubo);
+ glBindBufferBase(GL_UNIFORM_BUFFER, LIGHT_UNIFORM_LOCATION, state.canvas_instance_data_buffers[state.current_data_buffer_index].light_ubo);
#ifdef WEB_ENABLED
glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(LightUniform) * light_count, state.light_uniforms);
@@ -361,7 +364,7 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
state_buffer.tex_to_sdf = 1.0 / ((canvas_scale.x + canvas_scale.y) * 0.5);
- glBindBufferBase(GL_UNIFORM_BUFFER, BASE_UNIFORM_LOCATION, state.canvas_instance_data_buffers[state.current_buffer].state_ubo);
+ glBindBufferBase(GL_UNIFORM_BUFFER, BASE_UNIFORM_LOCATION, state.canvas_instance_data_buffers[state.current_data_buffer_index].state_ubo);
glBufferData(GL_UNIFORM_BUFFER, sizeof(StateBuffer), &state_buffer, GL_STREAM_DRAW);
GLuint global_buffer = material_storage->global_shader_parameters_get_uniform_buffer();
@@ -395,7 +398,7 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
Item *ci = p_item_list;
Item *canvas_group_owner = nullptr;
- uint32_t starting_index = 0;
+ state.last_item_index = 0;
while (ci) {
if (ci->copy_back_buffer && canvas_group_owner == nullptr) {
@@ -440,6 +443,7 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
const Item::CommandMesh *cm = static_cast<const Item::CommandMesh *>(c);
if (cm->mesh_instance.is_valid()) {
mesh_storage->mesh_instance_check_for_update(cm->mesh_instance);
+ mesh_storage->mesh_instance_set_canvas_item_transform(cm->mesh_instance, canvas_transform_inverse * ci->final_transform);
update_skeletons = true;
}
}
@@ -454,7 +458,7 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
update_skeletons = false;
}
// Canvas group begins here, render until before this item
- _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, starting_index, r_sdf_used);
+ _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, r_sdf_used);
item_count = 0;
if (ci->canvas_group_owner->canvas_group->mode != RS::CANVAS_GROUP_MODE_TRANSPARENT) {
@@ -485,7 +489,7 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
mesh_storage->update_mesh_instances();
update_skeletons = false;
}
- _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, starting_index, r_sdf_used, true);
+ _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, r_sdf_used, true);
item_count = 0;
if (ci->canvas_group->blur_mipmaps) {
@@ -504,7 +508,7 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
}
//render anything pending, including clearing if no items
- _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, starting_index, r_sdf_used);
+ _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, r_sdf_used);
item_count = 0;
texture_storage->render_target_copy_to_back_buffer(p_to_render_target, back_buffer_rect, backbuffer_gen_mipmaps);
@@ -530,7 +534,7 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
mesh_storage->update_mesh_instances();
update_skeletons = false;
}
- _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, starting_index, r_sdf_used);
+ _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, r_sdf_used);
//then reset
item_count = 0;
}
@@ -542,14 +546,15 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
RenderingServerDefault::redraw_request();
}
- state.canvas_instance_data_buffers[state.current_buffer].fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+ state.canvas_instance_data_buffers[state.current_data_buffer_index].fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
// Clear out state used in 2D pass
reset_canvas();
- state.current_buffer = (state.current_buffer + 1) % state.canvas_instance_data_buffers.size();
+ state.current_data_buffer_index = (state.current_data_buffer_index + 1) % state.canvas_instance_data_buffers.size();
+ state.current_instance_buffer_index = 0;
}
-void RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_count, const Transform2D &p_canvas_transform_inverse, Light *p_lights, uint32_t &r_last_index, bool &r_sdf_used, bool p_to_backbuffer) {
+void RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_count, const Transform2D &p_canvas_transform_inverse, Light *p_lights, bool &r_sdf_used, bool p_to_backbuffer) {
GLES3::MaterialStorage *material_storage = GLES3::MaterialStorage::get_singleton();
canvas_begin(p_to_render_target, p_to_backbuffer);
@@ -565,17 +570,17 @@ void RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_cou
// Record Batches.
// First item always forms its own batch.
bool batch_broken = false;
- _new_batch(batch_broken, index);
+ _new_batch(batch_broken);
// Override the start position and index as we want to start from where we finished off last time.
- state.canvas_instance_batches[state.current_batch_index].start = r_last_index;
+ state.canvas_instance_batches[state.current_batch_index].start = state.last_item_index;
index = 0;
for (int i = 0; i < p_item_count; i++) {
Item *ci = items[i];
if (ci->final_clip_owner != state.canvas_instance_batches[state.current_batch_index].clip) {
- _new_batch(batch_broken, index);
+ _new_batch(batch_broken);
state.canvas_instance_batches[state.current_batch_index].clip = ci->final_clip_owner;
current_clip = ci->final_clip_owner;
}
@@ -599,7 +604,7 @@ void RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_cou
GLES3::CanvasShaderData *shader_data_cache = nullptr;
if (material != state.canvas_instance_batches[state.current_batch_index].material) {
- _new_batch(batch_broken, index);
+ _new_batch(batch_broken);
GLES3::CanvasMaterialData *material_data = nullptr;
if (material.is_valid()) {
@@ -629,12 +634,12 @@ void RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_cou
}
// Copy over all data needed for rendering.
- glBindBuffer(GL_ARRAY_BUFFER, state.canvas_instance_data_buffers[state.current_buffer].buffer);
+ glBindBuffer(GL_ARRAY_BUFFER, state.canvas_instance_data_buffers[state.current_data_buffer_index].instance_buffers[state.current_instance_buffer_index]);
#ifdef WEB_ENABLED
- glBufferSubData(GL_ARRAY_BUFFER, r_last_index * sizeof(InstanceData), sizeof(InstanceData) * index, state.instance_data_array);
+ glBufferSubData(GL_ARRAY_BUFFER, state.last_item_index * sizeof(InstanceData), sizeof(InstanceData) * index, state.instance_data_array);
#else
// On Desktop and mobile we map the memory without synchronizing for maximum speed.
- void *buffer = glMapBufferRange(GL_ARRAY_BUFFER, r_last_index * sizeof(InstanceData), index * sizeof(InstanceData), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
+ void *buffer = glMapBufferRange(GL_ARRAY_BUFFER, state.last_item_index * sizeof(InstanceData), index * sizeof(InstanceData), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
memcpy(buffer, state.instance_data_array, index * sizeof(InstanceData));
glUnmapBuffer(GL_ARRAY_BUFFER);
#endif
@@ -757,14 +762,14 @@ void RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_cou
state.current_batch_index = 0;
state.canvas_instance_batches.clear();
- r_last_index += index;
+ state.last_item_index += index;
}
void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_render_target, const Transform2D &p_canvas_transform_inverse, Item *&current_clip, GLES3::CanvasShaderData::BlendMode p_blend_mode, Light *p_lights, uint32_t &r_index, bool &r_batch_broken, bool &r_sdf_used) {
RenderingServer::CanvasItemTextureFilter texture_filter = p_item->texture_filter == RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT ? state.default_filter : p_item->texture_filter;
if (texture_filter != state.canvas_instance_batches[state.current_batch_index].filter) {
- _new_batch(r_batch_broken, r_index);
+ _new_batch(r_batch_broken);
state.canvas_instance_batches[state.current_batch_index].filter = texture_filter;
}
@@ -772,7 +777,7 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend
RenderingServer::CanvasItemTextureRepeat texture_repeat = p_item->texture_repeat == RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT ? state.default_repeat : p_item->texture_repeat;
if (texture_repeat != state.canvas_instance_batches[state.current_batch_index].repeat) {
- _new_batch(r_batch_broken, r_index);
+ _new_batch(r_batch_broken);
state.canvas_instance_batches[state.current_batch_index].repeat = texture_repeat;
}
@@ -803,7 +808,7 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend
light_count++;
- if (light_count == data.max_lights_per_item) {
+ if (light_count == data.max_lights_per_item - 1) {
break;
}
}
@@ -816,7 +821,7 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend
bool lights_disabled = light_count == 0 && !state.using_directional_lights;
if (lights_disabled != state.canvas_instance_batches[state.current_batch_index].lights_disabled) {
- _new_batch(r_batch_broken, r_index);
+ _new_batch(r_batch_broken);
state.canvas_instance_batches[state.current_batch_index].lights_disabled = lights_disabled;
}
@@ -853,18 +858,19 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend
state.instance_data_array[r_index].flags = base_flags | (state.instance_data_array[r_index == 0 ? 0 : r_index - 1].flags & (FLAGS_DEFAULT_NORMAL_MAP_USED | FLAGS_DEFAULT_SPECULAR_MAP_USED)); //reset on each command for sanity, keep canvastexture binding config
- Color blend_color;
+ Color blend_color = base_color;
+ GLES3::CanvasShaderData::BlendMode blend_mode = p_blend_mode;
if (c->type == Item::Command::TYPE_RECT) {
const Item::CommandRect *rect = static_cast<const Item::CommandRect *>(c);
if (rect->flags & CANVAS_RECT_LCD) {
- p_blend_mode = GLES3::CanvasShaderData::BLEND_MODE_LCD;
+ blend_mode = GLES3::CanvasShaderData::BLEND_MODE_LCD;
blend_color = rect->modulate * base_color;
}
}
- if (p_blend_mode != state.canvas_instance_batches[state.current_batch_index].blend_mode || blend_color != state.canvas_instance_batches[state.current_batch_index].blend_color) {
- _new_batch(r_batch_broken, r_index);
- state.canvas_instance_batches[state.current_batch_index].blend_mode = p_blend_mode;
+ if (blend_mode != state.canvas_instance_batches[state.current_batch_index].blend_mode || blend_color != state.canvas_instance_batches[state.current_batch_index].blend_color) {
+ _new_batch(r_batch_broken);
+ state.canvas_instance_batches[state.current_batch_index].blend_mode = blend_mode;
state.canvas_instance_batches[state.current_batch_index].blend_color = blend_color;
}
@@ -873,12 +879,12 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend
const Item::CommandRect *rect = static_cast<const Item::CommandRect *>(c);
if (rect->flags & CANVAS_RECT_TILE && state.canvas_instance_batches[state.current_batch_index].repeat != RenderingServer::CanvasItemTextureRepeat::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED) {
- _new_batch(r_batch_broken, r_index);
+ _new_batch(r_batch_broken);
state.canvas_instance_batches[state.current_batch_index].repeat = RenderingServer::CanvasItemTextureRepeat::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED;
}
if (rect->texture != state.canvas_instance_batches[state.current_batch_index].tex || state.canvas_instance_batches[state.current_batch_index].command_type != Item::Command::TYPE_RECT) {
- _new_batch(r_batch_broken, r_index);
+ _new_batch(r_batch_broken);
state.canvas_instance_batches[state.current_batch_index].tex = rect->texture;
state.canvas_instance_batches[state.current_batch_index].command_type = Item::Command::TYPE_RECT;
state.canvas_instance_batches[state.current_batch_index].command = c;
@@ -968,7 +974,7 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend
const Item::CommandNinePatch *np = static_cast<const Item::CommandNinePatch *>(c);
if (np->texture != state.canvas_instance_batches[state.current_batch_index].tex || state.canvas_instance_batches[state.current_batch_index].command_type != Item::Command::TYPE_NINEPATCH) {
- _new_batch(r_batch_broken, r_index);
+ _new_batch(r_batch_broken);
state.canvas_instance_batches[state.current_batch_index].tex = np->texture;
state.canvas_instance_batches[state.current_batch_index].command_type = Item::Command::TYPE_NINEPATCH;
state.canvas_instance_batches[state.current_batch_index].command = c;
@@ -1033,7 +1039,7 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend
const Item::CommandPolygon *polygon = static_cast<const Item::CommandPolygon *>(c);
// Polygon's can't be batched, so always create a new batch
- _new_batch(r_batch_broken, r_index);
+ _new_batch(r_batch_broken);
state.canvas_instance_batches[state.current_batch_index].tex = polygon->texture;
state.canvas_instance_batches[state.current_batch_index].command_type = Item::Command::TYPE_POLYGON;
@@ -1060,7 +1066,7 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend
const Item::CommandPrimitive *primitive = static_cast<const Item::CommandPrimitive *>(c);
if (primitive->point_count != state.canvas_instance_batches[state.current_batch_index].primitive_points || state.canvas_instance_batches[state.current_batch_index].command_type != Item::Command::TYPE_PRIMITIVE) {
- _new_batch(r_batch_broken, r_index);
+ _new_batch(r_batch_broken);
state.canvas_instance_batches[state.current_batch_index].tex = primitive->texture;
state.canvas_instance_batches[state.current_batch_index].primitive_points = primitive->point_count;
state.canvas_instance_batches[state.current_batch_index].command_type = Item::Command::TYPE_PRIMITIVE;
@@ -1085,10 +1091,7 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend
if (primitive->point_count == 4) {
// Reset base data.
_update_transform_2d_to_mat2x3(base_transform * draw_transform, state.instance_data_array[r_index].world);
- state.instance_data_array[r_index].color_texture_pixel_size[0] = 0.0;
- state.instance_data_array[r_index].color_texture_pixel_size[1] = 0.0;
-
- state.instance_data_array[r_index].flags = base_flags | (state.instance_data_array[r_index - 1].flags & (FLAGS_DEFAULT_NORMAL_MAP_USED | FLAGS_DEFAULT_SPECULAR_MAP_USED)); //reset on each command for sanity, keep canvastexture binding config
+ _prepare_canvas_texture(state.canvas_instance_batches[state.current_batch_index].tex, state.canvas_instance_batches[state.current_batch_index].filter, state.canvas_instance_batches[state.current_batch_index].repeat, r_index, texpixel_size);
for (uint32_t j = 0; j < 3; j++) {
int offset = j == 0 ? 0 : 1;
@@ -1110,7 +1113,7 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend
case Item::Command::TYPE_MULTIMESH:
case Item::Command::TYPE_PARTICLES: {
// Mesh's can't be batched, so always create a new batch
- _new_batch(r_batch_broken, r_index);
+ _new_batch(r_batch_broken);
Color modulate(1, 1, 1, 1);
state.canvas_instance_batches[state.current_batch_index].shader_variant = CanvasShaderGLES3::MODE_ATTRIBUTES;
@@ -1182,7 +1185,7 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend
const Item::CommandClipIgnore *ci = static_cast<const Item::CommandClipIgnore *>(c);
if (current_clip) {
if (ci->ignore != reclip) {
- _new_batch(r_batch_broken, r_index);
+ _new_batch(r_batch_broken);
if (ci->ignore) {
state.canvas_instance_batches[state.current_batch_index].clip = nullptr;
reclip = true;
@@ -1226,7 +1229,7 @@ void RasterizerCanvasGLES3::_render_batch(Light *p_lights, uint32_t p_index) {
case Item::Command::TYPE_RECT:
case Item::Command::TYPE_NINEPATCH: {
glBindVertexArray(data.indexed_quad_array);
- glBindBuffer(GL_ARRAY_BUFFER, state.canvas_instance_data_buffers[state.current_buffer].buffer);
+ glBindBuffer(GL_ARRAY_BUFFER, state.canvas_instance_data_buffers[state.current_data_buffer_index].instance_buffers[state.canvas_instance_batches[p_index].instance_buffer_index]);
uint32_t range_start = state.canvas_instance_batches[p_index].start * sizeof(InstanceData);
_enable_attributes(range_start, false);
@@ -1242,7 +1245,7 @@ void RasterizerCanvasGLES3::_render_batch(Light *p_lights, uint32_t p_index) {
ERR_FAIL_COND(!pb);
glBindVertexArray(pb->vertex_array);
- glBindBuffer(GL_ARRAY_BUFFER, state.canvas_instance_data_buffers[state.current_buffer].buffer);
+ glBindBuffer(GL_ARRAY_BUFFER, state.canvas_instance_data_buffers[state.current_data_buffer_index].instance_buffers[state.canvas_instance_batches[p_index].instance_buffer_index]);
uint32_t range_start = state.canvas_instance_batches[p_index].start * sizeof(InstanceData);
_enable_attributes(range_start, false);
@@ -1266,7 +1269,7 @@ void RasterizerCanvasGLES3::_render_batch(Light *p_lights, uint32_t p_index) {
case Item::Command::TYPE_PRIMITIVE: {
glBindVertexArray(data.canvas_quad_array);
- glBindBuffer(GL_ARRAY_BUFFER, state.canvas_instance_data_buffers[state.current_buffer].buffer);
+ glBindBuffer(GL_ARRAY_BUFFER, state.canvas_instance_data_buffers[state.current_data_buffer_index].instance_buffers[state.canvas_instance_batches[p_index].instance_buffer_index]);
uint32_t range_start = state.canvas_instance_batches[p_index].start * sizeof(InstanceData);
_enable_attributes(range_start, true);
@@ -1369,7 +1372,7 @@ void RasterizerCanvasGLES3::_render_batch(Light *p_lights, uint32_t p_index) {
index_array_gl = mesh_storage->mesh_surface_get_index_buffer(surface, 0);
bool use_index_buffer = false;
glBindVertexArray(vertex_array_gl);
- glBindBuffer(GL_ARRAY_BUFFER, state.canvas_instance_data_buffers[state.current_buffer].buffer);
+ glBindBuffer(GL_ARRAY_BUFFER, state.canvas_instance_data_buffers[state.current_data_buffer_index].instance_buffers[state.canvas_instance_batches[p_index].instance_buffer_index]);
uint32_t range_start = state.canvas_instance_batches[p_index].start * sizeof(InstanceData);
_enable_attributes(range_start, false, instance_count);
@@ -1426,20 +1429,30 @@ void RasterizerCanvasGLES3::_render_batch(Light *p_lights, uint32_t p_index) {
}
void RasterizerCanvasGLES3::_add_to_batch(uint32_t &r_index, bool &r_batch_broken) {
- if (r_index >= data.max_instances_per_buffer - 1) {
- ERR_PRINT_ONCE("Trying to draw too many items. Please increase maximum number of items in the project settings 'rendering/gl_compatibility/item_buffer_size'");
- return;
- }
-
- if (state.canvas_instance_batches[state.current_batch_index].instance_count >= data.max_instances_per_batch) {
- _new_batch(r_batch_broken, r_index);
- }
-
state.canvas_instance_batches[state.current_batch_index].instance_count++;
r_index++;
+ if (r_index >= data.max_instances_per_buffer) {
+ // Copy over all data needed for rendering right away
+ // then go back to recording item commands.
+ glBindBuffer(GL_ARRAY_BUFFER, state.canvas_instance_data_buffers[state.current_data_buffer_index].instance_buffers[state.current_instance_buffer_index]);
+#ifdef WEB_ENABLED
+ glBufferSubData(GL_ARRAY_BUFFER, state.last_item_index * sizeof(InstanceData), sizeof(InstanceData) * r_index, state.instance_data_array);
+#else
+ // On Desktop and mobile we map the memory without synchronizing for maximum speed.
+ void *buffer = glMapBufferRange(GL_ARRAY_BUFFER, state.last_item_index * sizeof(InstanceData), r_index * sizeof(InstanceData), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
+ memcpy(buffer, state.instance_data_array, r_index * sizeof(InstanceData));
+ glUnmapBuffer(GL_ARRAY_BUFFER);
+#endif
+ _allocate_instance_buffer();
+ r_index = 0;
+ state.last_item_index = 0;
+ r_batch_broken = false; // Force a new batch to be created
+ _new_batch(r_batch_broken);
+ state.canvas_instance_batches[state.current_batch_index].start = 0;
+ }
}
-void RasterizerCanvasGLES3::_new_batch(bool &r_batch_broken, uint32_t &r_index) {
+void RasterizerCanvasGLES3::_new_batch(bool &r_batch_broken) {
if (state.canvas_instance_batches.size() == 0) {
state.canvas_instance_batches.push_back(Batch());
return;
@@ -1455,7 +1468,7 @@ void RasterizerCanvasGLES3::_new_batch(bool &r_batch_broken, uint32_t &r_index)
Batch new_batch = state.canvas_instance_batches[state.current_batch_index];
new_batch.instance_count = 0;
new_batch.start = state.canvas_instance_batches[state.current_batch_index].start + state.canvas_instance_batches[state.current_batch_index].instance_count;
-
+ new_batch.instance_buffer_index = state.current_instance_buffer_index;
state.current_batch_index++;
state.canvas_instance_batches.push_back(new_batch);
}
@@ -1486,6 +1499,9 @@ void RasterizerCanvasGLES3::light_set_texture(RID p_rid, RID p_texture) {
if (cl->texture == p_texture) {
return;
}
+
+ ERR_FAIL_COND(p_texture.is_valid() && !texture_storage->owns_texture(p_texture));
+
if (cl->texture.is_valid()) {
texture_storage->texture_remove_from_texture_atlas(cl->texture);
}
@@ -2432,17 +2448,35 @@ void RasterizerCanvasGLES3::_allocate_instance_data_buffer() {
glBindBuffer(GL_UNIFORM_BUFFER, new_buffers[2]);
glBufferData(GL_UNIFORM_BUFFER, sizeof(StateBuffer), nullptr, GL_STREAM_DRAW);
- state.current_buffer = (state.current_buffer + 1);
+ state.current_data_buffer_index = (state.current_data_buffer_index + 1);
DataBuffer db;
- db.buffer = new_buffers[0];
+ db.instance_buffers.push_back(new_buffers[0]);
db.light_ubo = new_buffers[1];
db.state_ubo = new_buffers[2];
db.last_frame_used = RSG::rasterizer->get_frame_number();
- state.canvas_instance_data_buffers.insert(state.current_buffer, db);
- state.current_buffer = state.current_buffer % state.canvas_instance_data_buffers.size();
+ state.canvas_instance_data_buffers.insert(state.current_data_buffer_index, db);
+ state.current_data_buffer_index = state.current_data_buffer_index % state.canvas_instance_data_buffers.size();
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
}
+void RasterizerCanvasGLES3::_allocate_instance_buffer() {
+ state.current_instance_buffer_index++;
+
+ if (int(state.current_instance_buffer_index) < state.canvas_instance_data_buffers[state.current_data_buffer_index].instance_buffers.size()) {
+ // We already allocated another buffer in a previous frame, so we can just use it.
+ return;
+ }
+
+ GLuint new_buffer;
+ glGenBuffers(1, &new_buffer);
+
+ glBindBuffer(GL_ARRAY_BUFFER, new_buffer);
+ glBufferData(GL_ARRAY_BUFFER, data.max_instance_buffer_size, nullptr, GL_STREAM_DRAW);
+
+ state.canvas_instance_data_buffers[state.current_data_buffer_index].instance_buffers.push_back(new_buffer);
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+}
void RasterizerCanvasGLES3::set_time(double p_time) {
state.time = p_time;
@@ -2585,14 +2619,12 @@ RasterizerCanvasGLES3::RasterizerCanvasGLES3() {
int uniform_max_size = config->max_uniform_buffer_size;
if (uniform_max_size < 65536) {
data.max_lights_per_render = 64;
- data.max_instances_per_batch = 128;
} else {
data.max_lights_per_render = 256;
- data.max_instances_per_batch = 2048;
}
// Reserve 3 Uniform Buffers for instance data Frame N, N+1 and N+2
- data.max_instances_per_buffer = MAX(data.max_instances_per_batch, uint32_t(GLOBAL_GET("rendering/gl_compatibility/item_buffer_size")));
+ data.max_instances_per_buffer = uint32_t(GLOBAL_GET("rendering/gl_compatibility/item_buffer_size"));
data.max_instance_buffer_size = data.max_instances_per_buffer * sizeof(InstanceData); // 16,384 instances * 128 bytes = 2,097,152 bytes = 2,048 kb
state.canvas_instance_data_buffers.resize(3);
state.canvas_instance_batches.reserve(200);
@@ -2610,7 +2642,7 @@ RasterizerCanvasGLES3::RasterizerCanvasGLES3() {
glBindBuffer(GL_UNIFORM_BUFFER, new_buffers[2]);
glBufferData(GL_UNIFORM_BUFFER, sizeof(StateBuffer), nullptr, GL_STREAM_DRAW);
DataBuffer db;
- db.buffer = new_buffers[0];
+ db.instance_buffers.push_back(new_buffers[0]);
db.light_ubo = new_buffers[1];
db.state_ubo = new_buffers[2];
db.last_frame_used = 0;
@@ -2637,7 +2669,6 @@ RasterizerCanvasGLES3::RasterizerCanvasGLES3() {
String global_defines;
global_defines += "#define MAX_GLOBAL_SHADER_UNIFORMS 256\n"; // TODO: this is arbitrary for now
global_defines += "#define MAX_LIGHTS " + itos(data.max_lights_per_render) + "\n";
- global_defines += "#define MAX_DRAW_DATA_INSTANCES " + itos(data.max_instances_per_batch) + "\n";
GLES3::MaterialStorage::get_singleton()->shaders.canvas_shader.initialize(global_defines, 1);
data.canvas_shader_default_version = GLES3::MaterialStorage::get_singleton()->shaders.canvas_shader.version_create();
diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h
index 916e12057c..1c14d0b466 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.h
+++ b/drivers/gles3/rasterizer_canvas_gles3.h
@@ -247,7 +247,6 @@ public:
uint32_t max_lights_per_render = 256;
uint32_t max_lights_per_item = 16;
- uint32_t max_instances_per_batch = 512;
uint32_t max_instances_per_buffer = 16384;
uint32_t max_instance_buffer_size = 16384 * 128;
} data;
@@ -256,6 +255,7 @@ public:
// Position in the UBO measured in bytes
uint32_t start = 0;
uint32_t instance_count = 0;
+ uint32_t instance_buffer_index = 0;
RID tex;
RS::CanvasItemTextureFilter filter = RS::CANVAS_ITEM_TEXTURE_FILTER_MAX;
@@ -281,7 +281,7 @@ public:
// We track them and ensure that they don't get reused until at least 2 frames have passed
// to avoid the GPU stalling to wait for a resource to become available.
struct DataBuffer {
- GLuint buffer = 0;
+ Vector<GLuint> instance_buffers;
GLuint light_ubo = 0;
GLuint state_ubo = 0;
uint64_t last_frame_used = -3;
@@ -291,9 +291,10 @@ public:
struct State {
LocalVector<DataBuffer> canvas_instance_data_buffers;
LocalVector<Batch> canvas_instance_batches;
- uint32_t current_buffer = 0;
- uint32_t current_buffer_index = 0;
+ uint32_t current_data_buffer_index = 0;
+ uint32_t current_instance_buffer_index = 0;
uint32_t current_batch_index = 0;
+ uint32_t last_item_index = 0;
InstanceData *instance_data_array = nullptr;
@@ -354,14 +355,14 @@ public:
void _prepare_canvas_texture(RID p_texture, RS::CanvasItemTextureFilter p_base_filter, RS::CanvasItemTextureRepeat p_base_repeat, uint32_t &r_index, Size2 &r_texpixel_size);
void canvas_render_items(RID p_to_render_target, Item *p_item_list, const Color &p_modulate, Light *p_light_list, Light *p_directional_list, const Transform2D &p_canvas_transform, RS::CanvasItemTextureFilter p_default_filter, RS::CanvasItemTextureRepeat p_default_repeat, bool p_snap_2d_vertices_to_pixel, bool &r_sdf_used) override;
- void _render_items(RID p_to_render_target, int p_item_count, const Transform2D &p_canvas_transform_inverse, Light *p_lights, uint32_t &r_last_index, bool &r_sdf_used, bool p_to_backbuffer = false);
+ void _render_items(RID p_to_render_target, int p_item_count, const Transform2D &p_canvas_transform_inverse, Light *p_lights, bool &r_sdf_used, bool p_to_backbuffer = false);
void _record_item_commands(const Item *p_item, RID p_render_target, const Transform2D &p_canvas_transform_inverse, Item *&current_clip, GLES3::CanvasShaderData::BlendMode p_blend_mode, Light *p_lights, uint32_t &r_index, bool &r_break_batch, bool &r_sdf_used);
void _render_batch(Light *p_lights, uint32_t p_index);
bool _bind_material(GLES3::CanvasMaterialData *p_material_data, CanvasShaderGLES3::ShaderVariant p_variant, uint64_t p_specialization);
- void _new_batch(bool &r_batch_broken, uint32_t &r_index);
+ void _new_batch(bool &r_batch_broken);
void _add_to_batch(uint32_t &r_index, bool &r_batch_broken);
void _allocate_instance_data_buffer();
- void _align_instance_data_buffer(uint32_t &r_index);
+ void _allocate_instance_buffer();
void _enable_attributes(uint32_t p_start, bool p_primitive, uint32_t p_rate = 1);
void set_time(double p_time);
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index e4bcc424b3..949f2953d3 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -145,6 +145,7 @@ void RasterizerSceneGLES3::_geometry_instance_dependency_changed(Dependency::Dep
case Dependency::DEPENDENCY_CHANGED_MULTIMESH:
case Dependency::DEPENDENCY_CHANGED_SKELETON_DATA: {
static_cast<RenderGeometryInstance *>(p_tracker->userdata)->_mark_dirty();
+ static_cast<GeometryInstanceGLES3 *>(p_tracker->userdata)->data->dirty_dependencies = true;
} break;
case Dependency::DEPENDENCY_CHANGED_MULTIMESH_VISIBLE_INSTANCES: {
GeometryInstanceGLES3 *ginstance = static_cast<GeometryInstanceGLES3 *>(p_tracker->userdata);
@@ -160,6 +161,7 @@ void RasterizerSceneGLES3::_geometry_instance_dependency_changed(Dependency::Dep
void RasterizerSceneGLES3::_geometry_instance_dependency_deleted(const RID &p_dependency, DependencyTracker *p_tracker) {
static_cast<RenderGeometryInstance *>(p_tracker->userdata)->_mark_dirty();
+ static_cast<GeometryInstanceGLES3 *>(p_tracker->userdata)->data->dirty_dependencies = true;
}
void RasterizerSceneGLES3::_geometry_instance_add_surface_with_material(GeometryInstanceGLES3 *ginstance, uint32_t p_surface, GLES3::SceneMaterialData *p_material, uint32_t p_material_id, uint32_t p_shader_id, RID p_mesh) {
@@ -1535,8 +1537,6 @@ void RasterizerSceneGLES3::_setup_lights(const RenderDataGLES3 *p_render_data, b
}
}
- li->gl_id = r_omni_light_count;
-
scene_state.omni_light_sort[r_omni_light_count].instance = li;
scene_state.omni_light_sort[r_omni_light_count].depth = distance;
r_omni_light_count++;
@@ -1560,8 +1560,6 @@ void RasterizerSceneGLES3::_setup_lights(const RenderDataGLES3 *p_render_data, b
}
}
- li->gl_id = r_spot_light_count;
-
scene_state.spot_light_sort[r_spot_light_count].instance = li;
scene_state.spot_light_sort[r_spot_light_count].depth = distance;
r_spot_light_count++;
@@ -1584,8 +1582,11 @@ void RasterizerSceneGLES3::_setup_lights(const RenderDataGLES3 *p_render_data, b
LightData &light_data = (i < r_omni_light_count) ? scene_state.omni_lights[index] : scene_state.spot_lights[index];
RS::LightType type = (i < r_omni_light_count) ? RS::LIGHT_OMNI : RS::LIGHT_SPOT;
GLES3::LightInstance *li = (i < r_omni_light_count) ? scene_state.omni_light_sort[index].instance : scene_state.spot_light_sort[index].instance;
+ real_t distance = (i < r_omni_light_count) ? scene_state.omni_light_sort[index].depth : scene_state.spot_light_sort[index].depth;
RID base = li->light;
+ li->gl_id = index;
+
Transform3D light_transform = li->transform;
Vector3 pos = inverse_transform.xform(light_transform.origin);
@@ -1612,13 +1613,11 @@ void RasterizerSceneGLES3::_setup_lights(const RenderDataGLES3 *p_render_data, b
// Reuse fade begin, fade length and distance for shadow LOD determination later.
float fade_begin = 0.0;
float fade_length = 0.0;
- real_t distance = 0.0;
float fade = 1.0;
if (light_storage->light_is_distance_fade_enabled(li->light)) {
fade_begin = light_storage->light_get_distance_fade_begin(li->light);
fade_length = light_storage->light_get_distance_fade_length(li->light);
- distance = p_render_data->cam_transform.origin.distance_to(li->transform.origin);
if (distance > fade_begin) {
// Use `smoothstep()` to make opacity changes more gradual and less noticeable to the player.
diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp
index 71caf3b8e3..10f42bf22b 100644
--- a/drivers/gles3/shader_gles3.cpp
+++ b/drivers/gles3/shader_gles3.cpp
@@ -192,7 +192,7 @@ void ShaderGLES3::_build_variant_code(StringBuilder &builder, uint32_t p_variant
builder.append("#define ViewIndex gl_ViewID_OVR\n");
builder.append("#define MAX_VIEWS 2\n");
builder.append("#else\n");
- builder.append("#define ViewIndex 0\n");
+ builder.append("#define ViewIndex uint(0)\n");
builder.append("#define MAX_VIEWS 1\n");
builder.append("#endif\n");
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 951155e287..f977c8ceaf 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -565,9 +565,15 @@ uniform highp samplerCubeShadow positional_shadow; // texunit:-4
#ifdef USE_MULTIVIEW
uniform highp sampler2DArray depth_buffer; // texunit:-6
uniform highp sampler2DArray color_buffer; // texunit:-5
+vec3 multiview_uv(vec2 uv) {
+ return vec3(uv, ViewIndex);
+}
#else
uniform highp sampler2D depth_buffer; // texunit:-6
uniform highp sampler2D color_buffer; // texunit:-5
+vec2 multiview_uv(vec2 uv) {
+ return uv;
+}
#endif
uniform highp mat4 world_transform;
@@ -690,7 +696,8 @@ void light_compute(vec3 N, vec3 L, vec3 V, float A, vec3 light_color, float atte
#endif
#if defined(LIGHT_RIM_USED)
- float rim_light = pow(max(0.0, 1.0 - cNdotV), max(0.0, (1.0 - roughness) * 16.0));
+ // Epsilon min to prevent pow(0, 0) singularity which results in undefined behavior.
+ float rim_light = pow(max(1e-4, 1.0 - cNdotV), max(0.0, (1.0 - roughness) * 16.0));
diffuse_light += rim_light * rim * mix(vec3(1.0), albedo, rim_tint) * light_color;
#endif
}
@@ -924,8 +931,12 @@ void main() {
vec3 vertex = vertex_interp;
#ifdef USE_MULTIVIEW
vec3 view = -normalize(vertex_interp - multiview_data.eye_offset[ViewIndex].xyz);
+ mat4 projection_matrix = multiview_data.projection_matrix_view[ViewIndex];
+ mat4 inv_projection_matrix = multiview_data.inv_projection_matrix_view[ViewIndex];
#else
vec3 view = -normalize(vertex_interp);
+ mat4 projection_matrix = scene_data.projection_matrix;
+ mat4 inv_projection_matrix = scene_data.inv_projection_matrix;
#endif
highp mat4 model_matrix = world_transform;
vec3 albedo = vec3(1.0);
diff --git a/drivers/gles3/shaders/skeleton.glsl b/drivers/gles3/shaders/skeleton.glsl
index a1e3c098f4..aad856a5a2 100644
--- a/drivers/gles3/shaders/skeleton.glsl
+++ b/drivers/gles3/shaders/skeleton.glsl
@@ -87,6 +87,16 @@ uniform highp float blend_weight;
uniform lowp float blend_shape_count;
#endif
+#ifdef USE_SKELETON
+uniform mediump vec2 skeleton_transform_x;
+uniform mediump vec2 skeleton_transform_y;
+uniform mediump vec2 skeleton_transform_offset;
+
+uniform mediump vec2 inverse_transform_x;
+uniform mediump vec2 inverse_transform_y;
+uniform mediump vec2 inverse_transform_offset;
+#endif
+
vec2 signNotZero(vec2 v) {
return mix(vec2(-1.0), vec2(1.0), greaterThanEqual(v.xy, vec2(0.0)));
}
@@ -164,10 +174,13 @@ void main() {
m += GET_BONE_MATRIX(bones.z, bones_a.z, in_weight_attrib.z);
m += GET_BONE_MATRIX(bones.w, bones_a.w, in_weight_attrib.w);
+ mat4 skeleton_matrix = mat4(vec4(skeleton_transform_x, 0.0, 0.0), vec4(skeleton_transform_y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(skeleton_transform_offset, 0.0, 1.0));
+ mat4 inverse_matrix = mat4(vec4(inverse_transform_x, 0.0, 0.0), vec4(inverse_transform_y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(inverse_transform_offset, 0.0, 1.0));
mat4 bone_matrix = mat4(m[0], m[1], vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));
- //reverse order because its transposed
- out_vertex = (vec4(out_vertex, 0.0, 1.0) * bone_matrix).xy;
+ bone_matrix = skeleton_matrix * transpose(bone_matrix) * inverse_matrix;
+
+ out_vertex = (bone_matrix * vec4(out_vertex, 0.0, 1.0)).xy;
#endif // USE_SKELETON
#else // MODE_2D
diff --git a/drivers/gles3/storage/config.cpp b/drivers/gles3/storage/config.cpp
index d1a83e6851..77a4553c76 100644
--- a/drivers/gles3/storage/config.cpp
+++ b/drivers/gles3/storage/config.cpp
@@ -65,6 +65,10 @@ Config::Config() {
}
bptc_supported = extensions.has("GL_ARB_texture_compression_bptc") || extensions.has("EXT_texture_compression_bptc");
+ astc_supported = extensions.has("GL_KHR_texture_compression_astc") || extensions.has("GL_OES_texture_compression_astc") || extensions.has("GL_KHR_texture_compression_astc_ldr") || extensions.has("GL_KHR_texture_compression_astc_hdr");
+ astc_hdr_supported = extensions.has("GL_KHR_texture_compression_astc_ldr");
+ astc_layered_supported = extensions.has("GL_KHR_texture_compression_astc_sliced_3d");
+
#ifdef GLES_OVER_GL
float_texture_supported = true;
etc2_supported = false;
diff --git a/drivers/gles3/storage/config.h b/drivers/gles3/storage/config.h
index 8399502675..623f0442bd 100644
--- a/drivers/gles3/storage/config.h
+++ b/drivers/gles3/storage/config.h
@@ -77,6 +77,9 @@ public:
bool rgtc_supported = false;
bool bptc_supported = false;
bool etc2_supported = false;
+ bool astc_supported = false;
+ bool astc_hdr_supported = false;
+ bool astc_layered_supported = false;
bool force_vertex_shading = false;
diff --git a/drivers/gles3/storage/light_storage.h b/drivers/gles3/storage/light_storage.h
index a304b6a265..8b2bdaf872 100644
--- a/drivers/gles3/storage/light_storage.h
+++ b/drivers/gles3/storage/light_storage.h
@@ -113,7 +113,7 @@ struct ReflectionProbe {
Color ambient_color;
float ambient_color_energy = 1.0;
float max_distance = 0;
- Vector3 extents = Vector3(1, 1, 1);
+ Vector3 extents = Vector3(10, 10, 10);
Vector3 origin_offset;
bool interior = false;
bool box_projection = false;
diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp
index 50e5c868d3..4fb780b665 100644
--- a/drivers/gles3/storage/material_storage.cpp
+++ b/drivers/gles3/storage/material_storage.cpp
@@ -1546,6 +1546,8 @@ MaterialStorage::MaterialStorage() {
actions.render_mode_defines["unshaded"] = "#define MODE_UNSHADED\n";
actions.render_mode_defines["light_only"] = "#define MODE_LIGHT_ONLY\n";
+ actions.global_buffer_array_variable = "global_shader_uniforms";
+
shaders.compiler_canvas.initialize(actions);
}
@@ -1635,8 +1637,8 @@ MaterialStorage::MaterialStorage() {
actions.renames["NODE_POSITION_VIEW"] = "(model_matrix * scene_data.view_matrix)[3].xyz";
actions.renames["VIEW_INDEX"] = "ViewIndex";
- actions.renames["VIEW_MONO_LEFT"] = "0";
- actions.renames["VIEW_RIGHT"] = "1";
+ actions.renames["VIEW_MONO_LEFT"] = "uint(0)";
+ actions.renames["VIEW_RIGHT"] = "uint(1)";
//for light
actions.renames["VIEW"] = "view";
@@ -1718,6 +1720,9 @@ MaterialStorage::MaterialStorage() {
actions.default_filter = ShaderLanguage::FILTER_LINEAR_MIPMAP;
actions.default_repeat = ShaderLanguage::REPEAT_ENABLE;
+ actions.check_multiview_samplers = true;
+ actions.global_buffer_array_variable = "global_shader_uniforms";
+
shaders.compiler_scene.initialize(actions);
}
@@ -1773,6 +1778,8 @@ MaterialStorage::MaterialStorage() {
actions.default_filter = ShaderLanguage::FILTER_LINEAR_MIPMAP;
actions.default_repeat = ShaderLanguage::REPEAT_ENABLE;
+ actions.global_buffer_array_variable = "global_shader_uniforms";
+
shaders.compiler_particles.initialize(actions);
}
@@ -1826,6 +1833,8 @@ MaterialStorage::MaterialStorage() {
actions.default_filter = ShaderLanguage::FILTER_LINEAR_MIPMAP;
actions.default_repeat = ShaderLanguage::REPEAT_ENABLE;
+ actions.global_buffer_array_variable = "global_shader_uniforms";
+
shaders.compiler_sky.initialize(actions);
}
}
diff --git a/drivers/gles3/storage/mesh_storage.cpp b/drivers/gles3/storage/mesh_storage.cpp
index 71f262af20..5ba0c5a09c 100644
--- a/drivers/gles3/storage/mesh_storage.cpp
+++ b/drivers/gles3/storage/mesh_storage.cpp
@@ -997,6 +997,11 @@ void MeshStorage::mesh_instance_check_for_update(RID p_mesh_instance) {
}
}
+void MeshStorage::mesh_instance_set_canvas_item_transform(RID p_mesh_instance, const Transform2D &p_transform) {
+ MeshInstance *mi = mesh_instance_owner.get_or_null(p_mesh_instance);
+ mi->canvas_item_transform_2d = p_transform;
+}
+
void MeshStorage::_blend_shape_bind_mesh_instance_buffer(MeshInstance *p_mi, uint32_t p_surface) {
glBindBuffer(GL_ARRAY_BUFFER, p_mi->surfaces[p_surface].vertex_buffers[0]);
@@ -1163,6 +1168,16 @@ void MeshStorage::update_mesh_instances() {
skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::BLEND_SHAPE_COUNT, float(mi->mesh->blend_shape_count), skeleton_shader.shader_version, variant, specialization);
if (can_use_skeleton) {
+ Transform2D transform = mi->canvas_item_transform_2d.affine_inverse() * sk->base_transform_2d;
+ skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::SKELETON_TRANSFORM_X, transform[0], skeleton_shader.shader_version, variant, specialization);
+ skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::SKELETON_TRANSFORM_Y, transform[1], skeleton_shader.shader_version, variant, specialization);
+ skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::SKELETON_TRANSFORM_OFFSET, transform[2], skeleton_shader.shader_version, variant, specialization);
+
+ Transform2D inverse_transform = transform.affine_inverse();
+ skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::INVERSE_TRANSFORM_X, inverse_transform[0], skeleton_shader.shader_version, variant, specialization);
+ skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::INVERSE_TRANSFORM_Y, inverse_transform[1], skeleton_shader.shader_version, variant, specialization);
+ skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::INVERSE_TRANSFORM_OFFSET, inverse_transform[2], skeleton_shader.shader_version, variant, specialization);
+
// Do last blendshape in the same pass as the Skeleton.
_compute_skeleton(mi, sk, i);
can_use_skeleton = false;
@@ -1201,6 +1216,16 @@ void MeshStorage::update_mesh_instances() {
continue;
}
+ Transform2D transform = mi->canvas_item_transform_2d.affine_inverse() * sk->base_transform_2d;
+ skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::SKELETON_TRANSFORM_X, transform[0], skeleton_shader.shader_version, variant, specialization);
+ skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::SKELETON_TRANSFORM_Y, transform[1], skeleton_shader.shader_version, variant, specialization);
+ skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::SKELETON_TRANSFORM_OFFSET, transform[2], skeleton_shader.shader_version, variant, specialization);
+
+ Transform2D inverse_transform = transform.affine_inverse();
+ skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::INVERSE_TRANSFORM_X, inverse_transform[0], skeleton_shader.shader_version, variant, specialization);
+ skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::INVERSE_TRANSFORM_Y, inverse_transform[1], skeleton_shader.shader_version, variant, specialization);
+ skeleton_shader.shader.version_set_uniform(SkeletonShaderGLES3::INVERSE_TRANSFORM_OFFSET, inverse_transform[2], skeleton_shader.shader_version, variant, specialization);
+
glBindVertexArray(mi->mesh->surfaces[i]->skeleton_vertex_array);
_compute_skeleton(mi, sk, i);
}
diff --git a/drivers/gles3/storage/mesh_storage.h b/drivers/gles3/storage/mesh_storage.h
index 2efc57462b..e1c2bc3f63 100644
--- a/drivers/gles3/storage/mesh_storage.h
+++ b/drivers/gles3/storage/mesh_storage.h
@@ -163,6 +163,7 @@ struct MeshInstance {
bool weights_dirty = false;
SelfList<MeshInstance> weight_update_list;
SelfList<MeshInstance> array_update_list;
+ Transform2D canvas_item_transform_2d;
MeshInstance() :
weight_update_list(this), array_update_list(this) {}
};
@@ -423,6 +424,7 @@ public:
virtual void mesh_instance_set_skeleton(RID p_mesh_instance, RID p_skeleton) override;
virtual void mesh_instance_set_blend_shape_weight(RID p_mesh_instance, int p_shape, float p_weight) override;
virtual void mesh_instance_check_for_update(RID p_mesh_instance) override;
+ virtual void mesh_instance_set_canvas_item_transform(RID p_mesh_instance, const Transform2D &p_transform) override;
virtual void update_mesh_instances() override;
// TODO: considering hashing versions with multimesh buffer RID.
diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp
index 8818ab2118..97698af0a0 100644
--- a/drivers/gles3/storage/texture_storage.cpp
+++ b/drivers/gles3/storage/texture_storage.cpp
@@ -594,6 +594,50 @@ Ref<Image> TextureStorage::_get_gl_image_and_format(const Ref<Image> &p_image, I
}
decompress_ra_to_rg = true;
} break;
+ case Image::FORMAT_ASTC_4x4: {
+ if (config->astc_supported) {
+ r_gl_internal_format = _EXT_COMPRESSED_RGBA_ASTC_4x4_KHR;
+ r_gl_format = GL_RGBA;
+ r_gl_type = GL_UNSIGNED_BYTE;
+ r_compressed = true;
+
+ } else {
+ need_decompress = true;
+ }
+ } break;
+ case Image::FORMAT_ASTC_4x4_HDR: {
+ if (config->astc_hdr_supported) {
+ r_gl_internal_format = _EXT_COMPRESSED_RGBA_ASTC_4x4_KHR;
+ r_gl_format = GL_RGBA;
+ r_gl_type = GL_UNSIGNED_BYTE;
+ r_compressed = true;
+
+ } else {
+ need_decompress = true;
+ }
+ } break;
+ case Image::FORMAT_ASTC_8x8: {
+ if (config->astc_supported) {
+ r_gl_internal_format = _EXT_COMPRESSED_RGBA_ASTC_8x8_KHR;
+ r_gl_format = GL_RGBA;
+ r_gl_type = GL_UNSIGNED_BYTE;
+ r_compressed = true;
+
+ } else {
+ need_decompress = true;
+ }
+ } break;
+ case Image::FORMAT_ASTC_8x8_HDR: {
+ if (config->astc_hdr_supported) {
+ r_gl_internal_format = _EXT_COMPRESSED_RGBA_ASTC_8x8_KHR;
+ r_gl_format = GL_RGBA;
+ r_gl_type = GL_UNSIGNED_BYTE;
+ r_compressed = true;
+
+ } else {
+ need_decompress = true;
+ }
+ } break;
default: {
ERR_FAIL_V_MSG(Ref<Image>(), "Image Format: " + itos(p_format) + " is not supported by the OpenGL3 Renderer");
}
@@ -1534,18 +1578,6 @@ AABB TextureStorage::decal_get_aabb(RID p_decal) const {
return AABB();
}
-/* DECAL INSTANCE API */
-
-RID TextureStorage::decal_instance_create(RID p_decal) {
- return RID();
-}
-
-void TextureStorage::decal_instance_free(RID p_decal_instance) {
-}
-
-void TextureStorage::decal_instance_set_transform(RID p_decal, const Transform3D &p_transform) {
-}
-
/* RENDER TARGET API */
GLuint TextureStorage::system_fbo = 0;
@@ -1608,9 +1640,13 @@ void TextureStorage::_update_render_target(RenderTarget *rt) {
glTexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
+#ifndef IOS_ENABLED
if (use_multiview) {
glFramebufferTextureMultiviewOVR(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, rt->color, 0, 0, rt->view_count);
} else {
+#else
+ {
+#endif
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->color, 0);
}
@@ -1635,9 +1671,13 @@ void TextureStorage::_update_render_target(RenderTarget *rt) {
glTexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
+#ifndef IOS_ENABLED
if (use_multiview) {
glFramebufferTextureMultiviewOVR(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, rt->depth, 0, 0, rt->view_count);
} else {
+#else
+ {
+#endif
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, rt->depth, 0);
}
diff --git a/drivers/gles3/storage/texture_storage.h b/drivers/gles3/storage/texture_storage.h
index 9ffe16fd16..522be64d35 100644
--- a/drivers/gles3/storage/texture_storage.h
+++ b/drivers/gles3/storage/texture_storage.h
@@ -84,6 +84,36 @@ namespace GLES3 {
#define _EXT_COMPRESSED_RGBA8_ETC2_EAC 0x9278
#define _EXT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
+#define _EXT_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
+#define _EXT_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
+#define _EXT_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
+#define _EXT_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
+#define _EXT_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
+#define _EXT_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
+#define _EXT_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
+#define _EXT_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
+#define _EXT_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
+#define _EXT_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
+#define _EXT_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
+#define _EXT_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
+#define _EXT_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
+#define _EXT_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
+
+#define _EXT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
+#define _EXT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
+#define _EXT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
+#define _EXT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
+#define _EXT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
+#define _EXT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
+#define _EXT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
+#define _EXT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
+#define _EXT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
+#define _EXT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
+#define _EXT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
+#define _EXT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
+#define _EXT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
+#define _EXT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
+
#define _GL_TEXTURE_EXTERNAL_OES 0x8D65
#define _EXT_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
@@ -561,9 +591,10 @@ public:
/* DECAL INSTANCE */
- virtual RID decal_instance_create(RID p_decal) override;
- virtual void decal_instance_free(RID p_decal_instance) override;
- virtual void decal_instance_set_transform(RID p_decal, const Transform3D &p_transform) override;
+ virtual RID decal_instance_create(RID p_decal) override { return RID(); }
+ virtual void decal_instance_free(RID p_decal_instance) override {}
+ virtual void decal_instance_set_transform(RID p_decal, const Transform3D &p_transform) override {}
+ virtual void decal_instance_set_sorting_offset(RID p_decal_instance, float p_sorting_offset) override {}
/* RENDER TARGET API */
diff --git a/drivers/gles3/storage/utilities.cpp b/drivers/gles3/storage/utilities.cpp
index e72240c69b..30c3e61ee7 100644
--- a/drivers/gles3/storage/utilities.cpp
+++ b/drivers/gles3/storage/utilities.cpp
@@ -309,6 +309,9 @@ bool Utilities::has_os_feature(const String &p_feature) const {
if (p_feature == "bptc") {
return config->bptc_supported;
}
+ if (p_feature == "astc") {
+ return config->astc_supported;
+ }
if (p_feature == "etc" || p_feature == "etc2") {
return config->etc2_supported;
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index 1c1255ce98..e14c3c7f7a 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -264,7 +264,7 @@ Error AudioDriverPulseAudio::init_device() {
samples_in.resize(buffer_frames * channels);
samples_out.resize(pa_buffer_size);
- // Reset audio input to keep synchronisation.
+ // Reset audio input to keep synchronization.
input_position = 0;
input_size = 0;
diff --git a/drivers/pulseaudio/pulse-so_wrap.c b/drivers/pulseaudio/pulse-so_wrap.c
index 12bdcc704e..8f477740ce 100644
--- a/drivers/pulseaudio/pulse-so_wrap.c
+++ b/drivers/pulseaudio/pulse-so_wrap.c
@@ -1,7 +1,7 @@
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by /home/hp/Projects/godot/pulse/generate-wrapper.py 0.3 on 2021-02-20 00:08:31
-// flags: /home/hp/Projects/godot/pulse/generate-wrapper.py --include /usr/include/pulse/pulseaudio.h --sys-include <pulse/pulseaudio.h> --soname libpulse.so.0 --omit-prefix _pa_ --init-name pulse --output-header pulse-so_wrap.h --output-implementation pulse-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-12 10:26:29
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/pulse/pulseaudio.h --sys-include "thirdparty/linuxbsd_headers/pulse/pulseaudio.h" --soname libpulse.so.0 --omit-prefix _pa_ --init-name pulse --output-header ./drivers/pulseaudio/pulse-so_wrap.h --output-implementation ./drivers/pulseaudio/pulse-so_wrap.c
//
#include <stdint.h>
@@ -89,10 +89,6 @@
#define pa_format_info_get_prop_string pa_format_info_get_prop_string_dylibloader_orig_pulse
#define pa_format_info_get_prop_string_array pa_format_info_get_prop_string_array_dylibloader_orig_pulse
#define pa_format_info_free_string_array pa_format_info_free_string_array_dylibloader_orig_pulse
-#define pa_format_info_get_sample_format pa_format_info_get_sample_format_dylibloader_orig_pulse
-#define pa_format_info_get_rate pa_format_info_get_rate_dylibloader_orig_pulse
-#define pa_format_info_get_channels pa_format_info_get_channels_dylibloader_orig_pulse
-#define pa_format_info_get_channel_map pa_format_info_get_channel_map_dylibloader_orig_pulse
#define pa_format_info_set_prop_int pa_format_info_set_prop_int_dylibloader_orig_pulse
#define pa_format_info_set_prop_int_array pa_format_info_set_prop_int_array_dylibloader_orig_pulse
#define pa_format_info_set_prop_int_range pa_format_info_set_prop_int_range_dylibloader_orig_pulse
@@ -327,7 +323,6 @@
#define pa_threaded_mainloop_get_api pa_threaded_mainloop_get_api_dylibloader_orig_pulse
#define pa_threaded_mainloop_in_thread pa_threaded_mainloop_in_thread_dylibloader_orig_pulse
#define pa_threaded_mainloop_set_name pa_threaded_mainloop_set_name_dylibloader_orig_pulse
-#define pa_threaded_mainloop_once_unlocked pa_threaded_mainloop_once_unlocked_dylibloader_orig_pulse
#define pa_mainloop_new pa_mainloop_new_dylibloader_orig_pulse
#define pa_mainloop_free pa_mainloop_free_dylibloader_orig_pulse
#define pa_mainloop_prepare pa_mainloop_prepare_dylibloader_orig_pulse
@@ -352,7 +347,6 @@
#define pa_get_binary_name pa_get_binary_name_dylibloader_orig_pulse
#define pa_path_get_filename pa_path_get_filename_dylibloader_orig_pulse
#define pa_msleep pa_msleep_dylibloader_orig_pulse
-#define pa_thread_make_realtime pa_thread_make_realtime_dylibloader_orig_pulse
#define pa_gettimeofday pa_gettimeofday_dylibloader_orig_pulse
#define pa_timeval_diff pa_timeval_diff_dylibloader_orig_pulse
#define pa_timeval_cmp pa_timeval_cmp_dylibloader_orig_pulse
@@ -362,7 +356,7 @@
#define pa_timeval_store pa_timeval_store_dylibloader_orig_pulse
#define pa_timeval_load pa_timeval_load_dylibloader_orig_pulse
#define pa_rtclock_now pa_rtclock_now_dylibloader_orig_pulse
-#include <pulse/pulseaudio.h>
+#include "thirdparty/linuxbsd_headers/pulse/pulseaudio.h"
#undef pa_get_library_version
#undef pa_bytes_per_second
#undef pa_frame_size
@@ -447,10 +441,6 @@
#undef pa_format_info_get_prop_string
#undef pa_format_info_get_prop_string_array
#undef pa_format_info_free_string_array
-#undef pa_format_info_get_sample_format
-#undef pa_format_info_get_rate
-#undef pa_format_info_get_channels
-#undef pa_format_info_get_channel_map
#undef pa_format_info_set_prop_int
#undef pa_format_info_set_prop_int_array
#undef pa_format_info_set_prop_int_range
@@ -685,7 +675,6 @@
#undef pa_threaded_mainloop_get_api
#undef pa_threaded_mainloop_in_thread
#undef pa_threaded_mainloop_set_name
-#undef pa_threaded_mainloop_once_unlocked
#undef pa_mainloop_new
#undef pa_mainloop_free
#undef pa_mainloop_prepare
@@ -710,7 +699,6 @@
#undef pa_get_binary_name
#undef pa_path_get_filename
#undef pa_msleep
-#undef pa_thread_make_realtime
#undef pa_gettimeofday
#undef pa_timeval_diff
#undef pa_timeval_cmp
@@ -751,21 +739,21 @@ int (*pa_proplist_sets_dylibloader_wrapper_pulse)( pa_proplist*,const char*,cons
int (*pa_proplist_setp_dylibloader_wrapper_pulse)( pa_proplist*,const char*);
int (*pa_proplist_setf_dylibloader_wrapper_pulse)( pa_proplist*,const char*,const char*,...);
int (*pa_proplist_set_dylibloader_wrapper_pulse)( pa_proplist*,const char*,const void*, size_t);
-const char* (*pa_proplist_gets_dylibloader_wrapper_pulse)(const pa_proplist*,const char*);
-int (*pa_proplist_get_dylibloader_wrapper_pulse)(const pa_proplist*,const char*,const void**, size_t*);
+const char* (*pa_proplist_gets_dylibloader_wrapper_pulse)( pa_proplist*,const char*);
+int (*pa_proplist_get_dylibloader_wrapper_pulse)( pa_proplist*,const char*,const void**, size_t*);
void (*pa_proplist_update_dylibloader_wrapper_pulse)( pa_proplist*, pa_update_mode_t,const pa_proplist*);
int (*pa_proplist_unset_dylibloader_wrapper_pulse)( pa_proplist*,const char*);
int (*pa_proplist_unset_many_dylibloader_wrapper_pulse)( pa_proplist*,const char* []);
-const char* (*pa_proplist_iterate_dylibloader_wrapper_pulse)(const pa_proplist*, void**);
-char* (*pa_proplist_to_string_dylibloader_wrapper_pulse)(const pa_proplist*);
-char* (*pa_proplist_to_string_sep_dylibloader_wrapper_pulse)(const pa_proplist*,const char*);
+const char* (*pa_proplist_iterate_dylibloader_wrapper_pulse)( pa_proplist*, void**);
+char* (*pa_proplist_to_string_dylibloader_wrapper_pulse)( pa_proplist*);
+char* (*pa_proplist_to_string_sep_dylibloader_wrapper_pulse)( pa_proplist*,const char*);
pa_proplist* (*pa_proplist_from_string_dylibloader_wrapper_pulse)(const char*);
-int (*pa_proplist_contains_dylibloader_wrapper_pulse)(const pa_proplist*,const char*);
+int (*pa_proplist_contains_dylibloader_wrapper_pulse)( pa_proplist*,const char*);
void (*pa_proplist_clear_dylibloader_wrapper_pulse)( pa_proplist*);
pa_proplist* (*pa_proplist_copy_dylibloader_wrapper_pulse)(const pa_proplist*);
-unsigned (*pa_proplist_size_dylibloader_wrapper_pulse)(const pa_proplist*);
-int (*pa_proplist_isempty_dylibloader_wrapper_pulse)(const pa_proplist*);
-int (*pa_proplist_equal_dylibloader_wrapper_pulse)(const pa_proplist*,const pa_proplist*);
+unsigned (*pa_proplist_size_dylibloader_wrapper_pulse)( pa_proplist*);
+int (*pa_proplist_isempty_dylibloader_wrapper_pulse)( pa_proplist*);
+int (*pa_proplist_equal_dylibloader_wrapper_pulse)( pa_proplist*, pa_proplist*);
pa_channel_map* (*pa_channel_map_init_dylibloader_wrapper_pulse)( pa_channel_map*);
pa_channel_map* (*pa_channel_map_init_mono_dylibloader_wrapper_pulse)( pa_channel_map*);
pa_channel_map* (*pa_channel_map_init_stereo_dylibloader_wrapper_pulse)( pa_channel_map*);
@@ -806,10 +794,6 @@ int (*pa_format_info_get_prop_int_array_dylibloader_wrapper_pulse)(const pa_form
int (*pa_format_info_get_prop_string_dylibloader_wrapper_pulse)(const pa_format_info*,const char*, char**);
int (*pa_format_info_get_prop_string_array_dylibloader_wrapper_pulse)(const pa_format_info*,const char*, char***, int*);
void (*pa_format_info_free_string_array_dylibloader_wrapper_pulse)( char**, int);
-int (*pa_format_info_get_sample_format_dylibloader_wrapper_pulse)(const pa_format_info*, pa_sample_format_t*);
-int (*pa_format_info_get_rate_dylibloader_wrapper_pulse)(const pa_format_info*, uint32_t*);
-int (*pa_format_info_get_channels_dylibloader_wrapper_pulse)(const pa_format_info*, uint8_t*);
-int (*pa_format_info_get_channel_map_dylibloader_wrapper_pulse)(const pa_format_info*, pa_channel_map*);
void (*pa_format_info_set_prop_int_dylibloader_wrapper_pulse)( pa_format_info*,const char*, int);
void (*pa_format_info_set_prop_int_array_dylibloader_wrapper_pulse)( pa_format_info*,const char*,const int*, int);
void (*pa_format_info_set_prop_int_range_dylibloader_wrapper_pulse)( pa_format_info*,const char*, int, int);
@@ -822,34 +806,34 @@ void (*pa_format_info_set_channel_map_dylibloader_wrapper_pulse)( pa_format_info
pa_operation* (*pa_operation_ref_dylibloader_wrapper_pulse)( pa_operation*);
void (*pa_operation_unref_dylibloader_wrapper_pulse)( pa_operation*);
void (*pa_operation_cancel_dylibloader_wrapper_pulse)( pa_operation*);
-pa_operation_state_t (*pa_operation_get_state_dylibloader_wrapper_pulse)(const pa_operation*);
+pa_operation_state_t (*pa_operation_get_state_dylibloader_wrapper_pulse)( pa_operation*);
void (*pa_operation_set_state_callback_dylibloader_wrapper_pulse)( pa_operation*, pa_operation_notify_cb_t, void*);
pa_context* (*pa_context_new_dylibloader_wrapper_pulse)( pa_mainloop_api*,const char*);
-pa_context* (*pa_context_new_with_proplist_dylibloader_wrapper_pulse)( pa_mainloop_api*,const char*,const pa_proplist*);
+pa_context* (*pa_context_new_with_proplist_dylibloader_wrapper_pulse)( pa_mainloop_api*,const char*, pa_proplist*);
void (*pa_context_unref_dylibloader_wrapper_pulse)( pa_context*);
pa_context* (*pa_context_ref_dylibloader_wrapper_pulse)( pa_context*);
void (*pa_context_set_state_callback_dylibloader_wrapper_pulse)( pa_context*, pa_context_notify_cb_t, void*);
void (*pa_context_set_event_callback_dylibloader_wrapper_pulse)( pa_context*, pa_context_event_cb_t, void*);
-int (*pa_context_errno_dylibloader_wrapper_pulse)(const pa_context*);
-int (*pa_context_is_pending_dylibloader_wrapper_pulse)(const pa_context*);
-pa_context_state_t (*pa_context_get_state_dylibloader_wrapper_pulse)(const pa_context*);
+int (*pa_context_errno_dylibloader_wrapper_pulse)( pa_context*);
+int (*pa_context_is_pending_dylibloader_wrapper_pulse)( pa_context*);
+pa_context_state_t (*pa_context_get_state_dylibloader_wrapper_pulse)( pa_context*);
int (*pa_context_connect_dylibloader_wrapper_pulse)( pa_context*,const char*, pa_context_flags_t,const pa_spawn_api*);
void (*pa_context_disconnect_dylibloader_wrapper_pulse)( pa_context*);
pa_operation* (*pa_context_drain_dylibloader_wrapper_pulse)( pa_context*, pa_context_notify_cb_t, void*);
pa_operation* (*pa_context_exit_daemon_dylibloader_wrapper_pulse)( pa_context*, pa_context_success_cb_t, void*);
pa_operation* (*pa_context_set_default_sink_dylibloader_wrapper_pulse)( pa_context*,const char*, pa_context_success_cb_t, void*);
pa_operation* (*pa_context_set_default_source_dylibloader_wrapper_pulse)( pa_context*,const char*, pa_context_success_cb_t, void*);
-int (*pa_context_is_local_dylibloader_wrapper_pulse)(const pa_context*);
+int (*pa_context_is_local_dylibloader_wrapper_pulse)( pa_context*);
pa_operation* (*pa_context_set_name_dylibloader_wrapper_pulse)( pa_context*,const char*, pa_context_success_cb_t, void*);
-const char* (*pa_context_get_server_dylibloader_wrapper_pulse)(const pa_context*);
-uint32_t (*pa_context_get_protocol_version_dylibloader_wrapper_pulse)(const pa_context*);
-uint32_t (*pa_context_get_server_protocol_version_dylibloader_wrapper_pulse)(const pa_context*);
-pa_operation* (*pa_context_proplist_update_dylibloader_wrapper_pulse)( pa_context*, pa_update_mode_t,const pa_proplist*, pa_context_success_cb_t, void*);
+const char* (*pa_context_get_server_dylibloader_wrapper_pulse)( pa_context*);
+uint32_t (*pa_context_get_protocol_version_dylibloader_wrapper_pulse)( pa_context*);
+uint32_t (*pa_context_get_server_protocol_version_dylibloader_wrapper_pulse)( pa_context*);
+pa_operation* (*pa_context_proplist_update_dylibloader_wrapper_pulse)( pa_context*, pa_update_mode_t, pa_proplist*, pa_context_success_cb_t, void*);
pa_operation* (*pa_context_proplist_remove_dylibloader_wrapper_pulse)( pa_context*,const char* [], pa_context_success_cb_t, void*);
-uint32_t (*pa_context_get_index_dylibloader_wrapper_pulse)(const pa_context*);
-pa_time_event* (*pa_context_rttime_new_dylibloader_wrapper_pulse)(const pa_context*, pa_usec_t, pa_time_event_cb_t, void*);
-void (*pa_context_rttime_restart_dylibloader_wrapper_pulse)(const pa_context*, pa_time_event*, pa_usec_t);
-size_t (*pa_context_get_tile_size_dylibloader_wrapper_pulse)(const pa_context*,const pa_sample_spec*);
+uint32_t (*pa_context_get_index_dylibloader_wrapper_pulse)( pa_context*);
+pa_time_event* (*pa_context_rttime_new_dylibloader_wrapper_pulse)( pa_context*, pa_usec_t, pa_time_event_cb_t, void*);
+void (*pa_context_rttime_restart_dylibloader_wrapper_pulse)( pa_context*, pa_time_event*, pa_usec_t);
+size_t (*pa_context_get_tile_size_dylibloader_wrapper_pulse)( pa_context*,const pa_sample_spec*);
int (*pa_context_load_cookie_from_file_dylibloader_wrapper_pulse)( pa_context*,const char*);
int (*pa_cvolume_equal_dylibloader_wrapper_pulse)(const pa_cvolume*,const pa_cvolume*);
pa_cvolume* (*pa_cvolume_init_dylibloader_wrapper_pulse)( pa_cvolume*);
@@ -888,9 +872,9 @@ pa_cvolume* (*pa_cvolume_set_fade_dylibloader_wrapper_pulse)( pa_cvolume*,const
float (*pa_cvolume_get_lfe_balance_dylibloader_wrapper_pulse)(const pa_cvolume*,const pa_channel_map*);
pa_cvolume* (*pa_cvolume_set_lfe_balance_dylibloader_wrapper_pulse)( pa_cvolume*,const pa_channel_map*, float);
pa_cvolume* (*pa_cvolume_scale_dylibloader_wrapper_pulse)( pa_cvolume*, pa_volume_t);
-pa_cvolume* (*pa_cvolume_scale_mask_dylibloader_wrapper_pulse)( pa_cvolume*, pa_volume_t,const pa_channel_map*, pa_channel_position_mask_t);
+pa_cvolume* (*pa_cvolume_scale_mask_dylibloader_wrapper_pulse)( pa_cvolume*, pa_volume_t, pa_channel_map*, pa_channel_position_mask_t);
pa_cvolume* (*pa_cvolume_set_position_dylibloader_wrapper_pulse)( pa_cvolume*,const pa_channel_map*, pa_channel_position_t, pa_volume_t);
-pa_volume_t (*pa_cvolume_get_position_dylibloader_wrapper_pulse)(const pa_cvolume*,const pa_channel_map*, pa_channel_position_t);
+pa_volume_t (*pa_cvolume_get_position_dylibloader_wrapper_pulse)( pa_cvolume*,const pa_channel_map*, pa_channel_position_t);
pa_cvolume* (*pa_cvolume_merge_dylibloader_wrapper_pulse)( pa_cvolume*,const pa_cvolume*,const pa_cvolume*);
pa_cvolume* (*pa_cvolume_inc_clamp_dylibloader_wrapper_pulse)( pa_cvolume*, pa_volume_t, pa_volume_t);
pa_cvolume* (*pa_cvolume_inc_dylibloader_wrapper_pulse)( pa_cvolume*, pa_volume_t);
@@ -900,13 +884,13 @@ pa_stream* (*pa_stream_new_with_proplist_dylibloader_wrapper_pulse)( pa_context*
pa_stream* (*pa_stream_new_extended_dylibloader_wrapper_pulse)( pa_context*,const char*, pa_format_info**, unsigned int, pa_proplist*);
void (*pa_stream_unref_dylibloader_wrapper_pulse)( pa_stream*);
pa_stream* (*pa_stream_ref_dylibloader_wrapper_pulse)( pa_stream*);
-pa_stream_state_t (*pa_stream_get_state_dylibloader_wrapper_pulse)(const pa_stream*);
-pa_context* (*pa_stream_get_context_dylibloader_wrapper_pulse)(const pa_stream*);
-uint32_t (*pa_stream_get_index_dylibloader_wrapper_pulse)(const pa_stream*);
-uint32_t (*pa_stream_get_device_index_dylibloader_wrapper_pulse)(const pa_stream*);
-const char* (*pa_stream_get_device_name_dylibloader_wrapper_pulse)(const pa_stream*);
-int (*pa_stream_is_suspended_dylibloader_wrapper_pulse)(const pa_stream*);
-int (*pa_stream_is_corked_dylibloader_wrapper_pulse)(const pa_stream*);
+pa_stream_state_t (*pa_stream_get_state_dylibloader_wrapper_pulse)( pa_stream*);
+pa_context* (*pa_stream_get_context_dylibloader_wrapper_pulse)( pa_stream*);
+uint32_t (*pa_stream_get_index_dylibloader_wrapper_pulse)( pa_stream*);
+uint32_t (*pa_stream_get_device_index_dylibloader_wrapper_pulse)( pa_stream*);
+const char* (*pa_stream_get_device_name_dylibloader_wrapper_pulse)( pa_stream*);
+int (*pa_stream_is_suspended_dylibloader_wrapper_pulse)( pa_stream*);
+int (*pa_stream_is_corked_dylibloader_wrapper_pulse)( pa_stream*);
int (*pa_stream_connect_playback_dylibloader_wrapper_pulse)( pa_stream*,const char*,const pa_buffer_attr*, pa_stream_flags_t,const pa_cvolume*, pa_stream*);
int (*pa_stream_connect_record_dylibloader_wrapper_pulse)( pa_stream*,const char*,const pa_buffer_attr*, pa_stream_flags_t);
int (*pa_stream_disconnect_dylibloader_wrapper_pulse)( pa_stream*);
@@ -916,15 +900,15 @@ int (*pa_stream_write_dylibloader_wrapper_pulse)( pa_stream*,const void*, size_t
int (*pa_stream_write_ext_free_dylibloader_wrapper_pulse)( pa_stream*,const void*, size_t, pa_free_cb_t, void*, int64_t, pa_seek_mode_t);
int (*pa_stream_peek_dylibloader_wrapper_pulse)( pa_stream*,const void**, size_t*);
int (*pa_stream_drop_dylibloader_wrapper_pulse)( pa_stream*);
-size_t (*pa_stream_writable_size_dylibloader_wrapper_pulse)(const pa_stream*);
-size_t (*pa_stream_readable_size_dylibloader_wrapper_pulse)(const pa_stream*);
+size_t (*pa_stream_writable_size_dylibloader_wrapper_pulse)( pa_stream*);
+size_t (*pa_stream_readable_size_dylibloader_wrapper_pulse)( pa_stream*);
pa_operation* (*pa_stream_drain_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_success_cb_t, void*);
pa_operation* (*pa_stream_update_timing_info_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_success_cb_t, void*);
void (*pa_stream_set_state_callback_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_notify_cb_t, void*);
void (*pa_stream_set_write_callback_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_request_cb_t, void*);
void (*pa_stream_set_read_callback_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_request_cb_t, void*);
void (*pa_stream_set_overflow_callback_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_notify_cb_t, void*);
-int64_t (*pa_stream_get_underflow_index_dylibloader_wrapper_pulse)(const pa_stream*);
+int64_t (*pa_stream_get_underflow_index_dylibloader_wrapper_pulse)( pa_stream*);
void (*pa_stream_set_underflow_callback_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_notify_cb_t, void*);
void (*pa_stream_set_started_callback_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_notify_cb_t, void*);
void (*pa_stream_set_latency_update_callback_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_notify_cb_t, void*);
@@ -942,14 +926,14 @@ int (*pa_stream_get_latency_dylibloader_wrapper_pulse)( pa_stream*, pa_usec_t*,
const pa_timing_info* (*pa_stream_get_timing_info_dylibloader_wrapper_pulse)( pa_stream*);
const pa_sample_spec* (*pa_stream_get_sample_spec_dylibloader_wrapper_pulse)( pa_stream*);
const pa_channel_map* (*pa_stream_get_channel_map_dylibloader_wrapper_pulse)( pa_stream*);
-const pa_format_info* (*pa_stream_get_format_info_dylibloader_wrapper_pulse)(const pa_stream*);
+const pa_format_info* (*pa_stream_get_format_info_dylibloader_wrapper_pulse)( pa_stream*);
const pa_buffer_attr* (*pa_stream_get_buffer_attr_dylibloader_wrapper_pulse)( pa_stream*);
pa_operation* (*pa_stream_set_buffer_attr_dylibloader_wrapper_pulse)( pa_stream*,const pa_buffer_attr*, pa_stream_success_cb_t, void*);
pa_operation* (*pa_stream_update_sample_rate_dylibloader_wrapper_pulse)( pa_stream*, uint32_t, pa_stream_success_cb_t, void*);
pa_operation* (*pa_stream_proplist_update_dylibloader_wrapper_pulse)( pa_stream*, pa_update_mode_t, pa_proplist*, pa_stream_success_cb_t, void*);
pa_operation* (*pa_stream_proplist_remove_dylibloader_wrapper_pulse)( pa_stream*,const char* [], pa_stream_success_cb_t, void*);
int (*pa_stream_set_monitor_stream_dylibloader_wrapper_pulse)( pa_stream*, uint32_t);
-uint32_t (*pa_stream_get_monitor_stream_dylibloader_wrapper_pulse)(const pa_stream*);
+uint32_t (*pa_stream_get_monitor_stream_dylibloader_wrapper_pulse)( pa_stream*);
pa_operation* (*pa_context_get_sink_info_by_name_dylibloader_wrapper_pulse)( pa_context*,const char*, pa_sink_info_cb_t, void*);
pa_operation* (*pa_context_get_sink_info_by_index_dylibloader_wrapper_pulse)( pa_context*, uint32_t, pa_sink_info_cb_t, void*);
pa_operation* (*pa_context_get_sink_info_list_dylibloader_wrapper_pulse)( pa_context*, pa_sink_info_cb_t, void*);
@@ -1016,7 +1000,7 @@ int (*pa_stream_connect_upload_dylibloader_wrapper_pulse)( pa_stream*, size_t);
int (*pa_stream_finish_upload_dylibloader_wrapper_pulse)( pa_stream*);
pa_operation* (*pa_context_remove_sample_dylibloader_wrapper_pulse)( pa_context*,const char*, pa_context_success_cb_t, void*);
pa_operation* (*pa_context_play_sample_dylibloader_wrapper_pulse)( pa_context*,const char*,const char*, pa_volume_t, pa_context_success_cb_t, void*);
-pa_operation* (*pa_context_play_sample_with_proplist_dylibloader_wrapper_pulse)( pa_context*,const char*,const char*, pa_volume_t,const pa_proplist*, pa_context_play_sample_cb_t, void*);
+pa_operation* (*pa_context_play_sample_with_proplist_dylibloader_wrapper_pulse)( pa_context*,const char*,const char*, pa_volume_t, pa_proplist*, pa_context_play_sample_cb_t, void*);
const char* (*pa_strerror_dylibloader_wrapper_pulse)( int);
void* (*pa_xmalloc_dylibloader_wrapper_pulse)( size_t);
void* (*pa_xmalloc0_dylibloader_wrapper_pulse)( size_t);
@@ -1040,17 +1024,16 @@ void (*pa_threaded_mainloop_unlock_dylibloader_wrapper_pulse)( pa_threaded_mainl
void (*pa_threaded_mainloop_wait_dylibloader_wrapper_pulse)( pa_threaded_mainloop*);
void (*pa_threaded_mainloop_signal_dylibloader_wrapper_pulse)( pa_threaded_mainloop*, int);
void (*pa_threaded_mainloop_accept_dylibloader_wrapper_pulse)( pa_threaded_mainloop*);
-int (*pa_threaded_mainloop_get_retval_dylibloader_wrapper_pulse)(const pa_threaded_mainloop*);
+int (*pa_threaded_mainloop_get_retval_dylibloader_wrapper_pulse)( pa_threaded_mainloop*);
pa_mainloop_api* (*pa_threaded_mainloop_get_api_dylibloader_wrapper_pulse)( pa_threaded_mainloop*);
int (*pa_threaded_mainloop_in_thread_dylibloader_wrapper_pulse)( pa_threaded_mainloop*);
void (*pa_threaded_mainloop_set_name_dylibloader_wrapper_pulse)( pa_threaded_mainloop*,const char*);
-void (*pa_threaded_mainloop_once_unlocked_dylibloader_wrapper_pulse)( pa_threaded_mainloop*, void*, void*);
pa_mainloop* (*pa_mainloop_new_dylibloader_wrapper_pulse)( void);
void (*pa_mainloop_free_dylibloader_wrapper_pulse)( pa_mainloop*);
int (*pa_mainloop_prepare_dylibloader_wrapper_pulse)( pa_mainloop*, int);
int (*pa_mainloop_poll_dylibloader_wrapper_pulse)( pa_mainloop*);
int (*pa_mainloop_dispatch_dylibloader_wrapper_pulse)( pa_mainloop*);
-int (*pa_mainloop_get_retval_dylibloader_wrapper_pulse)(const pa_mainloop*);
+int (*pa_mainloop_get_retval_dylibloader_wrapper_pulse)( pa_mainloop*);
int (*pa_mainloop_iterate_dylibloader_wrapper_pulse)( pa_mainloop*, int, int*);
int (*pa_mainloop_run_dylibloader_wrapper_pulse)( pa_mainloop*, int*);
pa_mainloop_api* (*pa_mainloop_get_api_dylibloader_wrapper_pulse)( pa_mainloop*);
@@ -1069,7 +1052,6 @@ char* (*pa_get_home_dir_dylibloader_wrapper_pulse)( char*, size_t);
char* (*pa_get_binary_name_dylibloader_wrapper_pulse)( char*, size_t);
char* (*pa_path_get_filename_dylibloader_wrapper_pulse)(const char*);
int (*pa_msleep_dylibloader_wrapper_pulse)( unsigned long);
-int (*pa_thread_make_realtime_dylibloader_wrapper_pulse)( int);
struct timeval* (*pa_gettimeofday_dylibloader_wrapper_pulse)(struct timeval*);
pa_usec_t (*pa_timeval_diff_dylibloader_wrapper_pulse)(struct timeval*,struct timeval*);
int (*pa_timeval_cmp_dylibloader_wrapper_pulse)(struct timeval*,struct timeval*);
@@ -1762,38 +1744,6 @@ int initialize_pulse(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// pa_format_info_get_sample_format
- *(void **) (&pa_format_info_get_sample_format_dylibloader_wrapper_pulse) = dlsym(handle, "pa_format_info_get_sample_format");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// pa_format_info_get_rate
- *(void **) (&pa_format_info_get_rate_dylibloader_wrapper_pulse) = dlsym(handle, "pa_format_info_get_rate");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// pa_format_info_get_channels
- *(void **) (&pa_format_info_get_channels_dylibloader_wrapper_pulse) = dlsym(handle, "pa_format_info_get_channels");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// pa_format_info_get_channel_map
- *(void **) (&pa_format_info_get_channel_map_dylibloader_wrapper_pulse) = dlsym(handle, "pa_format_info_get_channel_map");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// pa_format_info_set_prop_int
*(void **) (&pa_format_info_set_prop_int_dylibloader_wrapper_pulse) = dlsym(handle, "pa_format_info_set_prop_int");
if (verbose) {
@@ -3666,14 +3616,6 @@ int initialize_pulse(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// pa_threaded_mainloop_once_unlocked
- *(void **) (&pa_threaded_mainloop_once_unlocked_dylibloader_wrapper_pulse) = dlsym(handle, "pa_threaded_mainloop_once_unlocked");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// pa_mainloop_new
*(void **) (&pa_mainloop_new_dylibloader_wrapper_pulse) = dlsym(handle, "pa_mainloop_new");
if (verbose) {
@@ -3866,14 +3808,6 @@ int initialize_pulse(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// pa_thread_make_realtime
- *(void **) (&pa_thread_make_realtime_dylibloader_wrapper_pulse) = dlsym(handle, "pa_thread_make_realtime");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// pa_gettimeofday
*(void **) (&pa_gettimeofday_dylibloader_wrapper_pulse) = dlsym(handle, "pa_gettimeofday");
if (verbose) {
diff --git a/drivers/pulseaudio/pulse-so_wrap.h b/drivers/pulseaudio/pulse-so_wrap.h
index 7f9a70fae1..bba8fd36a6 100644
--- a/drivers/pulseaudio/pulse-so_wrap.h
+++ b/drivers/pulseaudio/pulse-so_wrap.h
@@ -2,8 +2,8 @@
#define DYLIBLOAD_WRAPPER_PULSE
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by /home/hp/Projects/godot/pulse/generate-wrapper.py 0.3 on 2021-02-20 00:08:31
-// flags: /home/hp/Projects/godot/pulse/generate-wrapper.py --include /usr/include/pulse/pulseaudio.h --sys-include <pulse/pulseaudio.h> --soname libpulse.so.0 --omit-prefix _pa_ --init-name pulse --output-header pulse-so_wrap.h --output-implementation pulse-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-12 10:26:29
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/pulse/pulseaudio.h --sys-include "thirdparty/linuxbsd_headers/pulse/pulseaudio.h" --soname libpulse.so.0 --omit-prefix _pa_ --init-name pulse --output-header ./drivers/pulseaudio/pulse-so_wrap.h --output-implementation ./drivers/pulseaudio/pulse-so_wrap.c
//
#include <stdint.h>
@@ -91,10 +91,6 @@
#define pa_format_info_get_prop_string pa_format_info_get_prop_string_dylibloader_orig_pulse
#define pa_format_info_get_prop_string_array pa_format_info_get_prop_string_array_dylibloader_orig_pulse
#define pa_format_info_free_string_array pa_format_info_free_string_array_dylibloader_orig_pulse
-#define pa_format_info_get_sample_format pa_format_info_get_sample_format_dylibloader_orig_pulse
-#define pa_format_info_get_rate pa_format_info_get_rate_dylibloader_orig_pulse
-#define pa_format_info_get_channels pa_format_info_get_channels_dylibloader_orig_pulse
-#define pa_format_info_get_channel_map pa_format_info_get_channel_map_dylibloader_orig_pulse
#define pa_format_info_set_prop_int pa_format_info_set_prop_int_dylibloader_orig_pulse
#define pa_format_info_set_prop_int_array pa_format_info_set_prop_int_array_dylibloader_orig_pulse
#define pa_format_info_set_prop_int_range pa_format_info_set_prop_int_range_dylibloader_orig_pulse
@@ -329,7 +325,6 @@
#define pa_threaded_mainloop_get_api pa_threaded_mainloop_get_api_dylibloader_orig_pulse
#define pa_threaded_mainloop_in_thread pa_threaded_mainloop_in_thread_dylibloader_orig_pulse
#define pa_threaded_mainloop_set_name pa_threaded_mainloop_set_name_dylibloader_orig_pulse
-#define pa_threaded_mainloop_once_unlocked pa_threaded_mainloop_once_unlocked_dylibloader_orig_pulse
#define pa_mainloop_new pa_mainloop_new_dylibloader_orig_pulse
#define pa_mainloop_free pa_mainloop_free_dylibloader_orig_pulse
#define pa_mainloop_prepare pa_mainloop_prepare_dylibloader_orig_pulse
@@ -354,7 +349,6 @@
#define pa_get_binary_name pa_get_binary_name_dylibloader_orig_pulse
#define pa_path_get_filename pa_path_get_filename_dylibloader_orig_pulse
#define pa_msleep pa_msleep_dylibloader_orig_pulse
-#define pa_thread_make_realtime pa_thread_make_realtime_dylibloader_orig_pulse
#define pa_gettimeofday pa_gettimeofday_dylibloader_orig_pulse
#define pa_timeval_diff pa_timeval_diff_dylibloader_orig_pulse
#define pa_timeval_cmp pa_timeval_cmp_dylibloader_orig_pulse
@@ -364,7 +358,7 @@
#define pa_timeval_store pa_timeval_store_dylibloader_orig_pulse
#define pa_timeval_load pa_timeval_load_dylibloader_orig_pulse
#define pa_rtclock_now pa_rtclock_now_dylibloader_orig_pulse
-#include <pulse/pulseaudio.h>
+#include "thirdparty/linuxbsd_headers/pulse/pulseaudio.h"
#undef pa_get_library_version
#undef pa_bytes_per_second
#undef pa_frame_size
@@ -449,10 +443,6 @@
#undef pa_format_info_get_prop_string
#undef pa_format_info_get_prop_string_array
#undef pa_format_info_free_string_array
-#undef pa_format_info_get_sample_format
-#undef pa_format_info_get_rate
-#undef pa_format_info_get_channels
-#undef pa_format_info_get_channel_map
#undef pa_format_info_set_prop_int
#undef pa_format_info_set_prop_int_array
#undef pa_format_info_set_prop_int_range
@@ -687,7 +677,6 @@
#undef pa_threaded_mainloop_get_api
#undef pa_threaded_mainloop_in_thread
#undef pa_threaded_mainloop_set_name
-#undef pa_threaded_mainloop_once_unlocked
#undef pa_mainloop_new
#undef pa_mainloop_free
#undef pa_mainloop_prepare
@@ -712,7 +701,6 @@
#undef pa_get_binary_name
#undef pa_path_get_filename
#undef pa_msleep
-#undef pa_thread_make_realtime
#undef pa_gettimeofday
#undef pa_timeval_diff
#undef pa_timeval_cmp
@@ -809,10 +797,6 @@ extern "C" {
#define pa_format_info_get_prop_string pa_format_info_get_prop_string_dylibloader_wrapper_pulse
#define pa_format_info_get_prop_string_array pa_format_info_get_prop_string_array_dylibloader_wrapper_pulse
#define pa_format_info_free_string_array pa_format_info_free_string_array_dylibloader_wrapper_pulse
-#define pa_format_info_get_sample_format pa_format_info_get_sample_format_dylibloader_wrapper_pulse
-#define pa_format_info_get_rate pa_format_info_get_rate_dylibloader_wrapper_pulse
-#define pa_format_info_get_channels pa_format_info_get_channels_dylibloader_wrapper_pulse
-#define pa_format_info_get_channel_map pa_format_info_get_channel_map_dylibloader_wrapper_pulse
#define pa_format_info_set_prop_int pa_format_info_set_prop_int_dylibloader_wrapper_pulse
#define pa_format_info_set_prop_int_array pa_format_info_set_prop_int_array_dylibloader_wrapper_pulse
#define pa_format_info_set_prop_int_range pa_format_info_set_prop_int_range_dylibloader_wrapper_pulse
@@ -1047,7 +1031,6 @@ extern "C" {
#define pa_threaded_mainloop_get_api pa_threaded_mainloop_get_api_dylibloader_wrapper_pulse
#define pa_threaded_mainloop_in_thread pa_threaded_mainloop_in_thread_dylibloader_wrapper_pulse
#define pa_threaded_mainloop_set_name pa_threaded_mainloop_set_name_dylibloader_wrapper_pulse
-#define pa_threaded_mainloop_once_unlocked pa_threaded_mainloop_once_unlocked_dylibloader_wrapper_pulse
#define pa_mainloop_new pa_mainloop_new_dylibloader_wrapper_pulse
#define pa_mainloop_free pa_mainloop_free_dylibloader_wrapper_pulse
#define pa_mainloop_prepare pa_mainloop_prepare_dylibloader_wrapper_pulse
@@ -1072,7 +1055,6 @@ extern "C" {
#define pa_get_binary_name pa_get_binary_name_dylibloader_wrapper_pulse
#define pa_path_get_filename pa_path_get_filename_dylibloader_wrapper_pulse
#define pa_msleep pa_msleep_dylibloader_wrapper_pulse
-#define pa_thread_make_realtime pa_thread_make_realtime_dylibloader_wrapper_pulse
#define pa_gettimeofday pa_gettimeofday_dylibloader_wrapper_pulse
#define pa_timeval_diff pa_timeval_diff_dylibloader_wrapper_pulse
#define pa_timeval_cmp pa_timeval_cmp_dylibloader_wrapper_pulse
@@ -1111,21 +1093,21 @@ extern int (*pa_proplist_sets_dylibloader_wrapper_pulse)( pa_proplist*,const cha
extern int (*pa_proplist_setp_dylibloader_wrapper_pulse)( pa_proplist*,const char*);
extern int (*pa_proplist_setf_dylibloader_wrapper_pulse)( pa_proplist*,const char*,const char*,...);
extern int (*pa_proplist_set_dylibloader_wrapper_pulse)( pa_proplist*,const char*,const void*, size_t);
-extern const char* (*pa_proplist_gets_dylibloader_wrapper_pulse)(const pa_proplist*,const char*);
-extern int (*pa_proplist_get_dylibloader_wrapper_pulse)(const pa_proplist*,const char*,const void**, size_t*);
+extern const char* (*pa_proplist_gets_dylibloader_wrapper_pulse)( pa_proplist*,const char*);
+extern int (*pa_proplist_get_dylibloader_wrapper_pulse)( pa_proplist*,const char*,const void**, size_t*);
extern void (*pa_proplist_update_dylibloader_wrapper_pulse)( pa_proplist*, pa_update_mode_t,const pa_proplist*);
extern int (*pa_proplist_unset_dylibloader_wrapper_pulse)( pa_proplist*,const char*);
extern int (*pa_proplist_unset_many_dylibloader_wrapper_pulse)( pa_proplist*,const char* []);
-extern const char* (*pa_proplist_iterate_dylibloader_wrapper_pulse)(const pa_proplist*, void**);
-extern char* (*pa_proplist_to_string_dylibloader_wrapper_pulse)(const pa_proplist*);
-extern char* (*pa_proplist_to_string_sep_dylibloader_wrapper_pulse)(const pa_proplist*,const char*);
+extern const char* (*pa_proplist_iterate_dylibloader_wrapper_pulse)( pa_proplist*, void**);
+extern char* (*pa_proplist_to_string_dylibloader_wrapper_pulse)( pa_proplist*);
+extern char* (*pa_proplist_to_string_sep_dylibloader_wrapper_pulse)( pa_proplist*,const char*);
extern pa_proplist* (*pa_proplist_from_string_dylibloader_wrapper_pulse)(const char*);
-extern int (*pa_proplist_contains_dylibloader_wrapper_pulse)(const pa_proplist*,const char*);
+extern int (*pa_proplist_contains_dylibloader_wrapper_pulse)( pa_proplist*,const char*);
extern void (*pa_proplist_clear_dylibloader_wrapper_pulse)( pa_proplist*);
extern pa_proplist* (*pa_proplist_copy_dylibloader_wrapper_pulse)(const pa_proplist*);
-extern unsigned (*pa_proplist_size_dylibloader_wrapper_pulse)(const pa_proplist*);
-extern int (*pa_proplist_isempty_dylibloader_wrapper_pulse)(const pa_proplist*);
-extern int (*pa_proplist_equal_dylibloader_wrapper_pulse)(const pa_proplist*,const pa_proplist*);
+extern unsigned (*pa_proplist_size_dylibloader_wrapper_pulse)( pa_proplist*);
+extern int (*pa_proplist_isempty_dylibloader_wrapper_pulse)( pa_proplist*);
+extern int (*pa_proplist_equal_dylibloader_wrapper_pulse)( pa_proplist*, pa_proplist*);
extern pa_channel_map* (*pa_channel_map_init_dylibloader_wrapper_pulse)( pa_channel_map*);
extern pa_channel_map* (*pa_channel_map_init_mono_dylibloader_wrapper_pulse)( pa_channel_map*);
extern pa_channel_map* (*pa_channel_map_init_stereo_dylibloader_wrapper_pulse)( pa_channel_map*);
@@ -1166,10 +1148,6 @@ extern int (*pa_format_info_get_prop_int_array_dylibloader_wrapper_pulse)(const
extern int (*pa_format_info_get_prop_string_dylibloader_wrapper_pulse)(const pa_format_info*,const char*, char**);
extern int (*pa_format_info_get_prop_string_array_dylibloader_wrapper_pulse)(const pa_format_info*,const char*, char***, int*);
extern void (*pa_format_info_free_string_array_dylibloader_wrapper_pulse)( char**, int);
-extern int (*pa_format_info_get_sample_format_dylibloader_wrapper_pulse)(const pa_format_info*, pa_sample_format_t*);
-extern int (*pa_format_info_get_rate_dylibloader_wrapper_pulse)(const pa_format_info*, uint32_t*);
-extern int (*pa_format_info_get_channels_dylibloader_wrapper_pulse)(const pa_format_info*, uint8_t*);
-extern int (*pa_format_info_get_channel_map_dylibloader_wrapper_pulse)(const pa_format_info*, pa_channel_map*);
extern void (*pa_format_info_set_prop_int_dylibloader_wrapper_pulse)( pa_format_info*,const char*, int);
extern void (*pa_format_info_set_prop_int_array_dylibloader_wrapper_pulse)( pa_format_info*,const char*,const int*, int);
extern void (*pa_format_info_set_prop_int_range_dylibloader_wrapper_pulse)( pa_format_info*,const char*, int, int);
@@ -1182,34 +1160,34 @@ extern void (*pa_format_info_set_channel_map_dylibloader_wrapper_pulse)( pa_form
extern pa_operation* (*pa_operation_ref_dylibloader_wrapper_pulse)( pa_operation*);
extern void (*pa_operation_unref_dylibloader_wrapper_pulse)( pa_operation*);
extern void (*pa_operation_cancel_dylibloader_wrapper_pulse)( pa_operation*);
-extern pa_operation_state_t (*pa_operation_get_state_dylibloader_wrapper_pulse)(const pa_operation*);
+extern pa_operation_state_t (*pa_operation_get_state_dylibloader_wrapper_pulse)( pa_operation*);
extern void (*pa_operation_set_state_callback_dylibloader_wrapper_pulse)( pa_operation*, pa_operation_notify_cb_t, void*);
extern pa_context* (*pa_context_new_dylibloader_wrapper_pulse)( pa_mainloop_api*,const char*);
-extern pa_context* (*pa_context_new_with_proplist_dylibloader_wrapper_pulse)( pa_mainloop_api*,const char*,const pa_proplist*);
+extern pa_context* (*pa_context_new_with_proplist_dylibloader_wrapper_pulse)( pa_mainloop_api*,const char*, pa_proplist*);
extern void (*pa_context_unref_dylibloader_wrapper_pulse)( pa_context*);
extern pa_context* (*pa_context_ref_dylibloader_wrapper_pulse)( pa_context*);
extern void (*pa_context_set_state_callback_dylibloader_wrapper_pulse)( pa_context*, pa_context_notify_cb_t, void*);
extern void (*pa_context_set_event_callback_dylibloader_wrapper_pulse)( pa_context*, pa_context_event_cb_t, void*);
-extern int (*pa_context_errno_dylibloader_wrapper_pulse)(const pa_context*);
-extern int (*pa_context_is_pending_dylibloader_wrapper_pulse)(const pa_context*);
-extern pa_context_state_t (*pa_context_get_state_dylibloader_wrapper_pulse)(const pa_context*);
+extern int (*pa_context_errno_dylibloader_wrapper_pulse)( pa_context*);
+extern int (*pa_context_is_pending_dylibloader_wrapper_pulse)( pa_context*);
+extern pa_context_state_t (*pa_context_get_state_dylibloader_wrapper_pulse)( pa_context*);
extern int (*pa_context_connect_dylibloader_wrapper_pulse)( pa_context*,const char*, pa_context_flags_t,const pa_spawn_api*);
extern void (*pa_context_disconnect_dylibloader_wrapper_pulse)( pa_context*);
extern pa_operation* (*pa_context_drain_dylibloader_wrapper_pulse)( pa_context*, pa_context_notify_cb_t, void*);
extern pa_operation* (*pa_context_exit_daemon_dylibloader_wrapper_pulse)( pa_context*, pa_context_success_cb_t, void*);
extern pa_operation* (*pa_context_set_default_sink_dylibloader_wrapper_pulse)( pa_context*,const char*, pa_context_success_cb_t, void*);
extern pa_operation* (*pa_context_set_default_source_dylibloader_wrapper_pulse)( pa_context*,const char*, pa_context_success_cb_t, void*);
-extern int (*pa_context_is_local_dylibloader_wrapper_pulse)(const pa_context*);
+extern int (*pa_context_is_local_dylibloader_wrapper_pulse)( pa_context*);
extern pa_operation* (*pa_context_set_name_dylibloader_wrapper_pulse)( pa_context*,const char*, pa_context_success_cb_t, void*);
-extern const char* (*pa_context_get_server_dylibloader_wrapper_pulse)(const pa_context*);
-extern uint32_t (*pa_context_get_protocol_version_dylibloader_wrapper_pulse)(const pa_context*);
-extern uint32_t (*pa_context_get_server_protocol_version_dylibloader_wrapper_pulse)(const pa_context*);
-extern pa_operation* (*pa_context_proplist_update_dylibloader_wrapper_pulse)( pa_context*, pa_update_mode_t,const pa_proplist*, pa_context_success_cb_t, void*);
+extern const char* (*pa_context_get_server_dylibloader_wrapper_pulse)( pa_context*);
+extern uint32_t (*pa_context_get_protocol_version_dylibloader_wrapper_pulse)( pa_context*);
+extern uint32_t (*pa_context_get_server_protocol_version_dylibloader_wrapper_pulse)( pa_context*);
+extern pa_operation* (*pa_context_proplist_update_dylibloader_wrapper_pulse)( pa_context*, pa_update_mode_t, pa_proplist*, pa_context_success_cb_t, void*);
extern pa_operation* (*pa_context_proplist_remove_dylibloader_wrapper_pulse)( pa_context*,const char* [], pa_context_success_cb_t, void*);
-extern uint32_t (*pa_context_get_index_dylibloader_wrapper_pulse)(const pa_context*);
-extern pa_time_event* (*pa_context_rttime_new_dylibloader_wrapper_pulse)(const pa_context*, pa_usec_t, pa_time_event_cb_t, void*);
-extern void (*pa_context_rttime_restart_dylibloader_wrapper_pulse)(const pa_context*, pa_time_event*, pa_usec_t);
-extern size_t (*pa_context_get_tile_size_dylibloader_wrapper_pulse)(const pa_context*,const pa_sample_spec*);
+extern uint32_t (*pa_context_get_index_dylibloader_wrapper_pulse)( pa_context*);
+extern pa_time_event* (*pa_context_rttime_new_dylibloader_wrapper_pulse)( pa_context*, pa_usec_t, pa_time_event_cb_t, void*);
+extern void (*pa_context_rttime_restart_dylibloader_wrapper_pulse)( pa_context*, pa_time_event*, pa_usec_t);
+extern size_t (*pa_context_get_tile_size_dylibloader_wrapper_pulse)( pa_context*,const pa_sample_spec*);
extern int (*pa_context_load_cookie_from_file_dylibloader_wrapper_pulse)( pa_context*,const char*);
extern int (*pa_cvolume_equal_dylibloader_wrapper_pulse)(const pa_cvolume*,const pa_cvolume*);
extern pa_cvolume* (*pa_cvolume_init_dylibloader_wrapper_pulse)( pa_cvolume*);
@@ -1248,9 +1226,9 @@ extern pa_cvolume* (*pa_cvolume_set_fade_dylibloader_wrapper_pulse)( pa_cvolume*
extern float (*pa_cvolume_get_lfe_balance_dylibloader_wrapper_pulse)(const pa_cvolume*,const pa_channel_map*);
extern pa_cvolume* (*pa_cvolume_set_lfe_balance_dylibloader_wrapper_pulse)( pa_cvolume*,const pa_channel_map*, float);
extern pa_cvolume* (*pa_cvolume_scale_dylibloader_wrapper_pulse)( pa_cvolume*, pa_volume_t);
-extern pa_cvolume* (*pa_cvolume_scale_mask_dylibloader_wrapper_pulse)( pa_cvolume*, pa_volume_t,const pa_channel_map*, pa_channel_position_mask_t);
+extern pa_cvolume* (*pa_cvolume_scale_mask_dylibloader_wrapper_pulse)( pa_cvolume*, pa_volume_t, pa_channel_map*, pa_channel_position_mask_t);
extern pa_cvolume* (*pa_cvolume_set_position_dylibloader_wrapper_pulse)( pa_cvolume*,const pa_channel_map*, pa_channel_position_t, pa_volume_t);
-extern pa_volume_t (*pa_cvolume_get_position_dylibloader_wrapper_pulse)(const pa_cvolume*,const pa_channel_map*, pa_channel_position_t);
+extern pa_volume_t (*pa_cvolume_get_position_dylibloader_wrapper_pulse)( pa_cvolume*,const pa_channel_map*, pa_channel_position_t);
extern pa_cvolume* (*pa_cvolume_merge_dylibloader_wrapper_pulse)( pa_cvolume*,const pa_cvolume*,const pa_cvolume*);
extern pa_cvolume* (*pa_cvolume_inc_clamp_dylibloader_wrapper_pulse)( pa_cvolume*, pa_volume_t, pa_volume_t);
extern pa_cvolume* (*pa_cvolume_inc_dylibloader_wrapper_pulse)( pa_cvolume*, pa_volume_t);
@@ -1260,13 +1238,13 @@ extern pa_stream* (*pa_stream_new_with_proplist_dylibloader_wrapper_pulse)( pa_c
extern pa_stream* (*pa_stream_new_extended_dylibloader_wrapper_pulse)( pa_context*,const char*, pa_format_info**, unsigned int, pa_proplist*);
extern void (*pa_stream_unref_dylibloader_wrapper_pulse)( pa_stream*);
extern pa_stream* (*pa_stream_ref_dylibloader_wrapper_pulse)( pa_stream*);
-extern pa_stream_state_t (*pa_stream_get_state_dylibloader_wrapper_pulse)(const pa_stream*);
-extern pa_context* (*pa_stream_get_context_dylibloader_wrapper_pulse)(const pa_stream*);
-extern uint32_t (*pa_stream_get_index_dylibloader_wrapper_pulse)(const pa_stream*);
-extern uint32_t (*pa_stream_get_device_index_dylibloader_wrapper_pulse)(const pa_stream*);
-extern const char* (*pa_stream_get_device_name_dylibloader_wrapper_pulse)(const pa_stream*);
-extern int (*pa_stream_is_suspended_dylibloader_wrapper_pulse)(const pa_stream*);
-extern int (*pa_stream_is_corked_dylibloader_wrapper_pulse)(const pa_stream*);
+extern pa_stream_state_t (*pa_stream_get_state_dylibloader_wrapper_pulse)( pa_stream*);
+extern pa_context* (*pa_stream_get_context_dylibloader_wrapper_pulse)( pa_stream*);
+extern uint32_t (*pa_stream_get_index_dylibloader_wrapper_pulse)( pa_stream*);
+extern uint32_t (*pa_stream_get_device_index_dylibloader_wrapper_pulse)( pa_stream*);
+extern const char* (*pa_stream_get_device_name_dylibloader_wrapper_pulse)( pa_stream*);
+extern int (*pa_stream_is_suspended_dylibloader_wrapper_pulse)( pa_stream*);
+extern int (*pa_stream_is_corked_dylibloader_wrapper_pulse)( pa_stream*);
extern int (*pa_stream_connect_playback_dylibloader_wrapper_pulse)( pa_stream*,const char*,const pa_buffer_attr*, pa_stream_flags_t,const pa_cvolume*, pa_stream*);
extern int (*pa_stream_connect_record_dylibloader_wrapper_pulse)( pa_stream*,const char*,const pa_buffer_attr*, pa_stream_flags_t);
extern int (*pa_stream_disconnect_dylibloader_wrapper_pulse)( pa_stream*);
@@ -1276,15 +1254,15 @@ extern int (*pa_stream_write_dylibloader_wrapper_pulse)( pa_stream*,const void*,
extern int (*pa_stream_write_ext_free_dylibloader_wrapper_pulse)( pa_stream*,const void*, size_t, pa_free_cb_t, void*, int64_t, pa_seek_mode_t);
extern int (*pa_stream_peek_dylibloader_wrapper_pulse)( pa_stream*,const void**, size_t*);
extern int (*pa_stream_drop_dylibloader_wrapper_pulse)( pa_stream*);
-extern size_t (*pa_stream_writable_size_dylibloader_wrapper_pulse)(const pa_stream*);
-extern size_t (*pa_stream_readable_size_dylibloader_wrapper_pulse)(const pa_stream*);
+extern size_t (*pa_stream_writable_size_dylibloader_wrapper_pulse)( pa_stream*);
+extern size_t (*pa_stream_readable_size_dylibloader_wrapper_pulse)( pa_stream*);
extern pa_operation* (*pa_stream_drain_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_success_cb_t, void*);
extern pa_operation* (*pa_stream_update_timing_info_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_success_cb_t, void*);
extern void (*pa_stream_set_state_callback_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_notify_cb_t, void*);
extern void (*pa_stream_set_write_callback_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_request_cb_t, void*);
extern void (*pa_stream_set_read_callback_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_request_cb_t, void*);
extern void (*pa_stream_set_overflow_callback_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_notify_cb_t, void*);
-extern int64_t (*pa_stream_get_underflow_index_dylibloader_wrapper_pulse)(const pa_stream*);
+extern int64_t (*pa_stream_get_underflow_index_dylibloader_wrapper_pulse)( pa_stream*);
extern void (*pa_stream_set_underflow_callback_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_notify_cb_t, void*);
extern void (*pa_stream_set_started_callback_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_notify_cb_t, void*);
extern void (*pa_stream_set_latency_update_callback_dylibloader_wrapper_pulse)( pa_stream*, pa_stream_notify_cb_t, void*);
@@ -1302,14 +1280,14 @@ extern int (*pa_stream_get_latency_dylibloader_wrapper_pulse)( pa_stream*, pa_us
extern const pa_timing_info* (*pa_stream_get_timing_info_dylibloader_wrapper_pulse)( pa_stream*);
extern const pa_sample_spec* (*pa_stream_get_sample_spec_dylibloader_wrapper_pulse)( pa_stream*);
extern const pa_channel_map* (*pa_stream_get_channel_map_dylibloader_wrapper_pulse)( pa_stream*);
-extern const pa_format_info* (*pa_stream_get_format_info_dylibloader_wrapper_pulse)(const pa_stream*);
+extern const pa_format_info* (*pa_stream_get_format_info_dylibloader_wrapper_pulse)( pa_stream*);
extern const pa_buffer_attr* (*pa_stream_get_buffer_attr_dylibloader_wrapper_pulse)( pa_stream*);
extern pa_operation* (*pa_stream_set_buffer_attr_dylibloader_wrapper_pulse)( pa_stream*,const pa_buffer_attr*, pa_stream_success_cb_t, void*);
extern pa_operation* (*pa_stream_update_sample_rate_dylibloader_wrapper_pulse)( pa_stream*, uint32_t, pa_stream_success_cb_t, void*);
extern pa_operation* (*pa_stream_proplist_update_dylibloader_wrapper_pulse)( pa_stream*, pa_update_mode_t, pa_proplist*, pa_stream_success_cb_t, void*);
extern pa_operation* (*pa_stream_proplist_remove_dylibloader_wrapper_pulse)( pa_stream*,const char* [], pa_stream_success_cb_t, void*);
extern int (*pa_stream_set_monitor_stream_dylibloader_wrapper_pulse)( pa_stream*, uint32_t);
-extern uint32_t (*pa_stream_get_monitor_stream_dylibloader_wrapper_pulse)(const pa_stream*);
+extern uint32_t (*pa_stream_get_monitor_stream_dylibloader_wrapper_pulse)( pa_stream*);
extern pa_operation* (*pa_context_get_sink_info_by_name_dylibloader_wrapper_pulse)( pa_context*,const char*, pa_sink_info_cb_t, void*);
extern pa_operation* (*pa_context_get_sink_info_by_index_dylibloader_wrapper_pulse)( pa_context*, uint32_t, pa_sink_info_cb_t, void*);
extern pa_operation* (*pa_context_get_sink_info_list_dylibloader_wrapper_pulse)( pa_context*, pa_sink_info_cb_t, void*);
@@ -1376,7 +1354,7 @@ extern int (*pa_stream_connect_upload_dylibloader_wrapper_pulse)( pa_stream*, si
extern int (*pa_stream_finish_upload_dylibloader_wrapper_pulse)( pa_stream*);
extern pa_operation* (*pa_context_remove_sample_dylibloader_wrapper_pulse)( pa_context*,const char*, pa_context_success_cb_t, void*);
extern pa_operation* (*pa_context_play_sample_dylibloader_wrapper_pulse)( pa_context*,const char*,const char*, pa_volume_t, pa_context_success_cb_t, void*);
-extern pa_operation* (*pa_context_play_sample_with_proplist_dylibloader_wrapper_pulse)( pa_context*,const char*,const char*, pa_volume_t,const pa_proplist*, pa_context_play_sample_cb_t, void*);
+extern pa_operation* (*pa_context_play_sample_with_proplist_dylibloader_wrapper_pulse)( pa_context*,const char*,const char*, pa_volume_t, pa_proplist*, pa_context_play_sample_cb_t, void*);
extern const char* (*pa_strerror_dylibloader_wrapper_pulse)( int);
extern void* (*pa_xmalloc_dylibloader_wrapper_pulse)( size_t);
extern void* (*pa_xmalloc0_dylibloader_wrapper_pulse)( size_t);
@@ -1400,17 +1378,16 @@ extern void (*pa_threaded_mainloop_unlock_dylibloader_wrapper_pulse)( pa_threade
extern void (*pa_threaded_mainloop_wait_dylibloader_wrapper_pulse)( pa_threaded_mainloop*);
extern void (*pa_threaded_mainloop_signal_dylibloader_wrapper_pulse)( pa_threaded_mainloop*, int);
extern void (*pa_threaded_mainloop_accept_dylibloader_wrapper_pulse)( pa_threaded_mainloop*);
-extern int (*pa_threaded_mainloop_get_retval_dylibloader_wrapper_pulse)(const pa_threaded_mainloop*);
+extern int (*pa_threaded_mainloop_get_retval_dylibloader_wrapper_pulse)( pa_threaded_mainloop*);
extern pa_mainloop_api* (*pa_threaded_mainloop_get_api_dylibloader_wrapper_pulse)( pa_threaded_mainloop*);
extern int (*pa_threaded_mainloop_in_thread_dylibloader_wrapper_pulse)( pa_threaded_mainloop*);
extern void (*pa_threaded_mainloop_set_name_dylibloader_wrapper_pulse)( pa_threaded_mainloop*,const char*);
-extern void (*pa_threaded_mainloop_once_unlocked_dylibloader_wrapper_pulse)( pa_threaded_mainloop*, void*, void*);
extern pa_mainloop* (*pa_mainloop_new_dylibloader_wrapper_pulse)( void);
extern void (*pa_mainloop_free_dylibloader_wrapper_pulse)( pa_mainloop*);
extern int (*pa_mainloop_prepare_dylibloader_wrapper_pulse)( pa_mainloop*, int);
extern int (*pa_mainloop_poll_dylibloader_wrapper_pulse)( pa_mainloop*);
extern int (*pa_mainloop_dispatch_dylibloader_wrapper_pulse)( pa_mainloop*);
-extern int (*pa_mainloop_get_retval_dylibloader_wrapper_pulse)(const pa_mainloop*);
+extern int (*pa_mainloop_get_retval_dylibloader_wrapper_pulse)( pa_mainloop*);
extern int (*pa_mainloop_iterate_dylibloader_wrapper_pulse)( pa_mainloop*, int, int*);
extern int (*pa_mainloop_run_dylibloader_wrapper_pulse)( pa_mainloop*, int*);
extern pa_mainloop_api* (*pa_mainloop_get_api_dylibloader_wrapper_pulse)( pa_mainloop*);
@@ -1429,7 +1406,6 @@ extern char* (*pa_get_home_dir_dylibloader_wrapper_pulse)( char*, size_t);
extern char* (*pa_get_binary_name_dylibloader_wrapper_pulse)( char*, size_t);
extern char* (*pa_path_get_filename_dylibloader_wrapper_pulse)(const char*);
extern int (*pa_msleep_dylibloader_wrapper_pulse)( unsigned long);
-extern int (*pa_thread_make_realtime_dylibloader_wrapper_pulse)( int);
extern struct timeval* (*pa_gettimeofday_dylibloader_wrapper_pulse)(struct timeval*);
extern pa_usec_t (*pa_timeval_diff_dylibloader_wrapper_pulse)(struct timeval*,struct timeval*);
extern int (*pa_timeval_cmp_dylibloader_wrapper_pulse)(struct timeval*,struct timeval*);
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index 6c833c8a26..42146cd7ec 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -1666,34 +1666,27 @@ RID RenderingDeviceVulkan::texture_create(const TextureFormat &p_format, const T
image_create_info.pNext = nullptr;
image_create_info.flags = 0;
- // TODO: Check for support via RenderingDevice to enable on mobile when possible.
-
-#ifndef ANDROID_ENABLED
-
- // vkCreateImage fails with format list on Android (VK_ERROR_OUT_OF_HOST_MEMORY)
VkImageFormatListCreateInfoKHR format_list_create_info; // Keep out of the if, needed for creation.
Vector<VkFormat> allowed_formats; // Keep out of the if, needed for creation.
-#endif
if (p_format.shareable_formats.size()) {
image_create_info.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
-#ifndef ANDROID_ENABLED
-
- for (int i = 0; i < p_format.shareable_formats.size(); i++) {
- allowed_formats.push_back(vulkan_formats[p_format.shareable_formats[i]]);
- }
+ if (context->is_device_extension_enabled(VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME)) {
+ for (int i = 0; i < p_format.shareable_formats.size(); i++) {
+ allowed_formats.push_back(vulkan_formats[p_format.shareable_formats[i]]);
+ }
- format_list_create_info.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR;
- format_list_create_info.pNext = nullptr;
- format_list_create_info.viewFormatCount = allowed_formats.size();
- format_list_create_info.pViewFormats = allowed_formats.ptr();
- image_create_info.pNext = &format_list_create_info;
+ format_list_create_info.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR;
+ format_list_create_info.pNext = nullptr;
+ format_list_create_info.viewFormatCount = allowed_formats.size();
+ format_list_create_info.pViewFormats = allowed_formats.ptr();
+ image_create_info.pNext = &format_list_create_info;
- ERR_FAIL_COND_V_MSG(p_format.shareable_formats.find(p_format.format) == -1, RID(),
- "If supplied a list of shareable formats, the current format must be present in the list");
- ERR_FAIL_COND_V_MSG(p_view.format_override != DATA_FORMAT_MAX && p_format.shareable_formats.find(p_view.format_override) == -1, RID(),
- "If supplied a list of shareable formats, the current view format override must be present in the list");
-#endif
+ ERR_FAIL_COND_V_MSG(p_format.shareable_formats.find(p_format.format) == -1, RID(),
+ "If supplied a list of shareable formats, the current format must be present in the list");
+ ERR_FAIL_COND_V_MSG(p_view.format_override != DATA_FORMAT_MAX && p_format.shareable_formats.find(p_view.format_override) == -1, RID(),
+ "If supplied a list of shareable formats, the current view format override must be present in the list");
+ }
}
if (p_format.texture_type == TEXTURE_TYPE_CUBE || p_format.texture_type == TEXTURE_TYPE_CUBE_ARRAY) {
@@ -2096,49 +2089,54 @@ RID RenderingDeviceVulkan::texture_create_shared(const TextureView &p_view, RID
}
VkImageViewUsageCreateInfo usage_info;
- usage_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO;
- usage_info.pNext = nullptr;
- if (p_view.format_override != DATA_FORMAT_MAX) {
- // Need to validate usage with vulkan.
+ if (context->is_device_extension_enabled(VK_KHR_MAINTENANCE_2_EXTENSION_NAME)) {
+ // May need to make VK_KHR_maintenance2 manditory and thus has Vulkan 1.1 be our minimum supported version
+ // if we require setting this information. Vulkan 1.0 may simply not care..
- usage_info.usage = 0;
+ usage_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO;
+ usage_info.pNext = nullptr;
+ if (p_view.format_override != DATA_FORMAT_MAX) {
+ // Need to validate usage with vulkan.
- if (texture.usage_flags & TEXTURE_USAGE_SAMPLING_BIT) {
- usage_info.usage |= VK_IMAGE_USAGE_SAMPLED_BIT;
- }
+ usage_info.usage = 0;
- if (texture.usage_flags & TEXTURE_USAGE_STORAGE_BIT) {
- if (texture_is_format_supported_for_usage(p_view.format_override, TEXTURE_USAGE_STORAGE_BIT)) {
- usage_info.usage |= VK_IMAGE_USAGE_STORAGE_BIT;
+ if (texture.usage_flags & TEXTURE_USAGE_SAMPLING_BIT) {
+ usage_info.usage |= VK_IMAGE_USAGE_SAMPLED_BIT;
}
- }
- if (texture.usage_flags & TEXTURE_USAGE_COLOR_ATTACHMENT_BIT) {
- if (texture_is_format_supported_for_usage(p_view.format_override, TEXTURE_USAGE_COLOR_ATTACHMENT_BIT)) {
- usage_info.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
+ if (texture.usage_flags & TEXTURE_USAGE_STORAGE_BIT) {
+ if (texture_is_format_supported_for_usage(p_view.format_override, TEXTURE_USAGE_STORAGE_BIT)) {
+ usage_info.usage |= VK_IMAGE_USAGE_STORAGE_BIT;
+ }
}
- }
- if (texture.usage_flags & TEXTURE_USAGE_INPUT_ATTACHMENT_BIT) {
- usage_info.usage |= VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
- }
+ if (texture.usage_flags & TEXTURE_USAGE_COLOR_ATTACHMENT_BIT) {
+ if (texture_is_format_supported_for_usage(p_view.format_override, TEXTURE_USAGE_COLOR_ATTACHMENT_BIT)) {
+ usage_info.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
+ }
+ }
- if (texture.usage_flags & TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) {
- usage_info.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
- }
+ if (texture.usage_flags & TEXTURE_USAGE_INPUT_ATTACHMENT_BIT) {
+ usage_info.usage |= VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
+ }
- if (texture.usage_flags & TEXTURE_USAGE_CAN_UPDATE_BIT) {
- usage_info.usage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
- }
- if (texture.usage_flags & TEXTURE_USAGE_CAN_COPY_FROM_BIT) {
- usage_info.usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
- }
+ if (texture.usage_flags & TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) {
+ usage_info.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
+ }
- if (texture.usage_flags & TEXTURE_USAGE_CAN_COPY_TO_BIT) {
- usage_info.usage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
- }
+ if (texture.usage_flags & TEXTURE_USAGE_CAN_UPDATE_BIT) {
+ usage_info.usage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
+ }
+ if (texture.usage_flags & TEXTURE_USAGE_CAN_COPY_FROM_BIT) {
+ usage_info.usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
+ }
- image_view_create_info.pNext = &usage_info;
+ if (texture.usage_flags & TEXTURE_USAGE_CAN_COPY_TO_BIT) {
+ usage_info.usage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
+ }
+
+ image_view_create_info.pNext = &usage_info;
+ }
}
VkResult err = vkCreateImageView(device, &image_view_create_info, nullptr, &texture.view);
@@ -4278,7 +4276,7 @@ RID RenderingDeviceVulkan::sampler_create(const SamplerState &p_state) {
sampler_create_info.addressModeW = address_modes[p_state.repeat_w];
sampler_create_info.mipLodBias = p_state.lod_bias;
- sampler_create_info.anisotropyEnable = p_state.use_anisotropy;
+ sampler_create_info.anisotropyEnable = p_state.use_anisotropy && context->get_physical_device_features().samplerAnisotropy;
sampler_create_info.maxAnisotropy = p_state.anisotropy_max;
sampler_create_info.compareEnable = p_state.enable_compare;
@@ -9368,11 +9366,11 @@ bool RenderingDeviceVulkan::has_feature(const Features p_feature) const {
return multiview_capabilies.is_supported && multiview_capabilies.max_view_count > 1;
} break;
case SUPPORTS_FSR_HALF_FLOAT: {
- return context->get_shader_capabilities().shader_float16_is_supported && context->get_storage_buffer_capabilities().storage_buffer_16_bit_access_is_supported;
+ return context->get_shader_capabilities().shader_float16_is_supported && context->get_physical_device_features().shaderInt16 && context->get_storage_buffer_capabilities().storage_buffer_16_bit_access_is_supported;
} break;
case SUPPORTS_ATTACHMENT_VRS: {
VulkanContext::VRSCapabilities vrs_capabilities = context->get_vrs_capabilities();
- return vrs_capabilities.attachment_vrs_supported;
+ return vrs_capabilities.attachment_vrs_supported && context->get_physical_device_features().shaderStorageImageExtendedFormats;
} break;
default: {
return false;
diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp
index 0bccefede8..d1391cb53e 100644
--- a/drivers/vulkan/vulkan_context.cpp
+++ b/drivers/vulkan/vulkan_context.cpp
@@ -353,11 +353,11 @@ Error VulkanContext::_get_preferred_validation_layers(uint32_t *count, const cha
ERR_FAIL_V(ERR_CANT_CREATE);
}
- for (uint32_t i = 0; i < instance_validation_layers_alt.size(); i++) {
- if (_check_layers(instance_validation_layers_alt[i].size(), instance_validation_layers_alt[i].ptr(), instance_layer_count, instance_layers)) {
- *count = instance_validation_layers_alt[i].size();
+ for (const LocalVector<const char *> &layer : instance_validation_layers_alt) {
+ if (_check_layers(layer.size(), layer.ptr(), instance_layer_count, instance_layers)) {
+ *count = layer.size();
if (names != nullptr) {
- *names = instance_validation_layers_alt[i].ptr();
+ *names = layer.ptr();
}
break;
}
@@ -413,6 +413,7 @@ Error VulkanContext::_initialize_instance_extensions() {
register_requested_instance_extension(VK_EXT_DEBUG_REPORT_EXTENSION_NAME, false);
}
+ // This extension allows us to use the properties2 features to query additional device capabilities
register_requested_instance_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, false);
// Only enable debug utils in verbose mode or DEV_ENABLED.
@@ -493,7 +494,10 @@ Error VulkanContext::_initialize_device_extensions() {
register_requested_device_extension(VK_KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME, false);
register_requested_device_extension(VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME, false);
register_requested_device_extension(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME, false);
+ register_requested_device_extension(VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME, false);
register_requested_device_extension(VK_KHR_16BIT_STORAGE_EXTENSION_NAME, false);
+ register_requested_device_extension(VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME, false);
+ register_requested_device_extension(VK_KHR_MAINTENANCE_2_EXTENSION_NAME, false);
// TODO consider the following extensions:
// - VK_KHR_spirv_1_4
@@ -744,48 +748,90 @@ Error VulkanContext::_check_capabilities() {
}
if (vkGetPhysicalDeviceFeatures2_func != nullptr) {
// Check our extended features.
- VkPhysicalDeviceFragmentShadingRateFeaturesKHR vrs_features = {
- /*sType*/ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR,
- /*pNext*/ nullptr,
- /*pipelineFragmentShadingRate*/ false,
- /*primitiveFragmentShadingRate*/ false,
- /*attachmentFragmentShadingRate*/ false,
- };
+ void *next = nullptr;
- VkPhysicalDeviceShaderFloat16Int8FeaturesKHR shader_features = {
- /*sType*/ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES_KHR,
- /*pNext*/ &vrs_features,
- /*shaderFloat16*/ false,
- /*shaderInt8*/ false,
- };
+ // We must check that the relative extension is present before assuming a
+ // feature as enabled.
+ // See also: https://github.com/godotengine/godot/issues/65409
- VkPhysicalDevice16BitStorageFeaturesKHR storage_feature = {
- /*sType*/ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR,
- /*pNext*/ &shader_features,
- /*storageBuffer16BitAccess*/ false,
- /*uniformAndStorageBuffer16BitAccess*/ false,
- /*storagePushConstant16*/ false,
- /*storageInputOutput16*/ false,
- };
+ VkPhysicalDeviceVulkan12Features device_features_vk12 = {};
+ VkPhysicalDeviceShaderFloat16Int8FeaturesKHR shader_features = {};
+ VkPhysicalDeviceFragmentShadingRateFeaturesKHR vrs_features = {};
+ VkPhysicalDevice16BitStorageFeaturesKHR storage_feature = {};
+ VkPhysicalDeviceMultiviewFeatures multiview_features = {};
- VkPhysicalDeviceMultiviewFeatures multiview_features = {
- /*sType*/ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES,
- /*pNext*/ &storage_feature,
- /*multiview*/ false,
- /*multiviewGeometryShader*/ false,
- /*multiviewTessellationShader*/ false,
- };
+ if (device_api_version >= VK_API_VERSION_1_2) {
+ device_features_vk12.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;
+ device_features_vk12.pNext = next;
+ next = &device_features_vk12;
+ } else {
+ if (is_device_extension_enabled(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME)) {
+ shader_features = {
+ /*sType*/ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES_KHR,
+ /*pNext*/ next,
+ /*shaderFloat16*/ false,
+ /*shaderInt8*/ false,
+ };
+ next = &shader_features;
+ }
+ }
+
+ if (is_device_extension_enabled(VK_KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME)) {
+ vrs_features = {
+ /*sType*/ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR,
+ /*pNext*/ next,
+ /*pipelineFragmentShadingRate*/ false,
+ /*primitiveFragmentShadingRate*/ false,
+ /*attachmentFragmentShadingRate*/ false,
+ };
+ next = &vrs_features;
+ }
+
+ if (is_device_extension_enabled(VK_KHR_16BIT_STORAGE_EXTENSION_NAME)) {
+ storage_feature = {
+ /*sType*/ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR,
+ /*pNext*/ next,
+ /*storageBuffer16BitAccess*/ false,
+ /*uniformAndStorageBuffer16BitAccess*/ false,
+ /*storagePushConstant16*/ false,
+ /*storageInputOutput16*/ false,
+ };
+ next = &storage_feature;
+ }
+
+ if (is_device_extension_enabled(VK_KHR_MULTIVIEW_EXTENSION_NAME)) {
+ multiview_features = {
+ /*sType*/ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES,
+ /*pNext*/ next,
+ /*multiview*/ false,
+ /*multiviewGeometryShader*/ false,
+ /*multiviewTessellationShader*/ false,
+ };
+ next = &multiview_features;
+ }
VkPhysicalDeviceFeatures2 device_features;
device_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
- device_features.pNext = &multiview_features;
+ device_features.pNext = next;
vkGetPhysicalDeviceFeatures2_func(gpu, &device_features);
- // We must check that the relative extension is present before assuming a
- // feature as enabled. Actually, according to the spec we shouldn't add the
- // structs in pNext at all, but this works fine.
- // See also: https://github.com/godotengine/godot/issues/65409
+ if (device_api_version >= VK_API_VERSION_1_2) {
+#ifdef MACOS_ENABLED
+ ERR_FAIL_COND_V_MSG(!device_features_vk12.shaderSampledImageArrayNonUniformIndexing, ERR_CANT_CREATE, "Your GPU doesn't support shaderSampledImageArrayNonUniformIndexing which is required to use the Vulkan-based renderers in Godot.");
+#endif
+
+ if (is_device_extension_enabled(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME)) {
+ shader_capabilities.shader_float16_is_supported = device_features_vk12.shaderFloat16;
+ shader_capabilities.shader_int8_is_supported = device_features_vk12.shaderInt8;
+ }
+ } else {
+ if (is_device_extension_enabled(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME)) {
+ shader_capabilities.shader_float16_is_supported = shader_features.shaderFloat16;
+ shader_capabilities.shader_int8_is_supported = shader_features.shaderInt8;
+ }
+ }
+
if (is_device_extension_enabled(VK_KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME)) {
vrs_capabilities.pipeline_vrs_supported = vrs_features.pipelineFragmentShadingRate;
vrs_capabilities.primitive_vrs_supported = vrs_features.primitiveFragmentShadingRate;
@@ -798,11 +844,6 @@ Error VulkanContext::_check_capabilities() {
multiview_capabilities.tessellation_shader_is_supported = multiview_features.multiviewTessellationShader;
}
- if (is_device_extension_enabled(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME)) {
- shader_capabilities.shader_float16_is_supported = shader_features.shaderFloat16;
- shader_capabilities.shader_int8_is_supported = shader_features.shaderInt8;
- }
-
if (is_device_extension_enabled(VK_KHR_16BIT_STORAGE_EXTENSION_NAME)) {
storage_buffer_capabilities.storage_buffer_16_bit_access_is_supported = storage_feature.storageBuffer16BitAccess;
storage_buffer_capabilities.uniform_and_storage_buffer_16_bit_access_is_supported = storage_feature.uniformAndStorageBuffer16BitAccess;
@@ -1279,6 +1320,10 @@ Error VulkanContext::_create_physical_device(VkSurfaceKHR p_surface) {
// features based on this query
vkGetPhysicalDeviceFeatures(gpu, &physical_device_features);
+ // Check required features
+ ERR_FAIL_COND_V_MSG(!physical_device_features.imageCubeArray, ERR_CANT_CREATE, "Your GPU doesn't support image cube arrays which are required to use the Vulkan-based renderers in Godot.");
+ ERR_FAIL_COND_V_MSG(!physical_device_features.independentBlend, ERR_CANT_CREATE, "Your GPU doesn't support independentBlend which is required to use the Vulkan-based renderers in Godot.");
+
physical_device_features.robustBufferAccess = false; // Turn off robust buffer access, which can hamper performance on some hardware.
#define GET_INSTANCE_PROC_ADDR(inst, entrypoint) \
@@ -2252,7 +2297,7 @@ Error VulkanContext::swap_buffers() {
// simple that it doesn't do either of those.
}
#endif
- // Wait for the image acquired semaphore to be signalled to ensure
+ // Wait for the image acquired semaphore to be signaled to ensure
// that the image won't be rendered to until the presentation
// engine has fully released ownership to the application, and it is
// okay to render to the image.
@@ -2304,7 +2349,7 @@ Error VulkanContext::swap_buffers() {
if (separate_present_queue) {
// If we are using separate queues, change image ownership to the
// present queue before presenting, waiting for the draw complete
- // semaphore and signalling the ownership released semaphore when finished.
+ // semaphore and signaling the ownership released semaphore when finished.
VkFence nullFence = VK_NULL_HANDLE;
pipe_stage_flags[0] = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
submit_info.waitSemaphoreCount = 1;
diff --git a/drivers/vulkan/vulkan_context.h b/drivers/vulkan/vulkan_context.h
index 7044064e12..9fd2c40a06 100644
--- a/drivers/vulkan/vulkan_context.h
+++ b/drivers/vulkan/vulkan_context.h
@@ -280,6 +280,7 @@ public:
const VRSCapabilities &get_vrs_capabilities() const { return vrs_capabilities; };
const ShaderCapabilities &get_shader_capabilities() const { return shader_capabilities; };
const StorageBufferCapabilities &get_storage_buffer_capabilities() const { return storage_buffer_capabilities; };
+ const VkPhysicalDeviceFeatures &get_physical_device_features() const { return physical_device_features; };
VkDevice get_device();
VkPhysicalDevice get_physical_device();
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index 37a94ce4cc..ea40622afc 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -34,7 +34,6 @@
#include "core/os/os.h"
#include "core/string/print_string.h"
-
#include <share.h> // _SH_DENYNO
#include <shlwapi.h>
#define WIN32_LEAN_AND_MEAN
@@ -58,7 +57,27 @@ void FileAccessWindows::check_errors() const {
}
}
+bool FileAccessWindows::is_path_invalid(const String &p_path) {
+ // Check for invalid operating system file.
+ String fname = p_path;
+ int dot = fname.find(".");
+ if (dot != -1) {
+ fname = fname.substr(0, dot);
+ }
+ fname = fname.to_lower();
+ return invalid_files.has(fname);
+}
+
Error FileAccessWindows::open_internal(const String &p_path, int p_mode_flags) {
+ if (is_path_invalid(p_path)) {
+#ifdef DEBUG_ENABLED
+ if (p_mode_flags != READ) {
+ WARN_PRINT("The path :" + p_path + " is a reserved Windows system pipe, so it can't be used for creating files.");
+ }
+#endif
+ return ERR_INVALID_PARAMETER;
+ }
+
_close();
path_src = p_path;
@@ -313,6 +332,10 @@ void FileAccessWindows::store_buffer(const uint8_t *p_src, uint64_t p_length) {
}
bool FileAccessWindows::file_exists(const String &p_name) {
+ if (is_path_invalid(p_name)) {
+ return false;
+ }
+
String filename = fix_path(p_name);
FILE *g = _wfsopen((LPCWSTR)(filename.utf16().get_data()), L"rb", _SH_DENYNO);
if (g == nullptr) {
@@ -324,6 +347,10 @@ bool FileAccessWindows::file_exists(const String &p_name) {
}
uint64_t FileAccessWindows::_get_modified_time(const String &p_file) {
+ if (is_path_invalid(p_file)) {
+ return 0;
+ }
+
String file = fix_path(p_file);
if (file.ends_with("/") && file != "/") {
file = file.substr(0, file.length() - 1);
@@ -352,4 +379,20 @@ FileAccessWindows::~FileAccessWindows() {
_close();
}
+HashSet<String> FileAccessWindows::invalid_files;
+
+void FileAccessWindows::initialize() {
+ static const char *reserved_files[]{
+ "con", "prn", "aux", "nul", "com0", "com1", "com2", "com3", "com4", "com5", "com6", "com7", "com8", "com9", "lpt0", "lpt1", "lpt2", "lpt3", "lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9", nullptr
+ };
+ int reserved_file_index = 0;
+ while (reserved_files[reserved_file_index] != nullptr) {
+ invalid_files.insert(reserved_files[reserved_file_index]);
+ reserved_file_index++;
+ }
+}
+void FileAccessWindows::finalize() {
+ invalid_files.clear();
+}
+
#endif // WINDOWS_ENABLED
diff --git a/drivers/windows/file_access_windows.h b/drivers/windows/file_access_windows.h
index 832cef3363..2b9960d494 100644
--- a/drivers/windows/file_access_windows.h
+++ b/drivers/windows/file_access_windows.h
@@ -50,6 +50,9 @@ class FileAccessWindows : public FileAccess {
void _close();
+ static bool is_path_invalid(const String &p_path);
+ static HashSet<String> invalid_files;
+
public:
virtual Error open_internal(const String &p_path, int p_mode_flags) override; ///< open a file
virtual bool is_open() const override; ///< true when file is open
@@ -79,6 +82,9 @@ public:
virtual uint32_t _get_unix_permissions(const String &p_file) override;
virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions) override;
+ static void initialize();
+ static void finalize();
+
FileAccessWindows() {}
virtual ~FileAccessWindows();
};
diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp
index cb8d98932d..ae54c20fe2 100644
--- a/editor/action_map_editor.cpp
+++ b/editor/action_map_editor.cpp
@@ -449,10 +449,14 @@ void ActionMapEditor::update_action_list(const Vector<ActionInfo> &p_action_info
// First Column - Icon
Ref<InputEventKey> k = event;
if (k.is_valid()) {
- if (k->get_physical_keycode() == Key::NONE) {
+ if (k->get_physical_keycode() == Key::NONE && k->get_keycode() == Key::NONE && k->get_key_label() != Key::NONE) {
+ event_item->set_icon(0, action_tree->get_theme_icon(SNAME("KeyboardLabel"), SNAME("EditorIcons")));
+ } else if (k->get_keycode() != Key::NONE) {
event_item->set_icon(0, action_tree->get_theme_icon(SNAME("Keyboard"), SNAME("EditorIcons")));
- } else {
+ } else if (k->get_physical_keycode() != Key::NONE) {
event_item->set_icon(0, action_tree->get_theme_icon(SNAME("KeyboardPhysical"), SNAME("EditorIcons")));
+ } else {
+ event_item->set_icon(0, action_tree->get_theme_icon(SNAME("KeyboardError"), SNAME("EditorIcons")));
}
}
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index 639f5e6de5..8defa04ada 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -1489,32 +1489,21 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
}
}
-void AnimationBezierTrackEdit::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
- _pan_callback(-p_scroll_vec * 32);
-}
-
-void AnimationBezierTrackEdit::_pan_callback(Vector2 p_scroll_vec) {
+void AnimationBezierTrackEdit::_pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event) {
v_scroll += p_scroll_vec.y * v_zoom;
v_scroll = CLAMP(v_scroll, -100000, 100000);
timeline->set_value(timeline->get_value() - p_scroll_vec.x / timeline->get_zoom_scale());
queue_redraw();
}
-void AnimationBezierTrackEdit::_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt) {
+void AnimationBezierTrackEdit::_zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event) {
const float v_zoom_orig = v_zoom;
- if (p_alt) {
+ Ref<InputEventWithModifiers> iewm = p_event;
+ if (iewm.is_valid() && iewm->is_alt_pressed()) {
// Alternate zoom (doesn't affect timeline).
- if (p_scroll_vec.y > 0) {
- v_zoom = MIN(v_zoom * 1.2, 100000);
- } else {
- v_zoom = MAX(v_zoom / 1.2, 0.000001);
- }
+ v_zoom = CLAMP(v_zoom * p_zoom_factor, 0.000001, 100000);
} else {
- if (p_scroll_vec.y > 0) {
- timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05);
- } else {
- timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05);
- }
+ timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / p_zoom_factor);
}
v_scroll = v_scroll + (p_origin.y - get_size().y / 2.0) * (v_zoom - v_zoom_orig);
queue_redraw();
@@ -1681,7 +1670,7 @@ void AnimationBezierTrackEdit::_bind_methods() {
AnimationBezierTrackEdit::AnimationBezierTrackEdit() {
panner.instantiate();
- panner->set_callbacks(callable_mp(this, &AnimationBezierTrackEdit::_scroll_callback), callable_mp(this, &AnimationBezierTrackEdit::_pan_callback), callable_mp(this, &AnimationBezierTrackEdit::_zoom_callback));
+ panner->set_callbacks(callable_mp(this, &AnimationBezierTrackEdit::_pan_callback), callable_mp(this, &AnimationBezierTrackEdit::_zoom_callback));
play_position = memnew(Control);
play_position->set_mouse_filter(MOUSE_FILTER_PASS);
diff --git a/editor/animation_bezier_editor.h b/editor/animation_bezier_editor.h
index e6d6424ef2..dbc231ccac 100644
--- a/editor/animation_bezier_editor.h
+++ b/editor/animation_bezier_editor.h
@@ -174,9 +174,8 @@ class AnimationBezierTrackEdit : public Control {
SelectionSet selection;
Ref<ViewPanner> panner;
- void _scroll_callback(Vector2 p_scroll_vec, bool p_alt);
- void _pan_callback(Vector2 p_scroll_vec);
- void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
+ void _pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event);
+ void _zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event);
void _draw_line_clipped(const Vector2 &p_from, const Vector2 &p_to, const Color &p_color, int p_clip_left, int p_clip_right);
void _draw_track(int p_track, const Color &p_color);
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 857a9a664a..8dd087451c 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -1704,25 +1704,13 @@ Control::CursorShape AnimationTimelineEdit::get_cursor_shape(const Point2 &p_pos
}
}
-void AnimationTimelineEdit::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
- // Timeline has no vertical scroll, so we change it to horizontal.
- p_scroll_vec.x += p_scroll_vec.y;
- _pan_callback(-p_scroll_vec * 32);
-}
-
-void AnimationTimelineEdit::_pan_callback(Vector2 p_scroll_vec) {
+void AnimationTimelineEdit::_pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event) {
set_value(get_value() - p_scroll_vec.x / get_zoom_scale());
}
-void AnimationTimelineEdit::_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt) {
- double new_zoom_value;
+void AnimationTimelineEdit::_zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event) {
double current_zoom_value = get_zoom()->get_value();
- if (current_zoom_value <= 0.1) {
- new_zoom_value = MAX(0.01, current_zoom_value - 0.01 * SIGN(p_scroll_vec.y));
- } else {
- new_zoom_value = p_scroll_vec.y > 0 ? MAX(0.01, current_zoom_value / 1.05) : current_zoom_value * 1.05;
- }
- get_zoom()->set_value(new_zoom_value);
+ get_zoom()->set_value(MAX(0.01, current_zoom_value * p_zoom_factor));
}
void AnimationTimelineEdit::set_use_fps(bool p_use_fps) {
@@ -1798,7 +1786,8 @@ AnimationTimelineEdit::AnimationTimelineEdit() {
len_hb->hide();
panner.instantiate();
- panner->set_callbacks(callable_mp(this, &AnimationTimelineEdit::_scroll_callback), callable_mp(this, &AnimationTimelineEdit::_pan_callback), callable_mp(this, &AnimationTimelineEdit::_zoom_callback));
+ panner->set_callbacks(callable_mp(this, &AnimationTimelineEdit::_pan_callback), callable_mp(this, &AnimationTimelineEdit::_zoom_callback));
+ panner->set_pan_axis(ViewPanner::PAN_AXIS_HORIZONTAL);
set_layout_direction(Control::LAYOUT_DIRECTION_LTR);
}
@@ -1965,6 +1954,10 @@ void AnimationTrackEdit::_notification(int p_what) {
get_theme_icon(SNAME("TrackDiscrete"), SNAME("EditorIcons")),
get_theme_icon(SNAME("TrackCapture"), SNAME("EditorIcons"))
};
+ Ref<Texture2D> blend_icon[2] = {
+ get_theme_icon(SNAME("UseBlendEnable"), SNAME("EditorIcons")),
+ get_theme_icon(SNAME("UseBlendDisable"), SNAME("EditorIcons")),
+ };
int ofs = get_size().width - timeline->get_buttons_width();
@@ -1993,6 +1986,11 @@ void AnimationTrackEdit::_notification(int p_what) {
if (!animation->track_is_compressed(track) && animation->track_get_type(track) == Animation::TYPE_VALUE) {
draw_texture(update_icon, update_mode_rect.position);
}
+ if (animation->track_get_type(track) == Animation::TYPE_AUDIO) {
+ Ref<Texture2D> use_blend_icon = blend_icon[animation->audio_track_is_use_blend(track) ? 0 : 1];
+ Vector2 use_blend_icon_pos = update_mode_rect.position + (update_mode_rect.size - use_blend_icon->get_size()) / 2;
+ draw_texture(use_blend_icon, use_blend_icon_pos);
+ }
// Make it easier to click.
update_mode_rect.position.y = 0;
update_mode_rect.size.y = get_size().height;
@@ -2001,13 +1999,12 @@ void AnimationTrackEdit::_notification(int p_what) {
update_mode_rect.size.x += hsep / 2;
if (!read_only) {
- if (animation->track_get_type(track) == Animation::TYPE_VALUE) {
+ if (animation->track_get_type(track) == Animation::TYPE_VALUE || animation->track_get_type(track) == Animation::TYPE_AUDIO) {
draw_texture(down_icon, Vector2(ofs, int(get_size().height - down_icon->get_height()) / 2));
update_mode_rect.size.x += down_icon->get_width();
} else if (animation->track_get_type(track) == Animation::TYPE_BEZIER) {
Ref<Texture2D> bezier_icon = get_theme_icon(SNAME("EditBezier"), SNAME("EditorIcons"));
update_mode_rect.size.x += down_icon->get_width();
-
update_mode_rect = Rect2();
} else {
update_mode_rect = Rect2();
@@ -2450,7 +2447,11 @@ String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
}
if (update_mode_rect.has_point(p_pos)) {
- return TTR("Update Mode (How this property is set)");
+ if (animation->track_get_type(track) == Animation::TYPE_AUDIO) {
+ return TTR("Use Blend");
+ } else {
+ return TTR("Update Mode (How this property is set)");
+ }
}
if (interp_mode_rect.has_point(p_pos)) {
@@ -2652,9 +2653,14 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
menu->connect("id_pressed", callable_mp(this, &AnimationTrackEdit::_menu_selected));
}
menu->clear();
- menu->add_icon_item(get_theme_icon(SNAME("TrackContinuous"), SNAME("EditorIcons")), TTR("Continuous"), MENU_CALL_MODE_CONTINUOUS);
- menu->add_icon_item(get_theme_icon(SNAME("TrackDiscrete"), SNAME("EditorIcons")), TTR("Discrete"), MENU_CALL_MODE_DISCRETE);
- menu->add_icon_item(get_theme_icon(SNAME("TrackCapture"), SNAME("EditorIcons")), TTR("Capture"), MENU_CALL_MODE_CAPTURE);
+ if (animation->track_get_type(track) == Animation::TYPE_AUDIO) {
+ menu->add_icon_item(get_theme_icon(SNAME("UseBlendEnable"), SNAME("EditorIcons")), TTR("Use Blend"), MENU_USE_BLEND_ENABLED);
+ menu->add_icon_item(get_theme_icon(SNAME("UseBlendDisable"), SNAME("EditorIcons")), TTR("Don't Use Blend"), MENU_USE_BLEND_DISABLED);
+ } else {
+ menu->add_icon_item(get_theme_icon(SNAME("TrackContinuous"), SNAME("EditorIcons")), TTR("Continuous"), MENU_CALL_MODE_CONTINUOUS);
+ menu->add_icon_item(get_theme_icon(SNAME("TrackDiscrete"), SNAME("EditorIcons")), TTR("Discrete"), MENU_CALL_MODE_DISCRETE);
+ menu->add_icon_item(get_theme_icon(SNAME("TrackCapture"), SNAME("EditorIcons")), TTR("Capture"), MENU_CALL_MODE_CAPTURE);
+ }
menu->reset_size();
Vector2 popup_pos = get_screen_position() + update_mode_rect.position + Vector2(0, update_mode_rect.size.height);
@@ -2673,7 +2679,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
menu->add_icon_item(get_theme_icon(SNAME("InterpRaw"), SNAME("EditorIcons")), TTR("Nearest"), MENU_INTERPOLATION_NEAREST);
menu->add_icon_item(get_theme_icon(SNAME("InterpLinear"), SNAME("EditorIcons")), TTR("Linear"), MENU_INTERPOLATION_LINEAR);
menu->add_icon_item(get_theme_icon(SNAME("InterpCubic"), SNAME("EditorIcons")), TTR("Cubic"), MENU_INTERPOLATION_CUBIC);
- // Check is angle property.
+ // Check whether it is angle property.
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
if (ape) {
AnimationPlayer *ap = ape->get_player();
@@ -3066,6 +3072,16 @@ void AnimationTrackEdit::_menu_selected(int p_index) {
emit_signal(SNAME("delete_request"));
} break;
+ case MENU_USE_BLEND_ENABLED:
+ case MENU_USE_BLEND_DISABLED: {
+ bool use_blend = p_index == MENU_USE_BLEND_ENABLED;
+ EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
+ undo_redo->create_action(TTR("Change Animation Use Blend"));
+ undo_redo->add_do_method(animation.ptr(), "audio_track_set_use_blend", track, use_blend);
+ undo_redo->add_undo_method(animation.ptr(), "audio_track_set_use_blend", track, animation->audio_track_is_use_blend(track));
+ undo_redo->commit_action();
+ queue_redraw();
+ } break;
}
}
@@ -3499,6 +3515,9 @@ void AnimationTrackEditor::_animation_track_remove_request(int p_track, Ref<Anim
if (p_from_animation->track_get_type(idx) == Animation::TYPE_VALUE) {
undo_redo->add_undo_method(p_from_animation.ptr(), "value_track_set_update_mode", idx, p_from_animation->value_track_get_update_mode(idx));
}
+ if (animation->track_get_type(idx) == Animation::TYPE_AUDIO) {
+ undo_redo->add_undo_method(animation.ptr(), "audio_track_set_use_blend", idx, animation->audio_track_is_use_blend(idx));
+ }
undo_redo->commit_action();
}
@@ -5358,32 +5377,23 @@ void AnimationTrackEditor::_toggle_bezier_edit() {
}
}
-void AnimationTrackEditor::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
- if (p_alt) {
+void AnimationTrackEditor::_pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event) {
+ Ref<InputEventWithModifiers> iewm = p_event;
+ if (iewm.is_valid() && iewm->is_alt_pressed()) {
if (p_scroll_vec.x < 0 || p_scroll_vec.y < 0) {
goto_prev_step(true);
} else {
goto_next_step(true);
}
} else {
- _pan_callback(-p_scroll_vec * 32);
+ timeline->set_value(timeline->get_value() - p_scroll_vec.x / timeline->get_zoom_scale());
+ scroll->set_v_scroll(scroll->get_v_scroll() - p_scroll_vec.y);
}
}
-void AnimationTrackEditor::_pan_callback(Vector2 p_scroll_vec) {
- timeline->set_value(timeline->get_value() - p_scroll_vec.x / timeline->get_zoom_scale());
- scroll->set_v_scroll(scroll->get_v_scroll() - p_scroll_vec.y);
-}
-
-void AnimationTrackEditor::_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt) {
- double new_zoom_value;
+void AnimationTrackEditor::_zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event) {
double current_zoom_value = timeline->get_zoom()->get_value();
- if (current_zoom_value <= 0.1) {
- new_zoom_value = MAX(0.01, current_zoom_value - 0.01 * SIGN(p_scroll_vec.y));
- } else {
- new_zoom_value = p_scroll_vec.y > 0 ? MAX(0.01, current_zoom_value / 1.05) : current_zoom_value * 1.05;
- }
- timeline->get_zoom()->set_value(new_zoom_value);
+ timeline->get_zoom()->set_value(MAX(0.01, current_zoom_value * p_zoom_factor));
}
void AnimationTrackEditor::_cancel_bezier_edit() {
@@ -5638,6 +5648,9 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
if (tc.track_type == Animation::TYPE_VALUE) {
tc.update_mode = animation->value_track_get_update_mode(idx);
}
+ if (tc.track_type == Animation::TYPE_AUDIO) {
+ tc.use_blend = animation->audio_track_is_use_blend(idx);
+ }
tc.loop_wrap = animation->track_get_interpolation_loop_wrap(idx);
tc.enabled = animation->track_is_enabled(idx);
for (int i = 0; i < animation->track_get_key_count(idx); i++) {
@@ -5682,6 +5695,9 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
if (track_clipboard[i].track_type == Animation::TYPE_VALUE) {
undo_redo->add_do_method(animation.ptr(), "value_track_set_update_mode", base_track, track_clipboard[i].update_mode);
}
+ if (track_clipboard[i].track_type == Animation::TYPE_AUDIO) {
+ undo_redo->add_do_method(animation.ptr(), "audio_track_set_use_blend", base_track, track_clipboard[i].use_blend);
+ }
for (int j = 0; j < track_clipboard[i].keys.size(); j++) {
undo_redo->add_do_method(animation.ptr(), "track_insert_key", base_track, track_clipboard[i].keys[j].time, track_clipboard[i].keys[j].value, track_clipboard[i].keys[j].transition);
@@ -6398,7 +6414,7 @@ AnimationTrackEditor::AnimationTrackEditor() {
timeline->connect("length_changed", callable_mp(this, &AnimationTrackEditor::_update_length));
panner.instantiate();
- panner->set_callbacks(callable_mp(this, &AnimationTrackEditor::_scroll_callback), callable_mp(this, &AnimationTrackEditor::_pan_callback), callable_mp(this, &AnimationTrackEditor::_zoom_callback));
+ panner->set_callbacks(callable_mp(this, &AnimationTrackEditor::_pan_callback), callable_mp(this, &AnimationTrackEditor::_zoom_callback));
scroll = memnew(ScrollContainer);
timeline_vbox->add_child(scroll);
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index ef06445011..2a59bda2a4 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -159,9 +159,8 @@ class AnimationTimelineEdit : public Range {
bool use_fps = false;
Ref<ViewPanner> panner;
- void _scroll_callback(Vector2 p_scroll_vec, bool p_alt);
- void _pan_callback(Vector2 p_scroll_vec);
- void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
+ void _pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event);
+ void _zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event);
bool dragging_timeline = false;
bool dragging_hsize = false;
@@ -221,7 +220,9 @@ class AnimationTrackEdit : public Control {
MENU_KEY_INSERT,
MENU_KEY_DUPLICATE,
MENU_KEY_ADD_RESET,
- MENU_KEY_DELETE
+ MENU_KEY_DELETE,
+ MENU_USE_BLEND_ENABLED,
+ MENU_USE_BLEND_DISABLED,
};
AnimationTimelineEdit *timeline = nullptr;
@@ -460,9 +461,8 @@ class AnimationTrackEditor : public VBoxContainer {
PropertyInfo _find_hint_for_track(int p_idx, NodePath &r_base_path, Variant *r_current_val = nullptr);
Ref<ViewPanner> panner;
- void _scroll_callback(Vector2 p_scroll_vec, bool p_alt);
- void _pan_callback(Vector2 p_scroll_vec);
- void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
+ void _pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event);
+ void _zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event);
void _timeline_value_changed(double);
@@ -568,6 +568,7 @@ class AnimationTrackEditor : public VBoxContainer {
Animation::LoopMode loop_mode = Animation::LOOP_PINGPONG;
bool loop_wrap = false;
bool enabled = false;
+ bool use_blend = false;
struct Key {
float time = 0;
diff --git a/editor/array_property_edit.cpp b/editor/array_property_edit.cpp
deleted file mode 100644
index dd27b61df9..0000000000
--- a/editor/array_property_edit.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-/**************************************************************************/
-/* array_property_edit.cpp */
-/**************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/**************************************************************************/
-/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
-/* */
-/* 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 "array_property_edit.h"
-
-#include "core/io/marshalls.h"
-#include "editor/editor_undo_redo_manager.h"
-
-#define ITEMS_PER_PAGE 100
-
-Variant ArrayPropertyEdit::get_array() const {
- Object *o = ObjectDB::get_instance(obj);
- if (!o) {
- return Array();
- }
- Variant arr = o->get(property);
- if (!arr.is_array()) {
- Callable::CallError ce;
- Variant::construct(default_type, arr, nullptr, 0, ce);
- }
- return arr;
-}
-
-void ArrayPropertyEdit::_notif_change() {
- notify_property_list_changed();
-}
-
-void ArrayPropertyEdit::_set_size(int p_size) {
- Variant arr = get_array();
- arr.call("resize", p_size);
- Object *o = ObjectDB::get_instance(obj);
- if (!o) {
- return;
- }
-
- o->set(property, arr);
-}
-
-void ArrayPropertyEdit::_set_value(int p_idx, const Variant &p_value) {
- Variant arr = get_array();
- arr.set(p_idx, p_value);
- Object *o = ObjectDB::get_instance(obj);
- if (!o) {
- return;
- }
-
- o->set(property, arr);
-}
-
-bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
- String pn = p_name;
-
- if (pn.begins_with("array/")) {
- if (pn == "array/size") {
- Variant arr = get_array();
- int size = arr.call("size");
-
- int newsize = p_value;
- if (newsize == size) {
- return true;
- }
-
- EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
- ur->create_action(TTR("Resize Array"));
- ur->add_do_method(this, "_set_size", newsize);
- ur->add_undo_method(this, "_set_size", size);
- if (newsize < size) {
- for (int i = newsize; i < size; i++) {
- ur->add_undo_method(this, "_set_value", i, arr.get(i));
- }
- } else if (newsize > size) {
- Variant init;
- Callable::CallError ce;
- Variant::Type new_type = subtype;
- if (new_type == Variant::NIL && size) {
- new_type = arr.get(size - 1).get_type();
- }
- if (new_type != Variant::NIL) {
- Variant::construct(new_type, init, nullptr, 0, ce);
- for (int i = size; i < newsize; i++) {
- ur->add_do_method(this, "_set_value", i, init);
- }
- }
- }
- ur->add_do_method(this, "_notif_change");
- ur->add_undo_method(this, "_notif_change");
- ur->commit_action();
- return true;
- }
- if (pn == "array/page") {
- page = p_value;
- notify_property_list_changed();
- return true;
- }
-
- } else if (pn.begins_with("indices")) {
- if (pn.contains("_")) {
- //type
- int idx = pn.get_slicec('/', 1).get_slicec('_', 0).to_int();
-
- int type = p_value;
-
- Variant arr = get_array();
-
- Variant value = arr.get(idx);
- if (value.get_type() != type && type >= 0 && type < Variant::VARIANT_MAX) {
- Callable::CallError ce;
- Variant new_value;
- Variant::construct(Variant::Type(type), new_value, nullptr, 0, ce);
- EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
-
- ur->create_action(TTR("Change Array Value Type"));
- ur->add_do_method(this, "_set_value", idx, new_value);
- ur->add_undo_method(this, "_set_value", idx, value);
- ur->add_do_method(this, "_notif_change");
- ur->add_undo_method(this, "_notif_change");
- ur->commit_action();
- }
- return true;
-
- } else {
- int idx = pn.get_slicec('/', 1).to_int();
- Variant arr = get_array();
-
- Variant value = arr.get(idx);
- EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
-
- ur->create_action(TTR("Change Array Value"));
- ur->add_do_method(this, "_set_value", idx, p_value);
- ur->add_undo_method(this, "_set_value", idx, value);
- ur->commit_action();
- return true;
- }
- }
-
- return false;
-}
-
-bool ArrayPropertyEdit::_get(const StringName &p_name, Variant &r_ret) const {
- Variant arr = get_array();
- //int size = arr.call("size");
-
- String pn = p_name;
- if (pn.begins_with("array/")) {
- if (pn == "array/size") {
- r_ret = arr.call("size");
- return true;
- }
- if (pn == "array/page") {
- r_ret = page;
- return true;
- }
- } else if (pn.begins_with("indices")) {
- if (pn.contains("_")) {
- //type
- int idx = pn.get_slicec('/', 1).get_slicec('_', 0).to_int();
- bool valid;
- r_ret = arr.get(idx, &valid);
- if (valid) {
- r_ret = r_ret.get_type();
- }
- return valid;
-
- } else {
- int idx = pn.get_slicec('/', 1).to_int();
- bool valid;
- r_ret = arr.get(idx, &valid);
-
- if (r_ret.get_type() == Variant::OBJECT && Object::cast_to<EncodedObjectAsID>(r_ret)) {
- r_ret = Object::cast_to<EncodedObjectAsID>(r_ret)->get_object_id();
- }
-
- return valid;
- }
- }
-
- return false;
-}
-
-void ArrayPropertyEdit::_get_property_list(List<PropertyInfo> *p_list) const {
- Variant arr = get_array();
- int size = arr.call("size");
-
- p_list->push_back(PropertyInfo(Variant::INT, "array/size", PROPERTY_HINT_RANGE, "0,100000,1"));
- int pages = size / ITEMS_PER_PAGE;
- if (pages > 0) {
- p_list->push_back(PropertyInfo(Variant::INT, "array/page", PROPERTY_HINT_RANGE, "0," + itos(pages) + ",1"));
- }
-
- int offset = page * ITEMS_PER_PAGE;
-
- int items = MIN(size - offset, ITEMS_PER_PAGE);
-
- for (int i = 0; i < items; i++) {
- Variant v = arr.get(i + offset);
- bool is_typed = arr.get_type() != Variant::ARRAY || subtype != Variant::NIL;
-
- if (!is_typed) {
- p_list->push_back(PropertyInfo(Variant::INT, "indices/" + itos(i + offset) + "_type", PROPERTY_HINT_ENUM, vtypes));
- }
-
- if (v.get_type() == Variant::OBJECT && Object::cast_to<EncodedObjectAsID>(v)) {
- p_list->push_back(PropertyInfo(Variant::INT, "indices/" + itos(i + offset), PROPERTY_HINT_OBJECT_ID, "Object"));
- continue;
- }
-
- if (is_typed || v.get_type() != Variant::NIL) {
- PropertyInfo pi(v.get_type(), "indices/" + itos(i + offset));
- if (subtype != Variant::NIL) {
- pi.type = Variant::Type(subtype);
- pi.hint = PropertyHint(subtype_hint);
- pi.hint_string = subtype_hint_string;
- } else if (v.get_type() == Variant::OBJECT) {
- pi.hint = PROPERTY_HINT_RESOURCE_TYPE;
- pi.hint_string = "Resource";
- }
-
- p_list->push_back(pi);
- }
- }
-}
-
-void ArrayPropertyEdit::edit(Object *p_obj, const StringName &p_prop, const String &p_hint_string, Variant::Type p_deftype) {
- page = 0;
- property = p_prop;
- obj = p_obj->get_instance_id();
- default_type = p_deftype;
-
- if (!p_hint_string.is_empty()) {
- int hint_subtype_separator = p_hint_string.find(":");
- if (hint_subtype_separator >= 0) {
- String subtype_string = p_hint_string.substr(0, hint_subtype_separator);
-
- int slash_pos = subtype_string.find("/");
- if (slash_pos >= 0) {
- subtype_hint = PropertyHint(subtype_string.substr(slash_pos + 1, subtype_string.size() - slash_pos - 1).to_int());
- subtype_string = subtype_string.substr(0, slash_pos);
- }
-
- subtype_hint_string = p_hint_string.substr(hint_subtype_separator + 1, p_hint_string.size() - hint_subtype_separator - 1);
- subtype = Variant::Type(subtype_string.to_int());
- }
- }
-}
-
-Node *ArrayPropertyEdit::get_node() {
- return Object::cast_to<Node>(ObjectDB::get_instance(obj));
-}
-
-bool ArrayPropertyEdit::_dont_undo_redo() {
- return true;
-}
-
-void ArrayPropertyEdit::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_set_size"), &ArrayPropertyEdit::_set_size);
- ClassDB::bind_method(D_METHOD("_set_value"), &ArrayPropertyEdit::_set_value);
- ClassDB::bind_method(D_METHOD("_notif_change"), &ArrayPropertyEdit::_notif_change);
- ClassDB::bind_method(D_METHOD("_dont_undo_redo"), &ArrayPropertyEdit::_dont_undo_redo);
-}
-
-ArrayPropertyEdit::ArrayPropertyEdit() {
- page = 0;
- for (int i = 0; i < Variant::VARIANT_MAX; i++) {
- if (i > 0) {
- vtypes += ",";
- }
- vtypes += Variant::get_type_name(Variant::Type(i));
- }
- default_type = Variant::NIL;
- subtype = Variant::NIL;
- subtype_hint = PROPERTY_HINT_NONE;
- subtype_hint_string = "";
-}
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index df8adf01e4..28d687488c 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -143,7 +143,9 @@ void FindReplaceBar::unhandled_input(const Ref<InputEvent> &p_event) {
}
bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col) {
- text_editor->remove_secondary_carets();
+ if (!preserve_cursor) {
+ text_editor->remove_secondary_carets();
+ }
String text = get_search_text();
Point2i pos = text_editor->search(text, p_flags, p_from_line, p_from_col);
@@ -2086,6 +2088,7 @@ CodeTextEditor::CodeTextEditor() {
text_editor = memnew(CodeEdit);
add_child(text_editor);
text_editor->set_v_size_flags(SIZE_EXPAND_FILL);
+ text_editor->set_structured_text_bidi_override(TextServer::STRUCTURED_TEXT_GDSCRIPT);
int ot_mode = EDITOR_GET("interface/editor/code_font_contextual_ligatures");
Ref<FontVariation> fc = text_editor->get_theme_font(SNAME("font"));
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 6f4736dca7..aaa07e98c8 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -30,6 +30,7 @@
#include "connections_dialog.h"
+#include "core/config/project_settings.h"
#include "editor/doc_tools.h"
#include "editor/editor_help.h"
#include "editor/editor_node.h"
@@ -165,6 +166,7 @@ void ConnectDialog::_tree_node_selected() {
if (!edit_mode) {
set_dst_method(generate_method_callback_name(source, signal, current));
}
+ _update_method_tree();
_update_ok_enabled();
}
@@ -182,6 +184,11 @@ void ConnectDialog::_unbind_count_changed(double p_count) {
}
}
+void ConnectDialog::_method_selected() {
+ TreeItem *selected_item = method_tree->get_selected();
+ dst_method->set_text(selected_item->get_metadata(0));
+}
+
/*
* Adds a new parameter bind to connection.
*/
@@ -242,14 +249,154 @@ StringName ConnectDialog::generate_method_callback_name(Node *p_source, String p
String dst_method;
if (p_source == p_target) {
- dst_method = String(EDITOR_GET("interface/editors/default_signal_callback_to_self_name")).format(subst);
+ dst_method = String(GLOBAL_GET("editor/naming/default_signal_callback_to_self_name")).format(subst);
} else {
- dst_method = String(EDITOR_GET("interface/editors/default_signal_callback_name")).format(subst);
+ dst_method = String(GLOBAL_GET("editor/naming/default_signal_callback_name")).format(subst);
}
return dst_method;
}
+void ConnectDialog::_create_method_tree_items(const List<MethodInfo> &p_methods, TreeItem *p_parent_item) {
+ for (const MethodInfo &mi : p_methods) {
+ TreeItem *method_item = method_tree->create_item(p_parent_item);
+ method_item->set_text(0, get_signature(mi));
+ method_item->set_metadata(0, mi.name);
+ }
+}
+
+List<MethodInfo> ConnectDialog::_filter_method_list(const List<MethodInfo> &p_methods, const MethodInfo &p_signal, const String &p_search_string) const {
+ bool check_signal = compatible_methods_only->is_pressed();
+ List<MethodInfo> ret;
+
+ for (const MethodInfo &mi : p_methods) {
+ if (!p_search_string.is_empty() && !mi.name.contains(p_search_string)) {
+ continue;
+ }
+
+ if (check_signal) {
+ if (mi.arguments.size() != p_signal.arguments.size()) {
+ continue;
+ }
+
+ bool type_mismatch = false;
+ const List<PropertyInfo>::Element *E = p_signal.arguments.front();
+ for (const List<PropertyInfo>::Element *F = mi.arguments.front(); F; F = F->next(), E = E->next()) {
+ Variant::Type stype = E->get().type;
+ Variant::Type mtype = F->get().type;
+
+ if (stype != Variant::NIL && mtype != Variant::NIL && stype != mtype) {
+ type_mismatch = true;
+ break;
+ }
+
+ if (stype == Variant::OBJECT && mtype == Variant::OBJECT && E->get().class_name != F->get().class_name) {
+ type_mismatch = true;
+ break;
+ }
+ }
+
+ if (type_mismatch) {
+ continue;
+ }
+ }
+ ret.push_back(mi);
+ }
+ return ret;
+}
+
+void ConnectDialog::_update_method_tree() {
+ method_tree->clear();
+
+ Color disabled_color = get_theme_color(SNAME("accent_color"), SNAME("Editor")) * 0.7;
+ String search_string = method_search->get_text();
+ Node *target = tree->get_selected();
+ if (!target) {
+ return;
+ }
+
+ MethodInfo signal_info;
+ if (compatible_methods_only->is_pressed()) {
+ List<MethodInfo> signals;
+ source->get_signal_list(&signals);
+ for (const MethodInfo &mi : signals) {
+ if (mi.name == signal) {
+ signal_info = mi;
+ break;
+ }
+ }
+ }
+
+ TreeItem *root_item = method_tree->create_item();
+ root_item->set_text(0, TTR("Methods"));
+ root_item->set_selectable(0, false);
+
+ // If a script is attached, get methods from it.
+ ScriptInstance *si = target->get_script_instance();
+ if (si) {
+ TreeItem *si_item = method_tree->create_item(root_item);
+ si_item->set_text(0, TTR("Attached Script"));
+ si_item->set_icon(0, get_theme_icon(SNAME("Script"), SNAME("EditorIcons")));
+ si_item->set_selectable(0, false);
+
+ List<MethodInfo> methods;
+ si->get_method_list(&methods);
+ methods = _filter_method_list(methods, signal_info, search_string);
+
+ if (methods.is_empty()) {
+ si_item->set_custom_color(0, disabled_color);
+ } else {
+ _create_method_tree_items(methods, si_item);
+ }
+ }
+
+ if (script_methods_only->is_pressed()) {
+ empty_tree_label->set_visible(root_item->get_first_child() == nullptr);
+ return;
+ }
+
+ // Get methods from each class in the hierarchy.
+ StringName current_class = target->get_class_name();
+ do {
+ TreeItem *class_item = method_tree->create_item(root_item);
+ class_item->set_text(0, current_class);
+ Ref<Texture2D> icon = get_theme_icon(SNAME("Node"), SNAME("EditorIcons"));
+ if (has_theme_icon(current_class, SNAME("EditorIcons"))) {
+ icon = get_theme_icon(current_class, SNAME("EditorIcons"));
+ }
+ class_item->set_icon(0, icon);
+ class_item->set_selectable(0, false);
+
+ List<MethodInfo> methods;
+ ClassDB::get_method_list(current_class, &methods, true);
+ methods = _filter_method_list(methods, signal_info, search_string);
+
+ if (methods.is_empty()) {
+ class_item->set_custom_color(0, disabled_color);
+ } else {
+ _create_method_tree_items(methods, class_item);
+ }
+ current_class = ClassDB::get_parent_class_nocheck(current_class);
+ } while (current_class != StringName());
+
+ empty_tree_label->set_visible(root_item->get_first_child() == nullptr);
+}
+
+void ConnectDialog::_method_check_button_pressed(const CheckButton *p_button) {
+ if (p_button == script_methods_only) {
+ EditorSettings::get_singleton()->set_project_metadata("editor_metadata", "show_script_methods_only", p_button->is_pressed());
+ } else if (p_button == compatible_methods_only) {
+ EditorSettings::get_singleton()->set_project_metadata("editor_metadata", "show_compatible_methods_only", p_button->is_pressed());
+ }
+ _update_method_tree();
+}
+
+void ConnectDialog::_open_method_popup() {
+ method_popup->popup_centered();
+ method_search->clear();
+ method_search->grab_focus();
+}
+
/*
* Enables or disables the connect button. The connect button is enabled if a
* node is selected and valid in the selected mode.
@@ -262,7 +409,7 @@ void ConnectDialog::_update_ok_enabled() {
return;
}
- if (!advanced->is_pressed() && target->get_script().is_null()) {
+ if (dst_method->get_text().is_empty()) {
get_ok_button()->set_disabled(true);
return;
}
@@ -285,17 +432,16 @@ void ConnectDialog::_notification(int p_what) {
Ref<StyleBox> style = get_theme_stylebox("normal", "LineEdit")->duplicate();
if (style.is_valid()) {
- style->set_default_margin(SIDE_TOP, style->get_default_margin(SIDE_TOP) + 1.0);
+ style->set_content_margin(SIDE_TOP, style->get_content_margin(SIDE_TOP) + 1.0);
from_signal->add_theme_style_override("normal", style);
}
+ method_search->set_right_icon(get_theme_icon("Search", "EditorIcons"));
+ open_method_tree->set_icon(get_theme_icon("Edit", "EditorIcons"));
} break;
}
}
void ConnectDialog::_bind_methods() {
- ClassDB::bind_method("_cancel", &ConnectDialog::_cancel_pressed);
- ClassDB::bind_method("_update_ok_enabled", &ConnectDialog::_update_ok_enabled);
-
ADD_SIGNAL(MethodInfo("connected"));
}
@@ -303,10 +449,18 @@ Node *ConnectDialog::get_source() const {
return source;
}
+ConnectDialog::ConnectionData ConnectDialog::get_source_connection_data() const {
+ return source_connection_data;
+}
+
StringName ConnectDialog::get_signal_name() const {
return signal;
}
+PackedStringArray ConnectDialog::get_signal_args() const {
+ return signal_args;
+}
+
NodePath ConnectDialog::get_dst_path() const {
return dst_path;
}
@@ -335,6 +489,34 @@ Vector<Variant> ConnectDialog::get_binds() const {
return cdbinds->params;
}
+String ConnectDialog::get_signature(const MethodInfo &p_method, PackedStringArray *r_arg_names) {
+ PackedStringArray signature;
+ signature.append(p_method.name);
+ signature.append("(");
+
+ for (int i = 0; i < p_method.arguments.size(); i++) {
+ if (i > 0) {
+ signature.append(", ");
+ }
+
+ const PropertyInfo &pi = p_method.arguments[i];
+ String tname = "var";
+ if (pi.type == Variant::OBJECT && pi.class_name != StringName()) {
+ tname = pi.class_name.operator String();
+ } else if (pi.type != Variant::NIL) {
+ tname = Variant::get_type_name(pi.type);
+ }
+
+ signature.append((pi.name.is_empty() ? String("arg " + itos(i)) : pi.name) + ": " + tname);
+ if (r_arg_names) {
+ r_arg_names->push_back(pi.name + ":" + tname);
+ }
+ }
+
+ signature.append(")");
+ return String().join(signature);
+}
+
bool ConnectDialog::get_deferred() const {
return deferred->is_pressed();
}
@@ -355,11 +537,12 @@ bool ConnectDialog::is_editing() const {
* If creating a connection from scratch, sensible defaults are used.
* If editing an existing connection, previous data is retained.
*/
-void ConnectDialog::init(ConnectionData p_cd, bool p_edit) {
+void ConnectDialog::init(const ConnectionData &p_cd, const PackedStringArray &p_signal_args, bool p_edit) {
set_hide_on_ok(false);
source = static_cast<Node *>(p_cd.source);
signal = p_cd.signal;
+ signal_args = p_signal_args;
tree->set_selected(nullptr);
tree->set_marked(source, true);
@@ -377,22 +560,7 @@ void ConnectDialog::init(ConnectionData p_cd, bool p_edit) {
deferred->set_pressed(b_deferred);
one_shot->set_pressed(b_oneshot);
- MethodInfo r_signal;
- Ref<Script> source_script = source->get_script();
- if (source_script.is_valid() && source_script->has_script_signal(signal)) {
- List<MethodInfo> signals;
- source_script->get_script_signal_list(&signals);
- for (MethodInfo &mi : signals) {
- if (mi.name == signal) {
- r_signal = mi;
- break;
- }
- }
- } else {
- ClassDB::get_signal(source->get_class(), signal, &r_signal);
- }
-
- unbind_count->set_max(r_signal.arguments.size());
+ unbind_count->set_max(p_signal_args.size());
unbind_count->set_value(p_cd.unbinds);
_unbind_count_changed(p_cd.unbinds);
@@ -402,9 +570,11 @@ void ConnectDialog::init(ConnectionData p_cd, bool p_edit) {
cdbinds->notify_changed();
edit_mode = p_edit;
+
+ source_connection_data = p_cd;
}
-void ConnectDialog::popup_dialog(const String &p_for_signal) {
+void ConnectDialog::popup_dialog(const String p_for_signal) {
from_signal->set_text(p_for_signal);
error_label->add_theme_color_override("font_color", error_label->get_theme_color(SNAME("error_color"), SNAME("Editor")));
if (!advanced->is_pressed()) {
@@ -437,7 +607,6 @@ void ConnectDialog::_advanced_pressed() {
error_label->set_visible(!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root()));
}
- _update_ok_enabled();
EditorSettings::get_singleton()->set_project_metadata("editor_metadata", "use_advanced_connections", advanced->is_pressed());
popup_centered();
@@ -458,8 +627,8 @@ ConnectDialog::ConnectDialog() {
vbc_left->set_h_size_flags(Control::SIZE_EXPAND_FILL);
from_signal = memnew(LineEdit);
- from_signal->set_editable(false);
vbc_left->add_margin_child(TTR("From Signal:"), from_signal);
+ from_signal->set_editable(false);
tree = memnew(SceneTreeEditor(false));
tree->set_connecting_signal(true);
@@ -476,6 +645,43 @@ ConnectDialog::ConnectDialog() {
vbc_left->add_child(error_label);
error_label->hide();
+ method_popup = memnew(AcceptDialog);
+ method_popup->set_title(TTR("Select Method"));
+ method_popup->set_min_size(Vector2(400, 600) * EDSCALE);
+ add_child(method_popup);
+
+ VBoxContainer *method_vbc = memnew(VBoxContainer);
+ method_popup->add_child(method_vbc);
+
+ method_search = memnew(LineEdit);
+ method_vbc->add_child(method_search);
+ method_search->set_placeholder(TTR("Filter Methods"));
+ method_search->set_clear_button_enabled(true);
+ method_search->connect("text_changed", callable_mp(this, &ConnectDialog::_update_method_tree).unbind(1));
+
+ method_tree = memnew(Tree);
+ method_vbc->add_child(method_tree);
+ method_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ method_tree->set_hide_root(true);
+ method_tree->connect("item_selected", callable_mp(this, &ConnectDialog::_method_selected));
+ method_tree->connect("item_activated", callable_mp((Window *)method_popup, &Window::hide));
+
+ empty_tree_label = memnew(Label(TTR("No method found matching given filters.")));
+ method_tree->add_child(empty_tree_label);
+ empty_tree_label->set_anchors_and_offsets_preset(Control::PRESET_CENTER);
+
+ script_methods_only = memnew(CheckButton(TTR("Script Methods Only")));
+ method_vbc->add_child(script_methods_only);
+ script_methods_only->set_h_size_flags(Control::SIZE_SHRINK_END);
+ script_methods_only->set_pressed(EditorSettings::get_singleton()->get_project_metadata("editor_metadata", "show_script_methods_only", true));
+ script_methods_only->connect("pressed", callable_mp(this, &ConnectDialog::_method_check_button_pressed).bind(script_methods_only));
+
+ compatible_methods_only = memnew(CheckButton(TTR("Compatible Methods Only")));
+ method_vbc->add_child(compatible_methods_only);
+ compatible_methods_only->set_h_size_flags(Control::SIZE_SHRINK_END);
+ compatible_methods_only->set_pressed(EditorSettings::get_singleton()->get_project_metadata("editor_metadata", "show_compatible_methods_only", true));
+ compatible_methods_only->connect("pressed", callable_mp(this, &ConnectDialog::_method_check_button_pressed).bind(compatible_methods_only));
+
vbc_right = memnew(VBoxContainer);
main_hb->add_child(vbc_right);
vbc_right->set_h_size_flags(Control::SIZE_EXPAND_FILL);
@@ -521,14 +727,22 @@ ConnectDialog::ConnectDialog() {
vbc_right->add_margin_child(TTR("Unbind Signal Arguments:"), unbind_count);
+ HBoxContainer *hbc_method = memnew(HBoxContainer);
+ vbc_left->add_margin_child(TTR("Receiver Method:"), hbc_method);
+
dst_method = memnew(LineEdit);
dst_method->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ dst_method->connect("text_changed", callable_mp(method_tree, &Tree::deselect_all).unbind(1));
dst_method->connect("text_submitted", callable_mp(this, &ConnectDialog::_text_submitted));
- vbc_left->add_margin_child(TTR("Receiver Method:"), dst_method);
+ hbc_method->add_child(dst_method);
- advanced = memnew(CheckButton);
+ open_method_tree = memnew(Button);
+ hbc_method->add_child(open_method_tree);
+ open_method_tree->set_text("Pick");
+ open_method_tree->connect("pressed", callable_mp(this, &ConnectDialog::_open_method_popup));
+
+ advanced = memnew(CheckButton(TTR("Advanced")));
vbc_left->add_child(advanced);
- advanced->set_text(TTR("Advanced"));
advanced->set_h_size_flags(Control::SIZE_SHRINK_BEGIN | Control::SIZE_EXPAND);
advanced->set_pressed(EditorSettings::get_singleton()->get_project_metadata("editor_metadata", "use_advanced_connections", false));
advanced->connect("pressed", callable_mp(this, &ConnectDialog::_advanced_pressed));
@@ -566,7 +780,7 @@ ConnectDialog::~ConnectDialog() {
// Originally copied and adapted from EditorProperty, try to keep style in sync.
Control *ConnectionsDockTree::make_custom_tooltip(const String &p_text) const {
EditorHelpBit *help_bit = memnew(EditorHelpBit);
- help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE);
+ help_bit->get_rich_text()->set_custom_minimum_size(Size2(360 * EDSCALE, 1));
// p_text is expected to be something like this:
// "gui_input::(event: InputEvent)::<Signal description>"
@@ -605,9 +819,6 @@ void ConnectionsDock::_filter_changed(const String &p_text) {
* Creates or edits connections based on state of the ConnectDialog when "Connect" is pressed.
*/
void ConnectionsDock::_make_or_edit_connection() {
- TreeItem *it = tree->get_selected();
- ERR_FAIL_COND(!it);
-
NodePath dst_path = connect_dialog->get_dst_path();
Node *target = selected_node->get_node(dst_path);
ERR_FAIL_COND(!target);
@@ -645,27 +856,21 @@ void ConnectionsDock::_make_or_edit_connection() {
add_script_function = !found_inherited_function;
}
- PackedStringArray script_function_args;
- if (add_script_function) {
- // Pick up args here before "it" is deleted by update_tree.
- script_function_args = it->get_metadata(0).operator Dictionary()["args"];
- script_function_args.resize(script_function_args.size() - cd.unbinds);
- for (int i = 0; i < cd.binds.size(); i++) {
- script_function_args.push_back("extra_arg_" + itos(i) + ":" + Variant::get_type_name(cd.binds[i].get_type()));
- }
- }
if (connect_dialog->is_editing()) {
- _disconnect(*it);
+ _disconnect(connect_dialog->get_source_connection_data());
_connect(cd);
} else {
_connect(cd);
}
- // IMPORTANT NOTE: _disconnect and _connect cause an update_tree, which will delete the object "it" is pointing to.
- it = nullptr;
-
if (add_script_function) {
+ PackedStringArray script_function_args = connect_dialog->get_signal_args();
+ script_function_args.resize(script_function_args.size() - cd.unbinds);
+ for (int i = 0; i < cd.binds.size(); i++) {
+ script_function_args.push_back("extra_arg_" + itos(i) + ":" + Variant::get_type_name(cd.binds[i].get_type()));
+ }
+
EditorNode::get_singleton()->emit_signal(SNAME("script_add_function_request"), target, cd.method, script_function_args);
hide();
}
@@ -676,7 +881,7 @@ void ConnectionsDock::_make_or_edit_connection() {
/*
* Creates single connection w/ undo-redo functionality.
*/
-void ConnectionsDock::_connect(ConnectDialog::ConnectionData p_cd) {
+void ConnectionsDock::_connect(const ConnectDialog::ConnectionData &p_cd) {
Node *source = Object::cast_to<Node>(p_cd.source);
Node *target = Object::cast_to<Node>(p_cd.target);
@@ -700,18 +905,15 @@ void ConnectionsDock::_connect(ConnectDialog::ConnectionData p_cd) {
/*
* Break single connection w/ undo-redo functionality.
*/
-void ConnectionsDock::_disconnect(TreeItem &p_item) {
- Connection connection = p_item.get_metadata(0);
- ConnectDialog::ConnectionData cd = connection;
-
- ERR_FAIL_COND(cd.source != selected_node); // Shouldn't happen but... Bugcheck.
+void ConnectionsDock::_disconnect(const ConnectDialog::ConnectionData &p_cd) {
+ ERR_FAIL_COND(p_cd.source != selected_node); // Shouldn't happen but... Bugcheck.
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
- undo_redo->create_action(vformat(TTR("Disconnect '%s' from '%s'"), cd.signal, cd.method));
+ undo_redo->create_action(vformat(TTR("Disconnect '%s' from '%s'"), p_cd.signal, p_cd.method));
- Callable callable = cd.get_callable();
- undo_redo->add_do_method(selected_node, "disconnect", cd.signal, callable);
- undo_redo->add_undo_method(selected_node, "connect", cd.signal, callable, cd.binds, cd.flags);
+ Callable callable = p_cd.get_callable();
+ undo_redo->add_do_method(selected_node, "disconnect", p_cd.signal, callable);
+ undo_redo->add_undo_method(selected_node, "connect", p_cd.signal, callable, p_cd.flags);
undo_redo->add_do_method(this, "update_tree");
undo_redo->add_undo_method(this, "update_tree");
undo_redo->add_do_method(SceneTreeDock::get_singleton()->get_tree_editor(), "update_tree"); // To force redraw of scene tree.
@@ -741,7 +943,7 @@ void ConnectionsDock::_disconnect_all() {
if (!_is_connection_inherited(connection)) {
ConnectDialog::ConnectionData cd = connection;
undo_redo->add_do_method(selected_node, "disconnect", cd.signal, cd.get_callable());
- undo_redo->add_undo_method(selected_node, "connect", cd.signal, cd.get_callable(), cd.binds, cd.flags);
+ undo_redo->add_undo_method(selected_node, "connect", cd.signal, cd.get_callable(), cd.flags);
}
child = child->get_next();
}
@@ -795,8 +997,9 @@ bool ConnectionsDock::_is_connection_inherited(Connection &p_connection) {
* Open connection dialog with TreeItem data to CREATE a brand-new connection.
*/
void ConnectionsDock::_open_connection_dialog(TreeItem &p_item) {
- String signal_name = p_item.get_metadata(0).operator Dictionary()["name"];
- const String &signal_name_ref = signal_name;
+ Dictionary sinfo = p_item.get_metadata(0);
+ String signal_name = sinfo["name"];
+ PackedStringArray signal_args = sinfo["args"];
Node *dst_node = selected_node->get_owner() ? selected_node->get_owner() : selected_node;
if (!dst_node || dst_node->get_script().is_null()) {
@@ -805,26 +1008,34 @@ void ConnectionsDock::_open_connection_dialog(TreeItem &p_item) {
ConnectDialog::ConnectionData cd;
cd.source = selected_node;
- cd.signal = StringName(signal_name_ref);
+ cd.signal = StringName(signal_name);
cd.target = dst_node;
cd.method = ConnectDialog::generate_method_callback_name(cd.source, signal_name, cd.target);
- connect_dialog->popup_dialog(signal_name_ref);
- connect_dialog->init(cd);
+ connect_dialog->popup_dialog(signal_name + "(" + String(", ").join(signal_args) + ")");
+ connect_dialog->init(cd, signal_args);
connect_dialog->set_title(TTR("Connect a Signal to a Method"));
}
/*
* Open connection dialog with Connection data to EDIT an existing connection.
*/
-void ConnectionsDock::_open_connection_dialog(ConnectDialog::ConnectionData p_cd) {
- Node *src = Object::cast_to<Node>(p_cd.source);
- Node *dst = Object::cast_to<Node>(p_cd.target);
+void ConnectionsDock::_open_edit_connection_dialog(TreeItem &p_item) {
+ TreeItem *signal_item = p_item.get_parent();
+ ERR_FAIL_COND(!signal_item);
+
+ Connection connection = p_item.get_metadata(0);
+ ConnectDialog::ConnectionData cd = connection;
+
+ Node *src = Object::cast_to<Node>(cd.source);
+ Node *dst = Object::cast_to<Node>(cd.target);
if (src && dst) {
- const String &signal_name_ref = p_cd.signal;
- connect_dialog->set_title(TTR("Edit Connection:") + p_cd.signal);
+ const String &signal_name_ref = cd.signal;
+ PackedStringArray signal_args = signal_item->get_metadata(0).operator Dictionary()["args"];
+
+ connect_dialog->set_title(vformat(TTR("Edit Connection: '%s'"), cd.signal));
connect_dialog->popup_dialog(signal_name_ref);
- connect_dialog->init(p_cd, true);
+ connect_dialog->init(cd, signal_args, true);
}
}
@@ -899,14 +1110,14 @@ void ConnectionsDock::_handle_slot_menu_option(int p_option) {
switch (p_option) {
case EDIT: {
- Connection connection = item->get_metadata(0);
- _open_connection_dialog(connection);
+ _open_edit_connection_dialog(*item);
} break;
case GO_TO_SCRIPT: {
_go_to_script(*item);
} break;
case DISCONNECT: {
- _disconnect(*item);
+ Connection connection = item->get_metadata(0);
+ _disconnect(connection);
update_tree();
} break;
}
@@ -957,7 +1168,8 @@ void ConnectionsDock::_connect_pressed() {
if (_is_item_signal(*item)) {
_open_connection_dialog(*item);
} else {
- _disconnect(*item);
+ Connection connection = item->get_metadata(0);
+ _disconnect(connection);
update_tree();
}
}
@@ -985,6 +1197,10 @@ void ConnectionsDock::set_node(Node *p_node) {
}
void ConnectionsDock::update_tree() {
+ String prev_selected;
+ if (tree->is_anything_selected()) {
+ prev_selected = tree->get_selected()->get_text(0);
+ }
tree->clear();
if (!selected_node) {
@@ -1046,37 +1262,22 @@ void ConnectionsDock::update_tree() {
}
for (MethodInfo &mi : node_signals2) {
- StringName signal_name = mi.name;
- String signaldesc = "(";
- PackedStringArray argnames;
-
- String filter_text = search_box->get_text();
- if (!filter_text.is_subsequence_ofn(signal_name)) {
+ const StringName signal_name = mi.name;
+ if (!search_box->get_text().is_subsequence_ofn(signal_name)) {
continue;
}
+ PackedStringArray argnames;
- if (mi.arguments.size()) {
- for (int i = 0; i < mi.arguments.size(); i++) {
- PropertyInfo &pi = mi.arguments[i];
+ // Create the children of the subsection - the actual list of signals.
+ TreeItem *signal_item = tree->create_item(section_item);
+ String signame = connect_dialog->get_signature(mi, &argnames);
+ signal_item->set_text(0, signame);
- if (i > 0) {
- signaldesc += ", ";
- }
- String tname = "var";
- if (pi.type == Variant::OBJECT && pi.class_name != StringName()) {
- tname = pi.class_name.operator String();
- } else if (pi.type != Variant::NIL) {
- tname = Variant::get_type_name(pi.type);
- }
- signaldesc += (pi.name.is_empty() ? String("arg " + itos(i)) : pi.name) + ": " + tname;
- argnames.push_back(pi.name + ":" + tname);
- }
+ if (signame == prev_selected) {
+ signal_item->select(0);
+ prev_selected = "";
}
- signaldesc += ")";
- // Create the children of the subsection - the actual list of signals.
- TreeItem *signal_item = tree->create_item(section_item);
- signal_item->set_text(0, String(signal_name) + signaldesc);
Dictionary sinfo;
sinfo["name"] = signal_name;
sinfo["args"] = argnames;
@@ -1117,7 +1318,7 @@ void ConnectionsDock::update_tree() {
}
// "::" separators used in make_custom_tooltip for formatting.
- signal_item->set_tooltip_text(0, String(signal_name) + "::" + signaldesc + "::" + descr);
+ signal_item->set_tooltip_text(0, String(signal_name) + "::" + signame.trim_prefix(mi.name) + "::" + descr);
}
// List existing connections.
@@ -1238,9 +1439,6 @@ ConnectionsDock::ConnectionsDock() {
tree->connect("item_mouse_selected", callable_mp(this, &ConnectionsDock::_rmb_pressed));
add_theme_constant_override("separation", 3 * EDSCALE);
-
- EDITOR_DEF("interface/editors/default_signal_callback_name", "_on_{node_name}_{signal_name}");
- EDITOR_DEF("interface/editors/default_signal_callback_to_self_name", "_on_{signal_name}");
}
ConnectionsDock::~ConnectionsDock() {
diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h
index 829a98caed..277ea03cf7 100644
--- a/editor/connections_dialog.h
+++ b/editor/connections_dialog.h
@@ -88,7 +88,7 @@ public:
method = base_callable.get_method();
}
- Callable get_callable() {
+ Callable get_callable() const {
if (unbinds > 0) {
return Callable(target, method).unbind(unbinds);
} else if (!binds.is_empty()) {
@@ -107,16 +107,26 @@ private:
Label *connect_to_label = nullptr;
LineEdit *from_signal = nullptr;
Node *source = nullptr;
+ ConnectionData source_connection_data;
StringName signal;
+ PackedStringArray signal_args;
LineEdit *dst_method = nullptr;
ConnectDialogBinds *cdbinds = nullptr;
bool edit_mode = false;
bool first_popup = true;
NodePath dst_path;
VBoxContainer *vbc_right = nullptr;
-
SceneTreeEditor *tree = nullptr;
AcceptDialog *error = nullptr;
+
+ Button *open_method_tree = nullptr;
+ AcceptDialog *method_popup = nullptr;
+ Tree *method_tree = nullptr;
+ Label *empty_tree_label = nullptr;
+ LineEdit *method_search = nullptr;
+ CheckButton *script_methods_only = nullptr;
+ CheckButton *compatible_methods_only = nullptr;
+
SpinBox *unbind_count = nullptr;
EditorInspector *bind_editor = nullptr;
OptionButton *type_list = nullptr;
@@ -132,6 +142,14 @@ private:
void _item_activated();
void _text_submitted(const String &p_text);
void _tree_node_selected();
+
+ void _method_selected();
+ void _create_method_tree_items(const List<MethodInfo> &p_methods, TreeItem *p_parent_item);
+ List<MethodInfo> _filter_method_list(const List<MethodInfo> &p_methods, const MethodInfo &p_signal, const String &p_search_string) const;
+ void _update_method_tree();
+ void _method_check_button_pressed(const CheckButton *p_button);
+ void _open_method_popup();
+
void _unbind_count_changed(double p_count);
void _add_bind();
void _remove_bind();
@@ -145,21 +163,24 @@ protected:
public:
static StringName generate_method_callback_name(Node *p_source, String p_signal_name, Node *p_target);
Node *get_source() const;
+ ConnectionData get_source_connection_data() const;
StringName get_signal_name() const;
+ PackedStringArray get_signal_args() const;
NodePath get_dst_path() const;
void set_dst_node(Node *p_node);
StringName get_dst_method_name() const;
void set_dst_method(const StringName &p_method);
int get_unbinds() const;
Vector<Variant> get_binds() const;
+ String get_signature(const MethodInfo &p_method, PackedStringArray *r_arg_names = nullptr);
bool get_deferred() const;
bool get_one_shot() const;
bool is_editing() const;
- void init(ConnectionData p_cd, bool p_edit = false);
+ void init(const ConnectionData &p_cd, const PackedStringArray &p_signal_args, bool p_edit = false);
- void popup_dialog(const String &p_for_signal);
+ void popup_dialog(const String p_for_signal);
ConnectDialog();
~ConnectDialog();
};
@@ -203,8 +224,8 @@ class ConnectionsDock : public VBoxContainer {
void _filter_changed(const String &p_text);
void _make_or_edit_connection();
- void _connect(ConnectDialog::ConnectionData p_cd);
- void _disconnect(TreeItem &p_item);
+ void _connect(const ConnectDialog::ConnectionData &p_cd);
+ void _disconnect(const ConnectDialog::ConnectionData &p_cd);
void _disconnect_all();
void _tree_item_selected();
@@ -213,7 +234,7 @@ class ConnectionsDock : public VBoxContainer {
bool _is_connection_inherited(Connection &p_connection);
void _open_connection_dialog(TreeItem &p_item);
- void _open_connection_dialog(ConnectDialog::ConnectionData p_cd);
+ void _open_edit_connection_dialog(TreeItem &p_item);
void _go_to_script(TreeItem &p_item);
void _handle_signal_menu_option(int p_option);
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 0814d5b5ca..aee907854c 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -122,7 +122,7 @@ bool CreateDialog::_should_hide_type(const String &p_type) const {
return true;
}
- if (base_type == "Node" && p_type.begins_with("Editor")) {
+ if (is_base_type_node && p_type.begins_with("Editor")) {
return true; // Do not show editor nodes.
}
@@ -508,6 +508,11 @@ String CreateDialog::get_selected_type() {
return selected->get_text(0);
}
+void CreateDialog::set_base_type(const String &p_base) {
+ base_type = p_base;
+ is_base_type_node = ClassDB::is_parent_class(p_base, "Node");
+}
+
Variant CreateDialog::instantiate_selected() {
TreeItem *selected = search_options->get_selected();
diff --git a/editor/create_dialog.h b/editor/create_dialog.h
index ad63346a02..37579812cf 100644
--- a/editor/create_dialog.h
+++ b/editor/create_dialog.h
@@ -51,6 +51,7 @@ class CreateDialog : public ConfirmationDialog {
Tree *search_options = nullptr;
String base_type;
+ bool is_base_type_node = false;
String icon_fallback;
String preferred_search_result_type;
@@ -113,7 +114,7 @@ public:
Variant instantiate_selected();
String get_selected_type();
- void set_base_type(const String &p_base) { base_type = p_base; }
+ void set_base_type(const String &p_base);
String get_base_type() const { return base_type; }
void select_base();
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index 2c6b9990ed..32952a367d 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -519,7 +519,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
String error_title;
if (oe.callstack.size() > 0) {
// If available, use the script's stack in the error title.
- error_title = oe.callstack[oe.callstack.size() - 1].func + ": ";
+ error_title = _format_frame_text(&oe.callstack[0]) + ": ";
} else if (!oe.source_func.is_empty()) {
// Otherwise try to use the C++ source function.
error_title += oe.source_func + ": ";
@@ -530,13 +530,25 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
error->set_text(1, error_title);
tooltip += " " + error_title + "\n";
+ // Find the language of the error's source file.
+ String source_language_name = "C++"; // Default value is the old hard-coded one.
+ const String source_file_extension = oe.source_file.get_extension();
+ for (int i = 0; i < ScriptServer::get_language_count(); ++i) {
+ ScriptLanguage *script_language = ScriptServer::get_language(i);
+ if (source_file_extension == script_language->get_extension()) {
+ source_language_name = script_language->get_name();
+ break;
+ }
+ }
+
if (!oe.error_descr.is_empty()) {
// Add item for C++ error condition.
TreeItem *cpp_cond = error_tree->create_item(error);
- cpp_cond->set_text(0, "<" + TTR("C++ Error") + ">");
+ // TRANSLATORS: %s is the name of a language, e.g. C++.
+ cpp_cond->set_text(0, "<" + vformat(TTR("%s Error"), source_language_name) + ">");
cpp_cond->set_text(1, oe.error);
cpp_cond->set_text_alignment(0, HORIZONTAL_ALIGNMENT_LEFT);
- tooltip += TTR("C++ Error:") + " " + oe.error + "\n";
+ tooltip += vformat(TTR("%s Error:"), source_language_name) + " " + oe.error + "\n";
if (source_is_project_file) {
cpp_cond->set_metadata(0, source_meta);
}
@@ -547,14 +559,18 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
// Source of the error.
String source_txt = (source_is_project_file ? oe.source_file.get_file() : oe.source_file) + ":" + itos(oe.source_line);
if (!oe.source_func.is_empty()) {
- source_txt += " @ " + oe.source_func + "()";
+ source_txt += " @ " + oe.source_func;
+ if (!oe.source_func.ends_with(")")) {
+ source_txt += "()";
+ }
}
TreeItem *cpp_source = error_tree->create_item(error);
- cpp_source->set_text(0, "<" + (source_is_project_file ? TTR("Source") : TTR("C++ Source")) + ">");
+ // TRANSLATORS: %s is the name of a language, e.g. C++.
+ cpp_source->set_text(0, "<" + vformat(TTR("%s Source"), source_language_name) + ">");
cpp_source->set_text(1, source_txt);
cpp_source->set_text_alignment(0, HORIZONTAL_ALIGNMENT_LEFT);
- tooltip += (source_is_project_file ? TTR("Source:") : TTR("C++ Source:")) + " " + source_txt + "\n";
+ tooltip += vformat(TTR("%s Source:"), source_language_name) + " " + source_txt + "\n";
// Set metadata to highlight error line in scripts.
if (source_is_project_file) {
@@ -581,7 +597,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
tooltip += TTR("Stack Trace:") + "\n";
}
- String frame_txt = infos[i].file.get_file() + ":" + itos(infos[i].line) + " @ " + infos[i].func + "()";
+ String frame_txt = _format_frame_text(&infos[i]);
tooltip += frame_txt + "\n";
stack_trace->set_text(1, frame_txt);
}
@@ -901,6 +917,14 @@ void ScriptEditorDebugger::_breakpoint_tree_clicked() {
}
}
+String ScriptEditorDebugger::_format_frame_text(const ScriptLanguage::StackInfo *info) {
+ String text = info->file.get_file() + ":" + itos(info->line) + " @ " + info->func;
+ if (!text.ends_with(")")) {
+ text += "()";
+ }
+ return text;
+}
+
void ScriptEditorDebugger::start(Ref<RemoteDebuggerPeer> p_peer) {
_clear_errors_list();
stop();
diff --git a/editor/debugger/script_editor_debugger.h b/editor/debugger/script_editor_debugger.h
index e31b3af3d9..a0c420522a 100644
--- a/editor/debugger/script_editor_debugger.h
+++ b/editor/debugger/script_editor_debugger.h
@@ -210,6 +210,8 @@ private:
void _breakpoint_tree_clicked();
+ String _format_frame_text(const ScriptLanguage::StackInfo *info);
+
protected:
void _notification(int p_what);
static void _bind_methods();
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index a925e2d1d3..c98ec7b2d5 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -536,12 +536,17 @@ void DependencyRemoveDialog::show(const Vector<String> &p_folders, const Vector<
}
void DependencyRemoveDialog::ok_pressed() {
- for (int i = 0; i < files_to_delete.size(); ++i) {
- if (ResourceCache::has(files_to_delete[i])) {
- Ref<Resource> res = ResourceCache::get_ref(files_to_delete[i]);
+ for (const KeyValue<String, String> &E : all_remove_files) {
+ String file = E.key;
+
+ if (ResourceCache::has(file)) {
+ Ref<Resource> res = ResourceCache::get_ref(file);
+ emit_signal(SNAME("resource_removed"), res);
res->set_path("");
}
+ }
+ for (int i = 0; i < files_to_delete.size(); ++i) {
// If the file we are deleting for e.g. the main scene, default environment,
// or audio bus layout, we must clear its definition in Project Settings.
if (files_to_delete[i] == String(GLOBAL_GET("application/config/icon"))) {
@@ -621,6 +626,7 @@ void DependencyRemoveDialog::ok_pressed() {
}
void DependencyRemoveDialog::_bind_methods() {
+ ADD_SIGNAL(MethodInfo("resource_removed", PropertyInfo(Variant::OBJECT, "obj")));
ADD_SIGNAL(MethodInfo("file_removed", PropertyInfo(Variant::STRING, "file")));
ADD_SIGNAL(MethodInfo("folder_removed", PropertyInfo(Variant::STRING, "folder")));
}
diff --git a/editor/dictionary_property_edit.cpp b/editor/dictionary_property_edit.cpp
deleted file mode 100644
index ad59a1c169..0000000000
--- a/editor/dictionary_property_edit.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/**************************************************************************/
-/* dictionary_property_edit.cpp */
-/**************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/**************************************************************************/
-/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
-/* */
-/* 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 "dictionary_property_edit.h"
-#include "editor/editor_undo_redo_manager.h"
-
-void DictionaryPropertyEdit::_notif_change() {
- notify_property_list_changed();
-}
-
-void DictionaryPropertyEdit::_set_key(const Variant &p_old_key, const Variant &p_new_key) {
- // TODO: Set key of a dictionary is not allowed yet
-}
-
-void DictionaryPropertyEdit::_set_value(const Variant &p_key, const Variant &p_value) {
- Dictionary dict = get_dictionary();
- dict[p_key] = p_value;
- Object *o = ObjectDB::get_instance(obj);
- if (!o) {
- return;
- }
-
- o->set(property, dict);
-}
-
-Variant DictionaryPropertyEdit::get_dictionary() const {
- Object *o = ObjectDB::get_instance(obj);
- if (!o) {
- return Dictionary();
- }
- Variant dict = o->get(property);
- if (dict.get_type() != Variant::DICTIONARY) {
- return Dictionary();
- }
- return dict;
-}
-
-void DictionaryPropertyEdit::_get_property_list(List<PropertyInfo> *p_list) const {
- Dictionary dict = get_dictionary();
-
- Array keys = dict.keys();
- keys.sort();
-
- for (int i = 0; i < keys.size(); i++) {
- String index = itos(i);
-
- const Variant &key = keys[i];
- PropertyInfo pi(key.get_type(), index + ": key");
- p_list->push_back(pi);
-
- const Variant &value = dict[key];
- pi = PropertyInfo(value.get_type(), index + ": value");
- p_list->push_back(pi);
- }
-}
-
-void DictionaryPropertyEdit::edit(Object *p_obj, const StringName &p_prop) {
- property = p_prop;
- obj = p_obj->get_instance_id();
-}
-
-Node *DictionaryPropertyEdit::get_node() {
- Object *o = ObjectDB::get_instance(obj);
- if (!o) {
- return nullptr;
- }
-
- return cast_to<Node>(o);
-}
-
-bool DictionaryPropertyEdit::_dont_undo_redo() {
- return true;
-}
-
-void DictionaryPropertyEdit::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_set_key"), &DictionaryPropertyEdit::_set_key);
- ClassDB::bind_method(D_METHOD("_set_value"), &DictionaryPropertyEdit::_set_value);
- ClassDB::bind_method(D_METHOD("_notif_change"), &DictionaryPropertyEdit::_notif_change);
- ClassDB::bind_method(D_METHOD("_dont_undo_redo"), &DictionaryPropertyEdit::_dont_undo_redo);
-}
-
-bool DictionaryPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
- Dictionary dict = get_dictionary();
- Array keys = dict.keys();
- keys.sort();
-
- String pn = p_name;
- int slash = pn.find(": ");
- if (slash != -1 && pn.length() > slash) {
- String type = pn.substr(slash + 2, pn.length());
- int index = pn.substr(0, slash).to_int();
- if (type == "key" && index < keys.size()) {
- const Variant &key = keys[index];
- EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
-
- ur->create_action(TTR("Change Dictionary Key"));
- ur->add_do_method(this, "_set_key", key, p_value);
- ur->add_undo_method(this, "_set_key", p_value, key);
- ur->commit_action();
-
- return true;
- } else if (type == "value" && index < keys.size()) {
- const Variant &key = keys[index];
- if (dict.has(key)) {
- Variant value = dict[key];
- EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
-
- ur->create_action(TTR("Change Dictionary Value"));
- ur->add_do_method(this, "_set_value", key, p_value);
- ur->add_undo_method(this, "_set_value", key, value);
- ur->commit_action();
-
- return true;
- }
- }
- }
-
- return false;
-}
-
-bool DictionaryPropertyEdit::_get(const StringName &p_name, Variant &r_ret) const {
- Dictionary dict = get_dictionary();
- Array keys = dict.keys();
- keys.sort();
-
- String pn = p_name;
- int slash = pn.find(": ");
-
- if (slash != -1 && pn.length() > slash) {
- String type = pn.substr(slash + 2, pn.length());
- int index = pn.substr(0, slash).to_int();
-
- if (type == "key" && index < keys.size()) {
- r_ret = keys[index];
- return true;
- } else if (type == "value" && index < keys.size()) {
- const Variant &key = keys[index];
- if (dict.has(key)) {
- r_ret = dict[key];
- return true;
- }
- }
- }
-
- return false;
-}
-
-DictionaryPropertyEdit::DictionaryPropertyEdit() {
-}
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp
index c675060b2b..d71ef78d88 100644
--- a/editor/doc_tools.cpp
+++ b/editor/doc_tools.cpp
@@ -461,7 +461,7 @@ void DocTools::generate(bool p_basic_types) {
}
if (default_value_valid && default_value.get_type() != Variant::OBJECT) {
- prop.default_value = default_value.get_construct_string().replace("\n", " ");
+ prop.default_value = DocData::get_default_value_string(default_value);
}
StringName setter = ClassDB::get_property_setter(name, E.name);
@@ -591,7 +591,7 @@ void DocTools::generate(bool p_basic_types) {
tid.name = E;
tid.type = "Color";
tid.data_type = "color";
- tid.default_value = Variant(ThemeDB::get_singleton()->get_default_theme()->get_color(E, cname)).get_construct_string().replace("\n", " ");
+ tid.default_value = DocData::get_default_value_string(ThemeDB::get_singleton()->get_default_theme()->get_color(E, cname));
c.theme_properties.push_back(tid);
}
@@ -750,6 +750,7 @@ void DocTools::generate(bool p_basic_types) {
MethodInfo mi;
mi.name = "operator []";
mi.return_val.type = Variant::get_indexed_element_type(Variant::Type(i));
+ mi.return_val.usage = Variant::get_indexed_element_usage(Variant::Type(i));
PropertyInfo arg;
arg.name = "index";
arg.type = Variant::INT;
@@ -771,8 +772,7 @@ void DocTools::generate(bool p_basic_types) {
int darg_idx = mi.default_arguments.size() - mi.arguments.size() + j;
if (darg_idx >= 0) {
- Variant default_arg = mi.default_arguments[darg_idx];
- ad.default_value = default_arg.get_construct_string().replace("\n", " ");
+ ad.default_value = DocData::get_default_value_string(mi.default_arguments[darg_idx]);
}
method.arguments.push_back(ad);
@@ -816,7 +816,7 @@ void DocTools::generate(bool p_basic_types) {
DocData::PropertyDoc property;
property.name = pi.name;
property.type = Variant::get_type_name(pi.type);
- property.default_value = v.get(pi.name).get_construct_string().replace("\n", " ");
+ property.default_value = DocData::get_default_value_string(v.get(pi.name));
c.properties.push_back(property);
}
@@ -947,8 +947,7 @@ void DocTools::generate(bool p_basic_types) {
int darg_idx = j - (mi.arguments.size() - mi.default_arguments.size());
if (darg_idx >= 0) {
- Variant default_arg = mi.default_arguments[darg_idx];
- ad.default_value = default_arg.get_construct_string().replace("\n", " ");
+ ad.default_value = DocData::get_default_value_string(mi.default_arguments[darg_idx]);
}
md.arguments.push_back(ad);
@@ -992,8 +991,7 @@ void DocTools::generate(bool p_basic_types) {
int darg_idx = j - (ai.arguments.size() - ai.default_arguments.size());
if (darg_idx >= 0) {
- Variant default_arg = ai.default_arguments[darg_idx];
- ad.default_value = default_arg.get_construct_string().replace("\n", " ");
+ ad.default_value = DocData::get_default_value_string(ai.default_arguments[darg_idx]);
}
atd.arguments.push_back(ad);
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 6e66962605..3059ce445c 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -122,12 +122,6 @@ int EditorSelectionHistory::get_history_pos() {
return current_elem_idx;
}
-bool EditorSelectionHistory::is_history_obj_inspector_only(int p_obj) const {
- ERR_FAIL_INDEX_V(p_obj, history.size(), false);
- ERR_FAIL_INDEX_V(history[p_obj].level, history[p_obj].path.size(), false);
- return history[p_obj].path[history[p_obj].level].inspector_only;
-}
-
ObjectID EditorSelectionHistory::get_history_obj(int p_obj) const {
ERR_FAIL_INDEX_V(p_obj, history.size(), ObjectID());
ERR_FAIL_INDEX_V(history[p_obj].level, history[p_obj].path.size(), ObjectID());
@@ -351,18 +345,6 @@ void EditorData::apply_changes_in_editors() {
}
}
-void EditorData::save_editor_global_states() {
- for (int i = 0; i < editor_plugins.size(); i++) {
- editor_plugins[i]->save_global_state();
- }
-}
-
-void EditorData::restore_editor_global_states() {
- for (int i = 0; i < editor_plugins.size(); i++) {
- editor_plugins[i]->restore_global_state();
- }
-}
-
void EditorData::paste_object_params(Object *p_object) {
ERR_FAIL_NULL(p_object);
undo_redo_manager->create_action(TTR("Paste Params"));
diff --git a/editor/editor_data.h b/editor/editor_data.h
index bce9dd345d..d00501280d 100644
--- a/editor/editor_data.h
+++ b/editor/editor_data.h
@@ -80,7 +80,6 @@ public:
// Gets an object from the history. The most recent object would be the object with p_obj = get_history_len() - 1.
ObjectID get_history_obj(int p_obj) const;
- bool is_history_obj_inspector_only(int p_obj) const;
bool next();
bool previous();
@@ -177,7 +176,6 @@ public:
Callable get_move_array_element_function(const StringName &p_class) const;
void save_editor_global_states();
- void restore_editor_global_states();
void add_custom_type(const String &p_type, const String &p_inherits, const Ref<Script> &p_script, const Ref<Texture2D> &p_icon);
Variant instantiate_custom_type(const String &p_type, const String &p_inherits);
@@ -203,7 +201,6 @@ public:
String get_scene_type(int p_idx) const;
void set_scene_path(int p_idx, const String &p_path);
Ref<Script> get_scene_root_script(int p_idx) const;
- void set_edited_scene_version(uint64_t version, int p_scene_idx = -1);
void set_scene_modified_time(int p_idx, uint64_t p_time);
uint64_t get_scene_modified_time(int p_idx) const;
void clear_edited_scenes();
diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp
index a83a53ad15..33a1fe4b45 100644
--- a/editor/editor_feature_profile.cpp
+++ b/editor/editor_feature_profile.cpp
@@ -980,7 +980,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
no_profile_selected_help = memnew(Label(TTR("Create or import a profile to edit available classes and properties.")));
// Add some spacing above the help label.
Ref<StyleBoxEmpty> sb = memnew(StyleBoxEmpty);
- sb->set_default_margin(SIDE_TOP, 20 * EDSCALE);
+ sb->set_content_margin(SIDE_TOP, 20 * EDSCALE);
no_profile_selected_help->add_theme_style_override("normal", sb);
no_profile_selected_help->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
no_profile_selected_help->set_v_size_flags(Control::SIZE_EXPAND_FILL);
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index a9b4c08698..4d0ef3fe8d 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -47,7 +47,7 @@
EditorFileSystem *EditorFileSystem::singleton = nullptr;
//the name is the version, to keep compatibility with different versions of Godot
-#define CACHE_FILE_NAME "filesystem_cache7"
+#define CACHE_FILE_NAME "filesystem_cache8"
void EditorFileSystemDirectory::sort_files() {
files.sort_custom<FileInfoSort>();
@@ -169,6 +169,11 @@ StringName EditorFileSystemDirectory::get_file_type(int p_idx) const {
return files[p_idx]->type;
}
+StringName EditorFileSystemDirectory::get_file_resource_script_class(int p_idx) const {
+ ERR_FAIL_INDEX_V(p_idx, files.size(), "");
+ return files[p_idx]->resource_script_class;
+}
+
String EditorFileSystemDirectory::get_name() {
return name;
}
@@ -266,6 +271,10 @@ void EditorFileSystem::_scan_filesystem() {
FileCache fc;
fc.type = split[1];
+ if (fc.type.find("/") != -1) {
+ fc.type = fc.type.get_slice("/", 0);
+ fc.resource_script_class = fc.type.get_slice("/", 1);
+ }
fc.uid = split[2].to_int();
fc.modification_time = split[3].to_int();
fc.import_modification_time = split[4].to_int();
@@ -854,6 +863,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, Ref<DirAc
if (fc && fc->modification_time == mt && fc->import_modification_time == import_mt && !_test_for_reimport(path, true)) {
fi->type = fc->type;
+ fi->resource_script_class = fc->resource_script_class;
fi->uid = fc->uid;
fi->deps = fc->deps;
fi->modified_time = fc->modification_time;
@@ -875,6 +885,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, Ref<DirAc
if (fc->type.is_empty()) {
fi->type = ResourceLoader::get_resource_type(path);
+ fi->resource_script_class = ResourceLoader::get_resource_script_class(path);
fi->import_group_file = ResourceLoader::get_import_group_file(path);
//there is also the chance that file type changed due to reimport, must probably check this somehow here (or kind of note it for next time in another file?)
//note: I think this should not happen any longer..
@@ -904,6 +915,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, Ref<DirAc
if (fc && fc->modification_time == mt) {
//not imported, so just update type if changed
fi->type = fc->type;
+ fi->resource_script_class = fc->resource_script_class;
fi->uid = fc->uid;
fi->modified_time = fc->modification_time;
fi->deps = fc->deps;
@@ -915,6 +927,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, Ref<DirAc
} else {
//new or modified time
fi->type = ResourceLoader::get_resource_type(path);
+ fi->resource_script_class = ResourceLoader::get_resource_script_class(path);
if (fi->type == "" && textfile_extensions.has(ext)) {
fi->type = "TextFile";
}
@@ -1029,6 +1042,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const
fi->modified_time = FileAccess::get_modified_time(path);
fi->import_modified_time = 0;
fi->type = ResourceLoader::get_resource_type(path);
+ fi->resource_script_class = ResourceLoader::get_resource_script_class(path);
if (fi->type == "" && textfile_extensions.has(ext)) {
fi->type = "TextFile";
}
@@ -1285,7 +1299,12 @@ void EditorFileSystem::_save_filesystem_cache(EditorFileSystemDirectory *p_dir,
if (!p_dir->files[i]->import_group_file.is_empty()) {
group_file_cache.insert(p_dir->files[i]->import_group_file);
}
- String s = p_dir->files[i]->file + "::" + p_dir->files[i]->type + "::" + itos(p_dir->files[i]->uid) + "::" + itos(p_dir->files[i]->modified_time) + "::" + itos(p_dir->files[i]->import_modified_time) + "::" + itos(p_dir->files[i]->import_valid) + "::" + p_dir->files[i]->import_group_file + "::" + p_dir->files[i]->script_class_name + "<>" + p_dir->files[i]->script_class_extends + "<>" + p_dir->files[i]->script_class_icon_path;
+
+ String type = p_dir->files[i]->type;
+ if (p_dir->files[i]->resource_script_class) {
+ type += "/" + String(p_dir->files[i]->resource_script_class);
+ }
+ String s = p_dir->files[i]->file + "::" + type + "::" + itos(p_dir->files[i]->uid) + "::" + itos(p_dir->files[i]->modified_time) + "::" + itos(p_dir->files[i]->import_modified_time) + "::" + itos(p_dir->files[i]->import_valid) + "::" + p_dir->files[i]->import_group_file + "::" + p_dir->files[i]->script_class_name + "<>" + p_dir->files[i]->script_class_extends + "<>" + p_dir->files[i]->script_class_icon_path;
s += "::";
for (int j = 0; j < p_dir->files[i]->deps.size(); j++) {
if (j > 0) {
@@ -1533,6 +1552,11 @@ void EditorFileSystem::_update_script_classes() {
int index = -1;
EditorFileSystemDirectory *efd = find_file(path, &index);
+ if (!efd || index < 0) {
+ // The file was removed
+ continue;
+ }
+
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
ScriptLanguage *lang = ScriptServer::get_language(i);
if (lang->supports_documentation() && efd->files[index]->type == lang->get_type()) {
@@ -1567,6 +1591,11 @@ void EditorFileSystem::_update_script_classes() {
void EditorFileSystem::_update_pending_script_classes() {
if (!update_script_paths.is_empty()) {
_update_script_classes();
+ } else {
+ // In case the class cache file was removed somehow, regenerate it.
+ if (ScriptServer::has_global_classes() && !FileAccess::exists(ScriptServer::get_global_class_cache_file_path())) {
+ ScriptServer::save_global_classes();
+ }
}
}
@@ -1612,6 +1641,8 @@ void EditorFileSystem::update_file(const String &p_file) {
if (type.is_empty() && textfile_extensions.has(p_file.get_extension())) {
type = "TextFile";
}
+ String script_class = ResourceLoader::get_resource_script_class(p_file);
+
ResourceUID::ID uid = ResourceLoader::get_resource_uid(p_file);
if (cpos == -1) {
@@ -1645,6 +1676,7 @@ void EditorFileSystem::update_file(const String &p_file) {
}
fs->files[cpos]->type = type;
+ fs->files[cpos]->resource_script_class = script_class;
fs->files[cpos]->uid = uid;
fs->files[cpos]->script_class_name = _get_global_script_class(type, p_file, &fs->files[cpos]->script_class_extends, &fs->files[cpos]->script_class_icon_path);
fs->files[cpos]->import_group_file = ResourceLoader::get_import_group_file(p_file);
diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h
index 03b1fb4a49..2490bd31b3 100644
--- a/editor/editor_file_system.h
+++ b/editor/editor_file_system.h
@@ -54,6 +54,7 @@ class EditorFileSystemDirectory : public Object {
struct FileInfo {
String file;
StringName type;
+ StringName resource_script_class; // If any resource has script with a global class name, its found here.
ResourceUID::ID uid = ResourceUID::INVALID_ID;
uint64_t modified_time = 0;
uint64_t import_modified_time = 0;
@@ -61,6 +62,7 @@ class EditorFileSystemDirectory : public Object {
String import_group_file;
Vector<String> deps;
bool verified = false; //used for checking changes
+ // These are for script resources only.
String script_class_name;
String script_class_extends;
String script_class_icon_path;
@@ -90,6 +92,7 @@ public:
String get_file(int p_idx) const;
String get_file_path(int p_idx) const;
StringName get_file_type(int p_idx) const;
+ StringName get_file_resource_script_class(int p_idx) const;
Vector<String> get_file_deps(int p_idx) const;
bool get_file_import_is_valid(int p_idx) const;
uint64_t get_file_modified_time(int p_idx) const;
@@ -189,6 +192,7 @@ class EditorFileSystem : public Node {
/* Used for reading the filesystem cache file */
struct FileCache {
String type;
+ String resource_script_class;
ResourceUID::ID uid = ResourceUID::INVALID_ID;
uint64_t modification_time = 0;
uint64_t import_modification_time = 0;
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 9b1a5e028b..e11251596a 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -195,8 +195,8 @@ void EditorHelp::_class_desc_resized(bool p_force_update_theme) {
display_margin = new_display_margin;
Ref<StyleBox> class_desc_stylebox = EditorNode::get_singleton()->get_theme_base()->get_theme_stylebox(SNAME("background"), SNAME("EditorHelp"))->duplicate();
- class_desc_stylebox->set_default_margin(SIDE_LEFT, display_margin);
- class_desc_stylebox->set_default_margin(SIDE_RIGHT, display_margin);
+ class_desc_stylebox->set_content_margin(SIDE_LEFT, display_margin);
+ class_desc_stylebox->set_content_margin(SIDE_RIGHT, display_margin);
class_desc->add_theme_style_override("normal", class_desc_stylebox);
class_desc->add_theme_style_override("focused", class_desc_stylebox);
}
@@ -2370,7 +2370,7 @@ EditorHelpBit::EditorHelpBit() {
rich_text = memnew(RichTextLabel);
add_child(rich_text);
rich_text->connect("meta_clicked", callable_mp(this, &EditorHelpBit::_meta_clicked));
- rich_text->set_fit_content_height(true);
+ rich_text->set_fit_content(true);
set_custom_minimum_size(Size2(0, 50 * EDSCALE));
}
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 035bd96f4d..0166d4c719 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -886,7 +886,7 @@ void EditorProperty::_update_pin_flags() {
static Control *make_help_bit(const String &p_text, bool p_property) {
EditorHelpBit *help_bit = memnew(EditorHelpBit);
- help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE);
+ help_bit->get_rich_text()->set_custom_minimum_size(Size2(360 * EDSCALE, 1));
PackedStringArray slices = p_text.split("::", false);
if (slices.is_empty()) {
@@ -2181,8 +2181,7 @@ void EditorInspectorArray::_notification(int p_what) {
odd_style->set_bg_color(color.darkened(-0.08));
even_style->set_bg_color(color.darkened(0.08));
- for (int i = 0; i < (int)array_elements.size(); i++) {
- ArrayElement &ae = array_elements[i];
+ for (ArrayElement &ae : array_elements) {
if (ae.move_texture_rect) {
ae.move_texture_rect->set_texture(get_theme_icon(SNAME("TripleBar"), SNAME("EditorIcons")));
}
@@ -3283,6 +3282,11 @@ void EditorInspector::update_tree() {
ped->parse_end(object);
_parse_added_editors(main_vbox, nullptr, ped);
}
+
+ if (_is_main_editor_inspector()) {
+ // Updating inspector might invalidate some editing owners.
+ EditorNode::get_singleton()->hide_unused_editors();
+ }
}
void EditorInspector::update_property(const String &p_prop) {
@@ -3307,6 +3311,9 @@ void EditorInspector::_clear() {
sections.clear();
pending.clear();
restart_request_props.clear();
+ if (_is_main_editor_inspector()) {
+ EditorNode::get_singleton()->hide_unused_editors(this);
+ }
}
Object *EditorInspector::get_edited_object() {
@@ -3641,6 +3648,10 @@ void EditorInspector::_edit_set(const String &p_name, const Variant &p_value, bo
}
}
+bool EditorInspector::_is_main_editor_inspector() const {
+ return InspectorDock::get_singleton() && InspectorDock::get_inspector_singleton() == this;
+}
+
void EditorInspector::_property_changed(const String &p_path, const Variant &p_value, const String &p_name, bool p_changing, bool p_update_all) {
// The "changing" variable must be true for properties that trigger events as typing occurs,
// like "text_changed" signal. E.g. text property of Label, Button, RichTextLabel, etc.
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
index 699a88e657..6a1c77d376 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -47,11 +47,7 @@ class TextureRect;
class EditorPropertyRevert {
public:
- static bool get_instantiated_node_original_property(Node *p_node, const StringName &p_prop, Variant &value, bool p_check_class_default = true);
- static bool is_node_property_different(Node *p_node, const Variant &p_current, const Variant &p_orig);
- static bool is_property_value_different(const Variant &p_a, const Variant &p_b);
static Variant get_property_revert_value(Object *p_object, const StringName &p_property, bool *r_is_valid);
-
static bool can_property_revert(Object *p_object, const StringName &p_property, const Variant *p_custom_current_value = nullptr);
};
@@ -331,7 +327,7 @@ class EditorInspectorArray : public EditorInspectorSection {
AcceptDialog *resize_dialog = nullptr;
SpinBox *new_size_spin_box = nullptr;
- // Pagination
+ // Pagination.
int page_length = 5;
int page = 0;
int max_page = 0;
@@ -495,13 +491,14 @@ class EditorInspector : public ScrollContainer {
HashMap<ObjectID, int> scroll_cache;
- String property_prefix; //used for sectioned inspector
+ String property_prefix; // Used for sectioned inspector.
String object_class;
Variant property_clipboard;
bool restrict_to_basic = false;
void _edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all, const String &p_changed_field);
+ bool _is_main_editor_inspector() const;
void _property_changed(const String &p_path, const Variant &p_value, const String &p_name = "", bool p_changing = false, bool p_update_all = false);
void _multiple_properties_changed(Vector<String> p_paths, Array p_values, bool p_changing = false);
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 7beea04589..0405749147 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -58,6 +58,7 @@
#include "scene/gui/tab_bar.h"
#include "scene/gui/tab_container.h"
#include "scene/main/window.h"
+#include "scene/property_utils.h"
#include "scene/resources/packed_scene.h"
#include "servers/display_server.h"
#include "servers/navigation_server_3d.h"
@@ -124,6 +125,7 @@
#include "editor/plugins/asset_library_editor_plugin.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
#include "editor/plugins/debugger_editor_plugin.h"
+#include "editor/plugins/dedicated_server_export_plugin.h"
#include "editor/plugins/editor_preview_plugins.h"
#include "editor/plugins/editor_resource_conversion_plugin.h"
#include "editor/plugins/gdextension_export_plugin.h"
@@ -579,6 +581,7 @@ void EditorNode::_notification(int p_what) {
ResourceImporterTexture::get_singleton()->update_imports();
+ bottom_panel_updating = false;
} break;
case NOTIFICATION_ENTER_TREE: {
@@ -641,7 +644,7 @@ void EditorNode::_notification(int p_what) {
}
RenderingServer::get_singleton()->viewport_set_disable_2d(get_scene_root()->get_viewport_rid(), true);
- RenderingServer::get_singleton()->viewport_set_disable_environment(get_viewport()->get_viewport_rid(), true);
+ RenderingServer::get_singleton()->viewport_set_environment_mode(get_viewport()->get_viewport_rid(), RenderingServer::VIEWPORT_ENVIRONMENT_DISABLED);
feature_profile_manager->notify_changed();
@@ -997,6 +1000,7 @@ void EditorNode::_resources_reimported(const Vector<String> &p_resources) {
for (const String &E : scenes) {
reload_scene(E);
+ reload_instances_with_path_in_edited_scenes(E);
}
scene_tabs->set_current_tab(current_tab);
@@ -2078,42 +2082,58 @@ bool EditorNode::_is_class_editor_disabled_by_feature_profile(const StringName &
return false;
}
-void EditorNode::edit_item(Object *p_object) {
+void EditorNode::edit_item(Object *p_object, Object *p_editing_owner) {
+ ERR_FAIL_NULL(p_editing_owner);
+
if (p_object && _is_class_editor_disabled_by_feature_profile(p_object->get_class())) {
return;
}
- Vector<EditorPlugin *> top_plugins = editor_plugins_over->get_plugins_list();
Vector<EditorPlugin *> item_plugins;
if (p_object) {
item_plugins = editor_data.get_subeditors(p_object);
}
if (!item_plugins.is_empty()) {
- bool same = true;
- if (item_plugins.size() == top_plugins.size()) {
- for (int i = 0; i < item_plugins.size(); i++) {
- if (item_plugins[i] != top_plugins[i]) {
- same = false;
- }
+ ObjectID owner_id = p_editing_owner->get_instance_id();
+
+ List<EditorPlugin *> to_remove;
+ for (EditorPlugin *plugin : active_plugins[owner_id]) {
+ if (!item_plugins.has(plugin)) {
+ // Remove plugins no longer used by this editing owner.
+ to_remove.push_back(plugin);
+ plugin->make_visible(false);
+ plugin->edit(nullptr);
}
- } else {
- same = false;
}
- if (!same) {
- _display_top_editors(false);
- _set_top_editors(item_plugins);
+ for (EditorPlugin *plugin : to_remove) {
+ active_plugins[owner_id].erase(plugin);
}
- _set_editing_top_editors(p_object);
- _display_top_editors(true);
- } else if (!top_plugins.is_empty()) {
- hide_top_editors();
- }
-}
-void EditorNode::edit_item_resource(Ref<Resource> p_resource) {
- edit_item(p_resource.ptr());
+ for (EditorPlugin *plugin : item_plugins) {
+ if (active_plugins[owner_id].has(plugin)) {
+ continue;
+ }
+
+ for (KeyValue<ObjectID, HashSet<EditorPlugin *>> &kv : active_plugins) {
+ if (kv.key != owner_id) {
+ EditorPropertyResource *epres = Object::cast_to<EditorPropertyResource>(ObjectDB::get_instance(kv.key));
+ if (epres && kv.value.has(plugin)) {
+ // If it's resource property editing the same resource type, fold it.
+ epres->fold_resource();
+ }
+ kv.value.erase(plugin);
+ }
+ }
+ active_plugins[owner_id].insert(plugin);
+ editor_plugins_over->add_plugin(plugin);
+ plugin->edit(p_object);
+ plugin->make_visible(true);
+ }
+ } else {
+ hide_unused_editors(p_editing_owner);
+ }
}
void EditorNode::push_item(Object *p_object, const String &p_property, bool p_inspector_only) {
@@ -2122,7 +2142,7 @@ void EditorNode::push_item(Object *p_object, const String &p_property, bool p_in
NodeDock::get_singleton()->set_node(nullptr);
SceneTreeDock::get_singleton()->set_selected(nullptr);
InspectorDock::get_singleton()->update(nullptr);
- _display_top_editors(false);
+ hide_unused_editors();
return;
}
@@ -2150,22 +2170,34 @@ void EditorNode::_save_default_environment() {
}
}
-void EditorNode::hide_top_editors() {
- _display_top_editors(false);
-
- editor_plugins_over->clear();
-}
-
-void EditorNode::_display_top_editors(bool p_display) {
- editor_plugins_over->make_visible(p_display);
-}
-
-void EditorNode::_set_top_editors(Vector<EditorPlugin *> p_editor_plugins_over) {
- editor_plugins_over->set_plugins_list(p_editor_plugins_over);
-}
+void EditorNode::hide_unused_editors(const Object *p_editing_owner) {
+ if (p_editing_owner) {
+ const ObjectID id = p_editing_owner->get_instance_id();
+ for (EditorPlugin *plugin : active_plugins[id]) {
+ plugin->make_visible(false);
+ plugin->edit(nullptr);
+ editor_plugins_over->remove_plugin(plugin);
+ }
+ active_plugins.erase(id);
+ } else {
+ // If no editing owner is provided, this method will go over all owners and check if they are valid.
+ // This is to sweep properties that were removed from the inspector.
+ List<ObjectID> to_remove;
+ for (KeyValue<ObjectID, HashSet<EditorPlugin *>> &kv : active_plugins) {
+ if (!ObjectDB::get_instance(kv.key)) {
+ to_remove.push_back(kv.key);
+ for (EditorPlugin *plugin : kv.value) {
+ plugin->make_visible(false);
+ plugin->edit(nullptr);
+ editor_plugins_over->remove_plugin(plugin);
+ }
+ }
+ }
-void EditorNode::_set_editing_top_editors(Object *p_current_object) {
- editor_plugins_over->edit(p_current_object);
+ for (const ObjectID &id : to_remove) {
+ active_plugins.erase(id);
+ }
+ }
}
static bool overrides_external_editor(Object *p_object) {
@@ -2199,7 +2231,7 @@ void EditorNode::_edit_current(bool p_skip_foreign) {
NodeDock::get_singleton()->set_node(nullptr);
InspectorDock::get_singleton()->update(nullptr);
- _display_top_editors(false);
+ hide_unused_editors();
return;
}
@@ -2327,6 +2359,9 @@ void EditorNode::_edit_current(bool p_skip_foreign) {
InspectorDock::get_inspector_singleton()->set_use_folding(!disable_folding);
}
+ Object *editor_owner = is_node ? (Object *)SceneTreeDock::get_singleton() : is_resource ? (Object *)InspectorDock::get_inspector_singleton()
+ : (Object *)this;
+
// Take care of the main editor plugin.
if (!inspector_only) {
@@ -2343,6 +2378,7 @@ void EditorNode::_edit_current(bool p_skip_foreign) {
}
}
+ ObjectID editor_owner_id = editor_owner->get_instance_id();
if (main_plugin && !skip_main_plugin) {
// Special case if use of external editor is true.
Resource *current_res = Object::cast_to<Resource>(current_obj);
@@ -2353,15 +2389,22 @@ void EditorNode::_edit_current(bool p_skip_foreign) {
}
else if (main_plugin != editor_plugin_screen && (!ScriptEditor::get_singleton() || !ScriptEditor::get_singleton()->is_visible_in_tree() || ScriptEditor::get_singleton()->can_take_away_focus())) {
+ // Unedit previous plugin.
+ editor_plugin_screen->edit(nullptr);
+ active_plugins[editor_owner_id].erase(editor_plugin_screen);
// Update screen main_plugin.
editor_select(plugin_index);
main_plugin->edit(current_obj);
} else {
editor_plugin_screen->edit(current_obj);
}
+ is_main_screen_editing = true;
+ } else if (!main_plugin && editor_plugin_screen && is_main_screen_editing) {
+ editor_plugin_screen->edit(nullptr);
+ is_main_screen_editing = false;
}
- edit_item(current_obj);
+ edit_item(current_obj, editor_owner);
}
InspectorDock::get_singleton()->update(current_obj);
@@ -3058,7 +3101,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
String EditorNode::adjust_scene_name_casing(const String &root_name) {
- switch (GLOBAL_GET("editor/scene/scene_naming").operator int()) {
+ switch (GLOBAL_GET("editor/naming/scene_name_casing").operator int()) {
case SCENE_NAME_CASING_AUTO:
// Use casing of the root node.
break;
@@ -3626,12 +3669,12 @@ void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) {
if (get_edited_scene()) {
if (current_tab < 2) {
- // Use heuristic instead.
- int n2d = 0, n3d = 0;
- _find_node_types(get_edited_scene(), n2d, n3d);
- if (n2d > n3d) {
+ Node *editor_node = SceneTreeDock::get_singleton()->get_tree_editor()->get_selected();
+ editor_node = editor_node == nullptr ? get_edited_scene() : editor_node;
+
+ if (Object::cast_to<Node2D>(editor_node) || Object::cast_to<Control>(editor_node)) {
editor_select(EDITOR_2D);
- } else if (n3d > n2d) {
+ } else if (Object::cast_to<Node3D>(editor_node)) {
editor_select(EDITOR_3D);
}
}
@@ -3712,11 +3755,12 @@ void EditorNode::set_current_scene(int p_idx) {
call_deferred(SNAME("_set_main_scene_state"), state, get_edited_scene()); // Do after everything else is done setting up.
}
-void EditorNode::setup_color_picker(ColorPicker *picker) {
+void EditorNode::setup_color_picker(ColorPicker *p_picker) {
+ p_picker->set_editor_settings(EditorSettings::get_singleton());
int default_color_mode = EDITOR_GET("interface/inspector/default_color_picker_mode");
int picker_shape = EDITOR_GET("interface/inspector/default_color_picker_shape");
- picker->set_color_mode((ColorPicker::ColorModeType)default_color_mode);
- picker->set_picker_shape((ColorPicker::PickerShapeType)picker_shape);
+ p_picker->set_color_mode((ColorPicker::ColorModeType)default_color_mode);
+ p_picker->set_picker_shape((ColorPicker::PickerShapeType)picker_shape);
}
bool EditorNode::is_scene_open(const String &p_path) {
@@ -3904,6 +3948,134 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
return OK;
}
+HashMap<StringName, Variant> EditorNode::get_modified_properties_for_node(Node *p_node) {
+ HashMap<StringName, Variant> modified_property_map;
+
+ List<PropertyInfo> pinfo;
+ p_node->get_property_list(&pinfo);
+ for (const PropertyInfo &E : pinfo) {
+ if (E.usage & PROPERTY_USAGE_STORAGE) {
+ bool is_valid_revert = false;
+ Variant revert_value = EditorPropertyRevert::get_property_revert_value(p_node, E.name, &is_valid_revert);
+ Variant current_value = p_node->get(E.name);
+ if (is_valid_revert) {
+ if (PropertyUtils::is_property_value_different(current_value, revert_value)) {
+ modified_property_map[E.name] = current_value;
+ }
+ }
+ }
+ }
+
+ return modified_property_map;
+}
+
+void EditorNode::update_diff_data_for_node(
+ Node *p_edited_scene,
+ Node *p_root,
+ Node *p_node,
+ HashMap<NodePath, ModificationNodeEntry> &p_modification_table,
+ List<AdditiveNodeEntry> &p_addition_list) {
+ bool node_part_of_subscene = p_node != p_edited_scene &&
+ p_edited_scene->get_scene_inherited_state().is_valid() &&
+ p_edited_scene->get_scene_inherited_state()->find_node_by_path(p_edited_scene->get_path_to(p_node)) >= 0;
+
+ // Loop through the owners until either we reach the root node or nullptr
+ Node *valid_node_owner = p_node->get_owner();
+ while (valid_node_owner) {
+ if (valid_node_owner == p_root) {
+ break;
+ }
+ valid_node_owner = valid_node_owner->get_owner();
+ }
+
+ if ((valid_node_owner == p_root && (p_root != p_edited_scene || !p_edited_scene->get_scene_file_path().is_empty())) || node_part_of_subscene || p_node == p_root) {
+ HashMap<StringName, Variant> modified_properties = get_modified_properties_for_node(p_node);
+
+ // Find all valid connections to other nodes.
+ List<Connection> connections_to;
+ p_node->get_all_signal_connections(&connections_to);
+
+ List<ConnectionWithNodePath> valid_connections_to;
+ for (const Connection &c : connections_to) {
+ Node *connection_target_node = Object::cast_to<Node>(c.callable.get_object());
+ if (connection_target_node) {
+ // TODO: add support for reinstating custom callables
+ if (!c.callable.is_custom()) {
+ ConnectionWithNodePath connection_to;
+ connection_to.connection = c;
+ connection_to.node_path = p_node->get_path_to(connection_target_node);
+ valid_connections_to.push_back(connection_to);
+ }
+ }
+ }
+
+ // Find all valid connections from other nodes.
+ List<Connection> connections_from;
+ p_node->get_signals_connected_to_this(&connections_from);
+
+ List<Connection> valid_connections_from;
+ for (const Connection &c : connections_from) {
+ Node *source_node = Object::cast_to<Node>(c.signal.get_object());
+
+ Node *valid_source_owner = nullptr;
+ if (source_node) {
+ valid_source_owner = source_node->get_owner();
+ while (valid_source_owner) {
+ if (valid_source_owner == p_root) {
+ break;
+ }
+ valid_source_owner = valid_source_owner->get_owner();
+ }
+ }
+
+ if (!source_node || valid_source_owner == nullptr) {
+ // TODO: add support for reinstating custom callables
+ if (!c.callable.is_custom()) {
+ valid_connections_from.push_back(c);
+ }
+ }
+ }
+
+ // Find all node groups.
+ List<Node::GroupInfo> groups;
+ p_node->get_groups(&groups);
+
+ if (!modified_properties.is_empty() || !valid_connections_to.is_empty() || !valid_connections_from.is_empty() || !groups.is_empty()) {
+ ModificationNodeEntry modification_node_entry;
+ modification_node_entry.property_table = modified_properties;
+ modification_node_entry.connections_to = valid_connections_to;
+ modification_node_entry.connections_from = valid_connections_from;
+ modification_node_entry.groups = groups;
+
+ p_modification_table[p_root->get_path_to(p_node)] = modification_node_entry;
+ }
+ } else {
+ AdditiveNodeEntry new_additive_node_entry;
+ new_additive_node_entry.node = p_node;
+ new_additive_node_entry.parent = p_root->get_path_to(p_node->get_parent());
+ new_additive_node_entry.owner = p_node->get_owner();
+ new_additive_node_entry.index = p_node->get_index();
+
+ Node2D *node_2d = Object::cast_to<Node2D>(p_node);
+ if (node_2d) {
+ new_additive_node_entry.transform_2d = node_2d->get_relative_transform_to_parent(node_2d->get_parent());
+ }
+ Node3D *node_3d = Object::cast_to<Node3D>(p_node);
+ if (node_3d) {
+ new_additive_node_entry.transform_3d = node_3d->get_relative_transform(node_3d->get_parent());
+ }
+ p_addition_list.push_back(new_additive_node_entry);
+
+ return;
+ }
+
+ for (int i = 0; i < p_node->get_child_count(); i++) {
+ Node *child = p_node->get_child(i);
+ update_diff_data_for_node(p_edited_scene, p_root, child, p_modification_table, p_addition_list);
+ }
+}
+//
+
void EditorNode::open_request(const String &p_path) {
if (!opening_prev) {
List<String>::Element *prev_scene_item = previous_scenes.find(p_path);
@@ -5281,7 +5453,7 @@ void EditorNode::_scene_tab_input(const Ref<InputEvent> &p_input) {
_scene_tab_closed(scene_tabs->get_hovered_tab());
}
} else {
- if ((mb->get_button_index() == MouseButton::LEFT && mb->is_double_click()) || (mb->get_button_index() == MouseButton::MIDDLE && mb->is_pressed())) {
+ if (mb->get_button_index() == MouseButton::LEFT && mb->is_double_click()) {
_menu_option_confirm(FILE_NEW_SCENE, true);
}
}
@@ -5430,12 +5602,16 @@ void EditorNode::remove_bottom_panel_item(Control *p_item) {
}
void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) {
+ if (bottom_panel_updating) {
+ return;
+ }
ERR_FAIL_INDEX(p_idx, bottom_panel_items.size());
if (bottom_panel_items[p_idx].control->is_visible() == p_enable) {
return;
}
+ bottom_panel_updating = true;
if (p_enable) {
for (int i = 0; i < bottom_panel_items.size(); i++) {
bottom_panel_items[i].button->set_pressed(i == p_idx);
@@ -5760,6 +5936,353 @@ void EditorNode::reload_scene(const String &p_path) {
scene_tabs->set_current_tab(current_tab);
}
+void EditorNode::find_all_instances_inheriting_path_in_node(Node *p_root, Node *p_node, const String &p_instance_path, List<Node *> &p_instance_list) {
+ String scene_file_path = p_node->get_scene_file_path();
+
+ // This is going to get messy...
+ if (p_node->get_scene_file_path() == p_instance_path) {
+ p_instance_list.push_back(p_node);
+ } else {
+ Node *current_node = p_node;
+
+ Ref<SceneState> inherited_state = current_node->get_scene_inherited_state();
+ while (inherited_state.is_valid()) {
+ String inherited_path = inherited_state->get_path();
+ if (inherited_path == p_instance_path) {
+ p_instance_list.push_back(p_node);
+ break;
+ }
+
+ inherited_state = inherited_state->get_base_scene_state();
+ }
+ }
+
+ for (int i = 0; i < p_node->get_child_count(); i++) {
+ Node *child = p_node->get_child(i);
+ find_all_instances_inheriting_path_in_node(p_root, child, p_instance_path, p_instance_list);
+ }
+}
+
+void EditorNode::reload_instances_with_path_in_edited_scenes(const String &p_instance_path) {
+ int original_edited_scene_idx = editor_data.get_edited_scene();
+ HashMap<int, List<Node *>> edited_scene_map;
+
+ // Walk through each opened scene to get a global list of all instances which match
+ // the current reimported scenes.
+ for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
+ if (editor_data.get_scene_path(i) != p_instance_path) {
+ Node *edited_scene_root = editor_data.get_edited_scene_root(i);
+
+ if (edited_scene_root) {
+ List<Node *> valid_nodes;
+ find_all_instances_inheriting_path_in_node(edited_scene_root, edited_scene_root, p_instance_path, valid_nodes);
+ if (valid_nodes.size() > 0) {
+ edited_scene_map[i] = valid_nodes;
+ }
+ }
+ }
+ }
+
+ if (edited_scene_map.size() > 0) {
+ // Reload the new instance.
+ Error err;
+ Ref<PackedScene> instance_scene_packed_scene = ResourceLoader::load(p_instance_path, "", ResourceFormatLoader::CACHE_MODE_IGNORE, &err);
+ instance_scene_packed_scene->set_path(p_instance_path, true);
+
+ ERR_FAIL_COND(err != OK);
+ ERR_FAIL_COND(instance_scene_packed_scene.is_null());
+
+ HashMap<String, Ref<PackedScene>> local_scene_cache;
+ local_scene_cache[p_instance_path] = instance_scene_packed_scene;
+
+ for (const KeyValue<int, List<Node *>> &edited_scene_map_elem : edited_scene_map) {
+ // Set the current scene.
+ int current_scene_idx = edited_scene_map_elem.key;
+ editor_data.set_edited_scene(current_scene_idx);
+ Node *current_edited_scene = editor_data.get_edited_scene_root(current_scene_idx);
+
+ // Clear the history for this tab (should we allow history to be retained?).
+ EditorUndoRedoManager::get_singleton()->clear_history();
+
+ // Update the version
+ editor_data.is_scene_changed(current_scene_idx);
+
+ for (Node *original_node : edited_scene_map_elem.value) {
+ // Walk the tree for the current node and extract relevant diff data, storing it in the modification table.
+ // For additional nodes which are part of the current scene, they get added to the addition table.
+ HashMap<NodePath, ModificationNodeEntry> modification_table;
+ List<AdditiveNodeEntry> addition_list;
+ update_diff_data_for_node(current_edited_scene, original_node, original_node, modification_table, addition_list);
+
+ // Disconnect all relevant connections, all connections from and persistent connections to.
+ for (const KeyValue<NodePath, ModificationNodeEntry> &modification_table_entry : modification_table) {
+ for (Connection conn : modification_table_entry.value.connections_from) {
+ conn.signal.get_object()->disconnect(conn.signal.get_name(), conn.callable);
+ }
+ for (ConnectionWithNodePath cwnp : modification_table_entry.value.connections_to) {
+ Connection conn = cwnp.connection;
+ if (conn.flags & CONNECT_PERSIST) {
+ conn.signal.get_object()->disconnect(conn.signal.get_name(), conn.callable);
+ }
+ }
+ }
+
+ // Store all the paths for any selected nodes which are ancestors of the node we're replacing.
+ List<NodePath> selected_node_paths;
+ for (Node *selected_node : editor_selection->get_selected_node_list()) {
+ if (selected_node == original_node || original_node->is_ancestor_of(selected_node)) {
+ selected_node_paths.push_back(original_node->get_path_to(selected_node));
+ editor_selection->remove_node(selected_node);
+ }
+ }
+
+ // Remove all nodes which were added as additional elements (they will be restored later).
+ for (AdditiveNodeEntry additive_node_entry : addition_list) {
+ Node *addition_node = additive_node_entry.node;
+ addition_node->get_parent()->remove_child(addition_node);
+ }
+
+ // Clear ownership of the nodes (kind of hack to workaround an issue with
+ // replace_by when called on nodes in other tabs).
+ List<Node *> nodes_owned_by_original_node;
+ original_node->get_owned_by(original_node, &nodes_owned_by_original_node);
+ for (Node *owned_node : nodes_owned_by_original_node) {
+ owned_node->set_owner(nullptr);
+ }
+
+ // Delete all the remaining node children.
+ while (original_node->get_child_count()) {
+ Node *child = original_node->get_child(0);
+
+ original_node->remove_child(child);
+ child->queue_free();
+ }
+
+ // Reset the editable instance state.
+ bool is_editable = true;
+ Node *owner = original_node->get_owner();
+ if (owner) {
+ is_editable = owner->is_editable_instance(original_node);
+ }
+
+ // Load a replacement scene for the node.
+ Ref<PackedScene> current_packed_scene;
+ if (original_node->get_scene_file_path() == p_instance_path) {
+ // If the node file name directly matches the scene we're replacing,
+ // just load it since we already cached it.
+ current_packed_scene = instance_scene_packed_scene;
+ } else {
+ // Otherwise, check the inheritance chain, reloading and caching any scenes
+ // we require along the way.
+ List<String> required_load_paths;
+ String scene_path = original_node->get_scene_file_path();
+ // Do we need to check if the paths are empty?
+ if (!scene_path.is_empty()) {
+ required_load_paths.push_front(scene_path);
+ }
+ Ref<SceneState> inherited_state = original_node->get_scene_inherited_state();
+ while (inherited_state.is_valid()) {
+ String inherited_path = inherited_state->get_path();
+ // Do we need to check if the paths are empty?
+ if (!inherited_path.is_empty()) {
+ required_load_paths.push_front(inherited_path);
+ }
+ inherited_state = inherited_state->get_base_scene_state();
+ }
+
+ // Ensure the inheritance chain is loaded in the correct order so that cache can
+ // be properly updated.
+ for (String path : required_load_paths) {
+ if (!local_scene_cache.find(path)) {
+ current_packed_scene = ResourceLoader::load(path, "", ResourceFormatLoader::CACHE_MODE_IGNORE, &err);
+ current_packed_scene->set_path(path, true);
+ local_scene_cache[path] = current_packed_scene;
+ } else {
+ current_packed_scene = local_scene_cache[path];
+ }
+ }
+ }
+
+ ERR_FAIL_COND(current_packed_scene.is_null());
+
+ // Instantiate the node.
+ Node *instantiated_node = nullptr;
+ if (current_packed_scene.is_valid()) {
+ instantiated_node = current_packed_scene->instantiate(PackedScene::GEN_EDIT_STATE_INSTANCE);
+ }
+
+ ERR_FAIL_COND(!instantiated_node);
+
+ bool original_node_is_displayed_folded = original_node->is_displayed_folded();
+ bool original_node_scene_instance_load_placeholder = original_node->get_scene_instance_load_placeholder();
+
+ // Update the name to match
+ instantiated_node->set_name(original_node->get_name());
+
+ // Is this replacing the edited root node?
+ String original_node_file_path = original_node->get_scene_file_path();
+
+ if (current_edited_scene == original_node) {
+ instantiated_node->set_scene_instance_state(original_node->get_scene_instance_state());
+ // Fix unsaved inherited scene
+ if (original_node_file_path.is_empty()) {
+ Ref<SceneState> state = current_packed_scene->get_state();
+ state->set_path(current_packed_scene->get_path());
+ instantiated_node->set_scene_inherited_state(state);
+ instantiated_node->set_scene_file_path(String());
+ }
+ editor_data.set_edited_scene_root(instantiated_node);
+ current_edited_scene = instantiated_node;
+
+ if (original_node->is_inside_tree()) {
+ SceneTreeDock::get_singleton()->set_edited_scene(current_edited_scene);
+ original_node->get_tree()->set_edited_scene_root(instantiated_node);
+ }
+ }
+
+ // Replace the original node with the instantiated version.
+ original_node->replace_by(instantiated_node, false);
+
+ // Mark the old node for deletion.
+ original_node->queue_free();
+
+ // Restore the folded and placeholder state from the original node.
+ instantiated_node->set_display_folded(original_node_is_displayed_folded);
+ instantiated_node->set_scene_instance_load_placeholder(original_node_scene_instance_load_placeholder);
+
+ if (owner) {
+ Ref<SceneState> ss_inst = owner->get_scene_instance_state();
+ if (ss_inst.is_valid()) {
+ ss_inst->update_instance_resource(p_instance_path, current_packed_scene);
+ }
+
+ owner->set_editable_instance(instantiated_node, is_editable);
+ }
+
+ // Attempt to re-add all the additional nodes.
+ for (AdditiveNodeEntry additive_node_entry : addition_list) {
+ Node *parent_node = instantiated_node->get_node_or_null(additive_node_entry.parent);
+
+ if (!parent_node) {
+ parent_node = current_edited_scene;
+ }
+
+ parent_node->add_child(additive_node_entry.node);
+ parent_node->move_child(additive_node_entry.node, additive_node_entry.index);
+ // If the additive node's owner was the node which got replaced, update it.
+ if (additive_node_entry.owner == original_node) {
+ additive_node_entry.owner = instantiated_node;
+ }
+
+ additive_node_entry.node->set_owner(additive_node_entry.owner);
+
+ // If the parent node was lost, attempt to restore the original global transform.
+ {
+ Node2D *node_2d = Object::cast_to<Node2D>(additive_node_entry.node);
+ if (node_2d) {
+ node_2d->set_transform(additive_node_entry.transform_2d);
+ }
+
+ Node3D *node_3d = Object::cast_to<Node3D>(additive_node_entry.node);
+ if (node_3d) {
+ node_3d->set_transform(additive_node_entry.transform_3d);
+ }
+ }
+ }
+
+ // Restore the selection.
+ if (selected_node_paths.size()) {
+ for (NodePath selected_node_path : selected_node_paths) {
+ Node *selected_node = instantiated_node->get_node_or_null(selected_node_path);
+ if (selected_node) {
+ editor_selection->add_node(selected_node);
+ }
+ }
+ editor_selection->update();
+ }
+
+ // Attempt to restore the modified properties and signals for the instantitated node and all its owned children.
+ for (KeyValue<NodePath, ModificationNodeEntry> &E : modification_table) {
+ NodePath new_current_path = E.key;
+ Node *modifiable_node = instantiated_node->get_node_or_null(new_current_path);
+
+ if (modifiable_node) {
+ // Get properties for this node.
+ List<PropertyInfo> pinfo;
+ modifiable_node->get_property_list(&pinfo);
+
+ // Get names of all valid property names (TODO: make this more efficient).
+ List<String> property_names;
+ for (const PropertyInfo &E2 : pinfo) {
+ if (E2.usage & PROPERTY_USAGE_STORAGE) {
+ property_names.push_back(E2.name);
+ }
+ }
+
+ // Restore the modified properties for this node.
+ for (const KeyValue<StringName, Variant> &E2 : E.value.property_table) {
+ if (property_names.find(E2.key)) {
+ modifiable_node->set(E2.key, E2.value);
+ }
+ }
+ // Restore the connections to other nodes.
+ for (const ConnectionWithNodePath &E2 : E.value.connections_to) {
+ Connection conn = E2.connection;
+
+ // Get the node the callable is targeting.
+ Node *target_node = cast_to<Node>(conn.callable.get_object());
+
+ // If the callable object no longer exists or is marked for deletion,
+ // attempt to reaccquire the closest match by using the node path
+ // we saved earlier.
+ if (!target_node || !target_node->is_queued_for_deletion()) {
+ target_node = modifiable_node->get_node_or_null(E2.node_path);
+ }
+
+ if (target_node) {
+ // Reconstruct the callable.
+ Callable new_callable = Callable(target_node, conn.callable.get_method());
+
+ if (!modifiable_node->is_connected(conn.signal.get_name(), new_callable)) {
+ ERR_FAIL_COND(modifiable_node->connect(conn.signal.get_name(), new_callable, conn.flags) != OK);
+ }
+ }
+ }
+
+ // Restore the connections from other nodes.
+ for (const Connection &E2 : E.value.connections_from) {
+ Connection conn = E2;
+
+ bool valid = modifiable_node->has_method(conn.callable.get_method()) || Ref<Script>(modifiable_node->get_script()).is_null() || Ref<Script>(modifiable_node->get_script())->has_method(conn.callable.get_method());
+ ERR_CONTINUE_MSG(!valid, vformat("Attempt to connect signal '%s.%s' to nonexistent method '%s.%s'.", conn.signal.get_object()->get_class(), conn.signal.get_name(), conn.callable.get_object()->get_class(), conn.callable.get_method()));
+
+ // Get the object which the signal is connected from.
+ Object *source_object = conn.signal.get_object();
+
+ if (source_object) {
+ ERR_FAIL_COND(source_object->connect(conn.signal.get_name(), Callable(modifiable_node, conn.callable.get_method()), conn.flags) != OK);
+ }
+ }
+
+ // Re-add the groups.
+ for (const Node::GroupInfo &E2 : E.value.groups) {
+ modifiable_node->add_to_group(E2.name, E2.persistent);
+ }
+ }
+ }
+ }
+ // Cleanup the history of the changes.
+ editor_history.cleanup_history();
+
+ current_edited_scene->propagate_notification(NOTIFICATION_NODE_RECACHE_REQUESTED);
+ }
+ edited_scene_map.clear();
+ }
+ editor_data.set_edited_scene(original_edited_scene_idx);
+
+ _edit_current();
+}
+
int EditorNode::plugin_init_callback_count = 0;
void EditorNode::add_plugin_init_callback(EditorPluginInitializeCallback p_callback) {
@@ -5923,7 +6446,7 @@ void EditorNode::_feature_profile_changed() {
}
void EditorNode::_bind_methods() {
- GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/scene/scene_naming", PROPERTY_HINT_ENUM, "Auto,PascalCase,snake_case"), SCENE_NAME_CASING_SNAKE_CASE);
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/naming/scene_name_casing", PROPERTY_HINT_ENUM, "Auto,PascalCase,snake_case"), SCENE_NAME_CASING_SNAKE_CASE);
ClassDB::bind_method("edit_current", &EditorNode::edit_current);
ClassDB::bind_method("edit_node", &EditorNode::edit_node);
@@ -6755,6 +7278,7 @@ EditorNode::EditorNode() {
project_title->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS);
project_title->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
project_title->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ project_title->set_mouse_filter(Control::MOUSE_FILTER_PASS);
left_spacer->add_child(project_title);
}
@@ -6916,7 +7440,7 @@ EditorNode::EditorNode() {
_reset_play_buttons();
- ED_SHORTCUT_AND_COMMAND("editor/run_specific_scene", TTR("Run Specific Scene"), KeyModifierMask::META | KeyModifierMask::SHIFT | Key::F5);
+ ED_SHORTCUT_AND_COMMAND("editor/run_specific_scene", TTR("Run Specific Scene"), KeyModifierMask::CTRL | KeyModifierMask::SHIFT | Key::F5);
ED_SHORTCUT_OVERRIDE("editor/run_specific_scene", "macos", KeyModifierMask::META | KeyModifierMask::SHIFT | Key::R);
play_custom_scene_button->set_shortcut(ED_GET_SHORTCUT("editor/run_specific_scene"));
@@ -7373,6 +7897,11 @@ EditorNode::EditorNode() {
EditorExport::get_singleton()->add_export_plugin(gdextension_export_plugin);
+ Ref<DedicatedServerExportPlugin> dedicated_server_export_plugin;
+ dedicated_server_export_plugin.instantiate();
+
+ EditorExport::get_singleton()->add_export_plugin(dedicated_server_export_plugin);
+
Ref<PackedSceneEditorTranslationParserPlugin> packed_scene_translation_parser_plugin;
packed_scene_translation_parser_plugin.instantiate();
EditorTranslationParser::get_singleton()->add_parser(packed_scene_translation_parser_plugin, EditorTranslationParser::STANDARD);
@@ -7400,7 +7929,6 @@ EditorNode::EditorNode() {
_update_recent_scenes();
- editor_data.restore_editor_global_states();
set_process_shortcut_input(true);
load_errors = memnew(RichTextLabel);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index fb2544c141..3967f64c6b 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -68,6 +68,7 @@ class EditorLayoutsDialog;
class EditorLog;
class EditorPluginList;
class EditorQuickOpen;
+class EditorPropertyResource;
class EditorResourcePreview;
class EditorResourceConversionPlugin;
class EditorRun;
@@ -86,6 +87,7 @@ class ImportDock;
class LinkButton;
class MenuBar;
class MenuButton;
+class Node2D;
class NodeDock;
class OptionButton;
class OrphanResourcesDialog;
@@ -293,6 +295,8 @@ private:
bool _initializing_plugins = false;
HashMap<String, EditorPlugin *> addon_name_to_plugin;
LocalVector<String> pending_addons;
+ HashMap<ObjectID, HashSet<EditorPlugin *>> active_plugins;
+ bool is_main_screen_editing = false;
PanelContainer *scene_root_parent = nullptr;
Control *theme_base = nullptr;
@@ -456,6 +460,7 @@ private:
EditorToaster *editor_toaster = nullptr;
LinkButton *version_btn = nullptr;
Button *bottom_panel_raise = nullptr;
+ bool bottom_panel_updating = false;
Tree *disk_changed_list = nullptr;
ConfirmationDialog *disk_changed = nullptr;
@@ -592,10 +597,6 @@ private:
void _inherit_request(String p_file);
void _instantiate_request(const Vector<String> &p_files);
- void _display_top_editors(bool p_display);
- void _set_top_editors(Vector<EditorPlugin *> p_editor_plugins_over);
- void _set_editing_top_editors(Object *p_current_object);
-
void _quick_opened();
void _quick_run();
void _open_command_palette();
@@ -796,9 +797,8 @@ public:
void show_about() { _menu_option_confirm(HELP_ABOUT, false); }
void push_item(Object *p_object, const String &p_property = "", bool p_inspector_only = false);
- void edit_item(Object *p_object);
- void edit_item_resource(Ref<Resource> p_resource);
- void hide_top_editors();
+ void edit_item(Object *p_object, Object *p_editing_owner);
+ void hide_unused_editors(const Object *p_editing_owner = nullptr);
void select_editor_by_name(const String &p_name);
@@ -820,11 +820,42 @@ public:
Error load_scene(const String &p_scene, bool p_ignore_broken_deps = false, bool p_set_inherited = false, bool p_clear_errors = true, bool p_force_open_imported = false, bool p_silent_change_tab = false);
Error load_resource(const String &p_resource, bool p_ignore_broken_deps = false);
+ HashMap<StringName, Variant> get_modified_properties_for_node(Node *p_node);
+
+ struct AdditiveNodeEntry {
+ Node *node = nullptr;
+ NodePath parent = NodePath();
+ Node *owner = nullptr;
+ int index = 0;
+ // Used if the original parent node is lost
+ Transform2D transform_2d;
+ Transform3D transform_3d;
+ };
+
+ struct ConnectionWithNodePath {
+ Connection connection;
+ NodePath node_path;
+ };
+
+ struct ModificationNodeEntry {
+ HashMap<StringName, Variant> property_table;
+ List<ConnectionWithNodePath> connections_to;
+ List<Connection> connections_from;
+ List<Node::GroupInfo> groups;
+ };
+
+ void update_diff_data_for_node(
+ Node *p_edited_scene,
+ Node *p_root,
+ Node *p_node,
+ HashMap<NodePath, ModificationNodeEntry> &p_modification_table,
+ List<AdditiveNodeEntry> &p_addition_list);
+
bool is_scene_open(const String &p_path);
void set_current_scene(int p_idx);
- void setup_color_picker(ColorPicker *picker);
+ void setup_color_picker(ColorPicker *p_picker);
void request_instantiate_scene(const String &p_path);
void request_instantiate_scenes(const Vector<String> &p_files);
@@ -872,6 +903,9 @@ public:
void reload_scene(const String &p_path);
+ void find_all_instances_inheriting_path_in_node(Node *p_root, Node *p_node, const String &p_instance_path, List<Node *> &p_instance_list);
+ void reload_instances_with_path_in_edited_scenes(const String &p_path);
+
bool is_exiting() const { return exiting; }
Button *get_pause_button() { return pause_button; }
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index d508638acd..14cdbc364e 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -662,7 +662,7 @@ void EditorPlugin::make_visible(bool p_visible) {
}
void EditorPlugin::edit(Object *p_object) {
- if (p_object->is_class("Resource")) {
+ if (Object::cast_to<Resource>(p_object)) {
GDVIRTUAL_CALL(_edit, Ref<Resource>(Object::cast_to<Resource>(p_object)));
} else {
GDVIRTUAL_CALL(_edit, p_object);
@@ -712,9 +712,6 @@ bool EditorPlugin::get_remove_list(List<Node *> *p_list) {
return false;
}
-void EditorPlugin::restore_global_state() {}
-void EditorPlugin::save_global_state() {}
-
void EditorPlugin::add_undo_redo_inspector_hook_callback(Callable p_callable) {
EditorNode::get_singleton()->get_editor_data().add_undo_redo_inspector_hook_callback(p_callable);
}
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index b79d2de035..a5a17acdf1 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -278,9 +278,6 @@ public:
void make_bottom_panel_item_visible(Control *p_item);
void hide_bottom_panel();
- virtual void restore_global_state();
- virtual void save_global_state();
-
void add_translation_parser_plugin(const Ref<EditorTranslationParserPlugin> &p_parser);
void remove_translation_parser_plugin(const Ref<EditorTranslationParserPlugin> &p_parser);
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 3bf320f580..f022027e65 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -268,7 +268,7 @@ void EditorPropertyTextEnum::_custom_value_accepted() {
_custom_value_submitted(new_value);
}
-void EditorPropertyTextEnum::_custom_value_cancelled() {
+void EditorPropertyTextEnum::_custom_value_canceled() {
custom_value_edit->set_text(get_edited_object()->get(get_edited_property()));
edit_custom_layout->hide();
@@ -342,12 +342,17 @@ void EditorPropertyTextEnum::_notification(int p_what) {
}
EditorPropertyTextEnum::EditorPropertyTextEnum() {
+ HBoxContainer *hb = memnew(HBoxContainer);
+ add_child(hb);
+
default_layout = memnew(HBoxContainer);
- add_child(default_layout);
+ default_layout->set_h_size_flags(SIZE_EXPAND_FILL);
+ hb->add_child(default_layout);
edit_custom_layout = memnew(HBoxContainer);
+ edit_custom_layout->set_h_size_flags(SIZE_EXPAND_FILL);
edit_custom_layout->hide();
- add_child(edit_custom_layout);
+ hb->add_child(edit_custom_layout);
option_button = memnew(OptionButton);
option_button->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -375,7 +380,7 @@ EditorPropertyTextEnum::EditorPropertyTextEnum() {
cancel_button = memnew(Button);
cancel_button->set_flat(true);
edit_custom_layout->add_child(cancel_button);
- cancel_button->connect("pressed", callable_mp(this, &EditorPropertyTextEnum::_custom_value_cancelled));
+ cancel_button->connect("pressed", callable_mp(this, &EditorPropertyTextEnum::_custom_value_canceled));
add_focusable(option_button);
add_focusable(edit_button);
@@ -1318,10 +1323,12 @@ void EditorPropertyObjectID::update_property() {
ObjectID id = get_edited_object()->get(get_edited_property());
if (id.is_valid()) {
edit->set_text(type + " ID: " + uitos(id));
+ edit->set_tooltip_text(type + " ID: " + uitos(id));
edit->set_disabled(false);
edit->set_icon(EditorNode::get_singleton()->get_class_icon(type));
} else {
edit->set_text(TTR("<empty>"));
+ edit->set_tooltip_text("");
edit->set_disabled(true);
edit->set_icon(Ref<Texture2D>());
}
@@ -1338,6 +1345,7 @@ EditorPropertyObjectID::EditorPropertyObjectID() {
edit = memnew(Button);
add_child(edit);
add_focusable(edit);
+ edit->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS);
edit->connect("pressed", callable_mp(this, &EditorPropertyObjectID::_edit_pressed));
}
@@ -3900,40 +3908,7 @@ void EditorPropertyResource::_open_editor_pressed() {
Ref<Resource> res = get_edited_object()->get(get_edited_property());
if (res.is_valid()) {
// May clear the editor so do it deferred.
- callable_mp(EditorNode::get_singleton(), &EditorNode::edit_item_resource).bind(res).call_deferred();
- }
-}
-
-void EditorPropertyResource::_fold_other_editors(Object *p_self) {
- if (this == p_self) {
- return;
- }
-
- Ref<Resource> res = get_edited_object()->get(get_edited_property());
- if (!res.is_valid()) {
- return;
- }
-
- bool use_editor = false;
- for (int i = 0; i < EditorNode::get_editor_data().get_editor_plugin_count(); i++) {
- EditorPlugin *ep = EditorNode::get_editor_data().get_editor_plugin(i);
- if (ep->handles(res.ptr())) {
- use_editor = true;
- break;
- }
- }
- if (!use_editor) {
- return;
- }
-
- opened_editor = false;
-
- bool unfolded = get_edited_object()->editor_is_section_unfolded(get_edited_property());
- if (unfolded) {
- // Refold.
- resource_picker->set_toggle_pressed(false);
- get_edited_object()->editor_set_section_unfold(get_edited_property(), false);
- update_property();
+ callable_mp(EditorNode::get_singleton(), &EditorNode::edit_item).bind(res.ptr(), this).call_deferred();
}
}
@@ -4086,20 +4061,17 @@ void EditorPropertyResource::update_property() {
sub_inspector_vbox->add_child(sub_inspector);
resource_picker->set_toggle_pressed(true);
- bool use_editor = false;
+ Array editor_list;
for (int i = 0; i < EditorNode::get_editor_data().get_editor_plugin_count(); i++) {
EditorPlugin *ep = EditorNode::get_editor_data().get_editor_plugin(i);
if (ep->handles(res.ptr())) {
- use_editor = true;
+ editor_list.push_back(ep);
}
}
- if (use_editor) {
- // Open editor directly and hide other such editors which are currently open.
+ if (!editor_list.is_empty()) {
+ // Open editor directly.
_open_editor_pressed();
- if (is_inside_tree()) {
- get_tree()->call_deferred(SNAME("call_group"), "_editor_resource_properties", "_fold_other_editors", this);
- }
opened_editor = true;
}
@@ -4118,7 +4090,7 @@ void EditorPropertyResource::update_property() {
sub_inspector_vbox = nullptr;
if (opened_editor) {
- EditorNode::get_singleton()->hide_top_editors();
+ EditorNode::get_singleton()->hide_unused_editors();
opened_editor = false;
}
@@ -4152,6 +4124,15 @@ void EditorPropertyResource::set_use_sub_inspector(bool p_enable) {
use_sub_inspector = p_enable;
}
+void EditorPropertyResource::fold_resource() {
+ bool unfolded = get_edited_object()->editor_is_section_unfolded(get_edited_property());
+ if (unfolded) {
+ resource_picker->set_toggle_pressed(false);
+ get_edited_object()->editor_set_section_unfold(get_edited_property(), false);
+ update_property();
+ }
+}
+
void EditorPropertyResource::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
@@ -4163,14 +4144,8 @@ void EditorPropertyResource::_notification(int p_what) {
}
}
-void EditorPropertyResource::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_fold_other_editors"), &EditorPropertyResource::_fold_other_editors);
-}
-
EditorPropertyResource::EditorPropertyResource() {
use_sub_inspector = bool(EDITOR_GET("interface/inspector/open_resources_in_current_inspector"));
-
- add_to_group("_editor_resource_properties");
}
////////////// DEFAULT PLUGIN //////////////////////
diff --git a/editor/editor_properties.h b/editor/editor_properties.h
index a255af30ee..d29ec12f97 100644
--- a/editor/editor_properties.h
+++ b/editor/editor_properties.h
@@ -121,7 +121,7 @@ class EditorPropertyTextEnum : public EditorProperty {
void _edit_custom_value();
void _custom_value_submitted(String p_value);
void _custom_value_accepted();
- void _custom_value_cancelled();
+ void _custom_value_canceled();
protected:
virtual void _set_read_only(bool p_read_only) override;
@@ -834,13 +834,11 @@ class EditorPropertyResource : public EditorProperty {
void _sub_inspector_object_id_selected(int p_id);
void _open_editor_pressed();
- void _fold_other_editors(Object *p_self);
void _update_property_bg();
void _update_preferred_shader();
protected:
virtual void _set_read_only(bool p_read_only) override;
- static void _bind_methods();
void _notification(int p_what);
public:
@@ -852,6 +850,7 @@ public:
void expand_revertable() override;
void set_use_sub_inspector(bool p_enable);
+ void fold_resource();
EditorPropertyResource();
};
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index 28c0b047d8..b96ac9dbcb 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -158,17 +158,32 @@ EditorPropertyDictionaryObject::EditorPropertyDictionaryObject() {
///////////////////// ARRAY ///////////////////////////
+void EditorPropertyArray::initialize_array(Variant &p_array) {
+ if (array_type == Variant::ARRAY && subtype != Variant::NIL) {
+ Array array;
+ StringName subtype_class;
+ Ref<Script> subtype_script;
+ if (subtype == Variant::OBJECT && !subtype_hint_string.is_empty()) {
+ if (ClassDB::class_exists(subtype_hint_string)) {
+ subtype_class = subtype_hint_string;
+ }
+ }
+ array.set_typed(subtype, subtype_class, subtype_script);
+ p_array = array;
+ } else {
+ VariantInternal::initialize(&p_array, array_type);
+ }
+}
+
void EditorPropertyArray::_property_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing) {
if (p_property.begins_with("indices")) {
int index = p_property.get_slice("/", 1).to_int();
- Variant array = object->get_array();
+
+ Variant array = object->get_array().duplicate();
array.set(index, p_value);
- emit_changed(get_edited_property(), array, "", true);
- if (array.get_type() == Variant::ARRAY) {
- array = array.call("duplicate"); // Duplicate, so undo/redo works better.
- }
object->set_array(array);
+ emit_changed(get_edited_property(), array, "", true);
}
}
@@ -188,18 +203,12 @@ void EditorPropertyArray::_change_type_menu(int p_index) {
}
Variant value;
- Callable::CallError ce;
- Variant::construct(Variant::Type(p_index), value, nullptr, 0, ce);
- Variant array = object->get_array();
+ VariantInternal::initialize(&value, Variant::Type(p_index));
+
+ Variant array = object->get_array().duplicate();
array.set(changing_type_index, value);
emit_changed(get_edited_property(), array, "", true);
-
- if (array.get_type() == Variant::ARRAY) {
- array = array.call("duplicate"); // Duplicate, so undo/redo works better.
- }
-
- object->set_array(array);
update_property();
}
@@ -234,6 +243,8 @@ void EditorPropertyArray::update_property() {
return;
}
+ object->set_array(array);
+
int size = array.call("size");
int max_page = MAX(0, size - 1) / page_length;
page_index = MIN(page_index, max_page);
@@ -305,12 +316,6 @@ void EditorPropertyArray::update_property() {
paginator->update(page_index, max_page);
paginator->set_visible(max_page > 0);
- if (array.get_type() == Variant::ARRAY) {
- array = array.call("duplicate");
- }
-
- object->set_array(array);
-
int amount = MIN(size - offset, page_length);
for (int i = 0; i < amount; i++) {
bool reorder_is_from_current_page = reorder_from_index / page_length == page_index;
@@ -401,7 +406,7 @@ void EditorPropertyArray::update_property() {
}
void EditorPropertyArray::_remove_pressed(int p_index) {
- Variant array = object->get_array();
+ Variant array = object->get_array().duplicate();
array.call("remove_at", p_index);
emit_changed(get_edited_property(), array, "", false);
@@ -469,8 +474,9 @@ void EditorPropertyArray::drop_data_fw(const Point2 &p_point, const Variant &p_d
// Handle the case where array is not initialized yet.
if (!array.is_array()) {
- Callable::CallError ce;
- Variant::construct(array_type, array, nullptr, 0, ce);
+ initialize_array(array);
+ } else {
+ array = array.duplicate();
}
// Loop the file array and add to existing array.
@@ -483,13 +489,7 @@ void EditorPropertyArray::drop_data_fw(const Point2 &p_point, const Variant &p_d
}
}
- if (array.get_type() == Variant::ARRAY) {
- array = array.call("duplicate");
- }
-
emit_changed(get_edited_property(), array, "", false);
- object->set_array(array);
-
update_property();
}
}
@@ -536,10 +536,8 @@ void EditorPropertyArray::_notification(int p_what) {
void EditorPropertyArray::_edit_pressed() {
Variant array = get_edited_object()->get(get_edited_property());
- if (!array.is_array()) {
- Callable::CallError ce;
- Variant::construct(array_type, array, nullptr, 0, ce);
-
+ if (!array.is_array() && edit->is_pressed()) {
+ initialize_array(array);
get_edited_object()->set(get_edited_property(), array);
}
@@ -560,37 +558,10 @@ void EditorPropertyArray::_length_changed(double p_page) {
return;
}
- Variant array = object->get_array();
- int previous_size = array.call("size");
-
+ Variant array = object->get_array().duplicate();
array.call("resize", int(p_page));
- if (array.get_type() == Variant::ARRAY) {
- if (subtype != Variant::NIL) {
- int size = array.call("size");
- for (int i = previous_size; i < size; i++) {
- if (array.get(i).get_type() == Variant::NIL) {
- Callable::CallError ce;
- Variant r;
- Variant::construct(subtype, r, nullptr, 0, ce);
- array.set(i, r);
- }
- }
- }
- array = array.call("duplicate"); // Duplicate, so undo/redo works better.
- } else {
- int size = array.call("size");
- // Pool*Array don't initialize their elements, have to do it manually.
- for (int i = previous_size; i < size; i++) {
- Callable::CallError ce;
- Variant r;
- Variant::construct(array.get(i).get_type(), r, nullptr, 0, ce);
- array.set(i, r);
- }
- }
-
emit_changed(get_edited_property(), array, "", false);
- object->set_array(array);
update_property();
}
@@ -677,14 +648,13 @@ void EditorPropertyArray::_reorder_button_up() {
if (reorder_from_index != reorder_to_index) {
// Move the element.
- Variant array = object->get_array();
+ Variant array = object->get_array().duplicate();
Variant value_to_move = array.get(reorder_from_index);
array.call("remove_at", reorder_from_index);
array.call("insert", reorder_to_index, value_to_move);
emit_changed(get_edited_property(), array, "", false);
- object->set_array(array);
update_property();
}
@@ -742,14 +712,13 @@ void EditorPropertyDictionary::_property_changed(const String &p_property, Varia
object->set_new_item_value(p_value);
} else if (p_property.begins_with("indices")) {
int index = p_property.get_slice("/", 1).to_int();
- Dictionary dict = object->get_dict();
+
+ Dictionary dict = object->get_dict().duplicate();
Variant key = dict.get_key_at_index(index);
dict[key] = p_value;
- emit_changed(get_edited_property(), dict, "", true);
-
- dict = dict.duplicate(); // Duplicate, so undo/redo works better.
object->set_dict(dict);
+ emit_changed(get_edited_property(), dict, "", true);
}
}
@@ -769,24 +738,19 @@ void EditorPropertyDictionary::_add_key_value() {
return;
}
- Dictionary dict = object->get_dict();
-
+ Dictionary dict = object->get_dict().duplicate();
dict[object->get_new_item_key()] = object->get_new_item_value();
object->set_new_item_key(Variant());
object->set_new_item_value(Variant());
emit_changed(get_edited_property(), dict, "", false);
-
- dict = dict.duplicate(); // Duplicate, so undo/redo works better.
- object->set_dict(dict);
update_property();
}
void EditorPropertyDictionary::_change_type_menu(int p_index) {
if (changing_type_index < 0) {
Variant value;
- Callable::CallError ce;
- Variant::construct(Variant::Type(p_index), value, nullptr, 0, ce);
+ VariantInternal::initialize(&value, Variant::Type(p_index));
if (changing_type_index == -1) {
object->set_new_item_key(value);
} else {
@@ -796,12 +760,10 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) {
return;
}
- Dictionary dict = object->get_dict();
-
+ Dictionary dict = object->get_dict().duplicate();
if (p_index < Variant::VARIANT_MAX) {
Variant value;
- Callable::CallError ce;
- Variant::construct(Variant::Type(p_index), value, nullptr, 0, ce);
+ VariantInternal::initialize(&value, Variant::Type(p_index));
Variant key = dict.get_key_at_index(changing_type_index);
dict[key] = value;
} else {
@@ -810,9 +772,6 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) {
}
emit_changed(get_edited_property(), dict, "", false);
-
- dict = dict.duplicate(); // Duplicate, so undo/redo works better.
- object->set_dict(dict);
update_property();
}
@@ -836,6 +795,7 @@ void EditorPropertyDictionary::update_property() {
}
Dictionary dict = updated_val;
+ object->set_dict(updated_val);
edit->set_text(vformat(TTR("Dictionary (size %d)"), dict.size()));
@@ -883,9 +843,6 @@ void EditorPropertyDictionary::update_property() {
int amount = MIN(size - offset, page_length);
int total_amount = page_index == max_page ? amount + 2 : amount; // For the "Add Key/Value Pair" box on last page.
- dict = dict.duplicate();
-
- object->set_dict(dict);
VBoxContainer *add_vbox = nullptr;
double default_float_step = EDITOR_GET("interface/inspector/default_float_step");
@@ -1225,9 +1182,8 @@ void EditorPropertyDictionary::_notification(int p_what) {
void EditorPropertyDictionary::_edit_pressed() {
Variant prop_val = get_edited_object()->get(get_edited_property());
- if (prop_val.get_type() == Variant::NIL) {
- Callable::CallError ce;
- Variant::construct(Variant::DICTIONARY, prop_val, nullptr, 0, ce);
+ if (prop_val.get_type() == Variant::NIL && edit->is_pressed()) {
+ VariantInternal::initialize(&prop_val, Variant::DICTIONARY);
get_edited_object()->set(get_edited_property(), prop_val);
}
@@ -1272,14 +1228,13 @@ EditorPropertyDictionary::EditorPropertyDictionary() {
void EditorPropertyLocalizableString::_property_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing) {
if (p_property.begins_with("indices")) {
int index = p_property.get_slice("/", 1).to_int();
- Dictionary dict = object->get_dict();
+
+ Dictionary dict = object->get_dict().duplicate();
Variant key = dict.get_key_at_index(index);
dict[key] = p_value;
- emit_changed(get_edited_property(), dict, "", true);
-
- dict = dict.duplicate(); // Duplicate, so undo/redo works better.
object->set_dict(dict);
+ emit_changed(get_edited_property(), dict, "", true);
}
}
@@ -1288,29 +1243,22 @@ void EditorPropertyLocalizableString::_add_locale_popup() {
}
void EditorPropertyLocalizableString::_add_locale(const String &p_locale) {
- Dictionary dict = object->get_dict();
-
+ Dictionary dict = object->get_dict().duplicate();
object->set_new_item_key(p_locale);
object->set_new_item_value(String());
dict[object->get_new_item_key()] = object->get_new_item_value();
emit_changed(get_edited_property(), dict, "", false);
-
- dict = dict.duplicate(); // Duplicate, so undo/redo works better.
- object->set_dict(dict);
update_property();
}
void EditorPropertyLocalizableString::_remove_item(Object *p_button, int p_index) {
- Dictionary dict = object->get_dict();
+ Dictionary dict = object->get_dict().duplicate();
Variant key = dict.get_key_at_index(p_index);
dict.erase(key);
emit_changed(get_edited_property(), dict, "", false);
-
- dict = dict.duplicate(); // Duplicate, so undo/redo works better.
- object->set_dict(dict);
update_property();
}
@@ -1330,6 +1278,7 @@ void EditorPropertyLocalizableString::update_property() {
}
Dictionary dict = updated_val;
+ object->set_dict(dict);
edit->set_text(vformat(TTR("Localizable String (size %d)"), dict.size()));
@@ -1376,10 +1325,6 @@ void EditorPropertyLocalizableString::update_property() {
int amount = MIN(size - offset, page_length);
- dict = dict.duplicate();
-
- object->set_dict(dict);
-
for (int i = 0; i < amount; i++) {
String prop_name;
Variant key;
@@ -1451,9 +1396,8 @@ void EditorPropertyLocalizableString::_notification(int p_what) {
void EditorPropertyLocalizableString::_edit_pressed() {
Variant prop_val = get_edited_object()->get(get_edited_property());
- if (prop_val.get_type() == Variant::NIL) {
- Callable::CallError ce;
- Variant::construct(Variant::DICTIONARY, prop_val, nullptr, 0, ce);
+ if (prop_val.get_type() == Variant::NIL && edit->is_pressed()) {
+ VariantInternal::initialize(&prop_val, Variant::DICTIONARY);
get_edited_object()->set(get_edited_property(), prop_val);
}
diff --git a/editor/editor_properties_array_dict.h b/editor/editor_properties_array_dict.h
index 73a16e3687..3b880c60a8 100644
--- a/editor/editor_properties_array_dict.h
+++ b/editor/editor_properties_array_dict.h
@@ -102,6 +102,8 @@ class EditorPropertyArray : public EditorProperty {
HBoxContainer *reorder_selected_element_hbox = nullptr;
Button *reorder_selected_button = nullptr;
+ void initialize_array(Variant &p_array);
+
void _page_changed(int p_page);
void _reorder_button_gui_input(const Ref<InputEvent> &p_event);
diff --git a/editor/editor_property_name_processor.cpp b/editor/editor_property_name_processor.cpp
index 18ba19f5f6..5380fddde2 100644
--- a/editor/editor_property_name_processor.cpp
+++ b/editor/editor_property_name_processor.cpp
@@ -115,6 +115,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
capitalize_string_remaps["arm64-v8a"] = "arm64-v8a";
capitalize_string_remaps["armeabi-v7a"] = "armeabi-v7a";
capitalize_string_remaps["arvr"] = "ARVR";
+ capitalize_string_remaps["astc"] = "ASTC";
capitalize_string_remaps["bg"] = "BG";
capitalize_string_remaps["bidi"] = "BiDi";
capitalize_string_remaps["bp"] = "BP";
diff --git a/editor/editor_quick_open.cpp b/editor/editor_quick_open.cpp
index d516610908..b90edb8f90 100644
--- a/editor/editor_quick_open.cpp
+++ b/editor/editor_quick_open.cpp
@@ -69,17 +69,9 @@ void EditorQuickOpen::_build_search_cache(EditorFileSystemDirectory *p_efsd) {
for (int i = 0; i < p_efsd->get_file_count(); i++) {
String file = p_efsd->get_file_path(i);
String engine_type = p_efsd->get_file_type(i);
- // TODO: Fix lack of caching for resource's script's global class name (if applicable).
- String script_type;
- if (_load_resources) {
- Ref<Resource> res = ResourceLoader::load(file);
- if (res.is_valid()) {
- Ref<Script> scr = res->get_script();
- if (scr.is_valid()) {
- script_type = scr->get_language()->get_global_class_name(file);
- }
- }
- }
+
+ String script_type = p_efsd->get_file_resource_script_class(i);
+
String actual_type = script_type.is_empty() ? engine_type : script_type;
// Iterate all possible base types.
for (String &parent_type : base_types) {
diff --git a/editor/editor_quick_open.h b/editor/editor_quick_open.h
index 0503eec835..4b63a226c2 100644
--- a/editor/editor_quick_open.h
+++ b/editor/editor_quick_open.h
@@ -43,7 +43,6 @@ class EditorQuickOpen : public ConfirmationDialog {
Tree *search_options = nullptr;
String base_type;
bool allow_multi_select = false;
- bool _load_resources = false; // Prohibitively slow for now.
Vector<String> files;
OAHashMap<String, Ref<Texture2D>> icons;
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp
index a1c913aadd..86ffbccefd 100644
--- a/editor/editor_resource_picker.cpp
+++ b/editor/editor_resource_picker.cpp
@@ -42,12 +42,6 @@
#include "editor/plugins/script_editor_plugin.h"
#include "editor/scene_tree_dock.h"
-HashMap<StringName, List<StringName>> EditorResourcePicker::allowed_types_cache;
-
-void EditorResourcePicker::clear_caches() {
- allowed_types_cache.clear();
-}
-
void EditorResourcePicker::_update_resource() {
String resource_path;
if (edited_resource.is_valid() && edited_resource->get_path().is_resource_file()) {
@@ -103,7 +97,7 @@ void EditorResourcePicker::_update_resource_preview(const String &p_path, const
}
if (p_preview.is_valid()) {
- preview_rect->set_offset(SIDE_LEFT, assign_button->get_icon()->get_width() + assign_button->get_theme_stylebox(SNAME("normal"))->get_default_margin(SIDE_LEFT) + get_theme_constant(SNAME("h_separation"), SNAME("Button")));
+ preview_rect->set_offset(SIDE_LEFT, assign_button->get_icon()->get_width() + assign_button->get_theme_stylebox(SNAME("normal"))->get_content_margin(SIDE_LEFT) + get_theme_constant(SNAME("h_separation"), SNAME("Button")));
// Resource-specific stretching.
if (Ref<GradientTexture1D>(edited_resource).is_valid() || Ref<Gradient>(edited_resource).is_valid()) {
@@ -464,7 +458,7 @@ void EditorResourcePicker::set_create_options(Object *p_menu_node) {
if (!base_type.is_empty()) {
int idx = 0;
- HashSet<String> allowed_types;
+ HashSet<StringName> allowed_types;
_get_allowed_types(false, &allowed_types);
Vector<EditorData::CustomType> custom_resources;
@@ -472,7 +466,7 @@ void EditorResourcePicker::set_create_options(Object *p_menu_node) {
custom_resources = EditorNode::get_editor_data().get_custom_types()["Resource"];
}
- for (const String &E : allowed_types) {
+ for (const StringName &E : allowed_types) {
const String &t = E;
bool is_custom_resource = false;
@@ -561,53 +555,44 @@ String EditorResourcePicker::_get_resource_type(const Ref<Resource> &p_resource)
return res_type;
}
-void EditorResourcePicker::_get_allowed_types(bool p_with_convert, HashSet<String> *p_vector) const {
- Vector<String> allowed_types = base_type.split(",");
- int size = allowed_types.size();
+static void _add_allowed_type(const StringName &p_type, HashSet<StringName> *p_vector) {
+ if (p_vector->has(p_type)) {
+ // Already added
+ return;
+ }
- List<StringName> global_classes;
- ScriptServer::get_global_class_list(&global_classes);
+ if (ClassDB::class_exists(p_type)) {
+ // Engine class,
- for (int i = 0; i < size; i++) {
- String base = allowed_types[i].strip_edges();
- if (!ClassDB::is_virtual(base)) {
- p_vector->insert(base);
+ if (!ClassDB::is_virtual(p_type)) {
+ p_vector->insert(p_type);
}
- // If we hit a familiar base type, take all the data from cache.
- if (allowed_types_cache.has(base)) {
- List<StringName> allowed_subtypes = allowed_types_cache[base];
- for (const StringName &subtype_name : allowed_subtypes) {
- if (!ClassDB::is_virtual(subtype_name)) {
- p_vector->insert(subtype_name);
- }
- }
- } else {
- List<StringName> allowed_subtypes;
+ List<StringName> inheriters;
+ ClassDB::get_inheriters_from_class(p_type, &inheriters);
+ for (const StringName &S : inheriters) {
+ _add_allowed_type(S, p_vector);
+ }
+ } else {
+ // Script class.
+ p_vector->insert(p_type);
+ }
- List<StringName> inheriters;
- if (!ScriptServer::is_global_class(base)) {
- ClassDB::get_inheriters_from_class(base, &inheriters);
- }
- for (const StringName &subtype_name : inheriters) {
- if (!ClassDB::is_virtual(subtype_name)) {
- p_vector->insert(subtype_name);
- }
- allowed_subtypes.push_back(subtype_name);
- }
+ List<StringName> inheriters;
+ ScriptServer::get_inheriters_list(p_type, &inheriters);
+ for (const StringName &S : inheriters) {
+ _add_allowed_type(S, p_vector);
+ }
+}
- for (const StringName &subtype_name : global_classes) {
- if (EditorNode::get_editor_data().script_class_is_parent(subtype_name, base)) {
- if (!ClassDB::is_virtual(subtype_name)) {
- p_vector->insert(subtype_name);
- }
- allowed_subtypes.push_back(subtype_name);
- }
- }
+void EditorResourcePicker::_get_allowed_types(bool p_with_convert, HashSet<StringName> *p_vector) const {
+ Vector<String> allowed_types = base_type.split(",");
+ int size = allowed_types.size();
- // Store the subtypes of the base type in the cache for future use.
- allowed_types_cache[base] = allowed_subtypes;
- }
+ for (int i = 0; i < size; i++) {
+ String base = allowed_types[i].strip_edges();
+
+ _add_allowed_type(base, p_vector);
if (p_with_convert) {
if (base == "BaseMaterial3D") {
@@ -619,14 +604,6 @@ void EditorResourcePicker::_get_allowed_types(bool p_with_convert, HashSet<Strin
}
}
}
-
- if (EditorNode::get_editor_data().get_custom_types().has("Resource")) {
- Vector<EditorData::CustomType> custom_resources = EditorNode::get_editor_data().get_custom_types()["Resource"];
-
- for (int i = 0; i < custom_resources.size(); i++) {
- p_vector->insert(custom_resources[i].name);
- }
- }
}
bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const {
@@ -654,7 +631,7 @@ bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const {
}
}
- HashSet<String> allowed_types;
+ HashSet<StringName> allowed_types;
_get_allowed_types(true, &allowed_types);
if (res.is_valid()) {
@@ -673,9 +650,9 @@ bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const {
return false;
}
-bool EditorResourcePicker::_is_type_valid(const String p_type_name, HashSet<String> p_allowed_types) const {
- for (const String &E : p_allowed_types) {
- String at = E.strip_edges();
+bool EditorResourcePicker::_is_type_valid(const String p_type_name, HashSet<StringName> p_allowed_types) const {
+ for (const StringName &E : p_allowed_types) {
+ String at = E;
if (p_type_name == at || ClassDB::is_parent_class(p_type_name, at) || EditorNode::get_editor_data().script_class_is_parent(p_type_name, at)) {
return true;
}
@@ -721,15 +698,15 @@ void EditorResourcePicker::drop_data_fw(const Point2 &p_point, const Variant &p_
}
if (dropped_resource.is_valid()) {
- HashSet<String> allowed_types;
+ HashSet<StringName> allowed_types;
_get_allowed_types(false, &allowed_types);
String res_type = _get_resource_type(dropped_resource);
// If the accepted dropped resource is from the extended list, it requires conversion.
if (!_is_type_valid(res_type, allowed_types)) {
- for (const String &E : allowed_types) {
- String at = E.strip_edges();
+ for (const StringName &E : allowed_types) {
+ String at = E;
if (at == "BaseMaterial3D" && Ref<Texture2D>(dropped_resource).is_valid()) {
// Use existing resource if possible and only replace its data.
@@ -832,7 +809,7 @@ void EditorResourcePicker::set_base_type(const String &p_base_type) {
// There is a possibility that the new base type is conflicting with the existing value.
// Keep the value, but warn the user that there is a potential mistake.
if (!base_type.is_empty() && edited_resource.is_valid()) {
- HashSet<String> allowed_types;
+ HashSet<StringName> allowed_types;
_get_allowed_types(true, &allowed_types);
StringName custom_class;
@@ -846,10 +823,6 @@ void EditorResourcePicker::set_base_type(const String &p_base_type) {
String class_str = (custom_class == StringName() ? edited_resource->get_class() : vformat("%s (%s)", custom_class, edited_resource->get_class()));
WARN_PRINT(vformat("Value mismatch between the new base type of this EditorResourcePicker, '%s', and the type of the value it already has, '%s'.", base_type, class_str));
}
- } else {
- // Call the method to build the cache immediately.
- HashSet<String> allowed_types;
- _get_allowed_types(false, &allowed_types);
}
}
@@ -858,7 +831,7 @@ String EditorResourcePicker::get_base_type() const {
}
Vector<String> EditorResourcePicker::get_allowed_types() const {
- HashSet<String> allowed_types;
+ HashSet<StringName> allowed_types;
_get_allowed_types(false, &allowed_types);
Vector<String> types;
@@ -866,7 +839,7 @@ Vector<String> EditorResourcePicker::get_allowed_types() const {
int i = 0;
String *w = types.ptrw();
- for (const String &E : allowed_types) {
+ for (const StringName &E : allowed_types) {
w[i] = E;
i++;
}
@@ -882,7 +855,7 @@ void EditorResourcePicker::set_edited_resource(Ref<Resource> p_resource) {
}
if (!base_type.is_empty()) {
- HashSet<String> allowed_types;
+ HashSet<StringName> allowed_types;
_get_allowed_types(true, &allowed_types);
StringName custom_class;
diff --git a/editor/editor_resource_picker.h b/editor/editor_resource_picker.h
index 8641cb6e84..a302e24957 100644
--- a/editor/editor_resource_picker.h
+++ b/editor/editor_resource_picker.h
@@ -42,8 +42,6 @@ class EditorQuickOpen;
class EditorResourcePicker : public HBoxContainer {
GDCLASS(EditorResourcePicker, HBoxContainer);
- static HashMap<StringName, List<StringName>> allowed_types_cache;
-
String base_type;
Ref<Resource> edited_resource;
@@ -92,9 +90,9 @@ class EditorResourcePicker : public HBoxContainer {
void _button_input(const Ref<InputEvent> &p_event);
String _get_resource_type(const Ref<Resource> &p_resource) const;
- void _get_allowed_types(bool p_with_convert, HashSet<String> *p_vector) const;
+ void _get_allowed_types(bool p_with_convert, HashSet<StringName> *p_vector) const;
bool _is_drop_valid(const Dictionary &p_drag_data) const;
- bool _is_type_valid(const String p_type_name, HashSet<String> p_allowed_types) const;
+ bool _is_type_valid(const String p_type_name, HashSet<StringName> p_allowed_types) const;
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
@@ -118,8 +116,6 @@ protected:
GDVIRTUAL1R(bool, _handle_menu_selected, int)
public:
- static void clear_caches();
-
void set_base_type(const String &p_base_type);
String get_base_type() const;
Vector<String> get_allowed_types() const;
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index 4bcd91376a..d3cceee1a3 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -272,7 +272,9 @@ Error EditorRun::run(const String &p_scene, const String &p_write_movie) {
OS::ProcessID pid = 0;
Error err = OS::get_singleton()->create_instance(args, &pid);
ERR_FAIL_COND_V(err, err);
- pids.push_back(pid);
+ if (pid != 0) {
+ pids.push_back(pid);
+ }
}
status = STATUS_PLAY;
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 8ca98e6f76..1c988840ac 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -453,6 +453,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
// Theme
EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_ENUM, "interface/theme/preset", "Default", "Default,Breeze Dark,Godot 2,Gray,Light,Solarized (Dark),Solarized (Light),Black (OLED),Custom")
+ EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/theme/enable_touchscreen_touch_area", DisplayServer::get_singleton()->is_touchscreen_available(), "")
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/theme/icon_and_font_color", 0, "Auto,Dark,Light")
EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "interface/theme/base_color", Color(0.2, 0.23, 0.31), "")
EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "interface/theme/accent_color", Color(0.41, 0.61, 0.91), "")
@@ -473,6 +474,12 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
/* Filesystem */
+ // External Programs
+ EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "filesystem/external_programs/raster_image_editor", "", "")
+ EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "filesystem/external_programs/vector_image_editor", "", "")
+ EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "filesystem/external_programs/audio_editor", "", "")
+ EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "filesystem/external_programs/3d_model_editor", "", "")
+
// Directories
EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_DIR, "filesystem/directories/autoscan_project_path", "", "")
const String fs_dir_default_project_path = OS::get_singleton()->has_environment("HOME") ? OS::get_singleton()->get_environment("HOME") : OS::get_singleton()->get_system_dir(OS::SYSTEM_DIR_DOCUMENTS);
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index 177266e366..54e14074d9 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -278,11 +278,11 @@ void EditorSpinSlider::_update_value_input_stylebox() {
// higher margin to match the location where the text begins.
// The margin values below were determined by empirical testing.
if (is_layout_rtl()) {
- stylebox->set_default_margin(SIDE_LEFT, 0);
- stylebox->set_default_margin(SIDE_RIGHT, (!get_label().is_empty() ? 23 : 16) * EDSCALE);
+ stylebox->set_content_margin(SIDE_LEFT, 0);
+ stylebox->set_content_margin(SIDE_RIGHT, (!get_label().is_empty() ? 23 : 16) * EDSCALE);
} else {
- stylebox->set_default_margin(SIDE_LEFT, (!get_label().is_empty() ? 23 : 16) * EDSCALE);
- stylebox->set_default_margin(SIDE_RIGHT, 0);
+ stylebox->set_content_margin(SIDE_LEFT, (!get_label().is_empty() ? 23 : 16) * EDSCALE);
+ stylebox->set_content_margin(SIDE_RIGHT, 0);
}
value_input->add_theme_style_override("normal", stylebox);
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 7a880d2ab3..d2c82ad013 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -197,15 +197,15 @@ void EditorColorMap::create() {
static Ref<StyleBoxTexture> make_stylebox(Ref<Texture2D> p_texture, float p_left, float p_top, float p_right, float p_bottom, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1, bool p_draw_center = true) {
Ref<StyleBoxTexture> style(memnew(StyleBoxTexture));
style->set_texture(p_texture);
- style->set_margin_size_individual(p_left * EDSCALE, p_top * EDSCALE, p_right * EDSCALE, p_bottom * EDSCALE);
- style->set_default_margin_individual(p_margin_left * EDSCALE, p_margin_top * EDSCALE, p_margin_right * EDSCALE, p_margin_bottom * EDSCALE);
+ style->set_texture_margin_individual(p_left * EDSCALE, p_top * EDSCALE, p_right * EDSCALE, p_bottom * EDSCALE);
+ style->set_content_margin_individual((p_left + p_margin_left) * EDSCALE, (p_top + p_margin_top) * EDSCALE, (p_right + p_margin_right) * EDSCALE, (p_bottom + p_margin_bottom) * EDSCALE);
style->set_draw_center(p_draw_center);
return style;
}
static Ref<StyleBoxEmpty> make_empty_stylebox(float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1) {
Ref<StyleBoxEmpty> style(memnew(StyleBoxEmpty));
- style->set_default_margin_individual(p_margin_left * EDSCALE, p_margin_top * EDSCALE, p_margin_right * EDSCALE, p_margin_bottom * EDSCALE);
+ style->set_content_margin_individual(p_margin_left * EDSCALE, p_margin_top * EDSCALE, p_margin_right * EDSCALE, p_margin_bottom * EDSCALE);
return style;
}
@@ -215,7 +215,7 @@ static Ref<StyleBoxFlat> make_flat_stylebox(Color p_color, float p_margin_left =
// Adjust level of detail based on the corners' effective sizes.
style->set_corner_detail(Math::ceil(0.8 * p_corner_width * EDSCALE));
style->set_corner_radius_all(p_corner_width * EDSCALE);
- style->set_default_margin_individual(p_margin_left * EDSCALE, p_margin_top * EDSCALE, p_margin_right * EDSCALE, p_margin_bottom * EDSCALE);
+ style->set_content_margin_individual(p_margin_left * EDSCALE, p_margin_top * EDSCALE, p_margin_right * EDSCALE, p_margin_bottom * EDSCALE);
// Work around issue about antialiased edges being blurrier (GH-35279).
style->set_anti_aliased(false);
return style;
@@ -394,6 +394,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Color accent_color = EDITOR_GET("interface/theme/accent_color");
Color base_color = EDITOR_GET("interface/theme/base_color");
float contrast = EDITOR_GET("interface/theme/contrast");
+ bool enable_touchscreen_touch_area = EDITOR_GET("interface/theme/enable_touchscreen_touch_area");
bool draw_extra_borders = EDITOR_GET("interface/theme/draw_extra_borders");
float icon_saturation = EDITOR_GET("interface/theme/icon_saturation");
float relationship_line_opacity = EDITOR_GET("interface/theme/relationship_line_opacity");
@@ -648,7 +649,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const Vector2 widget_default_margin = Vector2(extra_spacing + 6, extra_spacing + default_margin_size + 1) * EDSCALE;
Ref<StyleBoxFlat> style_widget = style_default->duplicate();
- style_widget->set_default_margin_individual(widget_default_margin.x, widget_default_margin.y, widget_default_margin.x, widget_default_margin.y);
+ style_widget->set_content_margin_individual(widget_default_margin.x, widget_default_margin.y, widget_default_margin.x, widget_default_margin.y);
style_widget->set_bg_color(dark_color_1);
if (draw_extra_borders) {
style_widget->set_border_width_all(Math::round(EDSCALE));
@@ -684,7 +685,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Style for windows, popups, etc..
Ref<StyleBoxFlat> style_popup = style_default->duplicate();
const int popup_margin_size = default_margin_size * EDSCALE * 3;
- style_popup->set_default_margin_all(popup_margin_size);
+ style_popup->set_content_margin_all(popup_margin_size);
style_popup->set_border_color(contrast_color_1);
const Color shadow_color = Color(0, 0, 0, dark_theme ? 0.3 : 0.1);
style_popup->set_shadow_color(shadow_color);
@@ -722,12 +723,12 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_tab_base->set_corner_radius(CORNER_BOTTOM_RIGHT, 0);
// When using a border width greater than 0, visually line up the left of the selected tab with the underlying panel.
- style_tab_base->set_expand_margin_size(SIDE_LEFT, -border_width);
+ style_tab_base->set_expand_margin(SIDE_LEFT, -border_width);
- style_tab_base->set_default_margin(SIDE_LEFT, widget_default_margin.x + 5 * EDSCALE);
- style_tab_base->set_default_margin(SIDE_RIGHT, widget_default_margin.x + 5 * EDSCALE);
- style_tab_base->set_default_margin(SIDE_BOTTOM, widget_default_margin.y);
- style_tab_base->set_default_margin(SIDE_TOP, widget_default_margin.y);
+ style_tab_base->set_content_margin(SIDE_LEFT, widget_default_margin.x + 5 * EDSCALE);
+ style_tab_base->set_content_margin(SIDE_RIGHT, widget_default_margin.x + 5 * EDSCALE);
+ style_tab_base->set_content_margin(SIDE_BOTTOM, widget_default_margin.y);
+ style_tab_base->set_content_margin(SIDE_TOP, widget_default_margin.y);
Ref<StyleBoxFlat> style_tab_selected = style_tab_base->duplicate();
@@ -740,13 +741,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_tab_selected->set_corner_radius_all(0);
Ref<StyleBoxFlat> style_tab_unselected = style_tab_base->duplicate();
- style_tab_unselected->set_expand_margin_size(SIDE_BOTTOM, 0);
+ style_tab_unselected->set_expand_margin(SIDE_BOTTOM, 0);
style_tab_unselected->set_bg_color(dark_color_1);
// Add some spacing between unselected tabs to make them easier to distinguish from each other
style_tab_unselected->set_border_color(Color(0, 0, 0, 0));
Ref<StyleBoxFlat> style_tab_disabled = style_tab_base->duplicate();
- style_tab_disabled->set_expand_margin_size(SIDE_BOTTOM, 0);
+ style_tab_disabled->set_expand_margin(SIDE_BOTTOM, 0);
style_tab_disabled->set_bg_color(disabled_bg_color);
style_tab_disabled->set_border_color(disabled_bg_color);
@@ -772,7 +773,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// CanvasItem Editor
Ref<StyleBoxFlat> style_canvas_editor_info = make_flat_stylebox(Color(0.0, 0.0, 0.0, 0.2));
- style_canvas_editor_info->set_expand_margin_size_all(4 * EDSCALE);
+ style_canvas_editor_info->set_expand_margin_all(4 * EDSCALE);
theme->set_stylebox("CanvasItemInfoOverlay", "EditorStyles", style_canvas_editor_info);
// 2D and 3D contextual toolbar.
@@ -787,7 +788,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Add an underline to the StyleBox, but prevent its minimum vertical size from changing.
toolbar_stylebox->set_border_color(accent_color);
toolbar_stylebox->set_border_width(SIDE_BOTTOM, Math::round(2 * EDSCALE));
- toolbar_stylebox->set_default_margin(SIDE_BOTTOM, 0);
+ toolbar_stylebox->set_content_margin(SIDE_BOTTOM, 0);
theme->set_stylebox("ContextualToolbar", "EditorStyles", toolbar_stylebox);
// Script Editor
@@ -808,11 +809,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Ref<StyleBoxFlat> style_write_movie_button = style_widget_pressed->duplicate();
style_write_movie_button->set_bg_color(accent_color);
style_write_movie_button->set_corner_radius_all(corner_radius * EDSCALE);
- style_write_movie_button->set_default_margin(SIDE_TOP, 0);
- style_write_movie_button->set_default_margin(SIDE_BOTTOM, 0);
- style_write_movie_button->set_default_margin(SIDE_LEFT, 0);
- style_write_movie_button->set_default_margin(SIDE_RIGHT, 0);
- style_write_movie_button->set_expand_margin_size(SIDE_RIGHT, 2 * EDSCALE);
+ style_write_movie_button->set_content_margin(SIDE_TOP, 0);
+ style_write_movie_button->set_content_margin(SIDE_BOTTOM, 0);
+ style_write_movie_button->set_content_margin(SIDE_LEFT, 0);
+ style_write_movie_button->set_content_margin(SIDE_RIGHT, 0);
+ style_write_movie_button->set_expand_margin(SIDE_RIGHT, 2 * EDSCALE);
theme->set_stylebox("MovieWriterButtonPressed", "EditorStyles", style_write_movie_button);
theme->set_stylebox("normal", "MenuButton", style_menu);
@@ -855,16 +856,16 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
color_inspector_action.a = 0.5;
Ref<StyleBoxFlat> style_inspector_action = style_widget->duplicate();
style_inspector_action->set_bg_color(color_inspector_action);
- style_inspector_action->set_default_margin(SIDE_RIGHT, ACTION_BUTTON_EXTRA_MARGIN);
+ style_inspector_action->set_content_margin(SIDE_RIGHT, ACTION_BUTTON_EXTRA_MARGIN);
theme->set_stylebox("normal", "InspectorActionButton", style_inspector_action);
style_inspector_action = style_widget_hover->duplicate();
- style_inspector_action->set_default_margin(SIDE_RIGHT, ACTION_BUTTON_EXTRA_MARGIN);
+ style_inspector_action->set_content_margin(SIDE_RIGHT, ACTION_BUTTON_EXTRA_MARGIN);
theme->set_stylebox("hover", "InspectorActionButton", style_inspector_action);
style_inspector_action = style_widget_pressed->duplicate();
- style_inspector_action->set_default_margin(SIDE_RIGHT, ACTION_BUTTON_EXTRA_MARGIN);
+ style_inspector_action->set_content_margin(SIDE_RIGHT, ACTION_BUTTON_EXTRA_MARGIN);
theme->set_stylebox("pressed", "InspectorActionButton", style_inspector_action);
style_inspector_action = style_widget_disabled->duplicate();
- style_inspector_action->set_default_margin(SIDE_RIGHT, ACTION_BUTTON_EXTRA_MARGIN);
+ style_inspector_action->set_content_margin(SIDE_RIGHT, ACTION_BUTTON_EXTRA_MARGIN);
theme->set_stylebox("disabled", "InspectorActionButton", style_inspector_action);
theme->set_constant("h_separation", "InspectorActionButton", ACTION_BUTTON_EXTRA_MARGIN);
@@ -908,11 +909,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Ref<StyleBoxFlat> style_option_button_pressed = style_widget_pressed->duplicate();
Ref<StyleBoxFlat> style_option_button_disabled = style_widget_disabled->duplicate();
- style_option_button_focus->set_default_margin(SIDE_RIGHT, 4 * EDSCALE);
- style_option_button_normal->set_default_margin(SIDE_RIGHT, 4 * EDSCALE);
- style_option_button_hover->set_default_margin(SIDE_RIGHT, 4 * EDSCALE);
- style_option_button_pressed->set_default_margin(SIDE_RIGHT, 4 * EDSCALE);
- style_option_button_disabled->set_default_margin(SIDE_RIGHT, 4 * EDSCALE);
+ style_option_button_focus->set_content_margin(SIDE_RIGHT, 4 * EDSCALE);
+ style_option_button_normal->set_content_margin(SIDE_RIGHT, 4 * EDSCALE);
+ style_option_button_hover->set_content_margin(SIDE_RIGHT, 4 * EDSCALE);
+ style_option_button_pressed->set_content_margin(SIDE_RIGHT, 4 * EDSCALE);
+ style_option_button_disabled->set_content_margin(SIDE_RIGHT, 4 * EDSCALE);
theme->set_stylebox("focus", "OptionButton", style_option_button_focus);
theme->set_stylebox("normal", "OptionButton", style_widget);
@@ -978,7 +979,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Checkbox
Ref<StyleBoxFlat> sb_checkbox = style_menu->duplicate();
- sb_checkbox->set_default_margin_all(default_margin_size * EDSCALE);
+ sb_checkbox->set_content_margin_all(default_margin_size * EDSCALE);
theme->set_stylebox("normal", "CheckBox", sb_checkbox);
theme->set_stylebox("pressed", "CheckBox", sb_checkbox);
@@ -1018,7 +1019,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Use 1 pixel for the sides, since if 0 is used, the highlight of hovered items is drawn
// on top of the popup border. This causes a 'gap' in the panel border when an item is highlighted,
// and it looks weird. 1px solves this.
- style_popup_menu->set_default_margin_individual(EDSCALE, 2 * EDSCALE, EDSCALE, 2 * EDSCALE);
+ style_popup_menu->set_content_margin_individual(EDSCALE, 2 * EDSCALE, EDSCALE, 2 * EDSCALE);
// Always display a border for PopupMenus so they can be distinguished from their background.
style_popup_menu->set_border_width_all(EDSCALE);
if (draw_extra_borders) {
@@ -1078,7 +1079,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
sub_inspector_bg->set_bg_color(dark_color_1.lerp(si_base_color, 0.08));
sub_inspector_bg->set_border_width_all(2 * EDSCALE);
sub_inspector_bg->set_border_color(si_base_color * Color(0.7, 0.7, 0.7, 0.8));
- sub_inspector_bg->set_default_margin_all(4 * EDSCALE);
+ sub_inspector_bg->set_content_margin_all(4 * EDSCALE);
sub_inspector_bg->set_corner_radius(CORNER_TOP_LEFT, 0);
sub_inspector_bg->set_corner_radius(CORNER_TOP_RIGHT, 0);
@@ -1318,7 +1319,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_content_panel->set_corner_radius(CORNER_TOP_LEFT, 0);
style_content_panel->set_corner_radius(CORNER_TOP_RIGHT, 0);
// Compensate for the border.
- style_content_panel->set_default_margin_individual(margin_size_extra * EDSCALE, (2 + margin_size_extra) * EDSCALE, margin_size_extra * EDSCALE, margin_size_extra * EDSCALE);
+ style_content_panel->set_content_margin_individual(margin_size_extra * EDSCALE, (2 + margin_size_extra) * EDSCALE, margin_size_extra * EDSCALE, margin_size_extra * EDSCALE);
theme->set_stylebox("panel", "TabContainer", style_content_panel);
// Bottom panel.
@@ -1339,15 +1340,15 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// This stylebox is used in 3d and 2d viewports (no borders).
Ref<StyleBoxFlat> style_content_panel_vp = style_content_panel->duplicate();
- style_content_panel_vp->set_default_margin_individual(border_width * 2, default_margin_size * EDSCALE, border_width * 2, border_width * 2);
+ style_content_panel_vp->set_content_margin_individual(border_width * 2, default_margin_size * EDSCALE, border_width * 2, border_width * 2);
theme->set_stylebox("Content", "EditorStyles", style_content_panel_vp);
// This stylebox is used by preview tabs in the Theme Editor.
Ref<StyleBoxFlat> style_theme_preview_tab = style_tab_selected_odd->duplicate();
- style_theme_preview_tab->set_expand_margin_size(SIDE_BOTTOM, 5 * EDSCALE);
+ style_theme_preview_tab->set_expand_margin(SIDE_BOTTOM, 5 * EDSCALE);
theme->set_stylebox("ThemeEditorPreviewFG", "EditorStyles", style_theme_preview_tab);
Ref<StyleBoxFlat> style_theme_preview_bg_tab = style_tab_unselected->duplicate();
- style_theme_preview_bg_tab->set_expand_margin_size(SIDE_BOTTOM, 2 * EDSCALE);
+ style_theme_preview_bg_tab->set_expand_margin(SIDE_BOTTOM, 2 * EDSCALE);
theme->set_stylebox("ThemeEditorPreviewBG", "EditorStyles", style_theme_preview_bg_tab);
// Separators
@@ -1361,9 +1362,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("DebuggerPanel", "EditorStyles", style_panel_debugger);
Ref<StyleBoxFlat> style_panel_invisible_top = style_content_panel->duplicate();
- int stylebox_offset = theme->get_font(SNAME("tab_selected"), SNAME("TabContainer"))->get_height(theme->get_font_size(SNAME("tab_selected"), SNAME("TabContainer"))) + theme->get_stylebox(SNAME("tab_selected"), SNAME("TabContainer"))->get_minimum_size().height + theme->get_stylebox(SNAME("panel"), SNAME("TabContainer"))->get_default_margin(SIDE_TOP);
- style_panel_invisible_top->set_expand_margin_size(SIDE_TOP, -stylebox_offset);
- style_panel_invisible_top->set_default_margin(SIDE_TOP, 0);
+ int stylebox_offset = theme->get_font(SNAME("tab_selected"), SNAME("TabContainer"))->get_height(theme->get_font_size(SNAME("tab_selected"), SNAME("TabContainer"))) + theme->get_stylebox(SNAME("tab_selected"), SNAME("TabContainer"))->get_minimum_size().height + theme->get_stylebox(SNAME("panel"), SNAME("TabContainer"))->get_content_margin(SIDE_TOP);
+ style_panel_invisible_top->set_expand_margin(SIDE_TOP, -stylebox_offset);
+ style_panel_invisible_top->set_content_margin(SIDE_TOP, 0);
theme->set_stylebox("BottomPanelDebuggerOverride", "EditorStyles", style_panel_invisible_top);
// LineEdit
@@ -1371,7 +1372,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Ref<StyleBoxFlat> style_line_edit = style_widget->duplicate();
// The original style_widget style has an extra 1 pixel offset that makes LineEdits not align with Buttons,
// so this compensates for that.
- style_line_edit->set_default_margin(SIDE_TOP, style_line_edit->get_default_margin(SIDE_TOP) - 1 * EDSCALE);
+ style_line_edit->set_content_margin(SIDE_TOP, style_line_edit->get_content_margin(SIDE_TOP) - 1 * EDSCALE);
// Don't round the bottom corner to make the line look sharper.
style_tab_selected->set_corner_radius(CORNER_BOTTOM_LEFT, 0);
@@ -1459,12 +1460,12 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_window_title->set_corner_radius(CORNER_TOP_LEFT, 0);
style_window_title->set_corner_radius(CORNER_TOP_RIGHT, 0);
// Prevent visible line between window title and body.
- style_window_title->set_expand_margin_size(SIDE_BOTTOM, 2 * EDSCALE);
+ style_window_title->set_expand_margin(SIDE_BOTTOM, 2 * EDSCALE);
Ref<StyleBoxFlat> style_window = style_popup->duplicate();
style_window->set_border_color(base_color);
style_window->set_border_width(SIDE_TOP, 24 * EDSCALE);
- style_window->set_expand_margin_size(SIDE_TOP, 24 * EDSCALE);
+ style_window->set_expand_margin(SIDE_TOP, 24 * EDSCALE);
theme->set_stylebox("embedded_border", "Window", style_window);
theme->set_color("title_color", "Window", font_color);
@@ -1492,11 +1493,15 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// HScrollBar
Ref<Texture2D> empty_icon = memnew(ImageTexture);
- theme->set_stylebox("scroll", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 0, 0, 0, 0));
- theme->set_stylebox("scroll_focus", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 0, 0, 0, 0));
- theme->set_stylebox("grabber", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabber"), SNAME("EditorIcons")), 6, 6, 6, 6, 2, 2, 2, 2));
- theme->set_stylebox("grabber_highlight", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberHl"), SNAME("EditorIcons")), 5, 5, 5, 5, 2, 2, 2, 2));
- theme->set_stylebox("grabber_pressed", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberPressed"), SNAME("EditorIcons")), 6, 6, 6, 6, 2, 2, 2, 2));
+ if (enable_touchscreen_touch_area) {
+ theme->set_stylebox("scroll", "HScrollBar", make_line_stylebox(separator_color, 50));
+ } else {
+ theme->set_stylebox("scroll", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 1, 1, 1, 1));
+ }
+ theme->set_stylebox("scroll_focus", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 1, 1, 1, 1));
+ theme->set_stylebox("grabber", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabber"), SNAME("EditorIcons")), 6, 6, 6, 6, 1, 1, 1, 1));
+ theme->set_stylebox("grabber_highlight", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberHl"), SNAME("EditorIcons")), 5, 5, 5, 5, 1, 1, 1, 1));
+ theme->set_stylebox("grabber_pressed", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberPressed"), SNAME("EditorIcons")), 6, 6, 6, 6, 1, 1, 1, 1));
theme->set_icon("increment", "HScrollBar", empty_icon);
theme->set_icon("increment_highlight", "HScrollBar", empty_icon);
@@ -1506,11 +1511,15 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("decrement_pressed", "HScrollBar", empty_icon);
// VScrollBar
- theme->set_stylebox("scroll", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 0, 0, 0, 0));
- theme->set_stylebox("scroll_focus", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 0, 0, 0, 0));
- theme->set_stylebox("grabber", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabber"), SNAME("EditorIcons")), 6, 6, 6, 6, 2, 2, 2, 2));
- theme->set_stylebox("grabber_highlight", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberHl"), SNAME("EditorIcons")), 5, 5, 5, 5, 2, 2, 2, 2));
- theme->set_stylebox("grabber_pressed", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberPressed"), SNAME("EditorIcons")), 6, 6, 6, 6, 2, 2, 2, 2));
+ if (enable_touchscreen_touch_area) {
+ theme->set_stylebox("scroll", "VScrollBar", make_line_stylebox(separator_color, 50, 1, 1, true));
+ } else {
+ theme->set_stylebox("scroll", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 1, 1, 1, 1));
+ }
+ theme->set_stylebox("scroll_focus", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 1, 1, 1, 1));
+ theme->set_stylebox("grabber", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabber"), SNAME("EditorIcons")), 6, 6, 6, 6, 1, 1, 1, 1));
+ theme->set_stylebox("grabber_highlight", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberHl"), SNAME("EditorIcons")), 5, 5, 5, 5, 1, 1, 1, 1));
+ theme->set_stylebox("grabber_pressed", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberPressed"), SNAME("EditorIcons")), 6, 6, 6, 6, 1, 1, 1, 1));
theme->set_icon("increment", "VScrollBar", empty_icon);
theme->set_icon("increment_highlight", "VScrollBar", empty_icon);
@@ -1598,7 +1607,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// is only relevant for default tooltips.
Ref<StyleBoxFlat> style_tooltip = style_popup->duplicate();
style_tooltip->set_shadow_size(0);
- style_tooltip->set_default_margin_all(default_margin_size * EDSCALE * 0.5);
+ style_tooltip->set_content_margin_all(default_margin_size * EDSCALE * 0.5);
style_tooltip->set_bg_color(dark_color_3 * Color(0.8, 0.8, 0.8, 0.9));
style_tooltip->set_border_width_all(0);
theme->set_color("font_color", "TooltipLabel", font_hover_color);
@@ -1610,10 +1619,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Ref<StyleBoxFlat> control_editor_popup_style = style_popup->duplicate();
control_editor_popup_style->set_shadow_size(0);
- control_editor_popup_style->set_default_margin(SIDE_LEFT, default_margin_size * EDSCALE);
- control_editor_popup_style->set_default_margin(SIDE_TOP, default_margin_size * EDSCALE);
- control_editor_popup_style->set_default_margin(SIDE_RIGHT, default_margin_size * EDSCALE);
- control_editor_popup_style->set_default_margin(SIDE_BOTTOM, default_margin_size * EDSCALE);
+ control_editor_popup_style->set_content_margin(SIDE_LEFT, default_margin_size * EDSCALE);
+ control_editor_popup_style->set_content_margin(SIDE_TOP, default_margin_size * EDSCALE);
+ control_editor_popup_style->set_content_margin(SIDE_RIGHT, default_margin_size * EDSCALE);
+ control_editor_popup_style->set_content_margin(SIDE_BOTTOM, default_margin_size * EDSCALE);
control_editor_popup_style->set_border_width_all(0);
theme->set_stylebox("panel", "ControlEditorPopupPanel", control_editor_popup_style);
@@ -1826,8 +1835,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Dictionary editor add item.
// Expand to the left and right by 4px to compensate for the dictionary editor margins.
Ref<StyleBoxFlat> style_dictionary_add_item = make_flat_stylebox(prop_subsection_color, 0, 4, 0, 4, corner_radius);
- style_dictionary_add_item->set_expand_margin_size(SIDE_LEFT, 4 * EDSCALE);
- style_dictionary_add_item->set_expand_margin_size(SIDE_RIGHT, 4 * EDSCALE);
+ style_dictionary_add_item->set_expand_margin(SIDE_LEFT, 4 * EDSCALE);
+ style_dictionary_add_item->set_expand_margin(SIDE_RIGHT, 4 * EDSCALE);
theme->set_stylebox("DictionaryAddItem", "EditorStyles", style_dictionary_add_item);
Ref<StyleBoxEmpty> vshader_label_style = make_empty_stylebox(2, 1, 2, 1);
diff --git a/editor/editor_title_bar.cpp b/editor/editor_title_bar.cpp
index 0271bbd64a..ae5cdfd72b 100644
--- a/editor/editor_title_bar.cpp
+++ b/editor/editor_title_bar.cpp
@@ -30,7 +30,7 @@
#include "editor/editor_title_bar.h"
-void EditorTitleBar::input(const Ref<InputEvent> &p_event) {
+void EditorTitleBar::gui_input(const Ref<InputEvent> &p_event) {
if (!can_move) {
return;
}
diff --git a/editor/editor_title_bar.h b/editor/editor_title_bar.h
index 6cac163830..4055476b82 100644
--- a/editor/editor_title_bar.h
+++ b/editor/editor_title_bar.h
@@ -42,7 +42,7 @@ class EditorTitleBar : public HBoxContainer {
bool can_move = false;
protected:
- virtual void input(const Ref<InputEvent> &p_event) override;
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
static void _bind_methods(){};
public:
diff --git a/editor/editor_toaster.cpp b/editor/editor_toaster.cpp
index 558423df78..73b645f351 100644
--- a/editor/editor_toaster.cpp
+++ b/editor/editor_toaster.cpp
@@ -230,10 +230,10 @@ void EditorToaster::_auto_hide_or_free_toasts() {
}
// Delete the control right away (removed as child) as it might cause issues otherwise when iterative over the vbox_container children.
- for (unsigned int i = 0; i < to_delete.size(); i++) {
- vbox_container->remove_child(to_delete[i]);
- to_delete[i]->queue_free();
- toasts.erase(to_delete[i]);
+ for (Control *c : to_delete) {
+ vbox_container->remove_child(c);
+ c->queue_free();
+ toasts.erase(c);
}
if (toasts.is_empty()) {
@@ -525,7 +525,7 @@ EditorToaster::EditorToaster() {
Ref<StyleBoxFlat> boxes[] = { info_panel_style_background, warning_panel_style_background, error_panel_style_background };
for (int i = 0; i < 3; i++) {
- boxes[i]->set_default_margin_individual(int(stylebox_radius * 2.5), 3, int(stylebox_radius * 2.5), 3);
+ boxes[i]->set_content_margin_individual(int(stylebox_radius * 2.5), 3, int(stylebox_radius * 2.5), 3);
}
// Theming (progress).
diff --git a/editor/editor_zoom_widget.cpp b/editor/editor_zoom_widget.cpp
index 5a334bdaa6..3998b33a53 100644
--- a/editor/editor_zoom_widget.cpp
+++ b/editor/editor_zoom_widget.cpp
@@ -41,12 +41,12 @@ void EditorZoomWidget::_update_zoom_label() {
// lower the editor scale to increase the available real estate,
// even if their display doesn't have a particularly low DPI.
if (zoom >= 10) {
- // Don't show a decimal when the zoom level is higher than 1000 %.
- zoom_text = TS->format_number(rtos(Math::round((zoom / MAX(1, EDSCALE)) * 100))) + " " + TS->percent_sign();
+ zoom_text = TS->format_number(rtos(Math::round((zoom / MAX(1, EDSCALE)) * 100)));
} else {
- zoom_text = TS->format_number(rtos(Math::snapped((zoom / MAX(1, EDSCALE)) * 100, 0.1))) + " " + TS->percent_sign();
+ // 2 decimal places if the zoom is below 10%, 1 decimal place if it's below 1000%.
+ zoom_text = TS->format_number(rtos(Math::snapped((zoom / MAX(1, EDSCALE)) * 100, (zoom >= 0.1) ? 0.1 : 0.01)));
}
-
+ zoom_text += " " + TS->percent_sign();
zoom_reset->set_text(zoom_text);
}
@@ -134,7 +134,7 @@ void EditorZoomWidget::set_zoom_by_increments(int p_increment_count, bool p_inte
float new_zoom_index = closest_zoom_index + p_increment_count;
float new_zoom = Math::pow(2.f, new_zoom_index / 12.f);
- // Restore Editor scale transformation
+ // Restore Editor scale transformation.
new_zoom *= MAX(1, EDSCALE);
set_zoom(new_zoom);
@@ -179,8 +179,12 @@ EditorZoomWidget::EditorZoomWidget() {
zoom_reset = memnew(Button);
zoom_reset->set_flat(true);
+ zoom_reset->add_theme_style_override("normal", memnew(StyleBoxEmpty));
+ zoom_reset->add_theme_style_override("hover", memnew(StyleBoxEmpty));
+ zoom_reset->add_theme_style_override("focus", memnew(StyleBoxEmpty));
+ zoom_reset->add_theme_style_override("pressed", memnew(StyleBoxEmpty));
add_child(zoom_reset);
- zoom_reset->add_theme_constant_override("outline_size", 1);
+ zoom_reset->add_theme_constant_override("outline_size", Math::ceil(2 * EDSCALE));
zoom_reset->add_theme_color_override("font_outline_color", Color(0, 0, 0));
zoom_reset->add_theme_color_override("font_color", Color(1, 1, 1));
zoom_reset->connect("pressed", callable_mp(this, &EditorZoomWidget::_button_zoom_reset));
@@ -189,7 +193,7 @@ EditorZoomWidget::EditorZoomWidget() {
zoom_reset->set_focus_mode(FOCUS_NONE);
zoom_reset->set_text_alignment(HORIZONTAL_ALIGNMENT_CENTER);
// Prevent the button's size from changing when the text size changes
- zoom_reset->set_custom_minimum_size(Size2(75 * EDSCALE, 0));
+ zoom_reset->set_custom_minimum_size(Size2(56 * EDSCALE, 0));
zoom_plus = memnew(Button);
zoom_plus->set_flat(true);
@@ -201,5 +205,5 @@ EditorZoomWidget::EditorZoomWidget() {
_update_zoom_label();
- add_theme_constant_override("separation", Math::round(-8 * EDSCALE));
+ add_theme_constant_override("separation", 0);
}
diff --git a/editor/event_listener_line_edit.cpp b/editor/event_listener_line_edit.cpp
index 274fe34c52..ea4a7133bf 100644
--- a/editor/event_listener_line_edit.cpp
+++ b/editor/event_listener_line_edit.cpp
@@ -59,16 +59,42 @@ static const char *_joy_axis_descriptions[(size_t)JoyAxis::MAX * 2] = {
String EventListenerLineEdit::get_event_text(const Ref<InputEvent> &p_event, bool p_include_device) {
ERR_FAIL_COND_V_MSG(p_event.is_null(), String(), "Provided event is not a valid instance of InputEvent");
- String text = p_event->as_text();
-
+ String text;
Ref<InputEventKey> key = p_event;
- if (key.is_valid() && key->is_command_or_control_autoremap()) {
+ if (key.is_valid()) {
+ String mods_text = key->InputEventWithModifiers::as_text();
+ mods_text = mods_text.is_empty() ? mods_text : mods_text + "+";
+ if (key->is_command_or_control_autoremap()) {
#ifdef MACOS_ENABLED
- text = text.replace("Command", "Command/Ctrl");
+ mods_text = mods_text.replace("Command", "Command/Ctrl");
#else
- text = text.replace("Ctrl", "Command/Ctrl");
+ mods_text = mods_text.replace("Ctrl", "Command/Ctrl");
#endif
+ }
+
+ if (key->get_keycode() != Key::NONE) {
+ text += mods_text + keycode_get_string(key->get_keycode());
+ }
+ if (key->get_physical_keycode() != Key::NONE) {
+ if (!text.is_empty()) {
+ text += " or ";
+ }
+ text += mods_text + keycode_get_string(key->get_physical_keycode()) + " (" + RTR("Physical") + ")";
+ }
+ if (key->get_key_label() != Key::NONE) {
+ if (!text.is_empty()) {
+ text += " or ";
+ }
+ text += mods_text + keycode_get_string(key->get_key_label()) + " (Unicode)";
+ }
+
+ if (text.is_empty()) {
+ text = "(" + RTR("Unset") + ")";
+ }
+ } else {
+ text = p_event->as_text();
}
+
Ref<InputEventMouse> mouse = p_event;
Ref<InputEventJoypadMotion> jp_motion = p_event;
Ref<InputEventJoypadButton> jp_button = p_event;
diff --git a/editor/export/editor_export.cpp b/editor/export/editor_export.cpp
index cc96107f97..bc429e1111 100644
--- a/editor/export/editor_export.cpp
+++ b/editor/export/editor_export.cpp
@@ -45,6 +45,7 @@ void EditorExport::_save() {
config->set_value(section, "name", preset->get_name());
config->set_value(section, "platform", preset->get_platform()->get_name());
config->set_value(section, "runnable", preset->is_runnable());
+ config->set_value(section, "dedicated_server", preset->is_dedicated_server());
config->set_value(section, "custom_features", preset->get_custom_features());
bool save_files = false;
@@ -64,6 +65,11 @@ void EditorExport::_save() {
config->set_value(section, "export_filter", "exclude");
save_files = true;
} break;
+ case EditorExportPreset::EXPORT_CUSTOMIZED: {
+ config->set_value(section, "export_filter", "customized");
+ config->set_value(section, "customized_files", preset->get_customized_files());
+ save_files = false;
+ };
}
if (save_files) {
@@ -77,7 +83,6 @@ void EditorExport::_save() {
config->set_value(section, "encryption_exclude_filters", preset->get_enc_ex_filter());
config->set_value(section, "encrypt_pck", preset->get_enc_pck());
config->set_value(section, "encrypt_directory", preset->get_enc_directory());
- config->set_value(section, "script_export_mode", preset->get_script_export_mode());
config->set_value(section, "script_encryption_key", preset->get_script_encryption_key());
String option_section = "preset." + itos(i) + ".options";
@@ -124,10 +129,20 @@ void EditorExport::add_export_preset(const Ref<EditorExportPreset> &p_preset, in
}
String EditorExportPlatform::test_etc2() const {
- const bool etc2_supported = GLOBAL_GET("rendering/textures/vram_compression/import_etc2");
+ const bool etc2_supported = GLOBAL_GET("rendering/textures/vram_compression/import_etc2_astc");
if (!etc2_supported) {
- return TTR("Target platform requires 'ETC2' texture compression. Enable 'Import Etc 2' in Project Settings.");
+ return TTR("Target platform requires 'ETC2/ASTC' texture compression. Enable 'Import ETC2 ASTC' in Project Settings.");
+ }
+
+ return String();
+}
+
+String EditorExportPlatform::test_bc() const {
+ const bool bc_supported = GLOBAL_GET("rendering/textures/vram_compression/import_s3tc_bptc");
+
+ if (!bc_supported) {
+ return TTR("Target platform requires 'S3TC/BPTC' texture compression. Enable 'Import S3TC BPTC' in Project Settings.");
}
return String();
@@ -214,6 +229,7 @@ void EditorExport::load_config() {
preset->set_name(config->get_value(section, "name"));
preset->set_runnable(config->get_value(section, "runnable"));
+ preset->set_dedicated_server(config->get_value(section, "dedicated_server", false));
if (config->has_section_key(section, "custom_features")) {
preset->set_custom_features(config->get_value(section, "custom_features"));
@@ -234,6 +250,10 @@ void EditorExport::load_config() {
} else if (export_filter == "exclude") {
preset->set_export_filter(EditorExportPreset::EXCLUDE_SELECTED_RESOURCES);
get_files = true;
+ } else if (export_filter == "customized") {
+ preset->set_export_filter(EditorExportPreset::EXPORT_CUSTOMIZED);
+ preset->set_customized_files(config->get_value(section, "customized_files", Dictionary()));
+ get_files = false;
}
if (get_files) {
@@ -264,9 +284,6 @@ void EditorExport::load_config() {
if (config->has_section_key(section, "encryption_exclude_filters")) {
preset->set_enc_ex_filter(config->get_value(section, "encryption_exclude_filters"));
}
- if (config->has_section_key(section, "script_export_mode")) {
- preset->set_script_export_mode(config->get_value(section, "script_export_mode"));
- }
if (config->has_section_key(section, "script_encryption_key")) {
preset->set_script_encryption_key(config->get_value(section, "script_encryption_key"));
}
diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp
index cacd181ad8..a46484bb0e 100644
--- a/editor/export/editor_export_platform.cpp
+++ b/editor/export/editor_export_platform.cpp
@@ -343,6 +343,24 @@ void EditorExportPlatform::_export_find_resources(EditorFileSystemDirectory *p_d
}
}
+void EditorExportPlatform::_export_find_customized_resources(const Ref<EditorExportPreset> &p_preset, EditorFileSystemDirectory *p_dir, EditorExportPreset::FileExportMode p_mode, HashSet<String> &p_paths) {
+ for (int i = 0; i < p_dir->get_subdir_count(); i++) {
+ EditorFileSystemDirectory *subdir = p_dir->get_subdir(i);
+ _export_find_customized_resources(p_preset, subdir, p_preset->get_file_export_mode(subdir->get_path(), p_mode), p_paths);
+ }
+
+ for (int i = 0; i < p_dir->get_file_count(); i++) {
+ if (p_dir->get_file_type(i) == "TextFile") {
+ continue;
+ }
+ String path = p_dir->get_file_path(i);
+ EditorExportPreset::FileExportMode file_mode = p_preset->get_file_export_mode(path, p_mode);
+ if (file_mode != EditorExportPreset::MODE_FILE_REMOVE) {
+ p_paths.insert(path);
+ }
+ }
+}
+
void EditorExportPlatform::_export_find_dependencies(const String &p_path, HashSet<String> &p_paths) {
if (p_paths.has(p_path)) {
return;
@@ -503,8 +521,8 @@ bool EditorExportPlatform::_export_customize_dictionary(Dictionary &dict, LocalV
case Variant::OBJECT: {
Ref<Resource> res = v;
if (res.is_valid()) {
- for (uint32_t j = 0; j < customize_resources_plugins.size(); j++) {
- Ref<Resource> new_res = customize_resources_plugins[j]->_customize_resource(res, "");
+ for (Ref<EditorExportPlugin> &plugin : customize_resources_plugins) {
+ Ref<Resource> new_res = plugin->_customize_resource(res, "");
if (new_res.is_valid()) {
changed = true;
if (new_res != res) {
@@ -550,8 +568,8 @@ bool EditorExportPlatform::_export_customize_array(Array &arr, LocalVector<Ref<E
case Variant::OBJECT: {
Ref<Resource> res = v;
if (res.is_valid()) {
- for (uint32_t j = 0; j < customize_resources_plugins.size(); j++) {
- Ref<Resource> new_res = customize_resources_plugins[j]->_customize_resource(res, "");
+ for (Ref<EditorExportPlugin> &plugin : customize_resources_plugins) {
+ Ref<Resource> new_res = plugin->_customize_resource(res, "");
if (new_res.is_valid()) {
changed = true;
if (new_res != res) {
@@ -597,8 +615,8 @@ bool EditorExportPlatform::_export_customize_object(Object *p_object, LocalVecto
case Variant::OBJECT: {
Ref<Resource> res = p_object->get(E.name);
if (res.is_valid()) {
- for (uint32_t j = 0; j < customize_resources_plugins.size(); j++) {
- Ref<Resource> new_res = customize_resources_plugins[j]->_customize_resource(res, "");
+ for (Ref<EditorExportPlugin> &plugin : customize_resources_plugins) {
+ Ref<Resource> new_res = plugin->_customize_resource(res, "");
if (new_res.is_valid()) {
changed = true;
if (new_res != res) {
@@ -639,10 +657,20 @@ bool EditorExportPlatform::_export_customize_object(Object *p_object, LocalVecto
return changed;
}
+bool EditorExportPlatform::_is_editable_ancestor(Node *p_root, Node *p_node) {
+ while (p_node != nullptr && p_node != p_root) {
+ if (p_root->is_editable_instance(p_node)) {
+ return true;
+ }
+ p_node = p_node->get_owner();
+ }
+ return false;
+}
+
bool EditorExportPlatform::_export_customize_scene_resources(Node *p_root, Node *p_node, LocalVector<Ref<EditorExportPlugin>> &customize_resources_plugins) {
bool changed = false;
- if (p_node == p_root || p_node->get_owner() == p_root) {
+ if (p_root == p_node || p_node->get_owner() == p_root || _is_editable_ancestor(p_root, p_node)) {
if (_export_customize_object(p_node, customize_resources_plugins)) {
changed = true;
}
@@ -715,16 +743,16 @@ String EditorExportPlatform::_export_customize(const String &p_path, LocalVector
ERR_FAIL_COND_V(ps.is_null(), p_path);
Node *node = ps->instantiate(PackedScene::GEN_EDIT_STATE_INSTANCE); // Make sure the child scene root gets the correct inheritance chain.
ERR_FAIL_COND_V(node == nullptr, p_path);
- if (customize_scenes_plugins.size()) {
- for (uint32_t i = 0; i < customize_scenes_plugins.size(); i++) {
- Node *customized = customize_scenes_plugins[i]->_customize_scene(node, p_path);
+ if (!customize_scenes_plugins.is_empty()) {
+ for (Ref<EditorExportPlugin> &plugin : customize_scenes_plugins) {
+ Node *customized = plugin->_customize_scene(node, p_path);
if (customized != nullptr) {
node = customized;
modified = true;
}
}
}
- if (customize_resources_plugins.size()) {
+ if (!customize_resources_plugins.is_empty()) {
if (_export_customize_scene_resources(node, node, customize_resources_plugins)) {
modified = true;
}
@@ -746,9 +774,9 @@ String EditorExportPlatform::_export_customize(const String &p_path, LocalVector
Ref<Resource> res = ResourceLoader::load(p_path, "", ResourceFormatLoader::CACHE_MODE_IGNORE);
ERR_FAIL_COND_V(res.is_null(), p_path);
- if (customize_resources_plugins.size()) {
- for (uint32_t i = 0; i < customize_resources_plugins.size(); i++) {
- Ref<Resource> new_res = customize_resources_plugins[i]->_customize_resource(res, p_path);
+ if (!customize_resources_plugins.is_empty()) {
+ for (Ref<EditorExportPlugin> &plugin : customize_resources_plugins) {
+ Ref<Resource> new_res = plugin->_customize_resource(res, p_path);
if (new_res.is_valid()) {
modified = true;
if (new_res != res) {
@@ -786,7 +814,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
HashSet<String> paths;
Vector<String> path_remaps;
- paths.insert(ProjectSettings::get_singleton()->get_project_data_path().path_join("global_script_class_cache.cfg"));
+ paths.insert(ProjectSettings::get_singleton()->get_global_class_list_path());
if (p_preset->get_export_filter() == EditorExportPreset::EXPORT_ALL_RESOURCES) {
//find stuff
_export_find_resources(EditorFileSystem::get_singleton()->get_filesystem(), paths);
@@ -796,6 +824,8 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
for (int i = 0; i < files.size(); i++) {
paths.erase(files[i]);
}
+ } else if (p_preset->get_export_filter() == EditorExportPreset::EXPORT_CUSTOMIZED) {
+ _export_find_customized_resources(p_preset, EditorFileSystem::get_singleton()->get_filesystem(), p_preset->get_file_export_mode("res://"), paths);
} else {
bool scenes_only = p_preset->get_export_filter() == EditorExportPreset::EXPORT_SELECTED_SCENES;
@@ -939,14 +969,14 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
LocalVector<Ref<EditorExportPlugin>> customize_scenes_plugins;
for (int i = 0; i < export_plugins.size(); i++) {
- if (export_plugins[i]->_begin_customize_resources(Ref<EditorExportPlatform>(this), features_psa)) {
+ if (export_plugins.write[i]->_begin_customize_resources(Ref<EditorExportPlatform>(this), features_psa)) {
customize_resources_plugins.push_back(export_plugins[i]);
custom_resources_hash = hash_murmur3_one_64(export_plugins[i]->_get_name().hash64(), custom_resources_hash);
uint64_t hash = export_plugins[i]->_get_customization_configuration_hash();
custom_resources_hash = hash_murmur3_one_64(hash, custom_resources_hash);
}
- if (export_plugins[i]->_begin_customize_scenes(Ref<EditorExportPlatform>(this), features_psa)) {
+ if (export_plugins.write[i]->_begin_customize_scenes(Ref<EditorExportPlatform>(this), features_psa)) {
customize_scenes_plugins.push_back(export_plugins[i]);
custom_resources_hash = hash_murmur3_one_64(export_plugins[i]->_get_name().hash64(), custom_resources_hash);
@@ -960,7 +990,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
bool convert_text_to_binary = GLOBAL_GET("editor/export/convert_text_resources_to_binary");
- if (convert_text_to_binary || customize_resources_plugins.size() || customize_scenes_plugins.size()) {
+ if (convert_text_to_binary || !customize_resources_plugins.is_empty() || !customize_scenes_plugins.is_empty()) {
// See if we have something to open
Ref<FileAccess> f = FileAccess::open(export_base_path.path_join("file_cache"), FileAccess::READ);
if (f.is_valid()) {
@@ -1179,7 +1209,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
idx++;
}
- if (convert_text_to_binary || customize_resources_plugins.size() || customize_scenes_plugins.size()) {
+ if (convert_text_to_binary || !customize_resources_plugins.is_empty() || !customize_scenes_plugins.is_empty()) {
// End scene customization
String fcache = export_base_path.path_join("file_cache");
@@ -1196,12 +1226,12 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
ERR_PRINT("Error opening export file cache: " + fcache);
}
- for (uint32_t i = 0; i < customize_resources_plugins.size(); i++) {
- customize_resources_plugins[i]->_end_customize_resources();
+ for (Ref<EditorExportPlugin> &plugin : customize_resources_plugins) {
+ plugin->_end_customize_resources();
}
- for (uint32_t i = 0; i < customize_scenes_plugins.size(); i++) {
- customize_scenes_plugins[i]->_end_customize_scenes();
+ for (Ref<EditorExportPlugin> &plugin : customize_scenes_plugins) {
+ plugin->_end_customize_scenes();
}
}
//save config!
@@ -1218,6 +1248,9 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
}
}
}
+ for (int i = 0; i < export_plugins.size(); i++) {
+ custom_list.append_array(export_plugins[i]->_get_export_features(Ref<EditorExportPlatform>(this), p_debug));
+ }
ProjectSettings::CustomMap custom_map;
if (path_remaps.size()) {
@@ -1294,7 +1327,9 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
} else {
// Use default text server data.
String icu_data_file = EditorPaths::get_singleton()->get_cache_dir().path_join("tmp_icu_data");
- TS->save_support_data(icu_data_file);
+ if (!TS->save_support_data(icu_data_file)) {
+ return ERR_INVALID_DATA;
+ }
Vector<uint8_t> array = FileAccess::get_file_as_bytes(icu_data_file);
err = p_func(p_udata, ts_data, array, idx, total, enc_in_filters, enc_ex_filters, key);
DirAccess::remove_file_or_error(icu_data_file);
@@ -1767,6 +1802,13 @@ Error EditorExportPlatform::ssh_run_on_remote(const String &p_host, const String
List<String> args;
args.push_back("-p");
args.push_back(p_port);
+ args.push_back("-q");
+ args.push_back("-o");
+ args.push_back("LogLevel=error");
+ args.push_back("-o");
+ args.push_back("BatchMode=yes");
+ args.push_back("-o");
+ args.push_back("StrictHostKeyChecking=no");
for (const String &E : p_ssh_args) {
args.push_back(E);
}
@@ -1817,6 +1859,13 @@ Error EditorExportPlatform::ssh_run_on_remote_no_wait(const String &p_host, cons
List<String> args;
args.push_back("-p");
args.push_back(p_port);
+ args.push_back("-q");
+ args.push_back("-o");
+ args.push_back("LogLevel=error");
+ args.push_back("-o");
+ args.push_back("BatchMode=yes");
+ args.push_back("-o");
+ args.push_back("StrictHostKeyChecking=no");
for (const String &E : p_ssh_args) {
args.push_back(E);
}
@@ -1847,6 +1896,13 @@ Error EditorExportPlatform::ssh_push_to_remote(const String &p_host, const Strin
List<String> args;
args.push_back("-P");
args.push_back(p_port);
+ args.push_back("-q");
+ args.push_back("-o");
+ args.push_back("LogLevel=error");
+ args.push_back("-o");
+ args.push_back("BatchMode=yes");
+ args.push_back("-o");
+ args.push_back("StrictHostKeyChecking=no");
for (const String &E : p_scp_args) {
args.push_back(E);
}
diff --git a/editor/export/editor_export_platform.h b/editor/export/editor_export_platform.h
index 1fb35759ac..05d985eb6a 100644
--- a/editor/export/editor_export_platform.h
+++ b/editor/export/editor_export_platform.h
@@ -91,6 +91,7 @@ private:
Vector<ExportMessage> messages;
void _export_find_resources(EditorFileSystemDirectory *p_dir, HashSet<String> &p_paths);
+ void _export_find_customized_resources(const Ref<EditorExportPreset> &p_preset, EditorFileSystemDirectory *p_dir, EditorExportPreset::FileExportMode p_mode, HashSet<String> &p_paths);
void _export_find_dependencies(const String &p_path, HashSet<String> &p_paths);
static Error _save_pack_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key);
@@ -112,6 +113,7 @@ private:
bool _export_customize_array(Array &array, LocalVector<Ref<EditorExportPlugin>> &customize_resources_plugins);
bool _export_customize_object(Object *p_object, LocalVector<Ref<EditorExportPlugin>> &customize_resources_plugins);
bool _export_customize_scene_resources(Node *p_root, Node *p_node, LocalVector<Ref<EditorExportPlugin>> &customize_resources_plugins);
+ bool _is_editable_ancestor(Node *p_root, Node *p_node);
String _export_customize(const String &p_path, LocalVector<Ref<EditorExportPlugin>> &customize_resources_plugins, LocalVector<Ref<EditorExportPlugin>> &customize_scenes_plugins, HashMap<String, FileExportCache> &export_cache, const String &export_base_path, bool p_force_save);
@@ -227,6 +229,7 @@ public:
virtual Ref<Texture2D> get_run_icon() const { return get_logo(); }
String test_etc2() const;
+ String test_bc() const;
bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const;
virtual bool has_valid_export_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const = 0;
virtual bool has_valid_project_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error) const = 0;
diff --git a/editor/export/editor_export_plugin.cpp b/editor/export/editor_export_plugin.cpp
index 784dbc116a..0add55820f 100644
--- a/editor/export/editor_export_plugin.cpp
+++ b/editor/export/editor_export_plugin.cpp
@@ -141,7 +141,7 @@ void EditorExportPlugin::_export_end_script() {
// Customization
-bool EditorExportPlugin::_begin_customize_resources(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features) const {
+bool EditorExportPlugin::_begin_customize_resources(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features) {
bool ret = false;
GDVIRTUAL_CALL(_begin_customize_resources, p_platform, p_features, ret);
return ret;
@@ -153,7 +153,7 @@ Ref<Resource> EditorExportPlugin::_customize_resource(const Ref<Resource> &p_res
return ret;
}
-bool EditorExportPlugin::_begin_customize_scenes(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features) const {
+bool EditorExportPlugin::_begin_customize_scenes(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features) {
bool ret = false;
GDVIRTUAL_CALL(_begin_customize_scenes, p_platform, p_features, ret);
return ret;
@@ -185,6 +185,12 @@ String EditorExportPlugin::_get_name() const {
return ret;
}
+PackedStringArray EditorExportPlugin::_get_export_features(const Ref<EditorExportPlatform> &p_platform, bool p_debug) const {
+ PackedStringArray ret;
+ GDVIRTUAL_CALL(_get_export_features, p_platform, p_debug, ret);
+ return ret;
+}
+
void EditorExportPlugin::_export_file(const String &p_path, const String &p_type, const HashSet<String> &p_features) {
}
@@ -227,8 +233,6 @@ void EditorExportPlugin::_bind_methods() {
}
EditorExportPlugin::EditorExportPlugin() {
- GLOBAL_DEF("editor/export/convert_text_resources_to_binary", false);
-
EDITOR_DEF("export/ssh/ssh", "");
EDITOR_DEF("export/ssh/scp", "");
}
diff --git a/editor/export/editor_export_plugin.h b/editor/export/editor_export_plugin.h
index 5ac0a70c3e..fad647a67b 100644
--- a/editor/export/editor_export_plugin.h
+++ b/editor/export/editor_export_plugin.h
@@ -120,18 +120,22 @@ protected:
GDVIRTUAL0(_end_customize_scenes)
GDVIRTUAL0(_end_customize_resources)
+ GDVIRTUAL2RC(PackedStringArray, _get_export_features, const Ref<EditorExportPlatform> &, bool);
+
GDVIRTUAL0RC(String, _get_name)
- bool _begin_customize_resources(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features) const; // Return true if this plugin does property export customization
- Ref<Resource> _customize_resource(const Ref<Resource> &p_resource, const String &p_path); // If nothing is returned, it means do not touch (nothing changed). If something is returned (either the same or a different resource) it means changes are made.
+ virtual bool _begin_customize_resources(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features); // Return true if this plugin does property export customization
+ virtual Ref<Resource> _customize_resource(const Ref<Resource> &p_resource, const String &p_path); // If nothing is returned, it means do not touch (nothing changed). If something is returned (either the same or a different resource) it means changes are made.
+
+ virtual bool _begin_customize_scenes(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features); // Return true if this plugin does property export customization
+ virtual Node *_customize_scene(Node *p_root, const String &p_path); // Return true if a change was made
- bool _begin_customize_scenes(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features) const; // Return true if this plugin does property export customization
- Node *_customize_scene(Node *p_root, const String &p_path); // Return true if a change was made
+ virtual uint64_t _get_customization_configuration_hash() const; // Hash used for caching customized resources and scenes.
- uint64_t _get_customization_configuration_hash() const; // Hash used for caching customized resources and scenes.
+ virtual void _end_customize_scenes();
+ virtual void _end_customize_resources();
- void _end_customize_scenes();
- void _end_customize_resources();
+ virtual PackedStringArray _get_export_features(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;
virtual String _get_name() const;
diff --git a/editor/export/editor_export_preset.cpp b/editor/export/editor_export_preset.cpp
index 6cd8e85e6a..6beef623bc 100644
--- a/editor/export/editor_export_preset.cpp
+++ b/editor/export/editor_export_preset.cpp
@@ -64,15 +64,29 @@ Ref<EditorExportPlatform> EditorExportPreset::get_platform() const {
return platform;
}
-void EditorExportPreset::update_files_to_export() {
- Vector<String> to_remove;
- for (const String &E : selected_files) {
- if (!FileAccess::exists(E)) {
- to_remove.push_back(E);
+void EditorExportPreset::update_files() {
+ {
+ Vector<String> to_remove;
+ for (const String &E : selected_files) {
+ if (!FileAccess::exists(E)) {
+ to_remove.push_back(E);
+ }
+ }
+ for (int i = 0; i < to_remove.size(); ++i) {
+ selected_files.erase(to_remove[i]);
}
}
- for (int i = 0; i < to_remove.size(); ++i) {
- selected_files.erase(to_remove[i]);
+
+ {
+ Vector<String> to_remove;
+ for (const KeyValue<String, FileExportMode> &E : customized_files) {
+ if (!FileAccess::exists(E.key) && !DirAccess::exists(E.key)) {
+ to_remove.push_back(E.key);
+ }
+ }
+ for (int i = 0; i < to_remove.size(); ++i) {
+ customized_files.erase(to_remove[i]);
+ }
}
}
@@ -84,6 +98,48 @@ Vector<String> EditorExportPreset::get_files_to_export() const {
return files;
}
+Dictionary EditorExportPreset::get_customized_files() const {
+ Dictionary files;
+ for (const KeyValue<String, FileExportMode> &E : customized_files) {
+ String mode;
+ switch (E.value) {
+ case MODE_FILE_NOT_CUSTOMIZED: {
+ continue;
+ } break;
+ case MODE_FILE_STRIP: {
+ mode = "strip";
+ } break;
+ case MODE_FILE_KEEP: {
+ mode = "keep";
+ } break;
+ case MODE_FILE_REMOVE: {
+ mode = "remove";
+ }
+ }
+ files[E.key] = mode;
+ }
+ return files;
+}
+
+int EditorExportPreset::get_customized_files_count() const {
+ return customized_files.size();
+}
+
+void EditorExportPreset::set_customized_files(const Dictionary &p_files) {
+ for (const Variant *key = p_files.next(nullptr); key; key = p_files.next(key)) {
+ EditorExportPreset::FileExportMode mode = EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED;
+ String value = p_files[*key];
+ if (value == "strip") {
+ mode = EditorExportPreset::MODE_FILE_STRIP;
+ } else if (value == "keep") {
+ mode = EditorExportPreset::MODE_FILE_KEEP;
+ } else if (value == "remove") {
+ mode = EditorExportPreset::MODE_FILE_REMOVE;
+ }
+ set_file_export_mode(*key, mode);
+ }
+}
+
void EditorExportPreset::set_name(const String &p_name) {
name = p_name;
EditorExport::singleton->save_presets();
@@ -102,6 +158,15 @@ bool EditorExportPreset::is_runnable() const {
return runnable;
}
+void EditorExportPreset::set_dedicated_server(bool p_enable) {
+ dedicated_server = p_enable;
+ EditorExport::singleton->save_presets();
+}
+
+bool EditorExportPreset::is_dedicated_server() const {
+ return dedicated_server;
+}
+
void EditorExportPreset::set_export_filter(ExportFilter p_filter) {
export_filter = p_filter;
EditorExport::singleton->save_presets();
@@ -158,6 +223,23 @@ bool EditorExportPreset::has_export_file(const String &p_path) {
return selected_files.has(p_path);
}
+void EditorExportPreset::set_file_export_mode(const String &p_path, EditorExportPreset::FileExportMode p_mode) {
+ if (p_mode == FileExportMode::MODE_FILE_NOT_CUSTOMIZED) {
+ customized_files.erase(p_path);
+ } else {
+ customized_files.insert(p_path, p_mode);
+ }
+ EditorExport::singleton->save_presets();
+}
+
+EditorExportPreset::FileExportMode EditorExportPreset::get_file_export_mode(const String &p_path, EditorExportPreset::FileExportMode p_default) const {
+ HashMap<String, FileExportMode>::ConstIterator i = customized_files.find(p_path);
+ if (i) {
+ return i->value;
+ }
+ return p_default;
+}
+
void EditorExportPreset::set_custom_features(const String &p_custom_features) {
custom_features = p_custom_features;
EditorExport::singleton->save_presets();
@@ -203,15 +285,6 @@ bool EditorExportPreset::get_enc_directory() const {
return enc_directory;
}
-void EditorExportPreset::set_script_export_mode(int p_mode) {
- script_mode = p_mode;
- EditorExport::singleton->save_presets();
-}
-
-int EditorExportPreset::get_script_export_mode() const {
- return script_mode;
-}
-
void EditorExportPreset::set_script_encryption_key(const String &p_key) {
script_key = p_key;
EditorExport::singleton->save_presets();
diff --git a/editor/export/editor_export_preset.h b/editor/export/editor_export_preset.h
index 2055416d4b..db139d8860 100644
--- a/editor/export/editor_export_preset.h
+++ b/editor/export/editor_export_preset.h
@@ -44,11 +44,14 @@ public:
EXPORT_SELECTED_SCENES,
EXPORT_SELECTED_RESOURCES,
EXCLUDE_SELECTED_RESOURCES,
+ EXPORT_CUSTOMIZED,
};
- enum ScriptExportMode {
- MODE_SCRIPT_TEXT,
- MODE_SCRIPT_COMPILED,
+ enum FileExportMode {
+ MODE_FILE_NOT_CUSTOMIZED,
+ MODE_FILE_STRIP,
+ MODE_FILE_KEEP,
+ MODE_FILE_REMOVE,
};
private:
@@ -60,7 +63,9 @@ private:
String exporter;
HashSet<String> selected_files;
+ HashMap<String, FileExportMode> customized_files;
bool runnable = false;
+ bool dedicated_server = false;
friend class EditorExport;
friend class EditorExportPlatform;
@@ -78,7 +83,6 @@ private:
bool enc_pck = false;
bool enc_directory = false;
- int script_mode = MODE_SCRIPT_COMPILED;
String script_key;
protected:
@@ -91,20 +95,29 @@ public:
bool has(const StringName &p_property) const { return values.has(p_property); }
- void update_files_to_export();
+ void update_files();
Vector<String> get_files_to_export() const;
+ Dictionary get_customized_files() const;
+ int get_customized_files_count() const;
+ void set_customized_files(const Dictionary &p_files);
void add_export_file(const String &p_path);
void remove_export_file(const String &p_path);
bool has_export_file(const String &p_path);
+ void set_file_export_mode(const String &p_path, FileExportMode p_mode);
+ FileExportMode get_file_export_mode(const String &p_path, FileExportMode p_default = MODE_FILE_NOT_CUSTOMIZED) const;
+
void set_name(const String &p_name);
String get_name() const;
void set_runnable(bool p_enable);
bool is_runnable() const;
+ void set_dedicated_server(bool p_enable);
+ bool is_dedicated_server() const;
+
void set_export_filter(ExportFilter p_filter);
ExportFilter get_export_filter() const;
@@ -132,9 +145,6 @@ public:
void set_enc_directory(bool p_enabled);
bool get_enc_directory() const;
- void set_script_export_mode(int p_mode);
- int get_script_export_mode() const;
-
void set_script_encryption_key(const String &p_key);
String get_script_encryption_key() const;
diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp
index e099acca00..52c192164f 100644
--- a/editor/export/project_export.cpp
+++ b/editor/export/project_export.cpp
@@ -45,6 +45,7 @@
#include "scene/gui/link_button.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/option_button.h"
+#include "scene/gui/popup_menu.h"
#include "scene/gui/split_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/tree.h"
@@ -165,7 +166,7 @@ void ProjectExportDialog::_update_presets() {
if (preset->is_runnable()) {
preset_name += " (" + TTR("Runnable") + ")";
}
- preset->update_files_to_export();
+ preset->update_files();
presets->add_item(preset_name, preset->get_platform()->get_logo());
}
@@ -244,6 +245,7 @@ void ProjectExportDialog::_edit_preset(int p_index) {
export_filter->select(current->get_export_filter());
include_filters->set_text(current->get_include_filter());
exclude_filters->set_text(current->get_exclude_filter());
+ server_strip_message->set_visible(current->get_export_filter() == EditorExportPreset::EXPORT_CUSTOMIZED);
_fill_resource_tree();
@@ -317,9 +319,6 @@ void ProjectExportDialog::_edit_preset(int p_index) {
bool enc_directory_mode = current->get_enc_directory();
enc_directory->set_pressed(enc_directory_mode);
- int script_export_mode = current->get_script_export_mode();
- script_mode->select(script_export_mode);
-
String key = current->get_script_encryption_key();
if (!updating_script_key) {
script_key->set_text(key);
@@ -513,19 +512,6 @@ void ProjectExportDialog::_enc_directory_changed(bool p_pressed) {
_update_current_preset();
}
-void ProjectExportDialog::_script_export_mode_changed(int p_mode) {
- if (updating) {
- return;
- }
-
- Ref<EditorExportPreset> current = get_current_preset();
- ERR_FAIL_COND(current.is_null());
-
- current->set_script_export_mode(p_mode);
-
- _update_current_preset();
-}
-
void ProjectExportDialog::_script_encryption_key_changed(const String &p_key) {
if (updating) {
return;
@@ -586,6 +572,7 @@ void ProjectExportDialog::_duplicate_preset() {
if (make_runnable) {
preset->set_runnable(make_runnable);
}
+ preset->set_dedicated_server(current->is_dedicated_server());
preset->set_export_filter(current->get_export_filter());
preset->set_include_filter(current->get_include_filter());
preset->set_exclude_filter(current->get_exclude_filter());
@@ -708,7 +695,16 @@ void ProjectExportDialog::_export_type_changed(int p_which) {
return;
}
- current->set_export_filter(EditorExportPreset::ExportFilter(p_which));
+ EditorExportPreset::ExportFilter filter_type = (EditorExportPreset::ExportFilter)p_which;
+ current->set_export_filter(filter_type);
+ current->set_dedicated_server(filter_type == EditorExportPreset::EXPORT_CUSTOMIZED);
+ server_strip_message->set_visible(filter_type == EditorExportPreset::EXPORT_CUSTOMIZED);
+
+ // Default to stripping everything when first switching to server build.
+ if (filter_type == EditorExportPreset::EXPORT_CUSTOMIZED && current->get_customized_files_count() == 0) {
+ current->set_file_export_mode("res://", EditorExportPreset::MODE_FILE_STRIP);
+ }
+
updating = true;
_fill_resource_tree();
updating = false;
@@ -744,25 +740,53 @@ void ProjectExportDialog::_fill_resource_tree() {
return;
}
+ TreeItem *root = include_files->create_item();
+
+ if (f == EditorExportPreset::EXPORT_CUSTOMIZED) {
+ include_files->set_columns(2);
+ include_files->set_column_expand(1, false);
+ include_files->set_column_custom_minimum_width(1, 250 * EDSCALE);
+ } else {
+ include_files->set_columns(1);
+ }
+
include_label->show();
include_margin->show();
- TreeItem *root = include_files->create_item();
+ _fill_tree(EditorFileSystem::get_singleton()->get_filesystem(), root, current, f);
+}
- _fill_tree(EditorFileSystem::get_singleton()->get_filesystem(), root, current, f == EditorExportPreset::EXPORT_SELECTED_SCENES);
+void ProjectExportDialog::_setup_item_for_file_mode(TreeItem *p_item, EditorExportPreset::FileExportMode p_mode) {
+ if (p_mode == EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED) {
+ p_item->set_checked(0, false);
+ p_item->set_cell_mode(1, TreeItem::CELL_MODE_STRING);
+ p_item->set_text(1, "");
+ p_item->set_editable(1, false);
+ p_item->set_selectable(1, false);
+ } else {
+ p_item->set_checked(0, true);
+ p_item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
+ p_item->set_text(1, file_mode_popup->get_item_text(file_mode_popup->get_item_index(p_mode)));
+ p_item->set_editable(1, true);
+ p_item->set_selectable(1, true);
+ }
}
-bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> &current, bool p_only_scenes) {
+bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> &current, EditorExportPreset::ExportFilter p_export_filter) {
p_item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
p_item->set_icon(0, presets->get_theme_icon(SNAME("folder"), SNAME("FileDialog")));
p_item->set_text(0, p_dir->get_name() + "/");
p_item->set_editable(0, true);
p_item->set_metadata(0, p_dir->get_path());
+ if (p_export_filter == EditorExportPreset::EXPORT_CUSTOMIZED) {
+ _setup_item_for_file_mode(p_item, current->get_file_export_mode(p_dir->get_path()));
+ }
+
bool used = false;
for (int i = 0; i < p_dir->get_subdir_count(); i++) {
TreeItem *subdir = include_files->create_item(p_item);
- if (_fill_tree(p_dir->get_subdir(i), subdir, current, p_only_scenes)) {
+ if (_fill_tree(p_dir->get_subdir(i), subdir, current, p_export_filter)) {
used = true;
} else {
memdelete(subdir);
@@ -771,7 +795,7 @@ bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem
for (int i = 0; i < p_dir->get_file_count(); i++) {
String type = p_dir->get_file_type(i);
- if (p_only_scenes && type != "PackedScene") {
+ if (p_export_filter == EditorExportPreset::EXPORT_SELECTED_SCENES && type != "PackedScene") {
continue;
}
if (type == "TextFile") {
@@ -786,9 +810,14 @@ bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem
file->set_icon(0, EditorNode::get_singleton()->get_class_icon(type));
file->set_editable(0, true);
- file->set_checked(0, current->has_export_file(path));
file->set_metadata(0, path);
- file->propagate_check(0);
+
+ if (p_export_filter == EditorExportPreset::EXPORT_CUSTOMIZED) {
+ _setup_item_for_file_mode(file, current->get_file_export_mode(path));
+ } else {
+ file->set_checked(0, current->has_export_file(path));
+ file->propagate_check(0);
+ }
used = true;
}
@@ -810,7 +839,19 @@ void ProjectExportDialog::_tree_changed() {
return;
}
- item->propagate_check(0);
+ if (current->get_export_filter() == EditorExportPreset::EXPORT_CUSTOMIZED) {
+ EditorExportPreset::FileExportMode file_mode = EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED;
+ String path = item->get_metadata(0);
+
+ if (item->is_checked(0)) {
+ file_mode = current->get_file_export_mode(path, EditorExportPreset::MODE_FILE_STRIP);
+ }
+
+ _setup_item_for_file_mode(item, file_mode);
+ current->set_file_export_mode(path, file_mode);
+ } else {
+ item->propagate_check(0);
+ }
}
void ProjectExportDialog::_check_propagated_to_item(Object *p_obj, int column) {
@@ -830,6 +871,30 @@ void ProjectExportDialog::_check_propagated_to_item(Object *p_obj, int column) {
}
}
+void ProjectExportDialog::_tree_popup_edited(bool p_arrow_clicked) {
+ Rect2 bounds = include_files->get_custom_popup_rect();
+ bounds.position += get_global_canvas_transform().get_origin();
+ bounds.size *= get_global_canvas_transform().get_scale();
+ if (!is_embedding_subwindows()) {
+ bounds.position += get_position();
+ }
+ file_mode_popup->popup(bounds);
+}
+
+void ProjectExportDialog::_set_file_export_mode(int p_id) {
+ Ref<EditorExportPreset> current = get_current_preset();
+ if (current.is_null()) {
+ return;
+ }
+
+ TreeItem *item = include_files->get_edited();
+ String path = item->get_metadata(0);
+
+ current->set_file_export_mode(path, (EditorExportPreset::FileExportMode)p_id);
+
+ item->set_text(1, file_mode_popup->get_item_text(file_mode_popup->get_item_index(p_id)));
+}
+
void ProjectExportDialog::_export_pck_zip() {
Ref<EditorExportPreset> current = get_current_preset();
ERR_FAIL_COND(current.is_null());
@@ -1084,6 +1149,7 @@ ProjectExportDialog::ProjectExportDialog() {
export_filter->add_item(TTR("Export selected scenes (and dependencies)"));
export_filter->add_item(TTR("Export selected resources (and dependencies)"));
export_filter->add_item(TTR("Export all resources in the project except resources checked below"));
+ export_filter->add_item(TTR("Export as dedicated server"));
resources_vb->add_margin_child(TTR("Export Mode:"), export_filter);
export_filter->connect("item_selected", callable_mp(this, &ProjectExportDialog::_export_type_changed));
@@ -1098,6 +1164,36 @@ ProjectExportDialog::ProjectExportDialog() {
include_margin->add_child(include_files);
include_files->connect("item_edited", callable_mp(this, &ProjectExportDialog::_tree_changed));
include_files->connect("check_propagated_to_item", callable_mp(this, &ProjectExportDialog::_check_propagated_to_item));
+ include_files->connect("custom_popup_edited", callable_mp(this, &ProjectExportDialog::_tree_popup_edited));
+
+ server_strip_message = memnew(Label);
+ server_strip_message->set_visible(false);
+ server_strip_message->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART);
+ resources_vb->add_child(server_strip_message);
+
+ {
+ List<StringName> resource_names;
+ ClassDB::get_inheriters_from_class("Resource", &resource_names);
+
+ PackedStringArray strippable;
+ for (StringName resource_name : resource_names) {
+ if (ClassDB::has_method(resource_name, "create_placeholder", true)) {
+ strippable.push_back(resource_name);
+ }
+ }
+ strippable.sort();
+
+ String message = TTR("\"Strip Visuals\" will replace the following resources with placeholders:") + " ";
+ message += String(", ").join(strippable);
+ server_strip_message->set_text(message);
+ }
+
+ file_mode_popup = memnew(PopupMenu);
+ add_child(file_mode_popup);
+ file_mode_popup->add_item(TTR("Strip Visuals"), EditorExportPreset::MODE_FILE_STRIP);
+ file_mode_popup->add_item(TTR("Keep"), EditorExportPreset::MODE_FILE_KEEP);
+ file_mode_popup->add_item(TTR("Remove"), EditorExportPreset::MODE_FILE_REMOVE);
+ file_mode_popup->connect("id_pressed", callable_mp(this, &ProjectExportDialog::_set_file_export_mode));
include_filters = memnew(LineEdit);
resources_vb->add_margin_child(
@@ -1111,12 +1207,6 @@ ProjectExportDialog::ProjectExportDialog() {
exclude_filters);
exclude_filters->connect("text_changed", callable_mp(this, &ProjectExportDialog::_filter_changed));
- script_mode = memnew(OptionButton);
- resources_vb->add_margin_child(TTR("GDScript Export Mode:"), script_mode);
- script_mode->add_item(TTR("Text"), (int)EditorExportPreset::MODE_SCRIPT_TEXT);
- script_mode->add_item(TTR("Compiled Bytecode (Faster Loading)"), (int)EditorExportPreset::MODE_SCRIPT_COMPILED);
- script_mode->connect("item_selected", callable_mp(this, &ProjectExportDialog::_script_export_mode_changed));
-
// Feature tags.
VBoxContainer *feature_vb = memnew(VBoxContainer);
diff --git a/editor/export/project_export.h b/editor/export/project_export.h
index 1138d598cb..63f8fc4a2e 100644
--- a/editor/export/project_export.h
+++ b/editor/export/project_export.h
@@ -31,11 +31,11 @@
#ifndef PROJECT_EXPORT_H
#define PROJECT_EXPORT_H
+#include "editor/export/editor_export_preset.h"
#include "scene/gui/dialogs.h"
class CheckBox;
class CheckButton;
-class EditorExportPreset;
class EditorFileDialog;
class EditorFileSystemDirectory;
class EditorInspector;
@@ -43,6 +43,7 @@ class EditorPropertyPath;
class ItemList;
class MenuButton;
class OptionButton;
+class PopupMenu;
class RichTextLabel;
class TabContainer;
class Tree;
@@ -75,6 +76,8 @@ private:
LineEdit *include_filters = nullptr;
LineEdit *exclude_filters = nullptr;
Tree *include_files = nullptr;
+ Label *server_strip_message = nullptr;
+ PopupMenu *file_mode_popup = nullptr;
Label *include_label = nullptr;
MarginContainer *include_margin = nullptr;
@@ -86,7 +89,6 @@ private:
LineEdit *custom_features = nullptr;
RichTextLabel *custom_feature_display = nullptr;
- OptionButton *script_mode = nullptr;
LineEdit *script_key = nullptr;
Label *script_key_error = nullptr;
@@ -114,9 +116,12 @@ private:
void _export_type_changed(int p_which);
void _filter_changed(const String &p_filter);
void _fill_resource_tree();
- bool _fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> &current, bool p_only_scenes);
+ void _setup_item_for_file_mode(TreeItem *p_item, EditorExportPreset::FileExportMode p_mode);
+ bool _fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> &current, EditorExportPreset::ExportFilter p_export_filter);
void _tree_changed();
void _check_propagated_to_item(Object *p_obj, int column);
+ void _tree_popup_edited(bool p_arrow_clicked);
+ void _set_file_export_mode(int p_id);
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
@@ -152,7 +157,6 @@ private:
void _enc_pck_changed(bool p_pressed);
void _enc_directory_changed(bool p_pressed);
void _enc_filters_changed(const String &p_text);
- void _script_export_mode_changed(int p_mode);
void _script_encryption_key_changed(const String &p_key);
bool _validate_script_encryption_key(const String &p_key);
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 7ba60bfaad..378e06b4c9 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -1531,6 +1531,10 @@ void FileSystemDock::_make_scene_confirm() {
EditorNode::get_singleton()->save_scene_list({ scene_path });
}
+void FileSystemDock::_resource_removed(const Ref<Resource> &p_resource) {
+ emit_signal(SNAME("resource_removed"), p_resource);
+}
+
void FileSystemDock::_file_removed(String p_file) {
emit_signal(SNAME("file_removed"), p_file);
@@ -1819,6 +1823,43 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
OS::get_singleton()->shell_open(String("file://") + dir);
} break;
+ case FILE_OPEN_EXTERNAL: {
+ String fpath = path;
+ if (path == "Favorites") {
+ fpath = p_selected[0];
+ }
+
+ String file = ProjectSettings::get_singleton()->globalize_path(fpath);
+
+ String resource_type = ResourceLoader::get_resource_type(fpath);
+ String external_program;
+
+ if (resource_type == "CompressedTexture2D" || resource_type == "Image") {
+ if (file.get_extension() == "svg" || file.get_extension() == "svgz") {
+ external_program = EDITOR_GET("filesystem/external_programs/vector_image_editor");
+ } else {
+ external_program = EDITOR_GET("filesystem/external_programs/raster_image_editor");
+ }
+ } else if (ClassDB::is_parent_class(resource_type, "AudioStream")) {
+ external_program = EDITOR_GET("filesystem/external_programs/audio_editor");
+ } else if (resource_type == "PackedScene") {
+ // Ignore non-model scenes.
+ if (file.get_extension() != "tscn" && file.get_extension() != "scn" && file.get_extension() != "res") {
+ external_program = EDITOR_GET("filesystem/external_programs/3d_model_editor");
+ }
+ } else if (ClassDB::is_parent_class(resource_type, "Script")) {
+ external_program = EDITOR_GET("text_editor/external/exec_path");
+ }
+
+ if (external_program.is_empty()) {
+ OS::get_singleton()->shell_open(file);
+ } else {
+ List<String> args;
+ args.push_back(file);
+ OS::get_singleton()->create_process(external_program, args);
+ }
+ } break;
+
case FILE_OPEN: {
// Open folders.
TreeItem *selected = tree->get_root();
@@ -2590,18 +2631,29 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
if (p_paths.size() == 1) {
p_popup->add_separator();
if (p_display_path_dependent_options) {
- p_popup->add_icon_item(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")), TTR("New Folder..."), FILE_NEW_FOLDER);
- p_popup->add_icon_item(get_theme_icon(SNAME("PackedScene"), SNAME("EditorIcons")), TTR("New Scene..."), FILE_NEW_SCENE);
- p_popup->add_icon_item(get_theme_icon(SNAME("Script"), SNAME("EditorIcons")), TTR("New Script..."), FILE_NEW_SCRIPT);
- p_popup->add_icon_item(get_theme_icon(SNAME("Object"), SNAME("EditorIcons")), TTR("New Resource..."), FILE_NEW_RESOURCE);
- p_popup->add_icon_item(get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")), TTR("New TextFile..."), FILE_NEW_TEXTFILE);
+ PopupMenu *new_menu = memnew(PopupMenu);
+ new_menu->set_name("New");
+ new_menu->connect("id_pressed", callable_mp(this, &FileSystemDock::_tree_rmb_option));
+
+ p_popup->add_child(new_menu);
+ p_popup->add_submenu_item(TTR("New"), "New");
+
+ new_menu->add_icon_item(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")), TTR("Folder..."), FILE_NEW_FOLDER);
+ new_menu->add_icon_item(get_theme_icon(SNAME("PackedScene"), SNAME("EditorIcons")), TTR("Scene..."), FILE_NEW_SCENE);
+ new_menu->add_icon_item(get_theme_icon(SNAME("Script"), SNAME("EditorIcons")), TTR("Script..."), FILE_NEW_SCRIPT);
+ new_menu->add_icon_item(get_theme_icon(SNAME("Object"), SNAME("EditorIcons")), TTR("Resource..."), FILE_NEW_RESOURCE);
+ new_menu->add_icon_item(get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")), TTR("TextFile..."), FILE_NEW_TEXTFILE);
p_popup->add_separator();
}
String fpath = p_paths[0];
- String item_text = fpath.ends_with("/") ? TTR("Open in File Manager") : TTR("Show in File Manager");
+ bool is_directory = fpath.ends_with("/");
+ String item_text = is_directory ? TTR("Open in File Manager") : TTR("Show in File Manager");
p_popup->add_icon_shortcut(get_theme_icon(SNAME("Filesystem"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_SHOW_IN_EXPLORER);
p_popup->set_item_text(p_popup->get_item_index(FILE_SHOW_IN_EXPLORER), item_text);
+ if (!is_directory) {
+ p_popup->add_icon_shortcut(get_theme_icon(SNAME("ExternalLink"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/open_in_external_program"), FILE_OPEN_EXTERNAL);
+ }
path = fpath;
}
}
@@ -2707,6 +2759,7 @@ void FileSystemDock::_file_list_empty_clicked(const Vector2 &p_pos, MouseButton
file_list_popup->add_icon_item(get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")), TTR("New TextFile..."), FILE_NEW_TEXTFILE);
file_list_popup->add_separator();
file_list_popup->add_icon_shortcut(get_theme_icon(SNAME("Filesystem"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_SHOW_IN_EXPLORER);
+
file_list_popup->set_position(files->get_screen_position() + p_pos);
file_list_popup->reset_size();
file_list_popup->popup();
@@ -2820,6 +2873,8 @@ void FileSystemDock::_tree_gui_input(Ref<InputEvent> p_event) {
_tree_rmb_option(FILE_RENAME);
} else if (ED_IS_SHORTCUT("filesystem_dock/show_in_explorer", p_event)) {
_tree_rmb_option(FILE_SHOW_IN_EXPLORER);
+ } else if (ED_IS_SHORTCUT("filesystem_dock/open_in_external_program", p_event)) {
+ _tree_rmb_option(FILE_OPEN_EXTERNAL);
} else if (ED_IS_SHORTCUT("editor/open_search", p_event)) {
focus_on_filter();
} else {
@@ -2890,12 +2945,19 @@ void FileSystemDock::_file_list_gui_input(Ref<InputEvent> p_event) {
}
}
-void FileSystemDock::_get_imported_files(const String &p_path, Vector<String> &r_files) const {
+bool FileSystemDock::_get_imported_files(const String &p_path, String &r_extension, Vector<String> &r_files) const {
if (!p_path.ends_with("/")) {
if (FileAccess::exists(p_path + ".import")) {
+ if (r_extension.is_empty()) {
+ r_extension = p_path.get_extension();
+ } else if (r_extension != p_path.get_extension()) {
+ r_files.clear();
+ return false; // File type mismatch, stop search.
+ }
+
r_files.push_back(p_path);
}
- return;
+ return true;
}
Ref<DirAccess> da = DirAccess::open(p_path);
@@ -2904,11 +2966,14 @@ void FileSystemDock::_get_imported_files(const String &p_path, Vector<String> &r
while (!n.is_empty()) {
if (n != "." && n != ".." && !n.ends_with(".import")) {
String npath = p_path + n + (da->current_is_dir() ? "/" : "");
- _get_imported_files(npath, r_files);
+ if (!_get_imported_files(npath, r_extension, r_files)) {
+ return false;
+ }
}
n = da->get_next();
}
da->list_dir_end();
+ return true;
}
void FileSystemDock::_update_import_dock() {
@@ -2933,10 +2998,16 @@ void FileSystemDock::_update_import_dock() {
}
}
- // Expand directory selection
+ if (!selected.is_empty() && selected[0] == "res://") {
+ // Scanning res:// is costly and unlikely to yield any useful results.
+ return;
+ }
+
+ // Expand directory selection.
Vector<String> efiles;
- for (int i = 0; i < selected.size(); i++) {
- _get_imported_files(selected[i], efiles);
+ String extension;
+ for (const String &fpath : selected) {
+ _get_imported_files(fpath, extension, efiles);
}
// Check import.
@@ -3028,6 +3099,7 @@ void FileSystemDock::_bind_methods() {
ADD_SIGNAL(MethodInfo("inherit", PropertyInfo(Variant::STRING, "file")));
ADD_SIGNAL(MethodInfo("instantiate", PropertyInfo(Variant::PACKED_STRING_ARRAY, "files")));
+ ADD_SIGNAL(MethodInfo("resource_removed", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
ADD_SIGNAL(MethodInfo("file_removed", PropertyInfo(Variant::STRING, "file")));
ADD_SIGNAL(MethodInfo("folder_removed", PropertyInfo(Variant::STRING, "folder")));
ADD_SIGNAL(MethodInfo("files_moved", PropertyInfo(Variant::STRING, "old_file"), PropertyInfo(Variant::STRING, "new_file")));
@@ -3049,6 +3121,7 @@ FileSystemDock::FileSystemDock() {
ED_SHORTCUT("filesystem_dock/rename", TTR("Rename..."), Key::F2);
ED_SHORTCUT_OVERRIDE("filesystem_dock/rename", "macos", Key::ENTER);
ED_SHORTCUT("filesystem_dock/show_in_explorer", TTR("Open in File Manager"));
+ ED_SHORTCUT("filesystem_dock/open_in_external_program", TTR("Open in External Program"));
VBoxContainer *top_vbc = memnew(VBoxContainer);
add_child(top_vbc);
@@ -3186,6 +3259,7 @@ FileSystemDock::FileSystemDock() {
add_child(owners_editor);
remove_dialog = memnew(DependencyRemoveDialog);
+ remove_dialog->connect("resource_removed", callable_mp(this, &FileSystemDock::_resource_removed));
remove_dialog->connect("file_removed", callable_mp(this, &FileSystemDock::_file_removed));
remove_dialog->connect("folder_removed", callable_mp(this, &FileSystemDock::_folder_removed));
add_child(remove_dialog);
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 2304d8f8ad..ede6869eea 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -94,6 +94,7 @@ private:
FILE_NEW_SCRIPT,
FILE_NEW_SCENE,
FILE_SHOW_IN_EXPLORER,
+ FILE_OPEN_EXTERNAL,
FILE_COPY_PATH,
FILE_COPY_UID,
FILE_NEW_RESOURCE,
@@ -213,7 +214,7 @@ private:
void _file_multi_selected(int p_index, bool p_selected);
void _tree_multi_selected(Object *p_item, int p_column, bool p_selected);
- void _get_imported_files(const String &p_path, Vector<String> &r_files) const;
+ bool _get_imported_files(const String &p_path, String &r_extension, Vector<String> &r_files) const;
void _update_import_dock();
void _get_all_items_in_dir(EditorFileSystemDirectory *p_efsd, Vector<String> &r_files, Vector<String> &r_folders) const;
@@ -226,6 +227,7 @@ private:
void _update_favorites_list_after_move(const HashMap<String, String> &p_files_renames, const HashMap<String, String> &p_folders_renames) const;
void _update_project_settings_after_move(const HashMap<String, String> &p_renames) const;
+ void _resource_removed(const Ref<Resource> &p_resource);
void _file_removed(String p_file);
void _folder_removed(String p_folder);
diff --git a/editor/icons/BoneMapHumanBody.svg b/editor/icons/BoneMapHumanBody.svg
index 8674157aaa..818ee63069 100644
--- a/editor/icons/BoneMapHumanBody.svg
+++ b/editor/icons/BoneMapHumanBody.svg
@@ -1,26 +1 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" id="レイヤー_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
- y="0px" width="1024px" height="1024px" viewBox="0 0 1024 1024" enable-background="new 0 0 1024 1024" xml:space="preserve">
-<path fill="#3F3F3F" d="M0,0h1024v1024H0V0z"/>
-<path fill="#B2B2B2" d="M512,536.162c7,35,11.645,66.898,14,114c2,40,4,51,2,66c-7.384,55.369,6.77,183.898,8.666,206.667
- c2,24-7.653,24.241-10.666,46.333c-2.449,17.958,79,18.439,65-9c-25-49-2-84,4-221c0.521-11.921-8.967-47.874-2-94
- c11.086-73.414,8.42-107.242,6.5-145.662c-1.245-31.973-1-56.963-9-138.963c-0.976-10.002,5.915-79.268,11.954-79.088
- c42,1.25,97.313-5.009,118.145-14.68c28.901,3.73,97.81-12.047,127.887-16.126c14.541,9.407,16.673,3.335,37.515,9.019
- c5.5,1.5,17.336-1.443,12-5c-7.409-4.937-20.75-8.25-23-12c10.75-2.5,22.365-9.578,36-13.166c9.5-2.5,18.866-11.748,15.5-12.334l0,0
- c-11.5-2-26.03,4.547-37.5,6.5c-15.724,2.678-25.238,3.24-33.334,5.167c-1.227,0.292-3.103,0.763-5.791,0.958
- c0,0-0.02,0.16-0.053,0.437c-36.818,0.994-80.322-9.724-130.31-5.569c-34.026-3.925-94.181-5.16-113.513-5.493
- c-13.911-0.239-59.293-2.583-71.75-0.5c-0.668-4.083-1.5-9.75,0.949-16.468c14.881-7.246,19.188-17.796,27.301-34.694
- c0.922,4.424,6.252,4.929,12.459-14.231c5.661-17.478,2.323-22.254-2.313-22.525c0.172-2.056,0.279-4.105,0.313-6.142
- C573.746,76.562,566,42.163,512,42.163s-61.746,34.399-60.959,82.44c0.034,2.037,0.142,4.086,0.313,6.142
- c-4.637,0.271-7.975,5.047-2.313,22.525c6.207,19.16,11.537,18.655,12.459,14.231c8.112,16.898,12.42,27.448,27.301,34.694
- c2.449,6.718,1.617,12.385,0.949,16.468c-12.457-2.083-57.839,0.261-71.75,0.5c-19.332,0.333-79.486,1.568-113.513,5.493
- c-49.987-4.155-93.491,6.563-130.31,5.569c-0.033-0.277-0.053-0.437-0.053-0.437c-2.688-0.195-4.564-0.666-5.791-0.958
- c-8.096-1.927-17.61-2.489-33.334-5.167c-11.47-1.953-26-8.5-37.5-6.5l0,0c-3.366,0.586,6,9.834,15.5,12.334
- c13.635,3.588,25.25,10.666,36,13.166c-2.25,3.75-15.591,7.063-23,12c-5.336,3.557,6.5,6.5,12,5
- c20.842-5.684,22.974,0.388,37.515-9.019c30.077,4.079,98.985,19.857,127.887,16.126c20.832,9.671,76.145,15.93,118.145,14.68
- c6.039-0.18,12.93,69.085,11.954,79.088c-8,82-7.755,106.99-9,138.963c-1.92,38.419-4.586,72.248,6.5,145.662
- c6.967,46.126-2.521,82.079-2,94c6,137,29,172,4,221c-14,27.439,67.449,26.958,65,9c-3.013-22.092-12.666-22.333-10.666-46.333
- c1.896-22.769,16.05-151.298,8.666-206.667c-2-15,0-26,2-66C500.356,603.061,505,571.162,512,536.162z"/>
-</svg>
+<svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_1451_455)"><path d="M0 0H256V256H0V0Z" fill="#3F3F3F"/><path d="M128 134.04C129.75 142.79 130.911 150.765 131.5 162.54C132 172.54 132.5 175.29 132 179.04C130.154 192.883 133.692 225.015 134.166 230.707C134.666 236.707 132.253 236.767 131.5 242.29C130.888 246.78 151.25 246.9 147.75 240.04C141.5 227.79 147.25 219.04 148.75 184.79C148.88 181.81 146.508 172.822 148.25 161.29C151.021 142.937 150.355 134.48 149.875 124.875C149.564 116.882 149.625 110.634 147.625 90.134C147.381 87.6335 149.104 70.317 150.613 70.362C161.113 70.6745 174.942 69.1098 180.15 66.692C187.375 67.6245 204.602 63.6803 212.121 62.6605C215.757 65.0123 216.29 63.4943 221.5 64.9153C222.875 65.2903 225.834 64.5545 224.5 63.6653C222.648 62.431 219.313 61.6028 218.75 60.6653C221.438 60.0403 224.341 58.2708 227.75 57.3738C230.125 56.7488 232.467 54.4368 231.625 54.2903C228.75 53.7903 225.118 55.427 222.25 55.9153C218.319 56.5848 215.941 56.7253 213.917 57.207C213.61 57.28 213.141 57.3978 212.469 57.4465C212.469 57.4465 212.464 57.4865 212.456 57.5558C203.251 57.8043 192.375 55.1248 179.878 56.1635C171.372 55.1823 156.333 54.8735 151.5 54.7903C148.022 54.7305 136.677 54.1445 133.562 54.6653C133.395 53.6445 133.187 52.2278 133.8 50.5483C137.52 48.7368 138.597 46.0993 140.625 41.8748C140.855 42.9808 142.188 43.107 143.74 38.317C145.155 33.9475 144.32 32.7535 143.161 32.6858C143.204 32.1718 143.231 31.6595 143.24 31.1503C143.436 19.1403 141.5 10.5405 128 10.5405C114.5 10.5405 112.563 19.1403 112.76 31.1505C112.769 31.6598 112.796 32.172 112.838 32.686C111.679 32.7538 110.845 33.9478 112.26 38.3173C113.812 43.1073 115.144 42.981 115.375 41.875C117.403 46.0995 118.48 48.737 122.2 50.5485C122.812 52.228 122.604 53.6448 122.437 54.6655C119.323 54.1448 107.978 54.7308 104.5 54.7905C99.6669 54.8738 84.6284 55.1825 76.1217 56.1638C63.6249 55.125 52.7489 57.8045 43.5442 57.556C43.5359 57.4868 43.5309 57.4468 43.5309 57.4468C42.8589 57.398 42.3899 57.2803 42.0832 57.2073C40.0592 56.7255 37.6807 56.585 33.7497 55.9155C30.8822 55.4273 27.2497 53.7905 24.3747 54.2905C23.5332 54.437 25.8747 56.749 28.2497 57.374C31.6584 58.271 34.5622 60.0405 37.2497 60.6655C36.6872 61.603 33.3519 62.4313 31.4997 63.6655C30.1657 64.5548 33.1247 65.2905 34.4997 64.9155C39.7102 63.4945 40.2432 65.0125 43.8784 62.6608C51.3977 63.6805 68.6247 67.625 75.8502 66.6923C81.0582 69.11 94.8864 70.6748 105.386 70.3623C106.896 70.3173 108.619 87.6335 108.375 90.1343C106.375 110.634 106.436 116.882 106.125 124.875C105.645 134.48 104.978 142.937 107.75 161.291C109.492 172.822 107.12 181.81 107.25 184.791C108.75 219.041 114.5 227.791 108.25 240.041C104.75 246.9 125.112 246.78 124.5 242.291C123.747 236.768 121.333 236.707 121.833 230.707C122.307 225.015 125.846 192.883 124 179.041C123.5 175.291 124 172.541 124.5 162.541C125.089 150.765 126.25 142.79 128 134.04Z" fill="#B2B2B2"/></g><defs><clipPath id="clip0_1451_455"><rect width="256" height="256" fill="white"/></clipPath></defs></svg>
diff --git a/editor/icons/BoneMapHumanFace.svg b/editor/icons/BoneMapHumanFace.svg
index 6cb21140bc..e38c5cb790 100644
--- a/editor/icons/BoneMapHumanFace.svg
+++ b/editor/icons/BoneMapHumanFace.svg
@@ -1 +1 @@
-<svg enable-background="new 0 0 1024 1024" height="1024" viewBox="0 0 1024 1024" width="1024" xmlns="http://www.w3.org/2000/svg"><path d="m0 0h1024v1024h-1024z" fill="#3f3f3f"/><path d="m788.105 552.967c17.995-57.892 31.896-124.566 30.875-198.071-3.758-270.403-249.846-251.479-295.568-244.947-359.868 51.409-219.047 452.358-220.453 496.426-4.899 153.499 83.686 170.991 161.665 215.554 2.646 1.512 7.259 1.786 13.313 1.111 7.223 25.179 11.762 59.035 9.548 75.638-3.266 24.495 209.021 24.495 209.021 0 0-62.883 12.233-124.363 33.827-188.89 7.143-2.284 16.054-7.601 25.963-16.95 13.681-12.908 34.839-21.774 45.726-63.145 15.615-59.338 3.869-76.074-13.917-76.726z" fill="#b2b2b2"/></svg>
+<svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_1451_458)"><path d="M0 0H256V256H0V0Z" fill="#3F3F3F"/><path d="M197.026 138.242C201.525 123.769 205 107.1 204.745 88.724C203.805 21.1232 142.283 25.8542 130.853 27.4872C40.8859 40.3395 76.0912 140.577 75.7397 151.594C74.5149 189.968 96.6612 194.342 116.156 205.482C116.817 205.86 117.971 205.929 119.484 205.76C121.29 212.055 122.425 220.519 121.871 224.669C121.055 230.793 174.126 230.793 174.126 224.669C174.126 208.949 177.185 193.579 182.583 177.447C184.369 176.876 186.597 175.547 189.074 173.21C192.494 169.983 197.784 167.766 200.505 157.423C204.409 142.589 201.473 138.405 197.026 138.242Z" fill="#B2B2B2"/></g><defs><clipPath id="clip0_1451_458"><rect width="256" height="256" fill="white"/></clipPath></defs></svg>
diff --git a/editor/icons/BoneMapHumanLeftHand.svg b/editor/icons/BoneMapHumanLeftHand.svg
index 08c68bb4be..a9861f818c 100644
--- a/editor/icons/BoneMapHumanLeftHand.svg
+++ b/editor/icons/BoneMapHumanLeftHand.svg
@@ -1 +1 @@
-<svg enable-background="new 0 0 1024 1024" height="1024" viewBox="0 0 1024 1024" width="1024" xmlns="http://www.w3.org/2000/svg"><path d="m0 0h1024v1024h-1024z" fill="#3f3f3f"/><path d="m703.906 786.098c7.046-66.929 28.135-153.363 18.529-260.192-1.143-12.71-4.5-48.282-4.46-82.732.025-21.174-2.111-48.505-1.975-64.174.167-19.333-.428-41.584-.625-55.755-1.052-75.44-13.225-85.827-30.813-85.827-17.246 0-26.77 14.266-27.062 84.582-.061 14.42.5 51 .5 58.5 0 17.508-.333 34.167 0 53.5.447 25.955-4.279 68-9 68-3.902 0-8.099-39.299-9.575-76.999-.756-19.326-3.219-58.336-2.6-70.102 1.759-33.413.474-58.914 1.537-90.165 3.183-93.607-13.016-111.729-34.695-111.729-21.973 0-35.979 57.688-34.849 114.224.128 6.394-1.165 50.739.188 89.859.754 21.811-1.07 49.627-1.683 69.67-1.095 35.768-5.755 63.896-8.869 63.896-2.641 0-4.135-32.584-5.456-65.706-.859-21.557-4.468-58.477-3.664-83.616 1.886-59.012-1.139-110.226-1.063-121.501.635-94.955-14.66-123.101-36.052-123.101-21.476 0-37.188 30.192-36.6 123.343.067 10.53-2.62 99.926-1.759 121.816.865 21.992-2.773 65.062-3.517 84.818-1.299 34.521-6.49 63.947-9.124 63.947-3.281 0-10.794-25.638-11.724-60.965-.587-22.275 1.231-50.99.624-70.688-1.257-40.707-3.175-64.631-3.877-99.708-1.945-97.182-16.352-106.289-38.142-106.289-17.957 0-32.453 28.673-32.657 115.03-.065 27.702-2.429 62.626-.315 94.329.805 12.081-.622 42.512-1.875 73.894-.799 20.007-1.102 47.501-1.137 63.775-.17 78.595-26.712 133.424-36.555 131.308-30.333-6.521-51.648-43.918-71.219-117.307-10.551-39.566-36.667-71.149-69.9-77.813-25.9-5.193-19.783 46.161-1.319 125.293 8.65 37.068 27.909 86.227 39.566 122.655 31.653 98.917 125.574 188.563 160.903 228.546 17.146 19.403 236.894 19.403 264.59 0 11.525-8.07 43.087-101.557 45.724-126.616z" fill="#b2b2b2"/></svg>
+<svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_1451_461)"><path d="M0 0H256V256H0V0Z" fill="#3F3F3F"/><path d="M175.976 196.525C177.738 179.792 183.01 158.184 180.609 131.477C180.323 128.299 179.484 119.406 179.494 110.794C179.5 105.5 178.966 98.6674 179 94.7501C179.042 89.9169 178.893 84.3541 178.844 80.8114C178.581 61.9514 175.537 59.3546 171.14 59.3546C166.829 59.3546 164.448 62.9211 164.375 80.5001C164.36 84.1051 164.5 93.2501 164.5 95.1251C164.5 99.5021 164.417 103.667 164.5 108.5C164.612 114.989 163.43 125.5 162.25 125.5C161.274 125.5 160.225 115.675 159.856 106.25C159.667 101.419 159.051 91.6664 159.206 88.7249C159.646 80.3716 159.325 73.9964 159.59 66.1836C160.386 42.7819 156.336 38.2514 150.917 38.2514C145.423 38.2514 141.922 52.6734 142.204 66.8074C142.236 68.4059 141.913 79.4921 142.251 89.2721C142.44 94.7249 141.984 101.679 141.831 106.69C141.557 115.632 140.392 122.664 139.613 122.664C138.953 122.664 138.58 114.518 138.249 106.237C138.035 100.848 137.132 91.6179 137.333 85.3331C137.805 70.5801 137.049 57.7766 137.068 54.9579C137.226 31.2191 133.403 24.1826 128.055 24.1826C122.686 24.1826 118.758 31.7306 118.905 55.0184C118.921 57.6509 118.25 79.9999 118.465 85.4724C118.681 90.9704 117.772 101.738 117.586 106.677C117.261 115.307 115.963 122.664 115.305 122.664C114.484 122.664 112.606 116.254 112.374 107.422C112.227 101.854 112.681 94.6749 112.53 89.7504C112.215 79.5736 111.736 73.5926 111.56 64.8234C111.074 40.5279 107.472 38.2511 102.025 38.2511C97.5357 38.2511 93.9117 45.4194 93.8607 67.0086C93.8445 73.9341 93.2535 82.6651 93.782 90.5909C93.9832 93.6111 93.6265 101.219 93.3132 109.064C93.1135 114.066 93.0377 120.94 93.029 125.008C92.9865 144.657 86.351 158.364 83.8902 157.835C76.307 156.205 70.9782 146.856 66.0855 128.508C63.4477 118.617 56.9187 110.721 48.6105 109.055C42.1355 107.757 43.6647 120.595 48.2807 140.378C50.4432 149.645 55.258 161.935 58.1722 171.042C66.0855 195.771 89.5657 218.183 98.398 228.179C102.684 233.029 157.621 233.029 164.545 228.179C167.427 226.161 175.317 202.789 175.976 196.525Z" fill="#B2B2B2"/></g><defs><clipPath id="clip0_1451_461"><rect width="256" height="256" fill="white"/></clipPath></defs></svg>
diff --git a/editor/icons/BoneMapHumanRightHand.svg b/editor/icons/BoneMapHumanRightHand.svg
index 4e40af35d8..e92898152f 100644
--- a/editor/icons/BoneMapHumanRightHand.svg
+++ b/editor/icons/BoneMapHumanRightHand.svg
@@ -1 +1 @@
-<svg enable-background="new 0 0 1024 1024" height="1024" viewBox="0 0 1024 1024" width="1024" xmlns="http://www.w3.org/2000/svg"><path d="m0 0h1024v1024h-1024z" fill="#3f3f3f"/><path d="m320.094 786.098c-7.046-66.929-28.135-153.363-18.529-260.192 1.143-12.71 4.5-48.282 4.46-82.732-.025-21.174 2.111-48.505 1.975-64.174-.167-19.333.428-41.584.625-55.755 1.052-75.44 13.225-85.827 30.813-85.827 17.246 0 26.77 14.266 27.062 84.582.061 14.42-.5 51-.5 58.5 0 17.508.333 34.167 0 53.5-.447 25.955 4.279 68 9 68 3.902 0 8.099-39.299 9.575-76.999.756-19.326 3.219-58.336 2.6-70.102-1.759-33.413-.474-58.914-1.537-90.165-3.183-93.607 13.016-111.729 34.695-111.729 21.973 0 35.979 57.688 34.849 114.224-.128 6.394 1.165 50.739-.188 89.859-.754 21.811 1.07 49.627 1.683 69.67 1.095 35.768 5.755 63.896 8.869 63.896 2.641 0 4.135-32.584 5.456-65.706.859-21.557 4.468-58.477 3.664-83.616-1.886-59.012 1.139-110.226 1.063-121.501-.635-94.955 14.66-123.101 36.052-123.101 21.476 0 37.188 30.192 36.6 123.343-.067 10.53 2.62 99.926 1.759 121.816-.865 21.992 2.773 65.062 3.517 84.818 1.299 34.521 6.49 63.947 9.124 63.947 3.281 0 10.794-25.638 11.724-60.965.587-22.275-1.231-50.99-.624-70.688 1.257-40.707 3.176-64.631 3.877-99.708 1.945-97.182 16.352-106.289 38.142-106.289 17.957 0 32.453 28.673 32.657 115.03.065 27.702 2.429 62.626.314 94.329-.805 12.081.622 42.512 1.875 73.894.799 20.007 1.102 47.501 1.137 63.775.171 78.595 26.713 133.424 36.556 131.308 30.333-6.521 51.648-43.918 71.219-117.307 10.551-39.566 36.667-71.149 69.9-77.813 25.9-5.193 19.783 46.161 1.318 125.293-8.649 37.068-27.909 86.227-39.566 122.655-31.652 98.917-125.573 188.563-160.902 228.546-17.146 19.403-236.894 19.403-264.59 0-11.525-8.07-43.087-101.557-45.724-126.616z" fill="#b2b2b2"/></svg>
+<svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_1451_464)"><path d="M0 0H256V256H0V0Z" fill="#3F3F3F"/><path d="M80.0233 196.525C78.2618 179.792 72.9896 158.184 75.3911 131.477C75.6768 128.299 76.5161 119.406 76.5061 110.794C76.4998 105.5 77.0338 98.6674 76.9998 94.7501C76.9581 89.9169 77.1068 84.3541 77.1561 80.8114C77.4191 61.9514 80.4623 59.3546 84.8593 59.3546C89.1708 59.3546 91.5518 62.9211 91.6248 80.5001C91.6401 84.1051 91.4998 93.2501 91.4998 95.1251C91.4998 99.5021 91.5831 103.667 91.4998 108.5C91.3881 114.989 92.5696 125.5 93.7498 125.5C94.7253 125.5 95.7746 115.675 96.1436 106.25C96.3326 101.419 96.9483 91.6664 96.7935 88.7249C96.3538 80.3716 96.6751 73.9964 96.4093 66.1836C95.6136 42.7819 99.6633 38.2514 105.083 38.2514C110.576 38.2514 114.078 52.6734 113.795 66.8074C113.763 68.4059 114.087 79.4921 113.748 89.2721C113.56 94.7249 114.016 101.679 114.169 106.69C114.443 115.632 115.608 122.664 116.386 122.664C117.047 122.664 117.42 114.518 117.75 106.237C117.965 100.848 118.867 91.6179 118.666 85.3331C118.195 70.5801 118.951 57.7766 118.932 54.9579C118.773 31.2191 122.597 24.1826 127.945 24.1826C133.314 24.1826 137.242 31.7306 137.095 55.0184C137.078 57.6509 137.75 79.9999 137.535 85.4724C137.319 90.9704 138.228 101.738 138.414 106.677C138.739 115.307 140.037 122.664 140.695 122.664C141.515 122.664 143.394 116.254 143.626 107.422C143.773 101.854 143.318 94.6749 143.47 89.7504C143.784 79.5736 144.264 73.5926 144.439 64.8234C144.926 40.5279 148.527 38.2511 153.975 38.2511C158.464 38.2511 162.088 45.4194 162.139 67.0086C162.155 73.9341 162.746 82.6651 162.218 90.5909C162.016 93.6111 162.373 101.219 162.686 109.064C162.886 114.066 162.962 120.94 162.971 125.008C163.013 144.657 169.649 158.364 172.11 157.835C179.693 156.205 185.022 146.856 189.914 128.508C192.552 118.617 199.081 110.721 207.389 109.055C213.864 107.757 212.335 120.595 207.719 140.378C205.557 149.645 200.742 161.935 197.827 171.042C189.914 195.771 166.434 218.183 157.602 228.179C153.315 233.029 98.3783 233.029 91.4543 228.179C88.5731 226.161 80.6826 202.789 80.0233 196.525Z" fill="#B2B2B2"/></g><defs><clipPath id="clip0_1451_464"><rect width="256" height="256" fill="white"/></clipPath></defs></svg>
diff --git a/editor/icons/Keyboard.svg b/editor/icons/Keyboard.svg
index b9dfab71ed..b6d963f9d7 100644
--- a/editor/icons/Keyboard.svg
+++ b/editor/icons/Keyboard.svg
@@ -1 +1 @@
-<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill-opacity=".996"><path d="m4 2a1 1 0 0 0 -1 1v9.084c0 .506.448.916 1 .916h8c.552 0 1-.41 1-.916v-9.084a1 1 0 0 0 -1-1zm1.543 1.139h1.393l1.834 4.199h1.295v.437c.708.052 1.246.239 1.61.559.368.316.55.747.55 1.295 0 .552-.182.99-.55 1.314-.368.32-.906.505-1.61.553v.467h-1.294v-.473c-.708-.06-1.247-.248-1.615-.564-.364-.316-.545-.75-.545-1.297 0-.548.181-.977.545-1.29.368-.315.907-.504 1.615-.564v-.437h-1.464l-.282-.733h-1.595l-.284.733h-1.439l1.836-4.2zm.684 1.39-.409 1.057h.817zm3.84 4.338v1.526c.28-.04.483-.12.607-.24.124-.125.185-.302.185-.53 0-.224-.063-.396-.191-.516-.124-.12-.326-.2-.602-.24zm-1.296.006c-.284.04-.487.12-.61.24-.12.116-.182.288-.182.516 0 .22.065.392.193.512.132.12.331.202.6.246v-1.514z" fill="#e0e0e0"/><path d="m27 2h7v14h-7z" fill="#fff"/><path d="m1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-9h-1v9a1 1 0 0 1 -1 1h-10a1 1 0 0 1 -1-1v-9z" fill="#e0e0e0"/></g></svg>
+<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path d="M6.584 5.135 6.17 4.059l-.412 1.076h.826zm3.203 2.976a1.032 1.032 0 0 0-.287.041.953.953 0 0 0-.09.034c-.028.012-.057.024-.084.039a.912.912 0 0 0-.152.107.988.988 0 0 0-.23.305.937.937 0 0 0-.04.097 1.017 1.017 0 0 0-.068.323 1.553 1.553 0 0 0 0 .244 1.374 1.374 0 0 0 .068.328 1.03 1.03 0 0 0 .201.336c.023.022.045.044.069.064a.96.96 0 0 0 .152.104c.027.015.056.027.084.039.03.012.06.024.09.033a.965.965 0 0 0 .19.035 1.028 1.028 0 0 0 .197 0 .974.974 0 0 0 .36-.107.876.876 0 0 0 .077-.049.872.872 0 0 0 .074-.055.882.882 0 0 0 .13-.136.978.978 0 0 0 .177-.368 1.225 1.225 0 0 0 .035-.224 1.61 1.61 0 0 0 0-.244 1.361 1.361 0 0 0-.035-.223 1.092 1.092 0 0 0-.121-.285.87.87 0 0 0-.12-.15.862.862 0 0 0-.14-.124c-.025-.017-.05-.035-.078-.05-.027-.015-.056-.027-.086-.04a.892.892 0 0 0-.373-.074z" style="fill-opacity:.99607843;fill:#e0e0e0"/><path d="M4 2c-.616-.02-1.084.59-1 1.178.003 3-.007 6 .005 9 .057.577.672.889 1.203.822 2.631-.003 5.263.006 7.894-.005a.973.973 0 0 0 .898-1.09c-.003-3.002.007-6.005-.005-9.007-.042-.592-.643-.976-1.203-.898H4Zm1.475.646H6.89l1.865 4.27H7.268l-.286-.744H5.36l-.287.744H3.61l1.866-4.27Zm4.312 4.301c1.069-.042 2.164.679 2.363 1.766.232 1.01-.34 2.144-1.326 2.502.296.465.837-.109 1.06-.007l.544.642c-.64.756-1.883.677-2.605.084-.394-.448-.866-.673-1.409-.887-1.175-.66-1.391-2.456-.43-3.39.463-.486 1.141-.716 1.803-.71Z" style="fill:#e0e0e0;fill-opacity:.996078"/><path fill="#e0e0e0" d="M1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-1v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4Z" style="fill-opacity:.996"/></svg>
diff --git a/editor/icons/KeyboardError.svg b/editor/icons/KeyboardError.svg
new file mode 100644
index 0000000000..e20d133155
--- /dev/null
+++ b/editor/icons/KeyboardError.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path d="M4 2c-.616-.02-1.084.59-1 1.178.003 3-.007 6 .005 9 .057.577.672.889 1.203.822 2.631-.003 5.263.006 7.894-.005a.973.973 0 0 0 .898-1.09c-.003-3.002.007-6.005-.005-9.007-.042-.592-.643-.976-1.203-.898H4Zm4.223 1.262c1.06.005 2.29.257 2.92 1.197.532.862.275 2.057-.484 2.703-.346.382-.862.629-1.075 1.117.055.345-.33.172-.537.213H7.148c-.037-.749.503-1.335 1.026-1.796.406-.253.744-1.002.129-1.22-.626-.25-1.374.117-1.645.715l-2.08-1.039c.599-1.147 1.868-1.818 3.136-1.872.17-.013.339-.018.509-.018Zm.127 5.697c.798-.057 1.616.616 1.54 1.45-.023.81-.841 1.413-1.623 1.328-.833.022-1.6-.771-1.443-1.613.097-.721.83-1.195 1.526-1.165z" style="fill:#ff5f5f;fill-opacity:1"/><path fill="#e0e0e0" d="M1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-1v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4Z" style="fill-opacity:1;fill:#ff5f5f"/></svg>
diff --git a/editor/icons/KeyboardLabel.svg b/editor/icons/KeyboardLabel.svg
new file mode 100644
index 0000000000..07a687f447
--- /dev/null
+++ b/editor/icons/KeyboardLabel.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M11.814 1.977c-.078 0-.157.008-.232.023H4c-.7-.034-1.143.765-1 1.39.008 2.95-.017 5.9.014 8.848.13.705.965.847 1.562.76 2.542-.008 5.085.02 7.627-.014.734-.1.9-.952.797-1.564-.003-2.84.006-5.68-.006-8.522-.035-.594-.628-.927-1.18-.921zM9.797 4.016l.572.58-.572.578-.57-.578.57-.58zm-.606 1.05.594.606-.594.601-.591-.601.591-.606zm1.213 0 .596.606-.596.601-.593-.601.593-.606zm.717 1.436h1.06c.053.217.093.428.122.63.028.201.043.395.043.58a2.363 2.363 0 0 1-.133.724 1.425 1.425 0 0 1-.31.515c-.249.265-.598.399-1.05.399-.331 0-.594-.08-.785-.235a1.091 1.091 0 0 1-.236-.275c-.063.1-.14.19-.236.265-.206.163-.467.245-.787.245-.252 0-.457-.057-.614-.166a2.75 2.75 0 0 1-.095.42 1.936 1.936 0 0 1-.403.722c-.2.22-.452.383-.756.49-.303.11-.654.166-1.052.166-.466 0-.865-.089-1.2-.265a1.817 1.817 0 0 1-.765-.752c-.18-.327-.27-.715-.27-1.164 0-.256.027-.525.082-.809.055-.284.126-.545.21-.781h1.001c-.062.232-.112.46-.15.684a3.87 3.87 0 0 0-.053.613c0 .37.1.643.3.82.204.177.523.264.96.264.222 0 .425-.03.61-.092a.97.97 0 0 0 .439-.299.803.803 0 0 0 .166-.521 5.463 5.463 0 0 0-.051-.725 11.61 11.61 0 0 0-.068-.482 26.51 26.51 0 0 0-.096-.606h1.135l.043.276c.047.32.123.532.228.634.105.1.24.15.402.15.165 0 .284-.04.358-.124.076-.086.115-.224.115-.412v-.524h1.027v.524c0 .203.032.351.096.447.065.095.202.142.412.142a.637.637 0 0 0 .33-.078c.089-.052.133-.15.133-.297 0-.128-.019-.295-.054-.498l-.108-.605z" style="fill:#e0e0e0;fill-opacity:.996078"/><path fill="#e0e0e0" d="M1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-1v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4Z" style="fill-opacity:.996"/></svg>
diff --git a/editor/icons/KeyboardPhysical.svg b/editor/icons/KeyboardPhysical.svg
index 4364e0b4fa..7d4b7e2999 100644
--- a/editor/icons/KeyboardPhysical.svg
+++ b/editor/icons/KeyboardPhysical.svg
@@ -1 +1 @@
-<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill-opacity=".996"><path d="m4 2a1 1 0 0 0 -1 1v9.084c0 .506.448.916 1 .916h8c.552 0 1-.41 1-.916v-9.084a1 1 0 0 0 -1-1zm2.762 1.768h2.476l3.264 7.464h-2.604l-.502-1.3h-2.835l-.502 1.3h-2.561zm1.217 2.474-.725 1.878h1.45z" fill="#e0e0e0"/><path d="m27 2h7v14h-7z" fill="#fff"/><path d="m1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-9h-1v9a1 1 0 0 1 -1 1h-10a1 1 0 0 1 -1-1v-9z" fill="#e0e0e0"/></g></svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="M4 2a1 1 0 0 0-1 1v9.084c0 .506.448.916 1 .916h8c.552 0 1-.41 1-.916V3a1 1 0 0 0-1-1Zm2.762 1.768h2.476l3.264 7.464H9.898l-.502-1.3H6.561l-.502 1.3H3.498Zm1.217 2.474L7.254 8.12h1.45z" style="fill-opacity:.996"/><path fill="#e0e0e0" d="M1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-1v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4Z" style="fill-opacity:.996"/></svg>
diff --git a/editor/icons/UseBlendDisable.svg b/editor/icons/UseBlendDisable.svg
new file mode 100644
index 0000000000..449dc2d0c8
--- /dev/null
+++ b/editor/icons/UseBlendDisable.svg
@@ -0,0 +1 @@
+<svg enable-background="new -595.5 420.5 16 16" height="16" viewBox="-595.5 420.5 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m-591 421.5h7v14h-7z" fill="#a3e595" opacity=".5"/><g fill="none" stroke="#a3e595" stroke-linecap="square" stroke-width="2"><path d="m-585 434.5v-12"/><path d="m-590 422.5v12"/><path d="m-581.5 422.5h-12"/></g></svg>
diff --git a/editor/icons/UseBlendEnable.svg b/editor/icons/UseBlendEnable.svg
new file mode 100644
index 0000000000..5567b2d8c6
--- /dev/null
+++ b/editor/icons/UseBlendEnable.svg
@@ -0,0 +1 @@
+<svg enable-background="new -595.5 420.5 16 16" height="16" viewBox="-595.5 420.5 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m-587.5 423.244c-3.995 2.354-7 6.775-7 11.256v1h14v-1c0-4.48-3.005-8.901-7-11.256z" fill="#95c6e8" opacity=".5"/><g fill="none" stroke="#95c6e8" stroke-linecap="square" stroke-width="2"><path d="m-581.5 422.5c-6 0-12 6-12 12"/><path d="m-581.5 434.5c0-6-6-12-12-12"/></g></svg>
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 4b0ece3367..1ffede6502 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -734,7 +734,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
/* CREATE PRIMITIVE ARRAY */
/**************************/
- // The way collada uses indices is more optimal, and friendlier with 3D modelling software,
+ // The way collada uses indices is more optimal, and friendlier with 3D modeling software,
// because it can index everything, not only vertices (similar to how the WII works).
// This is, however, more incompatible with standard video cards, so arrays must be converted.
// Must convert to GL/DX format.
diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp
index bc4ced7ea2..10a0c2662f 100644
--- a/editor/import/resource_importer_layered_texture.cpp
+++ b/editor/import/resource_importer_layered_texture.cpp
@@ -123,6 +123,9 @@ bool ResourceImporterLayeredTexture::get_option_visibility(const String &p_path,
if (p_option == "compress/lossy_quality" && p_options.has("compress/mode")) {
return int(p_options["compress/mode"]) == COMPRESS_LOSSY;
}
+ if ((p_option == "compress/high_quality" || p_option == "compress/hdr_compression") && p_options.has("compress/mode")) {
+ return int(p_options["compress/mode"]) == COMPRESS_VRAM_COMPRESSED;
+ }
return true;
}
@@ -136,9 +139,9 @@ String ResourceImporterLayeredTexture::get_preset_name(int p_idx) const {
void ResourceImporterLayeredTexture::get_import_options(const String &p_path, List<ImportOption> *r_options, int p_preset) const {
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/mode", PROPERTY_HINT_ENUM, "Lossless,Lossy,VRAM Compressed,VRAM Uncompressed,Basis Universal", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), 1));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "compress/high_quality"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "compress/lossy_quality", PROPERTY_HINT_RANGE, "0,1,0.01"), 0.7));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/hdr_compression", PROPERTY_HINT_ENUM, "Disabled,Opaque Only,Always"), 1));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/bptc_ldr", PROPERTY_HINT_ENUM, "Disabled,Enabled,RGBA Only"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/channel_pack", PROPERTY_HINT_ENUM, "sRGB Friendly,Optimized,Normal Map (RG Channels)"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "mipmaps/generate"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "mipmaps/limit", PROPERTY_HINT_RANGE, "-1,256"), -1));
@@ -283,8 +286,8 @@ void ResourceImporterLayeredTexture::_save_tex(Vector<Ref<Image>> p_images, cons
Error ResourceImporterLayeredTexture::import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
int compress_mode = p_options["compress/mode"];
float lossy = p_options["compress/lossy_quality"];
+ float high_quality = p_options["compress/high_quality"];
int hdr_compression = p_options["compress/hdr_compression"];
- int bptc_ldr = p_options["compress/bptc_ldr"];
bool mipmaps = p_options["mipmaps/generate"];
int channel_pack = p_options["compress/channel_pack"];
@@ -389,9 +392,10 @@ Error ResourceImporterLayeredTexture::import(const String &p_source_file, const
texture_import->compress_mode = compress_mode;
texture_import->lossy = lossy;
texture_import->hdr_compression = hdr_compression;
- texture_import->bptc_ldr = bptc_ldr;
texture_import->mipmaps = mipmaps;
texture_import->used_channels = used_channels;
+ texture_import->high_quality = high_quality;
+
_check_compress_ctex(p_source_file, texture_import);
if (r_metadata) {
Dictionary meta;
@@ -406,12 +410,11 @@ Error ResourceImporterLayeredTexture::import(const String &p_source_file, const
}
const char *ResourceImporterLayeredTexture::compression_formats[] = {
- "bptc",
- "s3tc",
- "etc",
- "etc2",
+ "s3tc_bptc",
+ "etc2_astc",
nullptr
};
+
String ResourceImporterLayeredTexture::get_import_settings_string() const {
String s;
@@ -450,12 +453,16 @@ bool ResourceImporterLayeredTexture::are_import_settings_valid(const String &p_p
bool valid = true;
while (compression_formats[index]) {
String setting_path = "rendering/textures/vram_compression/import_" + String(compression_formats[index]);
- bool test = GLOBAL_GET(setting_path);
- if (test) {
- if (!formats_imported.has(compression_formats[index])) {
- valid = false;
- break;
+ if (ProjectSettings::get_singleton()->has_setting(setting_path)) {
+ bool test = GLOBAL_GET(setting_path);
+ if (test) {
+ if (!formats_imported.has(compression_formats[index])) {
+ valid = false;
+ break;
+ }
}
+ } else {
+ WARN_PRINT("Setting for imported format not found: " + setting_path);
}
index++;
}
@@ -484,64 +491,83 @@ void ResourceImporterLayeredTexture::_check_compress_ctex(const String &p_source
// Must import in all formats, in order of priority (so platform choses the best supported one. IE, etc2 over etc).
// Android, GLES 2.x
- bool can_bptc = GLOBAL_GET("rendering/textures/vram_compression/import_bptc");
- if (can_bptc) {
- r_texture_import->formats_imported.push_back("bptc"); // BPTC needs to be added anyway.
+ const bool can_s3tc_bptc = GLOBAL_GET("rendering/textures/vram_compression/import_s3tc_bptc") || OS::get_singleton()->get_preferred_texture_format() == OS::PREFERRED_TEXTURE_FORMAT_S3TC_BPTC;
+ const bool can_etc2_astc = GLOBAL_GET("rendering/textures/vram_compression/import_etc2_astc") || OS::get_singleton()->get_preferred_texture_format() == OS::PREFERRED_TEXTURE_FORMAT_ETC2_ASTC;
+
+ // Add list of formats imported
+ if (can_s3tc_bptc) {
+ r_texture_import->formats_imported.push_back("s3tc_bptc");
}
+ if (can_etc2_astc) {
+ r_texture_import->formats_imported.push_back("etc2_astc");
+ }
+
bool can_compress_hdr = r_texture_import->hdr_compression > 0;
ERR_FAIL_NULL(r_texture_import->image);
bool is_hdr = (r_texture_import->image->get_format() >= Image::FORMAT_RF && r_texture_import->image->get_format() <= Image::FORMAT_RGBE9995);
- bool is_ldr = (r_texture_import->image->get_format() >= Image::FORMAT_L8 && r_texture_import->image->get_format() <= Image::FORMAT_RGB565);
- bool can_s3tc = GLOBAL_GET("rendering/textures/vram_compression/import_s3tc");
ERR_FAIL_NULL(r_texture_import->slices);
// Can compress hdr, but hdr with alpha is not compressible.
- if (r_texture_import->hdr_compression == 2) {
- // The user selected to compress hdr anyway, so force an alpha-less format.
- if (r_texture_import->image->get_format() == Image::FORMAT_RGBAF) {
- for (int i = 0; i < r_texture_import->slices->size(); i++) {
- r_texture_import->slices->write[i]->convert(Image::FORMAT_RGBF);
- }
+ bool use_uncompressed = false;
+
+ if (is_hdr) {
+ if (r_texture_import->used_channels == Image::USED_CHANNELS_LA || r_texture_import->used_channels == Image::USED_CHANNELS_RGBA) {
+ if (r_texture_import->hdr_compression == 2) {
+ // The user selected to compress hdr anyway, so force an alpha-less format.
+ if (r_texture_import->image->get_format() == Image::FORMAT_RGBAF) {
+ for (int i = 0; i < r_texture_import->slices->size(); i++) {
+ r_texture_import->slices->write[i]->convert(Image::FORMAT_RGBF);
+ }
- } else if (r_texture_import->image->get_format() == Image::FORMAT_RGBAH) {
- for (int i = 0; i < r_texture_import->slices->size(); i++) {
- r_texture_import->slices->write[i]->convert(Image::FORMAT_RGBH);
+ } else if (r_texture_import->image->get_format() == Image::FORMAT_RGBAH) {
+ for (int i = 0; i < r_texture_import->slices->size(); i++) {
+ r_texture_import->slices->write[i]->convert(Image::FORMAT_RGBH);
+ }
+ }
+ } else {
+ can_compress_hdr = false;
}
}
- } else {
- can_compress_hdr = false;
- }
- if (is_hdr && can_compress_hdr) {
- if (!can_bptc) {
+ if (!can_compress_hdr) {
//default to rgbe
if (r_texture_import->image->get_format() != Image::FORMAT_RGBE9995) {
for (int i = 0; i < r_texture_import->slices->size(); i++) {
r_texture_import->slices->write[i]->convert(Image::FORMAT_RGBE9995);
}
}
+ use_uncompressed = true;
}
- } else {
- can_bptc = false;
}
- if (is_ldr && can_bptc) {
- if (r_texture_import->bptc_ldr == 0 || (r_texture_import->bptc_ldr == 1 && !(r_texture_import->used_channels == Image::USED_CHANNELS_LA || r_texture_import->used_channels == Image::USED_CHANNELS_RGBA))) {
- can_bptc = false;
- }
- }
- if (!(r_texture_import->used_channels == Image::USED_CHANNELS_LA || r_texture_import->used_channels == Image::USED_CHANNELS_RGBA)) {
- if (GLOBAL_GET("rendering/textures/vram_compression/import_etc2")) {
- _save_tex(*r_texture_import->slices, r_texture_import->save_path + ".etc2." + extension, r_texture_import->compress_mode, r_texture_import->lossy, Image::COMPRESS_ETC2, *r_texture_import->csource, r_texture_import->used_channels, r_texture_import->mipmaps, true);
- r_texture_import->platform_variants->push_back("etc2");
- r_texture_import->formats_imported.push_back("etc2");
+ if (use_uncompressed) {
+ _save_tex(*r_texture_import->slices, r_texture_import->save_path + "." + extension, COMPRESS_VRAM_UNCOMPRESSED, r_texture_import->lossy, Image::COMPRESS_S3TC /* IGNORED */, *r_texture_import->csource, r_texture_import->used_channels, r_texture_import->mipmaps, false);
+ } else {
+ if (can_s3tc_bptc) {
+ Image::CompressMode image_compress_mode;
+ String image_compress_format;
+ if (r_texture_import->high_quality || is_hdr) {
+ image_compress_mode = Image::COMPRESS_BPTC;
+ image_compress_format = "bptc";
+ } else {
+ image_compress_mode = Image::COMPRESS_S3TC;
+ image_compress_format = "s3tc";
+ }
+ _save_tex(*r_texture_import->slices, r_texture_import->save_path + "." + image_compress_format + "." + extension, r_texture_import->compress_mode, r_texture_import->lossy, image_compress_mode, *r_texture_import->csource, r_texture_import->used_channels, r_texture_import->mipmaps, true);
+ r_texture_import->platform_variants->push_back(image_compress_format);
}
- if (can_bptc || can_s3tc) {
- _save_tex(*r_texture_import->slices, r_texture_import->save_path + ".s3tc." + extension, r_texture_import->compress_mode, r_texture_import->lossy, can_bptc ? Image::COMPRESS_BPTC : Image::COMPRESS_S3TC, *r_texture_import->csource, r_texture_import->used_channels, r_texture_import->mipmaps, false);
- r_texture_import->platform_variants->push_back("s3tc");
- r_texture_import->formats_imported.push_back("s3tc");
+ if (can_etc2_astc) {
+ Image::CompressMode image_compress_mode;
+ String image_compress_format;
+ if (r_texture_import->high_quality || is_hdr) {
+ image_compress_mode = Image::COMPRESS_ASTC;
+ image_compress_format = "astc";
+ } else {
+ image_compress_mode = Image::COMPRESS_ETC2;
+ image_compress_format = "etc2";
+ }
+ _save_tex(*r_texture_import->slices, r_texture_import->save_path + "." + image_compress_format + "." + extension, r_texture_import->compress_mode, r_texture_import->lossy, image_compress_mode, *r_texture_import->csource, r_texture_import->used_channels, r_texture_import->mipmaps, true);
+ r_texture_import->platform_variants->push_back(image_compress_format);
}
- return;
}
- EditorNode::add_io_error(vformat(TTR("%s: No suitable PC VRAM compression algorithm enabled in Project Settings (S3TC or BPTC). This texture may not display correctly on desktop platforms."), p_source_file));
}
diff --git a/editor/import/resource_importer_layered_texture.h b/editor/import/resource_importer_layered_texture.h
index 5118ad7ba4..52fd37639d 100644
--- a/editor/import/resource_importer_layered_texture.h
+++ b/editor/import/resource_importer_layered_texture.h
@@ -51,8 +51,8 @@ public:
int compress_mode = 0;
float lossy = 1.0;
int hdr_compression = 0;
- int bptc_ldr = 0;
bool mipmaps = true;
+ bool high_quality = false;
Image::UsedChannels used_channels = Image::USED_CHANNELS_RGBA;
virtual ~LayeredTextureImport() {}
};
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 102fa903b8..6c6c89bcc0 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -1085,10 +1085,10 @@ Node *ResourceImporterScene::_post_fix_animations(Node *p_node, Node *p_root, co
return p_node;
}
-Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap<Ref<ImporterMesh>, Vector<Ref<Shape3D>>> &collision_map, Pair<PackedVector3Array, PackedInt32Array> &r_occluder_arrays, HashSet<Ref<ImporterMesh>> &r_scanned_meshes, const Dictionary &p_node_data, const Dictionary &p_material_data, const Dictionary &p_animation_data, float p_animation_fps) {
+Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap<Ref<ImporterMesh>, Vector<Ref<Shape3D>>> &collision_map, Pair<PackedVector3Array, PackedInt32Array> &r_occluder_arrays, HashSet<Ref<ImporterMesh>> &r_scanned_meshes, const Dictionary &p_node_data, const Dictionary &p_material_data, const Dictionary &p_animation_data, float p_animation_fps, float p_applied_root_scale) {
// children first
for (int i = 0; i < p_node->get_child_count(); i++) {
- Node *r = _post_fix_node(p_node->get_child(i), p_root, collision_map, r_occluder_arrays, r_scanned_meshes, p_node_data, p_material_data, p_animation_data, p_animation_fps);
+ Node *r = _post_fix_node(p_node->get_child(i), p_root, collision_map, r_occluder_arrays, r_scanned_meshes, p_node_data, p_material_data, p_animation_data, p_animation_fps, p_applied_root_scale);
if (!r) {
i--; //was erased
}
@@ -1231,7 +1231,8 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap<
} else {
shapes = get_collision_shapes(
m->get_mesh(),
- node_settings);
+ node_settings,
+ p_applied_root_scale);
}
if (shapes.size()) {
@@ -1242,6 +1243,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap<
p_node->add_child(col, true);
col->set_owner(p_node->get_owner());
col->set_transform(get_collision_shapes_transform(node_settings));
+ col->set_position(p_applied_root_scale * col->get_position());
base = col;
} break;
case MESH_PHYSICS_RIGID_BODY_AND_MESH: {
@@ -1249,6 +1251,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap<
rigid_body->set_name(p_node->get_name());
p_node->replace_by(rigid_body);
rigid_body->set_transform(mi->get_transform() * get_collision_shapes_transform(node_settings));
+ rigid_body->set_position(p_applied_root_scale * rigid_body->get_position());
p_node = rigid_body;
mi->set_transform(Transform3D());
rigid_body->add_child(mi, true);
@@ -1258,6 +1261,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap<
case MESH_PHYSICS_STATIC_COLLIDER_ONLY: {
StaticBody3D *col = memnew(StaticBody3D);
col->set_transform(mi->get_transform() * get_collision_shapes_transform(node_settings));
+ col->set_position(p_applied_root_scale * col->get_position());
col->set_name(p_node->get_name());
p_node->replace_by(col);
memdelete(p_node);
@@ -1267,6 +1271,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap<
case MESH_PHYSICS_AREA_ONLY: {
Area3D *area = memnew(Area3D);
area->set_transform(mi->get_transform() * get_collision_shapes_transform(node_settings));
+ area->set_position(p_applied_root_scale * area->get_position());
area->set_name(p_node->get_name());
p_node->replace_by(area);
memdelete(p_node);
@@ -1865,6 +1870,7 @@ void ResourceImporterScene::get_import_options(const String &p_path, List<Import
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/import"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "animation/fps", PROPERTY_HINT_RANGE, "1,120,1"), 30));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/trimming"), false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/remove_immutable_tracks"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "import_script/path", PROPERTY_HINT_FILE, script_ext_hint), ""));
r_options->push_back(ImportOption(PropertyInfo(Variant::DICTIONARY, "_subresources", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), Dictionary()));
@@ -2397,7 +2403,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
fps = (float)p_options[SNAME("animation/fps")];
}
_pre_fix_animations(scene, scene, node_data, animation_data, fps);
- _post_fix_node(scene, scene, collision_map, occluder_arrays, scanned_meshes, node_data, material_data, animation_data, fps);
+ _post_fix_node(scene, scene, collision_map, occluder_arrays, scanned_meshes, node_data, material_data, animation_data, fps, apply_root ? root_scale : 1.0);
_post_fix_animations(scene, scene, node_data, animation_data, fps);
String root_type = p_options["nodes/root_type"];
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index 2d08d4df50..aa057d3404 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -279,7 +279,7 @@ public:
Node *_pre_fix_node(Node *p_node, Node *p_root, HashMap<Ref<ImporterMesh>, Vector<Ref<Shape3D>>> &r_collision_map, Pair<PackedVector3Array, PackedInt32Array> *r_occluder_arrays, List<Pair<NodePath, Node *>> &r_node_renames);
Node *_pre_fix_animations(Node *p_node, Node *p_root, const Dictionary &p_node_data, const Dictionary &p_animation_data, float p_animation_fps);
- Node *_post_fix_node(Node *p_node, Node *p_root, HashMap<Ref<ImporterMesh>, Vector<Ref<Shape3D>>> &collision_map, Pair<PackedVector3Array, PackedInt32Array> &r_occluder_arrays, HashSet<Ref<ImporterMesh>> &r_scanned_meshes, const Dictionary &p_node_data, const Dictionary &p_material_data, const Dictionary &p_animation_data, float p_animation_fps);
+ Node *_post_fix_node(Node *p_node, Node *p_root, HashMap<Ref<ImporterMesh>, Vector<Ref<Shape3D>>> &collision_map, Pair<PackedVector3Array, PackedInt32Array> &r_occluder_arrays, HashSet<Ref<ImporterMesh>> &r_scanned_meshes, const Dictionary &p_node_data, const Dictionary &p_material_data, const Dictionary &p_animation_data, float p_animation_fps, float p_applied_root_scale);
Node *_post_fix_animations(Node *p_node, Node *p_root, const Dictionary &p_node_data, const Dictionary &p_animation_data, float p_animation_fps);
Ref<Animation> _save_animation_to_file(Ref<Animation> anim, bool p_save_to_file, String p_save_to_path, bool p_keep_custom_tracks);
@@ -298,7 +298,7 @@ public:
ResourceImporterScene(bool p_animation_import = false);
template <class M>
- static Vector<Ref<Shape3D>> get_collision_shapes(const Ref<Mesh> &p_mesh, const M &p_options);
+ static Vector<Ref<Shape3D>> get_collision_shapes(const Ref<Mesh> &p_mesh, const M &p_options, float p_applied_root_scale);
template <class M>
static Transform3D get_collision_shapes_transform(const M &p_options);
@@ -314,7 +314,7 @@ public:
};
template <class M>
-Vector<Ref<Shape3D>> ResourceImporterScene::get_collision_shapes(const Ref<Mesh> &p_mesh, const M &p_options) {
+Vector<Ref<Shape3D>> ResourceImporterScene::get_collision_shapes(const Ref<Mesh> &p_mesh, const M &p_options, float p_applied_root_scale) {
ShapeType generate_shape_type = SHAPE_TYPE_DECOMPOSE_CONVEX;
if (p_options.has(SNAME("physics/shape_type"))) {
generate_shape_type = (ShapeType)p_options[SNAME("physics/shape_type")].operator int();
@@ -409,7 +409,7 @@ Vector<Ref<Shape3D>> ResourceImporterScene::get_collision_shapes(const Ref<Mesh>
Ref<BoxShape3D> box;
box.instantiate();
if (p_options.has(SNAME("primitive/size"))) {
- box->set_size(p_options[SNAME("primitive/size")]);
+ box->set_size(p_options[SNAME("primitive/size")].operator Vector3() * p_applied_root_scale);
}
Vector<Ref<Shape3D>> shapes;
@@ -420,7 +420,7 @@ Vector<Ref<Shape3D>> ResourceImporterScene::get_collision_shapes(const Ref<Mesh>
Ref<SphereShape3D> sphere;
sphere.instantiate();
if (p_options.has(SNAME("primitive/radius"))) {
- sphere->set_radius(p_options[SNAME("primitive/radius")]);
+ sphere->set_radius(p_options[SNAME("primitive/radius")].operator float() * p_applied_root_scale);
}
Vector<Ref<Shape3D>> shapes;
@@ -430,10 +430,10 @@ Vector<Ref<Shape3D>> ResourceImporterScene::get_collision_shapes(const Ref<Mesh>
Ref<CylinderShape3D> cylinder;
cylinder.instantiate();
if (p_options.has(SNAME("primitive/height"))) {
- cylinder->set_height(p_options[SNAME("primitive/height")]);
+ cylinder->set_height(p_options[SNAME("primitive/height")].operator float() * p_applied_root_scale);
}
if (p_options.has(SNAME("primitive/radius"))) {
- cylinder->set_radius(p_options[SNAME("primitive/radius")]);
+ cylinder->set_radius(p_options[SNAME("primitive/radius")].operator float() * p_applied_root_scale);
}
Vector<Ref<Shape3D>> shapes;
@@ -443,10 +443,10 @@ Vector<Ref<Shape3D>> ResourceImporterScene::get_collision_shapes(const Ref<Mesh>
Ref<CapsuleShape3D> capsule;
capsule.instantiate();
if (p_options.has(SNAME("primitive/height"))) {
- capsule->set_height(p_options[SNAME("primitive/height")]);
+ capsule->set_height(p_options[SNAME("primitive/height")].operator float() * p_applied_root_scale);
}
if (p_options.has(SNAME("primitive/radius"))) {
- capsule->set_radius(p_options[SNAME("primitive/radius")]);
+ capsule->set_radius(p_options[SNAME("primitive/radius")].operator float() * p_applied_root_scale);
}
Vector<Ref<Shape3D>> shapes;
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index 2f543ea02d..c05e7582eb 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -169,9 +169,14 @@ String ResourceImporterTexture::get_resource_type() const {
}
bool ResourceImporterTexture::get_option_visibility(const String &p_path, const String &p_option, const HashMap<StringName, Variant> &p_options) const {
- if (p_option == "compress/lossy_quality") {
+ if (p_option == "compress/high_quality" || p_option == "compress/hdr_compression") {
int compress_mode = int(p_options["compress/mode"]);
- if (compress_mode != COMPRESS_LOSSY && compress_mode != COMPRESS_VRAM_COMPRESSED) {
+ if (compress_mode != COMPRESS_VRAM_COMPRESSED) {
+ return false;
+ }
+ } else if (p_option == "compress/lossy_quality") {
+ int compress_mode = int(p_options["compress/mode"]);
+ if (compress_mode != COMPRESS_LOSSY) {
return false;
}
} else if (p_option == "compress/hdr_mode") {
@@ -186,15 +191,6 @@ bool ResourceImporterTexture::get_option_visibility(const String &p_path, const
}
} else if (p_option == "mipmaps/limit") {
return p_options["mipmaps/generate"];
-
- } else if (p_option == "compress/bptc_ldr") {
- int compress_mode = int(p_options["compress/mode"]);
- if (compress_mode < COMPRESS_VRAM_COMPRESSED) {
- return false;
- }
- if (!GLOBAL_GET("rendering/textures/vram_compression/import_bptc")) {
- return false;
- }
}
return true;
@@ -216,9 +212,9 @@ String ResourceImporterTexture::get_preset_name(int p_idx) const {
void ResourceImporterTexture::get_import_options(const String &p_path, List<ImportOption> *r_options, int p_preset) const {
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/mode", PROPERTY_HINT_ENUM, "Lossless,Lossy,VRAM Compressed,VRAM Uncompressed,Basis Universal", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), p_preset == PRESET_3D ? 2 : 0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "compress/high_quality"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "compress/lossy_quality", PROPERTY_HINT_RANGE, "0,1,0.01"), 0.7));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/hdr_compression", PROPERTY_HINT_ENUM, "Disabled,Opaque Only,Always"), 1));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/bptc_ldr", PROPERTY_HINT_ENUM, "Disabled,Enabled,RGBA Only"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/normal_map", PROPERTY_HINT_ENUM, "Detect,Enable,Disabled"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/channel_pack", PROPERTY_HINT_ENUM, "sRGB Friendly,Optimized"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "mipmaps/generate"), (p_preset == PRESET_3D ? true : false)));
@@ -289,7 +285,7 @@ void ResourceImporterTexture::save_to_ctex_format(Ref<FileAccess> f, const Ref<I
case COMPRESS_VRAM_COMPRESSED: {
Ref<Image> image = p_image->duplicate();
- image->compress_from_channels(p_compress_format, p_channels, p_lossy_quality);
+ image->compress_from_channels(p_compress_format, p_channels);
f->store_32(CompressedTexture2D::DATA_FORMAT_IMAGE);
f->store_16(image->get_width());
@@ -322,15 +318,11 @@ void ResourceImporterTexture::save_to_ctex_format(Ref<FileAccess> f, const Ref<I
f->store_16(p_image->get_height());
f->store_32(p_image->get_mipmap_count());
f->store_32(p_image->get_format());
-
- for (int i = 0; i < p_image->get_mipmap_count() + 1; i++) {
- Vector<uint8_t> data = Image::basis_universal_packer(p_image->get_image_from_mipmap(i), p_channels);
- int data_len = data.size();
- f->store_32(data_len);
-
- const uint8_t *r = data.ptr();
- f->store_buffer(r, data_len);
- }
+ Vector<uint8_t> data = Image::basis_universal_packer(p_image, p_channels);
+ int data_len = data.size();
+ f->store_32(data_len);
+ const uint8_t *r = data.ptr();
+ f->store_buffer(r, data_len);
} break;
}
}
@@ -387,7 +379,7 @@ void ResourceImporterTexture::_save_ctex(const Ref<Image> &p_image, const String
Ref<Image> image = p_image->duplicate();
- if (((p_compress_mode == COMPRESS_BASIS_UNIVERSAL) || (p_compress_mode == COMPRESS_VRAM_COMPRESSED && p_force_po2_for_compressed)) && p_mipmaps) {
+ if (p_force_po2_for_compressed && p_mipmaps && ((p_compress_mode == COMPRESS_BASIS_UNIVERSAL) || (p_compress_mode == COMPRESS_VRAM_COMPRESSED))) {
image->resize_to_po2();
}
@@ -425,7 +417,7 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
const int pack_channels = p_options["compress/channel_pack"];
const int normal = p_options["compress/normal_map"];
const int hdr_compression = p_options["compress/hdr_compression"];
- const int bptc_ldr = p_options["compress/bptc_ldr"];
+ const int high_quality = p_options["compress/high_quality"];
// Mipmaps.
const bool mipmaps = p_options["mipmaps/generate"];
@@ -598,19 +590,22 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
// Android, GLES 2.x
const bool is_hdr = (image->get_format() >= Image::FORMAT_RF && image->get_format() <= Image::FORMAT_RGBE9995);
- bool is_ldr = (image->get_format() >= Image::FORMAT_L8 && image->get_format() <= Image::FORMAT_RGB565);
- const bool can_bptc = GLOBAL_GET("rendering/textures/vram_compression/import_bptc");
- const bool can_s3tc = GLOBAL_GET("rendering/textures/vram_compression/import_s3tc");
+ const bool can_s3tc_bptc = GLOBAL_GET("rendering/textures/vram_compression/import_s3tc_bptc") || OS::get_singleton()->get_preferred_texture_format() == OS::PREFERRED_TEXTURE_FORMAT_S3TC_BPTC;
+ const bool can_etc2_astc = GLOBAL_GET("rendering/textures/vram_compression/import_etc2_astc") || OS::get_singleton()->get_preferred_texture_format() == OS::PREFERRED_TEXTURE_FORMAT_ETC2_ASTC;
- if (can_bptc) {
- // Add to the list anyway.
- formats_imported.push_back("bptc");
+ // Add list of formats imported
+ if (can_s3tc_bptc) {
+ formats_imported.push_back("s3tc_bptc");
+ }
+ if (can_etc2_astc) {
+ formats_imported.push_back("etc2_astc");
}
bool can_compress_hdr = hdr_compression > 0;
bool has_alpha = image->detect_alpha() != Image::ALPHA_NONE;
+ bool use_uncompressed = false;
- if (is_hdr && can_compress_hdr) {
+ if (is_hdr) {
if (has_alpha) {
// Can compress HDR, but HDR with alpha is not compressible.
if (hdr_compression == 2) {
@@ -629,36 +624,41 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
// Fallback to RGBE99995.
if (image->get_format() != Image::FORMAT_RGBE9995) {
image->convert(Image::FORMAT_RGBE9995);
+ use_uncompressed = true;
}
}
}
- bool ok_on_pc = false;
- if (can_bptc || can_s3tc) {
- ok_on_pc = true;
- Image::CompressMode image_compress_mode = Image::COMPRESS_BPTC;
- if (!bptc_ldr && can_s3tc && is_ldr) {
- image_compress_mode = Image::COMPRESS_S3TC;
+ if (use_uncompressed) {
+ _save_ctex(image, p_save_path + ".ctex", COMPRESS_VRAM_UNCOMPRESSED, lossy, Image::COMPRESS_S3TC /*this is ignored */, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, false, mipmap_limit, normal_image, roughness_channel);
+ } else {
+ if (can_s3tc_bptc) {
+ Image::CompressMode image_compress_mode;
+ String image_compress_format;
+ if (high_quality || is_hdr) {
+ image_compress_mode = Image::COMPRESS_BPTC;
+ image_compress_format = "bptc";
+ } else {
+ image_compress_mode = Image::COMPRESS_S3TC;
+ image_compress_format = "s3tc";
+ }
+ _save_ctex(image, p_save_path + "." + image_compress_format + ".ctex", compress_mode, lossy, image_compress_mode, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, false, mipmap_limit, normal_image, roughness_channel);
+ r_platform_variants->push_back(image_compress_format);
}
- _save_ctex(image, p_save_path + ".s3tc.ctex", compress_mode, lossy, image_compress_mode, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, false, mipmap_limit, normal_image, roughness_channel);
- r_platform_variants->push_back("s3tc");
- formats_imported.push_back("s3tc");
- }
-
- if (GLOBAL_GET("rendering/textures/vram_compression/import_etc2")) {
- _save_ctex(image, p_save_path + ".etc2.ctex", compress_mode, lossy, Image::COMPRESS_ETC2, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, true, mipmap_limit, normal_image, roughness_channel);
- r_platform_variants->push_back("etc2");
- formats_imported.push_back("etc2");
- }
- if (GLOBAL_GET("rendering/textures/vram_compression/import_etc")) {
- _save_ctex(image, p_save_path + ".etc.ctex", compress_mode, lossy, Image::COMPRESS_ETC, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, true, mipmap_limit, normal_image, roughness_channel);
- r_platform_variants->push_back("etc");
- formats_imported.push_back("etc");
- }
-
- if (!ok_on_pc) {
- EditorNode::add_io_error(vformat(TTR("%s: No suitable desktop VRAM compression algorithm enabled in Project Settings (S3TC or BPTC). This texture may not display correctly on desktop platforms."), p_source_file));
+ if (can_etc2_astc) {
+ Image::CompressMode image_compress_mode;
+ String image_compress_format;
+ if (high_quality || is_hdr) {
+ image_compress_mode = Image::COMPRESS_ASTC;
+ image_compress_format = "astc";
+ } else {
+ image_compress_mode = Image::COMPRESS_ETC2;
+ image_compress_format = "etc2";
+ }
+ _save_ctex(image, p_save_path + "." + image_compress_format + ".ctex", compress_mode, lossy, image_compress_mode, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, false, mipmap_limit, normal_image, roughness_channel);
+ r_platform_variants->push_back(image_compress_format);
+ }
}
} else {
// Import normally.
@@ -692,10 +692,8 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
}
const char *ResourceImporterTexture::compression_formats[] = {
- "bptc",
- "s3tc",
- "etc",
- "etc2",
+ "s3tc_bptc",
+ "etc2_astc",
nullptr
};
String ResourceImporterTexture::get_import_settings_string() const {
@@ -745,12 +743,16 @@ bool ResourceImporterTexture::are_import_settings_valid(const String &p_path) co
bool valid = true;
while (compression_formats[index]) {
String setting_path = "rendering/textures/vram_compression/import_" + String(compression_formats[index]);
- bool test = GLOBAL_GET(setting_path);
- if (test) {
- if (!formats_imported.has(compression_formats[index])) {
- valid = false;
- break;
+ if (ProjectSettings::get_singleton()->has_setting(setting_path)) {
+ bool test = GLOBAL_GET(setting_path);
+ if (test) {
+ if (!formats_imported.has(compression_formats[index])) {
+ valid = false;
+ break;
+ }
}
+ } else {
+ WARN_PRINT("Setting for imported format not found: " + setting_path);
}
index++;
}
diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp
index 044f7475c2..8d26feebf4 100644
--- a/editor/import/scene_import_settings.cpp
+++ b/editor/import/scene_import_settings.cpp
@@ -441,7 +441,7 @@ void SceneImportSettings::_update_view_gizmos() {
// This collider_view doesn't have a mesh so we need to generate a new one.
// Generate the mesh collider.
- Vector<Ref<Shape3D>> shapes = ResourceImporterScene::get_collision_shapes(mesh_node->get_mesh(), e.value.settings);
+ Vector<Ref<Shape3D>> shapes = ResourceImporterScene::get_collision_shapes(mesh_node->get_mesh(), e.value.settings, 1.0);
const Transform3D transform = ResourceImporterScene::get_collision_shapes_transform(e.value.settings);
Ref<ArrayMesh> collider_view_mesh;
diff --git a/editor/input_event_configuration_dialog.cpp b/editor/input_event_configuration_dialog.cpp
index 08d4bfff4a..fb450a41d3 100644
--- a/editor/input_event_configuration_dialog.cpp
+++ b/editor/input_event_configuration_dialog.cpp
@@ -38,9 +38,10 @@
#include "scene/gui/separator.h"
#include "scene/gui/tree.h"
-void InputEventConfigurationDialog::_set_event(const Ref<InputEvent> &p_event, bool p_update_input_list_selection) {
+void InputEventConfigurationDialog::_set_event(const Ref<InputEvent> &p_event, const Ref<InputEvent> &p_original_event, bool p_update_input_list_selection) {
if (p_event.is_valid()) {
event = p_event;
+ original_event = p_original_event;
// If the event is changed to something which is not the same as the listener,
// clear out the event from the listener text box to avoid confusion.
@@ -61,7 +62,7 @@ void InputEventConfigurationDialog::_set_event(const Ref<InputEvent> &p_event, b
// Update option values and visibility
bool show_mods = false;
bool show_device = false;
- bool show_phys_key = false;
+ bool show_key = false;
if (mod.is_valid()) {
show_mods = true;
@@ -74,9 +75,25 @@ void InputEventConfigurationDialog::_set_event(const Ref<InputEvent> &p_event, b
}
if (k.is_valid()) {
- show_phys_key = true;
- physical_key_checkbox->set_pressed(k->get_physical_keycode() != Key::NONE && k->get_keycode() == Key::NONE);
-
+ show_key = true;
+ if (k->get_keycode() == Key::NONE && k->get_physical_keycode() == Key::NONE && k->get_key_label() != Key::NONE) {
+ key_mode->select(KEYMODE_UNICODE);
+ } else if (k->get_keycode() != Key::NONE) {
+ key_mode->select(KEYMODE_KEYCODE);
+ } else if (k->get_physical_keycode() != Key::NONE) {
+ key_mode->select(KEYMODE_PHY_KEYCODE);
+ } else {
+ // Invalid key.
+ event = Ref<InputEvent>();
+ original_event = Ref<InputEvent>();
+ event_listener->clear_event();
+ event_as_text->set_text(TTR("No Event Configured"));
+
+ additional_options_container->hide();
+ input_list_tree->deselect_all();
+ _update_input_list();
+ return;
+ }
} else if (joyb.is_valid() || joym.is_valid() || mb.is_valid()) {
show_device = true;
_set_current_device(event->get_device());
@@ -84,11 +101,20 @@ void InputEventConfigurationDialog::_set_event(const Ref<InputEvent> &p_event, b
mod_container->set_visible(show_mods);
device_container->set_visible(show_device);
- physical_key_checkbox->set_visible(show_phys_key);
+ key_mode->set_visible(show_key);
additional_options_container->show();
+ // Update mode selector based on original key event.
+ Ref<InputEventKey> ko = p_original_event;
+ if (ko.is_valid()) {
+ key_mode->set_item_disabled(KEYMODE_KEYCODE, ko->get_keycode() == Key::NONE);
+ key_mode->set_item_disabled(KEYMODE_PHY_KEYCODE, ko->get_physical_keycode() == Key::NONE);
+ key_mode->set_item_disabled(KEYMODE_UNICODE, ko->get_key_label() == Key::NONE);
+ }
+
// Update selected item in input list.
if (p_update_input_list_selection && (k.is_valid() || joyb.is_valid() || joym.is_valid() || mb.is_valid())) {
+ in_tree_update = true;
TreeItem *category = input_list_tree->get_root()->get_first_child();
while (category) {
TreeItem *input_item = category->get_first_child();
@@ -97,6 +123,7 @@ void InputEventConfigurationDialog::_set_event(const Ref<InputEvent> &p_event, b
// input_type should always be > 0, unless the tree structure has been misconfigured.
int input_type = input_item->get_parent()->get_meta("__type", 0);
if (input_type == 0) {
+ in_tree_update = false;
return;
}
@@ -112,6 +139,7 @@ void InputEventConfigurationDialog::_set_event(const Ref<InputEvent> &p_event, b
category->set_collapsed(false);
input_item->select(0);
input_list_tree->ensure_cursor_is_visible();
+ in_tree_update = false;
return;
}
input_item = input_item->get_next();
@@ -122,10 +150,12 @@ void InputEventConfigurationDialog::_set_event(const Ref<InputEvent> &p_event, b
category->set_collapsed(true); // Event not in this category, so collapse;
category = category->get_next();
}
+ in_tree_update = false;
}
} else {
// Event is not valid, reset dialog
- event = p_event;
+ event = Ref<InputEvent>();
+ original_event = Ref<InputEvent>();
event_listener->clear_event();
event_as_text->set_text(TTR("No Event Configured"));
@@ -141,8 +171,10 @@ void InputEventConfigurationDialog::_on_listen_input_changed(const Ref<InputEven
return;
}
- // Create an editable reference
+ // Create an editable reference and a copy of full event.
Ref<InputEvent> received_event = p_event;
+ Ref<InputEvent> received_original_event = received_event->duplicate();
+
// Check what the type is and if it is allowed.
Ref<InputEventKey> k = received_event;
Ref<InputEventJoypadButton> joyb = received_event;
@@ -169,12 +201,16 @@ void InputEventConfigurationDialog::_on_listen_input_changed(const Ref<InputEven
}
if (k.is_valid()) {
- k->set_pressed(false); // To avoid serialisation of 'pressed' property - doesn't matter for actions anyway.
- // Maintain physical keycode option state
- if (physical_key_checkbox->is_pressed()) {
+ k->set_pressed(false); // To avoid serialization of 'pressed' property - doesn't matter for actions anyway.
+ if (key_mode->get_selected_id() == KEYMODE_KEYCODE) {
+ k->set_physical_keycode(Key::NONE);
+ k->set_key_label(Key::NONE);
+ } else if (key_mode->get_selected_id() == KEYMODE_PHY_KEYCODE) {
k->set_keycode(Key::NONE);
- } else {
+ k->set_key_label(Key::NONE);
+ } else if (key_mode->get_selected_id() == KEYMODE_UNICODE) {
k->set_physical_keycode(Key::NONE);
+ k->set_keycode(Key::NONE);
}
}
@@ -186,7 +222,7 @@ void InputEventConfigurationDialog::_on_listen_input_changed(const Ref<InputEven
// Maintain device selection.
received_event->set_device(_get_current_device());
- _set_event(received_event);
+ _set_event(received_event, received_original_event);
}
void InputEventConfigurationDialog::_on_listen_focus_changed() {
@@ -326,14 +362,14 @@ void InputEventConfigurationDialog::_mod_toggled(bool p_checked, int p_index) {
}
}
- _set_event(ie);
+ _set_event(ie, original_event);
}
void InputEventConfigurationDialog::_autoremap_command_or_control_toggled(bool p_checked) {
Ref<InputEventWithModifiers> ie = event;
if (ie.is_valid()) {
ie->set_command_or_control_autoremap(p_checked);
- _set_event(ie);
+ _set_event(ie, original_event);
}
if (p_checked) {
@@ -345,27 +381,38 @@ void InputEventConfigurationDialog::_autoremap_command_or_control_toggled(bool p
}
}
-void InputEventConfigurationDialog::_physical_keycode_toggled(bool p_checked) {
+void InputEventConfigurationDialog::_key_mode_selected(int p_mode) {
Ref<InputEventKey> k = event;
-
- if (k.is_null()) {
+ Ref<InputEventKey> ko = original_event;
+ if (k.is_null() || ko.is_null()) {
return;
}
- if (p_checked) {
- k->set_physical_keycode(k->get_keycode());
+ if (key_mode->get_selected_id() == KEYMODE_KEYCODE) {
+ k->set_keycode(ko->get_keycode());
+ k->set_physical_keycode(Key::NONE);
+ k->set_key_label(Key::NONE);
+ } else if (key_mode->get_selected_id() == KEYMODE_PHY_KEYCODE) {
k->set_keycode(Key::NONE);
- } else {
- k->set_keycode((Key)k->get_physical_keycode());
+ k->set_physical_keycode(ko->get_physical_keycode());
+ k->set_key_label(Key::NONE);
+ } else if (key_mode->get_selected_id() == KEYMODE_UNICODE) {
k->set_physical_keycode(Key::NONE);
+ k->set_keycode(Key::NONE);
+ k->set_key_label(ko->get_key_label());
}
- _set_event(k);
+ _set_event(k, original_event);
}
void InputEventConfigurationDialog::_input_list_item_selected() {
TreeItem *selected = input_list_tree->get_selected();
+ // Called form _set_event, do not update for a second time.
+ if (in_tree_update) {
+ return;
+ }
+
// Invalid tree selection - type only exists on the "category" items, which are not a valid selection.
if (selected->has_meta("__type")) {
return;
@@ -379,15 +426,11 @@ void InputEventConfigurationDialog::_input_list_item_selected() {
Ref<InputEventKey> k;
k.instantiate();
- if (physical_key_checkbox->is_pressed()) {
- k->set_physical_keycode(keycode);
- k->set_keycode(Key::NONE);
- } else {
- k->set_physical_keycode(Key::NONE);
- k->set_keycode(keycode);
- }
+ k->set_physical_keycode(keycode);
+ k->set_keycode(keycode);
+ k->set_key_label(keycode);
- // Maintain modifier state from checkboxes
+ // Maintain modifier state from checkboxes.
k->set_alt_pressed(mod_checkboxes[MOD_ALT]->is_pressed());
k->set_shift_pressed(mod_checkboxes[MOD_SHIFT]->is_pressed());
if (autoremap_command_or_control_checkbox->is_pressed()) {
@@ -397,7 +440,23 @@ void InputEventConfigurationDialog::_input_list_item_selected() {
k->set_meta_pressed(mod_checkboxes[MOD_META]->is_pressed());
}
- _set_event(k, false);
+ Ref<InputEventKey> ko = k->duplicate();
+
+ if (key_mode->get_selected_id() == KEYMODE_UNICODE) {
+ key_mode->select(KEYMODE_PHY_KEYCODE);
+ }
+
+ if (key_mode->get_selected_id() == KEYMODE_KEYCODE) {
+ k->set_physical_keycode(Key::NONE);
+ k->set_keycode(keycode);
+ k->set_key_label(Key::NONE);
+ } else if (key_mode->get_selected_id() == KEYMODE_PHY_KEYCODE) {
+ k->set_physical_keycode(keycode);
+ k->set_keycode(Key::NONE);
+ k->set_key_label(Key::NONE);
+ }
+
+ _set_event(k, ko, false);
} break;
case INPUT_MOUSE_BUTTON: {
MouseButton idx = (MouseButton)(int)selected->get_meta("__index");
@@ -417,7 +476,7 @@ void InputEventConfigurationDialog::_input_list_item_selected() {
// Maintain selected device
mb->set_device(_get_current_device());
- _set_event(mb, false);
+ _set_event(mb, mb, false);
} break;
case INPUT_JOY_BUTTON: {
JoyButton idx = (JoyButton)(int)selected->get_meta("__index");
@@ -426,7 +485,7 @@ void InputEventConfigurationDialog::_input_list_item_selected() {
// Maintain selected device
jb->set_device(_get_current_device());
- _set_event(jb, false);
+ _set_event(jb, jb, false);
} break;
case INPUT_JOY_MOTION: {
JoyAxis axis = (JoyAxis)(int)selected->get_meta("__axis");
@@ -440,7 +499,7 @@ void InputEventConfigurationDialog::_input_list_item_selected() {
// Maintain selected device
jm->set_device(_get_current_device());
- _set_event(jm, false);
+ _set_event(jm, jm, false);
} break;
}
}
@@ -470,7 +529,9 @@ void InputEventConfigurationDialog::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
input_list_search->set_right_icon(input_list_search->get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
- physical_key_checkbox->set_icon(get_theme_icon(SNAME("KeyboardPhysical"), SNAME("EditorIcons")));
+ key_mode->set_item_icon(KEYMODE_KEYCODE, get_theme_icon(SNAME("Keyboard"), SNAME("EditorIcons")));
+ key_mode->set_item_icon(KEYMODE_PHY_KEYCODE, get_theme_icon(SNAME("KeyboardPhysical"), SNAME("EditorIcons")));
+ key_mode->set_item_icon(KEYMODE_UNICODE, get_theme_icon(SNAME("KeyboardLabel"), SNAME("EditorIcons")));
icon_cache.keyboard = get_theme_icon(SNAME("Keyboard"), SNAME("EditorIcons"));
icon_cache.mouse = get_theme_icon(SNAME("Mouse"), SNAME("EditorIcons"));
@@ -484,22 +545,22 @@ void InputEventConfigurationDialog::_notification(int p_what) {
void InputEventConfigurationDialog::popup_and_configure(const Ref<InputEvent> &p_event) {
if (p_event.is_valid()) {
- _set_event(p_event);
+ _set_event(p_event, p_event->duplicate());
} else {
// Clear Event
- _set_event(p_event);
+ _set_event(Ref<InputEvent>(), Ref<InputEvent>());
// Clear Checkbox Values
for (int i = 0; i < MOD_MAX; i++) {
mod_checkboxes[i]->set_pressed(false);
}
- // Enable the Physical Key checkbox by default to encourage its use.
+ // Enable the Physical Key by default to encourage its use.
// Physical Key should be used for most game inputs as it allows keys to work
// on non-QWERTY layouts out of the box.
// This is especially important for WASD movement layouts.
- physical_key_checkbox->set_pressed(true);
+ key_mode->select(KEYMODE_PHY_KEYCODE);
autoremap_command_or_control_checkbox->set_pressed(false);
// Select "All Devices" by default.
@@ -621,14 +682,15 @@ InputEventConfigurationDialog::InputEventConfigurationDialog() {
mod_container->hide();
additional_options_container->add_child(mod_container);
- // Physical Key Checkbox
+ // Key Mode Selection
- physical_key_checkbox = memnew(CheckBox);
- physical_key_checkbox->set_text(TTR("Use Physical Keycode"));
- physical_key_checkbox->set_tooltip_text(TTR("Stores the physical position of the key on the keyboard rather than the key's value. Used for compatibility with non-latin layouts.\nThis should generally be enabled for most game shortcuts, but not in non-game applications."));
- physical_key_checkbox->connect("toggled", callable_mp(this, &InputEventConfigurationDialog::_physical_keycode_toggled));
- physical_key_checkbox->hide();
- additional_options_container->add_child(physical_key_checkbox);
+ key_mode = memnew(OptionButton);
+ key_mode->add_item(TTR("Keycode (Latin Equivalent)"), KEYMODE_KEYCODE);
+ key_mode->add_item(TTR("Physical Keycode (Position on US QWERTY Keyboard)"), KEYMODE_PHY_KEYCODE);
+ key_mode->add_item(TTR("Key Label (Unicode, Case-Insensitive)"), KEYMODE_UNICODE);
+ key_mode->connect("item_selected", callable_mp(this, &InputEventConfigurationDialog::_key_mode_selected));
+ key_mode->hide();
+ additional_options_container->add_child(key_mode);
main_vbox->add_child(additional_options_container);
}
diff --git a/editor/input_event_configuration_dialog.h b/editor/input_event_configuration_dialog.h
index 67906233dd..e7ab0da4d6 100644
--- a/editor/input_event_configuration_dialog.h
+++ b/editor/input_event_configuration_dialog.h
@@ -50,7 +50,10 @@ private:
Ref<Texture2D> joypad_axis;
} icon_cache;
- Ref<InputEvent> event = Ref<InputEvent>();
+ Ref<InputEvent> event;
+ Ref<InputEvent> original_event;
+
+ bool in_tree_update = false;
// Listening for input
EventListenerLineEdit *event_listener = nullptr;
@@ -88,9 +91,15 @@ private:
CheckBox *mod_checkboxes[MOD_MAX];
CheckBox *autoremap_command_or_control_checkbox = nullptr;
- CheckBox *physical_key_checkbox = nullptr;
+ enum KeyMode {
+ KEYMODE_KEYCODE,
+ KEYMODE_PHY_KEYCODE,
+ KEYMODE_UNICODE,
+ };
+
+ OptionButton *key_mode = nullptr;
- void _set_event(const Ref<InputEvent> &p_event, bool p_update_input_list_selection = true);
+ void _set_event(const Ref<InputEvent> &p_event, const Ref<InputEvent> &p_original_event, bool p_update_input_list_selection = true);
void _on_listen_input_changed(const Ref<InputEvent> &p_event);
void _on_listen_focus_changed();
@@ -100,7 +109,7 @@ private:
void _mod_toggled(bool p_checked, int p_index);
void _autoremap_command_or_control_toggled(bool p_checked);
- void _physical_keycode_toggled(bool p_checked);
+ void _key_mode_selected(int p_mode);
void _device_selection_changed(int p_option_button_index);
void _set_current_device(int p_device);
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
index b28373e308..52482ecb16 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -189,8 +189,7 @@ void InspectorDock::_menu_option_confirm(int p_option, bool p_confirmed) {
int history_id = EditorUndoRedoManager::get_singleton()->get_history_for_object(current).id;
EditorUndoRedoManager::get_singleton()->clear_history(true, history_id);
- EditorNode::get_singleton()->get_editor_plugins_over()->edit(nullptr);
- EditorNode::get_singleton()->get_editor_plugins_over()->edit(current);
+ EditorNode::get_singleton()->edit_item(current, inspector);
}
} break;
diff --git a/editor/multi_node_edit.cpp b/editor/multi_node_edit.cpp
index 2a55ac949f..4f0db70681 100644
--- a/editor/multi_node_edit.cpp
+++ b/editor/multi_node_edit.cpp
@@ -48,6 +48,8 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value,
if (name == "scripts") { // Script set is intercepted at object level (check Variant Object::get()), so use a different name.
name = "script";
+ } else if (name.begins_with("Metadata/")) {
+ name = name.replace_first("Metadata/", "metadata/");
}
Node *node_path_target = nullptr;
@@ -98,6 +100,8 @@ bool MultiNodeEdit::_get(const StringName &p_name, Variant &r_ret) const {
String name = p_name;
if (name == "scripts") { // Script set is intercepted at object level (check Variant Object::get()), so use a different name.
name = "script";
+ } else if (name.begins_with("Metadata/")) {
+ name = name.replace_first("Metadata/", "metadata/");
}
for (const NodePath &E : nodes) {
@@ -137,14 +141,18 @@ void MultiNodeEdit::_get_property_list(List<PropertyInfo> *p_list) const {
List<PropertyInfo> plist;
n->get_property_list(&plist, true);
- for (const PropertyInfo &F : plist) {
+ for (PropertyInfo F : plist) {
if (F.name == "script") {
continue; // Added later manually, since this is intercepted before being set (check Variant Object::get()).
+ } else if (F.name.begins_with("metadata/")) {
+ F.name = F.name.replace_first("metadata/", "Metadata/"); // Trick to not get actual metadata edited from MultiNodeEdit.
}
+
if (!usage.has(F.name)) {
PLData pld;
pld.uses = 0;
pld.info = F;
+ pld.info.name = F.name;
usage[F.name] = pld;
data_list.push_back(usage.getptr(F.name));
}
diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp
index 4f6487fa77..97398b8b69 100644
--- a/editor/plugin_config_dialog.cpp
+++ b/editor/plugin_config_dialog.cpp
@@ -92,7 +92,7 @@ void PluginConfigDialog::_on_confirmed() {
_clear_fields();
}
-void PluginConfigDialog::_on_cancelled() {
+void PluginConfigDialog::_on_canceled() {
_clear_fields();
}
@@ -162,7 +162,7 @@ void PluginConfigDialog::_notification(int p_what) {
case NOTIFICATION_READY: {
connect("confirmed", callable_mp(this, &PluginConfigDialog::_on_confirmed));
- get_cancel_button()->connect("pressed", callable_mp(this, &PluginConfigDialog::_on_cancelled));
+ get_cancel_button()->connect("pressed", callable_mp(this, &PluginConfigDialog::_on_canceled));
} break;
}
}
diff --git a/editor/plugin_config_dialog.h b/editor/plugin_config_dialog.h
index e8df308c54..50b901a39e 100644
--- a/editor/plugin_config_dialog.h
+++ b/editor/plugin_config_dialog.h
@@ -58,7 +58,7 @@ class PluginConfigDialog : public ConfirmationDialog {
void _clear_fields();
void _on_confirmed();
- void _on_cancelled();
+ void _on_canceled();
void _on_language_changed(const int p_language);
void _on_required_text_changed(const String &p_text);
String _get_subfolder();
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index 33aebe5883..df94815105 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -38,6 +38,7 @@
#include "editor/editor_undo_redo_manager.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/gui/check_box.h"
+#include "scene/gui/option_button.h"
#include "scene/gui/panel_container.h"
StringName AnimationNodeBlendSpace1DEditor::get_blend_position_path() const {
@@ -335,6 +336,7 @@ void AnimationNodeBlendSpace1DEditor::_update_space() {
min_value->set_value(blend_space->get_min_space());
sync->set_pressed(blend_space->is_using_sync());
+ interpolation->select(blend_space->get_blend_mode());
label_value->set_text(blend_space->get_value_label());
@@ -361,6 +363,8 @@ void AnimationNodeBlendSpace1DEditor::_config_changed(double) {
undo_redo->add_undo_method(blend_space.ptr(), "set_snap", blend_space->get_snap());
undo_redo->add_do_method(blend_space.ptr(), "set_use_sync", sync->is_pressed());
undo_redo->add_undo_method(blend_space.ptr(), "set_use_sync", blend_space->is_using_sync());
+ undo_redo->add_do_method(blend_space.ptr(), "set_blend_mode", interpolation->get_selected());
+ undo_redo->add_undo_method(blend_space.ptr(), "set_blend_mode", blend_space->get_blend_mode());
undo_redo->add_do_method(this, "_update_space");
undo_redo->add_undo_method(this, "_update_space");
undo_redo->commit_action();
@@ -579,6 +583,10 @@ void AnimationNodeBlendSpace1DEditor::_notification(int p_what) {
tool_erase->set_icon(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")));
snap->set_icon(get_theme_icon(SNAME("SnapGrid"), SNAME("EditorIcons")));
open_editor->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")));
+ interpolation->clear();
+ interpolation->add_icon_item(get_theme_icon(SNAME("TrackContinuous"), SNAME("EditorIcons")), "", 0);
+ interpolation->add_icon_item(get_theme_icon(SNAME("TrackDiscrete"), SNAME("EditorIcons")), "", 1);
+ interpolation->add_icon_item(get_theme_icon(SNAME("TrackCapture"), SNAME("EditorIcons")), "", 2);
} break;
case NOTIFICATION_PROCESS: {
@@ -639,6 +647,7 @@ void AnimationNodeBlendSpace1DEditor::edit(const Ref<AnimationNode> &p_node) {
min_value->set_editable(!read_only);
max_value->set_editable(!read_only);
sync->set_disabled(read_only);
+ interpolation->set_disabled(read_only);
}
AnimationNodeBlendSpace1DEditor *AnimationNodeBlendSpace1DEditor::singleton = nullptr;
@@ -707,6 +716,13 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
top_hb->add_child(sync);
sync->connect("toggled", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_config_changed));
+ top_hb->add_child(memnew(VSeparator));
+
+ top_hb->add_child(memnew(Label(TTR("Blend:"))));
+ interpolation = memnew(OptionButton);
+ top_hb->add_child(interpolation);
+ interpolation->connect("item_selected", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_config_changed));
+
edit_hb = memnew(HBoxContainer);
top_hb->add_child(edit_hb);
edit_hb->add_child(memnew(VSeparator));
diff --git a/editor/plugins/animation_blend_space_1d_editor.h b/editor/plugins/animation_blend_space_1d_editor.h
index e71a4bd1b9..90104fc310 100644
--- a/editor/plugins/animation_blend_space_1d_editor.h
+++ b/editor/plugins/animation_blend_space_1d_editor.h
@@ -41,6 +41,7 @@
#include "scene/gui/tree.h"
class CheckBox;
+class OptionButton;
class PanelContainer;
class AnimationNodeBlendSpace1DEditor : public AnimationTreeNodeEditorPlugin {
@@ -66,6 +67,7 @@ class AnimationNodeBlendSpace1DEditor : public AnimationTreeNodeEditorPlugin {
SpinBox *min_value = nullptr;
CheckBox *sync = nullptr;
+ OptionButton *interpolation = nullptr;
HBoxContainer *edit_hb = nullptr;
SpinBox *edit_value = nullptr;
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index 7f8137f8d5..0daf934e17 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -74,7 +74,6 @@ void AnimationNodeBlendSpace2DEditor::edit(const Ref<AnimationNode> &p_node) {
}
tool_create->set_disabled(read_only);
- interpolation->set_disabled(read_only);
max_x_value->set_editable(!read_only);
min_x_value->set_editable(!read_only);
max_y_value->set_editable(!read_only);
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 14e3cb4b97..f5f9ec11b3 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -187,7 +187,7 @@ void AnimationNodeBlendTreeEditor::update_graph() {
String base_path = AnimationTreeEditor::get_singleton()->get_base_path() + String(E) + "/" + F.name;
EditorProperty *prop = EditorInspector::instantiate_property_editor(tree, F.type, base_path, F.hint, F.hint_string, F.usage);
if (prop) {
- prop->set_read_only(read_only);
+ prop->set_read_only(read_only || (F.usage & PROPERTY_USAGE_READ_ONLY));
prop->set_object_and_property(tree, base_path);
prop->update_property();
prop->set_name_split_ratio(0);
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index caee7514d0..b33ad67f23 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -245,7 +245,7 @@ void AnimationPlayerEditor::_play_bw_pressed() {
player->stop(); //so it won't blend with itself
}
ERR_FAIL_COND_EDMSG(!_validate_tracks(player->get_animation(current)), "Animation tracks may have any invalid key, abort playing.");
- player->play(current, -1, -1, true);
+ player->play_backwards(current);
}
//unstop
@@ -262,7 +262,7 @@ void AnimationPlayerEditor::_play_bw_from_pressed() {
}
ERR_FAIL_COND_EDMSG(!_validate_tracks(player->get_animation(current)), "Animation tracks may have any invalid key, abort playing.");
player->seek(time);
- player->play(current, -1, -1, true);
+ player->play_backwards(current);
}
//unstop
@@ -324,7 +324,7 @@ void AnimationPlayerEditor::_animation_selected(int p_which) {
void AnimationPlayerEditor::_animation_new() {
int count = 1;
- String base = TTR("New Anim");
+ String base = "new_animation";
String current_library_name = "";
if (animation->has_selectable_items()) {
String current_animation_name = animation->get_item_text(animation->get_selected());
@@ -337,7 +337,7 @@ void AnimationPlayerEditor::_animation_new() {
while (true) {
String attempt = base;
if (count > 1) {
- attempt += " (" + itos(count) + ")";
+ attempt += vformat("_%d", count);
}
if (player->has_animation(attempt_prefix + attempt)) {
count++;
@@ -452,7 +452,9 @@ float AnimationPlayerEditor::_get_editor_step() const {
}
void AnimationPlayerEditor::_animation_name_edited() {
- player->stop();
+ if (player->is_playing()) {
+ player->stop();
+ }
String new_name = name->get_text();
if (!AnimationLibrary::is_valid_animation_name(new_name)) {
@@ -1103,9 +1105,24 @@ void AnimationPlayerEditor::_animation_duplicate() {
return;
}
+ int count = 2;
String new_name = current;
- while (player->has_animation(new_name)) {
- new_name = new_name + " (copy)";
+ PackedStringArray split = new_name.split("_");
+ int last_index = split.size() - 1;
+ if (last_index > 0 && split[last_index].is_valid_int() && split[last_index].to_int() >= 0) {
+ count = split[last_index].to_int();
+ split.remove_at(last_index);
+ new_name = String("_").join(split);
+ }
+ while (true) {
+ String attempt = new_name;
+ attempt += vformat("_%d", count);
+ if (player->has_animation(attempt)) {
+ count++;
+ continue;
+ }
+ new_name = attempt;
+ break;
}
if (new_name.contains("/")) {
@@ -1675,7 +1692,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
stop = memnew(Button);
stop->set_flat(true);
hb->add_child(stop);
- stop->set_tooltip_text(TTR("Stop animation playback. (S)"));
+ stop->set_tooltip_text(TTR("Pause/stop animation playback. (S)"));
play = memnew(Button);
play->set_flat(true);
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index a675495429..9632670658 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -1127,7 +1127,7 @@ void AnimationNodeStateMachineEditor::_add_transition(const bool p_nested_action
connecting = false;
}
-void AnimationNodeStateMachineEditor::_connection_draw(const Vector2 &p_from, const Vector2 &p_to, AnimationNodeStateMachineTransition::SwitchMode p_mode, bool p_enabled, bool p_selected, bool p_travel, bool p_auto_advance, bool p_multi_transitions) {
+void AnimationNodeStateMachineEditor::_connection_draw(const Vector2 &p_from, const Vector2 &p_to, AnimationNodeStateMachineTransition::SwitchMode p_mode, bool p_enabled, bool p_selected, bool p_travel, float p_fade_ratio, bool p_auto_advance, bool p_multi_transitions) {
Color linecolor = get_theme_color(SNAME("font_color"), SNAME("Label"));
Color icon_color(1, 1, 1);
Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
@@ -1138,7 +1138,7 @@ void AnimationNodeStateMachineEditor::_connection_draw(const Vector2 &p_from, co
accent.a *= 0.6;
}
- const Ref<Texture2D> icons[6] = {
+ const Ref<Texture2D> icons[] = {
get_theme_icon(SNAME("TransitionImmediateBig"), SNAME("EditorIcons")),
get_theme_icon(SNAME("TransitionSyncBig"), SNAME("EditorIcons")),
get_theme_icon(SNAME("TransitionEndBig"), SNAME("EditorIcons")),
@@ -1146,6 +1146,7 @@ void AnimationNodeStateMachineEditor::_connection_draw(const Vector2 &p_from, co
get_theme_icon(SNAME("TransitionSyncAutoBig"), SNAME("EditorIcons")),
get_theme_icon(SNAME("TransitionEndAutoBig"), SNAME("EditorIcons"))
};
+ const int ICON_COUNT = sizeof(icons) / sizeof(*icons);
if (p_selected) {
state_machine_draw->draw_line(p_from, p_to, accent, 6);
@@ -1153,12 +1154,18 @@ void AnimationNodeStateMachineEditor::_connection_draw(const Vector2 &p_from, co
if (p_travel) {
linecolor = accent;
- linecolor.set_hsv(1.0, linecolor.get_s(), linecolor.get_v());
}
state_machine_draw->draw_line(p_from, p_to, linecolor, 2);
- Ref<Texture2D> icon = icons[p_mode + (p_auto_advance ? 3 : 0)];
+ if (p_fade_ratio > 0.0) {
+ Color fade_linecolor = accent;
+ fade_linecolor.set_hsv(1.0, fade_linecolor.get_s(), fade_linecolor.get_v());
+ state_machine_draw->draw_line(p_from, p_from.lerp(p_to, p_fade_ratio), fade_linecolor, 2);
+ }
+ int icon_index = p_mode + (p_auto_advance ? ICON_COUNT / 2 : 0);
+ ERR_FAIL_COND(icon_index >= ICON_COUNT);
+ Ref<Texture2D> icon = icons[icon_index];
Transform2D xf;
xf.columns[0] = (p_to - p_from).normalized();
@@ -1237,7 +1244,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
if (playback.is_valid()) {
playing = playback->is_playing();
current = playback->get_current_node();
- blend_from = playback->get_blend_from_node();
+ blend_from = playback->get_fading_from_node();
travel_path = playback->get_travel_path();
}
@@ -1327,7 +1334,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
}
}
- _connection_draw(from, to, AnimationNodeStateMachineTransition::SwitchMode(switch_mode->get_selected()), true, false, false, false, false);
+ _connection_draw(from, to, AnimationNodeStateMachineTransition::SwitchMode(switch_mode->get_selected()), true, false, false, 0.0, false, false);
}
Ref<Texture2D> tr_reference_icon = get_theme_icon(SNAME("TransitionImmediateBig"), SNAME("EditorIcons"));
@@ -1357,6 +1364,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
tl.mode = tr->get_switch_mode();
tl.width = tr_bidi_offset;
tl.travel = false;
+ tl.fade_ratio = 0.0;
tl.hidden = false;
if (state_machine->has_local_transition(local_to, local_from)) { //offset if same exists
@@ -1378,6 +1386,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
if (blend_from == local_from && current == local_to) {
tl.travel = true;
+ tl.fade_ratio = MIN(1.0, fading_pos / fading_time);
}
if (travel_path.size()) {
@@ -1418,7 +1427,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
for (int i = 0; i < transition_lines.size(); i++) {
TransitionLine tl = transition_lines[i];
if (!tl.hidden) {
- _connection_draw(tl.from, tl.to, tl.mode, !tl.disabled, tl.selected, tl.travel, tl.auto_advance, !tl.multi_transitions.is_empty());
+ _connection_draw(tl.from, tl.to, tl.mode, !tl.disabled, tl.selected, tl.travel, tl.fade_ratio, tl.auto_advance, !tl.multi_transitions.is_empty());
}
}
@@ -1508,25 +1517,24 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
state_machine_play_pos->queue_redraw();
}
-void AnimationNodeStateMachineEditor::_state_machine_pos_draw() {
+void AnimationNodeStateMachineEditor::_state_machine_pos_draw_individual(String p_name, float p_ratio) {
AnimationTree *tree = AnimationTreeEditor::get_singleton()->get_animation_tree();
if (!tree) {
return;
}
Ref<AnimationNodeStateMachinePlayback> playback = tree->get(AnimationTreeEditor::get_singleton()->get_base_path() + "playback");
-
if (!playback.is_valid() || !playback->is_playing()) {
return;
}
- if (playback->get_current_node() == state_machine->start_node || playback->get_current_node() == state_machine->end_node) {
+ if (p_name == state_machine->start_node || p_name == state_machine->end_node || p_name.is_empty()) {
return;
}
int idx = -1;
for (int i = 0; i < node_rects.size(); i++) {
- if (node_rects[i].node_name == playback->get_current_node()) {
+ if (node_rects[i].node_name == p_name) {
idx = i;
break;
}
@@ -1550,10 +1558,7 @@ void AnimationNodeStateMachineEditor::_state_machine_pos_draw() {
}
to.y = from.y;
- float len = MAX(0.0001, current_length);
-
- float pos = CLAMP(play_pos, 0, len);
- float c = pos / len;
+ float c = p_ratio;
Color fg = get_theme_color(SNAME("font_color"), SNAME("Label"));
Color bg = fg;
bg.a *= 0.3;
@@ -1565,6 +1570,32 @@ void AnimationNodeStateMachineEditor::_state_machine_pos_draw() {
state_machine_play_pos->draw_line(from, to, fg, 2);
}
+void AnimationNodeStateMachineEditor::_state_machine_pos_draw_all() {
+ AnimationTree *tree = AnimationTreeEditor::get_singleton()->get_animation_tree();
+ if (!tree) {
+ return;
+ }
+
+ Ref<AnimationNodeStateMachinePlayback> playback = tree->get(AnimationTreeEditor::get_singleton()->get_base_path() + "playback");
+ if (!playback.is_valid() || !playback->is_playing()) {
+ return;
+ }
+
+ {
+ float len = MAX(0.0001, current_length);
+ float pos = CLAMP(current_play_pos, 0, len);
+ float c = pos / len;
+ _state_machine_pos_draw_individual(playback->get_current_node(), c);
+ }
+
+ {
+ float len = MAX(0.0001, fade_from_length);
+ float pos = CLAMP(fade_from_current_play_pos, 0, len);
+ float c = pos / len;
+ _state_machine_pos_draw_individual(playback->get_fading_from_node(), c);
+ }
+}
+
void AnimationNodeStateMachineEditor::_update_graph() {
if (updating) {
return;
@@ -1687,17 +1718,28 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) {
Vector<StringName> tp;
bool is_playing = false;
StringName current_node;
- StringName blend_from_node;
- play_pos = 0;
+ StringName fading_from_node;
+
+ current_play_pos = 0;
current_length = 0;
+ fade_from_current_play_pos = 0;
+ fade_from_length = 0;
+
+ fading_time = 0;
+ fading_pos = 0;
+
if (playback.is_valid()) {
tp = playback->get_travel_path();
is_playing = playback->is_playing();
current_node = playback->get_current_node();
- blend_from_node = playback->get_blend_from_node();
- play_pos = playback->get_current_play_pos();
+ fading_from_node = playback->get_fading_from_node();
+ current_play_pos = playback->get_current_play_pos();
current_length = playback->get_current_length();
+ fade_from_current_play_pos = playback->get_fade_from_play_pos();
+ fade_from_length = playback->get_fade_from_length();
+ fading_time = playback->get_fading_time();
+ fading_pos = playback->get_fading_pos();
}
{
@@ -1714,12 +1756,19 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) {
}
//redraw if travel state changed
- if (!same_travel_path || last_active != is_playing || last_current_node != current_node || last_blend_from_node != blend_from_node) {
+ if (!same_travel_path ||
+ last_active != is_playing ||
+ last_current_node != current_node ||
+ last_fading_from_node != fading_from_node ||
+ last_fading_time != fading_time ||
+ last_fading_pos != fading_pos) {
state_machine_draw->queue_redraw();
last_travel_path = tp;
last_current_node = current_node;
last_active = is_playing;
- last_blend_from_node = blend_from_node;
+ last_fading_from_node = fading_from_node;
+ last_fading_time = fading_time;
+ last_fading_pos = fading_pos;
state_machine_play_pos->queue_redraw();
}
@@ -1737,14 +1786,15 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) {
// when current_node is a state machine, use playback of current_node to set play_pos
if (current_node_playback.is_valid()) {
- play_pos = current_node_playback->get_current_play_pos();
+ current_play_pos = current_node_playback->get_current_play_pos();
current_length = current_node_playback->get_current_length();
}
}
}
- if (last_play_pos != play_pos) {
- last_play_pos = play_pos;
+ if (last_play_pos != current_play_pos || fade_from_last_play_pos != fade_from_current_play_pos) {
+ last_play_pos = current_play_pos;
+ fade_from_last_play_pos = fade_from_current_play_pos;
state_machine_play_pos->queue_redraw();
}
} break;
@@ -2048,7 +2098,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
state_machine_draw->add_child(state_machine_play_pos);
state_machine_play_pos->set_mouse_filter(MOUSE_FILTER_PASS); //pass all to parent
state_machine_play_pos->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
- state_machine_play_pos->connect("draw", callable_mp(this, &AnimationNodeStateMachineEditor::_state_machine_pos_draw));
+ state_machine_play_pos->connect("draw", callable_mp(this, &AnimationNodeStateMachineEditor::_state_machine_pos_draw_all));
v_scroll = memnew(VScrollBar);
state_machine_draw->add_child(v_scroll);
diff --git a/editor/plugins/animation_state_machine_editor.h b/editor/plugins/animation_state_machine_editor.h
index 46fe13ccc1..66338c820e 100644
--- a/editor/plugins/animation_state_machine_editor.h
+++ b/editor/plugins/animation_state_machine_editor.h
@@ -85,9 +85,12 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
static AnimationNodeStateMachineEditor *singleton;
void _state_machine_gui_input(const Ref<InputEvent> &p_event);
- void _connection_draw(const Vector2 &p_from, const Vector2 &p_to, AnimationNodeStateMachineTransition::SwitchMode p_mode, bool p_enabled, bool p_selected, bool p_travel, bool p_auto_advance, bool p_multi_transitions);
+ void _connection_draw(const Vector2 &p_from, const Vector2 &p_to, AnimationNodeStateMachineTransition::SwitchMode p_mode, bool p_enabled, bool p_selected, bool p_travel, float p_fade_ratio, bool p_auto_advance, bool p_multi_transitions);
+
void _state_machine_draw();
- void _state_machine_pos_draw();
+
+ void _state_machine_pos_draw_individual(String p_name, float p_ratio);
+ void _state_machine_pos_draw_all();
void _update_graph();
@@ -150,6 +153,7 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
float width = 0;
bool selected;
bool travel;
+ float fade_ratio;
bool hidden;
int transition_index;
Vector<TransitionLine> multi_transitions;
@@ -204,13 +208,23 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
void _delete_tree_draw();
bool last_active = false;
- StringName last_blend_from_node;
+ StringName last_fading_from_node;
StringName last_current_node;
Vector<StringName> last_travel_path;
+
+ float fade_from_last_play_pos = 0.0f;
+ float fade_from_current_play_pos = 0.0f;
+ float fade_from_length = 0.0f;
+
float last_play_pos = 0.0f;
- float play_pos = 0.0f;
+ float current_play_pos = 0.0f;
float current_length = 0.0f;
+ float last_fading_time = 0.0f;
+ float last_fading_pos = 0.0f;
+ float fading_time = 0.0f;
+ float fading_pos = 0.0f;
+
float error_time = 0.0f;
String error_text;
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index 720deb0b92..ab46e8f04a 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -65,13 +65,14 @@ void AnimationTreeEditor::edit(AnimationTree *p_tree) {
tree = p_tree;
Vector<String> path;
- if (tree && tree->has_meta("_tree_edit_path")) {
- path = tree->get_meta("_tree_edit_path");
- } else {
- current_root = ObjectID();
+ if (tree) {
+ if (tree->has_meta("_tree_edit_path")) {
+ path = tree->get_meta("_tree_edit_path");
+ } else {
+ current_root = ObjectID();
+ }
+ edit_path(path);
}
-
- edit_path(path);
}
void AnimationTreeEditor::_node_removed(Node *p_node) {
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index eab5eb0404..2639765283 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -107,7 +107,7 @@ void EditorAssetLibraryItem::_bind_methods() {
EditorAssetLibraryItem::EditorAssetLibraryItem() {
Ref<StyleBoxEmpty> border;
border.instantiate();
- border->set_default_margin_all(5 * EDSCALE);
+ border->set_content_margin_all(5 * EDSCALE);
add_theme_style_override("panel", border);
HBoxContainer *hb = memnew(HBoxContainer);
@@ -1549,7 +1549,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
Ref<StyleBoxEmpty> border2;
border2.instantiate();
- border2->set_default_margin_individual(15 * EDSCALE, 15 * EDSCALE, 35 * EDSCALE, 15 * EDSCALE);
+ border2->set_content_margin_individual(15 * EDSCALE, 15 * EDSCALE, 35 * EDSCALE, 15 * EDSCALE);
PanelContainer *library_vb_border = memnew(PanelContainer);
library_scroll->add_child(library_vb_border);
diff --git a/editor/plugins/bit_map_editor_plugin.cpp b/editor/plugins/bit_map_editor_plugin.cpp
index 4f82aaf071..30fc60b0e0 100644
--- a/editor/plugins/bit_map_editor_plugin.cpp
+++ b/editor/plugins/bit_map_editor_plugin.cpp
@@ -53,7 +53,7 @@ BitMapEditor::BitMapEditor() {
// Reduce extra padding on top and bottom of size label.
Ref<StyleBoxEmpty> stylebox;
stylebox.instantiate();
- stylebox->set_default_margin(SIDE_RIGHT, 4 * EDSCALE);
+ stylebox->set_content_margin(SIDE_RIGHT, 4 * EDSCALE);
size_label->add_theme_style_override("normal", stylebox);
}
diff --git a/editor/plugins/bone_map_editor_plugin.cpp b/editor/plugins/bone_map_editor_plugin.cpp
index c913a9b0ab..3d94dd13a7 100644
--- a/editor/plugins/bone_map_editor_plugin.cpp
+++ b/editor/plugins/bone_map_editor_plugin.cpp
@@ -566,9 +566,9 @@ int BoneMapper::search_bone_by_name(Skeleton3D *p_skeleton, Vector<String> p_pic
if (hit_list.size() > 0) {
shortest = hit_list[0];
- for (uint32_t i = 0; i < hit_list.size(); i++) {
- if (hit_list[i].length() < shortest.length()) {
- shortest = hit_list[i]; // Prioritize parent.
+ for (const String &hit : hit_list) {
+ if (hit.length() < shortest.length()) {
+ shortest = hit; // Prioritize parent.
}
}
}
@@ -592,9 +592,9 @@ int BoneMapper::search_bone_by_name(Skeleton3D *p_skeleton, Vector<String> p_pic
if (hit_list.size() > 0) {
shortest = hit_list[0];
- for (uint32_t i = 0; i < hit_list.size(); i++) {
- if (hit_list[i].length() <= shortest.length()) {
- shortest = hit_list[i]; // Prioritize parent.
+ for (const String &hit : hit_list) {
+ if (hit.length() <= shortest.length()) {
+ shortest = hit; // Prioritize parent.
}
}
}
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 4c14755b03..0f9ce89f02 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -246,7 +246,7 @@ public:
}
};
-bool CanvasItemEditor::_is_node_locked(const Node *p_node) {
+bool CanvasItemEditor::_is_node_locked(const Node *p_node) const {
return p_node->get_meta("_edit_lock_", false);
}
@@ -770,7 +770,7 @@ bool CanvasItemEditor::_select_click_on_item(CanvasItem *item, Point2 p_click_po
return still_selected;
}
-List<CanvasItem *> CanvasItemEditor::_get_edited_canvas_items(bool retrieve_locked, bool remove_canvas_item_if_parent_in_selection) {
+List<CanvasItem *> CanvasItemEditor::_get_edited_canvas_items(bool retrieve_locked, bool remove_canvas_item_if_parent_in_selection) const {
List<CanvasItem *> selection;
for (const KeyValue<Node *, Object *> &E : editor_selection->get_selection()) {
CanvasItem *ci = Object::cast_to<CanvasItem>(E.key);
@@ -1226,7 +1226,6 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
bool panner_active = panner->gui_input(p_event, warped_panning ? viewport->get_global_rect() : Rect2());
if (panner->is_panning() != pan_pressed) {
pan_pressed = panner->is_panning();
- _update_cursor();
}
if (panner_active) {
@@ -1260,57 +1259,25 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
}
}
- Ref<InputEventMagnifyGesture> magnify_gesture = p_event;
- if (magnify_gesture.is_valid() && !p_already_accepted) {
- // Zoom gesture
- _zoom_on_position(zoom * magnify_gesture->get_factor(), magnify_gesture->get_position());
- return true;
- }
-
- Ref<InputEventPanGesture> pan_gesture = p_event;
- if (pan_gesture.is_valid() && !p_already_accepted) {
- // If ctrl key pressed, then zoom instead of pan.
- if (pan_gesture->is_ctrl_pressed()) {
- const real_t factor = pan_gesture->get_delta().y;
-
- zoom_widget->set_zoom_by_increments(1);
- if (factor != 1.f) {
- zoom_widget->set_zoom(zoom * ((zoom_widget->get_zoom() / zoom - 1.f) * factor + 1.f));
- }
- _zoom_on_position(zoom_widget->get_zoom(), pan_gesture->get_position());
-
- return true;
- }
-
- // Pan gesture
- const Vector2 delta = (pan_speed / zoom) * pan_gesture->get_delta();
- view_offset.x += delta.x;
- view_offset.y += delta.y;
- update_viewport();
- return true;
- }
-
return false;
}
-void CanvasItemEditor::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
- _pan_callback(-p_scroll_vec * pan_speed);
-}
-
-void CanvasItemEditor::_pan_callback(Vector2 p_scroll_vec) {
+void CanvasItemEditor::_pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event) {
view_offset.x -= p_scroll_vec.x / zoom;
view_offset.y -= p_scroll_vec.y / zoom;
update_viewport();
}
-void CanvasItemEditor::_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt) {
- int scroll_sign = (int)SIGN(p_scroll_vec.y);
- // Inverted so that scrolling up (-1) zooms in, scrolling down (+1) zooms out.
- zoom_widget->set_zoom_by_increments(-scroll_sign, p_alt);
- if (!Math::is_equal_approx(ABS(p_scroll_vec.y), (real_t)1.0)) {
- // Handle high-precision (analog) scrolling.
- zoom_widget->set_zoom(zoom * ((zoom_widget->get_zoom() / zoom - 1.f) * ABS(p_scroll_vec.y) + 1.f));
+void CanvasItemEditor::_zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event) {
+ Ref<InputEventMouseButton> mb = p_event;
+ if (mb.is_valid()) {
+ // Special behvior for scroll events, as the zoom_by_increment method can smartly end up on powers of two.
+ int increment = p_zoom_factor > 1.0 ? 1 : -1;
+ zoom_widget->set_zoom_by_increments(increment, mb->is_alt_pressed());
+ } else {
+ zoom_widget->set_zoom(zoom_widget->get_zoom() * p_zoom_factor);
}
+
_zoom_on_position(zoom_widget->get_zoom(), p_origin);
}
@@ -2570,8 +2537,10 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
// Handles the mouse hovering
_gui_input_hover(p_event);
- // Change the cursor
- _update_cursor();
+ if (mb.is_valid()) {
+ // Update the default cursor.
+ _update_cursor();
+ }
// Grab focus
if (!viewport->has_focus() && (!get_viewport()->gui_get_focus_owner() || !get_viewport()->gui_get_focus_owner()->is_text_field())) {
@@ -2580,6 +2549,31 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
}
void CanvasItemEditor::_update_cursor() {
+ // Choose the correct default cursor.
+ CursorShape c = CURSOR_ARROW;
+ switch (tool) {
+ case TOOL_MOVE:
+ c = CURSOR_MOVE;
+ break;
+ case TOOL_EDIT_PIVOT:
+ c = CURSOR_CROSS;
+ break;
+ case TOOL_PAN:
+ c = CURSOR_DRAG;
+ break;
+ case TOOL_RULER:
+ c = CURSOR_CROSS;
+ break;
+ default:
+ break;
+ }
+ if (pan_pressed) {
+ c = CURSOR_DRAG;
+ }
+ set_default_cursor_shape(c);
+}
+
+Control::CursorShape CanvasItemEditor::get_cursor_shape(const Point2 &p_pos) const {
// Compute an eventual rotation of the cursor
const CursorShape rotation_array[4] = { CURSOR_HSIZE, CURSOR_BDIAGSIZE, CURSOR_VSIZE, CURSOR_FDIAGSIZE };
int rotation_array_index = 0;
@@ -2601,26 +2595,8 @@ void CanvasItemEditor::_update_cursor() {
}
// Choose the correct cursor
- CursorShape c = CURSOR_ARROW;
+ CursorShape c = get_default_cursor_shape();
switch (drag_type) {
- case DRAG_NONE:
- switch (tool) {
- case TOOL_MOVE:
- c = CURSOR_MOVE;
- break;
- case TOOL_EDIT_PIVOT:
- c = CURSOR_CROSS;
- break;
- case TOOL_PAN:
- c = CURSOR_DRAG;
- break;
- case TOOL_RULER:
- c = CURSOR_CROSS;
- break;
- default:
- break;
- }
- break;
case DRAG_LEFT:
case DRAG_RIGHT:
c = rotation_array[rotation_array_index];
@@ -2662,16 +2638,7 @@ void CanvasItemEditor::_update_cursor() {
if (pan_pressed) {
c = CURSOR_DRAG;
}
-
- if (c != viewport->get_default_cursor_shape()) {
- viewport->set_default_cursor_shape(c);
-
- // Force refresh cursor if it's over the viewport.
- if (viewport->get_global_rect().has_point(get_global_mouse_position())) {
- DisplayServer::CursorShape ds_cursor_shape = (DisplayServer::CursorShape)viewport->get_default_cursor_shape();
- DisplayServer::get_singleton()->cursor_set_shape(ds_cursor_shape);
- }
- }
+ return c;
}
void CanvasItemEditor::_draw_text_at_position(Point2 p_position, String p_string, Side p_side) {
@@ -3869,7 +3836,7 @@ void CanvasItemEditor::_update_editor_settings() {
context_menu_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("ContextualToolbar"), SNAME("EditorStyles")));
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/2d_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning")));
- pan_speed = int(EDITOR_GET("editors/panning/2d_editor_pan_speed"));
+ panner->set_scroll_speed(EDITOR_GET("editors/panning/2d_editor_pan_speed"));
warped_panning = bool(EDITOR_GET("editors/panning/warped_mouse_panning"));
}
@@ -3958,8 +3925,8 @@ void CanvasItemEditor::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
select_sb->set_texture(get_theme_icon(SNAME("EditorRect2D"), SNAME("EditorIcons")));
- select_sb->set_margin_size_all(4);
- select_sb->set_default_margin_all(4);
+ select_sb->set_texture_margin_all(4);
+ select_sb->set_content_margin_all(4);
AnimationPlayerEditor::get_singleton()->get_track_editor()->connect("visibility_changed", callable_mp(this, &CanvasItemEditor::_keying_changed));
_keying_changed();
@@ -3990,6 +3957,10 @@ void CanvasItemEditor::_selection_changed() {
}
void CanvasItemEditor::edit(CanvasItem *p_canvas_item) {
+ if (!p_canvas_item) {
+ return;
+ }
+
Array selection = editor_selection->get_selected_nodes();
if (selection.size() != 1 || Object::cast_to<Node>(selection[0]) != p_canvas_item) {
_reset_drag();
@@ -5056,7 +5027,7 @@ CanvasItemEditor::CanvasItemEditor() {
zoom_widget->connect("zoom_changed", callable_mp(this, &CanvasItemEditor::_update_zoom));
panner.instantiate();
- panner->set_callbacks(callable_mp(this, &CanvasItemEditor::_scroll_callback), callable_mp(this, &CanvasItemEditor::_pan_callback), callable_mp(this, &CanvasItemEditor::_zoom_callback));
+ panner->set_callbacks(callable_mp(this, &CanvasItemEditor::_pan_callback), callable_mp(this, &CanvasItemEditor::_zoom_callback));
viewport = memnew(CanvasItemEditorViewport(this));
viewport_scrollable->add_child(viewport);
@@ -5430,11 +5401,13 @@ void CanvasItemEditorPlugin::make_visible(bool p_visible) {
canvas_item_editor->show();
canvas_item_editor->set_physics_process(true);
RenderingServer::get_singleton()->viewport_set_disable_2d(EditorNode::get_singleton()->get_scene_root()->get_viewport_rid(), false);
+ RenderingServer::get_singleton()->viewport_set_environment_mode(EditorNode::get_singleton()->get_scene_root()->get_viewport_rid(), RS::VIEWPORT_ENVIRONMENT_ENABLED);
} else {
canvas_item_editor->hide();
canvas_item_editor->set_physics_process(false);
RenderingServer::get_singleton()->viewport_set_disable_2d(EditorNode::get_singleton()->get_scene_root()->get_viewport_rid(), true);
+ RenderingServer::get_singleton()->viewport_set_environment_mode(EditorNode::get_singleton()->get_scene_root()->get_viewport_rid(), RS::VIEWPORT_ENVIRONMENT_DISABLED);
}
}
@@ -5925,7 +5898,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(CanvasItemEditor *p_canvas_it
EditorNode::get_singleton()->get_gui_base()->add_child(selector);
selector->set_title(TTR("Change Default Type"));
selector->connect("confirmed", callable_mp(this, &CanvasItemEditorViewport::_on_change_type_confirmed));
- selector->connect("cancelled", callable_mp(this, &CanvasItemEditorViewport::_on_change_type_closed));
+ selector->connect("canceled", callable_mp(this, &CanvasItemEditorViewport::_on_change_type_closed));
VBoxContainer *vbc = memnew(VBoxContainer);
selector->add_child(vbc);
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index f4fcc8a3d2..ebe87a56f7 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -363,12 +363,10 @@ private:
Ref<ViewPanner> panner;
bool warped_panning = true;
- int pan_speed = 20;
- void _scroll_callback(Vector2 p_scroll_vec, bool p_alt);
- void _pan_callback(Vector2 p_scroll_vec);
- void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
+ void _pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event);
+ void _zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event);
- bool _is_node_locked(const Node *p_node);
+ bool _is_node_locked(const Node *p_node) const;
bool _is_node_movable(const Node *p_node, bool p_popup_warning = false);
void _find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, Vector<_SelectResult> &r_items, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D());
void _get_canvas_items_at_pos(const Point2 &p_pos, Vector<_SelectResult> &r_items, bool p_allow_locked = false);
@@ -402,7 +400,7 @@ private:
void _prepare_grid_menu();
void _on_grid_menu_id_pressed(int p_id);
- List<CanvasItem *> _get_edited_canvas_items(bool retrieve_locked = false, bool remove_canvas_item_if_parent_in_selection = true);
+ List<CanvasItem *> _get_edited_canvas_items(bool retrieve_locked = false, bool remove_canvas_item_if_parent_in_selection = true) const;
Rect2 _get_encompassing_rect_from_list(List<CanvasItem *> p_list);
void _expand_encompassing_rect_using_children(Rect2 &r_rect, const Node *p_node, bool &r_first, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D(), bool include_locked_nodes = true);
Rect2 _get_encompassing_rect(const Node *p_node);
@@ -552,6 +550,8 @@ public:
void focus_selection();
void center_at(const Point2 &p_pos);
+ virtual CursorShape get_cursor_shape(const Point2 &p_pos) const override;
+
EditorSelection *editor_selection = nullptr;
CanvasItemEditor();
diff --git a/editor/plugins/dedicated_server_export_plugin.cpp b/editor/plugins/dedicated_server_export_plugin.cpp
new file mode 100644
index 0000000000..013706034e
--- /dev/null
+++ b/editor/plugins/dedicated_server_export_plugin.cpp
@@ -0,0 +1,139 @@
+/**************************************************************************/
+/* dedicated_server_export_plugin.cpp */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 "dedicated_server_export_plugin.h"
+
+EditorExportPreset::FileExportMode DedicatedServerExportPlugin::_get_export_mode_for_path(const String &p_path) {
+ Ref<EditorExportPreset> preset = get_export_preset();
+ ERR_FAIL_COND_V(preset.is_null(), EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED);
+
+ EditorExportPreset::FileExportMode mode = preset->get_file_export_mode(p_path);
+ if (mode != EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED) {
+ return mode;
+ }
+
+ String path = p_path;
+ if (path.begins_with("res://")) {
+ path = path.substr(6);
+ }
+
+ Vector<String> parts = path.split("/");
+
+ while (parts.size() > 0) {
+ parts.resize(parts.size() - 1);
+
+ String test_path = "res://";
+ if (parts.size() > 0) {
+ test_path += String("/").join(parts) + "/";
+ }
+
+ mode = preset->get_file_export_mode(test_path);
+ if (mode != EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED) {
+ break;
+ }
+ }
+
+ return mode;
+}
+
+PackedStringArray DedicatedServerExportPlugin::_get_export_features(const Ref<EditorExportPlatform> &p_platform, bool p_debug) const {
+ PackedStringArray ret;
+
+ Ref<EditorExportPreset> preset = get_export_preset();
+ ERR_FAIL_COND_V(preset.is_null(), ret);
+
+ if (preset->is_dedicated_server()) {
+ ret.append("dedicated_server");
+ }
+ return ret;
+}
+
+uint64_t DedicatedServerExportPlugin::_get_customization_configuration_hash() const {
+ Ref<EditorExportPreset> preset = get_export_preset();
+ ERR_FAIL_COND_V(preset.is_null(), 0);
+
+ if (preset->get_export_filter() != EditorExportPreset::EXPORT_CUSTOMIZED) {
+ return 0;
+ }
+
+ return preset->get_customized_files().hash();
+}
+
+bool DedicatedServerExportPlugin::_begin_customize_scenes(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features) {
+ Ref<EditorExportPreset> preset = get_export_preset();
+ ERR_FAIL_COND_V(preset.is_null(), false);
+
+ current_export_mode = EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED;
+
+ return preset->get_export_filter() == EditorExportPreset::EXPORT_CUSTOMIZED;
+}
+
+bool DedicatedServerExportPlugin::_begin_customize_resources(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features) {
+ Ref<EditorExportPreset> preset = get_export_preset();
+ ERR_FAIL_COND_V(preset.is_null(), false);
+
+ current_export_mode = EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED;
+
+ return preset->get_export_filter() == EditorExportPreset::EXPORT_CUSTOMIZED;
+}
+
+Node *DedicatedServerExportPlugin::_customize_scene(Node *p_root, const String &p_path) {
+ // Simply set the export mode based on the scene path. All the real
+ // customization happens in _customize_resource().
+ current_export_mode = _get_export_mode_for_path(p_path);
+ return nullptr;
+}
+
+Ref<Resource> DedicatedServerExportPlugin::_customize_resource(const Ref<Resource> &p_resource, const String &p_path) {
+ // If the resource has a path, we use that to get our export mode. But if it
+ // doesn't, we assume that this resource is embedded in the last resource with
+ // a path.
+ if (p_path != "") {
+ current_export_mode = _get_export_mode_for_path(p_path);
+ }
+
+ if (p_resource.is_valid() && current_export_mode == EditorExportPreset::MODE_FILE_STRIP && p_resource->has_method("create_placeholder")) {
+ Callable::CallError err;
+ Ref<Resource> result = const_cast<Resource *>(p_resource.ptr())->callp("create_placeholder", nullptr, 0, err);
+ if (err.error == Callable::CallError::CALL_OK) {
+ return result;
+ }
+ }
+
+ return Ref<Resource>();
+}
+
+void DedicatedServerExportPlugin::_end_customize_scenes() {
+ current_export_mode = EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED;
+}
+
+void DedicatedServerExportPlugin::_end_customize_resources() {
+ current_export_mode = EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED;
+}
diff --git a/editor/plugins/dedicated_server_export_plugin.h b/editor/plugins/dedicated_server_export_plugin.h
new file mode 100644
index 0000000000..cb014ae52d
--- /dev/null
+++ b/editor/plugins/dedicated_server_export_plugin.h
@@ -0,0 +1,58 @@
+/**************************************************************************/
+/* dedicated_server_export_plugin.h */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 DEDICATED_SERVER_EXPORT_PLUGIN_H
+#define DEDICATED_SERVER_EXPORT_PLUGIN_H
+
+#include "editor/export/editor_export.h"
+
+class DedicatedServerExportPlugin : public EditorExportPlugin {
+private:
+ EditorExportPreset::FileExportMode current_export_mode;
+
+ EditorExportPreset::FileExportMode _get_export_mode_for_path(const String &p_path);
+
+protected:
+ String _get_name() const override { return "DedicatedServer"; }
+
+ PackedStringArray _get_export_features(const Ref<EditorExportPlatform> &p_platform, bool p_debug) const override;
+ uint64_t _get_customization_configuration_hash() const override;
+
+ bool _begin_customize_scenes(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features) override;
+ bool _begin_customize_resources(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features) override;
+
+ Node *_customize_scene(Node *p_root, const String &p_path) override;
+ Ref<Resource> _customize_resource(const Ref<Resource> &p_resource, const String &p_path) override;
+
+ void _end_customize_scenes() override;
+ void _end_customize_resources() override;
+};
+
+#endif // DEDICATED_SERVER_EXPORT_PLUGIN_H
diff --git a/editor/plugins/gradient_editor.cpp b/editor/plugins/gradient_editor.cpp
index 3676c2c222..2eb17b3f13 100644
--- a/editor/plugins/gradient_editor.cpp
+++ b/editor/plugins/gradient_editor.cpp
@@ -52,12 +52,12 @@ void GradientEditor::reverse_gradient() {
int GradientEditor::_get_point_from_pos(int x) {
int result = -1;
- int total_w = get_size().width - get_size().height - draw_spacing;
+ int total_w = get_size().width - get_size().height - draw_spacing - handle_width;
float min_distance = 1e20;
for (int i = 0; i < points.size(); i++) {
// Check if we clicked at point.
float distance = ABS(x - points[i].offset * total_w);
- float min = (handle_width / 2 * 1.7); // Make it easier to grab.
+ float min = handle_width * 0.85; // Allow the mouse to be more than half a handle width away for ease of grabbing.
if (distance <= min && distance < min_distance) {
result = i;
min_distance = distance;
@@ -198,116 +198,87 @@ void GradientEditor::gui_input(const Ref<InputEvent> &p_event) {
}
Ref<InputEventMouseButton> mb = p_event;
- // Show color picker on double click.
- if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && mb->is_double_click() && mb->is_pressed()) {
- grabbed = _get_point_from_pos(mb->get_position().x);
- _show_color_picker();
- accept_event();
- return;
- }
-
- // Delete point on right click.
- if (mb.is_valid() && mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed()) {
- grabbed = _get_point_from_pos(mb->get_position().x);
- if (grabbed != -1) {
- points.remove_at(grabbed);
- grabbed = -1;
- grabbing = false;
- queue_redraw();
- emit_signal(SNAME("ramp_changed"));
- accept_event();
- }
- }
-
- // Hold alt key to duplicate selected color.
- if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && mb->is_pressed() && mb->is_alt_pressed()) {
- int x = mb->get_position().x;
- grabbed = _get_point_from_pos(x);
- if (grabbed != -1) {
- int total_w = get_size().width - get_size().height - draw_spacing;
- Gradient::Point new_point = points[grabbed];
- new_point.offset = CLAMP(x / float(total_w), 0, 1);
+ if (mb.is_valid() && mb->is_pressed()) {
+ float adjusted_mb_x = mb->get_position().x - handle_width / 2;
- points.push_back(new_point);
- points.sort();
- for (int i = 0; i < points.size(); ++i) {
- if (points[i].offset == new_point.offset) {
- grabbed = i;
- break;
- }
+ // Delete point on right click.
+ if (mb->get_button_index() == MouseButton::RIGHT) {
+ grabbed = _get_point_from_pos(adjusted_mb_x);
+ if (grabbed != -1) {
+ points.remove_at(grabbed);
+ grabbed = -1;
+ grabbing = false;
+ queue_redraw();
+ emit_signal(SNAME("ramp_changed"));
+ accept_event();
}
-
- emit_signal(SNAME("ramp_changed"));
- queue_redraw();
}
- }
- // Select.
- if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && mb->is_pressed()) {
- queue_redraw();
- int x = mb->get_position().x;
- int total_w = get_size().width - get_size().height - draw_spacing;
+ // Hold Alt key to duplicate selected color.
+ if (mb->get_button_index() == MouseButton::LEFT && mb->is_alt_pressed()) {
+ grabbed = _get_point_from_pos(adjusted_mb_x);
- //Check if color selector was clicked.
- if (x > total_w + draw_spacing) {
- _show_color_picker();
- return;
- }
-
- grabbing = true;
+ if (grabbed != -1) {
+ int total_w = get_size().width - get_size().height - draw_spacing - handle_width;
+ Gradient::Point new_point = points[grabbed];
+ new_point.offset = CLAMP(adjusted_mb_x / float(total_w), 0, 1);
+ points.push_back(new_point);
+ points.sort();
+ for (int i = 0; i < points.size(); ++i) {
+ if (points[i].offset == new_point.offset) {
+ grabbed = i;
+ break;
+ }
+ }
- grabbed = _get_point_from_pos(x);
- //grab or select
- if (grabbed != -1) {
- return;
+ emit_signal(SNAME("ramp_changed"));
+ queue_redraw();
+ }
}
- // Insert point.
- Gradient::Point new_point;
- new_point.offset = CLAMP(x / float(total_w), 0, 1);
-
- Gradient::Point prev;
- Gradient::Point next;
+ // Select.
+ if (mb->get_button_index() == MouseButton::LEFT) {
+ queue_redraw();
+ int total_w = get_size().width - get_size().height - draw_spacing - handle_width;
- int pos = -1;
- for (int i = 0; i < points.size(); i++) {
- if (points[i].offset < new_point.offset) {
- pos = i;
+ // Check if color selector was clicked or ramp was double-clicked.
+ if (adjusted_mb_x > total_w + draw_spacing) {
+ if (!mb->is_double_click()) {
+ _show_color_picker();
+ }
+ return;
+ } else if (mb->is_double_click()) {
+ grabbed = _get_point_from_pos(adjusted_mb_x);
+ _show_color_picker();
+ accept_event();
+ return;
}
- }
- if (pos == -1) {
- prev.color = Color(0, 0, 0);
- prev.offset = 0;
- if (points.size()) {
- next = points[0];
- } else {
- next.color = Color(1, 1, 1);
- next.offset = 1.0;
- }
- } else {
- if (pos == points.size() - 1) {
- next.color = Color(1, 1, 1);
- next.offset = 1.0;
- } else {
- next = points[pos + 1];
+ grabbing = true;
+ grabbed = _get_point_from_pos(adjusted_mb_x);
+
+ // Grab or select.
+ if (grabbed != -1) {
+ return;
}
- prev = points[pos];
- }
- new_point.color = prev.color.lerp(next.color, (new_point.offset - prev.offset) / (next.offset - prev.offset));
+ // Insert point.
+ Gradient::Point new_point;
+ new_point.offset = CLAMP(adjusted_mb_x / float(total_w), 0, 1);
+ new_point.color = gradient->get_color_at_offset(new_point.offset);
- points.push_back(new_point);
- points.sort();
- for (int i = 0; i < points.size(); i++) {
- if (points[i].offset == new_point.offset) {
- grabbed = i;
- break;
+ points.push_back(new_point);
+ points.sort();
+ for (int i = 0; i < points.size(); i++) {
+ if (points[i].offset == new_point.offset) {
+ grabbed = i;
+ break;
+ }
}
- }
- emit_signal(SNAME("ramp_changed"));
+ emit_signal(SNAME("ramp_changed"));
+ }
}
if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && !mb->is_pressed()) {
@@ -321,18 +292,16 @@ void GradientEditor::gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseMotion> mm = p_event;
if (mm.is_valid() && grabbing) {
- int total_w = get_size().width - get_size().height - draw_spacing;
-
- int x = mm->get_position().x;
-
- float newofs = CLAMP(x / float(total_w), 0, 1);
+ float adjusted_mm_x = mm->get_position().x - handle_width / 2;
+ int total_w = get_size().width - get_size().height - draw_spacing - handle_width;
+ float newofs = CLAMP(adjusted_mm_x / float(total_w), 0, 1);
// Snap to "round" coordinates if holding Ctrl.
// Be more precise if holding Shift as well.
if (mm->is_ctrl_pressed()) {
newofs = Math::snapped(newofs, mm->is_shift_pressed() ? 0.025 : 0.1);
} else if (mm->is_shift_pressed()) {
- // Snap to nearest point if holding just Shift
+ // Snap to nearest point if holding just Shift.
const float snap_threshold = 0.03;
float smallest_ofs = snap_threshold;
bool found = false;
@@ -421,7 +390,7 @@ void GradientEditor::_notification(int p_what) {
// Draw borders around color ramp if in focus.
if (has_focus()) {
- draw_rect(Rect2(handle_width / 2, 0, total_w, h), Color(1, 1, 1, 0.9), false);
+ draw_rect(Rect2(handle_width / 2, 0, total_w, h), Color(1, 1, 1, 0.9), false, 1);
}
// Draw point markers.
@@ -432,18 +401,18 @@ void GradientEditor::_notification(int p_what) {
draw_line(Vector2(points[i].offset * total_w + handle_width / 2, 0), Vector2(points[i].offset * total_w + handle_width / 2, h / 2), col);
Rect2 rect = Rect2(points[i].offset * total_w, h / 2, handle_width, h / 2);
draw_rect(rect, points[i].color, true);
- draw_rect(rect, col, false);
+ draw_rect(rect, col, false, 1);
if (grabbed == i) {
const Color focus_color = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
rect = rect.grow(-1);
if (has_focus()) {
- draw_rect(rect, focus_color, false);
+ draw_rect(rect, focus_color, false, 1);
} else {
- draw_rect(rect, focus_color.darkened(0.4), false);
+ draw_rect(rect, focus_color.darkened(0.4), false, 1);
}
rect = rect.grow(-1);
- draw_rect(rect, col, false);
+ draw_rect(rect, col, false, 1);
}
}
@@ -454,7 +423,7 @@ void GradientEditor::_notification(int p_what) {
// Draw with selection color.
draw_rect(Rect2(button_offset, 0, h, h), points[grabbed].color);
} else {
- // If no color selected draw grey color with 'X' on top.
+ // If no color selected draw gray color with 'X' on top.
draw_rect(Rect2(button_offset, 0, h, h), Color(0.5, 0.5, 0.5, 1));
draw_line(Vector2(button_offset, 0), Vector2(button_offset + h, h), Color(1, 1, 1, 0.6));
draw_line(Vector2(button_offset, h), Vector2(button_offset + h, 0), Color(1, 1, 1, 0.6));
diff --git a/editor/plugins/lightmap_gi_editor_plugin.cpp b/editor/plugins/lightmap_gi_editor_plugin.cpp
index 1adcc2a3b4..519cfcaa94 100644
--- a/editor/plugins/lightmap_gi_editor_plugin.cpp
+++ b/editor/plugins/lightmap_gi_editor_plugin.cpp
@@ -35,12 +35,43 @@
void LightmapGIEditorPlugin::_bake_select_file(const String &p_file) {
if (lightmap) {
- LightmapGI::BakeError err;
+ LightmapGI::BakeError err = LightmapGI::BAKE_ERROR_OK;
const uint64_t time_started = OS::get_singleton()->get_ticks_msec();
- if (get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root() == lightmap) {
- err = lightmap->bake(lightmap, p_file, bake_func_step);
+ if (get_tree()->get_edited_scene_root()) {
+ Ref<LightmapGIData> lightmapGIData = lightmap->get_light_data();
+
+ if (lightmapGIData.is_valid()) {
+ String path = lightmapGIData->get_path();
+ if (!path.is_resource_file()) {
+ int srpos = path.find("::");
+ if (srpos != -1) {
+ String base = path.substr(0, srpos);
+ if (ResourceLoader::get_resource_type(base) == "PackedScene") {
+ if (!get_tree()->get_edited_scene_root() || get_tree()->get_edited_scene_root()->get_scene_file_path() != base) {
+ err = LightmapGI::BAKE_ERROR_FOREIGN_DATA;
+ }
+ } else {
+ if (FileAccess::exists(base + ".import")) {
+ err = LightmapGI::BAKE_ERROR_FOREIGN_DATA;
+ }
+ }
+ }
+ } else {
+ if (FileAccess::exists(path + ".import")) {
+ err = LightmapGI::BAKE_ERROR_FOREIGN_DATA;
+ }
+ }
+ }
+
+ if (err == LightmapGI::BAKE_ERROR_OK) {
+ if (get_tree()->get_edited_scene_root() == lightmap) {
+ err = lightmap->bake(lightmap, p_file, bake_func_step);
+ } else {
+ err = lightmap->bake(lightmap->get_parent(), p_file, bake_func_step);
+ }
+ }
} else {
- err = lightmap->bake(lightmap->get_parent(), p_file, bake_func_step);
+ err = LightmapGI::BAKE_ERROR_NO_SCENE_ROOT;
}
bake_func_end(time_started);
@@ -59,16 +90,21 @@ void LightmapGIEditorPlugin::_bake_select_file(const String &p_file) {
file_dialog->set_current_path(scene_path);
file_dialog->popup_file_dialog();
-
} break;
- case LightmapGI::BAKE_ERROR_NO_MESHES:
+ case LightmapGI::BAKE_ERROR_NO_MESHES: {
EditorNode::get_singleton()->show_warning(TTR("No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake Light' flag is on."));
- break;
- case LightmapGI::BAKE_ERROR_CANT_CREATE_IMAGE:
+ } break;
+ case LightmapGI::BAKE_ERROR_CANT_CREATE_IMAGE: {
EditorNode::get_singleton()->show_warning(TTR("Failed creating lightmap images, make sure path is writable."));
- break;
+ } break;
+ case LightmapGI::BAKE_ERROR_NO_SCENE_ROOT: {
+ EditorNode::get_singleton()->show_warning(TTR("No editor scene root found."));
+ } break;
+ case LightmapGI::BAKE_ERROR_FOREIGN_DATA: {
+ EditorNode::get_singleton()->show_warning(TTR("Lightmap data is not local to the scene."));
+ } break;
default: {
- }
+ } break;
}
}
}
diff --git a/editor/plugins/navigation_link_2d_editor_plugin.cpp b/editor/plugins/navigation_link_2d_editor_plugin.cpp
index 21a1d839f0..dff92ced27 100644
--- a/editor/plugins/navigation_link_2d_editor_plugin.cpp
+++ b/editor/plugins/navigation_link_2d_editor_plugin.cpp
@@ -65,20 +65,20 @@ bool NavigationLink2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_e
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) {
if (mb->is_pressed()) {
- // Start location
- if (xform.xform(node->get_start_location()).distance_to(mb->get_position()) < grab_threshold) {
+ // Start position
+ if (xform.xform(node->get_start_position()).distance_to(mb->get_position()) < grab_threshold) {
start_grabbed = true;
- original_start_location = node->get_start_location();
+ original_start_position = node->get_start_position();
return true;
} else {
start_grabbed = false;
}
- // End location
- if (xform.xform(node->get_end_location()).distance_to(mb->get_position()) < grab_threshold) {
+ // End position
+ if (xform.xform(node->get_end_position()).distance_to(mb->get_position()) < grab_threshold) {
end_grabbed = true;
- original_end_location = node->get_end_location();
+ original_end_position = node->get_end_position();
return true;
} else {
@@ -87,10 +87,10 @@ bool NavigationLink2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_e
} else {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
if (start_grabbed) {
- undo_redo->create_action(TTR("Set start_location"));
- undo_redo->add_do_method(node, "set_start_location", node->get_start_location());
+ undo_redo->create_action(TTR("Set start_position"));
+ undo_redo->add_do_method(node, "set_start_position", node->get_start_position());
undo_redo->add_do_method(canvas_item_editor, "update_viewport");
- undo_redo->add_undo_method(node, "set_start_location", original_start_location);
+ undo_redo->add_undo_method(node, "set_start_position", original_start_position);
undo_redo->add_undo_method(canvas_item_editor, "update_viewport");
undo_redo->commit_action();
@@ -100,10 +100,10 @@ bool NavigationLink2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_e
}
if (end_grabbed) {
- undo_redo->create_action(TTR("Set end_location"));
- undo_redo->add_do_method(node, "set_end_location", node->get_end_location());
+ undo_redo->create_action(TTR("Set end_position"));
+ undo_redo->add_do_method(node, "set_end_position", node->get_end_position());
undo_redo->add_do_method(canvas_item_editor, "update_viewport");
- undo_redo->add_undo_method(node, "set_end_location", original_end_location);
+ undo_redo->add_undo_method(node, "set_end_position", original_end_position);
undo_redo->add_undo_method(canvas_item_editor, "update_viewport");
undo_redo->commit_action();
@@ -120,14 +120,14 @@ bool NavigationLink2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_e
point = node->get_global_transform().affine_inverse().xform(point);
if (start_grabbed) {
- node->set_start_location(point);
+ node->set_start_position(point);
canvas_item_editor->update_viewport();
return true;
}
if (end_grabbed) {
- node->set_end_location(point);
+ node->set_end_position(point);
canvas_item_editor->update_viewport();
return true;
@@ -143,13 +143,13 @@ void NavigationLink2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
}
Transform2D gt = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
- Vector2 global_start_location = gt.xform(node->get_start_location());
- Vector2 global_end_location = gt.xform(node->get_end_location());
+ Vector2 global_start_position = gt.xform(node->get_start_position());
+ Vector2 global_end_position = gt.xform(node->get_end_position());
// Only drawing the handles here, since the debug rendering will fill in the rest.
const Ref<Texture2D> handle = get_theme_icon(SNAME("EditorHandle"), SNAME("EditorIcons"));
- p_overlay->draw_texture(handle, global_start_location - handle->get_size() / 2);
- p_overlay->draw_texture(handle, global_end_location - handle->get_size() / 2);
+ p_overlay->draw_texture(handle, global_start_position - handle->get_size() / 2);
+ p_overlay->draw_texture(handle, global_end_position - handle->get_size() / 2);
}
void NavigationLink2DEditor::edit(NavigationLink2D *p_node) {
diff --git a/editor/plugins/navigation_link_2d_editor_plugin.h b/editor/plugins/navigation_link_2d_editor_plugin.h
index 76444403d0..ea731ca2cd 100644
--- a/editor/plugins/navigation_link_2d_editor_plugin.h
+++ b/editor/plugins/navigation_link_2d_editor_plugin.h
@@ -43,10 +43,10 @@ class NavigationLink2DEditor : public Control {
NavigationLink2D *node = nullptr;
bool start_grabbed = false;
- Vector2 original_start_location;
+ Vector2 original_start_position;
bool end_grabbed = false;
- Vector2 original_end_location;
+ Vector2 original_end_position;
protected:
void _notification(int p_what);
diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp
index bb71c27bff..e11dc1c81d 100644
--- a/editor/plugins/node_3d_editor_gizmos.cpp
+++ b/editor/plugins/node_3d_editor_gizmos.cpp
@@ -5057,8 +5057,8 @@ void NavigationLink3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
Vector3 up_vector = NavigationServer3D::get_singleton()->map_get_up(nav_map);
Vector3::Axis up_axis = up_vector.max_axis_index();
- Vector3 start_location = link->get_start_location();
- Vector3 end_location = link->get_end_location();
+ Vector3 start_position = link->get_start_position();
+ Vector3 end_position = link->get_end_position();
Ref<Material> link_material = get_material("navigation_link_material", p_gizmo);
Ref<Material> link_material_disabled = get_material("navigation_link_material_disabled", p_gizmo);
@@ -5068,10 +5068,10 @@ void NavigationLink3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
// Draw line between the points.
Vector<Vector3> lines;
- lines.append(start_location);
- lines.append(end_location);
+ lines.append(start_position);
+ lines.append(end_position);
- // Draw start location search radius
+ // Draw start position search radius
for (int i = 0; i < 30; i++) {
// Create a circle
const float ra = Math::deg_to_rad((float)(i * 12));
@@ -5082,21 +5082,21 @@ void NavigationLink3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
// Draw axis-aligned circle
switch (up_axis) {
case Vector3::AXIS_X:
- lines.append(start_location + Vector3(0, a.x, a.y));
- lines.append(start_location + Vector3(0, b.x, b.y));
+ lines.append(start_position + Vector3(0, a.x, a.y));
+ lines.append(start_position + Vector3(0, b.x, b.y));
break;
case Vector3::AXIS_Y:
- lines.append(start_location + Vector3(a.x, 0, a.y));
- lines.append(start_location + Vector3(b.x, 0, b.y));
+ lines.append(start_position + Vector3(a.x, 0, a.y));
+ lines.append(start_position + Vector3(b.x, 0, b.y));
break;
case Vector3::AXIS_Z:
- lines.append(start_location + Vector3(a.x, a.y, 0));
- lines.append(start_location + Vector3(b.x, b.y, 0));
+ lines.append(start_position + Vector3(a.x, a.y, 0));
+ lines.append(start_position + Vector3(b.x, b.y, 0));
break;
}
}
- // Draw end location search radius
+ // Draw end position search radius
for (int i = 0; i < 30; i++) {
// Create a circle
const float ra = Math::deg_to_rad((float)(i * 12));
@@ -5107,16 +5107,16 @@ void NavigationLink3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
// Draw axis-aligned circle
switch (up_axis) {
case Vector3::AXIS_X:
- lines.append(end_location + Vector3(0, a.x, a.y));
- lines.append(end_location + Vector3(0, b.x, b.y));
+ lines.append(end_position + Vector3(0, a.x, a.y));
+ lines.append(end_position + Vector3(0, b.x, b.y));
break;
case Vector3::AXIS_Y:
- lines.append(end_location + Vector3(a.x, 0, a.y));
- lines.append(end_location + Vector3(b.x, 0, b.y));
+ lines.append(end_position + Vector3(a.x, 0, a.y));
+ lines.append(end_position + Vector3(b.x, 0, b.y));
break;
case Vector3::AXIS_Z:
- lines.append(end_location + Vector3(a.x, a.y, 0));
- lines.append(end_location + Vector3(b.x, b.y, 0));
+ lines.append(end_position + Vector3(a.x, a.y, 0));
+ lines.append(end_position + Vector3(b.x, b.y, 0));
break;
}
}
@@ -5125,8 +5125,8 @@ void NavigationLink3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
p_gizmo->add_collision_segments(lines);
Vector<Vector3> handles;
- handles.append(start_location);
- handles.append(end_location);
+ handles.append(start_position);
+ handles.append(end_position);
p_gizmo->add_handles(handles, handles_material);
}
@@ -5136,7 +5136,7 @@ String NavigationLink3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_g
Variant NavigationLink3DGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const {
NavigationLink3D *link = Object::cast_to<NavigationLink3D>(p_gizmo->get_node_3d());
- return p_id == 0 ? link->get_start_location() : link->get_end_location();
+ return p_id == 0 ? link->get_start_position() : link->get_end_position();
}
void NavigationLink3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, Camera3D *p_camera, const Point2 &p_point) {
@@ -5151,8 +5151,8 @@ void NavigationLink3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, i
Vector3 ray_from = p_camera->project_ray_origin(p_point);
Vector3 ray_dir = p_camera->project_ray_normal(p_point);
- Vector3 location = p_id == 0 ? link->get_start_location() : link->get_end_location();
- Plane move_plane = Plane(cam_dir, gt.xform(location));
+ Vector3 position = p_id == 0 ? link->get_start_position() : link->get_end_position();
+ Plane move_plane = Plane(cam_dir, gt.xform(position));
Vector3 intersection;
if (!move_plane.intersects_ray(ray_from, ray_dir, &intersection)) {
@@ -5164,11 +5164,11 @@ void NavigationLink3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, i
intersection.snap(Vector3(snap, snap, snap));
}
- location = gi.xform(intersection);
+ position = gi.xform(intersection);
if (p_id == 0) {
- link->set_start_location(location);
+ link->set_start_position(position);
} else if (p_id == 1) {
- link->set_end_location(location);
+ link->set_end_position(position);
}
}
@@ -5177,22 +5177,22 @@ void NavigationLink3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo
if (p_cancel) {
if (p_id == 0) {
- link->set_start_location(p_restore);
+ link->set_start_position(p_restore);
} else {
- link->set_end_location(p_restore);
+ link->set_end_position(p_restore);
}
return;
}
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
if (p_id == 0) {
- ur->create_action(TTR("Change Start Location"));
- ur->add_do_method(link, "set_start_location", link->get_start_location());
- ur->add_undo_method(link, "set_start_location", p_restore);
+ ur->create_action(TTR("Change Start Position"));
+ ur->add_do_method(link, "set_start_position", link->get_start_position());
+ ur->add_undo_method(link, "set_start_position", p_restore);
} else {
- ur->create_action(TTR("Change End Location"));
- ur->add_do_method(link, "set_end_location", link->get_end_location());
- ur->add_undo_method(link, "set_end_location", p_restore);
+ ur->create_action(TTR("Change End Position"));
+ ur->add_do_method(link, "set_end_position", link->get_end_position());
+ ur->add_undo_method(link, "set_end_position", p_restore);
}
ur->commit_action();
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index dea07ab50c..36d1e54246 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -1414,7 +1414,7 @@ Transform3D Node3DEditorViewport::_compute_transform(TransformMode p_mode, const
// Recalculate orthogonalized scale without moving origin.
if (p_orthogonal) {
- s.basis = p_original_local.basis.scaled_orthogonal(p_motion + Vector3(1, 1, 1));
+ s.basis = p_original.basis.scaled_orthogonal(p_motion + Vector3(1, 1, 1));
// The scaled_orthogonal() does not require orthogonal Basis,
// but it may make a bit skew by precision problems.
s.basis.orthogonalize();
@@ -2208,11 +2208,6 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (ED_IS_SHORTCUT("spatial_editor/focus_selection", p_event)) {
_menu_option(VIEW_CENTER_TO_SELECTION);
}
- // Orthgonal mode doesn't work in freelook.
- if (!freelook_active && ED_IS_SHORTCUT("spatial_editor/switch_perspective_orthogonal", p_event)) {
- _menu_option(orthogonal ? VIEW_PERSPECTIVE : VIEW_ORTHOGONAL);
- _update_name();
- }
if (ED_IS_SHORTCUT("spatial_editor/align_transform_with_view", p_event)) {
_menu_option(VIEW_ALIGN_TRANSFORM_WITH_VIEW);
}
@@ -3279,6 +3274,10 @@ void Node3DEditorViewport::_menu_option(int p_option) {
_update_name();
} break;
+ case VIEW_SWITCH_PERSPECTIVE_ORTHOGONAL: {
+ _menu_option(orthogonal ? VIEW_PERSPECTIVE : VIEW_ORTHOGONAL);
+
+ } break;
case VIEW_AUTO_ORTHOGONAL: {
int idx = view_menu->get_popup()->get_item_index(VIEW_AUTO_ORTHOGONAL);
bool current = view_menu->get_popup()->is_item_checked(idx);
@@ -4612,7 +4611,9 @@ void Node3DEditorViewport::update_transform(Point2 p_mousepos, bool p_shift) {
// TRANSLATORS: Refers to changing the scale of a node in the 3D editor.
set_message(TTR("Scaling:") + " (" + String::num(motion_snapped.x, snap_step_decimals) + ", " +
String::num(motion_snapped.y, snap_step_decimals) + ", " + String::num(motion_snapped.z, snap_step_decimals) + ")");
- motion = _edit.original.basis.inverse().xform(motion);
+ if (local_coords) {
+ motion = _edit.original.basis.inverse().xform(motion);
+ }
List<Node *> &selection = editor_selection->get_selected_node_list();
for (Node *E : selection) {
@@ -4640,7 +4641,7 @@ void Node3DEditorViewport::update_transform(Point2 p_mousepos, bool p_shift) {
se->gizmo->set_subgizmo_transform(GE.key, new_xform);
}
} else {
- Transform3D new_xform = _compute_transform(TRANSFORM_SCALE, se->original, se->original_local, motion, snap, local_coords, sp->get_rotation_edit_mode() != Node3D::ROTATION_EDIT_MODE_BASIS);
+ Transform3D new_xform = _compute_transform(TRANSFORM_SCALE, se->original, se->original_local, motion, snap, local_coords, sp->get_rotation_edit_mode() != Node3D::ROTATION_EDIT_MODE_BASIS && _edit.plane != TRANSFORM_VIEW);
_transform_gizmo_apply(se->sp, new_xform, local_coords);
}
}
@@ -4713,7 +4714,9 @@ void Node3DEditorViewport::update_transform(Point2 p_mousepos, bool p_shift) {
// TRANSLATORS: Refers to changing the position of a node in the 3D editor.
set_message(TTR("Translating:") + " (" + String::num(motion_snapped.x, snap_step_decimals) + ", " +
String::num(motion_snapped.y, snap_step_decimals) + ", " + String::num(motion_snapped.z, snap_step_decimals) + ")");
- motion = spatial_editor->get_gizmo_transform().basis.inverse().xform(motion);
+ if (local_coords) {
+ motion = spatial_editor->get_gizmo_transform().basis.inverse().xform(motion);
+ }
List<Node *> &selection = editor_selection->get_selected_node_list();
for (Node *E : selection) {
@@ -4952,8 +4955,9 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p
view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/front_view"), VIEW_FRONT);
view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/rear_view"), VIEW_REAR);
view_menu->get_popup()->add_separator();
- view_menu->get_popup()->add_radio_check_item(TTR("Perspective") + " (" + ED_GET_SHORTCUT("spatial_editor/switch_perspective_orthogonal")->get_as_text() + ")", VIEW_PERSPECTIVE);
- view_menu->get_popup()->add_radio_check_item(TTR("Orthogonal") + " (" + ED_GET_SHORTCUT("spatial_editor/switch_perspective_orthogonal")->get_as_text() + ")", VIEW_ORTHOGONAL);
+ view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/switch_perspective_orthogonal"), VIEW_SWITCH_PERSPECTIVE_ORTHOGONAL);
+ view_menu->get_popup()->add_radio_check_item(TTR("Perspective"), VIEW_PERSPECTIVE);
+ view_menu->get_popup()->add_radio_check_item(TTR("Orthogonal"), VIEW_ORTHOGONAL);
view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_PERSPECTIVE), true);
view_menu->get_popup()->add_check_item(TTR("Auto Orthogonal Enabled"), VIEW_AUTO_ORTHOGONAL);
view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_AUTO_ORTHOGONAL), true);
diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index edc09f115a..a1fd9757d0 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -117,6 +117,7 @@ class Node3DEditorViewport : public Control {
VIEW_PERSPECTIVE,
VIEW_ENVIRONMENT,
VIEW_ORTHOGONAL,
+ VIEW_SWITCH_PERSPECTIVE_ORTHOGONAL,
VIEW_HALF_RESOLUTION,
VIEW_AUDIO_LISTENER,
VIEW_AUDIO_DOPPLER,
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index 05fc464226..fb35668310 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -939,21 +939,13 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
}
}
-void Polygon2DEditor::_uv_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
- _uv_pan_callback(-p_scroll_vec * 32);
-}
-
-void Polygon2DEditor::_uv_pan_callback(Vector2 p_scroll_vec) {
+void Polygon2DEditor::_uv_pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event) {
uv_hscroll->set_value(uv_hscroll->get_value() - p_scroll_vec.x);
uv_vscroll->set_value(uv_vscroll->get_value() - p_scroll_vec.y);
}
-void Polygon2DEditor::_uv_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt) {
- if (p_scroll_vec.y < 0) {
- uv_zoom->set_value(uv_zoom->get_value() / (1 - (0.1 * Math::abs(p_scroll_vec.y))));
- } else {
- uv_zoom->set_value(uv_zoom->get_value() * (1 - (0.1 * Math::abs(p_scroll_vec.y))));
- }
+void Polygon2DEditor::_uv_zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event) {
+ uv_zoom->set_value(uv_zoom->get_value() * p_zoom_factor);
}
void Polygon2DEditor::_uv_scroll_changed(real_t) {
@@ -1254,7 +1246,7 @@ Polygon2DEditor::Polygon2DEditor() {
uv_edit = memnew(AcceptDialog);
add_child(uv_edit);
uv_edit->set_title(TTR("Polygon 2D UV Editor"));
- uv_edit->connect("cancelled", callable_mp(this, &Polygon2DEditor::_uv_edit_popup_hide));
+ uv_edit->connect("canceled", callable_mp(this, &Polygon2DEditor::_uv_edit_popup_hide));
VBoxContainer *uv_main_vb = memnew(VBoxContainer);
uv_edit->add_child(uv_main_vb);
@@ -1478,7 +1470,7 @@ Polygon2DEditor::Polygon2DEditor() {
bone_scroll->add_child(bone_scroll_vb);
uv_panner.instantiate();
- uv_panner->set_callbacks(callable_mp(this, &Polygon2DEditor::_uv_scroll_callback), callable_mp(this, &Polygon2DEditor::_uv_pan_callback), callable_mp(this, &Polygon2DEditor::_uv_zoom_callback));
+ uv_panner->set_callbacks(callable_mp(this, &Polygon2DEditor::_uv_pan_callback), callable_mp(this, &Polygon2DEditor::_uv_zoom_callback));
uv_edit_draw->connect("draw", callable_mp(this, &Polygon2DEditor::_uv_draw));
uv_edit_draw->connect("gui_input", callable_mp(this, &Polygon2DEditor::_uv_input));
diff --git a/editor/plugins/polygon_2d_editor_plugin.h b/editor/plugins/polygon_2d_editor_plugin.h
index 7246c08bea..2c55a5f631 100644
--- a/editor/plugins/polygon_2d_editor_plugin.h
+++ b/editor/plugins/polygon_2d_editor_plugin.h
@@ -90,9 +90,8 @@ class Polygon2DEditor : public AbstractPolygon2DEditor {
TextureRect *uv_icon_zoom = nullptr;
Ref<ViewPanner> uv_panner;
- void _uv_scroll_callback(Vector2 p_scroll_vec, bool p_alt);
- void _uv_pan_callback(Vector2 p_scroll_vec);
- void _uv_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
+ void _uv_pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event);
+ void _uv_zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event);
VBoxContainer *bone_scroll_main_vb = nullptr;
ScrollContainer *bone_scroll = nullptr;
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 188abf1f5c..e515b46b1e 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -4007,12 +4007,6 @@ void ScriptEditorPlugin::apply_changes() {
script_editor->apply_scripts();
}
-void ScriptEditorPlugin::restore_global_state() {
-}
-
-void ScriptEditorPlugin::save_global_state() {
-}
-
void ScriptEditorPlugin::set_window_layout(Ref<ConfigFile> p_layout) {
script_editor->set_window_layout(p_layout);
}
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index d4c80c416b..988d07621c 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -542,9 +542,6 @@ public:
virtual void save_external_data() override;
virtual void apply_changes() override;
- virtual void restore_global_state() override;
- virtual void save_global_state() override;
-
virtual void set_window_layout(Ref<ConfigFile> p_layout) override;
virtual void get_window_layout(Ref<ConfigFile> p_layout) override;
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 6bb725f7a0..6b4e7184d9 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -252,12 +252,14 @@ void ScriptTextEditor::_warning_clicked(Variant p_line) {
} else if (p_line.get_type() == Variant::DICTIONARY) {
Dictionary meta = p_line.operator Dictionary();
const int line = meta["line"].operator int64_t() - 1;
+ const String code = meta["code"].operator String();
+ const String quote_style = EDITOR_GET("text_editor/completion/use_single_quotes") ? "'" : "\"";
CodeEdit *text_editor = code_editor->get_text_editor();
String prev_line = line > 0 ? text_editor->get_line(line - 1) : "";
if (prev_line.contains("@warning_ignore")) {
const int closing_bracket_idx = prev_line.find(")");
- const String text_to_insert = ", " + meta["code"].operator String();
+ const String text_to_insert = ", " + code.quote(quote_style);
prev_line = prev_line.insert(closing_bracket_idx, text_to_insert);
text_editor->set_line(line - 1, prev_line);
} else {
@@ -268,7 +270,7 @@ void ScriptTextEditor::_warning_clicked(Variant p_line) {
} else {
annotation_indent = String(" ").repeat(text_editor->get_indent_size() * indent);
}
- text_editor->insert_line_at(line, annotation_indent + "@warning_ignore(" + meta["code"].operator String() + ")");
+ text_editor->insert_line_at(line, annotation_indent + "@warning_ignore(" + code.quote(quote_style) + ")");
}
_validate_script();
@@ -2159,7 +2161,7 @@ ScriptTextEditor::ScriptTextEditor() {
connection_info_dialog = memnew(ConnectionInfoDialog);
- SET_DRAG_FORWARDING_GCD(code_editor, ScriptTextEditor);
+ SET_DRAG_FORWARDING_GCD(code_editor->get_text_editor(), ScriptTextEditor);
}
ScriptTextEditor::~ScriptTextEditor() {
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 87d602ccf1..907bc81674 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -43,10 +43,10 @@
void ShaderEditorPlugin::_update_shader_list() {
shader_list->clear();
- for (uint32_t i = 0; i < edited_shaders.size(); i++) {
- Ref<Resource> shader = edited_shaders[i].shader;
+ for (EditedShader &edited_shader : edited_shaders) {
+ Ref<Resource> shader = edited_shader.shader;
if (shader.is_null()) {
- shader = edited_shaders[i].shader_inc;
+ shader = edited_shader.shader_inc;
}
String path = shader->get_path();
@@ -62,8 +62,8 @@ void ShaderEditorPlugin::_update_shader_list() {
}
bool unsaved = false;
- if (edited_shaders[i].shader_editor) {
- unsaved = edited_shaders[i].shader_editor->is_unsaved();
+ if (edited_shader.shader_editor) {
+ unsaved = edited_shader.shader_editor->is_unsaved();
}
// TODO: Handle visual shaders too.
@@ -86,7 +86,7 @@ void ShaderEditorPlugin::_update_shader_list() {
}
for (int i = FILE_SAVE; i < FILE_MAX; i++) {
- file_menu->get_popup()->set_item_disabled(file_menu->get_popup()->get_item_index(i), edited_shaders.size() == 0);
+ file_menu->get_popup()->set_item_disabled(file_menu->get_popup()->get_item_index(i), edited_shaders.is_empty());
}
_update_shader_list_status();
@@ -117,6 +117,10 @@ void ShaderEditorPlugin::_move_shader_tab(int p_from, int p_to) {
}
void ShaderEditorPlugin::edit(Object *p_object) {
+ if (!p_object) {
+ return;
+ }
+
EditedShader es;
ShaderInclude *si = Object::cast_to<ShaderInclude>(p_object);
@@ -175,36 +179,36 @@ void ShaderEditorPlugin::selected_notify() {
}
TextShaderEditor *ShaderEditorPlugin::get_shader_editor(const Ref<Shader> &p_for_shader) {
- for (uint32_t i = 0; i < edited_shaders.size(); i++) {
- if (edited_shaders[i].shader == p_for_shader) {
- return edited_shaders[i].shader_editor;
+ for (EditedShader &edited_shader : edited_shaders) {
+ if (edited_shader.shader == p_for_shader) {
+ return edited_shader.shader_editor;
}
}
return nullptr;
}
VisualShaderEditor *ShaderEditorPlugin::get_visual_shader_editor(const Ref<Shader> &p_for_shader) {
- for (uint32_t i = 0; i < edited_shaders.size(); i++) {
- if (edited_shaders[i].shader == p_for_shader) {
- return edited_shaders[i].visual_shader_editor;
+ for (EditedShader &edited_shader : edited_shaders) {
+ if (edited_shader.shader == p_for_shader) {
+ return edited_shader.visual_shader_editor;
}
}
return nullptr;
}
void ShaderEditorPlugin::save_external_data() {
- for (uint32_t i = 0; i < edited_shaders.size(); i++) {
- if (edited_shaders[i].shader_editor) {
- edited_shaders[i].shader_editor->save_external_data();
+ for (EditedShader &edited_shader : edited_shaders) {
+ if (edited_shader.shader_editor) {
+ edited_shader.shader_editor->save_external_data();
}
}
_update_shader_list();
}
void ShaderEditorPlugin::apply_changes() {
- for (uint32_t i = 0; i < edited_shaders.size(); i++) {
- if (edited_shaders[i].shader_editor) {
- edited_shaders[i].shader_editor->apply_shaders();
+ for (EditedShader &edited_shader : edited_shaders) {
+ if (edited_shader.shader_editor) {
+ edited_shader.shader_editor->apply_shaders();
}
}
}
@@ -234,8 +238,8 @@ void ShaderEditorPlugin::_close_shader(int p_index) {
void ShaderEditorPlugin::_resource_saved(Object *obj) {
// May have been renamed on save.
- for (uint32_t i = 0; i < edited_shaders.size(); i++) {
- if (edited_shaders[i].shader.ptr() == obj) {
+ for (EditedShader &edited_shader : edited_shaders) {
+ if (edited_shader.shader.ptr() == obj) {
_update_shader_list();
return;
}
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp
index 3ee9823f3a..782e365138 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_3d_editor_plugin.cpp
@@ -266,15 +266,15 @@ void Skeleton3DEditor::reset_pose(const bool p_all_bones) {
if (!skeleton) {
return;
}
- const int bone_len = skeleton->get_bone_count();
- if (!bone_len) {
+ const int bone_count = skeleton->get_bone_count();
+ if (!bone_count) {
return;
}
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
ur->create_action(TTR("Set Bone Transform"), UndoRedo::MERGE_ENDS);
if (p_all_bones) {
- for (int i = 0; i < bone_len; i++) {
+ for (int i = 0; i < bone_count; i++) {
ur->add_undo_method(skeleton, "set_bone_pose_position", i, skeleton->get_bone_pose_position(i));
ur->add_undo_method(skeleton, "set_bone_pose_rotation", i, skeleton->get_bone_pose_rotation(i));
ur->add_undo_method(skeleton, "set_bone_pose_scale", i, skeleton->get_bone_pose_scale(i));
@@ -333,15 +333,15 @@ void Skeleton3DEditor::pose_to_rest(const bool p_all_bones) {
if (!skeleton) {
return;
}
- const int bone_len = skeleton->get_bone_count();
- if (!bone_len) {
+ const int bone_count = skeleton->get_bone_count();
+ if (!bone_count) {
return;
}
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
ur->create_action(TTR("Set Bone Rest"), UndoRedo::MERGE_ENDS);
if (p_all_bones) {
- for (int i = 0; i < bone_len; i++) {
+ for (int i = 0; i < bone_count; i++) {
ur->add_do_method(skeleton, "set_bone_rest", i, skeleton->get_bone_pose(i));
ur->add_undo_method(skeleton, "set_bone_rest", i, skeleton->get_bone_rest(i));
}
@@ -362,57 +362,56 @@ void Skeleton3DEditor::create_physical_skeleton() {
ERR_FAIL_COND(!get_tree());
Node *owner = get_tree()->get_edited_scene_root();
- const int bc = skeleton->get_bone_count();
+ const int bone_count = skeleton->get_bone_count();
- if (!bc) {
+ if (!bone_count) {
+ EditorNode::get_singleton()->show_warning(vformat(TTR("Cannot create a physical skeleton for a Skeleton3D node with no bones.")));
return;
}
Vector<BoneInfo> bones_infos;
- bones_infos.resize(bc);
+ bones_infos.resize(bone_count);
- if (bc > 0) {
- ur->create_action(TTR("Create physical bones"), UndoRedo::MERGE_ALL);
- for (int bone_id = 0; bc > bone_id; ++bone_id) {
- const int parent = skeleton->get_bone_parent(bone_id);
+ ur->create_action(TTR("Create physical bones"), UndoRedo::MERGE_ALL);
+ for (int bone_id = 0; bone_count > bone_id; ++bone_id) {
+ const int parent = skeleton->get_bone_parent(bone_id);
- if (parent < 0) {
- bones_infos.write[bone_id].relative_rest = skeleton->get_bone_rest(bone_id);
- } else {
- const int parent_parent = skeleton->get_bone_parent(parent);
-
- bones_infos.write[bone_id].relative_rest = bones_infos[parent].relative_rest * skeleton->get_bone_rest(bone_id);
-
- // Create physical bone on parent.
- if (!bones_infos[parent].physical_bone) {
- PhysicalBone3D *physical_bone = create_physical_bone(parent, bone_id, bones_infos);
- if (physical_bone && physical_bone->get_child(0)) {
- CollisionShape3D *collision_shape = Object::cast_to<CollisionShape3D>(physical_bone->get_child(0));
- if (collision_shape) {
- bones_infos.write[parent].physical_bone = physical_bone;
-
- ur->add_do_method(skeleton, "add_child", physical_bone);
- ur->add_do_method(physical_bone, "set_owner", owner);
- ur->add_do_method(collision_shape, "set_owner", owner);
- ur->add_do_property(physical_bone, "bone_name", skeleton->get_bone_name(parent));
-
- // Create joint between parent of parent.
- if (parent_parent != -1) {
- ur->add_do_method(physical_bone, "set_joint_type", PhysicalBone3D::JOINT_TYPE_PIN);
- }
+ if (parent < 0) {
+ bones_infos.write[bone_id].relative_rest = skeleton->get_bone_rest(bone_id);
+ } else {
+ const int parent_parent = skeleton->get_bone_parent(parent);
+
+ bones_infos.write[bone_id].relative_rest = bones_infos[parent].relative_rest * skeleton->get_bone_rest(bone_id);
+
+ // Create physical bone on parent.
+ if (!bones_infos[parent].physical_bone) {
+ PhysicalBone3D *physical_bone = create_physical_bone(parent, bone_id, bones_infos);
+ if (physical_bone && physical_bone->get_child(0)) {
+ CollisionShape3D *collision_shape = Object::cast_to<CollisionShape3D>(physical_bone->get_child(0));
+ if (collision_shape) {
+ bones_infos.write[parent].physical_bone = physical_bone;
+
+ ur->add_do_method(skeleton, "add_child", physical_bone);
+ ur->add_do_method(physical_bone, "set_owner", owner);
+ ur->add_do_method(collision_shape, "set_owner", owner);
+ ur->add_do_property(physical_bone, "bone_name", skeleton->get_bone_name(parent));
+
+ // Create joint between parent of parent.
+ if (parent_parent != -1) {
+ ur->add_do_method(physical_bone, "set_joint_type", PhysicalBone3D::JOINT_TYPE_PIN);
+ }
- ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, physical_bone);
- ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, collision_shape);
+ ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, physical_bone);
+ ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, collision_shape);
- ur->add_do_reference(physical_bone);
- ur->add_undo_method(skeleton, "remove_child", physical_bone);
- }
+ ur->add_do_reference(physical_bone);
+ ur->add_undo_method(skeleton, "remove_child", physical_bone);
}
}
}
}
- ur->commit_action();
}
+ ur->commit_action();
}
PhysicalBone3D *Skeleton3DEditor::create_physical_bone(int bone_id, int bone_child_id, const Vector<BoneInfo> &bones_infos) {
@@ -457,6 +456,11 @@ PhysicalBone3D *Skeleton3DEditor::create_physical_bone(int bone_id, int bone_chi
}
void Skeleton3DEditor::export_skeleton_profile() {
+ if (!skeleton->get_bone_count()) {
+ EditorNode::get_singleton()->show_warning(vformat(TTR("Cannot export a SkeletonProfile for a Skeleton3D node with no bones.")));
+ return;
+ }
+
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
file_dialog->set_title(TTR("Export Skeleton Profile As..."));
@@ -481,9 +485,9 @@ void Skeleton3DEditor::_file_selected(const String &p_file) {
Vector2 position_max;
Vector2 position_min;
- int len = skeleton->get_bone_count();
- sp->set_bone_size(len);
- for (int i = 0; i < len; i++) {
+ const int bone_count = skeleton->get_bone_count();
+ sp->set_bone_size(bone_count);
+ for (int i = 0; i < bone_count; i++) {
sp->set_bone_name(i, skeleton->get_bone_name(i));
int parent = skeleton->get_bone_parent(i);
if (parent >= 0) {
@@ -509,7 +513,7 @@ void Skeleton3DEditor::_file_selected(const String &p_file) {
Vector2 center = Vector2((position_max.x + position_min.x) * 0.5, (position_max.y + position_min.y) * 0.5);
float nrm = MAX(bound.x, bound.y);
if (nrm > 0) {
- for (int i = 0; i < len; i++) {
+ for (int i = 0; i < bone_count; i++) {
handle_positions.write[i] = (handle_positions[i] - center) / nrm * 0.9;
sp->set_handle_offset(i, Vector2(0.5 + handle_positions[i].x, 0.5 - handle_positions[i].y));
}
@@ -980,25 +984,31 @@ void Skeleton3DEditor::_draw_gizmo() {
}
void Skeleton3DEditor::_draw_handles() {
- handles_mesh_instance->show();
+ const int bone_count = skeleton->get_bone_count();
- const int bone_len = skeleton->get_bone_count();
handles_mesh->clear_surfaces();
- handles_mesh->surface_begin(Mesh::PRIMITIVE_POINTS);
- for (int i = 0; i < bone_len; i++) {
- Color c;
- if (i == selected_bone) {
- c = Color(1, 1, 0);
- } else {
- c = Color(0.1, 0.25, 0.8);
+ if (bone_count) {
+ handles_mesh_instance->show();
+
+ handles_mesh->surface_begin(Mesh::PRIMITIVE_POINTS);
+
+ for (int i = 0; i < bone_count; i++) {
+ Color c;
+ if (i == selected_bone) {
+ c = Color(1, 1, 0);
+ } else {
+ c = Color(0.1, 0.25, 0.8);
+ }
+ Vector3 point = skeleton->get_bone_global_pose(i).origin;
+ handles_mesh->surface_set_color(c);
+ handles_mesh->surface_add_vertex(point);
}
- Vector3 point = skeleton->get_bone_global_pose(i).origin;
- handles_mesh->surface_set_color(c);
- handles_mesh->surface_add_vertex(point);
+ handles_mesh->surface_end();
+ handles_mesh->surface_set_material(0, handle_material);
+ } else {
+ handles_mesh_instance->hide();
}
- handles_mesh->surface_end();
- handles_mesh->surface_set_material(0, handle_material);
}
TreeItem *Skeleton3DEditor::_find(TreeItem *p_node, const NodePath &p_path) {
@@ -1253,8 +1263,8 @@ int Skeleton3DGizmoPlugin::subgizmos_intersect_ray(const EditorNode3DGizmo *p_gi
Transform3D gt = skeleton->get_global_transform();
int closest_idx = -1;
real_t closest_dist = 1e10;
- const int bone_len = skeleton->get_bone_count();
- for (int i = 0; i < bone_len; i++) {
+ const int bone_count = skeleton->get_bone_count();
+ for (int i = 0; i < bone_count; i++) {
Vector3 joint_pos_3d = gt.xform(skeleton->get_bone_global_pose(i).origin);
Vector2 joint_pos_2d = p_camera->unproject_position(joint_pos_3d);
real_t dist_3d = ray_from.distance_to(joint_pos_3d);
@@ -1349,6 +1359,10 @@ void Skeleton3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
Skeleton3D *skeleton = Object::cast_to<Skeleton3D>(p_gizmo->get_node_3d());
p_gizmo->clear();
+ if (!skeleton->get_bone_count()) {
+ return;
+ }
+
int selected = -1;
Skeleton3DEditor *se = Skeleton3DEditor::get_singleton();
if (se) {
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 75e1199a6e..14b5f7cefb 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -40,7 +40,6 @@
#include "editor/editor_settings.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/scene_tree_dock.h"
-#include "scene/3d/sprite_3d.h"
#include "scene/gui/center_container.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/panel_container.h"
@@ -252,8 +251,7 @@ void SpriteFramesEditor::_sheet_add_frames() {
const Size2i separation = _get_separation();
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
- undo_redo->create_action(TTR("Add Frame"));
-
+ undo_redo->create_action(TTR("Add Frame"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
int fc = frames->get_frame_count(edited_anim);
for (const int &E : frames_selected) {
@@ -265,8 +263,8 @@ void SpriteFramesEditor::_sheet_add_frames() {
at->set_atlas(split_sheet_preview->get_texture());
at->set_region(Rect2(offset + frame_coords * (frame_size + separation), frame_size));
- undo_redo->add_do_method(frames, "add_frame", edited_anim, at, 1.0, -1);
- undo_redo->add_undo_method(frames, "remove_frame", edited_anim, fc);
+ undo_redo->add_do_method(frames.ptr(), "add_frame", edited_anim, at, 1.0, -1);
+ undo_redo->add_undo_method(frames.ptr(), "remove_frame", edited_anim, fc);
}
undo_redo->add_do_method(this, "_update_library");
@@ -415,8 +413,24 @@ void SpriteFramesEditor::_prepare_sprite_sheet(const String &p_file) {
void SpriteFramesEditor::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
+ case NOTIFICATION_ENTER_TREE: {
+ get_tree()->connect("node_removed", callable_mp(this, &SpriteFramesEditor::_node_removed));
+
+ [[fallthrough]];
+ }
case NOTIFICATION_THEME_CHANGED: {
+ autoplay_icon = get_theme_icon(SNAME("AutoPlay"), SNAME("EditorIcons"));
+ stop_icon = get_theme_icon(SNAME("Stop"), SNAME("EditorIcons"));
+ pause_icon = get_theme_icon(SNAME("Pause"), SNAME("EditorIcons"));
+ _update_stop_icon();
+
+ autoplay->set_icon(get_theme_icon(SNAME("AutoPlay"), SNAME("EditorIcons")));
+ anim_loop->set_icon(get_theme_icon(SNAME("Loop"), SNAME("EditorIcons")));
+ play->set_icon(get_theme_icon(SNAME("PlayStart"), SNAME("EditorIcons")));
+ play_from->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons")));
+ play_bw->set_icon(get_theme_icon(SNAME("PlayStartBackwards"), SNAME("EditorIcons")));
+ play_bw_from->set_icon(get_theme_icon(SNAME("PlayBackwards"), SNAME("EditorIcons")));
+
load->set_icon(get_theme_icon(SNAME("Load"), SNAME("EditorIcons")));
load_sheet->set_icon(get_theme_icon(SNAME("SpriteSheet"), SNAME("EditorIcons")));
copy->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")));
@@ -441,6 +455,10 @@ void SpriteFramesEditor::_notification(int p_what) {
case NOTIFICATION_READY: {
add_theme_constant_override("autohide", 1); // Fixes the dragger always showing up.
} break;
+
+ case NOTIFICATION_EXIT_TREE: {
+ get_tree()->disconnect("node_removed", callable_mp(this, &SpriteFramesEditor::_node_removed));
+ } break;
}
}
@@ -471,14 +489,14 @@ void SpriteFramesEditor::_file_load_request(const Vector<String> &p_path, int p_
}
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
- undo_redo->create_action(TTR("Add Frame"));
+ undo_redo->create_action(TTR("Add Frame"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
int fc = frames->get_frame_count(edited_anim);
int count = 0;
for (const Ref<Texture2D> &E : resources) {
- undo_redo->add_do_method(frames, "add_frame", edited_anim, E, 1.0, p_at_pos == -1 ? -1 : p_at_pos + count);
- undo_redo->add_undo_method(frames, "remove_frame", edited_anim, p_at_pos == -1 ? fc : p_at_pos);
+ undo_redo->add_do_method(frames.ptr(), "add_frame", edited_anim, E, 1.0, p_at_pos == -1 ? -1 : p_at_pos + count);
+ undo_redo->add_undo_method(frames.ptr(), "remove_frame", edited_anim, p_at_pos == -1 ? fc : p_at_pos);
count++;
}
undo_redo->add_do_method(this, "_update_library");
@@ -542,9 +560,9 @@ void SpriteFramesEditor::_paste_pressed() {
}
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
- undo_redo->create_action(TTR("Paste Frame"));
- undo_redo->add_do_method(frames, "add_frame", edited_anim, texture, duration);
- undo_redo->add_undo_method(frames, "remove_frame", edited_anim, frames->get_frame_count(edited_anim));
+ undo_redo->create_action(TTR("Paste Frame"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
+ undo_redo->add_do_method(frames.ptr(), "add_frame", edited_anim, texture, duration);
+ undo_redo->add_undo_method(frames.ptr(), "remove_frame", edited_anim, frames->get_frame_count(edited_anim));
undo_redo->add_do_method(this, "_update_library");
undo_redo->add_undo_method(this, "_update_library");
undo_redo->commit_action();
@@ -585,9 +603,9 @@ void SpriteFramesEditor::_empty_pressed() {
Ref<Texture2D> texture;
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
- undo_redo->create_action(TTR("Add Empty"));
- undo_redo->add_do_method(frames, "add_frame", edited_anim, texture, 1.0, from);
- undo_redo->add_undo_method(frames, "remove_frame", edited_anim, from);
+ undo_redo->create_action(TTR("Add Empty"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
+ undo_redo->add_do_method(frames.ptr(), "add_frame", edited_anim, texture, 1.0, from);
+ undo_redo->add_undo_method(frames.ptr(), "remove_frame", edited_anim, from);
undo_redo->add_do_method(this, "_update_library");
undo_redo->add_undo_method(this, "_update_library");
undo_redo->commit_action();
@@ -609,9 +627,9 @@ void SpriteFramesEditor::_empty2_pressed() {
Ref<Texture2D> texture;
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
- undo_redo->create_action(TTR("Add Empty"));
- undo_redo->add_do_method(frames, "add_frame", edited_anim, texture, 1.0, from + 1);
- undo_redo->add_undo_method(frames, "remove_frame", edited_anim, from + 1);
+ undo_redo->create_action(TTR("Add Empty"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
+ undo_redo->add_do_method(frames.ptr(), "add_frame", edited_anim, texture, 1.0, from + 1);
+ undo_redo->add_undo_method(frames.ptr(), "remove_frame", edited_anim, from + 1);
undo_redo->add_do_method(this, "_update_library");
undo_redo->add_undo_method(this, "_update_library");
undo_redo->commit_action();
@@ -633,11 +651,11 @@ void SpriteFramesEditor::_up_pressed() {
sel -= 1;
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
- undo_redo->create_action(TTR("Move Frame"));
- undo_redo->add_do_method(frames, "set_frame", edited_anim, to_move, frames->get_frame_texture(edited_anim, to_move - 1), frames->get_frame_duration(edited_anim, to_move - 1));
- undo_redo->add_do_method(frames, "set_frame", edited_anim, to_move - 1, frames->get_frame_texture(edited_anim, to_move), frames->get_frame_duration(edited_anim, to_move));
- undo_redo->add_undo_method(frames, "set_frame", edited_anim, to_move, frames->get_frame_texture(edited_anim, to_move), frames->get_frame_duration(edited_anim, to_move));
- undo_redo->add_undo_method(frames, "set_frame", edited_anim, to_move - 1, frames->get_frame_texture(edited_anim, to_move - 1), frames->get_frame_duration(edited_anim, to_move - 1));
+ undo_redo->create_action(TTR("Move Frame"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
+ undo_redo->add_do_method(frames.ptr(), "set_frame", edited_anim, to_move, frames->get_frame_texture(edited_anim, to_move - 1), frames->get_frame_duration(edited_anim, to_move - 1));
+ undo_redo->add_do_method(frames.ptr(), "set_frame", edited_anim, to_move - 1, frames->get_frame_texture(edited_anim, to_move), frames->get_frame_duration(edited_anim, to_move));
+ undo_redo->add_undo_method(frames.ptr(), "set_frame", edited_anim, to_move, frames->get_frame_texture(edited_anim, to_move), frames->get_frame_duration(edited_anim, to_move));
+ undo_redo->add_undo_method(frames.ptr(), "set_frame", edited_anim, to_move - 1, frames->get_frame_texture(edited_anim, to_move - 1), frames->get_frame_duration(edited_anim, to_move - 1));
undo_redo->add_do_method(this, "_update_library");
undo_redo->add_undo_method(this, "_update_library");
undo_redo->commit_action();
@@ -659,11 +677,11 @@ void SpriteFramesEditor::_down_pressed() {
sel += 1;
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
- undo_redo->create_action(TTR("Move Frame"));
- undo_redo->add_do_method(frames, "set_frame", edited_anim, to_move, frames->get_frame_texture(edited_anim, to_move + 1), frames->get_frame_duration(edited_anim, to_move + 1));
- undo_redo->add_do_method(frames, "set_frame", edited_anim, to_move + 1, frames->get_frame_texture(edited_anim, to_move), frames->get_frame_duration(edited_anim, to_move));
- undo_redo->add_undo_method(frames, "set_frame", edited_anim, to_move, frames->get_frame_texture(edited_anim, to_move), frames->get_frame_duration(edited_anim, to_move));
- undo_redo->add_undo_method(frames, "set_frame", edited_anim, to_move + 1, frames->get_frame_texture(edited_anim, to_move + 1), frames->get_frame_duration(edited_anim, to_move + 1));
+ undo_redo->create_action(TTR("Move Frame"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
+ undo_redo->add_do_method(frames.ptr(), "set_frame", edited_anim, to_move, frames->get_frame_texture(edited_anim, to_move + 1), frames->get_frame_duration(edited_anim, to_move + 1));
+ undo_redo->add_do_method(frames.ptr(), "set_frame", edited_anim, to_move + 1, frames->get_frame_texture(edited_anim, to_move), frames->get_frame_duration(edited_anim, to_move));
+ undo_redo->add_undo_method(frames.ptr(), "set_frame", edited_anim, to_move, frames->get_frame_texture(edited_anim, to_move), frames->get_frame_duration(edited_anim, to_move));
+ undo_redo->add_undo_method(frames.ptr(), "set_frame", edited_anim, to_move + 1, frames->get_frame_texture(edited_anim, to_move + 1), frames->get_frame_duration(edited_anim, to_move + 1));
undo_redo->add_do_method(this, "_update_library");
undo_redo->add_undo_method(this, "_update_library");
undo_redo->commit_action();
@@ -682,15 +700,15 @@ void SpriteFramesEditor::_delete_pressed() {
}
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
- undo_redo->create_action(TTR("Delete Resource"));
- undo_redo->add_do_method(frames, "remove_frame", edited_anim, to_delete);
- undo_redo->add_undo_method(frames, "add_frame", edited_anim, frames->get_frame_texture(edited_anim, to_delete), frames->get_frame_duration(edited_anim, to_delete), to_delete);
+ undo_redo->create_action(TTR("Delete Resource"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
+ undo_redo->add_do_method(frames.ptr(), "remove_frame", edited_anim, to_delete);
+ undo_redo->add_undo_method(frames.ptr(), "add_frame", edited_anim, frames->get_frame_texture(edited_anim, to_delete), frames->get_frame_duration(edited_anim, to_delete), to_delete);
undo_redo->add_do_method(this, "_update_library");
undo_redo->add_undo_method(this, "_update_library");
undo_redo->commit_action();
}
-void SpriteFramesEditor::_animation_select() {
+void SpriteFramesEditor::_animation_selected() {
if (updating) {
return;
}
@@ -705,9 +723,42 @@ void SpriteFramesEditor::_animation_select() {
TreeItem *selected = animations->get_selected();
ERR_FAIL_COND(!selected);
edited_anim = selected->get_text(0);
+
+ if (animated_sprite) {
+ sprite_node_updating = true;
+ animated_sprite->call("set_animation", edited_anim);
+ sprite_node_updating = false;
+ }
+
_update_library(true);
}
+void SpriteFramesEditor::_sync_animation() {
+ if (!animated_sprite || sprite_node_updating) {
+ return;
+ }
+ _select_animation(animated_sprite->call("get_animation"), false);
+ _update_stop_icon();
+}
+
+void SpriteFramesEditor::_select_animation(const String &p_name, bool p_update_node) {
+ TreeItem *selected = nullptr;
+ selected = animations->get_item_with_text(p_name);
+ if (!selected) {
+ return;
+ };
+
+ edited_anim = selected->get_text(0);
+
+ if (animated_sprite) {
+ if (p_update_node) {
+ animated_sprite->call("set_animation", edited_anim);
+ }
+ }
+
+ _update_library();
+}
+
static void _find_anim_sprites(Node *p_node, List<Node *> *r_nodes, Ref<SpriteFrames> p_sfames) {
Node *edited = EditorNode::get_singleton()->get_edited_scene();
if (!edited) {
@@ -765,55 +816,67 @@ void SpriteFramesEditor::_animation_name_edited() {
name = new_name + " " + itos(counter);
}
- List<Node *> nodes;
- _find_anim_sprites(EditorNode::get_singleton()->get_edited_scene(), &nodes, Ref<SpriteFrames>(frames));
-
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
- undo_redo->create_action(TTR("Rename Animation"));
- undo_redo->add_do_method(frames, "rename_animation", edited_anim, name);
- undo_redo->add_undo_method(frames, "rename_animation", name, edited_anim);
-
- for (Node *E : nodes) {
- String current = E->call("get_animation");
- undo_redo->add_do_method(E, "set_animation", name);
- undo_redo->add_undo_method(E, "set_animation", edited_anim);
- }
-
+ undo_redo->create_action(TTR("Rename Animation"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
+ _rename_node_animation(undo_redo, false, edited_anim, "", "");
+ undo_redo->add_do_method(frames.ptr(), "rename_animation", edited_anim, name);
+ undo_redo->add_undo_method(frames.ptr(), "rename_animation", name, edited_anim);
+ _rename_node_animation(undo_redo, false, edited_anim, name, name);
+ _rename_node_animation(undo_redo, true, edited_anim, edited_anim, edited_anim);
undo_redo->add_do_method(this, "_update_library");
undo_redo->add_undo_method(this, "_update_library");
+ undo_redo->commit_action();
+
+ _select_animation(name);
+ animations->grab_focus();
+}
- edited_anim = name;
+void SpriteFramesEditor::_rename_node_animation(EditorUndoRedoManager *undo_redo, bool is_undo, const String &p_filter, const String &p_new_animation, const String &p_new_autoplay) {
+ List<Node *> nodes;
+ _find_anim_sprites(EditorNode::get_singleton()->get_edited_scene(), &nodes, Ref<SpriteFrames>(frames));
- undo_redo->commit_action();
+ if (is_undo) {
+ for (Node *E : nodes) {
+ String current_name = E->call("get_animation");
+ if (current_name == p_filter) {
+ undo_redo->add_undo_method(E, "set_animation", p_new_animation);
+ }
+ String autoplay_name = E->call("get_autoplay");
+ if (autoplay_name == p_filter) {
+ undo_redo->add_undo_method(E, "set_autoplay", p_new_autoplay);
+ }
+ }
+ } else {
+ for (Node *E : nodes) {
+ String current_name = E->call("get_animation");
+ if (current_name == p_filter) {
+ undo_redo->add_do_method(E, "set_animation", p_new_animation);
+ }
+ String autoplay_name = E->call("get_autoplay");
+ if (autoplay_name == p_filter) {
+ undo_redo->add_do_method(E, "set_autoplay", p_new_autoplay);
+ }
+ }
+ }
}
void SpriteFramesEditor::_animation_add() {
- String name = "New Anim";
+ String name = "new_animation";
int counter = 0;
while (frames->has_animation(name)) {
counter++;
- name = "New Anim " + itos(counter);
+ name = vformat("new_animation_%d", counter);
}
- List<Node *> nodes;
- _find_anim_sprites(EditorNode::get_singleton()->get_edited_scene(), &nodes, Ref<SpriteFrames>(frames));
-
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
- undo_redo->create_action(TTR("Add Animation"));
- undo_redo->add_do_method(frames, "add_animation", name);
- undo_redo->add_undo_method(frames, "remove_animation", name);
+ undo_redo->create_action(TTR("Add Animation"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
+ undo_redo->add_do_method(frames.ptr(), "add_animation", name);
+ undo_redo->add_undo_method(frames.ptr(), "remove_animation", name);
undo_redo->add_do_method(this, "_update_library");
undo_redo->add_undo_method(this, "_update_library");
-
- for (Node *E : nodes) {
- String current = E->call("get_animation");
- undo_redo->add_do_method(E, "set_animation", name);
- undo_redo->add_undo_method(E, "set_animation", current);
- }
-
- edited_anim = name;
-
undo_redo->commit_action();
+
+ _select_animation(name);
animations->grab_focus();
}
@@ -831,24 +894,39 @@ void SpriteFramesEditor::_animation_remove() {
}
void SpriteFramesEditor::_animation_remove_confirmed() {
+ StringName new_edited;
+ List<StringName> anim_names;
+ frames->get_animation_list(&anim_names);
+ anim_names.sort_custom<StringName::AlphCompare>();
+ if (anim_names.size() >= 2) {
+ if (edited_anim == anim_names[0]) {
+ new_edited = anim_names[1];
+ } else {
+ new_edited = anim_names[0];
+ }
+ } else {
+ new_edited = StringName();
+ }
+
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
- undo_redo->create_action(TTR("Remove Animation"));
- undo_redo->add_do_method(frames, "remove_animation", edited_anim);
- undo_redo->add_undo_method(frames, "add_animation", edited_anim);
- undo_redo->add_undo_method(frames, "set_animation_speed", edited_anim, frames->get_animation_speed(edited_anim));
- undo_redo->add_undo_method(frames, "set_animation_loop", edited_anim, frames->get_animation_loop(edited_anim));
+ undo_redo->create_action(TTR("Remove Animation"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
+ _rename_node_animation(undo_redo, false, edited_anim, new_edited, "");
+ undo_redo->add_do_method(frames.ptr(), "remove_animation", edited_anim);
+ undo_redo->add_undo_method(frames.ptr(), "add_animation", edited_anim);
+ _rename_node_animation(undo_redo, true, edited_anim, edited_anim, edited_anim);
+ undo_redo->add_undo_method(frames.ptr(), "set_animation_speed", edited_anim, frames->get_animation_speed(edited_anim));
+ undo_redo->add_undo_method(frames.ptr(), "set_animation_loop", edited_anim, frames->get_animation_loop(edited_anim));
int fc = frames->get_frame_count(edited_anim);
for (int i = 0; i < fc; i++) {
Ref<Texture2D> texture = frames->get_frame_texture(edited_anim, i);
float duration = frames->get_frame_duration(edited_anim, i);
- undo_redo->add_undo_method(frames, "add_frame", edited_anim, texture, duration);
+ undo_redo->add_undo_method(frames.ptr(), "add_frame", edited_anim, texture, duration);
}
undo_redo->add_do_method(this, "_update_library");
undo_redo->add_undo_method(this, "_update_library");
-
- edited_anim = StringName();
-
undo_redo->commit_action();
+
+ _select_animation(new_edited);
}
void SpriteFramesEditor::_animation_search_text_changed(const String &p_text) {
@@ -861,9 +939,9 @@ void SpriteFramesEditor::_animation_loop_changed() {
}
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
- undo_redo->create_action(TTR("Change Animation Loop"));
- undo_redo->add_do_method(frames, "set_animation_loop", edited_anim, anim_loop->is_pressed());
- undo_redo->add_undo_method(frames, "set_animation_loop", edited_anim, frames->get_animation_loop(edited_anim));
+ undo_redo->create_action(TTR("Change Animation Loop"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
+ undo_redo->add_do_method(frames.ptr(), "set_animation_loop", edited_anim, anim_loop->is_pressed());
+ undo_redo->add_undo_method(frames.ptr(), "set_animation_loop", edited_anim, frames->get_animation_loop(edited_anim));
undo_redo->add_do_method(this, "_update_library", true);
undo_redo->add_undo_method(this, "_update_library", true);
undo_redo->commit_action();
@@ -875,9 +953,9 @@ void SpriteFramesEditor::_animation_speed_changed(double p_value) {
}
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
- undo_redo->create_action(TTR("Change Animation FPS"), UndoRedo::MERGE_ENDS);
- undo_redo->add_do_method(frames, "set_animation_speed", edited_anim, p_value);
- undo_redo->add_undo_method(frames, "set_animation_speed", edited_anim, frames->get_animation_speed(edited_anim));
+ undo_redo->create_action(TTR("Change Animation FPS"), UndoRedo::MERGE_ENDS, EditorNode::get_singleton()->get_edited_scene());
+ undo_redo->add_do_method(frames.ptr(), "set_animation_speed", edited_anim, p_value);
+ undo_redo->add_undo_method(frames.ptr(), "set_animation_speed", edited_anim, frames->get_animation_speed(edited_anim));
undo_redo->add_do_method(this, "_update_library", true);
undo_redo->add_undo_method(this, "_update_library", true);
undo_redo->commit_action();
@@ -927,9 +1005,9 @@ void SpriteFramesEditor::_frame_duration_changed(double p_value) {
float old_duration = frames->get_frame_duration(edited_anim, index);
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
- undo_redo->create_action(TTR("Set Frame Duration"));
- undo_redo->add_do_method(frames, "set_frame", edited_anim, index, texture, p_value);
- undo_redo->add_undo_method(frames, "set_frame", edited_anim, index, texture, old_duration);
+ undo_redo->create_action(TTR("Set Frame Duration"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
+ undo_redo->add_do_method(frames.ptr(), "set_frame", edited_anim, index, texture, p_value);
+ undo_redo->add_undo_method(frames.ptr(), "set_frame", edited_anim, index, texture, old_duration);
undo_redo->add_do_method(this, "_update_library");
undo_redo->add_undo_method(this, "_update_library");
undo_redo->commit_action();
@@ -968,6 +1046,10 @@ void SpriteFramesEditor::_zoom_reset() {
}
void SpriteFramesEditor::_update_library(bool p_skip_selector) {
+ if (frames.is_null()) {
+ return;
+ }
+
updating = true;
frame_duration->set_value(1.0); // Default.
@@ -998,12 +1080,27 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) {
it->set_text(0, name);
it->set_editable(0, true);
+ if (animated_sprite) {
+ if (name == String(animated_sprite->call("get_autoplay"))) {
+ it->set_icon(0, autoplay_icon);
+ }
+ }
+
if (E == edited_anim) {
it->select(0);
}
}
}
+ if (animated_sprite) {
+ String autoplay_name = animated_sprite->call("get_autoplay");
+ if (autoplay_name.is_empty()) {
+ autoplay->set_pressed(false);
+ } else {
+ autoplay->set_pressed(String(edited_anim) == autoplay_name);
+ }
+ }
+
frame_list->clear();
if (!frames->has_animation(edited_anim)) {
@@ -1018,18 +1115,19 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) {
}
for (int i = 0; i < frames->get_frame_count(edited_anim); i++) {
- String name;
+ String name = itos(i);
Ref<Texture2D> texture = frames->get_frame_texture(edited_anim, i);
float duration = frames->get_frame_duration(edited_anim, i);
- String duration_string;
- if (duration != 1.0f) {
- duration_string = String::utf8(" [ ×") + String::num_real(frames->get_frame_duration(edited_anim, i)) + " ]";
- }
if (texture.is_null()) {
- name = itos(i) + ": " + TTR("(empty)") + duration_string;
- } else {
- name = itos(i) + ": " + texture->get_name() + duration_string;
+ texture = empty_icon;
+ name += ": " + TTR("(empty)");
+ } else if (!texture->get_name().is_empty()) {
+ name += ": " + texture->get_name();
+ }
+
+ if (duration != 1.0f) {
+ name += String::utf8(" [× ") + String::num(duration, 2) + "]";
}
frame_list->add_item(name, texture);
@@ -1061,20 +1159,25 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) {
updating = false;
}
-void SpriteFramesEditor::edit(SpriteFrames *p_frames) {
- bool new_read_only_state = false;
- if (p_frames) {
- new_read_only_state = EditorNode::get_singleton()->is_resource_read_only(p_frames);
+void SpriteFramesEditor::_edit() {
+ if (!animated_sprite) {
+ return;
}
+ edit(animated_sprite->call("get_sprite_frames"));
+}
+
+void SpriteFramesEditor::edit(Ref<SpriteFrames> p_frames) {
+ _update_stop_icon();
- if (frames == p_frames && new_read_only_state == read_only) {
+ if (!p_frames.is_valid()) {
+ frames.unref();
return;
}
frames = p_frames;
- read_only = new_read_only_state;
+ read_only = EditorNode::get_singleton()->is_resource_read_only(p_frames);
- if (p_frames) {
+ if (p_frames.is_valid()) {
if (!p_frames->has_animation(edited_anim)) {
List<StringName> anim_names;
frames->get_animation_list(&anim_names);
@@ -1107,6 +1210,8 @@ void SpriteFramesEditor::edit(SpriteFrames *p_frames) {
move_up->set_disabled(read_only);
move_down->set_disabled(read_only);
delete_frame->set_disabled(read_only);
+
+ _fetch_sprite_node(); // Fetch node after set frames.
}
Variant SpriteFramesEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
@@ -1215,18 +1320,18 @@ void SpriteFramesEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
duration = frames->get_frame_duration(edited_anim, from_frame);
}
- undo_redo->create_action(TTR("Move Frame"));
- undo_redo->add_do_method(frames, "remove_frame", edited_anim, from_frame == -1 ? frames->get_frame_count(edited_anim) : from_frame);
- undo_redo->add_do_method(frames, "add_frame", edited_anim, texture, duration, at_pos == -1 ? -1 : at_pos);
- undo_redo->add_undo_method(frames, "remove_frame", edited_anim, at_pos == -1 ? frames->get_frame_count(edited_anim) - 1 : at_pos);
- undo_redo->add_undo_method(frames, "add_frame", edited_anim, texture, duration, from_frame);
+ undo_redo->create_action(TTR("Move Frame"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
+ undo_redo->add_do_method(frames.ptr(), "remove_frame", edited_anim, from_frame == -1 ? frames->get_frame_count(edited_anim) : from_frame);
+ undo_redo->add_do_method(frames.ptr(), "add_frame", edited_anim, texture, duration, at_pos == -1 ? -1 : at_pos);
+ undo_redo->add_undo_method(frames.ptr(), "remove_frame", edited_anim, at_pos == -1 ? frames->get_frame_count(edited_anim) - 1 : at_pos);
+ undo_redo->add_undo_method(frames.ptr(), "add_frame", edited_anim, texture, duration, from_frame);
undo_redo->add_do_method(this, "_update_library");
undo_redo->add_undo_method(this, "_update_library");
undo_redo->commit_action();
} else {
- undo_redo->create_action(TTR("Add Frame"));
- undo_redo->add_do_method(frames, "add_frame", edited_anim, texture, 1.0, at_pos == -1 ? -1 : at_pos);
- undo_redo->add_undo_method(frames, "remove_frame", edited_anim, at_pos == -1 ? frames->get_frame_count(edited_anim) : at_pos);
+ undo_redo->create_action(TTR("Add Frame"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
+ undo_redo->add_do_method(frames.ptr(), "add_frame", edited_anim, texture, 1.0, at_pos == -1 ? -1 : at_pos);
+ undo_redo->add_undo_method(frames.ptr(), "remove_frame", edited_anim, at_pos == -1 ? frames->get_frame_count(edited_anim) : at_pos);
undo_redo->add_do_method(this, "_update_library");
undo_redo->add_undo_method(this, "_update_library");
undo_redo->commit_action();
@@ -1245,10 +1350,156 @@ void SpriteFramesEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
}
}
+void SpriteFramesEditor::_update_stop_icon() {
+ bool is_playing = false;
+ if (animated_sprite) {
+ is_playing = animated_sprite->call("is_playing");
+ }
+ if (is_playing) {
+ stop->set_icon(pause_icon);
+ } else {
+ stop->set_icon(stop_icon);
+ }
+}
+
+void SpriteFramesEditor::_remove_sprite_node() {
+ if (!animated_sprite) {
+ return;
+ }
+ if (animated_sprite->is_connected("sprite_frames_changed", callable_mp(this, &SpriteFramesEditor::_edit))) {
+ animated_sprite->disconnect("sprite_frames_changed", callable_mp(this, &SpriteFramesEditor::_edit));
+ }
+ if (animated_sprite->is_connected("animation_changed", callable_mp(this, &SpriteFramesEditor::_sync_animation))) {
+ animated_sprite->disconnect("animation_changed", callable_mp(this, &SpriteFramesEditor::_sync_animation));
+ }
+ if (animated_sprite->is_connected("animation_finished", callable_mp(this, &SpriteFramesEditor::_update_stop_icon))) {
+ animated_sprite->disconnect("animation_finished", callable_mp(this, &SpriteFramesEditor::_update_stop_icon));
+ }
+ animated_sprite = nullptr;
+}
+
+void SpriteFramesEditor::_fetch_sprite_node() {
+ Node *selected = nullptr;
+ EditorSelection *editor_selection = EditorNode::get_singleton()->get_editor_selection();
+ if (editor_selection->get_selected_node_list().size() == 1) {
+ selected = editor_selection->get_selected_node_list()[0];
+ }
+
+ bool show_node_edit = false;
+ AnimatedSprite2D *as2d = Object::cast_to<AnimatedSprite2D>(selected);
+ AnimatedSprite3D *as3d = Object::cast_to<AnimatedSprite3D>(selected);
+ if (as2d || as3d) {
+ if (frames != selected->call("get_sprite_frames")) {
+ _remove_sprite_node();
+ } else {
+ animated_sprite = selected;
+ if (!animated_sprite->is_connected("sprite_frames_changed", callable_mp(this, &SpriteFramesEditor::_edit))) {
+ animated_sprite->connect("sprite_frames_changed", callable_mp(this, &SpriteFramesEditor::_edit));
+ }
+ if (!animated_sprite->is_connected("animation_changed", callable_mp(this, &SpriteFramesEditor::_sync_animation))) {
+ animated_sprite->connect("animation_changed", callable_mp(this, &SpriteFramesEditor::_sync_animation), CONNECT_DEFERRED);
+ }
+ if (!animated_sprite->is_connected("animation_finished", callable_mp(this, &SpriteFramesEditor::_update_stop_icon))) {
+ animated_sprite->connect("animation_finished", callable_mp(this, &SpriteFramesEditor::_update_stop_icon));
+ }
+ show_node_edit = true;
+ }
+ } else {
+ _remove_sprite_node();
+ }
+
+ if (show_node_edit) {
+ _sync_animation();
+ autoplay_container->show();
+ playback_container->show();
+ } else {
+ _update_library(); // To init autoplay icon.
+ autoplay_container->hide();
+ playback_container->hide();
+ }
+}
+
+void SpriteFramesEditor::_play_pressed() {
+ if (animated_sprite) {
+ animated_sprite->call("stop");
+ animated_sprite->call("play", animated_sprite->call("get_animation"));
+ }
+ _update_stop_icon();
+}
+
+void SpriteFramesEditor::_play_from_pressed() {
+ if (animated_sprite) {
+ animated_sprite->call("play", animated_sprite->call("get_animation"));
+ }
+ _update_stop_icon();
+}
+
+void SpriteFramesEditor::_play_bw_pressed() {
+ if (animated_sprite) {
+ animated_sprite->call("stop");
+ animated_sprite->call("play_backwards", animated_sprite->call("get_animation"));
+ }
+ _update_stop_icon();
+}
+
+void SpriteFramesEditor::_play_bw_from_pressed() {
+ if (animated_sprite) {
+ animated_sprite->call("play_backwards", animated_sprite->call("get_animation"));
+ }
+ _update_stop_icon();
+}
+
+void SpriteFramesEditor::_stop_pressed() {
+ if (animated_sprite) {
+ if (animated_sprite->call("is_playing")) {
+ animated_sprite->call("pause");
+ } else {
+ animated_sprite->call("stop");
+ }
+ }
+ _update_stop_icon();
+}
+
+void SpriteFramesEditor::_autoplay_pressed() {
+ if (updating) {
+ return;
+ }
+
+ if (animated_sprite) {
+ EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
+ undo_redo->create_action(TTR("Toggle Autoplay"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
+ String current = animated_sprite->call("get_animation");
+ String current_auto = animated_sprite->call("get_autoplay");
+ if (current == current_auto) {
+ //unset
+ undo_redo->add_do_method(animated_sprite, "set_autoplay", "");
+ undo_redo->add_undo_method(animated_sprite, "set_autoplay", current_auto);
+ } else {
+ //set
+ undo_redo->add_do_method(animated_sprite, "set_autoplay", current);
+ undo_redo->add_undo_method(animated_sprite, "set_autoplay", current_auto);
+ }
+ undo_redo->add_do_method(this, "_update_library");
+ undo_redo->add_undo_method(this, "_update_library");
+ undo_redo->commit_action();
+ }
+
+ _update_library();
+}
+
void SpriteFramesEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_library", "skipsel"), &SpriteFramesEditor::_update_library, DEFVAL(false));
}
+void SpriteFramesEditor::_node_removed(Node *p_node) {
+ if (animated_sprite) {
+ if (animated_sprite != p_node) {
+ return;
+ }
+ _remove_sprite_node();
+ }
+}
+
SpriteFramesEditor::SpriteFramesEditor() {
VBoxContainer *vbc_animlist = memnew(VBoxContainer);
add_child(vbc_animlist);
@@ -1272,8 +1523,37 @@ SpriteFramesEditor::SpriteFramesEditor() {
delete_anim->set_disabled(true);
delete_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_remove));
+ autoplay_container = memnew(HBoxContainer);
+ hbc_animlist->add_child(autoplay_container);
+
+ autoplay_container->add_child(memnew(VSeparator));
+
+ autoplay = memnew(Button);
+ autoplay->set_flat(true);
+ autoplay->set_tooltip_text(TTR("Autoplay on Load"));
+ autoplay_container->add_child(autoplay);
+
+ hbc_animlist->add_child(memnew(VSeparator));
+
+ anim_loop = memnew(Button);
+ anim_loop->set_toggle_mode(true);
+ anim_loop->set_flat(true);
+ anim_loop->set_tooltip_text(TTR("Animation Looping"));
+ anim_loop->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_loop_changed));
+ hbc_animlist->add_child(anim_loop);
+
+ anim_speed = memnew(SpinBox);
+ anim_speed->set_suffix(TTR("FPS"));
+ anim_speed->set_min(0);
+ anim_speed->set_max(120);
+ anim_speed->set_step(0.01);
+ anim_speed->set_custom_arrow_step(1);
+ anim_speed->set_tooltip_text(TTR("Animation Speed"));
+ anim_speed->connect("value_changed", callable_mp(this, &SpriteFramesEditor::_animation_speed_changed));
+ hbc_animlist->add_child(anim_speed);
+
anim_search_box = memnew(LineEdit);
- hbc_animlist->add_child(anim_search_box);
+ sub_vb->add_child(anim_search_box);
anim_search_box->set_h_size_flags(SIZE_EXPAND_FILL);
anim_search_box->set_placeholder(TTR("Filter Animations"));
anim_search_box->set_clear_button_enabled(true);
@@ -1283,7 +1563,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
sub_vb->add_child(animations);
animations->set_v_size_flags(SIZE_EXPAND_FILL);
animations->set_hide_root(true);
- animations->connect("cell_selected", callable_mp(this, &SpriteFramesEditor::_animation_select));
+ animations->connect("cell_selected", callable_mp(this, &SpriteFramesEditor::_animation_selected));
animations->connect("item_edited", callable_mp(this, &SpriteFramesEditor::_animation_name_edited));
animations->set_allow_reselect(true);
@@ -1292,23 +1572,6 @@ SpriteFramesEditor::SpriteFramesEditor() {
delete_anim->set_shortcut_context(animations);
delete_anim->set_shortcut(ED_SHORTCUT("sprite_frames/delete_animation", TTR("Delete Animation"), Key::KEY_DELETE));
- HBoxContainer *hbc_anim_speed = memnew(HBoxContainer);
- hbc_anim_speed->add_child(memnew(Label(TTR("Speed:"))));
- vbc_animlist->add_child(hbc_anim_speed);
- anim_speed = memnew(SpinBox);
- anim_speed->set_suffix(TTR("FPS"));
- anim_speed->set_min(0);
- anim_speed->set_max(120);
- anim_speed->set_step(0.01);
- anim_speed->set_h_size_flags(SIZE_EXPAND_FILL);
- hbc_anim_speed->add_child(anim_speed);
- anim_speed->connect("value_changed", callable_mp(this, &SpriteFramesEditor::_animation_speed_changed));
-
- anim_loop = memnew(CheckButton);
- anim_loop->set_text(TTR("Loop"));
- vbc_animlist->add_child(anim_loop);
- anim_loop->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_loop_changed));
-
VBoxContainer *vbc = memnew(VBoxContainer);
add_child(vbc);
vbc->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -1319,6 +1582,44 @@ SpriteFramesEditor::SpriteFramesEditor() {
HBoxContainer *hbc = memnew(HBoxContainer);
sub_vb->add_child(hbc);
+ playback_container = memnew(HBoxContainer);
+ hbc->add_child(playback_container);
+
+ play_bw_from = memnew(Button);
+ play_bw_from->set_flat(true);
+ play_bw_from->set_tooltip_text(TTR("Play selected animation backwards from current pos. (A)"));
+ playback_container->add_child(play_bw_from);
+
+ play_bw = memnew(Button);
+ play_bw->set_flat(true);
+ play_bw->set_tooltip_text(TTR("Play selected animation backwards from end. (Shift+A)"));
+ playback_container->add_child(play_bw);
+
+ stop = memnew(Button);
+ stop->set_flat(true);
+ stop->set_tooltip_text(TTR("Pause/stop animation playback. (S)"));
+ playback_container->add_child(stop);
+
+ play = memnew(Button);
+ play->set_flat(true);
+ play->set_tooltip_text(TTR("Play selected animation from start. (Shift+D)"));
+ playback_container->add_child(play);
+
+ play_from = memnew(Button);
+ play_from->set_flat(true);
+ play_from->set_tooltip_text(TTR("Play selected animation from current pos. (D)"));
+ playback_container->add_child(play_from);
+
+ playback_container->add_child(memnew(VSeparator));
+
+ autoplay->connect("pressed", callable_mp(this, &SpriteFramesEditor::_autoplay_pressed));
+ autoplay->set_toggle_mode(true);
+ play->connect("pressed", callable_mp(this, &SpriteFramesEditor::_play_pressed));
+ play_from->connect("pressed", callable_mp(this, &SpriteFramesEditor::_play_from_pressed));
+ play_bw->connect("pressed", callable_mp(this, &SpriteFramesEditor::_play_bw_pressed));
+ play_bw_from->connect("pressed", callable_mp(this, &SpriteFramesEditor::_play_bw_from_pressed));
+ stop->connect("pressed", callable_mp(this, &SpriteFramesEditor::_stop_pressed));
+
load = memnew(Button);
load->set_flat(true);
hbc->add_child(load);
@@ -1369,9 +1670,11 @@ SpriteFramesEditor::SpriteFramesEditor() {
frame_duration = memnew(SpinBox);
frame_duration->set_prefix(String::utf8("×"));
- frame_duration->set_min(0);
+ frame_duration->set_min(SPRITE_FRAME_MINIMUM_DURATION); // Avoid zero div.
frame_duration->set_max(10);
frame_duration->set_step(0.01);
+ frame_duration->set_custom_arrow_step(0.1);
+ frame_duration->set_allow_lesser(false);
frame_duration->set_allow_greater(true);
hbc->add_child(frame_duration);
@@ -1616,16 +1919,16 @@ SpriteFramesEditor::SpriteFramesEditor() {
}
void SpriteFramesEditorPlugin::edit(Object *p_object) {
- SpriteFrames *s;
+ Ref<SpriteFrames> s;
AnimatedSprite2D *animated_sprite = Object::cast_to<AnimatedSprite2D>(p_object);
if (animated_sprite) {
- s = *animated_sprite->get_sprite_frames();
+ s = animated_sprite->get_sprite_frames();
} else {
AnimatedSprite3D *animated_sprite_3d = Object::cast_to<AnimatedSprite3D>(p_object);
if (animated_sprite_3d) {
- s = *animated_sprite_3d->get_sprite_frames();
+ s = animated_sprite_3d->get_sprite_frames();
} else {
- s = Object::cast_to<SpriteFrames>(p_object);
+ s = p_object;
}
}
@@ -1650,9 +1953,7 @@ void SpriteFramesEditorPlugin::make_visible(bool p_visible) {
EditorNode::get_singleton()->make_bottom_panel_item_visible(frames_editor);
} else {
button->hide();
- if (frames_editor->is_visible_in_tree()) {
- EditorNode::get_singleton()->hide_bottom_panel();
- }
+ frames_editor->edit(Ref<SpriteFrames>());
}
}
diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h
index a5e0e54fb8..1dfb909388 100644
--- a/editor/plugins/sprite_frames_editor_plugin.h
+++ b/editor/plugins/sprite_frames_editor_plugin.h
@@ -33,6 +33,7 @@
#include "editor/editor_plugin.h"
#include "scene/2d/animated_sprite_2d.h"
+#include "scene/3d/sprite_3d.h"
#include "scene/gui/button.h"
#include "scene/gui/check_button.h"
#include "scene/gui/dialogs.h"
@@ -57,6 +58,9 @@ public:
class SpriteFramesEditor : public HSplitContainer {
GDCLASS(SpriteFramesEditor, HSplitContainer);
+ Ref<SpriteFrames> frames;
+ Node *animated_sprite = nullptr;
+
enum {
PARAM_USE_CURRENT, // Used in callbacks to indicate `dominant_param` should be not updated.
PARAM_FRAME_COUNT, // Keep "Horizontal" & "Vertical" values.
@@ -66,6 +70,18 @@ class SpriteFramesEditor : public HSplitContainer {
bool read_only = false;
+ Ref<Texture2D> autoplay_icon;
+ Ref<Texture2D> stop_icon;
+ Ref<Texture2D> pause_icon;
+ Ref<Texture2D> empty_icon = memnew(ImageTexture);
+
+ HBoxContainer *playback_container = nullptr;
+ Button *stop = nullptr;
+ Button *play = nullptr;
+ Button *play_from = nullptr;
+ Button *play_bw = nullptr;
+ Button *play_bw_from = nullptr;
+
Button *load = nullptr;
Button *load_sheet = nullptr;
Button *delete_frame = nullptr;
@@ -85,18 +101,19 @@ class SpriteFramesEditor : public HSplitContainer {
Button *add_anim = nullptr;
Button *delete_anim = nullptr;
- LineEdit *anim_search_box = nullptr;
+ SpinBox *anim_speed = nullptr;
+ Button *anim_loop = nullptr;
+
+ HBoxContainer *autoplay_container = nullptr;
+ Button *autoplay = nullptr;
+ LineEdit *anim_search_box = nullptr;
Tree *animations = nullptr;
- SpinBox *anim_speed = nullptr;
- CheckButton *anim_loop = nullptr;
EditorFileDialog *file = nullptr;
AcceptDialog *dialog = nullptr;
- SpriteFrames *frames = nullptr;
-
StringName edited_anim;
ConfirmationDialog *delete_dialog = nullptr;
@@ -146,7 +163,15 @@ class SpriteFramesEditor : public HSplitContainer {
void _frame_duration_changed(double p_value);
void _update_library(bool p_skip_selector = false);
- void _animation_select();
+ void _update_stop_icon();
+ void _play_pressed();
+ void _play_from_pressed();
+ void _play_bw_pressed();
+ void _play_bw_from_pressed();
+ void _autoplay_pressed();
+ void _stop_pressed();
+
+ void _animation_selected();
void _animation_name_edited();
void _animation_add();
void _animation_remove();
@@ -183,12 +208,24 @@ class SpriteFramesEditor : public HSplitContainer {
void _sheet_zoom_reset();
void _sheet_select_clear_all_frames();
+ void _edit();
+ void _regist_scene_undo(EditorUndoRedoManager *undo_redo);
+ void _fetch_sprite_node();
+ void _remove_sprite_node();
+
+ bool sprite_node_updating = false;
+ void _sync_animation();
+
+ void _select_animation(const String &p_name, bool p_update_node = true);
+ void _rename_node_animation(EditorUndoRedoManager *undo_redo, bool is_undo, const String &p_filter, const String &p_new_animation, const String &p_new_autoplay);
+
protected:
void _notification(int p_what);
+ void _node_removed(Node *p_node);
static void _bind_methods();
public:
- void edit(SpriteFrames *p_frames);
+ void edit(Ref<SpriteFrames> p_frames);
SpriteFramesEditor();
};
diff --git a/editor/plugins/text_shader_editor.cpp b/editor/plugins/text_shader_editor.cpp
index 1b29999796..ffd9564816 100644
--- a/editor/plugins/text_shader_editor.cpp
+++ b/editor/plugins/text_shader_editor.cpp
@@ -383,11 +383,12 @@ void ShaderTextEditor::_code_complete_script(const String &p_code, List<ScriptLa
List<ScriptLanguage::CodeCompletionOption> pp_defines;
ShaderPreprocessor preprocessor;
String code;
- complete_from_path = (shader.is_valid() ? shader->get_path() : shader_inc->get_path()).get_base_dir();
+ String resource_path = (shader.is_valid() ? shader->get_path() : shader_inc->get_path());
+ complete_from_path = resource_path.get_base_dir();
if (!complete_from_path.ends_with("/")) {
complete_from_path += "/";
}
- preprocessor.preprocess(p_code, "", code, nullptr, nullptr, nullptr, nullptr, &pp_options, &pp_defines, _complete_include_paths);
+ preprocessor.preprocess(p_code, resource_path, code, nullptr, nullptr, nullptr, nullptr, &pp_options, &pp_defines, _complete_include_paths);
complete_from_path = String();
if (pp_options.size()) {
for (const ScriptLanguage::CodeCompletionOption &E : pp_options) {
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 9bad2f2fbf..c5aa60c816 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -256,10 +256,10 @@ void TextureRegionEditor::_region_draw() {
margins[2] = node_ninepatch->get_patch_margin(SIDE_LEFT);
margins[3] = node_ninepatch->get_patch_margin(SIDE_RIGHT);
} else if (obj_styleBox.is_valid()) {
- margins[0] = obj_styleBox->get_margin_size(SIDE_TOP);
- margins[1] = obj_styleBox->get_margin_size(SIDE_BOTTOM);
- margins[2] = obj_styleBox->get_margin_size(SIDE_LEFT);
- margins[3] = obj_styleBox->get_margin_size(SIDE_RIGHT);
+ margins[0] = obj_styleBox->get_texture_margin(SIDE_TOP);
+ margins[1] = obj_styleBox->get_texture_margin(SIDE_BOTTOM);
+ margins[2] = obj_styleBox->get_texture_margin(SIDE_LEFT);
+ margins[3] = obj_styleBox->get_texture_margin(SIDE_RIGHT);
}
Vector2 pos[4] = {
@@ -314,10 +314,10 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
margins[2] = node_ninepatch->get_patch_margin(SIDE_LEFT);
margins[3] = node_ninepatch->get_patch_margin(SIDE_RIGHT);
} else if (obj_styleBox.is_valid()) {
- margins[0] = obj_styleBox->get_margin_size(SIDE_TOP);
- margins[1] = obj_styleBox->get_margin_size(SIDE_BOTTOM);
- margins[2] = obj_styleBox->get_margin_size(SIDE_LEFT);
- margins[3] = obj_styleBox->get_margin_size(SIDE_RIGHT);
+ margins[0] = obj_styleBox->get_texture_margin(SIDE_TOP);
+ margins[1] = obj_styleBox->get_texture_margin(SIDE_BOTTOM);
+ margins[2] = obj_styleBox->get_texture_margin(SIDE_LEFT);
+ margins[3] = obj_styleBox->get_texture_margin(SIDE_RIGHT);
}
Vector2 pos[4] = {
@@ -431,8 +431,8 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
undo_redo->add_do_method(node_ninepatch, "set_patch_margin", side[edited_margin], node_ninepatch->get_patch_margin(side[edited_margin]));
undo_redo->add_undo_method(node_ninepatch, "set_patch_margin", side[edited_margin], prev_margin);
} else if (obj_styleBox.is_valid()) {
- undo_redo->add_do_method(obj_styleBox.ptr(), "set_margin_size", side[edited_margin], obj_styleBox->get_margin_size(side[edited_margin]));
- undo_redo->add_undo_method(obj_styleBox.ptr(), "set_margin_size", side[edited_margin], prev_margin);
+ undo_redo->add_do_method(obj_styleBox.ptr(), "set_texture_margin", side[edited_margin], obj_styleBox->get_texture_margin(side[edited_margin]));
+ undo_redo->add_undo_method(obj_styleBox.ptr(), "set_texture_margin", side[edited_margin], prev_margin);
obj_styleBox->emit_signal(CoreStringNames::get_singleton()->changed);
}
edited_margin = -1;
@@ -474,7 +474,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
node_ninepatch->set_patch_margin(side[edited_margin], prev_margin);
}
if (obj_styleBox.is_valid()) {
- obj_styleBox->set_margin_size(side[edited_margin], prev_margin);
+ obj_styleBox->set_texture_margin(side[edited_margin], prev_margin);
}
edited_margin = -1;
} else {
@@ -535,7 +535,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
node_ninepatch->set_patch_margin(side[edited_margin], new_margin);
}
if (obj_styleBox.is_valid()) {
- obj_styleBox->set_margin_size(side[edited_margin], new_margin);
+ obj_styleBox->set_texture_margin(side[edited_margin], new_margin);
}
} else {
Vector2 new_pos = mtx.affine_inverse().xform(mm->get_position());
@@ -620,22 +620,14 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
}
}
-void TextureRegionEditor::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
- _pan_callback(-p_scroll_vec * 32);
-}
-
-void TextureRegionEditor::_pan_callback(Vector2 p_scroll_vec) {
+void TextureRegionEditor::_pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event) {
p_scroll_vec /= draw_zoom;
hscroll->set_value(hscroll->get_value() - p_scroll_vec.x);
vscroll->set_value(vscroll->get_value() - p_scroll_vec.y);
}
-void TextureRegionEditor::_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt) {
- if (p_scroll_vec.y < 0) {
- _zoom_on_position(draw_zoom * ((0.95 + (0.05 * Math::abs(p_scroll_vec.y))) / 0.95), p_origin);
- } else {
- _zoom_on_position(draw_zoom * (1 - (0.05 * Math::abs(p_scroll_vec.y))), p_origin);
- }
+void TextureRegionEditor::_zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event) {
+ _zoom_on_position(draw_zoom * p_zoom_factor, p_origin);
}
void TextureRegionEditor::_scroll_changed(float) {
@@ -748,6 +740,9 @@ void TextureRegionEditor::_update_rect() {
}
} else if (obj_styleBox.is_valid()) {
rect = obj_styleBox->get_region_rect();
+ if (rect == Rect2()) {
+ rect = Rect2(Vector2(), obj_styleBox->get_texture()->get_size());
+ }
}
}
@@ -1169,7 +1164,7 @@ TextureRegionEditor::TextureRegionEditor() {
hb_grid->hide();
panner.instantiate();
- panner->set_callbacks(callable_mp(this, &TextureRegionEditor::_scroll_callback), callable_mp(this, &TextureRegionEditor::_pan_callback), callable_mp(this, &TextureRegionEditor::_zoom_callback));
+ panner->set_callbacks(callable_mp(this, &TextureRegionEditor::_pan_callback), callable_mp(this, &TextureRegionEditor::_zoom_callback));
edit_draw = memnew(Panel);
vb->add_child(edit_draw);
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index 0325700d25..ba64a04084 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -103,9 +103,8 @@ class TextureRegionEditor : public AcceptDialog {
bool request_center = false;
Ref<ViewPanner> panner;
- void _scroll_callback(Vector2 p_scroll_vec, bool p_alt);
- void _pan_callback(Vector2 p_scroll_vec);
- void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
+ void _pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event);
+ void _zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event);
void _set_snap_mode(int p_mode);
void _set_snap_off_x(float p_val);
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index 40aac77a99..14ff59b442 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -3335,8 +3335,10 @@ void ThemeTypeEditor::set_edited_theme(const Ref<Theme> &p_theme) {
}
edited_theme = p_theme;
- edited_theme->connect("changed", callable_mp(this, &ThemeTypeEditor::_update_type_list_debounced));
- _update_type_list();
+ if (edited_theme.is_valid()) {
+ edited_theme->connect("changed", callable_mp(this, &ThemeTypeEditor::_update_type_list_debounced));
+ _update_type_list();
+ }
add_type_dialog->set_edited_theme(edited_theme);
}
@@ -3496,7 +3498,9 @@ void ThemeEditor::edit(const Ref<Theme> &p_theme) {
preview_tab->set_preview_theme(p_theme);
}
- theme_name->set_text(TTR("Theme:") + " " + theme->get_path().get_file());
+ if (theme.is_valid()) {
+ theme_name->set_text(TTR("Theme:") + " " + theme->get_path().get_file());
+ }
}
Ref<Theme> ThemeEditor::get_edited_theme() {
diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp
index 0ac375407c..fd651dd507 100644
--- a/editor/plugins/tiles/tile_atlas_view.cpp
+++ b/editor/plugins/tiles/tile_atlas_view.cpp
@@ -47,18 +47,14 @@ void TileAtlasView::gui_input(const Ref<InputEvent> &p_event) {
}
}
-void TileAtlasView::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
- _pan_callback(-p_scroll_vec * 32);
-}
-
-void TileAtlasView::_pan_callback(Vector2 p_scroll_vec) {
+void TileAtlasView::_pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event) {
panning += p_scroll_vec;
_update_zoom_and_panning(true);
emit_signal(SNAME("transform_changed"), zoom_widget->get_zoom(), panning);
}
-void TileAtlasView::_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt) {
- zoom_widget->set_zoom_by_increments(-p_scroll_vec.y * 2);
+void TileAtlasView::_zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event) {
+ zoom_widget->set_zoom(zoom_widget->get_zoom() * p_zoom_factor);
_update_zoom_and_panning(true);
emit_signal(SNAME("transform_changed"), zoom_widget->get_zoom(), panning);
}
@@ -251,7 +247,7 @@ void TileAtlasView::_draw_base_tiles() {
for (int frame = 0; frame < tile_set_atlas_source->get_tile_animation_frames_count(atlas_coords); frame++) {
// Update the y to max value.
Rect2i base_frame_rect = tile_set_atlas_source->get_tile_texture_region(atlas_coords, frame);
- Vector2i offset_pos = base_frame_rect.get_center() + tile_set_atlas_source->get_tile_effective_texture_offset(atlas_coords, 0);
+ Vector2i offset_pos = base_frame_rect.get_center() + tile_set_atlas_source->get_tile_data(atlas_coords, 0)->get_texture_origin();
// Draw the tile.
TileMap::draw_tile(base_tiles_draw->get_canvas_item(), offset_pos, tile_set, source_id, atlas_coords, 0, frame);
@@ -326,18 +322,19 @@ void TileAtlasView::_draw_base_tiles_shape_grid() {
Vector2i tile_shape_size = tile_set->get_tile_size();
for (int i = 0; i < tile_set_atlas_source->get_tiles_count(); i++) {
Vector2i tile_id = tile_set_atlas_source->get_tile_id(i);
- Vector2 in_tile_base_offset = tile_set_atlas_source->get_tile_effective_texture_offset(tile_id, 0);
-
- for (int frame = 0; frame < tile_set_atlas_source->get_tile_animation_frames_count(tile_id); frame++) {
- Color color = grid_color;
- if (frame > 0) {
- color.a *= 0.3;
+ Vector2 in_tile_base_offset = tile_set_atlas_source->get_tile_data(tile_id, 0)->get_texture_origin();
+ if (tile_set_atlas_source->is_position_in_tile_texture_region(tile_id, 0, -tile_shape_size / 2) && tile_set_atlas_source->is_position_in_tile_texture_region(tile_id, 0, tile_shape_size / 2 - Vector2(1, 1))) {
+ for (int frame = 0; frame < tile_set_atlas_source->get_tile_animation_frames_count(tile_id); frame++) {
+ Color color = grid_color;
+ if (frame > 0) {
+ color.a *= 0.3;
+ }
+ Rect2i texture_region = tile_set_atlas_source->get_tile_texture_region(tile_id, frame);
+ Transform2D tile_xform;
+ tile_xform.set_origin(texture_region.get_center() + in_tile_base_offset);
+ tile_xform.set_scale(tile_shape_size);
+ tile_set->draw_tile_shape(base_tiles_shape_grid, tile_xform, color);
}
- Rect2i texture_region = tile_set_atlas_source->get_tile_texture_region(tile_id);
- Transform2D tile_xform;
- tile_xform.set_origin(texture_region.get_center() + in_tile_base_offset);
- tile_xform.set_scale(tile_shape_size);
- tile_set->draw_tile_shape(base_tiles_shape_grid, tile_xform, color);
}
}
}
@@ -376,10 +373,10 @@ void TileAtlasView::_draw_alternatives() {
// Update the y to max value.
Vector2i offset_pos;
if (transposed) {
- offset_pos = (current_pos + Vector2(texture_region_size.y, texture_region_size.x) / 2 + tile_set_atlas_source->get_tile_effective_texture_offset(atlas_coords, alternative_id));
+ offset_pos = (current_pos + Vector2(texture_region_size.y, texture_region_size.x) / 2 + tile_data->get_texture_origin());
y_increment = MAX(y_increment, texture_region_size.x);
} else {
- offset_pos = (current_pos + texture_region_size / 2 + tile_set_atlas_source->get_tile_effective_texture_offset(atlas_coords, alternative_id));
+ offset_pos = (current_pos + texture_region_size / 2 + tile_data->get_texture_origin());
y_increment = MAX(y_increment, texture_region_size.y);
}
@@ -583,7 +580,7 @@ TileAtlasView::TileAtlasView() {
add_child(button_center_view);
panner.instantiate();
- panner->set_callbacks(callable_mp(this, &TileAtlasView::_scroll_callback), callable_mp(this, &TileAtlasView::_pan_callback), callable_mp(this, &TileAtlasView::_zoom_callback));
+ panner->set_callbacks(callable_mp(this, &TileAtlasView::_pan_callback), callable_mp(this, &TileAtlasView::_zoom_callback));
panner->set_enable_rmb(true);
center_container = memnew(CenterContainer);
diff --git a/editor/plugins/tiles/tile_atlas_view.h b/editor/plugins/tiles/tile_atlas_view.h
index f719bee704..4a7547f34b 100644
--- a/editor/plugins/tiles/tile_atlas_view.h
+++ b/editor/plugins/tiles/tile_atlas_view.h
@@ -65,9 +65,8 @@ private:
virtual void gui_input(const Ref<InputEvent> &p_event) override;
Ref<ViewPanner> panner;
- void _scroll_callback(Vector2 p_scroll_vec, bool p_alt);
- void _pan_callback(Vector2 p_scroll_vec);
- void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
+ void _pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event);
+ void _zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event);
HashMap<Vector2, HashMap<int, Rect2i>> alternative_tiles_rect_cache;
void _update_alternative_tiles_rect_cache();
diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp
index 81aa9bf272..3dd0c84ee7 100644
--- a/editor/plugins/tiles/tile_data_editors.cpp
+++ b/editor/plugins/tiles/tile_data_editors.cpp
@@ -169,8 +169,7 @@ void GenericTilePolygonEditor::_base_control_draw() {
}
// Draw the polygons.
- for (unsigned int i = 0; i < polygons.size(); i++) {
- const Vector<Vector2> &polygon = polygons[i];
+ for (const Vector<Vector2> &polygon : polygons) {
Color color = polygon_color;
if (!in_creation_polygon.is_empty()) {
color = color.darkened(0.3);
@@ -285,8 +284,8 @@ void GenericTilePolygonEditor::_advanced_menu_item_pressed(int p_item_pressed) {
undo_redo->add_do_method(base_control, "queue_redraw");
undo_redo->add_do_method(this, "emit_signal", "polygons_changed");
undo_redo->add_undo_method(this, "clear_polygons");
- for (unsigned int i = 0; i < polygons.size(); i++) {
- undo_redo->add_undo_method(this, "add_polygon", polygons[i]);
+ for (const PackedVector2Array &poly : polygons) {
+ undo_redo->add_undo_method(this, "add_polygon", poly);
}
undo_redo->add_undo_method(base_control, "queue_redraw");
undo_redo->add_undo_method(this, "emit_signal", "polygons_changed");
@@ -298,8 +297,8 @@ void GenericTilePolygonEditor::_advanced_menu_item_pressed(int p_item_pressed) {
undo_redo->add_do_method(base_control, "queue_redraw");
undo_redo->add_do_method(this, "emit_signal", "polygons_changed");
undo_redo->add_undo_method(this, "clear_polygons");
- for (unsigned int i = 0; i < polygons.size(); i++) {
- undo_redo->add_undo_method(this, "add_polygon", polygons[i]);
+ for (const PackedVector2Array &polygon : polygons) {
+ undo_redo->add_undo_method(this, "add_polygon", polygon);
}
undo_redo->add_undo_method(base_control, "queue_redraw");
undo_redo->add_undo_method(this, "emit_signal", "polygons_changed");
@@ -327,8 +326,8 @@ void GenericTilePolygonEditor::_advanced_menu_item_pressed(int p_item_pressed) {
}
for (unsigned int i = 0; i < polygons.size(); i++) {
Vector<Point2> new_polygon;
- for (int point_index = 0; point_index < polygons[i].size(); point_index++) {
- Vector2 point = polygons[i][point_index];
+ for (const Vector2 &vec : polygons[i]) {
+ Vector2 point = vec;
switch (p_item_pressed) {
case ROTATE_RIGHT: {
point = Vector2(-point.y, point.x);
@@ -351,8 +350,8 @@ void GenericTilePolygonEditor::_advanced_menu_item_pressed(int p_item_pressed) {
}
undo_redo->add_do_method(base_control, "queue_redraw");
undo_redo->add_do_method(this, "emit_signal", "polygons_changed");
- for (unsigned int i = 0; i < polygons.size(); i++) {
- undo_redo->add_undo_method(this, "set_polygon", polygons[i]);
+ for (const PackedVector2Array &polygon : polygons) {
+ undo_redo->add_undo_method(this, "set_polygon", polygon);
}
undo_redo->add_undo_method(base_control, "queue_redraw");
undo_redo->add_undo_method(this, "emit_signal", "polygons_changed");
@@ -1123,14 +1122,15 @@ void TileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2
return;
}
+ Vector2 texture_origin = tile_data->get_texture_origin();
if (value.get_type() == Variant::BOOL) {
Ref<Texture2D> texture = (bool)value ? tile_bool_checked : tile_bool_unchecked;
int size = MIN(tile_set->get_tile_size().x, tile_set->get_tile_size().y) / 3;
- Rect2 rect = p_transform.xform(Rect2(Vector2(-size / 2, -size / 2), Vector2(size, size)));
+ Rect2 rect = p_transform.xform(Rect2(Vector2(-size / 2, -size / 2) - texture_origin, Vector2(size, size)));
p_canvas_item->draw_texture_rect(texture, rect);
} else if (value.get_type() == Variant::COLOR) {
int size = MIN(tile_set->get_tile_size().x, tile_set->get_tile_size().y) / 3;
- Rect2 rect = p_transform.xform(Rect2(Vector2(-size / 2, -size / 2), Vector2(size, size)));
+ Rect2 rect = p_transform.xform(Rect2(Vector2(-size / 2, -size / 2) - texture_origin, Vector2(size, size)));
p_canvas_item->draw_rect(rect, value);
} else {
Ref<Font> font = TileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
@@ -1167,8 +1167,8 @@ void TileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2
}
Vector2 string_size = font->get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size);
- p_canvas_item->draw_string_outline(font, p_transform.get_origin() + Vector2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, 1, Color(0, 0, 0, 1));
- p_canvas_item->draw_string(font, p_transform.get_origin() + Vector2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, color);
+ p_canvas_item->draw_string_outline(font, p_transform.xform(-texture_origin) + Vector2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, 1, Color(0, 0, 0, 1));
+ p_canvas_item->draw_string(font, p_transform.xform(-texture_origin) + Vector2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, color);
}
}
@@ -1242,20 +1242,38 @@ TileDataDefaultEditor::~TileDataDefaultEditor() {
memdelete(dummy_object);
}
-void TileDataTextureOffsetEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) {
+void TileDataTextureOriginEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) {
TileData *tile_data = _get_tile_data(p_cell);
ERR_FAIL_COND(!tile_data);
Vector2i tile_set_tile_size = tile_set->get_tile_size();
- Color color = Color(1.0, 0.0, 0.0);
+ Color color = Color(1.0, 1.0, 1.0);
if (p_selected) {
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
color = selection_color;
}
- Transform2D tile_xform;
- tile_xform.set_scale(tile_set_tile_size);
- tile_set->draw_tile_shape(p_canvas_item, p_transform * tile_xform, color);
+
+ TileSetSource *source = *(tile_set->get_source(p_cell.source_id));
+ TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source);
+ if (atlas_source->is_position_in_tile_texture_region(p_cell.get_atlas_coords(), p_cell.alternative_tile, -tile_set_tile_size / 2) && atlas_source->is_position_in_tile_texture_region(p_cell.get_atlas_coords(), p_cell.alternative_tile, tile_set_tile_size / 2 - Vector2(1, 1))) {
+ Transform2D tile_xform;
+ tile_xform.set_scale(tile_set_tile_size);
+ tile_set->draw_tile_shape(p_canvas_item, p_transform * tile_xform, color);
+ }
+
+ if (atlas_source->is_position_in_tile_texture_region(p_cell.get_atlas_coords(), p_cell.alternative_tile, Vector2())) {
+ Ref<Texture2D> position_icon = TileSetEditor::get_singleton()->get_theme_icon(SNAME("EditorPosition"), SNAME("EditorIcons"));
+ p_canvas_item->draw_texture(position_icon, p_transform.xform(Vector2()) - (position_icon->get_size() / 2), color);
+ } else {
+ Ref<Font> font = TileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
+ int font_size = TileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"));
+ Vector2 texture_origin = tile_data->get_texture_origin();
+ String text = vformat("%s", texture_origin);
+ Vector2 string_size = font->get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size);
+ p_canvas_item->draw_string_outline(font, p_transform.xform(-texture_origin) + Vector2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, 1, Color(0, 0, 0, 1));
+ p_canvas_item->draw_string(font, p_transform.xform(-texture_origin) + Vector2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, color);
+ }
}
void TileDataPositionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) {
@@ -1289,8 +1307,21 @@ void TileDataYSortEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
color = selection_color;
}
- Ref<Texture2D> position_icon = TileSetEditor::get_singleton()->get_theme_icon(SNAME("EditorPosition"), SNAME("EditorIcons"));
- p_canvas_item->draw_texture(position_icon, p_transform.xform(Vector2(0, tile_data->get_y_sort_origin())) - position_icon->get_size() / 2, color);
+ Vector2 texture_origin = tile_data->get_texture_origin();
+ TileSetSource *source = *(tile_set->get_source(p_cell.source_id));
+ TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source);
+ if (atlas_source->is_position_in_tile_texture_region(p_cell.get_atlas_coords(), p_cell.alternative_tile, Vector2(0, tile_data->get_y_sort_origin()))) {
+ Ref<Texture2D> position_icon = TileSetEditor::get_singleton()->get_theme_icon(SNAME("EditorPosition"), SNAME("EditorIcons"));
+ p_canvas_item->draw_texture(position_icon, p_transform.xform(Vector2(0, tile_data->get_y_sort_origin())) - position_icon->get_size() / 2, color);
+ } else {
+ Ref<Font> font = TileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
+ int font_size = TileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"));
+ String text = vformat("%s", tile_data->get_y_sort_origin());
+
+ Vector2 string_size = font->get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size);
+ p_canvas_item->draw_string_outline(font, p_transform.xform(-texture_origin) + Vector2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, 1, Color(0, 0, 0, 1));
+ p_canvas_item->draw_string(font, p_transform.xform(-texture_origin) + Vector2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, color);
+ }
}
void TileDataOcclusionShapeEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) {
@@ -1334,7 +1365,7 @@ void TileDataOcclusionShapeEditor::_set_painted_value(TileSetAtlasSource *p_tile
if (occluder_polygon.is_valid()) {
polygon_editor->add_polygon(occluder_polygon->get_polygon());
}
- polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), p_tile_set_atlas_source->get_tile_effective_texture_offset(p_coords, p_alternative_tile), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate());
+ polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), tile_data->get_texture_origin(), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate());
}
void TileDataOcclusionShapeEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) {
@@ -1343,7 +1374,7 @@ void TileDataOcclusionShapeEditor::_set_value(TileSetAtlasSource *p_tile_set_atl
Ref<OccluderPolygon2D> occluder_polygon = p_value;
tile_data->set_occluder(occlusion_layer, occluder_polygon);
- polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), p_tile_set_atlas_source->get_tile_effective_texture_offset(p_coords, p_alternative_tile), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate());
+ polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), tile_data->get_texture_origin(), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate());
}
Variant TileDataOcclusionShapeEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) {
@@ -1490,7 +1521,7 @@ void TileDataCollisionEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_
E.value->update_property();
}
- polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), p_tile_set_atlas_source->get_tile_effective_texture_offset(p_coords, p_alternative_tile), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate());
+ polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), tile_data->get_texture_origin(), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate());
}
void TileDataCollisionEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) {
@@ -1509,7 +1540,7 @@ void TileDataCollisionEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_so
tile_data->set_collision_polygon_one_way_margin(physics_layer, i, polygon_dict["one_way_margin"]);
}
- polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), p_tile_set_atlas_source->get_tile_effective_texture_offset(p_coords, p_alternative_tile), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate());
+ polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), tile_data->get_texture_origin(), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate());
}
Variant TileDataCollisionEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) {
@@ -1742,7 +1773,7 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(hovered_coords, 0);
int terrain_set = tile_data->get_terrain_set();
Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(hovered_coords);
- Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(hovered_coords, 0);
+ Vector2i position = texture_region.get_center() + tile_data->get_texture_origin();
if (terrain_set >= 0 && terrain_set == int(dummy_object->get("terrain_set"))) {
// Draw hovered bit.
@@ -1793,7 +1824,7 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas
// Text
p_canvas_item->draw_set_transform_matrix(Transform2D());
Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(coords);
- Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, 0);
+ Vector2i position = texture_region.get_center() + tile_data->get_texture_origin();
Color color = Color(1, 1, 1);
String text;
@@ -1886,7 +1917,7 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas
Vector2i coords = E.get_atlas_coords();
Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(coords);
- Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, 0);
+ Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_data(coords, 0)->get_texture_origin();
Vector<Vector2> polygon = tile_set->get_terrain_polygon(terrain_set);
for (int j = 0; j < polygon.size(); j++) {
@@ -1931,7 +1962,7 @@ void TileDataTerrainsEditor::forward_draw_over_alternatives(TileAtlasView *p_til
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(hovered_coords, hovered_alternative);
int terrain_set = tile_data->get_terrain_set();
Rect2i texture_region = p_tile_atlas_view->get_alternative_tile_rect(hovered_coords, hovered_alternative);
- Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(hovered_coords, hovered_alternative);
+ Vector2i position = texture_region.get_center() + tile_data->get_texture_origin();
if (terrain_set == int(dummy_object->get("terrain_set"))) {
// Draw hovered bit.
@@ -1985,7 +2016,7 @@ void TileDataTerrainsEditor::forward_draw_over_alternatives(TileAtlasView *p_til
// Text
p_canvas_item->draw_set_transform_matrix(Transform2D());
Rect2i texture_region = p_tile_atlas_view->get_alternative_tile_rect(coords, alternative_tile);
- Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, 0);
+ Vector2i position = texture_region.get_center() + tile_data->get_texture_origin();
Color color = Color(1, 1, 1);
String text;
@@ -2070,7 +2101,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
// Set the terrains bits.
Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(coords);
- Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, 0);
+ Vector2i position = texture_region.get_center() + tile_data->get_texture_origin();
Vector<Vector2> polygon = tile_set->get_terrain_polygon(tile_data->get_terrain_set());
if (Geometry2D::is_segment_intersecting_polygon(mm->get_position() - position, drag_last_pos - position, polygon)) {
@@ -2104,7 +2135,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0);
int terrain_set = tile_data->get_terrain_set();
Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(coords);
- Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, 0);
+ Vector2i position = texture_region.get_center() + tile_data->get_texture_origin();
dummy_object->set("terrain_set", terrain_set);
dummy_object->set("terrain", -1);
@@ -2219,7 +2250,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
// Set the terrain bit.
Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(coords);
- Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, 0);
+ Vector2i position = texture_region.get_center() + tile_data->get_texture_origin();
Vector<Vector2> polygon = tile_set->get_terrain_polygon(terrain_set);
if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) {
@@ -2366,7 +2397,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0);
Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(coords);
- Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, 0);
+ Vector2i position = texture_region.get_center() + tile_data->get_texture_origin();
Vector<Vector2> polygon = tile_set->get_terrain_polygon(terrain_set);
for (int j = 0; j < polygon.size(); j++) {
@@ -2466,7 +2497,7 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi
// Set the terrains bits.
Rect2i texture_region = p_tile_atlas_view->get_alternative_tile_rect(coords, alternative_tile);
- Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, alternative_tile);
+ Vector2i position = texture_region.get_center() + tile_data->get_texture_origin();
Vector<Vector2> polygon = tile_set->get_terrain_polygon(tile_data->get_terrain_set());
if (Geometry2D::is_segment_intersecting_polygon(mm->get_position() - position, drag_last_pos - position, polygon)) {
@@ -2502,7 +2533,7 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, alternative_tile);
int terrain_set = tile_data->get_terrain_set();
Rect2i texture_region = p_tile_atlas_view->get_alternative_tile_rect(coords, alternative_tile);
- Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, alternative_tile);
+ Vector2i position = texture_region.get_center() + tile_data->get_texture_origin();
dummy_object->set("terrain_set", terrain_set);
dummy_object->set("terrain", -1);
@@ -2592,7 +2623,7 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi
// Set the terrain bit.
Rect2i texture_region = p_tile_atlas_view->get_alternative_tile_rect(coords, alternative_tile);
- Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, alternative_tile);
+ Vector2i position = texture_region.get_center() + tile_data->get_texture_origin();
Vector<Vector2> polygon = tile_set->get_terrain_polygon(terrain_set);
if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) {
@@ -2742,7 +2773,7 @@ void TileDataNavigationEditor::_set_painted_value(TileSetAtlasSource *p_tile_set
polygon_editor->add_polygon(nav_polygon->get_outline(i));
}
}
- polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), p_tile_set_atlas_source->get_tile_effective_texture_offset(p_coords, p_alternative_tile), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate());
+ polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), tile_data->get_texture_origin(), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate());
}
void TileDataNavigationEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) {
@@ -2751,7 +2782,7 @@ void TileDataNavigationEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_s
Ref<NavigationPolygon> nav_polygon = p_value;
tile_data->set_navigation_polygon(navigation_layer, nav_polygon);
- polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), p_tile_set_atlas_source->get_tile_effective_texture_offset(p_coords, p_alternative_tile), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate());
+ polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), tile_data->get_texture_origin(), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate());
}
Variant TileDataNavigationEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) {
diff --git a/editor/plugins/tiles/tile_data_editors.h b/editor/plugins/tiles/tile_data_editors.h
index 02d4584428..1ebf30aecd 100644
--- a/editor/plugins/tiles/tile_data_editors.h
+++ b/editor/plugins/tiles/tile_data_editors.h
@@ -242,8 +242,8 @@ public:
~TileDataDefaultEditor();
};
-class TileDataTextureOffsetEditor : public TileDataDefaultEditor {
- GDCLASS(TileDataTextureOffsetEditor, TileDataDefaultEditor);
+class TileDataTextureOriginEditor : public TileDataDefaultEditor {
+ GDCLASS(TileDataTextureOriginEditor, TileDataDefaultEditor);
public:
virtual void draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected = false) override;
diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp
index 885d41b8da..f0a02a3768 100644
--- a/editor/plugins/tiles/tile_map_editor.cpp
+++ b/editor/plugins/tiles/tile_map_editor.cpp
@@ -266,7 +266,7 @@ void TileMapEditorTilesPlugin::_patterns_item_list_gui_input(const Ref<InputEven
}
Ref<TileSet> tile_set = tile_map->get_tileset();
- if (!tile_set.is_valid()) {
+ if (!tile_set.is_valid() || EditorNode::get_singleton()->is_resource_read_only(tile_set)) {
return;
}
@@ -897,7 +897,7 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over
// Compute the offset
Rect2i source_rect = atlas_source->get_tile_texture_region(E.value.get_atlas_coords());
- Vector2i tile_offset = atlas_source->get_tile_effective_texture_offset(E.value.get_atlas_coords(), E.value.alternative_tile);
+ Vector2i tile_offset = tile_data->get_texture_origin();
// Compute the destination rectangle in the CanvasItem.
Rect2 dest_rect;
@@ -922,7 +922,7 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over
// Get the tile modulation.
Color modulate = tile_data->get_modulate();
- Color self_modulate = tile_map->get_self_modulate();
+ Color self_modulate = tile_map->get_modulate_in_tree() * tile_map->get_self_modulate();
modulate *= self_modulate;
modulate *= tile_map->get_layer_modulate(tile_map_layer);
@@ -1277,13 +1277,15 @@ void TileMapEditorTilesPlugin::_stop_dragging() {
tile_map->set_cell(tile_map_layer, kv.key, kv.value.source_id, kv.value.get_atlas_coords(), kv.value.alternative_tile);
}
- // Creating a pattern in the pattern list.
- select_last_pattern = true;
- int new_pattern_index = tile_set->get_patterns_count();
- undo_redo->create_action(TTR("Add TileSet pattern"));
- undo_redo->add_do_method(*tile_set, "add_pattern", selection_pattern, new_pattern_index);
- undo_redo->add_undo_method(*tile_set, "remove_pattern", new_pattern_index);
- undo_redo->commit_action();
+ if (EditorNode::get_singleton()->is_resource_read_only(tile_set)) {
+ // Creating a pattern in the pattern list.
+ select_last_pattern = true;
+ int new_pattern_index = tile_set->get_patterns_count();
+ undo_redo->create_action(TTR("Add TileSet pattern"));
+ undo_redo->add_do_method(*tile_set, "add_pattern", selection_pattern, new_pattern_index);
+ undo_redo->add_undo_method(*tile_set, "remove_pattern", new_pattern_index);
+ undo_redo->commit_action();
+ }
} else {
// Get the top-left cell.
Vector2i top_left;
@@ -1989,6 +1991,15 @@ TypedArray<Vector2i> TileMapEditorTilesPlugin::_get_tile_map_selection() const {
void TileMapEditorTilesPlugin::edit(ObjectID p_tile_map_id, int p_tile_map_layer) {
_stop_dragging(); // Avoids staying in a wrong drag state.
+ // Disable sort button if the tileset is read-only
+ TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
+ if (tile_map) {
+ Ref<TileSet> tile_set = tile_map->get_tileset();
+ if (tile_set.is_valid()) {
+ source_sort_button->set_disabled(EditorNode::get_singleton()->is_resource_read_only(tile_set));
+ }
+ }
+
if (tile_map_id != p_tile_map_id) {
tile_map_id = p_tile_map_id;
@@ -3088,8 +3099,8 @@ void TileMapEditorTerrainsPlugin::_update_terrains_cache() {
per_terrain_terrains_patterns.resize(tile_set->get_terrain_sets_count());
for (int i = 0; i < tile_set->get_terrain_sets_count(); i++) {
per_terrain_terrains_patterns[i].resize(tile_set->get_terrains_count(i));
- for (int j = 0; j < (int)per_terrain_terrains_patterns[i].size(); j++) {
- per_terrain_terrains_patterns[i][j].clear();
+ for (RBSet<TileSet::TerrainsPattern> &pattern : per_terrain_terrains_patterns[i]) {
+ pattern.clear();
}
}
@@ -3519,8 +3530,8 @@ void TileMapEditor::_update_bottom_panel() {
// Update the visibility of controls.
missing_tileset_label->set_visible(!tile_set.is_valid());
- for (unsigned int tab_index = 0; tab_index < tabs_data.size(); tab_index++) {
- tabs_data[tab_index].panel->hide();
+ for (TileMapEditorPlugin::TabData &tab_data : tabs_data) {
+ tab_data.panel->hide();
}
if (tile_set.is_valid()) {
tabs_data[tabs_bar->get_current_tab()].panel->show();
@@ -3609,15 +3620,15 @@ void TileMapEditor::_tab_changed(int p_tab_id) {
tabs_plugins[tabs_bar->get_current_tab()]->edit(tile_map_id, tile_map_layer);
// Update toolbar.
- for (unsigned int tab_index = 0; tab_index < tabs_data.size(); tab_index++) {
- tabs_data[tab_index].toolbar->hide();
+ for (TileMapEditorPlugin::TabData &tab_data : tabs_data) {
+ tab_data.toolbar->hide();
}
tabs_data[p_tab_id].toolbar->show();
// Update visible panel.
TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
- for (unsigned int tab_index = 0; tab_index < tabs_data.size(); tab_index++) {
- tabs_data[tab_index].panel->hide();
+ for (TileMapEditorPlugin::TabData &tab_data : tabs_data) {
+ tab_data.panel->hide();
}
if (tile_map && tile_map->get_tileset().is_valid()) {
tabs_data[tabs_bar->get_current_tab()].panel->show();
@@ -3986,7 +3997,7 @@ TileMapEditor::TileMapEditor() {
tabs_bar->connect("tab_changed", callable_mp(this, &TileMapEditor::_tab_changed));
// --- TileMap toolbar ---
- tile_map_toolbar = memnew(HBoxContainer);
+ tile_map_toolbar = memnew(HFlowContainer);
tile_map_toolbar->set_h_size_flags(SIZE_EXPAND_FILL);
add_child(tile_map_toolbar);
@@ -3994,15 +4005,18 @@ TileMapEditor::TileMapEditor() {
tile_map_toolbar->add_child(tabs_bar);
// Tabs toolbars.
- for (unsigned int tab_index = 0; tab_index < tabs_data.size(); tab_index++) {
- tabs_data[tab_index].toolbar->hide();
- if (!tabs_data[tab_index].toolbar->get_parent()) {
- tile_map_toolbar->add_child(tabs_data[tab_index].toolbar);
+ for (TileMapEditorPlugin::TabData &tab_data : tabs_data) {
+ tab_data.toolbar->hide();
+ if (!tab_data.toolbar->get_parent()) {
+ tile_map_toolbar->add_child(tab_data.toolbar);
}
}
- // Wide empty separation control.
- tile_map_toolbar->add_spacer();
+ // Wide empty separation control. (like BoxContainer::add_spacer())
+ Control *c = memnew(Control);
+ c->set_mouse_filter(MOUSE_FILTER_PASS);
+ c->set_h_size_flags(SIZE_EXPAND_FILL);
+ tile_map_toolbar->add_child(c);
// Layer selector.
layers_selection_button = memnew(OptionButton);
diff --git a/editor/plugins/tiles/tile_map_editor.h b/editor/plugins/tiles/tile_map_editor.h
index fb9c2f3689..1cab1d1500 100644
--- a/editor/plugins/tiles/tile_map_editor.h
+++ b/editor/plugins/tiles/tile_map_editor.h
@@ -38,6 +38,7 @@
#include "scene/2d/tile_map.h"
#include "scene/gui/box_container.h"
#include "scene/gui/check_box.h"
+#include "scene/gui/flow_container.h"
#include "scene/gui/item_list.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/option_button.h"
@@ -323,7 +324,7 @@ private:
Vector<TileMapEditorPlugin *> tile_map_editor_plugins;
// Toolbar.
- HBoxContainer *tile_map_toolbar = nullptr;
+ HFlowContainer *tile_map_toolbar = nullptr;
OptionButton *layers_selection_button = nullptr;
Button *toggle_highlight_selected_layer_button = nullptr;
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
index 32421daa92..840a3911af 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
@@ -585,6 +585,7 @@ void TileSetAtlasSourceEditor::_update_atlas_source_inspector() {
// Update visibility.
bool inspector_visible = tools_button_group->get_pressed_button() == tool_setup_atlas_source_button;
atlas_source_inspector->set_visible(inspector_visible);
+ atlas_source_inspector->set_read_only(read_only);
}
void TileSetAtlasSourceEditor::_update_tile_inspector() {
@@ -599,6 +600,7 @@ void TileSetAtlasSourceEditor::_update_tile_inspector() {
tile_inspector->hide();
tile_inspector_no_tile_selected_label->hide();
}
+ tile_inspector->set_read_only(read_only);
}
void TileSetAtlasSourceEditor::_update_tile_data_editors() {
@@ -638,14 +640,14 @@ void TileSetAtlasSourceEditor::_update_tile_data_editors() {
// --- Rendering ---
ADD_TILE_DATA_EDITOR_GROUP("Rendering");
- ADD_TILE_DATA_EDITOR(group, "Texture Offset", "texture_offset");
- if (!tile_data_editors.has("texture_offset")) {
- TileDataTextureOffsetEditor *tile_data_texture_offset_editor = memnew(TileDataTextureOffsetEditor);
- tile_data_texture_offset_editor->hide();
- tile_data_texture_offset_editor->setup_property_editor(Variant::VECTOR2, "texture_offset");
- tile_data_texture_offset_editor->connect("needs_redraw", callable_mp((CanvasItem *)tile_atlas_control_unscaled, &Control::queue_redraw));
- tile_data_texture_offset_editor->connect("needs_redraw", callable_mp((CanvasItem *)alternative_tiles_control_unscaled, &Control::queue_redraw));
- tile_data_editors["texture_offset"] = tile_data_texture_offset_editor;
+ ADD_TILE_DATA_EDITOR(group, "Texture Origin", "texture_origin");
+ if (!tile_data_editors.has("texture_origin")) {
+ TileDataTextureOriginEditor *tile_data_texture_origin_editor = memnew(TileDataTextureOriginEditor);
+ tile_data_texture_origin_editor->hide();
+ tile_data_texture_origin_editor->setup_property_editor(Variant::VECTOR2, "texture_origin");
+ tile_data_texture_origin_editor->connect("needs_redraw", callable_mp((CanvasItem *)tile_atlas_control_unscaled, &Control::queue_redraw));
+ tile_data_texture_origin_editor->connect("needs_redraw", callable_mp((CanvasItem *)alternative_tiles_control_unscaled, &Control::queue_redraw));
+ tile_data_editors["texture_origin"] = tile_data_texture_origin_editor;
}
ADD_TILE_DATA_EDITOR(group, "Modulate", "modulate");
@@ -970,19 +972,19 @@ void TileSetAtlasSourceEditor::_update_toolbar() {
current_tile_data_editor_toolbar->hide();
}
tools_settings_erase_button->show();
- tool_advanced_menu_buttom->show();
+ tool_advanced_menu_button->show();
} else if (tools_button_group->get_pressed_button() == tool_select_button) {
if (current_tile_data_editor_toolbar) {
current_tile_data_editor_toolbar->hide();
}
tools_settings_erase_button->hide();
- tool_advanced_menu_buttom->hide();
+ tool_advanced_menu_button->hide();
} else if (tools_button_group->get_pressed_button() == tool_paint_button) {
if (current_tile_data_editor_toolbar) {
current_tile_data_editor_toolbar->show();
}
tools_settings_erase_button->hide();
- tool_advanced_menu_buttom->hide();
+ tool_advanced_menu_button->hide();
}
}
@@ -1862,7 +1864,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_unscaled_draw() {
for (int i = 0; i < tile_set_atlas_source->get_tiles_count(); i++) {
Vector2i coords = tile_set_atlas_source->get_tile_id(i);
Rect2i texture_region = tile_set_atlas_source->get_tile_texture_region(coords);
- Vector2i position = texture_region.get_center() + tile_set_atlas_source->get_tile_effective_texture_offset(coords, 0);
+ Vector2i position = texture_region.get_center() + tile_set_atlas_source->get_tile_data(coords, 0)->get_texture_origin();
Transform2D xform = tile_atlas_control->get_parent_control()->get_transform();
xform.translate_local(position);
@@ -1885,7 +1887,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_unscaled_draw() {
continue;
}
Rect2i texture_region = tile_set_atlas_source->get_tile_texture_region(E.tile);
- Vector2i position = texture_region.get_center() + tile_set_atlas_source->get_tile_effective_texture_offset(E.tile, 0);
+ Vector2i position = texture_region.get_center() + tile_set_atlas_source->get_tile_data(E.tile, 0)->get_texture_origin();
Transform2D xform = tile_atlas_control->get_parent_control()->get_transform();
xform.translate_local(position);
@@ -2037,7 +2039,7 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_unscaled_draw() {
continue;
}
Rect2i rect = tile_atlas_view->get_alternative_tile_rect(coords, alternative_tile);
- Vector2 position = rect.get_center() + tile_set_atlas_source->get_tile_effective_texture_offset(coords, alternative_tile);
+ Vector2 position = rect.get_center() + tile_set_atlas_source->get_tile_data(coords, alternative_tile)->get_texture_origin();
Transform2D xform = alternative_tiles_control->get_parent_control()->get_transform();
xform.translate_local(position);
@@ -2061,7 +2063,7 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_unscaled_draw() {
continue;
}
Rect2i rect = tile_atlas_view->get_alternative_tile_rect(E.tile, E.alternative);
- Vector2 position = rect.get_center() + tile_set_atlas_source->get_tile_effective_texture_offset(E.tile, E.alternative);
+ Vector2 position = rect.get_center() + tile_set_atlas_source->get_tile_data(E.tile, E.alternative)->get_texture_origin();
Transform2D xform = alternative_tiles_control->get_parent_control()->get_transform();
xform.translate_local(position);
@@ -2188,7 +2190,12 @@ void TileSetAtlasSourceEditor::edit(Ref<TileSet> p_tile_set, TileSetAtlasSource
ERR_FAIL_COND(p_source_id < 0);
ERR_FAIL_COND(p_tile_set->get_source(p_source_id) != p_tile_set_atlas_source);
- if (p_tile_set == tile_set && p_tile_set_atlas_source == tile_set_atlas_source && p_source_id == tile_set_atlas_source_id) {
+ bool new_read_only_state = false;
+ if (p_tile_set.is_valid()) {
+ new_read_only_state = EditorNode::get_singleton()->is_resource_read_only(p_tile_set);
+ }
+
+ if (p_tile_set == tile_set && p_tile_set_atlas_source == tile_set_atlas_source && p_source_id == tile_set_atlas_source_id && new_read_only_state == read_only) {
return;
}
@@ -2205,11 +2212,23 @@ void TileSetAtlasSourceEditor::edit(Ref<TileSet> p_tile_set, TileSetAtlasSource
tile_set_atlas_source = p_tile_set_atlas_source;
tile_set_atlas_source_id = p_source_id;
- // Add the listener again.
+ // Read-only is off by default.
+ read_only = new_read_only_state;
+
if (tile_set.is_valid()) {
tile_set->connect("changed", callable_mp(this, &TileSetAtlasSourceEditor::_tile_set_changed));
}
+ if (read_only && tools_button_group->get_pressed_button() == tool_paint_button) {
+ tool_paint_button->set_pressed(false);
+ tool_setup_atlas_source_button->set_pressed(true);
+ }
+
+ // Disable buttons in read-only mode.
+ tool_paint_button->set_disabled(read_only);
+ tools_settings_erase_button->set_disabled(read_only);
+ tool_advanced_menu_button->set_disabled(read_only);
+
// Update everything.
_update_source_inspector();
@@ -2344,7 +2363,7 @@ void TileSetAtlasSourceEditor::_notification(int p_what) {
tools_settings_erase_button->set_icon(get_theme_icon(SNAME("Eraser"), SNAME("EditorIcons")));
- tool_advanced_menu_buttom->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
+ tool_advanced_menu_button->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
resize_handle = get_theme_icon(SNAME("EditorHandle"), SNAME("EditorIcons"));
resize_handle_disabled = get_theme_icon(SNAME("EditorHandleDisabled"), SNAME("EditorIcons"));
@@ -2352,6 +2371,18 @@ void TileSetAtlasSourceEditor::_notification(int p_what) {
case NOTIFICATION_INTERNAL_PROCESS: {
if (tile_set_changed_needs_update) {
+ // Read-only is off by default
+ read_only = false;
+ // Add the listener again and check for read-only status.
+ if (tile_set.is_valid()) {
+ read_only = EditorNode::get_singleton()->is_resource_read_only(tile_set);
+ }
+
+ // Disable buttons in read-only mode.
+ tool_paint_button->set_disabled(read_only);
+ tools_settings_erase_button->set_disabled(read_only);
+ tool_advanced_menu_button->set_disabled(read_only);
+
// Update everything.
_update_source_inspector();
@@ -2516,12 +2547,12 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
tools_settings_erase_button->set_shortcut_context(this);
tool_settings->add_child(tools_settings_erase_button);
- tool_advanced_menu_buttom = memnew(MenuButton);
- tool_advanced_menu_buttom->set_flat(true);
- tool_advanced_menu_buttom->get_popup()->add_item(TTR("Create Tiles in Non-Transparent Texture Regions"), ADVANCED_AUTO_CREATE_TILES);
- tool_advanced_menu_buttom->get_popup()->add_item(TTR("Remove Tiles in Fully Transparent Texture Regions"), ADVANCED_AUTO_REMOVE_TILES);
- tool_advanced_menu_buttom->get_popup()->connect("id_pressed", callable_mp(this, &TileSetAtlasSourceEditor::_menu_option));
- tool_settings->add_child(tool_advanced_menu_buttom);
+ tool_advanced_menu_button = memnew(MenuButton);
+ tool_advanced_menu_button->set_flat(true);
+ tool_advanced_menu_button->get_popup()->add_item(TTR("Create Tiles in Non-Transparent Texture Regions"), ADVANCED_AUTO_CREATE_TILES);
+ tool_advanced_menu_button->get_popup()->add_item(TTR("Remove Tiles in Fully Transparent Texture Regions"), ADVANCED_AUTO_REMOVE_TILES);
+ tool_advanced_menu_button->get_popup()->connect("id_pressed", callable_mp(this, &TileSetAtlasSourceEditor::_menu_option));
+ tool_settings->add_child(tool_advanced_menu_button);
_update_toolbar();
@@ -2673,7 +2704,7 @@ void EditorPropertyTilePolygon::update_property() {
Vector2i coords = atlas_tile_proxy_object->get_edited_tiles().front()->get().tile;
int alternative = atlas_tile_proxy_object->get_edited_tiles().front()->get().alternative;
TileData *tile_data = tile_set_atlas_source->get_tile_data(coords, alternative);
- generic_tile_polygon_editor->set_background(tile_set_atlas_source->get_texture(), tile_set_atlas_source->get_tile_texture_region(coords), tile_set_atlas_source->get_tile_effective_texture_offset(coords, alternative), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate());
+ generic_tile_polygon_editor->set_background(tile_set_atlas_source->get_texture(), tile_set_atlas_source->get_tile_texture_region(coords), tile_data->get_texture_origin(), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate());
// Reset the polygons.
generic_tile_polygon_editor->clear_polygons();
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.h b/editor/plugins/tiles/tile_set_atlas_source_editor.h
index bcab1296ad..a4826bc56f 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.h
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.h
@@ -113,6 +113,8 @@ public:
};
private:
+ bool read_only = false;
+
Ref<TileSet> tile_set;
TileSetAtlasSource *tile_set_atlas_source = nullptr;
int tile_set_atlas_source_id = TileSet::INVALID_SOURCE;
@@ -209,7 +211,7 @@ private:
HBoxContainer *tool_settings = nullptr;
HBoxContainer *tool_settings_tile_data_toolbar_container = nullptr;
Button *tools_settings_erase_button = nullptr;
- MenuButton *tool_advanced_menu_buttom = nullptr;
+ MenuButton *tool_advanced_menu_button = nullptr;
// Selection.
RBSet<TileSelection> selection;
diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp
index 53c2d4de51..39d17c718e 100644
--- a/editor/plugins/tiles/tile_set_editor.cpp
+++ b/editor/plugins/tiles/tile_set_editor.cpp
@@ -89,6 +89,10 @@ void TileSetEditor::_drop_data_fw(const Point2 &p_point, const Variant &p_data,
bool TileSetEditor::_can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
ERR_FAIL_COND_V(!tile_set.is_valid(), false);
+ if (read_only) {
+ return false;
+ }
+
if (p_from == sources_list) {
Dictionary d = p_data;
@@ -223,7 +227,7 @@ void TileSetEditor::_source_selected(int p_source_index) {
ERR_FAIL_COND(!tile_set.is_valid());
// Update the selected source.
- sources_delete_button->set_disabled(p_source_index < 0);
+ sources_delete_button->set_disabled(p_source_index < 0 || read_only);
if (p_source_index >= 0) {
int source_id = sources_list->get_item_metadata(p_source_index);
@@ -356,8 +360,19 @@ void TileSetEditor::_notification(int p_what) {
if (tile_set.is_valid()) {
tile_set->set_edited(true);
}
+
+ read_only = false;
+ if (tile_set.is_valid()) {
+ read_only = EditorNode::get_singleton()->is_resource_read_only(tile_set);
+ }
+
_update_sources_list();
_update_patterns_list();
+
+ sources_add_button->set_disabled(read_only);
+ sources_advanced_menu_button->set_disabled(read_only);
+ source_sort_button->set_disabled(read_only);
+
tile_set_changed_needs_update = false;
}
} break;
@@ -367,6 +382,10 @@ void TileSetEditor::_notification(int p_what) {
void TileSetEditor::_patterns_item_list_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(!tile_set.is_valid());
+ if (EditorNode::get_singleton()->is_resource_read_only(tile_set)) {
+ return;
+ }
+
if (ED_IS_SHORTCUT("tiles_editor/delete", p_event) && p_event->is_pressed() && !p_event->is_echo()) {
Vector<int> selected = patterns_item_list->get_selected_items();
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
@@ -667,7 +686,12 @@ void TileSetEditor::_undo_redo_inspector_callback(Object *p_undo_redo, Object *p
}
void TileSetEditor::edit(Ref<TileSet> p_tile_set) {
- if (p_tile_set == tile_set) {
+ bool new_read_only_state = false;
+ if (tile_set.is_valid()) {
+ new_read_only_state = EditorNode::get_singleton()->is_resource_read_only(p_tile_set);
+ }
+
+ if (p_tile_set == tile_set && new_read_only_state == read_only) {
return;
}
@@ -679,8 +703,15 @@ void TileSetEditor::edit(Ref<TileSet> p_tile_set) {
// Change the edited object.
tile_set = p_tile_set;
- // Add the listener again.
+ // Read-only status is false by default
+ read_only = new_read_only_state;
+
+ // Add the listener again and check for read-only status.
if (tile_set.is_valid()) {
+ sources_add_button->set_disabled(read_only);
+ sources_advanced_menu_button->set_disabled(read_only);
+ source_sort_button->set_disabled(read_only);
+
tile_set->connect("changed", callable_mp(this, &TileSetEditor::_tile_set_changed));
if (first_edit) {
first_edit = false;
@@ -690,10 +721,6 @@ void TileSetEditor::edit(Ref<TileSet> p_tile_set) {
}
_update_patterns_list();
}
-
- tile_set_atlas_source_editor->hide();
- tile_set_scenes_collection_source_editor->hide();
- no_source_selected_label->show();
}
TileSetEditor::TileSetEditor() {
diff --git a/editor/plugins/tiles/tile_set_editor.h b/editor/plugins/tiles/tile_set_editor.h
index e3dff11277..d36d3bde41 100644
--- a/editor/plugins/tiles/tile_set_editor.h
+++ b/editor/plugins/tiles/tile_set_editor.h
@@ -45,6 +45,8 @@ class TileSetEditor : public VBoxContainer {
static TileSetEditor *singleton;
private:
+ bool read_only = false;
+
Ref<TileSet> tile_set;
bool tile_set_changed_needs_update = false;
HSplitContainer *split_container = nullptr;
diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp
index 6251cd18f7..cc276597fa 100644
--- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp
@@ -284,7 +284,7 @@ void TileSetScenesCollectionSourceEditor::_update_tile_inspector() {
void TileSetScenesCollectionSourceEditor::_update_action_buttons() {
Vector<int> selected_indices = scene_tiles_list->get_selected_items();
- scene_tile_delete_button->set_disabled(selected_indices.size() <= 0);
+ scene_tile_delete_button->set_disabled(selected_indices.size() <= 0 || read_only);
}
void TileSetScenesCollectionSourceEditor::_update_scenes_list() {
@@ -342,6 +342,12 @@ void TileSetScenesCollectionSourceEditor::_notification(int p_what) {
case NOTIFICATION_INTERNAL_PROCESS: {
if (tile_set_scenes_collection_source_changed_needs_update) {
+ read_only = false;
+ // Add the listener again and check for read-only status.
+ if (tile_set.is_valid()) {
+ read_only = EditorNode::get_singleton()->is_resource_read_only(tile_set);
+ }
+
// Update everything.
_update_source_inspector();
_update_scenes_list();
@@ -365,7 +371,12 @@ void TileSetScenesCollectionSourceEditor::edit(Ref<TileSet> p_tile_set, TileSetS
ERR_FAIL_COND(p_source_id < 0);
ERR_FAIL_COND(p_tile_set->get_source(p_source_id) != p_tile_set_scenes_collection_source);
- if (p_tile_set == tile_set && p_tile_set_scenes_collection_source == tile_set_scenes_collection_source && p_source_id == tile_set_source_id) {
+ bool new_read_only_state = false;
+ if (p_tile_set.is_valid()) {
+ new_read_only_state = EditorNode::get_singleton()->is_resource_read_only(p_tile_set);
+ }
+
+ if (p_tile_set == tile_set && p_tile_set_scenes_collection_source == tile_set_scenes_collection_source && p_source_id == tile_set_source_id && new_read_only_state == read_only) {
return;
}
@@ -379,6 +390,16 @@ void TileSetScenesCollectionSourceEditor::edit(Ref<TileSet> p_tile_set, TileSetS
tile_set_scenes_collection_source = p_tile_set_scenes_collection_source;
tile_set_source_id = p_source_id;
+ // Read-only status is false by default
+ read_only = new_read_only_state;
+
+ if (tile_set.is_valid()) {
+ scenes_collection_source_inspector->set_read_only(read_only);
+ tile_inspector->set_read_only(read_only);
+
+ scene_tile_add_button->set_disabled(read_only);
+ }
+
// Add the listener again.
if (tile_set_scenes_collection_source) {
tile_set_scenes_collection_source->connect("changed", callable_mp(this, &TileSetScenesCollectionSourceEditor::_tile_set_scenes_collection_source_changed));
diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h
index 0901205a29..2a0e8595c4 100644
--- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h
+++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h
@@ -91,6 +91,8 @@ private:
};
private:
+ bool read_only = false;
+
Ref<TileSet> tile_set;
TileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr;
int tile_set_source_id = -1;
diff --git a/editor/plugins/tiles/tiles_editor_plugin.cpp b/editor/plugins/tiles/tiles_editor_plugin.cpp
index 19ee0ae98d..fad36660d9 100644
--- a/editor/plugins/tiles/tiles_editor_plugin.cpp
+++ b/editor/plugins/tiles/tiles_editor_plugin.cpp
@@ -101,12 +101,12 @@ void TilesEditorPlugin::_thread() {
encompassing_rect.expand_to(world_pos);
// Texture.
- Ref<TileSetAtlasSource> atlas_source = tile_set->get_source(tile_map->get_cell_source_id(0, cell));
+ Ref<TileSetAtlasSource> atlas_source = item.tile_set->get_source(tile_map->get_cell_source_id(0, cell));
if (atlas_source.is_valid()) {
Vector2i coords = tile_map->get_cell_atlas_coords(0, cell);
int alternative = tile_map->get_cell_alternative_tile(0, cell);
- Vector2 center = world_pos - atlas_source->get_tile_effective_texture_offset(coords, alternative);
+ Vector2 center = world_pos - atlas_source->get_tile_data(coords, alternative)->get_texture_origin();
encompassing_rect.expand_to(center - atlas_source->get_tile_texture_region(coords).size / 2);
encompassing_rect.expand_to(center + atlas_source->get_tile_texture_region(coords).size / 2);
}
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 96b1ad7ee0..af70e64b6a 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -40,6 +40,7 @@
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/editor_undo_redo_manager.h"
+#include "editor/filesystem_dock.h"
#include "editor/inspector_dock.h"
#include "editor/plugins/curve_editor_plugin.h"
#include "editor/plugins/shader_editor_plugin.h"
@@ -1271,18 +1272,55 @@ Dictionary VisualShaderEditor::get_custom_node_data(Ref<VisualShaderNodeCustom>
return dict;
}
-void VisualShaderEditor::update_custom_type(const Ref<Resource> &p_resource) {
- Ref<Script> scr = Ref<Script>(p_resource.ptr());
- if (scr.is_null() || scr->get_instance_base_type() != "VisualShaderNodeCustom") {
+void VisualShaderEditor::_get_current_mode_limits(int &r_begin_type, int &r_end_type) const {
+ switch (visual_shader->get_mode()) {
+ case Shader::MODE_CANVAS_ITEM:
+ case Shader::MODE_SPATIAL: {
+ r_begin_type = 0;
+ r_end_type = 3;
+ } break;
+ case Shader::MODE_PARTICLES: {
+ r_begin_type = 3;
+ r_end_type = 5 + r_begin_type;
+ } break;
+ case Shader::MODE_SKY: {
+ r_begin_type = 8;
+ r_end_type = 1 + r_begin_type;
+ } break;
+ case Shader::MODE_FOG: {
+ r_begin_type = 9;
+ r_end_type = 1 + r_begin_type;
+ } break;
+ default: {
+ } break;
+ }
+}
+
+void VisualShaderEditor::_script_created(const Ref<Script> &p_script) {
+ if (p_script.is_null() || p_script->get_instance_base_type() != "VisualShaderNodeCustom") {
+ return;
+ }
+ Ref<VisualShaderNodeCustom> ref;
+ ref.instantiate();
+ ref->set_script(p_script);
+
+ Dictionary dict = get_custom_node_data(ref);
+ add_custom_type(dict["name"], dict["script"], dict["description"], dict["return_icon_type"], dict["category"], dict["highend"]);
+
+ _update_options_menu();
+}
+
+void VisualShaderEditor::_update_custom_script(const Ref<Script> &p_script) {
+ if (p_script.is_null() || p_script->get_instance_base_type() != "VisualShaderNodeCustom") {
return;
}
Ref<VisualShaderNodeCustom> ref;
ref.instantiate();
- ref->set_script(scr);
+ ref->set_script(p_script);
if (!ref->is_available(visual_shader->get_mode(), visual_shader->get_shader_type())) {
for (int i = 0; i < add_options.size(); i++) {
- if (add_options[i].is_custom && add_options[i].script == scr) {
+ if (add_options[i].is_custom && add_options[i].script == p_script) {
add_options.remove_at(i);
_update_options_menu();
// TODO: Make indication for the existed custom nodes with that script on graph to be disabled.
@@ -1296,8 +1334,8 @@ void VisualShaderEditor::update_custom_type(const Ref<Resource> &p_resource) {
bool found_type = false;
bool need_rebuild = false;
- for (int i = 0; i < add_options.size(); i++) {
- if (add_options[i].is_custom && add_options[i].script == scr) {
+ for (int i = custom_node_option_idx; i < add_options.size(); i++) {
+ if (add_options[i].script == p_script) {
found_type = true;
add_options.write[i].name = dict["name"];
@@ -1306,31 +1344,11 @@ void VisualShaderEditor::update_custom_type(const Ref<Resource> &p_resource) {
add_options.write[i].category = dict["category"];
add_options.write[i].highend = dict["highend"];
- int max_type = 0;
- int type_offset = 0;
- switch (visual_shader->get_mode()) {
- case Shader::MODE_CANVAS_ITEM:
- case Shader::MODE_SPATIAL: {
- max_type = 3;
- } break;
- case Shader::MODE_PARTICLES: {
- max_type = 5;
- type_offset = 3;
- } break;
- case Shader::MODE_SKY: {
- max_type = 1;
- type_offset = 8;
- } break;
- case Shader::MODE_FOG: {
- max_type = 1;
- type_offset = 9;
- } break;
- default: {
- } break;
- }
- max_type = type_offset + max_type;
+ int begin_type = 0;
+ int end_type = 0;
+ _get_current_mode_limits(begin_type, end_type);
- for (int t = type_offset; t < max_type; t++) {
+ for (int t = begin_type; t < end_type; t++) {
VisualShader::Type type = (VisualShader::Type)t;
Vector<int> nodes = visual_shader->get_node_list(type);
@@ -1339,28 +1357,27 @@ void VisualShaderEditor::update_custom_type(const Ref<Resource> &p_resource) {
List<VisualShader::Connection> custom_node_input_connections;
List<VisualShader::Connection> custom_node_output_connections;
+
for (const VisualShader::Connection &E : node_connections) {
int from = E.from_node;
- int from_idx = E.from_port;
+ int from_port = E.from_port;
int to = E.to_node;
- int to_idx = E.to_port;
+ int to_port = E.to_port;
- if (graph_plugin->get_node_script(from) == scr) {
- custom_node_output_connections.push_back({ from, from_idx, to, to_idx });
- } else if (graph_plugin->get_node_script(to) == scr) {
- custom_node_input_connections.push_back({ from, from_idx, to, to_idx });
+ if (graph_plugin->get_node_script(from) == p_script) {
+ custom_node_output_connections.push_back({ from, from_port, to, to_port });
+ } else if (graph_plugin->get_node_script(to) == p_script) {
+ custom_node_input_connections.push_back({ from, from_port, to, to_port });
}
}
- for (int j = 0; j < nodes.size(); j++) {
- int node_id = nodes[j];
-
+ for (int node_id : nodes) {
Ref<VisualShaderNode> vsnode = visual_shader->get_node(type, node_id);
if (vsnode.is_null()) {
continue;
}
Ref<VisualShaderNodeCustom> custom_node = Ref<VisualShaderNodeCustom>(vsnode.ptr());
- if (custom_node.is_null() || custom_node->get_script() != scr) {
+ if (custom_node.is_null() || custom_node->get_script() != p_script) {
continue;
}
need_rebuild = true;
@@ -1429,6 +1446,89 @@ void VisualShaderEditor::update_custom_type(const Ref<Resource> &p_resource) {
}
}
+void VisualShaderEditor::_resource_saved(const Ref<Resource> &p_resource) {
+ _update_custom_script(Ref<Script>(p_resource.ptr()));
+}
+
+void VisualShaderEditor::_resources_removed() {
+ bool has_any_instance = false;
+
+ for (const Ref<Script> &scr : custom_scripts_to_delete) {
+ for (int i = custom_node_option_idx; i < add_options.size(); i++) {
+ if (add_options[i].script == scr) {
+ add_options.remove_at(i);
+
+ // Removes all node instances using that script from the graph.
+ {
+ int begin_type = 0;
+ int end_type = 0;
+ _get_current_mode_limits(begin_type, end_type);
+
+ for (int t = begin_type; t < end_type; t++) {
+ VisualShader::Type type = (VisualShader::Type)t;
+
+ List<VisualShader::Connection> node_connections;
+ visual_shader->get_node_connections(type, &node_connections);
+
+ for (const VisualShader::Connection &E : node_connections) {
+ int from = E.from_node;
+ int from_port = E.from_port;
+ int to = E.to_node;
+ int to_port = E.to_port;
+
+ if (graph_plugin->get_node_script(from) == scr || graph_plugin->get_node_script(to) == scr) {
+ visual_shader->disconnect_nodes(type, from, from_port, to, to_port);
+ graph_plugin->disconnect_nodes(type, from, from_port, to, to_port);
+ }
+ }
+
+ Vector<int> nodes = visual_shader->get_node_list(type);
+ for (int node_id : nodes) {
+ Ref<VisualShaderNode> vsnode = visual_shader->get_node(type, node_id);
+ if (vsnode.is_null()) {
+ continue;
+ }
+ Ref<VisualShaderNodeCustom> custom_node = Ref<VisualShaderNodeCustom>(vsnode.ptr());
+ if (custom_node.is_null() || custom_node->get_script() != scr) {
+ continue;
+ }
+ visual_shader->remove_node(type, node_id);
+ graph_plugin->remove_node(type, node_id, false);
+
+ has_any_instance = true;
+ }
+ }
+ }
+
+ break;
+ }
+ }
+ }
+ if (has_any_instance) {
+ EditorUndoRedoManager::get_singleton()->clear_history(); // Need to clear undo history, otherwise it may lead to hard-detected errors and crashes (since the script was removed).
+ ResourceSaver::save(visual_shader, visual_shader->get_path());
+ }
+ _update_options_menu();
+
+ custom_scripts_to_delete.clear();
+ pending_custom_scripts_to_delete = false;
+}
+
+void VisualShaderEditor::_resource_removed(const Ref<Resource> &p_resource) {
+ Ref<Script> scr = Ref<Script>(p_resource.ptr());
+ if (scr.is_null() || scr->get_instance_base_type() != "VisualShaderNodeCustom") {
+ return;
+ }
+
+ custom_scripts_to_delete.push_back(scr);
+
+ if (!pending_custom_scripts_to_delete) {
+ pending_custom_scripts_to_delete = true;
+
+ call_deferred("_resources_removed");
+ }
+}
+
void VisualShaderEditor::_update_options_menu_deferred() {
_update_options_menu();
@@ -4901,13 +5001,16 @@ void VisualShaderEditor::_bind_methods() {
ClassDB::bind_method("_expand_output_port", &VisualShaderEditor::_expand_output_port);
ClassDB::bind_method("_update_options_menu_deferred", &VisualShaderEditor::_update_options_menu_deferred);
ClassDB::bind_method("_rebuild_shader_deferred", &VisualShaderEditor::_rebuild_shader_deferred);
+ ClassDB::bind_method("_resources_removed", &VisualShaderEditor::_resources_removed);
ClassDB::bind_method("_is_available", &VisualShaderEditor::_is_available);
}
VisualShaderEditor::VisualShaderEditor() {
ShaderLanguage::get_keyword_list(&keyword_list);
- EditorNode::get_singleton()->connect("resource_saved", callable_mp(this, &VisualShaderEditor::update_custom_type));
+ EditorNode::get_singleton()->connect("resource_saved", callable_mp(this, &VisualShaderEditor::_resource_saved));
+ FileSystemDock::get_singleton()->get_script_create_dialog()->connect("script_created", callable_mp(this, &VisualShaderEditor::_script_created));
+ FileSystemDock::get_singleton()->connect("resource_removed", callable_mp(this, &VisualShaderEditor::_resource_removed));
graph = memnew(GraphEdit);
graph->get_zoom_hbox()->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -5186,7 +5289,7 @@ VisualShaderEditor::VisualShaderEditor() {
members_dialog->set_ok_button_text(TTR("Create"));
members_dialog->get_ok_button()->connect("pressed", callable_mp(this, &VisualShaderEditor::_member_create));
members_dialog->get_ok_button()->set_disabled(true);
- members_dialog->connect("cancelled", callable_mp(this, &VisualShaderEditor::_member_cancel));
+ members_dialog->connect("canceled", callable_mp(this, &VisualShaderEditor::_member_cancel));
add_child(members_dialog);
// add varyings dialog
diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h
index c4f6b4952c..519a390ccc 100644
--- a/editor/plugins/visual_shader_editor_plugin.h
+++ b/editor/plugins/visual_shader_editor_plugin.h
@@ -188,6 +188,9 @@ class VisualShaderEditor : public VBoxContainer {
PanelContainer *error_panel = nullptr;
Label *error_label = nullptr;
+ bool pending_custom_scripts_to_delete = false;
+ List<Ref<Script>> custom_scripts_to_delete;
+
bool _block_update_options_menu = false;
bool _block_rebuild_shader = false;
@@ -503,6 +506,13 @@ class VisualShaderEditor : public VBoxContainer {
void _visibility_changed();
+ void _get_current_mode_limits(int &r_begin_type, int &r_end_type) const;
+ void _update_custom_script(const Ref<Script> &p_script);
+ void _script_created(const Ref<Script> &p_script);
+ void _resource_saved(const Ref<Resource> &p_resource);
+ void _resource_removed(const Ref<Resource> &p_resource);
+ void _resources_removed();
+
protected:
void _notification(int p_what);
static void _bind_methods();
@@ -517,7 +527,6 @@ public:
void add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, bool p_highend);
Dictionary get_custom_node_data(Ref<VisualShaderNodeCustom> &p_custom_node);
- void update_custom_type(const Ref<Resource> &p_resource);
virtual Size2 get_minimum_size() const override;
void edit(VisualShader *p_visual_shader);
diff --git a/editor/plugins/voxel_gi_editor_plugin.cpp b/editor/plugins/voxel_gi_editor_plugin.cpp
index a3ccf392e6..f9f72fee77 100644
--- a/editor/plugins/voxel_gi_editor_plugin.cpp
+++ b/editor/plugins/voxel_gi_editor_plugin.cpp
@@ -35,7 +35,9 @@
void VoxelGIEditorPlugin::_bake() {
if (voxel_gi) {
- if (voxel_gi->get_probe_data().is_null()) {
+ Ref<VoxelGIData> voxel_gi_data = voxel_gi->get_probe_data();
+
+ if (voxel_gi_data.is_null()) {
String path = get_tree()->get_edited_scene_root()->get_scene_file_path();
if (path.is_empty()) {
path = "res://" + voxel_gi->get_name() + "_data.res";
@@ -46,7 +48,32 @@ void VoxelGIEditorPlugin::_bake() {
probe_file->set_current_path(path);
probe_file->popup_file_dialog();
return;
+ } else {
+ String path = voxel_gi_data->get_path();
+ if (!path.is_resource_file()) {
+ int srpos = path.find("::");
+ if (srpos != -1) {
+ String base = path.substr(0, srpos);
+ if (ResourceLoader::get_resource_type(base) == "PackedScene") {
+ if (!get_tree()->get_edited_scene_root() || get_tree()->get_edited_scene_root()->get_scene_file_path() != base) {
+ EditorNode::get_singleton()->show_warning(TTR("Voxel GI data is not local to the scene."));
+ return;
+ }
+ } else {
+ if (FileAccess::exists(base + ".import")) {
+ EditorNode::get_singleton()->show_warning(TTR("Voxel GI data is part of an imported resource."));
+ return;
+ }
+ }
+ }
+ } else {
+ if (FileAccess::exists(path + ".import")) {
+ EditorNode::get_singleton()->show_warning(TTR("Voxel GI data is an imported resource."));
+ return;
+ }
+ }
}
+
voxel_gi->bake();
}
}
diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp
index db11f80826..9695a7042d 100644
--- a/editor/progress_dialog.cpp
+++ b/editor/progress_dialog.cpp
@@ -195,7 +195,7 @@ void ProgressDialog::add_task(const String &p_task, const String &p_label, int p
cancel_hb->hide();
}
cancel_hb->move_to_front();
- cancelled = false;
+ canceled = false;
_popup();
if (p_can_cancel) {
cancel->grab_focus();
@@ -203,12 +203,12 @@ void ProgressDialog::add_task(const String &p_task, const String &p_label, int p
}
bool ProgressDialog::task_step(const String &p_task, const String &p_state, int p_step, bool p_force_redraw) {
- ERR_FAIL_COND_V(!tasks.has(p_task), cancelled);
+ ERR_FAIL_COND_V(!tasks.has(p_task), canceled);
if (!p_force_redraw) {
uint64_t tus = OS::get_singleton()->get_ticks_usec();
if (tus - last_progress_tick < 200000) { //200ms
- return cancelled;
+ return canceled;
}
}
@@ -228,7 +228,7 @@ bool ProgressDialog::task_step(const String &p_task, const String &p_state, int
#ifndef ANDROID_ENABLED
Main::iteration(); // this will not work on a lot of platforms, so it's only meant for the editor
#endif
- return cancelled;
+ return canceled;
}
void ProgressDialog::end_task(const String &p_task) {
@@ -246,7 +246,7 @@ void ProgressDialog::end_task(const String &p_task) {
}
void ProgressDialog::_cancel_pressed() {
- cancelled = true;
+ canceled = true;
}
void ProgressDialog::_bind_methods() {
@@ -257,6 +257,7 @@ ProgressDialog::ProgressDialog() {
add_child(main);
main->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT);
set_exclusive(true);
+ set_flag(Window::FLAG_POPUP, false);
last_progress_tick = 0;
singleton = this;
cancel_hb = memnew(HBoxContainer);
diff --git a/editor/progress_dialog.h b/editor/progress_dialog.h
index 5346f01a9e..7ac4864c9c 100644
--- a/editor/progress_dialog.h
+++ b/editor/progress_dialog.h
@@ -85,7 +85,7 @@ class ProgressDialog : public PopupPanel {
void _popup();
void _cancel_pressed();
- bool cancelled = false;
+ bool canceled = false;
protected:
void _notification(int p_what);
diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp
index 8ff0e7a454..058d77380f 100644
--- a/editor/project_converter_3_to_4.cpp
+++ b/editor/project_converter_3_to_4.cpp
@@ -32,10 +32,11 @@
#include "modules/modules_enabled.gen.h"
-const int ERROR_CODE = 77;
-
+#ifndef DISABLE_DEPRECATED
#ifdef MODULE_REGEX_ENABLED
+const int ERROR_CODE = 77;
+
#include "modules/regex/regex.h"
#include "core/io/dir_access.h"
@@ -44,7 +45,7 @@ const int ERROR_CODE = 77;
#include "core/templates/list.h"
#include "core/templates/local_vector.h"
-static const char *enum_renames[][2] = {
+const char *ProjectConverter3To4::enum_renames[][2] = {
//// constants
{ "TYPE_COLOR_ARRAY", "TYPE_PACKED_COLOR_ARRAY" },
{ "TYPE_FLOAT64_ARRAY", "TYPE_PACKED_FLOAT64_ARRAY" },
@@ -164,7 +165,7 @@ static const char *enum_renames[][2] = {
{ nullptr, nullptr },
};
-static const char *gdscript_function_renames[][2] = {
+const char *ProjectConverter3To4::gdscript_function_renames[][2] = {
// { "_set_name", "get_tracker_name"}, // XRPositionalTracker - CameraFeed use this
// { "_unhandled_input", "_unhandled_key_input"}, // BaseButton, ViewportContainer broke Node, FileDialog,SubViewportContainer
// { "create_gizmo", "_create_gizmo"}, // EditorNode3DGizmoPlugin - may be used
@@ -210,11 +211,11 @@ static const char *gdscript_function_renames[][2] = {
// { "set_v_offset", "set_drag_vertical_offset" }, // Camera2D broke Camera3D, PathFollow3D, PathFollow2D
// {"get_points","get_points_id"},// Astar, broke Line2D, Convexpolygonshape
// {"get_v_scroll","get_v_scroll_bar"},//ItemList, broke TextView
+ // { "get_stylebox", "get_theme_stylebox" }, // Control - Will rename the method in Theme as well, skipping
{ "_about_to_show", "_about_to_popup" }, // ColorPickerButton
{ "_get_configuration_warning", "_get_configuration_warnings" }, // Node
{ "_set_current", "set_current" }, // Camera2D
{ "_set_editor_description", "set_editor_description" }, // Node
- { "_set_playing", "set_playing" }, // AnimatedSprite3D
{ "_toplevel_raise_self", "_top_level_raise_self" }, // CanvasItem
{ "_update_wrap_at", "_update_wrap_at_column" }, // TextEdit
{ "add_animation", "add_animation_library" }, // AnimationPlayer
@@ -311,8 +312,8 @@ static const char *gdscript_function_renames[][2] = {
{ "get_font_types", "get_font_type_list" }, // Theme
{ "get_frame_color", "get_color" }, // ColorRect
{ "get_global_rate_scale", "get_playback_speed_scale" }, // AudioServer
- { "get_gravity_distance_scale", "get_gravity_point_distance_scale" }, //Area2D
- { "get_gravity_vector", "get_gravity_direction" }, //Area2D
+ { "get_gravity_distance_scale", "get_gravity_point_unit_distance" }, // Area(2D/3D)
+ { "get_gravity_vector", "get_gravity_direction" }, // Area(2D/3D)
{ "get_h_scrollbar", "get_h_scroll_bar" }, //ScrollContainer
{ "get_hand", "get_tracker_hand" }, // XRPositionalTracker
{ "get_handle_name", "_get_handle_name" }, // EditorNode3DGizmo
@@ -509,8 +510,8 @@ static const char *gdscript_function_renames[][2] = {
{ "set_follow_smoothing", "set_position_smoothing_speed" }, // Camera2D
{ "set_frame_color", "set_color" }, // ColorRect
{ "set_global_rate_scale", "set_playback_speed_scale" }, // AudioServer
- { "set_gravity_distance_scale", "set_gravity_point_distance_scale" }, // Area2D
- { "set_gravity_vector", "set_gravity_direction" }, // Area2D
+ { "set_gravity_distance_scale", "set_gravity_point_unit_distance" }, // Area(2D/3D)
+ { "set_gravity_vector", "set_gravity_direction" }, // Area(2D/3D)
{ "set_h_drag_enabled", "set_drag_horizontal_enabled" }, // Camera2D
{ "set_icon_align", "set_icon_alignment" }, // Button
{ "set_interior_ambient", "set_ambient_color" }, // ReflectionProbe
@@ -619,7 +620,7 @@ static const char *gdscript_function_renames[][2] = {
};
// gdscript_function_renames clone with CamelCase
-static const char *csharp_function_renames[][2] = {
+const char *ProjectConverter3To4::csharp_function_renames[][2] = {
// { "_SetName", "GetTrackerName"}, // XRPositionalTracker - CameraFeed use this
// { "_UnhandledInput", "_UnhandledKeyInput"}, // BaseButton, ViewportContainer broke Node, FileDialog,SubViewportContainer
// { "CreateGizmo", "_CreateGizmo"}, // EditorNode3DGizmoPlugin - may be used
@@ -665,6 +666,7 @@ static const char *csharp_function_renames[][2] = {
// { "SetVOffset", "SetDragVerticalOffset" }, // Camera2D broke Camera3D, PathFollow3D, PathFollow2D
// {"GetPoints","GetPointsId"},// Astar, broke Line2D, Convexpolygonshape
// {"GetVScroll","GetVScrollBar"},//ItemList, broke TextView
+ // { "GetStylebox", "GetThemeStylebox" }, // Control - Will rename the method in Theme as well, skipping
{ "AddSpatialGizmoPlugin", "AddNode3dGizmoPlugin" }, // EditorPlugin
{ "RenderingServer", "GetTabAlignment" }, // Tab
{ "_AboutToShow", "_AboutToPopup" }, // ColorPickerButton
@@ -1055,7 +1057,7 @@ static const char *csharp_function_renames[][2] = {
};
// Some needs to be disabled, because users can use this names as variables
-static const char *gdscript_properties_renames[][2] = {
+const char *ProjectConverter3To4::gdscript_properties_renames[][2] = {
// // { "d", "distance" }, //WorldMarginShape2D - TODO, looks that polish letters ą ę are treaten as space, not as letter, so `będą` are renamed to `będistanceą`
// // {"alt","alt_pressed"}, // This may broke a lot of comments and user variables
// // {"command","command_pressed"},// This may broke a lot of comments and user variables
@@ -1078,6 +1080,7 @@ static const char *gdscript_properties_renames[][2] = {
// { "zfar", "far" }, // Camera3D
// { "znear", "near" }, // Camera3D
// { "filename", "scene_file_path" }, // Node
+ // { "pressed", "button_pressed" }, // BaseButton - Will also rename the signal, skipping for now
{ "as_normalmap", "as_normal_map" }, // NoiseTexture
{ "bbcode_text", "text" }, // RichTextLabel
{ "bg", "panel" }, // Theme
@@ -1109,10 +1112,11 @@ static const char *gdscript_properties_renames[][2] = {
{ "files_disabled", "file_disabled_color" }, // Theme
{ "folder_icon_modulate", "folder_icon_color" }, // Theme
{ "global_rate_scale", "playback_speed_scale" }, // AudioServer
- { "gravity_distance_scale", "gravity_point_distance_scale" }, // Area2D
- { "gravity_vec", "gravity_direction" }, // Area2D
+ { "gravity_distance_scale", "gravity_point_unit_distance" }, // Area(2D/3D)
+ { "gravity_vec", "gravity_direction" }, // Area(2D/3D)
{ "hint_tooltip", "tooltip_text" }, // Control
{ "hseparation", "h_separation" }, // Theme
+ { "icon_align", "icon_alignment" }, // Button
{ "iterations_per_second", "physics_ticks_per_second" }, // Engine
{ "invert_enable", "invert_enabled" }, // Polygon2D
{ "margin_bottom", "offset_bottom" }, // Control broke NinePatchRect, StyleBox
@@ -1137,7 +1141,7 @@ static const char *gdscript_properties_renames[][2] = {
{ "rect_position", "position" }, // Control
{ "rect_global_position", "global_position" }, // Control
{ "rect_size", "size" }, // Control
- { "rect_min_size", "minimum_size" }, // Control
+ { "rect_min_size", "custom_minimum_size" }, // Control
{ "rect_rotation", "rotation" }, // Control
{ "rect_scale", "scale" }, // Control
{ "rect_pivot_offset", "pivot_offset" }, // Control
@@ -1164,12 +1168,13 @@ static const char *gdscript_properties_renames[][2] = {
{ "unit_db", "volume_db" }, // AudioStreamPlayer3D
{ "unit_offset", "progress_ratio" }, // PathFollow2D, PathFollow3D
{ "vseparation", "v_separation" }, // Theme
+ { "frames", "sprite_frames" }, // AnimatedSprite2D, AnimatedSprite3D
{ nullptr, nullptr },
};
// Some needs to be disabled, because users can use this names as variables
-static const char *csharp_properties_renames[][2] = {
+const char *ProjectConverter3To4::csharp_properties_renames[][2] = {
// // { "D", "Distance" }, //WorldMarginShape2D - TODO, looks that polish letters ą ę are treaten as space, not as letter, so `będą` are renamed to `będistanceą`
// // {"Alt","AltPressed"}, // This may broke a lot of comments and user variables
// // {"Command","CommandPressed"},// This may broke a lot of comments and user variables
@@ -1192,6 +1197,7 @@ static const char *csharp_properties_renames[][2] = {
// { "WrapEnabled", "WrapMode" }, // TextEdit
// { "Zfar", "Far" }, // Camera3D
// { "Znear", "Near" }, // Camera3D
+ // { "Pressed", "ButtonPressed" }, // BaseButton - Will also rename the signal, skipping for now
{ "AsNormalmap", "AsNormalMap" }, // NoiseTexture
{ "BbcodeText", "Text" }, // RichTextLabel
{ "CaretBlinkSpeed", "CaretBlinkInterval" }, // TextEdit, LineEdit
@@ -1221,6 +1227,7 @@ static const char *csharp_properties_renames[][2] = {
{ "GravityVec", "GravityDirection" }, // Area2D
{ "HintTooltip", "TooltipText" }, // Control
{ "Hseparation", "HSeparation" }, // Theme
+ { "IconAlign", "IconAlignment" }, // Button
{ "IterationsPerSecond", "PhysicsTicksPerSecond" }, // Engine
{ "InvertEnable", "InvertEnabled" }, // Polygon2D
{ "MarginBottom", "OffsetBottom" }, // Control broke NinePatchRect, StyleBox
@@ -1272,13 +1279,15 @@ static const char *csharp_properties_renames[][2] = {
{ nullptr, nullptr },
};
-static const char *gdscript_signals_renames[][2] = {
+const char *ProjectConverter3To4::gdscript_signals_renames[][2] = {
// {"instantiate","instance"}, // FileSystemDock
// { "hide", "hidden" }, // CanvasItem - function with same name exists
// { "tween_all_completed","loop_finished"}, // Tween - TODO, not sure
// {"changed","settings_changed"}, // EditorSettings
{ "about_to_show", "about_to_popup" }, // Popup
{ "button_release", "button_released" }, // XRController3D
+ { "cancelled", "canceled" }, // AcceptDialog
+ { "item_double_clicked", "item_icon_double_clicked" }, // Tree
{ "network_peer_connected", "peer_connected" }, // MultiplayerAPI
{ "network_peer_disconnected", "peer_disconnected" }, // MultiplayerAPI
{ "network_peer_packet", "peer_packet" }, // MultiplayerAPI
@@ -1295,7 +1304,7 @@ static const char *gdscript_signals_renames[][2] = {
{ nullptr, nullptr },
};
-static const char *csharp_signals_renames[][2] = {
+const char *ProjectConverter3To4::csharp_signals_renames[][2] = {
// {"Instantiate","Instance"}, // FileSystemDock
// { "Hide", "Hidden" }, // CanvasItem - function with same name exists
// { "TweenAllCompleted","LoopFinished"}, // Tween - TODO, not sure
@@ -1319,7 +1328,7 @@ static const char *csharp_signals_renames[][2] = {
};
-static const char *project_settings_renames[][2] = {
+const char *ProjectConverter3To4::project_settings_renames[][2] = {
{ "audio/channel_disable_threshold_db", "audio/buses/channel_disable_threshold_db" },
{ "audio/channel_disable_time", "audio/buses/channel_disable_time" },
{ "audio/default_bus_layout", "audio/buses/default_bus_layout" },
@@ -1354,16 +1363,29 @@ static const char *project_settings_renames[][2] = {
{ "rendering/quality/shadow_atlas/quadrant_3_subdiv", "rendering/lights_and_shadows/shadow_atlas/quadrant_3_subdiv" },
{ "rendering/quality/shadow_atlas/size", "rendering/lights_and_shadows/shadow_atlas/size" },
{ "rendering/quality/shadow_atlas/size.mobile", "rendering/lights_and_shadows/shadow_atlas/size.mobile" },
- { "rendering/vram_compression/import_bptc", "rendering/textures/vram_compression/import_bptc" },
- { "rendering/vram_compression/import_etc", "rendering/textures/vram_compression/import_etc" },
- { "rendering/vram_compression/import_etc2", "rendering/textures/vram_compression/import_etc2" },
- { "rendering/vram_compression/import_pvrtc", "rendering/textures/vram_compression/import_pvrtc" },
- { "rendering/vram_compression/import_s3tc", "rendering/textures/vram_compression/import_s3tc" },
+ { "rendering/vram_compression/import_etc2", "rendering/textures/vram_compression/import_etc2_astc" },
+ { "rendering/vram_compression/import_s3tc", "rendering/textures/vram_compression/import_s3tc_bptc" },
+ { "window/size/width", "window/size/viewport_width" },
+ { "window/size/height", "window/size/viewport_height" },
+ { "window/size/test_width", "window/size/window_width_override" },
+ { "window/size/test_height", "window/size/window_height_override" },
{ nullptr, nullptr },
};
-static const char *builtin_types_renames[][2] = {
+const char *ProjectConverter3To4::input_map_renames[][2] = {
+ { ",\"alt\":", ",\"alt_pressed\":" },
+ { ",\"shift\":", ",\"shift_pressed\":" },
+ { ",\"control\":", ",\"ctrl_pressed\":" },
+ { ",\"meta\":", ",\"meta_pressed\":" },
+ { ",\"scancode\":", ",\"keycode\":" },
+ { ",\"physical_scancode\":", ",\"physical_keycode\":" },
+ { ",\"doubleclick\":", ",\"double_click\":" },
+
+ { nullptr, nullptr },
+};
+
+const char *ProjectConverter3To4::builtin_types_renames[][2] = {
{ "PoolByteArray", "PackedByteArray" },
{ "PoolColorArray", "PackedColorArray" },
{ "PoolIntArray", "PackedInt32Array" },
@@ -1377,7 +1399,7 @@ static const char *builtin_types_renames[][2] = {
{ nullptr, nullptr },
};
-static const char *shaders_renames[][2] = {
+const char *ProjectConverter3To4::shaders_renames[][2] = {
{ "ALPHA_SCISSOR", "ALPHA_SCISSOR_THRESHOLD" },
{ "CAMERA_MATRIX", "INV_VIEW_MATRIX" },
{ "INV_CAMERA_MATRIX", "VIEW_MATRIX" },
@@ -1395,7 +1417,7 @@ static const char *shaders_renames[][2] = {
{ nullptr, nullptr },
};
-static const char *class_renames[][2] = {
+const char *ProjectConverter3To4::class_renames[][2] = {
// { "BulletPhysicsDirectBodyState", "BulletPhysicsDirectBodyState3D" }, // Class is not visible in ClassDB
// { "BulletPhysicsServer", "BulletPhysicsServer3D" }, // Class is not visible in ClassDB
// { "GDScriptFunctionState", "Node3D" }, // TODO - not sure to which should be changed
@@ -1620,7 +1642,7 @@ static const char *class_renames[][2] = {
{ nullptr, nullptr },
};
-static const char *color_renames[][2] = {
+const char *ProjectConverter3To4::ProjectConverter3To4::color_renames[][2] = {
{ "aliceblue", "ALICE_BLUE" },
{ "antiquewhite", "ANTIQUE_WHITE" },
{ "aqua", "AQUA" },
@@ -1771,6 +1793,19 @@ static const char *color_renames[][2] = {
{ nullptr, nullptr },
};
+// Find "OS.set_property(x)", capturing x into $1.
+static String make_regex_gds_os_property_set(String name_set) {
+ return String("\\bOS\\.") + name_set + "\\s*\\((.*)\\)";
+}
+// Find "OS.property = x", capturing x into $1 or $2.
+static String make_regex_gds_os_property_assign(String name) {
+ return String("\\bOS\\.") + name + "\\s*=\\s*([^#]+)";
+}
+// Find "OS.property" OR "OS.get_property()" / "OS.is_property()".
+static String make_regex_gds_os_property_get(String name, String get) {
+ return String("\\bOS\\.(") + get + "_)?" + name + "(\\s*\\(\\s*\\))?";
+}
+
class ProjectConverter3To4::RegExContainer {
public:
// Custom GDScript.
@@ -1788,8 +1823,37 @@ public:
RegEx reg_join = RegEx("([\\(\\)a-zA-Z0-9_]+)\\.join\\(([^\n^\\)]+)\\)");
RegEx reg_image_lock = RegEx("([a-zA-Z0-9_\\.]+)\\.lock\\(\\)");
RegEx reg_image_unlock = RegEx("([a-zA-Z0-9_\\.]+)\\.unlock\\(\\)");
- RegEx reg_os_fullscreen = RegEx("OS.window_fullscreen[= ]+([^#^\n]+)");
RegEx reg_instantiate = RegEx("\\.instance\\(([^\\)]*)\\)");
+ // Simple OS properties with getters/setters.
+ RegEx reg_os_current_screen = RegEx("\\bOS\\.(set_|get_)?current_screen\\b");
+ RegEx reg_os_min_window_size = RegEx("\\bOS\\.(set_|get_)?min_window_size\\b");
+ RegEx reg_os_max_window_size = RegEx("\\bOS\\.(set_|get_)?max_window_size\\b");
+ RegEx reg_os_window_position = RegEx("\\bOS\\.(set_|get_)?window_position\\b");
+ RegEx reg_os_window_size = RegEx("\\bOS\\.(set_|get_)?window_size\\b");
+ RegEx reg_os_getset_screen_orient = RegEx("\\bOS\\.(s|g)et_screen_orientation\\b");
+ // OS property getters/setters for non trivial replacements.
+ RegEx reg_os_set_window_resizable = RegEx(make_regex_gds_os_property_set("set_window_resizable"));
+ RegEx reg_os_assign_window_resizable = RegEx(make_regex_gds_os_property_assign("window_resizable"));
+ RegEx reg_os_is_window_resizable = RegEx(make_regex_gds_os_property_get("window_resizable", "is"));
+ RegEx reg_os_set_fullscreen = RegEx(make_regex_gds_os_property_set("set_window_fullscreen"));
+ RegEx reg_os_assign_fullscreen = RegEx(make_regex_gds_os_property_assign("window_fullscreen"));
+ RegEx reg_os_is_fullscreen = RegEx(make_regex_gds_os_property_get("window_fullscreen", "is"));
+ RegEx reg_os_set_maximized = RegEx(make_regex_gds_os_property_set("set_window_maximized"));
+ RegEx reg_os_assign_maximized = RegEx(make_regex_gds_os_property_assign("window_maximized"));
+ RegEx reg_os_is_maximized = RegEx(make_regex_gds_os_property_get("window_maximized", "is"));
+ RegEx reg_os_set_minimized = RegEx(make_regex_gds_os_property_set("set_window_minimized"));
+ RegEx reg_os_assign_minimized = RegEx(make_regex_gds_os_property_assign("window_minimized"));
+ RegEx reg_os_is_minimized = RegEx(make_regex_gds_os_property_get("window_minimized", "is"));
+ RegEx reg_os_set_vsync = RegEx(make_regex_gds_os_property_set("set_use_vsync"));
+ RegEx reg_os_assign_vsync = RegEx(make_regex_gds_os_property_assign("vsync_enabled"));
+ RegEx reg_os_is_vsync = RegEx(make_regex_gds_os_property_get("vsync_enabled", "is"));
+ // OS properties specific cases & specific replacements.
+ RegEx reg_os_assign_screen_orient = RegEx("^(\\s*)OS\\.screen_orientation\\s*=\\s*([^#]+)"); // $1 - indent, $2 - value
+ RegEx reg_os_set_always_on_top = RegEx(make_regex_gds_os_property_set("set_window_always_on_top"));
+ RegEx reg_os_is_always_on_top = RegEx("\\bOS\\.is_window_always_on_top\\s*\\(.*\\)");
+ RegEx reg_os_set_borderless = RegEx(make_regex_gds_os_property_set("set_borderless_window"));
+ RegEx reg_os_get_borderless = RegEx("\\bOS\\.get_borderless_window\\s*\\(\\s*\\)");
+ RegEx reg_os_screen_orient_enum = RegEx("\\bOS\\.SCREEN_ORIENTATION_(\\w+)\\b"); // $1 - constant suffix
// GDScript keywords.
RegEx keyword_gdscript_tool = RegEx("^tool");
@@ -1836,6 +1900,7 @@ public:
LocalVector<RegEx *> enum_regexes;
LocalVector<RegEx *> gdscript_function_regexes;
LocalVector<RegEx *> project_settings_regexes;
+ LocalVector<RegEx *> input_map_regexes;
LocalVector<RegEx *> gdscript_properties_regexes;
LocalVector<RegEx *> gdscript_signals_regexes;
LocalVector<RegEx *> shaders_regexes;
@@ -1859,6 +1924,10 @@ public:
for (unsigned int current_index = 0; project_settings_renames[current_index][0]; current_index++) {
project_settings_regexes.push_back(memnew(RegEx(String("\\b") + project_settings_renames[current_index][0] + "\\b")));
}
+ // Input Map.
+ for (unsigned int current_index = 0; input_map_renames[current_index][0]; current_index++) {
+ input_map_regexes.push_back(memnew(RegEx(String("\\b") + input_map_renames[current_index][0] + "\\b")));
+ }
// GDScript properties.
for (unsigned int current_index = 0; gdscript_properties_renames[current_index][0]; current_index++) {
gdscript_properties_regexes.push_back(memnew(RegEx(String("\\b") + gdscript_properties_renames[current_index][0] + "\\b")));
@@ -1912,8 +1981,8 @@ public:
}
}
~RegExContainer() {
- for (unsigned int i = 0; i < color_regexes.size(); i++) {
- memdelete(color_regexes[i]);
+ for (RegEx *regex : color_regexes) {
+ memdelete(regex);
}
for (unsigned int i = 0; i < class_tscn_regexes.size(); i++) {
memdelete(class_tscn_regexes[i]);
@@ -1921,35 +1990,38 @@ public:
memdelete(class_shader_regexes[i]);
memdelete(class_regexes[i]);
}
- for (unsigned int i = 0; i < enum_regexes.size(); i++) {
- memdelete(enum_regexes[i]);
+ for (RegEx *regex : enum_regexes) {
+ memdelete(regex);
+ }
+ for (RegEx *regex : gdscript_function_regexes) {
+ memdelete(regex);
}
- for (unsigned int i = 0; i < gdscript_function_regexes.size(); i++) {
- memdelete(gdscript_function_regexes[i]);
+ for (RegEx *regex : project_settings_regexes) {
+ memdelete(regex);
}
- for (unsigned int i = 0; i < project_settings_regexes.size(); i++) {
- memdelete(project_settings_regexes[i]);
+ for (RegEx *regex : input_map_regexes) {
+ memdelete(regex);
}
- for (unsigned int i = 0; i < gdscript_properties_regexes.size(); i++) {
- memdelete(gdscript_properties_regexes[i]);
+ for (RegEx *regex : gdscript_properties_regexes) {
+ memdelete(regex);
}
- for (unsigned int i = 0; i < gdscript_signals_regexes.size(); i++) {
- memdelete(gdscript_signals_regexes[i]);
+ for (RegEx *regex : gdscript_signals_regexes) {
+ memdelete(regex);
}
- for (unsigned int i = 0; i < shaders_regexes.size(); i++) {
- memdelete(shaders_regexes[i]);
+ for (RegEx *regex : shaders_regexes) {
+ memdelete(regex);
}
- for (unsigned int i = 0; i < builtin_types_regexes.size(); i++) {
- memdelete(builtin_types_regexes[i]);
+ for (RegEx *regex : builtin_types_regexes) {
+ memdelete(regex);
}
- for (unsigned int i = 0; i < csharp_function_regexes.size(); i++) {
- memdelete(csharp_function_regexes[i]);
+ for (RegEx *regex : csharp_function_regexes) {
+ memdelete(regex);
}
- for (unsigned int i = 0; i < csharp_properties_regexes.size(); i++) {
- memdelete(csharp_properties_regexes[i]);
+ for (RegEx *regex : csharp_properties_regexes) {
+ memdelete(regex);
}
- for (unsigned int i = 0; i < csharp_signal_regexes.size(); i++) {
- memdelete(csharp_signal_regexes[i]);
+ for (RegEx *regex : csharp_signal_regexes) {
+ memdelete(regex);
}
}
};
@@ -2081,6 +2153,7 @@ int ProjectConverter3To4::convert() {
} else if (file_name.ends_with("project.godot")) {
rename_common(project_settings_renames, reg_container.project_settings_regexes, lines);
rename_common(builtin_types_renames, reg_container.builtin_types_regexes, lines);
+ rename_common(input_map_renames, reg_container.input_map_regexes, lines);
} else if (file_name.ends_with(".csproj")) {
// TODO
} else {
@@ -2246,6 +2319,7 @@ int ProjectConverter3To4::validate_conversion() {
} else if (file_name.ends_with("project.godot")) {
changed_elements.append_array(check_for_rename_common(project_settings_renames, reg_container.project_settings_regexes, lines));
changed_elements.append_array(check_for_rename_common(builtin_types_renames, reg_container.builtin_types_regexes, lines));
+ changed_elements.append_array(check_for_rename_common(input_map_renames, reg_container.input_map_regexes, lines));
} else if (file_name.ends_with(".csproj")) {
// TODO
} else {
@@ -2382,6 +2456,8 @@ bool ProjectConverter3To4::test_conversion(RegExContainer &reg_container) {
valid = valid && test_conversion_basic("audio/channel_disable_threshold_db", "audio/buses/channel_disable_threshold_db", project_settings_renames, reg_container.project_settings_regexes, "project setting");
+ valid = valid && test_conversion_basic("\"device\":-1,\"alt\":false,\"shift\":false,\"control\":false,\"meta\":false,\"doubleclick\":false,\"scancode\":0,\"physical_scancode\":16777254,\"script\":null", "\"device\":-1,\"alt_pressed\":false,\"shift_pressed\":false,\"ctrl_pressed\":false,\"meta_pressed\":false,\"double_click\":false,\"keycode\":0,\"physical_keycode\":16777254,\"script\":null", input_map_renames, reg_container.input_map_regexes, "input map");
+
valid = valid && test_conversion_basic("Transform", "Transform3D", builtin_types_renames, reg_container.builtin_types_regexes, "builtin type");
// Custom Renames.
@@ -2399,8 +2475,41 @@ bool ProjectConverter3To4::test_conversion(RegExContainer &reg_container) {
valid = valid && test_conversion_with_regex("[Master]", "The master and mastersync rpc behavior is not officially supported anymore. Try using another keyword or making custom logic using Multiplayer.GetRemoteSenderId()\n[RPC]", &ProjectConverter3To4::rename_csharp_attributes, "custom rename csharp", reg_container);
valid = valid && test_conversion_with_regex("[MasterSync]", "The master and mastersync rpc behavior is not officially supported anymore. Try using another keyword or making custom logic using Multiplayer.GetRemoteSenderId()\n[RPC(CallLocal = true)]", &ProjectConverter3To4::rename_csharp_attributes, "custom rename csharp", reg_container);
- valid = valid && test_conversion_gdscript_builtin("OS.window_fullscreen = Settings.fullscreen", "if Settings.fullscreen:\n\tDisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)\nelse:\n\tDisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
- valid = valid && test_conversion_gdscript_builtin("OS.get_window_safe_area()", "DisplayServer.get_display_safe_area()", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tif OS.window_resizable: pass", "\tif (not get_window().unresizable): pass", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tif OS.is_window_resizable(): pass", "\tif (not get_window().unresizable): pass", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tOS.set_window_resizable(Settings.resizable)", "\tget_window().unresizable = not (Settings.resizable)", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tOS.window_resizable = Settings.resizable", "\tget_window().unresizable = not (Settings.resizable)", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+
+ valid = valid && test_conversion_gdscript_builtin("\tif OS.window_fullscreen: pass", "\tif ((get_window().mode == Window.MODE_EXCLUSIVE_FULLSCREEN) or (get_window().mode == Window.MODE_FULLSCREEN)): pass", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tif OS.is_window_fullscreen(): pass", "\tif ((get_window().mode == Window.MODE_EXCLUSIVE_FULLSCREEN) or (get_window().mode == Window.MODE_FULLSCREEN)): pass", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tOS.set_window_fullscreen(Settings.fullscreen)", "\tget_window().mode = Window.MODE_EXCLUSIVE_FULLSCREEN if (Settings.fullscreen) else Window.MODE_WINDOWED", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tOS.window_fullscreen = Settings.fullscreen", "\tget_window().mode = Window.MODE_EXCLUSIVE_FULLSCREEN if (Settings.fullscreen) else Window.MODE_WINDOWED", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+
+ valid = valid && test_conversion_gdscript_builtin("\tif OS.window_maximized: pass", "\tif (get_window().mode == Window.MODE_MAXIMIZED): pass", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tif OS.is_window_maximized(): pass", "\tif (get_window().mode == Window.MODE_MAXIMIZED): pass", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tOS.set_window_maximized(Settings.maximized)", "\tget_window().mode = Window.MODE_MAXIMIZED if (Settings.maximized) else Window.MODE_WINDOWED", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tOS.window_maximized = Settings.maximized", "\tget_window().mode = Window.MODE_MAXIMIZED if (Settings.maximized) else Window.MODE_WINDOWED", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+
+ valid = valid && test_conversion_gdscript_builtin("\tif OS.window_minimized: pass", "\tif (get_window().mode == Window.MODE_MINIMIZED): pass", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tif OS.is_window_minimized(): pass", "\tif (get_window().mode == Window.MODE_MINIMIZED): pass", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tOS.set_window_minimized(Settings.minimized)", "\tget_window().mode = Window.MODE_MINIMIZED if (Settings.minimized) else Window.MODE_WINDOWED", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tOS.window_minimized = Settings.minimized", "\tget_window().mode = Window.MODE_MINIMIZED if (Settings.minimized) else Window.MODE_WINDOWED", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+
+ valid = valid && test_conversion_gdscript_builtin("\tif OS.vsync_enabled: pass", "\tif (DisplayServer.window_get_vsync_mode() != DisplayServer.VSYNC_DISABLED): pass", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tif OS.is_vsync_enabled(): pass", "\tif (DisplayServer.window_get_vsync_mode() != DisplayServer.VSYNC_DISABLED): pass", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tOS.set_use_vsync(Settings.vsync)", "\tDisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ENABLED if (Settings.vsync) else DisplayServer.VSYNC_DISABLED)", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tOS.vsync_enabled = Settings.vsync", "\tDisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ENABLED if (Settings.vsync) else DisplayServer.VSYNC_DISABLED)", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+
+ valid = valid && test_conversion_gdscript_builtin("\tif OS.screen_orientation = OS.SCREEN_ORIENTATION_VERTICAL: pass", "\tif DisplayServer.screen_get_orientation() = DisplayServer.SCREEN_VERTICAL: pass", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tif OS.get_screen_orientation() = OS.SCREEN_ORIENTATION_LANDSCAPE: pass", "\tif DisplayServer.screen_get_orientation() = DisplayServer.SCREEN_LANDSCAPE: pass", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tOS.set_screen_orientation(Settings.orient)", "\tDisplayServer.screen_set_orientation(Settings.orient)", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tOS.screen_orientation = Settings.orient", "\tDisplayServer.screen_set_orientation(Settings.orient)", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+
+ valid = valid && test_conversion_gdscript_builtin("\tif OS.is_window_always_on_top(): pass", "\tif get_window().always_on_top: pass", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tOS.set_window_always_on_top(Settings.alwaystop)", "\tget_window().always_on_top = (Settings.alwaystop)", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+
+ valid = valid && test_conversion_gdscript_builtin("\tif OS.get_borderless_window(): pass", "\tif get_window().borderless: pass", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
+ valid = valid && test_conversion_gdscript_builtin("\tOS.set_borderless_window(Settings.borderless)", "\tget_window().borderless = (Settings.borderless)", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
valid = valid && test_conversion_gdscript_builtin("\tvar aa = roman(r.move_and_slide( a, b, c, d, e, f )) # Roman", "\tr.set_velocity(a)\n\tr.set_up_direction(b)\n\tr.set_floor_stop_on_slope_enabled(c)\n\tr.set_max_slides(d)\n\tr.set_floor_max_angle(e)\n\t# TODOConverter40 infinite_inertia were removed in Godot 4.0 - previous value `f`\n\tr.move_and_slide()\n\tvar aa = roman(r.velocity) # Roman", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
valid = valid && test_conversion_gdscript_builtin("\tmove_and_slide( a, b, c, d, e, f ) # Roman", "\tset_velocity(a)\n\tset_up_direction(b)\n\tset_floor_stop_on_slope_enabled(c)\n\tset_max_slides(d)\n\tset_floor_max_angle(e)\n\t# TODOConverter40 infinite_inertia were removed in Godot 4.0 - previous value `f`\n\tmove_and_slide() # Roman", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
@@ -2442,14 +2551,14 @@ bool ProjectConverter3To4::test_conversion(RegExContainer &reg_container) {
valid = valid && test_conversion_with_regex("tool", "@tool", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
valid = valid && test_conversion_with_regex("\n tool", "\n tool", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
valid = valid && test_conversion_with_regex("\n\ntool", "\n\n@tool", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
- valid = valid && test_conversion_with_regex("\n\nremote func", "\n\n@rpc(any_peer) func", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
- valid = valid && test_conversion_with_regex("\n\nremotesync func", "\n\n@rpc(any_peer, call_local) func", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
- valid = valid && test_conversion_with_regex("\n\nsync func", "\n\n@rpc(any_peer, call_local) func", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
+ valid = valid && test_conversion_with_regex("\n\nremote func", "\n\n@rpc(\"any_peer\") func", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
+ valid = valid && test_conversion_with_regex("\n\nremotesync func", "\n\n@rpc(\"any_peer\", \"call_local\") func", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
+ valid = valid && test_conversion_with_regex("\n\nsync func", "\n\n@rpc(\"any_peer\", \"call_local\") func", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
valid = valid && test_conversion_with_regex("\n\nslave func", "\n\n@rpc func", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
valid = valid && test_conversion_with_regex("\n\npuppet func", "\n\n@rpc func", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
- valid = valid && test_conversion_with_regex("\n\npuppetsync func", "\n\n@rpc(call_local) func", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
+ valid = valid && test_conversion_with_regex("\n\npuppetsync func", "\n\n@rpc(\"call_local\") func", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
valid = valid && test_conversion_with_regex("\n\nmaster func", "\n\nThe master and mastersync rpc behavior is not officially supported anymore. Try using another keyword or making custom logic using get_multiplayer().get_remote_sender_id()\n@rpc func", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
- valid = valid && test_conversion_with_regex("\n\nmastersync func", "\n\nThe master and mastersync rpc behavior is not officially supported anymore. Try using another keyword or making custom logic using get_multiplayer().get_remote_sender_id()\n@rpc(call_local) func", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
+ valid = valid && test_conversion_with_regex("\n\nmastersync func", "\n\nThe master and mastersync rpc behavior is not officially supported anymore. Try using another keyword or making custom logic using get_multiplayer().get_remote_sender_id()\n@rpc(\"call_local\") func", &ProjectConverter3To4::rename_gdscript_keywords, "gdscript keyword", reg_container);
valid = valid && test_conversion_gdscript_builtin("var size : Vector2 = Vector2() setget set_function , get_function", "var size : Vector2 = Vector2() : get = get_function, set = set_function", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
valid = valid && test_conversion_gdscript_builtin("var size : Vector2 = Vector2() setget set_function , ", "var size : Vector2 = Vector2() : set = set_function", &ProjectConverter3To4::rename_gdscript_functions, "custom rename", reg_container, false);
@@ -2737,6 +2846,7 @@ bool ProjectConverter3To4::test_array_names() {
valid = valid && test_single_array(shaders_renames, true);
valid = valid && test_single_array(gdscript_signals_renames);
valid = valid && test_single_array(project_settings_renames);
+ valid = valid && test_single_array(input_map_renames);
valid = valid && test_single_array(builtin_types_renames);
valid = valid && test_single_array(color_renames);
@@ -3163,9 +3273,96 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
line = reg_container.reg_setget_get.sub(line, "var $1$2: get = $3", true);
}
- // OS.window_fullscreen = a -> if a: DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN) else: DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
+ if (line.contains("window_resizable")) {
+ // OS.set_window_resizable(a) -> get_window().unresizable = not (a)
+ line = reg_container.reg_os_set_window_resizable.sub(line, "get_window().unresizable = not ($1)", true);
+ // OS.window_resizable = a -> same
+ line = reg_container.reg_os_assign_window_resizable.sub(line, "get_window().unresizable = not ($1)", true);
+ // OS.[is_]window_resizable() -> (not get_window().unresizable)
+ line = reg_container.reg_os_is_window_resizable.sub(line, "(not get_window().unresizable)", true);
+ }
+
if (line.contains("window_fullscreen")) {
- line = reg_container.reg_os_fullscreen.sub(line, "if $1:\n\tDisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)\nelse:\n\tDisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)", true);
+ // OS.window_fullscreen(a) -> get_window().mode = Window.MODE_EXCLUSIVE_FULLSCREEN if (a) else Window.MODE_WINDOWED
+ line = reg_container.reg_os_set_fullscreen.sub(line, "get_window().mode = Window.MODE_EXCLUSIVE_FULLSCREEN if ($1) else Window.MODE_WINDOWED", true);
+ // window_fullscreen = a -> same
+ line = reg_container.reg_os_assign_fullscreen.sub(line, "get_window().mode = Window.MODE_EXCLUSIVE_FULLSCREEN if ($1) else Window.MODE_WINDOWED", true);
+ // OS.[is_]window_fullscreen() -> ((get_window().mode == Window.MODE_EXCLUSIVE_FULLSCREEN) or (get_window().mode == Window.MODE_FULLSCREEN))
+ line = reg_container.reg_os_is_fullscreen.sub(line, "((get_window().mode == Window.MODE_EXCLUSIVE_FULLSCREEN) or (get_window().mode == Window.MODE_FULLSCREEN))", true);
+ }
+
+ if (line.contains("window_maximized")) {
+ // OS.window_maximized(a) -> get_window().mode = Window.MODE_MAXIMIZED if (a) else Window.MODE_WINDOWED
+ line = reg_container.reg_os_set_maximized.sub(line, "get_window().mode = Window.MODE_MAXIMIZED if ($1) else Window.MODE_WINDOWED", true);
+ // window_maximized = a -> same
+ line = reg_container.reg_os_assign_maximized.sub(line, "get_window().mode = Window.MODE_MAXIMIZED if ($1) else Window.MODE_WINDOWED", true);
+ // OS.[is_]window_maximized() -> (get_window().mode == Window.MODE_MAXIMIZED)
+ line = reg_container.reg_os_is_maximized.sub(line, "(get_window().mode == Window.MODE_MAXIMIZED)", true);
+ }
+
+ if (line.contains("window_minimized")) {
+ // OS.window_minimized(a) -> get_window().mode = Window.MODE_MINIMIZED if (a) else Window.MODE_WINDOWED
+ line = reg_container.reg_os_set_minimized.sub(line, "get_window().mode = Window.MODE_MINIMIZED if ($1) else Window.MODE_WINDOWED", true);
+ // window_minimized = a -> same
+ line = reg_container.reg_os_assign_minimized.sub(line, "get_window().mode = Window.MODE_MINIMIZED if ($1) else Window.MODE_WINDOWED", true);
+ // OS.[is_]window_minimized() -> (get_window().mode == Window.MODE_MINIMIZED)
+ line = reg_container.reg_os_is_minimized.sub(line, "(get_window().mode == Window.MODE_MINIMIZED)", true);
+ }
+
+ if (line.contains("set_use_vsync")) {
+ // OS.set_use_vsync(a) -> get_window().window_set_vsync_mode(DisplayServer.VSYNC_ENABLED if (a) else DisplayServer.VSYNC_DISABLED)
+ line = reg_container.reg_os_set_vsync.sub(line, "DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ENABLED if ($1) else DisplayServer.VSYNC_DISABLED)", true);
+ }
+ if (line.contains("vsync_enabled")) {
+ // vsync_enabled = a -> get_window().window_set_vsync_mode(DisplayServer.VSYNC_ENABLED if (a) else DisplayServer.VSYNC_DISABLED)
+ line = reg_container.reg_os_assign_vsync.sub(line, "DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ENABLED if ($1) else DisplayServer.VSYNC_DISABLED)", true);
+ // OS.[is_]vsync_enabled() -> (DisplayServer.window_get_vsync_mode() != DisplayServer.VSYNC_DISABLED)
+ line = reg_container.reg_os_is_vsync.sub(line, "(DisplayServer.window_get_vsync_mode() != DisplayServer.VSYNC_DISABLED)", true);
+ }
+
+ if (line.contains("OS.screen_orientation")) { // keep "OS." at start
+ // OS.screen_orientation = a -> DisplayServer.screen_set_orientation(a)
+ line = reg_container.reg_os_assign_screen_orient.sub(line, "$1DisplayServer.screen_set_orientation($2)", true); // assignment
+ line = line.replace("OS.screen_orientation", "DisplayServer.screen_get_orientation()"); // value access
+ }
+
+ if (line.contains("_window_always_on_top")) {
+ // OS.set_window_always_on_top(a) -> get_window().always_on_top = (a)
+ line = reg_container.reg_os_set_always_on_top.sub(line, "get_window().always_on_top = ($1)", true);
+ // OS.is_window_always_on_top() -> get_window().always_on_top
+ line = reg_container.reg_os_is_always_on_top.sub(line, "get_window().always_on_top", true);
+ }
+
+ if (line.contains("et_borderless_window")) {
+ // OS.set_borderless_window(a) -> get_window().borderless = (a)
+ line = reg_container.reg_os_set_borderless.sub(line, "get_window().borderless = ($1)", true);
+ // OS.get_borderless_window() -> get_window().borderless
+ line = reg_container.reg_os_get_borderless.sub(line, "get_window().borderless", true);
+ }
+
+ // OS.SCREEN_ORIENTATION_* -> DisplayServer.SCREEN_*
+ if (line.contains("OS.SCREEN_ORIENTATION_")) {
+ line = reg_container.reg_os_screen_orient_enum.sub(line, "DisplayServer.SCREEN_$1", true);
+ }
+
+ // OS -> Window simple replacements with optional set/get.
+ if (line.contains("current_screen")) {
+ line = reg_container.reg_os_current_screen.sub(line, "get_window().$1current_screen", true);
+ }
+ if (line.contains("min_window_size")) {
+ line = reg_container.reg_os_min_window_size.sub(line, "get_window().$1min_size", true);
+ }
+ if (line.contains("max_window_size")) {
+ line = reg_container.reg_os_max_window_size.sub(line, "get_window().$1max_size", true);
+ }
+ if (line.contains("window_position")) {
+ line = reg_container.reg_os_window_position.sub(line, "get_window().$1position", true);
+ }
+ if (line.contains("window_size")) {
+ line = reg_container.reg_os_window_size.sub(line, "get_window().$1size", true);
+ }
+ if (line.contains("et_screen_orientation")) {
+ line = reg_container.reg_os_getset_screen_orient.sub(line, "DisplayServer.screen_$1et_orientation", true);
}
// Instantiate
@@ -3666,11 +3863,85 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
if (line.contains("OS.get_datetime")) {
line = line.replace("OS.get_datetime", "Time.get_datetime_dict_from_system");
}
+
+ // OS -> DisplayServer
+ if (line.contains("OS.get_display_cutouts")) {
+ line = line.replace("OS.get_display_cutouts", "DisplayServer.get_display_cutouts");
+ }
+ if (line.contains("OS.get_screen_count")) {
+ line = line.replace("OS.get_screen_count", "DisplayServer.get_screen_count");
+ }
+ if (line.contains("OS.get_screen_dpi")) {
+ line = line.replace("OS.get_screen_dpi", "DisplayServer.screen_get_dpi");
+ }
+ if (line.contains("OS.get_screen_max_scale")) {
+ line = line.replace("OS.get_screen_max_scale", "DisplayServer.screen_get_max_scale");
+ }
+ if (line.contains("OS.get_screen_position")) {
+ line = line.replace("OS.get_screen_position", "DisplayServer.screen_get_position");
+ }
+ if (line.contains("OS.get_screen_refresh_rate")) {
+ line = line.replace("OS.get_screen_refresh_rate", "DisplayServer.screen_get_refresh_rate");
+ }
+ if (line.contains("OS.get_screen_scale")) {
+ line = line.replace("OS.get_screen_scale", "DisplayServer.screen_get_scale");
+ }
+ if (line.contains("OS.get_screen_size")) {
+ line = line.replace("OS.get_screen_size", "DisplayServer.screen_get_size");
+ }
+ if (line.contains("OS.set_icon")) {
+ line = line.replace("OS.set_icon", "DisplayServer.set_icon");
+ }
+ if (line.contains("OS.set_native_icon")) {
+ line = line.replace("OS.set_native_icon", "DisplayServer.set_native_icon");
+ }
+
+ // OS -> Window
+ if (line.contains("OS.window_borderless")) {
+ line = line.replace("OS.window_borderless", "get_window().borderless");
+ }
+ if (line.contains("OS.get_real_window_size")) {
+ line = line.replace("OS.get_real_window_size", "get_window().get_size_with_decorations");
+ }
+ if (line.contains("OS.is_window_focused")) {
+ line = line.replace("OS.is_window_focused", "get_window().has_focus");
+ }
+ if (line.contains("OS.move_window_to_foreground")) {
+ line = line.replace("OS.move_window_to_foreground", "get_window().move_to_foreground");
+ }
+ if (line.contains("OS.request_attention")) {
+ line = line.replace("OS.request_attention", "get_window().request_attention");
+ }
+ if (line.contains("OS.set_window_title")) {
+ line = line.replace("OS.set_window_title", "get_window().set_title");
+ }
+
+ // get_tree().set_input_as_handled() -> get_viewport().set_input_as_handled()
+ if (line.contains("get_tree().set_input_as_handled()")) {
+ line = line.replace("get_tree().set_input_as_handled()", "get_viewport().set_input_as_handled()");
+ }
+
+ // Fix the simple case of using _unhandled_key_input
+ // func _unhandled_key_input(event: InputEventKey) -> _unhandled_key_input(event: InputEvent)
+ if (line.contains("_unhandled_key_input(event: InputEventKey)")) {
+ line = line.replace("_unhandled_key_input(event: InputEventKey)", "_unhandled_key_input(event: InputEvent)");
+ }
}
void ProjectConverter3To4::process_csharp_line(String &line, const RegExContainer &reg_container) {
line = line.replace("OS.GetWindowSafeArea()", "DisplayServer.ScreenGetUsableRect()");
+ // GetTree().SetInputAsHandled() -> GetViewport().SetInputAsHandled()
+ if (line.contains("GetTree().SetInputAsHandled()")) {
+ line = line.replace("GetTree().SetInputAsHandled()", "GetViewport().SetInputAsHandled()");
+ }
+
+ // Fix the simple case of using _UnhandledKeyInput
+ // func _UnhandledKeyInput(InputEventKey @event) -> _UnhandledKeyInput(InputEvent @event)
+ if (line.contains("_UnhandledKeyInput(InputEventKey @event)")) {
+ line = line.replace("_UnhandledKeyInput(InputEventKey @event)", "_UnhandledKeyInput(InputEvent @event)");
+ }
+
// -- Connect(,,,things) -> Connect(,Callable(,),things) Object
if (line.contains("Connect(")) {
int start = line.find("Connect(");
@@ -3818,13 +4089,13 @@ void ProjectConverter3To4::rename_gdscript_keywords(Vector<String> &lines, const
line = reg_container.keyword_gdscript_onready.sub(line, "@onready", true);
}
if (line.contains("remote")) {
- line = reg_container.keyword_gdscript_remote.sub(line, "@rpc(any_peer) func", true);
+ line = reg_container.keyword_gdscript_remote.sub(line, "@rpc(\"any_peer\") func", true);
}
if (line.contains("remote")) {
- line = reg_container.keyword_gdscript_remotesync.sub(line, "@rpc(any_peer, call_local) func", true);
+ line = reg_container.keyword_gdscript_remotesync.sub(line, "@rpc(\"any_peer\", \"call_local\") func", true);
}
if (line.contains("sync")) {
- line = reg_container.keyword_gdscript_sync.sub(line, "@rpc(any_peer, call_local) func", true);
+ line = reg_container.keyword_gdscript_sync.sub(line, "@rpc(\"any_peer\", \"call_local\") func", true);
}
if (line.contains("slave")) {
line = reg_container.keyword_gdscript_slave.sub(line, "@rpc func", true);
@@ -3833,13 +4104,13 @@ void ProjectConverter3To4::rename_gdscript_keywords(Vector<String> &lines, const
line = reg_container.keyword_gdscript_puppet.sub(line, "@rpc func", true);
}
if (line.contains("puppet")) {
- line = reg_container.keyword_gdscript_puppetsync.sub(line, "@rpc(call_local) func", true);
+ line = reg_container.keyword_gdscript_puppetsync.sub(line, "@rpc(\"call_local\") func", true);
}
if (line.contains("master")) {
line = reg_container.keyword_gdscript_master.sub(line, error_message + "@rpc func", true);
}
if (line.contains("master")) {
- line = reg_container.keyword_gdscript_mastersync.sub(line, error_message + "@rpc(call_local) func", true);
+ line = reg_container.keyword_gdscript_mastersync.sub(line, error_message + "@rpc(\"call_local\") func", true);
}
}
}
@@ -3887,25 +4158,25 @@ Vector<String> ProjectConverter3To4::check_for_rename_gdscript_keywords(Vector<S
if (line.contains("remote")) {
old = line;
- line = reg_container.keyword_gdscript_remote.sub(line, "@rpc(any_peer) func", true);
+ line = reg_container.keyword_gdscript_remote.sub(line, "@rpc(\"any_peer\") func", true);
if (old != line) {
- found_renames.append(line_formatter(current_line, "remote func", "@rpc(any_peer) func", line));
+ found_renames.append(line_formatter(current_line, "remote func", "@rpc(\"any_peer\") func", line));
}
}
if (line.contains("remote")) {
old = line;
- line = reg_container.keyword_gdscript_remotesync.sub(line, "@rpc(any_peer, call_local)) func", true);
+ line = reg_container.keyword_gdscript_remotesync.sub(line, "@rpc(\"any_peer\", \"call_local\")) func", true);
if (old != line) {
- found_renames.append(line_formatter(current_line, "remotesync func", "@rpc(any_peer, call_local)) func", line));
+ found_renames.append(line_formatter(current_line, "remotesync func", "@rpc(\"any_peer\", \"call_local\")) func", line));
}
}
if (line.contains("sync")) {
old = line;
- line = reg_container.keyword_gdscript_sync.sub(line, "@rpc(any_peer, call_local)) func", true);
+ line = reg_container.keyword_gdscript_sync.sub(line, "@rpc(\"any_peer\", \"call_local\")) func", true);
if (old != line) {
- found_renames.append(line_formatter(current_line, "sync func", "@rpc(any_peer, call_local)) func", line));
+ found_renames.append(line_formatter(current_line, "sync func", "@rpc(\"any_peer\", \"call_local\")) func", line));
}
}
@@ -3927,9 +4198,9 @@ Vector<String> ProjectConverter3To4::check_for_rename_gdscript_keywords(Vector<S
if (line.contains("puppet")) {
old = line;
- line = reg_container.keyword_gdscript_puppetsync.sub(line, "@rpc(call_local) func", true);
+ line = reg_container.keyword_gdscript_puppetsync.sub(line, "@rpc(\"call_local\") func", true);
if (old != line) {
- found_renames.append(line_formatter(current_line, "puppetsync func", "@rpc(call_local) func", line));
+ found_renames.append(line_formatter(current_line, "puppetsync func", "@rpc(\"call_local\") func", line));
}
}
@@ -3943,9 +4214,9 @@ Vector<String> ProjectConverter3To4::check_for_rename_gdscript_keywords(Vector<S
if (line.contains("master")) {
old = line;
- line = reg_container.keyword_gdscript_master.sub(line, "@rpc(call_local) func", true);
+ line = reg_container.keyword_gdscript_master.sub(line, "@rpc(\"call_local\") func", true);
if (old != line) {
- found_renames.append(line_formatter(current_line, "mastersync func", "@rpc(call_local) func", line));
+ found_renames.append(line_formatter(current_line, "mastersync func", "@rpc(\"call_local\") func", line));
}
}
}
@@ -4080,3 +4351,4 @@ int ProjectConverter3To4::validate_conversion() {
}
#endif // MODULE_REGEX_ENABLED
+#endif // DISABLE_DEPRECATED
diff --git a/editor/project_converter_3_to_4.h b/editor/project_converter_3_to_4.h
index b3aa52f1e3..6ec2dd188d 100644
--- a/editor/project_converter_3_to_4.h
+++ b/editor/project_converter_3_to_4.h
@@ -29,6 +29,7 @@
/**************************************************************************/
#ifndef PROJECT_CONVERTER_3_TO_4_H
+#ifndef DISABLE_DEPRECATED
#define PROJECT_CONVERTER_3_TO_4_H
#include "core/io/file_access.h"
@@ -41,6 +42,19 @@ class RegEx;
class ProjectConverter3To4 {
public:
class RegExContainer;
+ static const char *enum_renames[][2];
+ static const char *gdscript_function_renames[][2];
+ static const char *csharp_function_renames[][2];
+ static const char *gdscript_properties_renames[][2];
+ static const char *csharp_properties_renames[][2];
+ static const char *gdscript_signals_renames[][2];
+ static const char *csharp_signals_renames[][2];
+ static const char *project_settings_renames[][2];
+ static const char *input_map_renames[][2];
+ static const char *builtin_types_renames[][2];
+ static const char *shaders_renames[][2];
+ static const char *class_renames[][2];
+ static const char *color_renames[][2];
private:
uint64_t maximum_file_size;
@@ -97,4 +111,6 @@ public:
int convert();
};
+#endif // DISABLE_DEPRECATED
+
#endif // PROJECT_CONVERTER_3_TO_4_H
diff --git a/editor/register_editor_types.cpp b/editor/register_editor_types.cpp
index 5f6b5aa42f..061baaff7e 100644
--- a/editor/register_editor_types.cpp
+++ b/editor/register_editor_types.cpp
@@ -219,6 +219,4 @@ void unregister_editor_types() {
if (EditorPaths::get_singleton()) {
EditorPaths::free();
}
-
- EditorResourcePicker::clear_caches();
}
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 733f140a56..86e77fbbbe 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -1428,6 +1428,9 @@ void SceneTreeDock::_script_open_request(const Ref<Script> &p_script) {
void SceneTreeDock::_push_item(Object *p_object) {
EditorNode::get_singleton()->push_item(p_object);
+ if (p_object == nullptr) {
+ EditorNode::get_singleton()->hide_unused_editors(this);
+ }
}
void SceneTreeDock::_handle_select(Node *p_node) {
@@ -2004,13 +2007,13 @@ void SceneTreeDock::_shader_created(Ref<Shader> p_shader) {
void SceneTreeDock::_script_creation_closed() {
script_create_dialog->disconnect("script_created", callable_mp(this, &SceneTreeDock::_script_created));
script_create_dialog->disconnect("confirmed", callable_mp(this, &SceneTreeDock::_script_creation_closed));
- script_create_dialog->disconnect("cancelled", callable_mp(this, &SceneTreeDock::_script_creation_closed));
+ script_create_dialog->disconnect("canceled", callable_mp(this, &SceneTreeDock::_script_creation_closed));
}
void SceneTreeDock::_shader_creation_closed() {
shader_create_dialog->disconnect("shader_created", callable_mp(this, &SceneTreeDock::_shader_created));
shader_create_dialog->disconnect("confirmed", callable_mp(this, &SceneTreeDock::_shader_creation_closed));
- shader_create_dialog->disconnect("cancelled", callable_mp(this, &SceneTreeDock::_shader_creation_closed));
+ shader_create_dialog->disconnect("canceled", callable_mp(this, &SceneTreeDock::_shader_creation_closed));
}
void SceneTreeDock::_toggle_editable_children_from_selection() {
@@ -2061,7 +2064,7 @@ void SceneTreeDock::_delete_confirm(bool p_cut) {
return;
}
- EditorNode::get_singleton()->get_editor_plugins_over()->make_visible(false);
+ EditorNode::get_singleton()->hide_unused_editors(this);
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(p_cut ? TTR("Cut Node(s)") : TTR("Remove Node(s)"), UndoRedo::MERGE_DISABLE, remove_list.front()->get());
@@ -2188,7 +2191,7 @@ void SceneTreeDock::_do_create(Node *p_parent) {
ERR_FAIL_COND(!child);
String new_name = p_parent->validate_child_name(child);
- if (GLOBAL_GET("editor/node_naming/name_casing").operator int() != NAME_CASING_PASCAL_CASE) {
+ if (GLOBAL_GET("editor/naming/node_name_casing").operator int() != NAME_CASING_PASCAL_CASE) {
new_name = adjust_name_casing(new_name);
}
child->set_name(new_name);
@@ -3090,7 +3093,7 @@ void SceneTreeDock::attach_script_to_selected(bool p_extend) {
script_create_dialog->connect("script_created", callable_mp(this, &SceneTreeDock::_script_created));
script_create_dialog->connect("confirmed", callable_mp(this, &SceneTreeDock::_script_creation_closed));
- script_create_dialog->connect("cancelled", callable_mp(this, &SceneTreeDock::_script_creation_closed));
+ script_create_dialog->connect("canceled", callable_mp(this, &SceneTreeDock::_script_creation_closed));
script_create_dialog->set_inheritance_base_type("Node");
script_create_dialog->config(inherits, path);
script_create_dialog->popup_centered();
@@ -3132,7 +3135,7 @@ void SceneTreeDock::attach_shader_to_selected(int p_preferred_mode) {
shader_create_dialog->connect("shader_created", callable_mp(this, &SceneTreeDock::_shader_created));
shader_create_dialog->connect("confirmed", callable_mp(this, &SceneTreeDock::_shader_creation_closed));
- shader_create_dialog->connect("cancelled", callable_mp(this, &SceneTreeDock::_shader_creation_closed));
+ shader_create_dialog->connect("canceled", callable_mp(this, &SceneTreeDock::_shader_creation_closed));
shader_create_dialog->config(path, true, true, -1, p_preferred_mode);
shader_create_dialog->popup_centered();
}
@@ -3610,7 +3613,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec
scene_tree->connect("script_dropped", callable_mp(this, &SceneTreeDock::_script_dropped));
scene_tree->connect("nodes_dragged", callable_mp(this, &SceneTreeDock::_nodes_drag_begin));
- scene_tree->get_scene_tree()->connect("item_double_clicked", callable_mp(this, &SceneTreeDock::_focus_node));
+ scene_tree->get_scene_tree()->connect("item_icon_double_clicked", callable_mp(this, &SceneTreeDock::_focus_node));
editor_selection->connect("selection_changed", callable_mp(this, &SceneTreeDock::_selection_changed));
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index e0d748c478..42801cdaf1 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -677,7 +677,7 @@ bool SceneTreeEditor::_item_matches_all_terms(TreeItem *p_item, PackedStringArra
for (int i = 0; i < p_terms.size(); i++) {
String term = p_terms[i];
- // Recognise special filter.
+ // Recognize special filter.
if (term.contains(":") && !term.get_slicec(':', 0).is_empty()) {
String parameter = term.get_slicec(':', 0);
String argument = term.get_slicec(':', 1);
@@ -971,7 +971,7 @@ void SceneTreeEditor::_renamed() {
String raw_new_name = which->get_text(0);
if (raw_new_name.strip_edges().is_empty()) {
// If name is empty, fallback to class name.
- if (GLOBAL_GET("editor/node_naming/name_casing").operator int() != NAME_CASING_PASCAL_CASE) {
+ if (GLOBAL_GET("editor/naming/node_name_casing").operator int() != NAME_CASING_PASCAL_CASE) {
raw_new_name = Node::adjust_name_casing(n->get_class());
} else {
raw_new_name = n->get_class();
diff --git a/editor/translations/af.po b/editor/translations/af.po
index a705eb58fb..605b30cf67 100644
--- a/editor/translations/af.po
+++ b/editor/translations/af.po
@@ -11201,7 +11201,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/ar.po b/editor/translations/ar.po
index 204dd9a41b..327332ae18 100644
--- a/editor/translations/ar.po
+++ b/editor/translations/ar.po
@@ -70,13 +70,14 @@
# xX-Void-Xx <arandomdude75@gmail.com>, 2022.
# أحمد النور <ahmed2699@gmail.com>, 2022.
# Commander Gordon <gordoncommander@gmail.com>, 2022.
+# Abdulrahman <abdelrahman.ramadan686@gmail.com>, 2022.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-10-29 23:55+0000\n"
-"Last-Translator: Commander Gordon <gordoncommander@gmail.com>\n"
+"PO-Revision-Date: 2022-12-21 07:01+0000\n"
+"Last-Translator: Abdulrahman <abdelrahman.ramadan686@gmail.com>\n"
"Language-Team: Arabic <https://hosted.weblate.org/projects/godot-engine/"
"godot/ar/>\n"
"Language: ar\n"
@@ -85,7 +86,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 4.14.2-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -877,7 +878,7 @@ msgstr "مطابقة Ø§Ù„Ù…Ø³Ø§ÙØ§Øª الطويلة"
#: core/project_settings.cpp
msgid "Compression Level"
-msgstr "ضغط المستوى"
+msgstr "مستوى الضغط"
#: core/project_settings.cpp
msgid "Window Log Size"
@@ -11177,7 +11178,7 @@ msgstr "نظر من الخلÙ"
msgid " [auto]"
msgstr " [auto]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [البوابات Ù…ÙØ¹Ù„Ø©]"
@@ -28516,6 +28517,5 @@ msgid "Log Active Async Compiles Count"
msgstr ""
#: servers/visual_server.cpp
-#, fuzzy
msgid "Shader Cache Size (MB)"
-msgstr "غيّر حجم الكاميرا"
+msgstr "حجم ذاكرة التظليل المؤقتة (مب)"
diff --git a/editor/translations/az.po b/editor/translations/az.po
index b6b36d99e5..90dfffe257 100644
--- a/editor/translations/az.po
+++ b/editor/translations/az.po
@@ -10789,7 +10789,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/bg.po b/editor/translations/bg.po
index 262a6825a6..728ffabe29 100644
--- a/editor/translations/bg.po
+++ b/editor/translations/bg.po
@@ -10946,7 +10946,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/bn.po b/editor/translations/bn.po
index df79cd5d84..b601d6d668 100644
--- a/editor/translations/bn.po
+++ b/editor/translations/bn.po
@@ -13,13 +13,14 @@
# Hasibul Hasan <d1hasib@yahoo.com>, 2020.
# saitama <atik.wowspace@gmail.com>, 2022.
# Joysankar Majumdar <joymajumdar15828@gmail.com>, 2022.
+# Safuan <safuanhossain12616@gmail.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-06-29 10:04+0000\n"
-"Last-Translator: Joysankar Majumdar <joymajumdar15828@gmail.com>\n"
+"PO-Revision-Date: 2023-01-09 20:42+0000\n"
+"Last-Translator: Safuan <safuanhossain12616@gmail.com>\n"
"Language-Team: Bengali <https://hosted.weblate.org/projects/godot-engine/"
"godot/bn/>\n"
"Language: bn\n"
@@ -27,7 +28,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 4.13.1-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -50,14 +51,12 @@ msgid "V-Sync Enabled"
msgstr "ভি-সিঙà§à¦• সকà§à¦°à¦¿à¦¯à¦¼ করà§à¦¨"
#: core/bind/core_bind.cpp main/main.cpp
-#, fuzzy
msgid "V-Sync Via Compositor"
msgstr "কমà§à¦ªà¦¸à¦¿à¦Ÿà¦° দà§à¦¬à¦¾à¦°à¦¾ ভি-সিঙà§à¦• করা"
#: core/bind/core_bind.cpp main/main.cpp
-#, fuzzy
msgid "Delta Smoothing"
-msgstr "ডেলà§à¦Ÿà¦¾ মসৃণ করন"
+msgstr "ডেলà§à¦Ÿà¦¾ মসৃণ"
#: core/bind/core_bind.cpp
#, fuzzy
@@ -86,7 +85,6 @@ msgstr "পরà§à¦¦à¦¾ à¦à§‹à¦à¦•/ উপসà§à¦¥à¦¾à¦ªà¦¨"
#: core/bind/core_bind.cpp core/project_settings.cpp main/main.cpp
#: platform/uwp/os_uwp.cpp
-#, fuzzy
msgid "Window"
msgstr "উইনà§à¦¡à§‹"
@@ -156,9 +154,8 @@ msgid "Target FPS"
msgstr "লকà§à¦·à§à¦¯-à¦à¦«à¦ªà¦¿à¦à¦¸(ফà§à¦°à§‡à¦®-পà§à¦°à¦¤à¦¿-সেকেনà§à¦¡)"
#: core/bind/core_bind.cpp
-#, fuzzy
msgid "Time Scale"
-msgstr "টাইম-সà§à¦•েল নোড"
+msgstr "টাইম-সà§à¦•েল"
#: core/bind/core_bind.cpp main/main.cpp
#, fuzzy
@@ -11772,7 +11769,7 @@ msgstr "পরিপà§à¦°à§‡à¦•à§à¦·à¦¿à¦¤ (Perspective)"
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/br.po b/editor/translations/br.po
index 0cfc29b4d1..41d6ac8ee8 100644
--- a/editor/translations/br.po
+++ b/editor/translations/br.po
@@ -10666,7 +10666,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/ca.po b/editor/translations/ca.po
index d3ced0a876..ab408a0d9f 100644
--- a/editor/translations/ca.po
+++ b/editor/translations/ca.po
@@ -11292,7 +11292,7 @@ msgstr "Perspectiva"
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/cs.po b/editor/translations/cs.po
index 173d38c85c..ee5bb962be 100644
--- a/editor/translations/cs.po
+++ b/editor/translations/cs.po
@@ -32,13 +32,13 @@
# JoeMoos <josephmoose13@gmail.com>, 2022.
# Mirinek <mirek.nozicka77@gmail.com>, 2022.
# Lubomír Baloun <lubosbaloun@gmail.com>, 2022.
-# Ondřej Pavelka <flamekick97@gmail.com>, 2022.
+# Ondřej Pavelka <flamekick97@gmail.com>, 2022, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-12-12 09:46+0000\n"
+"PO-Revision-Date: 2023-01-06 09:58+0000\n"
"Last-Translator: Ondřej Pavelka <flamekick97@gmail.com>\n"
"Language-Team: Czech <https://hosted.weblate.org/projects/godot-engine/godot/"
"cs/>\n"
@@ -47,7 +47,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
-"X-Generator: Weblate 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -251,9 +251,8 @@ msgstr "Data"
#: modules/gdscript/language_server/gdscript_language_server.cpp
#: modules/webrtc/webrtc_data_channel.h modules/websocket/websocket_macros.h
#: scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Network"
-msgstr "Síťový profiler"
+msgstr "Síť"
#: core/io/file_access_network.cpp
#, fuzzy
@@ -605,9 +604,8 @@ msgid "Application"
msgstr "Akce"
#: core/project_settings.cpp main/main.cpp
-#, fuzzy
msgid "Config"
-msgstr "Nastavení přichycení"
+msgstr "Konfigurace"
#: core/project_settings.cpp
#, fuzzy
@@ -1582,9 +1580,8 @@ msgid "Editors"
msgstr "Editory"
#: editor/animation_track_editor.cpp editor/editor_settings.cpp
-#, fuzzy
msgid "Confirm Insert Track"
-msgstr "Animace: Vložit stopu a klíÄ"
+msgstr "Potvrdit vložení stopy"
#. TRANSLATORS: %s will be replaced by a phrase describing the target of track.
#: editor/animation_track_editor.cpp
@@ -4547,17 +4544,16 @@ msgid "Version Control"
msgstr "Správa verzí"
#: editor/editor_node.cpp editor/plugins/version_control_editor_plugin.cpp
-#, fuzzy
msgid "Username"
-msgstr "Přejmenovat"
+msgstr "Uživatelské jméno"
#: editor/editor_node.cpp editor/plugins/version_control_editor_plugin.cpp
msgid "SSH Public Key Path"
-msgstr ""
+msgstr "Cesta k veÅ™ejnému klíÄi SSH"
#: editor/editor_node.cpp editor/plugins/version_control_editor_plugin.cpp
msgid "SSH Private Key Path"
-msgstr ""
+msgstr "Cesta k soukromému klíÄi SSH"
#: editor/editor_node.cpp
msgid "Dock Position"
@@ -5191,12 +5187,11 @@ msgstr "Ladicí program"
#: editor/editor_profiler.cpp
msgid "Profiler Frame History Size"
-msgstr ""
+msgstr "Velikost historie profilovacího rámce"
#: editor/editor_profiler.cpp
-#, fuzzy
msgid "Profiler Frame Max Functions"
-msgstr "Přejmenovat funkci"
+msgstr "Maximální poÄet funkcí profilovacího rámce"
#: editor/editor_properties.cpp
msgid "Edit Text:"
@@ -5723,82 +5718,78 @@ msgid "Show Members Overview"
msgstr "Zobrazit pÅ™ehled Älenů"
#: editor/editor_settings.cpp editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Files"
-msgstr "Soubor"
+msgstr "Soubory"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Trim Trailing Whitespace On Save"
-msgstr "Osekat koncové mezery"
+msgstr "Osekat koncové mezery při uložení"
#: editor/editor_settings.cpp
msgid "Autosave Interval Secs"
-msgstr ""
+msgstr "Interval automatického ukládání v sekundách"
#: editor/editor_settings.cpp editor/plugins/script_editor_plugin.cpp
msgid "Restore Scripts On Load"
-msgstr ""
+msgstr "Obnovit skripty pÅ™i naÄtení"
#: editor/editor_settings.cpp
msgid "Auto Reload And Parse Scripts On Save"
-msgstr ""
+msgstr "Automaticky aktualizovat a parsovat skripty při uložení"
#: editor/editor_settings.cpp
msgid "Auto Reload Scripts On External Change"
-msgstr ""
+msgstr "Automaticky aktualizovat skripty při externí změně"
#: editor/editor_settings.cpp
msgid "Create Signal Callbacks"
-msgstr ""
+msgstr "Vytvořit callback signálu"
#: editor/editor_settings.cpp
msgid "Sort Members Outline Alphabetically"
-msgstr ""
+msgstr "SeÅ™adit pÅ™ehled Älenů abecednÄ›"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
msgid "Cursor"
-msgstr ""
+msgstr "Kurzor"
#: editor/editor_settings.cpp
msgid "Scroll Past End Of File"
-msgstr ""
+msgstr "Skrolovat za konec souboru"
#: editor/editor_settings.cpp
msgid "Block Caret"
-msgstr ""
+msgstr "Blokovat stříšku"
#: editor/editor_settings.cpp
msgid "Caret Blink"
-msgstr ""
+msgstr "Blikání stříšky"
#: editor/editor_settings.cpp
msgid "Caret Blink Speed"
-msgstr ""
+msgstr "Rychlost blikání stříšky"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Right Click Moves Caret"
-msgstr "Pravý klik pro přidání bodu"
+msgstr "Pravý klik posune stříšku"
#: editor/editor_settings.cpp modules/gdscript/gdscript.cpp
#: modules/gdscript/gdscript_editor.cpp
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Completion"
-msgstr "Kopírovat výběr"
+msgstr "DokonÄování"
#: editor/editor_settings.cpp
msgid "Idle Parse Delay"
-msgstr ""
+msgstr "ZpoždÄ›ní parsování pÅ™i neÄinnosti"
#: editor/editor_settings.cpp
msgid "Auto Brace Complete"
-msgstr ""
+msgstr "Automatické doplnění závorky"
#: editor/editor_settings.cpp
msgid "Code Complete Delay"
-msgstr ""
+msgstr "ZpoždÄ›ní dokonÄení kódu"
#: editor/editor_settings.cpp
msgid "Put Callhint Tooltip Below Current Line"
@@ -5806,87 +5797,76 @@ msgstr ""
#: editor/editor_settings.cpp
msgid "Callhint Tooltip Offset"
-msgstr ""
+msgstr "Posunutí nápovědy"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Complete File Paths"
-msgstr "Kopírovat cestu k uzlu"
+msgstr "DokonÄit cestu k souboru"
#: editor/editor_settings.cpp modules/gdscript/gdscript_editor.cpp
-#, fuzzy
msgid "Add Type Hints"
-msgstr "Přidat typ"
+msgstr "Přidat nápovědy typů"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Use Single Quotes"
-msgstr "Nová dlaždice"
+msgstr "Používat jednoduché závorky"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Show Help Index"
-msgstr "Zobrazit pomocníky"
+msgstr "Zobrazit index nápovědy"
#: editor/editor_settings.cpp
msgid "Help Font Size"
-msgstr ""
+msgstr "Velikost fontu nápovědy"
#: editor/editor_settings.cpp
msgid "Help Source Font Size"
-msgstr ""
+msgstr "Velikost fontu zdroje nápovědy"
#: editor/editor_settings.cpp
msgid "Help Title Font Size"
-msgstr ""
+msgstr "Velikost fontu titulku nápovědy"
#: editor/editor_settings.cpp modules/gridmap/grid_map_editor_plugin.cpp
msgid "Grid Map"
msgstr "Mřížková mapa"
#: editor/editor_settings.cpp modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Pick Distance"
-msgstr "Vybrat vzdálenost:"
+msgstr "Výběrová vzdálenost"
#: editor/editor_settings.cpp editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Preview Size"
-msgstr "Náhled"
+msgstr "Velikost náhledu"
#: editor/editor_settings.cpp
msgid "Primary Grid Color"
-msgstr ""
+msgstr "Primární barva mřížky"
#: editor/editor_settings.cpp
msgid "Secondary Grid Color"
-msgstr ""
+msgstr "Sekundární barva mřížky"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Selection Box Color"
-msgstr "Pouze výběr"
+msgstr "Barva výběrového pole"
#: editor/editor_settings.cpp editor/plugins/path_editor_plugin.cpp
#: editor/spatial_editor_gizmos.cpp modules/csg/csg_gizmos.cpp
-#, fuzzy
msgid "3D Gizmos"
-msgstr "Gizma"
+msgstr "3D Rukojeti"
#: editor/editor_settings.cpp editor/plugins/path_editor_plugin.cpp
#: editor/spatial_editor_gizmos.cpp modules/csg/csg_gizmos.cpp
-#, fuzzy
msgid "Gizmo Colors"
-msgstr "Emisní barvy"
+msgstr "Barvy rukojetí"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Instanced"
-msgstr "Instance"
+msgstr "Instancováno"
#: editor/editor_settings.cpp modules/gltf/gltf_node.cpp
#: scene/3d/physics_body.cpp
-#, fuzzy
msgid "Joint"
msgstr "Bod"
@@ -5897,12 +5877,11 @@ msgstr "Bod"
#: scene/resources/particles_material.cpp servers/physics_2d_server.cpp
#: servers/physics_server.cpp
msgid "Shape"
-msgstr ""
+msgstr "Tvar"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Primary Grid Steps"
-msgstr "Krok mřížky:"
+msgstr "Primární stupně mřížky"
#: editor/editor_settings.cpp
msgid "Grid Size"
@@ -5910,35 +5889,31 @@ msgstr "Velikost mřížky"
#: editor/editor_settings.cpp
msgid "Grid Division Level Max"
-msgstr ""
+msgstr "Maximální úroveň rozdělení mřížky"
#: editor/editor_settings.cpp
msgid "Grid Division Level Min"
-msgstr ""
+msgstr "Minimální úroveň rozdělení mřížky"
#: editor/editor_settings.cpp
msgid "Grid Division Level Bias"
-msgstr ""
+msgstr "Sklon úrovně rozdělení mřížky"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Grid XZ Plane"
-msgstr "Vykreslit GridMap"
+msgstr "Rovina XZ mřížky"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Grid XY Plane"
-msgstr "Vykreslit GridMap"
+msgstr "Rovina XY mřížky"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Grid YZ Plane"
-msgstr "Vykreslit GridMap"
+msgstr "Rovina YZ mřížky"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Default FOV"
-msgstr "Výchozí"
+msgstr "Výchozí FOV"
#: editor/editor_settings.cpp
#, fuzzy
@@ -5946,222 +5921,194 @@ msgid "Default Z Near"
msgstr "Výchozí motiv"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Default Z Far"
-msgstr "Výchozí"
+msgstr "Výchozí Z limit dálky"
#: editor/editor_settings.cpp
msgid "Lightmap Baking Number Of CPU Threads"
-msgstr ""
+msgstr "PoÄet CPU vláken pÅ™i zapékání svÄ›telných map"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Navigation Scheme"
-msgstr "NavigaÄní režim"
+msgstr "Schéma navigace"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Invert Y Axis"
-msgstr "Editovat osu Y"
+msgstr "Invertovat osu Y"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Invert X Axis"
-msgstr "Editovat osu X"
+msgstr "Invertovat osu X"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Zoom Style"
-msgstr "Zmenšit"
+msgstr "Styl přiblížení"
#: editor/editor_settings.cpp
msgid "Emulate Numpad"
-msgstr ""
+msgstr "Emulovat numerickou klávesnici"
#: editor/editor_settings.cpp
msgid "Emulate 3 Button Mouse"
-msgstr ""
+msgstr "Emulovat třítlaÄítkovou myÅ¡"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Orbit Modifier"
-msgstr "Seřadit podle první změny"
+msgstr "Modifikátor orbitu"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Pan Modifier"
-msgstr "Režim posouvání"
+msgstr "Modifikátor posouvání"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Zoom Modifier"
-msgstr "Úpravy"
+msgstr "Modifikátor přiblížení"
#: editor/editor_settings.cpp editor/plugins/spatial_editor_plugin.cpp
msgid "Warped Mouse Panning"
-msgstr ""
+msgstr "Zkreslené posouvání myši"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Navigation Feel"
-msgstr "NavigaÄní režim"
+msgstr "Pocit navigace"
#: editor/editor_settings.cpp
msgid "Orbit Sensitivity"
-msgstr ""
+msgstr "Citlivost orbitu"
#: editor/editor_settings.cpp
msgid "Orbit Inertia"
-msgstr ""
+msgstr "SetrvaÄnost orbitu"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Translation Inertia"
-msgstr "Překlady"
+msgstr "SetrvaÄnost pÅ™ekladu"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Zoom Inertia"
-msgstr "Zvětšit"
+msgstr "SetrvaÄnost pÅ™iblížení"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook"
-msgstr "Volný pohled nahoru"
+msgstr "Volný pohled"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook Navigation Scheme"
-msgstr "Vytvořit Navigation Mesh"
+msgstr "NavigaÄní schéma volného pohledu"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook Sensitivity"
-msgstr "Volný pohled doleva"
+msgstr "Senzitivita volného pohledu"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook Inertia"
-msgstr "Volný pohled doleva"
+msgstr "SetrvaÄnost volného pohledu"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook Base Speed"
-msgstr "Rychlost volného pohledu"
+msgstr "Základní rychlost volného pohledu"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook Activation Modifier"
-msgstr "Zpomalení volného pohledu"
+msgstr "Modifikátor aktivace volného pohledu"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook Speed Zoom Link"
-msgstr "Rychlost volného pohledu"
+msgstr "Link rychlo přiblížení volného pohledu"
#: editor/editor_settings.cpp editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Grid Color"
-msgstr "Vyberte barvu"
+msgstr "Barva mřížky"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Guides Color"
-msgstr "Vyberte barvu"
+msgstr "Barva vodítek"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Smart Snapping Line Color"
-msgstr "Chytré přichcování"
+msgstr "Barva linky chytrého přichycování"
#: editor/editor_settings.cpp
msgid "Bone Width"
-msgstr ""
+msgstr "Šířka kosti"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Bone Color 1"
-msgstr "Odstranit položky třídy"
+msgstr "Barva kosti 1"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Bone Color 2"
-msgstr "Odstranit položky třídy"
+msgstr "Barva kosti 2"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Bone Selected Color"
-msgstr "Konfigurace vybraného profilu:"
+msgstr "Barva vybrané kosti"
#: editor/editor_settings.cpp
msgid "Bone IK Color"
-msgstr ""
+msgstr "Barva IK kosti"
#: editor/editor_settings.cpp
msgid "Bone Outline Color"
-msgstr ""
+msgstr "Barva obrysu kosti"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Bone Outline Size"
-msgstr "Velikost obrysu:"
+msgstr "Velikost obrysu kosti"
#: editor/editor_settings.cpp
+#, fuzzy
msgid "Viewport Border Color"
-msgstr ""
+msgstr "Barva ohraniÄení výřezu"
#: editor/editor_settings.cpp
+#, fuzzy
msgid "Constrain Editor View"
-msgstr ""
+msgstr "Omezit pohled editoru"
#: editor/editor_settings.cpp
msgid "Simple Panning"
-msgstr ""
+msgstr "Jednoduché posouvání"
#: editor/editor_settings.cpp
msgid "Scroll To Pan"
-msgstr ""
+msgstr "Skrollovat pro posun"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Pan Speed"
-msgstr "Rychlost:"
+msgstr "Rychlost posunu"
#: editor/editor_settings.cpp editor/plugins/polygon_2d_editor_plugin.cpp
-#, fuzzy
msgid "Poly Editor"
-msgstr "Polygon 2D UV Editor"
+msgstr "Editor polygonů"
#: editor/editor_settings.cpp
msgid "Point Grab Radius"
-msgstr ""
+msgstr "Dosah pro uchopení bodu"
#: editor/editor_settings.cpp editor/plugins/polygon_2d_editor_plugin.cpp
-#, fuzzy
msgid "Show Previous Outline"
-msgstr "Předchozí rovina"
+msgstr "Zobrazit předchozí obrys"
#: editor/editor_settings.cpp editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Autorename Animation Tracks"
-msgstr "Přejmenovat animaci"
+msgstr "Automaticky pÅ™ejmenovat animaÄní stopy"
#: editor/editor_settings.cpp
msgid "Default Create Bezier Tracks"
-msgstr ""
+msgstr "Výchozí vytváření beziérových stop"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Default Create Reset Tracks"
-msgstr "Vytvořit RESET stopu/stopy"
+msgstr "Výchozí vytváření resetovacích stop"
#: editor/editor_settings.cpp
msgid "Onion Layers Past Color"
-msgstr ""
+msgstr "Barva cibulových vrstev minulosti"
#: editor/editor_settings.cpp
msgid "Onion Layers Future Color"
-msgstr ""
+msgstr "Barva cibulových vrstev budoucnosti"
#: editor/editor_settings.cpp
msgid "Visual Editors"
@@ -6169,11 +6116,11 @@ msgstr "Vizuální editory"
#: editor/editor_settings.cpp
msgid "Minimap Opacity"
-msgstr ""
+msgstr "Průhlednost minimapy"
#: editor/editor_settings.cpp
msgid "Window Placement"
-msgstr ""
+msgstr "Umístění okna"
#: editor/editor_settings.cpp scene/2d/back_buffer_copy.cpp scene/2d/sprite.cpp
#: scene/2d/visibility_notifier_2d.cpp scene/3d/sprite_3d.cpp
@@ -6183,49 +6130,42 @@ msgid "Rect"
msgstr "Celý obdélník"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Rect Custom Position"
-msgstr "Nastavit bod z křivky"
+msgstr "Vlastní pozice okna"
#: editor/editor_settings.cpp platform/android/export/export_plugin.cpp
msgid "Screen"
msgstr ""
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Auto Save"
-msgstr "Automatický řez"
+msgstr "Automatické ukládání"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Save Before Running"
-msgstr "Uložit scénu před spuštěním..."
+msgstr "Uložit před spuštěním"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Font Size"
-msgstr "Pohled zepředu"
+msgstr "Velikost fontu"
#: editor/editor_settings.cpp
#: modules/gdscript/language_server/gdscript_language_server.cpp
-#, fuzzy
msgid "Remote Host"
-msgstr "Vzdálený "
+msgstr "Vzdálený host"
#: editor/editor_settings.cpp
#: modules/gdscript/language_server/gdscript_language_server.cpp
-#, fuzzy
msgid "Remote Port"
-msgstr "Odstranit bod"
+msgstr "Vzdálený port"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Editor SSL Certificates"
-msgstr "Nastavení editoru"
+msgstr "SSL certifikáty editoru"
#: editor/editor_settings.cpp
msgid "HTTP Proxy"
-msgstr ""
+msgstr "HTTP Proxy"
#: editor/editor_settings.cpp
msgid "Host"
@@ -6244,9 +6184,8 @@ msgstr "Správce projektů"
#. TRANSLATORS: Project Manager here refers to the tool used to create/manage Godot projects.
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Sorting Order"
-msgstr "Přejmenování složky:"
+msgstr "Seřadit podle"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
msgid "Symbol Color"
@@ -6322,11 +6261,11 @@ msgstr "Číslo řádku:"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
msgid "Caret Color"
-msgstr "Barva vynechávky"
+msgstr "Barva stříšky"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
msgid "Caret Background Color"
-msgstr "Barva pozadí vynechávky"
+msgstr "Barva pozadí stříšky"
#: editor/editor_settings.cpp
msgid "Text Selected Color"
@@ -7309,9 +7248,8 @@ msgid "Use Named Skins"
msgstr "Použít škálovací přichytávání"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "External Files"
-msgstr "Otevřít soubor"
+msgstr "Externí soubory"
#: editor/import/resource_importer_scene.cpp
msgid "Store In Subdir"
@@ -8293,7 +8231,7 @@ msgstr "Vynutit bílou modulaci"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Include Gizmos (3D)"
-msgstr "Zahrnout Gizmos (3D)"
+msgstr "Zahrnout rukojeti (3D)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Pin AnimationPlayer"
@@ -8681,9 +8619,8 @@ msgid "Download Error"
msgstr "Chyba při stahování"
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Available URLs"
-msgstr "Dostupné profily:"
+msgstr "Dostupné URL"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Download for this asset is already in progress!"
@@ -8771,7 +8708,7 @@ msgstr "Kategorie:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Site:"
-msgstr "Web:"
+msgstr "Stránka:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Support"
@@ -9346,7 +9283,7 @@ msgstr "Vytvořit kosti z uzlů"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Clear Custom Bones"
-msgstr "Vymazat kosti"
+msgstr "Vymazat vlastní kosti"
#. TRANSLATORS: Noun, name of the 2D/3D View menus.
#: editor/plugins/canvas_item_editor_plugin.cpp
@@ -9715,7 +9652,7 @@ msgstr "Pravý klik pro přidání bodu"
#: editor/plugins/gi_probe_editor_plugin.cpp
msgid "Bake GI Probe"
-msgstr "Zapéct GI probe"
+msgstr "Zapéct GI sondu"
#: editor/plugins/gradient_editor_plugin.cpp
msgid "Gradient Edited"
@@ -10338,7 +10275,7 @@ msgstr "Rozdělit segment (v křivce)"
#: editor/plugins/physical_bone_plugin.cpp
msgid "Move Joint"
-msgstr "Přesunout kloub"
+msgstr "Posunout bod"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid ""
@@ -10885,14 +10822,12 @@ msgid "External"
msgstr "Externí"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Use External Editor"
-msgstr "Debugovat v externím editoru"
+msgstr "Používat externí editor"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Exec Path"
-msgstr "Exportovat cestu"
+msgstr "Cesta k spuštění"
#: editor/plugins/script_editor_plugin.cpp
msgid "Script Temperature Enabled"
@@ -10920,11 +10855,11 @@ msgstr "Seřadit skripty podle"
#: editor/plugins/script_editor_plugin.cpp
msgid "List Script Names As"
-msgstr "Zobrazit názvy seznamu skriptů jako"
+msgstr "Zobrazit seznam názvů skriptů jako"
#: editor/plugins/script_editor_plugin.cpp
msgid "Exec Flags"
-msgstr ""
+msgstr "Parametry spuštění"
#: editor/plugins/script_editor_plugin.cpp
msgid "Clear Recent Scripts"
@@ -11254,7 +11189,7 @@ msgstr "Perspektivní"
msgid " [auto]"
msgstr " [auto]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [aktivní portály]"
@@ -11462,35 +11397,35 @@ msgstr "Není k dispozici při použití vykreslovacího modulu GLES2."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Left"
-msgstr "Volný pohled doleva"
+msgstr "Levý volný pohled"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Right"
-msgstr "Volný pohled doprava"
+msgstr "Pravý volný pohled"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Forward"
-msgstr "Volný pohled vpřed"
+msgstr "Přední volný pohled"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Backwards"
-msgstr "Volný pohled dozadu"
+msgstr "Zadní volný pohled"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Up"
-msgstr "Volný pohled nahoru"
+msgstr "Horní volný pohled"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Down"
-msgstr "Volný pohled dolů"
+msgstr "Dolní volný pohled"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Speed Modifier"
-msgstr "Rychlost volného pohledu"
+msgstr "Modifikátor rychlosti volného pohybu"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Slow Modifier"
-msgstr "Zpomalení volného pohledu"
+msgstr "Modifikátor zpomalení volného pohybu"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Toggle Camera Preview"
@@ -11756,16 +11691,15 @@ msgstr "Po"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Manipulator Gizmo Size"
-msgstr ""
+msgstr "Nastavení velikosti rukojeti"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Manipulator Gizmo Opacity"
-msgstr ""
+msgstr "Nastavení průhlednosti rukojeti"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Show Viewport Rotation Gizmo"
-msgstr "Uzamknout rotaci pohledu"
+msgstr "Zobrazit tlaÄítko rotace zobrazení"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Unnamed Gizmo"
@@ -12748,55 +12682,46 @@ msgid "Clear Transform"
msgstr "Promazat transformaci"
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Tile Map"
-msgstr "Nakreslit TileMap"
+msgstr "Mapa dlaždic"
#: editor/plugins/tile_map_editor_plugin.cpp
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Palette Min Width"
-msgstr ""
+msgstr "Minimální šířka palety"
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Palette Item H Separation"
-msgstr "Nazvaný oddÄ›lovaÄ"
+msgstr "H oddělování paletových položek"
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Show Tile Names"
-msgstr "Zobrazit všechny jazyky"
+msgstr "Zobrazit názvy dlaždic"
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Show Tile Ids"
-msgstr "Zobrazit pravítka"
+msgstr "Zobrazit Id dlaždic"
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Sort Tiles By Name"
-msgstr "Seřadit soubory"
+msgstr "Řadit dlaždice podle názvu"
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Bucket Fill Preview"
-msgstr "Vyplnit barvou"
+msgstr "Náhled vyplnění kbelíkem"
#: editor/plugins/tile_map_editor_plugin.cpp
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Editor Side"
-msgstr "Editor"
+msgstr "Strana editoru"
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Display Grid"
-msgstr "Rentgen pohled"
+msgstr "Zobrazit mřížku"
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Axis Color"
-msgstr "Vyberte barvu"
+msgstr "Barva osy"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Add Texture(s) to TileSet."
@@ -13331,7 +13256,7 @@ msgstr "Resetovat"
#: editor/plugins/version_control_editor_plugin.cpp
msgid "Version Control System"
-msgstr "Verzování (VCS)"
+msgstr "Systémy pro správu verzí"
#: editor/plugins/version_control_editor_plugin.cpp
msgid "Initialize"
@@ -13344,11 +13269,11 @@ msgstr "Odstranit bod"
#: editor/plugins/version_control_editor_plugin.cpp
msgid "Select SSH public key path"
-msgstr ""
+msgstr "Vybrat cestu k veÅ™ejnému klíÄi SSH"
#: editor/plugins/version_control_editor_plugin.cpp
msgid "Select SSH private key path"
-msgstr ""
+msgstr "Vybrat cestu k veÅ™ejnému klíÄi SSH"
#: editor/plugins/version_control_editor_plugin.cpp
msgid "SSH Passphrase"
@@ -16148,15 +16073,15 @@ msgstr "Filtrovat dlaždice"
#: editor/script_editor_debugger.cpp
msgid "Auto Switch To Remote Scene Tree"
-msgstr ""
+msgstr "Automaticky přepnout na vzdálený strom scén"
#: editor/script_editor_debugger.cpp
msgid "Remote Scene Tree Refresh Interval"
-msgstr ""
+msgstr "Interval obnovení vzdáleného stromu scén"
#: editor/script_editor_debugger.cpp
msgid "Remote Inspect Refresh Interval"
-msgstr ""
+msgstr "Interval obnovení vzdálené kontroly"
#: editor/script_editor_debugger.cpp
msgid "Network Profiler"
@@ -16254,7 +16179,7 @@ msgstr "Změnit rádius světla"
#: editor/spatial_editor_gizmos.cpp
msgid "Stream Player 3D"
-msgstr ""
+msgstr "Stream Player 3D"
#: editor/spatial_editor_gizmos.cpp
msgid "Change AudioStreamPlayer3D Emission Angle"
@@ -16264,7 +16189,7 @@ msgstr "Změnit úhel vysílání uzlu AudioStreamPlayer3D"
#: platform/osx/export/export.cpp
#: scene/resources/default_theme/default_theme.cpp
msgid "Camera"
-msgstr ""
+msgstr "Kamera"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Camera FOV"
@@ -16276,7 +16201,7 @@ msgstr "Změnit velikost kamery"
#: editor/spatial_editor_gizmos.cpp
msgid "Visibility Notifier"
-msgstr ""
+msgstr "Oznamovatel viditelnosti"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Notifier AABB"
@@ -16287,23 +16212,20 @@ msgid "Change Particles AABB"
msgstr "ZmÄ›nit Äástice AABB"
#: editor/spatial_editor_gizmos.cpp
-#, fuzzy
msgid "Reflection Probe"
-msgstr "Vybrat vlastnost"
+msgstr "Reflexní sonda"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Probe Extents"
msgstr "Změnit rozsahy Probe"
#: editor/spatial_editor_gizmos.cpp
-#, fuzzy
msgid "GI Probe"
-msgstr "Zapéct GI probe"
+msgstr "GI Sonda"
#: editor/spatial_editor_gizmos.cpp
-#, fuzzy
msgid "Baked Indirect Light"
-msgstr "Nepřímé osvětlení"
+msgstr "ZapeÄené nepřímé osvÄ›tlení"
#: editor/spatial_editor_gizmos.cpp modules/csg/csg_gizmos.cpp
msgid "Change Sphere Shape Radius"
@@ -16334,40 +16256,36 @@ msgid "Change Ray Shape Length"
msgstr "Změnit délku Ray Shape"
#: editor/spatial_editor_gizmos.cpp
-#, fuzzy
msgid "Navigation Edge"
-msgstr "NavigaÄní režim"
+msgstr "Hrana navigace"
#: editor/spatial_editor_gizmos.cpp
-#, fuzzy
msgid "Navigation Edge Disabled"
-msgstr "NavigaÄní režim"
+msgstr "Hrana navigace vypnuta"
#: editor/spatial_editor_gizmos.cpp
-#, fuzzy
msgid "Navigation Solid"
-msgstr "NavigaÄní režim"
+msgstr "Pevná navigace"
#: editor/spatial_editor_gizmos.cpp
-#, fuzzy
msgid "Navigation Solid Disabled"
-msgstr "NavigaÄní režim"
+msgstr "Pevná navigace vypnuta"
#: editor/spatial_editor_gizmos.cpp
msgid "Joint Body A"
-msgstr ""
+msgstr "Kloubové tělo A"
#: editor/spatial_editor_gizmos.cpp
msgid "Joint Body B"
-msgstr ""
+msgstr "Kloubové tělo B"
#: editor/spatial_editor_gizmos.cpp
msgid "Room Edge"
-msgstr ""
+msgstr "Hrana místnosti"
#: editor/spatial_editor_gizmos.cpp
msgid "Room Overlap"
-msgstr ""
+msgstr "Překrytí místností"
#: editor/spatial_editor_gizmos.cpp
#, fuzzy
@@ -16375,17 +16293,16 @@ msgid "Set Room Point Position"
msgstr "Nastavit pozici bodu křivky"
#: editor/spatial_editor_gizmos.cpp scene/3d/portal.cpp
-#, fuzzy
msgid "Portal Margin"
-msgstr "Nastavit okraj"
+msgstr "Okraj portálu"
#: editor/spatial_editor_gizmos.cpp
msgid "Portal Edge"
-msgstr ""
+msgstr "Hrana portálu"
#: editor/spatial_editor_gizmos.cpp
msgid "Portal Arrow"
-msgstr ""
+msgstr "Šipka portálu"
#: editor/spatial_editor_gizmos.cpp
#, fuzzy
@@ -16403,9 +16320,8 @@ msgstr "Jít zpět"
#: editor/spatial_editor_gizmos.cpp scene/2d/light_occluder_2d.cpp
#: scene/2d/tile_map.cpp
-#, fuzzy
msgid "Occluder"
-msgstr "Režim okluze"
+msgstr "Okluzor"
#: editor/spatial_editor_gizmos.cpp
#, fuzzy
@@ -16849,7 +16765,7 @@ msgstr ""
#: modules/csg/csg_gizmos.cpp
msgid "CSG"
-msgstr ""
+msgstr "CSG"
#: modules/csg/csg_gizmos.cpp
msgid "Change Cylinder Radius"
@@ -17215,18 +17131,16 @@ msgid "Object can't provide a length."
msgstr "Objekt nemůže poskytnout délku."
#: modules/gdscript/language_server/gdscript_language_server.cpp
-#, fuzzy
msgid "Language Server"
-msgstr "Jazyk:"
+msgstr "Jazykový server"
#: modules/gdscript/language_server/gdscript_language_server.cpp
-#, fuzzy
msgid "Enable Smart Resolve"
-msgstr "Nelze vyřešit"
+msgstr "Povolit funkci chytrého řešení"
#: modules/gdscript/language_server/gdscript_language_server.cpp
msgid "Show Native Symbols In Editor"
-msgstr ""
+msgstr "Zobrazení nativních symbolů v editoru"
#: modules/gdscript/language_server/gdscript_language_server.cpp
msgid "Use Thread"
@@ -17398,9 +17312,8 @@ msgid "Children"
msgstr "Upravitelní potomci"
#: modules/gltf/gltf_skeleton.cpp modules/gltf/gltf_skin.cpp
-#, fuzzy
msgid "Joints"
-msgstr "Bod"
+msgstr "Body"
#: modules/gltf/gltf_skeleton.cpp modules/gltf/gltf_skin.cpp
msgid "Roots"
@@ -17521,7 +17434,7 @@ msgstr ""
#: modules/gltf/gltf_state.cpp
msgid "Cameras"
-msgstr ""
+msgstr "Kamery"
#: modules/gltf/gltf_state.cpp servers/visual_server.cpp
#, fuzzy
@@ -17729,7 +17642,7 @@ msgstr "Nastavení GridMap"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Pick Distance:"
-msgstr "Vybrat vzdálenost:"
+msgstr "Výběrová vzdálenost:"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Filter meshes"
@@ -18793,7 +18706,7 @@ msgstr "Prioritní mód"
#: modules/webrtc/webrtc_data_channel.h
msgid "WebRTC"
-msgstr ""
+msgstr "WebRTC"
#: modules/webrtc/webrtc_data_channel.h
msgid "Max Channel In Buffer (KB)"
@@ -18801,11 +18714,11 @@ msgstr ""
#: modules/websocket/websocket_client.cpp
msgid "Verify SSL"
-msgstr ""
+msgstr "Ověřit SSL"
#: modules/websocket/websocket_client.cpp
msgid "Trusted SSL Certificate"
-msgstr ""
+msgstr "Důvěryhodný certifikát SSL"
#: modules/websocket/websocket_macros.h
#, fuzzy
@@ -18844,7 +18757,7 @@ msgstr "Fyzická Klávesa"
#: modules/websocket/websocket_server.cpp platform/javascript/export/export.cpp
msgid "SSL Certificate"
-msgstr ""
+msgstr "Certifikát SSL"
#: modules/websocket/websocket_server.cpp
#, fuzzy
@@ -18896,28 +18809,27 @@ msgstr "Chytré přichcování"
#: platform/android/export/export.cpp
msgid "Android SDK Path"
-msgstr ""
+msgstr "Cesta k Android SDK"
#: platform/android/export/export.cpp
-#, fuzzy
msgid "Debug Keystore"
-msgstr "Ladicí program"
+msgstr "Ladění Keystore"
#: platform/android/export/export.cpp
msgid "Debug Keystore User"
-msgstr ""
+msgstr "Uživatel ladění Keystore"
#: platform/android/export/export.cpp
msgid "Debug Keystore Pass"
-msgstr ""
+msgstr "Průchod ladění Keystore"
#: platform/android/export/export.cpp
msgid "Force System User"
-msgstr ""
+msgstr "Vynutit systémového uživatele"
#: platform/android/export/export.cpp
msgid "Shutdown ADB On Exit"
-msgstr ""
+msgstr "Vypnout ADB pÅ™i ukonÄení"
#: platform/android/export/export_plugin.cpp
msgid "Launcher Icons"
@@ -19000,7 +18912,7 @@ msgstr "Ladicí program"
#: platform/android/export/export_plugin.cpp platform/uwp/export/export.cpp
msgid "Debug Password"
-msgstr ""
+msgstr "Heslo ladění"
#: platform/android/export/export_plugin.cpp
#, fuzzy
@@ -19873,7 +19785,7 @@ msgstr "Chyba při spuštění serveru HTTP:"
#: platform/javascript/export/export.cpp
msgid "Web"
-msgstr ""
+msgstr "Web"
#: platform/javascript/export/export.cpp
msgid "HTTP Host"
@@ -19884,13 +19796,12 @@ msgid "HTTP Port"
msgstr ""
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Use SSL"
-msgstr "Použít přichycení"
+msgstr "Použít SSL"
#: platform/javascript/export/export.cpp
msgid "SSL Key"
-msgstr ""
+msgstr "KlÃ­Ä SSL"
#: platform/osx/export/codesign.cpp
msgid "Can't get filesystem access."
@@ -19952,9 +19863,8 @@ msgid "Invalid entitlements file."
msgstr "Neplatná přípona."
#: platform/osx/export/codesign.cpp
-#, fuzzy
msgid "Invalid executable file."
-msgstr "Neplatná přípona."
+msgstr "Neplatný spouštěcí soubor."
#: platform/osx/export/codesign.cpp
msgid "Can't resize signature load command."
@@ -20442,7 +20352,7 @@ msgstr ""
#: platform/osx/export/export.cpp
msgid "Force Builtin Codesign"
-msgstr ""
+msgstr "Vynutit vestavěný codesign"
#: platform/uwp/export/export.cpp
#, fuzzy
@@ -20580,6 +20490,8 @@ msgid ""
"Godot's Mono version does not support the UWP platform. Use the standard "
"build (no C# support) if you wish to target UWP."
msgstr ""
+"Mono verze Godotu nepodporuje platformu UWP. Použijte standartní build (bez "
+"podpory C#) pokud chcete použít platformu UWP."
#: platform/uwp/export/export.cpp
msgid "Invalid package short name."
@@ -20635,7 +20547,7 @@ msgstr "Neplatné rozměry obrázku uvítací obrazovky (měly by být 620x300).
#: platform/uwp/export/export.cpp
msgid "UWP"
-msgstr ""
+msgstr "UWP"
#: platform/uwp/export/export.cpp platform/windows/export/export.cpp
#, fuzzy
@@ -20644,12 +20556,11 @@ msgstr "Signál"
#: platform/uwp/export/export.cpp
msgid "Debug Certificate"
-msgstr ""
+msgstr "Certifikát ladění"
#: platform/uwp/export/export.cpp
-#, fuzzy
msgid "Debug Algorithm"
-msgstr "Ladicí program"
+msgstr "Algoritmus ladění"
#: platform/windows/export/export.cpp
#, fuzzy
@@ -21715,9 +21626,8 @@ msgid "Capping"
msgstr ""
#: scene/2d/line_2d.cpp
-#, fuzzy
msgid "Joint Mode"
-msgstr "Režim ikony"
+msgstr "Mód bodu"
#: scene/2d/line_2d.cpp
#, fuzzy
@@ -22659,9 +22569,8 @@ msgid "Light Data"
msgstr "S daty"
#: scene/3d/bone_attachment.cpp scene/3d/physics_body.cpp
-#, fuzzy
msgid "Bone Name"
-msgstr "Název uzlu:"
+msgstr "Název kosti"
#: scene/3d/camera.cpp
msgid "Keep Aspect"
@@ -23827,18 +23736,16 @@ msgid "Overlap Warning Threshold"
msgstr ""
#: scene/3d/room_manager.cpp
-#, fuzzy
msgid "Preview Camera"
-msgstr "Náhled"
+msgstr "Náhled kamery"
#: scene/3d/room_manager.cpp
msgid "Portal Depth Limit"
msgstr ""
#: scene/3d/room_manager.cpp
-#, fuzzy
msgid "Default Portal Margin"
-msgstr "Nastavit okraj"
+msgstr "Výchozí okraj portálu"
#: scene/3d/room_manager.cpp
#, fuzzy
@@ -23875,6 +23782,9 @@ msgid ""
"Room overlap detected, cameras may work incorrectly in overlapping area.\n"
"Check output log for details."
msgstr ""
+"Bylo detekováno překrytí místností, kamery nemusí fungovat správně v "
+"překryvajících oblastech.\n"
+"Podrobnosti najdete ve výstupním protokolu."
#: scene/3d/room_manager.cpp
msgid ""
@@ -24370,14 +24280,12 @@ msgid "Zero Y"
msgstr "Nula"
#: scene/animation/skeleton_ik.cpp
-#, fuzzy
msgid "Root Bone"
-msgstr "Název kořenového uzlu"
+msgstr "Kořenová kost"
#: scene/animation/skeleton_ik.cpp
-#, fuzzy
msgid "Tip Bone"
-msgstr "Kosti"
+msgstr "Å piÄková kost"
#: scene/animation/skeleton_ik.cpp
#, fuzzy
@@ -24904,7 +24812,7 @@ msgstr ""
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
msgid "Caret"
-msgstr ""
+msgstr "Stříška"
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
msgid "Blink"
@@ -25554,7 +25462,7 @@ msgstr "Vynásobit %s"
#: scene/main/scene_tree.cpp scene/resources/mesh_library.cpp
#: scene/resources/shape_2d.cpp
msgid "Shapes"
-msgstr ""
+msgstr "Tvary"
#: scene/main/scene_tree.cpp
msgid "Shape Color"
@@ -25721,7 +25629,7 @@ msgstr "Levé lineární"
#: scene/main/viewport.cpp
msgid "Render Direct To Screen"
-msgstr ""
+msgstr "Vykreslovat přímo na obrazovku"
#: scene/main/viewport.cpp
#, fuzzy
@@ -26519,9 +26427,8 @@ msgid "Label Width"
msgstr "Vlevo po celé výšce"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Screen Picker"
-msgstr "Operátor screen."
+msgstr "Výběr obrazovky"
#: scene/resources/default_theme/default_theme.cpp
#, fuzzy
@@ -27600,9 +27507,8 @@ msgid "Bind"
msgstr "Vazba"
#: scene/resources/skin.cpp
-#, fuzzy
msgid "Bone"
-msgstr "Kosti"
+msgstr "Kost"
#: scene/resources/sky.cpp
#, fuzzy
diff --git a/editor/translations/da.po b/editor/translations/da.po
index bb158fcada..5a9e684e85 100644
--- a/editor/translations/da.po
+++ b/editor/translations/da.po
@@ -11471,7 +11471,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/de.po b/editor/translations/de.po
index 61a5a51b9c..6d1c27e5b2 100644
--- a/editor/translations/de.po
+++ b/editor/translations/de.po
@@ -23,7 +23,7 @@
# Peter Friedland <peter_friedland@gmx.de>, 2016.
# No need for a name <endoplasmatik@gmx.net>, 2016.
# Sönke <me@eknoes.de>, 2018.
-# So Wieso <sowieso@dukun.de>, 2016-2018, 2019, 2020, 2021, 2022.
+# So Wieso <sowieso@dukun.de>, 2016-2018, 2019, 2020, 2021, 2022, 2023.
# Tim Schellenberg <smwleod@gmail.com>, 2017.
# Timo Schwarzer <account@timoschwarzer.com>, 2016-2018.
# viernullvier <hannes.breul+github@gmail.com>, 2016.
@@ -87,13 +87,14 @@
# Anonynonymouse <tom.spaine60388@gmail.com>, 2022.
# Felix Bitsch <felix.a.bitsch@gmail.com>, 2022.
# miguel <miguel-gonzalez@gmx.de>, 2022.
+# Least Significant Bite <leastsignificantbite@proton.me>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-12-13 13:21+0000\n"
-"Last-Translator: ‎ <artism90@googlemail.com>\n"
+"PO-Revision-Date: 2023-01-09 20:42+0000\n"
+"Last-Translator: So Wieso <sowieso@dukun.de>\n"
"Language-Team: German <https://hosted.weblate.org/projects/godot-engine/"
"godot/de/>\n"
"Language: de\n"
@@ -101,7 +102,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 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -482,7 +483,7 @@ msgstr "Gedrückt"
#: core/os/input_event.cpp
msgid "Scancode"
-msgstr "Scancode"
+msgstr "Tastencode"
#: core/os/input_event.cpp
msgid "Physical Scancode"
@@ -3751,7 +3752,7 @@ msgstr "Hoch"
#: editor/editor_network_profiler.cpp editor/editor_node.cpp
#: scene/main/node.cpp scene/resources/default_theme/default_theme.cpp
msgid "Node"
-msgstr "Knoten"
+msgstr "das Node"
#: editor/editor_network_profiler.cpp
msgid "Incoming RPC"
@@ -11038,7 +11039,7 @@ msgstr "Hinten perspektivisch"
msgid " [auto]"
msgstr " [auto]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [Portale aktiv]"
@@ -14308,17 +14309,15 @@ msgid "Invalid project path (changed anything?)."
msgstr "Ungültiger Projektpfad (etwas geändert?)."
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project at '%s' (error %d). It may be missing or corrupted."
msgstr ""
-"Die Datei project.godot im Projektpfad konnte nicht geladen werden (Fehler "
-"%d). Sie könnte fehlen oder beschädigt sein."
+"Projekt in ‚%s‘ konnte nicht geladen werden (Fehler %d). Es ist "
+"möglicherweise nicht vorhanden oder beschädigt."
#: editor/project_manager.cpp
-#, fuzzy
msgid "Couldn't save project at '%s' (error %d)."
-msgstr "Projekt in ‚%s‘ kann nicht geöffnet werden."
+msgstr "Projekt konnte nicht in ‚%s‘ gespeichert werden (Fehler %d)."
#: editor/project_manager.cpp
msgid "Couldn't create project.godot in project path."
@@ -23255,14 +23254,12 @@ msgid "AABB"
msgstr "AABB"
#: scene/3d/visual_instance.cpp
-#, fuzzy
msgid "Sorting"
-msgstr "Sortiere"
+msgstr "Sortierung"
#: scene/3d/visual_instance.cpp
-#, fuzzy
msgid "Use AABB Center"
-msgstr "Ambient verwenden"
+msgstr "AABB-Mittelpunkt verwenden"
#: scene/3d/visual_instance.cpp scene/resources/navigation_mesh.cpp
msgid "Geometry"
diff --git a/editor/translations/editor.pot b/editor/translations/editor.pot
index 7b7bfd71cc..964eb46175 100644
--- a/editor/translations/editor.pot
+++ b/editor/translations/editor.pot
@@ -1,6 +1,6 @@
# LANGUAGE translation of the Godot Engine editor.
-# Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.
-# Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).
+# Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md).
+# Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.
# This file is distributed under the same license as the Godot source code.
#
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
@@ -10564,7 +10564,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/el.po b/editor/translations/el.po
index 98873c7d40..fe89b69334 100644
--- a/editor/translations/el.po
+++ b/editor/translations/el.po
@@ -18,13 +18,14 @@
# JessicaLukatz <jessicalukatz32038@gmail.com>, 2022.
# Anthony V. <batmanplayer123@gmail.com>, 2022.
# Anthony V. <anthonyv156@outlook.com>, 2022.
+# Ilias Vasilakis <vaselas99@gmail.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-05-20 11:17+0000\n"
-"Last-Translator: Anthony V. <anthonyv156@outlook.com>\n"
+"PO-Revision-Date: 2023-01-15 13:34+0000\n"
+"Last-Translator: Ilias Vasilakis <vaselas99@gmail.com>\n"
"Language-Team: Greek <https://hosted.weblate.org/projects/godot-engine/godot/"
"el/>\n"
"Language: el\n"
@@ -32,7 +33,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 4.13-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -622,7 +623,7 @@ msgstr "Εμφάνιση όλων"
#: modules/opensimplex/noise_texture.cpp scene/2d/line_2d.cpp
#: scene/3d/label_3d.cpp scene/gui/text_edit.cpp scene/resources/texture.cpp
msgid "Width"
-msgstr ""
+msgstr "Πλάτος"
#: core/project_settings.cpp main/main.cpp modules/csg/csg_shape.cpp
#: modules/gltf/gltf_node.cpp modules/opensimplex/noise_texture.cpp
@@ -636,7 +637,7 @@ msgstr "Φως"
#: core/project_settings.cpp
msgid "Always On Top"
-msgstr ""
+msgstr "Πάντα στο επάνω μέÏος"
#: core/project_settings.cpp
#, fuzzy
@@ -804,7 +805,7 @@ msgstr "Απόδοση"
#: scene/resources/multimesh.cpp servers/visual/visual_server_scene.cpp
#: servers/visual_server.cpp
msgid "Quality"
-msgstr ""
+msgstr "Ποιότητα"
#: core/project_settings.cpp scene/gui/file_dialog.cpp
#: scene/main/scene_tree.cpp scene/resources/navigation_mesh.cpp
@@ -863,7 +864,7 @@ msgstr ""
#: core/project_settings.cpp
msgid "Compression Level"
-msgstr ""
+msgstr "Βαθμός Συμπίεσης"
#: core/project_settings.cpp
msgid "Window Log Size"
@@ -1034,11 +1035,11 @@ msgstr ""
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Max Renderable Elements"
-msgstr ""
+msgstr "Μέγιστος αÏιθμός οπτικοποιήσημων στοιχείων"
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Max Renderable Lights"
-msgstr ""
+msgstr "Μέγιστος αÏιθμός Οπτικοποιήσημων Φωτών"
#: drivers/gles3/rasterizer_scene_gles3.cpp
#, fuzzy
@@ -1081,7 +1082,7 @@ msgstr ""
#: drivers/gles3/rasterizer_scene_gles3.cpp scene/resources/environment.cpp
msgid "High Quality"
-msgstr ""
+msgstr "Υψηλή Ποιότητα"
#: drivers/gles3/rasterizer_storage_gles3.cpp
msgid "Blend Shape Max Buffer Size (KB)"
@@ -1196,7 +1197,7 @@ msgstr "Ποσότητα:"
#: editor/animation_track_editor.cpp main/main.cpp
#: modules/mono/mono_gd/gd_mono.cpp
msgid "Args"
-msgstr ""
+msgstr "ΟÏίσματα"
#: editor/animation_track_editor.cpp editor/editor_settings.cpp
#: editor/script_editor_debugger.cpp modules/gltf/gltf_accessor.cpp
@@ -2474,7 +2475,7 @@ msgstr ""
#: editor/editor_asset_installer.cpp
msgid "Contents of asset \"%s\" - No files conflict with your project:"
-msgstr ""
+msgstr "ΠεÏιεχόμενα ΠόÏου \"%s\" - Καμία ΣÏγκÏουση αÏχείων στο ΈÏγο σου:"
#: editor/editor_asset_installer.cpp
msgid "Uncompressing Assets"
@@ -2486,9 +2487,8 @@ msgid "The following files failed extraction from asset \"%s\":"
msgstr "Η εξαγωγή των ακόλουθων αÏχείων από το πακέτο απέτυχε:"
#: editor/editor_asset_installer.cpp
-#, fuzzy
msgid "(and %s more files)"
-msgstr "Και %s αÏχεία ακόμα."
+msgstr "Και %s αÏχεία ακόμα"
#: editor/editor_asset_installer.cpp
#, fuzzy
@@ -2837,22 +2837,19 @@ msgstr "Επιλέξτε"
#: editor/editor_export.cpp
msgid "Project export for platform:"
-msgstr ""
+msgstr "Εξαγωγή ΈÏγου για πλατφόÏμα:"
#: editor/editor_export.cpp
-#, fuzzy
msgid "Completed with warnings."
-msgstr "ΑντιγÏαφή διαδÏομής κόμβου"
+msgstr "ΟλοκληÏώθηκε με ΠÏοειδοποιήσεις."
#: editor/editor_export.cpp
-#, fuzzy
msgid "Completed successfully."
-msgstr "Το πακέτο εγκαταστάθηκε επιτυχώς!"
+msgstr "Επιτυχής ΟλοκλήÏωση."
#: editor/editor_export.cpp
-#, fuzzy
msgid "Failed."
-msgstr "Απέτυχε:"
+msgstr "Απέτυχε."
#: editor/editor_export.cpp
msgid "Storing File:"
@@ -2877,14 +2874,12 @@ msgid "Cannot create file \"%s\"."
msgstr "ΑδÏνατη η δημιουÏγία φακέλου."
#: editor/editor_export.cpp
-#, fuzzy
msgid "Failed to export project files."
-msgstr "Απέτυχε η εγγÏαφή σε αÏχείο:"
+msgstr "Απέτυχε η εξαγωγή αÏχείων έÏγου."
#: editor/editor_export.cpp
-#, fuzzy
msgid "Can't open file to read from path \"%s\"."
-msgstr "ΑδÏνατο το άνοιγμα αÏχείου για εγγÏαφή:"
+msgstr "ΑδÏνατο το άνοιγμα αÏχείου για ανάγνωση απο το μονοπάτι \"%s\"."
#: editor/editor_export.cpp
#, fuzzy
@@ -2962,9 +2957,8 @@ msgid "Release"
msgstr "ΕλευθέÏωση"
#: editor/editor_export.cpp
-#, fuzzy
msgid "Binary Format"
-msgstr "Τελεστής χÏώματος."
+msgstr "Δυαδική ΜοÏφή"
#: editor/editor_export.cpp
msgid "64 Bits"
@@ -3017,14 +3011,12 @@ msgid "Prepare Template"
msgstr "ΔιαχείÏιση ΠÏοτÏπων"
#: editor/editor_export.cpp platform/osx/export/export.cpp
-#, fuzzy
msgid "The given export path doesn't exist."
-msgstr "Η δεδομένη διαδÏομή εξαγωγής δεν υπάÏχει:"
+msgstr "Η δεδομένη διαδÏομή εξαγωγής δεν υπάÏχει."
#: editor/editor_export.cpp platform/javascript/export/export.cpp
-#, fuzzy
msgid "Template file not found: \"%s\"."
-msgstr "Δεν βÏέθηκε αÏχείο Ï€ÏοτÏπου:"
+msgstr "Δεν βÏέθηκε το αÏχείο Ï€ÏοτÏπου: \"%s\"."
#: editor/editor_export.cpp
#, fuzzy
@@ -3077,7 +3069,7 @@ msgstr "ΠλατφόÏμα Εισαγωγής"
#: editor/editor_feature_profile.cpp
msgid "Allows to view and edit 3D scenes."
-msgstr ""
+msgstr "ΕπιτÏέπει την Ï€Ïοβολή και επεξεÏγασία Ï„Ïισδιάστατων σκηνών."
#: editor/editor_feature_profile.cpp
msgid "Allows to edit scripts using the integrated script editor."
@@ -6103,9 +6095,8 @@ msgid "Bone Outline Color"
msgstr ""
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Bone Outline Size"
-msgstr "Μέγεθος πεÏιγÏάμματος:"
+msgstr "Μέγεθος πεÏιγÏάμματος Κοκάλου"
#: editor/editor_settings.cpp
msgid "Viewport Border Color"
@@ -10857,7 +10848,7 @@ msgstr "ΠÏοηγοÏμενη Δέσμη ΕνεÏγειών"
#: editor/plugins/script_editor_plugin.cpp
#: scene/resources/default_theme/default_theme.cpp
msgid "File"
-msgstr "ΑÏχείο"
+msgstr "Φάκελος"
#: editor/plugins/script_editor_plugin.cpp
msgid "Open..."
@@ -11366,7 +11357,7 @@ msgstr "ΠÏοοπτική"
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
@@ -16732,15 +16723,15 @@ msgstr "ΧÏήση κουμπώματος"
#: main/main.cpp
msgid "Per Pixel Transparency"
-msgstr ""
+msgstr "Διαφάνεια ανα Πίξελ"
#: main/main.cpp
msgid "Allowed"
-msgstr ""
+msgstr "ΕπιτÏεπτό"
#: main/main.cpp
msgid "Intended Usage"
-msgstr ""
+msgstr "ΠÏοβλεπόμενη ΧÏήση"
#: main/main.cpp
#, fuzzy
@@ -16754,7 +16745,7 @@ msgstr "Σφάλμα αποθήκευσης"
#: main/main.cpp
msgid "Threads"
-msgstr ""
+msgstr "Îήματα"
#: main/main.cpp servers/physics_2d/physics_2d_server_wrap_mt.h
#, fuzzy
@@ -16767,7 +16758,7 @@ msgstr ""
#: main/main.cpp
msgid "Handheld"
-msgstr ""
+msgstr "ΧειÏός"
#: main/main.cpp platform/javascript/export/export.cpp
#: platform/uwp/export/export.cpp
@@ -16799,7 +16790,7 @@ msgstr ""
#: scene/gui/scroll_container.cpp scene/gui/text_edit.cpp scene/gui/tree.cpp
#: scene/main/viewport.cpp scene/register_scene_types.cpp
msgid "GUI"
-msgstr ""
+msgstr "ΓÏαφική Διεπαφή ΧÏήσης"
#: main/main.cpp
msgid "Drop Mouse On GUI Input Disabled"
@@ -16811,7 +16802,7 @@ msgstr ""
#: main/main.cpp
msgid "Print FPS"
-msgstr ""
+msgstr "Δείξε ΚαÏέ ανα ΔευτεÏόλεπτο"
#: main/main.cpp
msgid "Verbose stdout"
@@ -16834,7 +16825,7 @@ msgstr "ΚαÏέ Επιλογής"
#: main/main.cpp
msgid "Low Processor Mode"
-msgstr ""
+msgstr "ΛειτουÏγεία Χαμηλής ΧÏήσης ΕπεξεÏγαστή"
#: main/main.cpp
msgid "Delta Sync After Draw"
@@ -16860,7 +16851,7 @@ msgstr "Σημείο"
#: main/main.cpp
msgid "Touch Delay"
-msgstr ""
+msgstr "ΚαθυστέÏηση Επαφής"
#: main/main.cpp servers/visual_server.cpp
msgid "GLES3"
@@ -16884,7 +16875,7 @@ msgstr "Εμφάνιση πεÏιβάλλοντος"
#: main/main.cpp
msgid "Default Clear Color"
-msgstr ""
+msgstr "ΠÏοκαθοÏισμένο ΧÏώμα ΚαθαÏίσματος"
#: main/main.cpp
msgid "Boot Splash"
@@ -16897,11 +16888,11 @@ msgstr "Εμφάνιση Οστών"
#: main/main.cpp
msgid "Image"
-msgstr ""
+msgstr "Εικόνα"
#: main/main.cpp
msgid "Fullsize"
-msgstr ""
+msgstr "ΠλήÏης Μέγεθος"
#: main/main.cpp scene/resources/dynamic_font.cpp
#, fuzzy
@@ -16932,11 +16923,11 @@ msgstr ""
#: main/main.cpp
msgid "Emulate Touch From Mouse"
-msgstr ""
+msgstr "ΠÏοσομοίωση Αφής απο το Ποντίκι"
#: main/main.cpp
msgid "Emulate Mouse From Touch"
-msgstr ""
+msgstr "ΠÏοσομοίωση Î Î¿Î½Ï„Î¹ÎºÎ¹Î¿Ï Î±Ï€Î¿ Αφή"
#: main/main.cpp
#, fuzzy
@@ -16974,11 +16965,11 @@ msgstr "Λήξη χÏÎ¿Î½Î¹ÎºÎ¿Ï Î¿Ïίου."
#: main/main.cpp
msgid "Runtime"
-msgstr ""
+msgstr "ΧÏόνος Εκτέλεσης"
#: main/main.cpp
msgid "Unhandled Exception Policy"
-msgstr ""
+msgstr "Πολιτική μη-χειÏιζόμενων ΕξαίÏεσεων"
#: main/main.cpp
#, fuzzy
@@ -16988,7 +16979,7 @@ msgstr "ΕÏÏεση είδους κόμβου"
#: main/main.cpp scene/gui/texture_progress.cpp
#: scene/gui/viewport_container.cpp
msgid "Stretch"
-msgstr ""
+msgstr "Τέντωμα"
#: main/main.cpp
#, fuzzy
@@ -16997,11 +16988,11 @@ msgstr "ΕπιθεωÏητής"
#: main/main.cpp
msgid "Shrink"
-msgstr ""
+msgstr "Συστολή"
#: main/main.cpp scene/main/scene_tree.cpp
msgid "Auto Accept Quit"
-msgstr ""
+msgstr "Αυτόματη Αποδοχή Εξόδου"
#: main/main.cpp scene/main/scene_tree.cpp
#, fuzzy
@@ -17015,11 +17006,11 @@ msgstr "ΠÏοσκόλληση σε ΠλευÏές Κόμβου"
#: main/main.cpp
msgid "Dynamic Fonts"
-msgstr ""
+msgstr "Δυναμικές ΓÏαμματοσειÏές"
#: main/main.cpp
msgid "Use Oversampling"
-msgstr ""
+msgstr "ΧÏήση ΥπεÏδειγματοληψίας"
#: modules/bullet/register_types.cpp modules/bullet/space_bullet.cpp
msgid "Active Soft World"
@@ -17052,7 +17043,7 @@ msgstr "Επιλογές"
#: modules/csg/csg_shape.cpp
msgid "Calculate Tangents"
-msgstr ""
+msgstr "Υπολογεισμός Καθέτων"
#: modules/csg/csg_shape.cpp
#, fuzzy
@@ -17110,7 +17101,7 @@ msgstr "Εμφάνιση Οδηγιών"
#: modules/csg/csg_shape.cpp
msgid "Cone"
-msgstr ""
+msgstr "Κώνος"
#: modules/csg/csg_shape.cpp
#, fuzzy
@@ -17135,11 +17126,11 @@ msgstr "ΠολÏγωνα"
#: modules/csg/csg_shape.cpp
msgid "Spin Degrees"
-msgstr ""
+msgstr "Βαθμοί ΠεÏιστοφικής Κίνησης"
#: modules/csg/csg_shape.cpp
msgid "Spin Sides"
-msgstr ""
+msgstr "ΠλευÏές ΠεÏιστÏοφικής Κίνησης"
#: modules/csg/csg_shape.cpp
#, fuzzy
@@ -17337,7 +17328,7 @@ msgstr "Δέσμες ΕνεÏγειών"
#: modules/gdscript/editor/gdscript_highlighter.cpp
msgid "Function Definition Color"
-msgstr ""
+msgstr "ΧÏώμα Δήλωσης ΣυνάÏτησης"
#: modules/gdscript/editor/gdscript_highlighter.cpp
#, fuzzy
@@ -17350,7 +17341,7 @@ msgstr ""
#: modules/gdscript/gdscript.cpp
msgid "Treat Warnings As Errors"
-msgstr ""
+msgstr "ΣυμπεÏιφοÏά σε Ï€Ïοειδοποιήσεις ως σφάλματα"
#: modules/gdscript/gdscript.cpp
msgid "Exclude Addons"
@@ -17414,7 +17405,7 @@ msgstr ""
#: modules/gdscript/language_server/gdscript_language_server.cpp
msgid "Use Thread"
-msgstr ""
+msgstr "ΧÏήση Îήματος"
#: modules/gltf/editor_scene_exporter_gltf_plugin.cpp
#, fuzzy
@@ -17639,11 +17630,11 @@ msgstr ""
#: modules/gltf/gltf_spec_gloss.cpp
msgid "Diffuse Factor"
-msgstr ""
+msgstr "Βαθμός Διάχυσης"
#: modules/gltf/gltf_spec_gloss.cpp
msgid "Gloss Factor"
-msgstr ""
+msgstr "Βαθμός Γυαλάδας"
#: modules/gltf/gltf_spec_gloss.cpp
#, fuzzy
@@ -17704,11 +17695,11 @@ msgstr "Δυνατότητες"
#: modules/gltf/gltf_state.cpp platform/uwp/export/export.cpp
msgid "Images"
-msgstr ""
+msgstr "Εικόνες"
#: modules/gltf/gltf_state.cpp
msgid "Cameras"
-msgstr ""
+msgstr "ΚάμεÏες"
#: modules/gltf/gltf_state.cpp servers/visual_server.cpp
#, fuzzy
@@ -17782,7 +17773,7 @@ msgstr "ΚέντÏο"
#: scene/2d/tile_map.cpp scene/3d/collision_object.cpp scene/3d/soft_body.cpp
#: scene/resources/material.cpp
msgid "Mask"
-msgstr ""
+msgstr "Μάσκα"
#: modules/gridmap/grid_map.cpp scene/2d/tile_map.cpp
#, fuzzy
@@ -17932,7 +17923,7 @@ msgstr ""
#: modules/lightmapper_cpu/lightmapper_cpu.cpp
msgid "Preparing data structures"
-msgstr ""
+msgstr "ΠÏοετοιμασία δομών δεδομένων"
#: modules/lightmapper_cpu/lightmapper_cpu.cpp
#, fuzzy
@@ -17966,19 +17957,19 @@ msgstr "ΠÏοετοιμασία Lightmaps"
#: modules/lightmapper_cpu/register_types.cpp
msgid "Low Quality Ray Count"
-msgstr ""
+msgstr "ΑÏιθμός Ακτινών Χαμηλής Ποιότητας"
#: modules/lightmapper_cpu/register_types.cpp
msgid "Medium Quality Ray Count"
-msgstr ""
+msgstr "ΑÏιθμός Ακτινών ΜέτÏιας Ποιότητας"
#: modules/lightmapper_cpu/register_types.cpp
msgid "High Quality Ray Count"
-msgstr ""
+msgstr "ΑÏιθμός Ακτινών Υψηλής Ποιότητας"
#: modules/lightmapper_cpu/register_types.cpp
msgid "Ultra Quality Ray Count"
-msgstr ""
+msgstr "ΑÏιθμός Ακτινών Ύψιστης Ποιότητας"
#: modules/minimp3/audio_stream_mp3.cpp
#: modules/minimp3/resource_importer_mp3.cpp
@@ -17990,7 +17981,7 @@ msgstr "Μετατόπιση:"
#: modules/mobile_vr/mobile_vr_interface.cpp
msgid "Eye Height"
-msgstr ""
+msgstr "Ύψος Ματιών"
#: modules/mobile_vr/mobile_vr_interface.cpp
msgid "IOD"
@@ -18133,7 +18124,7 @@ msgstr ""
#: modules/opensimplex/noise_texture.cpp
msgid "Noise"
-msgstr ""
+msgstr "ΘόÏυβος"
#: modules/opensimplex/noise_texture.cpp
#, fuzzy
@@ -18142,11 +18133,11 @@ msgstr "Μετατόπιση Πλέγματος:"
#: modules/opensimplex/open_simplex_noise.cpp
msgid "Octaves"
-msgstr ""
+msgstr "Οκτάβες"
#: modules/opensimplex/open_simplex_noise.cpp
msgid "Period"
-msgstr ""
+msgstr "ΠεÏίοδος"
#: modules/opensimplex/open_simplex_noise.cpp
#, fuzzy
@@ -18155,7 +18146,7 @@ msgstr "ΠÏοοπτική"
#: modules/opensimplex/open_simplex_noise.cpp
msgid "Lacunarity"
-msgstr ""
+msgstr "Κενότητα"
#: modules/regex/regex.cpp
msgid "Subject"
@@ -18177,7 +18168,7 @@ msgstr ""
#: modules/upnp/upnp.cpp
msgid "Discover Local Port"
-msgstr ""
+msgstr "ΕÏÏεση Τοπικής ΘÏÏας"
#: modules/upnp/upnp.cpp
msgid "Discover IPv6"
@@ -18740,26 +18731,24 @@ msgid "Mod %s"
msgstr "ΠÏόσθεσε %s"
#: modules/visual_script/visual_script_func_nodes.cpp
-#, fuzzy
msgid "ShiftLeft %s"
-msgstr "Θέσε %s"
+msgstr "ΑÏιστεÏή μετατόπιση %s"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "ShiftRight %s"
-msgstr ""
+msgstr "Δεξιά μετατόπιση %s"
#: modules/visual_script/visual_script_func_nodes.cpp
-#, fuzzy
msgid "BitAnd %s"
-msgstr "ΠÏόσθεσε %s"
+msgstr "Λογικό Και %s"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "BitOr %s"
-msgstr ""
+msgstr "ΛογικόΗ %s"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "BitXor %s"
-msgstr ""
+msgstr "Î›Î¿Î³Î¹ÎºÏŒÎžÎ¿Ï %s"
#: modules/visual_script/visual_script_func_nodes.cpp
#, fuzzy
@@ -18895,9 +18884,8 @@ msgid "Get Self"
msgstr "Εαυτός"
#: modules/visual_script/visual_script_nodes.cpp
-#, fuzzy
msgid "CustomNode"
-msgstr "Αποκοπή κόμβων"
+msgstr ""
#: modules/visual_script/visual_script_nodes.cpp
msgid "Custom node has no _step() method, can't process graph."
@@ -18955,7 +18943,7 @@ msgstr "εσοδεία"
#: modules/visual_script/visual_script_yield_nodes.cpp
msgid "Wait"
-msgstr ""
+msgstr "ΠεÏίμενε"
#: modules/visual_script/visual_script_yield_nodes.cpp
#, fuzzy
@@ -19605,10 +19593,11 @@ msgstr ""
#: platform/android/export/export_plugin.cpp
msgid "Invalid filename! Android APK requires the *.apk extension."
msgstr ""
+"Μή ΈγκυÏο όνομα αÏχείου! Το Android APK δέχεται μόνο την .apk κατάληξη."
#: platform/android/export/export_plugin.cpp
msgid "Unsupported export format!"
-msgstr ""
+msgstr "Μη αποδεκτή μοÏφή εξαγωγής!"
#: platform/android/export/export_plugin.cpp
msgid ""
@@ -19661,7 +19650,7 @@ msgstr ""
#: platform/android/export/export_plugin.cpp
msgid "Moving output"
-msgstr ""
+msgstr "Μετακίνηση της εξόδου"
#: platform/android/export/export_plugin.cpp
msgid ""
@@ -21362,7 +21351,7 @@ msgstr "ΣυμπλήÏωση"
#: scene/2d/canvas_item.cpp
msgid "Show Behind Parent"
-msgstr ""
+msgstr "Δείξε πίσω απο τον Γωνέα"
#: scene/2d/canvas_item.cpp
#, fuzzy
@@ -21377,7 +21366,7 @@ msgstr "Φως"
#: scene/2d/canvas_item.cpp
msgid "Use Parent Material"
-msgstr ""
+msgstr "ΧÏησιμποίησε το Υλικό του Γονέα"
#: scene/2d/canvas_modulate.cpp
msgid ""
@@ -21422,6 +21411,8 @@ msgstr "Ένα άδειο ColisionPollygon2D δεν επηÏεάζει τη σÏ
#: scene/2d/collision_polygon_2d.cpp
msgid "Invalid polygon. At least 3 points are needed in 'Solids' build mode."
msgstr ""
+"Μή έγκυÏο πολÏγωνο. ΠÏέπει να Ï€ÏοσδιοÏιστοÏν τουλάχιστον Ï„Ïία (3) σημεία για "
+"τη δημιουÏγία στεÏÎµÎ¿Ï Î±Î½Ï„Î¹ÎºÎµÎ¹Î¼Î­Î½Î¿Ï…."
#: scene/2d/collision_polygon_2d.cpp
msgid "Invalid polygon. At least 2 points are needed in 'Segments' build mode."
@@ -21499,7 +21490,7 @@ msgstr "Ρυθμίσεις:"
#: scene/2d/cpu_particles_2d.cpp scene/2d/particles_2d.cpp
#: scene/3d/cpu_particles.cpp scene/3d/particles.cpp
msgid "Lifetime"
-msgstr ""
+msgstr "ΔιάÏκεια Ζωής"
#: scene/2d/cpu_particles_2d.cpp scene/2d/particles_2d.cpp
#: scene/3d/cpu_particles.cpp scene/3d/particles.cpp scene/main/timer.cpp
@@ -21516,7 +21507,7 @@ msgstr "ΜετεπεξεÏγασία"
#: scene/2d/cpu_particles_2d.cpp scene/2d/particles_2d.cpp
#: scene/3d/cpu_particles.cpp scene/3d/particles.cpp
msgid "Explosiveness"
-msgstr ""
+msgstr "ΕκÏηκτικότητα"
#: scene/2d/cpu_particles_2d.cpp scene/2d/particles_2d.cpp
#: scene/3d/cpu_particles.cpp scene/3d/particles.cpp
@@ -21527,7 +21518,7 @@ msgstr "Τυχαία επανεκκίνηση (δευτεÏόλεπτα):"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp
#: scene/resources/particles_material.cpp
msgid "Lifetime Randomness"
-msgstr ""
+msgstr "Τυχαιότητα ΔιάÏκειας Ζωής"
#: scene/2d/cpu_particles_2d.cpp scene/2d/particles_2d.cpp
#: scene/3d/cpu_particles.cpp scene/3d/particles.cpp
@@ -21543,7 +21534,7 @@ msgstr ""
#: scene/2d/cpu_particles_2d.cpp scene/2d/particles_2d.cpp
#: scene/3d/cpu_particles.cpp scene/3d/particles.cpp
msgid "Drawing"
-msgstr ""
+msgstr "Σχεδίαση"
#: scene/2d/cpu_particles_2d.cpp scene/2d/particles_2d.cpp
#: scene/3d/cpu_particles.cpp scene/3d/particles.cpp
@@ -21554,7 +21545,7 @@ msgstr "ΈÏγα"
#: scene/2d/cpu_particles_2d.cpp scene/2d/particles_2d.cpp
#: scene/3d/cpu_particles.cpp scene/3d/particles.cpp
msgid "Draw Order"
-msgstr ""
+msgstr "ΣειÏά Σχεδίασης"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp
#: scene/resources/particles_material.cpp
@@ -21594,7 +21585,7 @@ msgstr "Κατευθήνσεις"
#: scene/resources/particles_material.cpp
#: servers/audio/effects/audio_effect_reverb.cpp
msgid "Spread"
-msgstr ""
+msgstr "ΕÏÏος"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp
#: scene/resources/particles_material.cpp
@@ -21612,7 +21603,7 @@ msgstr "ΑÏχικοποιήστε"
#: scene/resources/particles_material.cpp servers/physics_2d_server.cpp
#: servers/physics_server.cpp
msgid "Angular Velocity"
-msgstr ""
+msgstr "Γωνιακή ταχÏτητα"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp
#: scene/resources/particles_material.cpp
@@ -21623,7 +21614,7 @@ msgstr "ΑÏχικοποιήστε"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp
#: scene/resources/particles_material.cpp
msgid "Orbit Velocity"
-msgstr ""
+msgstr "ΤÏοχιακή ταχÏτητα"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp
#: scene/resources/particles_material.cpp
@@ -21651,12 +21642,12 @@ msgstr "ΔιαίÏεση ΚαμπÏλης"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp
#: scene/resources/particles_material.cpp
msgid "Radial Accel"
-msgstr ""
+msgstr "ΤÏοχιακή επιτάχυνση"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp
#: scene/resources/particles_material.cpp
msgid "Tangential Accel"
-msgstr ""
+msgstr "Γωνιακή επιτάχυνση"
#: scene/2d/cpu_particles_2d.cpp scene/2d/joints_2d.cpp
#: scene/3d/cpu_particles.cpp scene/3d/physics_body.cpp
@@ -21664,12 +21655,12 @@ msgstr ""
#: scene/resources/particles_material.cpp
#: servers/audio/effects/audio_effect_reverb.cpp
msgid "Damping"
-msgstr ""
+msgstr "Απόσβεση"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp
#: scene/resources/particles_material.cpp
msgid "Damping Random"
-msgstr ""
+msgstr "Τυχαιότητα Απόσβεσης"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp
#: scene/resources/particles_material.cpp
@@ -21680,12 +21671,12 @@ msgstr "ΔιαίÏεση ΚαμπÏλης"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp scene/3d/light.cpp
#: scene/resources/particles_material.cpp
msgid "Angle"
-msgstr ""
+msgstr "Γωνία"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp
#: scene/resources/particles_material.cpp
msgid "Angle Random"
-msgstr ""
+msgstr "Τυχαιότητα Γωνίας"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp
#: scene/resources/particles_material.cpp
@@ -21700,7 +21691,7 @@ msgstr "Ποσότητα:"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp
msgid "Scale Amount Random"
-msgstr ""
+msgstr "Τυχαιότητα ΠοσoÏ ÎšÎ»Î¹Î¼Î¬ÎºÏ‰ÏƒÎ·Ï‚"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp
#, fuzzy
@@ -21768,15 +21759,15 @@ msgstr "κλείσιμο καμπÏλης"
#: scene/2d/joints_2d.cpp
msgid "Node A and Node B must be PhysicsBody2Ds"
-msgstr ""
+msgstr "Ο Κόμβος Α και ο Κόμβος Î’ Ï€Ïέπει να είναι του Ï„Ïπου PhysicsBody2Ds"
#: scene/2d/joints_2d.cpp
msgid "Node A must be a PhysicsBody2D"
-msgstr ""
+msgstr "Ο Κόμβος Α Ï€Ïέπει να είναι του Ï„Ïπου PhysicsBody2D"
#: scene/2d/joints_2d.cpp
msgid "Node B must be a PhysicsBody2D"
-msgstr ""
+msgstr "Ο κόμβος Î’ Ï€Ïέπει να είναι του Ï„Ïπου PhysicsBody2D"
#: scene/2d/joints_2d.cpp
msgid "Joint is not connected to two PhysicsBody2Ds"
@@ -22206,7 +22197,7 @@ msgstr "ΛειτουÏγία ΠÏοτεÏαιότητας"
#: scene/2d/particles_2d.cpp scene/3d/particles.cpp
msgid "Process Material"
-msgstr ""
+msgstr "ΕπεξεÏγασία ΥλικοÏ"
#: scene/2d/path_2d.cpp scene/3d/path.cpp scene/resources/sky.cpp
#: scene/resources/texture.cpp
@@ -22269,7 +22260,7 @@ msgstr ""
#: scene/2d/physics_body_2d.cpp scene/3d/physics_body.cpp
msgid "Physics Material Override"
-msgstr ""
+msgstr "ΠαÏάκαμψη Î¥Î»Î¹ÎºÎ¿Ï Î¦Ï…ÏƒÎ¹ÎºÎ®Ï‚"
#: scene/2d/physics_body_2d.cpp scene/3d/physics_body.cpp
#: scene/resources/world.cpp scene/resources/world_2d.cpp
@@ -22460,11 +22451,11 @@ msgstr ""
#: scene/2d/ray_cast_2d.cpp scene/3d/camera.cpp scene/3d/ray_cast.cpp
msgid "Areas"
-msgstr ""
+msgstr "Τοποθεσίες"
#: scene/2d/ray_cast_2d.cpp scene/3d/camera.cpp scene/3d/ray_cast.cpp
msgid "Bodies"
-msgstr ""
+msgstr "Σώματα"
#: scene/2d/remote_transform_2d.cpp
msgid "Path property must point to a valid Node2D node to work."
@@ -22511,11 +22502,11 @@ msgstr ""
#: scene/2d/sprite.cpp scene/3d/sprite_3d.cpp
msgid "Hframes"
-msgstr ""
+msgstr "ΟÏιζόντια ΚαÏέ"
#: scene/2d/sprite.cpp scene/3d/sprite_3d.cpp
msgid "Vframes"
-msgstr ""
+msgstr "Κάθετα ΚαÏέ"
#: scene/2d/sprite.cpp scene/3d/sprite_3d.cpp
#, fuzzy
@@ -22594,7 +22585,7 @@ msgstr "ΛειτουÏγία ΣÏγκÏουσης"
#: scene/2d/tile_map.cpp
msgid "Use Kinematic"
-msgstr ""
+msgstr "ΧÏήση ΚινηματικοÏ"
#: scene/2d/touch_screen_button.cpp
#, fuzzy
@@ -22630,7 +22621,7 @@ msgstr "Επικόλληση κίνησης"
#: scene/2d/visibility_notifier_2d.cpp scene/3d/visibility_notifier.cpp
msgid "Freeze Bodies"
-msgstr ""
+msgstr "Πάγωμα Σωμάτων"
#: scene/2d/visibility_notifier_2d.cpp
#, fuzzy
@@ -22666,11 +22657,11 @@ msgstr "Η ARVRCamera απαιτεί γονικό κόμβο ARVROrigin."
#: scene/3d/arvr_nodes.cpp
msgid "Controller ID"
-msgstr ""
+msgstr "ΑναγνωÏηστικό ΧειÏιστηÏίου"
#: scene/3d/arvr_nodes.cpp servers/arvr/arvr_positional_tracker.cpp
msgid "Rumble"
-msgstr ""
+msgstr "Δώνηση"
#: scene/3d/arvr_nodes.cpp
msgid "ARVRController must have an ARVROrigin node as its parent."
@@ -22729,7 +22720,7 @@ msgstr ""
#: scene/3d/audio_stream_player_3d.cpp
msgid "Out Of Range Mode"
-msgstr ""
+msgstr "ΑπομακÏισμένη ΛειτουÏγεία"
#: scene/3d/audio_stream_player_3d.cpp
#, fuzzy
@@ -22748,7 +22739,7 @@ msgstr "Κίνηση"
#: scene/3d/audio_stream_player_3d.cpp
msgid "Attenuation Filter"
-msgstr ""
+msgstr "ΦίλτÏο Απόσβεσης"
#: scene/3d/audio_stream_player_3d.cpp
#: servers/audio/effects/audio_effect_chorus.cpp
@@ -22775,11 +22766,11 @@ msgstr "ΠακετάÏισμα"
#: scene/3d/baked_lightmap.cpp scene/3d/gi_probe.cpp
#: scene/3d/reflection_probe.cpp
msgid "Interior"
-msgstr ""
+msgstr "ΕσωτεÏικό"
#: scene/3d/baked_lightmap.cpp
msgid "Finding meshes and lights"
-msgstr ""
+msgstr "Î’Ïίσκοντας πλέγματα και φώτα"
#: scene/3d/baked_lightmap.cpp
msgid "Preparing geometry (%d/%d)"
@@ -22813,11 +22804,11 @@ msgstr "ΜαÏαφέτια"
#: scene/3d/baked_lightmap.cpp
msgid "Tweaks"
-msgstr ""
+msgstr "ΜικÏοδιοÏθώσεις"
#: scene/3d/baked_lightmap.cpp
msgid "Bounces"
-msgstr ""
+msgstr "Πηδήματα"
#: scene/3d/baked_lightmap.cpp
msgid "Bounce Indirect Energy"
@@ -22907,7 +22898,7 @@ msgstr ""
#: scene/3d/camera.cpp scene/3d/light.cpp scene/3d/reflection_probe.cpp
msgid "Cull Mask"
-msgstr ""
+msgstr "Μάσκα Αποκοπής"
#: scene/3d/camera.cpp
#, fuzzy
@@ -22921,7 +22912,7 @@ msgstr "ΈÏγο"
#: scene/3d/camera.cpp
msgid "FOV"
-msgstr ""
+msgstr "Οπτικό Πεδίο"
#: scene/3d/camera.cpp
#, fuzzy
@@ -22935,7 +22926,7 @@ msgstr "ΠλησιέστεÏη"
#: scene/3d/camera.cpp
msgid "Far"
-msgstr ""
+msgstr "ΜακÏιά"
#: scene/3d/camera.cpp scene/3d/collision_polygon.cpp scene/3d/spring_arm.cpp
#: scene/gui/control.cpp scene/resources/default_theme/default_theme.cpp
@@ -22952,7 +22943,7 @@ msgstr "ΠεÏικοπή πάνω"
#: scene/3d/collision_object.cpp scene/3d/soft_body.cpp
msgid "Ray Pickable"
-msgstr ""
+msgstr "Επιλέξημη Ακτίνα"
#: scene/3d/collision_object.cpp
#, fuzzy
@@ -23068,7 +23059,7 @@ msgstr "ΑπενεÏγοποιημένο Στοιχείο"
#: scene/3d/cpu_particles.cpp scene/resources/particles_material.cpp
msgid "Flatness"
-msgstr ""
+msgstr "Ομαλότητα"
#: scene/3d/cull_instance.cpp servers/visual_server.cpp
#, fuzzy
@@ -23086,7 +23077,7 @@ msgstr ""
#: scene/3d/cull_instance.cpp
msgid "Allow Merging"
-msgstr ""
+msgstr "ΕπίτÏεψε Συγχώνευση"
#: scene/3d/cull_instance.cpp
#, fuzzy
@@ -23118,7 +23109,7 @@ msgstr ""
#: scene/3d/gi_probe.cpp
msgid "Subdiv"
-msgstr ""
+msgstr "ΥποδιαίÏεση"
#: scene/3d/gi_probe.cpp
#, fuzzy
@@ -23137,7 +23128,7 @@ msgstr "ΚοÏμπωμα στα εικονοστοιχεία"
#: scene/3d/label_3d.cpp scene/3d/sprite_3d.cpp
msgid "Billboard"
-msgstr ""
+msgstr "Πινακίδα"
#: scene/3d/label_3d.cpp scene/3d/sprite_3d.cpp
#, fuzzy
@@ -23146,11 +23137,11 @@ msgstr "ΠÏόγÏαμμα Σκίασης"
#: scene/3d/label_3d.cpp scene/3d/sprite_3d.cpp
msgid "Double Sided"
-msgstr ""
+msgstr "ΔÏο Όψεων"
#: scene/3d/label_3d.cpp scene/3d/sprite_3d.cpp scene/resources/material.cpp
msgid "No Depth Test"
-msgstr ""
+msgstr "ΧωÏίς Έλεγχο Βάθους"
#: scene/3d/label_3d.cpp scene/3d/sprite_3d.cpp scene/resources/material.cpp
#, fuzzy
@@ -23289,7 +23280,7 @@ msgstr ""
#: scene/3d/light.cpp
msgid "Spot"
-msgstr ""
+msgstr "ΠÏοβολέας"
#: scene/3d/light.cpp
#, fuzzy
@@ -23349,7 +23340,7 @@ msgstr ""
#: scene/3d/occluder.cpp
msgid "No shape is set."
-msgstr ""
+msgstr "Δεν έχει επιλεχθεί Σχήμα."
#: scene/3d/occluder.cpp
msgid "Only uniform scales are supported."
@@ -23452,15 +23443,15 @@ msgstr "ΓÏαμμική"
#: scene/3d/physics_body.cpp
msgid "Angular X"
-msgstr ""
+msgstr "Γωνιώδης Χ"
#: scene/3d/physics_body.cpp
msgid "Angular Y"
-msgstr ""
+msgstr "Γωνιώδης Υ"
#: scene/3d/physics_body.cpp
msgid "Angular Z"
-msgstr ""
+msgstr "Γωνιώδης Ζ"
#: scene/3d/physics_body.cpp
#, fuzzy
@@ -23568,15 +23559,15 @@ msgstr "Κίνηση"
#: scene/3d/physics_body.cpp
msgid "X"
-msgstr ""
+msgstr "Χ"
#: scene/3d/physics_body.cpp
msgid "Y"
-msgstr ""
+msgstr "Î¥"
#: scene/3d/physics_body.cpp
msgid "Z"
-msgstr ""
+msgstr "Ζ"
#: scene/3d/physics_body.cpp
#, fuzzy
@@ -23685,7 +23676,7 @@ msgstr "Αλλαγη ΠαÏαμέτÏου"
#: scene/3d/physics_joint.cpp
msgid "Angular Limit"
-msgstr ""
+msgstr "Γωνιώδης ÎÏιο"
#: scene/3d/physics_joint.cpp
#, fuzzy
@@ -23699,7 +23690,7 @@ msgstr "Πεζά"
#: scene/3d/physics_joint.cpp
msgid "Motor"
-msgstr ""
+msgstr "ΜοτέÏ"
#: scene/3d/physics_joint.cpp
#, fuzzy
@@ -23783,19 +23774,19 @@ msgstr "ΓÏαμμική"
#: scene/3d/physics_joint.cpp
msgid "Equilibrium Point"
-msgstr ""
+msgstr "ΜέÏος ΙσοÏÏοπείας"
#: scene/3d/physics_joint.cpp
msgid "Angular Limit X"
-msgstr ""
+msgstr "Γωνιώδης ÎÏιο Χ"
#: scene/3d/physics_joint.cpp
msgid "Angular Motor X"
-msgstr ""
+msgstr "Γωνιώδης ÎœÎ¿Ï„Î­Ï Î§"
#: scene/3d/physics_joint.cpp
msgid "Angular Spring X"
-msgstr ""
+msgstr "Γωνιώδης ΕλατήÏιο Χ"
#: scene/3d/physics_joint.cpp
#, fuzzy
@@ -23814,15 +23805,15 @@ msgstr "ΓÏαμμική"
#: scene/3d/physics_joint.cpp
msgid "Angular Limit Y"
-msgstr ""
+msgstr "Γωνιώδης ÎÏιο Î¥"
#: scene/3d/physics_joint.cpp
msgid "Angular Motor Y"
-msgstr ""
+msgstr "Γωνιώδης ÎœÎ¿Ï„Î­Ï Î¥"
#: scene/3d/physics_joint.cpp
msgid "Angular Spring Y"
-msgstr ""
+msgstr "Γωνιώδης ΕλατήÏιο Î¥"
#: scene/3d/physics_joint.cpp
#, fuzzy
@@ -23841,15 +23832,15 @@ msgstr "ΓÏαμμική"
#: scene/3d/physics_joint.cpp
msgid "Angular Limit Z"
-msgstr ""
+msgstr "Γωνιώδης ÎÏιο Ζ"
#: scene/3d/physics_joint.cpp
msgid "Angular Motor Z"
-msgstr ""
+msgstr "Γωνιώδης ÎœÎ¿Ï„Î­Ï Î–"
#: scene/3d/physics_joint.cpp
msgid "Angular Spring Z"
-msgstr ""
+msgstr "Γωνιώδης ΕλατήÏιο Ζ"
#: scene/3d/portal.cpp
msgid "The RoomManager should not be a child or grandchild of a Portal."
@@ -23870,7 +23861,7 @@ msgstr "ΕπιστÏοφή"
#: scene/3d/portal.cpp scene/resources/occluder_shape_polygon.cpp
msgid "Two Way"
-msgstr ""
+msgstr "Διπλής ΚατεÏθυνσης"
#: scene/3d/portal.cpp
#, fuzzy
@@ -23903,7 +23894,7 @@ msgstr "Αποσφαλματωτής"
#: scene/3d/ray_cast.cpp scene/resources/style_box.cpp
msgid "Thickness"
-msgstr ""
+msgstr "Πάχος"
#: scene/3d/reflection_probe.cpp scene/main/viewport.cpp
#, fuzzy
@@ -23950,7 +23941,7 @@ msgstr ""
#: scene/3d/room.cpp
msgid "A Room cannot have another Room as a child or grandchild."
-msgstr ""
+msgstr "Ενα δωμάτιο δεν μποÏεί να έχει άλλο δωμάτιο ως παιδί ή εγγόνι."
#: scene/3d/room.cpp
msgid "The RoomManager should not be placed inside a Room."
@@ -23976,7 +23967,7 @@ msgstr ""
#: scene/3d/room.cpp
msgid "Bound"
-msgstr ""
+msgstr "ÎŒÏιο"
#: scene/3d/room_group.cpp
#, fuzzy
@@ -24019,7 +24010,7 @@ msgstr "ΕνέÏγεια"
#: scene/3d/room_manager.cpp
msgid "Roomlist"
-msgstr ""
+msgstr "Λίστα Δωματίων"
#: scene/3d/room_manager.cpp servers/visual_server.cpp
#, fuzzy
@@ -24038,7 +24029,7 @@ msgstr "ΑÏχείο ZIP"
#: scene/3d/room_manager.cpp servers/visual_server.cpp
msgid "Gameplay"
-msgstr ""
+msgstr "Παιχνίδι"
#: scene/3d/room_manager.cpp
#, fuzzy
@@ -25147,7 +25138,7 @@ msgstr ""
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
msgid "Caret"
-msgstr ""
+msgstr "ΚαÏέ"
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
msgid "Blink"
@@ -26123,7 +26114,7 @@ msgstr ""
#: scene/resources/default_theme/default_theme.cpp
msgid "Panel"
-msgstr ""
+msgstr "Πλαίσιο"
#: scene/resources/default_theme/default_theme.cpp
#, fuzzy
@@ -26162,7 +26153,7 @@ msgstr "Επανάληψη κίνησης"
#: scene/resources/default_theme/default_theme.cpp
msgid "Arrow"
-msgstr ""
+msgstr "Βέλος"
#: scene/resources/default_theme/default_theme.cpp
#, fuzzy
@@ -27148,7 +27139,7 @@ msgstr "Αποσφαλμάτωση ÎšÎ±Î½Î±Î»Î¹Î¿Ï UV"
#: scene/resources/environment.cpp
msgid "Blur"
-msgstr ""
+msgstr "Θόλωση"
#: scene/resources/environment.cpp
msgid "Edge Sharpness"
@@ -27770,7 +27761,7 @@ msgstr ""
#: scene/resources/physics_material.cpp
msgid "Absorbent"
-msgstr ""
+msgstr "ΑποÏÏοφητικός"
#: scene/resources/plane_shape.cpp
#, fuzzy
@@ -27815,7 +27806,7 @@ msgstr "Πάνω Δεξιά"
#: scene/resources/primitive_meshes.cpp
msgid "Is Hemisphere"
-msgstr ""
+msgstr "Είναι ΗμισφαίÏιο"
#: scene/resources/primitive_meshes.cpp
#, fuzzy
@@ -27824,11 +27815,11 @@ msgstr "ΔιαίÏεση ΚαμπÏλης"
#: scene/resources/ray_shape.cpp scene/resources/segment_shape_2d.cpp
msgid "Slips On Slope"
-msgstr ""
+msgstr "ΓλυστÏάει σε Κλίση"
#: scene/resources/segment_shape_2d.cpp
msgid "A"
-msgstr ""
+msgstr "Α"
#: scene/resources/shape_2d.cpp
msgid "Custom Solver Bias"
@@ -27856,7 +27847,7 @@ msgstr "Μέγεθος πεÏιγÏάμματος:"
#: scene/resources/sky.cpp
msgid "Panorama"
-msgstr ""
+msgstr "ΠανόÏαμα"
#: scene/resources/sky.cpp
#, fuzzy
@@ -27890,15 +27881,15 @@ msgstr "Αντικατάσταση"
#: scene/resources/sky.cpp
msgid "Longitude"
-msgstr ""
+msgstr "ΓεωγÏαφικό Μήκος"
#: scene/resources/sky.cpp
msgid "Angle Min"
-msgstr ""
+msgstr "Ελάχιστη Γωνία"
#: scene/resources/sky.cpp
msgid "Angle Max"
-msgstr ""
+msgstr "Μέγιστη Γωνία"
#: scene/resources/style_box.cpp
#, fuzzy
@@ -27912,7 +27903,7 @@ msgstr "Ανάπτυξη Όλων"
#: scene/resources/style_box.cpp
msgid "Skew"
-msgstr ""
+msgstr "Λοξότητα"
#: scene/resources/style_box.cpp
#, fuzzy
@@ -27921,7 +27912,7 @@ msgstr "Αλλαγή ΕσωτεÏική Ακτίνας ΤόÏου"
#: scene/resources/style_box.cpp
msgid "Corner Detail"
-msgstr ""
+msgstr "ΛεπτομέÏεια Γωνίας"
#: scene/resources/style_box.cpp
msgid "Anti Aliasing"
@@ -28024,9 +28015,8 @@ msgid "Depth Draw"
msgstr "Μέθοδος παÏεμβολής"
#: scene/resources/visual_shader.cpp
-#, fuzzy
msgid "Cull"
-msgstr "ΛειτουÏγία ΧάÏακα"
+msgstr "Αποκοπή"
#: scene/resources/visual_shader.cpp
#, fuzzy
@@ -28260,11 +28250,11 @@ msgstr ""
#: servers/audio/effects/audio_effect_delay.cpp
msgid "Tap 1"
-msgstr ""
+msgstr "Πάτησε 1"
#: servers/audio/effects/audio_effect_delay.cpp
msgid "Tap 2"
-msgstr ""
+msgstr "Πάτησε 2"
#: servers/audio/effects/audio_effect_delay.cpp
#: servers/audio/effects/audio_effect_phaser.cpp
@@ -28326,7 +28316,7 @@ msgstr ""
#: servers/audio/effects/audio_effect_pitch_shift.cpp
msgid "Oversampling"
-msgstr ""
+msgstr "ΥπεÏδειγματοληψία"
#: servers/audio/effects/audio_effect_pitch_shift.cpp
#: servers/audio/effects/audio_effect_spectrum_analyzer.cpp
diff --git a/editor/translations/en_Shaw.po b/editor/translations/en_Shaw.po
index 60caed0d9d..16e474d82d 100644
--- a/editor/translations/en_Shaw.po
+++ b/editor/translations/en_Shaw.po
@@ -10615,7 +10615,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/eo.po b/editor/translations/eo.po
index 04205e10d6..4ed8103686 100644
--- a/editor/translations/eo.po
+++ b/editor/translations/eo.po
@@ -11199,7 +11199,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/es.po b/editor/translations/es.po
index 5d683058c3..9e1868e4f9 100644
--- a/editor/translations/es.po
+++ b/editor/translations/es.po
@@ -14,7 +14,7 @@
# Diego López <diegodario21@gmail.com>, 2017.
# eon-s <emanuel.segretin@gmail.com>, 2018, 2019, 2020.
# Gustavo Leon <gleondiaz@gmail.com>, 2017-2018.
-# Javier Ocampos <xavier.ocampos@gmail.com>, 2018, 2019, 2020, 2021, 2022.
+# Javier Ocampos <xavier.ocampos@gmail.com>, 2018, 2019, 2020, 2021, 2022, 2023.
# Jose Maria Martinez <josemar1992@hotmail.com>, 2018.
# Juan Quiroga <juanquiroga9@gmail.com>, 2017.
# Kiji Pixel <raccoon.fella@gmail.com>, 2017.
@@ -90,14 +90,15 @@
# M3CG <cgmario1999@gmail.com>, 2022.
# Chalan <Valentin06ch@outlook.com>, 2022.
# Luis Miguel Soto Sánchez <luismiguelsoto@jerez.es>, 2022.
-# Victor Stancioiu <victorstancioiu@gmail.com>, 2022.
+# Victor Stancioiu <victorstancioiu@gmail.com>, 2022, 2023.
+# Daniel Miranda <danmiranda@gmail.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-11-16 22:47+0000\n"
-"Last-Translator: Javier Ocampos <xavier.ocampos@gmail.com>\n"
+"PO-Revision-Date: 2023-01-20 10:19+0000\n"
+"Last-Translator: Daniel Miranda <danmiranda@gmail.com>\n"
"Language-Team: Spanish <https://hosted.weblate.org/projects/godot-engine/"
"godot/es/>\n"
"Language: es\n"
@@ -105,7 +106,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 4.15-dev\n"
+"X-Generator: Weblate 4.15.1\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -11041,7 +11042,7 @@ msgstr "Perspectiva Trasera"
msgid " [auto]"
msgstr " [auto]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [portales activos]"
@@ -14308,17 +14309,15 @@ msgid "Invalid project path (changed anything?)."
msgstr "La ruta del proyecto no es correcta (¿has cambiado algo?)."
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project at '%s' (error %d). It may be missing or corrupted."
msgstr ""
-"No se pudo cargar project.godot desde la ruta de proyecto (error %d). La "
-"ruta no existe o está corrupta."
+"No se pudo cargar el proyecto desde la ruta '%s' (error %d). La ruta no "
+"existe o está corrupta."
#: editor/project_manager.cpp
-#, fuzzy
msgid "Couldn't save project at '%s' (error %d)."
-msgstr "No se puede abrir el proyecto en '%s'."
+msgstr "No se pudo guardar el proyecto en '%s' (error %d)."
#: editor/project_manager.cpp
msgid "Couldn't create project.godot in project path."
@@ -22304,7 +22303,7 @@ msgstr ""
#: scene/3d/mesh_instance.cpp
msgid "Transform Normals"
-msgstr "Transformar Normales"
+msgstr "Normales de Transformación"
#: scene/3d/navigation.cpp
msgid ""
@@ -23243,14 +23242,12 @@ msgid "AABB"
msgstr "AABB"
#: scene/3d/visual_instance.cpp
-#, fuzzy
msgid "Sorting"
msgstr "Ordenar"
#: scene/3d/visual_instance.cpp
-#, fuzzy
msgid "Use AABB Center"
-msgstr "Usar Ambiente"
+msgstr "Usar Centro de AABB"
#: scene/3d/visual_instance.cpp scene/resources/navigation_mesh.cpp
msgid "Geometry"
@@ -25064,7 +25061,7 @@ msgstr "Marcar"
#: scene/resources/default_theme/default_theme.cpp
msgid "Updown"
-msgstr ""
+msgstr "Reducción"
#: scene/resources/default_theme/default_theme.cpp
msgid "Scaleborder Size"
@@ -25544,11 +25541,11 @@ msgstr "Grados de Rotación del Cielo"
#: scene/resources/environment.cpp
msgid "Canvas Max Layer"
-msgstr ""
+msgstr "Max de Capas del Lienzo"
#: scene/resources/environment.cpp scene/resources/texture.cpp
msgid "Camera Feed ID"
-msgstr ""
+msgstr "Feed ID de la Cámara"
#: scene/resources/environment.cpp
msgid "Ambient Light"
@@ -25688,7 +25685,7 @@ msgstr "Nitidez de Borde"
#: scene/resources/environment.cpp
msgid "DOF Far Blur"
-msgstr ""
+msgstr "DOF Desenfoque Lejano"
#: scene/resources/environment.cpp scene/resources/material.cpp
msgid "Distance"
@@ -25700,7 +25697,7 @@ msgstr "Transición"
#: scene/resources/environment.cpp
msgid "DOF Near Blur"
-msgstr ""
+msgstr "DOF Desenfoque Cercano"
#: scene/resources/environment.cpp
msgid "Glow"
@@ -25760,7 +25757,7 @@ msgstr "Escala HDR"
#: scene/resources/environment.cpp
msgid "Bicubic Upscale"
-msgstr ""
+msgstr "Escala Bicúbica Superior"
#: scene/resources/environment.cpp
msgid "Adjustments"
@@ -25816,7 +25813,7 @@ msgstr "Siguiente Paso"
#: scene/resources/material.cpp
msgid "Use Shadow To Opacity"
-msgstr ""
+msgstr "Usar Sombra para Opacidad"
#: scene/resources/material.cpp
msgid "Unshaded"
@@ -26655,15 +26652,15 @@ msgstr "Mezcla"
#: servers/audio/effects/audio_effect_compressor.cpp
msgid "Sidechain"
-msgstr ""
+msgstr "Sidechain"
#: servers/audio/effects/audio_effect_delay.cpp
msgid "Tap 1"
-msgstr "Toque 1"
+msgstr "Tap 1"
#: servers/audio/effects/audio_effect_delay.cpp
msgid "Tap 2"
-msgstr "Toque 2"
+msgstr "Tap 2"
#: servers/audio/effects/audio_effect_delay.cpp
#: servers/audio/effects/audio_effect_phaser.cpp
@@ -26681,7 +26678,7 @@ msgstr "Pre-Ganancia"
#: servers/audio/effects/audio_effect_distortion.cpp
msgid "Keep Hf Hz"
-msgstr "Mantener Hz Altas"
+msgstr "Mantener Hf Hz"
#: servers/audio/effects/audio_effect_distortion.cpp
msgid "Drive"
@@ -26697,19 +26694,19 @@ msgstr "Resonancia"
#: servers/audio/effects/audio_effect_limiter.cpp
msgid "Ceiling dB"
-msgstr "dB Tope"
+msgstr "Límite de dB"
#: servers/audio/effects/audio_effect_limiter.cpp
msgid "Threshold dB"
-msgstr "Umbral dB"
+msgstr "Umbral de dB"
#: servers/audio/effects/audio_effect_limiter.cpp
msgid "Soft Clip dB"
-msgstr ""
+msgstr "Soft Clip dB"
#: servers/audio/effects/audio_effect_limiter.cpp
msgid "Soft Clip Ratio"
-msgstr ""
+msgstr "Soft Clip Ratio"
#: servers/audio/effects/audio_effect_phaser.cpp
msgid "Range Min Hz"
@@ -26721,7 +26718,7 @@ msgstr "Rango Hz Máximo"
#: servers/audio/effects/audio_effect_pitch_shift.cpp
msgid "Oversampling"
-msgstr "Sobremuestreo"
+msgstr "Oversampling"
#: servers/audio/effects/audio_effect_pitch_shift.cpp
#: servers/audio/effects/audio_effect_spectrum_analyzer.cpp
@@ -26730,7 +26727,7 @@ msgstr "Tamaño de FFT"
#: servers/audio/effects/audio_effect_reverb.cpp
msgid "Predelay"
-msgstr ""
+msgstr "Retraso"
#: servers/audio/effects/audio_effect_reverb.cpp
msgid "Msec"
@@ -27050,7 +27047,7 @@ msgstr ""
#: servers/visual_server.cpp
msgid "Disable For Vendors"
-msgstr ""
+msgstr "Deshabilitar para Proveedores"
#: servers/visual_server.cpp
msgid "Anisotropic Filter Level"
@@ -27182,7 +27179,7 @@ msgstr "Usar PVS Simple"
#: servers/visual_server.cpp
msgid "PVS Logging"
-msgstr ""
+msgstr "Registro de PVS"
#: servers/visual_server.cpp
msgid "Use Signals"
diff --git a/editor/translations/es_AR.po b/editor/translations/es_AR.po
index fdb6b4f00d..24d38e14a7 100644
--- a/editor/translations/es_AR.po
+++ b/editor/translations/es_AR.po
@@ -22,13 +22,14 @@
# emnrx <emanuelermancia@gmail.com>, 2022.
# Mau_Restor <restor@gmail.com>, 2022.
# Leonardo Martínez <leonardomartinez85@gmail.com>, 2022.
+# LR <nancok@tuta.io>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-11-26 14:36+0000\n"
-"Last-Translator: emnrx <emanuelermancia@gmail.com>\n"
+"PO-Revision-Date: 2023-01-01 05:48+0000\n"
+"Last-Translator: LR <nancok@tuta.io>\n"
"Language-Team: Spanish (Argentina) <https://hosted.weblate.org/projects/"
"godot-engine/godot/es_AR/>\n"
"Language: es_AR\n"
@@ -36,7 +37,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 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -286,11 +287,11 @@ msgstr ""
#: core/io/packet_peer.cpp
msgid "Input Buffer Max Size"
-msgstr ""
+msgstr "Tamaño maximo del bufer de entrada"
#: core/io/packet_peer.cpp
msgid "Output Buffer Max Size"
-msgstr ""
+msgstr "Tamaño maximo del buffer de salida"
#: core/io/packet_peer.cpp
msgid "Stream Peer"
@@ -505,8 +506,9 @@ msgid "Strength"
msgstr "Fuerza"
#: core/os/input_event.cpp
+#, fuzzy
msgid "Delta"
-msgstr ""
+msgstr "Delta"
#: core/os/input_event.cpp
msgid "Channel"
@@ -721,7 +723,7 @@ msgstr "Superior Derecha"
#: core/project_settings.cpp
msgid "UI Up"
-msgstr ""
+msgstr "Interfaz Arriba"
#: core/project_settings.cpp
#, fuzzy
@@ -735,7 +737,7 @@ msgstr "Página: "
#: core/project_settings.cpp
msgid "UI Page Down"
-msgstr ""
+msgstr "Interfaz Bajar Pagina"
#: core/project_settings.cpp
msgid "UI Home"
@@ -1013,7 +1015,7 @@ msgstr "Usar Muestreo Bicúbico"
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Max Renderable Elements"
-msgstr ""
+msgstr "Cantidad Maxima de Elementos Renderizables"
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Max Renderable Lights"
@@ -11251,7 +11253,7 @@ msgstr "Perspectiva Trasera"
msgid " [auto]"
msgstr " [auto]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [portales activos]"
diff --git a/editor/translations/et.po b/editor/translations/et.po
index dc36ae0b94..c08335ed4f 100644
--- a/editor/translations/et.po
+++ b/editor/translations/et.po
@@ -8,19 +8,20 @@
# René <renepiik@gmail.com>, 2020.
# Kritzmensch <streef.gtx@gmail.com>, 2021, 2022.
# dogyx <aaronloit@zohomail.eu>, 2022.
+# Oskar U <oskar.unn2003@gmail.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
-"PO-Revision-Date: 2022-09-16 07:12+0000\n"
-"Last-Translator: dogyx <aaronloit@zohomail.eu>\n"
+"PO-Revision-Date: 2023-01-08 09:47+0000\n"
+"Last-Translator: Oskar U <oskar.unn2003@gmail.com>\n"
"Language-Team: Estonian <https://hosted.weblate.org/projects/godot-engine/"
"godot/et/>\n"
"Language: et\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 4.14.1-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -9377,18 +9378,18 @@ msgstr "Lülita jagamisrežiim sisse/välja"
#: scene/gui/rich_text_label.cpp scene/gui/text_edit.cpp
#: scene/resources/primitive_meshes.cpp
msgid "Text"
-msgstr ""
+msgstr "Tekst"
#: editor/plugins/item_list_editor_plugin.cpp
#: editor/plugins/tile_set_editor_plugin.cpp main/main.cpp
#: platform/osx/export/export.cpp platform/windows/export/export.cpp
#: scene/gui/button.cpp scene/gui/item_list.cpp
msgid "Icon"
-msgstr ""
+msgstr "Ikoon"
#: editor/plugins/item_list_editor_plugin.cpp
msgid "ID"
-msgstr ""
+msgstr "ID"
#: editor/plugins/item_list_editor_plugin.cpp
#: scene/resources/default_theme/default_theme.cpp
@@ -10857,7 +10858,7 @@ msgstr "Perspektiiv"
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/eu.po b/editor/translations/eu.po
index 79da3d56fb..bfd4302fa8 100644
--- a/editor/translations/eu.po
+++ b/editor/translations/eu.po
@@ -10820,7 +10820,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/fa.po b/editor/translations/fa.po
index ad2a56e408..eb6c113057 100644
--- a/editor/translations/fa.po
+++ b/editor/translations/fa.po
@@ -28,7 +28,7 @@
# Aryan Azadeh <aryan@azadeh.email>, 2022.
# Mitsuha Miamizu <mitsuha.miamizu4444@gmail.com>, 2022.
# LordProfo <nimaentity30@gmail.com>, 2022.
-# LordProfo (Nima) <nimaentity30@gmail.com>, 2022.
+# LordProfo (Nima) <nimaentity30@gmail.com>, 2022, 2023.
# John Smith <pkafsharix@gmail.com>, 2022.
# Ali Jafari <ali.jafari.sn@gmail.com>, 2022.
# Ali Almasi <A710almasi@gmail.com>, 2022.
@@ -38,8 +38,8 @@ msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-11-16 22:47+0000\n"
-"Last-Translator: 2g.2d.2t <2g.2d.2t@gmail.com>\n"
+"PO-Revision-Date: 2023-01-01 05:48+0000\n"
+"Last-Translator: LordProfo (Nima) <nimaentity30@gmail.com>\n"
"Language-Team: Persian <https://hosted.weblate.org/projects/godot-engine/"
"godot/fa/>\n"
"Language: fa\n"
@@ -47,7 +47,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 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -2901,7 +2901,7 @@ msgstr "انتخاب حالت"
#: editor/editor_export.cpp
msgid "BPTC"
-msgstr ""
+msgstr "بی‌پی‌تی‌سی (BPTC)"
#: editor/editor_export.cpp platform/osx/export/export.cpp
msgid "S3TC"
@@ -2909,11 +2909,11 @@ msgstr "S3TC"
#: editor/editor_export.cpp platform/osx/export/export.cpp
msgid "ETC"
-msgstr "ای‌تی‌سی"
+msgstr "ئی‌تی‌سی (ETC)"
#: editor/editor_export.cpp platform/osx/export/export.cpp
msgid "ETC2"
-msgstr "ای‌تی‌سی‌۲"
+msgstr "ئی‌تی‌سی‌۲ (ETC2)"
#: editor/editor_export.cpp
msgid "No BPTC Fallbacks"
@@ -2964,7 +2964,7 @@ msgstr "تبدیل منابع متنی به دوتایی هنگام خروجی"
#: editor/editor_feature_profile.cpp
msgid "3D Editor"
-msgstr "ویرایشگر 3بعدی"
+msgstr "ویرایشگر ۳بعدی"
#: editor/editor_feature_profile.cpp
msgid "Script Editor"
@@ -3801,13 +3801,15 @@ msgstr "ایجاد بند انگشتی"
#: editor/editor_node.cpp
msgid "This operation can't be done without a tree root."
-msgstr ""
+msgstr "این عمل را نمی‌توان بدون tree root انجام داد."
#: 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 ""
+"این صحنه را نمی‌توان ذخیره کرد زیرا یک شامل نمونه‌سازی چرخه‌ای وجود دارد.\n"
+" Ù„Ø·ÙØ§Ù‹ آن را حل کنید Ùˆ سپس دوباره سعی کنید ذخیره کنید."
#: editor/editor_node.cpp
msgid ""
@@ -3873,6 +3875,9 @@ msgid ""
"Please read the documentation relevant to importing scenes to better "
"understand this workflow."
msgstr ""
+"این منبع متعلق به صحنه‌ای است که ایمپورت شده است، بنابراین قابل ویرایش نیست.\n"
+" Ù„Ø·ÙØ§Ù‹ اسناد مربوط به وارد کردن صحنه‌ها را بخوانید تا این گردش کار را بهتر درک "
+"کنید."
#: editor/editor_node.cpp
msgid ""
@@ -6913,7 +6918,7 @@ msgstr ""
#: editor/import/editor_import_collada.cpp
msgid "Collada"
-msgstr ""
+msgstr "کولادا"
#: editor/import/editor_import_collada.cpp
msgid "Use Ambient"
@@ -11203,7 +11208,7 @@ msgstr ""
msgid " [auto]"
msgstr " [خودکار]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
@@ -17129,9 +17134,8 @@ msgid "Add an architecture entry"
msgstr ""
#: modules/gdnative/gdnative_library_editor_plugin.cpp
-#, fuzzy
msgid "GDNativeLibrary"
-msgstr "صادکردن ÙØ§ÛŒÙ„ کتابخانه ای"
+msgstr "کتابخانهٔ جی‌دی‌نÙیتیو"
#: modules/gdnative/gdnative_library_singleton_editor.cpp
msgid "Enabled GDNative Singleton"
@@ -18580,25 +18584,24 @@ msgid "Mod %s"
msgstr ""
#: modules/visual_script/visual_script_func_nodes.cpp
-#, fuzzy
msgid "ShiftLeft %s"
-msgstr "تنظیم %s"
+msgstr "ShiftLeft %s"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "ShiftRight %s"
-msgstr ""
+msgstr "ShiftRight %s"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "BitAnd %s"
-msgstr ""
+msgstr "BitAnd %s"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "BitOr %s"
-msgstr ""
+msgstr "BitOr %s"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "BitXor %s"
-msgstr ""
+msgstr "BitXor %s"
#: modules/visual_script/visual_script_func_nodes.cpp
#, fuzzy
@@ -18730,9 +18733,8 @@ msgid "Get Self"
msgstr ""
#: modules/visual_script/visual_script_nodes.cpp
-#, fuzzy
msgid "CustomNode"
-msgstr "ساختن گره"
+msgstr "نود Ø³ÙØ§Ø±Ø´ÛŒ"
#: modules/visual_script/visual_script_nodes.cpp
msgid "Custom node has no _step() method, can't process graph."
@@ -18748,9 +18750,8 @@ msgstr ""
"(error) باشد."
#: modules/visual_script/visual_script_nodes.cpp
-#, fuzzy
msgid "SubCall"
-msgstr "ÙØ±Ø§Ø®ÙˆØ§Ù†ÛŒ"
+msgstr "ساب‌کال"
#: modules/visual_script/visual_script_nodes.cpp scene/gui/graph_node.cpp
msgid "Title"
@@ -18791,7 +18792,7 @@ msgstr ""
#: modules/visual_script/visual_script_yield_nodes.cpp
msgid "Wait"
-msgstr ""
+msgstr "صبرکردن"
#: modules/visual_script/visual_script_yield_nodes.cpp
#, fuzzy
@@ -20516,7 +20517,7 @@ msgstr "انتقال را در انیمیشن تغییر بده"
#: platform/uwp/export/export.cpp
msgid "Landscape"
-msgstr ""
+msgstr "چشم‌انداز"
#: platform/uwp/export/export.cpp
msgid "Portrait"
@@ -20826,7 +20827,7 @@ msgstr ""
#: platform/windows/export/export.cpp
msgid "Wine"
-msgstr ""
+msgstr "شراب"
#: platform/x11/export/export.cpp
msgid "32-bit executables cannot have embedded data >= 4 GiB."
@@ -22586,7 +22587,7 @@ msgstr ""
#: scene/3d/camera.cpp scene/3d/light.cpp scene/3d/reflection_probe.cpp
msgid "Cull Mask"
-msgstr ""
+msgstr "Cull Mask"
#: scene/3d/camera.cpp
#, fuzzy
@@ -26677,7 +26678,7 @@ msgstr ""
#: scene/resources/environment.cpp
msgid "Blur"
-msgstr ""
+msgstr "بلوری"
#: scene/resources/environment.cpp
msgid "Edge Sharpness"
@@ -27530,9 +27531,8 @@ msgid "Depth Draw"
msgstr "حالت درون یابی(درون‌یابی روشی است برای ÛŒØ§ÙØªÙ† مقدار تابع درون یک بازه)"
#: scene/resources/visual_shader.cpp
-#, fuzzy
msgid "Cull"
-msgstr "انتخاب حالت"
+msgstr "Cull"
#: scene/resources/visual_shader.cpp
#, fuzzy
@@ -27735,9 +27735,8 @@ msgstr "سطح دسی‌بل"
#: servers/audio/effects/audio_effect_chorus.cpp
#: servers/audio/effects/audio_effect_delay.cpp
#: servers/audio/effects/audio_effect_panner.cpp
-#, fuzzy
msgid "Pan"
-msgstr "بسته بندی"
+msgstr "Pan"
#: servers/audio/effects/audio_effect_compressor.cpp
#: servers/audio/effects/audio_effect_filter.cpp
diff --git a/editor/translations/fi.po b/editor/translations/fi.po
index 8aeba71bff..96267c77e3 100644
--- a/editor/translations/fi.po
+++ b/editor/translations/fi.po
@@ -11269,7 +11269,7 @@ msgstr "Takaperspektiivi"
msgid " [auto]"
msgstr " [automaattinen]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [portaalit aktiivisia]"
diff --git a/editor/translations/fil.po b/editor/translations/fil.po
index 71673d8255..2b6aa3a671 100644
--- a/editor/translations/fil.po
+++ b/editor/translations/fil.po
@@ -10674,7 +10674,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/fr.po b/editor/translations/fr.po
index 17063caae8..f6b1b5d1c9 100644
--- a/editor/translations/fr.po
+++ b/editor/translations/fr.po
@@ -105,14 +105,17 @@
# SCHUTZ Lucas <lucas.schutz0954@gmail.com>, 2022.
# EGuillemot <Elouen.Guillemot@gmail.com>, 2022.
# Entiz <maxime.salido@gmail.com>, 2022.
-# Callim Ethee <callimethee@gmail.com>, 2022.
+# Callim Ethee <callimethee@gmail.com>, 2022, 2023.
+# Hugo Berthet-Rambaud <hugoberthetrambaud@outlook.com>, 2023.
+# Nathan Chambrette <n.chambrette@gmail.com>, 2023.
+# slundi <slundi@gmail.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-10-10 18:06+0000\n"
-"Last-Translator: Helix Sir <vincentbarkmann@gmail.com>\n"
+"PO-Revision-Date: 2023-01-14 00:01+0000\n"
+"Last-Translator: slundi <slundi@gmail.com>\n"
"Language-Team: French <https://hosted.weblate.org/projects/godot-engine/"
"godot/fr/>\n"
"Language: fr\n"
@@ -120,7 +123,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 4.14.1\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -325,7 +328,7 @@ msgstr "Pré-lecture de page"
#: core/io/http_client.cpp
msgid "Blocking Mode Enabled"
-msgstr "Mode De Blocage Activé"
+msgstr "Mode de blocage activé"
#: core/io/http_client.cpp
msgid "Connection"
@@ -333,11 +336,11 @@ msgstr "Connexion"
#: core/io/http_client.cpp
msgid "Read Chunk Size"
-msgstr "Taile des tronçons de lecture"
+msgstr "Lire la taille des fragment(s)"
#: core/io/marshalls.cpp
msgid "Object ID"
-msgstr "ID de l'Objet"
+msgstr "Identifiant de l'Objet"
#: core/io/multiplayer_api.cpp core/io/packet_peer.cpp
msgid "Allow Object Decoding"
@@ -596,7 +599,7 @@ msgstr "Message"
#: core/os/input_event.cpp
msgid "Pitch"
-msgstr "Pitch"
+msgstr "Angle d'attaque"
#: core/os/input_event.cpp scene/2d/cpu_particles_2d.cpp
#: scene/2d/physics_body_2d.cpp scene/3d/cpu_particles.cpp
@@ -606,7 +609,7 @@ msgstr "Vélocité"
#: core/os/input_event.cpp
msgid "Instrument"
-msgstr "Instrument"
+msgstr "Appareil"
#: core/os/input_event.cpp
msgid "Controller Number"
@@ -5904,7 +5907,6 @@ msgid "Zoom Modifier"
msgstr "Touche de combinaison : Zoom"
#: editor/editor_settings.cpp editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Warped Mouse Panning"
msgstr "Panoramique déformé de la souris"
@@ -8843,15 +8845,15 @@ msgstr "Centré à Gauche"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Top"
-msgstr "Centrée en Haut"
+msgstr "Centré en Haut"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Right"
-msgstr "Centrée à droite"
+msgstr "Centré à droite"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Bottom"
-msgstr "Centrée en bas"
+msgstr "Centré en bas"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center"
@@ -11083,7 +11085,7 @@ msgstr "Perspective arrière"
msgid " [auto]"
msgstr " [auto]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [portails actifs]"
@@ -16833,7 +16835,7 @@ msgstr "Ajouter une entrée architecture"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "GDNativeLibrary"
-msgstr "GDNativeLibrary"
+msgstr "Bibliothèque Native GD"
#: modules/gdnative/gdnative_library_singleton_editor.cpp
msgid "Enabled GDNative Singleton"
@@ -17153,7 +17155,6 @@ msgid "Specular Factor"
msgstr "Facteur Spéculaire"
#: modules/gltf/gltf_spec_gloss.cpp
-#, fuzzy
msgid "Spec Gloss Img"
msgstr "Img Spéculaire Brillante"
@@ -18172,23 +18173,23 @@ msgstr "Module de %s"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "ShiftLeft %s"
-msgstr "Décalage %s vers la gauche"
+msgstr "Déplacer Vers la Gauche"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "ShiftRight %s"
-msgstr "Décaler %s vers la droite"
+msgstr "Déplacer vers la Droite"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "BitAnd %s"
-msgstr "Et par bit %s"
+msgstr "ET Binaire"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "BitOr %s"
-msgstr "Ou par bit %s"
+msgstr "OU Binaire"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "BitXor %s"
-msgstr "Ou-exclusif par bit %s"
+msgstr "OU Exclusif Binaire"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "Set Mode"
@@ -18303,7 +18304,7 @@ msgstr "Récupérer Self"
#: modules/visual_script/visual_script_nodes.cpp
msgid "CustomNode"
-msgstr "Nœud Personnalisé"
+msgstr "Noeud Personalisé"
#: modules/visual_script/visual_script_nodes.cpp
msgid "Custom node has no _step() method, can't process graph."
@@ -18357,7 +18358,7 @@ msgstr "Yield"
#: modules/visual_script/visual_script_yield_nodes.cpp
msgid "Wait"
-msgstr "Wait"
+msgstr "Attente/Attendre"
#: modules/visual_script/visual_script_yield_nodes.cpp
msgid "Next Frame"
@@ -19267,7 +19268,7 @@ msgstr "Projecteur 80 X 80"
#: platform/iphone/export/export.cpp
msgid "Storyboard"
-msgstr "Storyboard"
+msgstr "Story-board"
#: platform/iphone/export/export.cpp
msgid "Use Launch Screen Storyboard"
@@ -20272,15 +20273,14 @@ msgid "Could not find wine executable at \"%s\"."
msgstr "Impossible de trouver wine à l'emplacement \"%s\"."
#: platform/windows/export/export.cpp
-#, fuzzy
msgid ""
"Could not start rcedit executable. Configure rcedit path in the Editor "
"Settings (Export > Windows > Rcedit), or disable \"Application > Modify "
"Resources\" in the export preset."
msgstr ""
-"L'outil « rcedit » doit être configuré dans les préférences de l'éditeur "
-"(Exporter > Windows > Rcedit) for modifier l'icône ou les informations de "
-"l'application."
+"Impossible de démarrer l'exécutable rcedit. Configurez le chemin vers rcedit "
+"dans les réglages de l'éditeur (Exporter > Windows > Rcedit), ou désactivez "
+"\"Application > Modifier les Ressources\" dans les préréglages de l'export."
#: platform/windows/export/export.cpp
msgid "rcedit failed to modify executable: %s."
@@ -20303,15 +20303,14 @@ msgid "Invalid timestamp server."
msgstr "Server d'horodatage invalide."
#: platform/windows/export/export.cpp
-#, fuzzy
msgid ""
"Could not start signtool executable. Configure signtool path in the Editor "
"Settings (Export > Windows > Signtool), or disable \"Codesign\" in the "
"export preset."
msgstr ""
-"L'outil « rcedit » doit être configuré dans les préférences de l'éditeur "
-"(Exporter > Windows > Rcedit) for modifier l'icône ou les informations de "
-"l'application."
+"Impossible de démarrer l'exécutable signtool. Configurez le chemin vers "
+"signtool dans les réglages de l'éditeur (Exporter > Windows > Signtool) ou "
+"désactivez \"Codesign\" dans les préréglages de l'export."
#: platform/windows/export/export.cpp
msgid "Signtool failed to sign executable: %s."
@@ -20567,14 +20566,12 @@ msgid "Draw Margin"
msgstr "Afficher les marges"
#: scene/2d/camera_2d.cpp
-#, fuzzy
msgid "Drag Margin H Enabled"
-msgstr "Définir la marge"
+msgstr "Marge de tirage H activée"
#: scene/2d/camera_2d.cpp
-#, fuzzy
msgid "Drag Margin V Enabled"
-msgstr "Définir la marge"
+msgstr "Marge de tirage V activée"
#: scene/2d/camera_2d.cpp
msgid "Smoothing"
@@ -20589,9 +20586,8 @@ msgid "V"
msgstr "V"
#: scene/2d/camera_2d.cpp
-#, fuzzy
msgid "Drag Margin"
-msgstr "Tirer la marge"
+msgstr "Marge Tirage"
#: scene/2d/camera_2d.cpp
msgid "Draw Screen"
@@ -20602,9 +20598,8 @@ msgid "Draw Limits"
msgstr "Afficher les limites"
#: scene/2d/camera_2d.cpp
-#, fuzzy
msgid "Draw Drag Margin"
-msgstr "Définir la marge"
+msgstr "Dessiner la marge de tirage"
#: scene/2d/canvas_item.cpp scene/resources/environment.cpp
#: scene/resources/material.cpp
@@ -21633,9 +21628,8 @@ msgid "Internal Vertex Count"
msgstr "Nombre de Sommet Interne"
#: scene/2d/position_2d.cpp
-#, fuzzy
msgid "Gizmo Extents"
-msgstr "Gadgets"
+msgstr "Etendues des Gadgets"
#: scene/2d/ray_cast_2d.cpp scene/3d/ray_cast.cpp
msgid "Exclude Parent"
@@ -23258,9 +23252,8 @@ msgid "Gizmo"
msgstr "Gizmo"
#: scene/3d/spatial_velocity_tracker.cpp
-#, fuzzy
msgid "Track Physics Step"
-msgstr "Image physique %"
+msgstr "Suivre les Etapes Physiques"
#: scene/3d/spring_arm.cpp
msgid "Spring Length"
@@ -23682,9 +23675,8 @@ msgid "Group"
msgstr "Groupe"
#: scene/gui/button.cpp scene/gui/label.cpp
-#, fuzzy
msgid "Clip Text"
-msgstr "Copier le texte"
+msgstr "Découper le texte"
#: scene/gui/button.cpp scene/gui/label.cpp scene/gui/line_edit.cpp
#: scene/gui/spin_box.cpp
@@ -23696,9 +23688,8 @@ msgid "Icon Align"
msgstr "Aligner l'icône"
#: scene/gui/button.cpp
-#, fuzzy
msgid "Expand Icon"
-msgstr "Développer tout"
+msgstr "Développer l'icône"
#: scene/gui/center_container.cpp
msgid "Use Top Left"
@@ -23795,9 +23786,8 @@ msgid "Pivot Offset"
msgstr "Décalage du Pivot"
#: scene/gui/control.cpp
-#, fuzzy
msgid "Clip Content"
-msgstr "Constante de classe"
+msgstr "Découper le contenu"
#: scene/gui/control.cpp scene/resources/visual_shader_nodes.cpp
msgid "Hint"
@@ -23845,7 +23835,7 @@ msgstr "Forme de Curseur par Défaut"
#: scene/gui/control.cpp
msgid "Pass On Modal Close Click"
-msgstr ""
+msgstr "Transmettre Clic de Fermeture du Mode"
#: scene/gui/control.cpp
msgid "Size Flags"
@@ -23856,9 +23846,8 @@ msgid "Stretch Ratio"
msgstr "Ratio d’étirement"
#: scene/gui/control.cpp
-#, fuzzy
msgid "Theme Type Variation"
-msgstr "Propriétés du thème"
+msgstr "Variation du Type du Thème"
#: scene/gui/dialogs.cpp
msgid "Window Title"
@@ -23881,18 +23870,16 @@ msgid "Please Confirm..."
msgstr "Veuillez confirmer…"
#: scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Mode Overrides Title"
-msgstr "Remplacer l'item"
+msgstr "Le Mode remplace le Titre"
#: scene/gui/file_dialog.cpp
msgid "Must use a valid extension."
msgstr "Utilisez une extension valide."
#: scene/gui/graph_edit.cpp
-#, fuzzy
msgid "Right Disconnects"
-msgstr "Déconnecter"
+msgstr "La droite déconnecte"
#: scene/gui/graph_edit.cpp
msgid "Scroll Offset"
@@ -23928,9 +23915,8 @@ msgid "Enable grid minimap."
msgstr "Activer l'alignement."
#: scene/gui/graph_node.cpp
-#, fuzzy
msgid "Show Close"
-msgstr "Afficher les os"
+msgstr "Afficher la Fermeture"
#: scene/gui/graph_node.cpp scene/gui/option_button.cpp
#: scene/resources/default_theme/default_theme.cpp
@@ -23959,23 +23945,20 @@ msgid "Incremental Search Max Interval Msec"
msgstr "Intervalle max de recherche incrémentale (ms)"
#: scene/gui/item_list.cpp scene/gui/tree.cpp
-#, fuzzy
msgid "Allow Reselect"
-msgstr "Appliquer la réinitialisation"
+msgstr "Autoriser la Resélection"
#: scene/gui/item_list.cpp scene/gui/tree.cpp
-#, fuzzy
msgid "Allow RMB Select"
-msgstr "Remplir la sélection"
+msgstr "Autoriser la sélection par click droit"
#: scene/gui/item_list.cpp
msgid "Max Text Lines"
msgstr "Lignes de texte max"
#: scene/gui/item_list.cpp
-#, fuzzy
msgid "Auto Height"
-msgstr "En période de test"
+msgstr "Hauteur Auto"
#: scene/gui/item_list.cpp
msgid "Max Columns"
@@ -23994,23 +23977,20 @@ msgid "Icon Scale"
msgstr "Échelle de l'Icône"
#: scene/gui/item_list.cpp
-#, fuzzy
msgid "Fixed Icon Size"
-msgstr "Vue de devant"
+msgstr "Taille d'Icône Fixe"
#: scene/gui/label.cpp
-#, fuzzy
msgid "V Align"
-msgstr "Assigner"
+msgstr "Alignement V"
#: scene/gui/label.cpp scene/gui/rich_text_label.cpp
msgid "Visible Characters"
msgstr "Caractères visibles"
#: scene/gui/label.cpp scene/gui/rich_text_label.cpp
-#, fuzzy
msgid "Percent Visible"
-msgstr "Rendre visible"
+msgstr "Pourcentage visible"
#: scene/gui/label.cpp
msgid "Lines Skipped"
@@ -24037,34 +24017,28 @@ msgid "Expand To Text Length"
msgstr "Etendre à la longueur du texte"
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
-#, fuzzy
msgid "Context Menu Enabled"
-msgstr "Aide contextuelle"
+msgstr "Menu Contextuel Activé"
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
-#, fuzzy
msgid "Virtual Keyboard Enabled"
-msgstr "Filtrer les signaux"
+msgstr "Clavier Virtuel Activé"
#: scene/gui/line_edit.cpp
-#, fuzzy
msgid "Clear Button Enabled"
-msgstr "Filtrer les signaux"
+msgstr "Bouton de Nettoyage Activé"
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
-#, fuzzy
msgid "Shortcut Keys Enabled"
-msgstr "Raccourcis"
+msgstr "Raccourcis activés"
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
-#, fuzzy
msgid "Middle Mouse Paste Enabled"
-msgstr "Filtrer les signaux"
+msgstr "Collage avec le bouton central de la souris activé"
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
-#, fuzzy
msgid "Selecting Enabled"
-msgstr "Sélection uniquement"
+msgstr "Sélection Activée"
#: scene/gui/line_edit.cpp scene/gui/rich_text_label.cpp
#: scene/gui/text_edit.cpp
@@ -24072,14 +24046,12 @@ msgid "Deselect On Focus Loss Enabled"
msgstr "Déselection à la perte de focus activée"
#: scene/gui/line_edit.cpp
-#, fuzzy
msgid "Right Icon"
-msgstr "Bouton droit"
+msgstr "Icône droite"
#: scene/gui/line_edit.cpp
-#, fuzzy
msgid "Placeholder"
-msgstr "Charger en tant qu'instance temporaire"
+msgstr "Substitut temporaire"
#: scene/gui/line_edit.cpp
msgid "Alpha"
@@ -24102,24 +24074,20 @@ msgid "Underline"
msgstr "Souligner"
#: scene/gui/menu_button.cpp
-#, fuzzy
msgid "Switch On Hover"
-msgstr "Switch"
+msgstr "Chnager au Survol"
#: scene/gui/nine_patch_rect.cpp scene/resources/style_box.cpp
-#, fuzzy
msgid "Draw Center"
-msgstr "Centre"
+msgstr "Dessiner le Centre"
#: scene/gui/nine_patch_rect.cpp scene/resources/style_box.cpp
-#, fuzzy
msgid "Region Rect"
-msgstr "Définir région rectangulaire"
+msgstr "Zone Rectangulaire"
#: scene/gui/nine_patch_rect.cpp
-#, fuzzy
msgid "Patch Margin"
-msgstr "Définir la marge"
+msgstr "Marge de patch"
#: scene/gui/nine_patch_rect.cpp scene/resources/style_box.cpp
msgid "Axis Stretch"
@@ -24138,7 +24106,6 @@ msgstr ""
"un étirement."
#: scene/gui/popup.cpp
-#, fuzzy
msgid "Popup"
msgstr "Fenêtre contextuelle"
@@ -24170,9 +24137,8 @@ msgid "Hide On State Item Selection"
msgstr "Cacher lors de la sélection de l'élément d'état"
#: scene/gui/popup_menu.cpp
-#, fuzzy
msgid "Submenu Popup Delay"
-msgstr "Délai du pop-up du sous-menu"
+msgstr "Délai de pop-up du sous-menu"
#: scene/gui/popup_menu.cpp
msgid "Allow Search"
@@ -24205,9 +24171,8 @@ msgid "Exp Edit"
msgstr "Édition Exponentielle"
#: scene/gui/range.cpp
-#, fuzzy
msgid "Rounded"
-msgstr "Arrondir"
+msgstr "Arrondi"
#: scene/gui/range.cpp
msgid "Allow Greater"
@@ -24238,9 +24203,8 @@ msgid "Elapsed Time"
msgstr "Temps Écoulé"
#: scene/gui/rich_text_effect.cpp
-#, fuzzy
msgid "Env"
-msgstr "Fin"
+msgstr "Alentours"
#: scene/gui/rich_text_effect.cpp
msgid "Character"
@@ -24298,18 +24262,16 @@ msgstr ""
"définissez manuellement la taille minimale personnalisée."
#: scene/gui/scroll_container.cpp
-#, fuzzy
msgid "Follow Focus"
-msgstr "Remplir la surface"
+msgstr "Suivre le focus"
#: scene/gui/scroll_container.cpp
msgid "Horizontal Enabled"
msgstr "Horizontal Activé"
#: scene/gui/scroll_container.cpp
-#, fuzzy
msgid "Vertical Enabled"
-msgstr "Filtrer les signaux"
+msgstr "Vertical Activé"
#: scene/gui/scroll_container.cpp
msgid "Default Scroll Deadzone"
@@ -24320,9 +24282,8 @@ msgid "Scrollable"
msgstr "Défilant"
#: scene/gui/slider.cpp
-#, fuzzy
msgid "Tick Count"
-msgstr "Prélever une couleur"
+msgstr "Compte des Tics"
#: scene/gui/slider.cpp
msgid "Ticks On Borders"
@@ -24341,14 +24302,12 @@ msgid "Split Offset"
msgstr "Décalage des écarts"
#: scene/gui/split_container.cpp scene/gui/tree.cpp
-#, fuzzy
msgid "Collapsed"
-msgstr "Réduire tout"
+msgstr "Réduit"
#: scene/gui/split_container.cpp
-#, fuzzy
msgid "Dragger Visibility"
-msgstr "Basculer la visibilité"
+msgstr "Visibilité du Tireur"
#: scene/gui/tab_container.cpp scene/gui/tabs.cpp
msgid "Tab Align"
@@ -24359,9 +24318,8 @@ msgid "Current Tab"
msgstr "Onglet actuel"
#: scene/gui/tab_container.cpp
-#, fuzzy
msgid "Tabs Visible"
-msgstr "Rendre visible"
+msgstr "Onglets Visibles"
#: scene/gui/tab_container.cpp
msgid "All Tabs In Front"
@@ -24388,33 +24346,28 @@ msgid "Readonly"
msgstr "Lecture Seule"
#: scene/gui/text_edit.cpp
-#, fuzzy
msgid "Bookmark Gutter"
-msgstr "Signets"
+msgstr "Bandeau à Marque-pages"
#: scene/gui/text_edit.cpp
-#, fuzzy
msgid "Breakpoint Gutter"
-msgstr "Passer les points d'arrêt"
+msgstr "Bandeau à points d'arrêt"
#: scene/gui/text_edit.cpp
msgid "Fold Gutter"
msgstr "Replier le bandeau"
#: scene/gui/text_edit.cpp
-#, fuzzy
msgid "Drag And Drop Selection Enabled"
-msgstr "Sélection uniquement"
+msgstr "Sélection en Glisser-déposer Activée"
#: scene/gui/text_edit.cpp
-#, fuzzy
msgid "Hiding Enabled"
-msgstr "Activer"
+msgstr "Cacher Activé"
#: scene/gui/text_edit.cpp
-#, fuzzy
msgid "Wrap Enabled"
-msgstr "Activer"
+msgstr "Déformation Activée"
#: scene/gui/text_edit.cpp
msgid "Scroll Vertical"
@@ -24429,9 +24382,8 @@ msgid "Draw"
msgstr "Dessiner"
#: scene/gui/text_edit.cpp
-#, fuzzy
msgid "Block Mode"
-msgstr "Déverrouiller le nœud"
+msgstr "Mode Bloc"
#: scene/gui/text_edit.cpp
msgid "Moving By Right Click"
@@ -24451,34 +24403,29 @@ msgid "Hover"
msgstr "Survoler"
#: scene/gui/texture_button.cpp
-#, fuzzy
msgid "Focused"
-msgstr "Focaliser le chemin"
+msgstr "Focalisé"
#: scene/gui/texture_button.cpp
-#, fuzzy
msgid "Click Mask"
-msgstr "Mode collision"
+msgstr "Masque de Clic"
#: scene/gui/texture_button.cpp scene/gui/texture_rect.cpp
#: scene/gui/video_player.cpp
-#, fuzzy
msgid "Expand"
-msgstr "Développer tout"
+msgstr "Développer"
#: scene/gui/texture_progress.cpp
msgid "Under"
msgstr "Sous"
#: scene/gui/texture_progress.cpp
-#, fuzzy
msgid "Over"
-msgstr "Écraser"
+msgstr "Par-dessus"
#: scene/gui/texture_progress.cpp
-#, fuzzy
msgid "Progress"
-msgstr "Propriétés du thème"
+msgstr "Progrès"
#: scene/gui/texture_progress.cpp
msgid "Progress Offset"
@@ -24497,43 +24444,36 @@ msgid "Radial Fill"
msgstr "Remplissage Radial"
#: scene/gui/texture_progress.cpp
-#, fuzzy
msgid "Initial Angle"
-msgstr "Initialiser"
+msgstr "Angle Initial"
#: scene/gui/texture_progress.cpp
msgid "Fill Degrees"
msgstr "Degrés remplis"
#: scene/gui/texture_progress.cpp scene/resources/primitive_meshes.cpp
-#, fuzzy
msgid "Center Offset"
-msgstr "Centré à Gauche"
+msgstr "Décalage du Centre"
#: scene/gui/texture_progress.cpp
-#, fuzzy
msgid "Nine Patch Stretch"
-msgstr "Mode d’interpolation"
+msgstr "Etirement à Neuf Patchs"
#: scene/gui/texture_progress.cpp
-#, fuzzy
msgid "Stretch Margin Left"
-msgstr "Définir la marge"
+msgstr "Etirer la marge à gauche"
#: scene/gui/texture_progress.cpp
-#, fuzzy
msgid "Stretch Margin Top"
-msgstr "Définir la marge"
+msgstr "Etirer la marge en haut"
#: scene/gui/texture_progress.cpp
-#, fuzzy
msgid "Stretch Margin Right"
-msgstr "Définir la marge"
+msgstr "Etirer la marge à droite"
#: scene/gui/texture_progress.cpp
-#, fuzzy
msgid "Stretch Margin Bottom"
-msgstr "Mode sélection"
+msgstr "Etirer la marge en bas"
#: scene/gui/tree.cpp
msgid "Custom Minimum Height"
@@ -24544,14 +24484,12 @@ msgid "(Other)"
msgstr "(Autre)"
#: scene/gui/tree.cpp
-#, fuzzy
msgid "Column Titles Visible"
-msgstr "Rendre visible"
+msgstr "Titres des colonnes visibles"
#: scene/gui/tree.cpp
-#, fuzzy
msgid "Hide Folding"
-msgstr "Bouton désactivé"
+msgstr "Cacher les plis"
#: scene/gui/tree.cpp
msgid "Hide Root"
@@ -24562,43 +24500,36 @@ msgid "Drop Mode Flags"
msgstr "Options du Mode Abandon"
#: scene/gui/video_player.cpp
-#, fuzzy
msgid "Audio Track"
-msgstr "Ajouter une piste"
+msgstr "Piste Audio"
#: scene/gui/video_player.cpp scene/main/scene_tree.cpp scene/main/timer.cpp
msgid "Paused"
msgstr "En Pause"
#: scene/gui/video_player.cpp
-#, fuzzy
msgid "Buffering Msec"
-msgstr "Vue de derrière"
+msgstr "Mise en mémoire tampon ms"
#: scene/gui/video_player.cpp
-#, fuzzy
msgid "Stream Position"
-msgstr "Définir position d'entrée de la courbe"
+msgstr "Position Flux"
#: scene/gui/viewport_container.cpp
-#, fuzzy
msgid "Stretch Shrink"
-msgstr "Actualiser"
+msgstr "Etirer-Réduire"
#: scene/main/canvas_layer.cpp
-#, fuzzy
msgid "Follow Viewport"
-msgstr "Afficher le Viewport"
+msgstr "Suivre la fenêtre d'affichage"
#: scene/main/http_request.cpp
-#, fuzzy
msgid "Download File"
-msgstr "Télécharger"
+msgstr "Télécharger le Fichier"
#: scene/main/http_request.cpp
-#, fuzzy
msgid "Download Chunk Size"
-msgstr "Téléchargement en cours"
+msgstr "Taille des Blocs de Téléchargement"
#: scene/main/http_request.cpp
msgid "Body Size Limit"
@@ -24621,80 +24552,68 @@ msgstr ""
"'%s', car ce nom est déjà attribué à '%s'. Ce nœud n'est donc plus unique."
#: scene/main/node.cpp
-#, fuzzy
msgid "Name Num Separator"
-msgstr "Séparateur nommé"
+msgstr "Nom des séparateurs numériques"
#: scene/main/node.cpp
msgid "Name Casing"
msgstr "Convention de Nommage"
#: scene/main/node.cpp
-#, fuzzy
msgid "Editor Description"
-msgstr "Description"
+msgstr "Description de l'Editeur"
#: scene/main/node.cpp
-#, fuzzy
msgid "Pause Mode"
-msgstr "Mode navigation"
+msgstr "Mode Pause"
#: scene/main/node.cpp
-#, fuzzy
msgid "Physics Interpolation Mode"
-msgstr "Mode d’interpolation"
+msgstr "Mode d’interpolation physique"
#: scene/main/node.cpp
-#, fuzzy
msgid "Display Folded"
-msgstr "Afficher sans ombrage"
+msgstr "Afficher les repliés"
#: scene/main/node.cpp
-#, fuzzy
msgid "Filename"
-msgstr "Renommer"
+msgstr "Nom de fichier"
#: scene/main/node.cpp
msgid "Owner"
msgstr "Propriétaire"
#: scene/main/node.cpp scene/main/scene_tree.cpp
-#, fuzzy
msgid "Multiplayer"
-msgstr "Multiplier %s"
+msgstr "Multijoueur"
#: scene/main/node.cpp
msgid "Custom Multiplayer"
msgstr "Multijoueur Personnalisé"
#: scene/main/node.cpp
-#, fuzzy
msgid "Process Priority"
-msgstr "Activer la priorité"
+msgstr "Priorité de processus"
#: scene/main/scene_tree.cpp scene/main/timer.cpp
-#, fuzzy
msgid "Time Left"
-msgstr "En haut à gauche"
+msgstr "Temps restant"
#: scene/main/scene_tree.cpp
-#, fuzzy
msgid "Debug Collisions Hint"
-msgstr "Mode collision"
+msgstr "Déboguer les indices de collision"
#: scene/main/scene_tree.cpp
-#, fuzzy
msgid "Debug Navigation Hint"
-msgstr "Mode Navigation"
+msgstr "Déboguer les indices de navigation"
#: scene/main/scene_tree.cpp
msgid "Use Font Oversampling"
msgstr "Utiliser le Suréchantillonnage de Police"
#: scene/main/scene_tree.cpp
-#, fuzzy
msgid "Edited Scene Root"
-msgstr "Nouvelle racine de scène"
+msgstr "Racine de scène modifiée"
#: scene/main/scene_tree.cpp
msgid "Root"
@@ -24778,9 +24697,8 @@ msgstr ""
"Environnement -> Environnement par défaut) ne peut pas être chargé."
#: scene/main/scene_tree.cpp
-#, fuzzy
msgid "Enable Object Picking"
-msgstr "Activer l'effet « pelure d'oignon »"
+msgstr "Activer la sélection d'objet"
#: scene/main/timer.cpp
msgid ""
@@ -24829,14 +24747,12 @@ msgid "ARVR"
msgstr "ARVR"
#: scene/main/viewport.cpp
-#, fuzzy
msgid "Size Override Stretch"
-msgstr "Remplacer l'item"
+msgstr "La taille passe outre l'étirement"
#: scene/main/viewport.cpp
-#, fuzzy
msgid "Own World"
-msgstr "Propre Monde"
+msgstr "Monde Propre"
#: scene/main/viewport.cpp scene/resources/world_2d.cpp
msgid "World"
@@ -24859,9 +24775,8 @@ msgid "FXAA"
msgstr "FXAA"
#: scene/main/viewport.cpp
-#, fuzzy
msgid "Debanding"
-msgstr "Liaison"
+msgstr "Dé-banding"
#: scene/main/viewport.cpp
msgid "Disable 3D"
@@ -24888,9 +24803,8 @@ msgid "V Flip"
msgstr "Miroir V"
#: scene/main/viewport.cpp
-#, fuzzy
msgid "Clear Mode"
-msgstr "Mode Règle"
+msgstr "Mode Nettoyage"
#: scene/main/viewport.cpp
msgid "Enable 2D"
@@ -24901,18 +24815,16 @@ msgid "Enable 3D"
msgstr "Activer 3D"
#: scene/main/viewport.cpp
-#, fuzzy
msgid "Object Picking"
-msgstr "Activer l'effet « pelure d'oignon »"
+msgstr "Sélection d'objet"
#: scene/main/viewport.cpp
msgid "Disable Input"
msgstr "Désactiver entrées"
#: scene/main/viewport.cpp servers/visual_server.cpp
-#, fuzzy
msgid "Shadow Atlas"
-msgstr "Nouvel Atlas"
+msgstr "Atlas d'ombres"
#: scene/main/viewport.cpp
msgid "Quad 0"
@@ -25000,9 +24912,8 @@ msgid "Segments"
msgstr "Segments"
#: scene/resources/curve.cpp
-#, fuzzy
msgid "Bake Resolution"
-msgstr "Demi résolution"
+msgstr "Précalculer la résolution"
#: scene/resources/curve.cpp
msgid "Bake Interval"
@@ -25133,19 +25044,16 @@ msgid "Cursor Color"
msgstr "Couleur du curseur"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Clear Button Color"
-msgstr "Filtrer les signaux"
+msgstr "Couleur du bouton de nettoyage"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Clear Button Color Pressed"
-msgstr "Filtrer les signaux"
+msgstr "Couleur du bouton de nettoyage appuyé"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Minimum Spaces"
-msgstr "Scène principale"
+msgstr "Espacement Minimum"
#: scene/resources/default_theme/default_theme.cpp
msgid "BG"
@@ -25251,12 +25159,11 @@ msgstr "Signet"
#: scene/resources/default_theme/default_theme.cpp
msgid "Updown"
-msgstr ""
+msgstr "Haut/Bas"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Scaleborder Size"
-msgstr "Pixels de bordure"
+msgstr "Taille de la bordure du cadre"
#: scene/resources/default_theme/default_theme.cpp
msgid "Title Font"
@@ -25307,9 +25214,8 @@ msgid "Font Separator"
msgstr "Séparateur de police"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Font Color Accel"
-msgstr "Renommer l'item de couleur"
+msgstr "Accélération de la couleur de police"
#: scene/resources/default_theme/default_theme.cpp
msgid "Font Color Separator"
@@ -25328,14 +25234,12 @@ msgid "Default Frame"
msgstr "Trame par défaut"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Default Focus"
-msgstr "Défaut"
+msgstr "Focalisation par défaut"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Comment Focus"
-msgstr "Enregistrer"
+msgstr "Focalisation des commentaires"
#: scene/resources/default_theme/default_theme.cpp
msgid "Breakpoint"
@@ -25366,14 +25270,12 @@ msgid "Port Offset"
msgstr "Décalage du port"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "BG Focus"
-msgstr "Focaliser le chemin"
+msgstr "Focalisation de l'arrière-plan"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Selected Focus"
-msgstr "Sélectionner"
+msgstr "Focalisation de la sélection"
#: scene/resources/default_theme/default_theme.cpp
msgid "Cursor Unfocused"
@@ -25384,19 +25286,16 @@ msgid "Button Pressed"
msgstr "Bouton quand pressé"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Title Button Normal"
-msgstr "Bouton à bascule (toggle)"
+msgstr "Bouton de titre normal"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Title Button Pressed"
-msgstr "Bouton à bascule (toggle)"
+msgstr "Bouton de titre appuyé"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Title Button Hover"
-msgstr "Bouton à bascule (toggle)"
+msgstr "Bouton de titre survolé"
#: scene/resources/default_theme/default_theme.cpp
msgid "Custom Button"
@@ -25411,33 +25310,28 @@ msgid "Custom Button Hover"
msgstr "Bouton personnalisé au survol"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Select Arrow"
-msgstr "Tout sélectionner"
+msgstr "Flèche de sélection"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Arrow Collapsed"
-msgstr "Réduire tout"
+msgstr "Flèche réduite"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Title Button Font"
-msgstr "Bouton à bascule (toggle)"
+msgstr "Police du bouton de titre"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Title Button Color"
-msgstr "Couleur de la Sélection"
+msgstr "Couleur du bouton de titre"
#: scene/resources/default_theme/default_theme.cpp
msgid "Guide Color"
msgstr "Couleur des guides"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Drop Position Color"
-msgstr "Position du dock"
+msgstr "Couleur de position du dépôt"
#: scene/resources/default_theme/default_theme.cpp
msgid "Relationship Line Color"
@@ -25500,14 +25394,12 @@ msgid "Menu Highlight"
msgstr "Menu au survol"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Font Color FG"
-msgstr "Renommer l'item de couleur"
+msgstr "Couleur de police premier plan"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Font Color BG"
-msgstr "Renommer l'item de couleur"
+msgstr "Couleur de police arrière-plan"
#: scene/resources/default_theme/default_theme.cpp
msgid "Side Margin"
@@ -25519,11 +25411,11 @@ msgstr "Marge en haut"
#: scene/resources/default_theme/default_theme.cpp
msgid "Label V Align FG"
-msgstr ""
+msgstr "Alignement Vertical du Label Premier Plan"
#: scene/resources/default_theme/default_theme.cpp
msgid "Label V Align BG"
-msgstr ""
+msgstr "Alignement Vertical du Label Arrière-plan"
#: scene/resources/default_theme/default_theme.cpp
msgid "Large"
@@ -25546,19 +25438,16 @@ msgid "Files Disabled"
msgstr "Fichiers désactivés"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "SV Width"
-msgstr "Étendu à Gauche"
+msgstr "Largeur SV"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "SV Height"
-msgstr "Lumière"
+msgstr "Hauteur SV"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "H Width"
-msgstr "Étendu à Gauche"
+msgstr "Largeur H"
#: scene/resources/default_theme/default_theme.cpp
msgid "Label Width"
@@ -25673,9 +25562,8 @@ msgid "Activity"
msgstr "Activité"
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Bezier Len Pos"
-msgstr "Déplacer des points de Bézier"
+msgstr "Position de longueur de Bézier"
#: scene/resources/default_theme/default_theme.cpp
msgid "Bezier Len Neg"
@@ -25842,9 +25730,8 @@ msgid "Max Luma"
msgstr "Lumen maximum"
#: scene/resources/environment.cpp
-#, fuzzy
msgid "SS Reflections"
-msgstr "Mettre à l'échelle la sélection"
+msgstr "Reflets SS"
#: scene/resources/environment.cpp
msgid "Max Steps"
@@ -25879,14 +25766,12 @@ msgid "Intensity 2"
msgstr "Intensité 2"
#: scene/resources/environment.cpp scene/resources/material.cpp
-#, fuzzy
msgid "Light Affect"
-msgstr "Étendu à Droite"
+msgstr "Influence de la lumière"
#: scene/resources/environment.cpp
-#, fuzzy
msgid "AO Channel Affect"
-msgstr "Débogage du canal UV"
+msgstr "Influence du canal AO"
#: scene/resources/environment.cpp
msgid "Blur"
@@ -26158,12 +26043,11 @@ msgstr "NormalMap"
#: scene/resources/material.cpp
msgid "Rim"
-msgstr "Bord"
+msgstr "Bordure"
#: scene/resources/material.cpp
-#, fuzzy
msgid "Clearcoat"
-msgstr "Effacer"
+msgstr "Coucheclaire"
#: scene/resources/material.cpp
msgid "Gloss"
@@ -26175,7 +26059,7 @@ msgstr "Anisotropie"
#: scene/resources/material.cpp
msgid "Flowmap"
-msgstr ""
+msgstr "Organigramme"
#: scene/resources/material.cpp
msgid "Ambient Occlusion"
@@ -26186,23 +26070,20 @@ msgid "Deep Parallax"
msgstr "Parallaxe Profonde"
#: scene/resources/material.cpp
-#, fuzzy
msgid "Min Layers"
-msgstr "Calque"
+msgstr "Calques min"
#: scene/resources/material.cpp
-#, fuzzy
msgid "Max Layers"
-msgstr "Calque"
+msgstr "Calques max"
#: scene/resources/material.cpp
msgid "Flip Tangent"
msgstr "Inverser la Tangente"
#: scene/resources/material.cpp
-#, fuzzy
msgid "Flip Binormal"
-msgstr "Retourner le Portal"
+msgstr "Inversion Bi-normale"
#: scene/resources/material.cpp
msgid "Subsurf Scatter"
@@ -26241,9 +26122,8 @@ msgid "UV2"
msgstr "UV2"
#: scene/resources/material.cpp
-#, fuzzy
msgid "Proximity Fade"
-msgstr "Mode prioritaire"
+msgstr "Fondu de proximité"
#: scene/resources/material.cpp
msgid "Distance Fade"
@@ -26254,9 +26134,8 @@ msgid "Async Mode"
msgstr "Mode asynchrone"
#: scene/resources/mesh.cpp
-#, fuzzy
msgid "Lightmap Size Hint"
-msgstr "LightMap Bake"
+msgstr "Indice de taille de la texture de lumière"
#: scene/resources/mesh.cpp scene/resources/primitive_meshes.cpp
msgid "Custom AABB"
@@ -26307,9 +26186,8 @@ msgid "Source Geometry Mode"
msgstr "Mode Géométrie Source"
#: scene/resources/navigation_mesh.cpp
-#, fuzzy
msgid "Source Group Name"
-msgstr "Source"
+msgstr "Nom du groupe source"
#: scene/resources/navigation_mesh.cpp
msgid "Cells"
@@ -26332,18 +26210,16 @@ msgid "Regions"
msgstr "Régions"
#: scene/resources/navigation_mesh.cpp
-#, fuzzy
msgid "Merge Size"
-msgstr "Fusionner depuis la scène"
+msgstr "Taille de la fusion"
#: scene/resources/navigation_mesh.cpp
msgid "Edges"
msgstr "Arêtes"
#: scene/resources/navigation_mesh.cpp
-#, fuzzy
msgid "Max Error"
-msgstr "Erreur"
+msgstr "Erreur max"
#: scene/resources/navigation_mesh.cpp
msgid "Verts Per Poly"
@@ -26358,9 +26234,8 @@ msgid "Sample Distance"
msgstr "Échantillonner la distance"
#: scene/resources/navigation_mesh.cpp
-#, fuzzy
msgid "Sample Max Error"
-msgstr "Échantillonneur"
+msgstr "Échantillon erreur max"
#: scene/resources/navigation_mesh.cpp
msgid "Low Hanging Obstacles"
@@ -26375,14 +26250,12 @@ msgid "Walkable Low Height Spans"
msgstr "Etendues de faible hauteur praticables"
#: scene/resources/navigation_mesh.cpp
-#, fuzzy
msgid "Baking AABB"
-msgstr "Générer AABB"
+msgstr "Précalcul AABB"
#: scene/resources/navigation_mesh.cpp
-#, fuzzy
msgid "Baking AABB Offset"
-msgstr "Décalage :"
+msgstr "Décalage du Précalcul AABB"
#: scene/resources/occluder_shape.cpp
msgid "Spheres"
@@ -26413,14 +26286,12 @@ msgid "Divisor"
msgstr "Diviseur"
#: scene/resources/particles_material.cpp
-#, fuzzy
msgid "Size Modifier"
-msgstr "Modificateur de vitesse de la vue libre"
+msgstr "Modificateur de taille"
#: scene/resources/particles_material.cpp
-#, fuzzy
msgid "Color Modifier"
-msgstr "Ralentissement de la vue libre"
+msgstr "Modificateur de couleur"
#: scene/resources/particles_material.cpp
msgid "Point Texture"
@@ -26431,9 +26302,8 @@ msgid "Normal Texture"
msgstr "Texture Normale"
#: scene/resources/particles_material.cpp
-#, fuzzy
msgid "Color Texture"
-msgstr "Thème de l'éditeur"
+msgstr "Texture de couleur"
#: scene/resources/particles_material.cpp
msgid "Point Count"
@@ -26444,9 +26314,8 @@ msgid "Scale Random"
msgstr "Échelle Aléatoire"
#: scene/resources/particles_material.cpp
-#, fuzzy
msgid "Scale Curve"
-msgstr "Fermer la courbe"
+msgstr "Courbe d'échelle"
#: scene/resources/physics_material.cpp
msgid "Rough"
@@ -26485,9 +26354,8 @@ msgid "Top Radius"
msgstr "Rayon Supérieur"
#: scene/resources/primitive_meshes.cpp
-#, fuzzy
msgid "Bottom Radius"
-msgstr "En bas à droite"
+msgstr "Rayon bas"
#: scene/resources/primitive_meshes.cpp
msgid "Left To Right"
@@ -26574,18 +26442,16 @@ msgid "Content Margin"
msgstr "Marge de contenu"
#: scene/resources/style_box.cpp
-#, fuzzy
msgid "Expand Margin"
-msgstr "Développer tout"
+msgstr "Développer la marge"
#: scene/resources/style_box.cpp
msgid "Skew"
msgstr "Biseau"
#: scene/resources/style_box.cpp
-#, fuzzy
msgid "Corner Radius"
-msgstr "Changer le rayon intérieur de la tour"
+msgstr "Rayon de coin"
#: scene/resources/style_box.cpp
msgid "Corner Detail"
@@ -26604,9 +26470,8 @@ msgid "Grow End"
msgstr "Fin d'Expansion"
#: scene/resources/texture.cpp
-#, fuzzy
msgid "Load Path"
-msgstr "Charger un préréglage"
+msgstr "Charger chemin"
#: scene/resources/texture.cpp
msgid "Base Texture"
@@ -26673,14 +26538,12 @@ msgid "Output Port For Preview"
msgstr "Port de sortie de l'aperçu"
#: scene/resources/visual_shader.cpp
-#, fuzzy
msgid "Depth Draw"
-msgstr "Mode d’interpolation"
+msgstr "Dessin en profondeur"
#: scene/resources/visual_shader.cpp
-#, fuzzy
msgid "Cull"
-msgstr "Mode Règle"
+msgstr "élaguer/élagage"
#: scene/resources/visual_shader.cpp
msgid "Diffuse"
@@ -26727,9 +26590,8 @@ msgid "Cube Map"
msgstr "Textures en cube"
#: scene/resources/visual_shader_nodes.cpp
-#, fuzzy
msgid "Default Value Enabled"
-msgstr "Profil des fonctionnalités de Godot"
+msgstr "Valeur par défaut activée"
#: scene/resources/visual_shader_nodes.cpp
msgid "Default Value"
@@ -26757,25 +26619,23 @@ msgstr "Carte de navigation"
#: scene/resources/world.cpp scene/resources/world_2d.cpp
msgid "Direct Space State"
-msgstr ""
+msgstr "Etat de l'espace direct"
#: scene/resources/world.cpp scene/resources/world_2d.cpp
msgid "Default Gravity Vector"
msgstr "Vecteur de gravité par défaut"
#: scene/resources/world.cpp scene/resources/world_2d.cpp
-#, fuzzy
msgid "Default Linear Damp"
-msgstr "Linéaire gauche"
+msgstr "Amorti linéaire par défaut"
#: scene/resources/world.cpp scene/resources/world_2d.cpp
msgid "Default Angular Damp"
-msgstr ""
+msgstr "Amorti Angulaire par Défaut"
#: scene/resources/world.cpp
-#, fuzzy
msgid "Default Map Up"
-msgstr "Défaut"
+msgstr "Haut de carte par défaut"
#: scene/resources/world.cpp scene/resources/world_2d.cpp
msgid "Default Cell Size"
@@ -26807,7 +26667,7 @@ msgstr "AR"
#: servers/arvr/arvr_interface.cpp
msgid "Is Anchor Detection Enabled"
-msgstr ""
+msgstr "La détection d'ancre est-elle activée"
#: servers/arvr_server.cpp
msgid "Primary Interface"
@@ -26869,7 +26729,7 @@ msgstr "Niveau (dB)"
#: servers/audio/effects/audio_effect_delay.cpp
#: servers/audio/effects/audio_effect_panner.cpp
msgid "Pan"
-msgstr "Pan"
+msgstr "Panoramique/faire un panoramique"
#: servers/audio/effects/audio_effect_compressor.cpp
#: servers/audio/effects/audio_effect_filter.cpp
@@ -26890,15 +26750,15 @@ msgstr "Mixer"
#: servers/audio/effects/audio_effect_compressor.cpp
msgid "Sidechain"
-msgstr ""
+msgstr "Sidechain"
#: servers/audio/effects/audio_effect_delay.cpp
msgid "Tap 1"
-msgstr ""
+msgstr "Tap 1"
#: servers/audio/effects/audio_effect_delay.cpp
msgid "Tap 2"
-msgstr ""
+msgstr "Tap 2"
#: servers/audio/effects/audio_effect_delay.cpp
#: servers/audio/effects/audio_effect_phaser.cpp
@@ -26920,7 +26780,7 @@ msgstr "Garder haute fréquences (Hz)"
#: servers/audio/effects/audio_effect_distortion.cpp
msgid "Drive"
-msgstr ""
+msgstr "Elan"
#: servers/audio/effects/audio_effect_distortion.cpp
msgid "Post Gain"
@@ -26940,11 +26800,11 @@ msgstr "Seuil de dB"
#: servers/audio/effects/audio_effect_limiter.cpp
msgid "Soft Clip dB"
-msgstr ""
+msgstr "dB de Coupure Douce"
#: servers/audio/effects/audio_effect_limiter.cpp
msgid "Soft Clip Ratio"
-msgstr ""
+msgstr "Ratio de Coupure Douce"
#: servers/audio/effects/audio_effect_phaser.cpp
msgid "Range Min Hz"
@@ -26956,7 +26816,7 @@ msgstr "Borne supérieure de la plage (Hz)"
#: servers/audio/effects/audio_effect_pitch_shift.cpp
msgid "Oversampling"
-msgstr "Suréchantillonnage"
+msgstr "Sur-échantillonnage"
#: servers/audio/effects/audio_effect_pitch_shift.cpp
#: servers/audio/effects/audio_effect_spectrum_analyzer.cpp
@@ -26981,11 +26841,11 @@ msgstr "Passe-haut"
#: servers/audio/effects/audio_effect_spectrum_analyzer.cpp
msgid "Tap Back Pos"
-msgstr ""
+msgstr "Tap Position Arrière"
#: servers/audio/effects/audio_effect_stereo_enhance.cpp
msgid "Pan Pullout"
-msgstr ""
+msgstr "Retrait du Panoramique"
#: servers/audio/effects/audio_effect_stereo_enhance.cpp
msgid "Time Pullout (ms)"
@@ -27008,9 +26868,8 @@ msgid "Channel Disable Threshold dB"
msgstr "Désactiver le seuil de dB du canal"
#: servers/audio_server.cpp
-#, fuzzy
msgid "Channel Disable Time"
-msgstr "Changer le temps de mélange"
+msgstr "Temps de désactivation de canal"
#: servers/audio_server.cpp
msgid "Video Delay Compensation (ms)"
@@ -27054,7 +26913,7 @@ msgstr "Taille de la Table de Hachage BP"
#: servers/physics_2d/physics_2d_server_sw.cpp
msgid "Large Object Surface Threshold In Cells"
-msgstr ""
+msgstr "Seuil de Surface des Grands Objets dans les Cellules"
#: servers/physics_2d_server.cpp servers/physics_server.cpp
msgid "Inverse Mass"
@@ -27113,14 +26972,12 @@ msgid "Collision Depth"
msgstr "Profondeur de collision"
#: servers/physics_2d_server.cpp servers/physics_server.cpp
-#, fuzzy
msgid "Collision Safe Fraction"
-msgstr "Mode collision"
+msgstr "Fraction anti-collisions"
#: servers/physics_2d_server.cpp servers/physics_server.cpp
-#, fuzzy
msgid "Collision Unsafe Fraction"
-msgstr "Mode collision"
+msgstr "Fraction avec collisions potentielles"
#: servers/physics_2d_server.cpp servers/physics_server.cpp
msgid "Physics Engine"
@@ -27139,22 +26996,20 @@ msgid "Varying may not be assigned in the '%s' function."
msgstr "Varying ne peut pas être assigné dans la fonction '%s'."
#: servers/visual/shader_language.cpp
-#, fuzzy
msgid ""
"Varyings which were assigned in 'vertex' function may not be reassigned in "
"'fragment' or 'light'."
msgstr ""
-"Les Varyings assignées dans la fonction \"vertex\" ne peuvent pas être "
-"réassignées dans 'fragment' ou 'light'."
+"Les variations assignées dans la fonction \"sommet/vertex\" ne peuvent pas "
+"être réassignées dans \"fragment\" ou \"lumière/light\"."
#: servers/visual/shader_language.cpp
-#, fuzzy
msgid ""
"Varyings which were assigned in 'fragment' function may not be reassigned in "
"'vertex' or 'light'."
msgstr ""
-"Les Varyings attribuées dans la fonction 'fragment' ne peuvent pas être "
-"réattribuées dans 'vertex' ou 'light'."
+"Les variations attribuées dans la fonction \"fragment\" ne peuvent pas être "
+"réattribuées dans \"sommet/vertex\" ou \"lumière/light\"."
#: servers/visual/shader_language.cpp
msgid "Assignment to function."
@@ -27173,9 +27028,8 @@ msgid "Spatial Partitioning"
msgstr "Partitionnement Spatial"
#: servers/visual_server.cpp
-#, fuzzy
msgid "Render Loop Enabled"
-msgstr "Filtrer les signaux"
+msgstr "Boucle de rendu activée"
#: servers/visual_server.cpp
msgid "VRAM Compression"
@@ -27215,28 +27069,27 @@ msgstr "Niveau de compression WebP"
#: servers/visual_server.cpp
msgid "Time Rollover Secs"
-msgstr ""
+msgstr "Temps de Roulement en Secondes"
#: servers/visual_server.cpp
-#, fuzzy
msgid "Cubemap Size"
-msgstr "Changer la taille d'une caméra"
+msgstr "Taille de la Cubemap"
#: servers/visual_server.cpp
msgid "Quadrant 0 Subdiv"
-msgstr ""
+msgstr "Subdivisions Quadrant 0"
#: servers/visual_server.cpp
msgid "Quadrant 1 Subdiv"
-msgstr ""
+msgstr "Subdivision Quadrant 1"
#: servers/visual_server.cpp
msgid "Quadrant 2 Subdiv"
-msgstr ""
+msgstr "Subdivision Quadrant 2"
#: servers/visual_server.cpp
msgid "Quadrant 3 Subdiv"
-msgstr ""
+msgstr "Subdivision Quadrant 3"
#: servers/visual_server.cpp
msgid "Shadows"
@@ -27247,9 +27100,8 @@ msgid "Filter Mode"
msgstr "Mode de filtrage"
#: servers/visual_server.cpp
-#, fuzzy
msgid "Texture Array Reflections"
-msgstr "Centrer sur la sélection"
+msgstr "Refléxions de la liste de textures"
#: servers/visual_server.cpp
msgid "High Quality GGX"
@@ -27257,7 +27109,7 @@ msgstr "GGX haute qualité"
#: servers/visual_server.cpp
msgid "Irradiance Max Size"
-msgstr ""
+msgstr "Taille Max Irradiance"
#: servers/visual_server.cpp
msgid "Shading"
@@ -27265,7 +27117,7 @@ msgstr "Ombrage"
#: servers/visual_server.cpp
msgid "Force Vertex Shading"
-msgstr ""
+msgstr "Forcer l'Ombrage des Sommets"
#: servers/visual_server.cpp
msgid "Force Lambert Over Burley"
@@ -27277,24 +27129,23 @@ msgstr "Forcer Blinn au lieu de GGX"
#: servers/visual_server.cpp
msgid "Mesh Storage"
-msgstr ""
+msgstr "Stockage de Maillage"
#: servers/visual_server.cpp
-#, fuzzy
msgid "Split Stream"
-msgstr "Scinder la courbe"
+msgstr "Séparer flux"
#: servers/visual_server.cpp
msgid "Use Physical Light Attenuation"
-msgstr ""
+msgstr "Utiliser l'Atténuation Lumineuse Physique"
#: servers/visual_server.cpp
msgid "Depth Prepass"
-msgstr ""
+msgstr "Pré-passe de Profondeur"
#: servers/visual_server.cpp
msgid "Disable For Vendors"
-msgstr ""
+msgstr "Désactiver pour les Vendeurs"
#: servers/visual_server.cpp
msgid "Anisotropic Filter Level"
@@ -27310,15 +27161,15 @@ msgstr "Enveloppement"
#: servers/visual_server.cpp
msgid "Software Skinning Fallback"
-msgstr ""
+msgstr "Dépouillement Logiciel de Repli"
#: servers/visual_server.cpp
msgid "Force Software Skinning"
-msgstr ""
+msgstr "Forcer le Dépouillement Logiciel"
#: servers/visual_server.cpp
msgid "Use Software Skinning"
-msgstr ""
+msgstr "Utiliser Dépouillement Logiciel"
#: servers/visual_server.cpp
msgid "Ninepatch Mode"
@@ -27330,7 +27181,7 @@ msgstr "OpenGL"
#: servers/visual_server.cpp
msgid "Batching Send Null"
-msgstr ""
+msgstr "Traitement en Lot - Envoyer Null"
#: servers/visual_server.cpp
msgid "Batching Stream"
@@ -27338,11 +27189,11 @@ msgstr "Flux de traitement en lot"
#: servers/visual_server.cpp
msgid "Legacy Orphan Buffers"
-msgstr ""
+msgstr "Anciens Tampons Orphelins"
#: servers/visual_server.cpp
msgid "Legacy Stream"
-msgstr ""
+msgstr "Ancien Flux"
#: servers/visual_server.cpp
msgid "Batching"
@@ -27358,19 +27209,19 @@ msgstr "Utiliser le traitement en lot dans l'éditeur"
#: servers/visual_server.cpp
msgid "Single Rect Fallback"
-msgstr ""
+msgstr "Rectangle Unique de Repli"
#: servers/visual_server.cpp
msgid "Max Join Item Commands"
-msgstr ""
+msgstr "Commandes Max de Jointure d'Elements"
#: servers/visual_server.cpp
msgid "Colored Vertex Format Threshold"
-msgstr ""
+msgstr "Seuil de Format des Sommets Colorés"
#: servers/visual_server.cpp
msgid "Scissor Area Threshold"
-msgstr ""
+msgstr "Seuil d'Aire de Cisaillement"
#: servers/visual_server.cpp
msgid "Max Join Items"
@@ -27386,7 +27237,7 @@ msgstr "Anticipation de réorganisation d’éléments"
#: servers/visual_server.cpp
msgid "Flash Batching"
-msgstr ""
+msgstr "Traitement en Lot Flash"
#: servers/visual_server.cpp
msgid "Diagnose Frame"
@@ -27405,9 +27256,8 @@ msgid "Disable Half Float"
msgstr "Désactiver les demi Float"
#: servers/visual_server.cpp
-#, fuzzy
msgid "Enable High Float"
-msgstr "Activer la priorité"
+msgstr "Activer les grands flottants"
#: servers/visual_server.cpp
msgid "Precision"
@@ -27434,19 +27284,16 @@ msgid "Use Signals"
msgstr "Utiliser les signaux"
#: servers/visual_server.cpp
-#, fuzzy
msgid "Remove Danglers"
-msgstr "Supprimer la tuile"
+msgstr "Supprimer les pendouillants"
#: servers/visual_server.cpp
-#, fuzzy
msgid "Flip Imported Portals"
-msgstr "Retourner les Portals"
+msgstr "Retourner les portails importés"
#: servers/visual_server.cpp
-#, fuzzy
msgid "Occlusion Culling"
-msgstr "Voir la suppression de l'occlusion"
+msgstr "Elagage de l'occlusion"
#: servers/visual_server.cpp
msgid "Max Active Spheres"
diff --git a/editor/translations/ga.po b/editor/translations/ga.po
index 01810bb059..eea95f8656 100644
--- a/editor/translations/ga.po
+++ b/editor/translations/ga.po
@@ -10649,7 +10649,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/gl.po b/editor/translations/gl.po
index 1d2fbb333a..9bfb2b9309 100644
--- a/editor/translations/gl.po
+++ b/editor/translations/gl.po
@@ -11231,7 +11231,7 @@ msgstr "Perspetiva"
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/he.po b/editor/translations/he.po
index 57b2386570..7458eedd15 100644
--- a/editor/translations/he.po
+++ b/editor/translations/he.po
@@ -26,13 +26,14 @@
# Tomer Ben Rachel <tomerpacific@gmail.com>, 2022.
# moshe mil <milgmoshe@gmail.com>, 2022.
# Blawnode <blawnode@gmail.com>, 2022.
+# Yoni m <yoni.meirov08@gmail.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-11-23 20:47+0000\n"
-"Last-Translator: Blawnode <blawnode@gmail.com>\n"
+"PO-Revision-Date: 2023-01-01 05:48+0000\n"
+"Last-Translator: Yoni m <yoni.meirov08@gmail.com>\n"
"Language-Team: Hebrew <https://hosted.weblate.org/projects/godot-engine/"
"godot/he/>\n"
"Language: he\n"
@@ -41,7 +42,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=(n == 1) ? 0 : ((n == 2) ? 1 : ((n > 10 && "
"n % 10 == 0) ? 2 : 3));\n"
-"X-Generator: Weblate 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -274,9 +275,8 @@ msgid "Network Peer"
msgstr "מ×פיין\\עמית רשת"
#: core/io/multiplayer_api.cpp scene/animation/animation_player.cpp
-#, fuzzy
msgid "Root Node"
-msgstr "שינוי ×©× ×ž×¤×¨×§ השורש"
+msgstr "מפרק השורש"
#: core/io/networked_multiplayer_peer.cpp
msgid "Refuse New Connections"
@@ -300,11 +300,11 @@ msgstr "פלוט גודל מירבי של החוצץ"
#: core/io/packet_peer.cpp
msgid "Stream Peer"
-msgstr ""
+msgstr "×–×¨× ×¢×ž×™×ª×™×"
#: core/io/stream_peer.cpp
msgid "Big Endian"
-msgstr ""
+msgstr "×נדי×ן גדול"
#: core/io/stream_peer.cpp
#, fuzzy
@@ -395,18 +395,16 @@ msgid "Device"
msgstr "מכשיר"
#: core/os/input_event.cpp
-#, fuzzy
msgid "Alt"
-msgstr "הכל"
+msgstr "×לט"
#: core/os/input_event.cpp
msgid "Shift"
msgstr "הסט"
#: core/os/input_event.cpp
-#, fuzzy
msgid "Control"
-msgstr "בקרת גירס×ות"
+msgstr "לשלוט"
#: core/os/input_event.cpp
msgid "Meta"
@@ -417,9 +415,8 @@ msgid "Command"
msgstr "פקודה"
#: core/os/input_event.cpp
-#, fuzzy
msgid "Physical"
-msgstr "פיזיקה"
+msgstr "פיזי"
#: core/os/input_event.cpp scene/2d/touch_screen_button.cpp
#: scene/gui/base_button.cpp scene/gui/texture_button.cpp
@@ -428,9 +425,8 @@ msgid "Pressed"
msgstr "לחוץ"
#: core/os/input_event.cpp
-#, fuzzy
msgid "Scancode"
-msgstr "סריקת מקורות"
+msgstr "קוד סריקה"
#: core/os/input_event.cpp
msgid "Physical Scancode"
@@ -442,26 +438,23 @@ msgstr "יוניקוד"
#: core/os/input_event.cpp
msgid "Echo"
-msgstr ""
+msgstr "הד"
#: core/os/input_event.cpp scene/gui/base_button.cpp
-#, fuzzy
msgid "Button Mask"
-msgstr "כפתור"
+msgstr "מסכת כפתור"
#: core/os/input_event.cpp scene/2d/node_2d.cpp scene/gui/control.cpp
-#, fuzzy
msgid "Global Position"
-msgstr "קבוע"
+msgstr "×ž×™×§×•× ×’×œ×•×‘×œ×™"
#: core/os/input_event.cpp
msgid "Factor"
msgstr "פקטור"
#: core/os/input_event.cpp
-#, fuzzy
msgid "Button Index"
-msgstr "מפתח כפתורי עכבר:"
+msgstr "×ינדקס הכפתורי×"
#: core/os/input_event.cpp
msgid "Doubleclick"
@@ -477,12 +470,11 @@ msgstr "לחץ"
#: core/os/input_event.cpp
msgid "Pen Inverted"
-msgstr ""
+msgstr "עט הפוך"
#: core/os/input_event.cpp
-#, fuzzy
msgid "Relative"
-msgstr "GDNative"
+msgstr "קרוב משפחה"
#: core/os/input_event.cpp scene/2d/camera_2d.cpp scene/2d/cpu_particles_2d.cpp
#: scene/3d/cpu_particles.cpp scene/3d/interpolated_camera.cpp
@@ -497,9 +489,8 @@ msgid "Axis"
msgstr "ציר"
#: core/os/input_event.cpp
-#, fuzzy
msgid "Axis Value"
-msgstr "(ערך)"
+msgstr "ערך ציר"
#: core/os/input_event.cpp modules/visual_script/visual_script_func_nodes.cpp
msgid "Index"
@@ -529,16 +520,14 @@ msgid "Message"
msgstr "מסר"
#: core/os/input_event.cpp
-#, fuzzy
msgid "Pitch"
-msgstr "גובה צליל"
+msgstr "גובה הצליל"
#: core/os/input_event.cpp scene/2d/cpu_particles_2d.cpp
#: scene/2d/physics_body_2d.cpp scene/3d/cpu_particles.cpp
#: scene/3d/physics_body.cpp scene/resources/particles_material.cpp
-#, fuzzy
msgid "Velocity"
-msgstr "הגדלת ×ות ר×שונה"
+msgstr "מְהִירוּת"
#: core/os/input_event.cpp
msgid "Instrument"
@@ -559,14 +548,12 @@ msgid "Application"
msgstr "×פליקציה"
#: core/project_settings.cpp main/main.cpp
-#, fuzzy
msgid "Config"
-msgstr "הגדרת הצמדה"
+msgstr "הקונפדרציה"
#: core/project_settings.cpp
-#, fuzzy
msgid "Project Settings Override"
-msgstr "הגדרות מיז×..."
+msgstr "עקיפת הגדרות פרוייקט"
#: core/project_settings.cpp core/resource.cpp
#: editor/animation_track_editor.cpp editor/editor_autoload_settings.cpp
@@ -597,7 +584,7 @@ msgstr "הרצה"
#: core/project_settings.cpp editor/editor_node.cpp
#: editor/run_settings_dialog.cpp main/main.cpp
msgid "Main Scene"
-msgstr ""
+msgstr "סצנה ר×שית"
#: core/project_settings.cpp
msgid "Disable stdout"
@@ -609,22 +596,21 @@ msgstr "השבת stderr"
#: core/project_settings.cpp
msgid "Use Hidden Project Data Directory"
-msgstr ""
+msgstr "שימוש בספריית נתוני פרוייקט מוסתרי×"
#: core/project_settings.cpp
msgid "Use Custom User Dir"
-msgstr ""
+msgstr "השתמש ב- Dir משתמש מות×× ×ישית"
#: core/project_settings.cpp
msgid "Custom User Dir Name"
-msgstr ""
+msgstr "×©× ×ª×™×§×™×™×ª משתמש מות×× ×ישית"
#: core/project_settings.cpp main/main.cpp
#: platform/javascript/export/export.cpp platform/osx/export/export.cpp
#: platform/uwp/os_uwp.cpp
-#, fuzzy
msgid "Display"
-msgstr "הצג הכל"
+msgstr "הצג"
#: core/project_settings.cpp main/main.cpp modules/csg/csg_shape.cpp
#: modules/opensimplex/noise_texture.cpp scene/2d/line_2d.cpp
@@ -643,7 +629,7 @@ msgstr "גבה"
#: core/project_settings.cpp
msgid "Always On Top"
-msgstr ""
+msgstr "תמיד עליון"
#: core/project_settings.cpp
msgid "Test Width"
@@ -672,30 +658,27 @@ msgstr "עורך"
#: core/project_settings.cpp
msgid "Main Run Args"
-msgstr ""
+msgstr "×¤×¨×ž×˜×¨×™× ×¨××©×™×™× ×œ×¨×™×¦×”"
#: core/project_settings.cpp
-#, fuzzy
msgid "Scene Naming"
-msgstr "נתיב סצנות:"
+msgstr "מתן שמות לסצינה"
#: core/project_settings.cpp
msgid "Search In File Extensions"
-msgstr ""
+msgstr "חיפוש בסיומות קבצי×"
#: core/project_settings.cpp
msgid "Script Templates Search Path"
-msgstr ""
+msgstr "נתיב חיפוש של תבניות סקריפט"
#: core/project_settings.cpp
-#, fuzzy
msgid "Version Control Autoload On Startup"
-msgstr "בקרת גירס×ות"
+msgstr "טעינה ×וטומטית של בקרת גירס×ות בעת ×”×תחול"
#: core/project_settings.cpp
-#, fuzzy
msgid "Version Control Plugin Name"
-msgstr "בקרת גירס×ות"
+msgstr "×©× ×ª×•×¡×£ בקרת גרס×ות"
#: core/project_settings.cpp scene/2d/collision_object_2d.cpp
#: scene/3d/collision_object.cpp scene/gui/control.cpp
@@ -704,62 +687,55 @@ msgstr "קלט"
#: core/project_settings.cpp
msgid "UI Accept"
-msgstr ""
+msgstr "ממשק משתמש - ×ישור"
#: core/project_settings.cpp
-#, fuzzy
msgid "UI Select"
-msgstr "בחירה"
+msgstr "בחירת ממשק משתמש"
#: core/project_settings.cpp
msgid "UI Cancel"
-msgstr ""
+msgstr "ביטול ממשק משתמש"
#: core/project_settings.cpp
-#, fuzzy
msgid "UI Focus Next"
-msgstr "מיקוד נתיב"
+msgstr "מיקוד ממשק המשתמש הב×"
#: core/project_settings.cpp
-#, fuzzy
msgid "UI Focus Prev"
-msgstr "מיקוד נתיב"
+msgstr "מיקוד ממשק משתמש קוד×"
#: core/project_settings.cpp
-#, fuzzy
msgid "UI Left"
-msgstr "שמ×ל"
+msgstr "ממשק משתמש שמ×ל"
#: core/project_settings.cpp
-#, fuzzy
msgid "UI Right"
-msgstr "ימין"
+msgstr "ממשק משתמש ימין"
#: core/project_settings.cpp
msgid "UI Up"
-msgstr ""
+msgstr "ממשק משתמש למעלה"
#: core/project_settings.cpp
-#, fuzzy
msgid "UI Down"
-msgstr "הורדה"
+msgstr "ממשק משתמש למטה"
#: core/project_settings.cpp
msgid "UI Page Up"
-msgstr ""
+msgstr "עמוד למעלה ממשק המשתמש"
#: core/project_settings.cpp
msgid "UI Page Down"
-msgstr ""
+msgstr "עמוד למטה ממשק משתמש"
#: core/project_settings.cpp
msgid "UI Home"
-msgstr ""
+msgstr "ממשק משתמש בית"
#: core/project_settings.cpp
-#, fuzzy
msgid "UI End"
-msgstr "בסוף"
+msgstr "ממשק משתמש סוף"
#: core/project_settings.cpp main/main.cpp modules/bullet/register_types.cpp
#: modules/bullet/space_bullet.cpp scene/2d/physics_body_2d.cpp
@@ -796,7 +772,7 @@ msgstr ""
#: scene/main/viewport.cpp servers/visual/visual_server_scene.cpp
#: servers/visual_server.cpp
msgid "Rendering"
-msgstr ""
+msgstr "רינדור"
#: core/project_settings.cpp drivers/gles2/rasterizer_storage_gles2.cpp
#: drivers/gles3/rasterizer_scene_gles3.cpp
@@ -816,7 +792,7 @@ msgstr "מסנני×"
#: core/project_settings.cpp scene/main/viewport.cpp
msgid "Sharpen Intensity"
-msgstr ""
+msgstr "עוצמת חידוד"
#: core/project_settings.cpp editor/editor_export.cpp editor/editor_node.cpp
#: editor/editor_settings.cpp editor/plugins/script_editor_plugin.cpp
@@ -842,42 +818,40 @@ msgid "Profiler"
msgstr "מ×פיין"
#: core/project_settings.cpp
-#, fuzzy
msgid "Max Functions"
-msgstr "יצירת פונקציה"
+msgstr "פונקציות מקסימו×"
#: core/project_settings.cpp scene/3d/vehicle_body.cpp
msgid "Compression"
msgstr "כיווץ"
#: core/project_settings.cpp
-#, fuzzy
msgid "Formats"
-msgstr "תבנית"
+msgstr "פורמטי×"
#: core/project_settings.cpp
msgid "Zstd"
-msgstr ""
+msgstr "Zstd"
#: core/project_settings.cpp
msgid "Long Distance Matching"
-msgstr ""
+msgstr "הת×מה ×œ×ž×¨×—×§×™× ×רוכי×"
#: core/project_settings.cpp
msgid "Compression Level"
-msgstr ""
+msgstr "רמת דחיסה"
#: core/project_settings.cpp
msgid "Window Log Size"
-msgstr ""
+msgstr "גודל חלון יומן"
#: core/project_settings.cpp
msgid "Zlib"
-msgstr ""
+msgstr "ZLIB"
#: core/project_settings.cpp
msgid "Gzip"
-msgstr ""
+msgstr "Gzip"
#: core/project_settings.cpp platform/android/export/export.cpp
msgid "Android"
@@ -885,24 +859,23 @@ msgstr "Android"
#: core/project_settings.cpp
msgid "Modules"
-msgstr ""
+msgstr "מודולי×"
#: core/register_core_types.cpp
msgid "TCP"
msgstr "TCP"
#: core/register_core_types.cpp
-#, fuzzy
msgid "Connect Timeout Seconds"
-msgstr "שניות קצובות להתחברות"
+msgstr "זמן קצוב לחיבור בשניות"
#: core/register_core_types.cpp
msgid "Packet Peer Stream"
-msgstr ""
+msgstr "×–×¨× ×¢×ž×™×ª מנות"
#: core/register_core_types.cpp
msgid "Max Buffer (Power of 2)"
-msgstr ""
+msgstr "גודל מחסנית מקסימלי (בחזקה)"
#: core/register_core_types.cpp editor/editor_settings.cpp main/main.cpp
msgid "SSL"
@@ -943,7 +916,7 @@ msgstr "בדיקה"
#: core/translation.cpp scene/resources/font.cpp
msgid "Fallback"
-msgstr ""
+msgstr "חזרה"
#: core/ustring.cpp scene/resources/segment_shape_2d.cpp
msgid "B"
@@ -979,7 +952,7 @@ msgstr "EiB"
#: drivers/gles3/rasterizer_scene_gles3.cpp
#: drivers/gles3/rasterizer_storage_gles3.cpp modules/gltf/gltf_state.cpp
msgid "Buffers"
-msgstr ""
+msgstr "מחסניות"
#: drivers/gles2/rasterizer_canvas_base_gles2.cpp
#: drivers/gles3/rasterizer_canvas_base_gles3.cpp
@@ -1005,39 +978,36 @@ msgstr "2D"
#: drivers/gles2/rasterizer_canvas_base_gles2.cpp
#: drivers/gles3/rasterizer_canvas_base_gles3.cpp
-#, fuzzy
msgid "Snapping"
-msgstr "הגדרות הצמדה"
+msgstr "הצמדה"
#: drivers/gles2/rasterizer_canvas_base_gles2.cpp
#: drivers/gles3/rasterizer_canvas_base_gles3.cpp
-#, fuzzy
msgid "Use GPU Pixel Snap"
-msgstr "מצב מרחב מקומי (%s)"
+msgstr "שימוש בהצמדת ×¤×™×§×¡×œ×™× ×©×œ GPU"
#: drivers/gles2/rasterizer_scene_gles2.cpp
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Immediate Buffer Size (KB)"
-msgstr ""
+msgstr "גודל מחסנית מיידי (KB)"
#: drivers/gles2/rasterizer_storage_gles2.cpp
#: drivers/gles3/rasterizer_storage_gles3.cpp
-#, fuzzy
msgid "Lightmapping"
-msgstr "×פיית Lightmaps"
+msgstr "מיפוי ×ורות"
#: drivers/gles2/rasterizer_storage_gles2.cpp
#: drivers/gles3/rasterizer_storage_gles3.cpp
msgid "Use Bicubic Sampling"
-msgstr ""
+msgstr "השתמש בדגימה דו-כיוונית"
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Max Renderable Elements"
-msgstr ""
+msgstr "×ž×§×¡×™×ž×•× ×¨×›×™×‘×™× ×”× ×™×ª× ×™× ×œ×¨×™× ×“×•×¨"
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Max Renderable Lights"
-msgstr ""
+msgstr "×ž×§×¡×™×ž×•× ×ורות × ×™×ª× ×™× ×œ×¨×™× ×“×•×¨"
#: drivers/gles3/rasterizer_scene_gles3.cpp
#, fuzzy
@@ -1046,11 +1016,11 @@ msgstr "GridMap מחיקת הבחירה"
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Max Lights Per Object"
-msgstr ""
+msgstr "×ž×§×¡×™×ž×•× ×ורות לכל ×ובייקט"
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Subsurface Scattering"
-msgstr ""
+msgstr "פיזור תת-שטח"
#: drivers/gles3/rasterizer_scene_gles3.cpp editor/animation_track_editor.cpp
#: editor/import/resource_importer_texture.cpp
@@ -1067,15 +1037,15 @@ msgstr "קנה מידה"
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Follow Surface"
-msgstr ""
+msgstr "עקוב ×חר פני השטח"
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Weight Samples"
-msgstr ""
+msgstr "דוגמ×ות משקל"
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Voxel Cone Tracing"
-msgstr ""
+msgstr "מעקב חרוט ווקסל"
#: drivers/gles3/rasterizer_scene_gles3.cpp scene/resources/environment.cpp
msgid "High Quality"
@@ -1192,7 +1162,7 @@ msgstr "כמות:"
#: editor/animation_track_editor.cpp main/main.cpp
#: modules/mono/mono_gd/gd_mono.cpp
msgid "Args"
-msgstr ""
+msgstr "×רגומנטי×"
#: editor/animation_track_editor.cpp editor/editor_settings.cpp
#: editor/script_editor_debugger.cpp modules/gltf/gltf_accessor.cpp
@@ -1214,7 +1184,7 @@ msgstr ""
#: scene/2d/audio_stream_player_2d.cpp scene/3d/audio_stream_player_3d.cpp
#: scene/audio/audio_stream_player.cpp scene/gui/video_player.cpp
msgid "Stream"
-msgstr ""
+msgstr "זר×"
#: editor/animation_track_editor.cpp
#, fuzzy
@@ -1238,7 +1208,7 @@ msgstr "הנפשה"
#: editor/animation_track_editor.cpp
msgid "Easing"
-msgstr ""
+msgstr "הקלה (×נימציה)"
#: editor/animation_track_editor.cpp
msgid "Anim Multi Change Keyframe Time"
@@ -1373,7 +1343,7 @@ msgstr "קנה מידה:"
#: editor/scene_tree_editor.cpp editor/script_editor_debugger.cpp
#: modules/visual_script/visual_script_editor.cpp
msgid "Type:"
-msgstr ""
+msgstr "סוג:"
#: editor/animation_track_editor.cpp
#, fuzzy
@@ -1466,7 +1436,7 @@ msgstr "שכפול מפתח(ות)"
#: editor/animation_track_editor.cpp
msgid "Add RESET Value(s)"
-msgstr ""
+msgstr "הוסף ערכי ×יפוס"
#: editor/animation_track_editor.cpp
msgid "Delete Key(s)"
@@ -2232,7 +2202,7 @@ msgstr "פתיחה"
#: editor/dependency_editor.cpp
msgid "Owners of: %s (Total: %d)"
-msgstr ""
+msgstr "×‘×¢×œ×™× ×©×œ: %s (סה\"×›: %d)"
#: editor/dependency_editor.cpp
msgid ""
@@ -2645,7 +2615,7 @@ msgstr "×©× ×©×’×•×™."
#: editor/editor_autoload_settings.cpp
msgid "Cannot begin with a digit."
-msgstr ""
+msgstr "×œ× × ×™×ª×Ÿ להתחיל ×¢× ×¡×™×¤×¨×”."
#: editor/editor_autoload_settings.cpp
msgid "Valid characters:"
@@ -2790,7 +2760,7 @@ msgstr "בחירה"
#: editor/editor_export.cpp
msgid "Project export for platform:"
-msgstr ""
+msgstr "×™×™×¦×•× ×¤×¨×•×™×§×˜ לפלטפורמה:"
#: editor/editor_export.cpp
#, fuzzy
@@ -2908,7 +2878,7 @@ msgstr "חברי×"
#: platform/javascript/export/export.cpp platform/osx/export/export.cpp
#: platform/uwp/export/export.cpp
msgid "Release"
-msgstr ""
+msgstr "שחרר"
#: editor/editor_export.cpp
#, fuzzy
@@ -2917,7 +2887,7 @@ msgstr "התמרה"
#: editor/editor_export.cpp
msgid "64 Bits"
-msgstr ""
+msgstr "64 ביטי×"
#: editor/editor_export.cpp
msgid "Embed PCK"
@@ -2930,23 +2900,23 @@ msgstr "מצב שינוי קנה מידה (R)"
#: editor/editor_export.cpp
msgid "BPTC"
-msgstr ""
+msgstr "BPTC"
#: editor/editor_export.cpp platform/osx/export/export.cpp
msgid "S3TC"
-msgstr ""
+msgstr "S3TC"
#: editor/editor_export.cpp platform/osx/export/export.cpp
msgid "ETC"
-msgstr ""
+msgstr "ETC"
#: editor/editor_export.cpp platform/osx/export/export.cpp
msgid "ETC2"
-msgstr ""
+msgstr "ETC2"
#: editor/editor_export.cpp
msgid "No BPTC Fallbacks"
-msgstr ""
+msgstr "×ין חזרות BPTC"
#: editor/editor_export.cpp platform/android/export/export_plugin.cpp
#: platform/iphone/export/export.cpp platform/javascript/export/export.cpp
@@ -2991,7 +2961,7 @@ msgstr "×‘×™×™×¦×•× ×רכיטקטורת 32 ביט, ×” PCK המובנה ×œ× ×™
#: editor/editor_export.cpp
msgid "Convert Text Resources To Binary On Export"
-msgstr ""
+msgstr "המרת מש×בי טקסט לבינ××¨×™×™× ×‘×™×™×¦×•×"
#: editor/editor_feature_profile.cpp
msgid "3D Editor"
@@ -3315,7 +3285,7 @@ msgstr "הצג/הסתר ×§×‘×¦×™× ×ž×•×¡×ª×¨×™×"
#: editor/editor_file_dialog.cpp
msgid "Disable Overwrite Warning"
-msgstr ""
+msgstr "השבת ×ת ×זהרת החלפה"
#: editor/editor_file_dialog.cpp
msgid "Go Back"
@@ -3471,16 +3441,16 @@ msgstr "קבועי×"
#: editor/editor_help.cpp editor/plugins/theme_editor_plugin.cpp
msgid "Fonts"
-msgstr ""
+msgstr "גופני×"
#: editor/editor_help.cpp editor/plugins/theme_editor_plugin.cpp
#: platform/iphone/export/export.cpp
msgid "Icons"
-msgstr ""
+msgstr "סמלי×"
#: editor/editor_help.cpp
msgid "Styles"
-msgstr ""
+msgstr "סגנונות"
#: editor/editor_help.cpp
msgid "Enumerations"
@@ -3530,7 +3500,7 @@ msgstr "עזרה"
#: editor/editor_help.cpp
msgid "Sort Functions Alphabetically"
-msgstr ""
+msgstr "מיון פונקציות בסדר ×לפביתי"
#: editor/editor_help_search.cpp editor/editor_node.cpp
#: editor/plugins/script_editor_plugin.cpp
@@ -3622,7 +3592,7 @@ msgstr "מתודות בלבד"
#: editor/editor_inspector.cpp editor/plugins/item_list_editor_plugin.cpp
msgid "Checkable"
-msgstr ""
+msgstr "ניתן לבדיקה"
#: editor/editor_inspector.cpp editor/plugins/item_list_editor_plugin.cpp
#: scene/resources/default_theme/default_theme.cpp
@@ -3648,11 +3618,11 @@ msgstr "(ערך)"
#: editor/editor_inspector.cpp
msgid ""
"Pinning a value forces it to be saved even if it's equal to the default."
-msgstr ""
+msgstr "הצמדת ערך מ×לצת ×ותו להישמר ×’× ×× ×”×•× ×©×•×•×” לברירת המחדל."
#: editor/editor_inspector.cpp
msgid "Pin value [Disabled because '%s' is editor-only]"
-msgstr ""
+msgstr "הצמדת ערך [מושבת מכיוון ש- '%s' ×”×•× ×œ-עורך בלבד]"
#: editor/editor_inspector.cpp
#: editor/plugins/gradient_texture_2d_editor_plugin.cpp
@@ -3669,11 +3639,11 @@ msgstr "קביעה מרובה:"
#: editor/editor_inspector.cpp
msgid "Pinned %s"
-msgstr ""
+msgstr "הוצמד %s"
#: editor/editor_inspector.cpp
msgid "Unpinned %s"
-msgstr ""
+msgstr "בוטלה ההצמדה של %s"
#: editor/editor_inspector.cpp
#, fuzzy
@@ -3761,7 +3731,7 @@ msgstr "חלון חדש"
#: editor/editor_node.cpp editor/project_manager.cpp
msgid "Unnamed Project"
-msgstr ""
+msgstr "פרויקט ×œ×œ× ×©×"
#: editor/editor_node.cpp
msgid ""
@@ -3769,6 +3739,9 @@ msgid ""
"Update Continuously is enabled, which can increase power usage. Click to "
"disable it."
msgstr ""
+"מסתובב ×›×שר חלון העורך מצייר מחדש.\n"
+"×”×פשרות 'עדכן רציף' מופעלת, מה שעלול להגביר ×ת צריכת החשמל. לחץ כדי להשבית "
+"×ותו."
#: editor/editor_node.cpp
msgid "Spins when the editor window redraws."
@@ -3895,6 +3868,8 @@ msgid ""
"An error occurred while trying to save the editor layout.\n"
"Make sure the editor's user data path is writable."
msgstr ""
+"×ירעה שגי××” בעת ניסיון לשמור ×ת פריסת העורך.\n"
+"×•×“× ×©× ×ª×™×‘ נתוני המשתמש של העורך ניתן לכתיבה."
#: editor/editor_node.cpp
msgid ""
@@ -3902,6 +3877,9 @@ msgid ""
"To restore the Default layout to its base settings, use the Delete Layout "
"option and delete the Default layout."
msgstr ""
+"פריסת עורך ברירת המחדל נדרסת.\n"
+"כדי לשחזר ×ת פריסת ברירת המחדל להגדרות הבסיס שלה, השתמש ב×פשרות מחק פריסה "
+"ומחק ×ת פריסת ברירת המחדל."
#: editor/editor_node.cpp
msgid "Layout name not found!"
@@ -3963,7 +3941,7 @@ msgstr "×ין סצנה מוגדרת להרצה."
#: editor/editor_node.cpp
msgid "Save scene before running..."
-msgstr ""
+msgstr "שמור סצנה לפני ריצה..."
#: editor/editor_node.cpp
msgid "Could not start subprocess!"
@@ -4009,13 +3987,14 @@ msgstr "לשמור ×ת ×”×©×™× ×•×™×™× ×œÖ¾'%s' לפני הסגירה?"
#: editor/editor_node.cpp
msgid "%s no longer exists! Please specify a new save location."
-msgstr ""
+msgstr "%s כבר ×œ× ×§×™×™×! × × ×œ×¦×™×™×Ÿ ×ž×™×§×•× ×©×ž×™×¨×” חדש."
#: editor/editor_node.cpp
msgid ""
"The current scene has no root node, but %d modified external resource(s) "
"were saved anyway."
msgstr ""
+"לסצנה הנוכחית ×ין צומת שורש, ×ך %d מש××‘×™× ×—×™×¦×•× ×™×™× ×©×©×•× ×• נשמרו בכל מקרה."
#: editor/editor_node.cpp
#, fuzzy
@@ -11258,7 +11237,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/hi.po b/editor/translations/hi.po
index 657ee0ff41..229a1e6ee7 100644
--- a/editor/translations/hi.po
+++ b/editor/translations/hi.po
@@ -11065,7 +11065,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/hr.po b/editor/translations/hr.po
index 85fcb184f3..d3ea72cf63 100644
--- a/editor/translations/hr.po
+++ b/editor/translations/hr.po
@@ -8,12 +8,13 @@
# LeoClose <leoclose575@gmail.com>, 2020, 2021, 2022.
# Filip <fhomolka@protonmail.com>, 2022.
# Milo Ivir <mail@milotype.de>, 2022.
+# peter277 <ps2718@hotmail.com>, 2022.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
-"PO-Revision-Date: 2022-09-27 21:37+0000\n"
-"Last-Translator: Milo Ivir <mail@milotype.de>\n"
+"PO-Revision-Date: 2022-12-21 07:02+0000\n"
+"Last-Translator: peter277 <ps2718@hotmail.com>\n"
"Language-Team: Croatian <https://hosted.weblate.org/projects/godot-engine/"
"godot/hr/>\n"
"Language: hr\n"
@@ -21,7 +22,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 4.14.1\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -3432,7 +3433,7 @@ msgstr ""
#: editor/editor_help.cpp
msgid "Enumerations"
-msgstr ""
+msgstr "Nabrajanja"
#: editor/editor_help.cpp
msgid "Property Descriptions"
@@ -10824,7 +10825,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/hu.po b/editor/translations/hu.po
index b8bab10568..ad7ba523e3 100644
--- a/editor/translations/hu.po
+++ b/editor/translations/hu.po
@@ -11273,7 +11273,7 @@ msgstr "Perspektíva"
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/id.po b/editor/translations/id.po
index 89153d88d3..47b026986a 100644
--- a/editor/translations/id.po
+++ b/editor/translations/id.po
@@ -41,13 +41,14 @@
# Primananda Kurnia <primakurnia71@gmail.com>, 2022.
# FellowMustard <rachmawanng33@gmail.com>, 2022.
# Muhammad Zainal Abidin <eviepk12@gmail.com>, 2022.
+# adfriz <aditiyaafrizal2@gmail.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-09-27 21:37+0000\n"
-"Last-Translator: Muhammad Zainal Abidin <eviepk12@gmail.com>\n"
+"PO-Revision-Date: 2023-01-04 10:47+0000\n"
+"Last-Translator: adfriz <aditiyaafrizal2@gmail.com>\n"
"Language-Team: Indonesian <https://hosted.weblate.org/projects/godot-engine/"
"godot/id/>\n"
"Language: id\n"
@@ -55,7 +56,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 4.14.1\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -11181,7 +11182,7 @@ msgstr "Perspektif Belakang"
msgid " [auto]"
msgstr " [auto]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [portal aktif]"
@@ -20765,9 +20766,8 @@ msgid "Executable \"pck\" section not found."
msgstr ""
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Windows"
-msgstr "Jendela Baru"
+msgstr "Windows"
#: platform/windows/export/export.cpp
msgid "Rcedit"
diff --git a/editor/translations/ig.po b/editor/translations/ig.po
index e0c1a85c99..9acd1e98b7 100644
--- a/editor/translations/ig.po
+++ b/editor/translations/ig.po
@@ -10569,7 +10569,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/is.po b/editor/translations/is.po
index 7551598f22..fda8086f4b 100644
--- a/editor/translations/is.po
+++ b/editor/translations/is.po
@@ -10792,7 +10792,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/it.po b/editor/translations/it.po
index f1ff871a69..6010f082aa 100644
--- a/editor/translations/it.po
+++ b/editor/translations/it.po
@@ -73,7 +73,7 @@
# ale piccia <picciatialessio2@gmail.com>, 2022.
# Simone Starace <simone.starace93@gmail.com>, 2022.
# Daniele Giunta <danielegiunta2007@gmail.com>, 2022.
-# Damiano Guida <damiano.guida22@gmail.com>, 2022.
+# Damiano Guida <damiano.guida22@gmail.com>, 2022, 2023.
# Silvia Scaglione <sissisoad@gmail.com>, 2022.
# Cosimo Davide Viggiano <cosimod089@gmail.com>, 2022.
# Francesco Cammarata <francescocammarata.fr@gmail.com>, 2022.
@@ -82,8 +82,8 @@ msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-11-22 20:37+0000\n"
-"Last-Translator: Francesco Cammarata <francescocammarata.fr@gmail.com>\n"
+"PO-Revision-Date: 2023-01-15 13:34+0000\n"
+"Last-Translator: Damiano Guida <damiano.guida22@gmail.com>\n"
"Language-Team: Italian <https://hosted.weblate.org/projects/godot-engine/"
"godot/it/>\n"
"Language: it\n"
@@ -91,7 +91,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 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -11031,7 +11031,7 @@ msgstr "Prospettica da dietro"
msgid " [auto]"
msgstr " [auto]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [portali attivi]"
@@ -26477,7 +26477,7 @@ msgstr "Debug del Canale UV"
#: scene/resources/environment.cpp
msgid "Blur"
-msgstr ""
+msgstr "Sfocatura"
#: scene/resources/environment.cpp
msgid "Edge Sharpness"
diff --git a/editor/translations/ja.po b/editor/translations/ja.po
index dc17329ba7..e7016610d7 100644
--- a/editor/translations/ja.po
+++ b/editor/translations/ja.po
@@ -46,13 +46,13 @@
# Fire Dingo <snowsable113@icloud.com>, 2022.
# Narazaki Shuji <shujinarazaki@protonmail.com>, 2022.
# ta ko <neji.cion@gmail.com>, 2022.
-# T K <kidaaam@gmail.com>, 2022.
+# T K <kidaaam@gmail.com>, 2022, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-12-13 13:21+0000\n"
+"PO-Revision-Date: 2023-01-20 10:19+0000\n"
"Last-Translator: T K <kidaaam@gmail.com>\n"
"Language-Team: Japanese <https://hosted.weblate.org/projects/godot-engine/"
"godot/ja/>\n"
@@ -61,7 +61,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 4.15-dev\n"
+"X-Generator: Weblate 4.15.1\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -886,7 +886,6 @@ msgid "Connect Timeout Seconds"
msgstr "接続タイムアウトã®ç§’æ•°"
#: core/register_core_types.cpp
-#, fuzzy
msgid "Packet Peer Stream"
msgstr "パケットピアストリーム"
@@ -5288,12 +5287,11 @@ msgstr "ダイアログã®ãƒãƒƒãƒ—アップ時ã«ã‚¨ãƒ‡ã‚£ã‚¿ãƒ¼ã‚’è–„æš—ãã™
#: editor/editor_settings.cpp main/main.cpp
msgid "Low Processor Mode Sleep (µsec)"
-msgstr "低プロセッサ モード スリープ (マイクロ秒)"
+msgstr "çœã‚¨ãƒãƒ¢ãƒ¼ãƒ‰ã‚¹ãƒªãƒ¼ãƒ—時間 (マイクロ秒)"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Unfocused Low Processor Mode Sleep (µsec)"
-msgstr "フォーカスã•れã¦ã„ãªã„低プロセッサ モード スリープ (マイクロ秒)"
+msgstr "éžãƒ•ォーカス時ã®çœã‚¨ãƒãƒ¢ãƒ¼ãƒ‰ã‚¹ãƒªãƒ¼ãƒ—時間 (マイクロ秒)"
#: editor/editor_settings.cpp
msgid "Separate Distraction Mode"
@@ -5346,9 +5344,8 @@ msgid "Border Size"
msgstr "ボーダーサイズ"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Use Graph Node Headers"
-msgstr "グラフ ノード ヘッダーを使用ã™ã‚‹"
+msgstr "グラフノードヘッダーを使用ã™ã‚‹"
#: editor/editor_settings.cpp
msgid "Additional Spacing"
@@ -5690,9 +5687,8 @@ msgid "Secondary Grid Color"
msgstr "グリッドã®ã‚»ã‚«ãƒ³ãƒ€ãƒªã®è‰²"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Selection Box Color"
-msgstr "é¸æŠžç¯„å›²ã®ã¿"
+msgstr "é¸æŠžãƒœãƒƒã‚¯ã‚¹ã®è‰²"
#: editor/editor_settings.cpp editor/plugins/path_editor_plugin.cpp
#: editor/spatial_editor_gizmos.cpp modules/csg/csg_gizmos.cpp
@@ -5795,19 +5791,16 @@ msgid "Emulate 3 Button Mouse"
msgstr "3ボタンマウスをエミュレート"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Orbit Modifier"
-msgstr "更新日時ãŒå¤ã„é †ã§ä¸¦ã³æ›¿ãˆ"
+msgstr "オービットæ“作ã®ä¿®é£¾ã‚­ãƒ¼"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Pan Modifier"
-msgstr "パンモード"
+msgstr "パンæ“作ã®ä¿®é£¾ã‚­ãƒ¼"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Zoom Modifier"
-msgstr "変更済ã¿"
+msgstr "ズームæ“作ã®ä¿®é£¾ã‚­ãƒ¼"
#: editor/editor_settings.cpp editor/plugins/spatial_editor_plugin.cpp
#, fuzzy
@@ -5815,38 +5808,32 @@ msgid "Warped Mouse Panning"
msgstr "ワープマウスパンニング"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Navigation Feel"
-msgstr "ナビゲーションモード"
+msgstr "ナビゲーション感度"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Orbit Sensitivity"
-msgstr "è»Œé“æ„Ÿåº¦"
+msgstr "オービット感度"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Orbit Inertia"
-msgstr "è»Œé“æ…£æ€§"
+msgstr "オービット慣性"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Translation Inertia"
-msgstr "翻訳"
+msgstr "ç§»å‹•ã®æ…£æ€§"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Zoom Inertia"
-msgstr "ズームイン"
+msgstr "ã‚ºãƒ¼ãƒ ã®æ…£æ€§"
#: editor/editor_settings.cpp
msgid "Freelook"
msgstr "フリールック"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook Navigation Scheme"
-msgstr "ナビゲーションメッシュを生æˆ"
+msgstr "フリールックナビゲーション方å¼"
#: editor/editor_settings.cpp
msgid "Freelook Sensitivity"
@@ -5861,14 +5848,12 @@ msgid "Freelook Base Speed"
msgstr "フリールックã®åŸºæœ¬é€Ÿåº¦"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook Activation Modifier"
-msgstr "ãƒ•ãƒªãƒ¼ãƒ«ãƒƒã‚¯ã®æ¸›é€Ÿèª¿æ•´"
+msgstr "フリールック有効化ã®ä¿®é£¾ã‚­ãƒ¼"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook Speed Zoom Link"
-msgstr "フリールックã®é€Ÿåº¦èª¿æ•´"
+msgstr "フリールックã®é€Ÿåº¦ã‚’ズーム値ã«ãƒªãƒ³ã‚¯"
#: editor/editor_settings.cpp editor/plugins/tile_map_editor_plugin.cpp
msgid "Grid Color"
@@ -5915,14 +5900,12 @@ msgid "Viewport Border Color"
msgstr "ビューãƒãƒ¼ãƒˆã®ãƒœãƒ¼ãƒ€ãƒ¼ã®è‰²"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Constrain Editor View"
-msgstr "エディター ビューを制é™"
+msgstr "エディタビューをæŸç¸›ã™ã‚‹"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Simple Panning"
-msgstr "簡易パンニング"
+msgstr "簡易パンニングæ“作"
#: editor/editor_settings.cpp
#, fuzzy
@@ -5930,23 +5913,20 @@ msgid "Scroll To Pan"
msgstr "スクロールã—ã¦ãƒ‘ンニング"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Pan Speed"
-msgstr "速度:"
+msgstr "パン速度"
#: editor/editor_settings.cpp editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Poly Editor"
msgstr "ãƒãƒªã‚´ãƒ³ã‚¨ãƒ‡ã‚£ã‚¿ãƒ¼"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Point Grab Radius"
-msgstr "ãƒã‚¤ãƒ³ãƒˆã‚°ãƒ©ãƒ–åŠå¾„"
+msgstr "ãƒã‚¤ãƒ³ãƒˆã®é¸æŠžåŠå¾„"
#: editor/editor_settings.cpp editor/plugins/polygon_2d_editor_plugin.cpp
-#, fuzzy
msgid "Show Previous Outline"
-msgstr "å‰ã®å¹³é¢"
+msgstr "å‰ã®ã‚¢ã‚¦ãƒˆãƒ©ã‚¤ãƒ³ã‚’表示ã™ã‚‹"
#: editor/editor_settings.cpp editor/scene_tree_dock.cpp
msgid "Autorename Animation Tracks"
@@ -5961,19 +5941,16 @@ msgid "Default Create Reset Tracks"
msgstr "デフォルトã§RESETトラックを作æˆ"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Onion Layers Past Color"
msgstr "オニオンレイヤーéŽåŽ»ã®è‰²"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Onion Layers Future Color"
msgstr "オニオンレイヤー将æ¥ã®è‰²"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Visual Editors"
-msgstr "グループエディター"
+msgstr "ビジュアルエディター"
#: editor/editor_settings.cpp
msgid "Minimap Opacity"
@@ -6086,29 +6063,24 @@ msgid "Background Color"
msgstr "背景色"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Completion Background Color"
-msgstr "無効ãªèƒŒæ™¯è‰²ã§ã™ã€‚"
+msgstr "補完ã®èƒŒæ™¯è‰²"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Completion Selected Color"
-msgstr "é¸æŠžã•れãŸã‚‚ã®ã‚’インãƒãƒ¼ãƒˆ"
+msgstr "補完ã®é¸æŠžä¸­ã®è‰²"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Completion Existing Color"
-msgstr "既存ã®è‰²ã®è£œå®Œ"
+msgstr "æ—¢ã«è£œå®Œã•れã¦ã„る箇所ã®è‰²"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Completion Scroll Color"
-msgstr "スクロール色ã®è£œå®Œ"
+msgstr "補完ウインドウã®ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ«è‰²"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Completion Font Color"
-msgstr "フォント色ã®è£œå®Œ"
+msgstr "補完ã®ãƒ•ォント色"
#: editor/editor_settings.cpp
msgid "Text Color"
@@ -6135,9 +6107,8 @@ msgid "Text Selected Color"
msgstr "é¸æŠžã•れãŸãƒ†ã‚­ã‚¹ãƒˆã®è‰²"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Selection Color"
-msgstr "é¸æŠžç¯„å›²ã®ã¿"
+msgstr "é¸æŠžè‰²"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
msgid "Brace Mismatch Color"
@@ -7235,14 +7206,12 @@ msgid "Fix Alpha Border"
msgstr "アルファボーダーを修正"
#: editor/import/resource_importer_texture.cpp
-#, fuzzy
msgid "Premult Alpha"
-msgstr "ãƒãƒªã‚´ãƒ³ã‚’編集"
+msgstr "乗算済ã¿ã‚¢ãƒ«ãƒ•ã‚¡"
#: editor/import/resource_importer_texture.cpp
-#, fuzzy
msgid "Hdr As Srgb"
-msgstr "Srgbã¨ã—ã¦Hdr"
+msgstr "HDRã‚’sRGBã¨ã—ã¦è¡¨ç¤º"
#: editor/import/resource_importer_texture.cpp
msgid "Invert Color"
@@ -10980,7 +10949,7 @@ msgstr "å¾Œé¢ é€è¦–投影"
msgid " [auto]"
msgstr " [自動]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [ãƒãƒ¼ã‚¿ãƒ«æœ‰åй]"
@@ -14136,6 +14105,8 @@ msgid ""
"Note: Encryption key needs to be stored in the binary,\n"
"you need to build the export templates from source."
msgstr ""
+"注:æš—å·åŒ–キーã¯ãƒã‚¤ãƒŠãƒªã«æ ¼ç´ã™ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚\n"
+"ソースã‹ã‚‰ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆãƒ†ãƒ³ãƒ—レートをビルドã™ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚"
#: editor/project_export.cpp
msgid "More Info..."
@@ -14242,17 +14213,15 @@ msgid "Invalid project path (changed anything?)."
msgstr "無効ãªãƒ—ロジェクトパスã§ã™ (ãªã«ã‹å¤‰æ›´ãŒã‚りã¾ã—ãŸã‹ï¼Ÿ)。"
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project at '%s' (error %d). It may be missing or corrupted."
msgstr ""
-"プロジェクトパス㮠project.godot を読ã¿è¾¼ã‚ã¾ã›ã‚“ã§ã—ãŸã€‚ (エラー %d)。見ã¤ã‹"
-"らãªã„ã‹ç ´æã—ã¦ã„ã‚‹å¯èƒ½æ€§ãŒã‚りã¾ã™ã€‚"
+"%s ã®ãƒ—ロジェクトを読ã¿è¾¼ã‚ã¾ã›ã‚“ã§ã—ãŸã€‚ (エラー %d)。見ã¤ã‹ã‚‰ãªã„ã‹ç ´æã—ã¦"
+"ã„ã‚‹å¯èƒ½æ€§ãŒã‚りã¾ã™ã€‚"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Couldn't save project at '%s' (error %d)."
-msgstr "次ã®å ´æ‰€ã®ãƒ—ロジェクトを開ã‘ã¾ã›ã‚“ '%s'。"
+msgstr "プロジェクトを '%s' ã«ä¿å­˜ã§ãã¾ã›ã‚“ã§ã—㟠(エラー %d)。"
#: editor/project_manager.cpp
msgid "Couldn't create project.godot in project path."
@@ -15510,6 +15479,9 @@ msgid ""
"with the '%s' prefix in a node path.\n"
"Click to disable this."
msgstr ""
+"ã“ã®ãƒŽãƒ¼ãƒ‰ã«ã¯ã€ãƒŽãƒ¼ãƒ‰ パスã®å…ˆé ­ã« '%s' プレフィックスを付ã‘ã‚‹ã“ã¨ã§ã€ã‚·ãƒ¼ãƒ³"
+"内ã®ã©ã“ã‹ã‚‰ã§ã‚‚アクセスã§ãã¾ã™ã€‚\n"
+"クリックã™ã‚‹ã¨ç„¡åйã«ãªã‚Šã¾ã™ã€‚"
#: editor/scene_tree_editor.cpp
msgid ""
@@ -15911,7 +15883,7 @@ msgstr "å…‰æºã®åŠå¾„を変更"
#: editor/spatial_editor_gizmos.cpp
msgid "Stream Player 3D"
-msgstr ""
+msgstr "ストリームプレイヤー3D"
#: editor/spatial_editor_gizmos.cpp
msgid "Change AudioStreamPlayer3D Emission Angle"
@@ -15933,7 +15905,7 @@ msgstr "カメラサイズを変更"
#: editor/spatial_editor_gizmos.cpp
msgid "Visibility Notifier"
-msgstr ""
+msgstr "å¯è¦–性通知"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Notifier AABB"
@@ -15941,7 +15913,7 @@ msgstr "Notifierã®AABBを変更"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Particles AABB"
-msgstr "パーティクルã®è»¸å¹³è¡Œå¢ƒç•Œãƒœãƒƒã‚¯ã‚¹ã‚’変更"
+msgstr "パーティクルã®AABBを変更"
#: editor/spatial_editor_gizmos.cpp
msgid "Reflection Probe"
@@ -16113,9 +16085,8 @@ msgid "RID Pool Prealloc"
msgstr "RIDプールã®äº‹å‰å‰²ã‚Šå½“ã¦"
#: main/main.cpp
-#, fuzzy
msgid "Debugger stdout"
-msgstr "デãƒãƒƒã‚¬ãƒ¼"
+msgstr "デãƒãƒƒã‚¬ãƒ¼ã®æ¨™æº–出力"
#: main/main.cpp
msgid "Max Chars Per Second"
@@ -16155,7 +16126,7 @@ msgstr "ログã®ãƒ‘ス"
#: main/main.cpp
msgid "Max Log Files"
-msgstr ""
+msgstr "最大ログファイル数"
#: main/main.cpp
msgid "Driver"
@@ -16195,7 +16166,7 @@ msgstr "ピクセルå˜ä½ã®é€æ˜Žåº¦"
#: main/main.cpp
msgid "Allowed"
-msgstr ""
+msgstr "許å¯"
#: main/main.cpp
msgid "Intended Usage"
@@ -16206,9 +16177,8 @@ msgid "Framebuffer Allocation"
msgstr "フレームãƒãƒƒãƒ•ã‚¡ã®å‰²ã‚Šå½“ã¦"
#: main/main.cpp platform/uwp/os_uwp.cpp
-#, fuzzy
msgid "Energy Saving"
-msgstr "ä¿å­˜ä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ"
+msgstr "çœã‚¨ãƒãƒ«ã‚®ãƒ¼"
#: main/main.cpp
msgid "Threads"
@@ -16224,32 +16194,29 @@ msgstr "スレッドセーフãªBVH"
#: main/main.cpp
msgid "Handheld"
-msgstr ""
+msgstr "ãƒãƒ¼ã‚¿ãƒ–ル"
#: main/main.cpp platform/javascript/export/export.cpp
#: platform/uwp/export/export.cpp
-#, fuzzy
msgid "Orientation"
-msgstr "オンラインドキュメント"
+msgstr "æ–¹å‘"
#: main/main.cpp scene/gui/scroll_container.cpp scene/gui/text_edit.cpp
#: scene/main/scene_tree.cpp scene/register_scene_types.cpp
-#, fuzzy
msgid "Common"
-msgstr "コミュニティ"
+msgstr "一般"
#: main/main.cpp
msgid "Physics FPS"
msgstr "物ç†FPS"
#: main/main.cpp
-#, fuzzy
msgid "Force FPS"
-msgstr "強制プッシュ"
+msgstr "強制FPS"
#: main/main.cpp
msgid "Enable Pause Aware Picking"
-msgstr ""
+msgstr "ä¸€æ™‚åœæ­¢ä¸­ã®é¸æŠžèªè­˜ã®æœ‰åŠ¹åŒ–"
#: main/main.cpp scene/gui/item_list.cpp scene/gui/popup_menu.cpp
#: scene/gui/scroll_container.cpp scene/gui/text_edit.cpp scene/gui/tree.cpp
@@ -16287,11 +16254,11 @@ msgstr "フレームé…å»¶ (ミリ秒)"
#: main/main.cpp
msgid "Low Processor Mode"
-msgstr ""
+msgstr "低プロセッサモード"
#: main/main.cpp
msgid "Delta Sync After Draw"
-msgstr ""
+msgstr "æç”»å¾Œã®ãƒ‡ãƒ«ã‚¿åŒæœŸ"
#: main/main.cpp
msgid "iOS"
@@ -16299,7 +16266,7 @@ msgstr "iOS"
#: main/main.cpp
msgid "Hide Home Indicator"
-msgstr ""
+msgstr "ホームインジケーターを隠ã™"
#: main/main.cpp
msgid "Input Devices"
@@ -16322,9 +16289,8 @@ msgid "Shaders"
msgstr "シェーダー"
#: main/main.cpp
-#, fuzzy
msgid "Debug Shader Fallbacks"
-msgstr "シェーダーフォールãƒãƒƒã‚¯ã‚’強制"
+msgstr "シェーダーフォールãƒãƒƒã‚¯ã®ãƒ‡ãƒãƒƒã‚°"
#: main/main.cpp scene/3d/baked_lightmap.cpp scene/3d/camera.cpp
#: scene/3d/world_environment.cpp scene/main/scene_tree.cpp
@@ -16334,16 +16300,15 @@ msgstr "環境"
#: main/main.cpp
msgid "Default Clear Color"
-msgstr ""
+msgstr "デフォルトã®ã‚¯ãƒªã‚¢ãƒ¼è‰²"
#: main/main.cpp
msgid "Boot Splash"
msgstr "ブートスプラッシュ"
#: main/main.cpp
-#, fuzzy
msgid "Show Image"
-msgstr "ボーンを表示ã™ã‚‹"
+msgstr "ç”»åƒã‚’表示"
#: main/main.cpp
msgid "Image"
@@ -16375,7 +16340,7 @@ msgstr "ãƒãƒƒãƒ•ァリング"
#: main/main.cpp
msgid "Agile Event Flushing"
-msgstr ""
+msgstr "å³åº§ã«ã‚¤ãƒ™ãƒ³ãƒˆãƒ•ラッシュ"
#: main/main.cpp
msgid "Emulate Touch From Mouse"
@@ -16390,13 +16355,12 @@ msgid "Mouse Cursor"
msgstr "マウスカーソル"
#: main/main.cpp
-#, fuzzy
msgid "Custom Image"
-msgstr "ノードを切りå–ã‚‹"
+msgstr "カスタムイメージ"
#: main/main.cpp
msgid "Custom Image Hotspot"
-msgstr ""
+msgstr "カスタムイメージホットスãƒãƒƒãƒˆ"
#: main/main.cpp
msgid "Tooltip Position Offset"
@@ -16441,12 +16405,11 @@ msgstr "縮å°"
#: main/main.cpp scene/main/scene_tree.cpp
msgid "Auto Accept Quit"
-msgstr ""
+msgstr "プログラム終了を自動的ã«å—ã‘入れる"
#: main/main.cpp scene/main/scene_tree.cpp
-#, fuzzy
msgid "Quit On Go Back"
-msgstr "戻る"
+msgstr "ã€Œæˆ»ã‚‹ã€æ™‚ã«ãƒ—ログラム終了ã™ã‚‹"
#: main/main.cpp scene/main/viewport.cpp
msgid "Snap Controls To Pixels"
@@ -16462,7 +16425,7 @@ msgstr "オーãƒãƒ¼ã‚µãƒ³ãƒ—リングを使用"
#: modules/bullet/register_types.cpp modules/bullet/space_bullet.cpp
msgid "Active Soft World"
-msgstr ""
+msgstr "SoftBodyを有効ã«ã™ã‚‹"
#: modules/csg/csg_gizmos.cpp
msgid "CSG"
@@ -16478,11 +16441,11 @@ msgstr "円柱ã®é«˜ã•を変更"
#: modules/csg/csg_gizmos.cpp
msgid "Change Torus Inner Radius"
-msgstr "トーラスã®å†…径を変更"
+msgstr "トーラスã®å†…åŠå¾„を変更"
#: modules/csg/csg_gizmos.cpp
msgid "Change Torus Outer Radius"
-msgstr "トーラスã®å¤–径を変更"
+msgstr "トーラスã®å¤–åŠå¾„を変更"
#: modules/csg/csg_shape.cpp
msgid "Operation"
@@ -16546,14 +16509,12 @@ msgid "Cone"
msgstr "円éŒ"
#: modules/csg/csg_shape.cpp
-#, fuzzy
msgid "Inner Radius"
-msgstr "トーラスã®å†…径を変更"
+msgstr "内åŠå¾„"
#: modules/csg/csg_shape.cpp
-#, fuzzy
msgid "Outer Radius"
-msgstr "トーラスã®å¤–径を変更"
+msgstr "外åŠå¾„"
#: modules/csg/csg_shape.cpp
msgid "Ring Sides"
@@ -16629,17 +16590,16 @@ msgid "Channel Count"
msgstr "ãƒãƒ£ãƒ³ãƒãƒ«ã®æ•°"
#: modules/enet/networked_multiplayer_enet.cpp
-#, fuzzy
msgid "Always Ordered"
-msgstr "常ã«ã‚°ãƒªãƒƒãƒ‰ã‚’表示"
+msgstr "常ã«é †åºä»˜ã‘ã‚’ã™ã‚‹"
#: modules/enet/networked_multiplayer_enet.cpp
msgid "Server Relay"
-msgstr ""
+msgstr "サーãƒãƒ¼ãƒªãƒ¬ãƒ¼"
#: modules/enet/networked_multiplayer_enet.cpp
msgid "DTLS Verify"
-msgstr ""
+msgstr "DTLS 検証"
#: modules/enet/networked_multiplayer_enet.cpp
msgid "DTLS Hostname"
@@ -18014,17 +17974,16 @@ msgid "in order:"
msgstr ""
#: modules/visual_script/visual_script_flow_control.cpp
-#, fuzzy
msgid "Steps"
msgstr "ステップ"
#: modules/visual_script/visual_script_flow_control.cpp
msgid "Switch"
-msgstr ""
+msgstr "スイッãƒ"
#: modules/visual_script/visual_script_flow_control.cpp
msgid "'input' is:"
-msgstr ""
+msgstr "入力ã¯:"
#: modules/visual_script/visual_script_flow_control.cpp
msgid "Type Cast"
@@ -18273,14 +18232,12 @@ msgid "Construct %s"
msgstr "定数"
#: modules/visual_script/visual_script_nodes.cpp
-#, fuzzy
msgid "Get Local Var"
-msgstr "ローカル空間を使用"
+msgstr "ローカル変数を使用"
#: modules/visual_script/visual_script_nodes.cpp
-#, fuzzy
msgid "Set Local Var"
-msgstr "ローカル空間を使用"
+msgstr "ローカル変数をセット"
#: modules/visual_script/visual_script_nodes.cpp
msgid "Action %s"
@@ -19552,9 +19509,8 @@ msgstr "コード署å"
#: platform/osx/export/export.cpp platform/uwp/export/export.cpp
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Identity"
-msgstr "インデント"
+msgstr "識別å­"
#: platform/osx/export/export.cpp platform/windows/export/export.cpp
#, fuzzy
@@ -19752,9 +19708,8 @@ msgid ""
msgstr ""
#: platform/osx/export/export.cpp platform/windows/export/export.cpp
-#, fuzzy
msgid "No identity found."
-msgstr "アイコンãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸã€‚"
+msgstr "識別å­ãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸã€‚"
#: platform/osx/export/export.cpp
#, fuzzy
@@ -19818,6 +19773,8 @@ msgid ""
"Ad-hoc signed applications require the 'Disable Library Validation' "
"entitlement to load dynamic libraries."
msgstr ""
+"アドホック署å付ãアプリケーションã§ã¯ã€å‹•的ライブラリを読ã¿è¾¼ã‚€ãŸã‚ã«ã€Œãƒ©ã‚¤"
+"ブラリ検証を無効ã«ã™ã‚‹ã€ã®æ¨©é™ãŒå¿…è¦ã§ã™ã€‚"
#: platform/osx/export/export.cpp
msgid "Code signing bundle"
@@ -19848,15 +19805,12 @@ msgid "Sending archive for notarization"
msgstr "公証をã™ã‚‹ãŸã‚ã«ã‚¢ãƒ¼ã‚«ã‚¤ãƒ–ã‚’é€ä¿¡ä¸­"
#: platform/osx/export/export.cpp
-#, fuzzy
msgid "ZIP Creation"
-msgstr "プロジェクト"
+msgstr "ZIP作æˆ"
#: platform/osx/export/export.cpp
-#, fuzzy
msgid "Could not open file to read from path \"%s\"."
-msgstr ""
-"プロジェクトファイルをgladleプロジェクトã«ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆã§ãã¾ã›ã‚“ã§ã—ãŸ\n"
+msgstr "パス \"%s\" ã‹ã‚‰ãƒ•ァイルを開ã‘ã¾ã›ã‚“ã§ã—ãŸã€‚"
#: platform/osx/export/export.cpp
msgid "Invalid bundle identifier:"
@@ -19867,12 +19821,17 @@ msgid ""
"Warning: Built-in \"codesign\" is selected in the Editor Settings. Code "
"signing is limited to ad-hoc signature only."
msgstr ""
+"警告: ビルトインã®ã€Œã‚³ãƒ¼ãƒ‰ç½²åã€ãŒã‚¨ãƒ‡ã‚£ã‚¿ãƒ¼è¨­å®šã§é¸æŠžã•れã¦ã„ã¾ã™ã€‚コード署"
+"åã¯ã‚¢ãƒ‰ãƒ›ãƒƒã‚¯ç½²åã®ã¿ã«åˆ¶é™ã•れã¦ã„ã¾ã™ã€‚"
#: platform/osx/export/export.cpp
msgid ""
"Warning: Xcode command line tools are not installed, using built-in "
"\"codesign\". Code signing is limited to ad-hoc signature only."
msgstr ""
+"警告: Xcodeã®ã‚³ãƒžãƒ³ãƒ‰ãƒ©ã‚¤ãƒ³ãƒ„ールãŒã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•れã¦ã„ãªã„ãŸã‚ã€ãƒ“ルトインã®"
+"「コード署åã€ãŒä½¿ç”¨ã•れã¾ã™ã€‚コード署åã¯ã‚¢ãƒ‰ãƒ›ãƒƒã‚¯ç½²åã®ã¿ã«åˆ¶é™ã•れã¦ã„ã¾"
+"ã™ã€‚"
#: platform/osx/export/export.cpp
msgid "Notarization: Notarization with an ad-hoc signature is not supported."
@@ -19911,17 +19870,19 @@ msgid ""
"Code signing is disabled. The exported project will not run on Macs with "
"enabled Gatekeeper and Apple Silicon powered Macs."
msgstr ""
+"コード署åãŒç„¡åйã«ãªã£ã¦ã„ã¾ã™ã€‚エクスãƒãƒ¼ãƒˆã•れãŸãƒ—ロジェクトã¯ã€Gatekeeper "
+"ãŒæœ‰åйã«ãªã£ã¦ã„ã‚‹ Mac ãŠã‚ˆã³ Apple Silicon æ­è¼‰ã® Mac ã§ã¯å‹•作ã—ã¾ã›ã‚“。"
#: platform/osx/export/export.cpp
msgid ""
"Hardened Runtime is not compatible with ad-hoc signature, and will be "
"disabled!"
-msgstr ""
+msgstr "Hardened Runtime ã¯ã‚¢ãƒ‰ãƒ›ãƒƒã‚¯ç½²åã¨äº’æ›æ€§ãŒãªã„ãŸã‚ã€ç„¡åйã«ãªã‚Šã¾ã™!"
#: platform/osx/export/export.cpp
msgid ""
"Timestamping is not compatible with ad-hoc signature, and will be disabled!"
-msgstr ""
+msgstr "タイムスタンプã¯ã‚¢ãƒ‰ãƒ›ãƒƒã‚¯ç½²åã¨äº’æ›æ€§ãŒãªã„ãŸã‚ã€ç„¡åйã«ãªã‚Šã¾ã™!"
#: platform/osx/export/export.cpp
msgid ""
@@ -19937,34 +19898,46 @@ msgid ""
"Privacy: Microphone access is enabled, but usage description is not "
"specified."
msgstr ""
+"プライãƒã‚·ãƒ¼: マイクã¸ã®ã‚¢ã‚¯ã‚»ã‚¹ãŒæœ‰åйã«ãªã£ã¦ã„ã¾ã™ãŒã€ä½¿ç”¨æ–¹æ³•ã®èª¬æ˜ŽãŒã‚り"
+"ã¾ã›ã‚“。"
#: platform/osx/export/export.cpp
msgid ""
"Privacy: Camera access is enabled, but usage description is not specified."
msgstr ""
+"プライãƒã‚·ãƒ¼: カメラã¸ã®ã‚¢ã‚¯ã‚»ã‚¹ãŒæœ‰åйã«ãªã£ã¦ã„ã¾ã™ãŒã€ä½¿ç”¨æ–¹æ³•ã®èª¬æ˜ŽãŒã‚り"
+"ã¾ã›ã‚“。"
#: platform/osx/export/export.cpp
msgid ""
"Privacy: Location information access is enabled, but usage description is "
"not specified."
msgstr ""
+"プライãƒã‚·ãƒ¼: ä½ç½®æƒ…å ±ã¸ã®ã‚¢ã‚¯ã‚»ã‚¹ãŒæœ‰åйã«ãªã£ã¦ã„ã¾ã™ãŒã€ä½¿ç”¨æ–¹æ³•ã®èª¬æ˜ŽãŒã‚"
+"りã¾ã›ã‚“。"
#: platform/osx/export/export.cpp
msgid ""
"Privacy: Address book access is enabled, but usage description is not "
"specified."
msgstr ""
+"プライãƒã‚·ãƒ¼: アドレス帳ã¸ã®ã‚¢ã‚¯ã‚»ã‚¹ãŒæœ‰åйã«ãªã£ã¦ã„ã¾ã™ãŒã€ä½¿ç”¨æ–¹æ³•ã®èª¬æ˜ŽãŒ"
+"ã‚りã¾ã›ã‚“。"
#: platform/osx/export/export.cpp
msgid ""
"Privacy: Calendar access is enabled, but usage description is not specified."
msgstr ""
+"プライãƒã‚·ãƒ¼: カレンダーã¸ã®ã‚¢ã‚¯ã‚»ã‚¹ãŒæœ‰åйã«ãªã£ã¦ã„ã¾ã™ãŒã€ä½¿ç”¨æ–¹æ³•ã®èª¬æ˜ŽãŒ"
+"ã‚りã¾ã›ã‚“。"
#: platform/osx/export/export.cpp
msgid ""
"Privacy: Photo library access is enabled, but usage description is not "
"specified."
msgstr ""
+"プライãƒã‚·ãƒ¼:フォトライブラリã¸ã®ã‚¢ã‚¯ã‚»ã‚¹ãŒæœ‰åйã«ãªã£ã¦ã„ã¾ã™ãŒã€ä½¿ç”¨æ–¹æ³•ã®èª¬"
+"明ãŒã‚りã¾ã›ã‚“。"
#: platform/osx/export/export.cpp
msgid "macOS"
@@ -19972,40 +19945,35 @@ msgstr "macOS"
#: platform/osx/export/export.cpp
msgid "Force Builtin Codesign"
-msgstr ""
+msgstr "ビルドインコード署åを強制"
#: platform/uwp/export/export.cpp
msgid "Architecture"
msgstr "アーキテクãƒãƒ£"
#: platform/uwp/export/export.cpp
-#, fuzzy
msgid "Display Name"
-msgstr "表示スケール"
+msgstr "表示å"
#: platform/uwp/export/export.cpp
-#, fuzzy
msgid "Short Name"
-msgstr "スクリプトå:"
+msgstr "略称"
#: platform/uwp/export/export.cpp
msgid "Publisher"
-msgstr ""
+msgstr "パブリッシャー"
#: platform/uwp/export/export.cpp
-#, fuzzy
msgid "Publisher Display Name"
-msgstr "パッケージ発行者ã®è¡¨ç¤ºåãŒç„¡åйã§ã™ã€‚"
+msgstr "パブリッシャー表示å"
#: platform/uwp/export/export.cpp
-#, fuzzy
msgid "Product GUID"
-msgstr "無効ãªãƒ—ロダクト GUIDã§ã™ã€‚"
+msgstr "プロダクト GUID"
#: platform/uwp/export/export.cpp
-#, fuzzy
msgid "Publisher GUID"
-msgstr "ガイドをクリアã™ã‚‹"
+msgstr "パブリッシャー GUID"
#: platform/uwp/export/export.cpp
msgid "Signing"
@@ -20037,73 +20005,71 @@ msgstr "リビジョン"
#: platform/uwp/export/export.cpp
msgid "Landscape"
-msgstr ""
+msgstr "ランドスケープ"
#: platform/uwp/export/export.cpp
-#, fuzzy
msgid "Portrait"
-msgstr "ãƒãƒ¼ãƒˆ"
+msgstr "ãƒãƒ¼ãƒˆãƒ¬ãƒ¼ãƒˆ"
#: platform/uwp/export/export.cpp
msgid "Landscape Flipped"
-msgstr ""
+msgstr "ランドスケープå転"
#: platform/uwp/export/export.cpp
msgid "Portrait Flipped"
-msgstr ""
+msgstr "ãƒãƒ¼ãƒˆãƒ¬ãƒ¼ãƒˆå転"
#: platform/uwp/export/export.cpp
-#, fuzzy
msgid "Store Logo"
-msgstr "スケールモード"
+msgstr "ストアロゴ"
#: platform/uwp/export/export.cpp
msgid "Square 44 X 44 Logo"
-msgstr ""
+msgstr "正方形 44 x 44 ロゴ"
#: platform/uwp/export/export.cpp
msgid "Square 71 X 71 Logo"
-msgstr ""
+msgstr "正方形 71 x 71 ロゴ"
#: platform/uwp/export/export.cpp
msgid "Square 150 X 150 Logo"
-msgstr ""
+msgstr "正方形 150 x 150 ロゴ"
#: platform/uwp/export/export.cpp
msgid "Square 310 X 310 Logo"
-msgstr ""
+msgstr "正方形 310 x 310 ロゴ"
#: platform/uwp/export/export.cpp
msgid "Wide 310 X 150 Logo"
-msgstr ""
+msgstr "ワイド 310 x 150 ロゴ"
#: platform/uwp/export/export.cpp
-#, fuzzy
msgid "Splash Screen"
-msgstr "ドローコール:"
+msgstr "スプラッシュ・スクリーン"
#: platform/uwp/export/export.cpp
-#, fuzzy
msgid "Tiles"
-msgstr "ファイル"
+msgstr "タイル"
#: platform/uwp/export/export.cpp
msgid "Show Name On Square 150 X 150"
-msgstr ""
+msgstr "正方形 150×150 表示å"
#: platform/uwp/export/export.cpp
msgid "Show Name On Wide 310 X 150"
-msgstr ""
+msgstr "ワイド 310x150 表示å"
#: platform/uwp/export/export.cpp
msgid "Show Name On Square 310 X 310"
-msgstr ""
+msgstr "正方形 310×310 表示å"
#: platform/uwp/export/export.cpp
msgid ""
"Godot's Mono version does not support the UWP platform. Use the standard "
"build (no C# support) if you wish to target UWP."
msgstr ""
+"Godot ã® Mono ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã¯ UWP プラットフォームをサãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“。UWP ã‚’"
+"対象ã¨ã—ãŸã„å ´åˆã¯ã€æ¨™æº–ビルド(C# éžã‚µãƒãƒ¼ãƒˆ)を使用ã—ã¦ä¸‹ã•ã„。"
#: platform/uwp/export/export.cpp
msgid "Invalid package short name."
@@ -20169,41 +20135,36 @@ msgid "UWP"
msgstr "UWP"
#: platform/uwp/export/export.cpp platform/windows/export/export.cpp
-#, fuzzy
msgid "Signtool"
-msgstr "シグナル"
+msgstr "サインツール"
#: platform/uwp/export/export.cpp
msgid "Debug Certificate"
-msgstr ""
+msgstr "デãƒãƒƒã‚°è¨¼æ˜Žæ›¸"
#: platform/uwp/export/export.cpp
-#, fuzzy
msgid "Debug Algorithm"
-msgstr "デãƒãƒƒã‚¬ãƒ¼"
+msgstr "デãƒãƒƒã‚°ã‚¢ãƒ«ã‚´ãƒªã‚ºãƒ "
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Failed to rename temporary file \"%s\"."
-msgstr "一時ファイルを削除ã§ãã¾ã›ã‚“:"
+msgstr "一時ファイル \"%s\" ã®åå‰ã®å¤‰æ›´ã«å¤±æ•—ã—ã¾ã—ãŸã€‚"
#: platform/windows/export/export.cpp
msgid "Identity Type"
-msgstr ""
+msgstr "識別å­ã‚¿ã‚¤ãƒ—"
#: platform/windows/export/export.cpp
msgid "Timestamp Server URL"
-msgstr ""
+msgstr "タイムスタンプサーãƒãƒ¼URL"
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Digest Algorithm"
-msgstr "デãƒãƒƒã‚¬ãƒ¼"
+msgstr "ダイジェストアルゴリズム"
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Modify Resources"
-msgstr "リソースをコピー"
+msgstr "リソースã®å¤‰æ›´"
#: platform/windows/export/export.cpp
msgid "File Version"
@@ -20227,22 +20188,19 @@ msgstr "ファイルã®èª¬æ˜Ž"
#: platform/windows/export/export.cpp
msgid "Trademarks"
-msgstr ""
+msgstr "商標"
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Resources Modification"
-msgstr "ランダムãªå›žè»¢:"
+msgstr "リソースã®å¤‰æ›´"
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Could not find rcedit executable at \"%s\"."
-msgstr "キーストアãŒè¦‹ã¤ã‹ã‚‰ãªã„ãŸã‚ã€ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆã§ãã¾ã›ã‚“。"
+msgstr "\"%s\" ã« rcedit 実行ファイルãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸã€‚"
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Could not find wine executable at \"%s\"."
-msgstr "キーストアãŒè¦‹ã¤ã‹ã‚‰ãªã„ãŸã‚ã€ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆã§ãã¾ã›ã‚“。"
+msgstr "\"%s\" ã« wine 実行ファイルãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸã€‚"
#: platform/windows/export/export.cpp
msgid ""
@@ -20250,31 +20208,29 @@ msgid ""
"Settings (Export > Windows > Rcedit), or disable \"Application > Modify "
"Resources\" in the export preset."
msgstr ""
+"rcedit 実行ファイルを開始ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚エディター設定 (Export > Windows "
+"> Rcedit)ã‹ã‚‰ rcedit ã®ãƒ‘スを設定ã™ã‚‹ã‹ã€ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆãƒ—リセット㧠\"アプリ"
+"ケーション > リソースã®å¤‰æ›´\"を無効ã«ã—ã¦ä¸‹ã•ã„。"
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "rcedit failed to modify executable: %s."
-msgstr "無効ãªå®Ÿè¡Œå¯èƒ½ãƒ•ァイルã§ã™ã€‚"
+msgstr "rcedit ã¯å®Ÿè¡Œå¯èƒ½ãƒ•ァイルã®å¤‰æ›´ã«å¤±æ•—ã—ã¾ã—ãŸ: %s。"
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Could not find signtool executable at \"%s\"."
-msgstr "キーストアãŒè¦‹ã¤ã‹ã‚‰ãªã„ãŸã‚ã€ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆã§ãã¾ã›ã‚“。"
+msgstr "\"%s\" 㫠サインツール実行ファイルãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸã€‚"
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Could not find osslsigncode executable at \"%s\"."
-msgstr "キーストアãŒè¦‹ã¤ã‹ã‚‰ãªã„ãŸã‚ã€ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆã§ãã¾ã›ã‚“。"
+msgstr "\"%s\" ã« osslsigncode 実行ファイルãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸã€‚"
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Invalid identity type."
-msgstr "無効ãªè­˜åˆ¥å­:"
+msgstr "無効ãªè­˜åˆ¥å­ã‚¿ã‚¤ãƒ—。"
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Invalid timestamp server."
-msgstr "無効ãªåå‰ã§ã™ã€‚"
+msgstr "タイムスタンプサーãƒãƒ¼ãŒç„¡åйã§ã™ã€‚"
#: platform/windows/export/export.cpp
msgid ""
@@ -20282,22 +20238,25 @@ msgid ""
"Settings (Export > Windows > Signtool), or disable \"Codesign\" in the "
"export preset."
msgstr ""
+"サインツール実行ファイルを開始ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚エディター設定 (Export > "
+"Windows > サインツール)ã‹ã‚‰ã‚µã‚¤ãƒ³ãƒ„ールã®ãƒ‘スを設定ã™ã‚‹ã‹ã€ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆãƒ—リ"
+"セット㧠\"コード署å\"を無効ã«ã—ã¦ä¸‹ã•ã„。"
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Signtool failed to sign executable: %s."
-msgstr "無効ãªå®Ÿè¡Œå¯èƒ½ãƒ•ァイルã§ã™ã€‚"
+msgstr "サインツールã¯å®Ÿè¡Œå¯èƒ½ãƒ•ァイルã®ç½²åã«å¤±æ•—ã—ã¾ã—ãŸ: %s。"
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Failed to remove temporary file \"%s\"."
-msgstr "一時ファイルを削除ã§ãã¾ã›ã‚“:"
+msgstr "一時ファイル \"%s\" ã®å‰Šé™¤ã«å¤±æ•—ã—ã¾ã—ãŸã€‚"
#: platform/windows/export/export.cpp
msgid ""
"The rcedit tool must be configured in the Editor Settings (Export > Windows "
"> Rcedit) to change the icon or app information data."
msgstr ""
+"アイコンやアプリ情報データを変更ã™ã‚‹ã«ã¯ã€ã‚¨ãƒ‡ã‚£ã‚¿ãƒ¼è¨­å®š (Export > Windows > "
+"Rcedit) ã§ rcedit ã®è¨­å®šã‚’行ã†å¿…è¦ãŒã‚りã¾ã™ã€‚"
#: platform/windows/export/export.cpp
msgid "Invalid icon path:"
@@ -20313,20 +20272,19 @@ msgstr "無効ãªè£½å“ãƒãƒ¼ã‚¸ãƒ§ãƒ³:"
#: platform/windows/export/export.cpp
msgid "Windows executables cannot be >= 4 GiB."
-msgstr ""
+msgstr "Windows ã®å®Ÿè¡Œãƒ•ァイルã¯ã€4GiBã‚’è¶…ãˆã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。"
#: platform/windows/export/export.cpp platform/x11/export/export.cpp
-#, fuzzy
msgid "Failed to open executable file \"%s\"."
-msgstr "無効ãªå®Ÿè¡Œå¯èƒ½ãƒ•ァイルã§ã™ã€‚"
+msgstr "実行ファイル \"%s\" ã‚’é–‹ãã®ã«å¤±æ•—ã—ã¾ã—ãŸã€‚"
#: platform/windows/export/export.cpp platform/x11/export/export.cpp
msgid "Executable file header corrupted."
-msgstr ""
+msgstr "実行ファイルã®ãƒ˜ãƒƒãƒ€ãƒ¼ãŒç ´æã—ã¦ã„ã¾ã™ã€‚"
#: platform/windows/export/export.cpp platform/x11/export/export.cpp
msgid "Executable \"pck\" section not found."
-msgstr ""
+msgstr "実行å¯èƒ½ãª \"pck \"セクションãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“。"
#: platform/windows/export/export.cpp
msgid "Windows"
@@ -20334,7 +20292,7 @@ msgstr "Windows"
#: platform/windows/export/export.cpp
msgid "Rcedit"
-msgstr ""
+msgstr "Rcedit"
#: platform/windows/export/export.cpp
msgid "Osslsigncode"
@@ -20363,21 +20321,18 @@ msgstr ""
#: scene/2d/animated_sprite.cpp scene/2d/cpu_particles_2d.cpp
#: scene/2d/particles_2d.cpp scene/3d/cpu_particles.cpp scene/3d/particles.cpp
-#, fuzzy
msgid "Speed Scale"
-msgstr "スケール"
+msgstr "スピードスケール"
#: scene/2d/animated_sprite.cpp scene/2d/audio_stream_player_2d.cpp
#: scene/3d/audio_stream_player_3d.cpp scene/3d/sprite_3d.cpp
#: scene/audio/audio_stream_player.cpp
-#, fuzzy
msgid "Playing"
-msgstr "実行"
+msgstr "実行中"
#: scene/2d/animated_sprite.cpp scene/2d/sprite.cpp scene/3d/sprite_3d.cpp
-#, fuzzy
msgid "Centered"
-msgstr "中央"
+msgstr "中央æƒãˆ"
#: scene/2d/animated_sprite.cpp scene/2d/sprite.cpp scene/3d/sprite_3d.cpp
#: scene/gui/texture_button.cpp scene/gui/texture_rect.cpp
@@ -20390,52 +20345,45 @@ msgid "Flip V"
msgstr "垂直å転"
#: scene/2d/area_2d.cpp scene/3d/area.cpp
-#, fuzzy
msgid "Monitoring"
-msgstr "モニター"
+msgstr "モニタリング"
#: scene/2d/area_2d.cpp scene/3d/area.cpp
-#, fuzzy
msgid "Monitorable"
-msgstr "モニター"
+msgstr "モニターå¯èƒ½"
#: scene/2d/area_2d.cpp scene/3d/area.cpp
msgid "Physics Overrides"
msgstr "物ç†ã®ã‚ªãƒ¼ãƒãƒ¼ãƒ©ã‚¤ãƒ‰"
#: scene/2d/area_2d.cpp scene/3d/area.cpp
-#, fuzzy
msgid "Space Override"
-msgstr "上書ã"
+msgstr "領域ã®ã‚ªãƒ¼ãƒãƒ¼ãƒ©ã‚¤ãƒ‰"
#: scene/2d/area_2d.cpp scene/3d/area.cpp
-#, fuzzy
msgid "Gravity Point"
-msgstr "ãƒã‚¤ãƒ³ãƒˆã‚’生æˆ"
+msgstr "é‡åŠ›ç‚¹"
#: scene/2d/area_2d.cpp scene/3d/area.cpp
-#, fuzzy
msgid "Gravity Distance Scale"
-msgstr "インスタンス"
+msgstr "é‡åŠ›è·é›¢ã‚¹ã‚±ãƒ¼ãƒ«"
#: scene/2d/area_2d.cpp scene/3d/area.cpp
-#, fuzzy
msgid "Gravity Vec"
-msgstr "デフォルトã®ãƒ—レビュー"
+msgstr "é‡åŠ›ãƒ™ã‚¯ãƒˆãƒ«"
#: scene/2d/area_2d.cpp scene/2d/cpu_particles_2d.cpp scene/3d/area.cpp
#: scene/3d/cpu_particles.cpp scene/resources/particles_material.cpp
msgid "Gravity"
-msgstr ""
+msgstr "é‡åŠ›"
#: scene/2d/area_2d.cpp scene/3d/area.cpp
-#, fuzzy
msgid "Linear Damp"
-msgstr "リニア"
+msgstr "線形減衰"
#: scene/2d/area_2d.cpp scene/3d/area.cpp
msgid "Angular Damp"
-msgstr ""
+msgstr "角度減衰"
#: scene/2d/area_2d.cpp scene/3d/area.cpp
msgid "Audio Bus"
@@ -20453,9 +20401,8 @@ msgstr "ボリューム dB"
#: scene/2d/audio_stream_player_2d.cpp scene/3d/audio_stream_player_3d.cpp
#: scene/audio/audio_stream_player.cpp
#: servers/audio/effects/audio_effect_pitch_shift.cpp
-#, fuzzy
msgid "Pitch Scale"
-msgstr "スケール"
+msgstr "ピッãƒã‚¹ã‚±ãƒ¼ãƒ«"
#: scene/2d/audio_stream_player_2d.cpp scene/3d/audio_stream_player_3d.cpp
#: scene/audio/audio_stream_player.cpp scene/gui/video_player.cpp
@@ -20465,7 +20412,7 @@ msgstr "自動å†ç”Ÿ"
#: scene/2d/audio_stream_player_2d.cpp scene/3d/audio_stream_player_3d.cpp
#: scene/audio/audio_stream_player.cpp
msgid "Stream Paused"
-msgstr ""
+msgstr "ストリームã®ä¸€æ™‚åœæ­¢"
#: scene/2d/audio_stream_player_2d.cpp scene/3d/audio_stream_player_3d.cpp
#: scene/3d/light.cpp scene/3d/reflection_probe.cpp
@@ -20475,9 +20422,8 @@ msgid "Max Distance"
msgstr "最大è·é›¢"
#: scene/2d/audio_stream_player_2d.cpp scene/3d/light.cpp
-#, fuzzy
msgid "Attenuation"
-msgstr "アニメーション"
+msgstr "減衰é‡"
#: scene/2d/audio_stream_player_2d.cpp scene/3d/audio_stream_player_3d.cpp
#: scene/audio/audio_stream_player.cpp scene/gui/video_player.cpp
@@ -20486,22 +20432,19 @@ msgstr "ãƒã‚¹"
#: scene/2d/audio_stream_player_2d.cpp scene/3d/audio_stream_player_3d.cpp
msgid "Area Mask"
-msgstr ""
+msgstr "エリアマスク"
#: scene/2d/back_buffer_copy.cpp
-#, fuzzy
msgid "Copy Mode"
-msgstr "ノードをコピー"
+msgstr "コピーモード"
#: scene/2d/camera_2d.cpp
-#, fuzzy
msgid "Anchor Mode"
-msgstr "アイコンモード"
+msgstr "アンカーモード"
#: scene/2d/camera_2d.cpp
-#, fuzzy
msgid "Rotating"
-msgstr "回転ã®ã‚¹ãƒ†ãƒƒãƒ—:"
+msgstr "回転"
#: scene/2d/camera_2d.cpp scene/2d/listener_2d.cpp scene/3d/camera.cpp
#: scene/3d/listener.cpp scene/animation/animation_blend_tree.cpp
@@ -20513,9 +20456,8 @@ msgid "Zoom"
msgstr "ズーム"
#: scene/2d/camera_2d.cpp scene/main/canvas_layer.cpp
-#, fuzzy
msgid "Custom Viewport"
-msgstr "1 ビューãƒãƒ¼ãƒˆ"
+msgstr "カスタムビューãƒãƒ¼ãƒˆ"
#: scene/2d/camera_2d.cpp scene/3d/camera.cpp scene/3d/interpolated_camera.cpp
#: scene/animation/animation_player.cpp scene/animation/animation_tree.cpp
@@ -20544,29 +20486,24 @@ msgid "Bottom"
msgstr "下"
#: scene/2d/camera_2d.cpp
-#, fuzzy
msgid "Smoothed"
-msgstr "スムーズステップ"
+msgstr "スムージング"
#: scene/2d/camera_2d.cpp
-#, fuzzy
msgid "Draw Margin"
-msgstr "マージンを設定ã™ã‚‹"
+msgstr "マージンをæç”»ã™ã‚‹"
#: scene/2d/camera_2d.cpp
-#, fuzzy
msgid "Drag Margin H Enabled"
-msgstr "マージンを設定ã™ã‚‹"
+msgstr "水平方å‘ã®ãƒ‰ãƒ©ãƒƒã‚°ãƒžãƒ¼ã‚¸ãƒ³ã«ã®ã¿æœ‰åй"
#: scene/2d/camera_2d.cpp
-#, fuzzy
msgid "Drag Margin V Enabled"
-msgstr "マージンを設定ã™ã‚‹"
+msgstr "垂直方å‘ã®ãƒ‰ãƒ©ãƒƒã‚°ãƒžãƒ¼ã‚¸ãƒ³ã«ã®ã¿æœ‰åй"
#: scene/2d/camera_2d.cpp
-#, fuzzy
msgid "Smoothing"
-msgstr "スムーズステップ"
+msgstr "スムージング"
#: scene/2d/camera_2d.cpp
msgid "H"
@@ -20577,35 +20514,29 @@ msgid "V"
msgstr "垂直"
#: scene/2d/camera_2d.cpp
-#, fuzzy
msgid "Drag Margin"
-msgstr "マージンを設定ã™ã‚‹"
+msgstr "ドラッグマージン"
#: scene/2d/camera_2d.cpp
-#, fuzzy
msgid "Draw Screen"
-msgstr "ドローコール:"
+msgstr "スクリーンをæç”»ã™ã‚‹"
#: scene/2d/camera_2d.cpp
-#, fuzzy
msgid "Draw Limits"
-msgstr "ドローコール:"
+msgstr "é™ç•Œã‚’æç”»ã™ã‚‹"
#: scene/2d/camera_2d.cpp
-#, fuzzy
msgid "Draw Drag Margin"
-msgstr "マージンを設定ã™ã‚‹"
+msgstr "ドラッグマージンをæç”»ã™ã‚‹"
#: scene/2d/canvas_item.cpp scene/resources/environment.cpp
#: scene/resources/material.cpp
-#, fuzzy
msgid "Blend Mode"
-msgstr "ブレンド2 ノード"
+msgstr "ブレンドモード"
#: scene/2d/canvas_item.cpp
-#, fuzzy
msgid "Light Mode"
-msgstr "å³ä¼¸é•·"
+msgstr "ライトモード"
#: scene/2d/canvas_item.cpp
#, fuzzy
@@ -23582,14 +23513,12 @@ msgid "AABB"
msgstr ""
#: scene/3d/visual_instance.cpp
-#, fuzzy
msgid "Sorting"
msgstr "ソート"
#: scene/3d/visual_instance.cpp
-#, fuzzy
msgid "Use AABB Center"
-msgstr "アンビエントを使用"
+msgstr "AABBセンターを使用"
#: scene/3d/visual_instance.cpp scene/resources/navigation_mesh.cpp
#, fuzzy
diff --git a/editor/translations/ka.po b/editor/translations/ka.po
index 629afaa429..ce7502e5ac 100644
--- a/editor/translations/ka.po
+++ b/editor/translations/ka.po
@@ -11066,7 +11066,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/km.po b/editor/translations/km.po
index ade147ec7e..85f5081b6f 100644
--- a/editor/translations/km.po
+++ b/editor/translations/km.po
@@ -10598,7 +10598,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/ko.po b/editor/translations/ko.po
index f43830b1e9..9563bc6244 100644
--- a/editor/translations/ko.po
+++ b/editor/translations/ko.po
@@ -29,7 +29,7 @@
# ì‹ ë™ê·œ <rlsl0422@gmail.com>, 2021.
# Kiroo <elusive1102@naver.com>, 2021.
# JumpJetAvocado <dwkng@jbnu.ac.kr>, 2021.
-# Lee Minhak <minarihak@gmail.com>, 2022.
+# Lee Minhak <minarihak@gmail.com>, 2022, 2023.
# 한수현 <shh1473@ajou.ac.kr>, 2022.
# Taehun Yun <yooontehoon@naver.com>, 2022.
# vrSono <global.sonogong@gmail.com>, 2022.
@@ -41,13 +41,14 @@
# nulltable <un5450@naver.com>, 2022.
# Godoto <aicompose@gmail.com>, 2022.
# gaenyang <gaenyang@outlook.com>, 2022.
+# 오지훈 <jule1130@naver.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-10-24 12:41+0000\n"
-"Last-Translator: Godoto <aicompose@gmail.com>\n"
+"PO-Revision-Date: 2023-01-20 10:19+0000\n"
+"Last-Translator: 오지훈 <jule1130@naver.com>\n"
"Language-Team: Korean <https://hosted.weblate.org/projects/godot-engine/"
"godot/ko/>\n"
"Language: ko\n"
@@ -55,7 +56,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 4.14.2-dev\n"
+"X-Generator: Weblate 4.15.1\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -582,7 +583,7 @@ msgstr "ì´ë¦„"
#: modules/visual_script/visual_script_nodes.cpp platform/uwp/export/export.cpp
#: platform/windows/export/export.cpp
msgid "Description"
-msgstr "서술"
+msgstr "설명"
#: core/project_settings.cpp editor/editor_node.cpp editor/editor_settings.cpp
#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
@@ -10886,7 +10887,7 @@ msgstr "후면 ì›ê·¼"
msgid " [auto]"
msgstr " [ìžë™]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [í¬í„¸ 활성]"
@@ -17852,9 +17853,8 @@ msgid "Use Default Args"
msgstr "ë””í´íŠ¸ë¡œ 재설정"
#: modules/visual_script/visual_script_func_nodes.cpp
-#, fuzzy
msgid "Validate"
-msgstr "올바른 문ìž:"
+msgstr "올바른 문ìž"
#: modules/visual_script/visual_script_func_nodes.cpp
#, fuzzy
@@ -17984,24 +17984,20 @@ msgid "Preload"
msgstr "새로고침"
#: modules/visual_script/visual_script_nodes.cpp
-#, fuzzy
msgid "Get Index"
-msgstr "Z ì¸ë±ìФ"
+msgstr "ì¸ë±ìФ 가져오기"
#: modules/visual_script/visual_script_nodes.cpp
-#, fuzzy
msgid "Set Index"
-msgstr "Z ì¸ë±ìФ"
+msgstr "ì¸ë±ìФ 설정"
#: modules/visual_script/visual_script_nodes.cpp
-#, fuzzy
msgid "Global Constant"
-msgstr "ìƒìˆ˜"
+msgstr "ì „ì—­ ìƒìˆ˜"
#: modules/visual_script/visual_script_nodes.cpp
-#, fuzzy
msgid "Class Constant"
-msgstr "ìƒìˆ˜"
+msgstr "í´ëž˜ìФ ìƒìˆ˜"
#: modules/visual_script/visual_script_nodes.cpp
#, fuzzy
@@ -18009,24 +18005,21 @@ msgid "Basic Constant"
msgstr "ìƒìˆ˜"
#: modules/visual_script/visual_script_nodes.cpp
-#, fuzzy
msgid "Math Constant"
-msgstr "ìƒìˆ˜"
+msgstr "수학 ìƒìˆ˜"
#: modules/visual_script/visual_script_nodes.cpp
-#, fuzzy
msgid "Get Engine Singleton"
-msgstr "í™œì„±í™”ëœ GDNative 싱글톤"
+msgstr "엔진 싱글톤 가져오기"
#: modules/visual_script/visual_script_nodes.cpp
#, fuzzy
msgid "Get Scene Node"
-msgstr "시간 íƒìƒ‰ 노드"
+msgstr "씬 Node 가져오기"
#: modules/visual_script/visual_script_nodes.cpp
-#, fuzzy
msgid "Get Scene Tree"
-msgstr "씬 트리 편집"
+msgstr "씬 트리 가져오기"
#: modules/visual_script/visual_script_nodes.cpp
#, fuzzy
@@ -18034,9 +18027,8 @@ msgid "Get Self"
msgstr "ìžì²´"
#: modules/visual_script/visual_script_nodes.cpp
-#, fuzzy
msgid "CustomNode"
-msgstr "노드 잘ë¼ë‚´ê¸°"
+msgstr ""
#: modules/visual_script/visual_script_nodes.cpp
msgid "Custom node has no _step() method, can't process graph."
@@ -18096,18 +18088,16 @@ msgid "Wait"
msgstr "대기"
#: modules/visual_script/visual_script_yield_nodes.cpp
-#, fuzzy
msgid "Next Frame"
-msgstr "프레임 ì´ë™"
+msgstr "ë‹¤ìŒ í”„ë ˆìž„"
#: modules/visual_script/visual_script_yield_nodes.cpp
-#, fuzzy
msgid "Next Physics Frame"
-msgstr "물리 프레임 %"
+msgstr "ë‹¤ìŒ ë¬¼ë¦¬ 프레임"
#: modules/visual_script/visual_script_yield_nodes.cpp
msgid "%s sec(s)"
-msgstr ""
+msgstr "%sì´ˆ"
#: modules/visual_script/visual_script_yield_nodes.cpp scene/main/timer.cpp
#, fuzzy
@@ -18136,7 +18126,7 @@ msgstr "우선 순위 모드"
#: modules/webrtc/webrtc_data_channel.h
msgid "WebRTC"
-msgstr ""
+msgstr "WebRTC"
#: modules/webrtc/webrtc_data_channel.h
msgid "Max Channel In Buffer (KB)"
@@ -18148,12 +18138,12 @@ msgstr ""
#: modules/websocket/websocket_client.cpp
msgid "Trusted SSL Certificate"
-msgstr ""
+msgstr "신뢰할 수 있는 SSL ì¸ì¦ì„œ"
#: modules/websocket/websocket_macros.h
#, fuzzy
msgid "WebSocket Client"
-msgstr "ë„¤íŠ¸ì›Œí¬ í”„ë¡œíŒŒì¼ëŸ¬"
+msgstr "WebSocket í´ë¼ì´ì–¸íЏ"
#: modules/websocket/websocket_macros.h
msgid "Max In Buffer (KB)"
@@ -18181,13 +18171,12 @@ msgid "Bind IP"
msgstr ""
#: modules/websocket/websocket_server.cpp
-#, fuzzy
msgid "Private Key"
-msgstr "물리 키"
+msgstr "ê°œì¸ í‚¤"
#: modules/websocket/websocket_server.cpp platform/javascript/export/export.cpp
msgid "SSL Certificate"
-msgstr ""
+msgstr "SSL ì¸ì¦ì„œ"
#: modules/websocket/websocket_server.cpp
#, fuzzy
@@ -18212,8 +18201,9 @@ msgid "Optional Features"
msgstr "ì„ íƒì  기능"
#: modules/webxr/webxr_interface.cpp
+#, fuzzy
msgid "Requested Reference Space Types"
-msgstr ""
+msgstr "ìš”ì²­ëœ ì°¸ì¡° 공간 유형"
#: modules/webxr/webxr_interface.cpp
msgid "Reference Space Type"
diff --git a/editor/translations/lt.po b/editor/translations/lt.po
index 5f0c068dbb..33cc2f8ae9 100644
--- a/editor/translations/lt.po
+++ b/editor/translations/lt.po
@@ -11054,7 +11054,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/lv.po b/editor/translations/lv.po
index 51836c627b..18c5c4242e 100644
--- a/editor/translations/lv.po
+++ b/editor/translations/lv.po
@@ -10997,7 +10997,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/mk.po b/editor/translations/mk.po
index 6d725ac82b..9f06f03d81 100644
--- a/editor/translations/mk.po
+++ b/editor/translations/mk.po
@@ -10624,7 +10624,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/ml.po b/editor/translations/ml.po
index 171cc17fdb..8a66f8b8b4 100644
--- a/editor/translations/ml.po
+++ b/editor/translations/ml.po
@@ -10647,7 +10647,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/mr.po b/editor/translations/mr.po
index 24300da41a..ac50228677 100644
--- a/editor/translations/mr.po
+++ b/editor/translations/mr.po
@@ -10634,7 +10634,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/ms.po b/editor/translations/ms.po
index 3b34efe6f2..7c87a4709d 100644
--- a/editor/translations/ms.po
+++ b/editor/translations/ms.po
@@ -11073,7 +11073,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/nb.po b/editor/translations/nb.po
index 9d831aee5d..f7aac38f70 100644
--- a/editor/translations/nb.po
+++ b/editor/translations/nb.po
@@ -4,7 +4,7 @@
# This file is distributed under the same license as the Godot source code.
# Allan Nordhøy <epost@anotheragency.no>, 2017-2018, 2019, 2020, 2021.
# Anonymous <GentleSaucepan@protonmail.com>, 2017, 2021.
-# Elias <eliasnykrem@gmail.com>, 2018.
+# Elias <eliasnykrem@gmail.com>, 2018, 2023.
# flesk <eivindkn@gmail.com>, 2017, 2019.
# Frank T. Rambol <frank@d-fect.com>, 2018, 2021.
# Jørgen Aarmo Lund <jorgen.aarmo@gmail.com>, 2016, 2019.
@@ -28,8 +28,8 @@ msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-12-08 10:28+0000\n"
-"Last-Translator: slasken06 <ask.skivdal@gmail.com>\n"
+"PO-Revision-Date: 2023-01-17 13:54+0000\n"
+"Last-Translator: Elias <eliasnykrem@gmail.com>\n"
"Language-Team: Norwegian Bokmål <https://hosted.weblate.org/projects/godot-"
"engine/godot/nb_NO/>\n"
"Language: nb\n"
@@ -37,7 +37,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 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -2281,7 +2281,7 @@ msgstr "Ã…pne"
#: editor/dependency_editor.cpp
msgid "Owners of: %s (Total: %d)"
-msgstr ""
+msgstr "Eiere av: %s (Totalt: %d)"
#: editor/dependency_editor.cpp
#, fuzzy
@@ -2868,22 +2868,19 @@ msgstr "Velg"
#: editor/editor_export.cpp
msgid "Project export for platform:"
-msgstr ""
+msgstr "Prosjekteksport til platform:"
#: editor/editor_export.cpp
-#, fuzzy
msgid "Completed with warnings."
-msgstr "Kopier Node-bane"
+msgstr "Fullført med varsler."
#: editor/editor_export.cpp
-#, fuzzy
msgid "Completed successfully."
-msgstr "Vellykket Installering av Pakke!"
+msgstr "Fullført vellykket."
#: editor/editor_export.cpp
-#, fuzzy
msgid "Failed."
-msgstr "Feilet:"
+msgstr "Feilet."
#: editor/editor_export.cpp
msgid "Storing File:"
@@ -2898,29 +2895,24 @@ msgid "Packing"
msgstr "Pakking"
#: editor/editor_export.cpp
-#, fuzzy
msgid "Save PCK"
-msgstr "Lagre som"
+msgstr "Lagre PCK"
#: editor/editor_export.cpp
-#, fuzzy
msgid "Cannot create file \"%s\"."
-msgstr "Kunne ikke opprette mappe."
+msgstr "Kunne ikke opprette filen \"%s\"."
#: editor/editor_export.cpp
-#, fuzzy
msgid "Failed to export project files."
-msgstr "Kunne ikke opprette mappe."
+msgstr "Kunne ikke eksportere prosjektfiler."
#: editor/editor_export.cpp
-#, fuzzy
msgid "Can't open file to read from path \"%s\"."
-msgstr "Kan ikke åpne fil for skriving:"
+msgstr "Kan ikke åpne filen for å lese fra banen \"%s\"."
#: editor/editor_export.cpp
-#, fuzzy
msgid "Save ZIP"
-msgstr "Lagre som"
+msgstr "Lagre ZIP"
#: editor/editor_export.cpp
msgid ""
@@ -2984,9 +2976,8 @@ msgstr ""
#: editor/editor_export.cpp platform/android/export/export_plugin.cpp
#: platform/iphone/export/export.cpp platform/javascript/export/export.cpp
#: platform/osx/export/export.cpp platform/uwp/export/export.cpp
-#, fuzzy
msgid "Custom Template"
-msgstr "Medlemmer"
+msgstr "Egendefinert mal"
#: editor/editor_export.cpp editor/project_export.cpp
#: platform/android/export/export_plugin.cpp platform/iphone/export/export.cpp
@@ -2996,22 +2987,20 @@ msgid "Release"
msgstr "Slipp"
#: editor/editor_export.cpp
-#, fuzzy
msgid "Binary Format"
-msgstr "Anim Forandre Omforming"
+msgstr "Binærformat"
#: editor/editor_export.cpp
msgid "64 Bits"
-msgstr ""
+msgstr "64 Bits"
#: editor/editor_export.cpp
msgid "Embed PCK"
-msgstr ""
+msgstr "Innebygd PCK"
#: editor/editor_export.cpp platform/osx/export/export.cpp
-#, fuzzy
msgid "Texture Format"
-msgstr "Linjal Modus"
+msgstr "Teksturformat"
#: editor/editor_export.cpp
msgid "BPTC"
@@ -3031,9 +3020,8 @@ msgid "ETC2"
msgstr ""
#: editor/editor_export.cpp
-#, fuzzy
msgid "No BPTC Fallbacks"
-msgstr "Tilbakefall"
+msgstr "Ingen BPTC tilbakefall"
#: editor/editor_export.cpp platform/android/export/export_plugin.cpp
#: platform/iphone/export/export.cpp platform/javascript/export/export.cpp
@@ -3048,24 +3036,20 @@ msgid "Custom release template not found."
msgstr "Fant ikke tilpasset utgivelsesmal."
#: editor/editor_export.cpp
-#, fuzzy
msgid "Prepare Template"
-msgstr "HÃ¥ndter Eksportmaler"
+msgstr "Forbered mal"
#: editor/editor_export.cpp platform/osx/export/export.cpp
-#, fuzzy
msgid "The given export path doesn't exist."
-msgstr "Fil eksisterer ikke."
+msgstr "Den angitte eksportbanen eksisterer ikke."
#: editor/editor_export.cpp platform/javascript/export/export.cpp
-#, fuzzy
msgid "Template file not found: \"%s\"."
-msgstr "Malfil ble ikke funnet:"
+msgstr "Malfil ble ikke funnet \"%s\"."
#: editor/editor_export.cpp
-#, fuzzy
msgid "Failed to copy export template."
-msgstr "HÃ¥ndter Eksportmaler"
+msgstr "Kunne ikke kopiere eksportmalen."
#: editor/editor_export.cpp platform/windows/export/export.cpp
#: platform/x11/export/export.cpp
@@ -3082,9 +3066,8 @@ msgid "Convert Text Resources To Binary On Export"
msgstr ""
#: editor/editor_feature_profile.cpp
-#, fuzzy
msgid "3D Editor"
-msgstr "Redigeringsverktøy"
+msgstr "3D Redigeringsverktøy"
#: editor/editor_feature_profile.cpp
msgid "Script Editor"
@@ -3097,7 +3080,7 @@ msgstr "Ressursbibliotek"
#: editor/editor_feature_profile.cpp
msgid "Scene Tree Editing"
-msgstr ""
+msgstr "Scenetre redigering"
#: editor/editor_feature_profile.cpp
#, fuzzy
@@ -3115,7 +3098,7 @@ msgstr "Importer"
#: editor/editor_feature_profile.cpp
msgid "Allows to view and edit 3D scenes."
-msgstr ""
+msgstr "Lar deg se og redigere 3D scener."
#: editor/editor_feature_profile.cpp
msgid "Allows to edit scripts using the integrated script editor."
@@ -11529,7 +11512,7 @@ msgstr "Perspektiv"
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
@@ -14991,9 +14974,8 @@ msgid "Project Path:"
msgstr "Prosjektsti:"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Project Installation Path:"
-msgstr "Prosjektsti:"
+msgstr "Prosjekt installasjonsti:"
#: editor/project_manager.cpp
msgid "Renderer:"
@@ -15005,7 +14987,7 @@ msgstr ""
#: editor/project_manager.cpp
msgid "Not supported by your GPU drivers."
-msgstr ""
+msgstr "Støttes ikke av dine GPU-drivere."
#: editor/project_manager.cpp
msgid ""
@@ -15040,9 +15022,8 @@ msgid "Renderer can be changed later, but scenes may need to be adjusted."
msgstr "Rendrer kan endres senere, men scener må kanskje justeres."
#: editor/project_manager.cpp
-#, fuzzy
msgid "Missing Project"
-msgstr "Importer Eksisterende Prosjekt"
+msgstr "Manglede Prosjekt"
#: editor/project_manager.cpp
msgid "Error: Project is missing on the filesystem."
@@ -15053,9 +15034,8 @@ msgid "Local"
msgstr "Lokal"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Local Projects"
-msgstr "Prosjekter"
+msgstr "Lokale prosjekter"
#: editor/project_manager.cpp
#, fuzzy
@@ -15063,9 +15043,8 @@ msgid "Asset Library Projects"
msgstr "Ressursbibliotek"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Can't open project at '%s'."
-msgstr "Kan ikke åpne prosjekt"
+msgstr "Kan ikke åpne prosjektet i '%s'."
#: editor/project_manager.cpp
msgid "Are you sure to open more than one project?"
@@ -15172,23 +15151,20 @@ msgid "Loading, please wait..."
msgstr "Henter fillager, vennligst vent..."
#: editor/project_manager.cpp
-#, fuzzy
msgid "Edit Project"
-msgstr "Eksporter Prosjekt"
+msgstr "Rediger Prosjekt"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Run Project"
-msgstr "Endre Navn på Prosjekt"
+msgstr "Kjør prosjektet"
#: editor/project_manager.cpp
msgid "Scan"
-msgstr "Skann"
+msgstr "Søk"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Scan Projects"
-msgstr "Prosjekter"
+msgstr "Søk etter prosjekter"
#: editor/project_manager.cpp
msgid "Select a Folder to Scan"
@@ -15199,19 +15175,16 @@ msgid "New Project"
msgstr "Nytt prosjekt"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Import Project"
-msgstr "Eksporter Prosjekt"
+msgstr "Importert prosjekt"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Remove Project"
-msgstr "Endre Navn på Prosjekt"
+msgstr "Fjern prosjekt"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Remove Missing"
-msgstr "Fjern punkt"
+msgstr "Fjern manglende"
#: editor/project_manager.cpp
msgid "About"
@@ -15227,7 +15200,7 @@ msgstr "Fjern alle"
#: editor/project_manager.cpp
msgid "Also delete project contents (no undo!)"
-msgstr ""
+msgstr "Slett også prosjektets innhold (kan ikke reverseres!)"
#: editor/project_manager.cpp
msgid "Can't run project"
@@ -15240,9 +15213,8 @@ msgid ""
msgstr ""
#: editor/project_manager.cpp
-#, fuzzy
msgid "Filter projects"
-msgstr "Lim inn Noder"
+msgstr "Filtre prosjekter"
#: editor/project_manager.cpp
msgid ""
diff --git a/editor/translations/nl.po b/editor/translations/nl.po
index 5e80c53732..0e47306f0d 100644
--- a/editor/translations/nl.po
+++ b/editor/translations/nl.po
@@ -11327,7 +11327,7 @@ msgstr "Perspectief"
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/pl.po b/editor/translations/pl.po
index 47b7bfe98a..31048d3390 100644
--- a/editor/translations/pl.po
+++ b/editor/translations/pl.po
@@ -2,7 +2,7 @@
# Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).
# This file is distributed under the same license as the Godot source code.
-# 8-bit Pixel <dawdejw@gmail.com>, 2016.
+# 8-bit Pixel <dawdejw@gmail.com>, 2016, 2023.
# Adam Wolanski <adam.wolanski94@gmail.com>, 2017.
# Adrian Węcławski <weclawskiadrian@gmail.com>, 2016.
# aelspire <aelspire@gmail.com>, 2017, 2019, 2020, 2021.
@@ -17,14 +17,14 @@
# Maksymilian Świąć <maksymilian.swiac@gmail.com>, 2017-2018.
# Mietek Szcześniak <ravaging@go2.pl>, 2016.
# NeverK <neverkoxu@gmail.com>, 2018, 2019, 2020, 2021, 2022.
-# Rafal Brozio <rafal.brozio@gmail.com>, 2016, 2019, 2020, 2021.
+# Rafal Brozio <rafal.brozio@gmail.com>, 2016, 2019, 2020, 2021, 2023.
# Rafał Ziemniak <synaptykq@gmail.com>, 2017.
-# RM <synaptykq@gmail.com>, 2018, 2020, 2022.
+# RM <synaptykq@gmail.com>, 2018, 2020, 2022, 2023.
# Sebastian Krzyszkowiak <dos@dosowisko.net>, 2017.
-# Sebastian Pasich <sebastian.pasich@gmail.com>, 2017, 2019, 2020, 2022.
+# Sebastian Pasich <sebastian.pasich@gmail.com>, 2017, 2019, 2020, 2022, 2023.
# siatek papieros <sbigneu@gmail.com>, 2016.
# Zatherz <zatherz@linux.pl>, 2017, 2020, 2021.
-# Tomek <kobewi4e@gmail.com>, 2018, 2019, 2020, 2021, 2022.
+# Tomek <kobewi4e@gmail.com>, 2018, 2019, 2020, 2021, 2022, 2023.
# Wojcieh Er Zet <wojcieh.rzepecki@gmail.com>, 2018.
# Dariusz Siek <dariuszynski@gmail.com>, 2018, 2019, 2020, 2021.
# Szymon Nowakowski <smnbdg13@gmail.com>, 2019.
@@ -45,7 +45,7 @@
# Piotr Grodzki <ziemniakglados@gmail.com>, 2020.
# Dzejkop <jakubtrad@gmail.com>, 2020, 2021.
# Mateusz Grzonka <alpinus4@gmail.com>, 2020.
-# gnu-ewm <gnu.ewm@protonmail.com>, 2021.
+# gnu-ewm <gnu.ewm@protonmail.com>, 2021, 2023.
# vrid <patryksoon@live.com>, 2021.
# Suchy Talerz <kacperkubis06@gmail.com>, 2021.
# Bartosz Stasiak <bs97086@amu.edu.pl>, 2021.
@@ -60,22 +60,23 @@
# Mateusz Zdrzałek <matjozohd@gmail.com>, 2022.
# Konrad <kobe-interactive@protonmail.com>, 2022.
# Pixel Zone - Godot Engine Tutorials <karoltomaszewskimusic@gmail.com>, 2022.
-# DK0492 <doriankaczmarek28@gmail.com>, 2022.
+# DK0492 <doriankaczmarek28@gmail.com>, 2022, 2023.
# Dawid Skubij <davidsd@tlen.pl>, 2022.
-# kingofsponges <q.patex.q@gmail.com>, 2022.
+# kingofsponges <q.patex.q@gmail.com>, 2022, 2023.
# Patryk Morawski <gormit7@gmail.com>, 2022.
# Adrians <adrianspl@o2.pl>, 2022.
# Wodorek <Krol.w94@gmail.com>, 2022.
# Filip Gliszczyński <filipgliszczynski@gmail.com>, 2022.
# Piotr Åšlusarz <piotrekslusarz@outlook.com>, 2022.
# Jan Kurzak <Iqaz0oki@outlook.com>, 2022.
+# Wojciech Pluta <wojciech.pluta@oracle.com>, 2022.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-12-12 09:46+0000\n"
-"Last-Translator: Tomek <kobewi4e@gmail.com>\n"
+"PO-Revision-Date: 2023-01-20 10:19+0000\n"
+"Last-Translator: RM <synaptykq@gmail.com>\n"
"Language-Team: Polish <https://hosted.weblate.org/projects/godot-engine/"
"godot/pl/>\n"
"Language: pl\n"
@@ -84,7 +85,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
"|| n%100>=20) ? 1 : 2;\n"
-"X-Generator: Weblate 4.15-dev\n"
+"X-Generator: Weblate 4.15.1\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -104,7 +105,7 @@ msgstr "Kod zakończenia"
#: core/bind/core_bind.cpp
msgid "V-Sync Enabled"
-msgstr "V-Sync Włączone"
+msgstr "V-Sync włączone"
#: core/bind/core_bind.cpp main/main.cpp
msgid "V-Sync Via Compositor"
@@ -112,7 +113,7 @@ msgstr "V-Sync przez kompozytor"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Delta Smoothing"
-msgstr "Wygładzanie Delta"
+msgstr "Wygładzanie delta"
#: core/bind/core_bind.cpp
msgid "Low Processor Usage Mode"
@@ -5523,18 +5524,16 @@ msgid "Show Line Numbers"
msgstr "Pokaż numery linii"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Line Numbers Zero Padded"
-msgstr "Numer linii:"
+msgstr "Numery linii wyrównane zerami"
#: editor/editor_settings.cpp
msgid "Show Bookmark Gutter"
msgstr "Pokaż ciek zakładek"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Show Breakpoint Gutter"
-msgstr "Pomiń punkty wstrzymania"
+msgstr "Pokaż rynnę punktów wstrzymania"
#: editor/editor_settings.cpp
msgid "Show Info Gutter"
@@ -5561,9 +5560,8 @@ msgid "Line Length Guideline Hard Column"
msgstr "Wytyczne dotyczące długości linii twardej kolumny"
#: editor/editor_settings.cpp editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Script List"
-msgstr "Edytor skryptów"
+msgstr "Lista skryptów"
#: editor/editor_settings.cpp
msgid "Show Members Overview"
@@ -5594,9 +5592,8 @@ msgid "Auto Reload Scripts On External Change"
msgstr "Automatycznie przeładuj skrypty przy zmianie zewnętrznej"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Create Signal Callbacks"
-msgstr "Opóźnienia wymuszania shaderów"
+msgstr "Twórz wywołania zwrotne sygnałów"
#: editor/editor_settings.cpp
msgid "Sort Members Outline Alphabetically"
@@ -5623,9 +5620,8 @@ msgid "Caret Blink Speed"
msgstr "Prędkość migania karety"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Right Click Moves Caret"
-msgstr "Prawy klik, aby dodać punkt"
+msgstr "Prawy klik przesuwa kursor"
#: editor/editor_settings.cpp modules/gdscript/gdscript.cpp
#: modules/gdscript/gdscript_editor.cpp
@@ -5647,56 +5643,51 @@ msgstr "Opóźnienie zakończenia kodu"
#: editor/editor_settings.cpp
msgid "Put Callhint Tooltip Below Current Line"
-msgstr ""
+msgstr "Ustaw dymek podpowiedzi pod aktualnym wierszem"
#: editor/editor_settings.cpp
msgid "Callhint Tooltip Offset"
-msgstr ""
+msgstr "Przesunięcie dymka podpowiedzi"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Complete File Paths"
-msgstr "Skopiuj ścieżkę węzła"
+msgstr "Uzupełniaj ścieżki plików"
#: editor/editor_settings.cpp modules/gdscript/gdscript_editor.cpp
-#, fuzzy
msgid "Add Type Hints"
-msgstr "Dodaj typ"
+msgstr "Dodaj wskazówki typów"
#: editor/editor_settings.cpp
msgid "Use Single Quotes"
msgstr "Użyj pojedynczych cudzysłowów"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Show Help Index"
-msgstr "Pokaż linie pomocnicze"
+msgstr "Pokaż indeks pomocy"
#: editor/editor_settings.cpp
msgid "Help Font Size"
-msgstr ""
+msgstr "Rozmiar czcionki pomocy"
#: editor/editor_settings.cpp
msgid "Help Source Font Size"
-msgstr ""
+msgstr "Rozmiar czcionki kodu w pomocy"
#: editor/editor_settings.cpp
msgid "Help Title Font Size"
-msgstr ""
+msgstr "Rozmiar czcionki tytułu w pomocy"
#: editor/editor_settings.cpp modules/gridmap/grid_map_editor_plugin.cpp
msgid "Grid Map"
msgstr "Siatka"
#: editor/editor_settings.cpp modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Pick Distance"
-msgstr "Wybierz odległość:"
+msgstr "Dystans łapania"
#: editor/editor_settings.cpp editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Preview Size"
-msgstr "PodglÄ…d"
+msgstr "Rozmiar podglÄ…du"
#: editor/editor_settings.cpp
msgid "Primary Grid Color"
@@ -5707,32 +5698,27 @@ msgid "Secondary Grid Color"
msgstr "Pomocniczy kolor siatki"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Selection Box Color"
-msgstr "Tylko zaznaczenie"
+msgstr "Kolor prostopadłościanu zaznaczenia"
#: editor/editor_settings.cpp editor/plugins/path_editor_plugin.cpp
#: editor/spatial_editor_gizmos.cpp modules/csg/csg_gizmos.cpp
-#, fuzzy
msgid "3D Gizmos"
-msgstr "Uchwyty"
+msgstr "Uchwyty 3D"
#: editor/editor_settings.cpp editor/plugins/path_editor_plugin.cpp
#: editor/spatial_editor_gizmos.cpp modules/csg/csg_gizmos.cpp
-#, fuzzy
msgid "Gizmo Colors"
-msgstr "Kolory emisji"
+msgstr "Kolory uchwytów"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Instanced"
-msgstr "Instancja"
+msgstr "Instancjonowany"
#: editor/editor_settings.cpp modules/gltf/gltf_node.cpp
#: scene/3d/physics_body.cpp
-#, fuzzy
msgid "Joint"
-msgstr "Punkt"
+msgstr "Złącze"
#: editor/editor_settings.cpp scene/2d/collision_shape_2d.cpp
#: scene/2d/cpu_particles_2d.cpp scene/2d/touch_screen_button.cpp
@@ -5744,276 +5730,236 @@ msgid "Shape"
msgstr "Kształt"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Primary Grid Steps"
-msgstr "Krok siatki:"
+msgstr "Główne kroki siatki"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Grid Size"
-msgstr "Krok siatki:"
+msgstr "Rozmiar siatki"
#: editor/editor_settings.cpp
msgid "Grid Division Level Max"
-msgstr ""
+msgstr "Maksymalny poziom podziału siatki"
#: editor/editor_settings.cpp
msgid "Grid Division Level Min"
-msgstr ""
+msgstr "Minimalny poziom podziału siatki"
#: editor/editor_settings.cpp
msgid "Grid Division Level Bias"
-msgstr ""
+msgstr "Tendencja poziomu podziału siatki"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Grid XZ Plane"
-msgstr "Malowanie GridMap"
+msgstr "Płaszczyzna siatki XZ"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Grid XY Plane"
-msgstr "Malowanie GridMap"
+msgstr "Płaszczyzna siatki XY"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Grid YZ Plane"
-msgstr "Malowanie GridMap"
+msgstr "Płaszczyzna siatki YZ"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Default FOV"
-msgstr "Domyślny"
+msgstr "Domyślne pole widzenia (FOV)"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Default Z Near"
-msgstr "Domyślny motyw"
+msgstr "Domyślne bliskie Z"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Default Z Far"
-msgstr "Domyślny"
+msgstr "Domyślne dalekie Z"
#: editor/editor_settings.cpp
msgid "Lightmap Baking Number Of CPU Threads"
-msgstr ""
+msgstr "Liczba wątków CPU dla wypalania map światła"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Navigation Scheme"
-msgstr "Tryb nawigacji"
+msgstr "Schemat nawigacji"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Invert Y Axis"
-msgstr "Edytuj oÅ› Y"
+msgstr "Odwróć oś Y"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Invert X Axis"
-msgstr "Edytuj oÅ› X"
+msgstr "Odwróć oś X"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Zoom Style"
-msgstr "Oddal"
+msgstr "Styl przybliżenia"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Emulate Numpad"
-msgstr "Włącz emulację klawiatury numerycznej"
+msgstr "Emuluj klawiaturÄ™ numerycznÄ…"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Emulate 3 Button Mouse"
-msgstr "Włącz emulację środkowego przycisku myszy"
+msgstr "Emuluj trzyprzyciskowÄ… mysz"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Orbit Modifier"
-msgstr "Pierwsze zmodyfikowane"
+msgstr "Modyfikator orbity"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Pan Modifier"
-msgstr "Tryb przesuwania"
+msgstr "Modyfikator przesuwania"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Zoom Modifier"
-msgstr "Zmodyfikowany"
+msgstr "Modyfikator przybliżenia"
#: editor/editor_settings.cpp editor/plugins/spatial_editor_plugin.cpp
msgid "Warped Mouse Panning"
-msgstr ""
+msgstr "Zawinięte przesuwanie myszą"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Navigation Feel"
-msgstr "Tryb nawigacji"
+msgstr "Preferencje nawigacji"
#: editor/editor_settings.cpp
msgid "Orbit Sensitivity"
-msgstr ""
+msgstr "Czułość orbity"
#: editor/editor_settings.cpp
msgid "Orbit Inertia"
-msgstr ""
+msgstr "Bezwładność orbity"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Translation Inertia"
-msgstr "Tłumaczenia"
+msgstr "Bezwładność przesunięcia"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Zoom Inertia"
-msgstr "Przybliż"
+msgstr "Bezwładność przybliżenia"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook"
-msgstr "\"Wolny widok\" w górę"
+msgstr "Wolny widok"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook Navigation Scheme"
-msgstr "Utwórz siatkę nawigacyjną (Navigation Mesh)"
+msgstr "Schemat nawigacji wolnego widoku"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook Sensitivity"
-msgstr "\"Wolny widok\" w lewo"
+msgstr "Czułość wolnego widoku"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook Inertia"
-msgstr "\"Wolny widok\" w lewo"
+msgstr "Bezwładność wolnego widoku"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook Base Speed"
-msgstr "Modyfikator prędkości swobodnego widoku"
+msgstr "Bazowa prędkość wolnego widoku"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook Activation Modifier"
-msgstr "Wolny modyfikator swobodnego widoku"
+msgstr "Modyfikator aktywacji wolnego widoku"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Freelook Speed Zoom Link"
-msgstr "Modyfikator prędkości swobodnego widoku"
+msgstr "Szybkość swobodnego widoku zależna od przybliżenia"
#: editor/editor_settings.cpp editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Grid Color"
-msgstr "Wybierz Kolor"
+msgstr "Kolor siatki"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Guides Color"
-msgstr "Wybierz Kolor"
+msgstr "Kolor prowadnic"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Smart Snapping Line Color"
-msgstr "Inteligentne przyciÄ…ganie"
+msgstr "Kolor linii inteligentnego przyciÄ…gania"
#: editor/editor_settings.cpp
msgid "Bone Width"
-msgstr ""
+msgstr "Szerokość kości"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Bone Color 1"
-msgstr "Zmień nazwę elementu koloru"
+msgstr "Kolor kości 1"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Bone Color 2"
-msgstr "Zmień nazwę elementu koloru"
+msgstr "Kolor kości 2"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Bone Selected Color"
-msgstr "Konfiguruj wybrany profil:"
+msgstr "Kolor zaznaczenia kości"
#: editor/editor_settings.cpp
msgid "Bone IK Color"
-msgstr ""
+msgstr "Kolor kości IK"
#: editor/editor_settings.cpp
msgid "Bone Outline Color"
-msgstr ""
+msgstr "Kolor obrysu kości"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Bone Outline Size"
-msgstr "Rozmiar zarysu:"
+msgstr "Rozmiar obrysu kości"
#: editor/editor_settings.cpp
msgid "Viewport Border Color"
-msgstr ""
+msgstr "Kolor obwódki viewportu"
#: editor/editor_settings.cpp
msgid "Constrain Editor View"
-msgstr ""
+msgstr "Ogranicz widok edytora"
#: editor/editor_settings.cpp
msgid "Simple Panning"
-msgstr ""
+msgstr "Proste przesuwanie"
#: editor/editor_settings.cpp
msgid "Scroll To Pan"
-msgstr ""
+msgstr "Przewijanie przesuwa"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Pan Speed"
-msgstr "Szybkość:"
+msgstr "Szybkość przesuwania"
#: editor/editor_settings.cpp editor/plugins/polygon_2d_editor_plugin.cpp
-#, fuzzy
msgid "Poly Editor"
-msgstr "WielokÄ…t 2D UV Edytor"
+msgstr "Edytor wielokątów"
#: editor/editor_settings.cpp
msgid "Point Grab Radius"
-msgstr ""
+msgstr "Promień chwytania punktów"
#: editor/editor_settings.cpp editor/plugins/polygon_2d_editor_plugin.cpp
-#, fuzzy
msgid "Show Previous Outline"
-msgstr "Poprzednia płaszczyzna"
+msgstr "Pokaż poprzedni obrys"
#: editor/editor_settings.cpp editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Autorename Animation Tracks"
-msgstr "Zmień nazwę animacji"
+msgstr "Automatycznie przemianuj ścieżki animacji"
#: editor/editor_settings.cpp
msgid "Default Create Bezier Tracks"
-msgstr ""
+msgstr "Twórz domyślnie ścieżki Beziera"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Default Create Reset Tracks"
-msgstr "Utwórz ścieżki RESET"
+msgstr "Domyślnie twórz ścieżki resetu"
#: editor/editor_settings.cpp
msgid "Onion Layers Past Color"
-msgstr ""
+msgstr "Przeszły kolor warstw cebuli"
#: editor/editor_settings.cpp
msgid "Onion Layers Future Color"
-msgstr ""
+msgstr "Przyszły kolor warstw cebuli"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Visual Editors"
-msgstr "Edytor grup"
+msgstr "Edytory wizualne"
#: editor/editor_settings.cpp
msgid "Minimap Opacity"
@@ -6021,69 +5967,61 @@ msgstr "Przezroczystość minimapy"
#: editor/editor_settings.cpp
msgid "Window Placement"
-msgstr ""
+msgstr "Ustawienie okna"
#: editor/editor_settings.cpp scene/2d/back_buffer_copy.cpp scene/2d/sprite.cpp
#: scene/2d/visibility_notifier_2d.cpp scene/3d/sprite_3d.cpp
#: scene/gui/control.cpp
-#, fuzzy
msgid "Rect"
-msgstr "Cały obszar"
+msgstr "ProstokÄ…t"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Rect Custom Position"
-msgstr "Ustaw punkt kontrolny wychodzÄ…cy z krzywej"
+msgstr "Własna pozycja prostokąta"
#: editor/editor_settings.cpp platform/android/export/export_plugin.cpp
msgid "Screen"
-msgstr ""
+msgstr "Ekran"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Auto Save"
-msgstr "Tnij automatycznie"
+msgstr "Autozapis"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Save Before Running"
-msgstr "Zapisz scenÄ™ przed uruchomieniem..."
+msgstr "Zapisz przed uruchomieniem"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Font Size"
-msgstr "Widok z przodu"
+msgstr "Rozmiar czcionki"
#: editor/editor_settings.cpp
#: modules/gdscript/language_server/gdscript_language_server.cpp
-#, fuzzy
msgid "Remote Host"
-msgstr "Zdalny "
+msgstr "Zdalny host"
#: editor/editor_settings.cpp
#: modules/gdscript/language_server/gdscript_language_server.cpp
-#, fuzzy
msgid "Remote Port"
-msgstr "Usuń punkt"
+msgstr "Zdalny port"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Editor SSL Certificates"
-msgstr "Ustawienia edytora"
+msgstr "Certyfikaty SSL edytora"
#: editor/editor_settings.cpp
msgid "HTTP Proxy"
-msgstr ""
+msgstr "Proxy HTTP"
#: editor/editor_settings.cpp
msgid "Host"
-msgstr ""
+msgstr "Host"
#: editor/editor_settings.cpp editor/fileserver/editor_file_server.cpp
#: main/main.cpp modules/mono/mono_gd/gd_mono.cpp
#: scene/resources/default_theme/default_theme.cpp
msgid "Port"
-msgstr ""
+msgstr "Port"
#. TRANSLATORS: Project Manager here refers to the tool used to create/manage Godot projects.
#: editor/editor_settings.cpp
@@ -6092,171 +6030,150 @@ msgstr "Menedżer projektów"
#. TRANSLATORS: Project Manager here refers to the tool used to create/manage Godot projects.
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Sorting Order"
-msgstr "w kolejności:"
+msgstr "Kolejność sortowania"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
msgid "Symbol Color"
-msgstr ""
+msgstr "Kolor symbolu"
#: editor/editor_settings.cpp
msgid "Keyword Color"
-msgstr ""
+msgstr "Kolor słowa kluczowego"
#: editor/editor_settings.cpp
msgid "Control Flow Keyword Color"
-msgstr ""
+msgstr "Kolor słowa kluczowego kontroli przepływu"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Base Type Color"
-msgstr "Zmień typ podstawowy"
+msgstr "Kolor typu bazowego"
#: editor/editor_settings.cpp
msgid "Engine Type Color"
-msgstr ""
+msgstr "Kolor typu silnika"
#: editor/editor_settings.cpp
msgid "User Type Color"
-msgstr ""
+msgstr "Kolor typu użytkownika"
#: editor/editor_settings.cpp
msgid "Comment Color"
-msgstr ""
+msgstr "Kolor komentarza"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "String Color"
-msgstr "Zapisywanie pliku:"
+msgstr "Kolor ciągu znaków"
#: editor/editor_settings.cpp platform/javascript/export/export.cpp
#: platform/uwp/export/export.cpp
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Background Color"
-msgstr "Kolor tła nieprawidłowy."
+msgstr "Kolor tła"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Completion Background Color"
-msgstr "Kolor tła nieprawidłowy."
+msgstr "Kolor tła uzupełniania"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Completion Selected Color"
-msgstr "Importuj zaznaczone"
+msgstr "Kolor zaznaczenia uzupełniania"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
msgid "Completion Existing Color"
-msgstr ""
+msgstr "Kolor istniejącego uzupełniania"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
msgid "Completion Scroll Color"
-msgstr ""
+msgstr "Kolor przewijania uzupełniania"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
msgid "Completion Font Color"
-msgstr ""
+msgstr "Kolor czcionki uzupełniania"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Text Color"
-msgstr "Następny poziom"
+msgstr "Kolor tekstu"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Line Number Color"
-msgstr "Numer linii:"
+msgstr "Kolor numerów linii"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Safe Line Number Color"
-msgstr "Numer linii:"
+msgstr "Kolor numerów bezpiecznych linii"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
msgid "Caret Color"
-msgstr ""
+msgstr "Kolor kursora"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Caret Background Color"
-msgstr "Kolor tła nieprawidłowy."
+msgstr "Kolor tła kursora"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Text Selected Color"
-msgstr "Usuń zaznaczone"
+msgstr "Kolor zaznaczonego tekstu"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Selection Color"
-msgstr "Tylko zaznaczenie"
+msgstr "Kolor zaznaczenia"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
msgid "Brace Mismatch Color"
-msgstr ""
+msgstr "Kolor niedopasowanych nawiasów"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Current Line Color"
-msgstr "Aktualna scena"
+msgstr "Kolor aktualnej linii"
#: editor/editor_settings.cpp
msgid "Line Length Guideline Color"
-msgstr ""
+msgstr "Kolor prowadnicy długości linii"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Word Highlighted Color"
-msgstr "Podświetlacz składni"
+msgstr "Kolor podświetlonego słowa"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
msgid "Number Color"
-msgstr ""
+msgstr "Kolor numeru"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Function Color"
-msgstr "Funkcja"
+msgstr "Kolor funkcji"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Member Variable Color"
-msgstr "Zmień nawę zmiennej"
+msgstr "Kolor zmiennej członkowskiej"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Mark Color"
-msgstr "Wybierz Kolor"
+msgstr "Kolor oznaczenia"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Bookmark Color"
-msgstr "Zakładki"
+msgstr "Kolor zakładki"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Breakpoint Color"
-msgstr "Punkty wstrzymania"
+msgstr "Kolor punktu wstrzymania"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
msgid "Executing Line Color"
-msgstr ""
+msgstr "Kolor wywoływanej linii"
#: editor/editor_settings.cpp scene/resources/default_theme/default_theme.cpp
msgid "Code Folding Color"
-msgstr ""
+msgstr "Kolor zawinięcia kodu"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Search Result Color"
-msgstr "Wyniki wyszukiwania"
+msgstr "Kolor wyniku wyszukiwania"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Search Result Border Color"
-msgstr "Wyniki wyszukiwania"
+msgstr "Kolor obramowania wyniku wyszukiwania"
#: editor/editor_spin_slider.cpp
msgid "Hold %s to round to integers. Hold Shift for more precise changes."
@@ -6265,14 +6182,12 @@ msgstr ""
"bardziej precyzyjnych zmian."
#: editor/editor_spin_slider.cpp scene/gui/button.cpp
-#, fuzzy
msgid "Flat"
-msgstr "Płaskie 0"
+msgstr "Płaski"
#: editor/editor_spin_slider.cpp
-#, fuzzy
msgid "Hide Slider"
-msgstr "Tryb kolizji"
+msgstr "Ukryj suwak"
#: editor/editor_sub_scene.cpp
msgid "Select Node(s) to Import"
@@ -6563,7 +6478,7 @@ msgstr ""
#: editor/fileserver/editor_file_server.cpp
msgid "File Server"
-msgstr ""
+msgstr "Serwer plików"
#: editor/fileserver/editor_file_server.cpp
#: editor/plugins/version_control_editor_plugin.cpp
@@ -6936,43 +6851,40 @@ msgstr "ZarzÄ…dzaj grupami"
#: editor/import/editor_import_collada.cpp
msgid "Collada"
-msgstr ""
+msgstr "Collada"
#: editor/import/editor_import_collada.cpp
msgid "Use Ambient"
-msgstr ""
+msgstr "Użyj otoczenia"
#: editor/import/resource_importer_bitmask.cpp
-#, fuzzy
msgid "Create From"
-msgstr "Utwórz katalog"
+msgstr "Utwórz z"
#: editor/import/resource_importer_bitmask.cpp
#: servers/audio/effects/audio_effect_compressor.cpp
msgid "Threshold"
-msgstr ""
+msgstr "Próg"
#: editor/import/resource_importer_csv_translation.cpp
#: editor/import/resource_importer_layered_texture.cpp
#: editor/import/resource_importer_scene.cpp
#: editor/import/resource_importer_texture.cpp
#: editor/import/resource_importer_wav.cpp scene/3d/gi_probe.cpp
-#, fuzzy
msgid "Compress"
-msgstr "Komponenty"
+msgstr "Skompresuj"
#: editor/import/resource_importer_csv_translation.cpp
msgid "Delimiter"
-msgstr ""
+msgstr "Separator"
#: editor/import/resource_importer_layered_texture.cpp
-#, fuzzy
msgid "ColorCorrect"
-msgstr "Funkcja koloru."
+msgstr "ColorCorrect"
#: editor/import/resource_importer_layered_texture.cpp
msgid "No BPTC If RGB"
-msgstr ""
+msgstr "Bez BPTC jeśli RGB"
#: editor/import/resource_importer_layered_texture.cpp
#: editor/import/resource_importer_texture.cpp scene/2d/cpu_particles_2d.cpp
@@ -6980,31 +6892,29 @@ msgstr ""
#: scene/resources/material.cpp scene/resources/particles_material.cpp
#: scene/resources/texture.cpp scene/resources/visual_shader.cpp
msgid "Flags"
-msgstr ""
+msgstr "Flagi"
#: editor/import/resource_importer_layered_texture.cpp
#: editor/import/resource_importer_texture.cpp scene/animation/tween.cpp
#: scene/resources/texture.cpp
msgid "Repeat"
-msgstr ""
+msgstr "Powtórz"
#: editor/import/resource_importer_layered_texture.cpp
#: editor/import/resource_importer_texture.cpp scene/2d/light_2d.cpp
#: scene/gui/control.cpp
-#, fuzzy
msgid "Filter"
-msgstr "Filtry:"
+msgstr "Filtr"
#: editor/import/resource_importer_layered_texture.cpp
#: editor/import/resource_importer_texture.cpp
-#, fuzzy
msgid "Mipmaps"
-msgstr "Sygnały"
+msgstr "Mipmapy"
#: editor/import/resource_importer_layered_texture.cpp
#: editor/import/resource_importer_texture.cpp
msgid "Anisotropic"
-msgstr ""
+msgstr "Anizotropowe"
#: editor/import/resource_importer_layered_texture.cpp
#: editor/import/resource_importer_texture.cpp
@@ -7012,51 +6922,43 @@ msgid "sRGB"
msgstr "sRGB"
#: editor/import/resource_importer_layered_texture.cpp
-#, fuzzy
msgid "Slices"
-msgstr "Tnij automatycznie"
+msgstr "Kawałki"
#: editor/import/resource_importer_layered_texture.cpp
#: scene/gui/aspect_ratio_container.cpp scene/gui/control.cpp
#: scene/gui/nine_patch_rect.cpp scene/gui/scroll_container.cpp
#: scene/resources/style_box.cpp
-#, fuzzy
msgid "Horizontal"
-msgstr "Poziomo:"
+msgstr "Poziomo"
#: editor/import/resource_importer_layered_texture.cpp
#: scene/gui/aspect_ratio_container.cpp scene/gui/control.cpp
#: scene/gui/nine_patch_rect.cpp scene/gui/scroll_container.cpp
#: scene/resources/style_box.cpp
-#, fuzzy
msgid "Vertical"
-msgstr "Pionowo:"
+msgstr "Pionowo"
#: editor/import/resource_importer_obj.cpp
-#, fuzzy
msgid "Generate Tangents"
-msgstr "Wygeneruj punkty"
+msgstr "Wygeneruj styczne"
#: editor/import/resource_importer_obj.cpp
-#, fuzzy
msgid "Scale Mesh"
-msgstr "Tryb skalowania"
+msgstr "Skaluj siatkÄ™"
#: editor/import/resource_importer_obj.cpp
-#, fuzzy
msgid "Offset Mesh"
-msgstr "Przesunięcie:"
+msgstr "Przesuń siatkę"
#: editor/import/resource_importer_obj.cpp
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Octahedral Compression"
-msgstr "Kompresja"
+msgstr "Kompresja ośmiościenna"
#: editor/import/resource_importer_obj.cpp
-#, fuzzy
msgid "Optimize Mesh Flags"
-msgstr "Rozmiar: "
+msgstr "Optymalizuj flagi siatki"
#: editor/import/resource_importer_scene.cpp
msgid "Import as Single Scene"
@@ -7100,101 +7002,84 @@ msgstr "Importuj jako wiele scen + materiały"
#: editor/import/resource_importer_scene.cpp modules/gltf/gltf_state.cpp
#: scene/3d/physics_joint.cpp
-#, fuzzy
msgid "Nodes"
-msgstr "Węzeł"
+msgstr "Węzły"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Root Type"
-msgstr "Wróć"
+msgstr "Typ korzenia"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Root Name"
-msgstr "Nazwa zdalnego repozytorium"
+msgstr "Nazwa korzenia"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Root Scale"
-msgstr "Skaluj"
+msgstr "Skala korzenia"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Custom Script"
-msgstr "NiestandardowyWęzeł"
+msgstr "Własny skrypt"
#: editor/import/resource_importer_scene.cpp scene/resources/texture.cpp
-#, fuzzy
msgid "Storage"
-msgstr "Zapisywanie pliku:"
+msgstr "Przechowywanie"
#: editor/import/resource_importer_scene.cpp
msgid "Use Legacy Names"
-msgstr ""
+msgstr "Użyj starszych nazw"
#: editor/import/resource_importer_scene.cpp modules/gltf/gltf_state.cpp
-#, fuzzy
msgid "Materials"
-msgstr "Zmiany materiału:"
+msgstr "Materiały"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Keep On Reimport"
-msgstr "Importuj ponownie"
+msgstr "Zachowaj po reimporcie"
#: editor/import/resource_importer_scene.cpp modules/gltf/gltf_state.cpp
-#, fuzzy
msgid "Meshes"
-msgstr "Siatka"
+msgstr "Siatki"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Ensure Tangents"
-msgstr "Modyfikuj stycznÄ… krzywej"
+msgstr "Zapewnij styczne"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Light Baking"
-msgstr "Lightmapping"
+msgstr "Wypalanie światła"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Lightmap Texel Size"
-msgstr "Stwórz Lightmaps"
+msgstr "Rozmiar teksela mapy światła"
#: editor/import/resource_importer_scene.cpp modules/gltf/gltf_state.cpp
msgid "Skins"
-msgstr ""
+msgstr "Skórki"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Use Named Skins"
-msgstr "Użyj przyciągania skali"
+msgstr "Używaj nazwanych skórek"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "External Files"
-msgstr "Otwórz plik"
+msgstr "Pliki zewnętrzne"
#: editor/import/resource_importer_scene.cpp
msgid "Store In Subdir"
-msgstr ""
+msgstr "Przechowaj w podfolderze"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Filter Script"
-msgstr "Filtruj skrypty"
+msgstr "Skrypt filtra"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Keep Custom Tracks"
-msgstr "Przekształcanie"
+msgstr "Zachowaj własne ścieżki"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Optimizer"
-msgstr "Zoptymalizuj"
+msgstr "Optymalizator"
#: editor/import/resource_importer_scene.cpp
#: editor/plugins/item_list_editor_plugin.cpp main/main.cpp
@@ -7208,41 +7093,34 @@ msgstr "Zoptymalizuj"
#: scene/3d/sprite_3d.cpp scene/gui/graph_edit.cpp
#: scene/gui/rich_text_label.cpp scene/resources/curve.cpp
#: scene/resources/environment.cpp scene/resources/material.cpp
-#, fuzzy
msgid "Enabled"
-msgstr "Włącz"
+msgstr "Włączony"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Max Linear Error"
-msgstr "Maks. błąd liniowy:"
+msgstr "Maks. błąd liniowy"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Max Angular Error"
-msgstr "Maks. błąd kątowy:"
+msgstr "Maks. błąd kątowy"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Max Angle"
-msgstr "Wartość"
+msgstr "Maksymalny kÄ…t"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Remove Unused Tracks"
-msgstr "Usuń ścieżkę animacji"
+msgstr "Usuń nieużywane ścieżki"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Clips"
-msgstr "Klipy animacji"
+msgstr "Klipy"
#: editor/import/resource_importer_scene.cpp scene/2d/cpu_particles_2d.cpp
#: scene/2d/particles_2d.cpp scene/3d/area.cpp scene/3d/cpu_particles.cpp
#: scene/3d/particles.cpp scene/resources/environment.cpp
-#, fuzzy
msgid "Amount"
-msgstr "Ilośc:"
+msgstr "Ilość"
#: editor/import/resource_importer_scene.cpp
#: editor/plugins/mesh_library_editor_plugin.cpp
@@ -7258,9 +7136,8 @@ msgid "Generating Lightmaps"
msgstr "Generowanie Lightmapy"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Generating for Mesh:"
-msgstr "Generowanie dla siatki: "
+msgstr "Generowanie dla siatki:"
#: editor/import/resource_importer_scene.cpp
msgid "Running Custom Script..."
@@ -7293,34 +7170,37 @@ msgid ""
"%s: Texture detected as used as a normal map in 3D. Enabling red-green "
"texture compression to reduce memory usage (blue channel is discarded)."
msgstr ""
+"%s: Tekstura wykryta jako mapa normalnych w 3D. Włączam czerwono-zieloną "
+"kompresję tekstury, by zmniejszyć zużycie pamięci (niebieski kanał jest "
+"odrzucony)."
#: editor/import/resource_importer_texture.cpp
msgid ""
"%s: Texture detected as used in 3D. Enabling filter, repeat, mipmap "
"generation and VRAM texture compression."
msgstr ""
+"%s: Tekstura wykryta jako używana w 3D. Włączam filtrowanie, powtarzanie, "
+"generacjÄ™ mipmap i kompresjÄ™ tekstur VRAM."
#: editor/import/resource_importer_texture.cpp
msgid "2D, Detect 3D"
-msgstr ""
+msgstr "2D, wykryj 3D"
#: editor/import/resource_importer_texture.cpp
-#, fuzzy
msgid "2D Pixel"
-msgstr "Widoczne piksele"
+msgstr "2D piksel"
#: editor/import/resource_importer_texture.cpp scene/resources/texture.cpp
msgid "Lossy Quality"
-msgstr ""
+msgstr "Stratna jakość"
#: editor/import/resource_importer_texture.cpp
-#, fuzzy
msgid "HDR Mode"
-msgstr "Tryb zaznaczenia"
+msgstr "Tryb HDR"
#: editor/import/resource_importer_texture.cpp
msgid "BPTC LDR"
-msgstr ""
+msgstr "LDR BPTC"
#: editor/import/resource_importer_texture.cpp
#: editor/plugins/tile_set_editor_plugin.cpp scene/2d/cpu_particles_2d.cpp
@@ -7330,105 +7210,94 @@ msgid "Normal Map"
msgstr "Mapa normalnych"
#: editor/import/resource_importer_texture.cpp
-#, fuzzy
msgid "Process"
-msgstr "Przetwarzanie końcowe"
+msgstr "Przetwarzanie"
#: editor/import/resource_importer_texture.cpp
msgid "Fix Alpha Border"
-msgstr ""
+msgstr "Popraw obramowanie alfa"
#: editor/import/resource_importer_texture.cpp
-#, fuzzy
msgid "Premult Alpha"
-msgstr "Edytuj wielokÄ…t"
+msgstr "Wstępnie przemnóż alfę"
#: editor/import/resource_importer_texture.cpp
msgid "Hdr As Srgb"
-msgstr ""
+msgstr "HDR jako sRGB"
#: editor/import/resource_importer_texture.cpp
-#, fuzzy
msgid "Invert Color"
-msgstr "Wierzchołki"
+msgstr "Odwróć kolor"
#: editor/import/resource_importer_texture.cpp
-#, fuzzy
msgid "Normal Map Invert Y"
-msgstr "Losowa skala:"
+msgstr "Odwróć Y mapy normalnych"
#: editor/import/resource_importer_texture.cpp
-#, fuzzy
msgid "Size Limit"
-msgstr "Limity"
+msgstr "Limit rozmiaru"
#: editor/import/resource_importer_texture.cpp
msgid "Detect 3D"
-msgstr ""
+msgstr "Wykryj 3D"
#: editor/import/resource_importer_texture.cpp
-#, fuzzy
msgid "SVG"
-msgstr "HSV"
+msgstr "SVG"
#: editor/import/resource_importer_texture.cpp
msgid ""
"Warning, no suitable PC VRAM compression enabled in Project Settings. This "
"texture will not display correctly on PC."
msgstr ""
+"Ostrzeżenie, brak ustawionej w ustawieniach projektu odpowiedniej kompresji "
+"PC VRAM. Ta tekstura nie będzie się poprawnie wyświetlać na PC."
#: editor/import/resource_importer_texture_atlas.cpp
-#, fuzzy
msgid "Atlas File"
-msgstr "Rozmiar zarysu:"
+msgstr "Plik atlasu"
#: editor/import/resource_importer_texture_atlas.cpp
-#, fuzzy
msgid "Import Mode"
-msgstr "Tryb eksportu:"
+msgstr "Tryb importu"
#: editor/import/resource_importer_texture_atlas.cpp
-#, fuzzy
msgid "Crop To Region"
-msgstr "Ustaw obszar Kafelka"
+msgstr "Przytnij do regionu"
#: editor/import/resource_importer_texture_atlas.cpp
msgid "Trim Alpha Border From Region"
-msgstr ""
+msgstr "Przytnij obramowanie alfy z regionu"
#: editor/import/resource_importer_wav.cpp scene/2d/physics_body_2d.cpp
-#, fuzzy
msgid "Force"
-msgstr "Wrzuć na siłę"
+msgstr "Siła"
#: editor/import/resource_importer_wav.cpp
msgid "8 Bit"
-msgstr ""
+msgstr "8 bitów"
#: editor/import/resource_importer_wav.cpp main/main.cpp
#: modules/mono/editor/csharp_project.cpp modules/mono/godotsharp_dirs.cpp
#: modules/mono/mono_gd/gd_mono.cpp
msgid "Mono"
-msgstr ""
+msgstr "Mono"
#: editor/import/resource_importer_wav.cpp
-#, fuzzy
msgid "Max Rate"
-msgstr "Węzeł Mieszania"
+msgstr "Maksymalne tempo"
#: editor/import/resource_importer_wav.cpp
-#, fuzzy
msgid "Max Rate Hz"
-msgstr "Węzeł Mieszania"
+msgstr "Maksymalne tempo Hz"
#: editor/import/resource_importer_wav.cpp
msgid "Trim"
-msgstr ""
+msgstr "Przytnij"
#: editor/import/resource_importer_wav.cpp
-#, fuzzy
msgid "Normalize"
-msgstr "Format"
+msgstr "Normalizuj"
#: editor/import/resource_importer_wav.cpp
#: scene/resources/audio_stream_sample.cpp
@@ -7437,15 +7306,13 @@ msgstr "Tryb zapętlenia"
#: editor/import/resource_importer_wav.cpp
#: scene/resources/audio_stream_sample.cpp
-#, fuzzy
msgid "Loop Begin"
-msgstr "Tryb przesuwania"
+msgstr "Początek pętli"
#: editor/import/resource_importer_wav.cpp
#: scene/resources/audio_stream_sample.cpp
-#, fuzzy
msgid "Loop End"
-msgstr "Tryb przesuwania"
+msgstr "Koniec pętli"
#: editor/import_defaults_editor.cpp
msgid "Select Importer"
@@ -7523,27 +7390,24 @@ msgid "Failed to load resource."
msgstr "Nie udało się wczytać zasobu."
#: editor/inspector_dock.cpp
-#, fuzzy
msgid "Property Name Style"
-msgstr "Nazwa projektu:"
+msgstr "Styl nazw właściwości"
#: editor/inspector_dock.cpp scene/gui/color_picker.cpp
msgid "Raw"
msgstr "Raw"
#: editor/inspector_dock.cpp
-#, fuzzy
msgid "Capitalized"
-msgstr "Wielkie litery na początku słów"
+msgstr "Z wielkiej litery"
#: editor/inspector_dock.cpp
-#, fuzzy
msgid "Localized"
-msgstr "Ustawienia regionalne"
+msgstr "Tłumaczone"
#: editor/inspector_dock.cpp
msgid "Localization not available for current language."
-msgstr ""
+msgstr "Tłumaczenie niedostępne dla aktualnego języka."
#: editor/inspector_dock.cpp
msgid "Copy Properties"
@@ -8088,9 +7952,8 @@ msgid "New"
msgstr "Nowy"
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "Paste As Reference"
-msgstr "Referencja klasy %s"
+msgstr "Wklej jako referencjÄ™"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Edit Transitions..."
@@ -8281,9 +8144,8 @@ msgid "Set the end animation. This is useful for sub-transitions."
msgstr "Ustaw koniec animacji. To jest przydatne dla podprzejść."
#: editor/plugins/animation_state_machine_editor.cpp
-#, fuzzy
msgid "Transition:"
-msgstr "Przejście: "
+msgstr "Przejście:"
#: editor/plugins/animation_state_machine_editor.cpp
msgid "Play Mode:"
@@ -8420,7 +8282,7 @@ msgstr "Filtry..."
#: editor/plugins/asset_library_editor_plugin.cpp scene/main/http_request.cpp
msgid "Use Threads"
-msgstr ""
+msgstr "Używaj wątków"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Contents:"
@@ -8548,9 +8410,8 @@ msgid "Download Error"
msgstr "Błąd pobierania"
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Available URLs"
-msgstr "Dostępne profile:"
+msgstr "Dostępne URL"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Download for this asset is already in progress!"
@@ -8585,25 +8446,21 @@ msgid "Loading..."
msgstr "Wczytywanie..."
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgctxt "Pagination"
msgid "First"
msgstr "PoczÄ…tek"
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgctxt "Pagination"
msgid "Previous"
msgstr "Wstecz"
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgctxt "Pagination"
msgid "Next"
msgstr "Dalej"
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgctxt "Pagination"
msgid "Last"
msgstr "Koniec"
@@ -8654,7 +8511,7 @@ msgstr "Testowanie"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Failed to get repository configuration."
-msgstr ""
+msgstr "Nie udało się uzyskać konfiguracji repozytorium."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Assets ZIP File"
@@ -8713,7 +8570,7 @@ msgstr "Stwórz Lightmaps"
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid "LightMap Bake"
-msgstr ""
+msgstr "Wypal mapę światła"
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid "Select lightmap bake file:"
@@ -9220,23 +9077,20 @@ msgid "View"
msgstr "Widok"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Show"
-msgstr "Pokaż siatkę"
+msgstr "Pokaż"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Show When Snapping"
-msgstr "Inteligentne przyciÄ…ganie"
+msgstr "Pokaż podczas przyciągania"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Hide"
-msgstr ""
+msgstr "Ukryj"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Toggle Grid"
-msgstr "Przełącz tryb"
+msgstr "Przełącz siatkę"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
@@ -9588,16 +9442,15 @@ msgstr "Gradient edytowany"
#: editor/plugins/gradient_texture_2d_editor_plugin.cpp
msgid "Swap GradientTexture2D Fill Points"
-msgstr ""
+msgstr "Zamień punkty wypełnienia GradientTexture2D"
#: editor/plugins/gradient_texture_2d_editor_plugin.cpp
msgid "Swap Gradient Fill Points"
-msgstr ""
+msgstr "Zamień punkty wypełnienia gradientu"
#: editor/plugins/gradient_texture_2d_editor_plugin.cpp
-#, fuzzy
msgid "Toggle Grid Snap"
-msgstr "Przełącz tryb"
+msgstr "Przełącz przyciąganie do siatki"
#: editor/plugins/item_list_editor_plugin.cpp editor/project_export.cpp
#: scene/3d/label_3d.cpp scene/gui/button.cpp scene/gui/dialogs.cpp
@@ -9616,13 +9469,12 @@ msgstr "Ikona"
#: editor/plugins/item_list_editor_plugin.cpp
msgid "ID"
-msgstr ""
+msgstr "ID"
#: editor/plugins/item_list_editor_plugin.cpp
#: scene/resources/default_theme/default_theme.cpp
-#, fuzzy
msgid "Separator"
-msgstr "Separacja:"
+msgstr "Separator"
#: editor/plugins/item_list_editor_plugin.cpp
msgid "Item %d"
@@ -9859,9 +9711,8 @@ msgstr ""
"%s"
#: editor/plugins/mesh_library_editor_plugin.cpp
-#, fuzzy
msgid "MeshLibrary"
-msgstr "Biblioteka meshów"
+msgstr "Biblioteka siatek"
#: editor/plugins/mesh_library_editor_plugin.cpp
msgid "Add Item"
@@ -9884,14 +9735,12 @@ msgid "Update from Scene"
msgstr "Aktualizuj ze sceny"
#: editor/plugins/mesh_library_editor_plugin.cpp
-#, fuzzy
msgid "Apply without Transforms"
-msgstr "Zastosuj transformacje MeshInstance"
+msgstr "Zastosuj bez transformacji"
#: editor/plugins/mesh_library_editor_plugin.cpp
-#, fuzzy
msgid "Apply with Transforms"
-msgstr "Zastosuj transformacje MeshInstance"
+msgstr "Zastosuj z transformacjami"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "No mesh source specified (and no MultiMesh set in node)."
@@ -10059,9 +9908,8 @@ msgid "Volume"
msgstr "Głośność"
#: editor/plugins/particles_editor_plugin.cpp
-#, fuzzy
msgid "Emission Source:"
-msgstr "Źródła emisji: "
+msgstr "Źródło emisji:"
#: editor/plugins/particles_editor_plugin.cpp
msgid "A processor material of type 'ParticlesMaterial' is required."
@@ -10417,7 +10265,7 @@ msgstr "Synchronizuj kości z wielokątem"
#: editor/plugins/ray_cast_2d_editor_plugin.cpp
msgid "Set cast_to"
-msgstr ""
+msgstr "Ustaw cast_to"
#: editor/plugins/resource_preloader_editor_plugin.cpp
msgid "ERROR: Couldn't load resource!"
@@ -10748,58 +10596,51 @@ msgstr "Wyniki wyszukiwania"
#: editor/plugins/script_editor_plugin.cpp
msgid "Open Dominant Script On Scene Change"
-msgstr ""
+msgstr "Otwórz dominujący skrypt przy zmianie sceny"
#: editor/plugins/script_editor_plugin.cpp
msgid "External"
-msgstr ""
+msgstr "Zewnętrzne"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Use External Editor"
-msgstr "Debugowanie z zewnętrznym edytorem"
+msgstr "Użyj zewnętrznego edytora"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Exec Path"
-msgstr "Ścieżka eksportu"
+msgstr "Ścieżka uruchomienia"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Script Temperature Enabled"
-msgstr "Wybierz plik szablonu"
+msgstr "Włącz temperaturę skryptów"
#: editor/plugins/script_editor_plugin.cpp
msgid "Highlight Current Script"
-msgstr ""
+msgstr "Podświetl aktualny skrypt"
#: editor/plugins/script_editor_plugin.cpp
msgid "Script Temperature History Size"
-msgstr ""
+msgstr "Rozmiar historii temperatury skryptów"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Current Script Background Color"
-msgstr "Kolor tła nieprawidłowy."
+msgstr "Kolor tła aktualnego skryptu"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Group Help Pages"
-msgstr "Grupuj wybrane"
+msgstr "Grupuj strony pomocy"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Sort Scripts By"
-msgstr "Utwórz Skrypt"
+msgstr "Sortuj skrypty po"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "List Script Names As"
-msgstr "Nazwa skryptu:"
+msgstr "Listuj nazwy skryptów jako"
#: editor/plugins/script_editor_plugin.cpp
msgid "Exec Flags"
-msgstr ""
+msgstr "Parametry uruchomienia"
#: editor/plugins/script_editor_plugin.cpp
msgid "Clear Recent Scripts"
@@ -11118,7 +10959,7 @@ msgstr "Tył perspektywicznie"
msgid " [auto]"
msgstr " [auto]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [portale aktywne]"
@@ -11160,15 +11001,13 @@ msgstr "Przesuń"
#. TRANSLATORS: Refers to changing the scale of a node in the 3D editor.
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Scaling:"
-msgstr "Skalowanie: "
+msgstr "Skalowanie:"
#. TRANSLATORS: Refers to changing the position of a node in the 3D editor.
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Translating:"
-msgstr "Przesuwanie: "
+msgstr "Przesuwanie:"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rotating %s degrees."
@@ -11316,13 +11155,14 @@ msgstr "PodglÄ…d kinowy"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "(Not in GLES2)"
-msgstr ""
+msgstr "(Nie w GLES2)"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid ""
"Debug draw modes are only available when using the GLES3 renderer, not GLES2."
-msgstr "Niedostępne dla renderera GLES2."
+msgstr ""
+"Tryby rysowania debugowego są dostępne tylko w przypadku korzystania z "
+"renderera GLES3, a nie GLES2."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Left"
@@ -11617,16 +11457,15 @@ msgstr "Po"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Manipulator Gizmo Size"
-msgstr ""
+msgstr "Regulacja wielkości uchwytu"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Manipulator Gizmo Opacity"
-msgstr ""
+msgstr "Regulacja przezroczystości uchwytu"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Show Viewport Rotation Gizmo"
-msgstr "Zablokuj obrót widoku"
+msgstr "Pokaż obrót widoku uchwytu"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Unnamed Gizmo"
@@ -11678,9 +11517,8 @@ 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 "Convert to MeshInstance2D"
-msgstr "Zamień na Mesh2D"
+msgstr "Konwertuj do MeshInstance2D"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Invalid geometry, can't create polygon."
@@ -11711,19 +11549,16 @@ msgid "Sprite"
msgstr "Sprite"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Simplification:"
-msgstr "Uproszczenie: "
+msgstr "Uproszczenie:"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Shrink (Pixels):"
-msgstr "Zmniejsz (piksele): "
+msgstr "Zmniejsz (piksele):"
#: editor/plugins/sprite_editor_plugin.cpp
-#, fuzzy
msgid "Grow (Pixels):"
-msgstr "Zwiększ (piksele): "
+msgstr "Zwiększ (piksele):"
#: editor/plugins/sprite_editor_plugin.cpp
msgid "Update Preview"
@@ -11786,9 +11621,8 @@ msgid "New Animation"
msgstr "Nowa animacja"
#: editor/plugins/sprite_frames_editor_plugin.cpp
-#, fuzzy
msgid "Filter animations"
-msgstr "Filtruj metody"
+msgstr "Filtruj animacje"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Speed:"
@@ -12088,9 +11922,8 @@ msgstr ""
"Zamknąć tak czy inaczej?"
#: editor/plugins/theme_editor_plugin.cpp
-#, fuzzy
msgid "Remove Type"
-msgstr "Usuń Kafelek"
+msgstr "Usuń typ"
#: editor/plugins/theme_editor_plugin.cpp
msgid ""
@@ -16481,7 +16314,7 @@ msgstr ""
#: main/main.cpp
msgid "Verbose stdout"
-msgstr ""
+msgstr "Werbalne stdout"
#: main/main.cpp scene/main/scene_tree.cpp scene/resources/multimesh.cpp
#, fuzzy
@@ -16500,11 +16333,11 @@ msgstr "Powiększ do zaznaczenia"
#: main/main.cpp
msgid "Low Processor Mode"
-msgstr ""
+msgstr "Tryb niskiego wykorzystania procesora"
#: main/main.cpp
msgid "Delta Sync After Draw"
-msgstr ""
+msgstr "Synchronizacja delta po wyświetlaniu"
#: main/main.cpp
msgid "iOS"
@@ -16512,7 +16345,7 @@ msgstr "iOS"
#: main/main.cpp
msgid "Hide Home Indicator"
-msgstr ""
+msgstr "Ukryj wskaźnik powitalny"
#: main/main.cpp
#, fuzzy
@@ -16526,11 +16359,11 @@ msgstr "Punkt"
#: main/main.cpp
msgid "Touch Delay"
-msgstr ""
+msgstr "Opóźnienie dotyku"
#: main/main.cpp servers/visual_server.cpp
msgid "GLES3"
-msgstr ""
+msgstr "GLES3"
#: main/main.cpp servers/visual_server.cpp
#, fuzzy
@@ -16555,43 +16388,39 @@ msgstr ""
#: main/main.cpp
msgid "Boot Splash"
-msgstr ""
+msgstr "Ekran uruchamiania"
#: main/main.cpp
-#, fuzzy
msgid "Show Image"
-msgstr "Pokaż kości"
+msgstr "Pokaż obraz"
#: main/main.cpp
msgid "Image"
-msgstr ""
+msgstr "Obraz"
#: main/main.cpp
msgid "Fullsize"
-msgstr ""
+msgstr "Pełny rozmiar"
#: main/main.cpp scene/resources/dynamic_font.cpp
-#, fuzzy
msgid "Use Filter"
-msgstr "Filtr:"
+msgstr "Użyj filtra"
#: main/main.cpp scene/resources/style_box.cpp
-#, fuzzy
msgid "BG Color"
-msgstr "Kolory"
+msgstr "Kolor tła"
#: main/main.cpp
-#, fuzzy
msgid "macOS Native Icon"
-msgstr "Ustaw ikonÄ™ Kafelka"
+msgstr "Ikona natywna macOS"
#: main/main.cpp
msgid "Windows Native Icon"
-msgstr ""
+msgstr "Ikona natywna Windows"
#: main/main.cpp
msgid "Buffering"
-msgstr ""
+msgstr "Buforowanie"
#: main/main.cpp
msgid "Agile Event Flushing"
@@ -16599,30 +16428,27 @@ msgstr ""
#: main/main.cpp
msgid "Emulate Touch From Mouse"
-msgstr ""
+msgstr "Emulacja dotyku za pomocÄ… myszy"
#: main/main.cpp
msgid "Emulate Mouse From Touch"
-msgstr ""
+msgstr "Emulacja myszy za pomocÄ… dotyku"
#: main/main.cpp
-#, fuzzy
msgid "Mouse Cursor"
-msgstr "Przycisk myszy"
+msgstr "Kursor myszy"
#: main/main.cpp
-#, fuzzy
msgid "Custom Image"
-msgstr "NiestandardowyWęzeł"
+msgstr "Niestandardowy obraz"
#: main/main.cpp
msgid "Custom Image Hotspot"
-msgstr ""
+msgstr "Własny punkt dostępu do obrazów"
#: main/main.cpp
-#, fuzzy
msgid "Tooltip Position Offset"
-msgstr "Offset obrotu:"
+msgstr "Przesunięcie pozycji podpowiedzi"
#: main/main.cpp modules/mono/mono_gd/gd_mono.cpp
#, fuzzy
@@ -16630,22 +16456,20 @@ msgid "Debugger Agent"
msgstr "Debugger"
#: main/main.cpp modules/mono/mono_gd/gd_mono.cpp
-#, fuzzy
msgid "Wait For Debugger"
-msgstr "Debugger"
+msgstr "Czekanie na Debuggera"
#: main/main.cpp modules/mono/mono_gd/gd_mono.cpp
-#, fuzzy
msgid "Wait Timeout"
-msgstr "Przekroczenie czasu."
+msgstr "Limit czasu oczekiwania"
#: main/main.cpp
msgid "Runtime"
-msgstr ""
+msgstr "Åšrodowisko pracy"
#: main/main.cpp
msgid "Unhandled Exception Policy"
-msgstr ""
+msgstr "Polityka dotycząca wyjątków nieobsługiwanych"
#: main/main.cpp
#, fuzzy
@@ -16654,22 +16478,20 @@ msgstr "Znajdź typ węzła"
#: main/main.cpp scene/gui/texture_progress.cpp
#: scene/gui/viewport_container.cpp
-#, fuzzy
msgid "Stretch"
-msgstr "Załaduj"
+msgstr "RozciÄ…gnij"
#: main/main.cpp
-#, fuzzy
msgid "Aspect"
-msgstr "Inspektor"
+msgstr "Aspekt"
#: main/main.cpp
msgid "Shrink"
-msgstr ""
+msgstr "Zmniejsz"
#: main/main.cpp scene/main/scene_tree.cpp
msgid "Auto Accept Quit"
-msgstr ""
+msgstr "Automatyczne akceptowanie zamknięcia"
#: main/main.cpp scene/main/scene_tree.cpp
#, fuzzy
@@ -16677,25 +16499,24 @@ msgid "Quit On Go Back"
msgstr "Wróć"
#: main/main.cpp scene/main/viewport.cpp
-#, fuzzy
msgid "Snap Controls To Pixels"
-msgstr "Przyciągaj do boków węzła"
+msgstr "Przymocuj elementy sterujÄ…ce do pikseli"
#: main/main.cpp
msgid "Dynamic Fonts"
-msgstr ""
+msgstr "Czcionki dynamiczne"
#: main/main.cpp
msgid "Use Oversampling"
-msgstr ""
+msgstr "Zastosuj nadpróbkowanie"
#: modules/bullet/register_types.cpp modules/bullet/space_bullet.cpp
msgid "Active Soft World"
-msgstr ""
+msgstr "Aktywuj wsparcie SoftBody World"
#: modules/csg/csg_gizmos.cpp
msgid "CSG"
-msgstr ""
+msgstr "CSG"
#: modules/csg/csg_gizmos.cpp
msgid "Change Cylinder Radius"
@@ -16714,30 +16535,26 @@ msgid "Change Torus Outer Radius"
msgstr "Zmień zewnętrzny promień torusa"
#: modules/csg/csg_shape.cpp
-#, fuzzy
msgid "Operation"
-msgstr "Opcje"
+msgstr "Operacja"
#: modules/csg/csg_shape.cpp
msgid "Calculate Tangents"
-msgstr ""
+msgstr "Oblicz styczne"
#: modules/csg/csg_shape.cpp
-#, fuzzy
msgid "Use Collision"
-msgstr "Kolizja"
+msgstr "Użyj kolizji"
#: modules/csg/csg_shape.cpp servers/physics_2d_server.cpp
-#, fuzzy
msgid "Collision Layer"
-msgstr "Tryb kolizji"
+msgstr "Warstwa kolizji"
#: modules/csg/csg_shape.cpp scene/2d/ray_cast_2d.cpp scene/3d/camera.cpp
#: scene/3d/ray_cast.cpp scene/3d/spring_arm.cpp
#: scene/resources/navigation_mesh.cpp servers/physics_server.cpp
-#, fuzzy
msgid "Collision Mask"
-msgstr "Tryb kolizji"
+msgstr "Maska kolizji"
#: modules/csg/csg_shape.cpp
#, fuzzy
@@ -16752,9 +16569,8 @@ msgstr "Zmień wielkość liter"
#: scene/resources/cylinder_shape.cpp scene/resources/environment.cpp
#: scene/resources/navigation_mesh.cpp scene/resources/primitive_meshes.cpp
#: scene/resources/sphere_shape.cpp
-#, fuzzy
msgid "Radius"
-msgstr "Promień:"
+msgstr "Promień"
#: modules/csg/csg_shape.cpp scene/resources/primitive_meshes.cpp
#, fuzzy
@@ -16762,33 +16578,28 @@ msgid "Radial Segments"
msgstr "Argumenty głównej sceny:"
#: modules/csg/csg_shape.cpp scene/resources/primitive_meshes.cpp
-#, fuzzy
msgid "Rings"
-msgstr "Ostrzeżenia"
+msgstr "Pierścienie"
#: modules/csg/csg_shape.cpp
-#, fuzzy
msgid "Smooth Faces"
-msgstr "Płynny Krok"
+msgstr "Gładkie twarze"
#: modules/csg/csg_shape.cpp
-#, fuzzy
msgid "Sides"
-msgstr "Pokaż prowadnice"
+msgstr "Boki"
#: modules/csg/csg_shape.cpp
msgid "Cone"
-msgstr ""
+msgstr "Stożek"
#: modules/csg/csg_shape.cpp
-#, fuzzy
msgid "Inner Radius"
-msgstr "Zmień wewnętrzny promień torusa"
+msgstr "Promień wewnętrzny"
#: modules/csg/csg_shape.cpp
-#, fuzzy
msgid "Outer Radius"
-msgstr "Zmień zewnętrzny promień torusa"
+msgstr "promień zewnętrzny"
#: modules/csg/csg_shape.cpp
msgid "Ring Sides"
@@ -16797,7 +16608,6 @@ msgstr ""
#: modules/csg/csg_shape.cpp scene/2d/collision_polygon_2d.cpp
#: scene/2d/light_occluder_2d.cpp scene/2d/polygon_2d.cpp
#: scene/3d/collision_polygon.cpp
-#, fuzzy
msgid "Polygon"
msgstr "WielokÄ…t"
@@ -16810,9 +16620,8 @@ msgid "Spin Sides"
msgstr ""
#: modules/csg/csg_shape.cpp
-#, fuzzy
msgid "Path Node"
-msgstr "Wklej węzły"
+msgstr "Ścieżka węzła"
#: modules/csg/csg_shape.cpp
#, fuzzy
@@ -16821,21 +16630,19 @@ msgstr "Utwórz wewnętrzny wierzchołek"
#: modules/csg/csg_shape.cpp
msgid "Path Interval"
-msgstr ""
+msgstr "Odstęp między ścieżkami"
#: modules/csg/csg_shape.cpp
msgid "Path Simplify Angle"
msgstr ""
#: modules/csg/csg_shape.cpp
-#, fuzzy
msgid "Path Rotation"
-msgstr "Obrót losowy:"
+msgstr "Obrót ścieżki"
#: modules/csg/csg_shape.cpp
-#, fuzzy
msgid "Path Local"
-msgstr "Uczyń lokalnym"
+msgstr "Ścieżka lokalna"
#: modules/csg/csg_shape.cpp
#, fuzzy
@@ -17046,7 +16853,7 @@ msgstr "Nie bazuje na pliku zasobów"
#: modules/gdscript/gdscript_functions.cpp
msgid "Invalid instance dictionary format (missing @path)"
-msgstr "Niepoprawna instancja formatu słownika (brakujący @path)"
+msgstr "Niepoprawna instancja formatu słownika (brakuje @path)"
#: modules/gdscript/gdscript_functions.cpp
msgid "Invalid instance dictionary format (can't load script at @path)"
@@ -17059,7 +16866,7 @@ msgstr "Niepoprawna instancja formatu słownika (niepoprawny skrypt w @path)"
#: modules/gdscript/gdscript_functions.cpp
msgid "Invalid instance dictionary (invalid subclasses)"
-msgstr "Niepoprawna instancja słownika (niepoprawne podklasy)"
+msgstr "Niepoprawny słownik instancji (niepoprawne podklasy)"
#: modules/gdscript/gdscript_functions.cpp
msgid "Object can't provide a length."
@@ -17288,27 +17095,27 @@ msgstr "Przesuń złącze"
#: modules/gltf/gltf_skin.cpp
msgid "Joint I To Bone I"
-msgstr ""
+msgstr "Staw I do kości I"
#: modules/gltf/gltf_skin.cpp
msgid "Joint I To Name"
-msgstr ""
+msgstr "Staw I do nazwy"
#: modules/gltf/gltf_skin.cpp
msgid "Godot Skin"
-msgstr ""
+msgstr "Skórka Godot"
#: modules/gltf/gltf_spec_gloss.cpp
msgid "Diffuse Img"
-msgstr ""
+msgstr "Rozmycie obrazu"
#: modules/gltf/gltf_spec_gloss.cpp
msgid "Diffuse Factor"
-msgstr ""
+msgstr "Współczynnik rozmycia"
#: modules/gltf/gltf_spec_gloss.cpp
msgid "Gloss Factor"
-msgstr ""
+msgstr "Współczynnik połysku"
#: modules/gltf/gltf_spec_gloss.cpp
#, fuzzy
@@ -17391,19 +17198,16 @@ msgid "Skeletons"
msgstr "Szkielet"
#: modules/gltf/gltf_state.cpp
-#, fuzzy
msgid "Skeleton To Node"
-msgstr "Wybierz węzeł"
+msgstr "Szkielet do węzła"
#: modules/gltf/gltf_state.cpp
-#, fuzzy
msgid "Animations"
-msgstr "Animacje:"
+msgstr "Animacje"
#: modules/gltf/gltf_texture.cpp
-#, fuzzy
msgid "Src Image"
-msgstr "Pokaż kości"
+msgstr "Obraz źródłowy"
#: modules/gridmap/grid_map.cpp
msgid "Mesh Library"
@@ -17421,33 +17225,29 @@ msgstr "Stwórz Lightmaps"
#: modules/gridmap/grid_map.cpp scene/2d/tile_map.cpp
msgid "Cell"
-msgstr ""
+msgstr "Komórka"
#: modules/gridmap/grid_map.cpp
-#, fuzzy
msgid "Octant Size"
-msgstr "Widok z przodu"
+msgstr "Wielkość oktantu"
#: modules/gridmap/grid_map.cpp
-#, fuzzy
msgid "Center X"
-msgstr "Wyśrodkowane"
+msgstr "Wyśrodkowanie X"
#: modules/gridmap/grid_map.cpp
-#, fuzzy
msgid "Center Y"
-msgstr "Wyśrodkowane"
+msgstr "Wyśrodkowanie Y"
#: modules/gridmap/grid_map.cpp
-#, fuzzy
msgid "Center Z"
-msgstr "Wyśrodkowane"
+msgstr "Wyśrodkowanie Z"
#: modules/gridmap/grid_map.cpp scene/2d/collision_object_2d.cpp
#: scene/2d/tile_map.cpp scene/3d/collision_object.cpp scene/3d/soft_body.cpp
#: scene/resources/material.cpp
msgid "Mask"
-msgstr ""
+msgstr "Maska"
#: modules/gridmap/grid_map.cpp scene/2d/tile_map.cpp
#, fuzzy
@@ -17458,9 +17258,8 @@ msgstr "Nawigacja"
#: scene/2d/navigation_agent_2d.cpp scene/2d/navigation_polygon.cpp
#: scene/2d/tile_map.cpp scene/3d/navigation.cpp scene/3d/navigation_agent.cpp
#: scene/3d/navigation_mesh_instance.cpp
-#, fuzzy
msgid "Navigation Layers"
-msgstr "Tryb nawigacji"
+msgstr "Warstwy nawigacji"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Plane"
@@ -17620,9 +17419,8 @@ msgid "Plotting lightmaps"
msgstr "Kreślenie map światła"
#: modules/lightmapper_cpu/register_types.cpp
-#, fuzzy
msgid "CPU Lightmapper"
-msgstr "Stwórz Lightmaps"
+msgstr "Mapper światła CPU"
#: modules/lightmapper_cpu/register_types.cpp
msgid "Low Quality Ray Count"
@@ -17644,22 +17442,20 @@ msgstr ""
#: modules/minimp3/resource_importer_mp3.cpp
#: modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
#: modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
-#, fuzzy
msgid "Loop Offset"
-msgstr "Przesunięcie:"
+msgstr "Przesunięcie pętli"
#: modules/mobile_vr/mobile_vr_interface.cpp
msgid "Eye Height"
-msgstr ""
+msgstr "Wysokość oczu"
#: modules/mobile_vr/mobile_vr_interface.cpp
msgid "IOD"
-msgstr ""
+msgstr "IOD"
#: modules/mobile_vr/mobile_vr_interface.cpp
-#, fuzzy
msgid "Display Width"
-msgstr "Widok siatki"
+msgstr "Szerokość wyświetlacza"
#: modules/mobile_vr/mobile_vr_interface.cpp
#, fuzzy
@@ -17668,15 +17464,15 @@ msgstr "Widok bezcieniowy"
#: modules/mobile_vr/mobile_vr_interface.cpp
msgid "Oversample"
-msgstr ""
+msgstr "Nadpróbkowanie"
#: modules/mobile_vr/mobile_vr_interface.cpp
msgid "K1"
-msgstr ""
+msgstr "K1"
#: modules/mobile_vr/mobile_vr_interface.cpp
msgid "K2"
-msgstr ""
+msgstr "K2"
#: modules/mono/csharp_script.cpp
msgid "Class name can't be a reserved keyword"
@@ -17687,14 +17483,12 @@ msgid "Build Solution"
msgstr "Zbuduj rozwiÄ…zanie"
#: modules/mono/editor/csharp_project.cpp
-#, fuzzy
msgid "Auto Update Project"
-msgstr "Projekt bez nazwy"
+msgstr "Automatyczna aktualizacja projektu"
#: modules/mono/godotsharp_dirs.cpp
-#, fuzzy
msgid "Assembly Name"
-msgstr "Pokaż wszystko"
+msgstr "Nazwa zespołu"
#: modules/mono/godotsharp_dirs.cpp
#, fuzzy
@@ -17702,9 +17496,8 @@ msgid "Solution Directory"
msgstr "Wybierz katalog"
#: modules/mono/godotsharp_dirs.cpp
-#, fuzzy
msgid "C# Project Directory"
-msgstr "Wybierz katalog"
+msgstr "Katalog projektów C#"
#: modules/mono/mono_gd/gd_mono_utils.cpp
msgid "End of inner exception stack trace"
@@ -17775,42 +17568,39 @@ msgstr "Parsowanie Geometrii..."
#: modules/navigation/navigation_mesh_generator.cpp
msgid "Done!"
-msgstr "Skończone!"
+msgstr "Gotowe!"
#: modules/opensimplex/noise_texture.cpp
msgid "Seamless"
msgstr ""
#: modules/opensimplex/noise_texture.cpp
-#, fuzzy
msgid "As Normal Map"
-msgstr "Losowa skala:"
+msgstr "Jako normalna mapa"
#: modules/opensimplex/noise_texture.cpp
msgid "Bump Strength"
-msgstr ""
+msgstr "Siła uderzenia"
#: modules/opensimplex/noise_texture.cpp
msgid "Noise"
-msgstr ""
+msgstr "Szum"
#: modules/opensimplex/noise_texture.cpp
-#, fuzzy
msgid "Noise Offset"
-msgstr "Offset siatki:"
+msgstr "Redukcja szumów"
#: modules/opensimplex/open_simplex_noise.cpp
msgid "Octaves"
-msgstr ""
+msgstr "Oktawy"
#: modules/opensimplex/open_simplex_noise.cpp
msgid "Period"
-msgstr ""
+msgstr "Okres"
#: modules/opensimplex/open_simplex_noise.cpp
-#, fuzzy
msgid "Persistence"
-msgstr "Perspektywa"
+msgstr "Trwałość"
#: modules/opensimplex/open_simplex_noise.cpp
msgid "Lacunarity"
@@ -17821,14 +17611,12 @@ msgid "Subject"
msgstr ""
#: modules/regex/regex.cpp
-#, fuzzy
msgid "Names"
-msgstr "Nazwa"
+msgstr "Nazwy"
#: modules/regex/regex.cpp
-#, fuzzy
msgid "Strings"
-msgstr "Ustawienia:"
+msgstr "CiÄ…gi tekstowe"
#: modules/upnp/upnp.cpp
msgid "Discover Multicast If"
@@ -17901,7 +17689,9 @@ msgstr "Węzeł zwrócił niewłaściwą sekwencję wyjściową: "
#: modules/visual_script/visual_script.cpp
msgid "Found sequence bit but not the node in the stack, report bug!"
-msgstr "Znaleziono bit sekwencji, ale nie węzeł na stosie, zgłoś błąd!"
+msgstr ""
+"Nie znaleziono węzła w stosie, choć znaleziono ciąg bitów. Powiadom o "
+"błędzie!"
#: modules/visual_script/visual_script.cpp
#, fuzzy
@@ -18031,7 +17821,7 @@ msgstr "Wklej węzeł VisualScript"
#: modules/visual_script/visual_script_editor.cpp
msgid "Remove VisualScript Nodes"
-msgstr "Usuwanie węzłów VisualScript"
+msgstr "Usuń węzły VisualScript"
#: modules/visual_script/visual_script_editor.cpp
msgid "Duplicate VisualScript Nodes"
@@ -18088,7 +17878,7 @@ msgstr ""
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Getter Property"
-msgstr "Dodaj właściwość Gettera"
+msgstr "Dodaj właściwość Getter"
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Setter Property"
@@ -19165,14 +18955,12 @@ msgid "Code Signing"
msgstr "DMG podpisywania kodu"
#: platform/android/export/export_plugin.cpp
-#, fuzzy
msgid ""
"'apksigner' could not be found. Please check that the command is available "
"in the Android SDK build-tools directory. The resulting %s is unsigned."
msgstr ""
-"\"apksigner\" nie został znaleziony.\n"
-"Sprawdź, czy komenda jest dostępna w folderze narzędzi SDK Androida.\n"
-"Wynikowy %s jest niepodpisany."
+"\"apksigner\" nie został znaleziony. Sprawdź, czy komenda jest dostępna w "
+"folderze narzędzi SDK Androida. Wynikowy %s jest niepodpisany."
#: platform/android/export/export_plugin.cpp
msgid "Signing debug %s..."
@@ -19233,15 +19021,12 @@ msgstr ""
"informacja o wersji. Zainstaluj ponownie z menu \"Projekt\"."
#: platform/android/export/export_plugin.cpp
-#, fuzzy
msgid ""
"Android build version mismatch: Template installed: %s, Godot version: %s. "
"Please reinstall Android build template from 'Project' menu."
msgstr ""
-"Niezgodna wersja buildu Androida:\n"
-" Zainstalowany szablon: %s\n"
-" Wersja Godota: %s\n"
-"Zainstaluj ponownie szablon z menu \"Projekt\"."
+"Niezgodna wersja buildu Androida: Zainstalowany szablon: %s Wersja Godota: "
+"%s. Zainstaluj ponownie szablon z menu \"Projekt\"."
#: platform/android/export/export_plugin.cpp
#, fuzzy
@@ -19264,13 +19049,12 @@ msgid "Building Android Project (gradle)"
msgstr "Budowanie projektu Androida (gradle)"
#: platform/android/export/export_plugin.cpp
-#, fuzzy
msgid ""
"Building of Android project failed, check output for the error. "
"Alternatively visit docs.godotengine.org for Android build documentation."
msgstr ""
-"Budowanie projektu Androida się nie powiodło, sprawdź wyjście błędu.\n"
-"Alternatywnie, odwiedź docs.godotengine.org po dokumentację budowania dla "
+"Budowanie projektu Androida się nie powiodło, sprawdź dane wyjściowe błędu. "
+"Ewentualnie, odwiedź docs.godotengine.org po dokumentację budowania dla "
"Androida."
#: platform/android/export/export_plugin.cpp
@@ -19295,20 +19079,16 @@ msgid "Creating APK..."
msgstr "Tworzenie APK..."
#: platform/android/export/export_plugin.cpp
-#, fuzzy
msgid "Could not find template APK to export: \"%s\"."
-msgstr ""
-"Nie udało się znaleźć szablonu APK do eksportu:\n"
-"%s"
+msgstr "Nie udało się znaleźć szablonu APK do eksportu: \"%s\"."
#: platform/android/export/export_plugin.cpp
-#, fuzzy
msgid ""
"Missing libraries in the export template for the selected architectures: %s. "
"Please build a template with all required libraries, or uncheck the missing "
"architectures in the export preset."
msgstr ""
-"BrakujÄ…ce biblioteki w szablonie eksportu dla wybranej architektury: %s.\n"
+"BrakujÄ…ce biblioteki w szablonie eksportu dla wybranej architektury: %s. "
"Zbuduj szablon ze wszystkimi wymaganymi bibliotekami lub odznacz brakujÄ…ce "
"architektury w profilu eksportu."
@@ -21873,8 +21653,8 @@ msgid ""
"A material to process the particles is not assigned, so no behavior is "
"imprinted."
msgstr ""
-"Nie przypisano materiału do przetwarzania cząsteczek, więc zmiany nie będą "
-"widoczne."
+"Materiał nie jest przypisany do cząsteczek, więc ich zachowanie będzie "
+"niewidoczne."
#: scene/2d/particles_2d.cpp
msgid ""
@@ -22041,9 +21821,8 @@ msgid "Safe Margin"
msgstr "Ustaw margines"
#: scene/2d/physics_body_2d.cpp scene/3d/physics_body.cpp
-#, fuzzy
msgid "Sync To Physics"
-msgstr " (fizyczny)"
+msgstr "Synchronizuj z fizykÄ…"
#: scene/2d/physics_body_2d.cpp scene/3d/physics_body.cpp
#, fuzzy
@@ -23067,7 +22846,8 @@ msgstr ""
msgid ""
"Nothing is visible because meshes have not been assigned to draw passes."
msgstr ""
-"Nic nie jest widoczne, bo siatki nie zostały przypisane do kolejki rysowania."
+"Nic nie jest widoczne ponieważ siatki nie zostały przydzielone do przebiegów "
+"wyświetlających."
#: scene/3d/particles.cpp
msgid ""
@@ -26857,7 +26637,7 @@ msgstr "Debug kanału UV"
#: scene/resources/environment.cpp
msgid "Blur"
-msgstr ""
+msgstr "Rozmazanie"
#: scene/resources/environment.cpp
msgid "Edge Sharpness"
@@ -27983,9 +27763,8 @@ msgstr ""
#: servers/audio/effects/audio_effect_delay.cpp
#: servers/audio/effects/audio_effect_phaser.cpp
#: servers/audio/effects/audio_effect_reverb.cpp
-#, fuzzy
msgid "Feedback"
-msgstr "Oceń dokumentację"
+msgstr "Informacja zwrotna"
#: servers/audio/effects/audio_effect_delay.cpp
#, fuzzy
@@ -27994,7 +27773,7 @@ msgstr "Omiń"
#: servers/audio/effects/audio_effect_distortion.cpp
msgid "Pre Gain"
-msgstr ""
+msgstr "Wstępne wzmocnienie"
#: servers/audio/effects/audio_effect_distortion.cpp
msgid "Keep Hf Hz"
@@ -28010,17 +27789,16 @@ msgid "Post Gain"
msgstr "Po"
#: servers/audio/effects/audio_effect_filter.cpp
-#, fuzzy
msgid "Resonance"
-msgstr "Zasoby"
+msgstr "Rezonans"
#: servers/audio/effects/audio_effect_limiter.cpp
msgid "Ceiling dB"
-msgstr ""
+msgstr "Sufit dB"
#: servers/audio/effects/audio_effect_limiter.cpp
msgid "Threshold dB"
-msgstr ""
+msgstr "Wartość progowa dB"
#: servers/audio/effects/audio_effect_limiter.cpp
msgid "Soft Clip dB"
@@ -28462,13 +28240,12 @@ msgid "Legacy Stream"
msgstr ""
#: servers/visual_server.cpp
-#, fuzzy
msgid "Batching"
-msgstr "Wyszukiwanie..."
+msgstr "Tworzenie pakietów wsadowych"
#: servers/visual_server.cpp
msgid "Use Batching"
-msgstr ""
+msgstr "Użyj przetwarzania wsadowego"
#: servers/visual_server.cpp
#, fuzzy
@@ -28581,9 +28358,8 @@ msgid "Max Active Polygons"
msgstr "Przesuń Wielokąt"
#: servers/visual_server.cpp
-#, fuzzy
msgid "Shader Compilation Mode"
-msgstr "Sposób interpolacji"
+msgstr "Sposób kompilacji shader'ów"
#: servers/visual_server.cpp
msgid "Max Simultaneous Compiles"
diff --git a/editor/translations/pr.po b/editor/translations/pr.po
index 45bbc8daf0..9b150194df 100644
--- a/editor/translations/pr.po
+++ b/editor/translations/pr.po
@@ -11039,7 +11039,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/pt.po b/editor/translations/pt.po
index 85814ded34..0fcc083b42 100644
--- a/editor/translations/pt.po
+++ b/editor/translations/pt.po
@@ -13,7 +13,7 @@
# Rueben Stevens <supercell03@gmail.com>, 2017.
# SARDON <fabio3_Santos@hotmail.com>, 2017.
# Vinicius Gonçalves <viniciusgoncalves21@gmail.com>, 2017.
-# ssantos <ssantos@web.de>, 2018, 2019, 2020, 2021, 2022.
+# ssantos <ssantos@web.de>, 2018, 2019, 2020, 2021, 2022, 2023.
# Gonçalo Dinis Guerreiro João <goncalojoao205@gmail.com>, 2019.
# Manuela Silva <mmsrs@sky.com>, 2020.
# Murilo Gama <murilovsky2030@gmail.com>, 2020, 2022.
@@ -31,12 +31,13 @@
# Tuily <brizolla.tuily@gmail.com>, 2022.
# Thuany <thutymsoares@gmail.com>, 2022.
# Isaque Mendes <isaquemendes405@gmail.com>, 2022.
+# Alex Bruno Boiniak <aboiniak@gmail.com>, 2022.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-11-19 08:35+0000\n"
+"PO-Revision-Date: 2023-01-11 19:51+0000\n"
"Last-Translator: ssantos <ssantos@web.de>\n"
"Language-Team: Portuguese <https://hosted.weblate.org/projects/godot-engine/"
"godot/pt/>\n"
@@ -45,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 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -183,7 +184,7 @@ msgstr "Erro"
#: core/bind/core_bind.cpp
msgid "Error String"
-msgstr "Erro String"
+msgstr "Cadeia de caracteres de erro"
#: core/bind/core_bind.cpp
msgid "Error Line"
@@ -383,7 +384,7 @@ msgstr "Tamanho Máximo (KB)"
#: core/os/input.cpp
msgid "Mouse Mode"
-msgstr "Modo Mouse"
+msgstr "Modo do Rato"
#: core/os/input.cpp
msgid "Use Accumulated Input"
@@ -4332,7 +4333,7 @@ msgstr "Restaurar Cenas quando carregar"
#: editor/editor_node.cpp editor/editor_settings.cpp
msgid "Show Thumbnail On Hover"
-msgstr "Mostrar Miniatura ao Passar o Mouse Por Cima"
+msgstr "Mostrar Miniatura ao Passar o Rato Por Cima"
#: editor/editor_node.cpp editor/editor_settings.cpp
msgid "Inspector"
@@ -5479,7 +5480,7 @@ msgstr "Largura do Minimapa"
#: editor/editor_settings.cpp
msgid "Mouse Extra Buttons Navigate History"
-msgstr "Botões extra do Mouse para Navegar no Histórico"
+msgstr "Botões extra do Rato para Navegar no Histórico"
#: editor/editor_settings.cpp
msgid "Drag And Drop Selection"
@@ -5773,7 +5774,7 @@ msgstr "Emular Teclado Numérico"
#: editor/editor_settings.cpp
msgid "Emulate 3 Button Mouse"
-msgstr "Emular Mouse de 3 Botões"
+msgstr "Emular Rato de 3 Botões"
#: editor/editor_settings.cpp
msgid "Orbit Modifier"
@@ -5789,7 +5790,7 @@ msgstr "Modificador de Zoom"
#: editor/editor_settings.cpp editor/plugins/spatial_editor_plugin.cpp
msgid "Warped Mouse Panning"
-msgstr "Panorama do Mouse Distorcido"
+msgstr "Panorama do Rato Distorcido"
#: editor/editor_settings.cpp
msgid "Navigation Feel"
@@ -6037,7 +6038,7 @@ msgstr "Cor do Comentário"
#: editor/editor_settings.cpp
msgid "String Color"
-msgstr "Cor da String"
+msgstr "Cor da cadeia de caracteres"
#: editor/editor_settings.cpp platform/javascript/export/export.cpp
#: platform/uwp/export/export.cpp
@@ -6887,9 +6888,8 @@ msgstr "Filtro"
#: editor/import/resource_importer_layered_texture.cpp
#: editor/import/resource_importer_texture.cpp
-#, fuzzy
msgid "Mipmaps"
-msgstr "Sinais"
+msgstr "Mipmaps"
#: editor/import/resource_importer_layered_texture.cpp
#: editor/import/resource_importer_texture.cpp
@@ -10925,7 +10925,7 @@ msgstr "Perspetiva Traseira"
msgid " [auto]"
msgstr " [auto]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [portais ativos]"
@@ -14176,17 +14176,15 @@ msgid "Invalid project path (changed anything?)."
msgstr "Caminho de projeto inválido (alguma alteração?)."
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project at '%s' (error %d). It may be missing or corrupted."
msgstr ""
-"Não consegui carregar o project.godot no caminho do projeto (erro %d). "
-"Poderá estar em falta ou corrompido."
+"Não pode carregar o projeto em '%s' (error %d). Pode estar sumido ou "
+"corrompido."
#: editor/project_manager.cpp
-#, fuzzy
msgid "Couldn't save project at '%s' (error %d)."
-msgstr "Incapaz de abrir projeto em '%s'."
+msgstr "Incapaz de salvar projeto em '%s' (error %d)."
#: editor/project_manager.cpp
msgid "Couldn't create project.godot in project path."
@@ -16187,7 +16185,7 @@ msgstr "Interface Gráfica"
#: main/main.cpp
msgid "Drop Mouse On GUI Input Disabled"
-msgstr "Desabilitar Soltar o Mouse na Entrada da Interface Gráfica"
+msgstr "Desabilitar Soltar o Rato na Entrada da Interface Gráfica"
#: main/main.cpp
msgid "stdout"
@@ -16305,15 +16303,15 @@ msgstr "Liberação Ãgil de Eventos"
#: main/main.cpp
msgid "Emulate Touch From Mouse"
-msgstr "Emular Toque do Mouse"
+msgstr "Emular Toque do Rato"
#: main/main.cpp
msgid "Emulate Mouse From Touch"
-msgstr "Emular o Mouse do Toque"
+msgstr "Emular o Rato do Toque"
#: main/main.cpp
msgid "Mouse Cursor"
-msgstr "Cursor do Mouse"
+msgstr "Cursor do Rato"
#: main/main.cpp
msgid "Custom Image"
@@ -16516,9 +16514,8 @@ msgid "Path Local"
msgstr "Caminho Local"
#: modules/csg/csg_shape.cpp
-#, fuzzy
msgid "Path Continuous U"
-msgstr "Contínuo"
+msgstr "Caminho Contínuo U"
#: modules/csg/csg_shape.cpp
msgid "Path U Distance"
@@ -16578,9 +16575,8 @@ msgstr "Carregar Apenas uma Vez"
#: modules/gdnative/gdnative.cpp
#: modules/visual_script/visual_script_func_nodes.cpp
-#, fuzzy
msgid "Singleton"
-msgstr "Esqueleto"
+msgstr "Singleton"
#: modules/gdnative/gdnative.cpp
msgid "Symbol Prefix"
@@ -17426,7 +17422,7 @@ msgstr "Nomes"
#: modules/regex/regex.cpp
msgid "Strings"
-msgstr "Strings"
+msgstr "Cadeias"
#: modules/upnp/upnp.cpp
msgid "Discover Multicast If"
@@ -18436,9 +18432,8 @@ msgid "XR Mode"
msgstr "Modo XR"
#: platform/android/export/export_plugin.cpp
-#, fuzzy
msgid "Hand Tracking"
-msgstr "Empacotamento"
+msgstr "Rastreamento das Mãos"
#: platform/android/export/export_plugin.cpp
msgid "Hand Tracking Frequency"
@@ -18923,9 +18918,8 @@ msgid "Code Sign Identity Debug"
msgstr "Depuração de Identidade de Sinal de Código"
#: platform/iphone/export/export.cpp
-#, fuzzy
msgid "Export Method Debug"
-msgstr "Exportar com Depuração"
+msgstr "Exportar Método Depuração"
#: platform/iphone/export/export.cpp
msgid "Provisioning Profile UUID Release"
@@ -19001,9 +18995,8 @@ msgid "Microphone Usage Description"
msgstr "Descrição do Uso do Microfone"
#: platform/iphone/export/export.cpp
-#, fuzzy
msgid "Photolibrary Usage Description"
-msgstr "Descrições da Propriedade"
+msgstr "Descrição de Uso da Fotobiblioteca"
#: platform/iphone/export/export.cpp
msgid "iPhone 120 X 120"
@@ -19050,14 +19043,12 @@ msgid "Image Scale Mode"
msgstr "Modo de Escalonamento de Imagem"
#: platform/iphone/export/export.cpp
-#, fuzzy
msgid "Custom Image @2x"
-msgstr "CustomNode"
+msgstr "Personalizar Imagem @2x"
#: platform/iphone/export/export.cpp
-#, fuzzy
msgid "Custom Image @3x"
-msgstr "CustomNode"
+msgstr "Personalizar Imagem @3x"
#: platform/iphone/export/export.cpp
msgid "Use Custom BG Color"
@@ -19154,9 +19145,8 @@ msgid "Export Icon"
msgstr "Exportar Ãcone"
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Custom HTML Shell"
-msgstr "CustomNode"
+msgstr "HTML Shell Personalizado"
#: platform/javascript/export/export.cpp
msgid "Head Include"
@@ -23759,7 +23749,7 @@ msgstr "Anterior"
#: scene/gui/control.cpp
msgid "Mouse"
-msgstr "Mouse"
+msgstr "Rato"
#: scene/gui/control.cpp
msgid "Default Cursor Shape"
diff --git a/editor/translations/pt_BR.po b/editor/translations/pt_BR.po
index 8e574f992d..eb7b2ffde0 100644
--- a/editor/translations/pt_BR.po
+++ b/editor/translations/pt_BR.po
@@ -20,7 +20,7 @@
# MalcomRF <malcomkbk@gmail.com>, 2017.
# Marcus Correia <marknokalt@live.com>, 2017-2018.
# Michael Alexsander Silva Dias <michaelalexsander@protonmail.com>, 2017-2018.
-# Renato Rotenberg <renato.rotenberg@gmail.com>, 2017, 2019, 2021.
+# Renato Rotenberg <renato.rotenberg@gmail.com>, 2017, 2019, 2021, 2023.
# Rodolfo R Gomes <rodolforg@gmail.com>, 2017-2018, 2019.
# Tiago Almeida <thyagoeap@gmail.com>, 2017.
# Mauricio Luan Carneiro deSouza <newmailmlcs@gmail.com>, 2018.
@@ -156,13 +156,14 @@
# Murilo Gama <murilovsky2030@gmail.com>, 2022.
# Kauã Azevedo <Kazevic@pm.me>, 2022.
# Zer0-Zer0 <dankmemerson@tutanota.com>, 2022.
+# Levi Ferreira <leviferreiramorais@gmail.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: 2016-05-30\n"
-"PO-Revision-Date: 2022-12-10 02:13+0000\n"
-"Last-Translator: Julio Yagami <juliohenrique31501234@hotmail.com>\n"
+"PO-Revision-Date: 2023-01-14 00:01+0000\n"
+"Last-Translator: Levi Ferreira <leviferreiramorais@gmail.com>\n"
"Language-Team: Portuguese (Brazil) <https://hosted.weblate.org/projects/"
"godot-engine/godot/pt_BR/>\n"
"Language: pt_BR\n"
@@ -170,7 +171,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 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -11075,7 +11076,7 @@ msgstr "Perspectiva Traseira"
msgid " [auto]"
msgstr " [automático]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [portais ativados]"
@@ -14331,17 +14332,15 @@ msgid "Invalid project path (changed anything?)."
msgstr "Caminho de projeto inválido (mudou alguma coisa?)."
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project at '%s' (error %d). It may be missing or corrupted."
msgstr ""
-"Não foi possível carregar project.godot no caminho do projeto (erro %d). Ele "
-"pode estar ausente ou corrompido."
+"Não foi possível carregar project.godot em '%s' (erro %d). Ele pode estar "
+"ausente ou corrompido."
#: editor/project_manager.cpp
-#, fuzzy
msgid "Couldn't save project at '%s' (error %d)."
-msgstr "Não é possível abrir o projeto em '%s'."
+msgstr "Não foi possível salvar o projeto em '%s' (erro %d)."
#: editor/project_manager.cpp
msgid "Couldn't create project.godot in project path."
@@ -16200,9 +16199,8 @@ msgid "Multithreaded Server"
msgstr "Servidor com Multi-Thread"
#: main/main.cpp
-#, fuzzy
msgid "RID Pool Prealloc"
-msgstr "Pre-alocação de Pool RID"
+msgstr "Pool de Prealocação de RID"
#: main/main.cpp
msgid "Debugger stdout"
@@ -16310,7 +16308,7 @@ msgstr "Modelo de Thread"
#: main/main.cpp
msgid "Thread Safe BVH"
-msgstr ""
+msgstr "Thread Segura de BVH"
#: main/main.cpp
msgid "Handheld"
@@ -16675,9 +16673,8 @@ msgid "Path Local"
msgstr "Caminho Local"
#: modules/csg/csg_shape.cpp
-#, fuzzy
msgid "Path Continuous U"
-msgstr "Caminho Contínuo"
+msgstr "Caminho Continuo U"
#: modules/csg/csg_shape.cpp
msgid "Path U Distance"
@@ -16943,11 +16940,11 @@ msgstr "Contagem Escassa"
#: modules/gltf/gltf_accessor.cpp
msgid "Sparse Indices Buffer View"
-msgstr ""
+msgstr "Visualização de Buffer dos Indices Esparsos"
#: modules/gltf/gltf_accessor.cpp
msgid "Sparse Indices Byte Offset"
-msgstr ""
+msgstr "Deslocação de Byte dos Ãndices Esparsos"
#: modules/gltf/gltf_accessor.cpp
msgid "Sparse Indices Component Type"
@@ -16955,11 +16952,11 @@ msgstr "Tipo de Componente de Ãndices Esparsos"
#: modules/gltf/gltf_accessor.cpp
msgid "Sparse Values Buffer View"
-msgstr ""
+msgstr "Visualização de Buffer dos Valores Esparsos"
#: modules/gltf/gltf_accessor.cpp
msgid "Sparse Values Byte Offset"
-msgstr ""
+msgstr "Deslocação de Byte dos Valores Esparsos"
#: modules/gltf/gltf_buffer_view.cpp
msgid "Buffer"
@@ -16971,7 +16968,7 @@ msgstr "Largura do byte"
#: modules/gltf/gltf_buffer_view.cpp
msgid "Byte Stride"
-msgstr ""
+msgstr "Separação dos Bytes"
#: modules/gltf/gltf_buffer_view.cpp
msgid "Indices"
@@ -17031,11 +17028,11 @@ msgstr "Pai"
#: modules/gltf/gltf_node.cpp
msgid "Xform"
-msgstr ""
+msgstr "Xform"
#: modules/gltf/gltf_node.cpp scene/3d/mesh_instance.cpp
msgid "Skin"
-msgstr ""
+msgstr "Pele"
#: modules/gltf/gltf_node.cpp scene/3d/spatial.cpp
msgid "Translation"
@@ -17107,11 +17104,11 @@ msgstr "Fator Especular"
#: modules/gltf/gltf_spec_gloss.cpp
msgid "Spec Gloss Img"
-msgstr ""
+msgstr "Imagem Especular Lustrosa"
#: modules/gltf/gltf_state.cpp
msgid "Json"
-msgstr ""
+msgstr "Json"
#: modules/gltf/gltf_state.cpp
msgid "Major Version"
@@ -17127,7 +17124,7 @@ msgstr "Dados do GLB"
#: modules/gltf/gltf_state.cpp
msgid "Use Named Skin Binds"
-msgstr ""
+msgstr "Usar Associações de Pele com nome"
#: modules/gltf/gltf_state.cpp
msgid "Buffer Views"
@@ -17432,15 +17429,15 @@ msgstr "Exibir para as Lentes"
#: modules/mobile_vr/mobile_vr_interface.cpp
msgid "Oversample"
-msgstr ""
+msgstr "Amostragem em excesso"
#: modules/mobile_vr/mobile_vr_interface.cpp
msgid "K1"
-msgstr ""
+msgstr "K1"
#: modules/mobile_vr/mobile_vr_interface.cpp
msgid "K2"
-msgstr ""
+msgstr "K2"
#: modules/mono/csharp_script.cpp
msgid "Class name can't be a reserved keyword"
@@ -18019,7 +18016,7 @@ msgstr "Iterador"
#: modules/visual_script/visual_script_flow_control.cpp
msgid "for (elem) in (input):"
-msgstr ""
+msgstr "for (elem) in (input):"
#: modules/visual_script/visual_script_flow_control.cpp
msgid "Input type not iterable:"
@@ -18191,7 +18188,7 @@ msgstr "Argumentos inválidos:"
#: modules/visual_script/visual_script_nodes.cpp
msgid "a if cond, else b"
-msgstr ""
+msgstr "a se cond, se não b"
#: modules/visual_script/visual_script_nodes.cpp
msgid "Var Name"
@@ -18247,11 +18244,11 @@ msgstr "Obter Ãrvore de Cenas"
#: modules/visual_script/visual_script_nodes.cpp
msgid "Get Self"
-msgstr "Obter Sí Mesmo"
+msgstr "Obter Si Mesmo"
#: modules/visual_script/visual_script_nodes.cpp
msgid "CustomNode"
-msgstr ""
+msgstr "Nó Personalizado"
#: modules/visual_script/visual_script_nodes.cpp
msgid "Custom node has no _step() method, can't process graph."
@@ -18269,7 +18266,7 @@ msgstr ""
#: modules/visual_script/visual_script_nodes.cpp
msgid "SubCall"
-msgstr ""
+msgstr "Sub-Chamada"
#: modules/visual_script/visual_script_nodes.cpp scene/gui/graph_node.cpp
msgid "Title"
@@ -18301,11 +18298,11 @@ msgstr "Buscar VisualScript"
#: modules/visual_script/visual_script_yield_nodes.cpp
msgid "Yield"
-msgstr ""
+msgstr "Aguardar Retorno"
#: modules/visual_script/visual_script_yield_nodes.cpp
msgid "Wait"
-msgstr ""
+msgstr "Esperar"
#: modules/visual_script/visual_script_yield_nodes.cpp
msgid "Next Frame"
@@ -18325,7 +18322,7 @@ msgstr "Tempo de Espera"
#: modules/visual_script/visual_script_yield_nodes.cpp
msgid "WaitSignal"
-msgstr ""
+msgstr "EsperarSinal"
#: modules/visual_script/visual_script_yield_nodes.cpp
msgid "WaitNodeSignal"
@@ -18341,7 +18338,7 @@ msgstr "Modo de Escrita"
#: modules/webrtc/webrtc_data_channel.h
msgid "WebRTC"
-msgstr ""
+msgstr "WebRTC"
#: modules/webrtc/webrtc_data_channel.h
msgid "Max Channel In Buffer (KB)"
@@ -18381,7 +18378,7 @@ msgstr "Servidor WebSocket"
#: modules/websocket/websocket_server.cpp
msgid "Bind IP"
-msgstr ""
+msgstr "Atrelar IP"
#: modules/websocket/websocket_server.cpp
msgid "Private Key"
@@ -18441,11 +18438,11 @@ msgstr "Depurar Keystore"
#: platform/android/export/export.cpp
msgid "Debug Keystore User"
-msgstr ""
+msgstr "Usuário da Keystore de Depuração"
#: platform/android/export/export.cpp
msgid "Debug Keystore Pass"
-msgstr ""
+msgstr "Senha da Keystore de Depuração"
#: platform/android/export/export.cpp
msgid "Force System User"
@@ -19033,43 +19030,43 @@ msgstr "Telas de Inicialização de Paisagem"
#: platform/iphone/export/export.cpp
msgid "iPhone 2436 X 1125"
-msgstr "IPhone 2436 X 1125"
+msgstr "iPhone 2436 X 1125"
#: platform/iphone/export/export.cpp
msgid "iPhone 2208 X 1242"
-msgstr ""
+msgstr "iPhone 2208 X 1242"
#: platform/iphone/export/export.cpp
msgid "iPad 1024 X 768"
-msgstr ""
+msgstr "iPad 1024 X 768"
#: platform/iphone/export/export.cpp
msgid "iPad 2048 X 1536"
-msgstr ""
+msgstr "iPad 2048 X 1536"
#: platform/iphone/export/export.cpp
msgid "Portrait Launch Screens"
-msgstr ""
+msgstr "Tela de Apresentação em Retrato"
#: platform/iphone/export/export.cpp
msgid "iPhone 640 X 960"
-msgstr ""
+msgstr "iPhone 640 X 960"
#: platform/iphone/export/export.cpp
msgid "iPhone 640 X 1136"
-msgstr ""
+msgstr "iPhone 640 X 1136"
#: platform/iphone/export/export.cpp
msgid "iPhone 750 X 1334"
-msgstr ""
+msgstr "iPhone 750 X 1334"
#: platform/iphone/export/export.cpp
msgid "iPhone 1125 X 2436"
-msgstr ""
+msgstr "iPhone 1125 X 2436"
#: platform/iphone/export/export.cpp
msgid "iPad 768 X 1024"
-msgstr ""
+msgstr "iPad 768 X 1024"
#: platform/iphone/export/export.cpp
msgid "iPad 1536 X 2048"
diff --git a/editor/translations/ro.po b/editor/translations/ro.po
index 906d6aee71..9e2d8b5c96 100644
--- a/editor/translations/ro.po
+++ b/editor/translations/ro.po
@@ -20,13 +20,15 @@
# Psynt <nichita@cadvegra.com>, 2022.
# Ilie Adrian Avramescu <himark1977@protonmail.com>, 2022.
# Andres Ene <grassiscomplex420@gmail.com>, 2022.
+# Claudiu Ceia <claudiu.ceia@gmail.com>, 2022.
+# Random Videos <istudordanadenis@gmail.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-11-22 20:37+0000\n"
-"Last-Translator: Andres Ene <grassiscomplex420@gmail.com>\n"
+"PO-Revision-Date: 2023-01-13 03:04+0000\n"
+"Last-Translator: Random Videos <istudordanadenis@gmail.com>\n"
"Language-Team: Romanian <https://hosted.weblate.org/projects/godot-engine/"
"godot/ro/>\n"
"Language: ro\n"
@@ -35,7 +37,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < "
"20)) ? 1 : 2;\n"
-"X-Generator: Weblate 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -66,9 +68,8 @@ msgid "Delta Smoothing"
msgstr "Netezirea Delta"
#: core/bind/core_bind.cpp
-#, fuzzy
msgid "Low Processor Usage Mode"
-msgstr "Mod Mutare"
+msgstr "Mod utilizare redusă a procesorului"
#: core/bind/core_bind.cpp
msgid "Low Processor Usage Mode Sleep (µsec)"
@@ -225,18 +226,16 @@ msgstr "Date"
#: modules/gdscript/language_server/gdscript_language_server.cpp
#: modules/webrtc/webrtc_data_channel.h modules/websocket/websocket_macros.h
#: scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Network"
-msgstr "Analizator Network"
+msgstr "Rețea"
#: core/io/file_access_network.cpp
-#, fuzzy
msgid "Remote FS"
-msgstr "Ștergeți"
+msgstr "Sistem de fișiere (FS) la distanță"
#: core/io/file_access_network.cpp
msgid "Page Size"
-msgstr "Marime Pagina"
+msgstr "Mărime Pagina"
#: core/io/file_access_network.cpp
msgid "Page Read Ahead"
@@ -248,29 +247,27 @@ msgstr "Mod de blocare Activat"
#: core/io/http_client.cpp
msgid "Connection"
-msgstr "Conexie"
+msgstr "Conexiune"
#: core/io/http_client.cpp
msgid "Read Chunk Size"
-msgstr ""
+msgstr "Dimensiunea fragmentului de citire"
#: core/io/marshalls.cpp
msgid "Object ID"
msgstr "ID Obiect"
#: core/io/multiplayer_api.cpp core/io/packet_peer.cpp
-#, fuzzy
msgid "Allow Object Decoding"
-msgstr "Activează Onion Skinning"
+msgstr "Permite Decodarea Obiectelor"
#: core/io/multiplayer_api.cpp scene/main/scene_tree.cpp
msgid "Refuse New Network Connections"
msgstr "Refuza Conexiuni noi pe retea"
#: core/io/multiplayer_api.cpp scene/main/scene_tree.cpp
-#, fuzzy
msgid "Network Peer"
-msgstr "Analizator Network"
+msgstr "Peer de Rețea"
#: core/io/multiplayer_api.cpp scene/animation/animation_player.cpp
msgid "Root Node"
@@ -286,15 +283,15 @@ msgstr "Mod Transfer"
#: core/io/packet_peer.cpp
msgid "Encode Buffer Max Size"
-msgstr ""
+msgstr "Dimensiunea Maximă a Bufferului de Encodare"
#: core/io/packet_peer.cpp
msgid "Input Buffer Max Size"
-msgstr ""
+msgstr "Dimensiunea Maximă a Bufferului de Intrare"
#: core/io/packet_peer.cpp
msgid "Output Buffer Max Size"
-msgstr ""
+msgstr "Dimensiunea Maximă a Bufferului de Ieșire"
#: core/io/packet_peer.cpp
msgid "Stream Peer"
@@ -302,11 +299,11 @@ msgstr "Fluxul Peer"
#: core/io/stream_peer.cpp
msgid "Big Endian"
-msgstr ""
+msgstr "Big Endian"
#: core/io/stream_peer.cpp
msgid "Data Array"
-msgstr ""
+msgstr "Matrice Date"
#: core/io/stream_peer_ssl.cpp
msgid "Blocking Handshake"
@@ -367,9 +364,8 @@ msgid "Seed"
msgstr "Semințe"
#: core/math/random_number_generator.cpp
-#, fuzzy
msgid "State"
-msgstr "Mod Rotație"
+msgstr "State"
#: core/message_queue.cpp
msgid "Message Queue"
@@ -377,17 +373,15 @@ msgstr "Coada de mesaje"
#: core/message_queue.cpp
msgid "Max Size (KB)"
-msgstr ""
+msgstr "Dimensiune maximă (KB)"
#: core/os/input.cpp
-#, fuzzy
msgid "Mouse Mode"
-msgstr "Mod Mutare"
+msgstr "Mod Maus"
#: core/os/input.cpp
-#, fuzzy
msgid "Use Accumulated Input"
-msgstr "Șterge Intrare(Input)"
+msgstr "Utilizează Intrarea (Input) Acumulată"
#: core/os/input_event.cpp editor/project_settings_editor.cpp
#: servers/audio_server.cpp
@@ -411,9 +405,8 @@ msgid "Meta"
msgstr "Meta"
#: core/os/input_event.cpp
-#, fuzzy
msgid "Command"
-msgstr "Comunitate"
+msgstr "Comandă"
#: core/os/input_event.cpp
#, fuzzy
@@ -444,9 +437,8 @@ msgid "Echo"
msgstr "Ecou"
#: core/os/input_event.cpp scene/gui/base_button.cpp
-#, fuzzy
msgid "Button Mask"
-msgstr "Adaugă în Grup"
+msgstr "Mască Buton"
#: core/os/input_event.cpp scene/2d/node_2d.cpp scene/gui/control.cpp
msgid "Global Position"
@@ -457,9 +449,8 @@ msgid "Factor"
msgstr "Factor"
#: core/os/input_event.cpp
-#, fuzzy
msgid "Button Index"
-msgstr "Mod ÃŽn Jur"
+msgstr "Indice Buton"
#: core/os/input_event.cpp
msgid "Doubleclick"
@@ -498,9 +489,8 @@ msgid "Axis Value"
msgstr "Valoarea Axei"
#: core/os/input_event.cpp modules/visual_script/visual_script_func_nodes.cpp
-#, fuzzy
msgid "Index"
-msgstr "Mod ÃŽn Jur"
+msgstr "Indice"
#: core/os/input_event.cpp editor/project_settings_editor.cpp
#: modules/visual_script/visual_script_nodes.cpp
@@ -518,29 +508,26 @@ msgid "Delta"
msgstr "Delta"
#: core/os/input_event.cpp
-#, fuzzy
msgid "Channel"
-msgstr "Schimbați"
+msgstr "Canal"
#: core/os/input_event.cpp main/main.cpp
-#, fuzzy
msgid "Message"
-msgstr "Sincronizează Modificările Scriptului"
+msgstr "Mesaj"
#: core/os/input_event.cpp
-#, fuzzy
msgid "Pitch"
-msgstr "Dimensiune:"
+msgstr "Înclinație"
#: core/os/input_event.cpp scene/2d/cpu_particles_2d.cpp
#: scene/2d/physics_body_2d.cpp scene/3d/cpu_particles.cpp
#: scene/3d/physics_body.cpp scene/resources/particles_material.cpp
msgid "Velocity"
-msgstr ""
+msgstr "Viteză (velocity)"
#: core/os/input_event.cpp
msgid "Instrument"
-msgstr ""
+msgstr "Instrument"
#: core/os/input_event.cpp
msgid "Controller Number"
@@ -553,19 +540,16 @@ msgstr "Valoarea controlerului"
#: core/project_settings.cpp editor/editor_node.cpp main/main.cpp
#: platform/iphone/export/export.cpp platform/osx/export/export.cpp
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Application"
-msgstr "Acțiune"
+msgstr "Aplicație"
#: core/project_settings.cpp main/main.cpp
-#, fuzzy
msgid "Config"
-msgstr "Configurare Snap"
+msgstr "Configurare"
#: core/project_settings.cpp
-#, fuzzy
msgid "Project Settings Override"
-msgstr "Setări proiect..."
+msgstr "Suprascriere setări proiect"
#: core/project_settings.cpp core/resource.cpp
#: editor/animation_track_editor.cpp editor/editor_autoload_settings.cpp
@@ -596,29 +580,27 @@ msgstr "Execută"
#: core/project_settings.cpp editor/editor_node.cpp
#: editor/run_settings_dialog.cpp main/main.cpp
msgid "Main Scene"
-msgstr ""
+msgstr "Scena Principală"
#: core/project_settings.cpp
-#, fuzzy
msgid "Disable stdout"
-msgstr "Dezactivat"
+msgstr "Dezactivează stdout"
#: core/project_settings.cpp
-#, fuzzy
msgid "Disable stderr"
-msgstr "Dezactivat"
+msgstr "Dezactivează stderr"
#: core/project_settings.cpp
msgid "Use Hidden Project Data Directory"
-msgstr ""
+msgstr "Utilizează directorul de date de proiect ascuns"
#: core/project_settings.cpp
msgid "Use Custom User Dir"
-msgstr ""
+msgstr "Utilizează Director de Utilizator Personalizat"
#: core/project_settings.cpp
msgid "Custom User Dir Name"
-msgstr ""
+msgstr "Nume de Director de Utilizator Personalizat"
#: core/project_settings.cpp main/main.cpp
#: platform/javascript/export/export.cpp platform/osx/export/export.cpp
@@ -631,7 +613,7 @@ msgstr "Afișează Tot"
#: modules/opensimplex/noise_texture.cpp scene/2d/line_2d.cpp
#: scene/3d/label_3d.cpp scene/gui/text_edit.cpp scene/resources/texture.cpp
msgid "Width"
-msgstr ""
+msgstr "Lățime"
#: core/project_settings.cpp main/main.cpp modules/csg/csg_shape.cpp
#: modules/gltf/gltf_node.cpp modules/opensimplex/noise_texture.cpp
@@ -640,21 +622,19 @@ msgstr ""
#: scene/resources/font.cpp scene/resources/navigation_mesh.cpp
#: scene/resources/primitive_meshes.cpp scene/resources/texture.cpp
msgid "Height"
-msgstr ""
+msgstr "Înălțime"
#: core/project_settings.cpp
msgid "Always On Top"
-msgstr ""
+msgstr "Mereu Deasupra"
#: core/project_settings.cpp
-#, fuzzy
msgid "Test Width"
-msgstr "Stânga liniară"
+msgstr "Lățime de Test"
#: core/project_settings.cpp
-#, fuzzy
msgid "Test Height"
-msgstr "Se Testează"
+msgstr "Înălțime de Test"
#: core/project_settings.cpp editor/animation_track_editor.cpp
#: editor/editor_audio_buses.cpp main/main.cpp servers/audio_server.cpp
@@ -662,9 +642,8 @@ msgid "Audio"
msgstr "Sunet"
#: core/project_settings.cpp
-#, fuzzy
msgid "Default Bus Layout"
-msgstr "Încarcă Schema de Pistă Audio implicită."
+msgstr "Schema de Pistă Audio Implicită"
#: core/project_settings.cpp editor/editor_export.cpp
#: editor/editor_file_system.cpp editor/editor_node.cpp
@@ -687,73 +666,64 @@ msgstr "Căutare în extensii de fișiere"
#: core/project_settings.cpp
msgid "Script Templates Search Path"
-msgstr ""
+msgstr "Cale de Căutare pentru Șabloane de Scripturi"
#: core/project_settings.cpp
-#, fuzzy
msgid "Version Control Autoload On Startup"
-msgstr "Control versiune"
+msgstr "Încărcare Automată de Control al Versiunii la Pornire"
#: core/project_settings.cpp
-#, fuzzy
msgid "Version Control Plugin Name"
-msgstr "Control versiune"
+msgstr "Numele Pluginului de Control al Versiunii"
#: core/project_settings.cpp scene/2d/collision_object_2d.cpp
#: scene/3d/collision_object.cpp scene/gui/control.cpp
-#, fuzzy
msgid "Input"
-msgstr "Adaugă Intrare(Input)"
+msgstr "Intrare (Input)"
#: core/project_settings.cpp
msgid "UI Accept"
-msgstr ""
+msgstr "Acceptare (UI)"
#: core/project_settings.cpp
-#, fuzzy
msgid "UI Select"
-msgstr "Selectează"
+msgstr "Selectează (UI)"
#: core/project_settings.cpp
msgid "UI Cancel"
-msgstr "Anulare interfață utilizator"
+msgstr "Anulare (UI)"
#: core/project_settings.cpp
-#, fuzzy
msgid "UI Focus Next"
-msgstr "Cale focalizare"
+msgstr "Focalizează Urmatorul (UI)"
#: core/project_settings.cpp
-#, fuzzy
msgid "UI Focus Prev"
-msgstr "Cale focalizare"
+msgstr "Focalizează Anteriorul (UI)"
#: core/project_settings.cpp
-#, fuzzy
msgid "UI Left"
-msgstr "Mod Rotație"
+msgstr "Stânga (UI)"
#: core/project_settings.cpp
-#, fuzzy
msgid "UI Right"
-msgstr "Rotație poligon"
+msgstr "Dreapta (UI)"
#: core/project_settings.cpp
msgid "UI Up"
-msgstr ""
+msgstr "Sus (UI)"
#: core/project_settings.cpp
-#, fuzzy
msgid "UI Down"
-msgstr "Descarcă"
+msgstr "JUos (UI)"
#: core/project_settings.cpp
msgid "UI Page Up"
-msgstr "Pagina UI în sus"
+msgstr "Pagina Ssus (UI)"
#: core/project_settings.cpp
msgid "UI Page Down"
-msgstr ""
+msgstr "Pagină Jos (UI)"
#: core/project_settings.cpp
msgid "UI Home"
@@ -783,7 +753,7 @@ msgstr "Cadru Fizic %"
#: scene/3d/physics_body.cpp scene/resources/world.cpp
#: servers/physics/space_sw.cpp servers/physics_server.cpp
msgid "3D"
-msgstr ""
+msgstr "3D"
#: core/project_settings.cpp
#, fuzzy
@@ -800,7 +770,7 @@ msgstr "Creează un Frate de Coliziune Trimesh"
#: scene/main/viewport.cpp servers/visual/visual_server_scene.cpp
#: servers/visual_server.cpp
msgid "Rendering"
-msgstr ""
+msgstr "Randare"
#: core/project_settings.cpp drivers/gles2/rasterizer_storage_gles2.cpp
#: drivers/gles3/rasterizer_scene_gles3.cpp
@@ -850,17 +820,16 @@ msgid "Max Functions"
msgstr "Faceți Funcția"
#: core/project_settings.cpp scene/3d/vehicle_body.cpp
-#, fuzzy
msgid "Compression"
-msgstr "Setare expresie"
+msgstr "Compresie"
#: core/project_settings.cpp
msgid "Formats"
-msgstr ""
+msgstr "Formate"
#: core/project_settings.cpp
msgid "Zstd"
-msgstr ""
+msgstr "Zstd"
#: core/project_settings.cpp
msgid "Long Distance Matching"
@@ -905,11 +874,11 @@ msgstr "Pachet Peer Stream"
#: core/register_core_types.cpp
msgid "Max Buffer (Power of 2)"
-msgstr ""
+msgstr "Buffer Maxim (Putere de-a lui 2)"
#: core/register_core_types.cpp editor/editor_settings.cpp main/main.cpp
msgid "SSL"
-msgstr ""
+msgstr "SSL"
#: core/register_core_types.cpp main/main.cpp
#, fuzzy
@@ -941,7 +910,7 @@ msgstr "Resursă"
#: core/translation.cpp editor/project_settings_editor.cpp
msgid "Locale"
-msgstr ""
+msgstr "Local"
#: core/translation.cpp
#, fuzzy
@@ -986,17 +955,17 @@ msgstr "EiB"
#: drivers/gles3/rasterizer_scene_gles3.cpp
#: drivers/gles3/rasterizer_storage_gles3.cpp modules/gltf/gltf_state.cpp
msgid "Buffers"
-msgstr ""
+msgstr "Buffere"
#: drivers/gles2/rasterizer_canvas_base_gles2.cpp
#: drivers/gles3/rasterizer_canvas_base_gles3.cpp
msgid "Canvas Polygon Buffer Size (KB)"
-msgstr ""
+msgstr "Dimensiune Buffer Poligon de Canvas (KB)"
#: drivers/gles2/rasterizer_canvas_base_gles2.cpp
#: drivers/gles3/rasterizer_canvas_base_gles3.cpp
msgid "Canvas Polygon Index Buffer Size (KB)"
-msgstr ""
+msgstr "Dimensiune Indice Buffer Poligon de Canvas (KB)"
#: drivers/gles2/rasterizer_canvas_base_gles2.cpp
#: drivers/gles3/rasterizer_canvas_base_gles3.cpp editor/editor_settings.cpp
@@ -1040,11 +1009,11 @@ msgstr "Utilizarea eșantionării bicubice"
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Max Renderable Elements"
-msgstr ""
+msgstr "Numărul Maxim de Elemente Care se Pot Randa"
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Max Renderable Lights"
-msgstr ""
+msgstr "Numărul Maxim de Lumini Care se Pot Randa"
#: drivers/gles3/rasterizer_scene_gles3.cpp
#, fuzzy
@@ -1053,7 +1022,7 @@ msgstr "Centrează Selecția"
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Max Lights Per Object"
-msgstr ""
+msgstr "Numărul Maxim de Lumini per Obiect"
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Subsurface Scattering"
@@ -1087,7 +1056,7 @@ msgstr ""
#: drivers/gles3/rasterizer_scene_gles3.cpp scene/resources/environment.cpp
msgid "High Quality"
-msgstr ""
+msgstr "Calitate Înaltă"
#: drivers/gles3/rasterizer_storage_gles3.cpp
msgid "Blend Shape Max Buffer Size (KB)"
@@ -1190,7 +1159,7 @@ msgstr "Rotație"
#: editor/animation_track_editor.cpp editor/script_editor_debugger.cpp
#: modules/visual_script/visual_script_nodes.cpp scene/gui/range.cpp
msgid "Value"
-msgstr ""
+msgstr "Valoare"
#: editor/animation_track_editor.cpp
#, fuzzy
@@ -1200,14 +1169,14 @@ msgstr "Cantitate:"
#: editor/animation_track_editor.cpp main/main.cpp
#: modules/mono/mono_gd/gd_mono.cpp
msgid "Args"
-msgstr ""
+msgstr "Argumente"
#: editor/animation_track_editor.cpp editor/editor_settings.cpp
#: editor/script_editor_debugger.cpp modules/gltf/gltf_accessor.cpp
#: modules/gltf/gltf_light.cpp modules/visual_script/visual_script_nodes.cpp
#: scene/3d/physics_body.cpp scene/resources/visual_shader_nodes.cpp
msgid "Type"
-msgstr ""
+msgstr "Tip"
#: editor/animation_track_editor.cpp
#, fuzzy
@@ -1380,7 +1349,7 @@ msgstr "Dimensiune:"
#: editor/scene_tree_editor.cpp editor/script_editor_debugger.cpp
#: modules/visual_script/visual_script_editor.cpp
msgid "Type:"
-msgstr ""
+msgstr "Tip:"
#: editor/animation_track_editor.cpp
#, fuzzy
@@ -1646,7 +1615,7 @@ msgstr "Anim Mutați Cheie"
#: servers/camera/camera_feed.cpp servers/physics_2d_server.cpp
#: servers/physics_server.cpp
msgid "Transform"
-msgstr ""
+msgstr "Transformă"
#: editor/animation_track_editor.cpp editor/editor_help.cpp
msgid "Methods"
@@ -2667,7 +2636,7 @@ msgstr "Nume nevalid."
#: editor/editor_autoload_settings.cpp
msgid "Cannot begin with a digit."
-msgstr ""
+msgstr "Nu poate începe cu o cifră"
#: editor/editor_autoload_settings.cpp
msgid "Valid characters:"
@@ -2949,7 +2918,7 @@ msgstr "Culoare uniformă."
#: editor/editor_export.cpp
msgid "64 Bits"
-msgstr ""
+msgstr "64 de biți"
#: editor/editor_export.cpp
msgid "Embed PCK"
@@ -3207,6 +3176,8 @@ msgstr "Opțiunii Extra:"
#: editor/editor_feature_profile.cpp
msgid "Create or import a profile to edit available classes and properties."
msgstr ""
+"Creează sau importă un profil pentru a edita clasele si proprietățile "
+"disponibile"
#: editor/editor_feature_profile.cpp
msgid "New profile name:"
@@ -3347,7 +3318,7 @@ msgstr "Comutați Fișiere Ascunse"
#: editor/editor_file_dialog.cpp
msgid "Disable Overwrite Warning"
-msgstr ""
+msgstr "Opreste suprascrierea avertizărilor"
#: editor/editor_file_dialog.cpp
msgid "Go Back"
@@ -3496,7 +3467,7 @@ msgstr "Proprietățile Temei"
#: scene/2d/cpu_particles_2d.cpp scene/3d/cpu_particles.cpp
#: scene/resources/gradient.cpp
msgid "Colors"
-msgstr ""
+msgstr "Culori"
#: editor/editor_help.cpp editor/plugins/theme_editor_plugin.cpp
msgid "Constants"
@@ -3504,16 +3475,16 @@ msgstr "Constante"
#: editor/editor_help.cpp editor/plugins/theme_editor_plugin.cpp
msgid "Fonts"
-msgstr ""
+msgstr "Fonturi"
#: editor/editor_help.cpp editor/plugins/theme_editor_plugin.cpp
#: platform/iphone/export/export.cpp
msgid "Icons"
-msgstr ""
+msgstr "Icoană"
#: editor/editor_help.cpp
msgid "Styles"
-msgstr ""
+msgstr "Stiluri"
#: editor/editor_help.cpp
msgid "Enumerations"
@@ -3645,7 +3616,7 @@ msgstr "Proprietate:"
#: editor/editor_inspector.cpp editor/editor_spin_slider.cpp
msgid "Label"
-msgstr ""
+msgstr "Etichetă"
#: editor/editor_inspector.cpp editor/editor_spin_slider.cpp
#: scene/resources/default_theme/default_theme.cpp
@@ -4213,14 +4184,14 @@ msgid "Unable to load addon script from path: '%s'."
msgstr "Nu a putut fi încărcat scriptul add-on din calea: '%s'."
#: editor/editor_node.cpp
-#, fuzzy
msgid ""
"Unable to load addon script from path: '%s'. This might be due to a code "
"error in that script.\n"
"Disabling the addon at '%s' to prevent further errors."
msgstr ""
"Imposibil de încărcat scriptul addon din cale: '%s' Se pare că există o "
-"eroare în cod, verificați sintaxa."
+"eroare în cod, verificați sintaxa.\n"
+"Dezactivez addon-ul de la '%s' pentru a preveni erori ulterioare."
#: editor/editor_node.cpp
msgid ""
@@ -7317,9 +7288,8 @@ msgid "Generating Lightmaps"
msgstr "Se Genereaza Lightmaps"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Generating for Mesh:"
-msgstr "Se Generează pentru Mesh: "
+msgstr "Se Generează pentru Mesh:"
#: editor/import/resource_importer_scene.cpp
msgid "Running Custom Script..."
@@ -8967,36 +8937,32 @@ msgid "Center Top"
msgstr "Centrează Selecția"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Center Right"
-msgstr "Rotație poligon"
+msgstr "Centrează Dreapta"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Center Bottom"
-msgstr "Centrează Selecția"
+msgstr "Centrează Jos"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center"
-msgstr ""
+msgstr "Centrează"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Left Wide"
-msgstr "Stânga liniară"
+msgstr "Stânga Lat"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Top Wide"
-msgstr ""
+msgstr "Sus Lat"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Right Wide"
-msgstr "Dreapta liniară"
+msgstr "Dreapta Lat"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Bottom Wide"
-msgstr ""
+msgstr "Jos Lat"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "VCenter Wide"
@@ -9032,6 +8998,9 @@ msgid ""
"Project Camera Override\n"
"Overrides the running project's camera with the editor viewport camera."
msgstr ""
+"Suprascrierea Camerei de Proiect\n"
+"Suprascrie camera proiectului care rulează cu camera de vizualizare a "
+"editorului."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -9040,48 +9009,45 @@ msgid ""
"No project instance running. Run the project from the editor to use this "
"feature."
msgstr ""
+"Suprascrierea Camerei de Proiect\n"
+"Nicio instanță de proiect nu rulează. Rulați proiectul din editor pentru a "
+"utiliza această caracteristică."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Lock Selected"
-msgstr "Selectează"
+msgstr "Blochează Selecția"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Unlock Selected"
-msgstr ""
+msgstr "Deblochează Selecția"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Group Selected"
-msgstr "Elminați Selecția"
+msgstr "Grupează Selecția"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Ungroup Selected"
-msgstr "Elminați Selecția"
+msgstr "Degrupați selecția"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Paste Pose"
msgstr "Lipește Postura"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Clear Guides"
-msgstr "Curăță Postura"
+msgstr "Elimină Ghidurile"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Create Custom Bone(s) from Node(s)"
-msgstr "Creează Puncte de Emisie Din Mesh"
+msgstr "Crează Oase personalizate din Noduri"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Clear Bones"
-msgstr "Curăță Postura"
+msgstr "Elimină Oase"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Make IK Chain"
@@ -9112,36 +9078,31 @@ msgstr "Selectare mod"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Drag: Rotate selected node around pivot."
-msgstr "Ștergeți pista selectată."
+msgstr "Trage: Rotește nodul selectat în jurul pivotului."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Alt+Drag: Move selected node."
-msgstr "Alt+Trage: Mutare"
+msgstr "Alt+Trage: Mută nodul selectat."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Alt+Drag: Scale selected node."
-msgstr "Alt+Trage: Mutare"
+msgstr "Alt+Trage: Scalează nodul selectat."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "V: Set selected node's pivot position."
-msgstr "Ștergeți pista selectată."
+msgstr "V: Setează poziția pivotului nodului selectat."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Alt+RMB: Show list of all nodes at position clicked, including locked."
msgstr ""
-"Arată o listă a tuturor obiectelor la poziția clickului\n"
-"(similar cu Alt+RMB în modul selectare)."
+"Alt+RMB: Arată o listă a tuturor nodurilor la poziția clickului, inclusiv "
+"cele blocate."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "RMB: Add node at position clicked."
-msgstr ""
+msgstr "RMB: Adaugă nod la poziția clickului."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -9155,13 +9116,12 @@ msgstr "Mod Rotație"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Scale Mode"
-msgstr "Mod Redimensionare (R)"
+msgstr "Mod Redimensionare"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Shift: Scale proportionally."
-msgstr ""
+msgstr "Shift: Redimensionare proporțională."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -9189,21 +9149,18 @@ msgid "Toggle smart snapping."
msgstr "Comutați fixarea inteligentă."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Use Smart Snap"
-msgstr "Utilizează Snap"
+msgstr "Utilizează Snap Inteligent"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Toggle grid snapping."
msgstr "Comutare grilă fixare."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Use Grid Snap"
-msgstr "Snap Grilă"
+msgstr "Utilizează Snap Grilă"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snapping Options"
msgstr "Opțiuni Snapping"
@@ -9212,9 +9169,8 @@ msgid "Use Rotation Snap"
msgstr "Folosește Rotația Snap"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Use Scale Snap"
-msgstr "Utilizează Snap"
+msgstr "Utilizează Snap Redimensionare"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap Relative"
@@ -9225,9 +9181,8 @@ msgid "Use Pixel Snap"
msgstr "Utilizează Pixel Snap"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Smart Snapping"
-msgstr "Snapping inteligent"
+msgstr "Snapping Inteligent"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -9235,34 +9190,28 @@ msgid "Configure Snap..."
msgstr "Configurare Snap..."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snap to Parent"
-msgstr "Snap către părinte"
+msgstr "Snap către Părinte"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snap to Node Anchor"
-msgstr "Snap către ancora nodului"
+msgstr "Snap către Ancora Nodului"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snap to Node Sides"
-msgstr "Snap pe fețele nodului"
+msgstr "Snap pe Fețele Nodului"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snap to Node Center"
-msgstr "Snap către ancora nodului"
+msgstr "Snap către Centrul Nodului"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snap to Other Nodes"
-msgstr "Snap către alte noduri"
+msgstr "Snap către Alte Noduri"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snap to Guides"
-msgstr "Snap pe ghizi"
+msgstr "Snap pe Ghiduri"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -9271,9 +9220,8 @@ msgstr "Imobilizează obiectul selectat (nu poate fi mișcat)."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Lock Selected Node(s)"
-msgstr "Selectează"
+msgstr "Blochează Nodurile Selectate"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -9282,9 +9230,8 @@ msgstr "Remobilizează obiectul selectat (poate fi mișcat)."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Unlock Selected Node(s)"
-msgstr "Selectează"
+msgstr "Deblochează Nodurile Selectate"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -9293,9 +9240,8 @@ msgstr "Asigură-te că nu pot fi selectați copiii obiectului."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Group Selected Node(s)"
-msgstr "Elminați Selecția"
+msgstr "Grupează Nodurile Selectate"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -9304,14 +9250,12 @@ msgstr "Restaurează abilitatea copiilor obiectului de a fi selectați."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Ungroup Selected Node(s)"
-msgstr "Elminați Selecția"
+msgstr "Degrupează Nodurile Selectate"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Skeleton Options"
-msgstr "Singleton (Unicat)"
+msgstr "Opțiuni Schelet"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Show Bones"
@@ -9322,9 +9266,8 @@ msgid "Make Custom Bone(s) from Node(s)"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Clear Custom Bones"
-msgstr "Curăță Oasele"
+msgstr "Curăță Oasele Personalizate"
#. TRANSLATORS: Noun, name of the 2D/3D View menus.
#: editor/plugins/canvas_item_editor_plugin.cpp
@@ -9333,23 +9276,20 @@ msgid "View"
msgstr "Perspectivă"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Show"
-msgstr "Arată Grila"
+msgstr "Arată"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Show When Snapping"
-msgstr "Snapping inteligent"
+msgstr "Arată Când Faci Snap"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Hide"
-msgstr ""
+msgstr "Ascunde"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Toggle Grid"
-msgstr "Comutare mod"
+msgstr "Comutare Grilă"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
@@ -9378,7 +9318,7 @@ msgstr "Arată Fereastra de Lucru"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Show Group And Lock Icons"
-msgstr ""
+msgstr "Arată Pictogramele de Grupare și Blocare"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
@@ -9390,7 +9330,7 @@ msgstr "Încadrează în Ecran Selecția"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Preview Canvas Scale"
-msgstr ""
+msgstr "Previzualizare Scară Canvas"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Layout"
@@ -9421,14 +9361,12 @@ msgid ""
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Auto Insert Key"
-msgstr "Anim Inserați Cheie"
+msgstr "Inserare Automată a Cheii"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Animation Key and Pose Options"
-msgstr "Lungime Animație (în secunde)"
+msgstr "Optiuni pentru Chei Animație și Postură"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key (Existing Tracks)"
@@ -9443,9 +9381,8 @@ msgid "Clear Pose"
msgstr "Curăță Postura"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Add Node Here"
-msgstr "Adaugă punct"
+msgstr "Adaugă Nod Aici"
#: editor/plugins/canvas_item_editor_plugin.cpp
#, fuzzy
@@ -9467,49 +9404,43 @@ msgstr "Perspectivă Snap"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Zoom to 3.125%"
-msgstr ""
+msgstr "Magnificare la 3.125%"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Zoom to 6.25%"
-msgstr ""
+msgstr "Magnificare la 6.25%"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Zoom to 12.5%"
-msgstr ""
+msgstr "Magnificare la 12.5%"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Zoom to 25%"
-msgstr "Departare"
+msgstr "Magnificare la 25%"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Zoom to 50%"
-msgstr "Departare"
+msgstr "Magnificare la 50%"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Zoom to 100%"
-msgstr "Departare"
+msgstr "Magnificare la 100%"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Zoom to 200%"
-msgstr "Departare"
+msgstr "Magnificare la 200%"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Zoom to 400%"
-msgstr "Departare"
+msgstr "Magnificare la 400%"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Zoom to 800%"
-msgstr "Departare"
+msgstr "Magnificare la 800%"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Zoom to 1600%"
-msgstr ""
+msgstr "Magnificare la 1600%"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Adding %s..."
@@ -9530,9 +9461,8 @@ msgid "Error instancing scene from %s"
msgstr "Eroare la instanțierea scenei din %s"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Change Default Type"
-msgstr "Schimbă tipul implicit"
+msgstr "Schimbă Tipul Implicit"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid ""
@@ -9543,9 +9473,8 @@ msgstr ""
"Trage & lasă + Shift: Schimbă tipul nodului"
#: editor/plugins/collision_polygon_editor_plugin.cpp
-#, fuzzy
msgid "Create Polygon3D"
-msgstr "Crează Poligon"
+msgstr "Crează Poligon3D"
#: editor/plugins/collision_polygon_editor_plugin.cpp
msgid "Edit Poly"
@@ -9595,7 +9524,7 @@ msgstr "Mască de Emisie"
#: editor/plugins/cpu_particles_2d_editor_plugin.cpp
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Solid Pixels"
-msgstr ""
+msgstr "Pixeli Solizi"
#: editor/plugins/cpu_particles_2d_editor_plugin.cpp
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -9618,9 +9547,8 @@ msgid "Emission Colors"
msgstr "Culori de Emisie"
#: editor/plugins/cpu_particles_editor_plugin.cpp
-#, fuzzy
msgid "CPUParticles"
-msgstr "Particule"
+msgstr "ParticuleCPU"
#: editor/plugins/cpu_particles_editor_plugin.cpp
#: editor/plugins/particles_editor_plugin.cpp
@@ -9667,29 +9595,24 @@ msgid "Load Curve Preset"
msgstr "Încarcă Presetare a Curbei"
#: editor/plugins/curve_editor_plugin.cpp
-#, fuzzy
msgid "Add Point"
-msgstr "Adaugă punct"
+msgstr "Adaugă Punct"
#: editor/plugins/curve_editor_plugin.cpp
-#, fuzzy
msgid "Remove Point"
-msgstr "Elimină punct"
+msgstr "Elimină Punct"
#: editor/plugins/curve_editor_plugin.cpp
-#, fuzzy
msgid "Left Linear"
-msgstr "Stânga liniară"
+msgstr "Stânga Liniară"
#: editor/plugins/curve_editor_plugin.cpp
-#, fuzzy
msgid "Right Linear"
-msgstr "Dreapta liniară"
+msgstr "Dreapta Liniară"
#: editor/plugins/curve_editor_plugin.cpp
-#, fuzzy
msgid "Load Preset"
-msgstr "Încarcă presetare"
+msgstr "Încarcă Presetare"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Remove Curve Point"
@@ -9704,9 +9627,8 @@ msgid "Hold Shift to edit tangents individually"
msgstr "Ține apăsat Shift pentru a edita individual tangentele"
#: editor/plugins/curve_editor_plugin.cpp
-#, fuzzy
msgid "Right click to add point"
-msgstr "Click Drept: Ștergere punct"
+msgstr "Click dreapta pentru adăugare punct"
#: editor/plugins/gi_probe_editor_plugin.cpp
msgid "Bake GI Probe"
@@ -9714,7 +9636,7 @@ msgstr "Procesează Sonda GI"
#: editor/plugins/gradient_editor_plugin.cpp
msgid "Gradient Edited"
-msgstr ""
+msgstr "Gradient Dditat"
#: editor/plugins/gradient_texture_2d_editor_plugin.cpp
msgid "Swap GradientTexture2D Fill Points"
@@ -9735,18 +9657,18 @@ msgstr "Comutare mod"
#: scene/gui/rich_text_label.cpp scene/gui/text_edit.cpp
#: scene/resources/primitive_meshes.cpp
msgid "Text"
-msgstr ""
+msgstr "Text"
#: editor/plugins/item_list_editor_plugin.cpp
#: editor/plugins/tile_set_editor_plugin.cpp main/main.cpp
#: platform/osx/export/export.cpp platform/windows/export/export.cpp
#: scene/gui/button.cpp scene/gui/item_list.cpp
msgid "Icon"
-msgstr ""
+msgstr "Pictogramă"
#: editor/plugins/item_list_editor_plugin.cpp
msgid "ID"
-msgstr ""
+msgstr "ID"
#: editor/plugins/item_list_editor_plugin.cpp
#: scene/resources/default_theme/default_theme.cpp
@@ -11288,7 +11210,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
@@ -18656,14 +18578,12 @@ msgid "Var Name"
msgstr "Nume"
#: modules/visual_script/visual_script_nodes.cpp
-#, fuzzy
msgid "VariableGet not found in script:"
-msgstr "Metoda nu a fost găsită în obiect: "
+msgstr "VariableGet nu a fost găsită în obiect:"
#: modules/visual_script/visual_script_nodes.cpp
-#, fuzzy
msgid "VariableSet not found in script:"
-msgstr "Metoda nu a fost găsită în obiect: "
+msgstr "Metoda VariableSet nu a fost găsită în obiect:"
#: modules/visual_script/visual_script_nodes.cpp
msgid "Preload"
@@ -19354,11 +19274,8 @@ msgid "Signing debug %s..."
msgstr ""
#: platform/android/export/export_plugin.cpp
-#, fuzzy
msgid "Signing release %s..."
-msgstr ""
-"Se Scanează Fișierele,\n"
-"Te Rog Așteaptă..."
+msgstr "Se semnează release-ul %s..."
#: platform/android/export/export_plugin.cpp
msgid "Could not find keystore, unable to export."
diff --git a/editor/translations/ru.po b/editor/translations/ru.po
index d746bb61ad..97e9723383 100644
--- a/editor/translations/ru.po
+++ b/editor/translations/ru.po
@@ -11029,7 +11029,7 @@ msgstr "Задний перÑпективный"
msgid " [auto]"
msgstr " [авто]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [порталы активны]"
diff --git a/editor/translations/si.po b/editor/translations/si.po
index d0fcba8cfd..af22d7b2d2 100644
--- a/editor/translations/si.po
+++ b/editor/translations/si.po
@@ -10744,7 +10744,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/sk.po b/editor/translations/sk.po
index 43c2fa6b5b..4f4e1107f3 100644
--- a/editor/translations/sk.po
+++ b/editor/translations/sk.po
@@ -12,13 +12,14 @@
# Anonymous <noreply@weblate.org>, 2020.
# Mario-projects-dev <m.vitek.mv@gmail.com>, 2021.
# Eliška Fichnová <eliska@fichna.sk>, 2021.
+# Adam Švidroň <adsvidro@gmail.com>, 2022.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2021-07-07 15:34+0000\n"
-"Last-Translator: Eliška Fichnová <eliska@fichna.sk>\n"
+"PO-Revision-Date: 2022-12-21 07:01+0000\n"
+"Last-Translator: Adam Švidroň <adsvidro@gmail.com>\n"
"Language-Team: Slovak <https://hosted.weblate.org/projects/godot-engine/"
"godot/sk/>\n"
"Language: sk\n"
@@ -26,7 +27,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
-"X-Generator: Weblate 4.8-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -34,7 +35,7 @@ msgstr ""
#: core/bind/core_bind.cpp
msgid "Clipboard"
-msgstr ""
+msgstr "Schránka"
#: core/bind/core_bind.cpp
#, fuzzy
@@ -11289,7 +11290,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/sl.po b/editor/translations/sl.po
index 864dac1b8d..3605bbeaf5 100644
--- a/editor/translations/sl.po
+++ b/editor/translations/sl.po
@@ -11456,7 +11456,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/sq.po b/editor/translations/sq.po
index 1215b7dbcb..e4d3ef6732 100644
--- a/editor/translations/sq.po
+++ b/editor/translations/sq.po
@@ -11222,7 +11222,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/sr_Cyrl.po b/editor/translations/sr_Cyrl.po
index 419e33c494..c2d0ffe462 100644
--- a/editor/translations/sr_Cyrl.po
+++ b/editor/translations/sr_Cyrl.po
@@ -12040,7 +12040,7 @@ msgstr "ПерÑпективна пројекција"
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/sr_Latn.po b/editor/translations/sr_Latn.po
index 7973756c7e..5693d06931 100644
--- a/editor/translations/sr_Latn.po
+++ b/editor/translations/sr_Latn.po
@@ -10752,7 +10752,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/sv.po b/editor/translations/sv.po
index 04965e6c69..dff36498be 100644
--- a/editor/translations/sv.po
+++ b/editor/translations/sv.po
@@ -25,15 +25,16 @@
# Leon <joel.lundborg@gmail.com>, 2021, 2022.
# Kent Jofur <kent.jofur@gmail.com>, 2021.
# Alex25820 <alexs25820@gmail.com>, 2021.
-# Björn Åkesson <bjorn.akesson@gmail.com>, 2022.
+# Björn Åkesson <bjorn.akesson@gmail.com>, 2022, 2023.
# Kenny Andersson <kenny@ordinary.se>, 2022.
+# Ludvig Svenonius <ludvig.svenonius@protonmail.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-09-29 19:16+0000\n"
-"Last-Translator: Kristoffer Grundström <swedishsailfishosuser@tutanota.com>\n"
+"PO-Revision-Date: 2023-01-20 11:20+0000\n"
+"Last-Translator: Ludvig Svenonius <ludvig.svenonius@protonmail.com>\n"
"Language-Team: Swedish <https://hosted.weblate.org/projects/godot-engine/"
"godot/sv/>\n"
"Language: sv\n"
@@ -41,7 +42,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 4.14.1\n"
+"X-Generator: Weblate 4.15.1\n"
#: core/bind/core_bind.cpp main/main.cpp
#, fuzzy
@@ -704,9 +705,8 @@ msgid "Script Templates Search Path"
msgstr "Sökväg för skriptmallar"
#: core/project_settings.cpp
-#, fuzzy
msgid "Version Control Autoload On Startup"
-msgstr "Versionshantering"
+msgstr "Automatisk Inläsning av Versionskontroll vid Start"
#: core/project_settings.cpp
#, fuzzy
@@ -8287,7 +8287,7 @@ msgstr ""
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Autoplay on Load"
-msgstr ""
+msgstr "Spela upp automatiskt efter inladdning"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Enable Onion Skinning"
@@ -11363,7 +11363,7 @@ msgstr "Perspektiv"
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
@@ -15031,19 +15031,19 @@ msgstr ""
#: editor/project_settings_editor.cpp
msgid "Physical Key"
-msgstr ""
+msgstr "Fysisk tangent"
#: editor/project_settings_editor.cpp
msgid "Key "
-msgstr "Nyckel "
+msgstr "Tangent "
#: editor/project_settings_editor.cpp
msgid "Joy Button"
-msgstr ""
+msgstr "Styrspaksknapp"
#: editor/project_settings_editor.cpp
msgid "Joy Axis"
-msgstr ""
+msgstr "Styrspaksaxel"
#: editor/project_settings_editor.cpp
msgid "Mouse Button"
@@ -15072,9 +15072,8 @@ msgid "Add Input Action Event"
msgstr ""
#: editor/project_settings_editor.cpp
-#, fuzzy
msgid "All Devices"
-msgstr "Enhet"
+msgstr "Alla Enheter"
#: editor/project_settings_editor.cpp
msgid " (Physical)"
@@ -20908,11 +20907,11 @@ msgstr ""
#: scene/2d/area_2d.cpp scene/3d/area.cpp
msgid "Monitoring"
-msgstr ""
+msgstr "Övervakning"
#: scene/2d/area_2d.cpp scene/3d/area.cpp
msgid "Monitorable"
-msgstr ""
+msgstr "Övervakningsbar"
#: scene/2d/area_2d.cpp scene/3d/area.cpp
#, fuzzy
@@ -20985,7 +20984,7 @@ msgstr "Slå på/av Autoplay"
#: scene/2d/audio_stream_player_2d.cpp scene/3d/audio_stream_player_3d.cpp
#: scene/audio/audio_stream_player.cpp
msgid "Stream Paused"
-msgstr ""
+msgstr "Pausad"
#: scene/2d/audio_stream_player_2d.cpp scene/3d/audio_stream_player_3d.cpp
#: scene/3d/light.cpp scene/3d/reflection_probe.cpp
@@ -25655,39 +25654,32 @@ msgid "Swap OK Cancel"
msgstr "Avbryt"
#: scene/register_scene_types.cpp
-#, fuzzy
msgid "Layer Names"
-msgstr "Namn"
+msgstr "Skiktnamn"
#: scene/register_scene_types.cpp
-#, fuzzy
msgid "2D Render"
-msgstr "Renderare:"
+msgstr "2D-Rendering"
#: scene/register_scene_types.cpp
-#, fuzzy
msgid "3D Render"
-msgstr "Renderare:"
+msgstr "3D-Rendering"
#: scene/register_scene_types.cpp
-#, fuzzy
msgid "2D Physics"
-msgstr "Fysik Bildruta %"
+msgstr "2D-Fysik"
#: scene/register_scene_types.cpp
-#, fuzzy
msgid "3D Physics"
-msgstr "Fysik Bildruta %"
+msgstr "3D-Fysik"
#: scene/register_scene_types.cpp
-#, fuzzy
msgid "2D Navigation"
-msgstr "Animations-Node"
+msgstr "2D-Navigation"
#: scene/register_scene_types.cpp
-#, fuzzy
msgid "3D Navigation"
-msgstr "Animations-Node"
+msgstr "3D-Navigation"
#: scene/register_scene_types.cpp
msgid "Use hiDPI"
diff --git a/editor/translations/te.po b/editor/translations/te.po
index 22474ca4ba..f8a1f82710 100644
--- a/editor/translations/te.po
+++ b/editor/translations/te.po
@@ -10590,7 +10590,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/th.po b/editor/translations/th.po
index 5f4ee76a4d..c41428e6d1 100644
--- a/editor/translations/th.po
+++ b/editor/translations/th.po
@@ -11270,7 +11270,7 @@ msgstr "เพอร์สเปà¸à¸—ีฟ"
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/tl.po b/editor/translations/tl.po
index 670e52056d..fa5f9a9aea 100644
--- a/editor/translations/tl.po
+++ b/editor/translations/tl.po
@@ -10910,7 +10910,7 @@ msgstr ""
msgid " [auto]"
msgstr " [kusa]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [mga aktibong portal]"
diff --git a/editor/translations/tr.po b/editor/translations/tr.po
index ac4b509150..73fbaec2cb 100644
--- a/editor/translations/tr.po
+++ b/editor/translations/tr.po
@@ -11032,7 +11032,7 @@ msgstr "Arka Perspektif"
msgid " [auto]"
msgstr " [Oto]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [portallar aktif]"
diff --git a/editor/translations/uk.po b/editor/translations/uk.po
index f9a6c787a5..a8d989d5ee 100644
--- a/editor/translations/uk.po
+++ b/editor/translations/uk.po
@@ -17,21 +17,23 @@
# Микола Тимошенко <9081@ukr.net>, 2020.
# Miroslav <zinmirx@gmail.com>, 2020.
# IllusiveMan196 <hamsterrv@gmail.com>, 2021, 2022.
-# KazanskiyMaks <kazanskiy.maks@gmail.com>, 2022.
+# KazanskiyMaks <kazanskiy.maks@gmail.com>, 2022, 2023.
# МироÑлав <hlopukmyroslav@gmail.com>, 2022.
# Ostap <ostapbataj79@gmail.com>, 2022.
# Wald Sin <naaveranos@gmail.com>, 2022.
# Гліб Соколов <ramithes@i.ua>, 2022.
# Max Donchenko <maxx.donchenko@gmail.com>, 2022.
# Artem <artem@molotov.work>, 2022.
-# Teashrock <kajitsu22@gmail.com>, 2022.
+# Teashrock <kajitsu22@gmail.com>, 2022, 2023.
+# kirill7606 <k7606irill@gmail.com>, 2022.
+# Alex <anna.loban@yahoo.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Ukrainian (Godot Engine)\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-10-03 12:44+0000\n"
-"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
+"PO-Revision-Date: 2023-01-08 09:47+0000\n"
+"Last-Translator: KazanskiyMaks <kazanskiy.maks@gmail.com>\n"
"Language-Team: Ukrainian <https://hosted.weblate.org/projects/godot-engine/"
"godot/uk/>\n"
"Language: uk\n"
@@ -40,7 +42,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 4.14.1\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -60,27 +62,27 @@ msgstr "Код виходу"
#: core/bind/core_bind.cpp
msgid "V-Sync Enabled"
-msgstr "Увімкнено верт. Ñинхронізацію"
+msgstr "Увімкнено вертикальну Ñинхронізацію"
#: core/bind/core_bind.cpp main/main.cpp
msgid "V-Sync Via Compositor"
-msgstr "Верт. Ñинхр. через заÑіб композиції"
+msgstr "Вертикальна ÑÐ¸Ð½Ñ…Ñ€Ð¾Ð½Ñ–Ð·Ð°Ñ†Ñ–Ñ Ñ‡ÐµÑ€ÐµÐ· заÑіб композиції"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Delta Smoothing"
-msgstr "Ð—Ð³Ð»Ð°Ð´Ð¶ÑƒÐ²Ð°Ð½Ð½Ñ Ñ€Ñ–Ð·Ð½Ð¸Ñ†Ñ–"
+msgstr "Дельта-згладжуваннÑ"
#: core/bind/core_bind.cpp
msgid "Low Processor Usage Mode"
-msgstr "Режим низького ÑÐ¿Ð¾Ð¶Ð¸Ð²Ð°Ð½Ð½Ñ Ð¿Ñ€Ð¾Ñ†ÐµÑора"
+msgstr "Режим низького викориÑÑ‚Ð°Ð½Ð½Ñ Ð¿Ñ€Ð¾Ñ†ÐµÑора"
#: core/bind/core_bind.cpp
msgid "Low Processor Usage Mode Sleep (µsec)"
-msgstr "ПриÑиплÑÐ½Ð½Ñ Ñƒ режимі низького ÑÐ¿Ð¾Ð¶Ð¸Ð²Ð°Ð½Ð½Ñ Ð¿Ñ€Ð¾Ñ†ÐµÑора (мкÑ)"
+msgstr "Ð§Ð°Ñ Ñну в режимі низького викориÑÑ‚Ð°Ð½Ð½Ñ Ð¿Ñ€Ð¾Ñ†ÐµÑора (мкÑ)"
#: core/bind/core_bind.cpp main/main.cpp platform/uwp/os_uwp.cpp
msgid "Keep Screen On"
-msgstr "Залишити зневаджувач відкритим"
+msgstr "Ðе вимикати екран"
#: core/bind/core_bind.cpp
msgid "Min Window Size"
@@ -4533,7 +4535,7 @@ msgstr "Перезавантажити поточний проєкт"
#: editor/editor_node.cpp
msgid "Quit to Project List"
-msgstr "Вийти в ÑпиÑок проєктів"
+msgstr "Вийти до ÑпиÑку проєктів"
#: editor/editor_node.cpp
msgid "Deploy with Remote Debug"
@@ -5496,9 +5498,8 @@ msgid "Mouse Extra Buttons Navigate History"
msgstr "Додаткові кнопки миші Ð´Ð»Ñ Ð½Ð°Ð²Ñ–Ð³Ð°Ñ†Ñ–Ñ— журналом"
#: editor/editor_settings.cpp
-#, fuzzy
msgid "Drag And Drop Selection"
-msgstr "ПеретÑгніть виділене"
+msgstr "Ð’Ð¸Ð´Ñ–Ð»ÐµÐ½Ð½Ñ Drag And Drop"
#: editor/editor_settings.cpp
msgid "Stay In Script Editor On Node Selected"
@@ -10955,7 +10956,7 @@ msgstr "Задній перÑпективний"
msgid " [auto]"
msgstr " [авто]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [портали активні]"
@@ -14219,17 +14220,15 @@ msgid "Invalid project path (changed anything?)."
msgstr "Ðекоректний шлÑÑ… до проєкту (щоÑÑŒ змінилоÑÑ?)."
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project at '%s' (error %d). It may be missing or corrupted."
msgstr ""
-"Ðе вдалоÑÑ Ð·Ð°Ð²Ð°Ð½Ñ‚Ð°Ð¶Ð¸Ñ‚Ð¸ project.godot у каталозі проєкту (помилка %d). "
-"Можливо, файл вилучено або пошкоджено."
+"Ðе вдалоÑÑ Ð·Ð°Ð²Ð°Ð½Ñ‚Ð°Ð¶Ð¸Ñ‚Ð¸ проєкт у '%s' (помилка %d). Можливо, файл вилучено "
+"або пошкоджено."
#: editor/project_manager.cpp
-#, fuzzy
msgid "Couldn't save project at '%s' (error %d)."
-msgstr "Ðе вдалоÑÑ Ð²Ñ–Ð´ÐºÑ€Ð¸Ñ‚Ð¸ проєкт у «%s»."
+msgstr "Ðе вдалоÑÑ Ð·Ð±ÐµÑ€ÐµÐ³Ñ‚Ð¸ проєкт у '%s' (помилка %d)."
#: editor/project_manager.cpp
msgid "Couldn't create project.godot in project path."
@@ -15272,18 +15271,16 @@ msgid "Make Local"
msgstr "Зробити локальним"
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Enable Scene Unique Name(s)"
-msgstr "Увімкнути унікальну назву Ñцени"
+msgstr "Увімкнути Унікальні Ðазви Сцен(и)"
#: editor/scene_tree_dock.cpp
msgid "Unique names already used by another node in the scene:"
msgstr "Цю унікальну назву у Ñцені вже викориÑтано іншим вузлом:"
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Disable Scene Unique Name(s)"
-msgstr "Вимкнути унікальна назва Ñцени"
+msgstr "Вимкнути Унікальні Ðазви Сцен(и)"
#: editor/scene_tree_dock.cpp
msgid "New Scene Root"
@@ -16315,7 +16312,7 @@ msgstr "Середовище"
#: main/main.cpp
msgid "Default Clear Color"
-msgstr "Типовий колір очищеннÑ"
+msgstr "Типовий чиÑтий колір"
#: main/main.cpp
msgid "Boot Splash"
@@ -16848,12 +16845,10 @@ msgid "Sparse Indices Component Type"
msgstr "Тип компонентів індекÑів розÑіюваннÑ"
#: modules/gltf/gltf_accessor.cpp
-#, fuzzy
msgid "Sparse Values Buffer View"
-msgstr "Буферне Ð¿Ð¾Ð´Ð°Ð½Ð½Ñ Ñ€Ð¾Ð·Ñ€Ñ–Ð´Ð¶ÐµÐ½Ð¸Ñ… значень"
+msgstr "ПереглÑд буфера розріджених значень"
#: modules/gltf/gltf_accessor.cpp
-#, fuzzy
msgid "Sparse Values Byte Offset"
msgstr "Ð—Ð¼Ñ–Ñ‰ÐµÐ½Ð½Ñ Ð±Ð°Ð¹Ñ‚Ñ–Ð² розріджених значень"
@@ -16879,7 +16874,7 @@ msgstr "Розмір Ð¿Ð¾Ð»Ñ Ð·Ð¾Ñ€Ñƒ"
#: modules/gltf/gltf_camera.cpp
msgid "Zfar"
-msgstr ""
+msgstr "Ð’Ñ–Ð´Ð´Ð°Ð»ÐµÐ½Ð½Ñ Ð¿Ð¾ Z"
#: modules/gltf/gltf_camera.cpp
msgid "Znear"
@@ -16982,20 +16977,22 @@ msgid "Joint I To Name"
msgstr "З'Ñ”Ð´Ð½Ð°Ð½Ð½Ñ I З Іменем"
#: modules/gltf/gltf_skin.cpp
+#, fuzzy
msgid "Godot Skin"
-msgstr ""
+msgstr "Godot текÑтура"
#: modules/gltf/gltf_spec_gloss.cpp
msgid "Diffuse Img"
-msgstr ""
+msgstr "РозÑÑ–Ñне зображеннÑ"
#: modules/gltf/gltf_spec_gloss.cpp
msgid "Diffuse Factor"
-msgstr ""
+msgstr "Фактор розÑіюваннÑ"
#: modules/gltf/gltf_spec_gloss.cpp
+#, fuzzy
msgid "Gloss Factor"
-msgstr ""
+msgstr "Фактор блиÑку"
#: modules/gltf/gltf_spec_gloss.cpp
msgid "Specular Factor"
@@ -17003,7 +17000,7 @@ msgstr "Коефіцієнт дзеркальноÑті"
#: modules/gltf/gltf_spec_gloss.cpp
msgid "Spec Gloss Img"
-msgstr ""
+msgstr "Дзеркальне глÑнцеве зображеннÑ"
#: modules/gltf/gltf_state.cpp
msgid "Json"
@@ -17022,8 +17019,9 @@ msgid "GLB Data"
msgstr "Дані GLB"
#: modules/gltf/gltf_state.cpp
+#, fuzzy
msgid "Use Named Skin Binds"
-msgstr ""
+msgstr "ВикориÑтовуйте іменовані обшивки"
#: modules/gltf/gltf_state.cpp
msgid "Buffer Views"
@@ -17127,7 +17125,7 @@ msgstr "ÐавігаціÑ"
#: scene/3d/navigation_mesh_instance.cpp
#, fuzzy
msgid "Navigation Layers"
-msgstr "Поведінка навігації"
+msgstr "Ðавігаційні шари"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Plane"
@@ -17292,19 +17290,19 @@ msgstr "Запікати карти оÑвітленнÑ"
#: modules/lightmapper_cpu/register_types.cpp
msgid "Low Quality Ray Count"
-msgstr ""
+msgstr "КількіÑть променів низької ÑкоÑті"
#: modules/lightmapper_cpu/register_types.cpp
msgid "Medium Quality Ray Count"
-msgstr ""
+msgstr "Ð¡ÐµÑ€ÐµÐ´Ð½Ñ ÑкіÑть підрахунку променів"
#: modules/lightmapper_cpu/register_types.cpp
msgid "High Quality Ray Count"
-msgstr ""
+msgstr "ВиÑока ÑкіÑть підрахунку променів"
#: modules/lightmapper_cpu/register_types.cpp
msgid "Ultra Quality Ray Count"
-msgstr ""
+msgstr "КількіÑть променів виÑокої ÑкоÑті"
#: modules/minimp3/audio_stream_mp3.cpp
#: modules/minimp3/resource_importer_mp3.cpp
@@ -17315,7 +17313,7 @@ msgstr "Ð—Ð¼Ñ–Ñ‰ÐµÐ½Ð½Ñ Ñ†Ð¸ÐºÐ»Ñƒ"
#: modules/mobile_vr/mobile_vr_interface.cpp
msgid "Eye Height"
-msgstr ""
+msgstr "ВиÑота очей"
#: modules/mobile_vr/mobile_vr_interface.cpp
msgid "IOD"
@@ -17331,7 +17329,7 @@ msgstr "ПереглÑд без тіней"
#: modules/mobile_vr/mobile_vr_interface.cpp
msgid "Oversample"
-msgstr ""
+msgstr "Ðадвибірка"
#: modules/mobile_vr/mobile_vr_interface.cpp
msgid "K1"
@@ -17354,19 +17352,16 @@ msgid "Auto Update Project"
msgstr "Проєкт без назви"
#: modules/mono/godotsharp_dirs.cpp
-#, fuzzy
msgid "Assembly Name"
-msgstr "Показана назва"
+msgstr "Ðазва збірки"
#: modules/mono/godotsharp_dirs.cpp
-#, fuzzy
msgid "Solution Directory"
-msgstr "Виберіть каталог"
+msgstr "Каталог проєкту"
#: modules/mono/godotsharp_dirs.cpp
-#, fuzzy
msgid "C# Project Directory"
-msgstr "Виберіть каталог"
+msgstr "Каталог проєкту C#"
#: modules/mono/mono_gd/gd_mono_utils.cpp
msgid "End of inner exception stack trace"
@@ -17516,8 +17511,9 @@ msgid "IGD Service Type"
msgstr "Тип Ñлужби IGD"
#: modules/upnp/upnp_device.cpp
+#, fuzzy
msgid "IGD Our Addr"
-msgstr ""
+msgstr "IGD це Ðаша адреÑа"
#: modules/upnp/upnp_device.cpp
msgid "IGD Status"
@@ -18314,12 +18310,14 @@ msgid "Optional Features"
msgstr "Ðеобов'Ñзкові можливоÑті"
#: modules/webxr/webxr_interface.cpp
+#, fuzzy
msgid "Requested Reference Space Types"
-msgstr ""
+msgstr "Запитані типи довідкового проÑтору"
#: modules/webxr/webxr_interface.cpp
+#, fuzzy
msgid "Reference Space Type"
-msgstr ""
+msgstr "Довідка типу проÑтору"
#: modules/webxr/webxr_interface.cpp
msgid "Visibility State"
@@ -18335,7 +18333,7 @@ msgstr "Стандартна прив'Ñзка XR"
#: platform/android/export/export.cpp
msgid "Android SDK Path"
-msgstr ""
+msgstr "ШлÑÑ… Android SDK"
#: platform/android/export/export.cpp
msgid "Debug Keystore"
@@ -18358,8 +18356,9 @@ msgid "Shutdown ADB On Exit"
msgstr ""
#: platform/android/export/export_plugin.cpp
+#, fuzzy
msgid "Launcher Icons"
-msgstr ""
+msgstr "Значки панелі запуÑку"
#: platform/android/export/export_plugin.cpp
#, fuzzy
@@ -18367,12 +18366,14 @@ msgid "Main 192 X 192"
msgstr "iPhone 120 X 120"
#: platform/android/export/export_plugin.cpp
+#, fuzzy
msgid "Adaptive Foreground 432 X 432"
-msgstr ""
+msgstr "адаптивний передній план 432 x 432"
#: platform/android/export/export_plugin.cpp
+#, fuzzy
msgid "Adaptive Background 432 X 432"
-msgstr ""
+msgstr "адаптивний задній план(фон) 432 x 432"
#: platform/android/export/export_plugin.cpp
msgid "Package name is missing."
@@ -18447,8 +18448,9 @@ msgid "Release Password"
msgstr "Пароль випуÑку"
#: platform/android/export/export_plugin.cpp
+#, fuzzy
msgid "One Click Deploy"
-msgstr ""
+msgstr "Ð Ð¾Ð·Ð³Ð¾Ñ€Ñ‚Ð°Ð½Ð½Ñ Ð² один клік"
#: platform/android/export/export_plugin.cpp
msgid "Clear Previous Install"
@@ -18729,10 +18731,13 @@ msgid "\"Min SDK\" should be a valid integer, but got \"%s\" which is invalid."
msgstr ""
#: platform/android/export/export_plugin.cpp
+#, fuzzy
msgid ""
"\"Min SDK\" cannot be lower than %d, which is the version needed by the "
"Godot library."
msgstr ""
+"\"Min SDK\" не може бути нижчим за %d, що Ñ” верÑією, необхідною Ð´Ð»Ñ "
+"бібліотеки Godot."
#: platform/android/export/export_plugin.cpp
#, fuzzy
@@ -18743,15 +18748,20 @@ msgstr ""
"збираннÑ»."
#: platform/android/export/export_plugin.cpp
+#, fuzzy
msgid ""
"\"Target SDK\" should be a valid integer, but got \"%s\" which is invalid."
msgstr ""
+"\"Target SDK\" має бути дійÑним цілим чиÑлом, але отримано \"%s\", Ñке не Ñ” "
+"дійÑним."
#: platform/android/export/export_plugin.cpp
msgid ""
"\"Target SDK\" %d is higher than the default version %d. This may work, but "
"wasn't tested and may be unstable."
msgstr ""
+"\"Target SDK\" %d вищий за Ñтандартну верÑÑ–ÑŽ %d. Це може працювати, але це "
+"не було перевірено та може бути неÑтабільним."
#: platform/android/export/export_plugin.cpp
#, fuzzy
@@ -18930,8 +18940,9 @@ msgid "The character '%s' is not allowed in Identifier."
msgstr "У назві ідентифікатора не можна викориÑтовувати Ñимволи «%s»."
#: platform/iphone/export/export.cpp
+#, fuzzy
msgid "Landscape Launch Screens"
-msgstr ""
+msgstr "Ðльбомні екрани запуÑку"
#: platform/iphone/export/export.cpp
#, fuzzy
@@ -18954,8 +18965,9 @@ msgid "iPad 2048 X 1536"
msgstr "iPad 152 X 152"
#: platform/iphone/export/export.cpp
+#, fuzzy
msgid "Portrait Launch Screens"
-msgstr ""
+msgstr "Портретні початкові екрани"
#: platform/iphone/export/export.cpp
#, fuzzy
@@ -18994,15 +19006,16 @@ msgstr "iPhone 120 X 120"
#: platform/iphone/export/export.cpp
msgid "App Store Team ID"
-msgstr ""
+msgstr "Ідентифікатор команди App Store"
#: platform/iphone/export/export.cpp
+#, fuzzy
msgid "Provisioning Profile UUID Debug"
-msgstr ""
+msgstr "ÐÐ°Ð»Ð°Ð³Ð¾Ð´Ð¶ÐµÐ½Ð½Ñ Ð¿Ñ€Ð¾Ñ„Ñ–Ð»ÑŽ UUID"
#: platform/iphone/export/export.cpp
msgid "Code Sign Identity Debug"
-msgstr ""
+msgstr "ÐÐ°Ð»Ð°Ð³Ð¾Ð´Ð¶ÐµÐ½Ð½Ñ Ñ–Ð´ÐµÐ½Ñ‚Ð¸Ñ„Ñ–ÐºÐ°Ñ†Ñ–Ñ— коду"
#: platform/iphone/export/export.cpp
msgid "Export Method Debug"
diff --git a/editor/translations/ur_PK.po b/editor/translations/ur_PK.po
index 1046f11996..bc15a001c9 100644
--- a/editor/translations/ur_PK.po
+++ b/editor/translations/ur_PK.po
@@ -10936,7 +10936,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/vi.po b/editor/translations/vi.po
index b4a5f4494b..0ff37e659e 100644
--- a/editor/translations/vi.po
+++ b/editor/translations/vi.po
@@ -11119,7 +11119,7 @@ msgstr "Phối cảnh"
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/zh_CN.po b/editor/translations/zh_CN.po
index 52f072e946..5b58752f63 100644
--- a/editor/translations/zh_CN.po
+++ b/editor/translations/zh_CN.po
@@ -92,7 +92,7 @@ msgstr ""
"Project-Id-Version: Chinese (Simplified) (Godot Engine)\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: 2018-01-20 12:15+0200\n"
-"PO-Revision-Date: 2022-12-05 08:51+0000\n"
+"PO-Revision-Date: 2022-12-28 00:54+0000\n"
"Last-Translator: Haoyu Qiu <timothyqiu32@gmail.com>\n"
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
"godot-engine/godot/zh_Hans/>\n"
@@ -101,7 +101,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 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -145,15 +145,15 @@ msgstr "å±å¹•常亮"
#: core/bind/core_bind.cpp
msgid "Min Window Size"
-msgstr "最å°çª—å£å¤§å°"
+msgstr "最å°çª—å£å°ºå¯¸"
#: core/bind/core_bind.cpp
msgid "Max Window Size"
-msgstr "最大窗å£å¤§å°"
+msgstr "最大窗å£å°ºå¯¸"
#: core/bind/core_bind.cpp
msgid "Screen Orientation"
-msgstr "çª—å£æœå‘"
+msgstr "å±å¹•æœå‘"
#: core/bind/core_bind.cpp core/project_settings.cpp main/main.cpp
#: platform/uwp/os_uwp.cpp
@@ -1097,7 +1097,7 @@ msgstr "æƒé‡é‡‡æ ·"
#: drivers/gles3/rasterizer_scene_gles3.cpp
msgid "Voxel Cone Tracing"
-msgstr "体素椎追踪"
+msgstr "体素锥追踪"
#: drivers/gles3/rasterizer_scene_gles3.cpp scene/resources/environment.cpp
msgid "High Quality"
@@ -5843,7 +5843,7 @@ msgstr "骨骼轮廓颜色"
#: editor/editor_settings.cpp
msgid "Viewport Border Color"
-msgstr "视区边框颜色"
+msgstr "视å£è¾¹æ¡†é¢œè‰²"
#: editor/editor_settings.cpp
msgid "Constrain Editor View"
@@ -8685,7 +8685,7 @@ msgid ""
"Overrides the running project's camera with the editor viewport camera."
msgstr ""
"项目相机覆盖\n"
-"使用编辑器视图相机覆盖正在è¿è¡Œçš„项目中的相机。"
+"使用编辑器视å£ç›¸æœºè¦†ç›–正在è¿è¡Œçš„项目中的相机。"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -10819,7 +10819,7 @@ msgstr "é€è§†åŽè§†å›¾"
msgid " [auto]"
msgstr " [自动]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [å…¥å£ç”Ÿæ•ˆ]"
@@ -11203,27 +11203,27 @@ msgstr "å˜æ¢å¯¹è¯æ¡†..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
-msgstr "1 个视窗"
+msgstr "1 个视å£"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "2 Viewports"
-msgstr "2 个视窗"
+msgstr "2 个视å£"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "2 Viewports (Alt)"
-msgstr "2 个视窗(备选)"
+msgstr "2 个视å£ï¼ˆå¤‡é€‰ï¼‰"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "3 Viewports"
-msgstr "3 个视窗"
+msgstr "3 个视å£"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "3 Viewports (Alt)"
-msgstr "3 个视窗(备选)"
+msgstr "3 个视å£ï¼ˆå¤‡é€‰ï¼‰"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "4 Viewports"
-msgstr "4 个视窗"
+msgstr "4 个视å£"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Gizmos"
@@ -11320,7 +11320,7 @@ msgstr "æ“作å°å·¥å…·ä¸é€æ˜Žåº¦"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Show Viewport Rotation Gizmo"
-msgstr "显示视区旋转å°å·¥å…·"
+msgstr "æ˜¾ç¤ºè§†å£æ—‹è½¬å°å·¥å…·"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Unnamed Gizmo"
@@ -14010,16 +14010,13 @@ msgid "Invalid project path (changed anything?)."
msgstr "项目路径无效(被外部修改?)。"
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project at '%s' (error %d). It may be missing or corrupted."
-msgstr ""
-"无法在项目路径中加载 project.godot 文件(错误 %d)。该文件å¯èƒ½ç¼ºå¤±æˆ–å·²æŸå。"
+msgstr "无法加载ä½äºŽâ€œ%sâ€çš„项目(错误 %d)。项目å¯èƒ½ç¼ºå¤±æˆ–å·²æŸå。"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Couldn't save project at '%s' (error %d)."
-msgstr "无法打开ä½äºŽâ€œ%sâ€çš„项目。"
+msgstr "无法ä¿å­˜ä½äºŽâ€œ%sâ€çš„项目(错误 %d)。"
#: editor/project_manager.cpp
msgid "Couldn't create project.godot in project path."
@@ -14934,7 +14931,7 @@ msgstr "将节点设置为根节点"
#: editor/scene_tree_dock.cpp
msgid "Delete %d nodes and any children?"
-msgstr "是å¦åˆ é™¤èŠ‚ç‚¹ “%s†åŠå…¶å­èŠ‚ç‚¹ï¼Ÿ"
+msgstr "是å¦åˆ é™¤ %d 个节点åŠå…¶å­èŠ‚ç‚¹ï¼Ÿ"
#: editor/scene_tree_dock.cpp
msgid "Delete %d nodes?"
@@ -19971,7 +19968,7 @@ msgstr "缩放"
#: scene/2d/camera_2d.cpp scene/main/canvas_layer.cpp
msgid "Custom Viewport"
-msgstr "自定义视区"
+msgstr "自定义视å£"
#: scene/2d/camera_2d.cpp scene/3d/camera.cpp scene/3d/interpolated_camera.cpp
#: scene/animation/animation_player.cpp scene/animation/animation_tree.cpp
@@ -22699,14 +22696,12 @@ msgid "AABB"
msgstr "AABB"
#: scene/3d/visual_instance.cpp
-#, fuzzy
msgid "Sorting"
msgstr "排åº"
#: scene/3d/visual_instance.cpp
-#, fuzzy
msgid "Use AABB Center"
-msgstr "使用环境光"
+msgstr "使用 AABB 中心"
#: scene/3d/visual_instance.cpp scene/resources/navigation_mesh.cpp
msgid "Geometry"
@@ -23869,7 +23864,7 @@ msgstr "拉伸收缩"
#: scene/main/canvas_layer.cpp
msgid "Follow Viewport"
-msgstr "è·Ÿéšè§†åŒº"
+msgstr "è·Ÿéšè§†å£"
#: scene/main/http_request.cpp
msgid "Download File"
diff --git a/editor/translations/zh_HK.po b/editor/translations/zh_HK.po
index 8af64cfc4e..80c7658ff9 100644
--- a/editor/translations/zh_HK.po
+++ b/editor/translations/zh_HK.po
@@ -11433,7 +11433,7 @@ msgstr ""
msgid " [auto]"
msgstr ""
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr ""
diff --git a/editor/translations/zh_TW.po b/editor/translations/zh_TW.po
index dd54885310..4d04c45976 100644
--- a/editor/translations/zh_TW.po
+++ b/editor/translations/zh_TW.po
@@ -38,13 +38,14 @@
# Shi-Xun Hong <jimmy3421@gmail.com>, 2022.
# Hugel <qihu@nfschina.com>, 2022.
# nitenook <admin@alterbaum.net>, 2022.
+# Edison Lee <edisonlee@edisonlee55.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2022-10-16 07:25+0000\n"
-"Last-Translator: BinotaLIU <me@binota.org>\n"
+"PO-Revision-Date: 2023-01-14 10:06+0000\n"
+"Last-Translator: Edison Lee <edisonlee@edisonlee55.com>\n"
"Language-Team: Chinese (Traditional) <https://hosted.weblate.org/projects/"
"godot-engine/godot/zh_Hant/>\n"
"Language: zh_TW\n"
@@ -52,7 +53,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 4.15-dev\n"
+"X-Generator: Weblate 4.15.1-dev\n"
#: core/bind/core_bind.cpp main/main.cpp
msgid "Tablet Driver"
@@ -1154,7 +1155,7 @@ msgstr "旋轉"
#: editor/animation_track_editor.cpp editor/script_editor_debugger.cpp
#: modules/visual_script/visual_script_nodes.cpp scene/gui/range.cpp
msgid "Value"
-msgstr "數值"
+msgstr "值"
#: editor/animation_track_editor.cpp
msgid "Arg Count"
@@ -10771,7 +10772,7 @@ msgstr "é€è¦–後視圖"
msgid " [auto]"
msgstr " [自動]"
-#. TRANSLATORS: This will be appended to the view name when Portal Occulusion is enabled.
+#. TRANSLATORS: This will be appended to the view name when Portal Occlusion is enabled.
#: editor/plugins/spatial_editor_plugin.cpp
msgid " [portals active]"
msgstr " [å…¥å£ç”Ÿæ•ˆ]"
@@ -17787,9 +17788,8 @@ msgid "ShiftRight %s"
msgstr "å°‡ %s å‘å³ç§»å‹•"
#: modules/visual_script/visual_script_func_nodes.cpp
-#, fuzzy
msgid "BitAnd %s"
-msgstr "新增 %"
+msgstr ""
#: modules/visual_script/visual_script_func_nodes.cpp
#, fuzzy
@@ -18557,9 +18557,8 @@ msgstr "「Target Sdkã€ç‰ˆæœ¬å¿…須高於或于「Min Sdkã€ç‰ˆæœ¬ä¸€è‡´ã€‚"
#: platform/android/export/export_plugin.cpp platform/osx/export/export.cpp
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Code Signing"
-msgstr "訊號"
+msgstr "程å¼ç¢¼ç°½ç« "
#: platform/android/export/export_plugin.cpp
msgid ""
@@ -18766,11 +18765,11 @@ msgstr ""
#: platform/iphone/export/export.cpp
msgid "App Store Team ID"
-msgstr ""
+msgstr "App Store 團隊 ID"
#: platform/iphone/export/export.cpp
msgid "Provisioning Profile UUID Debug"
-msgstr ""
+msgstr "部署æè¿°æª” UUID åµéŒ¯"
#: platform/iphone/export/export.cpp
msgid "Code Sign Identity Debug"
@@ -18848,19 +18847,16 @@ msgid "Accessible From iTunes Sharing"
msgstr ""
#: platform/iphone/export/export.cpp platform/osx/export/export.cpp
-#, fuzzy
msgid "Privacy"
-msgstr "實體按éµ"
+msgstr "éš±ç§"
#: platform/iphone/export/export.cpp platform/osx/export/export.cpp
-#, fuzzy
msgid "Camera Usage Description"
-msgstr "說明"
+msgstr "相機使用æè¿°"
#: platform/iphone/export/export.cpp platform/osx/export/export.cpp
-#, fuzzy
msgid "Microphone Usage Description"
-msgstr "屬性說明"
+msgstr "麥克風使用æè¿°"
#: platform/iphone/export/export.cpp
#, fuzzy
@@ -18933,9 +18929,8 @@ msgid "Custom BG Color"
msgstr "剪下節點"
#: platform/iphone/export/export.cpp
-#, fuzzy
msgid "Export Icons"
-msgstr "展開全部"
+msgstr "匯出圖示"
#: platform/iphone/export/export.cpp platform/javascript/export/export.cpp
#: platform/osx/export/export.cpp
@@ -19017,7 +19012,7 @@ msgstr ""
#: platform/javascript/export/export.cpp
msgid "HTML"
-msgstr ""
+msgstr "HTML"
#: platform/javascript/export/export.cpp
#, fuzzy
@@ -19052,7 +19047,7 @@ msgstr ""
#: platform/javascript/export/export.cpp
msgid "Offline Page"
-msgstr ""
+msgstr "離線é é¢"
#: platform/javascript/export/export.cpp
msgid "Icon 144 X 144"
@@ -19084,16 +19079,15 @@ msgstr ""
#: platform/javascript/export/export.cpp
msgid "HTTP Host"
-msgstr ""
+msgstr "HTTP 主機"
#: platform/javascript/export/export.cpp
msgid "HTTP Port"
-msgstr ""
+msgstr "HTTP 連接埠"
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Use SSL"
-msgstr "使用å¸é™„"
+msgstr "使用 SSL"
#: platform/javascript/export/export.cpp
msgid "SSL Key"
@@ -19159,9 +19153,8 @@ msgid "Invalid entitlements file."
msgstr "無效的副檔å。"
#: platform/osx/export/codesign.cpp
-#, fuzzy
msgid "Invalid executable file."
-msgstr "無效的副檔å。"
+msgstr "無效的執行檔。"
#: platform/osx/export/codesign.cpp
msgid "Can't resize signature load command."
@@ -19229,24 +19222,21 @@ msgid "Removable Volumes Usage Description"
msgstr ""
#: platform/osx/export/export.cpp platform/windows/export/export.cpp
-#, fuzzy
msgid "Codesign"
-msgstr "節點"
+msgstr "程å¼ç¢¼ç°½ç« "
#: platform/osx/export/export.cpp platform/uwp/export/export.cpp
#: platform/windows/export/export.cpp
-#, fuzzy
msgid "Identity"
-msgstr "å‘左縮排"
+msgstr "身分"
#: platform/osx/export/export.cpp platform/windows/export/export.cpp
-#, fuzzy
msgid "Timestamp"
-msgstr "時間"
+msgstr "時間戳"
#: platform/osx/export/export.cpp
msgid "Hardened Runtime"
-msgstr ""
+msgstr "Hardened Runtime"
#: platform/osx/export/export.cpp
#, fuzzy
@@ -19259,9 +19249,8 @@ msgid "Entitlements"
msgstr "Gizmo"
#: platform/osx/export/export.cpp
-#, fuzzy
msgid "Custom File"
-msgstr "剪下節點"
+msgstr "自訂檔案"
#: platform/osx/export/export.cpp
msgid "Allow JIT Code Execution"
@@ -19281,75 +19270,64 @@ msgid "Disable Library Validation"
msgstr "å·²åœç”¨çš„æŒ‰éˆ•"
#: platform/osx/export/export.cpp
-#, fuzzy
msgid "Audio Input"
-msgstr "新增輸入"
+msgstr "音æºè¼¸å…¥"
#: platform/osx/export/export.cpp
msgid "Address Book"
-msgstr ""
+msgstr "地å€ç°¿"
#: platform/osx/export/export.cpp
msgid "Calendars"
-msgstr ""
+msgstr "日曆"
#: platform/osx/export/export.cpp
-#, fuzzy
msgid "Photos Library"
-msgstr "匯出函å¼åº«"
+msgstr "照片圖庫"
#: platform/osx/export/export.cpp
-#, fuzzy
msgid "Apple Events"
-msgstr "新增事件"
+msgstr "Apple 活動"
#: platform/osx/export/export.cpp
-#, fuzzy
msgid "Debugging"
msgstr "åµéŒ¯"
#: platform/osx/export/export.cpp
msgid "App Sandbox"
-msgstr ""
+msgstr "æ‡‰ç”¨ç¨‹å¼æ²™ç›’"
#: platform/osx/export/export.cpp
-#, fuzzy
msgid "Network Server"
-msgstr "網路分æžå·¥å…·"
+msgstr "網路伺æœå™¨"
#: platform/osx/export/export.cpp
-#, fuzzy
msgid "Network Client"
-msgstr "網路分æžå·¥å…·"
+msgstr "網路客戶端"
#: platform/osx/export/export.cpp
-#, fuzzy
msgid "Device USB"
-msgstr "è£ç½®"
+msgstr "è£ç½® USB"
#: platform/osx/export/export.cpp
msgid "Device Bluetooth"
-msgstr ""
+msgstr "è£ç½®è—芽"
#: platform/osx/export/export.cpp
-#, fuzzy
msgid "Files Downloads"
-msgstr "下載"
+msgstr "檔案下載"
#: platform/osx/export/export.cpp
-#, fuzzy
msgid "Files Pictures"
-msgstr "功能"
+msgstr "檔案圖片"
#: platform/osx/export/export.cpp
-#, fuzzy
msgid "Files Music"
-msgstr "檔案"
+msgstr "檔案音樂"
#: platform/osx/export/export.cpp
-#, fuzzy
msgid "Files Movies"
-msgstr "篩é¸åœ–塊"
+msgstr "檔案影片"
#: platform/osx/export/export.cpp platform/windows/export/export.cpp
#, fuzzy
@@ -19362,15 +19340,15 @@ msgstr "公證"
#: platform/osx/export/export.cpp
msgid "Apple ID Name"
-msgstr ""
+msgstr "Apple ID å稱"
#: platform/osx/export/export.cpp
msgid "Apple ID Password"
-msgstr ""
+msgstr "Apple ID 密碼"
#: platform/osx/export/export.cpp
msgid "Apple Team ID"
-msgstr ""
+msgstr "Apple 團隊 ID"
#: platform/osx/export/export.cpp
msgid "Could not open icon file \"%s\"."
@@ -20004,7 +19982,7 @@ msgstr ""
#: platform/windows/export/export.cpp
msgid "Wine"
-msgstr ""
+msgstr "Wine"
#: platform/x11/export/export.cpp
msgid "32-bit executables cannot have embedded data >= 4 GiB."
@@ -27006,7 +26984,7 @@ msgstr "æ··åˆ (Mix)"
#: servers/audio/effects/audio_effect_compressor.cpp
msgid "Sidechain"
-msgstr ""
+msgstr "å´éˆ"
#: servers/audio/effects/audio_effect_delay.cpp
msgid "Tap 1"
diff --git a/main/main.cpp b/main/main.cpp
index e5d2ea3922..c5a9f94417 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -185,6 +185,7 @@ static bool init_maximized = false;
static bool init_windowed = false;
static bool init_always_on_top = false;
static bool init_use_custom_pos = false;
+static bool init_use_custom_screen = false;
static Vector2 init_custom_pos;
// Debug
@@ -207,6 +208,11 @@ static bool dump_extension_api = false;
#endif
bool profile_gpu = false;
+// Constants.
+
+static const String NULL_DISPLAY_DRIVER("headless");
+static const String NULL_AUDIO_DRIVER("Dummy");
+
/* Helper methods */
bool Main::is_cmdline_tool() {
@@ -523,7 +529,11 @@ Error Main::test_setup() {
}
}
if (text_driver_idx >= 0) {
- TextServerManager::get_singleton()->set_primary_interface(TextServerManager::get_singleton()->get_interface(text_driver_idx));
+ Ref<TextServer> ts = TextServerManager::get_singleton()->get_interface(text_driver_idx);
+ TextServerManager::get_singleton()->set_primary_interface(ts);
+ if (ts->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA)) {
+ ts->load_support_data("res://" + ts->get_support_data_filename());
+ }
} else {
ERR_FAIL_V_MSG(ERR_CANT_CREATE, "TextServer: Unable to create TextServer interface.");
}
@@ -964,6 +974,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (I->next()) {
init_screen = I->next()->get().to_int();
+ init_use_custom_screen = true;
N = I->next()->next();
} else {
@@ -997,8 +1008,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--headless") { // enable headless mode (no audio, no rendering).
- audio_driver = "Dummy";
- display_driver = "headless";
+ audio_driver = NULL_AUDIO_DRIVER;
+ display_driver = NULL_DISPLAY_DRIVER;
} else if (I->get() == "--profiling") { // enable profiling
@@ -1133,8 +1144,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
// `--doctool` implies `--headless` to avoid spawning an unnecessary window
// and speed up class reference generation.
- audio_driver = "Dummy";
- display_driver = "headless";
+ audio_driver = NULL_AUDIO_DRIVER;
+ display_driver = NULL_DISPLAY_DRIVER;
main_args.push_back(I->get());
#endif
} else if (I->get() == "--path") { // set path of project to start or edit
@@ -1371,6 +1382,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
ResourceUID::get_singleton()->load_from_cache(); // load UUIDs from cache.
+ if (ProjectSettings::get_singleton()->has_custom_feature("dedicated_server")) {
+ audio_driver = NULL_AUDIO_DRIVER;
+ display_driver = NULL_DISPLAY_DRIVER;
+ }
+
GLOBAL_DEF(PropertyInfo(Variant::INT, "network/limits/debugger/max_chars_per_second", PROPERTY_HINT_RANGE, "0, 4096, 1, or_greater"), 32768);
GLOBAL_DEF(PropertyInfo(Variant::INT, "network/limits/debugger/max_queued_messages", PROPERTY_HINT_RANGE, "0, 8192, 1, or_greater"), 2048);
GLOBAL_DEF(PropertyInfo(Variant::INT, "network/limits/debugger/max_errors_per_second", PROPERTY_HINT_RANGE, "0, 200, 1, or_greater"), 400);
@@ -1669,7 +1685,23 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
window_flags |= DisplayServer::WINDOW_FLAG_NO_FOCUS_BIT;
}
window_mode = (DisplayServer::WindowMode)(GLOBAL_GET("display/window/size/mode").operator int());
- init_screen = GLOBAL_GET("display/window/size/initial_screen").operator int();
+ int initial_position_type = GLOBAL_GET("display/window/size/initial_position_type").operator int();
+ if (initial_position_type == 0) {
+ if (!init_use_custom_pos) {
+ init_custom_pos = GLOBAL_GET("display/window/size/initial_position").operator Vector2i();
+ init_use_custom_pos = true;
+ }
+ } else if (initial_position_type == 1) {
+ if (!init_use_custom_screen) {
+ init_screen = DisplayServer::SCREEN_PRIMARY;
+ init_use_custom_screen = true;
+ }
+ } else if (initial_position_type == 2) {
+ if (!init_use_custom_screen) {
+ init_screen = GLOBAL_GET("display/window/size/initial_screen").operator int();
+ init_use_custom_screen = true;
+ }
+ }
}
GLOBAL_DEF("internationalization/locale/include_text_server_data", false);
@@ -1708,7 +1740,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
// Display driver, e.g. X11, Wayland.
// Make sure that headless is the last one, which it is assumed to be by design.
- DEV_ASSERT(String("headless") == DisplayServer::get_create_function_name(DisplayServer::get_create_function_count() - 1));
+ DEV_ASSERT(NULL_DISPLAY_DRIVER == DisplayServer::get_create_function_name(DisplayServer::get_create_function_count() - 1));
for (int i = 0; i < DisplayServer::get_create_function_count(); i++) {
String name = DisplayServer::get_create_function_name(i);
if (display_driver == name) {
@@ -1733,7 +1765,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
// Make sure that dummy is the last one, which it is assumed to be by design.
- DEV_ASSERT(String("Dummy") == AudioDriverManager::get_driver(AudioDriverManager::get_driver_count() - 1)->get_name());
+ DEV_ASSERT(NULL_AUDIO_DRIVER == AudioDriverManager::get_driver(AudioDriverManager::get_driver_count() - 1)->get_name());
for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) {
if (audio_driver == AudioDriverManager::get_driver(i)->get_name()) {
audio_driver_idx = i;
@@ -2147,7 +2179,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
if (id) {
agile_input_event_flushing = GLOBAL_DEF("input_devices/buffering/agile_event_flushing", false);
- if (bool(GLOBAL_DEF("input_devices/pointing/emulate_touch_from_mouse", false)) &&
+ if (bool(GLOBAL_DEF_BASIC("input_devices/pointing/emulate_touch_from_mouse", false)) &&
!(editor || project_manager)) {
if (!DisplayServer::get_singleton()->is_touchscreen_available()) {
//only if no touchscreen ui hint, set emulation
@@ -2155,7 +2187,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
}
}
- id->set_emulate_mouse_from_touch(bool(GLOBAL_DEF("input_devices/pointing/emulate_mouse_from_touch", true)));
+ id->set_emulate_mouse_from_touch(bool(GLOBAL_DEF_BASIC("input_devices/pointing/emulate_mouse_from_touch", true)));
}
MAIN_PRINT("Main: Load Translations and Remaps");
@@ -2220,7 +2252,11 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
}
}
if (text_driver_idx >= 0) {
- TextServerManager::get_singleton()->set_primary_interface(TextServerManager::get_singleton()->get_interface(text_driver_idx));
+ Ref<TextServer> ts = TextServerManager::get_singleton()->get_interface(text_driver_idx);
+ TextServerManager::get_singleton()->set_primary_interface(ts);
+ if (ts->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA)) {
+ ts->load_support_data("res://" + ts->get_support_data_filename());
+ }
} else {
ERR_FAIL_V_MSG(ERR_CANT_CREATE, "TextServer: Unable to create TextServer interface.");
}
@@ -2431,6 +2467,14 @@ bool Main::start() {
ERR_FAIL_COND_V_MSG(da.is_null(), false, "Argument supplied to --doctool must be a valid directory path.");
}
+#ifndef MODULE_MONO_ENABLED
+ // Hack to define .NET-specific project settings even on non-.NET builds,
+ // so that we don't lose their descriptions and default values in DocTools.
+ // Default values should be synced with mono_gd/gd_mono.cpp.
+ GLOBAL_DEF("dotnet/project/assembly_name", "");
+ GLOBAL_DEF("dotnet/project/solution_directory", "");
+#endif
+
Error err;
DocTools doc;
doc.generate(doc_base);
@@ -3167,10 +3211,12 @@ bool Main::iteration() {
auto_build_solutions = false;
// Only relevant when running the editor.
if (!editor) {
+ OS::get_singleton()->set_exit_code(EXIT_FAILURE);
ERR_FAIL_V_MSG(true,
"Command line option --build-solutions was passed, but no project is being edited. Aborting.");
}
if (!EditorNode::get_singleton()->call_build()) {
+ OS::get_singleton()->set_exit_code(EXIT_FAILURE);
ERR_FAIL_V_MSG(true,
"Command line option --build-solutions was passed, but the build callback failed. Aborting.");
}
diff --git a/misc/scripts/codespell.sh b/misc/scripts/codespell.sh
index c00d897666..44084b3348 100755
--- a/misc/scripts/codespell.sh
+++ b/misc/scripts/codespell.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-SKIP_LIST="./.git,./bin,./thirdparty,*.gen.*,*.po,*.pot,package-lock.json,./core/string/locales.h,./DONORS.md,./misc/dist/linux/org.godotengine.Godot.desktop,./misc/scripts/codespell.sh"
+SKIP_LIST="./.*,./bin,./editor/project_converter_3_to_4.cpp,./platform/web/node_modules,./platform/android/java/lib/src/com,./thirdparty,*.gen.*,*.po,*.pot,*.rc,package-lock.json,./core/string/locales.h,./AUTHORS.md,./COPYRIGHT.txt,./DONORS.md,./misc/dist/linux/org.godotengine.Godot.desktop,./misc/scripts/codespell.sh"
IGNORE_LIST="alo,ba,childs,complies,curvelinear,doubleclick,expct,fave,findn,gird,gud,inout,lod,nd,numer,ois,readded,ro,sav,statics,te,varius,varn,wan"
-codespell -w -q 3 -S "${SKIP_LIST}" -L "${IGNORE_LIST}"
+codespell -w -q 3 -S "${SKIP_LIST}" -L "${IGNORE_LIST}" --builtin "clear,rare,en-GB_to_en-US"
diff --git a/modules/astcenc/SCsub b/modules/astcenc/SCsub
new file mode 100644
index 0000000000..0f04f2bc28
--- /dev/null
+++ b/modules/astcenc/SCsub
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+
+Import("env")
+Import("env_modules")
+
+env_astcenc = env_modules.Clone()
+
+# Thirdparty source files
+
+thirdparty_obj = []
+
+thirdparty_dir = "#thirdparty/astcenc/"
+thirdparty_sources = [
+ "astcenc_averages_and_directions.cpp",
+ "astcenc_block_sizes.cpp",
+ "astcenc_color_quantize.cpp",
+ "astcenc_color_unquantize.cpp",
+ "astcenc_compress_symbolic.cpp",
+ "astcenc_compute_variance.cpp",
+ "astcenc_decompress_symbolic.cpp",
+ "astcenc_diagnostic_trace.cpp",
+ "astcenc_entry.cpp",
+ "astcenc_find_best_partitioning.cpp",
+ "astcenc_ideal_endpoints_and_weights.cpp",
+ "astcenc_image.cpp",
+ "astcenc_integer_sequence.cpp",
+ "astcenc_mathlib.cpp",
+ "astcenc_mathlib_softfloat.cpp",
+ "astcenc_partition_tables.cpp",
+ "astcenc_percentile_tables.cpp",
+ "astcenc_pick_best_endpoint_format.cpp",
+ "astcenc_platform_isa_detection.cpp",
+ "astcenc_quantization.cpp",
+ "astcenc_symbolic_physical.cpp",
+ "astcenc_weight_align.cpp",
+ "astcenc_weight_quant_xfer_tables.cpp",
+]
+thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+env_astcenc.Prepend(CPPPATH=[thirdparty_dir])
+
+env_thirdparty = env_astcenc.Clone()
+env_thirdparty.disable_warnings()
+env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
+env.modules_sources += thirdparty_obj
+
+# Godot source files
+
+module_obj = []
+
+env_astcenc.add_source_files(module_obj, "*.cpp")
+env.modules_sources += module_obj
+
+# Needed to force rebuilding the module files when the thirdparty library is updated.
+env.Depends(module_obj, thirdparty_obj)
diff --git a/modules/astcenc/config.py b/modules/astcenc/config.py
new file mode 100644
index 0000000000..eb565b85b9
--- /dev/null
+++ b/modules/astcenc/config.py
@@ -0,0 +1,6 @@
+def can_build(env, platform):
+ return env.editor_build
+
+
+def configure(env):
+ pass
diff --git a/modules/astcenc/image_compress_astcenc.cpp b/modules/astcenc/image_compress_astcenc.cpp
new file mode 100644
index 0000000000..1c643d780d
--- /dev/null
+++ b/modules/astcenc/image_compress_astcenc.cpp
@@ -0,0 +1,290 @@
+/**************************************************************************/
+/* image_compress_astcenc.cpp */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 "image_compress_astcenc.h"
+
+#include "core/os/os.h"
+#include "core/string/print_string.h"
+
+#include <astcenc.h>
+
+void _compress_astc(Image *r_img, Image::ASTCFormat p_format) {
+ uint64_t start_time = OS::get_singleton()->get_ticks_msec();
+
+ // TODO: See how to handle lossy quality.
+
+ Image::Format img_format = r_img->get_format();
+ if (img_format >= Image::FORMAT_DXT1) {
+ return; // Do not compress, already compressed.
+ }
+
+ bool is_hdr = false;
+ if ((img_format >= Image::FORMAT_RH) && (img_format <= Image::FORMAT_RGBE9995)) {
+ is_hdr = true;
+ r_img->convert(Image::FORMAT_RGBAF);
+ } else {
+ r_img->convert(Image::FORMAT_RGBA8);
+ }
+
+ // Determine encoder output format from our enum.
+
+ Image::Format target_format = Image::FORMAT_RGBA8;
+ astcenc_profile profile = ASTCENC_PRF_LDR;
+ unsigned int block_x = 4;
+ unsigned int block_y = 4;
+
+ if (p_format == Image::ASTCFormat::ASTC_FORMAT_4x4) {
+ if (is_hdr) {
+ target_format = Image::FORMAT_ASTC_4x4_HDR;
+ profile = ASTCENC_PRF_HDR;
+ } else {
+ target_format = Image::FORMAT_ASTC_4x4;
+ }
+ } else if (p_format == Image::ASTCFormat::ASTC_FORMAT_8x8) {
+ if (is_hdr) {
+ target_format = Image::FORMAT_ASTC_8x8_HDR;
+ profile = ASTCENC_PRF_HDR;
+ } else {
+ target_format = Image::FORMAT_ASTC_8x8;
+ }
+ block_x = 8;
+ block_y = 8;
+ }
+
+ // Compress image data and (if required) mipmaps.
+
+ const bool mipmaps = r_img->has_mipmaps();
+ int width = r_img->get_width();
+ int height = r_img->get_height();
+ int required_width = (width % block_x) != 0 ? width + (block_x - (width % block_x)) : width;
+ int required_height = (height % block_y) != 0 ? height + (block_y - (height % block_y)) : height;
+
+ if (width != required_width || height != required_height) {
+ // Resize texture to fit block size.
+ r_img->resize(required_width, required_height);
+ width = required_width;
+ height = required_height;
+ }
+
+ print_verbose(vformat("astcenc: Encoding image size %dx%d to format %s%s.", width, height, Image::get_format_name(target_format), mipmaps ? ", with mipmaps" : ""));
+
+ // Initialize astcenc.
+
+ int dest_size = Image::get_image_data_size(width, height, target_format, mipmaps);
+ Vector<uint8_t> dest_data;
+ dest_data.resize(dest_size);
+ uint8_t *dest_write = dest_data.ptrw();
+
+ astcenc_config config;
+ config.block_x = block_x;
+ config.block_y = block_y;
+ config.profile = profile;
+
+ const float quality = ASTCENC_PRE_MEDIUM;
+ astcenc_error status = astcenc_config_init(profile, block_x, block_y, 1, quality, 0, &config);
+ ERR_FAIL_COND_MSG(status != ASTCENC_SUCCESS,
+ vformat("astcenc: Configuration initialization failed: %s.", astcenc_get_error_string(status)));
+
+ // Context allocation.
+
+ astcenc_context *context;
+ const unsigned int thread_count = 1; // Godot compresses multiple images each on a thread, which is more efficient for large amount of images imported.
+ status = astcenc_context_alloc(&config, thread_count, &context);
+ ERR_FAIL_COND_MSG(status != ASTCENC_SUCCESS,
+ vformat("astcenc: Context allocation failed: %s.", astcenc_get_error_string(status)));
+
+ Vector<uint8_t> image_data = r_img->get_data();
+
+ int mip_count = mipmaps ? Image::get_image_required_mipmaps(width, height, target_format) : 0;
+ for (int i = 0; i < mip_count + 1; i++) {
+ int src_mip_w, src_mip_h;
+ int src_ofs = Image::get_image_mipmap_offset_and_dimensions(width, height, r_img->get_format(), i, src_mip_w, src_mip_h);
+
+ const uint8_t *slices = &image_data.ptr()[src_ofs];
+
+ int dst_mip_w, dst_mip_h;
+ int dst_ofs = Image::get_image_mipmap_offset_and_dimensions(width, height, target_format, i, dst_mip_w, dst_mip_h);
+ // Ensure that mip offset is a multiple of 8 (etcpak expects uint64_t pointer).
+ ERR_FAIL_COND(dst_ofs % 8 != 0);
+ uint8_t *dest_mip_write = (uint8_t *)&dest_write[dst_ofs];
+
+ // Compress image.
+
+ astcenc_image image;
+ image.dim_x = src_mip_w;
+ image.dim_y = src_mip_h;
+ image.dim_z = 1;
+ image.data_type = ASTCENC_TYPE_U8;
+ if (is_hdr) {
+ image.data_type = ASTCENC_TYPE_F32;
+ }
+ image.data = (void **)(&slices);
+
+ // Compute the number of ASTC blocks in each dimension.
+ unsigned int block_count_x = (src_mip_w + block_x - 1) / block_x;
+ unsigned int block_count_y = (src_mip_h + block_y - 1) / block_y;
+ size_t comp_len = block_count_x * block_count_y * 16;
+
+ const astcenc_swizzle swizzle = {
+ ASTCENC_SWZ_R, ASTCENC_SWZ_G, ASTCENC_SWZ_B, ASTCENC_SWZ_A
+ };
+
+ status = astcenc_compress_image(context, &image, &swizzle, dest_mip_write, comp_len, 0);
+
+ ERR_BREAK_MSG(status != ASTCENC_SUCCESS,
+ vformat("astcenc: ASTC image compression failed: %s.", astcenc_get_error_string(status)));
+ astcenc_compress_reset(context);
+ }
+
+ astcenc_context_free(context);
+
+ // Replace original image with compressed one.
+
+ r_img->set_data(width, height, mipmaps, target_format, dest_data);
+
+ print_verbose(vformat("astcenc: Encoding took %s ms.", rtos(OS::get_singleton()->get_ticks_msec() - start_time)));
+}
+
+void _decompress_astc(Image *r_img) {
+ uint64_t start_time = OS::get_singleton()->get_ticks_msec();
+
+ // Determine decompression parameters from image format.
+
+ Image::Format img_format = r_img->get_format();
+ bool is_hdr = false;
+ unsigned int block_x = 0;
+ unsigned int block_y = 0;
+ if (img_format == Image::FORMAT_ASTC_4x4) {
+ block_x = 4;
+ block_y = 4;
+ is_hdr = false;
+ } else if (img_format == Image::FORMAT_ASTC_4x4_HDR) {
+ block_x = 4;
+ block_y = 4;
+ is_hdr = true;
+ } else if (img_format == Image::FORMAT_ASTC_8x8) {
+ block_x = 8;
+ block_y = 8;
+ is_hdr = false;
+ } else if (img_format == Image::FORMAT_ASTC_8x8_HDR) {
+ block_x = 8;
+ block_y = 8;
+ is_hdr = true;
+ } else {
+ ERR_FAIL_MSG("astcenc: Cannot decompress Image with a non-ASTC format.");
+ }
+
+ // Initialize astcenc.
+
+ astcenc_profile profile = ASTCENC_PRF_LDR;
+ if (is_hdr) {
+ profile = ASTCENC_PRF_HDR;
+ }
+ astcenc_config config;
+ const float quality = ASTCENC_PRE_MEDIUM;
+
+ astcenc_error status = astcenc_config_init(profile, block_x, block_y, 1, quality, 0, &config);
+ ERR_FAIL_COND_MSG(status != ASTCENC_SUCCESS,
+ vformat("astcenc: Configuration initialization failed: %s.", astcenc_get_error_string(status)));
+
+ // Context allocation.
+
+ astcenc_context *context = nullptr;
+ const unsigned int thread_count = 1;
+
+ status = astcenc_context_alloc(&config, thread_count, &context);
+ ERR_FAIL_COND_MSG(status != ASTCENC_SUCCESS,
+ vformat("astcenc: Context allocation failed: %s.", astcenc_get_error_string(status)));
+
+ Image::Format target_format = is_hdr ? Image::FORMAT_RGBAF : Image::FORMAT_RGBA8;
+
+ const bool mipmaps = r_img->has_mipmaps();
+ int width = r_img->get_width();
+ int height = r_img->get_height();
+ int dest_size = Image::get_image_data_size(width, height, target_format, mipmaps);
+ Vector<uint8_t> dest_data;
+ dest_data.resize(dest_size);
+ uint8_t *dest_write = dest_data.ptrw();
+
+ // Decompress image.
+
+ Vector<uint8_t> image_data = r_img->get_data();
+ int mip_count = mipmaps ? Image::get_image_required_mipmaps(width, height, target_format) : 0;
+
+ for (int i = 0; i < mip_count + 1; i++) {
+ int src_mip_w, src_mip_h;
+
+ int src_ofs = Image::get_image_mipmap_offset_and_dimensions(width, height, r_img->get_format(), i, src_mip_w, src_mip_h);
+ const uint8_t *src_data = &image_data.ptr()[src_ofs];
+ int src_size;
+ if (i == mip_count) {
+ src_size = image_data.size() - src_ofs;
+ } else {
+ int auxw, auxh;
+ src_size = Image::get_image_mipmap_offset_and_dimensions(width, height, r_img->get_format(), i + 1, auxw, auxh) - src_ofs;
+ }
+
+ int dst_mip_w, dst_mip_h;
+ int dst_ofs = Image::get_image_mipmap_offset_and_dimensions(width, height, target_format, i, dst_mip_w, dst_mip_h);
+ // Ensure that mip offset is a multiple of 8 (etcpak expects uint64_t pointer).
+ ERR_FAIL_COND(dst_ofs % 8 != 0);
+ uint8_t *dest_mip_write = (uint8_t *)&dest_write[dst_ofs];
+
+ astcenc_image image;
+ image.dim_x = dst_mip_w;
+ image.dim_y = dst_mip_h;
+ image.dim_z = 1;
+ image.data_type = ASTCENC_TYPE_U8;
+ if (is_hdr) {
+ target_format = Image::FORMAT_RGBAF;
+ image.data_type = ASTCENC_TYPE_F32;
+ }
+
+ image.data = (void **)(&dest_mip_write);
+
+ const astcenc_swizzle swizzle = {
+ ASTCENC_SWZ_R, ASTCENC_SWZ_G, ASTCENC_SWZ_B, ASTCENC_SWZ_A
+ };
+
+ status = astcenc_decompress_image(context, src_data, src_size, &image, &swizzle, 0);
+ ERR_BREAK_MSG(status != ASTCENC_SUCCESS,
+ vformat("astcenc: ASTC decompression failed: %s.", astcenc_get_error_string(status)));
+ ERR_BREAK_MSG(image.dim_z > 1,
+ "astcenc: ASTC decompression failed because this is a 3D texture, which is not supported.");
+ astcenc_compress_reset(context);
+ }
+ astcenc_context_free(context);
+
+ // Replace original image with compressed one.
+
+ r_img->set_data(width, height, mipmaps, target_format, dest_data);
+
+ print_verbose(vformat("astcenc: Decompression took %s ms.", rtos(OS::get_singleton()->get_ticks_msec() - start_time)));
+}
diff --git a/modules/astcenc/image_compress_astcenc.h b/modules/astcenc/image_compress_astcenc.h
new file mode 100644
index 0000000000..ad157d7c0a
--- /dev/null
+++ b/modules/astcenc/image_compress_astcenc.h
@@ -0,0 +1,39 @@
+/**************************************************************************/
+/* image_compress_astcenc.h */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 IMAGE_COMPRESS_ASTCENC_H
+#define IMAGE_COMPRESS_ASTCENC_H
+
+#include "core/io/image.h"
+
+void _compress_astc(Image *r_img, Image::ASTCFormat p_format);
+void _decompress_astc(Image *r_img);
+
+#endif // IMAGE_COMPRESS_ASTCENC_H
diff --git a/modules/astcenc/register_types.cpp b/modules/astcenc/register_types.cpp
new file mode 100644
index 0000000000..0bb1c3432f
--- /dev/null
+++ b/modules/astcenc/register_types.cpp
@@ -0,0 +1,48 @@
+/**************************************************************************/
+/* register_types.cpp */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 "register_types.h"
+
+#include "image_compress_astcenc.h"
+
+void initialize_astcenc_module(ModuleInitializationLevel p_level) {
+ if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
+ return;
+ }
+
+ Image::_image_compress_astc_func = _compress_astc;
+ Image::_image_decompress_astc = _decompress_astc;
+}
+
+void uninitialize_astcenc_module(ModuleInitializationLevel p_level) {
+ if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
+ return;
+ }
+}
diff --git a/modules/astcenc/register_types.h b/modules/astcenc/register_types.h
new file mode 100644
index 0000000000..636da9ff8b
--- /dev/null
+++ b/modules/astcenc/register_types.h
@@ -0,0 +1,39 @@
+/**************************************************************************/
+/* register_types.h */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 ASTCENC_REGISTER_TYPES_H
+#define ASTCENC_REGISTER_TYPES_H
+
+#include "modules/register_module_types.h"
+
+void initialize_astcenc_module(ModuleInitializationLevel p_level);
+void uninitialize_astcenc_module(ModuleInitializationLevel p_level);
+
+#endif // ASTCENC_REGISTER_TYPES_H
diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp
index 7251511460..ff7c01f9fc 100644
--- a/modules/basis_universal/register_types.cpp
+++ b/modules/basis_universal/register_types.cpp
@@ -52,44 +52,50 @@ enum BasisDecompressFormat {
#ifdef TOOLS_ENABLED
static Vector<uint8_t> basis_universal_packer(const Ref<Image> &p_image, Image::UsedChannels p_channels) {
Vector<uint8_t> budata;
-
{
+ basisu::basis_compressor_params params;
Ref<Image> image = p_image->duplicate();
-
- // unfortunately, basis universal does not support compressing supplied mipmaps,
- // so for the time being, only compressing individual images will have to do.
-
- if (image->has_mipmaps()) {
- image->clear_mipmaps();
- }
if (image->get_format() != Image::FORMAT_RGBA8) {
image->convert(Image::FORMAT_RGBA8);
}
-
- basisu::image buimg(image->get_width(), image->get_height());
-
+ Ref<Image> image_single = image->duplicate();
{
- Vector<uint8_t> vec = image->get_data();
+ if (image_single->has_mipmaps()) {
+ image_single->clear_mipmaps();
+ }
+ basisu::image buimg(image_single->get_width(), image_single->get_height());
+ Vector<uint8_t> vec = image_single->get_data();
const uint8_t *r = vec.ptr();
-
memcpy(buimg.get_ptr(), r, vec.size());
+ params.m_source_images.push_back(buimg);
+ }
+ basisu::vector<basisu::image> source_images;
+ for (int32_t mipmap_i = 1; mipmap_i < image->get_mipmap_count(); mipmap_i++) {
+ Ref<Image> mip = image->get_image_from_mipmap(mipmap_i);
+ basisu::image buimg(mip->get_width(), mip->get_height());
+ Vector<uint8_t> vec = mip->get_data();
+ const uint8_t *r = vec.ptr();
+ memcpy(buimg.get_ptr(), r, vec.size());
+ source_images.push_back(buimg);
}
- basisu::basis_compressor_params params;
params.m_uastc = true;
- params.m_max_endpoint_clusters = 512;
- params.m_max_selector_clusters = 512;
+ params.m_quality_level = basisu::BASISU_QUALITY_MIN;
+
+ params.m_pack_uastc_flags &= ~basisu::cPackUASTCLevelMask;
+
+ static const uint32_t s_level_flags[basisu::TOTAL_PACK_UASTC_LEVELS] = { basisu::cPackUASTCLevelFastest, basisu::cPackUASTCLevelFaster, basisu::cPackUASTCLevelDefault, basisu::cPackUASTCLevelSlower, basisu::cPackUASTCLevelVerySlow };
+ params.m_pack_uastc_flags |= s_level_flags[0];
+ params.m_rdo_uastc = 0.0f;
+ params.m_rdo_uastc_quality_scalar = 0.0f;
+ params.m_rdo_uastc_dict_size = 1024;
+
+ params.m_mip_fast = true;
params.m_multithreading = true;
- //params.m_quality_level = 0;
- //params.m_disable_hierarchical_endpoint_codebooks = true;
- //params.m_no_selector_rdo = true;
basisu::job_pool jpool(OS::get_singleton()->get_processor_count());
params.m_pJob_pool = &jpool;
- params.m_mip_gen = false; //sorry, please some day support provided mipmaps.
- params.m_source_images.push_back(buimg);
-
BasisDecompressFormat decompress_format = BASIS_DECOMPRESS_RG;
params.m_check_for_alpha = false;
@@ -252,8 +258,7 @@ static Ref<Image> basis_universal_unpacker_ptr(const uint8_t *p_data, int p_size
};
};
- image.instantiate();
- image->set_data(info.m_width, info.m_height, info.m_total_levels > 1, imgfmt, gpudata);
+ image = Image::create_from_data(info.m_width, info.m_height, info.m_total_levels > 1, imgfmt, gpudata);
return image;
}
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index 9cc3d0413d..13c7a8202c 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -558,7 +558,7 @@ void CSGShape3D::_notification(int p_what) {
set_collision_layer(collision_layer);
set_collision_mask(collision_mask);
set_collision_priority(collision_priority);
- _update_collision_faces();
+ _make_dirty();
}
} break;
@@ -1763,7 +1763,7 @@ CSGBrush *CSGPolygon3D::_build_brush() {
}
}
- if (!path) {
+ if (!path || !path->is_inside_tree()) {
return new_brush;
}
diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp
index 4982b6b995..f19228cb18 100644
--- a/modules/cvtt/image_compress_cvtt.cpp
+++ b/modules/cvtt/image_compress_cvtt.cpp
@@ -129,7 +129,7 @@ static void _digest_row_task(const CVTTCompressionJobParams &p_job_params, const
}
}
-void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::UsedChannels p_channels) {
+void image_compress_cvtt(Image *p_image, Image::UsedChannels p_channels) {
if (p_image->get_format() >= Image::FORMAT_BPTC_RGBA) {
return; //do not compress, already compressed
}
diff --git a/modules/cvtt/image_compress_cvtt.h b/modules/cvtt/image_compress_cvtt.h
index 5dc8b6f52c..ca88a9d4c9 100644
--- a/modules/cvtt/image_compress_cvtt.h
+++ b/modules/cvtt/image_compress_cvtt.h
@@ -33,7 +33,7 @@
#include "core/io/image.h"
-void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::UsedChannels p_channels);
+void image_compress_cvtt(Image *p_image, Image::UsedChannels p_channels);
void image_decompress_cvtt(Image *p_image);
#endif // IMAGE_COMPRESS_CVTT_H
diff --git a/modules/enet/doc_classes/ENetConnection.xml b/modules/enet/doc_classes/ENetConnection.xml
index 8c84fe87d7..dc832976d9 100644
--- a/modules/enet/doc_classes/ENetConnection.xml
+++ b/modules/enet/doc_classes/ENetConnection.xml
@@ -84,19 +84,17 @@
</method>
<method name="dtls_client_setup">
<return type="int" enum="Error" />
- <param index="0" name="certificate" type="X509Certificate" />
- <param index="1" name="hostname" type="String" />
- <param index="2" name="verify" type="bool" default="true" />
+ <param index="0" name="hostname" type="String" />
+ <param index="1" name="client_options" type="TLSOptions" default="null" />
<description>
- Configure this ENetHost to use the custom Godot extension allowing DTLS encryption for ENet clients. Call this before [method connect_to_host] to have ENet connect using DTLS with [code]certificate[/code] and [code]hostname[/code] verification. Verification can be optionally turned off via the [code]verify[/code] parameter.
+ Configure this ENetHost to use the custom Godot extension allowing DTLS encryption for ENet clients. Call this before [method connect_to_host] to have ENet connect using DTLS validating the server certificate against [code]hostname[/code]. You can pass the optional [param client_options] parameter to customize the trusted certification authorities, or disable the common name verification. See [method TLSOptions.client] and [method TLSOptions.client_unsafe].
</description>
</method>
<method name="dtls_server_setup">
<return type="int" enum="Error" />
- <param index="0" name="key" type="CryptoKey" />
- <param index="1" name="certificate" type="X509Certificate" />
+ <param index="0" name="server_options" type="TLSOptions" />
<description>
- Configure this ENetHost to use the custom Godot extension allowing DTLS encryption for ENet servers. Call this right after [method create_host_bound] to have ENet expect peers to connect using DTLS.
+ Configure this ENetHost to use the custom Godot extension allowing DTLS encryption for ENet servers. Call this right after [method create_host_bound] to have ENet expect peers to connect using DTLS. See [method TLSOptions.server].
</description>
</method>
<method name="flush">
diff --git a/modules/enet/enet_connection.cpp b/modules/enet/enet_connection.cpp
index d16e7d7c4a..804263186f 100644
--- a/modules/enet/enet_connection.cpp
+++ b/modules/enet/enet_connection.cpp
@@ -273,10 +273,11 @@ TypedArray<ENetPacketPeer> ENetConnection::_get_peers() {
return out;
}
-Error ENetConnection::dtls_server_setup(Ref<CryptoKey> p_key, Ref<X509Certificate> p_cert) {
+Error ENetConnection::dtls_server_setup(const Ref<TLSOptions> &p_options) {
#ifdef GODOT_ENET
ERR_FAIL_COND_V_MSG(!host, ERR_UNCONFIGURED, "The ENetConnection instance isn't currently active.");
- return enet_host_dtls_server_setup(host, p_key.ptr(), p_cert.ptr()) ? FAILED : OK;
+ ERR_FAIL_COND_V(p_options.is_null() || !p_options->is_server(), ERR_INVALID_PARAMETER);
+ return enet_host_dtls_server_setup(host, const_cast<TLSOptions *>(p_options.ptr())) ? FAILED : OK;
#else
ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "ENet DTLS support not available in this build.");
#endif
@@ -291,10 +292,11 @@ void ENetConnection::refuse_new_connections(bool p_refuse) {
#endif
}
-Error ENetConnection::dtls_client_setup(Ref<X509Certificate> p_cert, const String &p_hostname, bool p_verify) {
+Error ENetConnection::dtls_client_setup(const String &p_hostname, const Ref<TLSOptions> &p_options) {
#ifdef GODOT_ENET
ERR_FAIL_COND_V_MSG(!host, ERR_UNCONFIGURED, "The ENetConnection instance isn't currently active.");
- return enet_host_dtls_client_setup(host, p_cert.ptr(), p_verify, p_hostname.utf8().get_data()) ? FAILED : OK;
+ ERR_FAIL_COND_V(p_options.is_null() || p_options->is_server(), ERR_INVALID_PARAMETER);
+ return enet_host_dtls_client_setup(host, p_hostname.utf8().get_data(), const_cast<TLSOptions *>(p_options.ptr())) ? FAILED : OK;
#else
ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "ENet DTLS support not available in this build.");
#endif
@@ -351,8 +353,8 @@ void ENetConnection::_bind_methods() {
ClassDB::bind_method(D_METHOD("channel_limit", "limit"), &ENetConnection::channel_limit);
ClassDB::bind_method(D_METHOD("broadcast", "channel", "packet", "flags"), &ENetConnection::_broadcast);
ClassDB::bind_method(D_METHOD("compress", "mode"), &ENetConnection::compress);
- ClassDB::bind_method(D_METHOD("dtls_server_setup", "key", "certificate"), &ENetConnection::dtls_server_setup);
- ClassDB::bind_method(D_METHOD("dtls_client_setup", "certificate", "hostname", "verify"), &ENetConnection::dtls_client_setup, DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("dtls_server_setup", "server_options"), &ENetConnection::dtls_server_setup);
+ ClassDB::bind_method(D_METHOD("dtls_client_setup", "hostname", "client_options"), &ENetConnection::dtls_client_setup, DEFVAL(Ref<TLSOptions>()));
ClassDB::bind_method(D_METHOD("refuse_new_connections", "refuse"), &ENetConnection::refuse_new_connections);
ClassDB::bind_method(D_METHOD("pop_statistic", "statistic"), &ENetConnection::pop_statistic);
ClassDB::bind_method(D_METHOD("get_max_channels"), &ENetConnection::get_max_channels);
diff --git a/modules/enet/enet_connection.h b/modules/enet/enet_connection.h
index 9e444911cc..481afc48bb 100644
--- a/modules/enet/enet_connection.h
+++ b/modules/enet/enet_connection.h
@@ -128,8 +128,8 @@ public:
int get_local_port() const;
// Godot additions
- Error dtls_server_setup(Ref<CryptoKey> p_key, Ref<X509Certificate> p_cert);
- Error dtls_client_setup(Ref<X509Certificate> p_cert, const String &p_hostname, bool p_verify = true);
+ Error dtls_server_setup(const Ref<TLSOptions> &p_options);
+ Error dtls_client_setup(const String &p_hostname, const Ref<TLSOptions> &p_options);
void refuse_new_connections(bool p_refuse);
ENetConnection() {}
diff --git a/modules/enet/enet_multiplayer_peer.cpp b/modules/enet/enet_multiplayer_peer.cpp
index 50ea0dd37a..93a20ab1f8 100644
--- a/modules/enet/enet_multiplayer_peer.cpp
+++ b/modules/enet/enet_multiplayer_peer.cpp
@@ -363,7 +363,7 @@ Error ENetMultiplayerPeer::put_packet(const uint8_t *p_buffer, int p_buffer_size
#ifdef DEBUG_ENABLED
if ((packet_flags & ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT) && p_buffer_size > ENET_HOST_DEFAULT_MTU) {
- WARN_PRINT_ONCE(vformat("Sending %d bytes unrealiably which is above the MTU (%d), this will result in higher packet loss", p_buffer_size, ENET_HOST_DEFAULT_MTU));
+ WARN_PRINT_ONCE(vformat("Sending %d bytes unreliably which is above the MTU (%d), this will result in higher packet loss", p_buffer_size, ENET_HOST_DEFAULT_MTU));
}
#endif
diff --git a/modules/etcpak/image_compress_etcpak.cpp b/modules/etcpak/image_compress_etcpak.cpp
index b5192bd664..16a59d3880 100644
--- a/modules/etcpak/image_compress_etcpak.cpp
+++ b/modules/etcpak/image_compress_etcpak.cpp
@@ -33,8 +33,8 @@
#include "core/os/os.h"
#include "core/string/print_string.h"
-#include "thirdparty/etcpak/ProcessDxtc.hpp"
-#include "thirdparty/etcpak/ProcessRGB.hpp"
+#include <ProcessDxtc.hpp>
+#include <ProcessRGB.hpp>
EtcpakType _determine_etc_type(Image::UsedChannels p_channels) {
switch (p_channels) {
@@ -74,25 +74,23 @@ EtcpakType _determine_dxt_type(Image::UsedChannels p_channels) {
}
}
-void _compress_etc1(Image *r_img, float p_lossy_quality) {
- _compress_etcpak(EtcpakType::ETCPAK_TYPE_ETC1, r_img, p_lossy_quality);
+void _compress_etc1(Image *r_img) {
+ _compress_etcpak(EtcpakType::ETCPAK_TYPE_ETC1, r_img);
}
-void _compress_etc2(Image *r_img, float p_lossy_quality, Image::UsedChannels p_channels) {
+void _compress_etc2(Image *r_img, Image::UsedChannels p_channels) {
EtcpakType type = _determine_etc_type(p_channels);
- _compress_etcpak(type, r_img, p_lossy_quality);
+ _compress_etcpak(type, r_img);
}
-void _compress_bc(Image *r_img, float p_lossy_quality, Image::UsedChannels p_channels) {
+void _compress_bc(Image *r_img, Image::UsedChannels p_channels) {
EtcpakType type = _determine_dxt_type(p_channels);
- _compress_etcpak(type, r_img, p_lossy_quality);
+ _compress_etcpak(type, r_img);
}
-void _compress_etcpak(EtcpakType p_compresstype, Image *r_img, float p_lossy_quality) {
+void _compress_etcpak(EtcpakType p_compresstype, Image *r_img) {
uint64_t start_time = OS::get_singleton()->get_ticks_msec();
- // TODO: See how to handle lossy quality.
-
Image::Format img_format = r_img->get_format();
if (img_format >= Image::FORMAT_DXT1) {
return; // Do not compress, already compressed.
@@ -130,7 +128,7 @@ void _compress_etcpak(EtcpakType p_compresstype, Image *r_img, float p_lossy_qua
} else if (p_compresstype == EtcpakType::ETCPAK_TYPE_DXT5) {
target_format = Image::FORMAT_DXT5;
} else {
- ERR_FAIL_MSG("Invalid or unsupported Etcpak compression format.");
+ ERR_FAIL_MSG("Invalid or unsupported etcpak compression format, not ETC or DXT.");
}
// Compress image data and (if required) mipmaps.
@@ -171,7 +169,7 @@ void _compress_etcpak(EtcpakType p_compresstype, Image *r_img, float p_lossy_qua
const uint8_t *src_read = r_img->get_data().ptr();
- print_verbose(vformat("ETCPAK: Encoding image size %dx%d to format %s.", width, height, Image::get_format_name(target_format)));
+ print_verbose(vformat("etcpak: Encoding image size %dx%d to format %s%s.", width, height, Image::get_format_name(target_format), mipmaps ? ", with mipmaps" : ""));
int dest_size = Image::get_image_data_size(width, height, target_format, mipmaps);
Vector<uint8_t> dest_data;
@@ -232,12 +230,12 @@ void _compress_etcpak(EtcpakType p_compresstype, Image *r_img, float p_lossy_qua
} else if (p_compresstype == EtcpakType::ETCPAK_TYPE_DXT5 || p_compresstype == EtcpakType::ETCPAK_TYPE_DXT5_RA_AS_RG) {
CompressDxt5(src_mip_read, dest_mip_write, blocks, mip_w);
} else {
- ERR_FAIL_MSG("Invalid or unsupported Etcpak compression format.");
+ ERR_FAIL_MSG("etcpak: Invalid or unsupported compression format.");
}
}
// Replace original image with compressed one.
r_img->set_data(width, height, mipmaps, target_format, dest_data);
- print_verbose(vformat("ETCPAK encode took %s ms.", rtos(OS::get_singleton()->get_ticks_msec() - start_time)));
+ print_verbose(vformat("etcpak: Encoding took %s ms.", rtos(OS::get_singleton()->get_ticks_msec() - start_time)));
}
diff --git a/modules/etcpak/image_compress_etcpak.h b/modules/etcpak/image_compress_etcpak.h
index 8cb17b1c8a..ff267631a6 100644
--- a/modules/etcpak/image_compress_etcpak.h
+++ b/modules/etcpak/image_compress_etcpak.h
@@ -43,10 +43,10 @@ enum class EtcpakType {
ETCPAK_TYPE_DXT5_RA_AS_RG,
};
-void _compress_etc1(Image *r_img, float p_lossy_quality);
-void _compress_etc2(Image *r_img, float p_lossy_quality, Image::UsedChannels p_channels);
-void _compress_bc(Image *r_img, float p_lossy_quality, Image::UsedChannels p_channels);
+void _compress_etc1(Image *r_img);
+void _compress_etc2(Image *r_img, Image::UsedChannels p_channels);
+void _compress_bc(Image *r_img, Image::UsedChannels p_channels);
-void _compress_etcpak(EtcpakType p_compresstype, Image *r_img, float p_lossy_quality);
+void _compress_etcpak(EtcpakType p_compresstype, Image *r_img);
#endif // IMAGE_COMPRESS_ETCPAK_H
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml
index 3fe741a582..7f9d4ae253 100644
--- a/modules/gdscript/doc_classes/@GDScript.xml
+++ b/modules/gdscript/doc_classes/@GDScript.xml
@@ -316,12 +316,21 @@
<return type="void" />
<param index="0" name="names" type="String" />
<description>
- Export a [String] or integer property as an enumerated list of options. If the property is an integer field, then the index of the value is stored, in the same order the values are provided. You can add specific identifiers for allowed values using a colon.
+ Export an [int] or [String] property as an enumerated list of options. If the property is an [int], then the index of the value is stored, in the same order the values are provided. You can add specific identifiers for allowed values using a colon. If the property is a [String], then the value is stored.
See also [constant PROPERTY_HINT_ENUM].
[codeblock]
- @export_enum("Rebecca", "Mary", "Leah") var character_name: String
@export_enum("Warrior", "Magician", "Thief") var character_class: int
@export_enum("Slow:30", "Average:60", "Very Fast:200") var character_speed: int
+ @export_enum("Rebecca", "Mary", "Leah") var character_name: String
+ [/codeblock]
+ If you want to set an initial value, you must specify it explicitly:
+ [codeblock]
+ @export_enum("Rebecca", "Mary", "Leah") var character_name: String = "Rebecca"
+ [/codeblock]
+ If you want to use named GDScript enums, then use [annotation @export] instead:
+ [codeblock]
+ enum CharacterName {REBECCA, MARY, LEAH}
+ @export var character_name: CharacterName
[/codeblock]
</description>
</annotation>
@@ -485,7 +494,7 @@
Export a [NodePath] property with a filter for allowed node types.
See also [constant PROPERTY_HINT_NODE_PATH_VALID_TYPES].
[codeblock]
- @export_node_path(Button, TouchScreenButton) var some_button
+ @export_node_path("Button", "TouchScreenButton") var some_button
[/codeblock]
</description>
</annotation>
@@ -507,7 +516,7 @@
<param index="2" name="step" type="float" default="1.0" />
<param index="3" name="extra_hints" type="String" default="&quot;&quot;" />
<description>
- Export a numeric property as a range value. The range must be defined by [param min] and [param max], as well as an optional [param step] and a variety of extra hints. The [param step] defaults to [code]1[/code] for integer properties. For floating-point numbers this value depends on your [code]EditorSettings.interface/inspector/default_float_step[/code] setting.
+ Export an [int] or [float] property as a range value. The range must be defined by [param min] and [param max], as well as an optional [param step] and a variety of extra hints. The [param step] defaults to [code]1[/code] for integer properties. For floating-point numbers this value depends on your [code]EditorSettings.interface/inspector/default_float_step[/code] setting.
If hints [code]"or_greater"[/code] and [code]"or_less"[/code] are provided, the editor widget will not cap the value at range boundaries. The [code]"exp"[/code] hint will make the edited values on range to change exponentially. The [code]"hide_slider"[/code] hint will hide the slider element of the editor widget.
Hints also allow to indicate the units for the edited value. Using [code]"radians"[/code] you can specify that the actual value is in radians, but should be displayed in degrees in the Inspector dock. [code]"degrees"[/code] allows to add a degree sign as a unit suffix. Finally, a custom suffix can be provided using [code]"suffix:unit"[/code], where "unit" can be any string.
See also [constant PROPERTY_HINT_RANGE].
diff --git a/modules/gdscript/doc_classes/GDScript.xml b/modules/gdscript/doc_classes/GDScript.xml
index 8246c96c15..1a102bd16f 100644
--- a/modules/gdscript/doc_classes/GDScript.xml
+++ b/modules/gdscript/doc_classes/GDScript.xml
@@ -11,12 +11,6 @@
<link title="GDScript documentation index">$DOCS_URL/tutorials/scripting/gdscript/index.html</link>
</tutorials>
<methods>
- <method name="get_as_byte_code" qualifiers="const">
- <return type="PackedByteArray" />
- <description>
- Returns byte code for the script source code.
- </description>
- </method>
<method name="new" qualifiers="vararg">
<return type="Variant" />
<description>
diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp
index 23be913a24..5883ec863d 100644
--- a/modules/gdscript/editor/gdscript_highlighter.cpp
+++ b/modules/gdscript/editor/gdscript_highlighter.cpp
@@ -307,7 +307,7 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_l
in_number = true;
}
- if (!in_word && (is_ascii_char(str[j]) || is_underscore(str[j])) && !in_number) {
+ if (!in_word && is_unicode_identifier_start(str[j]) && !in_number) {
in_word = true;
}
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 28f478e9cd..8324cb0fe0 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -98,7 +98,7 @@ Variant GDScriptNativeClass::callp(const StringName &p_method, const Variant **p
return Object::callp(p_method, p_args, p_argcount, r_error);
}
MethodBind *method = ClassDB::get_method(name, p_method);
- if (method) {
+ if (method && method->is_static()) {
// Native static method.
return method->call(nullptr, p_args, p_argcount, r_error);
}
@@ -248,6 +248,10 @@ Ref<Script> GDScript::get_base_script() const {
}
}
+StringName GDScript::get_global_name() const {
+ return name;
+}
+
StringName GDScript::get_instance_base_type() const {
if (native.is_valid()) {
return native->get_name();
@@ -702,11 +706,7 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc
}
members_cache.push_back(member.variable->export_info);
- Variant default_value;
- if (member.variable->initializer && member.variable->initializer->is_constant) {
- default_value = member.variable->initializer->reduced_value;
- GDScriptCompiler::convert_to_initializer_type(default_value, member.variable);
- }
+ Variant default_value = analyzer.make_variable_default_value(member.variable);
member_default_values_cache[member.variable->identifier->name] = default_value;
} break;
case GDScriptParser::ClassNode::Member::SIGNAL: {
@@ -1007,17 +1007,6 @@ void GDScript::_get_property_list(List<PropertyInfo> *p_properties) const {
void GDScript::_bind_methods() {
ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "new", &GDScript::_new, MethodInfo("new"));
-
- ClassDB::bind_method(D_METHOD("get_as_byte_code"), &GDScript::get_as_byte_code);
-}
-
-Vector<uint8_t> GDScript::get_as_byte_code() const {
- return Vector<uint8_t>();
-};
-
-// TODO: Fully remove this. There's not this kind of "bytecode" anymore.
-Error GDScript::load_byte_code(const String &p_path) {
- return ERR_COMPILATION_FAILED;
}
void GDScript::set_path(const String &p_path, bool p_take_over) {
@@ -1532,41 +1521,24 @@ bool GDScriptInstance::set(const StringName &p_name, const Variant &p_value) {
HashMap<StringName, GDScript::MemberInfo>::Iterator E = script->member_indices.find(p_name);
if (E) {
const GDScript::MemberInfo *member = &E->value;
- if (member->setter) {
- const Variant *val = &p_value;
+ Variant value = p_value;
+ if (member->data_type.has_type && !member->data_type.is_type(value)) {
+ const Variant *args = &p_value;
Callable::CallError err;
- callp(member->setter, &val, 1, err);
- if (err.error == Callable::CallError::CALL_OK) {
- return true; //function exists, call was successful
- } else {
+ Variant::construct(member->data_type.builtin_type, value, &args, 1, err);
+ if (err.error != Callable::CallError::CALL_OK || !member->data_type.is_type(value)) {
return false;
}
+ }
+ if (member->setter) {
+ const Variant *args = &value;
+ Callable::CallError err;
+ callp(member->setter, &args, 1, err);
+ return err.error == Callable::CallError::CALL_OK;
} else {
- if (member->data_type.has_type) {
- if (member->data_type.builtin_type == Variant::ARRAY && member->data_type.has_container_element_type()) {
- // Typed array.
- if (p_value.get_type() == Variant::ARRAY) {
- return VariantInternal::get_array(&members.write[member->index])->typed_assign(p_value);
- } else {
- return false;
- }
- } else if (!member->data_type.is_type(p_value)) {
- // Try conversion
- Callable::CallError ce;
- const Variant *value = &p_value;
- Variant converted;
- Variant::construct(member->data_type.builtin_type, converted, &value, 1, ce);
- if (ce.error == Callable::CallError::CALL_OK) {
- members.write[member->index] = converted;
- return true;
- } else {
- return false;
- }
- }
- }
- members.write[member->index] = p_value;
+ members.write[member->index] = value;
+ return true;
}
- return true;
}
}
@@ -2455,7 +2427,6 @@ bool GDScriptLanguage::handles_global_class_type(const String &p_type) const {
}
String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_base_type, String *r_icon_path) const {
- Vector<uint8_t> sourcef;
Error err;
Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ, &err);
if (err) {
@@ -2467,87 +2438,100 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
GDScriptParser parser;
err = parser.parse(source, p_path, false);
- // TODO: Simplify this code by using the analyzer to get full inheritance.
- if (err == OK) {
- const GDScriptParser::ClassNode *c = parser.get_tree();
- if (r_icon_path) {
- if (c->icon_path.is_empty() || c->icon_path.is_absolute_path()) {
- *r_icon_path = c->icon_path;
- } else if (c->icon_path.is_relative_path()) {
- *r_icon_path = p_path.get_base_dir().path_join(c->icon_path).simplify_path();
- }
- }
- if (r_base_type) {
- const GDScriptParser::ClassNode *subclass = c;
- String path = p_path;
- GDScriptParser subparser;
- while (subclass) {
- if (subclass->extends_used) {
- if (!subclass->extends_path.is_empty()) {
- if (subclass->extends.size() == 0) {
- get_global_class_name(subclass->extends_path, r_base_type);
- subclass = nullptr;
- break;
- } else {
- Vector<StringName> extend_classes = subclass->extends;
+ const GDScriptParser::ClassNode *c = parser.get_tree();
+ if (!c) {
+ return String(); // No class parsed.
+ }
+
+ /* **WARNING**
+ *
+ * This function is written with the goal to be *extremely* error tolerant, as such
+ * it should meet the following requirements:
+ *
+ * - It must not rely on the analyzer (in fact, the analyzer must not be used here),
+ * because at the time global classes are parsed, the dependencies may not be present
+ * yet, hence the function will fail (which is unintended).
+ * - It must not fail even if the parsing fails, because even if the file is broken,
+ * it should attempt its best to retrieve the inheritance metadata.
+ *
+ * Before changing this function, please ask the current maintainer of EditorFileSystem.
+ */
+
+ if (r_icon_path) {
+ if (c->icon_path.is_empty() || c->icon_path.is_absolute_path()) {
+ *r_icon_path = c->icon_path.simplify_path();
+ } else if (c->icon_path.is_relative_path()) {
+ *r_icon_path = p_path.get_base_dir().path_join(c->icon_path).simplify_path();
+ }
+ }
+ if (r_base_type) {
+ const GDScriptParser::ClassNode *subclass = c;
+ String path = p_path;
+ GDScriptParser subparser;
+ while (subclass) {
+ if (subclass->extends_used) {
+ if (!subclass->extends_path.is_empty()) {
+ if (subclass->extends.size() == 0) {
+ get_global_class_name(subclass->extends_path, r_base_type);
+ subclass = nullptr;
+ break;
+ } else {
+ Vector<StringName> extend_classes = subclass->extends;
- Ref<FileAccess> subfile = FileAccess::open(subclass->extends_path, FileAccess::READ);
- if (subfile.is_null()) {
- break;
- }
- String subsource = subfile->get_as_utf8_string();
+ Ref<FileAccess> subfile = FileAccess::open(subclass->extends_path, FileAccess::READ);
+ if (subfile.is_null()) {
+ break;
+ }
+ String subsource = subfile->get_as_utf8_string();
- if (subsource.is_empty()) {
- break;
- }
- String subpath = subclass->extends_path;
- if (subpath.is_relative_path()) {
- subpath = path.get_base_dir().path_join(subpath).simplify_path();
- }
+ if (subsource.is_empty()) {
+ break;
+ }
+ String subpath = subclass->extends_path;
+ if (subpath.is_relative_path()) {
+ subpath = path.get_base_dir().path_join(subpath).simplify_path();
+ }
- if (OK != subparser.parse(subsource, subpath, false)) {
- break;
- }
- path = subpath;
- subclass = subparser.get_tree();
-
- while (extend_classes.size() > 0) {
- bool found = false;
- for (int i = 0; i < subclass->members.size(); i++) {
- if (subclass->members[i].type != GDScriptParser::ClassNode::Member::CLASS) {
- continue;
- }
-
- const GDScriptParser::ClassNode *inner_class = subclass->members[i].m_class;
- if (inner_class->identifier->name == extend_classes[0]) {
- extend_classes.remove_at(0);
- found = true;
- subclass = inner_class;
- break;
- }
+ if (OK != subparser.parse(subsource, subpath, false)) {
+ break;
+ }
+ path = subpath;
+ subclass = subparser.get_tree();
+
+ while (extend_classes.size() > 0) {
+ bool found = false;
+ for (int i = 0; i < subclass->members.size(); i++) {
+ if (subclass->members[i].type != GDScriptParser::ClassNode::Member::CLASS) {
+ continue;
}
- if (!found) {
- subclass = nullptr;
+
+ const GDScriptParser::ClassNode *inner_class = subclass->members[i].m_class;
+ if (inner_class->identifier->name == extend_classes[0]) {
+ extend_classes.remove_at(0);
+ found = true;
+ subclass = inner_class;
break;
}
}
+ if (!found) {
+ subclass = nullptr;
+ break;
+ }
}
- } else if (subclass->extends.size() == 1) {
- *r_base_type = subclass->extends[0];
- subclass = nullptr;
- } else {
- break;
}
- } else {
- *r_base_type = "RefCounted";
+ } else if (subclass->extends.size() == 1) {
+ *r_base_type = subclass->extends[0];
subclass = nullptr;
+ } else {
+ break;
}
+ } else {
+ *r_base_type = "RefCounted";
+ subclass = nullptr;
}
}
- return c->identifier != nullptr ? String(c->identifier->name) : String();
}
-
- return String();
+ return c->identifier != nullptr ? String(c->identifier->name) : String();
}
GDScriptLanguage::GDScriptLanguage() {
@@ -2647,8 +2631,6 @@ Ref<Resource> ResourceFormatLoaderGDScript::load(const String &p_path, const Str
Error err;
Ref<GDScript> scr = GDScriptCache::get_full_script(p_path, err, "", p_cache_mode == CACHE_MODE_IGNORE);
- // TODO: Reintroduce binary and encrypted scripts.
-
if (scr.is_null()) {
// Don't fail loading because of parsing error.
scr.instantiate();
@@ -2663,9 +2645,6 @@ Ref<Resource> ResourceFormatLoaderGDScript::load(const String &p_path, const Str
void ResourceFormatLoaderGDScript::get_recognized_extensions(List<String> *p_extensions) const {
p_extensions->push_back("gd");
- // TODO: Reintroduce binary and encrypted scripts.
- // p_extensions->push_back("gdc");
- // p_extensions->push_back("gde");
}
bool ResourceFormatLoaderGDScript::handles_type(const String &p_type) const {
@@ -2674,8 +2653,7 @@ bool ResourceFormatLoaderGDScript::handles_type(const String &p_type) const {
String ResourceFormatLoaderGDScript::get_resource_type(const String &p_path) const {
String el = p_path.get_extension().to_lower();
- // TODO: Reintroduce binary and encrypted scripts.
- if (el == "gd" /*|| el == "gdc" || el == "gde"*/) {
+ if (el == "gd") {
return "GDScript";
}
return "";
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index a53785a98d..82d04f641c 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -228,6 +228,7 @@ public:
virtual bool can_instantiate() const override;
virtual Ref<Script> get_base_script() const override;
+ virtual StringName get_global_name() const override;
virtual StringName get_instance_base_type() const override; // this may not work in all scripts, will return empty if so
virtual ScriptInstance *instance_create(Object *p_this) override;
@@ -250,9 +251,6 @@ public:
virtual void set_path(const String &p_path, bool p_take_over = false) override;
String get_script_path() const;
Error load_source_code(const String &p_path);
- Error load_byte_code(const String &p_path);
-
- Vector<uint8_t> get_as_byte_code() const;
bool get_property_default_value(const StringName &p_property, Variant &r_value) const override;
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index e04a962dcb..100b71eb9b 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -160,19 +160,6 @@ static GDScriptParser::DataType make_builtin_meta_type(Variant::Type p_type) {
return type;
}
-static StringName enum_get_value_name(const GDScriptParser::DataType p_type, int64_t p_val) {
- // Check that an enum has a given value, not key.
- // Make sure that implicit conversion to int64_t is sensible before calling!
- HashMap<StringName, int64_t>::ConstIterator i = p_type.enum_values.begin();
- while (i) {
- if (i->value == p_val) {
- return i->key;
- }
- ++i;
- }
- return StringName();
-}
-
bool GDScriptAnalyzer::has_member_name_conflict_in_script_class(const StringName &p_member_name, const GDScriptParser::ClassNode *p_class, const GDScriptParser::Node *p_member) {
if (p_class->members_indices.has(p_member_name)) {
int index = p_class->members_indices[p_member_name];
@@ -593,6 +580,7 @@ GDScriptParser::DataType GDScriptAnalyzer::resolve_datatype(GDScriptParser::Type
if (result.builtin_type == Variant::ARRAY) {
GDScriptParser::DataType container_type = type_from_metatype(resolve_datatype(p_type->container_type));
if (container_type.kind != GDScriptParser::DataType::VARIANT) {
+ container_type.is_constant = false;
result.set_container_element_type(container_type);
}
}
@@ -802,6 +790,7 @@ void GDScriptAnalyzer::resolve_class_member(GDScriptParser::ClassNode *p_class,
// Apply annotations.
for (GDScriptParser::AnnotationNode *&E : member.variable->annotations) {
+ resolve_annotation(E);
E->apply(parser, member.variable);
}
} break;
@@ -812,6 +801,7 @@ void GDScriptAnalyzer::resolve_class_member(GDScriptParser::ClassNode *p_class,
// Apply annotations.
for (GDScriptParser::AnnotationNode *&E : member.constant->annotations) {
+ resolve_annotation(E);
E->apply(parser, member.constant);
}
} break;
@@ -835,6 +825,7 @@ void GDScriptAnalyzer::resolve_class_member(GDScriptParser::ClassNode *p_class,
// Apply annotations.
for (GDScriptParser::AnnotationNode *&E : member.signal->annotations) {
+ resolve_annotation(E);
E->apply(parser, member.signal);
}
} break;
@@ -876,12 +867,13 @@ void GDScriptAnalyzer::resolve_class_member(GDScriptParser::ClassNode *p_class,
current_enum = prev_enum;
- dictionary.set_read_only(true);
+ dictionary.make_read_only();
member.m_enum->set_datatype(enum_type);
member.m_enum->dictionary = dictionary;
// Apply annotations.
for (GDScriptParser::AnnotationNode *&E : member.m_enum->annotations) {
+ resolve_annotation(E);
E->apply(parser, member.m_enum);
}
} break;
@@ -1058,12 +1050,13 @@ void GDScriptAnalyzer::resolve_class_body(GDScriptParser::ClassNode *p_class, co
resolve_class_body(base_class, p_class);
}
- // Do functions and properties now.
+ // Do functions, properties, and groups now.
for (int i = 0; i < p_class->members.size(); i++) {
GDScriptParser::ClassNode::Member member = p_class->members[i];
if (member.type == GDScriptParser::ClassNode::Member::FUNCTION) {
// Apply annotations.
for (GDScriptParser::AnnotationNode *&E : member.function->annotations) {
+ resolve_annotation(E);
E->apply(parser, member.function);
}
@@ -1097,6 +1090,10 @@ void GDScriptAnalyzer::resolve_class_body(GDScriptParser::ClassNode *p_class, co
resolve_function_body(member.variable->setter);
}
}
+ } else if (member.type == GDScriptParser::ClassNode::Member::GROUP) {
+ // Apply annotation (`@export_{category,group,subgroup}`).
+ resolve_annotation(member.annotation);
+ member.annotation->apply(parser, nullptr);
}
}
@@ -1290,7 +1287,55 @@ void GDScriptAnalyzer::resolve_node(GDScriptParser::Node *p_node, bool p_is_root
}
void GDScriptAnalyzer::resolve_annotation(GDScriptParser::AnnotationNode *p_annotation) {
- // TODO: Add second validation function for annotations, so they can use checked types.
+ ERR_FAIL_COND_MSG(!parser->valid_annotations.has(p_annotation->name), vformat(R"(Annotation "%s" not found to validate.)", p_annotation->name));
+
+ const MethodInfo &annotation_info = parser->valid_annotations[p_annotation->name].info;
+
+ const List<PropertyInfo>::Element *E = annotation_info.arguments.front();
+ for (int i = 0; i < p_annotation->arguments.size(); i++) {
+ GDScriptParser::ExpressionNode *argument = p_annotation->arguments[i];
+ const PropertyInfo &argument_info = E->get();
+
+ if (E->next() != nullptr) {
+ E = E->next();
+ }
+
+ reduce_expression(argument);
+
+ if (!argument->is_constant) {
+ push_error(vformat(R"(Argument %d of annotation "%s" isn't a constant expression.)", i + 1, p_annotation->name), argument);
+ return;
+ }
+
+ Variant value = argument->reduced_value;
+
+ if (value.get_type() != argument_info.type) {
+#ifdef DEBUG_ENABLED
+ if (argument_info.type == Variant::INT && value.get_type() == Variant::FLOAT) {
+ parser->push_warning(argument, GDScriptWarning::NARROWING_CONVERSION);
+ }
+#endif
+
+ if (!Variant::can_convert_strict(value.get_type(), argument_info.type)) {
+ push_error(vformat(R"(Invalid argument for annotation "%s": argument %d should be "%s" but is "%s".)", p_annotation->name, i + 1, Variant::get_type_name(argument_info.type), argument->get_datatype().to_string()), argument);
+ return;
+ }
+
+ Variant converted_to;
+ const Variant *converted_from = &value;
+ Callable::CallError call_error;
+ Variant::construct(argument_info.type, converted_to, &converted_from, 1, call_error);
+
+ if (call_error.error != Callable::CallError::CALL_OK) {
+ push_error(vformat(R"(Cannot convert argument %d of annotation "%s" from "%s" to "%s".)", i + 1, p_annotation->name, Variant::get_type_name(value.get_type()), Variant::get_type_name(argument_info.type)), argument);
+ return;
+ }
+
+ value = converted_to;
+ }
+
+ p_annotation->resolved_arguments.push_back(value);
+ }
}
void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode *p_function, const GDScriptParser::Node *p_source, bool p_is_lambda) {
@@ -1486,8 +1531,10 @@ void GDScriptAnalyzer::decide_suite_type(GDScriptParser::Node *p_suite, GDScript
void GDScriptAnalyzer::resolve_suite(GDScriptParser::SuiteNode *p_suite) {
for (int i = 0; i < p_suite->statements.size(); i++) {
GDScriptParser::Node *stmt = p_suite->statements[i];
- for (GDScriptParser::AnnotationNode *&annotation : stmt->annotations) {
- annotation->apply(parser, stmt);
+ // Apply annotations.
+ for (GDScriptParser::AnnotationNode *&E : stmt->annotations) {
+ resolve_annotation(E);
+ E->apply(parser, stmt);
}
#ifdef DEBUG_ENABLED
@@ -1525,29 +1572,30 @@ void GDScriptAnalyzer::resolve_assignable(GDScriptParser::AssignableNode *p_assi
if (p_assignable->initializer->type == GDScriptParser::Node::ARRAY) {
GDScriptParser::ArrayNode *array = static_cast<GDScriptParser::ArrayNode *>(p_assignable->initializer);
- if ((p_assignable->infer_datatype && array->elements.size() > 0) || (has_specified_type && specified_type.has_container_element_type())) {
- update_array_literal_element_type(specified_type, array);
+ if (has_specified_type && specified_type.has_container_element_type()) {
+ update_array_literal_element_type(array, specified_type.get_container_element_type());
}
}
- if (is_constant) {
- if (p_assignable->initializer->type == GDScriptParser::Node::ARRAY) {
- const_fold_array(static_cast<GDScriptParser::ArrayNode *>(p_assignable->initializer), true);
- } else if (p_assignable->initializer->type == GDScriptParser::Node::DICTIONARY) {
- const_fold_dictionary(static_cast<GDScriptParser::DictionaryNode *>(p_assignable->initializer), true);
- }
- if (!p_assignable->initializer->is_constant) {
+ if (is_constant && !p_assignable->initializer->is_constant) {
+ bool is_initializer_value_reduced = false;
+ Variant initializer_value = make_expression_reduced_value(p_assignable->initializer, is_initializer_value_reduced);
+ if (is_initializer_value_reduced) {
+ p_assignable->initializer->is_constant = true;
+ p_assignable->initializer->reduced_value = initializer_value;
+ } else {
push_error(vformat(R"(Assigned value for %s "%s" isn't a constant expression.)", p_kind, p_assignable->identifier->name), p_assignable->initializer);
}
}
+ if (has_specified_type && p_assignable->initializer->is_constant) {
+ update_const_expression_builtin_type(p_assignable->initializer, specified_type, "assign");
+ }
GDScriptParser::DataType initializer_type = p_assignable->initializer->get_datatype();
if (p_assignable->infer_datatype) {
- if (!initializer_type.is_set() || initializer_type.has_no_type()) {
+ if (!initializer_type.is_set() || initializer_type.has_no_type() || !initializer_type.is_hard_type()) {
push_error(vformat(R"(Cannot infer the type of "%s" %s because the value doesn't have a set type.)", p_assignable->identifier->name, p_kind), p_assignable->initializer);
- } else if (initializer_type.is_variant() && !initializer_type.is_hard_type()) {
- push_error(vformat(R"(Cannot infer the type of "%s" %s because the value is Variant. Use explicit "Variant" type if this is intended.)", p_assignable->identifier->name, p_kind), p_assignable->initializer);
} else if (initializer_type.kind == GDScriptParser::DataType::BUILTIN && initializer_type.builtin_type == Variant::NIL && !is_constant) {
push_error(vformat(R"(Cannot infer the type of "%s" %s because the value is "null".)", p_assignable->identifier->name, p_kind), p_assignable->initializer);
}
@@ -1577,12 +1625,14 @@ void GDScriptAnalyzer::resolve_assignable(GDScriptParser::AssignableNode *p_assi
downgrade_node_type_source(p_assignable->initializer);
}
} else if (!is_type_compatible(specified_type, initializer_type, true, p_assignable->initializer)) {
- if (!is_constant && is_type_compatible(initializer_type, specified_type, true, p_assignable->initializer)) {
+ if (!is_constant && is_type_compatible(initializer_type, specified_type)) {
mark_node_unsafe(p_assignable->initializer);
p_assignable->use_conversion_assign = true;
} else {
push_error(vformat(R"(Cannot assign a value of type %s to %s "%s" with specified type %s.)", initializer_type.to_string(), p_kind, p_assignable->identifier->name, specified_type.to_string()), p_assignable->initializer);
}
+ } else if (specified_type.has_container_element_type() && !initializer_type.has_container_element_type()) {
+ mark_node_unsafe(p_assignable->initializer);
#ifdef DEBUG_ENABLED
} else if (specified_type.builtin_type == Variant::INT && initializer_type.builtin_type == Variant::FLOAT) {
parser->push_warning(p_assignable->initializer, GDScriptWarning::NARROWING_CONVERSION);
@@ -1848,11 +1898,22 @@ void GDScriptAnalyzer::resolve_match_pattern(GDScriptParser::PatternNode *p_matc
break;
case GDScriptParser::PatternNode::PT_EXPRESSION:
if (p_match_pattern->expression) {
- reduce_expression(p_match_pattern->expression);
- if (!p_match_pattern->expression->is_constant) {
- push_error(R"(Expression in match pattern must be a constant.)", p_match_pattern->expression);
+ GDScriptParser::ExpressionNode *expr = p_match_pattern->expression;
+ reduce_expression(expr);
+ result = expr->get_datatype();
+ if (!expr->is_constant) {
+ while (expr && expr->type == GDScriptParser::Node::SUBSCRIPT) {
+ GDScriptParser::SubscriptNode *sub = static_cast<GDScriptParser::SubscriptNode *>(expr);
+ if (!sub->is_attribute) {
+ expr = nullptr;
+ } else {
+ expr = sub->base;
+ }
+ }
+ if (!expr || expr->type != GDScriptParser::Node::IDENTIFIER) {
+ push_error(R"(Expression in match pattern must be a constant expression, an identifier, or an attribute access ("A.B").)", expr);
+ }
}
- result = p_match_pattern->expression->get_datatype();
}
break;
case GDScriptParser::PatternNode::PT_BIND:
@@ -1905,25 +1966,46 @@ void GDScriptAnalyzer::resolve_return(GDScriptParser::ReturnNode *p_return) {
GDScriptParser::DataType result;
GDScriptParser::DataType expected_type;
- bool has_expected_type = false;
-
- if (parser->current_function != nullptr) {
+ bool has_expected_type = parser->current_function != nullptr;
+ if (has_expected_type) {
expected_type = parser->current_function->get_datatype();
- has_expected_type = true;
}
if (p_return->return_value != nullptr) {
- reduce_expression(p_return->return_value);
- if (p_return->return_value->type == GDScriptParser::Node::ARRAY) {
- // Check if assigned value is an array literal, so we can make it a typed array too if appropriate.
- if (has_expected_type && expected_type.has_container_element_type() && p_return->return_value->type == GDScriptParser::Node::ARRAY) {
- update_array_literal_element_type(expected_type, static_cast<GDScriptParser::ArrayNode *>(p_return->return_value));
+ bool is_void_function = has_expected_type && expected_type.is_hard_type() && expected_type.kind == GDScriptParser::DataType::BUILTIN && expected_type.builtin_type == Variant::NIL;
+ bool is_call = p_return->return_value->type == GDScriptParser::Node::CALL;
+ if (is_void_function && is_call) {
+ // Pretend the call is a root expression to allow those that are "void".
+ reduce_call(static_cast<GDScriptParser::CallNode *>(p_return->return_value), false, true);
+ } else {
+ reduce_expression(p_return->return_value);
+ }
+ if (is_void_function) {
+ p_return->void_return = true;
+ const GDScriptParser::DataType &return_type = p_return->return_value->datatype;
+ if (is_call && !return_type.is_hard_type()) {
+ String function_name = parser->current_function->identifier ? parser->current_function->identifier->name.operator String() : String("<anonymous function>");
+ String called_function_name = static_cast<GDScriptParser::CallNode *>(p_return->return_value)->function_name.operator String();
+#ifdef DEBUG_ENABLED
+ parser->push_warning(p_return, GDScriptWarning::UNSAFE_VOID_RETURN, function_name, called_function_name);
+#endif
+ mark_node_unsafe(p_return);
+ } else if (!is_call) {
+ push_error("A void function cannot return a value.", p_return);
}
+ result.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;
+ result.kind = GDScriptParser::DataType::BUILTIN;
+ result.builtin_type = Variant::NIL;
+ result.is_constant = true;
+ } else {
+ if (p_return->return_value->type == GDScriptParser::Node::ARRAY && has_expected_type && expected_type.has_container_element_type()) {
+ update_array_literal_element_type(static_cast<GDScriptParser::ArrayNode *>(p_return->return_value), expected_type.get_container_element_type());
+ }
+ if (has_expected_type && expected_type.is_hard_type() && p_return->return_value->is_constant) {
+ update_const_expression_builtin_type(p_return->return_value, expected_type, "return");
+ }
+ result = p_return->return_value->get_datatype();
}
- if (has_expected_type && expected_type.is_hard_type() && expected_type.kind == GDScriptParser::DataType::BUILTIN && expected_type.builtin_type == Variant::NIL) {
- push_error("A void function cannot return a value.", p_return);
- }
- result = p_return->return_value->get_datatype();
} else {
// Return type is null by default.
result.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;
@@ -1932,24 +2014,21 @@ void GDScriptAnalyzer::resolve_return(GDScriptParser::ReturnNode *p_return) {
result.is_constant = true;
}
- if (has_expected_type) {
- expected_type.is_meta_type = false;
- if (expected_type.is_hard_type()) {
- if (!is_type_compatible(expected_type, result)) {
- // Try other way. Okay but not safe.
- if (!is_type_compatible(result, expected_type)) {
- push_error(vformat(R"(Cannot return value of type "%s" because the function return type is "%s".)", result.to_string(), expected_type.to_string()), p_return);
- } else {
- // TODO: Add warning.
- mark_node_unsafe(p_return);
- }
+ if (has_expected_type && !expected_type.is_variant()) {
+ if (result.is_variant() || !result.is_hard_type()) {
+ mark_node_unsafe(p_return);
+ if (!is_type_compatible(expected_type, result, true, p_return)) {
+ downgrade_node_type_source(p_return);
+ }
+ } else if (!is_type_compatible(expected_type, result, true, p_return)) {
+ mark_node_unsafe(p_return);
+ if (!is_type_compatible(result, expected_type)) {
+ push_error(vformat(R"(Cannot return value of type "%s" because the function return type is "%s".)", result.to_string(), expected_type.to_string()), p_return);
+ }
#ifdef DEBUG_ENABLED
- } else if (expected_type.builtin_type == Variant::INT && result.builtin_type == Variant::FLOAT) {
- parser->push_warning(p_return, GDScriptWarning::NARROWING_CONVERSION);
- } else if (result.is_variant()) {
- mark_node_unsafe(p_return);
+ } else if (expected_type.builtin_type == Variant::INT && result.builtin_type == Variant::FLOAT) {
+ parser->push_warning(p_return, GDScriptWarning::NARROWING_CONVERSION);
#endif
- }
}
}
@@ -2014,7 +2093,7 @@ void GDScriptAnalyzer::reduce_expression(GDScriptParser::ExpressionNode *p_expre
reduce_subscript(static_cast<GDScriptParser::SubscriptNode *>(p_expression));
break;
case GDScriptParser::Node::TERNARY_OPERATOR:
- reduce_ternary_op(static_cast<GDScriptParser::TernaryOpNode *>(p_expression));
+ reduce_ternary_op(static_cast<GDScriptParser::TernaryOpNode *>(p_expression), p_is_root);
break;
case GDScriptParser::Node::UNARY_OPERATOR:
reduce_unary_op(static_cast<GDScriptParser::UnaryOpNode *>(p_expression));
@@ -2063,51 +2142,90 @@ void GDScriptAnalyzer::reduce_array(GDScriptParser::ArrayNode *p_array) {
p_array->set_datatype(arr_type);
}
+#ifdef DEBUG_ENABLED
+static bool enum_has_value(const GDScriptParser::DataType p_type, int64_t p_value) {
+ for (const KeyValue<StringName, int64_t> &E : p_type.enum_values) {
+ if (E.value == p_value) {
+ return true;
+ }
+ }
+ return false;
+}
+#endif
+
+void GDScriptAnalyzer::update_const_expression_builtin_type(GDScriptParser::ExpressionNode *p_expression, const GDScriptParser::DataType &p_type, const char *p_usage, bool p_is_cast) {
+ if (p_expression->get_datatype() == p_type) {
+ return;
+ }
+ if (p_type.kind != GDScriptParser::DataType::BUILTIN && p_type.kind != GDScriptParser::DataType::ENUM) {
+ return;
+ }
+
+ GDScriptParser::DataType expression_type = p_expression->get_datatype();
+ bool is_enum_cast = p_is_cast && p_type.kind == GDScriptParser::DataType::ENUM && p_type.is_meta_type == false && expression_type.builtin_type == Variant::INT;
+ if (!is_enum_cast && !is_type_compatible(p_type, expression_type, true, p_expression)) {
+ push_error(vformat(R"(Cannot %s a value of type "%s" as "%s".)", p_usage, expression_type.to_string(), p_type.to_string()), p_expression);
+ return;
+ }
+
+ GDScriptParser::DataType value_type = type_from_variant(p_expression->reduced_value, p_expression);
+ if (expression_type.is_variant() && !is_enum_cast && !is_type_compatible(p_type, value_type, true, p_expression)) {
+ push_error(vformat(R"(Cannot %s a value of type "%s" as "%s".)", p_usage, value_type.to_string(), p_type.to_string()), p_expression);
+ return;
+ }
+
+#ifdef DEBUG_ENABLED
+ if (p_type.kind == GDScriptParser::DataType::ENUM && value_type.builtin_type == Variant::INT && !enum_has_value(p_type, p_expression->reduced_value)) {
+ parser->push_warning(p_expression, GDScriptWarning::INT_AS_ENUM_WITHOUT_MATCH, p_usage, p_expression->reduced_value.stringify(), p_type.to_string());
+ }
+#endif
+
+ if (value_type.builtin_type == p_type.builtin_type) {
+ p_expression->set_datatype(p_type);
+ return;
+ }
+
+ Variant converted_to;
+ const Variant *converted_from = &p_expression->reduced_value;
+ Callable::CallError call_error;
+ Variant::construct(p_type.builtin_type, converted_to, &converted_from, 1, call_error);
+ if (call_error.error) {
+ push_error(vformat(R"(Failed to convert a value of type "%s" to "%s".)", value_type.to_string(), p_type.to_string()), p_expression);
+ return;
+ }
+
+#ifdef DEBUG_ENABLED
+ if (p_type.builtin_type == Variant::INT && value_type.builtin_type == Variant::FLOAT) {
+ parser->push_warning(p_expression, GDScriptWarning::NARROWING_CONVERSION);
+ }
+#endif
+
+ p_expression->reduced_value = converted_to;
+ p_expression->set_datatype(p_type);
+}
+
// When an array literal is stored (or passed as function argument) to a typed context, we then assume the array is typed.
// This function determines which type is that (if any).
-void GDScriptAnalyzer::update_array_literal_element_type(const GDScriptParser::DataType &p_base_type, GDScriptParser::ArrayNode *p_array_literal) {
- GDScriptParser::DataType array_type = p_array_literal->get_datatype();
- if (p_array_literal->elements.size() == 0) {
- // Empty array literal, just make the same type as the storage.
- array_type.set_container_element_type(p_base_type.get_container_element_type());
- } else {
- // Check if elements match.
- bool all_same_type = true;
- bool all_have_type = true;
-
- GDScriptParser::DataType element_type;
- for (int i = 0; i < p_array_literal->elements.size(); i++) {
- if (i == 0) {
- element_type = p_array_literal->elements[0]->get_datatype();
- } else {
- GDScriptParser::DataType this_element_type = p_array_literal->elements[i]->get_datatype();
- if (this_element_type.has_no_type()) {
- all_same_type = false;
- all_have_type = false;
- break;
- } else if (element_type != this_element_type) {
- if (!is_type_compatible(element_type, this_element_type, false)) {
- if (is_type_compatible(this_element_type, element_type, false)) {
- // This element is a super-type to the previous type, so we use the super-type.
- element_type = this_element_type;
- } else {
- // It's incompatible.
- all_same_type = false;
- break;
- }
- }
- }
- }
+void GDScriptAnalyzer::update_array_literal_element_type(GDScriptParser::ArrayNode *p_array, const GDScriptParser::DataType &p_element_type) {
+ for (int i = 0; i < p_array->elements.size(); i++) {
+ GDScriptParser::ExpressionNode *element_node = p_array->elements[i];
+ if (element_node->is_constant) {
+ update_const_expression_builtin_type(element_node, p_element_type, "include");
}
- if (all_same_type) {
- element_type.is_constant = false;
- array_type.set_container_element_type(element_type);
- } else if (all_have_type) {
- push_error(vformat(R"(Variant array is not compatible with an array of type "%s".)", p_base_type.get_container_element_type().to_string()), p_array_literal);
+ const GDScriptParser::DataType &element_type = element_node->get_datatype();
+ if (element_type.has_no_type() || element_type.is_variant() || !element_type.is_hard_type()) {
+ mark_node_unsafe(element_node);
+ continue;
+ }
+ if (!is_type_compatible(p_element_type, element_type, true, p_array)) {
+ push_error(vformat(R"(Cannot have an element of type "%s" in an array of type "Array[%s]".)", element_type.to_string(), p_element_type.to_string()), element_node);
+ return;
}
}
- // Update the type on the value itself.
- p_array_literal->set_datatype(array_type);
+
+ GDScriptParser::DataType array_type = p_array->get_datatype();
+ array_type.set_container_element_type(p_element_type);
+ p_array->set_datatype(array_type);
}
void GDScriptAnalyzer::reduce_assignment(GDScriptParser::AssignmentNode *p_assignment) {
@@ -2125,8 +2243,12 @@ void GDScriptAnalyzer::reduce_assignment(GDScriptParser::AssignmentNode *p_assig
}
// Check if assigned value is an array literal, so we can make it a typed array too if appropriate.
- if (assignee_type.has_container_element_type() && p_assignment->assigned_value->type == GDScriptParser::Node::ARRAY) {
- update_array_literal_element_type(assignee_type, static_cast<GDScriptParser::ArrayNode *>(p_assignment->assigned_value));
+ if (p_assignment->assigned_value->type == GDScriptParser::Node::ARRAY && assignee_type.has_container_element_type()) {
+ update_array_literal_element_type(static_cast<GDScriptParser::ArrayNode *>(p_assignment->assigned_value), assignee_type.get_container_element_type());
+ }
+
+ if (p_assignment->operation == GDScriptParser::AssignmentNode::OP_NONE && assignee_type.is_hard_type() && p_assignment->assigned_value->is_constant) {
+ update_const_expression_builtin_type(p_assignment->assigned_value, assignee_type, "assign");
}
GDScriptParser::DataType assigned_value_type = p_assignment->assigned_value->get_datatype();
@@ -2189,7 +2311,7 @@ void GDScriptAnalyzer::reduce_assignment(GDScriptParser::AssignmentNode *p_assig
// non-variant assignee and incompatible result
mark_node_unsafe(p_assignment);
if (assignee_is_hard) {
- if (is_type_compatible(op_type, assignee_type, true, p_assignment->assigned_value)) {
+ if (is_type_compatible(op_type, assignee_type)) {
// hard non-variant assignee and maybe compatible result
p_assignment->use_conversion_assign = true;
} else {
@@ -2200,6 +2322,9 @@ void GDScriptAnalyzer::reduce_assignment(GDScriptParser::AssignmentNode *p_assig
// weak non-variant assignee and incompatible result
downgrades_assignee = true;
}
+ } else if (assignee_type.has_container_element_type() && !op_type.has_container_element_type()) {
+ // typed array assignee and untyped array result
+ mark_node_unsafe(p_assignment);
}
}
}
@@ -2305,7 +2430,7 @@ void GDScriptAnalyzer::reduce_binary_op(GDScriptParser::BinaryOpNode *p_binary_o
GDScriptParser::DataType test_type = right_type;
test_type.is_meta_type = false;
- if (!is_type_compatible(test_type, left_type, false)) {
+ if (!is_type_compatible(test_type, left_type)) {
push_error(vformat(R"(Expression is of type "%s" so it can't be of type "%s".)"), p_binary_op->left_operand);
p_binary_op->reduced_value = false;
} else {
@@ -2322,47 +2447,101 @@ void GDScriptAnalyzer::reduce_binary_op(GDScriptParser::BinaryOpNode *p_binary_o
GDScriptParser::DataType result;
- if (left_type.is_variant() || right_type.is_variant()) {
+ if (p_binary_op->operation == GDScriptParser::BinaryOpNode::OP_TYPE_TEST) {
+ GDScriptParser::DataType test_type = right_type;
+ test_type.is_meta_type = false;
+
+ if (!is_type_compatible(test_type, left_type) && !is_type_compatible(left_type, test_type)) {
+ if (left_type.is_hard_type()) {
+ push_error(vformat(R"(Expression is of type "%s" so it can't be of type "%s".)", left_type.to_string(), test_type.to_string()), p_binary_op->left_operand);
+ } else {
+ // TODO: Warning.
+ mark_node_unsafe(p_binary_op);
+ }
+ }
+
+ // "is" operator is always a boolean anyway.
+ result.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;
+ result.kind = GDScriptParser::DataType::BUILTIN;
+ result.builtin_type = Variant::BOOL;
+ } else if ((p_binary_op->variant_op == Variant::OP_EQUAL || p_binary_op->variant_op == Variant::OP_NOT_EQUAL) &&
+ ((left_type.kind == GDScriptParser::DataType::BUILTIN && left_type.builtin_type == Variant::NIL) || (right_type.kind == GDScriptParser::DataType::BUILTIN && right_type.builtin_type == Variant::NIL))) {
+ // "==" and "!=" operators always return a boolean when comparing to null.
+ result.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;
+ result.kind = GDScriptParser::DataType::BUILTIN;
+ result.builtin_type = Variant::BOOL;
+ } else if (left_type.is_variant() || right_type.is_variant()) {
// Cannot infer type because one operand can be anything.
result.kind = GDScriptParser::DataType::VARIANT;
mark_node_unsafe(p_binary_op);
+ } else if (p_binary_op->variant_op < Variant::OP_MAX) {
+ bool valid = false;
+ result = get_operation_type(p_binary_op->variant_op, left_type, right_type, valid, p_binary_op);
+ if (!valid) {
+ push_error(vformat(R"(Invalid operands "%s" and "%s" for "%s" operator.)", left_type.to_string(), right_type.to_string(), Variant::get_operator_name(p_binary_op->variant_op)), p_binary_op);
+ }
} else {
- if (p_binary_op->variant_op < Variant::OP_MAX) {
- bool valid = false;
- result = get_operation_type(p_binary_op->variant_op, left_type, right_type, valid, p_binary_op);
+ ERR_PRINT("Parser bug: unknown binary operation.");
+ }
- if (!valid) {
- push_error(vformat(R"(Invalid operands "%s" and "%s" for "%s" operator.)", left_type.to_string(), right_type.to_string(), Variant::get_operator_name(p_binary_op->variant_op)), p_binary_op);
- }
- } else {
- if (p_binary_op->operation == GDScriptParser::BinaryOpNode::OP_TYPE_TEST) {
- GDScriptParser::DataType test_type = right_type;
- test_type.is_meta_type = false;
+ p_binary_op->set_datatype(result);
+}
- if (!is_type_compatible(test_type, left_type, false)) {
- // Test reverse as well to consider for subtypes.
- if (!is_type_compatible(left_type, test_type, false)) {
- if (left_type.is_hard_type()) {
- push_error(vformat(R"(Expression is of type "%s" so it can't be of type "%s".)", left_type.to_string(), test_type.to_string()), p_binary_op->left_operand);
- } else {
- // TODO: Warning.
- mark_node_unsafe(p_binary_op);
- }
- }
- }
+#ifdef TOOLS_ENABLED
+#ifndef DISABLE_DEPRECATED
+const char *GDScriptAnalyzer::get_rename_from_map(const char *map[][2], String key) {
+ for (int index = 0; map[index][0]; index++) {
+ if (map[index][0] == key) {
+ return map[index][1];
+ }
+ }
+ return nullptr;
+}
- // "is" operator is always a boolean anyway.
- result.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;
- result.kind = GDScriptParser::DataType::BUILTIN;
- result.builtin_type = Variant::BOOL;
- } else {
- ERR_PRINT("Parser bug: unknown binary operation.");
+// Checks if an identifier/function name has been renamed in Godot 4, uses ProjectConverter3To4 for rename map.
+// Returns the new name if found, nullptr otherwise.
+const char *GDScriptAnalyzer::check_for_renamed_identifier(String identifier, GDScriptParser::Node::Type type) {
+ switch (type) {
+ case GDScriptParser::Node::IDENTIFIER: {
+ // Check properties
+ const char *result = get_rename_from_map(ProjectConverter3To4::gdscript_properties_renames, identifier);
+ if (result) {
+ return result;
+ }
+ // Check enum values
+ result = get_rename_from_map(ProjectConverter3To4::enum_renames, identifier);
+ if (result) {
+ return result;
+ }
+ // Check color constants
+ result = get_rename_from_map(ProjectConverter3To4::color_renames, identifier);
+ if (result) {
+ return result;
+ }
+ // Check type names
+ result = get_rename_from_map(ProjectConverter3To4::class_renames, identifier);
+ if (result) {
+ return result;
}
+ return get_rename_from_map(ProjectConverter3To4::builtin_types_renames, identifier);
}
+ case GDScriptParser::Node::CALL: {
+ const char *result = get_rename_from_map(ProjectConverter3To4::gdscript_function_renames, identifier);
+ if (result) {
+ return result;
+ }
+ // Built-in Types are mistaken for function calls when the built-in type is not found.
+ // Check built-in types if function rename not found
+ return get_rename_from_map(ProjectConverter3To4::builtin_types_renames, identifier);
+ }
+ // Signal references don't get parsed through the GDScriptAnalyzer. No support for signal rename hints.
+ default:
+ // No rename found, return null
+ return nullptr;
}
-
- p_binary_op->set_datatype(result);
}
+#endif // DISABLE_DEPRECATED
+#endif // TOOLS_ENABLED
void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_await, bool p_is_root) {
bool all_is_constant = true;
@@ -2504,6 +2683,11 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a
}
if (types_match) {
+ for (int i = 0; i < p_call->arguments.size(); i++) {
+ if (p_call->arguments[i]->is_constant) {
+ update_const_expression_builtin_type(p_call->arguments[i], type_from_property(info.arguments[i], true), "pass");
+ }
+ }
match = true;
call_type = type_from_property(info.return_val);
break;
@@ -2697,7 +2881,7 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a
for (const KeyValue<int, GDScriptParser::ArrayNode *> &E : arrays) {
int index = E.key;
if (index < par_types.size() && par_types[index].has_container_element_type()) {
- update_array_literal_element_type(par_types[index], E.value);
+ update_array_literal_element_type(E.value, par_types[index].get_container_element_type());
}
}
validate_call_arg(par_types, default_arg_count, is_vararg, p_call);
@@ -2776,7 +2960,22 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a
}
if (!found && (is_self || (base_type.is_hard_type() && base_type.kind == GDScriptParser::DataType::BUILTIN))) {
String base_name = is_self && !p_call->is_super ? "self" : base_type.to_string();
+#ifdef TOOLS_ENABLED
+#ifndef DISABLE_DEPRECATED
+ String rename_hint = String();
+ if (GLOBAL_GET(GDScriptWarning::get_settings_path_from_code(GDScriptWarning::Code::RENAMED_IN_GD4_HINT)).booleanize()) {
+ const char *renamed_function_name = check_for_renamed_identifier(p_call->function_name, p_call->type);
+ if (renamed_function_name) {
+ rename_hint = " " + vformat(R"(Did you mean to use "%s"?)", String(renamed_function_name) + "()");
+ }
+ }
+ push_error(vformat(R"*(Function "%s()" not found in base %s.%s)*", p_call->function_name, base_name, rename_hint), p_call->is_super ? p_call : p_call->callee);
+#else // !DISABLE_DEPRECATED
push_error(vformat(R"*(Function "%s()" not found in base %s.)*", p_call->function_name, base_name), p_call->is_super ? p_call : p_call->callee);
+#endif // DISABLE_DEPRECATED
+#else
+ push_error(vformat(R"*(Function "%s()" not found in base %s.)*", p_call->function_name, base_name), p_call->is_super ? p_call : p_call->callee);
+#endif
} else if (!found && (!p_call->is_super && base_type.is_hard_type() && base_type.kind == GDScriptParser::DataType::NATIVE && base_type.is_meta_type)) {
push_error(vformat(R"*(Static function "%s()" not found in base "%s".)*", p_call->function_name, base_type.native_type), p_call);
}
@@ -2800,67 +2999,43 @@ void GDScriptAnalyzer::reduce_cast(GDScriptParser::CastNode *p_cast) {
}
p_cast->set_datatype(cast_type);
+ if (p_cast->operand->is_constant) {
+ update_const_expression_builtin_type(p_cast->operand, cast_type, "cast", true);
+ if (cast_type.is_variant() || p_cast->operand->get_datatype() == cast_type) {
+ p_cast->is_constant = true;
+ p_cast->reduced_value = p_cast->operand->reduced_value;
+ }
+ }
+
+ if (p_cast->operand->type == GDScriptParser::Node::ARRAY && cast_type.has_container_element_type()) {
+ update_array_literal_element_type(static_cast<GDScriptParser::ArrayNode *>(p_cast->operand), cast_type.get_container_element_type());
+ }
if (!cast_type.is_variant()) {
GDScriptParser::DataType op_type = p_cast->operand->get_datatype();
- if (!op_type.is_variant()) {
+ if (op_type.is_variant() || !op_type.is_hard_type()) {
+ mark_node_unsafe(p_cast);
+#ifdef DEBUG_ENABLED
+ if (op_type.is_variant() && !op_type.is_hard_type()) {
+ parser->push_warning(p_cast, GDScriptWarning::UNSAFE_CAST, cast_type.to_string());
+ }
+#endif
+ } else {
bool valid = false;
- bool more_informative_error = false;
- if (op_type.kind == GDScriptParser::DataType::ENUM && cast_type.kind == GDScriptParser::DataType::ENUM) {
- // Enum casts are compatible when value from operand exists in target enum
- if (p_cast->operand->is_constant && p_cast->operand->reduced) {
- if (enum_get_value_name(cast_type, p_cast->operand->reduced_value) != StringName()) {
- valid = true;
- } else {
- valid = false;
- more_informative_error = true;
- push_error(vformat(R"(Invalid cast. Enum "%s" does not have value corresponding to "%s.%s" (%d).)",
- cast_type.to_string(), op_type.enum_type,
- enum_get_value_name(op_type, p_cast->operand->reduced_value), // Can never be null
- p_cast->operand->reduced_value.operator uint64_t()),
- p_cast->cast_type);
- }
- } else {
- // Can't statically tell whether int has a corresponding enum value. Valid but dangerous!
- mark_node_unsafe(p_cast);
- valid = true;
- }
- } else if (op_type.kind == GDScriptParser::DataType::BUILTIN && op_type.builtin_type == Variant::INT && cast_type.kind == GDScriptParser::DataType::ENUM) {
- // Int assignment to enum not valid when exact int assigned is known but is not an enum value
- if (p_cast->operand->is_constant && p_cast->operand->reduced) {
- if (enum_get_value_name(cast_type, p_cast->operand->reduced_value) != StringName()) {
- valid = true;
- } else {
- valid = false;
- more_informative_error = true;
- push_error(vformat(R"(Invalid cast. Enum "%s" does not have enum value %d.)", cast_type.to_string(), p_cast->operand->reduced_value.operator uint64_t()), p_cast->cast_type);
- }
- } else {
- // Can't statically tell whether int has a corresponding enum value. Valid but dangerous!
- mark_node_unsafe(p_cast);
- valid = true;
- }
+ if (op_type.builtin_type == Variant::INT && cast_type.kind == GDScriptParser::DataType::ENUM) {
+ mark_node_unsafe(p_cast);
+ valid = true;
} else if (op_type.kind == GDScriptParser::DataType::BUILTIN && cast_type.kind == GDScriptParser::DataType::BUILTIN) {
valid = Variant::can_convert(op_type.builtin_type, cast_type.builtin_type);
} else if (op_type.kind != GDScriptParser::DataType::BUILTIN && cast_type.kind != GDScriptParser::DataType::BUILTIN) {
valid = is_type_compatible(cast_type, op_type) || is_type_compatible(op_type, cast_type);
}
- if (!valid && !more_informative_error) {
+ if (!valid) {
push_error(vformat(R"(Invalid cast. Cannot convert from "%s" to "%s".)", op_type.to_string(), cast_type.to_string()), p_cast->cast_type);
}
}
- } else {
- mark_node_unsafe(p_cast);
- }
-#ifdef DEBUG_ENABLED
- if (p_cast->operand->get_datatype().is_variant()) {
- parser->push_warning(p_cast, GDScriptWarning::UNSAFE_CAST, cast_type.to_string());
- mark_node_unsafe(p_cast);
}
-#endif
-
- // TODO: Perform cast on constants.
}
void GDScriptAnalyzer::reduce_dictionary(GDScriptParser::DictionaryNode *p_dictionary) {
@@ -2941,10 +3116,12 @@ void GDScriptAnalyzer::reduce_identifier_from_base_set_class(GDScriptParser::Ide
p_identifier->set_datatype(p_identifier_datatype);
Error err = OK;
- GDScript *scr = GDScriptCache::get_shallow_script(p_identifier_datatype.script_path, err).ptr();
- ERR_FAIL_COND_MSG(err != OK, vformat(R"(Error while getting cache for script "%s".)", p_identifier_datatype.script_path));
- scr = scr->find_class(p_identifier_datatype.class_type->fqcn);
- p_identifier->reduced_value = scr;
+ Ref<GDScript> scr = GDScriptCache::get_shallow_script(p_identifier_datatype.script_path, err);
+ if (err) {
+ push_error(vformat(R"(Error while getting cache for script "%s".)", p_identifier_datatype.script_path), p_identifier);
+ return;
+ }
+ p_identifier->reduced_value = scr->find_class(p_identifier_datatype.class_type->fqcn);
p_identifier->is_constant = true;
}
@@ -2988,7 +3165,22 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
p_identifier->reduced_value = result;
p_identifier->set_datatype(type_from_variant(result, p_identifier));
} else if (base.is_hard_type()) {
- push_error(vformat(R"(Cannot find constant "%s" on type "%s".)", name, base.to_string()), p_identifier);
+#ifdef TOOLS_ENABLED
+#ifndef DISABLE_DEPRECATED
+ String rename_hint = String();
+ if (GLOBAL_GET(GDScriptWarning::get_settings_path_from_code(GDScriptWarning::Code::RENAMED_IN_GD4_HINT)).booleanize()) {
+ const char *renamed_identifier_name = check_for_renamed_identifier(name, p_identifier->type);
+ if (renamed_identifier_name) {
+ rename_hint = " " + vformat(R"(Did you mean to use "%s"?)", renamed_identifier_name);
+ }
+ }
+ push_error(vformat(R"(Cannot find constant "%s" on base "%s".%s)", name, base.to_string(), rename_hint), p_identifier);
+#else // !DISABLE_DEPRECATED
+ push_error(vformat(R"(Cannot find constant "%s" on base "%s".)", name, base.to_string()), p_identifier);
+#endif // DISABLE_DEPRECATED
+#else
+ push_error(vformat(R"(Cannot find constant "%s" on base "%s".)", name, base.to_string()), p_identifier);
+#endif
}
} else {
switch (base.builtin_type) {
@@ -3017,7 +3209,22 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
}
}
if (base.is_hard_type()) {
+#ifdef TOOLS_ENABLED
+#ifndef DISABLE_DEPRECATED
+ String rename_hint = String();
+ if (GLOBAL_GET(GDScriptWarning::get_settings_path_from_code(GDScriptWarning::Code::RENAMED_IN_GD4_HINT)).booleanize()) {
+ const char *renamed_identifier_name = check_for_renamed_identifier(name, p_identifier->type);
+ if (renamed_identifier_name) {
+ rename_hint = " " + vformat(R"(Did you mean to use "%s"?)", renamed_identifier_name);
+ }
+ }
+ push_error(vformat(R"(Cannot find property "%s" on base "%s".%s)", name, base.to_string(), rename_hint), p_identifier);
+#else // !DISABLE_DEPRECATED
+ push_error(vformat(R"(Cannot find property "%s" on base "%s".)", name, base.to_string()), p_identifier);
+#endif // DISABLE_DEPRECATED
+#else
push_error(vformat(R"(Cannot find property "%s" on base "%s".)", name, base.to_string()), p_identifier);
+#endif
}
}
}
@@ -3356,7 +3563,22 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
if (GDScriptUtilityFunctions::function_exists(name)) {
push_error(vformat(R"(Built-in function "%s" cannot be used as an identifier.)", name), p_identifier);
} else {
+#ifdef TOOLS_ENABLED
+#ifndef DISABLE_DEPRECATED
+ String rename_hint = String();
+ if (GLOBAL_GET(GDScriptWarning::get_settings_path_from_code(GDScriptWarning::Code::RENAMED_IN_GD4_HINT)).booleanize()) {
+ const char *renamed_identifier_name = check_for_renamed_identifier(name, p_identifier->type);
+ if (renamed_identifier_name) {
+ rename_hint = " " + vformat(R"(Did you mean to use "%s"?)", renamed_identifier_name);
+ }
+ }
+ push_error(vformat(R"(Identifier "%s" not declared in the current scope.%s)", name, rename_hint), p_identifier);
+#else // !DISABLE_DEPRECATED
push_error(vformat(R"(Identifier "%s" not declared in the current scope.)", name), p_identifier);
+#endif // DISABLE_DEPRECATED
+#else
+ push_error(vformat(R"(Identifier "%s" not declared in the current scope.)", name), p_identifier);
+#endif
}
GDScriptParser::DataType dummy;
dummy.kind = GDScriptParser::DataType::VARIANT;
@@ -3488,12 +3710,6 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
reduce_identifier(static_cast<GDScriptParser::IdentifierNode *>(p_subscript->base), true);
} else {
reduce_expression(p_subscript->base);
-
- if (p_subscript->base->type == GDScriptParser::Node::ARRAY) {
- const_fold_array(static_cast<GDScriptParser::ArrayNode *>(p_subscript->base), false);
- } else if (p_subscript->base->type == GDScriptParser::Node::DICTIONARY) {
- const_fold_dictionary(static_cast<GDScriptParser::DictionaryNode *>(p_subscript->base), false);
- }
}
GDScriptParser::DataType result_type;
@@ -3534,6 +3750,7 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
}
#endif
result_type.kind = GDScriptParser::DataType::VARIANT;
+ mark_node_unsafe(p_subscript);
}
}
if (!valid) {
@@ -3735,10 +3952,10 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
p_subscript->set_datatype(result_type);
}
-void GDScriptAnalyzer::reduce_ternary_op(GDScriptParser::TernaryOpNode *p_ternary_op) {
+void GDScriptAnalyzer::reduce_ternary_op(GDScriptParser::TernaryOpNode *p_ternary_op, bool p_is_root) {
reduce_expression(p_ternary_op->condition);
- reduce_expression(p_ternary_op->true_expr);
- reduce_expression(p_ternary_op->false_expr);
+ reduce_expression(p_ternary_op->true_expr, p_is_root);
+ reduce_expression(p_ternary_op->false_expr, p_is_root);
GDScriptParser::DataType result;
@@ -3817,58 +4034,146 @@ void GDScriptAnalyzer::reduce_unary_op(GDScriptParser::UnaryOpNode *p_unary_op)
p_unary_op->set_datatype(result);
}
-void GDScriptAnalyzer::const_fold_array(GDScriptParser::ArrayNode *p_array, bool p_is_const) {
+Variant GDScriptAnalyzer::make_expression_reduced_value(GDScriptParser::ExpressionNode *p_expression, bool &is_reduced) {
+ Variant value;
+
+ if (p_expression->is_constant) {
+ is_reduced = true;
+ value = p_expression->reduced_value;
+ } else if (p_expression->type == GDScriptParser::Node::ARRAY) {
+ value = make_array_reduced_value(static_cast<GDScriptParser::ArrayNode *>(p_expression), is_reduced);
+ } else if (p_expression->type == GDScriptParser::Node::DICTIONARY) {
+ value = make_dictionary_reduced_value(static_cast<GDScriptParser::DictionaryNode *>(p_expression), is_reduced);
+ } else if (p_expression->type == GDScriptParser::Node::SUBSCRIPT) {
+ value = make_subscript_reduced_value(static_cast<GDScriptParser::SubscriptNode *>(p_expression), is_reduced);
+ }
+
+ return value;
+}
+
+Variant GDScriptAnalyzer::make_array_reduced_value(GDScriptParser::ArrayNode *p_array, bool &is_reduced) {
+ Array array = p_array->get_datatype().has_container_element_type() ? make_array_from_element_datatype(p_array->get_datatype().get_container_element_type()) : Array();
+
+ array.resize(p_array->elements.size());
for (int i = 0; i < p_array->elements.size(); i++) {
GDScriptParser::ExpressionNode *element = p_array->elements[i];
- if (element->type == GDScriptParser::Node::ARRAY) {
- const_fold_array(static_cast<GDScriptParser::ArrayNode *>(element), p_is_const);
- } else if (element->type == GDScriptParser::Node::DICTIONARY) {
- const_fold_dictionary(static_cast<GDScriptParser::DictionaryNode *>(element), p_is_const);
+ bool is_element_value_reduced = false;
+ Variant element_value = make_expression_reduced_value(element, is_element_value_reduced);
+ if (!is_element_value_reduced) {
+ return Variant();
}
- if (!element->is_constant) {
- return;
- }
+ array[i] = element_value;
}
- Array array;
- array.resize(p_array->elements.size());
- for (int i = 0; i < p_array->elements.size(); i++) {
- array[i] = p_array->elements[i]->reduced_value;
- }
- if (p_is_const) {
- array.set_read_only(true);
- }
- p_array->is_constant = true;
- p_array->reduced_value = array;
+ array.make_read_only();
+
+ is_reduced = true;
+ return array;
}
-void GDScriptAnalyzer::const_fold_dictionary(GDScriptParser::DictionaryNode *p_dictionary, bool p_is_const) {
+Variant GDScriptAnalyzer::make_dictionary_reduced_value(GDScriptParser::DictionaryNode *p_dictionary, bool &is_reduced) {
+ Dictionary dictionary;
+
for (int i = 0; i < p_dictionary->elements.size(); i++) {
const GDScriptParser::DictionaryNode::Pair &element = p_dictionary->elements[i];
- if (element.value->type == GDScriptParser::Node::ARRAY) {
- const_fold_array(static_cast<GDScriptParser::ArrayNode *>(element.value), p_is_const);
- } else if (element.value->type == GDScriptParser::Node::DICTIONARY) {
- const_fold_dictionary(static_cast<GDScriptParser::DictionaryNode *>(element.value), p_is_const);
+ bool is_element_key_reduced = false;
+ Variant element_key = make_expression_reduced_value(element.key, is_element_key_reduced);
+ if (!is_element_key_reduced) {
+ return Variant();
}
- if (!element.key->is_constant || !element.value->is_constant) {
- return;
+ bool is_element_value_reduced = false;
+ Variant element_value = make_expression_reduced_value(element.value, is_element_value_reduced);
+ if (!is_element_value_reduced) {
+ return Variant();
}
+
+ dictionary[element_key] = element_value;
}
- Dictionary dict;
- for (int i = 0; i < p_dictionary->elements.size(); i++) {
- const GDScriptParser::DictionaryNode::Pair &element = p_dictionary->elements[i];
- dict[element.key->reduced_value] = element.value->reduced_value;
+ dictionary.make_read_only();
+
+ is_reduced = true;
+ return dictionary;
+}
+
+Variant GDScriptAnalyzer::make_subscript_reduced_value(GDScriptParser::SubscriptNode *p_subscript, bool &is_reduced) {
+ bool is_base_value_reduced = false;
+ Variant base_value = make_expression_reduced_value(p_subscript->base, is_base_value_reduced);
+ if (!is_base_value_reduced) {
+ return Variant();
+ }
+
+ if (p_subscript->is_attribute) {
+ bool is_valid = false;
+ Variant value = base_value.get_named(p_subscript->attribute->name, is_valid);
+ if (is_valid) {
+ is_reduced = true;
+ return value;
+ } else {
+ return Variant();
+ }
+ } else {
+ bool is_index_value_reduced = false;
+ Variant index_value = make_expression_reduced_value(p_subscript->index, is_index_value_reduced);
+ if (!is_index_value_reduced) {
+ return Variant();
+ }
+
+ bool is_valid = false;
+ Variant value = base_value.get(index_value, &is_valid);
+ if (is_valid) {
+ is_reduced = true;
+ return value;
+ } else {
+ return Variant();
+ }
}
- if (p_is_const) {
- dict.set_read_only(true);
+}
+
+Array GDScriptAnalyzer::make_array_from_element_datatype(const GDScriptParser::DataType &p_element_datatype, const GDScriptParser::Node *p_source_node) {
+ Array array;
+
+ Ref<Script> script_type = p_element_datatype.script_type;
+ if (p_element_datatype.kind == GDScriptParser::DataType::CLASS && script_type.is_null()) {
+ Error err = OK;
+ Ref<GDScript> scr = GDScriptCache::get_shallow_script(p_element_datatype.script_path, err);
+ if (err) {
+ push_error(vformat(R"(Error while getting cache for script "%s".)", p_element_datatype.script_path), p_source_node);
+ return array;
+ }
+ script_type.reference_ptr(scr->find_class(p_element_datatype.class_type->fqcn));
}
- p_dictionary->is_constant = true;
- p_dictionary->reduced_value = dict;
+
+ array.set_typed(p_element_datatype.builtin_type, p_element_datatype.native_type, script_type);
+
+ return array;
+}
+
+Variant GDScriptAnalyzer::make_variable_default_value(GDScriptParser::VariableNode *p_variable) {
+ Variant result = Variant();
+
+ if (p_variable->initializer) {
+ bool is_initializer_value_reduced = false;
+ Variant initializer_value = make_expression_reduced_value(p_variable->initializer, is_initializer_value_reduced);
+ if (is_initializer_value_reduced) {
+ result = initializer_value;
+ }
+ } else {
+ GDScriptParser::DataType datatype = p_variable->get_datatype();
+ if (datatype.is_hard_type() && datatype.kind == GDScriptParser::DataType::BUILTIN && datatype.builtin_type != Variant::OBJECT) {
+ if (datatype.builtin_type == Variant::ARRAY && datatype.has_container_element_type()) {
+ result = make_array_from_element_datatype(datatype.get_container_element_type());
+ } else {
+ VariantInternal::initialize(&result, datatype.builtin_type);
+ }
+ }
+ }
+
+ return result;
}
GDScriptParser::DataType GDScriptAnalyzer::type_from_variant(const Variant &p_value, const GDScriptParser::Node *p_source) {
@@ -4158,26 +4463,22 @@ bool GDScriptAnalyzer::function_signature_from_info(const MethodInfo &p_info, GD
return true;
}
-bool GDScriptAnalyzer::validate_call_arg(const MethodInfo &p_method, const GDScriptParser::CallNode *p_call) {
+void GDScriptAnalyzer::validate_call_arg(const MethodInfo &p_method, const GDScriptParser::CallNode *p_call) {
List<GDScriptParser::DataType> arg_types;
for (const PropertyInfo &E : p_method.arguments) {
arg_types.push_back(type_from_property(E, true));
}
- return validate_call_arg(arg_types, p_method.default_arguments.size(), (p_method.flags & METHOD_FLAG_VARARG) != 0, p_call);
+ validate_call_arg(arg_types, p_method.default_arguments.size(), (p_method.flags & METHOD_FLAG_VARARG) != 0, p_call);
}
-bool GDScriptAnalyzer::validate_call_arg(const List<GDScriptParser::DataType> &p_par_types, int p_default_args_count, bool p_is_vararg, const GDScriptParser::CallNode *p_call) {
- bool valid = true;
-
+void GDScriptAnalyzer::validate_call_arg(const List<GDScriptParser::DataType> &p_par_types, int p_default_args_count, bool p_is_vararg, const GDScriptParser::CallNode *p_call) {
if (p_call->arguments.size() < p_par_types.size() - p_default_args_count) {
push_error(vformat(R"*(Too few arguments for "%s()" call. Expected at least %d but received %d.)*", p_call->function_name, p_par_types.size() - p_default_args_count, p_call->arguments.size()), p_call);
- valid = false;
}
if (!p_is_vararg && p_call->arguments.size() > p_par_types.size()) {
push_error(vformat(R"*(Too many arguments for "%s()" call. Expected at most %d but received %d.)*", p_call->function_name, p_par_types.size(), p_call->arguments.size()), p_call->arguments[p_par_types.size()]);
- valid = false;
}
for (int i = 0; i < p_call->arguments.size(); i++) {
@@ -4186,9 +4487,13 @@ bool GDScriptAnalyzer::validate_call_arg(const List<GDScriptParser::DataType> &p
break;
}
GDScriptParser::DataType par_type = p_par_types[i];
+
+ if (par_type.is_hard_type() && p_call->arguments[i]->is_constant) {
+ update_const_expression_builtin_type(p_call->arguments[i], par_type, "pass");
+ }
GDScriptParser::DataType arg_type = p_call->arguments[i]->get_datatype();
- if (arg_type.is_variant()) {
+ if ((arg_type.is_variant() || !arg_type.is_hard_type()) && !(par_type.is_hard_type() && par_type.is_variant())) {
// Argument can be anything, so this is unsafe.
mark_node_unsafe(p_call->arguments[i]);
} else if (par_type.is_hard_type() && !is_type_compatible(par_type, arg_type, true)) {
@@ -4198,17 +4503,13 @@ bool GDScriptAnalyzer::validate_call_arg(const List<GDScriptParser::DataType> &p
push_error(vformat(R"*(Invalid argument for "%s()" function: argument %d should be "%s" but is "%s".)*",
p_call->function_name, i + 1, par_type.to_string(), arg_type.to_string()),
p_call->arguments[i]);
- valid = false;
}
#ifdef DEBUG_ENABLED
- } else {
- if (par_type.kind == GDScriptParser::DataType::BUILTIN && par_type.builtin_type == Variant::INT && arg_type.kind == GDScriptParser::DataType::BUILTIN && arg_type.builtin_type == Variant::FLOAT) {
- parser->push_warning(p_call, GDScriptWarning::NARROWING_CONVERSION, p_call->function_name);
- }
+ } else if (par_type.kind == GDScriptParser::DataType::BUILTIN && par_type.builtin_type == Variant::INT && arg_type.kind == GDScriptParser::DataType::BUILTIN && arg_type.builtin_type == Variant::FLOAT) {
+ parser->push_warning(p_call, GDScriptWarning::NARROWING_CONVERSION, p_call->function_name);
#endif
}
}
- return valid;
}
#ifdef DEBUG_ENABLED
@@ -4343,14 +4644,8 @@ bool GDScriptAnalyzer::is_type_compatible(const GDScriptParser::DataType &p_targ
}
if (valid && p_target.builtin_type == Variant::ARRAY && p_source.builtin_type == Variant::ARRAY) {
// Check the element type.
- if (p_target.has_container_element_type()) {
- if (!p_source.has_container_element_type()) {
- // TODO: Maybe this is valid but unsafe?
- // Variant array can't be appended to typed array.
- valid = false;
- } else {
- valid = is_type_compatible(p_target.get_container_element_type(), p_source.get_container_element_type(), p_allow_implicit_conversion);
- }
+ if (p_target.has_container_element_type() && p_source.has_container_element_type()) {
+ valid = p_target.get_container_element_type() == p_source.get_container_element_type();
}
}
return valid;
@@ -4360,7 +4655,7 @@ bool GDScriptAnalyzer::is_type_compatible(const GDScriptParser::DataType &p_targ
if (p_source.kind == GDScriptParser::DataType::BUILTIN && p_source.builtin_type == Variant::INT) {
#ifdef DEBUG_ENABLED
if (p_source_node) {
- parser->push_warning(p_source_node, GDScriptWarning::INT_ASSIGNED_TO_ENUM);
+ parser->push_warning(p_source_node, GDScriptWarning::INT_AS_ENUM_WITHOUT_CAST);
}
#endif
return true;
@@ -4452,7 +4747,7 @@ bool GDScriptAnalyzer::is_type_compatible(const GDScriptParser::DataType &p_targ
return ClassDB::is_parent_class(src_native, GDScript::get_class_static());
}
while (src_class != nullptr) {
- if (src_class->fqcn == p_target.class_type->fqcn) {
+ if (src_class == p_target.class_type || src_class->fqcn == p_target.class_type->fqcn) {
return true;
}
src_class = src_class->base_type.class_type;
@@ -4552,6 +4847,11 @@ Ref<GDScriptParserRef> GDScriptAnalyzer::get_parser_for(const String &p_path) {
}
Error GDScriptAnalyzer::resolve_inheritance() {
+ // Apply annotations.
+ for (GDScriptParser::AnnotationNode *&E : parser->head->annotations) {
+ resolve_annotation(E);
+ E->apply(parser, parser->head);
+ }
return resolve_class_inheritance(parser->head, true);
}
diff --git a/modules/gdscript/gdscript_analyzer.h b/modules/gdscript/gdscript_analyzer.h
index b22d47982f..b51564fb0a 100644
--- a/modules/gdscript/gdscript_analyzer.h
+++ b/modules/gdscript/gdscript_analyzer.h
@@ -37,6 +37,10 @@
#include "gdscript_cache.h"
#include "gdscript_parser.h"
+#ifdef TOOLS_ENABLED
+#include "editor/project_converter_3_to_4.h"
+#endif
+
class GDScriptAnalyzer {
GDScriptParser *parser = nullptr;
HashMap<String, Ref<GDScriptParserRef>> depended_parsers;
@@ -99,24 +103,28 @@ class GDScriptAnalyzer {
void reduce_preload(GDScriptParser::PreloadNode *p_preload);
void reduce_self(GDScriptParser::SelfNode *p_self);
void reduce_subscript(GDScriptParser::SubscriptNode *p_subscript);
- void reduce_ternary_op(GDScriptParser::TernaryOpNode *p_ternary_op);
+ void reduce_ternary_op(GDScriptParser::TernaryOpNode *p_ternary_op, bool p_is_root = false);
void reduce_unary_op(GDScriptParser::UnaryOpNode *p_unary_op);
- void const_fold_array(GDScriptParser::ArrayNode *p_array, bool p_is_const);
- void const_fold_dictionary(GDScriptParser::DictionaryNode *p_dictionary, bool p_is_const);
+ Variant make_expression_reduced_value(GDScriptParser::ExpressionNode *p_expression, bool &is_reduced);
+ Variant make_array_reduced_value(GDScriptParser::ArrayNode *p_array, bool &is_reduced);
+ Variant make_dictionary_reduced_value(GDScriptParser::DictionaryNode *p_dictionary, bool &is_reduced);
+ Variant make_subscript_reduced_value(GDScriptParser::SubscriptNode *p_subscript, bool &is_reduced);
// Helpers.
+ Array make_array_from_element_datatype(const GDScriptParser::DataType &p_element_datatype, const GDScriptParser::Node *p_source_node = nullptr);
GDScriptParser::DataType type_from_variant(const Variant &p_value, const GDScriptParser::Node *p_source);
static GDScriptParser::DataType type_from_metatype(const GDScriptParser::DataType &p_meta_type);
GDScriptParser::DataType type_from_property(const PropertyInfo &p_property, bool p_is_arg = false) const;
GDScriptParser::DataType make_global_class_meta_type(const StringName &p_class_name, const GDScriptParser::Node *p_source);
bool get_function_signature(GDScriptParser::Node *p_source, bool p_is_constructor, GDScriptParser::DataType base_type, const StringName &p_function, GDScriptParser::DataType &r_return_type, List<GDScriptParser::DataType> &r_par_types, int &r_default_arg_count, bool &r_static, bool &r_vararg);
bool function_signature_from_info(const MethodInfo &p_info, GDScriptParser::DataType &r_return_type, List<GDScriptParser::DataType> &r_par_types, int &r_default_arg_count, bool &r_static, bool &r_vararg);
- bool validate_call_arg(const List<GDScriptParser::DataType> &p_par_types, int p_default_args_count, bool p_is_vararg, const GDScriptParser::CallNode *p_call);
- bool validate_call_arg(const MethodInfo &p_method, const GDScriptParser::CallNode *p_call);
+ void validate_call_arg(const List<GDScriptParser::DataType> &p_par_types, int p_default_args_count, bool p_is_vararg, const GDScriptParser::CallNode *p_call);
+ void validate_call_arg(const MethodInfo &p_method, const GDScriptParser::CallNode *p_call);
GDScriptParser::DataType get_operation_type(Variant::Operator p_operation, const GDScriptParser::DataType &p_a, const GDScriptParser::DataType &p_b, bool &r_valid, const GDScriptParser::Node *p_source);
GDScriptParser::DataType get_operation_type(Variant::Operator p_operation, const GDScriptParser::DataType &p_a, bool &r_valid, const GDScriptParser::Node *p_source);
- void update_array_literal_element_type(const GDScriptParser::DataType &p_base_type, GDScriptParser::ArrayNode *p_array_literal);
+ void update_const_expression_builtin_type(GDScriptParser::ExpressionNode *p_expression, const GDScriptParser::DataType &p_type, const char *p_usage, bool p_is_cast = false);
+ void update_array_literal_element_type(GDScriptParser::ArrayNode *p_array, const GDScriptParser::DataType &p_element_type);
bool is_type_compatible(const GDScriptParser::DataType &p_target, const GDScriptParser::DataType &p_source, bool p_allow_implicit_conversion = false, const GDScriptParser::Node *p_source_node = nullptr);
void push_error(const String &p_message, const GDScriptParser::Node *p_origin = nullptr);
void mark_node_unsafe(const GDScriptParser::Node *p_node);
@@ -124,11 +132,18 @@ class GDScriptAnalyzer {
void mark_lambda_use_self();
bool class_exists(const StringName &p_class) const;
Ref<GDScriptParserRef> get_parser_for(const String &p_path);
- static void reduce_identifier_from_base_set_class(GDScriptParser::IdentifierNode *p_identifier, GDScriptParser::DataType p_identifier_datatype);
+ void reduce_identifier_from_base_set_class(GDScriptParser::IdentifierNode *p_identifier, GDScriptParser::DataType p_identifier_datatype);
#ifdef DEBUG_ENABLED
bool is_shadowing(GDScriptParser::IdentifierNode *p_local, const String &p_context);
#endif
+#ifdef TOOLS_ENABLED
+#ifndef DISABLE_DEPRECATED
+ const char *get_rename_from_map(const char *map[][2], String key);
+ const char *check_for_renamed_identifier(String identifier, GDScriptParser::Node::Type type);
+#endif // DISABLE_DEPRECATED
+#endif // TOOLS_ENABLED
+
public:
Error resolve_inheritance();
Error resolve_interface();
@@ -136,6 +151,8 @@ public:
Error resolve_dependencies();
Error analyze();
+ Variant make_variable_default_value(GDScriptParser::VariableNode *p_variable);
+
GDScriptAnalyzer(GDScriptParser *p_parser);
};
diff --git a/modules/gdscript/gdscript_byte_codegen.cpp b/modules/gdscript/gdscript_byte_codegen.cpp
index 6c80fb7665..ec7a2b0f1c 100644
--- a/modules/gdscript/gdscript_byte_codegen.cpp
+++ b/modules/gdscript/gdscript_byte_codegen.cpp
@@ -401,6 +401,16 @@ GDScriptFunction *GDScriptByteCodeGenerator::write_end() {
function->_instruction_args_size = instr_args_max;
function->_ptrcall_args_size = ptrcall_max;
+#ifdef DEBUG_ENABLED
+ function->operator_names = operator_names;
+ function->setter_names = setter_names;
+ function->getter_names = getter_names;
+ function->builtin_methods_names = builtin_methods_names;
+ function->constructors_names = constructors_names;
+ function->utilities_names = utilities_names;
+ function->gds_utilities_names = gds_utilities_names;
+#endif
+
ended = true;
return function;
}
@@ -551,6 +561,9 @@ void GDScriptByteCodeGenerator::write_unary_operator(const Address &p_target, Va
append(Address());
append(p_target);
append(op_func);
+#ifdef DEBUG_ENABLED
+ add_debug_name(operator_names, get_operation_pos(op_func), Variant::get_operator_name(p_operator));
+#endif
return;
}
@@ -580,6 +593,9 @@ void GDScriptByteCodeGenerator::write_binary_operator(const Address &p_target, V
append(p_right_operand);
append(p_target);
append(op_func);
+#ifdef DEBUG_ENABLED
+ add_debug_name(operator_names, get_operation_pos(op_func), Variant::get_operator_name(p_operator));
+#endif
return;
}
@@ -765,6 +781,9 @@ void GDScriptByteCodeGenerator::write_set_named(const Address &p_target, const S
append(p_target);
append(p_source);
append(setter);
+#ifdef DEBUG_ENABLED
+ add_debug_name(setter_names, get_setter_pos(setter), p_name);
+#endif
return;
}
append_opcode(GDScriptFunction::OPCODE_SET_NAMED);
@@ -780,6 +799,9 @@ void GDScriptByteCodeGenerator::write_get_named(const Address &p_target, const S
append(p_source);
append(p_target);
append(getter);
+#ifdef DEBUG_ENABLED
+ add_debug_name(getter_names, get_getter_pos(getter), p_name);
+#endif
return;
}
append_opcode(GDScriptFunction::OPCODE_GET_NAMED);
@@ -804,9 +826,13 @@ void GDScriptByteCodeGenerator::write_assign_with_conversion(const Address &p_ta
switch (p_target.type.kind) {
case GDScriptDataType::BUILTIN: {
if (p_target.type.builtin_type == Variant::ARRAY && p_target.type.has_container_element_type()) {
+ const GDScriptDataType &element_type = p_target.type.get_container_element_type();
append_opcode(GDScriptFunction::OPCODE_ASSIGN_TYPED_ARRAY);
append(p_target);
append(p_source);
+ append(get_constant_pos(element_type.script_type) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS));
+ append(element_type.builtin_type);
+ append(element_type.native_type);
} else {
append_opcode(GDScriptFunction::OPCODE_ASSIGN_TYPED_BUILTIN);
append(p_target);
@@ -846,9 +872,13 @@ void GDScriptByteCodeGenerator::write_assign_with_conversion(const Address &p_ta
void GDScriptByteCodeGenerator::write_assign(const Address &p_target, const Address &p_source) {
if (p_target.type.kind == GDScriptDataType::BUILTIN && p_target.type.builtin_type == Variant::ARRAY && p_target.type.has_container_element_type()) {
+ const GDScriptDataType &element_type = p_target.type.get_container_element_type();
append_opcode(GDScriptFunction::OPCODE_ASSIGN_TYPED_ARRAY);
append(p_target);
append(p_source);
+ append(get_constant_pos(element_type.script_type) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS));
+ append(element_type.builtin_type);
+ append(element_type.native_type);
} else if (p_target.type.kind == GDScriptDataType::BUILTIN && p_source.type.kind == GDScriptDataType::BUILTIN && p_target.type.builtin_type != p_source.type.builtin_type) {
// Need conversion.
append_opcode(GDScriptFunction::OPCODE_ASSIGN_TYPED_BUILTIN);
@@ -972,14 +1002,18 @@ void GDScriptByteCodeGenerator::write_call_async(const Address &p_target, const
append(p_function_name);
}
-void GDScriptByteCodeGenerator::write_call_gdscript_utility(const Address &p_target, GDScriptUtilityFunctions::FunctionPtr p_function, const Vector<Address> &p_arguments) {
+void GDScriptByteCodeGenerator::write_call_gdscript_utility(const Address &p_target, const StringName &p_function, const Vector<Address> &p_arguments) {
append_opcode_and_argcount(GDScriptFunction::OPCODE_CALL_GDSCRIPT_UTILITY, 1 + p_arguments.size());
+ GDScriptUtilityFunctions::FunctionPtr gds_function = GDScriptUtilityFunctions::get_function(p_function);
for (int i = 0; i < p_arguments.size(); i++) {
append(p_arguments[i]);
}
append(get_call_target(p_target));
append(p_arguments.size());
- append(p_function);
+ append(gds_function);
+#ifdef DEBUG_ENABLED
+ add_debug_name(gds_utilities_names, get_gds_utility_pos(gds_function), p_function);
+#endif
}
void GDScriptByteCodeGenerator::write_call_utility(const Address &p_target, const StringName &p_function, const Vector<Address> &p_arguments) {
@@ -1012,6 +1046,9 @@ void GDScriptByteCodeGenerator::write_call_utility(const Address &p_target, cons
append(target);
append(p_arguments.size());
append(Variant::get_validated_utility_function(p_function));
+#ifdef DEBUG_ENABLED
+ add_debug_name(utilities_names, get_utility_pos(Variant::get_validated_utility_function(p_function)), p_function);
+#endif
} else {
append_opcode_and_argcount(GDScriptFunction::OPCODE_CALL_UTILITY, 1 + p_arguments.size());
for (int i = 0; i < p_arguments.size(); i++) {
@@ -1074,6 +1111,9 @@ void GDScriptByteCodeGenerator::write_call_builtin_type(const Address &p_target,
append(target);
append(p_arguments.size());
append(Variant::get_validated_builtin_method(p_type, p_method));
+#ifdef DEBUG_ENABLED
+ add_debug_name(builtin_methods_names, get_builtin_method_pos(Variant::get_validated_builtin_method(p_type, p_method)), p_method);
+#endif
}
void GDScriptByteCodeGenerator::write_call_builtin_type(const Address &p_target, const Address &p_base, Variant::Type p_type, const StringName &p_method, const Vector<Address> &p_arguments) {
@@ -1263,6 +1303,9 @@ void GDScriptByteCodeGenerator::write_construct(const Address &p_target, Variant
append(get_call_target(p_target));
append(p_arguments.size());
append(Variant::get_validated_constructor(p_type, valid_constructor));
+#ifdef DEBUG_ENABLED
+ add_debug_name(constructors_names, get_constructor_pos(Variant::get_validated_constructor(p_type, valid_constructor)), Variant::get_type_name(p_type));
+#endif
return;
}
}
@@ -1291,14 +1334,7 @@ void GDScriptByteCodeGenerator::write_construct_typed_array(const Address &p_tar
append(p_arguments[i]);
}
append(get_call_target(p_target));
- if (p_element_type.script_type) {
- Variant script_type = Ref<Script>(p_element_type.script_type);
- int addr = get_constant_pos(script_type);
- addr |= GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS;
- append(addr);
- } else {
- append(Address()); // null.
- }
+ append(get_constant_pos(p_element_type.script_type) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS));
append(p_arguments.size());
append(p_element_type.builtin_type);
append(p_element_type.native_type);
@@ -1543,28 +1579,6 @@ void GDScriptByteCodeGenerator::write_endwhile() {
current_breaks_to_patch.pop_back();
}
-void GDScriptByteCodeGenerator::start_match() {
- match_continues_to_patch.push_back(List<int>());
-}
-
-void GDScriptByteCodeGenerator::start_match_branch() {
- // Patch continue statements.
- for (const int &E : match_continues_to_patch.back()->get()) {
- patch_jump(E);
- }
- match_continues_to_patch.pop_back();
- // Start a new list for next branch.
- match_continues_to_patch.push_back(List<int>());
-}
-
-void GDScriptByteCodeGenerator::end_match() {
- // Patch continue statements.
- for (const int &E : match_continues_to_patch.back()->get()) {
- patch_jump(E);
- }
- match_continues_to_patch.pop_back();
-}
-
void GDScriptByteCodeGenerator::write_break() {
append_opcode(GDScriptFunction::OPCODE_JUMP);
current_breaks_to_patch.back()->get().push_back(opcodes.size());
@@ -1576,12 +1590,6 @@ void GDScriptByteCodeGenerator::write_continue() {
append(continue_addrs.back()->get());
}
-void GDScriptByteCodeGenerator::write_continue_match() {
- append_opcode(GDScriptFunction::OPCODE_JUMP);
- match_continues_to_patch.back()->get().push_back(opcodes.size());
- append(0);
-}
-
void GDScriptByteCodeGenerator::write_breakpoint() {
append_opcode(GDScriptFunction::OPCODE_BREAKPOINT);
}
@@ -1601,14 +1609,10 @@ void GDScriptByteCodeGenerator::write_return(const Address &p_return_value) {
if (function->return_type.kind == GDScriptDataType::BUILTIN && function->return_type.builtin_type == Variant::ARRAY && function->return_type.has_container_element_type()) {
// Typed array.
const GDScriptDataType &element_type = function->return_type.get_container_element_type();
-
- Variant script = element_type.script_type;
- int script_idx = get_constant_pos(script) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS);
-
append_opcode(GDScriptFunction::OPCODE_RETURN_TYPED_ARRAY);
append(p_return_value);
- append(script_idx);
- append(element_type.kind == GDScriptDataType::BUILTIN ? element_type.builtin_type : Variant::OBJECT);
+ append(get_constant_pos(element_type.script_type) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS));
+ append(element_type.builtin_type);
append(element_type.native_type);
} else if (function->return_type.kind == GDScriptDataType::BUILTIN && p_return_value.type.kind == GDScriptDataType::BUILTIN && function->return_type.builtin_type != p_return_value.type.builtin_type) {
// Add conversion.
@@ -1629,15 +1633,10 @@ void GDScriptByteCodeGenerator::write_return(const Address &p_return_value) {
case GDScriptDataType::BUILTIN: {
if (function->return_type.builtin_type == Variant::ARRAY && function->return_type.has_container_element_type()) {
const GDScriptDataType &element_type = function->return_type.get_container_element_type();
-
- Variant script = function->return_type.script_type;
- int script_idx = get_constant_pos(script);
- script_idx |= (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS);
-
append_opcode(GDScriptFunction::OPCODE_RETURN_TYPED_ARRAY);
append(p_return_value);
- append(script_idx);
- append(element_type.kind == GDScriptDataType::BUILTIN ? element_type.builtin_type : Variant::OBJECT);
+ append(get_constant_pos(element_type.script_type) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS));
+ append(element_type.builtin_type);
append(element_type.native_type);
} else {
append_opcode(GDScriptFunction::OPCODE_RETURN_TYPED_BUILTIN);
diff --git a/modules/gdscript/gdscript_byte_codegen.h b/modules/gdscript/gdscript_byte_codegen.h
index 171c505116..8aa02b86c4 100644
--- a/modules/gdscript/gdscript_byte_codegen.h
+++ b/modules/gdscript/gdscript_byte_codegen.h
@@ -95,6 +95,24 @@ class GDScriptByteCodeGenerator : public GDScriptCodeGenerator {
RBMap<MethodBind *, int> method_bind_map;
RBMap<GDScriptFunction *, int> lambdas_map;
+#if DEBUG_ENABLED
+ // Keep method and property names for pointer and validated operations.
+ // Used when disassembling the bytecode.
+ Vector<String> operator_names;
+ Vector<String> setter_names;
+ Vector<String> getter_names;
+ Vector<String> builtin_methods_names;
+ Vector<String> constructors_names;
+ Vector<String> utilities_names;
+ Vector<String> gds_utilities_names;
+ void add_debug_name(Vector<String> &vector, int index, const String &name) {
+ if (index >= vector.size()) {
+ vector.resize(index + 1);
+ }
+ vector.write[index] = name;
+ }
+#endif
+
// Lists since these can be nested.
List<int> if_jmp_addrs;
List<int> for_jmp_addrs;
@@ -113,7 +131,6 @@ class GDScriptByteCodeGenerator : public GDScriptCodeGenerator {
List<int> ternary_jump_skip_pos;
List<List<int>> current_breaks_to_patch;
- List<List<int>> match_continues_to_patch;
void add_stack_identifier(const StringName &p_id, int p_stackpos) {
if (locals.size() > max_locals) {
@@ -468,8 +485,8 @@ public:
virtual void write_super_call(const Address &p_target, const StringName &p_function_name, const Vector<Address> &p_arguments) override;
virtual void write_call_async(const Address &p_target, const Address &p_base, const StringName &p_function_name, const Vector<Address> &p_arguments) override;
virtual void write_call_utility(const Address &p_target, const StringName &p_function, const Vector<Address> &p_arguments) override;
- virtual void write_call_gdscript_utility(const Address &p_target, GDScriptUtilityFunctions::FunctionPtr p_function, const Vector<Address> &p_arguments) override;
void write_call_builtin_type(const Address &p_target, const Address &p_base, Variant::Type p_type, const StringName &p_method, bool p_is_static, const Vector<Address> &p_arguments);
+ virtual void write_call_gdscript_utility(const Address &p_target, const StringName &p_function, const Vector<Address> &p_arguments) override;
virtual void write_call_builtin_type(const Address &p_target, const Address &p_base, Variant::Type p_type, const StringName &p_method, const Vector<Address> &p_arguments) override;
virtual void write_call_builtin_type_static(const Address &p_target, Variant::Type p_type, const StringName &p_method, const Vector<Address> &p_arguments) override;
virtual void write_call_native_static(const Address &p_target, const StringName &p_class, const StringName &p_method, const Vector<Address> &p_arguments) override;
@@ -496,12 +513,8 @@ public:
virtual void start_while_condition() override;
virtual void write_while(const Address &p_condition) override;
virtual void write_endwhile() override;
- virtual void start_match() override;
- virtual void start_match_branch() override;
- virtual void end_match() override;
virtual void write_break() override;
virtual void write_continue() override;
- virtual void write_continue_match() override;
virtual void write_breakpoint() override;
virtual void write_newline(int p_line) override;
virtual void write_return(const Address &p_return_value) override;
diff --git a/modules/gdscript/gdscript_codegen.h b/modules/gdscript/gdscript_codegen.h
index e885938eba..6d42d152b9 100644
--- a/modules/gdscript/gdscript_codegen.h
+++ b/modules/gdscript/gdscript_codegen.h
@@ -121,7 +121,7 @@ public:
virtual void write_super_call(const Address &p_target, const StringName &p_function_name, const Vector<Address> &p_arguments) = 0;
virtual void write_call_async(const Address &p_target, const Address &p_base, const StringName &p_function_name, const Vector<Address> &p_arguments) = 0;
virtual void write_call_utility(const Address &p_target, const StringName &p_function, const Vector<Address> &p_arguments) = 0;
- virtual void write_call_gdscript_utility(const Address &p_target, GDScriptUtilityFunctions::FunctionPtr p_function, const Vector<Address> &p_arguments) = 0;
+ virtual void write_call_gdscript_utility(const Address &p_target, const StringName &p_function, const Vector<Address> &p_arguments) = 0;
virtual void write_call_builtin_type(const Address &p_target, const Address &p_base, Variant::Type p_type, const StringName &p_method, const Vector<Address> &p_arguments) = 0;
virtual void write_call_builtin_type_static(const Address &p_target, Variant::Type p_type, const StringName &p_method, const Vector<Address> &p_arguments) = 0;
virtual void write_call_native_static(const Address &p_target, const StringName &p_class, const StringName &p_method, const Vector<Address> &p_arguments) = 0;
@@ -148,12 +148,8 @@ public:
virtual void start_while_condition() = 0; // Used to allow a jump to the expression evaluation.
virtual void write_while(const Address &p_condition) = 0;
virtual void write_endwhile() = 0;
- virtual void start_match() = 0;
- virtual void start_match_branch() = 0;
- virtual void end_match() = 0;
virtual void write_break() = 0;
virtual void write_continue() = 0;
- virtual void write_continue_match() = 0;
virtual void write_breakpoint() = 0;
virtual void write_newline(int p_line) = 0;
virtual void write_return(const Address &p_return_value) = 0;
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index d63a1b4536..46cd4b0d55 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -196,7 +196,11 @@ static bool _is_exact_type(const PropertyInfo &p_par_type, const GDScriptDataTyp
}
}
-static bool _have_exact_arguments(const MethodBind *p_method, const Vector<GDScriptCodeGenerator::Address> &p_arguments) {
+static bool _can_use_ptrcall(const MethodBind *p_method, const Vector<GDScriptCodeGenerator::Address> &p_arguments) {
+ if (p_method->is_vararg()) {
+ // ptrcall won't work with vararg methods.
+ return false;
+ }
if (p_method->get_argument_count() != p_arguments.size()) {
// ptrcall won't work with default arguments.
return false;
@@ -546,7 +550,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
gen->write_call_utility(result, call->function_name, arguments);
} else if (!call->is_super && call->callee->type == GDScriptParser::Node::IDENTIFIER && GDScriptUtilityFunctions::function_exists(call->function_name)) {
// GDScript utility function.
- gen->write_call_gdscript_utility(result, GDScriptUtilityFunctions::get_function(call->function_name), arguments);
+ gen->write_call_gdscript_utility(result, call->function_name, arguments);
} else {
// Regular function.
const GDScriptParser::ExpressionNode *callee = call->callee;
@@ -563,7 +567,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
self.mode = GDScriptCodeGenerator::Address::SELF;
MethodBind *method = ClassDB::get_method(codegen.script->native->get_name(), call->function_name);
- if (_have_exact_arguments(method, arguments)) {
+ if (_can_use_ptrcall(method, arguments)) {
// Exact arguments, use ptrcall.
gen->write_call_ptrcall(result, self, method, arguments);
} else {
@@ -613,7 +617,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
}
if (ClassDB::class_exists(class_name) && ClassDB::has_method(class_name, call->function_name)) {
MethodBind *method = ClassDB::get_method(class_name, call->function_name);
- if (_have_exact_arguments(method, arguments)) {
+ if (_can_use_ptrcall(method, arguments)) {
// Exact arguments, use ptrcall.
gen->write_call_ptrcall(result, base, method, arguments);
} else {
@@ -1410,7 +1414,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_match_pattern(CodeGen &c
GDScriptCodeGenerator::Address value_length_addr = codegen.add_temporary(temp_type);
Vector<GDScriptCodeGenerator::Address> len_args;
len_args.push_back(p_value_addr);
- codegen.generator->write_call_gdscript_utility(value_length_addr, GDScriptUtilityFunctions::get_function("len"), len_args);
+ codegen.generator->write_call_gdscript_utility(value_length_addr, "len", len_args);
// Test length compatibility.
temp_type.builtin_type = Variant::BOOL;
@@ -1508,7 +1512,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_match_pattern(CodeGen &c
GDScriptCodeGenerator::Address value_length_addr = codegen.add_temporary(temp_type);
Vector<GDScriptCodeGenerator::Address> func_args;
func_args.push_back(p_value_addr);
- codegen.generator->write_call_gdscript_utility(value_length_addr, GDScriptUtilityFunctions::get_function("len"), func_args);
+ codegen.generator->write_call_gdscript_utility(value_length_addr, "len", func_args);
// Test length compatibility.
temp_type.builtin_type = Variant::BOOL;
@@ -1679,7 +1683,6 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui
case GDScriptParser::Node::MATCH: {
const GDScriptParser::MatchNode *match = static_cast<const GDScriptParser::MatchNode *>(s);
- gen->start_match();
codegen.start_block();
// Evaluate the match expression.
@@ -1718,7 +1721,6 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui
const GDScriptParser::MatchBranchNode *branch = match->branches[j];
- gen->start_match_branch(); // Need so lower level code can patch 'continue' jumps.
codegen.start_block(); // Create an extra block around for binds.
// Add locals in block before patterns, so temporaries don't use the stack address for binds.
@@ -1756,8 +1758,6 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui
for (int j = 0; j < match->branches.size(); j++) {
gen->write_endif();
}
-
- gen->end_match();
} break;
case GDScriptParser::Node::IF: {
const GDScriptParser::IfNode *if_n = static_cast<const GDScriptParser::IfNode *>(s);
@@ -1845,12 +1845,7 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui
gen->write_break();
} break;
case GDScriptParser::Node::CONTINUE: {
- const GDScriptParser::ContinueNode *cont = static_cast<const GDScriptParser::ContinueNode *>(s);
- if (cont->is_for_match) {
- gen->write_continue_match();
- } else {
- gen->write_continue();
- }
+ gen->write_continue();
} break;
case GDScriptParser::Node::RETURN: {
const GDScriptParser::ReturnNode *return_n = static_cast<const GDScriptParser::ReturnNode *>(s);
@@ -1864,7 +1859,12 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui
}
}
- gen->write_return(return_value);
+ if (return_n->void_return) {
+ // Always return "null", even if the expression is a call to a void function.
+ gen->write_return(codegen.add_constant(Variant()));
+ } else {
+ gen->write_return(return_value);
+ }
if (return_value.mode == GDScriptCodeGenerator::Address::TEMPORARY) {
codegen.generator->pop_temporary();
}
@@ -1909,14 +1909,6 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui
bool initialized = false;
if (lv->initializer != nullptr) {
- // For typed arrays we need to make sure this is already initialized correctly so typed assignment work.
- if (local_type.has_type && local_type.builtin_type == Variant::ARRAY) {
- if (local_type.has_container_element_type()) {
- codegen.generator->write_construct_typed_array(local, local_type.get_container_element_type(), Vector<GDScriptCodeGenerator::Address>());
- } else {
- codegen.generator->write_construct_array(local, Vector<GDScriptCodeGenerator::Address>());
- }
- }
GDScriptCodeGenerator::Address src_address = _parse_expression(codegen, err, lv->initializer);
if (err) {
return err;
@@ -2057,14 +2049,6 @@ GDScriptFunction *GDScriptCompiler::_parse_function(Error &r_error, GDScript *p_
// Emit proper line change.
codegen.generator->write_newline(field->initializer->start_line);
- // For typed arrays we need to make sure this is already initialized correctly so typed assignment work.
- if (field_type.has_type && field_type.builtin_type == Variant::ARRAY) {
- if (field_type.has_container_element_type()) {
- codegen.generator->write_construct_typed_array(dst_address, field_type.get_container_element_type(), Vector<GDScriptCodeGenerator::Address>());
- } else {
- codegen.generator->write_construct_array(dst_address, Vector<GDScriptCodeGenerator::Address>());
- }
- }
GDScriptCodeGenerator::Address src_address = _parse_expression(codegen, r_error, field->initializer, false, true);
if (r_error) {
memdelete(codegen.generator);
@@ -2105,17 +2089,6 @@ GDScriptFunction *GDScriptCompiler::_parse_function(Error &r_error, GDScript *p_
return nullptr;
}
GDScriptCodeGenerator::Address dst_addr = codegen.parameters[parameter->identifier->name];
-
- // For typed arrays we need to make sure this is already initialized correctly so typed assignment work.
- GDScriptDataType par_type = dst_addr.type;
- if (par_type.has_type && par_type.builtin_type == Variant::ARRAY) {
- if (par_type.has_container_element_type()) {
- codegen.generator->write_construct_typed_array(dst_addr, par_type.get_container_element_type(), Vector<GDScriptCodeGenerator::Address>());
- } else {
- codegen.generator->write_construct_array(dst_addr, Vector<GDScriptCodeGenerator::Address>());
- }
- }
-
codegen.generator->write_assign_default_parameter(dst_addr, src_addr, parameter->use_conversion_assign);
if (src_addr.mode == GDScriptCodeGenerator::Address::TEMPORARY) {
codegen.generator->pop_temporary();
diff --git a/modules/gdscript/gdscript_disassembler.cpp b/modules/gdscript/gdscript_disassembler.cpp
index 4edabdcb40..b5c8a6f478 100644
--- a/modules/gdscript/gdscript_disassembler.cpp
+++ b/modules/gdscript/gdscript_disassembler.cpp
@@ -128,7 +128,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
text += DADDR(3);
text += " = ";
text += DADDR(1);
- text += " <operator function> ";
+ text += " ";
+ text += operator_names[_code_ptr[ip + 4]];
+ text += " ";
text += DADDR(2);
incr += 5;
@@ -230,7 +232,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
text += "set_named validated ";
text += DADDR(1);
text += "[\"";
- text += "<unknown name>";
+ text += setter_names[_code_ptr[ip + 3]];
text += "\"] = ";
text += DADDR(2);
@@ -253,7 +255,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
text += " = ";
text += DADDR(1);
text += "[\"";
- text += "<unknown name>";
+ text += getter_names[_code_ptr[ip + 3]];
text += "\"]";
incr += 4;
@@ -398,7 +400,8 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
text += DADDR(1 + argc);
text += " = ";
- text += "<unknown type>(";
+ text += constructors_names[_code_ptr[ip + 3 + argc]];
+ text += "(";
for (int i = 0; i < argc; i++) {
if (i > 0) {
text += ", ";
@@ -687,7 +690,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
text += DADDR(2 + argc) + " = ";
text += DADDR(1) + ".";
- text += "<unknown method>";
+ text += builtin_methods_names[_code_ptr[ip + 4 + argc]];
text += "(";
@@ -725,12 +728,12 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
case OPCODE_CALL_UTILITY_VALIDATED: {
int instr_var_args = _code_ptr[++ip];
- text += "call-utility ";
+ text += "call-utility validated ";
int argc = _code_ptr[ip + 1 + instr_var_args];
text += DADDR(1 + argc) + " = ";
- text += "<unknown function>";
+ text += utilities_names[_code_ptr[ip + 3 + argc]];
text += "(";
for (int i = 0; i < argc; i++) {
@@ -746,12 +749,12 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
case OPCODE_CALL_GDSCRIPT_UTILITY: {
int instr_var_args = _code_ptr[++ip];
- text += "call-gscript-utility ";
+ text += "call-gdscript-utility ";
int argc = _code_ptr[ip + 1 + instr_var_args];
text += DADDR(1 + argc) + " = ";
- text += "<unknown function>";
+ text += gds_utilities_names[_code_ptr[ip + 3 + argc]];
text += "(";
for (int i = 0; i < argc; i++) {
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 3fc0924b4c..f88ac581ca 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -782,6 +782,7 @@ static void _find_annotation_arguments(const GDScriptParser::AnnotationNode *p_a
}
} else if (p_annotation->name == SNAME("@export_node_path")) {
ScriptLanguage::CodeCompletionOption node("Node", ScriptLanguage::CODE_COMPLETION_KIND_CLASS);
+ node.insert_text = node.display.quote(p_quote_style);
r_result.insert(node.display, node);
List<StringName> node_types;
ClassDB::get_inheriters_from_class("Node", &node_types);
@@ -790,11 +791,13 @@ static void _find_annotation_arguments(const GDScriptParser::AnnotationNode *p_a
continue;
}
ScriptLanguage::CodeCompletionOption option(E, ScriptLanguage::CODE_COMPLETION_KIND_CLASS);
+ option.insert_text = option.display.quote(p_quote_style);
r_result.insert(option.display, option);
}
} else if (p_annotation->name == SNAME("@warning_ignore")) {
for (int warning_code = 0; warning_code < GDScriptWarning::WARNING_MAX; warning_code++) {
ScriptLanguage::CodeCompletionOption warning(GDScriptWarning::get_name_from_code((GDScriptWarning::Code)warning_code).to_lower(), ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT);
+ warning.insert_text = warning.display.quote(p_quote_style);
r_result.insert(warning.display, warning);
}
}
diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h
index 76214f3482..37416a734d 100644
--- a/modules/gdscript/gdscript_function.h
+++ b/modules/gdscript/gdscript_function.h
@@ -505,6 +505,16 @@ private:
Vector<Variant> default_arg_values;
#endif
+#ifdef DEBUG_ENABLED
+ Vector<String> operator_names;
+ Vector<String> setter_names;
+ Vector<String> getter_names;
+ Vector<String> builtin_methods_names;
+ Vector<String> constructors_names;
+ Vector<String> utilities_names;
+ Vector<String> gds_utilities_names;
+#endif
+
List<StackDebug> stack_debug;
Variant _get_default_variant_for_data_type(const GDScriptDataType &p_data_type);
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index f5d3306376..bb08b017c9 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -41,6 +41,7 @@
#include "core/os/os.h"
#include "core/string/string_builder.h"
#include "gdscript_warning.h"
+#include "servers/text_server.h"
#endif // DEBUG_ENABLED
#ifdef TOOLS_ENABLED
@@ -50,46 +51,8 @@
static HashMap<StringName, Variant::Type> builtin_types;
Variant::Type GDScriptParser::get_builtin_type(const StringName &p_type) {
if (builtin_types.is_empty()) {
- builtin_types["bool"] = Variant::BOOL;
- builtin_types["int"] = Variant::INT;
- builtin_types["float"] = Variant::FLOAT;
- builtin_types["String"] = Variant::STRING;
- builtin_types["Vector2"] = Variant::VECTOR2;
- builtin_types["Vector2i"] = Variant::VECTOR2I;
- builtin_types["Rect2"] = Variant::RECT2;
- builtin_types["Rect2i"] = Variant::RECT2I;
- builtin_types["Transform2D"] = Variant::TRANSFORM2D;
- builtin_types["Vector3"] = Variant::VECTOR3;
- builtin_types["Vector3i"] = Variant::VECTOR3I;
- builtin_types["Vector4"] = Variant::VECTOR4;
- builtin_types["Vector4i"] = Variant::VECTOR4I;
- builtin_types["AABB"] = Variant::AABB;
- builtin_types["Plane"] = Variant::PLANE;
- builtin_types["Quaternion"] = Variant::QUATERNION;
- builtin_types["Basis"] = Variant::BASIS;
- builtin_types["Transform3D"] = Variant::TRANSFORM3D;
- builtin_types["Projection"] = Variant::PROJECTION;
- builtin_types["Color"] = Variant::COLOR;
- builtin_types["RID"] = Variant::RID;
- builtin_types["Object"] = Variant::OBJECT;
- builtin_types["StringName"] = Variant::STRING_NAME;
- builtin_types["NodePath"] = Variant::NODE_PATH;
- builtin_types["Dictionary"] = Variant::DICTIONARY;
- builtin_types["Callable"] = Variant::CALLABLE;
- builtin_types["Signal"] = Variant::SIGNAL;
- builtin_types["Array"] = Variant::ARRAY;
- builtin_types["PackedByteArray"] = Variant::PACKED_BYTE_ARRAY;
- builtin_types["PackedInt32Array"] = Variant::PACKED_INT32_ARRAY;
- builtin_types["PackedInt64Array"] = Variant::PACKED_INT64_ARRAY;
- builtin_types["PackedFloat32Array"] = Variant::PACKED_FLOAT32_ARRAY;
- builtin_types["PackedFloat64Array"] = Variant::PACKED_FLOAT64_ARRAY;
- builtin_types["PackedStringArray"] = Variant::PACKED_STRING_ARRAY;
- builtin_types["PackedVector2Array"] = Variant::PACKED_VECTOR2_ARRAY;
- builtin_types["PackedVector3Array"] = Variant::PACKED_VECTOR3_ARRAY;
- builtin_types["PackedColorArray"] = Variant::PACKED_COLOR_ARRAY;
- // NIL is not here, hence the -1.
- if (builtin_types.size() != Variant::VARIANT_MAX - 1) {
- ERR_PRINT("Outdated parser: amount of built-in types don't match the amount of types in Variant.");
+ for (int i = 1; i < Variant::VARIANT_MAX; i++) {
+ builtin_types[Variant::get_type_name((Variant::Type)i)] = (Variant::Type)i;
}
}
@@ -121,7 +84,7 @@ GDScriptParser::GDScriptParser() {
register_annotation(MethodInfo("@onready"), AnnotationInfo::VARIABLE, &GDScriptParser::onready_annotation);
// Export annotations.
register_annotation(MethodInfo("@export"), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_NONE, Variant::NIL>);
- register_annotation(MethodInfo("@export_enum", PropertyInfo(Variant::STRING, "names")), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_ENUM, Variant::INT>, varray(), true);
+ register_annotation(MethodInfo("@export_enum", PropertyInfo(Variant::STRING, "names")), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_ENUM, Variant::NIL>, varray(), true);
register_annotation(MethodInfo("@export_file", PropertyInfo(Variant::STRING, "filter")), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_FILE, Variant::STRING>, varray(""), true);
register_annotation(MethodInfo("@export_dir"), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_DIR, Variant::STRING>);
register_annotation(MethodInfo("@export_global_file", PropertyInfo(Variant::STRING, "filter")), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_GLOBAL_FILE, Variant::STRING>, varray(""), true);
@@ -186,24 +149,6 @@ void GDScriptParser::push_error(const String &p_message, const Node *p_origin) {
}
#ifdef DEBUG_ENABLED
-void GDScriptParser::push_warning(const Node *p_source, GDScriptWarning::Code p_code, const String &p_symbol1, const String &p_symbol2, const String &p_symbol3, const String &p_symbol4) {
- ERR_FAIL_COND(p_source == nullptr);
- Vector<String> symbols;
- if (!p_symbol1.is_empty()) {
- symbols.push_back(p_symbol1);
- }
- if (!p_symbol2.is_empty()) {
- symbols.push_back(p_symbol2);
- }
- if (!p_symbol3.is_empty()) {
- symbols.push_back(p_symbol3);
- }
- if (!p_symbol4.is_empty()) {
- symbols.push_back(p_symbol4);
- }
- push_warning(p_source, p_code, symbols);
-}
-
void GDScriptParser::push_warning(const Node *p_source, GDScriptWarning::Code p_code, const Vector<String> &p_symbols) {
ERR_FAIL_COND(p_source == nullptr);
if (is_ignoring_warnings) {
@@ -546,7 +491,7 @@ void GDScriptParser::parse_program() {
AnnotationNode *annotation = parse_annotation(AnnotationInfo::SCRIPT | AnnotationInfo::STANDALONE | AnnotationInfo::CLASS_LEVEL);
if (annotation != nullptr) {
if (annotation->applies_to(AnnotationInfo::SCRIPT)) {
- annotation->apply(this, head);
+ head->annotations.push_back(annotation);
} else {
annotation_stack.push_back(annotation);
// This annotation must appear after script-level annotations
@@ -788,7 +733,6 @@ void GDScriptParser::parse_class_member(T *(GDScriptParser::*p_parse_function)()
return;
}
- // Apply annotations.
for (AnnotationNode *&annotation : annotations) {
member->annotations.push_back(annotation);
}
@@ -858,14 +802,19 @@ void GDScriptParser::parse_class_body(bool p_is_multiline) {
case GDScriptTokenizer::Token::ANNOTATION: {
advance();
- // Check for class-level annotations.
+ // Check for standalone and class-level annotations.
AnnotationNode *annotation = parse_annotation(AnnotationInfo::STANDALONE | AnnotationInfo::CLASS_LEVEL);
if (annotation != nullptr) {
if (annotation->applies_to(AnnotationInfo::STANDALONE)) {
if (previous.type != GDScriptTokenizer::Token::NEWLINE) {
push_error(R"(Expected newline after a standalone annotation.)");
}
- annotation->apply(this, head);
+ if (annotation->name == "@export_category" || annotation->name == "@export_group" || annotation->name == "@export_subgroup") {
+ current_class->add_member_group(annotation);
+ } else {
+ // For potential non-group standalone annotations.
+ push_error(R"(Unexpected standalone annotation in class body.)");
+ }
} else {
annotation_stack.push_back(annotation);
}
@@ -995,14 +944,14 @@ GDScriptParser::VariableNode *GDScriptParser::parse_property(VariableNode *p_var
// Run with a loop because order doesn't matter.
for (int i = 0; i < 2; i++) {
- if (function->name == "set") {
+ if (function->name == SNAME("set")) {
if (setter_used) {
push_error(R"(Properties can only have one setter.)");
} else {
parse_property_setter(property);
setter_used = true;
}
- } else if (function->name == "get") {
+ } else if (function->name == SNAME("get")) {
if (getter_used) {
push_error(R"(Properties can only have one getter.)");
} else {
@@ -1451,7 +1400,11 @@ GDScriptParser::AnnotationNode *GDScriptParser::parse_annotation(uint32_t p_vali
annotation->info = &valid_annotations[annotation->name];
if (!annotation->applies_to(p_valid_targets)) {
- push_error(vformat(R"(Annotation "%s" is not allowed in this level.)", annotation->name));
+ if (annotation->applies_to(AnnotationInfo::SCRIPT)) {
+ push_error(vformat(R"(Annotation "%s" must be at the top of the script, before "extends" and "class_name".)", annotation->name));
+ } else {
+ push_error(vformat(R"(Annotation "%s" is not allowed in this level.)", annotation->name));
+ }
valid = false;
}
@@ -1483,7 +1436,7 @@ GDScriptParser::AnnotationNode *GDScriptParser::parse_annotation(uint32_t p_vali
match(GDScriptTokenizer::Token::NEWLINE); // Newline after annotation is optional.
if (valid) {
- valid = validate_annotation_arguments(annotation);
+ valid = validate_annotation_argument_count(annotation);
}
return valid ? annotation : nullptr;
@@ -1714,6 +1667,7 @@ GDScriptParser::Node *GDScriptParser::parse_statement() {
case Node::CALL:
case Node::ASSIGNMENT:
case Node::AWAIT:
+ case Node::TERNARY_OPERATOR:
// Fine.
break;
case Node::LAMBDA:
@@ -1729,7 +1683,6 @@ GDScriptParser::Node *GDScriptParser::parse_statement() {
}
}
- // Apply annotations to statement.
while (!is_annotation && result != nullptr && !annotation_stack.is_empty()) {
AnnotationNode *last_annotation = annotation_stack.back()->get();
if (last_annotation->applies_to(AnnotationInfo::STATEMENT)) {
@@ -1806,11 +1759,10 @@ GDScriptParser::BreakNode *GDScriptParser::parse_break() {
GDScriptParser::ContinueNode *GDScriptParser::parse_continue() {
if (!can_continue) {
- push_error(R"(Cannot use "continue" outside of a loop or pattern matching block.)");
+ push_error(R"(Cannot use "continue" outside of a loop.)");
}
current_suite->has_continue = true;
ContinueNode *cont = alloc_node<ContinueNode>();
- cont->is_for_match = is_continue_match;
complete_extents(cont);
end_statement(R"("continue")");
return cont;
@@ -1836,12 +1788,10 @@ GDScriptParser::ForNode *GDScriptParser::parse_for() {
// Save break/continue state.
bool could_break = can_break;
bool could_continue = can_continue;
- bool was_continue_match = is_continue_match;
// Allow break/continue.
can_break = true;
can_continue = true;
- is_continue_match = false;
SuiteNode *suite = alloc_node<SuiteNode>();
if (n_for->variable) {
@@ -1859,7 +1809,6 @@ GDScriptParser::ForNode *GDScriptParser::parse_for() {
// Reset break/continue state.
can_break = could_break;
can_continue = could_continue;
- is_continue_match = was_continue_match;
return n_for;
}
@@ -1919,11 +1868,8 @@ GDScriptParser::MatchNode *GDScriptParser::parse_match() {
return match;
}
-#ifdef DEBUG_ENABLED
bool all_have_return = true;
bool have_wildcard = false;
- bool have_wildcard_without_continue = false;
-#endif
while (!check(GDScriptTokenizer::Token::DEDENT) && !is_at_end()) {
MatchBranchNode *branch = parse_match_branch();
@@ -1933,31 +1879,22 @@ GDScriptParser::MatchNode *GDScriptParser::parse_match() {
}
#ifdef DEBUG_ENABLED
- if (have_wildcard_without_continue && !branch->patterns.is_empty()) {
+ if (have_wildcard && !branch->patterns.is_empty()) {
push_warning(branch->patterns[0], GDScriptWarning::UNREACHABLE_PATTERN);
}
-
- if (branch->has_wildcard) {
- have_wildcard = true;
- if (!branch->block->has_continue) {
- have_wildcard_without_continue = true;
- }
- }
- if (!branch->block->has_return) {
- all_have_return = false;
- }
#endif
+
+ have_wildcard = have_wildcard || branch->has_wildcard;
+ all_have_return = all_have_return && branch->block->has_return;
match->branches.push_back(branch);
}
complete_extents(match);
consume(GDScriptTokenizer::Token::DEDENT, R"(Expected an indented block after "match" statement.)");
-#ifdef DEBUG_ENABLED
if (all_have_return && have_wildcard) {
current_suite->has_return = true;
}
-#endif
return match;
}
@@ -1996,13 +1933,6 @@ GDScriptParser::MatchBranchNode *GDScriptParser::parse_match_branch() {
return nullptr;
}
- // Save continue state.
- bool could_continue = can_continue;
- bool was_continue_match = is_continue_match;
- // Allow continue for match.
- can_continue = true;
- is_continue_match = true;
-
SuiteNode *suite = alloc_node<SuiteNode>();
if (branch->patterns.size() > 0) {
for (const KeyValue<StringName, IdentifierNode *> &E : branch->patterns[0]->binds) {
@@ -2015,10 +1945,6 @@ GDScriptParser::MatchBranchNode *GDScriptParser::parse_match_branch() {
branch->block = parse_suite("match pattern block", suite);
complete_extents(branch);
- // Restore continue state.
- can_continue = could_continue;
- is_continue_match = was_continue_match;
-
return branch;
}
@@ -2177,12 +2103,10 @@ GDScriptParser::WhileNode *GDScriptParser::parse_while() {
// Save break/continue state.
bool could_break = can_break;
bool could_continue = can_continue;
- bool was_continue_match = is_continue_match;
// Allow break/continue.
can_break = true;
can_continue = true;
- is_continue_match = false;
n_while->loop = parse_suite(R"("while" block)");
n_while->loop->is_loop = true;
@@ -2191,7 +2115,6 @@ GDScriptParser::WhileNode *GDScriptParser::parse_while() {
// Reset break/continue state.
can_break = could_break;
can_continue = could_continue;
- is_continue_match = was_continue_match;
return n_while;
}
@@ -2251,7 +2174,14 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_expression(bool p_can_assi
}
GDScriptParser::IdentifierNode *GDScriptParser::parse_identifier() {
- return static_cast<IdentifierNode *>(parse_identifier(nullptr, false));
+ IdentifierNode *identifier = static_cast<IdentifierNode *>(parse_identifier(nullptr, false));
+#ifdef DEBUG_ENABLED
+ // Check for spoofing here (if available in TextServer) since this isn't called inside expressions. This is only relevant for declarations.
+ if (identifier && TS->has_feature(TextServer::FEATURE_UNICODE_SECURITY) && TS->spoof_check(identifier->name.operator String())) {
+ push_warning(identifier, GDScriptWarning::CONFUSABLE_IDENTIFIER, identifier->name.operator String());
+ }
+#endif
+ return identifier;
}
GDScriptParser::ExpressionNode *GDScriptParser::parse_identifier(ExpressionNode *p_previous_operand, bool p_can_assign) {
@@ -2953,7 +2883,7 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_call(ExpressionNode *p_pre
// Arguments.
CompletionType ct = COMPLETION_CALL_ARGUMENTS;
- if (call->function_name == "load") {
+ if (call->function_name == SNAME("load")) {
ct = COMPLETION_RESOURCE_PATH;
}
push_completion_call(call);
@@ -3621,7 +3551,7 @@ bool GDScriptParser::AnnotationNode::applies_to(uint32_t p_target_kinds) const {
return (info->target_kind & p_target_kinds) > 0;
}
-bool GDScriptParser::validate_annotation_arguments(AnnotationNode *p_annotation) {
+bool GDScriptParser::validate_annotation_argument_count(AnnotationNode *p_annotation) {
ERR_FAIL_COND_V_MSG(!valid_annotations.has(p_annotation->name), false, vformat(R"(Annotation "%s" not found to validate.)", p_annotation->name));
const MethodInfo &info = valid_annotations[p_annotation->name].info;
@@ -3636,62 +3566,6 @@ bool GDScriptParser::validate_annotation_arguments(AnnotationNode *p_annotation)
return false;
}
- const List<PropertyInfo>::Element *E = info.arguments.front();
- for (int i = 0; i < p_annotation->arguments.size(); i++) {
- ExpressionNode *argument = p_annotation->arguments[i];
- const PropertyInfo &parameter = E->get();
-
- if (E->next() != nullptr) {
- E = E->next();
- }
-
- switch (parameter.type) {
- case Variant::STRING:
- case Variant::STRING_NAME:
- case Variant::NODE_PATH:
- // Allow "quote-less strings", as long as they are recognized as identifiers.
- if (argument->type == Node::IDENTIFIER) {
- IdentifierNode *string = static_cast<IdentifierNode *>(argument);
- Callable::CallError error;
- Vector<Variant> args = varray(string->name);
- const Variant *name = args.ptr();
- Variant r;
- Variant::construct(parameter.type, r, &(name), 1, error);
- p_annotation->resolved_arguments.push_back(r);
- if (error.error != Callable::CallError::CALL_OK) {
- push_error(vformat(R"(Expected %s as argument %d of annotation "%s".)", Variant::get_type_name(parameter.type), i + 1, p_annotation->name));
- p_annotation->resolved_arguments.remove_at(p_annotation->resolved_arguments.size() - 1);
- return false;
- }
- break;
- }
- [[fallthrough]];
- default: {
- if (argument->type != Node::LITERAL) {
- push_error(vformat(R"(Expected %s as argument %d of annotation "%s".)", Variant::get_type_name(parameter.type), i + 1, p_annotation->name));
- return false;
- }
-
- Variant value = static_cast<LiteralNode *>(argument)->value;
- if (!Variant::can_convert_strict(value.get_type(), parameter.type)) {
- push_error(vformat(R"(Expected %s as argument %d of annotation "%s".)", Variant::get_type_name(parameter.type), i + 1, p_annotation->name));
- return false;
- }
- Callable::CallError error;
- const Variant *args = &value;
- Variant r;
- Variant::construct(parameter.type, r, &(args), 1, error);
- p_annotation->resolved_arguments.push_back(r);
- if (error.error != Callable::CallError::CALL_OK) {
- push_error(vformat(R"(Expected %s as argument %d of annotation "%s".)", Variant::get_type_name(parameter.type), i + 1, p_annotation->name));
- p_annotation->resolved_arguments.remove_at(p_annotation->resolved_arguments.size() - 1);
- return false;
- }
- break;
- }
- }
- }
-
return true;
}
@@ -3746,6 +3620,10 @@ bool GDScriptParser::export_annotations(const AnnotationNode *p_annotation, Node
String hint_string;
for (int i = 0; i < p_annotation->resolved_arguments.size(); i++) {
+ if (p_annotation->name != SNAME("@export_placeholder") && String(p_annotation->resolved_arguments[i]).contains(",")) {
+ push_error(vformat(R"(Argument %d of annotation "%s" contains a comma. Use separate arguments instead.)", i + 1, p_annotation->name), p_annotation->arguments[i]);
+ return false;
+ }
if (i > 0) {
hint_string += ",";
}
@@ -3890,6 +3768,24 @@ bool GDScriptParser::export_annotations(const AnnotationNode *p_annotation, Node
variable->export_info.hint_string = hint_prefix + ":" + variable->export_info.hint_string;
variable->export_info.type = Variant::ARRAY;
}
+ } else if (p_annotation->name == SNAME("@export_enum")) {
+ Variant::Type enum_type = Variant::INT;
+
+ if (export_type.kind == DataType::BUILTIN && export_type.builtin_type == Variant::STRING) {
+ enum_type = Variant::STRING;
+ } else if (export_type.is_variant() && variable->initializer != nullptr) {
+ DataType initializer_type = variable->initializer->get_datatype();
+ if (initializer_type.kind == DataType::BUILTIN && initializer_type.builtin_type == Variant::STRING) {
+ enum_type = Variant::STRING;
+ }
+ }
+
+ variable->export_info.type = enum_type;
+
+ if (!export_type.is_variant() && (export_type.kind != DataType::BUILTIN || export_type.builtin_type != enum_type)) {
+ push_error(vformat(R"("@export_enum" annotation requires a variable of type "int" or "String" but type "%s" was given instead.)", export_type.to_string()), variable);
+ return false;
+ }
} else {
// Validate variable type with export.
if (!export_type.is_variant() && (export_type.kind != DataType::BUILTIN || export_type.builtin_type != t_type)) {
@@ -3930,7 +3826,6 @@ bool GDScriptParser::export_group_annotations(const AnnotationNode *p_annotation
} break;
}
- current_class->add_member_group(annotation);
return true;
}
diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h
index 0903f62061..5a83aeb946 100644
--- a/modules/gdscript/gdscript_parser.h
+++ b/modules/gdscript/gdscript_parser.h
@@ -190,7 +190,7 @@ public:
case SCRIPT:
return script_type == p_other.script_type;
case CLASS:
- return class_type == p_other.class_type;
+ return class_type == p_other.class_type || class_type->fqcn == p_other.class_type->fqcn;
case RESOLVING:
case UNRESOLVED:
break;
@@ -758,7 +758,6 @@ public:
};
struct ContinueNode : public Node {
- bool is_for_match = false;
ContinueNode() {
type = CONTINUE;
}
@@ -971,6 +970,7 @@ public:
struct ReturnNode : public Node {
ExpressionNode *return_value = nullptr;
+ bool void_return = false;
ReturnNode() {
type = RETURN;
@@ -1254,7 +1254,6 @@ private:
bool panic_mode = false;
bool can_break = false;
bool can_continue = false;
- bool is_continue_match = false; // Whether a `continue` will act on a `match`.
List<bool> multiline_stack;
ClassNode *head = nullptr;
@@ -1361,8 +1360,11 @@ private:
void clear();
void push_error(const String &p_message, const Node *p_origin = nullptr);
#ifdef DEBUG_ENABLED
- void push_warning(const Node *p_source, GDScriptWarning::Code p_code, const String &p_symbol1 = String(), const String &p_symbol2 = String(), const String &p_symbol3 = String(), const String &p_symbol4 = String());
void push_warning(const Node *p_source, GDScriptWarning::Code p_code, const Vector<String> &p_symbols);
+ template <typename... Symbols>
+ void push_warning(const Node *p_source, GDScriptWarning::Code p_code, const Symbols &...p_symbols) {
+ push_warning(p_source, p_code, Vector<String>{ p_symbols... });
+ }
#endif
void make_completion_context(CompletionType p_type, Node *p_node, int p_argument = -1, bool p_force = false);
@@ -1400,7 +1402,7 @@ private:
// Annotations
AnnotationNode *parse_annotation(uint32_t p_valid_targets);
bool register_annotation(const MethodInfo &p_info, uint32_t p_target_kinds, AnnotationAction p_apply, const Vector<Variant> &p_default_arguments = Vector<Variant>(), bool p_is_vararg = false);
- bool validate_annotation_arguments(AnnotationNode *p_annotation);
+ bool validate_annotation_argument_count(AnnotationNode *p_annotation);
void clear_unused_annotations();
bool tool_annotation(const AnnotationNode *p_annotation, Node *p_target);
bool icon_annotation(const AnnotationNode *p_annotation, Node *p_target);
diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp
index e17a804003..d7f1114fd3 100644
--- a/modules/gdscript/gdscript_tokenizer.cpp
+++ b/modules/gdscript/gdscript_tokenizer.cpp
@@ -31,10 +31,14 @@
#include "gdscript_tokenizer.h"
#include "core/error/error_macros.h"
+#include "core/string/char_utils.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_settings.h"
#endif
+#ifdef DEBUG_ENABLED
+#include "servers/text_server.h"
+#endif
static const char *token_names[] = {
"Empty", // EMPTY,
@@ -435,10 +439,12 @@ GDScriptTokenizer::Token GDScriptTokenizer::check_vcs_marker(char32_t p_test, To
}
GDScriptTokenizer::Token GDScriptTokenizer::annotation() {
- if (!is_ascii_identifier_char(_peek())) {
+ if (is_unicode_identifier_start(_peek())) {
+ _advance(); // Consume start character.
+ } else {
push_error("Expected annotation identifier after \"@\".");
}
- while (is_ascii_identifier_char(_peek())) {
+ while (is_unicode_identifier_continue(_peek())) {
// Consume all identifier characters.
_advance();
}
@@ -447,7 +453,6 @@ GDScriptTokenizer::Token GDScriptTokenizer::annotation() {
return annotation;
}
-GDScriptTokenizer::Token GDScriptTokenizer::potential_identifier() {
#define KEYWORDS(KEYWORD_GROUP, KEYWORD) \
KEYWORD_GROUP('a') \
KEYWORD("as", Token::AS) \
@@ -512,8 +517,21 @@ GDScriptTokenizer::Token GDScriptTokenizer::potential_identifier() {
#define MIN_KEYWORD_LENGTH 2
#define MAX_KEYWORD_LENGTH 10
- // Consume all alphanumeric characters.
- while (is_ascii_identifier_char(_peek())) {
+#ifdef DEBUG_ENABLED
+void GDScriptTokenizer::make_keyword_list() {
+#define KEYWORD_LINE(keyword, token_type) keyword,
+#define KEYWORD_GROUP_IGNORE(group)
+ keyword_list = {
+ KEYWORDS(KEYWORD_GROUP_IGNORE, KEYWORD_LINE)
+ };
+#undef KEYWORD_LINE
+#undef KEYWORD_GROUP_IGNORE
+}
+#endif // DEBUG_ENABLED
+
+GDScriptTokenizer::Token GDScriptTokenizer::potential_identifier() {
+ // Consume all identifier characters.
+ while (is_unicode_identifier_continue(_peek())) {
_advance();
}
@@ -565,15 +583,28 @@ GDScriptTokenizer::Token GDScriptTokenizer::potential_identifier() {
}
// Not a keyword, so must be an identifier.
- return make_identifier(name);
+ Token id = make_identifier(name);
+
+#ifdef DEBUG_ENABLED
+ // Additional checks for identifiers but only in debug and if it's available in TextServer.
+ if (TS->has_feature(TextServer::FEATURE_UNICODE_SECURITY)) {
+ int64_t confusable = TS->is_confusable(name, keyword_list);
+ if (confusable >= 0) {
+ push_error(vformat(R"(Identifier "%s" is visually similar to the GDScript keyword "%s" and thus not allowed.)", name, keyword_list[confusable]));
+ }
+ }
+#endif // DEBUG_ENABLED
+
+ return id;
-#undef KEYWORDS
-#undef MIN_KEYWORD_LENGTH
-#undef MAX_KEYWORD_LENGTH
#undef KEYWORD_GROUP_CASE
#undef KEYWORD
}
+#undef MAX_KEYWORD_LENGTH
+#undef MIN_KEYWORD_LENGTH
+#undef KEYWORDS
+
void GDScriptTokenizer::newline(bool p_make_token) {
// Don't overwrite previous newline, nor create if we want a line continuation.
if (p_make_token && !pending_newline && !line_continuation) {
@@ -720,7 +751,7 @@ GDScriptTokenizer::Token GDScriptTokenizer::number() {
error.rightmost_column = column + 1;
push_error(error);
has_error = true;
- } else if (is_ascii_identifier_char(_peek())) {
+ } else if (is_unicode_identifier_start(_peek()) || is_unicode_identifier_continue(_peek())) {
// Letter at the end of the number.
push_error("Invalid numeric notation.");
}
@@ -1311,7 +1342,7 @@ GDScriptTokenizer::Token GDScriptTokenizer::scan() {
if (is_digit(c)) {
return number();
- } else if (is_ascii_identifier_char(c)) {
+ } else if (is_unicode_identifier_start(c)) {
return potential_identifier();
}
@@ -1504,7 +1535,11 @@ GDScriptTokenizer::Token GDScriptTokenizer::scan() {
}
default:
- return make_error(vformat(R"(Unknown character "%s".)", String(&c, 1)));
+ if (is_whitespace(c)) {
+ return make_error(vformat(R"(Invalid white space character "\\u%X".)", static_cast<int32_t>(c)));
+ } else {
+ return make_error(vformat(R"(Unknown character "%s".)", String(&c, 1)));
+ }
}
}
@@ -1514,4 +1549,7 @@ GDScriptTokenizer::GDScriptTokenizer() {
tab_size = EditorSettings::get_singleton()->get_setting("text_editor/behavior/indent/size");
}
#endif // TOOLS_ENABLED
+#ifdef DEBUG_ENABLED
+ make_keyword_list();
+#endif // DEBUG_ENABLED
}
diff --git a/modules/gdscript/gdscript_tokenizer.h b/modules/gdscript/gdscript_tokenizer.h
index 9588922122..608840d3f1 100644
--- a/modules/gdscript/gdscript_tokenizer.h
+++ b/modules/gdscript/gdscript_tokenizer.h
@@ -224,6 +224,9 @@ private:
char32_t indent_char = '\0';
int position = 0;
int length = 0;
+#ifdef DEBUG_ENABLED
+ Vector<String> keyword_list;
+#endif // DEBUG_ENABLED
#ifdef TOOLS_ENABLED
HashMap<int, CommentData> comments;
@@ -239,6 +242,10 @@ private:
void _skip_whitespace();
void check_indent();
+#ifdef DEBUG_ENABLED
+ void make_keyword_list();
+#endif // DEBUG_ENABLED
+
Token make_error(const String &p_message);
void push_error(const String &p_message);
void push_error(const Token &p_error);
diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp
index 4ea4438b5e..e18a4a6190 100644
--- a/modules/gdscript/gdscript_vm.cpp
+++ b/modules/gdscript/gdscript_vm.cpp
@@ -47,6 +47,16 @@ static String _get_script_name(const Ref<Script> p_script) {
}
}
+static String _get_element_type(Variant::Type builtin_type, const StringName &native_type, const Ref<Script> &script_type) {
+ if (script_type.is_valid() && script_type->is_valid()) {
+ return _get_script_name(script_type);
+ } else if (native_type != StringName()) {
+ return native_type.operator String();
+ } else {
+ return Variant::get_type_name(builtin_type);
+ }
+}
+
static String _get_var_type(const Variant *p_var) {
String basestr;
@@ -75,15 +85,8 @@ static String _get_var_type(const Variant *p_var) {
basestr = "Array";
const Array *p_array = VariantInternal::get_array(p_var);
Variant::Type builtin_type = (Variant::Type)p_array->get_typed_builtin();
- StringName native_type = p_array->get_typed_class_name();
- Ref<Script> script_type = p_array->get_typed_script();
-
- if (script_type.is_valid() && script_type->is_valid()) {
- basestr += "[" + _get_script_name(script_type) + "]";
- } else if (native_type != StringName()) {
- basestr += "[" + native_type.operator String() + "]";
- } else if (builtin_type != Variant::NIL) {
- basestr += "[" + Variant::get_type_name(builtin_type) + "]";
+ if (builtin_type != Variant::NIL) {
+ basestr += "[" + _get_element_type(builtin_type, p_array->get_typed_class_name(), p_array->get_typed_script()) + "]";
}
} else {
basestr = Variant::get_type_name(p_var->get_type());
@@ -101,10 +104,7 @@ Variant GDScriptFunction::_get_default_variant_for_data_type(const GDScriptDataT
// Typed array.
if (p_data_type.has_container_element_type()) {
const GDScriptDataType &element_type = p_data_type.get_container_element_type();
- array.set_typed(
- element_type.kind == GDScriptDataType::BUILTIN ? element_type.builtin_type : Variant::OBJECT,
- element_type.native_type,
- element_type.script_type);
+ array.set_typed(element_type.builtin_type, element_type.native_type, element_type.script_type);
}
return array;
@@ -131,6 +131,8 @@ String GDScriptFunction::_get_call_error(const Callable::CallError &p_err, const
#ifdef DEBUG_ENABLED
if (p_err.expected == Variant::OBJECT && argptrs[errorarg]->get_type() == p_err.expected) {
err_text = "Invalid type in " + p_where + ". The Object-derived class of argument " + itos(errorarg + 1) + " (" + _get_var_type(argptrs[errorarg]) + ") is not a subclass of the expected argument class.";
+ } else if (p_err.expected == Variant::ARRAY && argptrs[errorarg]->get_type() == p_err.expected) {
+ err_text = "Invalid type in " + p_where + ". The array of argument " + itos(errorarg + 1) + " (" + _get_var_type(argptrs[errorarg]) + ") does not have the same element type as the expected typed array argument.";
} else
#endif // DEBUG_ENABLED
{
@@ -518,7 +520,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
if (!argument_types[i].is_type(*p_args[i], true)) {
r_err.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_err.argument = i;
- r_err.expected = argument_types[i].kind == GDScriptDataType::BUILTIN ? argument_types[i].builtin_type : Variant::OBJECT;
+ r_err.expected = argument_types[i].builtin_type;
return _get_default_variant_for_data_type(return_type);
}
if (argument_types[i].kind == GDScriptDataType::BUILTIN) {
@@ -1174,27 +1176,37 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
DISPATCH_OPCODE;
OPCODE(OPCODE_ASSIGN_TYPED_ARRAY) {
- CHECK_SPACE(3);
+ CHECK_SPACE(6);
GET_VARIANT_PTR(dst, 0);
GET_VARIANT_PTR(src, 1);
- Array *dst_arr = VariantInternal::get_array(dst);
+ GET_VARIANT_PTR(script_type, 2);
+ Variant::Type builtin_type = (Variant::Type)_code_ptr[ip + 4];
+ int native_type_idx = _code_ptr[ip + 5];
+ GD_ERR_BREAK(native_type_idx < 0 || native_type_idx >= _global_names_count);
+ const StringName native_type = _global_names_ptr[native_type_idx];
if (src->get_type() != Variant::ARRAY) {
#ifdef DEBUG_ENABLED
- err_text = "Trying to assign value of type '" + Variant::get_type_name(src->get_type()) +
- "' to a variable of type '" + +"'.";
-#endif
+ err_text = vformat(R"(Trying to assign a value of type "%s" to a variable of type "Array[%s]".)",
+ _get_var_type(src), _get_element_type(builtin_type, native_type, *script_type));
+#endif // DEBUG_ENABLED
OPCODE_BREAK;
}
- if (!dst_arr->typed_assign(*src)) {
+
+ Array *array = VariantInternal::get_array(src);
+
+ if (array->get_typed_builtin() != ((uint32_t)builtin_type) || array->get_typed_class_name() != native_type || array->get_typed_script() != *script_type || array->get_typed_class_name() != native_type) {
#ifdef DEBUG_ENABLED
- err_text = "Trying to assign a typed array with an array of different type.'";
-#endif
+ err_text = vformat(R"(Trying to assign an array of type "%s" to a variable of type "Array[%s]".)",
+ _get_var_type(src), _get_element_type(builtin_type, native_type, *script_type));
+#endif // DEBUG_ENABLED
OPCODE_BREAK;
}
- ip += 3;
+ *dst = *src;
+
+ ip += 6;
}
DISPATCH_OPCODE;
@@ -1469,9 +1481,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
const StringName native_type = _global_names_ptr[native_type_idx];
Array array;
- array.set_typed(builtin_type, native_type, *script_type);
array.resize(argc);
-
for (int i = 0; i < argc; i++) {
array[i] = *(instruction_args[i]);
}
@@ -1479,7 +1489,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
GET_INSTRUCTION_ARG(dst, argc);
*dst = Variant(); // Clear potential previous typed array.
- *dst = array;
+ *dst = Array(array, builtin_type, native_type, *script_type);
ip += 4;
}
@@ -2486,30 +2496,25 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
if (r->get_type() != Variant::ARRAY) {
#ifdef DEBUG_ENABLED
- err_text = vformat(R"(Trying to return value of type "%s" from a function which the return type is "Array[%s]".)",
- Variant::get_type_name(r->get_type()), Variant::get_type_name(builtin_type));
-#endif
+ err_text = vformat(R"(Trying to return a value of type "%s" where expected return type is "Array[%s]".)",
+ _get_var_type(r), _get_element_type(builtin_type, native_type, *script_type));
+#endif // DEBUG_ENABLED
OPCODE_BREAK;
}
- Array array;
- array.set_typed(builtin_type, native_type, *script_type);
+ Array *array = VariantInternal::get_array(r);
+ if (array->get_typed_builtin() != ((uint32_t)builtin_type) || array->get_typed_class_name() != native_type || array->get_typed_script() != *script_type || array->get_typed_class_name() != native_type) {
#ifdef DEBUG_ENABLED
- bool valid = array.typed_assign(*VariantInternal::get_array(r));
-#else
- array.typed_assign(*VariantInternal::get_array(r));
+ err_text = vformat(R"(Trying to return an array of type "%s" where expected return type is "Array[%s]".)",
+ _get_var_type(r), _get_element_type(builtin_type, native_type, *script_type));
#endif // DEBUG_ENABLED
-
- // Assign the return value anyway since we want it to be the valid type.
- retvalue = array;
-
-#ifdef DEBUG_ENABLED
- if (!valid) {
- err_text = "Trying to return a typed array with an array of different type.'";
OPCODE_BREAK;
}
+ retvalue = *array;
+
+#ifdef DEBUG_ENABLED
exit_ok = true;
#endif // DEBUG_ENABLED
OPCODE_BREAK;
diff --git a/modules/gdscript/gdscript_warning.cpp b/modules/gdscript/gdscript_warning.cpp
index 184cecb316..9436146bed 100644
--- a/modules/gdscript/gdscript_warning.cpp
+++ b/modules/gdscript/gdscript_warning.cpp
@@ -125,6 +125,10 @@ String GDScriptWarning::get_message() const {
CHECK_SYMBOLS(4);
return "The argument '" + symbols[0] + "' of the function '" + symbols[1] + "' requires a the subtype '" + symbols[2] + "' but the supertype '" + symbols[3] + "' was provided";
} break;
+ case UNSAFE_VOID_RETURN: {
+ CHECK_SYMBOLS(2);
+ return "The method '" + symbols[0] + "()' returns 'void' but it's trying to return a call to '" + symbols[1] + "()' that can't be ensured to also be 'void'.";
+ } break;
case DEPRECATED_KEYWORD: {
CHECK_SYMBOLS(2);
return "The '" + symbols[0] + "' keyword is deprecated and will be removed in a future release, please replace its uses by '" + symbols[1] + "'.";
@@ -148,13 +152,24 @@ String GDScriptWarning::get_message() const {
CHECK_SYMBOLS(3);
return vformat(R"(The %s '%s' has the same name as a %s.)", symbols[0], symbols[1], symbols[2]);
}
- case INT_ASSIGNED_TO_ENUM: {
+ case INT_AS_ENUM_WITHOUT_CAST: {
return "Integer used when an enum value is expected. If this is intended cast the integer to the enum type.";
}
+ case INT_AS_ENUM_WITHOUT_MATCH: {
+ CHECK_SYMBOLS(3);
+ return vformat(R"(Cannot %s %s as Enum "%s": no enum member has matching value.)", symbols[0], symbols[1], symbols[2]);
+ } break;
case STATIC_CALLED_ON_INSTANCE: {
CHECK_SYMBOLS(2);
return vformat(R"(The function '%s()' is a static function but was called from an instance. Instead, it should be directly called from the type: '%s.%s()'.)", symbols[0], symbols[1], symbols[0]);
}
+ case CONFUSABLE_IDENTIFIER: {
+ CHECK_SYMBOLS(1);
+ return vformat(R"(The identifier "%s" has misleading characters and might be confused with something else.)", symbols[0]);
+ }
+ case RENAMED_IN_GD4_HINT: {
+ break; // Renamed identifier hint is taken care of by the GDScriptAnalyzer. No message needed here.
+ }
case WARNING_MAX:
break; // Can't happen, but silences warning
}
@@ -176,6 +191,9 @@ int GDScriptWarning::get_default_value(Code p_code) {
PropertyInfo GDScriptWarning::get_property_info(Code p_code) {
// Making this a separate function in case a warning needs different PropertyInfo in the future.
+ if (p_code == Code::RENAMED_IN_GD4_HINT) {
+ return PropertyInfo(Variant::BOOL, get_settings_path_from_code(p_code));
+ }
return PropertyInfo(Variant::INT, get_settings_path_from_code(p_code), PROPERTY_HINT_ENUM, "Ignore,Warn,Error");
}
@@ -210,6 +228,7 @@ String GDScriptWarning::get_name_from_code(Code p_code) {
"UNSAFE_METHOD_ACCESS",
"UNSAFE_CAST",
"UNSAFE_CALL_ARGUMENT",
+ "UNSAFE_VOID_RETURN",
"DEPRECATED_KEYWORD",
"STANDALONE_TERNARY",
"ASSERT_ALWAYS_TRUE",
@@ -217,8 +236,11 @@ String GDScriptWarning::get_name_from_code(Code p_code) {
"REDUNDANT_AWAIT",
"EMPTY_FILE",
"SHADOWED_GLOBAL_IDENTIFIER",
- "INT_ASSIGNED_TO_ENUM",
+ "INT_AS_ENUM_WITHOUT_CAST",
+ "INT_AS_ENUM_WITHOUT_MATCH",
"STATIC_CALLED_ON_INSTANCE",
+ "CONFUSABLE_IDENTIFIER",
+ "RENAMED_IN_GODOT_4_HINT"
};
static_assert((sizeof(names) / sizeof(*names)) == WARNING_MAX, "Amount of warning types don't match the amount of warning names.");
diff --git a/modules/gdscript/gdscript_warning.h b/modules/gdscript/gdscript_warning.h
index e3aee45f33..fa2907cdae 100644
--- a/modules/gdscript/gdscript_warning.h
+++ b/modules/gdscript/gdscript_warning.h
@@ -69,6 +69,7 @@ public:
UNSAFE_METHOD_ACCESS, // Function not found in the detected type (but can be in subtypes).
UNSAFE_CAST, // Cast used in an unknown type.
UNSAFE_CALL_ARGUMENT, // Function call argument is of a supertype of the require argument.
+ UNSAFE_VOID_RETURN, // Function returns void but returned a call to a function that can't be type checked.
DEPRECATED_KEYWORD, // The keyword is deprecated and should be replaced.
STANDALONE_TERNARY, // Return value of ternary expression is discarded.
ASSERT_ALWAYS_TRUE, // Expression for assert argument is always true.
@@ -76,8 +77,11 @@ public:
REDUNDANT_AWAIT, // await is used but expression is synchronous (not a signal nor a coroutine).
EMPTY_FILE, // A script file is empty.
SHADOWED_GLOBAL_IDENTIFIER, // A global class or function has the same name as variable.
- INT_ASSIGNED_TO_ENUM, // An integer value was assigned to an enum-typed variable without casting.
+ INT_AS_ENUM_WITHOUT_CAST, // An integer value was used as an enum value without casting.
+ INT_AS_ENUM_WITHOUT_MATCH, // An integer value was used as an enum value without matching enum member.
STATIC_CALLED_ON_INSTANCE, // A static method was called on an instance of a class instead of on the class itself.
+ CONFUSABLE_IDENTIFIER, // The identifier contains misleading characters that can be confused. E.g. "usеr" (has Cyrillic "е" instead of Latin "e").
+ RENAMED_IN_GD4_HINT, // A variable or function that could not be found has been renamed in Godot 4
WARNING_MAX,
};
diff --git a/modules/gdscript/language_server/gdscript_text_document.cpp b/modules/gdscript/language_server/gdscript_text_document.cpp
index edb2e8117a..b9e6921034 100644
--- a/modules/gdscript/language_server/gdscript_text_document.cpp
+++ b/modules/gdscript/language_server/gdscript_text_document.cpp
@@ -107,6 +107,7 @@ void GDScriptTextDocument::didSave(const Variant &p_param) {
} else {
scr->reload(true);
}
+ scr->update_exports();
ScriptEditor::get_singleton()->update_docs_from_script(scr);
}
}
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index 33b5ae6942..b6feaadccf 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -71,21 +71,18 @@ class EditorExportGDScript : public EditorExportPlugin {
public:
virtual void _export_file(const String &p_path, const String &p_type, const HashSet<String> &p_features) override {
- int script_mode = EditorExportPreset::MODE_SCRIPT_COMPILED;
String script_key;
const Ref<EditorExportPreset> &preset = get_export_preset();
if (preset.is_valid()) {
- script_mode = preset->get_script_export_mode();
script_key = preset->get_script_encryption_key().to_lower();
}
- if (!p_path.ends_with(".gd") || script_mode == EditorExportPreset::MODE_SCRIPT_TEXT) {
+ if (!p_path.ends_with(".gd")) {
return;
}
- // TODO: Re-add compiled GDScript on export.
return;
}
diff --git a/modules/gdscript/tests/gdscript_test_runner.cpp b/modules/gdscript/tests/gdscript_test_runner.cpp
index d2c8b5c317..5b8af0ff34 100644
--- a/modules/gdscript/tests/gdscript_test_runner.cpp
+++ b/modules/gdscript/tests/gdscript_test_runner.cpp
@@ -132,9 +132,10 @@ void finish_language() {
StringName GDScriptTestRunner::test_function_name;
-GDScriptTestRunner::GDScriptTestRunner(const String &p_source_dir, bool p_init_language) {
+GDScriptTestRunner::GDScriptTestRunner(const String &p_source_dir, bool p_init_language, bool p_print_filenames) {
test_function_name = StaticCString::create("test");
do_init_languages = p_init_language;
+ print_filenames = p_print_filenames;
source_dir = p_source_dir;
if (!source_dir.ends_with("/")) {
@@ -194,6 +195,9 @@ int GDScriptTestRunner::run_tests() {
int failed = 0;
for (int i = 0; i < tests.size(); i++) {
GDScriptTest test = tests[i];
+ if (print_filenames) {
+ print_line(test.get_source_relative_filepath());
+ }
GDScriptTest::TestResult result = test.run_test();
String expected = FileAccess::get_file_as_string(test.get_output_file());
@@ -225,8 +229,13 @@ bool GDScriptTestRunner::generate_outputs() {
}
for (int i = 0; i < tests.size(); i++) {
- OS::get_singleton()->print(".");
GDScriptTest test = tests[i];
+ if (print_filenames) {
+ print_line(test.get_source_relative_filepath());
+ } else {
+ OS::get_singleton()->print(".");
+ }
+
bool result = test.generate_output();
if (!result) {
@@ -337,15 +346,10 @@ GDScriptTest::GDScriptTest(const String &p_source_path, const String &p_output_p
void GDScriptTestRunner::handle_cmdline() {
List<String> cmdline_args = OS::get_singleton()->get_cmdline_args();
- // TODO: this could likely be ported to use test commands:
- // https://github.com/godotengine/godot/pull/41355
- // Currently requires to startup the whole engine, which is slow.
- String test_cmd = "--gdscript-test";
- String gen_cmd = "--gdscript-generate-tests";
for (List<String>::Element *E = cmdline_args.front(); E; E = E->next()) {
String &cmd = E->get();
- if (cmd == test_cmd || cmd == gen_cmd) {
+ if (cmd == "--gdscript-generate-tests") {
if (E->next() == nullptr) {
ERR_PRINT("Needed a path for the test files.");
exit(-1);
@@ -353,14 +357,10 @@ void GDScriptTestRunner::handle_cmdline() {
const String &path = E->next()->get();
- GDScriptTestRunner runner(path, false);
- int failed = 0;
- if (cmd == test_cmd) {
- failed = runner.run_tests();
- } else {
- bool completed = runner.generate_outputs();
- failed = completed ? 0 : -1;
- }
+ GDScriptTestRunner runner(path, false, cmdline_args.find("--print-filenames") != nullptr);
+
+ bool completed = runner.generate_outputs();
+ int failed = completed ? 0 : -1;
exit(failed);
}
}
diff --git a/modules/gdscript/tests/gdscript_test_runner.h b/modules/gdscript/tests/gdscript_test_runner.h
index b097f1b485..60b48c6a57 100644
--- a/modules/gdscript/tests/gdscript_test_runner.h
+++ b/modules/gdscript/tests/gdscript_test_runner.h
@@ -92,6 +92,7 @@ public:
bool generate_output();
const String &get_source_file() const { return source_file; }
+ const String get_source_relative_filepath() const { return source_file.trim_prefix(base_dir); }
const String &get_output_file() const { return output_file; }
GDScriptTest(const String &p_source_path, const String &p_output_path, const String &p_base_dir);
@@ -105,6 +106,7 @@ class GDScriptTestRunner {
bool is_generating = false;
bool do_init_languages = false;
+ bool print_filenames; // Whether filenames should be printed when generated/running tests
bool make_tests();
bool make_tests_for_dir(const String &p_dir);
@@ -117,7 +119,7 @@ public:
int run_tests();
bool generate_outputs();
- GDScriptTestRunner(const String &p_source_dir, bool p_init_language);
+ GDScriptTestRunner(const String &p_source_dir, bool p_init_language, bool p_print_filenames = false);
~GDScriptTestRunner();
};
diff --git a/modules/gdscript/tests/gdscript_test_runner_suite.h b/modules/gdscript/tests/gdscript_test_runner_suite.h
index aed0ac2baf..e27b6218f1 100644
--- a/modules/gdscript/tests/gdscript_test_runner_suite.h
+++ b/modules/gdscript/tests/gdscript_test_runner_suite.h
@@ -41,7 +41,8 @@ TEST_SUITE("[Modules][GDScript]") {
// Allow the tests to fail, but do not ignore errors during development.
// Update the scripts and expected output as needed.
TEST_CASE("Script compilation and runtime") {
- GDScriptTestRunner runner("modules/gdscript/tests/scripts", true);
+ bool print_filenames = OS::get_singleton()->get_cmdline_args().find("--print-filenames") != nullptr;
+ GDScriptTestRunner runner("modules/gdscript/tests/scripts", true, print_filenames);
int fail_count = runner.run_tests();
INFO("Make sure `*.out` files have expected results.");
REQUIRE_MESSAGE(fail_count == 0, "All GDScript tests should pass.");
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/annotation_non_constant_parameter.gd b/modules/gdscript/tests/scripts/analyzer/errors/annotation_non_constant_parameter.gd
new file mode 100644
index 0000000000..75524c32ae
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/annotation_non_constant_parameter.gd
@@ -0,0 +1,6 @@
+var num := 1
+
+@export_range(num, 10) var a
+
+func test():
+ pass
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/annotation_non_constant_parameter.out b/modules/gdscript/tests/scripts/analyzer/errors/annotation_non_constant_parameter.out
new file mode 100644
index 0000000000..b4f0e79237
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/annotation_non_constant_parameter.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Argument 1 of annotation "@export_range" isn't a constant expression.
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/assymetric_assignment_bad.gd b/modules/gdscript/tests/scripts/analyzer/errors/assymetric_assignment_bad.gd
new file mode 100644
index 0000000000..1b22d173c7
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/assymetric_assignment_bad.gd
@@ -0,0 +1,3 @@
+func test():
+ var var_color: String = Color.RED
+ print('not ok')
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/assymetric_assignment_bad.out b/modules/gdscript/tests/scripts/analyzer/errors/assymetric_assignment_bad.out
new file mode 100644
index 0000000000..cc4b1d86bf
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/assymetric_assignment_bad.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Cannot assign a value of type "Color" as "String".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/cast_enum_bad_enum.out b/modules/gdscript/tests/scripts/analyzer/errors/cast_enum_bad_enum.out
deleted file mode 100644
index 3a8d2a205a..0000000000
--- a/modules/gdscript/tests/scripts/analyzer/errors/cast_enum_bad_enum.out
+++ /dev/null
@@ -1,2 +0,0 @@
-GDTEST_ANALYZER_ERROR
-Invalid cast. Enum "cast_enum_bad_enum.gd::MyEnum" does not have value corresponding to "MyOtherEnum.OTHER_ENUM_VALUE_3" (2).
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/cast_enum_bad_int.out b/modules/gdscript/tests/scripts/analyzer/errors/cast_enum_bad_int.out
deleted file mode 100644
index bc0d8b7834..0000000000
--- a/modules/gdscript/tests/scripts/analyzer/errors/cast_enum_bad_int.out
+++ /dev/null
@@ -1,2 +0,0 @@
-GDTEST_ANALYZER_ERROR
-Invalid cast. Enum "cast_enum_bad_int.gd::MyEnum" does not have enum value 2.
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/enum_class_var_assign_with_wrong_enum_type.out b/modules/gdscript/tests/scripts/analyzer/errors/enum_class_var_assign_with_wrong_enum_type.out
index 02c4633586..84958f1aa2 100644
--- a/modules/gdscript/tests/scripts/analyzer/errors/enum_class_var_assign_with_wrong_enum_type.out
+++ b/modules/gdscript/tests/scripts/analyzer/errors/enum_class_var_assign_with_wrong_enum_type.out
@@ -1,2 +1,2 @@
GDTEST_ANALYZER_ERROR
-Value of type "enum_class_var_assign_with_wrong_enum_type.gd::MyOtherEnum" cannot be assigned to a variable of type "enum_class_var_assign_with_wrong_enum_type.gd::MyEnum".
+Cannot assign a value of type "enum_class_var_assign_with_wrong_enum_type.gd::MyOtherEnum" as "enum_class_var_assign_with_wrong_enum_type.gd::MyEnum".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/enum_class_var_init_with_wrong_enum_type.out b/modules/gdscript/tests/scripts/analyzer/errors/enum_class_var_init_with_wrong_enum_type.out
index 441cccbf7b..e294f3496a 100644
--- a/modules/gdscript/tests/scripts/analyzer/errors/enum_class_var_init_with_wrong_enum_type.out
+++ b/modules/gdscript/tests/scripts/analyzer/errors/enum_class_var_init_with_wrong_enum_type.out
@@ -1,2 +1,2 @@
GDTEST_ANALYZER_ERROR
-Cannot assign a value of type enum_class_var_init_with_wrong_enum_type.gd::MyOtherEnum to variable "class_var" with specified type enum_class_var_init_with_wrong_enum_type.gd::MyEnum.
+Cannot assign a value of type "enum_class_var_init_with_wrong_enum_type.gd::MyOtherEnum" as "enum_class_var_init_with_wrong_enum_type.gd::MyEnum".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/enum_function_parameter_wrong_type.out b/modules/gdscript/tests/scripts/analyzer/errors/enum_function_parameter_wrong_type.out
index e85f7d6f9f..a91189e2dd 100644
--- a/modules/gdscript/tests/scripts/analyzer/errors/enum_function_parameter_wrong_type.out
+++ b/modules/gdscript/tests/scripts/analyzer/errors/enum_function_parameter_wrong_type.out
@@ -1,2 +1,2 @@
GDTEST_ANALYZER_ERROR
-Invalid argument for "enum_func()" function: argument 1 should be "enum_function_parameter_wrong_type.gd::MyEnum" but is "enum_function_parameter_wrong_type.gd::MyOtherEnum".
+Cannot pass a value of type "enum_function_parameter_wrong_type.gd::MyOtherEnum" as "enum_function_parameter_wrong_type.gd::MyEnum".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/enum_function_return_wrong_type.out b/modules/gdscript/tests/scripts/analyzer/errors/enum_function_return_wrong_type.out
index f7ea3267fa..6b4eba3740 100644
--- a/modules/gdscript/tests/scripts/analyzer/errors/enum_function_return_wrong_type.out
+++ b/modules/gdscript/tests/scripts/analyzer/errors/enum_function_return_wrong_type.out
@@ -1,2 +1,2 @@
GDTEST_ANALYZER_ERROR
-Cannot return value of type "enum_function_return_wrong_type.gd::MyOtherEnum" because the function return type is "enum_function_return_wrong_type.gd::MyEnum".
+Cannot return a value of type "enum_function_return_wrong_type.gd::MyOtherEnum" as "enum_function_return_wrong_type.gd::MyEnum".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/enum_local_var_assign_outer_with_wrong_enum_type.out b/modules/gdscript/tests/scripts/analyzer/errors/enum_local_var_assign_outer_with_wrong_enum_type.out
index 38df5a0cd8..616358bb61 100644
--- a/modules/gdscript/tests/scripts/analyzer/errors/enum_local_var_assign_outer_with_wrong_enum_type.out
+++ b/modules/gdscript/tests/scripts/analyzer/errors/enum_local_var_assign_outer_with_wrong_enum_type.out
@@ -1,2 +1,2 @@
GDTEST_ANALYZER_ERROR
-Value of type "enum_local_var_assign_outer_with_wrong_enum_type.gd::InnerClass::MyEnum" cannot be assigned to a variable of type "enum_local_var_assign_outer_with_wrong_enum_type.gd::MyEnum".
+Cannot assign a value of type "enum_local_var_assign_outer_with_wrong_enum_type.gd::InnerClass::MyEnum" as "enum_local_var_assign_outer_with_wrong_enum_type.gd::MyEnum".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/enum_local_var_assign_with_wrong_enum_type.out b/modules/gdscript/tests/scripts/analyzer/errors/enum_local_var_assign_with_wrong_enum_type.out
index 2adcbd9edf..af3dde663f 100644
--- a/modules/gdscript/tests/scripts/analyzer/errors/enum_local_var_assign_with_wrong_enum_type.out
+++ b/modules/gdscript/tests/scripts/analyzer/errors/enum_local_var_assign_with_wrong_enum_type.out
@@ -1,2 +1,2 @@
GDTEST_ANALYZER_ERROR
-Value of type "enum_local_var_assign_with_wrong_enum_type.gd::MyOtherEnum" cannot be assigned to a variable of type "enum_local_var_assign_with_wrong_enum_type.gd::MyEnum".
+Cannot assign a value of type "enum_local_var_assign_with_wrong_enum_type.gd::MyOtherEnum" as "enum_local_var_assign_with_wrong_enum_type.gd::MyEnum".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/enum_local_var_init_with_wrong_enum_type.out b/modules/gdscript/tests/scripts/analyzer/errors/enum_local_var_init_with_wrong_enum_type.out
index 331113dd30..781b0bc85f 100644
--- a/modules/gdscript/tests/scripts/analyzer/errors/enum_local_var_init_with_wrong_enum_type.out
+++ b/modules/gdscript/tests/scripts/analyzer/errors/enum_local_var_init_with_wrong_enum_type.out
@@ -1,2 +1,2 @@
GDTEST_ANALYZER_ERROR
-Cannot assign a value of type enum_local_var_init_with_wrong_enum_type.gd::MyOtherEnum to variable "local_var" with specified type enum_local_var_init_with_wrong_enum_type.gd::MyEnum.
+Cannot assign a value of type "enum_local_var_init_with_wrong_enum_type.gd::MyOtherEnum" as "enum_local_var_init_with_wrong_enum_type.gd::MyEnum".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/enum_preload_unnamed_assign_to_named.out b/modules/gdscript/tests/scripts/analyzer/errors/enum_preload_unnamed_assign_to_named.out
index 6298c026b4..e8c7f86c4f 100644
--- a/modules/gdscript/tests/scripts/analyzer/errors/enum_preload_unnamed_assign_to_named.out
+++ b/modules/gdscript/tests/scripts/analyzer/errors/enum_preload_unnamed_assign_to_named.out
@@ -1,2 +1,2 @@
GDTEST_ANALYZER_ERROR
-Value of type "enum_value_from_parent.gd::<anonymous enum>" cannot be assigned to a variable of type "enum_preload_unnamed_assign_to_named.gd::MyEnum".
+Cannot assign a value of type "enum_value_from_parent.gd::<anonymous enum>" as "enum_preload_unnamed_assign_to_named.gd::MyEnum".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/enum_unnamed_assign_to_named.out b/modules/gdscript/tests/scripts/analyzer/errors/enum_unnamed_assign_to_named.out
index b70121ed81..fb18c94d0b 100644
--- a/modules/gdscript/tests/scripts/analyzer/errors/enum_unnamed_assign_to_named.out
+++ b/modules/gdscript/tests/scripts/analyzer/errors/enum_unnamed_assign_to_named.out
@@ -1,2 +1,2 @@
GDTEST_ANALYZER_ERROR
-Cannot assign a value of type enum_unnamed_assign_to_named.gd::<anonymous enum> to variable "local_var" with specified type enum_unnamed_assign_to_named.gd::MyEnum.
+Cannot assign a value of type "enum_unnamed_assign_to_named.gd::<anonymous enum>" as "enum_unnamed_assign_to_named.gd::MyEnum".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_local_variable.gd b/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_local_variable.gd
new file mode 100644
index 0000000000..6014ee831c
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_local_variable.gd
@@ -0,0 +1,3 @@
+func test():
+ var untyped = 1
+ var inferred := untyped
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_local_variable.out b/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_local_variable.out
new file mode 100644
index 0000000000..b6dc6d0b01
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_local_variable.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Cannot infer the type of "inferred" variable because the value doesn't have a set type.
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_member_variable.gd b/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_member_variable.gd
new file mode 100644
index 0000000000..040aa2e82a
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_member_variable.gd
@@ -0,0 +1,5 @@
+var untyped = 1
+var inferred := untyped
+
+func test():
+ pass
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_member_variable.out b/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_member_variable.out
new file mode 100644
index 0000000000..b6dc6d0b01
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_member_variable.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Cannot infer the type of "inferred" variable because the value doesn't have a set type.
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_parameter.gd b/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_parameter.gd
new file mode 100644
index 0000000000..80c676488e
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_parameter.gd
@@ -0,0 +1,5 @@
+func check(untyped = 1, inferred := untyped):
+ pass
+
+func test():
+ check()
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_parameter.out b/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_parameter.out
new file mode 100644
index 0000000000..8c9f0c13ae
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/inferring_with_weak_type_parameter.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Cannot infer the type of "inferred" parameter because the value doesn't have a set type.
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/invalid_array_index.out b/modules/gdscript/tests/scripts/analyzer/errors/invalid_array_index.out
index 6f7f0783f0..015ad756f8 100644
--- a/modules/gdscript/tests/scripts/analyzer/errors/invalid_array_index.out
+++ b/modules/gdscript/tests/scripts/analyzer/errors/invalid_array_index.out
@@ -1,2 +1,2 @@
GDTEST_ANALYZER_ERROR
-Cannot get index "true" from "[0, 1]".
+Invalid index type "bool" for a base of type "Array".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/lambda_wrong_return.out b/modules/gdscript/tests/scripts/analyzer/errors/lambda_wrong_return.out
index 53e2b012e6..69af0984f7 100644
--- a/modules/gdscript/tests/scripts/analyzer/errors/lambda_wrong_return.out
+++ b/modules/gdscript/tests/scripts/analyzer/errors/lambda_wrong_return.out
@@ -1,2 +1,2 @@
GDTEST_ANALYZER_ERROR
-Cannot return value of type "String" because the function return type is "int".
+Cannot return a value of type "String" as "int".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/match_with_subscript.gd b/modules/gdscript/tests/scripts/analyzer/errors/match_with_subscript.gd
new file mode 100644
index 0000000000..6d92db34c1
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/match_with_subscript.gd
@@ -0,0 +1,5 @@
+func test():
+ var dict = { a = 1 }
+ match 2:
+ dict["a"]:
+ print("not allowed")
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/match_with_subscript.out b/modules/gdscript/tests/scripts/analyzer/errors/match_with_subscript.out
new file mode 100644
index 0000000000..b7385a50d5
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/match_with_subscript.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Expression in match pattern must be a constant expression, an identifier, or an attribute access ("A.B").
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/match_with_variable_expression.gd b/modules/gdscript/tests/scripts/analyzer/errors/match_with_variable_expression.gd
new file mode 100644
index 0000000000..4df44d9ea2
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/match_with_variable_expression.gd
@@ -0,0 +1,5 @@
+func test():
+ var a = 1
+ match 2:
+ a + 2:
+ print("not allowed")
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/match_with_variable_expression.out b/modules/gdscript/tests/scripts/analyzer/errors/match_with_variable_expression.out
new file mode 100644
index 0000000000..b7385a50d5
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/match_with_variable_expression.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Expression in match pattern must be a constant expression, an identifier, or an attribute access ("A.B").
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/preload_enum_error.out b/modules/gdscript/tests/scripts/analyzer/errors/preload_enum_error.out
index 5e3c446bf6..08a973503f 100644
--- a/modules/gdscript/tests/scripts/analyzer/errors/preload_enum_error.out
+++ b/modules/gdscript/tests/scripts/analyzer/errors/preload_enum_error.out
@@ -1,2 +1,2 @@
GDTEST_ANALYZER_ERROR
-Value of type "enum_from_outer.gd::Named" cannot be assigned to a variable of type "preload_enum_error.gd::LocalNamed".
+Cannot assign a value of type "enum_from_outer.gd::Named" as "preload_enum_error.gd::LocalNamed".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/typed_array_assign_differently_typed.gd b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_assign_differently_typed.gd
new file mode 100644
index 0000000000..ce50cccb3c
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_assign_differently_typed.gd
@@ -0,0 +1,4 @@
+func test():
+ var differently: Array[float] = [1.0]
+ var typed: Array[int] = differently
+ print('not ok')
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/typed_array_assign_differently_typed.out b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_assign_differently_typed.out
new file mode 100644
index 0000000000..c6d39781ee
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_assign_differently_typed.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Cannot assign a value of type Array[float] to variable "typed" with specified type Array[int].
diff --git a/modules/gdscript/tests/scripts/analyzer/typed_array_assignment.gd b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_assignment.gd
index 9f86d0531c..9f86d0531c 100644
--- a/modules/gdscript/tests/scripts/analyzer/typed_array_assignment.gd
+++ b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_assignment.gd
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/typed_array_assignment.out b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_assignment.out
new file mode 100644
index 0000000000..8530783673
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_assignment.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Cannot include a value of type "String" as "int".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/typed_array_init_with_unconvertable_in_literal.gd b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_init_with_unconvertable_in_literal.gd
new file mode 100644
index 0000000000..25cde1d40b
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_init_with_unconvertable_in_literal.gd
@@ -0,0 +1,4 @@
+func test():
+ var unconvertable := 1
+ var typed: Array[Object] = [unconvertable]
+ print('not ok')
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/typed_array_init_with_unconvertable_in_literal.out b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_init_with_unconvertable_in_literal.out
new file mode 100644
index 0000000000..dfe3443761
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_init_with_unconvertable_in_literal.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Cannot have an element of type "int" in an array of type "Array[Object]".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/typed_array_pass_differently_to_typed.gd b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_pass_differently_to_typed.gd
new file mode 100644
index 0000000000..1a90bd121e
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_pass_differently_to_typed.gd
@@ -0,0 +1,7 @@
+func expect_typed(typed: Array[int]):
+ print(typed.size())
+
+func test():
+ var differently: Array[float] = [1.0]
+ expect_typed(differently)
+ print('not ok')
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/typed_array_pass_differently_to_typed.out b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_pass_differently_to_typed.out
new file mode 100644
index 0000000000..297e1283e8
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/typed_array_pass_differently_to_typed.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Invalid argument for "expect_typed()" function: argument 1 should be "Array[int]" but is "Array[float]".
diff --git a/modules/gdscript/tests/scripts/analyzer/features/allow_void_function_to_return_void.gd b/modules/gdscript/tests/scripts/analyzer/features/allow_void_function_to_return_void.gd
new file mode 100644
index 0000000000..df89137f40
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/allow_void_function_to_return_void.gd
@@ -0,0 +1,20 @@
+func test():
+ return_call()
+ return_nothing()
+ return_side_effect()
+ var r = return_side_effect.call() # Untyped call to check return value.
+ prints(r, typeof(r) == TYPE_NIL)
+ print("end")
+
+func side_effect(v):
+ print("effect")
+ return v
+
+func return_call() -> void:
+ return print("hello")
+
+func return_nothing() -> void:
+ return
+
+func return_side_effect() -> void:
+ return side_effect("x")
diff --git a/modules/gdscript/tests/scripts/analyzer/features/allow_void_function_to_return_void.out b/modules/gdscript/tests/scripts/analyzer/features/allow_void_function_to_return_void.out
new file mode 100644
index 0000000000..7c0416371f
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/allow_void_function_to_return_void.out
@@ -0,0 +1,10 @@
+GDTEST_OK
+>> WARNING
+>> Line: 20
+>> UNSAFE_VOID_RETURN
+>> The method 'return_side_effect()' returns 'void' but it's trying to return a call to 'side_effect()' that can't be ensured to also be 'void'.
+hello
+effect
+effect
+<null> true
+end
diff --git a/modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.gd b/modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.gd
new file mode 100644
index 0000000000..272dce8bbe
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.gd
@@ -0,0 +1,10 @@
+const BEFORE = 1
+
+@export_range(-10, 10) var a = 0
+@export_range(1 + 2, absi(-10) + 1) var b = 5
+@export_range(BEFORE + 1, BEFORE + AFTER + 1) var c = 5
+
+const AFTER = 10
+
+func test():
+ pass
diff --git a/modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.out b/modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.out
new file mode 100644
index 0000000000..d73c5eb7cd
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.out
@@ -0,0 +1 @@
+GDTEST_OK
diff --git a/modules/gdscript/tests/scripts/analyzer/features/assignments_with_untyped.gd b/modules/gdscript/tests/scripts/analyzer/features/assignments_with_untyped.gd
index 2d2c2bef19..595563541f 100644
--- a/modules/gdscript/tests/scripts/analyzer/features/assignments_with_untyped.gd
+++ b/modules/gdscript/tests/scripts/analyzer/features/assignments_with_untyped.gd
@@ -1,9 +1,4 @@
func test():
- var one_0 = 0
- one_0 = 1
- var one_1 := one_0
- print(one_1)
-
var two: Variant = 0
two += 2
print(two)
diff --git a/modules/gdscript/tests/scripts/analyzer/features/assignments_with_untyped.out b/modules/gdscript/tests/scripts/analyzer/features/assignments_with_untyped.out
index 7536c38490..0ddfa4b75f 100644
--- a/modules/gdscript/tests/scripts/analyzer/features/assignments_with_untyped.out
+++ b/modules/gdscript/tests/scripts/analyzer/features/assignments_with_untyped.out
@@ -1,5 +1,4 @@
GDTEST_OK
-1
2
3
4
diff --git a/modules/gdscript/tests/scripts/analyzer/features/assymetric_assignment_good.gd b/modules/gdscript/tests/scripts/analyzer/features/assymetric_assignment_good.gd
new file mode 100644
index 0000000000..efd8ad6edb
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/assymetric_assignment_good.gd
@@ -0,0 +1,16 @@
+const const_color: Color = 'red'
+
+func func_color(arg_color: Color = 'blue') -> bool:
+ return arg_color == Color.BLUE
+
+@warning_ignore("assert_always_true")
+func test():
+ assert(const_color == Color.RED)
+
+ assert(func_color() == true)
+ assert(func_color('blue') == true)
+
+ var var_color: Color = 'green'
+ assert(var_color == Color.GREEN)
+
+ print('ok')
diff --git a/modules/gdscript/tests/scripts/analyzer/features/assymetric_assignment_good.out b/modules/gdscript/tests/scripts/analyzer/features/assymetric_assignment_good.out
new file mode 100644
index 0000000000..1b47ed10dc
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/assymetric_assignment_good.out
@@ -0,0 +1,2 @@
+GDTEST_OK
+ok
diff --git a/modules/gdscript/tests/scripts/analyzer/features/const_conversions.gd b/modules/gdscript/tests/scripts/analyzer/features/const_conversions.gd
new file mode 100644
index 0000000000..bed9dd0e96
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/const_conversions.gd
@@ -0,0 +1,24 @@
+const const_float_int: float = 19
+const const_float_plus: float = 12 + 22
+const const_float_cast: float = 76 as float
+
+const const_packed_empty: PackedFloat64Array = []
+const const_packed_ints: PackedFloat64Array = [52]
+
+@warning_ignore("assert_always_true")
+func test():
+ assert(typeof(const_float_int) == TYPE_FLOAT)
+ assert(str(const_float_int) == '19')
+ assert(typeof(const_float_plus) == TYPE_FLOAT)
+ assert(str(const_float_plus) == '34')
+ assert(typeof(const_float_cast) == TYPE_FLOAT)
+ assert(str(const_float_cast) == '76')
+
+ assert(typeof(const_packed_empty) == TYPE_PACKED_FLOAT64_ARRAY)
+ assert(str(const_packed_empty) == '[]')
+ assert(typeof(const_packed_ints) == TYPE_PACKED_FLOAT64_ARRAY)
+ assert(str(const_packed_ints) == '[52]')
+ assert(typeof(const_packed_ints[0]) == TYPE_FLOAT)
+ assert(str(const_packed_ints[0]) == '52')
+
+ print('ok')
diff --git a/modules/gdscript/tests/scripts/analyzer/features/const_conversions.out b/modules/gdscript/tests/scripts/analyzer/features/const_conversions.out
new file mode 100644
index 0000000000..1b47ed10dc
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/const_conversions.out
@@ -0,0 +1,2 @@
+GDTEST_OK
+ok
diff --git a/modules/gdscript/tests/scripts/analyzer/features/hard_variants.gd b/modules/gdscript/tests/scripts/analyzer/features/hard_variants.gd
new file mode 100644
index 0000000000..48a804ff54
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/hard_variants.gd
@@ -0,0 +1,32 @@
+func variant() -> Variant: return null
+
+var member_weak = variant()
+var member_typed: Variant = variant()
+var member_inferred := variant()
+
+func param_weak(param = variant()) -> void: print(param)
+func param_typed(param: Variant = variant()) -> void: print(param)
+func param_inferred(param := variant()) -> void: print(param)
+
+func return_untyped(): return variant()
+func return_typed() -> Variant: return variant()
+
+@warning_ignore("unused_variable")
+func test() -> void:
+ var weak = variant()
+ var typed: Variant = variant()
+ var inferred := variant()
+
+ weak = variant()
+ typed = variant()
+ inferred = variant()
+
+ param_weak(typed)
+ param_typed(typed)
+ param_inferred(typed)
+
+ if typed == null: pass
+ if typed != null: pass
+ if typed is Node: pass
+
+ print('ok')
diff --git a/modules/gdscript/tests/scripts/analyzer/features/hard_variants.out b/modules/gdscript/tests/scripts/analyzer/features/hard_variants.out
new file mode 100644
index 0000000000..08491efa07
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/hard_variants.out
@@ -0,0 +1,5 @@
+GDTEST_OK
+<null>
+<null>
+<null>
+ok
diff --git a/modules/gdscript/tests/scripts/analyzer/features/return_conversions.gd b/modules/gdscript/tests/scripts/analyzer/features/return_conversions.gd
new file mode 100644
index 0000000000..0b1576e66e
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/return_conversions.gd
@@ -0,0 +1,34 @@
+func convert_literal_int_to_float() -> float: return 76
+func convert_arg_int_to_float(arg: int) -> float: return arg
+func convert_var_int_to_float() -> float: var number := 59; return number
+
+func convert_literal_array_to_packed() -> PackedStringArray: return ['46']
+func convert_arg_array_to_packed(arg: Array) -> PackedStringArray: return arg
+func convert_var_array_to_packed() -> PackedStringArray: var array := ['79']; return array
+
+func test():
+ var converted_literal_int := convert_literal_int_to_float()
+ assert(typeof(converted_literal_int) == TYPE_FLOAT)
+ assert(converted_literal_int == 76.0)
+
+ var converted_arg_int := convert_arg_int_to_float(36)
+ assert(typeof(converted_arg_int) == TYPE_FLOAT)
+ assert(converted_arg_int == 36.0)
+
+ var converted_var_int := convert_var_int_to_float()
+ assert(typeof(converted_var_int) == TYPE_FLOAT)
+ assert(converted_var_int == 59.0)
+
+ var converted_literal_array := convert_literal_array_to_packed()
+ assert(typeof(converted_literal_array) == TYPE_PACKED_STRING_ARRAY)
+ assert(str(converted_literal_array) == '["46"]')
+
+ var converted_arg_array := convert_arg_array_to_packed(['91'])
+ assert(typeof(converted_arg_array) == TYPE_PACKED_STRING_ARRAY)
+ assert(str(converted_arg_array) == '["91"]')
+
+ var converted_var_array := convert_var_array_to_packed()
+ assert(typeof(converted_var_array) == TYPE_PACKED_STRING_ARRAY)
+ assert(str(converted_var_array) == '["79"]')
+
+ print('ok')
diff --git a/modules/gdscript/tests/scripts/analyzer/features/return_conversions.out b/modules/gdscript/tests/scripts/analyzer/features/return_conversions.out
new file mode 100644
index 0000000000..1b47ed10dc
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/return_conversions.out
@@ -0,0 +1,2 @@
+GDTEST_OK
+ok
diff --git a/modules/gdscript/tests/scripts/analyzer/features/typed_array_as_default_parameter.out b/modules/gdscript/tests/scripts/analyzer/features/typed_array_as_default_parameter.out
index 082e3ade19..2729c5b6c7 100644
--- a/modules/gdscript/tests/scripts/analyzer/features/typed_array_as_default_parameter.out
+++ b/modules/gdscript/tests/scripts/analyzer/features/typed_array_as_default_parameter.out
@@ -2,7 +2,7 @@ GDTEST_OK
[0]
0
[1]
-2
+0
[2]
2
ok
diff --git a/modules/gdscript/tests/scripts/analyzer/features/typed_array_usage.gd b/modules/gdscript/tests/scripts/analyzer/features/typed_array_usage.gd
new file mode 100644
index 0000000000..e1e6134fd4
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/typed_array_usage.gd
@@ -0,0 +1,204 @@
+class A: pass
+class B extends A: pass
+
+enum E { E0 = 391 }
+
+func floats_identity(floats: Array[float]): return floats
+
+class Members:
+ var one: Array[int] = [104]
+ var two: Array[int] = one
+
+ func check_passing() -> bool:
+ assert(str(one) == '[104]')
+ assert(str(two) == '[104]')
+ two.push_back(582)
+ assert(str(one) == '[104, 582]')
+ assert(str(two) == '[104, 582]')
+ two = [486]
+ assert(str(one) == '[104, 582]')
+ assert(str(two) == '[486]')
+ return true
+
+
+@warning_ignore("unsafe_method_access")
+@warning_ignore("assert_always_true")
+@warning_ignore("return_value_discarded")
+func test():
+ var untyped_basic = [459]
+ assert(str(untyped_basic) == '[459]')
+ assert(untyped_basic.get_typed_builtin() == TYPE_NIL)
+
+ var inferred_basic := [366]
+ assert(str(inferred_basic) == '[366]')
+ assert(inferred_basic.get_typed_builtin() == TYPE_NIL)
+
+ var typed_basic: Array = [521]
+ assert(str(typed_basic) == '[521]')
+ assert(typed_basic.get_typed_builtin() == TYPE_NIL)
+
+
+ var empty_floats: Array[float] = []
+ assert(str(empty_floats) == '[]')
+ assert(empty_floats.get_typed_builtin() == TYPE_FLOAT)
+
+ untyped_basic = empty_floats
+ assert(untyped_basic.get_typed_builtin() == TYPE_FLOAT)
+
+ inferred_basic = empty_floats
+ assert(inferred_basic.get_typed_builtin() == TYPE_FLOAT)
+
+ typed_basic = empty_floats
+ assert(typed_basic.get_typed_builtin() == TYPE_FLOAT)
+
+ empty_floats.push_back(705.0)
+ untyped_basic.push_back(430.0)
+ inferred_basic.push_back(263.0)
+ typed_basic.push_back(518.0)
+ assert(str(empty_floats) == '[705, 430, 263, 518]')
+ assert(str(untyped_basic) == '[705, 430, 263, 518]')
+ assert(str(inferred_basic) == '[705, 430, 263, 518]')
+ assert(str(typed_basic) == '[705, 430, 263, 518]')
+
+
+ const constant_float := 950.0
+ const constant_int := 170
+ var typed_float := 954.0
+ var filled_floats: Array[float] = [constant_float, constant_int, typed_float, empty_floats[1] + empty_floats[2]]
+ assert(str(filled_floats) == '[950, 170, 954, 693]')
+ assert(filled_floats.get_typed_builtin() == TYPE_FLOAT)
+
+ var casted_floats := [empty_floats[2] * 2] as Array[float]
+ assert(str(casted_floats) == '[526]')
+ assert(casted_floats.get_typed_builtin() == TYPE_FLOAT)
+
+ var returned_floats = (func () -> Array[float]: return [554]).call()
+ assert(str(returned_floats) == '[554]')
+ assert(returned_floats.get_typed_builtin() == TYPE_FLOAT)
+
+ var passed_floats = floats_identity([663.0 if randf() > 0.5 else 663.0])
+ assert(str(passed_floats) == '[663]')
+ assert(passed_floats.get_typed_builtin() == TYPE_FLOAT)
+
+ var default_floats = (func (floats: Array[float] = [364.0]): return floats).call()
+ assert(str(default_floats) == '[364]')
+ assert(default_floats.get_typed_builtin() == TYPE_FLOAT)
+
+ var typed_int := 556
+ var converted_floats: Array[float] = [typed_int]
+ assert(str(converted_floats) == '[556]')
+ assert(converted_floats.get_typed_builtin() == TYPE_FLOAT)
+
+
+ const constant_basic = [228]
+ assert(str(constant_basic) == '[228]')
+ assert(constant_basic.get_typed_builtin() == TYPE_NIL)
+
+ const constant_floats: Array[float] = [constant_float - constant_basic[0] - constant_int]
+ assert(str(constant_floats) == '[552]')
+ assert(constant_floats.get_typed_builtin() == TYPE_FLOAT)
+
+
+ var source_floats: Array[float] = [999.74]
+ untyped_basic = source_floats
+ var destination_floats: Array[float] = untyped_basic
+ destination_floats[0] -= 0.74
+ assert(str(source_floats) == '[999]')
+ assert(str(untyped_basic) == '[999]')
+ assert(str(destination_floats) == '[999]')
+ assert(destination_floats.get_typed_builtin() == TYPE_FLOAT)
+
+
+ var duplicated_floats := empty_floats.duplicate().slice(2, 3)
+ duplicated_floats[0] *= 3
+ assert(str(duplicated_floats) == '[789]')
+ assert(duplicated_floats.get_typed_builtin() == TYPE_FLOAT)
+
+
+ var b_objects: Array[B] = [B.new(), null]
+ assert(b_objects.size() == 2)
+ assert(b_objects.get_typed_builtin() == TYPE_OBJECT)
+ assert(b_objects.get_typed_script() == B)
+
+ var a_objects: Array[A] = [A.new(), B.new(), null, b_objects[0]]
+ assert(a_objects.size() == 4)
+ assert(a_objects.get_typed_builtin() == TYPE_OBJECT)
+ assert(a_objects.get_typed_script() == A)
+
+ var a_passed = (func check_a_passing(a_objects: Array[A]): return a_objects.size()).call(a_objects)
+ assert(a_passed == 4)
+
+ var b_passed = (func check_b_passing(basic: Array): return basic[0] != null).call(b_objects)
+ assert(b_passed == true)
+
+
+ var empty_strings: Array[String] = []
+ var empty_bools: Array[bool] = []
+ var empty_basic_one := []
+ var empty_basic_two := []
+ assert(empty_strings == empty_bools)
+ assert(empty_basic_one == empty_basic_two)
+ assert(empty_strings.hash() == empty_bools.hash())
+ assert(empty_basic_one.hash() == empty_basic_two.hash())
+
+
+ var assign_source: Array[int] = [527]
+ var assign_target: Array[int] = []
+ assign_target.assign(assign_source)
+ assert(str(assign_source) == '[527]')
+ assert(str(assign_target) == '[527]')
+ assign_source.push_back(657)
+ assert(str(assign_source) == '[527, 657]')
+ assert(str(assign_target) == '[527]')
+
+
+ var defaults_passed = (func check_defaults_passing(one: Array[int] = [], two := one):
+ one.push_back(887)
+ two.push_back(198)
+ assert(str(one) == '[887, 198]')
+ assert(str(two) == '[887, 198]')
+ two = [130]
+ assert(str(one) == '[887, 198]')
+ assert(str(two) == '[130]')
+ return true
+ ).call()
+ assert(defaults_passed == true)
+
+
+ var members := Members.new()
+ var members_passed := members.check_passing()
+ assert(members_passed == true)
+
+
+ var resized_basic: Array = []
+ resized_basic.resize(1)
+ assert(typeof(resized_basic[0]) == TYPE_NIL)
+ assert(resized_basic[0] == null)
+
+ var resized_ints: Array[int] = []
+ resized_ints.resize(1)
+ assert(typeof(resized_ints[0]) == TYPE_INT)
+ assert(resized_ints[0] == 0)
+
+ var resized_arrays: Array[Array] = []
+ resized_arrays.resize(1)
+ assert(typeof(resized_arrays[0]) == TYPE_ARRAY)
+ resized_arrays[0].resize(1)
+ resized_arrays[0][0] = 523
+ assert(str(resized_arrays) == '[[523]]')
+
+ var resized_objects: Array[Object] = []
+ resized_objects.resize(1)
+ assert(typeof(resized_objects[0]) == TYPE_NIL)
+ assert(resized_objects[0] == null)
+
+
+ var typed_enums: Array[E] = []
+ typed_enums.resize(1)
+ assert(str(typed_enums) == '[0]')
+ typed_enums[0] = E.E0
+ assert(str(typed_enums) == '[391]')
+ assert(typed_enums.get_typed_builtin() == TYPE_INT)
+
+
+ print('ok')
diff --git a/modules/gdscript/tests/scripts/analyzer/features/typed_array_usage.out b/modules/gdscript/tests/scripts/analyzer/features/typed_array_usage.out
new file mode 100644
index 0000000000..1b47ed10dc
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/typed_array_usage.out
@@ -0,0 +1,2 @@
+GDTEST_OK
+ok
diff --git a/modules/gdscript/tests/scripts/analyzer/features/vararg_call.gd b/modules/gdscript/tests/scripts/analyzer/features/vararg_call.gd
new file mode 100644
index 0000000000..d444250f1e
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/vararg_call.gd
@@ -0,0 +1,6 @@
+signal ok()
+
+@warning_ignore("return_value_discarded")
+func test():
+ ok.connect(func(): print('ok'))
+ emit_signal(&'ok')
diff --git a/modules/gdscript/tests/scripts/analyzer/features/vararg_call.out b/modules/gdscript/tests/scripts/analyzer/features/vararg_call.out
new file mode 100644
index 0000000000..1b47ed10dc
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/vararg_call.out
@@ -0,0 +1,2 @@
+GDTEST_OK
+ok
diff --git a/modules/gdscript/tests/scripts/analyzer/features/warning_ignore_annotation.gd b/modules/gdscript/tests/scripts/analyzer/features/warning_ignore_annotation.gd
index 877a4ea221..4c02fd4b0d 100644
--- a/modules/gdscript/tests/scripts/analyzer/features/warning_ignore_annotation.gd
+++ b/modules/gdscript/tests/scripts/analyzer/features/warning_ignore_annotation.gd
@@ -1,12 +1,12 @@
-@warning_ignore(unused_private_class_variable)
+@warning_ignore("unused_private_class_variable")
var _unused = 2
-@warning_ignore(unused_variable)
+@warning_ignore("unused_variable")
func test():
print("test")
var unused = 3
- @warning_ignore(redundant_await)
+ @warning_ignore("redundant_await")
print(await regular_func())
print("done")
diff --git a/modules/gdscript/tests/scripts/analyzer/typed_array_assignment.out b/modules/gdscript/tests/scripts/analyzer/typed_array_assignment.out
deleted file mode 100644
index ad2e6558d7..0000000000
--- a/modules/gdscript/tests/scripts/analyzer/typed_array_assignment.out
+++ /dev/null
@@ -1,2 +0,0 @@
-GDTEST_ANALYZER_ERROR
-Cannot assign a value of type Array[String] to constant "arr" with specified type Array[int].
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/cast_enum_bad_enum.gd b/modules/gdscript/tests/scripts/analyzer/warnings/cast_enum_bad_enum.gd
index 71616ea3af..71616ea3af 100644
--- a/modules/gdscript/tests/scripts/analyzer/errors/cast_enum_bad_enum.gd
+++ b/modules/gdscript/tests/scripts/analyzer/warnings/cast_enum_bad_enum.gd
diff --git a/modules/gdscript/tests/scripts/analyzer/warnings/cast_enum_bad_enum.out b/modules/gdscript/tests/scripts/analyzer/warnings/cast_enum_bad_enum.out
new file mode 100644
index 0000000000..6e086a0918
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/warnings/cast_enum_bad_enum.out
@@ -0,0 +1,6 @@
+GDTEST_OK
+>> WARNING
+>> Line: 5
+>> INT_AS_ENUM_WITHOUT_MATCH
+>> Cannot cast 2 as Enum "cast_enum_bad_enum.gd::MyEnum": no enum member has matching value.
+2
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/cast_enum_bad_int.gd b/modules/gdscript/tests/scripts/analyzer/warnings/cast_enum_bad_int.gd
index 60a31fb318..60a31fb318 100644
--- a/modules/gdscript/tests/scripts/analyzer/errors/cast_enum_bad_int.gd
+++ b/modules/gdscript/tests/scripts/analyzer/warnings/cast_enum_bad_int.gd
diff --git a/modules/gdscript/tests/scripts/analyzer/warnings/cast_enum_bad_int.out b/modules/gdscript/tests/scripts/analyzer/warnings/cast_enum_bad_int.out
new file mode 100644
index 0000000000..c19d57f98e
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/warnings/cast_enum_bad_int.out
@@ -0,0 +1,6 @@
+GDTEST_OK
+>> WARNING
+>> Line: 4
+>> INT_AS_ENUM_WITHOUT_MATCH
+>> Cannot cast 2 as Enum "cast_enum_bad_int.gd::MyEnum": no enum member has matching value.
+2
diff --git a/modules/gdscript/tests/scripts/analyzer/warnings/lambda_unused_arg.out b/modules/gdscript/tests/scripts/analyzer/warnings/lambda_unused_arg.out
index b018091c18..32e230fc80 100644
--- a/modules/gdscript/tests/scripts/analyzer/warnings/lambda_unused_arg.out
+++ b/modules/gdscript/tests/scripts/analyzer/warnings/lambda_unused_arg.out
@@ -2,4 +2,4 @@ GDTEST_OK
>> WARNING
>> Line: 2
>> UNUSED_PARAMETER
->>
+>> The parameter 'unused' is never used in the function ''. If this is intended, prefix it with an underscore: '_unused'
diff --git a/modules/gdscript/tests/scripts/parser/errors/class_name_after_annotation.gd b/modules/gdscript/tests/scripts/parser/errors/class_name_after_annotation.gd
index 0085b3f367..2470fe978e 100644
--- a/modules/gdscript/tests/scripts/parser/errors/class_name_after_annotation.gd
+++ b/modules/gdscript/tests/scripts/parser/errors/class_name_after_annotation.gd
@@ -1,5 +1,5 @@
# Error here. Annotations should be used before `class_name`, not after.
-class_name HelloWorld
+class_name WrongAnnotationPlace
@icon("res://path/to/optional/icon.svg")
func test():
diff --git a/modules/gdscript/tests/scripts/parser/errors/class_name_after_annotation.out b/modules/gdscript/tests/scripts/parser/errors/class_name_after_annotation.out
index a598ff8424..5fcf1cbcad 100644
--- a/modules/gdscript/tests/scripts/parser/errors/class_name_after_annotation.out
+++ b/modules/gdscript/tests/scripts/parser/errors/class_name_after_annotation.out
@@ -1,2 +1,2 @@
GDTEST_PARSER_ERROR
-Annotation "@icon" is not allowed in this level.
+Annotation "@icon" must be at the top of the script, before "extends" and "class_name".
diff --git a/modules/gdscript/tests/scripts/parser/errors/identifier_similar_to_keyword.gd b/modules/gdscript/tests/scripts/parser/errors/identifier_similar_to_keyword.gd
new file mode 100644
index 0000000000..4b1f284070
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/errors/identifier_similar_to_keyword.gd
@@ -0,0 +1,3 @@
+func test():
+ var аs # Using Cyrillic "а".
+ print(аs)
diff --git a/modules/gdscript/tests/scripts/parser/errors/identifier_similar_to_keyword.out b/modules/gdscript/tests/scripts/parser/errors/identifier_similar_to_keyword.out
new file mode 100644
index 0000000000..337dec2f4d
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/errors/identifier_similar_to_keyword.out
@@ -0,0 +1,2 @@
+GDTEST_PARSER_ERROR
+Identifier "аs" is visually similar to the GDScript keyword "as" and thus not allowed.
diff --git a/modules/gdscript/tests/scripts/parser/features/arrays_dictionaries_nested_const.gd b/modules/gdscript/tests/scripts/parser/features/arrays_dictionaries_nested_const.gd
index cc78309ae4..a34cc26e67 100644
--- a/modules/gdscript/tests/scripts/parser/features/arrays_dictionaries_nested_const.gd
+++ b/modules/gdscript/tests/scripts/parser/features/arrays_dictionaries_nested_const.gd
@@ -1,6 +1,6 @@
# https://github.com/godotengine/godot/issues/50285
-@warning_ignore(unused_local_constant)
+@warning_ignore("unused_local_constant")
func test():
const CONST_INNER_DICTIONARY = { "key": true }
const CONST_NESTED_DICTIONARY_OLD_WORKAROUND = {
diff --git a/modules/gdscript/tests/scripts/parser/features/export_enum.gd b/modules/gdscript/tests/scripts/parser/features/export_enum.gd
new file mode 100644
index 0000000000..9b2c22dea1
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/features/export_enum.gd
@@ -0,0 +1,15 @@
+@export_enum("Red", "Green", "Blue") var untyped
+
+@export_enum("Red", "Green", "Blue") var weak_int = 0
+@export_enum("Red", "Green", "Blue") var weak_string = ""
+
+@export_enum("Red", "Green", "Blue") var hard_int: int
+@export_enum("Red", "Green", "Blue") var hard_string: String
+
+@export_enum("Red:10", "Green:20", "Blue:30") var with_values
+
+func test():
+ for property in get_property_list():
+ if property.name in ["untyped", "weak_int", "weak_string", "hard_int",
+ "hard_string", "with_values"]:
+ prints(property.name, property.type, property.hint_string)
diff --git a/modules/gdscript/tests/scripts/parser/features/export_enum.out b/modules/gdscript/tests/scripts/parser/features/export_enum.out
new file mode 100644
index 0000000000..330b7eaf01
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/features/export_enum.out
@@ -0,0 +1,7 @@
+GDTEST_OK
+untyped 2 Red,Green,Blue
+weak_int 2 Red,Green,Blue
+weak_string 4 Red,Green,Blue
+hard_int 2 Red,Green,Blue
+hard_string 4 Red,Green,Blue
+with_values 2 Red:10,Green:20,Blue:30
diff --git a/modules/gdscript/tests/scripts/parser/features/export_variable.gd b/modules/gdscript/tests/scripts/parser/features/export_variable.gd
index 1e072728fc..acf9ff2e21 100644
--- a/modules/gdscript/tests/scripts/parser/features/export_variable.gd
+++ b/modules/gdscript/tests/scripts/parser/features/export_variable.gd
@@ -5,7 +5,7 @@
@export var color: Color
@export_color_no_alpha var color_no_alpha: Color
-@export_node_path(Sprite2D, Sprite3D, Control, Node) var nodepath := ^"hello"
+@export_node_path("Sprite2D", "Sprite3D", "Control", "Node") var nodepath := ^"hello"
func test():
diff --git a/modules/gdscript/tests/scripts/parser/features/match.gd b/modules/gdscript/tests/scripts/parser/features/match.gd
index 4d05490aa5..59b5ba2426 100644
--- a/modules/gdscript/tests/scripts/parser/features/match.gd
+++ b/modules/gdscript/tests/scripts/parser/features/match.gd
@@ -3,8 +3,6 @@ func test():
match i:
"Hello":
print("hello")
- # This will fall through to the default case below.
- continue
"Good bye":
print("bye")
_:
diff --git a/modules/gdscript/tests/scripts/parser/features/match.out b/modules/gdscript/tests/scripts/parser/features/match.out
index 732885c7a2..a2cb94399c 100644
--- a/modules/gdscript/tests/scripts/parser/features/match.out
+++ b/modules/gdscript/tests/scripts/parser/features/match.out
@@ -1,4 +1,3 @@
GDTEST_OK
hello
-default
This will match
diff --git a/modules/gdscript/tests/scripts/parser/features/match_with_variables.gd b/modules/gdscript/tests/scripts/parser/features/match_with_variables.gd
new file mode 100644
index 0000000000..aa38c3bf41
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/features/match_with_variables.gd
@@ -0,0 +1,22 @@
+func test():
+ var a = 1
+ match 1:
+ a:
+ print("reach 1")
+
+ var dict = { b = 2 }
+ match 2:
+ dict.b:
+ print("reach 2")
+
+ var nested_dict = {
+ sub = { c = 3 }
+ }
+ match 3:
+ nested_dict.sub.c:
+ print("reach 3")
+
+ var sub_pattern = { d = 4 }
+ match [4]:
+ [sub_pattern.d]:
+ print("reach 4")
diff --git a/modules/gdscript/tests/scripts/parser/features/match_with_variables.out b/modules/gdscript/tests/scripts/parser/features/match_with_variables.out
new file mode 100644
index 0000000000..de1dcb0d40
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/features/match_with_variables.out
@@ -0,0 +1,5 @@
+GDTEST_OK
+reach 1
+reach 2
+reach 3
+reach 4
diff --git a/modules/gdscript/tests/scripts/parser/features/nested_match.gd b/modules/gdscript/tests/scripts/parser/features/nested_match.gd
index aaddcc7e83..491d917a8e 100644
--- a/modules/gdscript/tests/scripts/parser/features/nested_match.gd
+++ b/modules/gdscript/tests/scripts/parser/features/nested_match.gd
@@ -8,11 +8,10 @@ func test():
1234:
print("2")
match number:
- 1234:
- print("3")
- continue
+ 4321:
+ print("Should not be printed")
_:
- print("Should also be printed")
+ print("3")
match number:
1234:
print("4")
diff --git a/modules/gdscript/tests/scripts/parser/features/nested_match.out b/modules/gdscript/tests/scripts/parser/features/nested_match.out
index 651d76cc59..c2d2e29a06 100644
--- a/modules/gdscript/tests/scripts/parser/features/nested_match.out
+++ b/modules/gdscript/tests/scripts/parser/features/nested_match.out
@@ -2,7 +2,6 @@ GDTEST_OK
1
2
3
-Should also be printed
4
5
6
diff --git a/modules/gdscript/tests/scripts/parser/features/unicode_identifiers.gd b/modules/gdscript/tests/scripts/parser/features/unicode_identifiers.gd
new file mode 100644
index 0000000000..523959a016
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/features/unicode_identifiers.gd
@@ -0,0 +1,35 @@
+const π = PI
+var ㄥ = π
+
+func test():
+ var ÖƒÕ¸Ö€Õ±Õ¡Ö€Õ¯Õ¸Ö‚Õ´ = "test"
+ prints("ÖƒÕ¸Ö€Õ±Õ¡Ö€Õ¯Õ¸Ö‚Õ´", ÖƒÕ¸Ö€Õ±Õ¡Ö€Õ¯Õ¸Ö‚Õ´)
+ var امتحان = "test"
+ prints("امتحان", امتحان)
+ var পরীকà§à¦·à¦¾ = "test"
+ prints("পরীকà§à¦·à¦¾", পরীকà§à¦·à¦¾)
+ var теÑÑ‚ = "test"
+ prints("теÑÑ‚", теÑÑ‚)
+ var जाà¤à¤š = "test"
+ prints("जाà¤à¤š", जाà¤à¤š)
+ var 기준 = "test"
+ prints("기준", 기준)
+ var 测试 = "test"
+ prints("测试", 测试)
+ var テスト = "test"
+ prints("テスト", テスト)
+ var 試験 = "test"
+ prints("試験", 試験)
+ var പരീകàµà´· = "test"
+ prints("പരീകàµà´·", പരീകàµà´·)
+ var ทดสอบ = "test"
+ prints("ทดสอบ", ทดสอบ)
+ var δοκιμή = "test"
+ prints("δοκιμή", δοκιμή)
+
+ const d = 1.1
+ _process(d)
+ print(is_equal_approx(ã„¥, PI + (d * PI)))
+
+func _process(Δ: float) -> void:
+ ㄥ += Δ * π
diff --git a/modules/gdscript/tests/scripts/parser/features/unicode_identifiers.out b/modules/gdscript/tests/scripts/parser/features/unicode_identifiers.out
new file mode 100644
index 0000000000..c071380a8f
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/features/unicode_identifiers.out
@@ -0,0 +1,14 @@
+GDTEST_OK
+ÖƒÕ¸Ö€Õ±Õ¡Ö€Õ¯Õ¸Ö‚Õ´ test
+امتحان test
+পরীকà§à¦·à¦¾ test
+теÑÑ‚ test
+जाà¤à¤š test
+기준 test
+测试 test
+テスト test
+試験 test
+പരീകàµà´· test
+ทดสอบ test
+δοκιμή test
+true
diff --git a/modules/gdscript/tests/scripts/parser/warnings/confusable_identifier.gd b/modules/gdscript/tests/scripts/parser/warnings/confusable_identifier.gd
new file mode 100644
index 0000000000..e2caac8ffd
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/warnings/confusable_identifier.gd
@@ -0,0 +1,5 @@
+func test():
+ var port = 0 # Only latin characters.
+ var pοrt = 1 # The "ο" is Greek omicron.
+
+ prints(port, pοrt)
diff --git a/modules/gdscript/tests/scripts/parser/warnings/confusable_identifier.out b/modules/gdscript/tests/scripts/parser/warnings/confusable_identifier.out
new file mode 100644
index 0000000000..c483396443
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/warnings/confusable_identifier.out
@@ -0,0 +1,6 @@
+GDTEST_OK
+>> WARNING
+>> Line: 3
+>> CONFUSABLE_IDENTIFIER
+>> The identifier "pοrt" has misleading characters and might be confused with something else.
+0 1
diff --git a/modules/gdscript/tests/scripts/parser/warnings/enum_assign_int_without_casting.out b/modules/gdscript/tests/scripts/parser/warnings/enum_assign_int_without_casting.out
index eef13bbff8..b8e243769f 100644
--- a/modules/gdscript/tests/scripts/parser/warnings/enum_assign_int_without_casting.out
+++ b/modules/gdscript/tests/scripts/parser/warnings/enum_assign_int_without_casting.out
@@ -1,19 +1,19 @@
GDTEST_OK
>> WARNING
>> Line: 5
->> INT_ASSIGNED_TO_ENUM
+>> INT_AS_ENUM_WITHOUT_CAST
>> Integer used when an enum value is expected. If this is intended cast the integer to the enum type.
>> WARNING
>> Line: 9
->> INT_ASSIGNED_TO_ENUM
+>> INT_AS_ENUM_WITHOUT_CAST
>> Integer used when an enum value is expected. If this is intended cast the integer to the enum type.
>> WARNING
>> Line: 12
->> INT_ASSIGNED_TO_ENUM
+>> INT_AS_ENUM_WITHOUT_CAST
>> Integer used when an enum value is expected. If this is intended cast the integer to the enum type.
>> WARNING
>> Line: 14
->> INT_ASSIGNED_TO_ENUM
+>> INT_AS_ENUM_WITHOUT_CAST
>> Integer used when an enum value is expected. If this is intended cast the integer to the enum type.
0
1
diff --git a/modules/gdscript/tests/scripts/runtime/errors/constant_array_push_back.gd b/modules/gdscript/tests/scripts/runtime/errors/constant_array_push_back.gd
deleted file mode 100644
index 3e71cd0518..0000000000
--- a/modules/gdscript/tests/scripts/runtime/errors/constant_array_push_back.gd
+++ /dev/null
@@ -1,4 +0,0 @@
-const array: Array = [0]
-
-func test():
- array.push_back(0)
diff --git a/modules/gdscript/tests/scripts/runtime/errors/constant_array_push_back.out b/modules/gdscript/tests/scripts/runtime/errors/constant_array_push_back.out
deleted file mode 100644
index ba3e1c46c6..0000000000
--- a/modules/gdscript/tests/scripts/runtime/errors/constant_array_push_back.out
+++ /dev/null
@@ -1,7 +0,0 @@
-GDTEST_RUNTIME_ERROR
->> ERROR
->> on function: push_back()
->> core/variant/array.cpp
->> 253
->> Condition "_p->read_only" is true.
->> Array is in read-only state.
diff --git a/modules/gdscript/tests/scripts/runtime/errors/constant_dictionary_erase.gd b/modules/gdscript/tests/scripts/runtime/errors/constant_dictionary_erase.gd
deleted file mode 100644
index 7b350e81ad..0000000000
--- a/modules/gdscript/tests/scripts/runtime/errors/constant_dictionary_erase.gd
+++ /dev/null
@@ -1,4 +0,0 @@
-const dictionary := {}
-
-func test():
- dictionary.erase(0)
diff --git a/modules/gdscript/tests/scripts/runtime/errors/constant_dictionary_erase.out b/modules/gdscript/tests/scripts/runtime/errors/constant_dictionary_erase.out
deleted file mode 100644
index 3e7ca11a4f..0000000000
--- a/modules/gdscript/tests/scripts/runtime/errors/constant_dictionary_erase.out
+++ /dev/null
@@ -1,7 +0,0 @@
-GDTEST_RUNTIME_ERROR
->> ERROR
->> on function: erase()
->> core/variant/dictionary.cpp
->> 177
->> Condition "_p->read_only" is true. Returning: false
->> Dictionary is in read-only state.
diff --git a/modules/gdscript/tests/scripts/runtime/errors/non_static_method_call_on_native_class.gd b/modules/gdscript/tests/scripts/runtime/errors/non_static_method_call_on_native_class.gd
new file mode 100644
index 0000000000..0c15701364
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/errors/non_static_method_call_on_native_class.gd
@@ -0,0 +1,6 @@
+# https://github.com/godotengine/godot/issues/66675
+func test():
+ example(Node2D)
+
+func example(thing):
+ print(thing.has_method('asdf'))
diff --git a/modules/gdscript/tests/scripts/runtime/errors/non_static_method_call_on_native_class.out b/modules/gdscript/tests/scripts/runtime/errors/non_static_method_call_on_native_class.out
new file mode 100644
index 0000000000..3a90f98d99
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/errors/non_static_method_call_on_native_class.out
@@ -0,0 +1,6 @@
+GDTEST_RUNTIME_ERROR
+>> SCRIPT ERROR
+>> on function: example()
+>> runtime/errors/non_static_method_call_on_native_class.gd
+>> 6
+>> Invalid call. Nonexistent function 'has_method' in base 'Node2D'.
diff --git a/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_basic_to_typed.gd b/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_basic_to_typed.gd
new file mode 100644
index 0000000000..e9dbc1b640
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_basic_to_typed.gd
@@ -0,0 +1,4 @@
+func test():
+ var basic := [1]
+ var typed: Array[int] = basic
+ print('not ok')
diff --git a/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_basic_to_typed.out b/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_basic_to_typed.out
new file mode 100644
index 0000000000..bca700b4ec
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_basic_to_typed.out
@@ -0,0 +1,6 @@
+GDTEST_RUNTIME_ERROR
+>> SCRIPT ERROR
+>> on function: test()
+>> runtime/errors/typed_array_assign_basic_to_typed.gd
+>> 3
+>> Trying to assign an array of type "Array" to a variable of type "Array[int]".
diff --git a/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_differently_typed.gd b/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_differently_typed.gd
new file mode 100644
index 0000000000..920352a6ea
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_differently_typed.gd
@@ -0,0 +1,4 @@
+func test():
+ var differently: Variant = [1.0] as Array[float]
+ var typed: Array[int] = differently
+ print('not ok')
diff --git a/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_differently_typed.out b/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_differently_typed.out
new file mode 100644
index 0000000000..402ab38fb3
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_differently_typed.out
@@ -0,0 +1,6 @@
+GDTEST_RUNTIME_ERROR
+>> SCRIPT ERROR
+>> on function: test()
+>> runtime/errors/typed_array_assign_differently_typed.gd
+>> 3
+>> Trying to assign an array of type "Array[float]" to a variable of type "Array[int]".
diff --git a/modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_basic_to_typed.gd b/modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_basic_to_typed.gd
new file mode 100644
index 0000000000..e1fd0f7168
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_basic_to_typed.gd
@@ -0,0 +1,7 @@
+func expect_typed(typed: Array[int]):
+ print(typed.size())
+
+func test():
+ var basic := [1]
+ expect_typed(basic)
+ print('not ok')
diff --git a/modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_basic_to_typed.out b/modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_basic_to_typed.out
new file mode 100644
index 0000000000..6f210e944e
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_basic_to_typed.out
@@ -0,0 +1,6 @@
+GDTEST_RUNTIME_ERROR
+>> SCRIPT ERROR
+>> on function: test()
+>> runtime/errors/typed_array_pass_basic_to_typed.gd
+>> 6
+>> Invalid type in function 'expect_typed' in base 'RefCounted ()'. The array of argument 1 (Array) does not have the same element type as the expected typed array argument.
diff --git a/modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_differently_to_typed.gd b/modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_differently_to_typed.gd
new file mode 100644
index 0000000000..e2d2721e8c
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_differently_to_typed.gd
@@ -0,0 +1,7 @@
+func expect_typed(typed: Array[int]):
+ print(typed.size())
+
+func test():
+ var differently: Variant = [1.0] as Array[float]
+ expect_typed(differently)
+ print('not ok')
diff --git a/modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_differently_to_typed.out b/modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_differently_to_typed.out
new file mode 100644
index 0000000000..3cd4e25bd8
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/errors/typed_array_pass_differently_to_typed.out
@@ -0,0 +1,6 @@
+GDTEST_RUNTIME_ERROR
+>> SCRIPT ERROR
+>> on function: test()
+>> runtime/errors/typed_array_pass_differently_to_typed.gd
+>> 6
+>> Invalid type in function 'expect_typed' in base 'RefCounted ()'. The array of argument 1 (Array[float]) does not have the same element type as the expected typed array argument.
diff --git a/modules/gdscript/tests/scripts/runtime/features/await_on_void.gd b/modules/gdscript/tests/scripts/runtime/features/await_on_void.gd
index 46b9fbc951..1490a164c9 100644
--- a/modules/gdscript/tests/scripts/runtime/features/await_on_void.gd
+++ b/modules/gdscript/tests/scripts/runtime/features/await_on_void.gd
@@ -2,6 +2,6 @@ func wait() -> void:
pass
func test():
- @warning_ignore(redundant_await)
+ @warning_ignore("redundant_await")
await wait()
print("end")
diff --git a/modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.gd b/modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.gd
new file mode 100644
index 0000000000..d1746979be
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.gd
@@ -0,0 +1,10 @@
+const array: Array = [0]
+const dictionary := {1: 2}
+
+@warning_ignore("assert_always_true")
+func test():
+ assert(array.is_read_only() == true)
+ assert(str(array) == '[0]')
+ assert(dictionary.is_read_only() == true)
+ assert(str(dictionary) == '{ 1: 2 }')
+ print('ok')
diff --git a/modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.out b/modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.out
new file mode 100644
index 0000000000..1b47ed10dc
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.out
@@ -0,0 +1,2 @@
+GDTEST_OK
+ok
diff --git a/modules/gdscript/tests/scripts/runtime/features/does_not_override_temp_values.gd b/modules/gdscript/tests/scripts/runtime/features/does_not_override_temp_values.gd
index 1d4b400d81..48af734317 100644
--- a/modules/gdscript/tests/scripts/runtime/features/does_not_override_temp_values.gd
+++ b/modules/gdscript/tests/scripts/runtime/features/does_not_override_temp_values.gd
@@ -7,11 +7,11 @@ func test():
func builtin_method():
var pba := PackedByteArray()
- @warning_ignore(return_value_discarded)
+ @warning_ignore("return_value_discarded")
pba.resize(1) # Built-in validated.
func builtin_method_static():
var _pba := PackedByteArray()
- @warning_ignore(return_value_discarded)
+ @warning_ignore("return_value_discarded")
Vector2.from_angle(PI) # Static built-in validated.
diff --git a/modules/gdscript/tests/scripts/runtime/features/gdscript.gd b/modules/gdscript/tests/scripts/runtime/features/gdscript.gd
index f2368643de..e686cffc48 100644
--- a/modules/gdscript/tests/scripts/runtime/features/gdscript.gd
+++ b/modules/gdscript/tests/scripts/runtime/features/gdscript.gd
@@ -11,10 +11,10 @@ class InnerClass:
func _init() -> void:
prints("Inner")
'''
- @warning_ignore(return_value_discarded)
+ @warning_ignore("return_value_discarded")
gdscr.reload()
var inst = gdscr.new()
- @warning_ignore(unsafe_method_access)
+ @warning_ignore("unsafe_method_access")
inst.test()
diff --git a/modules/gdscript/tests/scripts/runtime/features/standalone-calls-do-not-write-to-nil.gd b/modules/gdscript/tests/scripts/runtime/features/standalone-calls-do-not-write-to-nil.gd
index cc34e71b01..2f55059334 100644
--- a/modules/gdscript/tests/scripts/runtime/features/standalone-calls-do-not-write-to-nil.gd
+++ b/modules/gdscript/tests/scripts/runtime/features/standalone-calls-do-not-write-to-nil.gd
@@ -20,26 +20,26 @@ func test_utility(v, f):
assert(not f) # Test unary operator reading from `nil`.
func test_builtin_call(v, f):
- @warning_ignore(unsafe_method_access)
+ @warning_ignore("unsafe_method_access")
v.angle() # Built-in method call.
assert(not f) # Test unary operator reading from `nil`.
func test_builtin_call_validated(v: Vector2, f):
- @warning_ignore(return_value_discarded)
+ @warning_ignore("return_value_discarded")
v.abs() # Built-in method call validated.
assert(not f) # Test unary operator reading from `nil`.
func test_object_call(v, f):
- @warning_ignore(unsafe_method_access)
+ @warning_ignore("unsafe_method_access")
v.get_reference_count() # Native type method call.
assert(not f) # Test unary operator reading from `nil`.
func test_object_call_method_bind(v: Resource, f):
- @warning_ignore(return_value_discarded)
+ @warning_ignore("return_value_discarded")
v.duplicate() # Native type method call with MethodBind.
assert(not f) # Test unary operator reading from `nil`.
func test_object_call_ptrcall(v: RefCounted, f):
- @warning_ignore(return_value_discarded)
+ @warning_ignore("return_value_discarded")
v.get_reference_count() # Native type method call with ptrcall.
assert(not f) # Test unary operator reading from `nil`.
diff --git a/modules/gdscript/tests/scripts/runtime/features/typed_array_init_with_untyped_in_literal.gd b/modules/gdscript/tests/scripts/runtime/features/typed_array_init_with_untyped_in_literal.gd
new file mode 100644
index 0000000000..ec444b4ffa
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/typed_array_init_with_untyped_in_literal.gd
@@ -0,0 +1,6 @@
+func test():
+ var untyped: Variant = 32
+ var typed: Array[int] = [untyped]
+ assert(typed.get_typed_builtin() == TYPE_INT)
+ assert(str(typed) == '[32]')
+ print('ok')
diff --git a/modules/gdscript/tests/scripts/runtime/features/typed_array_init_with_untyped_in_literal.out b/modules/gdscript/tests/scripts/runtime/features/typed_array_init_with_untyped_in_literal.out
new file mode 100644
index 0000000000..1b47ed10dc
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/typed_array_init_with_untyped_in_literal.out
@@ -0,0 +1,2 @@
+GDTEST_OK
+ok
diff --git a/modules/gdscript/tests/scripts/runtime/features/use_conversion_assign_with_variant_value.gd b/modules/gdscript/tests/scripts/runtime/features/use_conversion_assign_with_variant_value.gd
index af3f3cb941..efa8270526 100644
--- a/modules/gdscript/tests/scripts/runtime/features/use_conversion_assign_with_variant_value.gd
+++ b/modules/gdscript/tests/scripts/runtime/features/use_conversion_assign_with_variant_value.gd
@@ -1,7 +1,7 @@
# https://github.com/godotengine/godot/issues/71172
func test():
- @warning_ignore(narrowing_conversion)
+ @warning_ignore("narrowing_conversion")
var foo: int = 0.0
print(typeof(foo) == TYPE_INT)
var dict : Dictionary = {"a":0.0}
diff --git a/modules/gltf/doc_classes/GLTFDocument.xml b/modules/gltf/doc_classes/GLTFDocument.xml
index d7e8141eb1..d6657cad5d 100644
--- a/modules/gltf/doc_classes/GLTFDocument.xml
+++ b/modules/gltf/doc_classes/GLTFDocument.xml
@@ -51,6 +51,7 @@
<param index="0" name="state" type="GLTFState" />
<param index="1" name="bake_fps" type="float" default="30" />
<param index="2" name="trimming" type="bool" default="false" />
+ <param index="3" name="remove_immutable_tracks" type="bool" default="true" />
<description>
Takes a [GLTFState] object through the [param state] parameter and returns a Godot Engine scene node.
</description>
diff --git a/modules/gltf/doc_classes/GLTFState.xml b/modules/gltf/doc_classes/GLTFState.xml
index 9a554a0d49..b8943795a0 100644
--- a/modules/gltf/doc_classes/GLTFState.xml
+++ b/modules/gltf/doc_classes/GLTFState.xml
@@ -55,6 +55,11 @@
<description>
</description>
</method>
+ <method name="get_handle_binary_image">
+ <return type="int" />
+ <description>
+ </description>
+ </method>
<method name="get_images">
<return type="Texture2D[]" />
<description>
@@ -155,6 +160,12 @@
<description>
</description>
</method>
+ <method name="set_handle_binary_image">
+ <return type="void" />
+ <param index="0" name="method" type="int" />
+ <description>
+ </description>
+ </method>
<method name="set_images">
<return type="void" />
<param index="0" name="images" type="Texture2D[]" />
@@ -251,4 +262,12 @@
<member name="use_named_skin_binds" type="bool" setter="set_use_named_skin_binds" getter="get_use_named_skin_binds" default="false">
</member>
</members>
+ <constants>
+ <constant name="HANDLE_BINARY_DISCARD_TEXTURES" value="0">
+ </constant>
+ <constant name="HANDLE_BINARY_EXTRACT_TEXTURES" value="1">
+ </constant>
+ <constant name="HANDLE_BINARY_EMBED_AS_BASISU" value="2">
+ </constant>
+ </constants>
</class>
diff --git a/modules/gltf/editor/editor_scene_importer_blend.cpp b/modules/gltf/editor/editor_scene_importer_blend.cpp
index 2b8c057ee5..5415c5818f 100644
--- a/modules/gltf/editor/editor_scene_importer_blend.cpp
+++ b/modules/gltf/editor/editor_scene_importer_blend.cpp
@@ -32,6 +32,7 @@
#ifdef TOOLS_ENABLED
+#include "../gltf_defines.h"
#include "../gltf_document.h"
#include "core/config/project_settings.h"
@@ -43,7 +44,6 @@
#include "scene/gui/line_edit.h"
#ifdef WINDOWS_ENABLED
-// Code by Pedro Estebanez (https://github.com/godotengine/godot/pull/59766)
#include <shlwapi.h>
#endif
@@ -221,6 +221,7 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
gltf.instantiate();
Ref<GLTFState> state;
state.instantiate();
+
String base_dir;
if (p_options.has(SNAME("blender/materials/unpack_enabled")) && p_options[SNAME("blender/materials/unpack_enabled")]) {
base_dir = sink.get_base_dir();
@@ -232,7 +233,7 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
}
return nullptr;
}
- return gltf->generate_scene(state, (float)p_options["animation/fps"], (bool)p_options["animation/trimming"]);
+ return gltf->generate_scene(state, (float)p_options["animation/fps"], (bool)p_options["animation/trimming"], (bool)p_options["animation/remove_immutable_tracks"]);
}
Variant EditorSceneFormatImporterBlend::get_option_visibility(const String &p_path, bool p_for_animation, const String &p_option,
@@ -274,9 +275,6 @@ void EditorSceneFormatImporterBlend::get_import_options(const String &p_path, Li
ADD_OPTION_BOOL("blender/animation/limit_playback", true);
ADD_OPTION_BOOL("blender/animation/always_sample", true);
ADD_OPTION_BOOL("blender/animation/group_tracks", true);
-
-#undef ADD_OPTION_BOOL
-#undef ADD_OPTION_ENUM
}
///////////////////////////
diff --git a/modules/gltf/editor/editor_scene_importer_fbx.cpp b/modules/gltf/editor/editor_scene_importer_fbx.cpp
index 6c6ab7cd03..d829630032 100644
--- a/modules/gltf/editor/editor_scene_importer_fbx.cpp
+++ b/modules/gltf/editor/editor_scene_importer_fbx.cpp
@@ -100,7 +100,7 @@ Node *EditorSceneFormatImporterFBX::import_scene(const String &p_path, uint32_t
}
return nullptr;
}
- return gltf->generate_scene(state, (float)p_options["animation/fps"], (bool)p_options["animation/trimming"]);
+ return gltf->generate_scene(state, (float)p_options["animation/fps"], (bool)p_options["animation/trimming"], (bool)p_options["animation/remove_immutable_tracks"]);
}
Variant EditorSceneFormatImporterFBX::get_option_visibility(const String &p_path, bool p_for_animation,
diff --git a/modules/gltf/editor/editor_scene_importer_gltf.cpp b/modules/gltf/editor/editor_scene_importer_gltf.cpp
index 39956a6ff6..67bbf8dd15 100644
--- a/modules/gltf/editor/editor_scene_importer_gltf.cpp
+++ b/modules/gltf/editor/editor_scene_importer_gltf.cpp
@@ -32,6 +32,7 @@
#include "editor_scene_importer_gltf.h"
+#include "../gltf_defines.h"
#include "../gltf_document.h"
uint32_t EditorSceneFormatImporterGLTF::get_import_flags() const {
@@ -50,6 +51,10 @@ Node *EditorSceneFormatImporterGLTF::import_scene(const String &p_path, uint32_t
doc.instantiate();
Ref<GLTFState> state;
state.instantiate();
+ if (p_options.has("meshes/handle_gltf_embedded_images")) {
+ int32_t enum_option = p_options["meshes/handle_gltf_embedded_images"];
+ state->set_handle_binary_image(enum_option);
+ }
Error err = doc->append_from_file(p_path, state, p_flags);
if (err != OK) {
if (r_err) {
@@ -61,11 +66,28 @@ Node *EditorSceneFormatImporterGLTF::import_scene(const String &p_path, uint32_t
state->set_create_animations(bool(p_options["animation/import"]));
}
+#ifndef DISABLE_DEPRECATED
if (p_options.has("animation/trimming")) {
- return doc->generate_scene(state, (float)p_options["animation/fps"], (bool)p_options["animation/trimming"]);
+ if (p_options.has("animation/remove_immutable_tracks")) {
+ return doc->generate_scene(state, (float)p_options["animation/fps"], (bool)p_options["animation/trimming"], (bool)p_options["animation/remove_immutable_tracks"]);
+ } else {
+ return doc->generate_scene(state, (float)p_options["animation/fps"], (bool)p_options["animation/trimming"], true);
+ }
} else {
- return doc->generate_scene(state, (float)p_options["animation/fps"], false);
+ if (p_options.has("animation/remove_immutable_tracks")) {
+ return doc->generate_scene(state, (float)p_options["animation/fps"], false, (bool)p_options["animation/remove_immutable_tracks"]);
+ } else {
+ return doc->generate_scene(state, (float)p_options["animation/fps"], false, true);
+ }
}
+#else
+ return doc->generate_scene(state, (float)p_options["animation/fps"], (bool)p_options["animation/trimming"], (bool)p_options["animation/remove_immutable_tracks"]);
+#endif
+}
+
+void EditorSceneFormatImporterGLTF::get_import_options(const String &p_path,
+ List<ResourceImporter::ImportOption> *r_options) {
+ r_options->push_back(ResourceImporterScene::ImportOption(PropertyInfo(Variant::INT, "meshes/handle_gltf_embedded_images", PROPERTY_HINT_ENUM, "Discard All Textures,Extract Textures,Embed As Basis Universal", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), GLTFState::HANDLE_BINARY_EXTRACT_TEXTURES));
}
#endif // TOOLS_ENABLED
diff --git a/modules/gltf/editor/editor_scene_importer_gltf.h b/modules/gltf/editor/editor_scene_importer_gltf.h
index c2a4bf046d..ed57ec8cdb 100644
--- a/modules/gltf/editor/editor_scene_importer_gltf.h
+++ b/modules/gltf/editor/editor_scene_importer_gltf.h
@@ -47,6 +47,8 @@ public:
virtual Node *import_scene(const String &p_path, uint32_t p_flags,
const HashMap<StringName, Variant> &p_options,
List<String> *r_missing_deps, Error *r_err = nullptr) override;
+ virtual void get_import_options(const String &p_path,
+ List<ResourceImporter::ImportOption> *r_options) override;
};
#endif // TOOLS_ENABLED
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index 788a70f640..5950ad33b5 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -33,6 +33,7 @@
#include "extensions/gltf_spec_gloss.h"
#include "core/crypto/crypto_core.h"
+#include "core/io/config_file.h"
#include "core/io/dir_access.h"
#include "core/io/file_access.h"
#include "core/io/file_access_memory.h"
@@ -543,6 +544,7 @@ String GLTFDocument::_gen_unique_bone_name(Ref<GLTFState> p_state, const GLTFSke
}
Error GLTFDocument::_parse_scenes(Ref<GLTFState> p_state) {
+ p_state->unique_names.insert("Skeleton3D"); // Reserve skeleton name.
ERR_FAIL_COND_V(!p_state->json.has("scenes"), ERR_FILE_CORRUPT);
const Array &scenes = p_state->json["scenes"];
int loaded_scene = 0;
@@ -3063,6 +3065,7 @@ Error GLTFDocument::_parse_images(Ref<GLTFState> p_state, const String &p_base_p
// Ref: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#images
const Array &images = p_state->json["images"];
+ HashSet<String> used_names;
for (int i = 0; i < images.size(); i++) {
const Dictionary &d = images[i];
@@ -3089,6 +3092,19 @@ Error GLTFDocument::_parse_images(Ref<GLTFState> p_state, const String &p_base_p
const uint8_t *data_ptr = nullptr;
int data_size = 0;
+ String image_name;
+ if (d.has("name")) {
+ image_name = d["name"];
+ image_name = image_name.get_file().get_basename().validate_filename();
+ }
+ if (image_name.is_empty()) {
+ image_name = itos(i);
+ }
+ while (used_names.has(image_name)) {
+ image_name += "_" + itos(i);
+ }
+ used_names.insert(image_name);
+
if (d.has("uri")) {
// Handles the first two bullet points from the spec (embedded data, or external file).
String uri = d["uri"];
@@ -3124,10 +3140,12 @@ Error GLTFDocument::_parse_images(Ref<GLTFState> p_state, const String &p_base_p
// API for that in Godot, so we'd have to load as a buffer (i.e. embedded in
// the material), so we do this only as fallback.
Ref<Texture2D> texture = ResourceLoader::load(uri);
+ String extension = uri.get_extension().to_lower();
if (texture.is_valid()) {
p_state->images.push_back(texture);
+ p_state->source_images.push_back(texture->get_image());
continue;
- } else if (mimetype == "image/png" || mimetype == "image/jpeg") {
+ } else if (mimetype == "image/png" || mimetype == "image/jpeg" || extension == "png" || extension == "jpg" || extension == "jpeg") {
// Fallback to loading as byte array.
// This enables us to support the spec's requirement that we honor mimetype
// regardless of file URI.
@@ -3195,9 +3213,69 @@ Error GLTFDocument::_parse_images(Ref<GLTFState> p_state, const String &p_base_p
if (img.is_null()) {
ERR_PRINT(vformat("glTF: Couldn't load image index '%d' with its given mimetype: %s.", i, mimetype));
p_state->images.push_back(Ref<Texture2D>());
+ p_state->source_images.push_back(Ref<Image>());
continue;
}
- p_state->images.push_back(ImageTexture::create_from_image(img));
+ img->set_name(image_name);
+ if (GLTFState::GLTFHandleBinary(p_state->handle_binary_image) == GLTFState::GLTFHandleBinary::HANDLE_BINARY_DISCARD_TEXTURES) {
+ p_state->images.push_back(Ref<Texture2D>());
+ p_state->source_images.push_back(Ref<Image>());
+ continue;
+ } else if (GLTFState::GLTFHandleBinary(p_state->handle_binary_image) == GLTFState::GLTFHandleBinary::HANDLE_BINARY_EXTRACT_TEXTURES) {
+ if (p_state->base_path.is_empty()) {
+ p_state->images.push_back(Ref<Texture2D>());
+ p_state->source_images.push_back(Ref<Image>());
+ } else if (img->get_name().is_empty()) {
+ WARN_PRINT(vformat("glTF: Image index '%d' couldn't be named. Skipping it.", i));
+ p_state->images.push_back(Ref<Texture2D>());
+ p_state->source_images.push_back(Ref<Image>());
+ } else {
+ String file_path = p_state->get_base_path() + "/" + p_state->filename.get_basename() + "_" + img->get_name() + ".png";
+ Ref<ConfigFile> config;
+ config.instantiate();
+ if (FileAccess::exists(file_path + ".import")) {
+ config->load(file_path + ".import");
+ }
+ config->set_value("remap", "importer", "texture");
+ config->set_value("remap", "type", "Texture2D");
+ if (!config->has_section_key("params", "compress/mode")) {
+ config->set_value("remap", "compress/mode", 2); //user may want another compression, so leave it bes
+ }
+ if (!config->has_section_key("params", "mipmaps/generate")) {
+ config->set_value("params", "mipmaps/generate", true);
+ }
+ Error err = OK;
+ err = config->save(file_path + ".import");
+ ERR_FAIL_COND_V(err != OK, err);
+ img->save_png(file_path);
+ ERR_FAIL_COND_V(err != OK, err);
+ ResourceLoader::import(file_path);
+ Ref<Texture2D> saved_image = ResourceLoader::load(file_path, "Texture2D");
+ if (saved_image.is_valid()) {
+ p_state->images.push_back(saved_image);
+ p_state->source_images.push_back(img);
+ } else {
+ WARN_PRINT(vformat("glTF: Image index '%d' couldn't be loaded with the name: %s. Skipping it.", i, img->get_name()));
+ // Placeholder to keep count.
+ p_state->images.push_back(Ref<Texture2D>());
+ p_state->source_images.push_back(Ref<Image>());
+ }
+ }
+ continue;
+ } else if (GLTFState::GLTFHandleBinary(p_state->handle_binary_image) == GLTFState::GLTFHandleBinary::HANDLE_BINARY_EMBED_AS_BASISU) {
+ Ref<PortableCompressedTexture2D> tex;
+ tex.instantiate();
+ tex->set_name(img->get_name());
+ tex->set_keep_compressed_buffer(true);
+ p_state->source_images.push_back(img);
+ tex->create_from_image(img, PortableCompressedTexture2D::COMPRESSION_MODE_BASIS_UNIVERSAL);
+ p_state->images.push_back(tex);
+ p_state->source_images.push_back(img);
+ continue;
+ }
+
+ p_state->images.push_back(Ref<Texture2D>());
+ p_state->source_images.push_back(Ref<Image>());
}
print_verbose("glTF: Total images: " + itos(p_state->images.size()));
@@ -3267,12 +3345,24 @@ GLTFTextureIndex GLTFDocument::_set_texture(Ref<GLTFState> p_state, Ref<Texture2
return gltf_texture_i;
}
-Ref<Texture2D> GLTFDocument::_get_texture(Ref<GLTFState> p_state, const GLTFTextureIndex p_texture) {
+Ref<Texture2D> GLTFDocument::_get_texture(Ref<GLTFState> p_state, const GLTFTextureIndex p_texture, int p_texture_types) {
ERR_FAIL_INDEX_V(p_texture, p_state->textures.size(), Ref<Texture2D>());
const GLTFImageIndex image = p_state->textures[p_texture]->get_src_image();
-
ERR_FAIL_INDEX_V(image, p_state->images.size(), Ref<Texture2D>());
-
+ if (GLTFState::GLTFHandleBinary(p_state->handle_binary_image) == GLTFState::GLTFHandleBinary::HANDLE_BINARY_EMBED_AS_BASISU) {
+ Ref<PortableCompressedTexture2D> portable_texture;
+ portable_texture.instantiate();
+ portable_texture->set_keep_compressed_buffer(true);
+ Ref<Image> new_img = p_state->source_images[p_texture]->duplicate();
+ ERR_FAIL_COND_V(new_img.is_null(), Ref<Texture2D>());
+ new_img->generate_mipmaps();
+ if (p_texture_types) {
+ portable_texture->create_from_image(new_img, PortableCompressedTexture2D::COMPRESSION_MODE_BASIS_UNIVERSAL, true);
+ } else {
+ portable_texture->create_from_image(new_img, PortableCompressedTexture2D::COMPRESSION_MODE_BASIS_UNIVERSAL, false);
+ }
+ p_state->images.write[image] = portable_texture;
+ }
return p_state->images[image];
}
@@ -3683,7 +3773,7 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
material->set_texture_filter(diffuse_sampler->get_filter_mode());
material->set_flag(BaseMaterial3D::FLAG_USE_TEXTURE_REPEAT, diffuse_sampler->get_wrap_mode());
}
- Ref<Texture2D> diffuse_texture = _get_texture(p_state, diffuse_texture_dict["index"]);
+ Ref<Texture2D> diffuse_texture = _get_texture(p_state, diffuse_texture_dict["index"], TEXTURE_TYPE_GENERIC);
if (diffuse_texture.is_valid()) {
spec_gloss->diffuse_img = diffuse_texture->get_image();
material->set_texture(BaseMaterial3D::TEXTURE_ALBEDO, diffuse_texture);
@@ -3711,7 +3801,7 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
if (sgm.has("specularGlossinessTexture")) {
const Dictionary &spec_gloss_texture = sgm["specularGlossinessTexture"];
if (spec_gloss_texture.has("index")) {
- const Ref<Texture2D> orig_texture = _get_texture(p_state, spec_gloss_texture["index"]);
+ const Ref<Texture2D> orig_texture = _get_texture(p_state, spec_gloss_texture["index"], TEXTURE_TYPE_GENERIC);
if (orig_texture.is_valid()) {
spec_gloss->spec_gloss_img = orig_texture->get_image();
}
@@ -3734,7 +3824,7 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
Ref<GLTFTextureSampler> bct_sampler = _get_sampler_for_texture(p_state, bct["index"]);
material->set_texture_filter(bct_sampler->get_filter_mode());
material->set_flag(BaseMaterial3D::FLAG_USE_TEXTURE_REPEAT, bct_sampler->get_wrap_mode());
- material->set_texture(BaseMaterial3D::TEXTURE_ALBEDO, _get_texture(p_state, bct["index"]));
+ material->set_texture(BaseMaterial3D::TEXTURE_ALBEDO, _get_texture(p_state, bct["index"], TEXTURE_TYPE_GENERIC));
}
if (!mr.has("baseColorFactor")) {
material->set_albedo(Color(1, 1, 1));
@@ -3757,7 +3847,7 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
if (mr.has("metallicRoughnessTexture")) {
const Dictionary &bct = mr["metallicRoughnessTexture"];
if (bct.has("index")) {
- const Ref<Texture2D> t = _get_texture(p_state, bct["index"]);
+ const Ref<Texture2D> t = _get_texture(p_state, bct["index"], TEXTURE_TYPE_GENERIC);
material->set_texture(BaseMaterial3D::TEXTURE_METALLIC, t);
material->set_metallic_texture_channel(BaseMaterial3D::TEXTURE_CHANNEL_BLUE);
material->set_texture(BaseMaterial3D::TEXTURE_ROUGHNESS, t);
@@ -3775,7 +3865,7 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
if (d.has("normalTexture")) {
const Dictionary &bct = d["normalTexture"];
if (bct.has("index")) {
- material->set_texture(BaseMaterial3D::TEXTURE_NORMAL, _get_texture(p_state, bct["index"]));
+ material->set_texture(BaseMaterial3D::TEXTURE_NORMAL, _get_texture(p_state, bct["index"], TEXTURE_TYPE_NORMAL));
material->set_feature(BaseMaterial3D::FEATURE_NORMAL_MAPPING, true);
}
if (bct.has("scale")) {
@@ -3785,7 +3875,7 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
if (d.has("occlusionTexture")) {
const Dictionary &bct = d["occlusionTexture"];
if (bct.has("index")) {
- material->set_texture(BaseMaterial3D::TEXTURE_AMBIENT_OCCLUSION, _get_texture(p_state, bct["index"]));
+ material->set_texture(BaseMaterial3D::TEXTURE_AMBIENT_OCCLUSION, _get_texture(p_state, bct["index"], TEXTURE_TYPE_GENERIC));
material->set_ao_texture_channel(BaseMaterial3D::TEXTURE_CHANNEL_RED);
material->set_feature(BaseMaterial3D::FEATURE_AMBIENT_OCCLUSION, true);
}
@@ -3803,7 +3893,7 @@ Error GLTFDocument::_parse_materials(Ref<GLTFState> p_state) {
if (d.has("emissiveTexture")) {
const Dictionary &bct = d["emissiveTexture"];
if (bct.has("index")) {
- material->set_texture(BaseMaterial3D::TEXTURE_EMISSION, _get_texture(p_state, bct["index"]));
+ material->set_texture(BaseMaterial3D::TEXTURE_EMISSION, _get_texture(p_state, bct["index"], TEXTURE_TYPE_GENERIC));
material->set_feature(BaseMaterial3D::FEATURE_EMISSION, true);
material->set_emission(Color(0, 0, 0));
}
@@ -4232,6 +4322,21 @@ Error GLTFDocument::_parse_skins(Ref<GLTFState> p_state) {
return OK;
}
+void GLTFDocument::_recurse_children(Ref<GLTFState> p_state, const GLTFNodeIndex p_node_index,
+ RBSet<GLTFNodeIndex> &p_all_skin_nodes, HashSet<GLTFNodeIndex> &p_child_visited_set) {
+ if (p_child_visited_set.has(p_node_index)) {
+ return;
+ }
+ p_child_visited_set.insert(p_node_index);
+ for (int i = 0; i < p_state->nodes[p_node_index]->children.size(); ++i) {
+ _recurse_children(p_state, p_state->nodes[p_node_index]->children[i], p_all_skin_nodes, p_child_visited_set);
+ }
+
+ if (p_state->nodes[p_node_index]->skin < 0 || p_state->nodes[p_node_index]->mesh < 0 || !p_state->nodes[p_node_index]->children.is_empty()) {
+ p_all_skin_nodes.insert(p_node_index);
+ }
+}
+
Error GLTFDocument::_determine_skeletons(Ref<GLTFState> p_state) {
// Using a disjoint set, we are going to potentially combine all skins that are actually branches
// of a main skeleton, or treat skins defining the same set of nodes as ONE skeleton.
@@ -4242,16 +4347,21 @@ Error GLTFDocument::_determine_skeletons(Ref<GLTFState> p_state) {
for (GLTFSkinIndex skin_i = 0; skin_i < p_state->skins.size(); ++skin_i) {
const Ref<GLTFSkin> skin = p_state->skins[skin_i];
- Vector<GLTFNodeIndex> all_skin_nodes;
- all_skin_nodes.append_array(skin->joints);
- all_skin_nodes.append_array(skin->non_joints);
-
- for (int i = 0; i < all_skin_nodes.size(); ++i) {
- const GLTFNodeIndex node_index = all_skin_nodes[i];
+ HashSet<GLTFNodeIndex> child_visited_set;
+ RBSet<GLTFNodeIndex> all_skin_nodes;
+ for (int i = 0; i < skin->joints.size(); ++i) {
+ all_skin_nodes.insert(skin->joints[i]);
+ _recurse_children(p_state, skin->joints[i], all_skin_nodes, child_visited_set);
+ }
+ for (int i = 0; i < skin->non_joints.size(); ++i) {
+ all_skin_nodes.insert(skin->non_joints[i]);
+ _recurse_children(p_state, skin->non_joints[i], all_skin_nodes, child_visited_set);
+ }
+ for (GLTFNodeIndex node_index : all_skin_nodes) {
const GLTFNodeIndex parent = p_state->nodes[node_index]->parent;
skeleton_sets.insert(node_index);
- if (all_skin_nodes.find(parent) >= 0) {
+ if (all_skin_nodes.has(parent)) {
skeleton_sets.create_union(parent, node_index);
}
}
@@ -4470,7 +4580,7 @@ Error GLTFDocument::_create_skeletons(Ref<GLTFState> p_state) {
p_state->skeleton3d_to_gltf_skeleton[skeleton->get_instance_id()] = skel_i;
// Make a unique name, no gltf node represents this skeleton
- skeleton->set_name(_gen_unique_name(p_state, "Skeleton3D"));
+ skeleton->set_name("Skeleton3D");
List<GLTFNodeIndex> bones;
@@ -5162,6 +5272,7 @@ ImporterMeshInstance3D *GLTFDocument::_generate_mesh_instance(Ref<GLTFState> p_s
ImporterMeshInstance3D *mi = memnew(ImporterMeshInstance3D);
print_verbose("glTF: Creating mesh for: " + gltf_node->get_name());
+ p_state->scene_mesh_instances.insert(p_node_index, mi);
Ref<GLTFMesh> mesh = p_state->meshes.write[gltf_node->mesh];
if (mesh.is_null()) {
return mi;
@@ -5602,7 +5713,7 @@ void GLTFDocument::_generate_scene_node(Ref<GLTFState> p_state, Node *scene_pare
bone_attachment->set_owner(scene_root);
// There is no gltf_node that represent this, so just directly create a unique name
- bone_attachment->set_name(_gen_unique_name(p_state, "BoneAttachment3D"));
+ bone_attachment->set_name(gltf_node->get_name());
// We change the scene_parent to our bone attachment now. We do not set current_node because we want to make the node
// and attach it to the bone_attachment
@@ -5618,7 +5729,13 @@ void GLTFDocument::_generate_scene_node(Ref<GLTFState> p_state, Node *scene_pare
}
// If none of our GLTFDocumentExtension classes generated us a node, we generate one.
if (!current_node) {
- if (gltf_node->mesh >= 0) {
+ if (gltf_node->skin >= 0 && gltf_node->mesh >= 0 && !gltf_node->children.is_empty()) {
+ current_node = _generate_spatial(p_state, node_index);
+ Node3D *mesh_inst = _generate_mesh_instance(p_state, node_index);
+ mesh_inst->set_name(gltf_node->get_name());
+
+ current_node->add_child(mesh_inst, true);
+ } else if (gltf_node->mesh >= 0) {
current_node = _generate_mesh_instance(p_state, node_index);
} else if (gltf_node->camera >= 0) {
current_node = _generate_camera(p_state, node_index);
@@ -5639,7 +5756,6 @@ void GLTFDocument::_generate_scene_node(Ref<GLTFState> p_state, Node *scene_pare
current_node->set_name(gltf_node->get_name());
p_state->scene_nodes.insert(node_index, current_node);
-
for (int i = 0; i < gltf_node->children.size(); ++i) {
_generate_scene_node(p_state, current_node, scene_root, gltf_node->children[i]);
}
@@ -5658,22 +5774,17 @@ void GLTFDocument::_generate_skeleton_bone_node(Ref<GLTFState> p_state, Node *p_
Skeleton3D *active_skeleton = Object::cast_to<Skeleton3D>(p_scene_parent);
if (active_skeleton != skeleton) {
if (active_skeleton) {
- // Bone Attachment - Direct Parented Skeleton Case
+ // Should no longer be possible.
+ ERR_PRINT(vformat("glTF: Generating scene detected direct parented Skeletons at node %d", p_node_index));
BoneAttachment3D *bone_attachment = _generate_bone_attachment(p_state, active_skeleton, p_node_index, gltf_node->parent);
-
p_scene_parent->add_child(bone_attachment, true);
bone_attachment->set_owner(p_scene_root);
-
// There is no gltf_node that represent this, so just directly create a unique name
bone_attachment->set_name(_gen_unique_name(p_state, "BoneAttachment3D"));
-
// We change the scene_parent to our bone attachment now. We do not set current_node because we want to make the node
// and attach it to the bone_attachment
p_scene_parent = bone_attachment;
- WARN_PRINT(vformat("glTF: Generating scene detected direct parented Skeletons at node %d", p_node_index));
}
-
- // Add it to the scene if it has not already been added
if (skeleton->get_parent() == nullptr) {
p_scene_parent->add_child(skeleton, true);
skeleton->set_owner(p_scene_root);
@@ -5681,9 +5792,10 @@ void GLTFDocument::_generate_skeleton_bone_node(Ref<GLTFState> p_state, Node *p_
}
active_skeleton = skeleton;
- current_node = skeleton;
+ current_node = active_skeleton;
if (requires_extra_node) {
+ current_node = nullptr;
// skinned meshes must not be placed in a bone attachment.
if (!is_skinned_mesh) {
// Bone Attachment - Same Node Case
@@ -5693,7 +5805,7 @@ void GLTFDocument::_generate_skeleton_bone_node(Ref<GLTFState> p_state, Node *p_
bone_attachment->set_owner(p_scene_root);
// There is no gltf_node that represent this, so just directly create a unique name
- bone_attachment->set_name(_gen_unique_name(p_state, "BoneAttachment3D"));
+ bone_attachment->set_name(gltf_node->get_name());
// We change the scene_parent to our bone attachment now. We do not set current_node because we want to make the node
// and attach it to the bone_attachment
@@ -5858,7 +5970,7 @@ T GLTFDocument::_interpolate_track(const Vector<real_t> &p_times, const Vector<T
ERR_FAIL_V(p_values[0]);
}
-void GLTFDocument::_import_animation(Ref<GLTFState> p_state, AnimationPlayer *p_animation_player, const GLTFAnimationIndex p_index, const float p_bake_fps, const bool p_trimming) {
+void GLTFDocument::_import_animation(Ref<GLTFState> p_state, AnimationPlayer *p_animation_player, const GLTFAnimationIndex p_index, const float p_bake_fps, const bool p_trimming, const bool p_remove_immutable_tracks) {
Ref<GLTFAnimation> anim = p_state->animations[p_index];
String anim_name = anim->get_name();
@@ -5884,6 +5996,8 @@ void GLTFDocument::_import_animation(Ref<GLTFState> p_state, AnimationPlayer *p_
NodePath node_path;
//for skeletons, transform tracks always affect bones
NodePath transform_node_path;
+ //for meshes, especially skinned meshes, there are cases where it will be added as a child
+ NodePath mesh_instance_node_path;
GLTFNodeIndex node_index = track_i.key;
@@ -5894,6 +6008,12 @@ void GLTFDocument::_import_animation(Ref<GLTFState> p_state, AnimationPlayer *p_
HashMap<GLTFNodeIndex, Node *>::Iterator node_element = p_state->scene_nodes.find(node_index);
ERR_CONTINUE_MSG(!node_element, vformat("Unable to find node %d for animation", node_index));
node_path = root->get_path_to(node_element->value);
+ HashMap<GLTFNodeIndex, ImporterMeshInstance3D *>::Iterator mesh_instance_element = p_state->scene_mesh_instances.find(node_index);
+ if (mesh_instance_element) {
+ mesh_instance_node_path = root->get_path_to(mesh_instance_element->value);
+ } else {
+ mesh_instance_node_path = node_path;
+ }
if (gltf_node->skeleton >= 0) {
const Skeleton3D *sk = p_state->skeletons[gltf_node->skeleton]->godot_skeleton;
@@ -5953,35 +6073,38 @@ void GLTFDocument::_import_animation(Ref<GLTFState> p_state, AnimationPlayer *p_
int scale_idx = -1;
if (track.position_track.values.size()) {
- Vector3 base_pos = p_state->nodes[track_i.key]->position;
- bool not_default = false; //discard the track if all it contains is default values
- for (int i = 0; i < track.position_track.times.size(); i++) {
- Vector3 value = track.position_track.values[track.position_track.interpolation == GLTFAnimation::INTERP_CUBIC_SPLINE ? (1 + i * 3) : i];
- if (!value.is_equal_approx(base_pos)) {
- not_default = true;
- break;
+ bool is_default = true; //discard the track if all it contains is default values
+ if (p_remove_immutable_tracks) {
+ Vector3 base_pos = p_state->nodes[track_i.key]->position;
+ for (int i = 0; i < track.position_track.times.size(); i++) {
+ Vector3 value = track.position_track.values[track.position_track.interpolation == GLTFAnimation::INTERP_CUBIC_SPLINE ? (1 + i * 3) : i];
+ if (!value.is_equal_approx(base_pos)) {
+ is_default = false;
+ break;
+ }
}
}
- if (not_default) {
+ if (!p_remove_immutable_tracks || !is_default) {
position_idx = base_idx;
animation->add_track(Animation::TYPE_POSITION_3D);
animation->track_set_path(position_idx, transform_node_path);
animation->track_set_imported(position_idx, true); //helps merging later
-
base_idx++;
}
}
if (track.rotation_track.values.size()) {
- Quaternion base_rot = p_state->nodes[track_i.key]->rotation.normalized();
- bool not_default = false; //discard the track if all it contains is default values
- for (int i = 0; i < track.rotation_track.times.size(); i++) {
- Quaternion value = track.rotation_track.values[track.rotation_track.interpolation == GLTFAnimation::INTERP_CUBIC_SPLINE ? (1 + i * 3) : i].normalized();
- if (!value.is_equal_approx(base_rot)) {
- not_default = true;
- break;
+ bool is_default = true; //discard the track if all it contains is default values
+ if (p_remove_immutable_tracks) {
+ Quaternion base_rot = p_state->nodes[track_i.key]->rotation.normalized();
+ for (int i = 0; i < track.rotation_track.times.size(); i++) {
+ Quaternion value = track.rotation_track.values[track.rotation_track.interpolation == GLTFAnimation::INTERP_CUBIC_SPLINE ? (1 + i * 3) : i].normalized();
+ if (!value.is_equal_approx(base_rot)) {
+ is_default = false;
+ break;
+ }
}
}
- if (not_default) {
+ if (!p_remove_immutable_tracks || !is_default) {
rotation_idx = base_idx;
animation->add_track(Animation::TYPE_ROTATION_3D);
animation->track_set_path(rotation_idx, transform_node_path);
@@ -5990,16 +6113,18 @@ void GLTFDocument::_import_animation(Ref<GLTFState> p_state, AnimationPlayer *p_
}
}
if (track.scale_track.values.size()) {
- Vector3 base_scale = p_state->nodes[track_i.key]->scale;
- bool not_default = false; //discard the track if all it contains is default values
- for (int i = 0; i < track.scale_track.times.size(); i++) {
- Vector3 value = track.scale_track.values[track.scale_track.interpolation == GLTFAnimation::INTERP_CUBIC_SPLINE ? (1 + i * 3) : i];
- if (!value.is_equal_approx(base_scale)) {
- not_default = true;
- break;
+ bool is_default = true; //discard the track if all it contains is default values
+ if (p_remove_immutable_tracks) {
+ Vector3 base_scale = p_state->nodes[track_i.key]->scale;
+ for (int i = 0; i < track.scale_track.times.size(); i++) {
+ Vector3 value = track.scale_track.values[track.scale_track.interpolation == GLTFAnimation::INTERP_CUBIC_SPLINE ? (1 + i * 3) : i];
+ if (!value.is_equal_approx(base_scale)) {
+ is_default = false;
+ break;
+ }
}
}
- if (not_default) {
+ if (!p_remove_immutable_tracks || !is_default) {
scale_idx = base_idx;
animation->add_track(Animation::TYPE_SCALE_3D);
animation->track_set_path(scale_idx, transform_node_path);
@@ -6066,11 +6191,12 @@ void GLTFDocument::_import_animation(Ref<GLTFState> p_state, AnimationPlayer *p_
ERR_CONTINUE(mesh->get_mesh().is_null());
ERR_CONTINUE(mesh->get_mesh()->get_mesh().is_null());
- const String blend_path = String(node_path) + ":" + String(mesh->get_mesh()->get_blend_shape_name(i));
+ const String blend_path = String(mesh_instance_node_path) + ":" + String(mesh->get_mesh()->get_blend_shape_name(i));
const int track_idx = animation->get_track_count();
animation->add_track(Animation::TYPE_BLEND_SHAPE);
animation->track_set_path(track_idx, blend_path);
+ animation->track_set_imported(track_idx, true); //helps merging later
// Only LINEAR and STEP (NEAREST) can be supported out of the box by Godot's Animation,
// the other modes have to be baked.
@@ -6256,11 +6382,16 @@ void GLTFDocument::_process_mesh_instances(Ref<GLTFState> p_state, Node *p_scene
if (node->skin >= 0 && node->mesh >= 0) {
const GLTFSkinIndex skin_i = node->skin;
- HashMap<GLTFNodeIndex, Node *>::Iterator mi_element = p_state->scene_nodes.find(node_i);
- ERR_CONTINUE_MSG(!mi_element, vformat("Unable to find node %d", node_i));
-
- ImporterMeshInstance3D *mi = Object::cast_to<ImporterMeshInstance3D>(mi_element->value);
- ERR_CONTINUE_MSG(mi == nullptr, vformat("Unable to cast node %d of type %s to ImporterMeshInstance3D", node_i, mi_element->value->get_class_name()));
+ ImporterMeshInstance3D *mi = nullptr;
+ HashMap<GLTFNodeIndex, ImporterMeshInstance3D *>::Iterator mi_element = p_state->scene_mesh_instances.find(node_i);
+ if (mi_element) {
+ mi = mi_element->value;
+ } else {
+ HashMap<GLTFNodeIndex, Node *>::Iterator si_element = p_state->scene_nodes.find(node_i);
+ ERR_CONTINUE_MSG(!si_element, vformat("Unable to find node %d", node_i));
+ mi = Object::cast_to<ImporterMeshInstance3D>(si_element->value);
+ ERR_CONTINUE_MSG(mi == nullptr, vformat("Unable to cast node %d of type %s to ImporterMeshInstance3D", node_i, si_element->value->get_class_name()));
+ }
const GLTFSkeletonIndex skel_i = p_state->skins.write[node->skin]->skeleton;
Ref<GLTFSkeleton> gltf_skeleton = p_state->skeletons.write[skel_i];
@@ -6778,8 +6909,8 @@ void GLTFDocument::_bind_methods() {
&GLTFDocument::append_from_buffer, DEFVAL(0));
ClassDB::bind_method(D_METHOD("append_from_scene", "node", "state", "flags"),
&GLTFDocument::append_from_scene, DEFVAL(0));
- ClassDB::bind_method(D_METHOD("generate_scene", "state", "bake_fps", "trimming"),
- &GLTFDocument::generate_scene, DEFVAL(30), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("generate_scene", "state", "bake_fps", "trimming", "remove_immutable_tracks"),
+ &GLTFDocument::generate_scene, DEFVAL(30), DEFVAL(false), DEFVAL(true));
ClassDB::bind_method(D_METHOD("generate_buffer", "state"),
&GLTFDocument::generate_buffer);
ClassDB::bind_method(D_METHOD("write_to_filesystem", "state", "path"),
@@ -6888,7 +7019,7 @@ Error GLTFDocument::write_to_filesystem(Ref<GLTFState> p_state, const String &p_
return OK;
}
-Node *GLTFDocument::generate_scene(Ref<GLTFState> p_state, float p_bake_fps, bool p_trimming) {
+Node *GLTFDocument::generate_scene(Ref<GLTFState> p_state, float p_bake_fps, bool p_trimming, bool p_remove_immutable_tracks) {
ERR_FAIL_NULL_V(p_state, nullptr);
ERR_FAIL_INDEX_V(0, p_state->root_nodes.size(), nullptr);
Error err = OK;
@@ -6902,7 +7033,7 @@ Node *GLTFDocument::generate_scene(Ref<GLTFState> p_state, float p_bake_fps, boo
root->add_child(ap, true);
ap->set_owner(root);
for (int i = 0; i < p_state->animations.size(); i++) {
- _import_animation(p_state, ap, i, p_bake_fps, p_trimming);
+ _import_animation(p_state, ap, i, p_bake_fps, p_trimming, p_remove_immutable_tracks);
}
}
for (KeyValue<GLTFNodeIndex, Node *> E : p_state->scene_nodes) {
diff --git a/modules/gltf/gltf_document.h b/modules/gltf/gltf_document.h
index 164c63c53c..b8b989bf89 100644
--- a/modules/gltf/gltf_document.h
+++ b/modules/gltf/gltf_document.h
@@ -64,6 +64,10 @@ public:
COMPONENT_TYPE_INT = 5125,
COMPONENT_TYPE_FLOAT = 5126,
};
+ enum {
+ TEXTURE_TYPE_GENERIC = 0,
+ TEXTURE_TYPE_NORMAL = 1,
+ };
protected:
static void _bind_methods();
@@ -92,7 +96,7 @@ private:
GLTFTextureIndex _set_texture(Ref<GLTFState> p_state, Ref<Texture2D> p_texture,
StandardMaterial3D::TextureFilter p_filter_mode, bool p_repeats);
Ref<Texture2D> _get_texture(Ref<GLTFState> p_state,
- const GLTFTextureIndex p_texture);
+ const GLTFTextureIndex p_texture, int p_texture_type);
GLTFTextureSamplerIndex _set_sampler_for_mode(Ref<GLTFState> p_state,
StandardMaterial3D::TextureFilter p_filter_mode, bool p_repeats);
Ref<GLTFTextureSampler> _get_sampler_for_texture(Ref<GLTFState> p_state,
@@ -160,6 +164,8 @@ private:
float &r_metallic);
GLTFNodeIndex _find_highest_node(Ref<GLTFState> p_state,
const Vector<GLTFNodeIndex> &p_subset);
+ void _recurse_children(Ref<GLTFState> p_state, const GLTFNodeIndex p_node_index,
+ RBSet<GLTFNodeIndex> &p_all_skin_nodes, HashSet<GLTFNodeIndex> &p_child_visited_set);
bool _capture_nodes_in_skin(Ref<GLTFState> p_state, Ref<GLTFSkin> p_skin,
const GLTFNodeIndex p_node_index);
void _capture_nodes_for_multirooted_skin(Ref<GLTFState> p_state, Ref<GLTFSkin> p_skin);
@@ -290,7 +296,7 @@ public:
Error append_from_scene(Node *p_node, Ref<GLTFState> r_state, uint32_t p_flags = 0);
public:
- Node *generate_scene(Ref<GLTFState> p_state, float p_bake_fps = 30.0f, bool p_trimming = false);
+ Node *generate_scene(Ref<GLTFState> p_state, float p_bake_fps = 30.0f, bool p_trimming = false, bool p_remove_immutable_tracks = true);
PackedByteArray generate_buffer(Ref<GLTFState> p_state);
Error write_to_filesystem(Ref<GLTFState> p_state, const String &p_path);
@@ -303,7 +309,7 @@ public:
const GLTFNodeIndex p_node_index);
void _generate_skeleton_bone_node(Ref<GLTFState> p_state, Node *p_scene_parent, Node3D *p_scene_root, const GLTFNodeIndex p_node_index);
void _import_animation(Ref<GLTFState> p_state, AnimationPlayer *p_animation_player,
- const GLTFAnimationIndex p_index, const float p_bake_fps, const bool p_trimming);
+ const GLTFAnimationIndex p_index, const float p_bake_fps, const bool p_trimming, const bool p_remove_immutable_tracks);
void _convert_mesh_instances(Ref<GLTFState> p_state);
GLTFCameraIndex _convert_camera(Ref<GLTFState> p_state, Camera3D *p_camera);
void _convert_light_to_gltf(Light3D *p_light, Ref<GLTFState> p_state, Ref<GLTFNode> p_gltf_node);
diff --git a/modules/gltf/gltf_state.cpp b/modules/gltf/gltf_state.cpp
index 252453dfc2..b67484fc8e 100644
--- a/modules/gltf/gltf_state.cpp
+++ b/modules/gltf/gltf_state.cpp
@@ -91,6 +91,8 @@ void GLTFState::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_scene_node", "idx"), &GLTFState::get_scene_node);
ClassDB::bind_method(D_METHOD("get_additional_data", "extension_name"), &GLTFState::get_additional_data);
ClassDB::bind_method(D_METHOD("set_additional_data", "extension_name", "additional_data"), &GLTFState::set_additional_data);
+ ClassDB::bind_method(D_METHOD("get_handle_binary_image"), &GLTFState::get_handle_binary_image);
+ ClassDB::bind_method(D_METHOD("set_handle_binary_image", "method"), &GLTFState::set_handle_binary_image);
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "json"), "set_json", "get_json"); // Dictionary
ADD_PROPERTY(PropertyInfo(Variant::INT, "major_version"), "set_major_version", "get_major_version"); // int
@@ -118,6 +120,11 @@ void GLTFState::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "skeleton_to_node", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_EDITOR), "set_skeleton_to_node", "get_skeleton_to_node"); // RBMap<GLTFSkeletonIndex,
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "create_animations"), "set_create_animations", "get_create_animations"); // bool
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "animations", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_EDITOR), "set_animations", "get_animations"); // Vector<Ref<GLTFAnimation>>
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "handle_binary_image", PROPERTY_HINT_ENUM, "Discard All Textures,Extract Textures,Embed As Basis Universal", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_EDITOR), "set_handle_binary_image", "get_handle_binary_image"); // enum
+
+ BIND_CONSTANT(HANDLE_BINARY_DISCARD_TEXTURES);
+ BIND_CONSTANT(HANDLE_BINARY_EXTRACT_TEXTURES);
+ BIND_CONSTANT(HANDLE_BINARY_EMBED_AS_BASISU);
}
void GLTFState::add_used_extension(const String &p_extension_name, bool p_required) {
diff --git a/modules/gltf/gltf_state.h b/modules/gltf/gltf_state.h
index 488ad038aa..52d7949d03 100644
--- a/modules/gltf/gltf_state.h
+++ b/modules/gltf/gltf_state.h
@@ -59,6 +59,8 @@ class GLTFState : public Resource {
bool discard_meshes_and_materials = false;
bool create_animations = true;
+ int handle_binary_image = HANDLE_BINARY_EXTRACT_TEXTURES;
+
Vector<Ref<GLTFNode>> nodes;
Vector<Vector<uint8_t>> buffers;
Vector<Ref<GLTFBufferView>> buffer_views;
@@ -78,6 +80,7 @@ class GLTFState : public Resource {
Vector<Ref<Texture2D>> images;
Vector<String> extensions_used;
Vector<String> extensions_required;
+ Vector<Ref<Image>> source_images;
Vector<Ref<GLTFSkin>> skins;
Vector<Ref<GLTFCamera>> cameras;
@@ -89,6 +92,7 @@ class GLTFState : public Resource {
HashMap<GLTFSkeletonIndex, GLTFNodeIndex> skeleton_to_node;
Vector<Ref<GLTFAnimation>> animations;
HashMap<GLTFNodeIndex, Node *> scene_nodes;
+ HashMap<GLTFNodeIndex, ImporterMeshInstance3D *> scene_mesh_instances;
HashMap<ObjectID, GLTFSkeletonIndex> skeleton3d_to_gltf_skeleton;
HashMap<ObjectID, HashMap<ObjectID, GLTFSkinIndex>> skin_and_skeleton3d_to_gltf_skin;
@@ -100,6 +104,18 @@ protected:
public:
void add_used_extension(const String &p_extension, bool p_required = false);
+ enum GLTFHandleBinary {
+ HANDLE_BINARY_DISCARD_TEXTURES = 0,
+ HANDLE_BINARY_EXTRACT_TEXTURES,
+ HANDLE_BINARY_EMBED_AS_BASISU,
+ };
+ int32_t get_handle_binary_image() {
+ return handle_binary_image;
+ }
+ void set_handle_binary_image(int32_t p_handle_binary_image) {
+ handle_binary_image = p_handle_binary_image;
+ }
+
Dictionary get_json();
void set_json(Dictionary p_json);
@@ -115,6 +131,15 @@ public:
bool get_use_named_skin_binds();
void set_use_named_skin_binds(bool p_use_named_skin_binds);
+ bool get_discard_textures();
+ void set_discard_textures(bool p_discard_textures);
+
+ bool get_embed_as_basisu();
+ void set_embed_as_basisu(bool p_embed_as_basisu);
+
+ bool get_extract_textures();
+ void set_extract_textures(bool p_extract_textures);
+
bool get_discard_meshes_and_materials();
void set_discard_meshes_and_materials(bool p_discard_meshes_and_materials);
@@ -182,6 +207,7 @@ public:
void set_animations(TypedArray<GLTFAnimation> p_animations);
Node *get_scene_node(GLTFNodeIndex idx);
+ ImporterMeshInstance3D *get_scene_mesh_instance(GLTFNodeIndex idx);
int get_animation_players_count(int idx);
diff --git a/modules/mbedtls/dtls_server_mbedtls.cpp b/modules/mbedtls/dtls_server_mbedtls.cpp
index c54ab8ef6e..62513929ea 100644
--- a/modules/mbedtls/dtls_server_mbedtls.cpp
+++ b/modules/mbedtls/dtls_server_mbedtls.cpp
@@ -31,25 +31,25 @@
#include "dtls_server_mbedtls.h"
#include "packet_peer_mbed_dtls.h"
-Error DTLSServerMbedTLS::setup(Ref<CryptoKey> p_key, Ref<X509Certificate> p_cert, Ref<X509Certificate> p_ca_chain) {
- ERR_FAIL_COND_V(_cookies->setup() != OK, ERR_ALREADY_IN_USE);
- _key = p_key;
- _cert = p_cert;
- _ca_chain = p_ca_chain;
+Error DTLSServerMbedTLS::setup(Ref<TLSOptions> p_options) {
+ ERR_FAIL_COND_V(p_options.is_null() || !p_options->is_server(), ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(cookies->setup() != OK, ERR_ALREADY_IN_USE);
+ tls_options = p_options;
return OK;
}
void DTLSServerMbedTLS::stop() {
- _cookies->clear();
+ cookies->clear();
}
Ref<PacketPeerDTLS> DTLSServerMbedTLS::take_connection(Ref<PacketPeerUDP> p_udp_peer) {
Ref<PacketPeerMbedDTLS> out;
- out.instantiate();
- ERR_FAIL_COND_V(!out.is_valid(), out);
+ ERR_FAIL_COND_V(tls_options.is_null(), out);
ERR_FAIL_COND_V(!p_udp_peer.is_valid(), out);
- out->accept_peer(p_udp_peer, _key, _cert, _ca_chain, _cookies);
+
+ out.instantiate();
+ out->accept_peer(p_udp_peer, tls_options, cookies);
return out;
}
@@ -68,7 +68,7 @@ void DTLSServerMbedTLS::finalize() {
}
DTLSServerMbedTLS::DTLSServerMbedTLS() {
- _cookies.instantiate();
+ cookies.instantiate();
}
DTLSServerMbedTLS::~DTLSServerMbedTLS() {
diff --git a/modules/mbedtls/dtls_server_mbedtls.h b/modules/mbedtls/dtls_server_mbedtls.h
index e4612d01ef..d5841a45fa 100644
--- a/modules/mbedtls/dtls_server_mbedtls.h
+++ b/modules/mbedtls/dtls_server_mbedtls.h
@@ -37,16 +37,14 @@
class DTLSServerMbedTLS : public DTLSServer {
private:
static DTLSServer *_create_func();
- Ref<CryptoKey> _key;
- Ref<X509Certificate> _cert;
- Ref<X509Certificate> _ca_chain;
- Ref<CookieContextMbedTLS> _cookies;
+ Ref<TLSOptions> tls_options;
+ Ref<CookieContextMbedTLS> cookies;
public:
static void initialize();
static void finalize();
- virtual Error setup(Ref<CryptoKey> p_key, Ref<X509Certificate> p_cert, Ref<X509Certificate> p_ca_chain = Ref<X509Certificate>());
+ virtual Error setup(Ref<TLSOptions> p_options);
virtual void stop();
virtual Ref<PacketPeerDTLS> take_connection(Ref<PacketPeerUDP> p_peer);
diff --git a/modules/mbedtls/packet_peer_mbed_dtls.cpp b/modules/mbedtls/packet_peer_mbed_dtls.cpp
index 16450e151e..e8eb32f88d 100644
--- a/modules/mbedtls/packet_peer_mbed_dtls.cpp
+++ b/modules/mbedtls/packet_peer_mbed_dtls.cpp
@@ -114,16 +114,14 @@ Error PacketPeerMbedDTLS::_do_handshake() {
return OK;
}
-Error PacketPeerMbedDTLS::connect_to_peer(Ref<PacketPeerUDP> p_base, bool p_validate_certs, const String &p_for_hostname, Ref<X509Certificate> p_ca_certs) {
+Error PacketPeerMbedDTLS::connect_to_peer(Ref<PacketPeerUDP> p_base, const String &p_hostname, Ref<TLSOptions> p_options) {
ERR_FAIL_COND_V(!p_base.is_valid() || !p_base->is_socket_connected(), ERR_INVALID_PARAMETER);
- base = p_base;
- int authmode = p_validate_certs ? MBEDTLS_SSL_VERIFY_REQUIRED : MBEDTLS_SSL_VERIFY_NONE;
-
- Error err = tls_ctx->init_client(MBEDTLS_SSL_TRANSPORT_DATAGRAM, authmode, p_ca_certs);
+ Error err = tls_ctx->init_client(MBEDTLS_SSL_TRANSPORT_DATAGRAM, p_hostname, p_options.is_valid() ? p_options : TLSOptions::client());
ERR_FAIL_COND_V(err != OK, err);
- mbedtls_ssl_set_hostname(tls_ctx->get_context(), p_for_hostname.utf8().get_data());
+ base = p_base;
+
mbedtls_ssl_set_bio(tls_ctx->get_context(), this, bio_send, bio_recv, nullptr);
mbedtls_ssl_set_timer_cb(tls_ctx->get_context(), &timer, mbedtls_timing_set_delay, mbedtls_timing_get_delay);
@@ -137,8 +135,10 @@ Error PacketPeerMbedDTLS::connect_to_peer(Ref<PacketPeerUDP> p_base, bool p_vali
return OK;
}
-Error PacketPeerMbedDTLS::accept_peer(Ref<PacketPeerUDP> p_base, Ref<CryptoKey> p_key, Ref<X509Certificate> p_cert, Ref<X509Certificate> p_ca_chain, Ref<CookieContextMbedTLS> p_cookies) {
- Error err = tls_ctx->init_server(MBEDTLS_SSL_TRANSPORT_DATAGRAM, MBEDTLS_SSL_VERIFY_NONE, p_key, p_cert, p_cookies);
+Error PacketPeerMbedDTLS::accept_peer(Ref<PacketPeerUDP> p_base, Ref<TLSOptions> p_options, Ref<CookieContextMbedTLS> p_cookies) {
+ ERR_FAIL_COND_V(!p_base.is_valid() || !p_base->is_socket_connected(), ERR_INVALID_PARAMETER);
+
+ Error err = tls_ctx->init_server(MBEDTLS_SSL_TRANSPORT_DATAGRAM, p_options, p_cookies);
ERR_FAIL_COND_V(err != OK, err);
base = p_base;
diff --git a/modules/mbedtls/packet_peer_mbed_dtls.h b/modules/mbedtls/packet_peer_mbed_dtls.h
index 744ef81524..05decec783 100644
--- a/modules/mbedtls/packet_peer_mbed_dtls.h
+++ b/modules/mbedtls/packet_peer_mbed_dtls.h
@@ -64,8 +64,8 @@ protected:
public:
virtual void poll();
- virtual Error accept_peer(Ref<PacketPeerUDP> p_base, Ref<CryptoKey> p_key, Ref<X509Certificate> p_cert = Ref<X509Certificate>(), Ref<X509Certificate> p_ca_chain = Ref<X509Certificate>(), Ref<CookieContextMbedTLS> p_cookies = Ref<CookieContextMbedTLS>());
- virtual Error connect_to_peer(Ref<PacketPeerUDP> p_base, bool p_validate_certs = true, const String &p_for_hostname = String(), Ref<X509Certificate> p_ca_certs = Ref<X509Certificate>());
+ virtual Error accept_peer(Ref<PacketPeerUDP> p_base, Ref<TLSOptions> p_options, Ref<CookieContextMbedTLS> p_cookies = Ref<CookieContextMbedTLS>());
+ virtual Error connect_to_peer(Ref<PacketPeerUDP> p_base, const String &p_hostname, Ref<TLSOptions> p_options = Ref<TLSOptions>());
virtual Status get_status() const;
virtual void disconnect_from_peer();
diff --git a/modules/mbedtls/stream_peer_mbedtls.cpp b/modules/mbedtls/stream_peer_mbedtls.cpp
index 1d17fb9441..a9d187bd64 100644
--- a/modules/mbedtls/stream_peer_mbedtls.cpp
+++ b/modules/mbedtls/stream_peer_mbedtls.cpp
@@ -80,38 +80,30 @@ void StreamPeerMbedTLS::_cleanup() {
}
Error StreamPeerMbedTLS::_do_handshake() {
- int ret = 0;
- while ((ret = mbedtls_ssl_handshake(tls_ctx->get_context())) != 0) {
- if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
- // An error occurred.
- ERR_PRINT("TLS handshake error: " + itos(ret));
- TLSContextMbedTLS::print_mbedtls_error(ret);
- disconnect_from_stream();
- status = STATUS_ERROR;
- return FAILED;
- }
-
- // Handshake is still in progress.
- if (!blocking_handshake) {
- // Will retry via poll later
- return OK;
- }
+ int ret = mbedtls_ssl_handshake(tls_ctx->get_context());
+ if (ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE) {
+ // Handshake is still in progress, will retry via poll later.
+ return OK;
+ } else if (ret != 0) {
+ // An error occurred.
+ ERR_PRINT("TLS handshake error: " + itos(ret));
+ TLSContextMbedTLS::print_mbedtls_error(ret);
+ disconnect_from_stream();
+ status = STATUS_ERROR;
+ return FAILED;
}
status = STATUS_CONNECTED;
return OK;
}
-Error StreamPeerMbedTLS::connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs, const String &p_for_hostname, Ref<X509Certificate> p_ca_certs) {
+Error StreamPeerMbedTLS::connect_to_stream(Ref<StreamPeer> p_base, const String &p_common_name, Ref<TLSOptions> p_options) {
ERR_FAIL_COND_V(p_base.is_null(), ERR_INVALID_PARAMETER);
- base = p_base;
- int authmode = p_validate_certs ? MBEDTLS_SSL_VERIFY_REQUIRED : MBEDTLS_SSL_VERIFY_NONE;
-
- Error err = tls_ctx->init_client(MBEDTLS_SSL_TRANSPORT_STREAM, authmode, p_ca_certs);
+ Error err = tls_ctx->init_client(MBEDTLS_SSL_TRANSPORT_STREAM, p_common_name, p_options.is_valid() ? p_options : TLSOptions::client());
ERR_FAIL_COND_V(err != OK, err);
- mbedtls_ssl_set_hostname(tls_ctx->get_context(), p_for_hostname.utf8().get_data());
+ base = p_base;
mbedtls_ssl_set_bio(tls_ctx->get_context(), this, bio_send, bio_recv, nullptr);
status = STATUS_HANDSHAKING;
@@ -124,10 +116,11 @@ Error StreamPeerMbedTLS::connect_to_stream(Ref<StreamPeer> p_base, bool p_valida
return OK;
}
-Error StreamPeerMbedTLS::accept_stream(Ref<StreamPeer> p_base, Ref<CryptoKey> p_key, Ref<X509Certificate> p_cert, Ref<X509Certificate> p_ca_chain) {
+Error StreamPeerMbedTLS::accept_stream(Ref<StreamPeer> p_base, Ref<TLSOptions> p_options) {
ERR_FAIL_COND_V(p_base.is_null(), ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_options.is_null() || !p_options->is_server(), ERR_INVALID_PARAMETER);
- Error err = tls_ctx->init_server(MBEDTLS_SSL_TRANSPORT_STREAM, MBEDTLS_SSL_VERIFY_NONE, p_key, p_cert);
+ Error err = tls_ctx->init_server(MBEDTLS_SSL_TRANSPORT_STREAM, p_options);
ERR_FAIL_COND_V(err != OK, err);
base = p_base;
@@ -308,10 +301,8 @@ StreamPeerTLS *StreamPeerMbedTLS::_create_func() {
void StreamPeerMbedTLS::initialize_tls() {
_create = _create_func;
- available = true;
}
void StreamPeerMbedTLS::finalize_tls() {
- available = false;
_create = nullptr;
}
diff --git a/modules/mbedtls/stream_peer_mbedtls.h b/modules/mbedtls/stream_peer_mbedtls.h
index 8a36a7ea9a..ec0446c380 100644
--- a/modules/mbedtls/stream_peer_mbedtls.h
+++ b/modules/mbedtls/stream_peer_mbedtls.h
@@ -54,8 +54,8 @@ protected:
public:
virtual void poll();
- virtual Error accept_stream(Ref<StreamPeer> p_base, Ref<CryptoKey> p_key, Ref<X509Certificate> p_cert, Ref<X509Certificate> p_ca_chain = Ref<X509Certificate>());
- virtual Error connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs = false, const String &p_for_hostname = String(), Ref<X509Certificate> p_valid_cert = Ref<X509Certificate>());
+ virtual Error accept_stream(Ref<StreamPeer> p_base, Ref<TLSOptions> p_options);
+ virtual Error connect_to_stream(Ref<StreamPeer> p_base, const String &p_common_name, Ref<TLSOptions> p_options);
virtual Status get_status() const;
virtual Ref<StreamPeer> get_stream() const;
diff --git a/modules/mbedtls/tls_context_mbedtls.cpp b/modules/mbedtls/tls_context_mbedtls.cpp
index a01137f262..aab082f488 100644
--- a/modules/mbedtls/tls_context_mbedtls.cpp
+++ b/modules/mbedtls/tls_context_mbedtls.cpp
@@ -110,22 +110,20 @@ Error TLSContextMbedTLS::_setup(int p_endpoint, int p_transport, int p_authmode)
return OK;
}
-Error TLSContextMbedTLS::init_server(int p_transport, int p_authmode, Ref<CryptoKeyMbedTLS> p_pkey, Ref<X509CertificateMbedTLS> p_cert, Ref<CookieContextMbedTLS> p_cookies) {
- ERR_FAIL_COND_V(!p_pkey.is_valid(), ERR_INVALID_PARAMETER);
- ERR_FAIL_COND_V(!p_cert.is_valid(), ERR_INVALID_PARAMETER);
+Error TLSContextMbedTLS::init_server(int p_transport, Ref<TLSOptions> p_options, Ref<CookieContextMbedTLS> p_cookies) {
+ ERR_FAIL_COND_V(p_options.is_null() || !p_options->is_server(), ERR_INVALID_PARAMETER);
- Error err = _setup(MBEDTLS_SSL_IS_SERVER, p_transport, p_authmode);
+ // Check key and certificate(s)
+ pkey = p_options->get_private_key();
+ certs = p_options->get_own_certificate();
+ ERR_FAIL_COND_V(pkey.is_null() || certs.is_null(), ERR_INVALID_PARAMETER);
+
+ Error err = _setup(MBEDTLS_SSL_IS_SERVER, p_transport, MBEDTLS_SSL_VERIFY_NONE); // TODO client auth.
ERR_FAIL_COND_V(err != OK, err);
// Locking key and certificate(s)
- pkey = p_pkey;
- certs = p_cert;
- if (pkey.is_valid()) {
- pkey->lock();
- }
- if (certs.is_valid()) {
- certs->lock();
- }
+ pkey->lock();
+ certs->lock();
// Adding key and certificate
int ret = mbedtls_ssl_conf_own_cert(&conf, &(certs->cert), &(pkey->pkey));
@@ -150,15 +148,32 @@ Error TLSContextMbedTLS::init_server(int p_transport, int p_authmode, Ref<Crypto
return OK;
}
-Error TLSContextMbedTLS::init_client(int p_transport, int p_authmode, Ref<X509CertificateMbedTLS> p_valid_cas) {
- Error err = _setup(MBEDTLS_SSL_IS_CLIENT, p_transport, p_authmode);
+Error TLSContextMbedTLS::init_client(int p_transport, const String &p_hostname, Ref<TLSOptions> p_options) {
+ ERR_FAIL_COND_V(p_options.is_null() || p_options->is_server(), ERR_INVALID_PARAMETER);
+
+ int authmode = MBEDTLS_SSL_VERIFY_REQUIRED;
+ if (p_options->get_verify_mode() == TLSOptions::TLS_VERIFY_NONE) {
+ authmode = MBEDTLS_SSL_VERIFY_NONE;
+ }
+
+ Error err = _setup(MBEDTLS_SSL_IS_CLIENT, p_transport, authmode);
ERR_FAIL_COND_V(err != OK, err);
+ if (p_options->get_verify_mode() == TLSOptions::TLS_VERIFY_FULL) {
+ String cn = p_options->get_common_name();
+ if (cn.is_empty()) {
+ cn = p_hostname;
+ }
+ mbedtls_ssl_set_hostname(&tls, cn.utf8().get_data());
+ } else {
+ mbedtls_ssl_set_hostname(&tls, nullptr);
+ }
+
X509CertificateMbedTLS *cas = nullptr;
- if (p_valid_cas.is_valid()) {
+ if (p_options->get_trusted_ca_chain().is_valid()) {
// Locking CA certificates
- certs = p_valid_cas;
+ certs = p_options->get_trusted_ca_chain();
certs->lock();
cas = certs.ptr();
} else {
diff --git a/modules/mbedtls/tls_context_mbedtls.h b/modules/mbedtls/tls_context_mbedtls.h
index 574e80e199..f1bad6a40c 100644
--- a/modules/mbedtls/tls_context_mbedtls.h
+++ b/modules/mbedtls/tls_context_mbedtls.h
@@ -71,17 +71,17 @@ public:
static void print_mbedtls_error(int p_ret);
Ref<X509CertificateMbedTLS> certs;
+ Ref<CryptoKeyMbedTLS> pkey;
+ Ref<CookieContextMbedTLS> cookies;
+
mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_ssl_context tls;
mbedtls_ssl_config conf;
- Ref<CookieContextMbedTLS> cookies;
- Ref<CryptoKeyMbedTLS> pkey;
-
Error _setup(int p_endpoint, int p_transport, int p_authmode);
- Error init_server(int p_transport, int p_authmode, Ref<CryptoKeyMbedTLS> p_pkey, Ref<X509CertificateMbedTLS> p_cert, Ref<CookieContextMbedTLS> p_cookies = Ref<CookieContextMbedTLS>());
- Error init_client(int p_transport, int p_authmode, Ref<X509CertificateMbedTLS> p_valid_cas);
+ Error init_server(int p_transport, Ref<TLSOptions> p_options, Ref<CookieContextMbedTLS> p_cookies = Ref<CookieContextMbedTLS>());
+ Error init_client(int p_transport, const String &p_hostname, Ref<TLSOptions> p_options);
void clear();
mbedtls_ssl_context *get_context();
diff --git a/modules/minimp3/doc_classes/AudioStreamMP3.xml b/modules/minimp3/doc_classes/AudioStreamMP3.xml
index 8f03681c06..a88ff23b6b 100644
--- a/modules/minimp3/doc_classes/AudioStreamMP3.xml
+++ b/modules/minimp3/doc_classes/AudioStreamMP3.xml
@@ -21,21 +21,17 @@
[codeblocks]
[gdscript]
func load_mp3(path):
- var file = File.new()
- file.open(path, File.READ)
+ var file = FileAccess.open(path, FileAccess.READ)
var sound = AudioStreamMP3.new()
sound.data = file.get_buffer(file.get_length())
- file.close()
return sound
[/gdscript]
[csharp]
public AudioStreamMP3 LoadMP3(string path)
{
- var file = new File();
- file.Open(path, File.READ);
+ using var file = FileAccess.Open(path, FileAccess.ModeFlags.Read);
var sound = new AudioStreamMP3();
sound.Data = file.GetBuffer(file.GetLength());
- file.Close();
return sound;
}
[/csharp]
diff --git a/modules/minimp3/resource_importer_mp3.cpp b/modules/minimp3/resource_importer_mp3.cpp
index 6a04e40c73..4e56120ec6 100644
--- a/modules/minimp3/resource_importer_mp3.cpp
+++ b/modules/minimp3/resource_importer_mp3.cpp
@@ -71,7 +71,7 @@ String ResourceImporterMP3::get_preset_name(int p_idx) const {
}
void ResourceImporterMP3::get_import_options(const String &p_path, List<ImportOption> *r_options, int p_preset) const {
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "loop"), true));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "loop"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "loop_offset"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "bpm", PROPERTY_HINT_RANGE, "0,400,0.01,or_greater"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "beat_count", PROPERTY_HINT_RANGE, "0,512,or_greater"), 0));
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 7606465b8a..fe0f4aae81 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -60,6 +60,7 @@
#include "mono_gd/gd_mono_cache.h"
#include "signal_awaiter_utils.h"
#include "utils/macros.h"
+#include "utils/naming_utils.h"
#include "utils/string_utils.h"
#define CACHED_STRING_NAME(m_var) (CSharpLanguage::get_singleton()->get_string_names().m_var)
@@ -333,7 +334,7 @@ void CSharpLanguage::get_string_delimiters(List<String> *p_delimiters) const {
}
static String get_base_class_name(const String &p_base_class_name, const String p_class_name) {
- String base_class = p_base_class_name;
+ String base_class = pascal_to_pascal_case(p_base_class_name);
if (p_class_name == base_class) {
base_class = "Godot." + base_class;
}
@@ -394,17 +395,22 @@ bool CSharpLanguage::supports_builtin_mode() const {
}
#ifdef TOOLS_ENABLED
+struct VariantCsName {
+ Variant::Type variant_type;
+ const String cs_type;
+};
+
static String variant_type_to_managed_name(const String &p_var_type_name) {
if (p_var_type_name.is_empty()) {
return "Variant";
}
if (ClassDB::class_exists(p_var_type_name)) {
- return p_var_type_name;
+ return pascal_to_pascal_case(p_var_type_name);
}
if (p_var_type_name == Variant::get_type_name(Variant::OBJECT)) {
- return "Godot.Object";
+ return "GodotObject";
}
if (p_var_type_name == Variant::get_type_name(Variant::INT)) {
@@ -459,34 +465,34 @@ static String variant_type_to_managed_name(const String &p_var_type_name) {
return "Signal";
}
- Variant::Type var_types[] = {
- Variant::BOOL,
- Variant::INT,
- Variant::VECTOR2,
- Variant::VECTOR2I,
- Variant::RECT2,
- Variant::RECT2I,
- Variant::VECTOR3,
- Variant::VECTOR3I,
- Variant::TRANSFORM2D,
- Variant::VECTOR4,
- Variant::VECTOR4I,
- Variant::PLANE,
- Variant::QUATERNION,
- Variant::AABB,
- Variant::BASIS,
- Variant::TRANSFORM3D,
- Variant::PROJECTION,
- Variant::COLOR,
- Variant::STRING_NAME,
- Variant::NODE_PATH,
- Variant::RID,
- Variant::CALLABLE
+ const VariantCsName var_types[] = {
+ { Variant::BOOL, "bool" },
+ { Variant::INT, "long" },
+ { Variant::VECTOR2, "Vector2" },
+ { Variant::VECTOR2I, "Vector2I" },
+ { Variant::RECT2, "Rect2" },
+ { Variant::RECT2I, "Rect2I" },
+ { Variant::VECTOR3, "Vector3" },
+ { Variant::VECTOR3I, "Vector3I" },
+ { Variant::TRANSFORM2D, "Transform2D" },
+ { Variant::VECTOR4, "Vector4" },
+ { Variant::VECTOR4I, "Vector4I" },
+ { Variant::PLANE, "Plane" },
+ { Variant::QUATERNION, "Quaternion" },
+ { Variant::AABB, "Aabb" },
+ { Variant::BASIS, "Basis" },
+ { Variant::TRANSFORM3D, "Transform3D" },
+ { Variant::PROJECTION, "Projection" },
+ { Variant::COLOR, "Color" },
+ { Variant::STRING_NAME, "StringName" },
+ { Variant::NODE_PATH, "NodePath" },
+ { Variant::RID, "Rid" },
+ { Variant::CALLABLE, "Callable" },
};
- for (unsigned int i = 0; i < sizeof(var_types) / sizeof(Variant::Type); i++) {
- if (p_var_type_name == Variant::get_type_name(var_types[i])) {
- return p_var_type_name;
+ for (unsigned int i = 0; i < sizeof(var_types) / sizeof(VariantCsName); i++) {
+ if (p_var_type_name == Variant::get_type_name(var_types[i].variant_type)) {
+ return var_types[i].cs_type;
}
}
@@ -2606,6 +2612,10 @@ Ref<Script> CSharpScript::get_base_script() const {
return base_script;
}
+StringName CSharpScript::get_global_name() const {
+ return StringName();
+}
+
void CSharpScript::get_script_property_list(List<PropertyInfo> *r_list) const {
#ifdef TOOLS_ENABLED
const CSharpScript *top = this;
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index ef381fd76a..6021555255 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -186,6 +186,8 @@ public:
bool inherits_script(const Ref<Script> &p_script) const override;
Ref<Script> get_base_script() const override;
+ StringName get_global_name() const override;
+
ScriptLanguage *get_language() const override;
void get_script_method_list(List<MethodInfo> *p_list) const override;
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Bar.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Bar.cs
index 5eaebc4474..2d797e2f46 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Bar.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Bar.cs
@@ -1,6 +1,6 @@
namespace Godot.SourceGenerators.Sample
{
- partial class Bar : Godot.Object
+ partial class Bar : GodotObject
{
}
@@ -9,7 +9,7 @@ namespace Godot.SourceGenerators.Sample
{
}
- partial class NotSameNameAsFile : Godot.Object
+ partial class NotSameNameAsFile : GodotObject
{
}
}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/EventSignals.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/EventSignals.cs
index 764ba8f121..ee6aa857fc 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/EventSignals.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/EventSignals.cs
@@ -1,6 +1,6 @@
namespace Godot.SourceGenerators.Sample;
-public partial class EventSignals : Godot.Object
+public partial class EventSignals : GodotObject
{
[Signal]
public delegate void MySignalEventHandler(string str, int num);
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedFields.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedFields.cs
index ccaba4d727..31e66ac306 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedFields.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedFields.cs
@@ -11,7 +11,7 @@ namespace Godot.SourceGenerators.Sample
[SuppressMessage("ReSharper", "RedundantNameQualifier")]
[SuppressMessage("ReSharper", "ArrangeObjectCreationWhenTypeEvident")]
[SuppressMessage("ReSharper", "InconsistentNaming")]
- public partial class ExportedFields : Godot.Object
+ public partial class ExportedFields : GodotObject
{
[Export] private Boolean field_Boolean = true;
[Export] private Char field_Char = 'f';
@@ -29,19 +29,19 @@ namespace Godot.SourceGenerators.Sample
// Godot structs
[Export] private Vector2 field_Vector2 = new(10f, 10f);
- [Export] private Vector2i field_Vector2i = Vector2i.Up;
+ [Export] private Vector2I field_Vector2I = Vector2I.Up;
[Export] private Rect2 field_Rect2 = new(new Vector2(10f, 10f), new Vector2(10f, 10f));
- [Export] private Rect2i field_Rect2i = new(new Vector2i(10, 10), new Vector2i(10, 10));
+ [Export] private Rect2I field_Rect2I = new(new Vector2I(10, 10), new Vector2I(10, 10));
[Export] private Transform2D field_Transform2D = Transform2D.Identity;
[Export] private Vector3 field_Vector3 = new(10f, 10f, 10f);
- [Export] private Vector3i field_Vector3i = Vector3i.Back;
+ [Export] private Vector3I field_Vector3I = Vector3I.Back;
[Export] private Basis field_Basis = new Basis(Quaternion.Identity);
[Export] private Quaternion field_Quaternion = new Quaternion(Basis.Identity);
[Export] private Transform3D field_Transform3D = Transform3D.Identity;
[Export] private Vector4 field_Vector4 = new(10f, 10f, 10f, 10f);
- [Export] private Vector4i field_Vector4i = Vector4i.One;
+ [Export] private Vector4I field_Vector4I = Vector4I.One;
[Export] private Projection field_Projection = Projection.Identity;
- [Export] private AABB field_AABB = new AABB(10f, 10f, 10f, new Vector3(1f, 1f, 1f));
+ [Export] private Aabb field_Aabb = new Aabb(10f, 10f, 10f, new Vector3(1f, 1f, 1f));
[Export] private Color field_Color = Colors.Aquamarine;
[Export] private Plane field_Plane = Plane.PlaneXZ;
[Export] private Callable field_Callable = new Callable(Engine.GetMainLoop(), "_process");
@@ -80,10 +80,10 @@ namespace Godot.SourceGenerators.Sample
[Export] private Vector2[] field_Vector2Array = { Vector2.Up, Vector2.Down, Vector2.Left, Vector2.Right };
[Export] private Vector3[] field_Vector3Array = { Vector3.Up, Vector3.Down, Vector3.Left, Vector3.Right };
[Export] private Color[] field_ColorArray = { Colors.Aqua, Colors.Aquamarine, Colors.Azure, Colors.Beige };
- [Export] private Godot.Object[] field_GodotObjectOrDerivedArray = { null };
+ [Export] private GodotObject[] field_GodotObjectOrDerivedArray = { null };
[Export] private StringName[] field_StringNameArray = { "foo", "bar" };
[Export] private NodePath[] field_NodePathArray = { "foo", "bar" };
- [Export] private RID[] field_RIDArray = { default, default, default };
+ [Export] private Rid[] field_RidArray = { default, default, default };
// Note we use Array and not System.Array. This tests the generated namespace qualification.
[Export] private Int32[] field_empty_Int32Array = Array.Empty<Int32>();
// Note we use List and not System.Collections.Generic.
@@ -93,11 +93,11 @@ namespace Godot.SourceGenerators.Sample
[Export] private Variant field_Variant = "foo";
// Classes
- [Export] private Godot.Object field_GodotObjectOrDerived;
+ [Export] private GodotObject field_GodotObjectOrDerived;
[Export] private Godot.Texture field_GodotResourceTexture;
[Export] private StringName field_StringName = new StringName("foo");
[Export] private NodePath field_NodePath = new NodePath("foo");
- [Export] private RID field_RID;
+ [Export] private Rid field_Rid;
[Export]
private Godot.Collections.Dictionary field_GodotDictionary =
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs
index 5afaeb736f..aef2a8824e 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs
@@ -10,7 +10,7 @@ namespace Godot.SourceGenerators.Sample
[SuppressMessage("ReSharper", "RedundantNameQualifier")]
[SuppressMessage("ReSharper", "ArrangeObjectCreationWhenTypeEvident")]
[SuppressMessage("ReSharper", "InconsistentNaming")]
- public partial class ExportedProperties : Godot.Object
+ public partial class ExportedProperties : GodotObject
{
// Do not generate default value
private String _notGenerate_Property_String = new string("not generate");
@@ -117,19 +117,19 @@ namespace Godot.SourceGenerators.Sample
// Godot structs
[Export] private Vector2 property_Vector2 { get; set; } = new(10f, 10f);
- [Export] private Vector2i property_Vector2i { get; set; } = Vector2i.Up;
+ [Export] private Vector2I property_Vector2I { get; set; } = Vector2I.Up;
[Export] private Rect2 property_Rect2 { get; set; } = new(new Vector2(10f, 10f), new Vector2(10f, 10f));
- [Export] private Rect2i property_Rect2i { get; set; } = new(new Vector2i(10, 10), new Vector2i(10, 10));
+ [Export] private Rect2I property_Rect2I { get; set; } = new(new Vector2I(10, 10), new Vector2I(10, 10));
[Export] private Transform2D property_Transform2D { get; set; } = Transform2D.Identity;
[Export] private Vector3 property_Vector3 { get; set; } = new(10f, 10f, 10f);
- [Export] private Vector3i property_Vector3i { get; set; } = Vector3i.Back;
+ [Export] private Vector3I property_Vector3I { get; set; } = Vector3I.Back;
[Export] private Basis property_Basis { get; set; } = new Basis(Quaternion.Identity);
[Export] private Quaternion property_Quaternion { get; set; } = new Quaternion(Basis.Identity);
[Export] private Transform3D property_Transform3D { get; set; } = Transform3D.Identity;
[Export] private Vector4 property_Vector4 { get; set; } = new(10f, 10f, 10f, 10f);
- [Export] private Vector4i property_Vector4i { get; set; } = Vector4i.One;
+ [Export] private Vector4I property_Vector4I { get; set; } = Vector4I.One;
[Export] private Projection property_Projection { get; set; } = Projection.Identity;
- [Export] private AABB property_AABB { get; set; } = new AABB(10f, 10f, 10f, new Vector3(1f, 1f, 1f));
+ [Export] private Aabb property_Aabb { get; set; } = new Aabb(10f, 10f, 10f, new Vector3(1f, 1f, 1f));
[Export] private Color property_Color { get; set; } = Colors.Aquamarine;
[Export] private Plane property_Plane { get; set; } = Plane.PlaneXZ;
[Export] private Callable property_Callable { get; set; } = new Callable(Engine.GetMainLoop(), "_process");
@@ -168,20 +168,20 @@ namespace Godot.SourceGenerators.Sample
[Export] private Vector2[] property_Vector2Array { get; set; } = { Vector2.Up, Vector2.Down, Vector2.Left, Vector2.Right };
[Export] private Vector3[] property_Vector3Array { get; set; } = { Vector3.Up, Vector3.Down, Vector3.Left, Vector3.Right };
[Export] private Color[] property_ColorArray { get; set; } = { Colors.Aqua, Colors.Aquamarine, Colors.Azure, Colors.Beige };
- [Export] private Godot.Object[] property_GodotObjectOrDerivedArray { get; set; } = { null };
+ [Export] private GodotObject[] property_GodotObjectOrDerivedArray { get; set; } = { null };
[Export] private StringName[] field_StringNameArray { get; set; } = { "foo", "bar" };
[Export] private NodePath[] field_NodePathArray { get; set; } = { "foo", "bar" };
- [Export] private RID[] field_RIDArray { get; set; } = { default, default, default };
+ [Export] private Rid[] field_RidArray { get; set; } = { default, default, default };
// Variant
[Export] private Variant property_Variant { get; set; } = "foo";
// Classes
- [Export] private Godot.Object property_GodotObjectOrDerived { get; set; }
+ [Export] private GodotObject property_GodotObjectOrDerived { get; set; }
[Export] private Godot.Texture property_GodotResourceTexture { get; set; }
[Export] private StringName property_StringName { get; set; } = new StringName("foo");
[Export] private NodePath property_NodePath { get; set; } = new NodePath("foo");
- [Export] private RID property_RID { get; set; }
+ [Export] private Rid property_Rid { get; set; }
[Export]
private Godot.Collections.Dictionary property_GodotDictionary { get; set; } =
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Foo.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Foo.cs
index 21a5bfe560..9ef72d9e02 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Foo.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Foo.cs
@@ -1,6 +1,6 @@
namespace Godot.SourceGenerators.Sample
{
- partial class Foo : Godot.Object
+ partial class Foo : GodotObject
{
}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Generic.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Generic.cs
index b21b035b4d..2cd1a08c0e 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Generic.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Generic.cs
@@ -2,19 +2,19 @@
namespace Godot.SourceGenerators.Sample
{
- partial class Generic<T> : Godot.Object
+ partial class Generic<T> : GodotObject
{
private int _field;
}
// Generic again but different generic parameters
- partial class Generic<T, R> : Godot.Object
+ partial class Generic<T, R> : GodotObject
{
private int _field;
}
// Generic again but without generic parameters
- partial class Generic : Godot.Object
+ partial class Generic : GodotObject
{
private int _field;
}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Methods.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Methods.cs
index 618ba24abc..9aa6be3972 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Methods.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Methods.cs
@@ -3,7 +3,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Godot.SourceGenerators.Sample;
[SuppressMessage("ReSharper", "RedundantNameQualifier")]
-public partial class Methods : Godot.Object
+public partial class Methods : GodotObject
{
private void MethodWithOverload()
{
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/MoreExportedFields.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/MoreExportedFields.cs
index a6c8e52667..64088215e9 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/MoreExportedFields.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/MoreExportedFields.cs
@@ -11,7 +11,7 @@ namespace Godot.SourceGenerators.Sample
[SuppressMessage("ReSharper", "ArrangeObjectCreationWhenTypeEvident")]
[SuppressMessage("ReSharper", "InconsistentNaming")]
// We split the definition of ExportedFields to verify properties work across multiple files.
- public partial class ExportedFields : Godot.Object
+ public partial class ExportedFields : GodotObject
{
// Note we use Array and not System.Array. This tests the generated namespace qualification.
[Export] private Int64[] field_empty_Int64Array = Array.Empty<Int64>();
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Common.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Common.cs
index 4eed2d7b7b..41bf89e6d8 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Common.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Common.cs
@@ -14,9 +14,9 @@ namespace Godot.SourceGenerators
{
string message =
"Missing partial modifier on declaration of type '" +
- $"{symbol.FullQualifiedNameOmitGlobal()}' which is a subclass of '{GodotClasses.Object}'";
+ $"{symbol.FullQualifiedNameOmitGlobal()}' which is a subclass of '{GodotClasses.GodotObject}'";
- string description = $"{message}. Subclasses of '{GodotClasses.Object}' " +
+ string description = $"{message}. Subclasses of '{GodotClasses.GodotObject}' " +
"must be declared with the partial modifier.";
context.ReportDiagnostic(Diagnostic.Create(
@@ -46,9 +46,9 @@ namespace Godot.SourceGenerators
string message =
$"Missing partial modifier on declaration of type '{fullQualifiedName}', " +
- $"which contains one or more subclasses of '{GodotClasses.Object}'";
+ $"which contains one or more subclasses of '{GodotClasses.GodotObject}'";
- string description = $"{message}. Subclasses of '{GodotClasses.Object}' and their " +
+ string description = $"{message}. Subclasses of '{GodotClasses.GodotObject}' and their " +
"containing types must be declared with the partial modifier.";
context.ReportDiagnostic(Diagnostic.Create(
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs
index 8852b7ebad..f0c9043fd5 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs
@@ -85,7 +85,7 @@ namespace Godot.SourceGenerators
var classTypeSymbol = sm.GetDeclaredSymbol(cds);
if (classTypeSymbol?.BaseType == null
- || !classTypeSymbol.BaseType.InheritsFrom("GodotSharp", GodotClasses.Object))
+ || !classTypeSymbol.BaseType.InheritsFrom("GodotSharp", GodotClasses.GodotObject))
{
symbol = null;
return false;
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotClasses.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotClasses.cs
index 1d8ddbabf2..b60148b34f 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotClasses.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotClasses.cs
@@ -2,7 +2,7 @@ namespace Godot.SourceGenerators
{
public static class GodotClasses
{
- public const string Object = "Godot.Object";
+ public const string GodotObject = "Godot.GodotObject";
public const string AssemblyHasScriptsAttr = "Godot.AssemblyHasScriptsAttribute";
public const string ExportAttr = "Godot.ExportAttribute";
public const string ExportCategoryAttr = "Godot.ExportCategoryAttribute";
@@ -10,7 +10,7 @@ namespace Godot.SourceGenerators
public const string ExportSubgroupAttr = "Godot.ExportSubgroupAttribute";
public const string SignalAttr = "Godot.SignalAttribute";
public const string MustBeVariantAttr = "Godot.MustBeVariantAttribute";
- public const string GodotClassNameAttr = "Godot.GodotClassName";
+ public const string GodotClassNameAttr = "Godot.GodotClassNameAttribute";
public const string SystemFlagsAttr = "System.FlagsAttribute";
}
}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotEnums.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotEnums.cs
index 5fb29b86da..b30c8c240e 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotEnums.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotEnums.cs
@@ -12,19 +12,19 @@ namespace Godot.SourceGenerators
Float = 3,
String = 4,
Vector2 = 5,
- Vector2i = 6,
+ Vector2I = 6,
Rect2 = 7,
- Rect2i = 8,
+ Rect2I = 8,
Vector3 = 9,
- Vector3i = 10,
- Transform2d = 11,
+ Vector3I = 10,
+ Transform2D = 11,
Vector4 = 12,
- Vector4i = 13,
+ Vector4I = 13,
Plane = 14,
Quaternion = 15,
Aabb = 16,
Basis = 17,
- Transform3d = 18,
+ Transform3D = 18,
Projection = 19,
Color = 20,
StringName = 21,
@@ -56,12 +56,12 @@ namespace Godot.SourceGenerators
ExpEasing = 4,
Link = 5,
Flags = 6,
- Layers2dRender = 7,
- Layers2dPhysics = 8,
- Layers2dNavigation = 9,
- Layers3dRender = 10,
- Layers3dPhysics = 11,
- Layers3dNavigation = 12,
+ Layers2DRender = 7,
+ Layers2DPhysics = 8,
+ Layers2DNavigation = 9,
+ Layers3DRender = 10,
+ Layers3DPhysics = 11,
+ Layers3DNavigation = 12,
File = 13,
Dir = 14,
GlobalFile = 15,
@@ -111,15 +111,16 @@ namespace Godot.SourceGenerators
ClassIsEnum = 65536,
NilIsVariant = 131072,
Array = 262144,
- DoNotShareOnDuplicate = 524288,
- HighEndGfx = 1048576,
- NodePathFromSceneRoot = 2097152,
- ResourceNotPersistent = 4194304,
- KeyingIncrements = 8388608,
- DeferredSetResource = 16777216,
- EditorInstantiateObject = 33554432,
- EditorBasicSetting = 67108864,
- ReadOnly = 134217728,
+ AlwaysDuplicate = 524288,
+ NeverDuplicate = 1048576,
+ HighEndGfx = 2097152,
+ NodePathFromSceneRoot = 4194304,
+ ResourceNotPersistent = 8388608,
+ KeyingIncrements = 16777216,
+ DeferredSetResource = 33554432,
+ EditorInstantiateObject = 67108864,
+ EditorBasicSetting = 134217728,
+ ReadOnly = 268435456,
Default = 6,
NoEditor = 2
}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs
index 19fdd51dab..813bdf1e9f 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs
@@ -34,7 +34,7 @@ namespace GodotPlugins.Game
{
DllImportResolver dllImportResolver = new GodotDllImportResolver(godotDllHandle).OnResolveDllImport;
- var coreApiAssembly = typeof(Godot.Object).Assembly;
+ var coreApiAssembly = typeof(global::Godot.GodotObject).Assembly;
NativeLibrary.SetDllImportResolver(coreApiAssembly, dllImportResolver);
@@ -42,7 +42,7 @@ namespace GodotPlugins.Game
ManagedCallbacks.Create(outManagedCallbacks);
- ScriptManagerBridge.LookupScriptsInAssembly(typeof(GodotPlugins.Game.Main).Assembly);
+ ScriptManagerBridge.LookupScriptsInAssembly(typeof(global::GodotPlugins.Game.Main).Assembly);
return godot_bool.True;
}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalType.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalType.cs
index ee1374d0b9..be6af117eb 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalType.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalType.cs
@@ -21,19 +21,19 @@ namespace Godot.SourceGenerators
// Godot structs
Vector2,
- Vector2i,
+ Vector2I,
Rect2,
- Rect2i,
+ Rect2I,
Transform2D,
Vector3,
- Vector3i,
+ Vector3I,
Basis,
Quaternion,
Transform3D,
Vector4,
- Vector4i,
+ Vector4I,
Projection,
- AABB,
+ Aabb,
Color,
Plane,
Callable,
@@ -55,7 +55,7 @@ namespace Godot.SourceGenerators
GodotObjectOrDerivedArray,
SystemArrayOfStringName,
SystemArrayOfNodePath,
- SystemArrayOfRID,
+ SystemArrayOfRid,
// Variant
Variant,
@@ -64,7 +64,7 @@ namespace Godot.SourceGenerators
GodotObjectOrDerived,
StringName,
NodePath,
- RID,
+ Rid,
GodotDictionary,
GodotArray,
GodotGenericDictionary,
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalUtils.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalUtils.cs
index f0a6a72281..0258f53062 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalUtils.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalUtils.cs
@@ -19,7 +19,7 @@ namespace Godot.SourceGenerators
throw new InvalidOperationException($"Type not found: '{fullyQualifiedMetadataName}'.");
}
- GodotObjectType = GetTypeByMetadataNameOrThrow("Godot.Object");
+ GodotObjectType = GetTypeByMetadataNameOrThrow(GodotClasses.GodotObject);
}
}
@@ -40,19 +40,19 @@ namespace Godot.SourceGenerators
MarshalType.Double => VariantType.Float,
MarshalType.String => VariantType.String,
MarshalType.Vector2 => VariantType.Vector2,
- MarshalType.Vector2i => VariantType.Vector2i,
+ MarshalType.Vector2I => VariantType.Vector2I,
MarshalType.Rect2 => VariantType.Rect2,
- MarshalType.Rect2i => VariantType.Rect2i,
- MarshalType.Transform2D => VariantType.Transform2d,
+ MarshalType.Rect2I => VariantType.Rect2I,
+ MarshalType.Transform2D => VariantType.Transform2D,
MarshalType.Vector3 => VariantType.Vector3,
- MarshalType.Vector3i => VariantType.Vector3i,
+ MarshalType.Vector3I => VariantType.Vector3I,
MarshalType.Basis => VariantType.Basis,
MarshalType.Quaternion => VariantType.Quaternion,
- MarshalType.Transform3D => VariantType.Transform3d,
+ MarshalType.Transform3D => VariantType.Transform3D,
MarshalType.Vector4 => VariantType.Vector4,
- MarshalType.Vector4i => VariantType.Vector4i,
+ MarshalType.Vector4I => VariantType.Vector4I,
MarshalType.Projection => VariantType.Projection,
- MarshalType.AABB => VariantType.Aabb,
+ MarshalType.Aabb => VariantType.Aabb,
MarshalType.Color => VariantType.Color,
MarshalType.Plane => VariantType.Plane,
MarshalType.Callable => VariantType.Callable,
@@ -70,12 +70,12 @@ namespace Godot.SourceGenerators
MarshalType.GodotObjectOrDerivedArray => VariantType.Array,
MarshalType.SystemArrayOfStringName => VariantType.Array,
MarshalType.SystemArrayOfNodePath => VariantType.Array,
- MarshalType.SystemArrayOfRID => VariantType.Array,
+ MarshalType.SystemArrayOfRid => VariantType.Array,
MarshalType.Variant => VariantType.Nil,
MarshalType.GodotObjectOrDerived => VariantType.Object,
MarshalType.StringName => VariantType.StringName,
MarshalType.NodePath => VariantType.NodePath,
- MarshalType.RID => VariantType.Rid,
+ MarshalType.Rid => VariantType.Rid,
MarshalType.GodotDictionary => VariantType.Dictionary,
MarshalType.GodotArray => VariantType.Array,
MarshalType.GodotGenericDictionary => VariantType.Dictionary,
@@ -130,22 +130,22 @@ namespace Godot.SourceGenerators
return type switch
{
{ Name: "Vector2" } => MarshalType.Vector2,
- { Name: "Vector2i" } => MarshalType.Vector2i,
+ { Name: "Vector2I" } => MarshalType.Vector2I,
{ Name: "Rect2" } => MarshalType.Rect2,
- { Name: "Rect2i" } => MarshalType.Rect2i,
+ { Name: "Rect2I" } => MarshalType.Rect2I,
{ Name: "Transform2D" } => MarshalType.Transform2D,
{ Name: "Vector3" } => MarshalType.Vector3,
- { Name: "Vector3i" } => MarshalType.Vector3i,
+ { Name: "Vector3I" } => MarshalType.Vector3I,
{ Name: "Basis" } => MarshalType.Basis,
{ Name: "Quaternion" } => MarshalType.Quaternion,
{ Name: "Transform3D" } => MarshalType.Transform3D,
{ Name: "Vector4" } => MarshalType.Vector4,
- { Name: "Vector4i" } => MarshalType.Vector4i,
+ { Name: "Vector4I" } => MarshalType.Vector4I,
{ Name: "Projection" } => MarshalType.Projection,
- { Name: "AABB" } => MarshalType.AABB,
+ { Name: "Aabb" } => MarshalType.Aabb,
{ Name: "Color" } => MarshalType.Color,
{ Name: "Plane" } => MarshalType.Plane,
- { Name: "RID" } => MarshalType.RID,
+ { Name: "Rid" } => MarshalType.Rid,
{ Name: "Callable" } => MarshalType.Callable,
{ Name: "Signal" } => MarshalType.Signal,
{ Name: "Variant" } => MarshalType.Variant,
@@ -196,8 +196,8 @@ namespace Godot.SourceGenerators
return MarshalType.SystemArrayOfStringName;
case { Name: "NodePath" }:
return MarshalType.SystemArrayOfNodePath;
- case { Name: "RID" }:
- return MarshalType.SystemArrayOfRID;
+ case { Name: "Rid" }:
+ return MarshalType.SystemArrayOfRid;
}
}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MustBeVariantAnalyzer.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MustBeVariantAnalyzer.cs
index 98ca534c66..2a9758516c 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MustBeVariantAnalyzer.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MustBeVariantAnalyzer.cs
@@ -26,6 +26,10 @@ namespace Godot.SourceGenerators
private void AnalyzeNode(SyntaxNodeAnalysisContext context)
{
+ // Ignore syntax inside comments
+ if (IsInsideDocumentation(context.Node))
+ return;
+
var typeArgListSyntax = (TypeArgumentListSyntax)context.Node;
// Method invocation or variable declaration that contained the type arguments
@@ -74,6 +78,26 @@ namespace Godot.SourceGenerators
}
/// <summary>
+ /// Check if the syntax node is inside a documentation syntax.
+ /// </summary>
+ /// <param name="syntax">Syntax node to check.</param>
+ /// <returns><see langword="true"/> if the syntax node is inside a documentation syntax.</returns>
+ private bool IsInsideDocumentation(SyntaxNode? syntax)
+ {
+ while (syntax != null)
+ {
+ if (syntax is DocumentationCommentTriviaSyntax)
+ {
+ return true;
+ }
+
+ syntax = syntax.Parent;
+ }
+
+ return false;
+ }
+
+ /// <summary>
/// Check if the given type argument is being used in a type parameter that contains
/// the <c>MustBeVariantAttribute</c>; otherwise, we ignore the attribute.
/// </summary>
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs
index b64b843b7c..b720fb93a3 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs
@@ -328,15 +328,15 @@ namespace Godot.SourceGenerators
private static void AppendGroupingPropertyInfo(StringBuilder source, PropertyInfo propertyInfo)
{
- source.Append(" properties.Add(new(type: (Godot.Variant.Type)")
+ source.Append(" properties.Add(new(type: (global::Godot.Variant.Type)")
.Append((int)VariantType.Nil)
.Append(", name: \"")
.Append(propertyInfo.Name)
- .Append("\", hint: (Godot.PropertyHint)")
+ .Append("\", hint: (global::Godot.PropertyHint)")
.Append((int)PropertyHint.None)
.Append(", hintString: \"")
.Append(propertyInfo.HintString)
- .Append("\", usage: (Godot.PropertyUsageFlags)")
+ .Append("\", usage: (global::Godot.PropertyUsageFlags)")
.Append((int)propertyInfo.Usage)
.Append(", exported: true));\n");
}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs
index ba6c10aa31..d67cb5349d 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs
@@ -272,6 +272,25 @@ namespace Godot.SourceGenerators
source.Append(" }\n");
}
+ // Generate HasGodotClassSignal
+
+ if (godotSignalDelegates.Count > 0)
+ {
+ source.Append(
+ " protected override bool HasGodotClassSignal(in godot_string_name signal)\n {\n");
+
+ bool isFirstEntry = true;
+ foreach (var signal in godotSignalDelegates)
+ {
+ GenerateHasSignalEntry(signal.Name, source, isFirstEntry);
+ isFirstEntry = false;
+ }
+
+ source.Append(" return base.HasGodotClassSignal(signal);\n");
+
+ source.Append(" }\n");
+ }
+
source.Append("}\n"); // partial class
if (isInnerClass)
@@ -397,6 +416,20 @@ namespace Godot.SourceGenerators
PropertyHint.None, string.Empty, propUsage, exported: false);
}
+ private static void GenerateHasSignalEntry(
+ string signalName,
+ StringBuilder source,
+ bool isFirstEntry
+ )
+ {
+ source.Append(" ");
+ if (!isFirstEntry)
+ source.Append("else ");
+ source.Append("if (signal == SignalName.");
+ source.Append(signalName);
+ source.Append(") {\n return true;\n }\n");
+ }
+
private static void GenerateSignalEventInvoker(
GodotSignalDelegateData signal,
StringBuilder source
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs
index edbf53a389..a4d5e1a569 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs
@@ -23,7 +23,7 @@ namespace GodotTools.Build
public Godot.Collections.Array CustomProperties { get; private set; } = new();
public string LogsDirPath =>
- Path.Combine(GodotSharpDirs.BuildLogsDirs, $"{Solution.MD5Text()}_{Configuration}");
+ Path.Combine(GodotSharpDirs.BuildLogsDirs, $"{Solution.Md5Text()}_{Configuration}");
public override bool Equals(object? obj)
{
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs
index 993c6d9217..349f9d0cb8 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs
@@ -55,7 +55,7 @@ namespace GodotTools.Build
private static void PrintVerbose(string text)
{
- if (OS.IsStdoutVerbose())
+ if (OS.IsStdOutVerbose())
GD.Print(text);
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
index e439822666..c083b9cc60 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
@@ -336,7 +336,7 @@ namespace GodotTools.Build
_ = index; // Unused
_issuesListContextMenu.Clear();
- _issuesListContextMenu.Size = new Vector2i(1, 1);
+ _issuesListContextMenu.Size = new Vector2I(1, 1);
if (_issuesList.IsAnythingSelected())
{
@@ -347,7 +347,7 @@ namespace GodotTools.Build
if (_issuesListContextMenu.ItemCount > 0)
{
- _issuesListContextMenu.Position = (Vector2i)(_issuesList.GlobalPosition + atPosition);
+ _issuesListContextMenu.Position = (Vector2I)(_issuesList.GlobalPosition + atPosition);
_issuesListContextMenu.Popup();
}
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs
index d0cd529d1f..ae0ffaf4cb 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs
@@ -28,7 +28,7 @@ namespace GodotTools.Build
string launchMessage = startInfo.GetCommandLineDisplay(new StringBuilder("Running: ")).ToString();
stdOutHandler?.Invoke(launchMessage);
- if (Godot.OS.IsStdoutVerbose())
+ if (Godot.OS.IsStdOutVerbose())
Console.WriteLine(launchMessage);
startInfo.RedirectStandardOutput = true;
@@ -89,7 +89,7 @@ namespace GodotTools.Build
string launchMessage = startInfo.GetCommandLineDisplay(new StringBuilder("Running: ")).ToString();
stdOutHandler?.Invoke(launchMessage);
- if (Godot.OS.IsStdoutVerbose())
+ if (Godot.OS.IsStdOutVerbose())
Console.WriteLine(launchMessage);
startInfo.RedirectStandardOutput = true;
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs b/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs
index 2e438f3f8f..262de024ca 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs
@@ -122,7 +122,7 @@ namespace GodotTools.Build
{
base._Ready();
- CustomMinimumSize = new Vector2i(0, (int)(228 * EditorScale));
+ CustomMinimumSize = new Vector2(0, 228 * EditorScale);
SizeFlagsVertical = SizeFlags.ExpandFill;
var toolBarHBox = new HBoxContainer { SizeFlagsHorizontal = SizeFlags.ExpandFill };
@@ -175,7 +175,7 @@ namespace GodotTools.Build
AddChild(BuildOutputView);
}
- public override void _Notification(long what)
+ public override void _Notification(int what)
{
base._Notification(what);
diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
index db96003baf..019504ad66 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
@@ -71,7 +71,7 @@ namespace GodotTools.Export
}
}
- public override void _ExportBegin(string[] features, bool isDebug, string path, long flags)
+ public override void _ExportBegin(string[] features, bool isDebug, string path, uint flags)
{
base._ExportBegin(features, isDebug, path, flags);
diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
index 08147d9f6a..5abbe8752c 100644
--- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
@@ -192,7 +192,7 @@ namespace GodotTools
try
{
- if (Godot.OS.IsStdoutVerbose())
+ if (Godot.OS.IsStdOutVerbose())
Console.WriteLine(
$"Running: \"{command}\" {string.Join(" ", args.Select(a => $"\"{a}\""))}");
@@ -385,7 +385,7 @@ namespace GodotTools
// correct version first (`RegisterDefaults` always picks the latest).
if (DotNetFinder.TryFindDotNetSdk(dotNetSdkSearchVersion, out var sdkVersion, out string sdkPath))
{
- if (Godot.OS.IsStdoutVerbose())
+ if (Godot.OS.IsStdOutVerbose())
Console.WriteLine($"Found .NET Sdk version '{sdkVersion}': {sdkPath}");
ProjectUtils.MSBuildLocatorRegisterMSBuildPath(sdkPath);
@@ -395,12 +395,12 @@ namespace GodotTools
try
{
ProjectUtils.MSBuildLocatorRegisterDefaults(out sdkVersion, out sdkPath);
- if (Godot.OS.IsStdoutVerbose())
+ if (Godot.OS.IsStdOutVerbose())
Console.WriteLine($"Found .NET Sdk version '{sdkVersion}': {sdkPath}");
}
catch (InvalidOperationException e)
{
- if (Godot.OS.IsStdoutVerbose())
+ if (Godot.OS.IsStdOutVerbose())
GD.PrintErr(e.ToString());
GD.PushError($".NET Sdk not found. The required version is '{dotNetSdkSearchVersion}'.");
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/HotReloadAssemblyWatcher.cs b/modules/mono/editor/GodotTools/GodotTools/HotReloadAssemblyWatcher.cs
index 89ac8058b9..eb42f01b3a 100644
--- a/modules/mono/editor/GodotTools/GodotTools/HotReloadAssemblyWatcher.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/HotReloadAssemblyWatcher.cs
@@ -9,9 +9,9 @@ namespace GodotTools
{
private Timer _watchTimer;
- public override void _Notification(long what)
+ public override void _Notification(int what)
{
- if (what == Node.NotificationWmWindowFocusIn)
+ if (what == Node.NotificationWMWindowFocusIn)
{
RestartTimer();
diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs
index 9df90ac608..5de2c9833b 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs
@@ -200,13 +200,13 @@ namespace GodotTools.Ides
{
public void LogDebug(string message)
{
- if (OS.IsStdoutVerbose())
+ if (OS.IsStdOutVerbose())
Console.WriteLine(message);
}
public void LogInfo(string message)
{
- if (OS.IsStdoutVerbose())
+ if (OS.IsStdOutVerbose())
Console.WriteLine(message);
}
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 03cbfda1bd..ad6306bb41 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -38,10 +38,10 @@
#include "core/io/dir_access.h"
#include "core/io/file_access.h"
#include "core/os/os.h"
-#include "core/string/ucaps.h"
#include "main/main.h"
#include "../godotsharp_defs.h"
+#include "../utils/naming_utils.h"
#include "../utils/path_utils.h"
#include "../utils/string_utils.h"
@@ -84,10 +84,12 @@ StringBuilder &operator<<(StringBuilder &r_sb, const char *p_cstring) {
#define CS_PROPERTY_SINGLETON "Singleton"
#define CS_METHOD_INVOKE_GODOT_CLASS_METHOD "InvokeGodotClassMethod"
#define CS_METHOD_HAS_GODOT_CLASS_METHOD "HasGodotClassMethod"
+#define CS_METHOD_HAS_GODOT_CLASS_SIGNAL "HasGodotClassSignal"
#define CS_STATIC_FIELD_NATIVE_CTOR "NativeCtor"
#define CS_STATIC_FIELD_METHOD_BIND_PREFIX "MethodBind"
#define CS_STATIC_FIELD_METHOD_PROXY_NAME_PREFIX "MethodProxyName_"
+#define CS_STATIC_FIELD_SIGNAL_PROXY_NAME_PREFIX "SignalProxyName_"
#define ICALL_PREFIX "godot_icall_"
#define ICALL_CLASSDB_GET_METHOD "ClassDB_get_method"
@@ -144,74 +146,6 @@ static String fix_doc_description(const String &p_bbcode) {
.strip_edges();
}
-static String snake_to_pascal_case(const String &p_identifier, bool p_input_is_upper = false) {
- String ret;
- Vector<String> parts = p_identifier.split("_", true);
-
- for (int i = 0; i < parts.size(); i++) {
- String part = parts[i];
-
- if (part.length()) {
- part[0] = _find_upper(part[0]);
- if (p_input_is_upper) {
- for (int j = 1; j < part.length(); j++) {
- part[j] = _find_lower(part[j]);
- }
- }
- ret += part;
- } else {
- if (i == 0 || i == (parts.size() - 1)) {
- // Preserve underscores at the beginning and end
- ret += "_";
- } else {
- // Preserve contiguous underscores
- if (parts[i - 1].length()) {
- ret += "__";
- } else {
- ret += "_";
- }
- }
- }
- }
-
- return ret;
-}
-
-static String snake_to_camel_case(const String &p_identifier, bool p_input_is_upper = false) {
- String ret;
- Vector<String> parts = p_identifier.split("_", true);
-
- for (int i = 0; i < parts.size(); i++) {
- String part = parts[i];
-
- if (part.length()) {
- if (i != 0) {
- part[0] = _find_upper(part[0]);
- }
- if (p_input_is_upper) {
- for (int j = i != 0 ? 1 : 0; j < part.length(); j++) {
- part[j] = _find_lower(part[j]);
- }
- }
- ret += part;
- } else {
- if (i == 0 || i == (parts.size() - 1)) {
- // Preserve underscores at the beginning and end
- ret += "_";
- } else {
- // Preserve contiguous underscores
- if (parts[i - 1].length()) {
- ret += "__";
- } else {
- ret += "_";
- }
- }
- }
- }
-
- return ret;
-}
-
String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterface *p_itype) {
// Based on the version in EditorHelp
@@ -229,6 +163,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
List<String> tag_stack;
bool code_tag = false;
+ bool line_del = false;
int pos = 0;
while (pos < bbcode.length()) {
@@ -239,20 +174,22 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
}
if (brk_pos > pos) {
- String text = bbcode.substr(pos, brk_pos - pos);
- if (code_tag || tag_stack.size() > 0) {
- xml_output.append(text.xml_escape());
- } else {
- Vector<String> lines = text.split("\n");
- for (int i = 0; i < lines.size(); i++) {
- if (i != 0) {
- xml_output.append("<para>");
- }
+ if (!line_del) {
+ String text = bbcode.substr(pos, brk_pos - pos);
+ if (code_tag || tag_stack.size() > 0) {
+ xml_output.append(text.xml_escape());
+ } else {
+ Vector<String> lines = text.split("\n");
+ for (int i = 0; i < lines.size(); i++) {
+ if (i != 0) {
+ xml_output.append("<para>");
+ }
- xml_output.append(lines[i].xml_escape());
+ xml_output.append(lines[i].xml_escape());
- if (i != lines.size() - 1) {
- xml_output.append("</para>\n");
+ if (i != lines.size() - 1) {
+ xml_output.append("</para>\n");
+ }
}
}
}
@@ -265,20 +202,22 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
int brk_end = bbcode.find("]", brk_pos + 1);
if (brk_end == -1) {
- String text = bbcode.substr(brk_pos, bbcode.length() - brk_pos);
- if (code_tag || tag_stack.size() > 0) {
- xml_output.append(text.xml_escape());
- } else {
- Vector<String> lines = text.split("\n");
- for (int i = 0; i < lines.size(); i++) {
- if (i != 0) {
- xml_output.append("<para>");
- }
+ if (!line_del) {
+ String text = bbcode.substr(brk_pos, bbcode.length() - brk_pos);
+ if (code_tag || tag_stack.size() > 0) {
+ xml_output.append(text.xml_escape());
+ } else {
+ Vector<String> lines = text.split("\n");
+ for (int i = 0; i < lines.size(); i++) {
+ if (i != 0) {
+ xml_output.append("<para>");
+ }
- xml_output.append(lines[i].xml_escape());
+ xml_output.append(lines[i].xml_escape());
- if (i != lines.size() - 1) {
- xml_output.append("</para>\n");
+ if (i != lines.size() - 1) {
+ xml_output.append("</para>\n");
+ }
}
}
}
@@ -292,7 +231,9 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
bool tag_ok = tag_stack.size() && tag_stack.front()->get() == tag.substr(1, tag.length());
if (!tag_ok) {
- xml_output.append("[");
+ if (!line_del) {
+ xml_output.append("[");
+ }
pos = brk_pos + 1;
continue;
}
@@ -307,11 +248,20 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
xml_output.append("</c>");
} else if (tag == "/codeblock") {
xml_output.append("</code>");
+ } else if (tag == "/b") {
+ xml_output.append("</b>");
+ } else if (tag == "/i") {
+ xml_output.append("</i>");
+ } else if (tag == "/csharp") {
+ xml_output.append("</code>");
+ line_del = true;
+ } else if (tag == "/codeblocks") {
+ line_del = false;
}
} else if (code_tag) {
xml_output.append("[");
pos = brk_pos + 1;
- } else if (tag.begins_with("method ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ") || tag.begins_with("theme_item ")) {
+ } else if (tag.begins_with("method ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ") || tag.begins_with("theme_item ") || tag.begins_with("param ")) {
const int tag_end = tag.find(" ");
const String link_tag = tag.substr(0, tag_end);
const String link_target = tag.substr(tag_end + 1, tag.length()).lstrip(" ");
@@ -356,6 +306,8 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
} else if (link_tag == "theme_item") {
// We do not declare theme_items in any way in C#, so there is nothing to reference
_append_xml_undeclared(xml_output, link_target);
+ } else if (link_tag == "param") {
+ _append_xml_undeclared(xml_output, snake_to_camel_case(link_target, false));
}
pos = brk_end + 1;
@@ -377,8 +329,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
#endif
"\"/>");
} else if (tag == "Variant") {
- // We use System.Object for Variant, so there is no Variant type in C#
- xml_output.append("<c>Variant</c>");
+ xml_output.append("<see cref=\"Godot.Variant\"/>");
} else if (tag == "String") {
xml_output.append("<see cref=\"string\"/>");
} else if (tag == "Nil") {
@@ -428,11 +379,13 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
pos = brk_end + 1;
} else if (tag == "b") {
- // bold is not supported in xml comments
+ xml_output.append("<b>");
+
pos = brk_end + 1;
tag_stack.push_front(tag);
} else if (tag == "i") {
- // italics is not supported in xml comments
+ xml_output.append("<i>");
+
pos = brk_end + 1;
tag_stack.push_front(tag);
} else if (tag == "code") {
@@ -447,6 +400,17 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
code_tag = true;
pos = brk_end + 1;
tag_stack.push_front(tag);
+ } else if (tag == "codeblocks") {
+ line_del = true;
+ pos = brk_end + 1;
+ tag_stack.push_front(tag);
+ } else if (tag == "csharp") {
+ xml_output.append("<code>");
+
+ line_del = false;
+ code_tag = true;
+ pos = brk_end + 1;
+ tag_stack.push_front(tag);
} else if (tag == "kbd") {
// keyboard combinations are not supported in xml comments
pos = brk_end + 1;
@@ -459,7 +423,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
xml_output.append("\n"); // FIXME: Should use <para> instead. Luckily this tag isn't used for now.
pos = brk_end + 1;
} else if (tag == "u") {
- // underline is not supported in xml comments
+ // underline is not supported in Rider xml comments
pos = brk_end + 1;
tag_stack.push_front(tag);
} else if (tag == "s") {
@@ -510,7 +474,9 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
pos = brk_end + 1;
tag_stack.push_front("font");
} else {
- xml_output.append("["); // ignore
+ if (!line_del) {
+ xml_output.append("["); // ignore
+ }
pos = brk_pos + 1;
}
}
@@ -531,7 +497,7 @@ void BindingsGenerator::_append_xml_method(StringBuilder &p_xml_output, const Ty
} else if (!p_target_itype || !p_target_itype->is_object_type) {
if (OS::get_singleton()->is_stdout_verbose()) {
if (p_target_itype) {
- OS::get_singleton()->print("Cannot resolve method reference for non-Godot.Object type in documentation: %s\n", p_link_target.utf8().get_data());
+ OS::get_singleton()->print("Cannot resolve method reference for non-GodotObject type in documentation: %s\n", p_link_target.utf8().get_data());
} else {
OS::get_singleton()->print("Cannot resolve type from method reference in documentation: %s\n", p_link_target.utf8().get_data());
}
@@ -571,7 +537,7 @@ void BindingsGenerator::_append_xml_member(StringBuilder &p_xml_output, const Ty
} else if (!p_target_itype || !p_target_itype->is_object_type) {
if (OS::get_singleton()->is_stdout_verbose()) {
if (p_target_itype) {
- OS::get_singleton()->print("Cannot resolve member reference for non-Godot.Object type in documentation: %s\n", p_link_target.utf8().get_data());
+ OS::get_singleton()->print("Cannot resolve member reference for non-GodotObject type in documentation: %s\n", p_link_target.utf8().get_data());
} else {
OS::get_singleton()->print("Cannot resolve type from member reference in documentation: %s\n", p_link_target.utf8().get_data());
}
@@ -607,7 +573,7 @@ void BindingsGenerator::_append_xml_signal(StringBuilder &p_xml_output, const Ty
if (!p_target_itype || !p_target_itype->is_object_type) {
if (OS::get_singleton()->is_stdout_verbose()) {
if (p_target_itype) {
- OS::get_singleton()->print("Cannot resolve signal reference for non-Godot.Object type in documentation: %s\n", p_link_target.utf8().get_data());
+ OS::get_singleton()->print("Cannot resolve signal reference for non-GodotObject type in documentation: %s\n", p_link_target.utf8().get_data());
} else {
OS::get_singleton()->print("Cannot resolve type from signal reference in documentation: %s\n", p_link_target.utf8().get_data());
}
@@ -664,7 +630,7 @@ void BindingsGenerator::_append_xml_constant(StringBuilder &p_xml_output, const
if (OS::get_singleton()->is_stdout_verbose()) {
if (p_target_itype) {
- OS::get_singleton()->print("Cannot resolve constant reference for non-Godot.Object type in documentation: %s\n", p_link_target.utf8().get_data());
+ OS::get_singleton()->print("Cannot resolve constant reference for non-GodotObject type in documentation: %s\n", p_link_target.utf8().get_data());
} else {
OS::get_singleton()->print("Cannot resolve type from constant reference in documentation: %s\n", p_link_target.utf8().get_data());
}
@@ -933,11 +899,11 @@ void BindingsGenerator::_generate_array_extensions(StringBuilder &p_output) {
ARRAY_ALL(string);
ARRAY_ALL(Color);
ARRAY_ALL(Vector2);
- ARRAY_ALL(Vector2i);
+ ARRAY_ALL(Vector2I);
ARRAY_ALL(Vector3);
- ARRAY_ALL(Vector3i);
+ ARRAY_ALL(Vector3I);
ARRAY_ALL(Vector4);
- ARRAY_ALL(Vector4i);
+ ARRAY_ALL(Vector4I);
#undef ARRAY_ALL
#undef ARRAY_IS_EMPTY
@@ -1007,7 +973,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
_log("Declaring global enum '%s' inside struct '%s'\n", enum_proxy_name.utf8().get_data(), enum_class_name.utf8().get_data());
p_output.append("\npublic partial struct ");
- p_output.append(enum_class_name);
+ p_output.append(pascal_to_pascal_case(enum_class_name));
p_output.append("\n" OPEN_BLOCK);
}
@@ -1016,7 +982,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
}
p_output.append("\npublic enum ");
- p_output.append(enum_proxy_name);
+ p_output.append(pascal_to_pascal_case(enum_proxy_name));
p_output.append(" : long");
p_output.append("\n" OPEN_BLOCK);
@@ -1351,7 +1317,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
bool is_derived_type = itype.base_name != StringName();
if (!is_derived_type) {
- // Some Godot.Object assertions
+ // Some GodotObject assertions
CRASH_COND(itype.cname != name_cache.type_Object);
CRASH_COND(!itype.is_instantiable);
CRASH_COND(itype.api_type != ClassDB::API_CORE);
@@ -1468,7 +1434,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
}
output.append(MEMBER_BEGIN "public enum ");
- output.append(ienum.cname.operator String());
+ output.append(pascal_to_pascal_case(ienum.cname.operator String()));
output.append(" : long");
output.append(MEMBER_BEGIN OPEN_BLOCK);
@@ -1513,9 +1479,9 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
if (itype.is_singleton) {
// Add the type name and the singleton pointer as static fields
- output.append(MEMBER_BEGIN "private static Godot.Object singleton;\n");
+ output.append(MEMBER_BEGIN "private static GodotObject singleton;\n");
- output << MEMBER_BEGIN "public static Godot.Object " CS_PROPERTY_SINGLETON "\n" INDENT1 "{\n"
+ output << MEMBER_BEGIN "public static GodotObject " CS_PROPERTY_SINGLETON "\n" INDENT1 "{\n"
<< INDENT2 "get\n" INDENT2 "{\n" INDENT3 "if (singleton == null)\n"
<< INDENT4 "singleton = " C_METHOD_ENGINE_GET_SINGLETON "(typeof("
<< itype.proxy_name
@@ -1525,8 +1491,8 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
output.append(itype.name);
output.append("\";\n");
} else {
- // IMPORTANT: We also generate the static fields for Godot.Object instead of declaring
- // them manually in the `Object.base.cs` partial class declaration, because they're
+ // IMPORTANT: We also generate the static fields for GodotObject instead of declaring
+ // them manually in the `GodotObject.base.cs` partial class declaration, because they're
// required by other static fields in this generated partial class declaration.
// Static fields are initialized in order of declaration, but when they're in different
// partial class declarations then it becomes harder to tell (Rider warns about this).
@@ -1608,6 +1574,16 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
<< " = \"" << imethod.proxy_name << "\";\n";
}
+ // Generate signal names cache fields
+
+ for (const SignalInterface &isignal : itype.signals_) {
+ output << MEMBER_BEGIN "// ReSharper disable once InconsistentNaming\n"
+ << INDENT1 "[DebuggerBrowsable(DebuggerBrowsableState.Never)]\n"
+ << INDENT1 "private static readonly StringName "
+ << CS_STATIC_FIELD_SIGNAL_PROXY_NAME_PREFIX << isignal.name
+ << " = \"" << isignal.proxy_name << "\";\n";
+ }
+
// TODO: Only generate HasGodotClassMethod and InvokeGodotClassMethod if there's any method
// Generate InvokeGodotClassMethod
@@ -1721,6 +1697,34 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
}
output << INDENT1 "}\n";
+
+ // Generate HasGodotClassSignal
+
+ output << MEMBER_BEGIN "protected internal " << (is_derived_type ? "override" : "virtual")
+ << " bool " CS_METHOD_HAS_GODOT_CLASS_SIGNAL "(in godot_string_name signal)\n"
+ << INDENT1 "{\n";
+
+ for (const SignalInterface &isignal : itype.signals_) {
+ // We check for native names (snake_case). If we detect one, we call HasGodotClassSignal
+ // again, but this time with the respective proxy name (PascalCase). It's the job of
+ // user derived classes to override the method and check for those. Our C# source
+ // generators take care of generating those override methods.
+ output << INDENT2 "if (signal == SignalName." << isignal.proxy_name
+ << ")\n" INDENT2 "{\n"
+ << INDENT3 "if (" CS_METHOD_HAS_GODOT_CLASS_SIGNAL "("
+ << CS_STATIC_FIELD_SIGNAL_PROXY_NAME_PREFIX << isignal.name
+ << ".NativeValue.DangerousSelfRef))\n" INDENT3 "{\n"
+ << INDENT4 "return true;\n"
+ << INDENT3 "}\n" INDENT2 "}\n";
+ }
+
+ if (is_derived_type) {
+ output << INDENT2 "return base." CS_METHOD_HAS_GODOT_CLASS_SIGNAL "(signal);\n";
+ } else {
+ output << INDENT2 "return false;\n";
+ }
+
+ output << INDENT1 "}\n";
}
//Generate StringName for all class members
@@ -2058,9 +2062,9 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
<< INDENT1 "private static readonly IntPtr " << method_bind_field << " = ";
if (p_itype.is_singleton) {
- // Singletons are static classes. They don't derive Godot.Object,
+ // Singletons are static classes. They don't derive GodotObject,
// so we need to specify the type to call the static method.
- p_output << "Object.";
+ p_output << "GodotObject.";
}
p_output << ICALL_CLASSDB_GET_METHOD "(" BINDINGS_NATIVE_NAME_FIELD ", MethodName."
@@ -2775,6 +2779,18 @@ bool BindingsGenerator::_arg_default_value_is_assignable_to_type(const Variant &
return false;
}
+bool method_has_ptr_parameter(MethodInfo p_method_info) {
+ if (p_method_info.return_val.type == Variant::INT && p_method_info.return_val.hint == PROPERTY_HINT_INT_IS_POINTER) {
+ return true;
+ }
+ for (PropertyInfo arg : p_method_info.arguments) {
+ if (arg.type == Variant::INT && arg.hint == PROPERTY_HINT_INT_IS_POINTER) {
+ return true;
+ }
+ }
+ return false;
+}
+
bool BindingsGenerator::_populate_object_type_interfaces() {
obj_types.clear();
@@ -2812,7 +2828,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(type_cname);
- TypeInterface itype = TypeInterface::create_object_type(type_cname, api_type);
+ TypeInterface itype = TypeInterface::create_object_type(type_cname, pascal_to_pascal_case(type_cname), api_type);
itype.base_name = ClassDB::get_parent_class(type_cname);
itype.is_singleton = Engine::get_singleton()->has_singleton(itype.proxy_name);
@@ -2827,9 +2843,9 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
itype.cs_type = itype.proxy_name;
if (itype.is_singleton) {
- itype.cs_in_expr = "Object." CS_STATIC_METHOD_GETINSTANCE "(" CS_PROPERTY_SINGLETON ")";
+ itype.cs_in_expr = "GodotObject." CS_STATIC_METHOD_GETINSTANCE "(" CS_PROPERTY_SINGLETON ")";
} else {
- itype.cs_in_expr = "Object." CS_STATIC_METHOD_GETINSTANCE "(%0)";
+ itype.cs_in_expr = "GodotObject." CS_STATIC_METHOD_GETINSTANCE "(%0)";
}
itype.cs_out = "%5return (%2)%0(%1);";
@@ -2837,7 +2853,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
itype.c_arg_in = "(void*)%s";
itype.c_type = "IntPtr";
itype.c_type_in = itype.c_type;
- itype.c_type_out = "Object";
+ itype.c_type_out = "GodotObject";
// Populate properties
@@ -2918,6 +2934,11 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
continue;
}
+ if (method_has_ptr_parameter(method_info)) {
+ // Pointers are not supported.
+ continue;
+ }
+
MethodInterface imethod;
imethod.name = method_info.name;
imethod.cname = cname;
@@ -2979,7 +3000,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
} else if (return_info.type == Variant::NIL) {
imethod.return_type.cname = name_cache.type_void;
} else {
- imethod.return_type.cname = _get_type_name_from_meta(return_info.type, m ? m->get_argument_meta(-1) : GodotTypeInfo::METADATA_NONE);
+ imethod.return_type.cname = _get_type_name_from_meta(return_info.type, m ? m->get_argument_meta(-1) : (GodotTypeInfo::Metadata)method_info.return_val_metadata);
}
for (int i = 0; i < argc; i++) {
@@ -3003,7 +3024,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
} else if (arginfo.type == Variant::NIL) {
iarg.type.cname = name_cache.type_Variant;
} else {
- iarg.type.cname = _get_type_name_from_meta(arginfo.type, m ? m->get_argument_meta(i) : GodotTypeInfo::METADATA_NONE);
+ iarg.type.cname = _get_type_name_from_meta(arginfo.type, m ? m->get_argument_meta(i) : (GodotTypeInfo::Metadata)method_info.get_argument_meta(i));
}
iarg.name = escape_csharp_keyword(snake_to_camel_case(iarg.name));
@@ -3103,7 +3124,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
} else if (arginfo.type == Variant::NIL) {
iarg.type.cname = name_cache.type_Variant;
} else {
- iarg.type.cname = _get_type_name_from_meta(arginfo.type, GodotTypeInfo::METADATA_NONE);
+ iarg.type.cname = _get_type_name_from_meta(arginfo.type, (GodotTypeInfo::Metadata)method_info.get_argument_meta(i));
}
iarg.name = escape_csharp_keyword(snake_to_camel_case(iarg.name));
@@ -3152,7 +3173,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
for (const KeyValue<StringName, ClassDB::ClassInfo::EnumInfo> &E : enum_map) {
StringName enum_proxy_cname = E.key;
- String enum_proxy_name = enum_proxy_cname.operator String();
+ String enum_proxy_name = pascal_to_pascal_case(enum_proxy_cname.operator String());
if (itype.find_property_by_proxy_name(enum_proxy_name) || itype.find_method_by_proxy_name(enum_proxy_name) || itype.find_signal_by_proxy_name(enum_proxy_name)) {
// In case the enum name conflicts with other PascalCase members,
// we append 'Enum' to the enum name in those cases.
@@ -3280,7 +3301,7 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
} break;
case Variant::AABB: {
AABB aabb = p_val.operator ::AABB();
- r_iarg.default_argument = "new AABB(new Vector3" + aabb.position.operator String() + ", new Vector3" + aabb.size.operator String() + ")";
+ r_iarg.default_argument = "new Aabb(new Vector3" + aabb.position.operator String() + ", new Vector3" + aabb.size.operator String() + ")";
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
} break;
case Variant::RECT2: {
@@ -3290,7 +3311,7 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
} break;
case Variant::RECT2I: {
Rect2i rect = p_val.operator Rect2i();
- r_iarg.default_argument = "new Rect2i(new Vector2i" + rect.position.operator String() + ", new Vector2i" + rect.size.operator String() + ")";
+ r_iarg.default_argument = "new Rect2I(new Vector2I" + rect.position.operator String() + ", new Vector2I" + rect.size.operator String() + ")";
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
} break;
case Variant::COLOR:
@@ -3424,32 +3445,30 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
TypeInterface itype;
-#define INSERT_STRUCT_TYPE(m_type) \
- { \
- itype = TypeInterface::create_value_type(String(#m_type)); \
- itype.c_type_in = #m_type "*"; \
- itype.c_type_out = itype.cs_type; \
- itype.cs_in_expr = "&%0"; \
- itype.cs_in_expr_is_unsafe = true; \
- builtin_types.insert(itype.cname, itype); \
- }
-
- INSERT_STRUCT_TYPE(Vector2)
- INSERT_STRUCT_TYPE(Vector2i)
- INSERT_STRUCT_TYPE(Rect2)
- INSERT_STRUCT_TYPE(Rect2i)
- INSERT_STRUCT_TYPE(Transform2D)
- INSERT_STRUCT_TYPE(Vector3)
- INSERT_STRUCT_TYPE(Vector3i)
- INSERT_STRUCT_TYPE(Basis)
- INSERT_STRUCT_TYPE(Quaternion)
- INSERT_STRUCT_TYPE(Transform3D)
- INSERT_STRUCT_TYPE(AABB)
- INSERT_STRUCT_TYPE(Color)
- INSERT_STRUCT_TYPE(Plane)
- INSERT_STRUCT_TYPE(Vector4)
- INSERT_STRUCT_TYPE(Vector4i)
- INSERT_STRUCT_TYPE(Projection)
+#define INSERT_STRUCT_TYPE(m_type, m_proxy_name) \
+ { \
+ itype = TypeInterface::create_value_type(String(#m_type), String(#m_proxy_name)); \
+ itype.cs_in_expr = "&%0"; \
+ itype.cs_in_expr_is_unsafe = true; \
+ builtin_types.insert(itype.cname, itype); \
+ }
+
+ INSERT_STRUCT_TYPE(Vector2, Vector2)
+ INSERT_STRUCT_TYPE(Vector2i, Vector2I)
+ INSERT_STRUCT_TYPE(Rect2, Rect2)
+ INSERT_STRUCT_TYPE(Rect2i, Rect2I)
+ INSERT_STRUCT_TYPE(Transform2D, Transform2D)
+ INSERT_STRUCT_TYPE(Vector3, Vector3)
+ INSERT_STRUCT_TYPE(Vector3i, Vector3I)
+ INSERT_STRUCT_TYPE(Basis, Basis)
+ INSERT_STRUCT_TYPE(Quaternion, Quaternion)
+ INSERT_STRUCT_TYPE(Transform3D, Transform3D)
+ INSERT_STRUCT_TYPE(AABB, Aabb)
+ INSERT_STRUCT_TYPE(Color, Color)
+ INSERT_STRUCT_TYPE(Plane, Plane)
+ INSERT_STRUCT_TYPE(Vector4, Vector4)
+ INSERT_STRUCT_TYPE(Vector4i, Vector4I)
+ INSERT_STRUCT_TYPE(Projection, Projection)
#undef INSERT_STRUCT_TYPE
@@ -3588,7 +3607,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
itype = TypeInterface();
itype.name = "RID";
itype.cname = itype.name;
- itype.proxy_name = "RID";
+ itype.proxy_name = "Rid";
itype.cs_type = itype.proxy_name;
itype.c_arg_in = "&%s";
itype.c_type = itype.cs_type;
@@ -3802,7 +3821,7 @@ void BindingsGenerator::_populate_global_constants() {
enum_itype.is_enum = true;
enum_itype.name = ienum.cname.operator String();
enum_itype.cname = ienum.cname;
- enum_itype.proxy_name = enum_itype.name;
+ enum_itype.proxy_name = pascal_to_pascal_case(enum_itype.name);
TypeInterface::postsetup_enum_type(enum_itype);
enum_types.insert(enum_itype.cname, enum_itype);
@@ -3824,9 +3843,9 @@ void BindingsGenerator::_populate_global_constants() {
// HARDCODED
List<StringName> hardcoded_enums;
hardcoded_enums.push_back("Vector2.Axis");
- hardcoded_enums.push_back("Vector2i.Axis");
+ hardcoded_enums.push_back("Vector2I.Axis");
hardcoded_enums.push_back("Vector3.Axis");
- hardcoded_enums.push_back("Vector3i.Axis");
+ hardcoded_enums.push_back("Vector3I.Axis");
for (const StringName &enum_cname : hardcoded_enums) {
// These enums are not generated and must be written manually (e.g.: Vector3.Axis)
// Here, we assume core types do not begin with underscore
@@ -3834,7 +3853,7 @@ void BindingsGenerator::_populate_global_constants() {
enum_itype.is_enum = true;
enum_itype.name = enum_cname.operator String();
enum_itype.cname = enum_cname;
- enum_itype.proxy_name = enum_itype.name;
+ enum_itype.proxy_name = pascal_to_pascal_case(enum_itype.name);
TypeInterface::postsetup_enum_type(enum_itype);
enum_types.insert(enum_itype.cname, enum_itype);
}
diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h
index cef8246032..5c266ed31f 100644
--- a/modules/mono/editor/bindings_generator.h
+++ b/modules/mono/editor/bindings_generator.h
@@ -472,43 +472,88 @@ class BindingsGenerator {
}
private:
+ static DocData::ClassDoc *_get_type_doc(TypeInterface &itype) {
+ String doc_name = itype.name.begins_with("_") ? itype.name.substr(1) : itype.name;
+ return &EditorHelp::get_doc_data()->class_list[doc_name];
+ }
+
static void _init_value_type(TypeInterface &itype) {
- itype.proxy_name = itype.name;
+ if (itype.proxy_name.is_empty()) {
+ itype.proxy_name = itype.name;
+ }
- itype.c_type = itype.name;
itype.cs_type = itype.proxy_name;
- itype.c_type_in = itype.proxy_name + "*";
- itype.c_type_out = itype.proxy_name;
- itype.class_doc = &EditorHelp::get_doc_data()->class_list[itype.proxy_name];
+ itype.c_type = itype.cs_type;
+ itype.c_type_in = itype.cs_type + "*";
+ itype.c_type_out = itype.cs_type;
+
+ itype.class_doc = _get_type_doc(itype);
+ }
+
+ static void _init_object_type(TypeInterface &itype, ClassDB::APIType p_api_type) {
+ if (itype.proxy_name.is_empty()) {
+ itype.proxy_name = itype.name;
+ }
+
+ if (itype.proxy_name.begins_with("_")) {
+ itype.proxy_name = itype.proxy_name.substr(1);
+ }
+
+ itype.api_type = p_api_type;
+ itype.is_object_type = true;
+
+ itype.class_doc = _get_type_doc(itype);
}
public:
- static TypeInterface create_value_type(const String &p_name) {
+ static TypeInterface create_value_type(const String &p_name, const String &p_proxy_name) {
TypeInterface itype;
itype.name = p_name;
- itype.cname = StringName(p_name);
+ itype.cname = p_name;
+ itype.proxy_name = p_proxy_name;
_init_value_type(itype);
return itype;
}
- static TypeInterface create_value_type(const StringName &p_name) {
+ static TypeInterface create_value_type(const StringName &p_cname, const String &p_proxy_name) {
TypeInterface itype;
- itype.name = p_name.operator String();
+ itype.name = p_cname;
+ itype.cname = p_cname;
+ itype.proxy_name = p_proxy_name;
+ _init_value_type(itype);
+ return itype;
+ }
+
+ static TypeInterface create_value_type(const String &p_name) {
+ TypeInterface itype;
+ itype.name = p_name;
itype.cname = p_name;
_init_value_type(itype);
return itype;
}
- static TypeInterface create_object_type(const StringName &p_cname, ClassDB::APIType p_api_type) {
+ static TypeInterface create_value_type(const StringName &p_cname) {
TypeInterface itype;
+ itype.name = p_cname;
+ itype.cname = p_cname;
+ _init_value_type(itype);
+ return itype;
+ }
+ static TypeInterface create_object_type(const StringName &p_cname, const String &p_proxy_name, ClassDB::APIType p_api_type) {
+ TypeInterface itype;
itype.name = p_cname;
itype.cname = p_cname;
- itype.proxy_name = itype.name.begins_with("_") ? itype.name.substr(1, itype.name.length()) : itype.name;
- itype.api_type = p_api_type;
- itype.is_object_type = true;
- itype.class_doc = &EditorHelp::get_doc_data()->class_list[itype.proxy_name];
+ itype.proxy_name = p_proxy_name;
+ _init_object_type(itype, p_api_type);
+ return itype;
+ }
+ static TypeInterface create_object_type(const StringName &p_cname, ClassDB::APIType p_api_type) {
+ TypeInterface itype;
+ itype.name = p_cname;
+ itype.cname = p_cname;
+ _init_object_type(itype, p_api_type);
return itype;
}
diff --git a/modules/mono/editor/script_templates/CharacterBody2D/basic_movement.cs b/modules/mono/editor/script_templates/CharacterBody2D/basic_movement.cs
index fbad482cf6..87468fb433 100644
--- a/modules/mono/editor/script_templates/CharacterBody2D/basic_movement.cs
+++ b/modules/mono/editor/script_templates/CharacterBody2D/basic_movement.cs
@@ -17,22 +17,22 @@ public partial class _CLASS_ : _BASE_
// Add the gravity.
if (!IsOnFloor())
- velocity.y += gravity * (float)delta;
+ velocity.Y += gravity * (float)delta;
// Handle Jump.
if (Input.IsActionJustPressed("ui_accept") && IsOnFloor())
- velocity.y = JumpVelocity;
+ velocity.Y = JumpVelocity;
// Get the input direction and handle the movement/deceleration.
// As good practice, you should replace UI actions with custom gameplay actions.
Vector2 direction = Input.GetVector("ui_left", "ui_right", "ui_up", "ui_down");
if (direction != Vector2.Zero)
{
- velocity.x = direction.x * Speed;
+ velocity.X = direction.X * Speed;
}
else
{
- velocity.x = Mathf.MoveToward(Velocity.x, 0, Speed);
+ velocity.X = Mathf.MoveToward(Velocity.X, 0, Speed);
}
Velocity = velocity;
diff --git a/modules/mono/editor/script_templates/CharacterBody3D/basic_movement.cs b/modules/mono/editor/script_templates/CharacterBody3D/basic_movement.cs
index abed246a1e..ddeb9d7e00 100644
--- a/modules/mono/editor/script_templates/CharacterBody3D/basic_movement.cs
+++ b/modules/mono/editor/script_templates/CharacterBody3D/basic_movement.cs
@@ -17,25 +17,25 @@ public partial class _CLASS_ : _BASE_
// Add the gravity.
if (!IsOnFloor())
- velocity.y -= gravity * (float)delta;
+ velocity.Y -= gravity * (float)delta;
// Handle Jump.
if (Input.IsActionJustPressed("ui_accept") && IsOnFloor())
- velocity.y = JumpVelocity;
+ velocity.Y = JumpVelocity;
// Get the input direction and handle the movement/deceleration.
// As good practice, you should replace UI actions with custom gameplay actions.
Vector2 inputDir = Input.GetVector("ui_left", "ui_right", "ui_up", "ui_down");
- Vector3 direction = (Transform.basis * new Vector3(inputDir.x, 0, inputDir.y)).Normalized();
+ Vector3 direction = (Transform.Basis * new Vector3(inputDir.X, 0, inputDir.Y)).Normalized();
if (direction != Vector3.Zero)
{
- velocity.x = direction.x * Speed;
- velocity.z = direction.z * Speed;
+ velocity.X = direction.X * Speed;
+ velocity.Z = direction.Z * Speed;
}
else
{
- velocity.x = Mathf.MoveToward(Velocity.x, 0, Speed);
- velocity.z = Mathf.MoveToward(Velocity.z, 0, Speed);
+ velocity.X = Mathf.MoveToward(Velocity.X, 0, Speed);
+ velocity.Z = Mathf.MoveToward(Velocity.Z, 0, Speed);
}
Velocity = velocity;
diff --git a/modules/mono/editor/script_templates/EditorScenePostImport/basic_import_script.cs b/modules/mono/editor/script_templates/EditorScenePostImport/basic_import_script.cs
index 9e1b7ef580..fa2ff30a09 100644
--- a/modules/mono/editor/script_templates/EditorScenePostImport/basic_import_script.cs
+++ b/modules/mono/editor/script_templates/EditorScenePostImport/basic_import_script.cs
@@ -7,7 +7,7 @@ using System;
[Tool]
public partial class _CLASS_ : _BASE_
{
- public override Godot.Object _PostImport(Node scene)
+ public override GodotObject _PostImport(Node scene)
{
// Modify the contents of the scene upon import.
return scene; // Return the modified root node when you're done.
diff --git a/modules/mono/editor/script_templates/EditorScenePostImport/no_comments.cs b/modules/mono/editor/script_templates/EditorScenePostImport/no_comments.cs
index bf2c9434e4..4365ba5a04 100644
--- a/modules/mono/editor/script_templates/EditorScenePostImport/no_comments.cs
+++ b/modules/mono/editor/script_templates/EditorScenePostImport/no_comments.cs
@@ -7,7 +7,7 @@ using System;
[Tool]
public partial class _CLASS_ : _BASE_
{
- public override Godot.Object _PostImport(Node scene)
+ public override GodotObject _PostImport(Node scene)
{
return scene;
}
diff --git a/modules/mono/glue/GodotSharp/GodotPlugins/GodotPlugins.csproj b/modules/mono/glue/GodotSharp/GodotPlugins/GodotPlugins.csproj
index e720d3878c..e58d730ee3 100644
--- a/modules/mono/glue/GodotSharp/GodotPlugins/GodotPlugins.csproj
+++ b/modules/mono/glue/GodotSharp/GodotPlugins/GodotPlugins.csproj
@@ -8,6 +8,7 @@
<!-- To generate the .runtimeconfig.json file-->
<EnableDynamicLoading>true</EnableDynamicLoading>
+ <RollForward>LatestMajor</RollForward>
</PropertyGroup>
<ItemGroup>
diff --git a/modules/mono/glue/GodotSharp/GodotPlugins/Main.cs b/modules/mono/glue/GodotSharp/GodotPlugins/Main.cs
index 4ce02d221e..2a72b7c53e 100644
--- a/modules/mono/glue/GodotSharp/GodotPlugins/Main.cs
+++ b/modules/mono/glue/GodotSharp/GodotPlugins/Main.cs
@@ -65,7 +65,7 @@ namespace GodotPlugins
}
private static readonly List<AssemblyName> SharedAssemblies = new();
- private static readonly Assembly CoreApiAssembly = typeof(Godot.Object).Assembly;
+ private static readonly Assembly CoreApiAssembly = typeof(global::Godot.GodotObject).Assembly;
private static Assembly? _editorApiAssembly;
private static PluginLoadContextWrapper? _projectLoadContext;
private static bool _editorHint = false;
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs
index 0e46b63b59..af83cc24bf 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs
@@ -9,7 +9,7 @@ namespace Godot
/// </summary>
[Serializable]
[StructLayout(LayoutKind.Sequential)]
- public struct AABB : IEquatable<AABB>
+ public struct Aabb : IEquatable<Aabb>
{
private Vector3 _position;
private Vector3 _size;
@@ -50,19 +50,28 @@ namespace Godot
}
/// <summary>
- /// Returns an <see cref="AABB"/> with equivalent position and size, modified so that
+ /// The volume of this <see cref="Aabb"/>.
+ /// See also <see cref="HasVolume"/>.
+ /// </summary>
+ public readonly real_t Volume
+ {
+ get { return _size.X * _size.Y * _size.Z; }
+ }
+
+ /// <summary>
+ /// Returns an <see cref="Aabb"/> with equivalent position and size, modified so that
/// the most-negative corner is the origin and the size is positive.
/// </summary>
- /// <returns>The modified <see cref="AABB"/>.</returns>
- public readonly AABB Abs()
+ /// <returns>The modified <see cref="Aabb"/>.</returns>
+ public readonly Aabb Abs()
{
Vector3 end = End;
- Vector3 topLeft = new Vector3(Mathf.Min(_position.x, end.x), Mathf.Min(_position.y, end.y), Mathf.Min(_position.z, end.z));
- return new AABB(topLeft, _size.Abs());
+ Vector3 topLeft = new Vector3(Mathf.Min(_position.X, end.X), Mathf.Min(_position.Y, end.Y), Mathf.Min(_position.Z, end.Z));
+ return new Aabb(topLeft, _size.Abs());
}
/// <summary>
- /// Returns the center of the <see cref="AABB"/>, which is equal
+ /// Returns the center of the <see cref="Aabb"/>, which is equal
/// to <see cref="Position"/> + (<see cref="Size"/> / 2).
/// </summary>
/// <returns>The center.</returns>
@@ -72,94 +81,94 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if this <see cref="AABB"/> completely encloses another one.
+ /// Returns <see langword="true"/> if this <see cref="Aabb"/> completely encloses another one.
/// </summary>
- /// <param name="with">The other <see cref="AABB"/> that may be enclosed.</param>
+ /// <param name="with">The other <see cref="Aabb"/> that may be enclosed.</param>
/// <returns>
- /// A <see langword="bool"/> for whether or not this <see cref="AABB"/> encloses <paramref name="with"/>.
+ /// A <see langword="bool"/> for whether or not this <see cref="Aabb"/> encloses <paramref name="with"/>.
/// </returns>
- public readonly bool Encloses(AABB with)
+ public readonly bool Encloses(Aabb with)
{
Vector3 srcMin = _position;
Vector3 srcMax = _position + _size;
Vector3 dstMin = with._position;
Vector3 dstMax = with._position + with._size;
- return srcMin.x <= dstMin.x &&
- srcMax.x > dstMax.x &&
- srcMin.y <= dstMin.y &&
- srcMax.y > dstMax.y &&
- srcMin.z <= dstMin.z &&
- srcMax.z > dstMax.z;
+ return srcMin.X <= dstMin.X &&
+ srcMax.X > dstMax.X &&
+ srcMin.Y <= dstMin.Y &&
+ srcMax.Y > dstMax.Y &&
+ srcMin.Z <= dstMin.Z &&
+ srcMax.Z > dstMax.Z;
}
/// <summary>
- /// Returns this <see cref="AABB"/> expanded to include a given point.
+ /// Returns this <see cref="Aabb"/> expanded to include a given point.
/// </summary>
/// <param name="point">The point to include.</param>
- /// <returns>The expanded <see cref="AABB"/>.</returns>
- public readonly AABB Expand(Vector3 point)
+ /// <returns>The expanded <see cref="Aabb"/>.</returns>
+ public readonly Aabb Expand(Vector3 point)
{
Vector3 begin = _position;
Vector3 end = _position + _size;
- if (point.x < begin.x)
+ if (point.X < begin.X)
{
- begin.x = point.x;
+ begin.X = point.X;
}
- if (point.y < begin.y)
+ if (point.Y < begin.Y)
{
- begin.y = point.y;
+ begin.Y = point.Y;
}
- if (point.z < begin.z)
+ if (point.Z < begin.Z)
{
- begin.z = point.z;
+ begin.Z = point.Z;
}
- if (point.x > end.x)
+ if (point.X > end.X)
{
- end.x = point.x;
+ end.X = point.X;
}
- if (point.y > end.y)
+ if (point.Y > end.Y)
{
- end.y = point.y;
+ end.Y = point.Y;
}
- if (point.z > end.z)
+ if (point.Z > end.Z)
{
- end.z = point.z;
+ end.Z = point.Z;
}
- return new AABB(begin, end - begin);
+ return new Aabb(begin, end - begin);
}
/// <summary>
- /// Gets the position of one of the 8 endpoints of the <see cref="AABB"/>.
+ /// Gets the position of one of the 8 endpoints of the <see cref="Aabb"/>.
/// </summary>
/// <param name="idx">Which endpoint to get.</param>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="idx"/> is less than 0 or greater than 7.
/// </exception>
- /// <returns>An endpoint of the <see cref="AABB"/>.</returns>
+ /// <returns>An endpoint of the <see cref="Aabb"/>.</returns>
public readonly Vector3 GetEndpoint(int idx)
{
switch (idx)
{
case 0:
- return new Vector3(_position.x, _position.y, _position.z);
+ return new Vector3(_position.X, _position.Y, _position.Z);
case 1:
- return new Vector3(_position.x, _position.y, _position.z + _size.z);
+ return new Vector3(_position.X, _position.Y, _position.Z + _size.Z);
case 2:
- return new Vector3(_position.x, _position.y + _size.y, _position.z);
+ return new Vector3(_position.X, _position.Y + _size.Y, _position.Z);
case 3:
- return new Vector3(_position.x, _position.y + _size.y, _position.z + _size.z);
+ return new Vector3(_position.X, _position.Y + _size.Y, _position.Z + _size.Z);
case 4:
- return new Vector3(_position.x + _size.x, _position.y, _position.z);
+ return new Vector3(_position.X + _size.X, _position.Y, _position.Z);
case 5:
- return new Vector3(_position.x + _size.x, _position.y, _position.z + _size.z);
+ return new Vector3(_position.X + _size.X, _position.Y, _position.Z + _size.Z);
case 6:
- return new Vector3(_position.x + _size.x, _position.y + _size.y, _position.z);
+ return new Vector3(_position.X + _size.X, _position.Y + _size.Y, _position.Z);
case 7:
- return new Vector3(_position.x + _size.x, _position.y + _size.y, _position.z + _size.z);
+ return new Vector3(_position.X + _size.X, _position.Y + _size.Y, _position.Z + _size.Z);
default:
{
throw new ArgumentOutOfRangeException(nameof(idx),
@@ -169,21 +178,21 @@ namespace Godot
}
/// <summary>
- /// Returns the normalized longest axis of the <see cref="AABB"/>.
+ /// Returns the normalized longest axis of the <see cref="Aabb"/>.
/// </summary>
- /// <returns>A vector representing the normalized longest axis of the <see cref="AABB"/>.</returns>
+ /// <returns>A vector representing the normalized longest axis of the <see cref="Aabb"/>.</returns>
public readonly Vector3 GetLongestAxis()
{
var axis = new Vector3(1f, 0f, 0f);
- real_t maxSize = _size.x;
+ real_t maxSize = _size.X;
- if (_size.y > maxSize)
+ if (_size.Y > maxSize)
{
axis = new Vector3(0f, 1f, 0f);
- maxSize = _size.y;
+ maxSize = _size.Y;
}
- if (_size.z > maxSize)
+ if (_size.Z > maxSize)
{
axis = new Vector3(0f, 0f, 1f);
}
@@ -192,21 +201,21 @@ namespace Godot
}
/// <summary>
- /// Returns the <see cref="Vector3.Axis"/> index of the longest axis of the <see cref="AABB"/>.
+ /// Returns the <see cref="Vector3.Axis"/> index of the longest axis of the <see cref="Aabb"/>.
/// </summary>
/// <returns>A <see cref="Vector3.Axis"/> index for which axis is longest.</returns>
public readonly Vector3.Axis GetLongestAxisIndex()
{
var axis = Vector3.Axis.X;
- real_t maxSize = _size.x;
+ real_t maxSize = _size.X;
- if (_size.y > maxSize)
+ if (_size.Y > maxSize)
{
axis = Vector3.Axis.Y;
- maxSize = _size.y;
+ maxSize = _size.Y;
}
- if (_size.z > maxSize)
+ if (_size.Z > maxSize)
{
axis = Vector3.Axis.Z;
}
@@ -215,38 +224,38 @@ namespace Godot
}
/// <summary>
- /// Returns the scalar length of the longest axis of the <see cref="AABB"/>.
+ /// Returns the scalar length of the longest axis of the <see cref="Aabb"/>.
/// </summary>
- /// <returns>The scalar length of the longest axis of the <see cref="AABB"/>.</returns>
+ /// <returns>The scalar length of the longest axis of the <see cref="Aabb"/>.</returns>
public readonly real_t GetLongestAxisSize()
{
- real_t maxSize = _size.x;
+ real_t maxSize = _size.X;
- if (_size.y > maxSize)
- maxSize = _size.y;
+ if (_size.Y > maxSize)
+ maxSize = _size.Y;
- if (_size.z > maxSize)
- maxSize = _size.z;
+ if (_size.Z > maxSize)
+ maxSize = _size.Z;
return maxSize;
}
/// <summary>
- /// Returns the normalized shortest axis of the <see cref="AABB"/>.
+ /// Returns the normalized shortest axis of the <see cref="Aabb"/>.
/// </summary>
- /// <returns>A vector representing the normalized shortest axis of the <see cref="AABB"/>.</returns>
+ /// <returns>A vector representing the normalized shortest axis of the <see cref="Aabb"/>.</returns>
public readonly Vector3 GetShortestAxis()
{
var axis = new Vector3(1f, 0f, 0f);
- real_t maxSize = _size.x;
+ real_t maxSize = _size.X;
- if (_size.y < maxSize)
+ if (_size.Y < maxSize)
{
axis = new Vector3(0f, 1f, 0f);
- maxSize = _size.y;
+ maxSize = _size.Y;
}
- if (_size.z < maxSize)
+ if (_size.Z < maxSize)
{
axis = new Vector3(0f, 0f, 1f);
}
@@ -255,21 +264,21 @@ namespace Godot
}
/// <summary>
- /// Returns the <see cref="Vector3.Axis"/> index of the shortest axis of the <see cref="AABB"/>.
+ /// Returns the <see cref="Vector3.Axis"/> index of the shortest axis of the <see cref="Aabb"/>.
/// </summary>
/// <returns>A <see cref="Vector3.Axis"/> index for which axis is shortest.</returns>
public readonly Vector3.Axis GetShortestAxisIndex()
{
var axis = Vector3.Axis.X;
- real_t maxSize = _size.x;
+ real_t maxSize = _size.X;
- if (_size.y < maxSize)
+ if (_size.Y < maxSize)
{
axis = Vector3.Axis.Y;
- maxSize = _size.y;
+ maxSize = _size.Y;
}
- if (_size.z < maxSize)
+ if (_size.Z < maxSize)
{
axis = Vector3.Axis.Z;
}
@@ -278,18 +287,18 @@ namespace Godot
}
/// <summary>
- /// Returns the scalar length of the shortest axis of the <see cref="AABB"/>.
+ /// Returns the scalar length of the shortest axis of the <see cref="Aabb"/>.
/// </summary>
- /// <returns>The scalar length of the shortest axis of the <see cref="AABB"/>.</returns>
+ /// <returns>The scalar length of the shortest axis of the <see cref="Aabb"/>.</returns>
public readonly real_t GetShortestAxisSize()
{
- real_t maxSize = _size.x;
+ real_t maxSize = _size.X;
- if (_size.y < maxSize)
- maxSize = _size.y;
+ if (_size.Y < maxSize)
+ maxSize = _size.Y;
- if (_size.z < maxSize)
- maxSize = _size.z;
+ if (_size.Z < maxSize)
+ maxSize = _size.Z;
return maxSize;
}
@@ -306,99 +315,90 @@ namespace Godot
Vector3 ofs = _position + halfExtents;
return ofs + new Vector3(
- dir.x > 0f ? -halfExtents.x : halfExtents.x,
- dir.y > 0f ? -halfExtents.y : halfExtents.y,
- dir.z > 0f ? -halfExtents.z : halfExtents.z);
- }
-
- /// <summary>
- /// Returns the volume of the <see cref="AABB"/>.
- /// </summary>
- /// <returns>The volume.</returns>
- public readonly real_t GetVolume()
- {
- return _size.x * _size.y * _size.z;
+ dir.X > 0f ? -halfExtents.X : halfExtents.X,
+ dir.Y > 0f ? -halfExtents.Y : halfExtents.Y,
+ dir.Z > 0f ? -halfExtents.Z : halfExtents.Z);
}
/// <summary>
- /// Returns a copy of the <see cref="AABB"/> grown a given amount of units towards all the sides.
+ /// Returns a copy of the <see cref="Aabb"/> grown a given amount of units towards all the sides.
/// </summary>
/// <param name="by">The amount to grow by.</param>
- /// <returns>The grown <see cref="AABB"/>.</returns>
- public readonly AABB Grow(real_t by)
+ /// <returns>The grown <see cref="Aabb"/>.</returns>
+ public readonly Aabb Grow(real_t by)
{
- AABB res = this;
+ Aabb res = this;
- res._position.x -= by;
- res._position.y -= by;
- res._position.z -= by;
- res._size.x += 2.0f * by;
- res._size.y += 2.0f * by;
- res._size.z += 2.0f * by;
+ res._position.X -= by;
+ res._position.Y -= by;
+ res._position.Z -= by;
+ res._size.X += 2.0f * by;
+ res._size.Y += 2.0f * by;
+ res._size.Z += 2.0f * by;
return res;
}
/// <summary>
- /// Returns <see langword="true"/> if the <see cref="AABB"/> contains a point,
+ /// Returns <see langword="true"/> if the <see cref="Aabb"/> contains a point,
/// or <see langword="false"/> otherwise.
/// </summary>
/// <param name="point">The point to check.</param>
/// <returns>
- /// A <see langword="bool"/> for whether or not the <see cref="AABB"/> contains <paramref name="point"/>.
+ /// A <see langword="bool"/> for whether or not the <see cref="Aabb"/> contains <paramref name="point"/>.
/// </returns>
public readonly bool HasPoint(Vector3 point)
{
- if (point.x < _position.x)
+ if (point.X < _position.X)
return false;
- if (point.y < _position.y)
+ if (point.Y < _position.Y)
return false;
- if (point.z < _position.z)
+ if (point.Z < _position.Z)
return false;
- if (point.x > _position.x + _size.x)
+ if (point.X > _position.X + _size.X)
return false;
- if (point.y > _position.y + _size.y)
+ if (point.Y > _position.Y + _size.Y)
return false;
- if (point.z > _position.z + _size.z)
+ if (point.Z > _position.Z + _size.Z)
return false;
return true;
}
/// <summary>
- /// Returns <see langword="true"/> if the <see cref="AABB"/>
+ /// Returns <see langword="true"/> if the <see cref="Aabb"/>
/// has a surface or a length, and <see langword="false"/>
- /// if the <see cref="AABB"/> is empty (all components
+ /// if the <see cref="Aabb"/> is empty (all components
/// of <see cref="Size"/> are zero or negative).
/// </summary>
/// <returns>
- /// A <see langword="bool"/> for whether or not the <see cref="AABB"/> has surface.
+ /// A <see langword="bool"/> for whether or not the <see cref="Aabb"/> has surface.
/// </returns>
public readonly bool HasSurface()
{
- return _size.x > 0.0f || _size.y > 0.0f || _size.z > 0.0f;
+ return _size.X > 0.0f || _size.Y > 0.0f || _size.Z > 0.0f;
}
/// <summary>
- /// Returns <see langword="true"/> if the <see cref="AABB"/> has
- /// area, and <see langword="false"/> if the <see cref="AABB"/>
+ /// Returns <see langword="true"/> if the <see cref="Aabb"/> has
+ /// area, and <see langword="false"/> if the <see cref="Aabb"/>
/// is linear, empty, or has a negative <see cref="Size"/>.
- /// See also <see cref="GetVolume"/>.
+ /// See also <see cref="Volume"/>.
/// </summary>
/// <returns>
- /// A <see langword="bool"/> for whether or not the <see cref="AABB"/> has volume.
+ /// A <see langword="bool"/> for whether or not the <see cref="Aabb"/> has volume.
/// </returns>
public readonly bool HasVolume()
{
- return _size.x > 0.0f && _size.y > 0.0f && _size.z > 0.0f;
+ return _size.X > 0.0f && _size.Y > 0.0f && _size.Z > 0.0f;
}
/// <summary>
- /// Returns the intersection of this <see cref="AABB"/> and <paramref name="with"/>.
+ /// Returns the intersection of this <see cref="Aabb"/> and <paramref name="with"/>.
/// </summary>
- /// <param name="with">The other <see cref="AABB"/>.</param>
- /// <returns>The clipped <see cref="AABB"/>.</returns>
- public readonly AABB Intersection(AABB with)
+ /// <param name="with">The other <see cref="Aabb"/>.</param>
+ /// <returns>The clipped <see cref="Aabb"/>.</returns>
+ public readonly Aabb Intersection(Aabb with)
{
Vector3 srcMin = _position;
Vector3 srcMax = _position + _size;
@@ -407,78 +407,78 @@ namespace Godot
Vector3 min, max;
- if (srcMin.x > dstMax.x || srcMax.x < dstMin.x)
+ if (srcMin.X > dstMax.X || srcMax.X < dstMin.X)
{
- return new AABB();
+ return new Aabb();
}
- min.x = srcMin.x > dstMin.x ? srcMin.x : dstMin.x;
- max.x = srcMax.x < dstMax.x ? srcMax.x : dstMax.x;
+ min.X = srcMin.X > dstMin.X ? srcMin.X : dstMin.X;
+ max.X = srcMax.X < dstMax.X ? srcMax.X : dstMax.X;
- if (srcMin.y > dstMax.y || srcMax.y < dstMin.y)
+ if (srcMin.Y > dstMax.Y || srcMax.Y < dstMin.Y)
{
- return new AABB();
+ return new Aabb();
}
- min.y = srcMin.y > dstMin.y ? srcMin.y : dstMin.y;
- max.y = srcMax.y < dstMax.y ? srcMax.y : dstMax.y;
+ min.Y = srcMin.Y > dstMin.Y ? srcMin.Y : dstMin.Y;
+ max.Y = srcMax.Y < dstMax.Y ? srcMax.Y : dstMax.Y;
- if (srcMin.z > dstMax.z || srcMax.z < dstMin.z)
+ if (srcMin.Z > dstMax.Z || srcMax.Z < dstMin.Z)
{
- return new AABB();
+ return new Aabb();
}
- min.z = srcMin.z > dstMin.z ? srcMin.z : dstMin.z;
- max.z = srcMax.z < dstMax.z ? srcMax.z : dstMax.z;
+ min.Z = srcMin.Z > dstMin.Z ? srcMin.Z : dstMin.Z;
+ max.Z = srcMax.Z < dstMax.Z ? srcMax.Z : dstMax.Z;
- return new AABB(min, max - min);
+ return new Aabb(min, max - min);
}
/// <summary>
- /// Returns <see langword="true"/> if the <see cref="AABB"/> overlaps with <paramref name="with"/>
+ /// Returns <see langword="true"/> if the <see cref="Aabb"/> overlaps with <paramref name="with"/>
/// (i.e. they have at least one point in common).
/// </summary>
- /// <param name="with">The other <see cref="AABB"/> to check for intersections with.</param>
+ /// <param name="with">The other <see cref="Aabb"/> to check for intersections with.</param>
/// <returns>
/// A <see langword="bool"/> for whether or not they are intersecting.
/// </returns>
- public readonly bool Intersects(AABB with)
+ public readonly bool Intersects(Aabb with)
{
- if (_position.x >= with._position.x + with._size.x)
+ if (_position.X >= with._position.X + with._size.X)
return false;
- if (_position.x + _size.x <= with._position.x)
+ if (_position.X + _size.X <= with._position.X)
return false;
- if (_position.y >= with._position.y + with._size.y)
+ if (_position.Y >= with._position.Y + with._size.Y)
return false;
- if (_position.y + _size.y <= with._position.y)
+ if (_position.Y + _size.Y <= with._position.Y)
return false;
- if (_position.z >= with._position.z + with._size.z)
+ if (_position.Z >= with._position.Z + with._size.Z)
return false;
- if (_position.z + _size.z <= with._position.z)
+ if (_position.Z + _size.Z <= with._position.Z)
return false;
return true;
}
/// <summary>
- /// Returns <see langword="true"/> if the <see cref="AABB"/> is on both sides of <paramref name="plane"/>.
+ /// Returns <see langword="true"/> if the <see cref="Aabb"/> is on both sides of <paramref name="plane"/>.
/// </summary>
/// <param name="plane">The <see cref="Plane"/> to check for intersection.</param>
/// <returns>
- /// A <see langword="bool"/> for whether or not the <see cref="AABB"/> intersects the <see cref="Plane"/>.
+ /// A <see langword="bool"/> for whether or not the <see cref="Aabb"/> intersects the <see cref="Plane"/>.
/// </returns>
public readonly bool IntersectsPlane(Plane plane)
{
Vector3[] points =
{
- new Vector3(_position.x, _position.y, _position.z),
- new Vector3(_position.x, _position.y, _position.z + _size.z),
- new Vector3(_position.x, _position.y + _size.y, _position.z),
- new Vector3(_position.x, _position.y + _size.y, _position.z + _size.z),
- new Vector3(_position.x + _size.x, _position.y, _position.z),
- new Vector3(_position.x + _size.x, _position.y, _position.z + _size.z),
- new Vector3(_position.x + _size.x, _position.y + _size.y, _position.z),
- new Vector3(_position.x + _size.x, _position.y + _size.y, _position.z + _size.z)
+ new Vector3(_position.X, _position.Y, _position.Z),
+ new Vector3(_position.X, _position.Y, _position.Z + _size.Z),
+ new Vector3(_position.X, _position.Y + _size.Y, _position.Z),
+ new Vector3(_position.X, _position.Y + _size.Y, _position.Z + _size.Z),
+ new Vector3(_position.X + _size.X, _position.Y, _position.Z),
+ new Vector3(_position.X + _size.X, _position.Y, _position.Z + _size.Z),
+ new Vector3(_position.X + _size.X, _position.Y + _size.Y, _position.Z),
+ new Vector3(_position.X + _size.X, _position.Y + _size.Y, _position.Z + _size.Z)
};
bool over = false;
@@ -500,13 +500,13 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if the <see cref="AABB"/> intersects
+ /// Returns <see langword="true"/> if the <see cref="Aabb"/> intersects
/// the line segment between <paramref name="from"/> and <paramref name="to"/>.
/// </summary>
/// <param name="from">The start of the line segment.</param>
/// <param name="to">The end of the line segment.</param>
/// <returns>
- /// A <see langword="bool"/> for whether or not the <see cref="AABB"/> intersects the line segment.
+ /// A <see langword="bool"/> for whether or not the <see cref="Aabb"/> intersects the line segment.
/// </returns>
public readonly bool IntersectsSegment(Vector3 from, Vector3 to)
{
@@ -563,7 +563,7 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if this <see cref="AABB"/> is finite, by calling
+ /// Returns <see langword="true"/> if this <see cref="Aabb"/> is finite, by calling
/// <see cref="Mathf.IsFinite"/> on each component.
/// </summary>
/// <returns>Whether this vector is finite or not.</returns>
@@ -573,73 +573,73 @@ namespace Godot
}
/// <summary>
- /// Returns a larger <see cref="AABB"/> that contains this <see cref="AABB"/> and <paramref name="with"/>.
+ /// Returns a larger <see cref="Aabb"/> that contains this <see cref="Aabb"/> and <paramref name="with"/>.
/// </summary>
- /// <param name="with">The other <see cref="AABB"/>.</param>
- /// <returns>The merged <see cref="AABB"/>.</returns>
- public readonly AABB Merge(AABB with)
+ /// <param name="with">The other <see cref="Aabb"/>.</param>
+ /// <returns>The merged <see cref="Aabb"/>.</returns>
+ public readonly Aabb Merge(Aabb with)
{
Vector3 beg1 = _position;
Vector3 beg2 = with._position;
- var end1 = new Vector3(_size.x, _size.y, _size.z) + beg1;
- var end2 = new Vector3(with._size.x, with._size.y, with._size.z) + beg2;
+ var end1 = new Vector3(_size.X, _size.Y, _size.Z) + beg1;
+ var end2 = new Vector3(with._size.X, with._size.Y, with._size.Z) + beg2;
var min = new Vector3(
- beg1.x < beg2.x ? beg1.x : beg2.x,
- beg1.y < beg2.y ? beg1.y : beg2.y,
- beg1.z < beg2.z ? beg1.z : beg2.z
+ beg1.X < beg2.X ? beg1.X : beg2.X,
+ beg1.Y < beg2.Y ? beg1.Y : beg2.Y,
+ beg1.Z < beg2.Z ? beg1.Z : beg2.Z
);
var max = new Vector3(
- end1.x > end2.x ? end1.x : end2.x,
- end1.y > end2.y ? end1.y : end2.y,
- end1.z > end2.z ? end1.z : end2.z
+ end1.X > end2.X ? end1.X : end2.X,
+ end1.Y > end2.Y ? end1.Y : end2.Y,
+ end1.Z > end2.Z ? end1.Z : end2.Z
);
- return new AABB(min, max - min);
+ return new Aabb(min, max - min);
}
/// <summary>
- /// Constructs an <see cref="AABB"/> from a position and size.
+ /// Constructs an <see cref="Aabb"/> from a position and size.
/// </summary>
/// <param name="position">The position.</param>
/// <param name="size">The size, typically positive.</param>
- public AABB(Vector3 position, Vector3 size)
+ public Aabb(Vector3 position, Vector3 size)
{
_position = position;
_size = size;
}
/// <summary>
- /// Constructs an <see cref="AABB"/> from a <paramref name="position"/>,
+ /// Constructs an <see cref="Aabb"/> from a <paramref name="position"/>,
/// <paramref name="width"/>, <paramref name="height"/>, and <paramref name="depth"/>.
/// </summary>
/// <param name="position">The position.</param>
/// <param name="width">The width, typically positive.</param>
/// <param name="height">The height, typically positive.</param>
/// <param name="depth">The depth, typically positive.</param>
- public AABB(Vector3 position, real_t width, real_t height, real_t depth)
+ public Aabb(Vector3 position, real_t width, real_t height, real_t depth)
{
_position = position;
_size = new Vector3(width, height, depth);
}
/// <summary>
- /// Constructs an <see cref="AABB"/> from <paramref name="x"/>,
+ /// Constructs an <see cref="Aabb"/> from <paramref name="x"/>,
/// <paramref name="y"/>, <paramref name="z"/>, and <paramref name="size"/>.
/// </summary>
/// <param name="x">The position's X coordinate.</param>
/// <param name="y">The position's Y coordinate.</param>
/// <param name="z">The position's Z coordinate.</param>
/// <param name="size">The size, typically positive.</param>
- public AABB(real_t x, real_t y, real_t z, Vector3 size)
+ public Aabb(real_t x, real_t y, real_t z, Vector3 size)
{
_position = new Vector3(x, y, z);
_size = size;
}
/// <summary>
- /// Constructs an <see cref="AABB"/> from <paramref name="x"/>,
+ /// Constructs an <see cref="Aabb"/> from <paramref name="x"/>,
/// <paramref name="y"/>, <paramref name="z"/>, <paramref name="width"/>,
/// <paramref name="height"/>, and <paramref name="depth"/>.
/// </summary>
@@ -649,7 +649,7 @@ namespace Godot
/// <param name="width">The width, typically positive.</param>
/// <param name="height">The height, typically positive.</param>
/// <param name="depth">The depth, typically positive.</param>
- public AABB(real_t x, real_t y, real_t z, real_t width, real_t height, real_t depth)
+ 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);
@@ -663,7 +663,7 @@ namespace Godot
/// <param name="left">The left AABB.</param>
/// <param name="right">The right AABB.</param>
/// <returns>Whether or not the AABBs are exactly equal.</returns>
- public static bool operator ==(AABB left, AABB right)
+ public static bool operator ==(Aabb left, Aabb right)
{
return left.Equals(right);
}
@@ -676,7 +676,7 @@ namespace Godot
/// <param name="left">The left AABB.</param>
/// <param name="right">The right AABB.</param>
/// <returns>Whether or not the AABBs are not equal.</returns>
- public static bool operator !=(AABB left, AABB right)
+ public static bool operator !=(Aabb left, Aabb right)
{
return !left.Equals(right);
}
@@ -691,7 +691,7 @@ namespace Godot
/// <returns>Whether or not the AABB and the object are equal.</returns>
public override readonly bool Equals(object obj)
{
- return obj is AABB other && Equals(other);
+ return obj is Aabb other && Equals(other);
}
/// <summary>
@@ -701,7 +701,7 @@ namespace Godot
/// </summary>
/// <param name="other">The other AABB.</param>
/// <returns>Whether or not the AABBs are exactly equal.</returns>
- public readonly bool Equals(AABB other)
+ public readonly bool Equals(Aabb other)
{
return _position == other._position && _size == other._size;
}
@@ -712,13 +712,13 @@ namespace Godot
/// </summary>
/// <param name="other">The other AABB to compare.</param>
/// <returns>Whether or not the AABBs structures are approximately equal.</returns>
- public readonly bool IsEqualApprox(AABB other)
+ public readonly bool IsEqualApprox(Aabb other)
{
return _position.IsEqualApprox(other._position) && _size.IsEqualApprox(other._size);
}
/// <summary>
- /// Serves as the hash function for <see cref="AABB"/>.
+ /// Serves as the hash function for <see cref="Aabb"/>.
/// </summary>
/// <returns>A hash code for this AABB.</returns>
public override readonly int GetHashCode()
@@ -727,7 +727,7 @@ namespace Godot
}
/// <summary>
- /// Converts this <see cref="AABB"/> to a string.
+ /// Converts this <see cref="Aabb"/> to a string.
/// </summary>
/// <returns>A string representation of this AABB.</returns>
public override readonly string ToString()
@@ -736,7 +736,7 @@ namespace Godot
}
/// <summary>
- /// Converts this <see cref="AABB"/> to a string with the given <paramref name="format"/>.
+ /// Converts this <see cref="Aabb"/> to a string with the given <paramref name="format"/>.
/// </summary>
/// <returns>A string representation of this AABB.</returns>
public readonly string ToString(string format)
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs
index df306e5244..a61c5403b9 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs
@@ -99,7 +99,7 @@ namespace Godot.Collections
this[i] = array[i];
}
- public Array(Span<RID> array) : this()
+ public Array(Span<Rid> array) : this()
{
if (array == null)
throw new ArgumentNullException(nameof(array));
@@ -120,7 +120,7 @@ namespace Godot.Collections
// fine as long as the array is not mutated. However, Span does this type checking at
// instantiation, so it's not possible to use it even when not mutating anything.
// ReSharper disable once RedundantNameQualifier
- public Array(ReadOnlySpan<Godot.Object> array) : this()
+ public Array(ReadOnlySpan<GodotObject> array) : this()
{
if (array == null)
throw new ArgumentNullException(nameof(array));
@@ -189,10 +189,15 @@ namespace Godot.Collections
/// <summary>
/// Resizes this <see cref="Array"/> to the given size.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The array is read-only.
+ /// </exception>
/// <param name="newSize">The new size of the array.</param>
/// <returns><see cref="Error.Ok"/> if successful, or an error code.</returns>
public Error Resize(int newSize)
{
+ ThrowIfReadOnly();
+
var self = (godot_array)NativeValue;
return NativeFuncs.godotsharp_array_resize(ref self, newSize);
}
@@ -200,8 +205,13 @@ namespace Godot.Collections
/// <summary>
/// Shuffles the contents of this <see cref="Array"/> into a random order.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The array is read-only.
+ /// </exception>
public void Shuffle()
{
+ ThrowIfReadOnly();
+
var self = (godot_array)NativeValue;
NativeFuncs.godotsharp_array_shuffle(ref self);
}
@@ -240,6 +250,9 @@ namespace Godot.Collections
/// <summary>
/// Returns the item at the given <paramref name="index"/>.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The property is assigned and the array is read-only.
+ /// </exception>
/// <value>The <see cref="Variant"/> item at the given <paramref name="index"/>.</value>
public unsafe Variant this[int index]
{
@@ -250,8 +263,11 @@ namespace Godot.Collections
}
set
{
+ ThrowIfReadOnly();
+
if (index < 0 || index >= Count)
throw new ArgumentOutOfRangeException(nameof(index));
+
var self = (godot_array)NativeValue;
godot_variant* ptrw = NativeFuncs.godotsharp_array_ptrw(ref self);
godot_variant* itemPtr = &ptrw[index];
@@ -264,9 +280,14 @@ namespace Godot.Collections
/// Adds an item to the end of this <see cref="Array"/>.
/// This is the same as <c>append</c> or <c>push_back</c> in GDScript.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The array is read-only.
+ /// </exception>
/// <param name="item">The <see cref="Variant"/> item to add.</param>
public void Add(Variant item)
{
+ ThrowIfReadOnly();
+
godot_variant variantValue = (godot_variant)item.NativeVar;
var self = (godot_array)NativeValue;
_ = NativeFuncs.godotsharp_array_add(ref self, variantValue);
@@ -282,6 +303,9 @@ namespace Godot.Collections
/// <summary>
/// Erases all items from this <see cref="Array"/>.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The array is read-only.
+ /// </exception>
public void Clear() => Resize(0);
/// <summary>
@@ -303,10 +327,15 @@ namespace Godot.Collections
/// or the position at the end of the array.
/// Existing items will be moved to the right.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The array is read-only.
+ /// </exception>
/// <param name="index">The index to insert at.</param>
/// <param name="item">The <see cref="Variant"/> item to insert.</param>
public void Insert(int index, Variant item)
{
+ ThrowIfReadOnly();
+
if (index < 0 || index > Count)
throw new ArgumentOutOfRangeException(nameof(index));
@@ -319,9 +348,14 @@ namespace Godot.Collections
/// Removes the first occurrence of the specified <paramref name="item"/>
/// from this <see cref="Array"/>.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The array is read-only.
+ /// </exception>
/// <param name="item">The value to remove.</param>
public bool Remove(Variant item)
{
+ ThrowIfReadOnly();
+
int index = IndexOf(item);
if (index >= 0)
{
@@ -335,9 +369,14 @@ namespace Godot.Collections
/// <summary>
/// Removes an element from this <see cref="Array"/> by index.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The array is read-only.
+ /// </exception>
/// <param name="index">The index of the element to remove.</param>
public void RemoveAt(int index)
{
+ ThrowIfReadOnly();
+
if (index < 0 || index > Count)
throw new ArgumentOutOfRangeException(nameof(index));
@@ -358,7 +397,28 @@ namespace Godot.Collections
object ICollection.SyncRoot => false;
- bool ICollection<Variant>.IsReadOnly => false;
+ /// <summary>
+ /// Returns <see langword="true"/> if the array is read-only.
+ /// See <see cref="MakeReadOnly"/>.
+ /// </summary>
+ public bool IsReadOnly => NativeValue.DangerousSelfRef.IsReadOnly;
+
+ /// <summary>
+ /// Makes the <see cref="Array"/> read-only, i.e. disabled modying of the
+ /// array's elements. Does not apply to nested content, e.g. content of
+ /// nested arrays.
+ /// </summary>
+ public void MakeReadOnly()
+ {
+ if (IsReadOnly)
+ {
+ // Avoid interop call when the array is already read-only.
+ return;
+ }
+
+ var self = (godot_array)NativeValue;
+ NativeFuncs.godotsharp_array_make_read_only(ref self);
+ }
/// <summary>
/// Copies the elements of this <see cref="Array"/> to the given
@@ -472,6 +532,14 @@ namespace Godot.Collections
{
elem = NativeValue.DangerousSelfRef.Elements[index];
}
+
+ private void ThrowIfReadOnly()
+ {
+ if (IsReadOnly)
+ {
+ throw new InvalidOperationException("Array instance is read-only.");
+ }
+ }
}
internal interface IGenericGodotArray
@@ -592,6 +660,9 @@ namespace Godot.Collections
/// <summary>
/// Resizes this <see cref="Array{T}"/> to the given size.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The array is read-only.
+ /// </exception>
/// <param name="newSize">The new size of the array.</param>
/// <returns><see cref="Error.Ok"/> if successful, or an error code.</returns>
public Error Resize(int newSize)
@@ -602,6 +673,9 @@ namespace Godot.Collections
/// <summary>
/// Shuffles the contents of this <see cref="Array{T}"/> into a random order.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The array is read-only.
+ /// </exception>
public void Shuffle()
{
_underlyingArray.Shuffle();
@@ -634,6 +708,9 @@ namespace Godot.Collections
/// <summary>
/// Returns the value at the given <paramref name="index"/>.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The property is assigned and the array is read-only.
+ /// </exception>
/// <value>The value at the given <paramref name="index"/>.</value>
public unsafe T this[int index]
{
@@ -644,8 +721,11 @@ namespace Godot.Collections
}
set
{
+ ThrowIfReadOnly();
+
if (index < 0 || index >= Count)
throw new ArgumentOutOfRangeException(nameof(index));
+
var self = (godot_array)_underlyingArray.NativeValue;
godot_variant* ptrw = NativeFuncs.godotsharp_array_ptrw(ref self);
godot_variant* itemPtr = &ptrw[index];
@@ -673,10 +753,15 @@ namespace Godot.Collections
/// or the position at the end of the array.
/// Existing items will be moved to the right.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The array is read-only.
+ /// </exception>
/// <param name="index">The index to insert at.</param>
/// <param name="item">The item to insert.</param>
public void Insert(int index, T item)
{
+ ThrowIfReadOnly();
+
if (index < 0 || index > Count)
throw new ArgumentOutOfRangeException(nameof(index));
@@ -688,6 +773,9 @@ namespace Godot.Collections
/// <summary>
/// Removes an element from this <see cref="Array{T}"/> by index.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The array is read-only.
+ /// </exception>
/// <param name="index">The index of the element to remove.</param>
public void RemoveAt(int index)
{
@@ -703,16 +791,35 @@ namespace Godot.Collections
/// <returns>The number of elements.</returns>
public int Count => _underlyingArray.Count;
- bool ICollection<T>.IsReadOnly => false;
+ /// <summary>
+ /// Returns <see langword="true"/> if the array is read-only.
+ /// See <see cref="MakeReadOnly"/>.
+ /// </summary>
+ public bool IsReadOnly => _underlyingArray.IsReadOnly;
+
+ /// <summary>
+ /// Makes the <see cref="Array{T}"/> read-only, i.e. disabled modying of the
+ /// array's elements. Does not apply to nested content, e.g. content of
+ /// nested arrays.
+ /// </summary>
+ public void MakeReadOnly()
+ {
+ _underlyingArray.MakeReadOnly();
+ }
/// <summary>
/// Adds an item to the end of this <see cref="Array{T}"/>.
/// This is the same as <c>append</c> or <c>push_back</c> in GDScript.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The array is read-only.
+ /// </exception>
/// <param name="item">The item to add.</param>
/// <returns>The new size after adding the item.</returns>
public void Add(T item)
{
+ ThrowIfReadOnly();
+
using var variantValue = VariantUtils.CreateFrom(item);
var self = (godot_array)_underlyingArray.NativeValue;
_ = NativeFuncs.godotsharp_array_add(ref self, variantValue);
@@ -721,6 +828,9 @@ namespace Godot.Collections
/// <summary>
/// Erases all items from this <see cref="Array{T}"/>.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The array is read-only.
+ /// </exception>
public void Clear()
{
_underlyingArray.Clear();
@@ -769,10 +879,15 @@ namespace Godot.Collections
/// Removes the first occurrence of the specified value
/// from this <see cref="Array{T}"/>.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The array is read-only.
+ /// </exception>
/// <param name="item">The value to remove.</param>
/// <returns>A <see langword="bool"/> indicating success or failure.</returns>
public bool Remove(T item)
{
+ ThrowIfReadOnly();
+
int index = IndexOf(item);
if (index >= 0)
{
@@ -812,5 +927,13 @@ namespace Godot.Collections
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Array<T>(Variant from) => from.AsGodotArray<T>();
+
+ private void ThrowIfReadOnly()
+ {
+ if (IsReadOnly)
+ {
+ throw new InvalidOperationException("Array instance is read-only.");
+ }
+ }
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/AssemblyHasScriptsAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/AssemblyHasScriptsAttribute.cs
index acdae83d2e..81659f74de 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/AssemblyHasScriptsAttribute.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/AssemblyHasScriptsAttribute.cs
@@ -10,7 +10,7 @@ namespace Godot
/// collection of types that implement scripts; otherwise, retrieving the types requires lookup.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly)]
- public class AssemblyHasScriptsAttribute : Attribute
+ public sealed class AssemblyHasScriptsAttribute : Attribute
{
/// <summary>
/// If the Godot scripts contained in the assembly require lookup
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GodotClassNameAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GodotClassNameAttribute.cs
new file mode 100644
index 0000000000..b19427f60d
--- /dev/null
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GodotClassNameAttribute.cs
@@ -0,0 +1,24 @@
+using System;
+
+namespace Godot
+{
+ /// <summary>
+ /// Attribute that specifies the engine class name when it's not the same
+ /// as the generated C# class name. This allows introspection code to find
+ /// the name associated with the class. If the attribute is not present,
+ /// the C# class name can be used instead.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class)]
+ public class GodotClassNameAttribute : Attribute
+ {
+ /// <summary>
+ /// Original engine class name.
+ /// </summary>
+ public string Name { get; }
+
+ public GodotClassNameAttribute(string name)
+ {
+ Name = name;
+ }
+ }
+}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/MustBeVariantAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/MustBeVariantAttribute.cs
index 23088378d1..0070223c95 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/MustBeVariantAttribute.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/MustBeVariantAttribute.cs
@@ -7,5 +7,5 @@ namespace Godot
/// that can be marshaled from/to a <see cref="Variant"/>.
/// </summary>
[AttributeUsage(AttributeTargets.GenericParameter)]
- public class MustBeVariantAttribute : Attribute { }
+ public sealed class MustBeVariantAttribute : Attribute { }
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/RPCAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/RpcAttribute.cs
index afee926464..6a73d6f70c 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/RPCAttribute.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/RpcAttribute.cs
@@ -5,16 +5,16 @@ namespace Godot
/// <summary>
/// Attribute that changes the RPC mode for the annotated <c>method</c> to the given <see cref="Mode"/>,
/// optionally specifying the <see cref="TransferMode"/> and <see cref="TransferChannel"/> (on supported peers).
- /// See <see cref="MultiplayerAPI.RPCMode"/> and <see cref="MultiplayerPeer.TransferModeEnum"/>.
+ /// See <see cref="MultiplayerApi.RpcMode"/> and <see cref="MultiplayerPeer.TransferModeEnum"/>.
/// By default, methods are not exposed to networking (and RPCs).
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
- public class RPCAttribute : Attribute
+ public sealed class RpcAttribute : Attribute
{
/// <summary>
/// RPC mode for the annotated method.
/// </summary>
- public MultiplayerAPI.RPCMode Mode { get; } = MultiplayerAPI.RPCMode.Disabled;
+ public MultiplayerApi.RpcMode Mode { get; } = MultiplayerApi.RpcMode.Disabled;
/// <summary>
/// If the method will also be called locally; otherwise, it is only called remotely.
@@ -32,10 +32,10 @@ namespace Godot
public int TransferChannel { get; init; } = 0;
/// <summary>
- /// Constructs a <see cref="RPCAttribute"/> instance.
+ /// Constructs a <see cref="RpcAttribute"/> instance.
/// </summary>
/// <param name="mode">The RPC mode to use.</param>
- public RPCAttribute(MultiplayerAPI.RPCMode mode = MultiplayerAPI.RPCMode.Authority)
+ public RpcAttribute(MultiplayerApi.RpcMode mode = MultiplayerApi.RpcMode.Authority)
{
Mode = mode;
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ScriptPathAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ScriptPathAttribute.cs
index f05bcdac38..d363e14c5d 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ScriptPathAttribute.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ScriptPathAttribute.cs
@@ -6,7 +6,7 @@ namespace Godot
/// An attribute that contains the path to the object's script.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
- public class ScriptPathAttribute : Attribute
+ public sealed class ScriptPathAttribute : Attribute
{
/// <summary>
/// File path to the script.
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/SignalAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/SignalAttribute.cs
index 38e68a89d5..0a08bb5df8 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/SignalAttribute.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/SignalAttribute.cs
@@ -3,5 +3,5 @@ using System;
namespace Godot
{
[AttributeUsage(AttributeTargets.Delegate)]
- public class SignalAttribute : Attribute { }
+ public sealed class SignalAttribute : Attribute { }
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ToolAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ToolAttribute.cs
index d2344389f4..4c56201727 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ToolAttribute.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ToolAttribute.cs
@@ -3,5 +3,5 @@ using System;
namespace Godot
{
[AttributeUsage(AttributeTargets.Class)]
- public class ToolAttribute : Attribute { }
+ public sealed class ToolAttribute : Attribute { }
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
index b57317e1d0..ca963cbf4f 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
@@ -27,7 +27,7 @@ namespace Godot
/// The basis matrix's X vector (column 0).
/// </summary>
/// <value>Equivalent to <see cref="Column0"/> and array index <c>[0]</c>.</value>
- public Vector3 x
+ public Vector3 X
{
readonly get => Column0;
set => Column0 = value;
@@ -37,7 +37,7 @@ namespace Godot
/// The basis matrix's Y vector (column 1).
/// </summary>
/// <value>Equivalent to <see cref="Column1"/> and array index <c>[1]</c>.</value>
- public Vector3 y
+ public Vector3 Y
{
readonly get => Column1;
set => Column1 = value;
@@ -47,7 +47,7 @@ namespace Godot
/// The basis matrix's Z vector (column 2).
/// </summary>
/// <value>Equivalent to <see cref="Column2"/> and array index <c>[2]</c>.</value>
- public Vector3 z
+ public Vector3 Z
{
readonly get => Column2;
set => Column2 = value;
@@ -77,45 +77,63 @@ namespace Godot
/// <summary>
/// Column 0 of the basis matrix (the X vector).
/// </summary>
- /// <value>Equivalent to <see cref="x"/> and array index <c>[0]</c>.</value>
+ /// <value>Equivalent to <see cref="X"/> and array index <c>[0]</c>.</value>
public Vector3 Column0
{
- readonly get => new Vector3(Row0.x, Row1.x, Row2.x);
+ readonly get => new Vector3(Row0.X, Row1.X, Row2.X);
set
{
- Row0.x = value.x;
- Row1.x = value.y;
- Row2.x = value.z;
+ Row0.X = value.X;
+ Row1.X = value.Y;
+ Row2.X = value.Z;
}
}
/// <summary>
/// Column 1 of the basis matrix (the Y vector).
/// </summary>
- /// <value>Equivalent to <see cref="y"/> and array index <c>[1]</c>.</value>
+ /// <value>Equivalent to <see cref="Y"/> and array index <c>[1]</c>.</value>
public Vector3 Column1
{
- readonly get => new Vector3(Row0.y, Row1.y, Row2.y);
+ readonly get => new Vector3(Row0.Y, Row1.Y, Row2.Y);
set
{
- Row0.y = value.x;
- Row1.y = value.y;
- Row2.y = value.z;
+ Row0.Y = value.X;
+ Row1.Y = value.Y;
+ Row2.Y = value.Z;
}
}
/// <summary>
/// Column 2 of the basis matrix (the Z vector).
/// </summary>
- /// <value>Equivalent to <see cref="z"/> and array index <c>[2]</c>.</value>
+ /// <value>Equivalent to <see cref="Z"/> and array index <c>[2]</c>.</value>
public Vector3 Column2
{
- readonly get => new Vector3(Row0.z, Row1.z, Row2.z);
+ readonly get => new Vector3(Row0.Z, Row1.Z, Row2.Z);
set
{
- Row0.z = value.x;
- Row1.z = value.y;
- Row2.z = value.z;
+ Row0.Z = value.X;
+ Row1.Z = value.Y;
+ Row2.Z = value.Z;
+ }
+ }
+
+ /// <summary>
+ /// Assuming that the matrix is the combination of a rotation and scaling,
+ /// return the absolute value of scaling factors along each axis.
+ /// </summary>
+ public readonly Vector3 Scale
+ {
+ get
+ {
+ real_t detSign = Mathf.Sign(Determinant());
+ return detSign * new Vector3
+ (
+ Column0.Length(),
+ Column1.Length(),
+ Column2.Length()
+ );
}
}
@@ -195,9 +213,9 @@ namespace Godot
private void SetDiagonal(Vector3 diagonal)
{
- Row0 = new Vector3(diagonal.x, 0, 0);
- Row1 = new Vector3(0, diagonal.y, 0);
- Row2 = new Vector3(0, 0, diagonal.z);
+ Row0 = new Vector3(diagonal.X, 0, 0);
+ Row1 = new Vector3(0, diagonal.Y, 0);
+ Row2 = new Vector3(0, 0, diagonal.Z);
}
/// <summary>
@@ -252,29 +270,29 @@ namespace Godot
if (Row1[0] == 0 && Row0[1] == 0 && Row1[2] == 0 && Row2[1] == 0 && Row1[1] == 1)
{
// return the simplest form (human friendlier in editor and scripts)
- euler.x = 0;
- euler.y = Mathf.Atan2(Row0[2], Row0[0]);
- euler.z = 0;
+ euler.X = 0;
+ euler.Y = Mathf.Atan2(Row0[2], Row0[0]);
+ euler.Z = 0;
}
else
{
- euler.x = Mathf.Atan2(-Row1[2], Row2[2]);
- euler.y = Mathf.Asin(sy);
- euler.z = Mathf.Atan2(-Row0[1], Row0[0]);
+ euler.X = Mathf.Atan2(-Row1[2], Row2[2]);
+ euler.Y = Mathf.Asin(sy);
+ euler.Z = Mathf.Atan2(-Row0[1], Row0[0]);
}
}
else
{
- euler.x = Mathf.Atan2(Row2[1], Row1[1]);
- euler.y = -Mathf.Tau / 4.0f;
- euler.z = 0.0f;
+ euler.X = Mathf.Atan2(Row2[1], Row1[1]);
+ euler.Y = -Mathf.Tau / 4.0f;
+ euler.Z = 0.0f;
}
}
else
{
- euler.x = Mathf.Atan2(Row2[1], Row1[1]);
- euler.y = Mathf.Tau / 4.0f;
- euler.z = 0.0f;
+ euler.X = Mathf.Atan2(Row2[1], Row1[1]);
+ euler.Y = Mathf.Tau / 4.0f;
+ euler.Z = 0.0f;
}
return euler;
}
@@ -292,24 +310,24 @@ namespace Godot
{
if (sz > -(1.0f - Mathf.Epsilon))
{
- euler.x = Mathf.Atan2(Row2[1], Row1[1]);
- euler.y = Mathf.Atan2(Row0[2], Row0[0]);
- euler.z = Mathf.Asin(-sz);
+ euler.X = Mathf.Atan2(Row2[1], Row1[1]);
+ euler.Y = Mathf.Atan2(Row0[2], Row0[0]);
+ euler.Z = Mathf.Asin(-sz);
}
else
{
// It's -1
- euler.x = -Mathf.Atan2(Row1[2], Row2[2]);
- euler.y = 0.0f;
- euler.z = Mathf.Tau / 4.0f;
+ euler.X = -Mathf.Atan2(Row1[2], Row2[2]);
+ euler.Y = 0.0f;
+ euler.Z = Mathf.Tau / 4.0f;
}
}
else
{
// It's 1
- euler.x = -Mathf.Atan2(Row1[2], Row2[2]);
- euler.y = 0.0f;
- euler.z = -Mathf.Tau / 4.0f;
+ euler.X = -Mathf.Atan2(Row1[2], Row2[2]);
+ euler.Y = 0.0f;
+ euler.Z = -Mathf.Tau / 4.0f;
}
return euler;
}
@@ -331,29 +349,29 @@ namespace Godot
if (Row1[0] == 0 && Row0[1] == 0 && Row0[2] == 0 && Row2[0] == 0 && Row0[0] == 1)
{
// return the simplest form (human friendlier in editor and scripts)
- euler.x = Mathf.Atan2(-m12, Row1[1]);
- euler.y = 0;
- euler.z = 0;
+ euler.X = Mathf.Atan2(-m12, Row1[1]);
+ euler.Y = 0;
+ euler.Z = 0;
}
else
{
- euler.x = Mathf.Asin(-m12);
- euler.y = Mathf.Atan2(Row0[2], Row2[2]);
- euler.z = Mathf.Atan2(Row1[0], Row1[1]);
+ euler.X = Mathf.Asin(-m12);
+ euler.Y = Mathf.Atan2(Row0[2], Row2[2]);
+ euler.Z = Mathf.Atan2(Row1[0], Row1[1]);
}
}
else
{ // m12 == -1
- euler.x = Mathf.Tau / 4.0f;
- euler.y = Mathf.Atan2(Row0[1], Row0[0]);
- euler.z = 0;
+ euler.X = Mathf.Tau / 4.0f;
+ euler.Y = Mathf.Atan2(Row0[1], Row0[0]);
+ euler.Z = 0;
}
}
else
{ // m12 == 1
- euler.x = -Mathf.Tau / 4.0f;
- euler.y = -Mathf.Atan2(Row0[1], Row0[0]);
- euler.z = 0;
+ euler.X = -Mathf.Tau / 4.0f;
+ euler.Y = -Mathf.Atan2(Row0[1], Row0[0]);
+ euler.Z = 0;
}
return euler;
@@ -372,24 +390,24 @@ namespace Godot
{
if (sz > -(1.0f - Mathf.Epsilon))
{
- euler.x = Mathf.Atan2(-Row1[2], Row1[1]);
- euler.y = Mathf.Atan2(-Row2[0], Row0[0]);
- euler.z = Mathf.Asin(sz);
+ euler.X = Mathf.Atan2(-Row1[2], Row1[1]);
+ euler.Y = Mathf.Atan2(-Row2[0], Row0[0]);
+ euler.Z = Mathf.Asin(sz);
}
else
{
// It's -1
- euler.x = Mathf.Atan2(Row2[1], Row2[2]);
- euler.y = 0.0f;
- euler.z = -Mathf.Tau / 4.0f;
+ euler.X = Mathf.Atan2(Row2[1], Row2[2]);
+ euler.Y = 0.0f;
+ euler.Z = -Mathf.Tau / 4.0f;
}
}
else
{
// It's 1
- euler.x = Mathf.Atan2(Row2[1], Row2[2]);
- euler.y = 0.0f;
- euler.z = Mathf.Tau / 4.0f;
+ euler.X = Mathf.Atan2(Row2[1], Row2[2]);
+ euler.Y = 0.0f;
+ euler.Z = Mathf.Tau / 4.0f;
}
return euler;
}
@@ -407,24 +425,24 @@ namespace Godot
{
if (sx > -(1.0f - Mathf.Epsilon))
{
- euler.x = Mathf.Asin(sx);
- euler.y = Mathf.Atan2(-Row2[0], Row2[2]);
- euler.z = Mathf.Atan2(-Row0[1], Row1[1]);
+ euler.X = Mathf.Asin(sx);
+ euler.Y = Mathf.Atan2(-Row2[0], Row2[2]);
+ euler.Z = Mathf.Atan2(-Row0[1], Row1[1]);
}
else
{
// It's -1
- euler.x = -Mathf.Tau / 4.0f;
- euler.y = Mathf.Atan2(Row0[2], Row0[0]);
- euler.z = 0;
+ euler.X = -Mathf.Tau / 4.0f;
+ euler.Y = Mathf.Atan2(Row0[2], Row0[0]);
+ euler.Z = 0;
}
}
else
{
// It's 1
- euler.x = Mathf.Tau / 4.0f;
- euler.y = Mathf.Atan2(Row0[2], Row0[0]);
- euler.z = 0;
+ euler.X = Mathf.Tau / 4.0f;
+ euler.Y = Mathf.Atan2(Row0[2], Row0[0]);
+ euler.Z = 0;
}
return euler;
}
@@ -442,24 +460,24 @@ namespace Godot
{
if (sy > -(1.0f - Mathf.Epsilon))
{
- euler.x = Mathf.Atan2(Row2[1], Row2[2]);
- euler.y = Mathf.Asin(-sy);
- euler.z = Mathf.Atan2(Row1[0], Row0[0]);
+ euler.X = Mathf.Atan2(Row2[1], Row2[2]);
+ euler.Y = Mathf.Asin(-sy);
+ euler.Z = Mathf.Atan2(Row1[0], Row0[0]);
}
else
{
// It's -1
- euler.x = 0;
- euler.y = Mathf.Tau / 4.0f;
- euler.z = -Mathf.Atan2(Row0[1], Row1[1]);
+ euler.X = 0;
+ euler.Y = Mathf.Tau / 4.0f;
+ euler.Z = -Mathf.Atan2(Row0[1], Row1[1]);
}
}
else
{
// It's 1
- euler.x = 0;
- euler.y = -Mathf.Tau / 4.0f;
- euler.z = -Mathf.Atan2(Row0[1], Row1[1]);
+ euler.X = 0;
+ euler.Y = -Mathf.Tau / 4.0f;
+ euler.Z = -Mathf.Atan2(Row0[1], Row1[1]);
}
return euler;
}
@@ -542,21 +560,6 @@ namespace Godot
}
/// <summary>
- /// Assuming that the matrix is the combination of a rotation and scaling,
- /// return the absolute value of scaling factors along each axis.
- /// </summary>
- public readonly Vector3 GetScale()
- {
- real_t detSign = Mathf.Sign(Determinant());
- return detSign * new Vector3
- (
- Column0.Length(),
- Column1.Length(),
- Column2.Length()
- );
- }
-
- /// <summary>
/// Returns the inverse of the matrix.
/// </summary>
/// <returns>The inverse matrix.</returns>
@@ -650,9 +653,9 @@ namespace Godot
public readonly Basis Scaled(Vector3 scale)
{
Basis b = this;
- b.Row0 *= scale.x;
- b.Row1 *= scale.y;
- b.Row2 *= scale.z;
+ b.Row0 *= scale.X;
+ b.Row1 *= scale.Y;
+ b.Row2 *= scale.Z;
return b;
}
@@ -789,18 +792,18 @@ namespace Godot
{
real_t s = 2.0f / quaternion.LengthSquared();
- real_t xs = quaternion.x * s;
- real_t ys = quaternion.y * s;
- real_t zs = quaternion.z * s;
- real_t wx = quaternion.w * xs;
- real_t wy = quaternion.w * ys;
- real_t wz = quaternion.w * zs;
- real_t xx = quaternion.x * xs;
- real_t xy = quaternion.x * ys;
- real_t xz = quaternion.x * zs;
- real_t yy = quaternion.y * ys;
- real_t yz = quaternion.y * zs;
- real_t zz = quaternion.z * zs;
+ real_t xs = quaternion.X * s;
+ real_t ys = quaternion.Y * s;
+ real_t zs = quaternion.Z * s;
+ real_t wx = quaternion.W * xs;
+ real_t wy = quaternion.W * ys;
+ real_t wz = quaternion.W * zs;
+ real_t xx = quaternion.X * xs;
+ real_t xy = quaternion.X * ys;
+ real_t xz = quaternion.X * zs;
+ real_t yy = quaternion.Y * ys;
+ real_t yz = quaternion.Y * zs;
+ real_t zz = quaternion.Z * zs;
Row0 = new Vector3(1.0f - (yy + zz), xy - wz, xz + wy);
Row1 = new Vector3(xy + wz, 1.0f - (xx + zz), yz - wx);
@@ -815,29 +818,29 @@ namespace Godot
/// <param name="angle">The angle to rotate, in radians.</param>
public Basis(Vector3 axis, real_t angle)
{
- Vector3 axisSq = 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 sin, real_t cos) = Mathf.SinCos(angle);
- Row0.x = axisSq.x + cos * (1.0f - axisSq.x);
- Row1.y = axisSq.y + cos * (1.0f - axisSq.y);
- Row2.z = axisSq.z + cos * (1.0f - axisSq.z);
+ Row0.X = axisSq.X + cos * (1.0f - axisSq.X);
+ Row1.Y = axisSq.Y + cos * (1.0f - axisSq.Y);
+ Row2.Z = axisSq.Z + cos * (1.0f - axisSq.Z);
real_t t = 1.0f - cos;
- real_t xyzt = axis.x * axis.y * t;
- real_t zyxs = axis.z * sin;
- Row0.y = xyzt - zyxs;
- Row1.x = xyzt + zyxs;
+ real_t xyzt = axis.X * axis.Y * t;
+ real_t zyxs = axis.Z * sin;
+ Row0.Y = xyzt - zyxs;
+ Row1.X = xyzt + zyxs;
- xyzt = axis.x * axis.z * t;
- zyxs = axis.y * sin;
- Row0.z = xyzt + zyxs;
- Row2.x = xyzt - zyxs;
+ xyzt = axis.X * axis.Z * t;
+ zyxs = axis.Y * sin;
+ Row0.Z = xyzt + zyxs;
+ Row2.X = xyzt - zyxs;
- xyzt = axis.y * axis.z * t;
- zyxs = axis.x * sin;
- Row1.z = xyzt - zyxs;
- Row2.y = xyzt + zyxs;
+ xyzt = axis.Y * axis.Z * t;
+ zyxs = axis.X * sin;
+ Row1.Z = xyzt - zyxs;
+ Row2.Y = xyzt + zyxs;
}
/// <summary>
@@ -848,9 +851,9 @@ namespace Godot
/// <param name="column2">The Z vector, or Column2.</param>
public Basis(Vector3 column0, Vector3 column1, Vector3 column2)
{
- Row0 = new Vector3(column0.x, column1.x, column2.x);
- Row1 = new Vector3(column0.y, column1.y, column2.y);
- Row2 = new Vector3(column0.z, column1.z, column2.z);
+ Row0 = new Vector3(column0.X, column1.X, column2.X);
+ Row1 = new Vector3(column0.Y, column1.Y, column2.Y);
+ Row2 = new Vector3(column0.Z, column1.Z, column2.Z);
// Same as:
// Column0 = column0;
// Column1 = column1;
@@ -860,17 +863,17 @@ namespace Godot
/// <summary>
/// Constructs a transformation matrix from the given components.
- /// Arguments are named such that xy is equal to calling <c>x.y</c>.
+ /// Arguments are named such that xy is equal to calling <c>X.Y</c>.
/// </summary>
- /// <param name="xx">The X component of the X column vector, accessed via <c>b.x.x</c> or <c>[0][0]</c>.</param>
- /// <param name="yx">The X component of the Y column vector, accessed via <c>b.y.x</c> or <c>[1][0]</c>.</param>
- /// <param name="zx">The X component of the Z column vector, accessed via <c>b.z.x</c> or <c>[2][0]</c>.</param>
- /// <param name="xy">The Y component of the X column vector, accessed via <c>b.x.y</c> or <c>[0][1]</c>.</param>
- /// <param name="yy">The Y component of the Y column vector, accessed via <c>b.y.y</c> or <c>[1][1]</c>.</param>
- /// <param name="zy">The Y component of the Z column vector, accessed via <c>b.y.y</c> or <c>[2][1]</c>.</param>
- /// <param name="xz">The Z component of the X column vector, accessed via <c>b.x.y</c> or <c>[0][2]</c>.</param>
- /// <param name="yz">The Z component of the Y column vector, accessed via <c>b.y.y</c> or <c>[1][2]</c>.</param>
- /// <param name="zz">The Z component of the Z column vector, accessed via <c>b.y.y</c> or <c>[2][2]</c>.</param>
+ /// <param name="xx">The X component of the X column vector, accessed via <c>b.X.X</c> or <c>[0][0]</c>.</param>
+ /// <param name="yx">The X component of the Y column vector, accessed via <c>b.Y.X</c> or <c>[1][0]</c>.</param>
+ /// <param name="zx">The X component of the Z column vector, accessed via <c>b.Z.X</c> or <c>[2][0]</c>.</param>
+ /// <param name="xy">The Y component of the X column vector, accessed via <c>b.X.Y</c> or <c>[0][1]</c>.</param>
+ /// <param name="yy">The Y component of the Y column vector, accessed via <c>b.Y.Y</c> or <c>[1][1]</c>.</param>
+ /// <param name="zy">The Y component of the Z column vector, accessed via <c>b.Y.Y</c> or <c>[2][1]</c>.</param>
+ /// <param name="xz">The Z component of the X column vector, accessed via <c>b.X.Y</c> or <c>[0][2]</c>.</param>
+ /// <param name="yz">The Z component of the Y column vector, accessed via <c>b.Y.Y</c> or <c>[1][2]</c>.</param>
+ /// <param name="zz">The Z component of the Z column vector, accessed via <c>b.Y.Y</c> or <c>[2][2]</c>.</param>
public 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, yx, zx);
@@ -885,7 +888,7 @@ namespace Godot
/// <param name="order">The order to compose the Euler angles.</param>
public static Basis FromEuler(Vector3 euler, EulerOrder order = EulerOrder.Yxz)
{
- (real_t sin, real_t cos) = Mathf.SinCos(euler.x);
+ (real_t sin, real_t cos) = Mathf.SinCos(euler.X);
Basis xmat = new Basis
(
new Vector3(1, 0, 0),
@@ -893,7 +896,7 @@ namespace Godot
new Vector3(0, -sin, cos)
);
- (sin, cos) = Mathf.SinCos(euler.y);
+ (sin, cos) = Mathf.SinCos(euler.Y);
Basis ymat = new Basis
(
new Vector3(cos, 0, -sin),
@@ -901,7 +904,7 @@ namespace Godot
new Vector3(sin, 0, cos)
);
- (sin, cos) = Mathf.SinCos(euler.z);
+ (sin, cos) = Mathf.SinCos(euler.Z);
Basis zmat = new Basis
(
new Vector3(cos, sin, 0),
@@ -938,9 +941,9 @@ namespace Godot
public static Basis FromScale(Vector3 scale)
{
return new Basis(
- scale.x, 0, 0,
- 0, scale.y, 0,
- 0, 0, scale.z
+ scale.X, 0, 0,
+ 0, scale.Y, 0,
+ 0, 0, scale.Z
);
}
@@ -991,9 +994,9 @@ namespace Godot
{
return new Vector3
(
- basis.Row0[0] * vector.x + basis.Row1[0] * vector.y + basis.Row2[0] * vector.z,
- basis.Row0[1] * vector.x + basis.Row1[1] * vector.y + basis.Row2[1] * vector.z,
- basis.Row0[2] * vector.x + basis.Row1[2] * vector.y + basis.Row2[2] * vector.z
+ basis.Row0[0] * vector.X + basis.Row1[0] * vector.Y + basis.Row2[0] * vector.Z,
+ basis.Row0[1] * vector.X + basis.Row1[1] * vector.Y + basis.Row2[1] * vector.Z,
+ basis.Row0[2] * vector.X + basis.Row1[2] * vector.Y + basis.Row2[2] * vector.Z
);
}
@@ -1074,7 +1077,7 @@ namespace Godot
/// <returns>A string representation of this basis.</returns>
public override readonly string ToString()
{
- return $"[X: {x}, Y: {y}, Z: {z}]";
+ return $"[X: {X}, Y: {Y}, Z: {Z}]";
}
/// <summary>
@@ -1083,7 +1086,7 @@ namespace Godot
/// <returns>A string representation of this basis.</returns>
public readonly string ToString(string format)
{
- return $"[X: {x.ToString(format)}, Y: {y.ToString(format)}, Z: {z.ToString(format)}]";
+ return $"[X: {X.ToString(format)}, Y: {Y.ToString(format)}, Z: {Z.ToString(format)}]";
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs
index 354212da1b..16be494d99 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs
@@ -12,7 +12,7 @@ namespace Godot.Bridge
{
try
{
- var godotObject = (Object)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
+ var godotObject = (GodotObject)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
if (godotObject == null)
{
@@ -49,7 +49,7 @@ namespace Godot.Bridge
{
try
{
- var godotObject = (Object)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
+ var godotObject = (GodotObject)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
if (godotObject == null)
throw new InvalidOperationException();
@@ -79,17 +79,34 @@ namespace Godot.Bridge
{
try
{
- var godotObject = (Object)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
+ var godotObject = (GodotObject)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
if (godotObject == null)
throw new InvalidOperationException();
+ // Properties
if (godotObject.GetGodotClassPropertyValue(CustomUnsafe.AsRef(name), out godot_variant outRetValue))
{
*outRet = outRetValue;
return godot_bool.True;
}
+ // Signals
+ if (godotObject.HasGodotClassSignal(CustomUnsafe.AsRef(name)))
+ {
+ godot_signal signal = new godot_signal(*name, godotObject.GetInstanceId());
+ *outRet = VariantUtils.CreateFromSignalTakingOwnershipOfDisposableValue(signal);
+ return godot_bool.True;
+ }
+
+ // Methods
+ if (godotObject.HasGodotClassMethod(CustomUnsafe.AsRef(name)))
+ {
+ godot_callable method = new godot_callable(*name, godotObject.GetInstanceId());
+ *outRet = VariantUtils.CreateFromCallableTakingOwnershipOfDisposableValue(method);
+ return godot_bool.True;
+ }
+
var nameManaged = StringName.CreateTakingOwnershipOfDisposableValue(
NativeFuncs.godotsharp_string_name_new_copy(CustomUnsafe.AsRef(name)));
@@ -117,7 +134,7 @@ namespace Godot.Bridge
{
try
{
- var godotObject = (Object)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
+ var godotObject = (GodotObject)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
if (okIfNull.ToBool())
godotObject?.Dispose();
@@ -135,7 +152,7 @@ namespace Godot.Bridge
{
try
{
- var self = (Object)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
+ var self = (GodotObject)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
if (self == null)
{
@@ -169,7 +186,7 @@ namespace Godot.Bridge
{
try
{
- var godotObject = (Object)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
+ var godotObject = (GodotObject)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
if (godotObject == null)
return godot_bool.False;
@@ -192,7 +209,7 @@ namespace Godot.Bridge
{
try
{
- var godotObject = (Object)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
+ var godotObject = (GodotObject)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
if (godotObject == null)
return;
@@ -225,7 +242,7 @@ namespace Godot.Bridge
{
try
{
- var godotObject = (Object)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
+ var godotObject = (GodotObject)GCHandle.FromIntPtr(godotObjectGCHandle).Target;
if (godotObject == null)
return;
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/GodotSerializationInfo.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/GodotSerializationInfo.cs
index 6d20f95007..47feb1902f 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/GodotSerializationInfo.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/GodotSerializationInfo.cs
@@ -48,7 +48,7 @@ public sealed class GodotSerializationInfo : IDisposable
{
_signalEvents[name] = serializedData;
}
- else if (OS.IsStdoutVerbose())
+ else if (OS.IsStdOutVerbose())
{
Console.WriteLine($"Failed to serialize event signal delegate: {name}");
}
@@ -72,7 +72,7 @@ public sealed class GodotSerializationInfo : IDisposable
return true;
}
- else if (OS.IsStdoutVerbose())
+ else if (OS.IsStdOutVerbose())
{
Console.WriteLine($"Failed to deserialize event signal delegate: {name}");
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs
index dafa83431b..ec2728140e 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs
@@ -100,7 +100,7 @@ namespace Godot.Bridge
Type nativeType = TypeGetProxyClass(nativeTypeNameStr) ?? throw new InvalidOperationException(
"Wrapper class not found for type: " + nativeTypeNameStr);
- var obj = (Object)FormatterServices.GetUninitializedObject(nativeType);
+ var obj = (GodotObject)FormatterServices.GetUninitializedObject(nativeType);
var ctor = nativeType.GetConstructor(
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance,
@@ -150,7 +150,7 @@ namespace Godot.Bridge
}
}
- var obj = (Object)FormatterServices.GetUninitializedObject(scriptType);
+ var obj = (GodotObject)FormatterServices.GetUninitializedObject(scriptType);
var parameters = ctor.GetParameters();
int paramCount = parameters.Length;
@@ -189,7 +189,7 @@ namespace Godot.Bridge
return;
}
- var native = Object.InternalGetClassNativeBase(scriptType);
+ var native = GodotObject.InternalGetClassNativeBase(scriptType);
var field = native?.GetField("NativeName", BindingFlags.DeclaredOnly | BindingFlags.Static |
BindingFlags.Public | BindingFlags.NonPublic);
@@ -222,7 +222,7 @@ namespace Godot.Bridge
{
try
{
- var target = (Object?)GCHandle.FromIntPtr(gcHandlePtr).Target;
+ var target = (GodotObject?)GCHandle.FromIntPtr(gcHandlePtr).Target;
if (target != null)
target.NativePtr = newPtr;
}
@@ -239,21 +239,45 @@ namespace Godot.Bridge
if (nativeTypeNameStr[0] == '_')
nativeTypeNameStr = nativeTypeNameStr.Substring(1);
- Type? wrapperType = typeof(Object).Assembly.GetType("Godot." + nativeTypeNameStr);
+ Type? wrapperType = typeof(GodotObject).Assembly.GetType("Godot." + nativeTypeNameStr);
if (wrapperType == null)
{
- wrapperType = AppDomain.CurrentDomain.GetAssemblies()
- .FirstOrDefault(a => a.GetName().Name == "GodotSharpEditor")?
- .GetType("Godot." + nativeTypeNameStr);
+ wrapperType = GetTypeByGodotClassAttr(typeof(GodotObject).Assembly, nativeTypeNameStr);
+ }
+
+ if (wrapperType == null)
+ {
+ var editorAssembly = AppDomain.CurrentDomain.GetAssemblies()
+ .FirstOrDefault(a => a.GetName().Name == "GodotSharpEditor");
+ wrapperType = editorAssembly?.GetType("Godot." + nativeTypeNameStr);
+
+ if (wrapperType == null)
+ {
+ wrapperType = GetTypeByGodotClassAttr(editorAssembly, nativeTypeNameStr);
+ }
+ }
+
+ static Type? GetTypeByGodotClassAttr(Assembly assembly, string nativeTypeNameStr)
+ {
+ var types = assembly.GetTypes();
+ foreach (var type in types)
+ {
+ var attr = type.GetCustomAttribute<GodotClassNameAttribute>();
+ if (attr?.Name == nativeTypeNameStr)
+ {
+ return type;
+ }
+ }
+ return null;
}
static bool IsStatic(Type type) => type.IsAbstract && type.IsSealed;
if (wrapperType != null && IsStatic(wrapperType))
{
- // A static class means this is a Godot singleton class. If an instance is needed we use Godot.Object.
- return typeof(Object);
+ // A static class means this is a Godot singleton class. If an instance is needed we use GodotObject.
+ return typeof(GodotObject);
}
return wrapperType;
@@ -293,7 +317,7 @@ namespace Godot.Bridge
// such as when disabling C# source generators (for whatever reason) or when using a
// language other than C# that has nothing similar to source generators to automate it.
- var typeOfGodotObject = typeof(Object);
+ var typeOfGodotObject = typeof(GodotObject);
foreach (var type in assembly.GetTypes())
{
@@ -331,7 +355,7 @@ namespace Godot.Bridge
{
try
{
- var owner = (Object?)GCHandle.FromIntPtr(ownerGCHandlePtr).Target;
+ var owner = (GodotObject?)GCHandle.FromIntPtr(ownerGCHandlePtr).Target;
if (owner == null)
{
@@ -539,9 +563,9 @@ namespace Godot.Bridge
}
// ReSharper disable once RedundantNameQualifier
- if (!typeof(Godot.Object).IsAssignableFrom(scriptType))
+ if (!typeof(GodotObject).IsAssignableFrom(scriptType))
{
- // The class no longer inherits Godot.Object, can't reload
+ // The class no longer inherits GodotObject, can't reload
return godot_bool.False;
}
@@ -589,7 +613,7 @@ namespace Godot.Bridge
using var methods = new Collections.Array();
Type? top = scriptType;
- Type native = Object.InternalGetClassNativeBase(top);
+ Type native = GodotObject.InternalGetClassNativeBase(top);
while (top != null && top != native)
{
@@ -650,7 +674,7 @@ namespace Godot.Bridge
continue;
var rpcAttr = method.GetCustomAttributes(inherit: false)
- .OfType<RPCAttribute>().FirstOrDefault();
+ .OfType<RpcAttribute>().FirstOrDefault();
if (rpcAttr == null)
continue;
@@ -899,7 +923,7 @@ namespace Godot.Bridge
try
{
Type? top = _scriptTypeBiMap.GetScriptType(scriptPtr);
- Type native = Object.InternalGetClassNativeBase(top);
+ Type native = GodotObject.InternalGetClassNativeBase(top);
while (top != null && top != native)
{
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.cs
index 23b0aa9204..219a9a8c15 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.cs
@@ -28,7 +28,7 @@ namespace Godot
/// </example>
public readonly partial struct Callable
{
- private readonly Object _target;
+ private readonly GodotObject _target;
private readonly StringName _method;
private readonly Delegate _delegate;
private readonly unsafe delegate* managed<object, NativeVariantPtrArgs, out godot_variant, void> _trampoline;
@@ -36,7 +36,7 @@ namespace Godot
/// <summary>
/// Object that contains the method.
/// </summary>
- public Object Target => _target;
+ public GodotObject Target => _target;
/// <summary>
/// Name of the method that will be called.
@@ -60,7 +60,7 @@ namespace Godot
/// </summary>
/// <param name="target">Object that contains the method.</param>
/// <param name="method">Name of the method that will be called.</param>
- public unsafe Callable(Object target, StringName method)
+ public unsafe Callable(GodotObject target, StringName method)
{
_target = target;
_method = method;
@@ -71,7 +71,7 @@ namespace Godot
private unsafe Callable(Delegate @delegate,
delegate* managed<object, NativeVariantPtrArgs, out godot_variant, void> trampoline)
{
- _target = @delegate?.Target as Object;
+ _target = @delegate?.Target as GodotObject;
_method = null;
_delegate = @delegate;
_trampoline = trampoline;
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.generics.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.generics.cs
index ff385da1c9..3005582bea 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.generics.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Callable.generics.cs
@@ -45,7 +45,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From(Action)"/>
- public static unsafe Callable From<T0>(
+ public static unsafe Callable From<[MustBeVariant] T0>(
Action<T0> action
)
{
@@ -64,7 +64,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From(Action)"/>
- public static unsafe Callable From<T0, T1>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1>(
Action<T0, T1> action
)
{
@@ -84,7 +84,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From(Action)"/>
- public static unsafe Callable From<T0, T1, T2>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1, [MustBeVariant] T2>(
Action<T0, T1, T2> action
)
{
@@ -105,7 +105,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From(Action)"/>
- public static unsafe Callable From<T0, T1, T2, T3>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1, [MustBeVariant] T2, [MustBeVariant] T3>(
Action<T0, T1, T2, T3> action
)
{
@@ -127,7 +127,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From(Action)"/>
- public static unsafe Callable From<T0, T1, T2, T3, T4>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1, [MustBeVariant] T2, [MustBeVariant] T3, [MustBeVariant] T4>(
Action<T0, T1, T2, T3, T4> action
)
{
@@ -150,7 +150,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From(Action)"/>
- public static unsafe Callable From<T0, T1, T2, T3, T4, T5>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1, [MustBeVariant] T2, [MustBeVariant] T3, [MustBeVariant] T4, [MustBeVariant] T5>(
Action<T0, T1, T2, T3, T4, T5> action
)
{
@@ -174,7 +174,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From(Action)"/>
- public static unsafe Callable From<T0, T1, T2, T3, T4, T5, T6>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1, [MustBeVariant] T2, [MustBeVariant] T3, [MustBeVariant] T4, [MustBeVariant] T5, [MustBeVariant] T6>(
Action<T0, T1, T2, T3, T4, T5, T6> action
)
{
@@ -199,7 +199,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From(Action)"/>
- public static unsafe Callable From<T0, T1, T2, T3, T4, T5, T6, T7>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1, [MustBeVariant] T2, [MustBeVariant] T3, [MustBeVariant] T4, [MustBeVariant] T5, [MustBeVariant] T6, [MustBeVariant] T7>(
Action<T0, T1, T2, T3, T4, T5, T6, T7> action
)
{
@@ -225,7 +225,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From(Action)"/>
- public static unsafe Callable From<T0, T1, T2, T3, T4, T5, T6, T7, T8>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1, [MustBeVariant] T2, [MustBeVariant] T3, [MustBeVariant] T4, [MustBeVariant] T5, [MustBeVariant] T6, [MustBeVariant] T7, [MustBeVariant] T8>(
Action<T0, T1, T2, T3, T4, T5, T6, T7, T8> action
)
{
@@ -255,7 +255,7 @@ public readonly partial struct Callable
/// Constructs a new <see cref="Callable"/> for the given <paramref name="func"/>.
/// </summary>
/// <param name="func">Action method that will be called.</param>
- public static unsafe Callable From<TResult>(
+ public static unsafe Callable From<[MustBeVariant] TResult>(
Func<TResult> func
)
{
@@ -272,7 +272,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From{TResult}(Func{TResult})"/>
- public static unsafe Callable From<T0, TResult>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] TResult>(
Func<T0, TResult> func
)
{
@@ -291,7 +291,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From{TResult}(Func{TResult})"/>
- public static unsafe Callable From<T0, T1, TResult>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1, [MustBeVariant] TResult>(
Func<T0, T1, TResult> func
)
{
@@ -311,7 +311,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From{TResult}(Func{TResult})"/>
- public static unsafe Callable From<T0, T1, T2, TResult>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1, [MustBeVariant] T2, [MustBeVariant] TResult>(
Func<T0, T1, T2, TResult> func
)
{
@@ -332,7 +332,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From{TResult}(Func{TResult})"/>
- public static unsafe Callable From<T0, T1, T2, T3, TResult>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1, [MustBeVariant] T2, [MustBeVariant] T3, [MustBeVariant] TResult>(
Func<T0, T1, T2, T3, TResult> func
)
{
@@ -354,7 +354,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From{TResult}(Func{TResult})"/>
- public static unsafe Callable From<T0, T1, T2, T3, T4, TResult>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1, [MustBeVariant] T2, [MustBeVariant] T3, [MustBeVariant] T4, [MustBeVariant] TResult>(
Func<T0, T1, T2, T3, T4, TResult> func
)
{
@@ -377,7 +377,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From{TResult}(Func{TResult})"/>
- public static unsafe Callable From<T0, T1, T2, T3, T4, T5, TResult>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1, [MustBeVariant] T2, [MustBeVariant] T3, [MustBeVariant] T4, [MustBeVariant] T5, [MustBeVariant] TResult>(
Func<T0, T1, T2, T3, T4, T5, TResult> func
)
{
@@ -401,7 +401,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From{TResult}(Func{TResult})"/>
- public static unsafe Callable From<T0, T1, T2, T3, T4, T5, T6, TResult>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1, [MustBeVariant] T2, [MustBeVariant] T3, [MustBeVariant] T4, [MustBeVariant] T5, [MustBeVariant] T6, [MustBeVariant] TResult>(
Func<T0, T1, T2, T3, T4, T5, T6, TResult> func
)
{
@@ -426,7 +426,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From{TResult}(Func{TResult})"/>
- public static unsafe Callable From<T0, T1, T2, T3, T4, T5, T6, T7, TResult>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1, [MustBeVariant] T2, [MustBeVariant] T3, [MustBeVariant] T4, [MustBeVariant] T5, [MustBeVariant] T6, [MustBeVariant] T7, [MustBeVariant] TResult>(
Func<T0, T1, T2, T3, T4, T5, T6, T7, TResult> func
)
{
@@ -452,7 +452,7 @@ public readonly partial struct Callable
}
/// <inheritdoc cref="From{TResult}(Func{TResult})"/>
- public static unsafe Callable From<T0, T1, T2, T3, T4, T5, T6, T7, T8, TResult>(
+ public static unsafe Callable From<[MustBeVariant] T0, [MustBeVariant] T1, [MustBeVariant] T2, [MustBeVariant] T3, [MustBeVariant] T4, [MustBeVariant] T5, [MustBeVariant] T6, [MustBeVariant] T7, [MustBeVariant] T8, [MustBeVariant] TResult>(
Func<T0, T1, T2, T3, T4, T5, T6, T7, T8, TResult> func
)
{
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
index 2effdecf40..555811bab2 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
@@ -21,97 +21,97 @@ namespace Godot
/// <summary>
/// The color's red component, typically on the range of 0 to 1.
/// </summary>
- public float r;
+ public float R;
/// <summary>
/// The color's green component, typically on the range of 0 to 1.
/// </summary>
- public float g;
+ public float G;
/// <summary>
/// The color's blue component, typically on the range of 0 to 1.
/// </summary>
- public float b;
+ public float B;
/// <summary>
/// The color's alpha (transparency) component, typically on the range of 0 to 1.
/// </summary>
- public float a;
+ public float A;
/// <summary>
- /// Wrapper for <see cref="r"/> that uses the range 0 to 255 instead of 0 to 1.
+ /// Wrapper for <see cref="R"/> that uses the range 0 to 255 instead of 0 to 1.
/// </summary>
/// <value>Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255.</value>
- public int r8
+ public int R8
{
readonly get
{
- return (int)Math.Round(r * 255.0f);
+ return (int)Math.Round(R * 255.0f);
}
set
{
- r = value / 255.0f;
+ R = value / 255.0f;
}
}
/// <summary>
- /// Wrapper for <see cref="g"/> that uses the range 0 to 255 instead of 0 to 1.
+ /// Wrapper for <see cref="G"/> that uses the range 0 to 255 instead of 0 to 1.
/// </summary>
/// <value>Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255.</value>
- public int g8
+ public int G8
{
readonly get
{
- return (int)Math.Round(g * 255.0f);
+ return (int)Math.Round(G * 255.0f);
}
set
{
- g = value / 255.0f;
+ G = value / 255.0f;
}
}
/// <summary>
- /// Wrapper for <see cref="b"/> that uses the range 0 to 255 instead of 0 to 1.
+ /// Wrapper for <see cref="B"/> that uses the range 0 to 255 instead of 0 to 1.
/// </summary>
/// <value>Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255.</value>
- public int b8
+ public int B8
{
readonly get
{
- return (int)Math.Round(b * 255.0f);
+ return (int)Math.Round(B * 255.0f);
}
set
{
- b = value / 255.0f;
+ B = value / 255.0f;
}
}
/// <summary>
- /// Wrapper for <see cref="a"/> that uses the range 0 to 255 instead of 0 to 1.
+ /// Wrapper for <see cref="A"/> that uses the range 0 to 255 instead of 0 to 1.
/// </summary>
/// <value>Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255.</value>
- public int a8
+ public int A8
{
readonly get
{
- return (int)Math.Round(a * 255.0f);
+ return (int)Math.Round(A * 255.0f);
}
set
{
- a = value / 255.0f;
+ A = value / 255.0f;
}
}
/// <summary>
/// The HSV hue of this color, on the range 0 to 1.
/// </summary>
- /// <value>Getting is a long process, refer to the source code for details. Setting uses <see cref="FromHSV"/>.</value>
- public float h
+ /// <value>Getting is a long process, refer to the source code for details. Setting uses <see cref="FromHsv"/>.</value>
+ public float H
{
readonly get
{
- float max = Math.Max(r, Math.Max(g, b));
- float min = Math.Min(r, Math.Min(g, b));
+ float max = Math.Max(R, Math.Max(G, B));
+ float min = Math.Min(R, Math.Min(G, B));
float delta = max - min;
@@ -122,17 +122,17 @@ namespace Godot
float h;
- if (r == max)
+ if (R == max)
{
- h = (g - b) / delta; // Between yellow & magenta
+ h = (G - B) / delta; // Between yellow & magenta
}
- else if (g == max)
+ else if (G == max)
{
- h = 2 + ((b - r) / delta); // Between cyan & yellow
+ h = 2 + ((B - R) / delta); // Between cyan & yellow
}
else
{
- h = 4 + ((r - g) / delta); // Between magenta & cyan
+ h = 4 + ((R - G) / delta); // Between magenta & cyan
}
h /= 6.0f;
@@ -146,20 +146,20 @@ namespace Godot
}
set
{
- this = FromHSV(value, s, v, a);
+ this = FromHsv(value, S, V, A);
}
}
/// <summary>
/// The HSV saturation of this color, on the range 0 to 1.
/// </summary>
- /// <value>Getting is equivalent to the ratio between the min and max RGB value. Setting uses <see cref="FromHSV"/>.</value>
- public float s
+ /// <value>Getting is equivalent to the ratio between the min and max RGB value. Setting uses <see cref="FromHsv"/>.</value>
+ public float S
{
readonly get
{
- float max = Math.Max(r, Math.Max(g, b));
- float min = Math.Min(r, Math.Min(g, b));
+ float max = Math.Max(R, Math.Max(G, B));
+ float min = Math.Min(R, Math.Min(G, B));
float delta = max - min;
@@ -167,23 +167,23 @@ namespace Godot
}
set
{
- this = FromHSV(h, value, v, a);
+ this = FromHsv(H, value, V, A);
}
}
/// <summary>
/// The HSV value (brightness) of this color, on the range 0 to 1.
/// </summary>
- /// <value>Getting is equivalent to using <see cref="Math.Max(float, float)"/> on the RGB components. Setting uses <see cref="FromHSV"/>.</value>
- public float v
+ /// <value>Getting is equivalent to using <see cref="Math.Max(float, float)"/> on the RGB components. Setting uses <see cref="FromHsv"/>.</value>
+ public float V
{
readonly get
{
- return Math.Max(r, Math.Max(g, b));
+ return Math.Max(R, Math.Max(G, B));
}
set
{
- this = FromHSV(h, s, value, a);
+ this = FromHsv(H, S, value, A);
}
}
@@ -197,17 +197,17 @@ namespace Godot
/// </summary>
public readonly float Luminance
{
- get { return 0.2126f * r + 0.7152f * g + 0.0722f * b; }
+ get { return 0.2126f * R + 0.7152f * G + 0.0722f * B; }
}
/// <summary>
/// Access color components using their index.
/// </summary>
/// <value>
- /// <c>[0]</c> is equivalent to <see cref="r"/>,
- /// <c>[1]</c> is equivalent to <see cref="g"/>,
- /// <c>[2]</c> is equivalent to <see cref="b"/>,
- /// <c>[3]</c> is equivalent to <see cref="a"/>.
+ /// <c>[0]</c> is equivalent to <see cref="R"/>,
+ /// <c>[1]</c> is equivalent to <see cref="G"/>,
+ /// <c>[2]</c> is equivalent to <see cref="B"/>,
+ /// <c>[3]</c> is equivalent to <see cref="A"/>.
/// </value>
public float this[int index]
{
@@ -216,13 +216,13 @@ namespace Godot
switch (index)
{
case 0:
- return r;
+ return R;
case 1:
- return g;
+ return G;
case 2:
- return b;
+ return B;
case 3:
- return a;
+ return A;
default:
throw new ArgumentOutOfRangeException(nameof(index));
}
@@ -232,16 +232,16 @@ namespace Godot
switch (index)
{
case 0:
- r = value;
+ R = value;
return;
case 1:
- g = value;
+ G = value;
return;
case 2:
- b = value;
+ B = value;
return;
case 3:
- a = value;
+ A = value;
return;
default:
throw new ArgumentOutOfRangeException(nameof(index));
@@ -260,17 +260,17 @@ namespace Godot
{
Color res;
- float sa = 1.0f - over.a;
- res.a = (a * sa) + over.a;
+ float sa = 1.0f - over.A;
+ res.A = (A * sa) + over.A;
- if (res.a == 0)
+ if (res.A == 0)
{
return new Color(0, 0, 0, 0);
}
- res.r = ((r * a * sa) + (over.r * over.a)) / res.a;
- res.g = ((g * a * sa) + (over.g * over.a)) / res.a;
- res.b = ((b * a * sa) + (over.b * over.a)) / res.a;
+ res.R = ((R * A * sa) + (over.R * over.A)) / res.A;
+ res.G = ((G * A * sa) + (over.G * over.A)) / res.A;
+ res.B = ((B * A * sa) + (over.B * over.A)) / res.A;
return res;
}
@@ -289,10 +289,10 @@ namespace Godot
Color maximum = max ?? new Color(1, 1, 1, 1);
return new Color
(
- (float)Mathf.Clamp(r, minimum.r, maximum.r),
- (float)Mathf.Clamp(g, minimum.g, maximum.g),
- (float)Mathf.Clamp(b, minimum.b, maximum.b),
- (float)Mathf.Clamp(a, minimum.a, maximum.a)
+ (float)Mathf.Clamp(R, minimum.R, maximum.R),
+ (float)Mathf.Clamp(G, minimum.G, maximum.G),
+ (float)Mathf.Clamp(B, minimum.B, maximum.B),
+ (float)Mathf.Clamp(A, minimum.A, maximum.A)
);
}
@@ -305,9 +305,9 @@ namespace Godot
public readonly Color Darkened(float amount)
{
Color res = this;
- res.r *= 1.0f - amount;
- res.g *= 1.0f - amount;
- res.b *= 1.0f - amount;
+ res.R *= 1.0f - amount;
+ res.G *= 1.0f - amount;
+ res.B *= 1.0f - amount;
return res;
}
@@ -318,10 +318,10 @@ namespace Godot
public readonly Color Inverted()
{
return new Color(
- 1.0f - r,
- 1.0f - g,
- 1.0f - b,
- a
+ 1.0f - R,
+ 1.0f - G,
+ 1.0f - B,
+ A
);
}
@@ -334,9 +334,9 @@ namespace Godot
public readonly Color Lightened(float amount)
{
Color res = this;
- res.r += (1.0f - res.r) * amount;
- res.g += (1.0f - res.g) * amount;
- res.b += (1.0f - res.b) * amount;
+ res.R += (1.0f - res.R) * amount;
+ res.G += (1.0f - res.G) * amount;
+ res.B += (1.0f - res.B) * amount;
return res;
}
@@ -351,10 +351,10 @@ namespace Godot
{
return new Color
(
- (float)Mathf.Lerp(r, to.r, weight),
- (float)Mathf.Lerp(g, to.g, weight),
- (float)Mathf.Lerp(b, to.b, weight),
- (float)Mathf.Lerp(a, to.a, weight)
+ (float)Mathf.Lerp(R, to.R, weight),
+ (float)Mathf.Lerp(G, to.G, weight),
+ (float)Mathf.Lerp(B, to.B, weight),
+ (float)Mathf.Lerp(A, to.A, weight)
);
}
@@ -367,9 +367,9 @@ namespace Godot
public readonly Color LinearToSrgb()
{
return new Color(
- r < 0.0031308f ? 12.92f * r : (1.0f + 0.055f) * (float)Mathf.Pow(r, 1.0f / 2.4f) - 0.055f,
- g < 0.0031308f ? 12.92f * g : (1.0f + 0.055f) * (float)Mathf.Pow(g, 1.0f / 2.4f) - 0.055f,
- b < 0.0031308f ? 12.92f * b : (1.0f + 0.055f) * (float)Mathf.Pow(b, 1.0f / 2.4f) - 0.055f, a);
+ R < 0.0031308f ? 12.92f * R : (1.0f + 0.055f) * (float)Mathf.Pow(R, 1.0f / 2.4f) - 0.055f,
+ G < 0.0031308f ? 12.92f * G : (1.0f + 0.055f) * (float)Mathf.Pow(G, 1.0f / 2.4f) - 0.055f,
+ B < 0.0031308f ? 12.92f * B : (1.0f + 0.055f) * (float)Mathf.Pow(B, 1.0f / 2.4f) - 0.055f, A);
}
/// <summary>
@@ -381,10 +381,10 @@ namespace Godot
public readonly Color SrgbToLinear()
{
return new Color(
- r < 0.04045f ? r * (1.0f / 12.92f) : (float)Mathf.Pow((r + 0.055f) * (float)(1.0 / (1.0 + 0.055)), 2.4f),
- g < 0.04045f ? g * (1.0f / 12.92f) : (float)Mathf.Pow((g + 0.055f) * (float)(1.0 / (1.0 + 0.055)), 2.4f),
- b < 0.04045f ? b * (1.0f / 12.92f) : (float)Mathf.Pow((b + 0.055f) * (float)(1.0 / (1.0 + 0.055)), 2.4f),
- a);
+ R < 0.04045f ? R * (1.0f / 12.92f) : (float)Mathf.Pow((R + 0.055f) * (float)(1.0 / (1.0 + 0.055)), 2.4f),
+ G < 0.04045f ? G * (1.0f / 12.92f) : (float)Mathf.Pow((G + 0.055f) * (float)(1.0 / (1.0 + 0.055)), 2.4f),
+ B < 0.04045f ? B * (1.0f / 12.92f) : (float)Mathf.Pow((B + 0.055f) * (float)(1.0 / (1.0 + 0.055)), 2.4f),
+ A);
}
/// <summary>
@@ -395,13 +395,13 @@ namespace Godot
/// <returns>A <see langword="uint"/> representing this color in ABGR32 format.</returns>
public readonly uint ToAbgr32()
{
- uint c = (byte)Math.Round(a * 255);
+ uint c = (byte)Math.Round(A * 255);
c <<= 8;
- c |= (byte)Math.Round(b * 255);
+ c |= (byte)Math.Round(B * 255);
c <<= 8;
- c |= (byte)Math.Round(g * 255);
+ c |= (byte)Math.Round(G * 255);
c <<= 8;
- c |= (byte)Math.Round(r * 255);
+ c |= (byte)Math.Round(R * 255);
return c;
}
@@ -414,13 +414,13 @@ namespace Godot
/// <returns>A <see langword="ulong"/> representing this color in ABGR64 format.</returns>
public readonly ulong ToAbgr64()
{
- ulong c = (ushort)Math.Round(a * 65535);
+ ulong c = (ushort)Math.Round(A * 65535);
c <<= 16;
- c |= (ushort)Math.Round(b * 65535);
+ c |= (ushort)Math.Round(B * 65535);
c <<= 16;
- c |= (ushort)Math.Round(g * 65535);
+ c |= (ushort)Math.Round(G * 65535);
c <<= 16;
- c |= (ushort)Math.Round(r * 65535);
+ c |= (ushort)Math.Round(R * 65535);
return c;
}
@@ -433,13 +433,13 @@ namespace Godot
/// <returns>A <see langword="uint"/> representing this color in ARGB32 format.</returns>
public readonly uint ToArgb32()
{
- uint c = (byte)Math.Round(a * 255);
+ uint c = (byte)Math.Round(A * 255);
c <<= 8;
- c |= (byte)Math.Round(r * 255);
+ c |= (byte)Math.Round(R * 255);
c <<= 8;
- c |= (byte)Math.Round(g * 255);
+ c |= (byte)Math.Round(G * 255);
c <<= 8;
- c |= (byte)Math.Round(b * 255);
+ c |= (byte)Math.Round(B * 255);
return c;
}
@@ -452,13 +452,13 @@ namespace Godot
/// <returns>A <see langword="ulong"/> representing this color in ARGB64 format.</returns>
public readonly ulong ToArgb64()
{
- ulong c = (ushort)Math.Round(a * 65535);
+ ulong c = (ushort)Math.Round(A * 65535);
c <<= 16;
- c |= (ushort)Math.Round(r * 65535);
+ c |= (ushort)Math.Round(R * 65535);
c <<= 16;
- c |= (ushort)Math.Round(g * 65535);
+ c |= (ushort)Math.Round(G * 65535);
c <<= 16;
- c |= (ushort)Math.Round(b * 65535);
+ c |= (ushort)Math.Round(B * 65535);
return c;
}
@@ -471,13 +471,13 @@ namespace Godot
/// <returns>A <see langword="uint"/> representing this color in RGBA32 format.</returns>
public readonly uint ToRgba32()
{
- uint c = (byte)Math.Round(r * 255);
+ uint c = (byte)Math.Round(R * 255);
c <<= 8;
- c |= (byte)Math.Round(g * 255);
+ c |= (byte)Math.Round(G * 255);
c <<= 8;
- c |= (byte)Math.Round(b * 255);
+ c |= (byte)Math.Round(B * 255);
c <<= 8;
- c |= (byte)Math.Round(a * 255);
+ c |= (byte)Math.Round(A * 255);
return c;
}
@@ -490,13 +490,13 @@ namespace Godot
/// <returns>A <see langword="ulong"/> representing this color in RGBA64 format.</returns>
public readonly ulong ToRgba64()
{
- ulong c = (ushort)Math.Round(r * 65535);
+ ulong c = (ushort)Math.Round(R * 65535);
c <<= 16;
- c |= (ushort)Math.Round(g * 65535);
+ c |= (ushort)Math.Round(G * 65535);
c <<= 16;
- c |= (ushort)Math.Round(b * 65535);
+ c |= (ushort)Math.Round(B * 65535);
c <<= 16;
- c |= (ushort)Math.Round(a * 65535);
+ c |= (ushort)Math.Round(A * 65535);
return c;
}
@@ -508,17 +508,17 @@ namespace Godot
/// Whether or not to include alpha. If <see langword="false"/>, the color is RGB instead of RGBA.
/// </param>
/// <returns>A string for the HTML hexadecimal representation of this color.</returns>
- public readonly string ToHTML(bool includeAlpha = true)
+ public readonly string ToHtml(bool includeAlpha = true)
{
string txt = string.Empty;
- txt += ToHex32(r);
- txt += ToHex32(g);
- txt += ToHex32(b);
+ txt += ToHex32(R);
+ txt += ToHex32(G);
+ txt += ToHex32(B);
if (includeAlpha)
{
- txt += ToHex32(a);
+ txt += ToHex32(A);
}
return txt;
@@ -533,10 +533,10 @@ namespace Godot
/// <param name="a">The color's alpha (transparency) value, typically on the range of 0 to 1. Default: 1.</param>
public Color(float r, float g, float b, float a = 1.0f)
{
- this.r = r;
- this.g = g;
- this.b = b;
- this.a = a;
+ R = r;
+ G = g;
+ B = b;
+ A = a;
}
/// <summary>
@@ -546,10 +546,10 @@ namespace Godot
/// <param name="a">The color's alpha (transparency) value, typically on the range of 0 to 1. Default: 1.</param>
public Color(Color c, float a = 1.0f)
{
- r = c.r;
- g = c.g;
- b = c.b;
- this.a = a;
+ R = c.R;
+ G = c.G;
+ B = c.B;
+ A = a;
}
/// <summary>
@@ -559,13 +559,13 @@ namespace Godot
/// <param name="rgba">The <see langword="uint"/> representing the color.</param>
public Color(uint rgba)
{
- a = (rgba & 0xFF) / 255.0f;
+ A = (rgba & 0xFF) / 255.0f;
rgba >>= 8;
- b = (rgba & 0xFF) / 255.0f;
+ B = (rgba & 0xFF) / 255.0f;
rgba >>= 8;
- g = (rgba & 0xFF) / 255.0f;
+ G = (rgba & 0xFF) / 255.0f;
rgba >>= 8;
- r = (rgba & 0xFF) / 255.0f;
+ R = (rgba & 0xFF) / 255.0f;
}
/// <summary>
@@ -575,13 +575,13 @@ namespace Godot
/// <param name="rgba">The <see langword="ulong"/> representing the color.</param>
public Color(ulong rgba)
{
- a = (rgba & 0xFFFF) / 65535.0f;
+ A = (rgba & 0xFFFF) / 65535.0f;
rgba >>= 16;
- b = (rgba & 0xFFFF) / 65535.0f;
+ B = (rgba & 0xFFFF) / 65535.0f;
rgba >>= 16;
- g = (rgba & 0xFFFF) / 65535.0f;
+ G = (rgba & 0xFFFF) / 65535.0f;
rgba >>= 16;
- r = (rgba & 0xFFFF) / 65535.0f;
+ R = (rgba & 0xFFFF) / 65535.0f;
}
/// <summary>
@@ -598,7 +598,7 @@ namespace Godot
{
if (HtmlIsValid(code))
{
- this = FromHTML(code);
+ this = FromHtml(code);
}
else
{
@@ -616,7 +616,7 @@ namespace Godot
public Color(string code, float alpha)
{
this = new Color(code);
- a = alpha;
+ A = alpha;
}
/// <summary>
@@ -626,15 +626,15 @@ namespace Godot
/// <exception name="ArgumentOutOfRangeException">
/// <paramref name="rgba"/> color code is invalid.
/// </exception>
- public static Color FromHTML(ReadOnlySpan<char> rgba)
+ public static Color FromHtml(ReadOnlySpan<char> rgba)
{
Color c;
if (rgba.Length == 0)
{
- c.r = 0f;
- c.g = 0f;
- c.b = 0f;
- c.a = 1.0f;
+ c.R = 0f;
+ c.G = 0f;
+ c.B = 0f;
+ c.A = 1.0f;
return c;
}
@@ -670,44 +670,44 @@ namespace Godot
$"Invalid color code. Length is {rgba.Length}, but a length of 6 or 8 is expected: {rgba}");
}
- c.a = 1.0f;
+ c.A = 1.0f;
if (isShorthand)
{
- c.r = ParseCol4(rgba, 0) / 15f;
- c.g = ParseCol4(rgba, 1) / 15f;
- c.b = ParseCol4(rgba, 2) / 15f;
+ c.R = ParseCol4(rgba, 0) / 15f;
+ c.G = ParseCol4(rgba, 1) / 15f;
+ c.B = ParseCol4(rgba, 2) / 15f;
if (alpha)
{
- c.a = ParseCol4(rgba, 3) / 15f;
+ c.A = ParseCol4(rgba, 3) / 15f;
}
}
else
{
- c.r = ParseCol8(rgba, 0) / 255f;
- c.g = ParseCol8(rgba, 2) / 255f;
- c.b = ParseCol8(rgba, 4) / 255f;
+ c.R = ParseCol8(rgba, 0) / 255f;
+ c.G = ParseCol8(rgba, 2) / 255f;
+ c.B = ParseCol8(rgba, 4) / 255f;
if (alpha)
{
- c.a = ParseCol8(rgba, 6) / 255f;
+ c.A = ParseCol8(rgba, 6) / 255f;
}
}
- if (c.r < 0)
+ if (c.R < 0)
{
throw new ArgumentOutOfRangeException($"Invalid color code. Red part is not valid hexadecimal: {rgba}");
}
- if (c.g < 0)
+ if (c.G < 0)
{
throw new ArgumentOutOfRangeException($"Invalid color code. Green part is not valid hexadecimal: {rgba}");
}
- if (c.b < 0)
+ if (c.B < 0)
{
throw new ArgumentOutOfRangeException($"Invalid color code. Blue part is not valid hexadecimal: {rgba}");
}
- if (c.a < 0)
+ if (c.A < 0)
{
throw new ArgumentOutOfRangeException($"Invalid color code. Alpha part is not valid hexadecimal: {rgba}");
}
@@ -793,11 +793,11 @@ namespace Godot
/// <param name="value">The HSV value (brightness), typically on the range of 0 to 1.</param>
/// <param name="alpha">The alpha (transparency) value, typically on the range of 0 to 1.</param>
/// <returns>The constructed color.</returns>
- public static Color FromHSV(float hue, float saturation, float value, float alpha = 1.0f)
+ public static Color FromHsv(float hue, float saturation, float value, float alpha = 1.0f)
{
if (saturation == 0)
{
- // Achromatic (grey)
+ // Achromatic (gray)
return new Color(value, value, value, alpha);
}
@@ -837,10 +837,10 @@ namespace Godot
/// <param name="hue">Output parameter for the HSV hue.</param>
/// <param name="saturation">Output parameter for the HSV saturation.</param>
/// <param name="value">Output parameter for the HSV value.</param>
- public readonly void ToHSV(out float hue, out float saturation, out float value)
+ public readonly void ToHsv(out float hue, out float saturation, out float value)
{
- float max = (float)Mathf.Max(r, Mathf.Max(g, b));
- float min = (float)Mathf.Min(r, Mathf.Min(g, b));
+ float max = (float)Mathf.Max(R, Mathf.Max(G, B));
+ float min = (float)Mathf.Min(R, Mathf.Min(G, B));
float delta = max - min;
@@ -850,17 +850,17 @@ namespace Godot
}
else
{
- if (r == max)
+ if (R == max)
{
- hue = (g - b) / delta; // Between yellow & magenta
+ hue = (G - B) / delta; // Between yellow & magenta
}
- else if (g == max)
+ else if (G == max)
{
- hue = 2 + ((b - r) / delta); // Between cyan & yellow
+ hue = 2 + ((B - R) / delta); // Between cyan & yellow
}
else
{
- hue = 4 + ((r - g) / delta); // Between magenta & cyan
+ hue = 4 + ((R - G) / delta); // Between magenta & cyan
}
hue /= 6.0f;
@@ -950,7 +950,7 @@ namespace Godot
{
if (HtmlIsValid(str))
{
- return FromHTML(str);
+ return FromHtml(str);
}
else
{
@@ -1012,10 +1012,10 @@ namespace Godot
/// <returns>The added color.</returns>
public static Color operator +(Color left, Color right)
{
- left.r += right.r;
- left.g += right.g;
- left.b += right.b;
- left.a += right.a;
+ left.R += right.R;
+ left.G += right.G;
+ left.B += right.B;
+ left.A += right.A;
return left;
}
@@ -1028,17 +1028,17 @@ namespace Godot
/// <returns>The subtracted color.</returns>
public static Color operator -(Color left, Color right)
{
- left.r -= right.r;
- left.g -= right.g;
- left.b -= right.b;
- left.a -= right.a;
+ left.R -= right.R;
+ left.G -= right.G;
+ left.B -= right.B;
+ left.A -= right.A;
return left;
}
/// <summary>
/// Inverts the given color. This is equivalent to
/// <c>Colors.White - c</c> or
- /// <c>new Color(1 - c.r, 1 - c.g, 1 - c.b, 1 - c.a)</c>.
+ /// <c>new Color(1 - c.R, 1 - c.G, 1 - c.B, 1 - c.A)</c>.
/// </summary>
/// <param name="color">The color to invert.</param>
/// <returns>The inverted color.</returns>
@@ -1056,10 +1056,10 @@ namespace Godot
/// <returns>The multiplied color.</returns>
public static Color operator *(Color color, float scale)
{
- color.r *= scale;
- color.g *= scale;
- color.b *= scale;
- color.a *= scale;
+ color.R *= scale;
+ color.G *= scale;
+ color.B *= scale;
+ color.A *= scale;
return color;
}
@@ -1072,10 +1072,10 @@ namespace Godot
/// <returns>The multiplied color.</returns>
public static Color operator *(float scale, Color color)
{
- color.r *= scale;
- color.g *= scale;
- color.b *= scale;
- color.a *= scale;
+ color.R *= scale;
+ color.G *= scale;
+ color.B *= scale;
+ color.A *= scale;
return color;
}
@@ -1088,10 +1088,10 @@ namespace Godot
/// <returns>The multiplied color.</returns>
public static Color operator *(Color left, Color right)
{
- left.r *= right.r;
- left.g *= right.g;
- left.b *= right.b;
- left.a *= right.a;
+ left.R *= right.R;
+ left.G *= right.G;
+ left.B *= right.B;
+ left.A *= right.A;
return left;
}
@@ -1104,10 +1104,10 @@ namespace Godot
/// <returns>The divided color.</returns>
public static Color operator /(Color color, float scale)
{
- color.r /= scale;
- color.g /= scale;
- color.b /= scale;
- color.a /= scale;
+ color.R /= scale;
+ color.G /= scale;
+ color.B /= scale;
+ color.A /= scale;
return color;
}
@@ -1120,10 +1120,10 @@ namespace Godot
/// <returns>The divided color.</returns>
public static Color operator /(Color left, Color right)
{
- left.r /= right.r;
- left.g /= right.g;
- left.b /= right.b;
- left.a /= right.a;
+ left.R /= right.R;
+ left.G /= right.G;
+ left.B /= right.B;
+ left.A /= right.A;
return left;
}
@@ -1167,19 +1167,19 @@ namespace Godot
/// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Color left, Color right)
{
- if (left.r == right.r)
+ if (left.R == right.R)
{
- if (left.g == right.g)
+ if (left.G == right.G)
{
- if (left.b == right.b)
+ if (left.B == right.B)
{
- return left.a < right.a;
+ return left.A < right.A;
}
- return left.b < right.b;
+ return left.B < right.B;
}
- return left.g < right.g;
+ return left.G < right.G;
}
- return left.r < right.r;
+ return left.R < right.R;
}
/// <summary>
@@ -1196,19 +1196,19 @@ namespace Godot
/// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Color left, Color right)
{
- if (left.r == right.r)
+ if (left.R == right.R)
{
- if (left.g == right.g)
+ if (left.G == right.G)
{
- if (left.b == right.b)
+ if (left.B == right.B)
{
- return left.a > right.a;
+ return left.A > right.A;
}
- return left.b > right.b;
+ return left.B > right.B;
}
- return left.g > right.g;
+ return left.G > right.G;
}
- return left.r > right.r;
+ return left.R > right.R;
}
/// <summary>
@@ -1225,19 +1225,19 @@ namespace Godot
/// <returns>Whether or not the left is less than or equal to the right.</returns>
public static bool operator <=(Color left, Color right)
{
- if (left.r == right.r)
+ if (left.R == right.R)
{
- if (left.g == right.g)
+ if (left.G == right.G)
{
- if (left.b == right.b)
+ if (left.B == right.B)
{
- return left.a <= right.a;
+ return left.A <= right.A;
}
- return left.b < right.b;
+ return left.B < right.B;
}
- return left.g < right.g;
+ return left.G < right.G;
}
- return left.r < right.r;
+ return left.R < right.R;
}
/// <summary>
@@ -1254,19 +1254,19 @@ namespace Godot
/// <returns>Whether or not the left is greater than or equal to the right.</returns>
public static bool operator >=(Color left, Color right)
{
- if (left.r == right.r)
+ if (left.R == right.R)
{
- if (left.g == right.g)
+ if (left.G == right.G)
{
- if (left.b == right.b)
+ if (left.B == right.B)
{
- return left.a >= right.a;
+ return left.A >= right.A;
}
- return left.b > right.b;
+ return left.B > right.B;
}
- return left.g > right.g;
+ return left.G > right.G;
}
- return left.r > right.r;
+ return left.R > right.R;
}
/// <summary>
@@ -1288,7 +1288,7 @@ namespace Godot
/// <returns>Whether or not the colors are equal.</returns>
public readonly bool Equals(Color other)
{
- return r == other.r && g == other.g && b == other.b && a == other.a;
+ return R == other.R && G == other.G && B == other.B && A == other.A;
}
/// <summary>
@@ -1299,7 +1299,7 @@ namespace Godot
/// <returns>Whether or not the colors are approximately equal.</returns>
public readonly bool IsEqualApprox(Color other)
{
- return Mathf.IsEqualApprox(r, other.r) && Mathf.IsEqualApprox(g, other.g) && Mathf.IsEqualApprox(b, other.b) && Mathf.IsEqualApprox(a, other.a);
+ return Mathf.IsEqualApprox(R, other.R) && Mathf.IsEqualApprox(G, other.G) && Mathf.IsEqualApprox(B, other.B) && Mathf.IsEqualApprox(A, other.A);
}
/// <summary>
@@ -1308,7 +1308,7 @@ namespace Godot
/// <returns>A hash code for this color.</returns>
public override readonly int GetHashCode()
{
- return r.GetHashCode() ^ g.GetHashCode() ^ b.GetHashCode() ^ a.GetHashCode();
+ return R.GetHashCode() ^ G.GetHashCode() ^ B.GetHashCode() ^ A.GetHashCode();
}
/// <summary>
@@ -1317,7 +1317,7 @@ namespace Godot
/// <returns>A string representation of this color.</returns>
public override readonly string ToString()
{
- return $"({r}, {g}, {b}, {a})";
+ return $"({R}, {G}, {B}, {A})";
}
/// <summary>
@@ -1326,7 +1326,7 @@ namespace Godot
/// <returns>A string representation of this color.</returns>
public readonly string ToString(string format)
{
- return $"({r.ToString(format)}, {g.ToString(format)}, {b.ToString(format)}, {a.ToString(format)})";
+ return $"({R.ToString(format)}, {G.ToString(format)}, {B.ToString(format)}, {A.ToString(format)})";
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs
index d94fbff331..4a54f67cc9 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs
@@ -126,7 +126,7 @@ namespace Godot
}
}
// ReSharper disable once RedundantNameQualifier
- case Godot.Object godotObject:
+ case GodotObject godotObject:
{
using (var stream = new MemoryStream())
using (var writer = new BinaryWriter(stream))
@@ -399,7 +399,7 @@ namespace Godot
{
ulong objectId = reader.ReadUInt64();
// ReSharper disable once RedundantNameQualifier
- Godot.Object godotObject = GD.InstanceFromId(objectId);
+ GodotObject godotObject = GodotObject.InstanceFromId(objectId);
if (godotObject == null)
return false;
@@ -581,31 +581,31 @@ namespace Godot
return VariantUtils.CreateFrom(@double);
case Vector2 vector2:
return VariantUtils.CreateFrom(vector2);
- case Vector2i vector2I:
+ case Vector2I vector2I:
return VariantUtils.CreateFrom(vector2I);
case Rect2 rect2:
return VariantUtils.CreateFrom(rect2);
- case Rect2i rect2I:
+ case Rect2I rect2I:
return VariantUtils.CreateFrom(rect2I);
case Transform2D transform2D:
return VariantUtils.CreateFrom(transform2D);
case Vector3 vector3:
return VariantUtils.CreateFrom(vector3);
- case Vector3i vector3I:
+ case Vector3I vector3I:
return VariantUtils.CreateFrom(vector3I);
case Vector4 vector4:
return VariantUtils.CreateFrom(vector4);
- case Vector4i vector4I:
+ case Vector4I vector4I:
return VariantUtils.CreateFrom(vector4I);
case Basis basis:
return VariantUtils.CreateFrom(basis);
case Quaternion quaternion:
return VariantUtils.CreateFrom(quaternion);
- case Transform3D transform3d:
- return VariantUtils.CreateFrom(transform3d);
+ case Transform3D transform3D:
+ return VariantUtils.CreateFrom(transform3D);
case Projection projection:
return VariantUtils.CreateFrom(projection);
- case AABB aabb:
+ case Aabb aabb:
return VariantUtils.CreateFrom(aabb);
case Color color:
return VariantUtils.CreateFrom(color);
@@ -639,15 +639,15 @@ namespace Godot
return VariantUtils.CreateFrom(stringNameArray);
case NodePath[] nodePathArray:
return VariantUtils.CreateFrom(nodePathArray);
- case RID[] ridArray:
+ case Rid[] ridArray:
return VariantUtils.CreateFrom(ridArray);
- case Godot.Object[] godotObjectArray:
+ case GodotObject[] godotObjectArray:
return VariantUtils.CreateFrom(godotObjectArray);
case StringName stringName:
return VariantUtils.CreateFrom(stringName);
case NodePath nodePath:
return VariantUtils.CreateFrom(nodePath);
- case RID rid:
+ case Rid rid:
return VariantUtils.CreateFrom(rid);
case Collections.Dictionary godotDictionary:
return VariantUtils.CreateFrom(godotDictionary);
@@ -655,7 +655,7 @@ namespace Godot
return VariantUtils.CreateFrom(godotArray);
case Variant variant:
return VariantUtils.CreateFrom(variant);
- case Godot.Object godotObject:
+ case GodotObject godotObject:
return VariantUtils.CreateFrom(godotObject);
case Enum @enum:
return VariantUtils.CreateFrom(Convert.ToInt64(@enum));
@@ -690,18 +690,18 @@ namespace Godot
[typeof(float)] = (in godot_variant variant) => VariantUtils.ConvertTo<float>(variant),
[typeof(double)] = (in godot_variant variant) => VariantUtils.ConvertTo<double>(variant),
[typeof(Vector2)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector2>(variant),
- [typeof(Vector2i)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector2i>(variant),
+ [typeof(Vector2I)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector2I>(variant),
[typeof(Rect2)] = (in godot_variant variant) => VariantUtils.ConvertTo<Rect2>(variant),
- [typeof(Rect2i)] = (in godot_variant variant) => VariantUtils.ConvertTo<Rect2i>(variant),
+ [typeof(Rect2I)] = (in godot_variant variant) => VariantUtils.ConvertTo<Rect2I>(variant),
[typeof(Transform2D)] = (in godot_variant variant) => VariantUtils.ConvertTo<Transform2D>(variant),
[typeof(Vector3)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector3>(variant),
- [typeof(Vector3i)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector3i>(variant),
+ [typeof(Vector3I)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector3I>(variant),
[typeof(Basis)] = (in godot_variant variant) => VariantUtils.ConvertTo<Basis>(variant),
[typeof(Quaternion)] = (in godot_variant variant) => VariantUtils.ConvertTo<Quaternion>(variant),
[typeof(Transform3D)] = (in godot_variant variant) => VariantUtils.ConvertTo<Transform3D>(variant),
[typeof(Vector4)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector4>(variant),
- [typeof(Vector4i)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector4i>(variant),
- [typeof(AABB)] = (in godot_variant variant) => VariantUtils.ConvertTo<AABB>(variant),
+ [typeof(Vector4I)] = (in godot_variant variant) => VariantUtils.ConvertTo<Vector4I>(variant),
+ [typeof(Aabb)] = (in godot_variant variant) => VariantUtils.ConvertTo<Aabb>(variant),
[typeof(Color)] = (in godot_variant variant) => VariantUtils.ConvertTo<Color>(variant),
[typeof(Plane)] = (in godot_variant variant) => VariantUtils.ConvertTo<Plane>(variant),
[typeof(Callable)] = (in godot_variant variant) => VariantUtils.ConvertTo<Callable>(variant),
@@ -719,10 +719,10 @@ namespace Godot
[typeof(StringName[])] =
(in godot_variant variant) => VariantUtils.ConvertTo<StringName[]>(variant),
[typeof(NodePath[])] = (in godot_variant variant) => VariantUtils.ConvertTo<NodePath[]>(variant),
- [typeof(RID[])] = (in godot_variant variant) => VariantUtils.ConvertTo<RID[]>(variant),
+ [typeof(Rid[])] = (in godot_variant variant) => VariantUtils.ConvertTo<Rid[]>(variant),
[typeof(StringName)] = (in godot_variant variant) => VariantUtils.ConvertTo<StringName>(variant),
[typeof(NodePath)] = (in godot_variant variant) => VariantUtils.ConvertTo<NodePath>(variant),
- [typeof(RID)] = (in godot_variant variant) => VariantUtils.ConvertTo<RID>(variant),
+ [typeof(Rid)] = (in godot_variant variant) => VariantUtils.ConvertTo<Rid>(variant),
[typeof(Godot.Collections.Dictionary)] = (in godot_variant variant) =>
VariantUtils.ConvertTo<Godot.Collections.Dictionary>(variant),
[typeof(Godot.Collections.Array)] =
@@ -736,18 +736,18 @@ namespace Godot
if (ToSystemObjectFuncByType.TryGetValue(type, out var func))
return func(variant);
- if (typeof(Godot.Object).IsAssignableFrom(type))
- return Convert.ChangeType(VariantUtils.ConvertTo<Godot.Object>(variant), type);
+ if (typeof(GodotObject).IsAssignableFrom(type))
+ return Convert.ChangeType(VariantUtils.ConvertTo<GodotObject>(variant), type);
- if (typeof(Godot.Object[]).IsAssignableFrom(type))
+ if (typeof(GodotObject[]).IsAssignableFrom(type))
{
- static Godot.Object[] ConvertToSystemArrayOfGodotObject(in godot_array nativeArray, Type type)
+ static GodotObject[] ConvertToSystemArrayOfGodotObject(in godot_array nativeArray, Type type)
{
var array = Collections.Array.CreateTakingOwnershipOfDisposableValue(
NativeFuncs.godotsharp_array_new_copy(nativeArray));
int length = array.Count;
- var ret = (Godot.Object[])Activator.CreateInstance(type, length)!;
+ var ret = (GodotObject[])Activator.CreateInstance(type, length)!;
for (int i = 0; i < length; i++)
ret[i] = array[i].AsGodotObject();
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs
index b5a8742d3d..923b2adafd 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs
@@ -68,7 +68,15 @@ namespace Godot.Collections
}
/// <summary>
- /// Duplicates this <see cref="Dictionary"/>.
+ /// Returns a copy of the <see cref="Dictionary"/>.
+ /// If <paramref name="deep"/> is <see langword="true"/>, a deep copy is performed:
+ /// all nested arrays and dictionaries are duplicated and will not be shared with
+ /// the original dictionary. If <see langword="false"/>, a shallow copy is made and
+ /// references to the original nested arrays and dictionaries are kept, so that
+ /// modifying a sub-array or dictionary in the copy will also impact those
+ /// referenced in the source dictionary. Note that any <see cref="GodotObject"/> derived
+ /// elements will be shallow copied regardless of the <paramref name="deep"/>
+ /// setting.
/// </summary>
/// <param name="deep">If <see langword="true"/>, performs a deep copy.</param>
/// <returns>A new Godot Dictionary.</returns>
@@ -80,6 +88,44 @@ namespace Godot.Collections
return CreateTakingOwnershipOfDisposableValue(newDictionary);
}
+ /// <summary>
+ /// Adds entries from <paramref name="dictionary"/> to this dictionary.
+ /// By default, duplicate keys are not copied over, unless <paramref name="overwrite"/>
+ /// is <see langword="true"/>.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The dictionary is read-only.
+ /// </exception>
+ /// <param name="dictionary">Dictionary to copy entries from.</param>
+ /// <param name="overwrite">If duplicate keys should be copied over as well.</param>
+ public void Merge(Dictionary dictionary, bool overwrite = false)
+ {
+ ThrowIfReadOnly();
+
+ var self = (godot_dictionary)NativeValue;
+ var other = (godot_dictionary)dictionary.NativeValue;
+ NativeFuncs.godotsharp_dictionary_merge(ref self, in other, overwrite.ToGodotBool());
+ }
+
+ /// <summary>
+ /// Compares this <see cref="Dictionary"/> against the <paramref name="other"/>
+ /// <see cref="Dictionary"/> recursively. Returns <see langword="true"/> if the
+ /// two dictionaries contain the same keys and values. The order of the entries
+ /// does not matter.
+ /// otherwise.
+ /// </summary>
+ /// <param name="other">The other dictionary to compare against.</param>
+ /// <returns>
+ /// <see langword="true"/> if the dictionaries contain the same keys and values,
+ /// <see langword="false"/> otherwise.
+ /// </returns>
+ public bool RecursiveEqual(Dictionary other)
+ {
+ var self = (godot_dictionary)NativeValue;
+ var otherVariant = (godot_dictionary)other.NativeValue;
+ return NativeFuncs.godotsharp_dictionary_recursive_equal(ref self, otherVariant).ToBool();
+ }
+
// IDictionary
/// <summary>
@@ -134,6 +180,13 @@ namespace Godot.Collections
/// <summary>
/// Returns the value at the given <paramref name="key"/>.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The property is assigned and the dictionary is read-only.
+ /// </exception>
+ /// <exception cref="KeyNotFoundException">
+ /// The property is retrieved and an entry for <paramref name="key"/>
+ /// does not exist in the dictionary.
+ /// </exception>
/// <value>The value at the given <paramref name="key"/>.</value>
public Variant this[Variant key]
{
@@ -153,6 +206,8 @@ namespace Godot.Collections
}
set
{
+ ThrowIfReadOnly();
+
var self = (godot_dictionary)NativeValue;
NativeFuncs.godotsharp_dictionary_set_value(ref self,
(godot_variant)key.NativeVar, (godot_variant)value.NativeVar);
@@ -163,10 +218,18 @@ namespace Godot.Collections
/// Adds an value <paramref name="value"/> at key <paramref name="key"/>
/// to this <see cref="Dictionary"/>.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The dictionary is read-only.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// An entry for <paramref name="key"/> already exists in the dictionary.
+ /// </exception>
/// <param name="key">The key at which to add the value.</param>
/// <param name="value">The value to add.</param>
public void Add(Variant key, Variant value)
{
+ ThrowIfReadOnly();
+
var variantKey = (godot_variant)key.NativeVar;
var self = (godot_dictionary)NativeValue;
@@ -181,10 +244,15 @@ namespace Godot.Collections
=> Add(item.Key, item.Value);
/// <summary>
- /// Erases all items from this <see cref="Dictionary"/>.
+ /// Clears the dictionary, removing all entries from it.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The dictionary is read-only.
+ /// </exception>
public void Clear()
{
+ ThrowIfReadOnly();
+
var self = (godot_dictionary)NativeValue;
NativeFuncs.godotsharp_dictionary_clear(ref self);
}
@@ -200,7 +268,7 @@ namespace Godot.Collections
return NativeFuncs.godotsharp_dictionary_contains_key(ref self, (godot_variant)key.NativeVar).ToBool();
}
- public bool Contains(KeyValuePair<Variant, Variant> item)
+ bool ICollection<KeyValuePair<Variant, Variant>>.Contains(KeyValuePair<Variant, Variant> item)
{
godot_variant variantKey = (godot_variant)item.Key.NativeVar;
var self = (godot_dictionary)NativeValue;
@@ -220,15 +288,22 @@ namespace Godot.Collections
/// <summary>
/// Removes an element from this <see cref="Dictionary"/> by key.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The dictionary is read-only.
+ /// </exception>
/// <param name="key">The key of the element to remove.</param>
public bool Remove(Variant key)
{
+ ThrowIfReadOnly();
+
var self = (godot_dictionary)NativeValue;
return NativeFuncs.godotsharp_dictionary_remove_key(ref self, (godot_variant)key.NativeVar).ToBool();
}
- public bool Remove(KeyValuePair<Variant, Variant> item)
+ bool ICollection<KeyValuePair<Variant, Variant>>.Remove(KeyValuePair<Variant, Variant> item)
{
+ ThrowIfReadOnly();
+
godot_variant variantKey = (godot_variant)item.Key.NativeVar;
var self = (godot_dictionary)NativeValue;
bool found = NativeFuncs.godotsharp_dictionary_try_get_value(ref self,
@@ -264,8 +339,37 @@ namespace Godot.Collections
}
}
- bool ICollection<KeyValuePair<Variant, Variant>>.IsReadOnly => false;
+ /// <summary>
+ /// Returns <see langword="true"/> if the dictionary is read-only.
+ /// See <see cref="MakeReadOnly"/>.
+ /// </summary>
+ public bool IsReadOnly => NativeValue.DangerousSelfRef.IsReadOnly;
+
+ /// <summary>
+ /// Makes the <see cref="Dictionary"/> read-only, i.e. disabled modying of the
+ /// dictionary's elements. Does not apply to nested content, e.g. content of
+ /// nested dictionaries.
+ /// </summary>
+ public void MakeReadOnly()
+ {
+ if (IsReadOnly)
+ {
+ // Avoid interop call when the dictionary is already read-only.
+ return;
+ }
+
+ var self = (godot_dictionary)NativeValue;
+ NativeFuncs.godotsharp_dictionary_make_read_only(ref self);
+ }
+ /// <summary>
+ /// Gets the value for the given <paramref name="key"/> in the dictionary.
+ /// Returns <see langword="true"/> if an entry for the given key exists in
+ /// the dictionary; otherwise, returns <see langword="false"/>.
+ /// </summary>
+ /// <param name="key">The key of the element to get.</param>
+ /// <param name="value">The value at the given <paramref name="key"/>.</param>
+ /// <returns>If an entry was found for the given <paramref name="key"/>.</returns>
public bool TryGetValue(Variant key, out Variant value)
{
var self = (godot_dictionary)NativeValue;
@@ -283,7 +387,7 @@ namespace Godot.Collections
/// </summary>
/// <param name="array">The array to copy to.</param>
/// <param name="arrayIndex">The index to start at.</param>
- public void CopyTo(KeyValuePair<Variant, Variant>[] array, int arrayIndex)
+ void ICollection<KeyValuePair<Variant, Variant>>.CopyTo(KeyValuePair<Variant, Variant>[] array, int arrayIndex)
{
if (array == null)
throw new ArgumentNullException(nameof(array), "Value cannot be null.");
@@ -342,6 +446,14 @@ namespace Godot.Collections
using (str)
return Marshaling.ConvertStringToManaged(str);
}
+
+ private void ThrowIfReadOnly()
+ {
+ if (IsReadOnly)
+ {
+ throw new InvalidOperationException("Dictionary instance is read-only.");
+ }
+ }
}
internal interface IGenericGodotDictionary
@@ -433,20 +545,64 @@ namespace Godot.Collections
}
/// <summary>
- /// Duplicates this <see cref="Dictionary{TKey, TValue}"/>.
+ /// Returns a copy of the <see cref="Dictionary{TKey, TValue}"/>.
+ /// If <paramref name="deep"/> is <see langword="true"/>, a deep copy is performed:
+ /// all nested arrays and dictionaries are duplicated and will not be shared with
+ /// the original dictionary. If <see langword="false"/>, a shallow copy is made and
+ /// references to the original nested arrays and dictionaries are kept, so that
+ /// modifying a sub-array or dictionary in the copy will also impact those
+ /// referenced in the source dictionary. Note that any <see cref="GodotObject"/> derived
+ /// elements will be shallow copied regardless of the <paramref name="deep"/>
+ /// setting.
/// </summary>
- /// <param name="deep">If <see langword="true"/>, performs a deep copy.</param>
- /// <returns>A new Godot Dictionary.</returns>
public Dictionary<TKey, TValue> Duplicate(bool deep = false)
{
return new Dictionary<TKey, TValue>(_underlyingDict.Duplicate(deep));
}
+ /// <summary>
+ /// Adds entries from <paramref name="dictionary"/> to this dictionary.
+ /// By default, duplicate keys are not copied over, unless <paramref name="overwrite"/>
+ /// is <see langword="true"/>.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The dictionary is read-only.
+ /// </exception>
+ /// <param name="dictionary">Dictionary to copy entries from.</param>
+ /// <param name="overwrite">If duplicate keys should be copied over as well.</param>
+ public void Merge(Dictionary<TKey, TValue> dictionary, bool overwrite = false)
+ {
+ _underlyingDict.Merge(dictionary._underlyingDict, overwrite);
+ }
+
+ /// <summary>
+ /// Compares this <see cref="Dictionary{TKey, TValue}"/> against the <paramref name="other"/>
+ /// <see cref="Dictionary{TKey, TValue}"/> recursively. Returns <see langword="true"/> if the
+ /// two dictionaries contain the same keys and values. The order of the entries does not matter.
+ /// otherwise.
+ /// </summary>
+ /// <param name="other">The other dictionary to compare against.</param>
+ /// <returns>
+ /// <see langword="true"/> if the dictionaries contain the same keys and values,
+ /// <see langword="false"/> otherwise.
+ /// </returns>
+ public bool RecursiveEqual(Dictionary<TKey, TValue> other)
+ {
+ return _underlyingDict.RecursiveEqual(other._underlyingDict);
+ }
+
// IDictionary<TKey, TValue>
/// <summary>
/// Returns the value at the given <paramref name="key"/>.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The property is assigned and the dictionary is read-only.
+ /// </exception>
+ /// <exception cref="KeyNotFoundException">
+ /// The property is retrieved and an entry for <paramref name="key"/>
+ /// does not exist in the dictionary.
+ /// </exception>
/// <value>The value at the given <paramref name="key"/>.</value>
public TValue this[TKey key]
{
@@ -468,6 +624,8 @@ namespace Godot.Collections
}
set
{
+ ThrowIfReadOnly();
+
using var variantKey = VariantUtils.CreateFrom(key);
using var variantValue = VariantUtils.CreateFrom(value);
var self = (godot_dictionary)_underlyingDict.NativeValue;
@@ -527,10 +685,15 @@ namespace Godot.Collections
/// Adds an object <paramref name="value"/> at key <paramref name="key"/>
/// to this <see cref="Dictionary{TKey, TValue}"/>.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The dictionary is read-only.
+ /// </exception>
/// <param name="key">The key at which to add the object.</param>
/// <param name="value">The object to add.</param>
public void Add(TKey key, TValue value)
{
+ ThrowIfReadOnly();
+
using var variantKey = VariantUtils.CreateFrom(key);
var self = (godot_dictionary)_underlyingDict.NativeValue;
@@ -556,20 +719,27 @@ namespace Godot.Collections
/// <summary>
/// Removes an element from this <see cref="Dictionary{TKey, TValue}"/> by key.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The dictionary is read-only.
+ /// </exception>
/// <param name="key">The key of the element to remove.</param>
public bool Remove(TKey key)
{
+ ThrowIfReadOnly();
+
using var variantKey = VariantUtils.CreateFrom(key);
var self = (godot_dictionary)_underlyingDict.NativeValue;
return NativeFuncs.godotsharp_dictionary_remove_key(ref self, variantKey).ToBool();
}
/// <summary>
- /// Gets the object at the given <paramref name="key"/>.
+ /// Gets the value for the given <paramref name="key"/> in the dictionary.
+ /// Returns <see langword="true"/> if an entry for the given key exists in
+ /// the dictionary; otherwise, returns <see langword="false"/>.
/// </summary>
/// <param name="key">The key of the element to get.</param>
/// <param name="value">The value at the given <paramref name="key"/>.</param>
- /// <returns>If an object was found for the given <paramref name="key"/>.</returns>
+ /// <returns>If an entry was found for the given <paramref name="key"/>.</returns>
public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
{
using var variantKey = VariantUtils.CreateFrom(key);
@@ -592,14 +762,31 @@ namespace Godot.Collections
/// <returns>The number of elements.</returns>
public int Count => _underlyingDict.Count;
- bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly => false;
+ /// <summary>
+ /// Returns <see langword="true"/> if the dictionary is read-only.
+ /// See <see cref="MakeReadOnly"/>.
+ /// </summary>
+ public bool IsReadOnly => _underlyingDict.IsReadOnly;
+
+ /// <summary>
+ /// Makes the <see cref="Dictionary{TKey, TValue}"/> read-only, i.e. disabled
+ /// modying of the dictionary's elements. Does not apply to nested content,
+ /// e.g. content of nested dictionaries.
+ /// </summary>
+ public void MakeReadOnly()
+ {
+ _underlyingDict.MakeReadOnly();
+ }
void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> item)
=> Add(item.Key, item.Value);
/// <summary>
- /// Erases all the items from this <see cref="Dictionary{TKey, TValue}"/>.
+ /// Clears the dictionary, removing all entries from it.
/// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The dictionary is read-only.
+ /// </exception>
public void Clear() => _underlyingDict.Clear();
bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> item)
@@ -625,7 +812,7 @@ namespace Godot.Collections
/// </summary>
/// <param name="array">The array to copy to.</param>
/// <param name="arrayIndex">The index to start at.</param>
- public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
+ void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
{
if (array == null)
throw new ArgumentNullException(nameof(array), "Value cannot be null.");
@@ -649,6 +836,8 @@ namespace Godot.Collections
bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item)
{
+ ThrowIfReadOnly();
+
using var variantKey = VariantUtils.CreateFrom(item.Key);
var self = (godot_dictionary)_underlyingDict.NativeValue;
bool found = NativeFuncs.godotsharp_dictionary_try_get_value(ref self,
@@ -698,5 +887,13 @@ namespace Godot.Collections
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Dictionary<TKey, TValue>(Variant from) =>
from.AsGodotDictionary<TKey, TValue>();
+
+ private void ThrowIfReadOnly()
+ {
+ if (IsReadOnly)
+ {
+ throw new InvalidOperationException("Dictionary instance is read-only.");
+ }
+ }
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dispatcher.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dispatcher.cs
index e6cb4171a7..e7370b2b05 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dispatcher.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dispatcher.cs
@@ -9,7 +9,10 @@ namespace Godot
internal static GodotTaskScheduler DefaultGodotTaskScheduler;
internal static void InitializeDefaultGodotTaskScheduler()
- => DefaultGodotTaskScheduler = new GodotTaskScheduler();
+ {
+ DefaultGodotTaskScheduler?.Dispose();
+ DefaultGodotTaskScheduler = new GodotTaskScheduler();
+ }
public static GodotSynchronizationContext SynchronizationContext => DefaultGodotTaskScheduler.Context;
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/DisposablesTracker.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/DisposablesTracker.cs
index 421b588560..53292e10cf 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/DisposablesTracker.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/DisposablesTracker.cs
@@ -28,7 +28,7 @@ namespace Godot
try
{
- isStdoutVerbose = OS.IsStdoutVerbose();
+ isStdoutVerbose = OS.IsStdOutVerbose();
}
catch (ObjectDisposedException)
{
@@ -43,9 +43,9 @@ namespace Godot
// like StringName, NodePath, Godot.Collections.Array/Dictionary, etc.
// The Godot Object Dispose() method may need any of the later instances.
- foreach (WeakReference<Object> item in GodotObjectInstances.Keys)
+ foreach (WeakReference<GodotObject> item in GodotObjectInstances.Keys)
{
- if (item.TryGetTarget(out Object? self))
+ if (item.TryGetTarget(out GodotObject? self))
self.Dispose();
}
@@ -60,15 +60,15 @@ namespace Godot
}
// ReSharper disable once RedundantNameQualifier
- private static ConcurrentDictionary<WeakReference<Godot.Object>, byte> GodotObjectInstances { get; } =
+ private static ConcurrentDictionary<WeakReference<GodotObject>, byte> GodotObjectInstances { get; } =
new();
private static ConcurrentDictionary<WeakReference<IDisposable>, byte> OtherInstances { get; } =
new();
- public static WeakReference<Object> RegisterGodotObject(Object godotObject)
+ public static WeakReference<GodotObject> RegisterGodotObject(GodotObject godotObject)
{
- var weakReferenceToSelf = new WeakReference<Object>(godotObject);
+ var weakReferenceToSelf = new WeakReference<GodotObject>(godotObject);
GodotObjectInstances.TryAdd(weakReferenceToSelf, 0);
return weakReferenceToSelf;
}
@@ -80,7 +80,7 @@ namespace Godot
return weakReferenceToSelf;
}
- public static void UnregisterGodotObject(Object godotObject, WeakReference<Object> weakReferenceToSelf)
+ public static void UnregisterGodotObject(GodotObject godotObject, WeakReference<GodotObject> weakReferenceToSelf)
{
if (!GodotObjectInstances.TryRemove(weakReferenceToSelf, out _))
throw new ArgumentException("Godot Object not registered.", nameof(weakReferenceToSelf));
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/GodotObjectExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/GodotObjectExtensions.cs
new file mode 100644
index 0000000000..6c90c17078
--- /dev/null
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/GodotObjectExtensions.cs
@@ -0,0 +1,86 @@
+using System;
+using Godot.NativeInterop;
+
+namespace Godot
+{
+ public partial class GodotObject
+ {
+ /// <summary>
+ /// Returns the <see cref="GodotObject"/> that corresponds to <paramref name="instanceId"/>.
+ /// All Objects have a unique instance ID. See also <see cref="GetInstanceId"/>.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// public partial class MyNode : Node
+ /// {
+ /// public string Foo { get; set; } = "bar";
+ ///
+ /// public override void _Ready()
+ /// {
+ /// ulong id = GetInstanceId();
+ /// var inst = (MyNode)InstanceFromId(Id);
+ /// GD.Print(inst.Foo); // Prints bar
+ /// }
+ /// }
+ /// </code>
+ /// </example>
+ /// <param name="instanceId">Instance ID of the Object to retrieve.</param>
+ /// <returns>The <see cref="GodotObject"/> instance.</returns>
+ public static GodotObject InstanceFromId(ulong instanceId)
+ {
+ return InteropUtils.UnmanagedGetManaged(NativeFuncs.godotsharp_instance_from_id(instanceId));
+ }
+
+ /// <summary>
+ /// Returns <see langword="true"/> if the <see cref="GodotObject"/> that corresponds
+ /// to <paramref name="id"/> is a valid object (e.g. has not been deleted from
+ /// memory). All Objects have a unique instance ID.
+ /// </summary>
+ /// <param name="id">The Object ID to check.</param>
+ /// <returns>If the instance with the given ID is a valid object.</returns>
+ public static bool IsInstanceIdValid(ulong id)
+ {
+ return IsInstanceValid(InstanceFromId(id));
+ }
+
+ /// <summary>
+ /// Returns <see langword="true"/> if <paramref name="instance"/> is a
+ /// valid <see cref="GodotObject"/> (e.g. has not been deleted from memory).
+ /// </summary>
+ /// <param name="instance">The instance to check.</param>
+ /// <returns>If the instance is a valid object.</returns>
+ public static bool IsInstanceValid(GodotObject instance)
+ {
+ return instance != null && instance.NativeInstance != IntPtr.Zero;
+ }
+
+ /// <summary>
+ /// Returns a weak reference to an object, or <see langword="null"/>
+ /// if the argument is invalid.
+ /// A weak reference to an object is not enough to keep the object alive:
+ /// when the only remaining references to a referent are weak references,
+ /// garbage collection is free to destroy the referent and reuse its memory
+ /// for something else. However, until the object is actually destroyed the
+ /// weak reference may return the object even if there are no strong references
+ /// to it.
+ /// </summary>
+ /// <param name="obj">The object.</param>
+ /// <returns>
+ /// The <see cref="WeakRef"/> reference to the object or <see langword="null"/>.
+ /// </returns>
+ public static WeakRef WeakRef(GodotObject obj)
+ {
+ if (!IsInstanceValid(obj))
+ return null;
+
+ NativeFuncs.godotsharp_weakref(GetPtr(obj), out godot_ref weakRef);
+ using (weakRef)
+ {
+ if (weakRef.IsNull)
+ return null;
+
+ return (WeakRef)InteropUtils.UnmanagedGetManaged(weakRef.Reference);
+ }
+ }
+ }
+}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/ObjectExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/ObjectExtensions.cs
deleted file mode 100644
index 4094ceeb22..0000000000
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/ObjectExtensions.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System;
-using Godot.NativeInterop;
-
-namespace Godot
-{
- public partial class Object
- {
- /// <summary>
- /// Returns whether <paramref name="instance"/> is a valid object
- /// (e.g. has not been deleted from memory).
- /// </summary>
- /// <param name="instance">The instance to check.</param>
- /// <returns>If the instance is a valid object.</returns>
- public static bool IsInstanceValid(Object instance)
- {
- return instance != null && instance.NativeInstance != IntPtr.Zero;
- }
-
- /// <summary>
- /// Returns a weak reference to an object, or <see langword="null"/>
- /// if the argument is invalid.
- /// A weak reference to an object is not enough to keep the object alive:
- /// when the only remaining references to a referent are weak references,
- /// garbage collection is free to destroy the referent and reuse its memory
- /// for something else. However, until the object is actually destroyed the
- /// weak reference may return the object even if there are no strong references
- /// to it.
- /// </summary>
- /// <param name="obj">The object.</param>
- /// <returns>
- /// The <see cref="WeakRef"/> reference to the object or <see langword="null"/>.
- /// </returns>
- public static WeakRef WeakRef(Object obj)
- {
- if (!IsInstanceValid(obj))
- return null;
-
- NativeFuncs.godotsharp_weakref(GetPtr(obj), out godot_ref weakRef);
- using (weakRef)
- {
- if (weakRef.IsNull)
- return null;
-
- return (WeakRef)InteropUtils.UnmanagedGetManaged(weakRef.Reference);
- }
- }
- }
-}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs
index e4b79e7ec4..9425b7424c 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Text;
using Godot.NativeInterop;
namespace Godot
@@ -10,36 +11,45 @@ namespace Godot
public static partial class GD
{
/// <summary>
- /// Decodes a byte array back to a <c>Variant</c> value.
- /// If <paramref name="allowObjects"/> is <see langword="true"/> decoding objects is allowed.
- ///
- /// WARNING: Deserialized object can contain code which gets executed.
- /// Do not set <paramref name="allowObjects"/> to <see langword="true"/>
- /// if the serialized object comes from untrusted sources to avoid
- /// potential security threats (remote code execution).
+ /// Decodes a byte array back to a <see cref="Variant"/> value, without decoding objects.
+ /// Note: If you need object deserialization, see <see cref="BytesToVarWithObjects"/>.
/// </summary>
- /// <param name="bytes">Byte array that will be decoded to a <c>Variant</c>.</param>
- /// <param name="allowObjects">If objects should be decoded.</param>
- /// <returns>The decoded <c>Variant</c>.</returns>
- public static Variant BytesToVar(Span<byte> bytes, bool allowObjects = false)
+ /// <param name="bytes">Byte array that will be decoded to a <see cref="Variant"/>.</param>
+ /// <returns>The decoded <see cref="Variant"/>.</returns>
+ public static Variant BytesToVar(Span<byte> bytes)
{
using var varBytes = Marshaling.ConvertSystemArrayToNativePackedByteArray(bytes);
- NativeFuncs.godotsharp_bytes_to_var(varBytes, allowObjects.ToGodotBool(), out godot_variant ret);
+ NativeFuncs.godotsharp_bytes_to_var(varBytes, godot_bool.False, out godot_variant ret);
return Variant.CreateTakingOwnershipOfDisposableValue(ret);
}
/// <summary>
- /// Converts from a <c>Variant</c> type to another in the best way possible.
+ /// Decodes a byte array back to a <see cref="Variant"/> value. Decoding objects is allowed.
+ /// Warning: 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).
+ /// </summary>
+ /// <param name="bytes">Byte array that will be decoded to a <see cref="Variant"/>.</param>
+ /// <returns>The decoded <see cref="Variant"/>.</returns>
+ public static Variant BytesToVarWithObjects(Span<byte> bytes)
+ {
+ using var varBytes = Marshaling.ConvertSystemArrayToNativePackedByteArray(bytes);
+ NativeFuncs.godotsharp_bytes_to_var(varBytes, godot_bool.True, out godot_variant ret);
+ return Variant.CreateTakingOwnershipOfDisposableValue(ret);
+ }
+
+ /// <summary>
+ /// Converts <paramref name="what"/> to <paramref name="type"/> in the best way possible.
/// The <paramref name="type"/> parameter uses the <see cref="Variant.Type"/> values.
/// </summary>
/// <example>
/// <code>
- /// var a = new Vector2(1, 0);
- /// // Prints 1
- /// GD.Print(a.Length());
- /// var b = GD.Convert(a, Variant.Type.String)
- /// // Prints 6 as "(1, 0)" is 6 characters
- /// GD.Print(b.Length);
+ /// Variant a = new Godot.Collections.Array { 4, 2.5, 1.2 };
+ /// GD.Print(a.VariantType == Variant.Type.Array); // Prints true
+ ///
+ /// var b = GD.Convert(a, Variant.Type.PackedByteArray);
+ /// GD.Print(b); // Prints [4, 2, 1]
+ /// GD.Print(b.VariantType == Variant.Type.Array); // Prints false
/// </code>
/// </example>
/// <returns>The <c>Variant</c> converted to the given <paramref name="type"/>.</returns>
@@ -50,28 +60,7 @@ namespace Godot
}
/// <summary>
- /// Converts from decibels to linear energy (audio).
- /// </summary>
- /// <seealso cref="LinearToDb(real_t)"/>
- /// <param name="db">Decibels to convert.</param>
- /// <returns>Audio volume as linear energy.</returns>
- public static real_t DbToLinear(real_t db)
- {
- return (real_t)Math.Exp(db * 0.11512925464970228420089957273422);
- }
-
- private static string[] GetPrintParams(object[] parameters)
- {
- if (parameters == null)
- {
- return new[] { "null" };
- }
-
- return Array.ConvertAll(parameters, x => x?.ToString() ?? "null");
- }
-
- /// <summary>
- /// Returns the integer hash of the variable passed.
+ /// Returns the integer hash of the passed <paramref name="var"/>.
/// </summary>
/// <example>
/// <code>
@@ -86,52 +75,6 @@ namespace Godot
}
/// <summary>
- /// Returns the <see cref="Object"/> that corresponds to <paramref name="instanceId"/>.
- /// All Objects have a unique instance ID.
- /// </summary>
- /// <example>
- /// <code>
- /// public class MyNode : Node
- /// {
- /// public string foo = "bar";
- ///
- /// public override void _Ready()
- /// {
- /// ulong id = GetInstanceId();
- /// var inst = (MyNode)GD.InstanceFromId(Id);
- /// GD.Print(inst.foo); // Prints bar
- /// }
- /// }
- /// </code>
- /// </example>
- /// <param name="instanceId">Instance ID of the Object to retrieve.</param>
- /// <returns>The <see cref="Object"/> instance.</returns>
- public static Object InstanceFromId(ulong instanceId)
- {
- return InteropUtils.UnmanagedGetManaged(NativeFuncs.godotsharp_instance_from_id(instanceId));
- }
-
- /// <summary>
- /// Converts from linear energy to decibels (audio).
- /// This can be used to implement volume sliders that behave as expected (since volume isn't linear).
- /// </summary>
- /// <seealso cref="DbToLinear(real_t)"/>
- /// <example>
- /// <code>
- /// // "slider" refers to a node that inherits Range such as HSlider or VSlider.
- /// // Its range must be configured to go from 0 to 1.
- /// // Change the bus name if you'd like to change the volume of a specific bus only.
- /// AudioServer.SetBusVolumeDb(AudioServer.GetBusIndex("Master"), GD.LinearToDb(slider.value));
- /// </code>
- /// </example>
- /// <param name="linear">The linear energy to convert.</param>
- /// <returns>Audio as decibels.</returns>
- public static real_t LinearToDb(real_t linear)
- {
- return (real_t)(Math.Log(linear) * 8.6858896380650365530225783783321);
- }
-
- /// <summary>
/// Loads a resource from the filesystem located at <paramref name="path"/>.
/// The resource is loaded on the method call (unless it's referenced already
/// elsewhere, e.g. in another script or in the scene), which might cause slight delay,
@@ -185,57 +128,96 @@ namespace Godot
return ResourceLoader.Load<T>(path);
}
- /// <summary>
- /// Pushes an error message to Godot's built-in debugger and to the OS terminal.
- ///
- /// Note: Errors printed this way will not pause project execution.
- /// </summary>
- /// <example>
- /// <code>
- /// GD.PushError("test_error"); // Prints "test error" to debugger and terminal as error call
- /// </code>
- /// </example>
- /// <param name="message">Error message.</param>
- public static void PushError(string message)
+ private static string AppendPrintParams(object[] parameters)
{
- using var godotStr = Marshaling.ConvertStringToNative(message);
- NativeFuncs.godotsharp_pusherror(godotStr);
+ if (parameters == null)
+ {
+ return "null";
+ }
+
+ var sb = new StringBuilder();
+ for (int i = 0; i < parameters.Length; i++)
+ {
+ sb.Append(parameters[i]?.ToString() ?? "null");
+ }
+ return sb.ToString();
+ }
+
+ private static string AppendPrintParams(char separator, object[] parameters)
+ {
+ if (parameters == null)
+ {
+ return "null";
+ }
+
+ var sb = new StringBuilder();
+ for (int i = 0; i < parameters.Length; i++)
+ {
+ if (i != 0)
+ sb.Append(separator);
+ sb.Append(parameters[i]?.ToString() ?? "null");
+ }
+ return sb.ToString();
}
/// <summary>
- /// Pushes a warning message to Godot's built-in debugger and to the OS terminal.
+ /// Prints a message to the console.
+ ///
+ /// Note: Consider using <see cref="PushError(string)"/> and <see cref="PushWarning(string)"/>
+ /// to print error and warning messages instead of <see cref="Print(string)"/>.
+ /// This distinguishes them from print messages used for debugging purposes,
+ /// while also displaying a stack trace when an error or warning is printed.
/// </summary>
- /// <example>
- /// GD.PushWarning("test warning"); // Prints "test warning" to debugger and terminal as warning call
- /// </example>
- /// <param name="message">Warning message.</param>
- public static void PushWarning(string message)
+ /// <param name="what">Message that will be printed.</param>
+ public static void Print(string what)
{
- using var godotStr = Marshaling.ConvertStringToNative(message);
- NativeFuncs.godotsharp_pushwarning(godotStr);
+ using var godotStr = Marshaling.ConvertStringToNative(what);
+ NativeFuncs.godotsharp_print(godotStr);
}
/// <summary>
/// Converts one or more arguments of any type to string in the best way possible
/// and prints them to the console.
///
- /// Note: Consider using <see cref="PushError(string)"/> and <see cref="PushWarning(string)"/>
+ /// Note: Consider using <see cref="PushError(object[])"/> and <see cref="PushWarning(object[])"/>
/// to print error and warning messages instead of <see cref="Print(object[])"/>.
/// This distinguishes them from print messages used for debugging purposes,
/// while also displaying a stack trace when an error or warning is printed.
/// </summary>
/// <example>
/// <code>
- /// var a = new int[] { 1, 2, 3 };
+ /// var a = new Godot.Collections.Array { 1, 2, 3 };
/// GD.Print("a", "b", a); // Prints ab[1, 2, 3]
/// </code>
/// </example>
/// <param name="what">Arguments that will be printed.</param>
public static void Print(params object[] what)
{
- string str = string.Concat(GetPrintParams(what));
- using var godotStr = Marshaling.ConvertStringToNative(str);
- NativeFuncs.godotsharp_print(godotStr);
+ Print(AppendPrintParams(what));
+ }
+
+ /// <summary>
+ /// Prints a message to the console.
+ /// The following BBCode tags are supported: b, i, u, s, indent, code, url, center,
+ /// right, color, bgcolor, fgcolor.
+ /// Color tags only support named colors such as <c>red</c>, not hexadecimal color codes.
+ /// Unsupported tags will be left as-is in standard output.
+ /// When printing to standard output, the supported subset of BBCode is converted to
+ /// ANSI escape codes for the terminal emulator to display. Displaying ANSI escape codes
+ /// is currently only supported on Linux and macOS. Support for ANSI escape codes may vary
+ /// across terminal emulators, especially for italic and strikethrough.
+ ///
+ /// Note: Consider using <see cref="PushError(string)"/> and <see cref="PushWarning(string)"/>
+ /// to print error and warning messages instead of <see cref="Print(string)"/> or
+ /// <see cref="PrintRich(string)"/>.
+ /// This distinguishes them from print messages used for debugging purposes,
+ /// while also displaying a stack trace when an error or warning is printed.
+ /// </summary>
+ /// <param name="what">Message that will be printed.</param>
+ public static void PrintRich(string what)
+ {
+ using var godotStr = Marshaling.ConvertStringToNative(what);
+ NativeFuncs.godotsharp_print_rich(godotStr);
}
/// <summary>
@@ -250,7 +232,7 @@ namespace Godot
/// is currently only supported on Linux and macOS. Support for ANSI escape codes may vary
/// across terminal emulators, especially for italic and strikethrough.
///
- /// Note: Consider using <see cref="PushError(string)"/> and <see cref="PushWarning(string)"/>
+ /// Note: Consider using <see cref="PushError(object[])"/> and <see cref="PushWarning(object[])"/>
/// to print error and warning messages instead of <see cref="Print(object[])"/> or
/// <see cref="PrintRich(object[])"/>.
/// This distinguishes them from print messages used for debugging purposes,
@@ -258,23 +240,23 @@ namespace Godot
/// </summary>
/// <example>
/// <code>
- /// GD.PrintRich("[b]Hello world![/b]"); // Prints out "Hello world!" in bold.
+ /// GD.PrintRich("[code][b]Hello world![/b][/code]"); // Prints out: [b]Hello world![/b]
/// </code>
/// </example>
/// <param name="what">Arguments that will be printed.</param>
public static void PrintRich(params object[] what)
{
- string str = string.Concat(GetPrintParams(what));
- using var godotStr = Marshaling.ConvertStringToNative(str);
- NativeFuncs.godotsharp_print_rich(godotStr);
+ PrintRich(AppendPrintParams(what));
}
/// <summary>
- /// Prints the current stack trace information to the console.
+ /// Prints a message to standard error line.
/// </summary>
- public static void PrintStack()
+ /// <param name="what">Message that will be printed.</param>
+ public static void PrintErr(string what)
{
- Print(System.Environment.StackTrace);
+ using var godotStr = Marshaling.ConvertStringToNative(what);
+ NativeFuncs.godotsharp_printerr(godotStr);
}
/// <summary>
@@ -288,31 +270,36 @@ namespace Godot
/// <param name="what">Arguments that will be printed.</param>
public static void PrintErr(params object[] what)
{
- string str = string.Concat(GetPrintParams(what));
- using var godotStr = Marshaling.ConvertStringToNative(str);
- NativeFuncs.godotsharp_printerr(godotStr);
+ PrintErr(AppendPrintParams(what));
}
/// <summary>
- /// Prints one or more arguments to strings in the best way possible to console.
- /// No newline is added at the end.
- ///
- /// Note: Due to limitations with Godot's built-in console, this only prints to the terminal.
- /// If you need to print in the editor, use another method, such as <see cref="Print(object[])"/>.
+ /// Prints a message to the OS terminal.
+ /// Unlike <see cref="Print(string)"/>, no newline is added at the end.
+ /// </summary>
+ /// <param name="what">Message that will be printed.</param>
+ public static void PrintRaw(string what)
+ {
+ using var godotStr = Marshaling.ConvertStringToNative(what);
+ NativeFuncs.godotsharp_printraw(godotStr);
+ }
+
+ /// <summary>
+ /// Prints one or more arguments to strings in the best way possible to the OS terminal.
+ /// Unlike <see cref="Print(object[])"/>, no newline is added at the end.
/// </summary>
/// <example>
/// <code>
/// GD.PrintRaw("A");
/// GD.PrintRaw("B");
- /// // Prints AB
+ /// GD.PrintRaw("C");
+ /// // Prints ABC to terminal
/// </code>
/// </example>
/// <param name="what">Arguments that will be printed.</param>
public static void PrintRaw(params object[] what)
{
- string str = string.Concat(GetPrintParams(what));
- using var godotStr = Marshaling.ConvertStringToNative(str);
- NativeFuncs.godotsharp_printraw(godotStr);
+ PrintRaw(AppendPrintParams(what));
}
/// <summary>
@@ -326,8 +313,8 @@ namespace Godot
/// <param name="what">Arguments that will be printed.</param>
public static void PrintS(params object[] what)
{
- string str = string.Join(' ', GetPrintParams(what));
- using var godotStr = Marshaling.ConvertStringToNative(str);
+ string message = AppendPrintParams(' ', what);
+ using var godotStr = Marshaling.ConvertStringToNative(message);
NativeFuncs.godotsharp_prints(godotStr);
}
@@ -342,12 +329,74 @@ namespace Godot
/// <param name="what">Arguments that will be printed.</param>
public static void PrintT(params object[] what)
{
- string str = string.Join('\t', GetPrintParams(what));
- using var godotStr = Marshaling.ConvertStringToNative(str);
+ string message = AppendPrintParams('\t', what);
+ using var godotStr = Marshaling.ConvertStringToNative(message);
NativeFuncs.godotsharp_printt(godotStr);
}
/// <summary>
+ /// Pushes an error message to Godot's built-in debugger and to the OS terminal.
+ ///
+ /// Note: Errors printed this way will not pause project execution.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// GD.PushError("test error"); // Prints "test error" to debugger and terminal as error call
+ /// </code>
+ /// </example>
+ /// <param name="message">Error message.</param>
+ public static void PushError(string message)
+ {
+ using var godotStr = Marshaling.ConvertStringToNative(message);
+ NativeFuncs.godotsharp_pusherror(godotStr);
+ }
+
+ /// <summary>
+ /// Pushes an error message to Godot's built-in debugger and to the OS terminal.
+ ///
+ /// Note: Errors printed this way will not pause project execution.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// GD.PushError("test_error"); // Prints "test error" to debugger and terminal as error call
+ /// </code>
+ /// </example>
+ /// <param name="what">Arguments that form the error message.</param>
+ public static void PushError(params object[] what)
+ {
+ PushError(AppendPrintParams(what));
+ }
+
+ /// <summary>
+ /// Pushes a warning message to Godot's built-in debugger and to the OS terminal.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// GD.PushWarning("test warning"); // Prints "test warning" to debugger and terminal as warning call
+ /// </code>
+ /// </example>
+ /// <param name="message">Warning message.</param>
+ public static void PushWarning(string message)
+ {
+ using var godotStr = Marshaling.ConvertStringToNative(message);
+ NativeFuncs.godotsharp_pushwarning(godotStr);
+ }
+
+ /// <summary>
+ /// Pushes a warning message to Godot's built-in debugger and to the OS terminal.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// GD.PushWarning("test warning"); // Prints "test warning" to debugger and terminal as warning call
+ /// </code>
+ /// </example>
+ /// <param name="what">Arguments that form the warning message.</param>
+ public static void PushWarning(params object[] what)
+ {
+ PushWarning(AppendPrintParams(what));
+ }
+
+ /// <summary>
/// Returns a random floating point value between <c>0.0</c> and <c>1.0</c> (inclusive).
/// </summary>
/// <example>
@@ -362,7 +411,9 @@ namespace Godot
}
/// <summary>
- /// Returns a normally-distributed pseudo-random number, using Box-Muller transform with the specified <c>mean</c> and a standard <c>deviation</c>.
+ /// Returns a normally-distributed pseudo-random floating point value
+ /// using Box-Muller transform with the specified <pararmref name="mean"/>
+ /// and a standard <paramref name="deviation"/>.
/// This is also called Gaussian distribution.
/// </summary>
/// <returns>A random normally-distributed <see langword="float"/> number.</returns>
@@ -373,7 +424,8 @@ namespace Godot
/// <summary>
/// Returns a random unsigned 32-bit integer.
- /// Use remainder to obtain a random value in the interval <c>[0, N - 1]</c> (where N is smaller than 2^32).
+ /// Use remainder to obtain a random value in the interval <c>[0, N - 1]</c>
+ /// (where N is smaller than 2^32).
/// </summary>
/// <example>
/// <code>
@@ -391,11 +443,11 @@ namespace Godot
/// <summary>
/// Randomizes the seed (or the internal state) of the random number generator.
- /// Current implementation reseeds using a number based on time.
+ /// The current implementation uses a number based on the device's time.
///
/// Note: This method is called automatically when the project is run.
- /// If you need to fix the seed to have reproducible results, use <see cref="Seed(ulong)"/>
- /// to initialize the random number generator.
+ /// If you need to fix the seed to have consistent, reproducible results,
+ /// use <see cref="Seed(ulong)"/> to initialize the random number generator.
/// </summary>
public static void Randomize()
{
@@ -403,12 +455,13 @@ namespace Godot
}
/// <summary>
- /// Returns a random floating point value on the interval between <paramref name="from"/>
+ /// Returns a random floating point value between <paramref name="from"/>
/// and <paramref name="to"/> (inclusive).
/// </summary>
/// <example>
/// <code>
- /// GD.PrintS(GD.RandRange(-10.0, 10.0), GD.RandRange(-10.0, 10.0)); // Prints e.g. -3.844535 7.45315
+ /// GD.RandRange(0.0, 20.5); // Returns e.g. 7.45315
+ /// GD.RandRange(-10.0, 10.0); // Returns e.g. -3.844535
/// </code>
/// </example>
/// <returns>A random <see langword="double"/> number inside the given range.</returns>
@@ -424,8 +477,8 @@ namespace Godot
/// </summary>
/// <example>
/// <code>
- /// GD.Print(GD.RandRange(0, 1)); // Prints 0 or 1
- /// GD.Print(GD.RandRange(-10, 1000)); // Prints any number from -10 to 1000
+ /// GD.RandRange(0, 1); // Returns either 0 or 1
+ /// GD.RandRange(-10, 1000); // Returns random integer between -10 and 1000
/// </code>
/// </example>
/// <returns>A random <see langword="int"/> number inside the given range.</returns>
@@ -435,8 +488,18 @@ namespace Godot
}
/// <summary>
- /// Returns a random unsigned 32-bit integer, using the given <paramref name="seed"/>.
+ /// Given a <paramref name="seed"/>, returns a randomized <see langword="uint"/>
+ /// value. The <paramref name="seed"/> may be modified.
+ /// Passing the same <paramref name="seed"/> consistently returns the same value.
+ ///
+ /// Note: "Seed" here refers to the internal state of the pseudo random number
+ /// generator, currently implemented as a 64 bit integer.
/// </summary>
+ /// <example>
+ /// <code>
+ /// var a = GD.RandFromSeed(4);
+ /// </code>
+ /// </example>
/// <param name="seed">
/// Seed to use to generate the random number.
/// If a different seed is used, its value will be modified.
@@ -449,7 +512,8 @@ namespace Godot
/// <summary>
/// Returns a <see cref="IEnumerable{T}"/> that iterates from
- /// <c>0</c> to <paramref name="end"/> in steps of <c>1</c>.
+ /// <c>0</c> (inclusive) to <paramref name="end"/> (exclusive)
+ /// in steps of <c>1</c>.
/// </summary>
/// <param name="end">The last index.</param>
public static IEnumerable<int> Range(int end)
@@ -459,7 +523,8 @@ namespace Godot
/// <summary>
/// Returns a <see cref="IEnumerable{T}"/> that iterates from
- /// <paramref name="start"/> to <paramref name="end"/> in steps of <c>1</c>.
+ /// <paramref name="start"/> (inclusive) to <paramref name="end"/> (exclusive)
+ /// in steps of <c>1</c>.
/// </summary>
/// <param name="start">The first index.</param>
/// <param name="end">The last index.</param>
@@ -470,13 +535,21 @@ namespace Godot
/// <summary>
/// Returns a <see cref="IEnumerable{T}"/> that iterates from
- /// <paramref name="start"/> to <paramref name="end"/> in steps of <paramref name="step"/>.
+ /// <paramref name="start"/> (inclusive) to <paramref name="end"/> (exclusive)
+ /// in steps of <paramref name="step"/>.
+ /// The argument <paramref name="step"/> can be negative, but not <c>0</c>.
/// </summary>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="step"/> is 0.
+ /// </exception>
/// <param name="start">The first index.</param>
/// <param name="end">The last index.</param>
/// <param name="step">The amount by which to increment the index on each iteration.</param>
public static IEnumerable<int> Range(int start, int end, int step)
{
+ if (step == 0)
+ throw new ArgumentException("step cannot be 0.", nameof(step));
+
if (end < start && step > 0)
yield break;
@@ -496,8 +569,20 @@ namespace Godot
}
/// <summary>
- /// Sets seed for the random number generator.
+ /// Sets seed for the random number generator to <paramref name="seed"/>.
+ /// Setting the seed manually can ensure consistent, repeatable results for
+ /// most random functions.
/// </summary>
+ /// <example>
+ /// <code>
+ /// ulong mySeed = (ulong)GD.Hash("Godot Rocks");
+ /// GD.Seed(mySeed);
+ /// var a = GD.Randf() + GD.Randi();
+ /// GD.Seed(mySeed);
+ /// var b = GD.Randf() + GD.Randi();
+ /// // a and b are now identical
+ /// </code>
+ /// </example>
/// <param name="seed">Seed that will be used.</param>
public static void Seed(ulong seed)
{
@@ -505,26 +590,14 @@ namespace Godot
}
/// <summary>
- /// Converts one or more arguments of any type to string in the best way possible.
- /// </summary>
- /// <param name="what">Arguments that will converted to string.</param>
- /// <returns>The string formed by the given arguments.</returns>
- public static string Str(params Variant[] what)
- {
- using var whatGodot = new Godot.Collections.Array(what);
- NativeFuncs.godotsharp_str((godot_array)whatGodot.NativeValue, out godot_string ret);
- using (ret)
- return Marshaling.ConvertStringToManaged(ret);
- }
-
- /// <summary>
- /// Converts a formatted string that was returned by <see cref="VarToStr(Variant)"/> to the original value.
+ /// Converts a formatted string that was returned by <see cref="VarToStr(Variant)"/>
+ /// to the original value.
/// </summary>
/// <example>
/// <code>
- /// string a = "{\"a\": 1, \"b\": 2 }";
- /// var b = (Godot.Collections.Dictionary)GD.StrToVar(a);
- /// GD.Print(b["a"]); // Prints 1
+ /// string a = "{ \"a\": 1, \"b\": 2 }"; // a is a string
+ /// var b = GD.StrToVar(a).AsGodotDictionary(); // b is a Dictionary
+ /// GD.Print(b["a"]); // Prints 1
/// </code>
/// </example>
/// <param name="str">String that will be converted to Variant.</param>
@@ -537,38 +610,49 @@ namespace Godot
}
/// <summary>
- /// Encodes a <c>Variant</c> value to a byte array.
- /// If <paramref name="fullObjects"/> is <see langword="true"/> encoding objects is allowed
- /// (and can potentially include code).
- /// Deserialization can be done with <see cref="BytesToVar(Span{byte}, bool)"/>.
+ /// Encodes a <see cref="Variant"/> value to a byte array, without encoding objects.
+ /// Deserialization can be done with <see cref="BytesToVar"/>.
+ /// Note: If you need object serialization, see <see cref="VarToBytesWithObjects"/>.
+ /// </summary>
+ /// <param name="var"><see cref="Variant"/> that will be encoded.</param>
+ /// <returns>The <see cref="Variant"/> encoded as an array of bytes.</returns>
+ public static byte[] VarToBytes(Variant var)
+ {
+ NativeFuncs.godotsharp_var_to_bytes((godot_variant)var.NativeVar, godot_bool.False, out var varBytes);
+ using (varBytes)
+ return Marshaling.ConvertNativePackedByteArrayToSystemArray(varBytes);
+ }
+
+ /// <summary>
+ /// Encodes a <see cref="Variant"/>. Encoding objects is allowed (and can potentially
+ /// include executable code). Deserialization can be done with <see cref="BytesToVarWithObjects"/>.
/// </summary>
- /// <param name="var">Variant that will be encoded.</param>
- /// <param name="fullObjects">If objects should be serialized.</param>
- /// <returns>The <c>Variant</c> encoded as an array of bytes.</returns>
- public static byte[] VarToBytes(Variant var, bool fullObjects = false)
+ /// <param name="var"><see cref="Variant"/> that will be encoded.</param>
+ /// <returns>The <see cref="Variant"/> encoded as an array of bytes.</returns>
+ public static byte[] VarToBytesWithObjects(Variant var)
{
- NativeFuncs.godotsharp_var_to_bytes((godot_variant)var.NativeVar, fullObjects.ToGodotBool(), out var varBytes);
+ NativeFuncs.godotsharp_var_to_bytes((godot_variant)var.NativeVar, godot_bool.True, out var varBytes);
using (varBytes)
return Marshaling.ConvertNativePackedByteArrayToSystemArray(varBytes);
}
/// <summary>
- /// Converts a <c>Variant</c> <paramref name="var"/> to a formatted string that
+ /// Converts a <see cref="Variant"/> <paramref name="var"/> to a formatted string that
/// can later be parsed using <see cref="StrToVar(string)"/>.
/// </summary>
/// <example>
/// <code>
/// var a = new Godot.Collections.Dictionary { ["a"] = 1, ["b"] = 2 };
/// GD.Print(GD.VarToStr(a));
- /// // Prints
+ /// // Prints:
/// // {
- /// // "a": 1,
- /// // "b": 2
+ /// // "a": 1,
+ /// // "b": 2
/// // }
/// </code>
/// </example>
/// <param name="var">Variant that will be converted to string.</param>
- /// <returns>The <c>Variant</c> encoded as a string.</returns>
+ /// <returns>The <see cref="Variant"/> encoded as a string.</returns>
public static string VarToStr(Variant var)
{
NativeFuncs.godotsharp_var_to_str((godot_variant)var.NativeVar, out godot_string ret);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Object.base.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs
index 60ee6eb6f4..b9a5ac82d1 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Object.base.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs
@@ -5,20 +5,20 @@ using Godot.NativeInterop;
namespace Godot
{
- public partial class Object : IDisposable
+ public partial class GodotObject : IDisposable
{
private bool _disposed = false;
- private static readonly Type CachedType = typeof(Object);
+ private static readonly Type CachedType = typeof(GodotObject);
internal IntPtr NativePtr;
private bool _memoryOwn;
- private WeakReference<Object> _weakReferenceToSelf;
+ private WeakReference<GodotObject> _weakReferenceToSelf;
/// <summary>
- /// Constructs a new <see cref="Object"/>.
+ /// Constructs a new <see cref="GodotObject"/>.
/// </summary>
- public Object() : this(false)
+ public GodotObject() : this(false)
{
unsafe
{
@@ -49,17 +49,17 @@ namespace Godot
_weakReferenceToSelf = DisposablesTracker.RegisterGodotObject(this);
}
- internal Object(bool memoryOwn)
+ internal GodotObject(bool memoryOwn)
{
_memoryOwn = memoryOwn;
}
/// <summary>
- /// The pointer to the native instance of this <see cref="Object"/>.
+ /// The pointer to the native instance of this <see cref="GodotObject"/>.
/// </summary>
public IntPtr NativeInstance => NativePtr;
- internal static IntPtr GetPtr(Object instance)
+ internal static IntPtr GetPtr(GodotObject instance)
{
if (instance == null)
return IntPtr.Zero;
@@ -75,13 +75,13 @@ namespace Godot
return instance.NativePtr;
}
- ~Object()
+ ~GodotObject()
{
Dispose(false);
}
/// <summary>
- /// Disposes of this <see cref="Object"/>.
+ /// Disposes of this <see cref="GodotObject"/>.
/// </summary>
public void Dispose()
{
@@ -90,7 +90,7 @@ namespace Godot
}
/// <summary>
- /// Disposes implementation of this <see cref="Object"/>.
+ /// Disposes implementation of this <see cref="GodotObject"/>.
/// </summary>
protected virtual void Dispose(bool disposing)
{
@@ -129,7 +129,7 @@ namespace Godot
}
/// <summary>
- /// Converts this <see cref="Object"/> to a string.
+ /// Converts this <see cref="GodotObject"/> to a string.
/// </summary>
/// <returns>A string representation of this object.</returns>
public override string ToString()
@@ -166,7 +166,7 @@ namespace Godot
/// A <see cref="SignalAwaiter"/> that completes when
/// <paramref name="source"/> emits the <paramref name="signal"/>.
/// </returns>
- public SignalAwaiter ToSignal(Object source, StringName signal)
+ public SignalAwaiter ToSignal(GodotObject source, StringName signal)
{
return new SignalAwaiter(source, signal, this);
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Object.exceptions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.exceptions.cs
index 0fcc4ee01b..a7640043ce 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Object.exceptions.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.exceptions.cs
@@ -5,7 +5,7 @@ using System.Text;
namespace Godot
{
- public partial class Object
+ public partial class GodotObject
{
public class NativeMemberNotFoundException : Exception
{
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs
index 1b599beab5..027eab30fc 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs
@@ -1,13 +1,13 @@
+using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
namespace Godot
{
- public class GodotSynchronizationContext : SynchronizationContext
+ public sealed class GodotSynchronizationContext : SynchronizationContext, IDisposable
{
- private readonly BlockingCollection<KeyValuePair<SendOrPostCallback, object>> _queue =
- new BlockingCollection<KeyValuePair<SendOrPostCallback, object>>();
+ private readonly BlockingCollection<KeyValuePair<SendOrPostCallback, object>> _queue = new();
public override void Post(SendOrPostCallback d, object state)
{
@@ -24,5 +24,10 @@ namespace Godot
workItem.Key(workItem.Value);
}
}
+
+ public void Dispose()
+ {
+ _queue.Dispose();
+ }
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTaskScheduler.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTaskScheduler.cs
index 408bed71b2..f6c36455b2 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTaskScheduler.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTaskScheduler.cs
@@ -10,7 +10,7 @@ namespace Godot
/// GodotTaskScheduler contains a linked list of tasks to perform as a queue. Methods
/// within the class are used to control the queue and perform the contained tasks.
/// </summary>
- public class GodotTaskScheduler : TaskScheduler
+ public sealed class GodotTaskScheduler : TaskScheduler, IDisposable
{
/// <summary>
/// The current synchronization context.
@@ -108,5 +108,10 @@ namespace Godot
}
}
}
+
+ public void Dispose()
+ {
+ Context.Dispose();
+ }
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs
index b2cb0f5e6b..ca0032df73 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs
@@ -1,4 +1,5 @@
using System;
+using System.Runtime.CompilerServices;
namespace Godot
{
@@ -35,15 +36,18 @@ namespace Godot
public const real_t NaN = real_t.NaN;
// 0.0174532924f and 0.0174532925199433
- private const real_t _degToRadConst = (real_t)0.0174532925199432957692369077M;
+ private const float _degToRadConstF = (float)0.0174532925199432957692369077M;
+ private const double _degToRadConstD = (double)0.0174532925199432957692369077M;
// 57.29578f and 57.2957795130823
- private const real_t _radToDegConst = (real_t)57.295779513082320876798154814M;
+ private const float _radToDegConstF = (float)57.295779513082320876798154814M;
+ private const double _radToDegConstD = (double)57.295779513082320876798154814M;
/// <summary>
/// Returns the absolute value of <paramref name="s"/> (i.e. positive value).
/// </summary>
/// <param name="s">The input number.</param>
/// <returns>The absolute value of <paramref name="s"/>.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Abs(int s)
{
return Math.Abs(s);
@@ -54,12 +58,38 @@ namespace Godot
/// </summary>
/// <param name="s">The input number.</param>
/// <returns>The absolute value of <paramref name="s"/>.</returns>
- public static real_t Abs(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Abs(float s)
{
return Math.Abs(s);
}
/// <summary>
+ /// Returns the absolute value of <paramref name="s"/> (i.e. positive value).
+ /// </summary>
+ /// <param name="s">The input number.</param>
+ /// <returns>The absolute value of <paramref name="s"/>.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Abs(double s)
+ {
+ return Math.Abs(s);
+ }
+
+ /// <summary>
+ /// Returns the arc cosine of <paramref name="s"/> in radians.
+ /// Use to get the angle of cosine <paramref name="s"/>.
+ /// </summary>
+ /// <param name="s">The input cosine value. Must be on the range of -1.0 to 1.0.</param>
+ /// <returns>
+ /// An angle that would result in the given cosine value. On the range <c>0</c> to <c>Tau/2</c>.
+ /// </returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Acos(float s)
+ {
+ return MathF.Acos(s);
+ }
+
+ /// <summary>
/// Returns the arc cosine of <paramref name="s"/> in radians.
/// Use to get the angle of cosine <paramref name="s"/>.
/// </summary>
@@ -67,9 +97,24 @@ namespace Godot
/// <returns>
/// An angle that would result in the given cosine value. On the range <c>0</c> to <c>Tau/2</c>.
/// </returns>
- public static real_t Acos(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Acos(double s)
+ {
+ return Math.Acos(s);
+ }
+
+ /// <summary>
+ /// Returns the arc sine of <paramref name="s"/> in radians.
+ /// Use to get the angle of sine <paramref name="s"/>.
+ /// </summary>
+ /// <param name="s">The input sine value. Must be on the range of -1.0 to 1.0.</param>
+ /// <returns>
+ /// An angle that would result in the given sine value. On the range <c>-Tau/4</c> to <c>Tau/4</c>.
+ /// </returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Asin(float s)
{
- return (real_t)Math.Acos(s);
+ return MathF.Asin(s);
}
/// <summary>
@@ -80,9 +125,27 @@ namespace Godot
/// <returns>
/// An angle that would result in the given sine value. On the range <c>-Tau/4</c> to <c>Tau/4</c>.
/// </returns>
- public static real_t Asin(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Asin(double s)
+ {
+ return Math.Asin(s);
+ }
+
+ /// <summary>
+ /// Returns the arc tangent of <paramref name="s"/> in radians.
+ /// Use to get the angle of tangent <paramref name="s"/>.
+ ///
+ /// The method cannot know in which quadrant the angle should fall.
+ /// See <see cref="Atan2(float, float)"/> if you have both <c>y</c> and <c>x</c>.
+ /// </summary>
+ /// <param name="s">The input tangent value.</param>
+ /// <returns>
+ /// An angle that would result in the given tangent value. On the range <c>-Tau/4</c> to <c>Tau/4</c>.
+ /// </returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Atan(float s)
{
- return (real_t)Math.Asin(s);
+ return MathF.Atan(s);
}
/// <summary>
@@ -90,15 +153,34 @@ namespace Godot
/// Use to get the angle of tangent <paramref name="s"/>.
///
/// The method cannot know in which quadrant the angle should fall.
- /// See <see cref="Atan2(real_t, real_t)"/> if you have both <c>y</c> and <c>x</c>.
+ /// See <see cref="Atan2(double, double)"/> if you have both <c>y</c> and <c>x</c>.
/// </summary>
/// <param name="s">The input tangent value.</param>
/// <returns>
/// An angle that would result in the given tangent value. On the range <c>-Tau/4</c> to <c>Tau/4</c>.
/// </returns>
- public static real_t Atan(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Atan(double s)
+ {
+ return Math.Atan(s);
+ }
+
+ /// <summary>
+ /// Returns the arc tangent of <paramref name="y"/> and <paramref name="x"/> in radians.
+ /// Use to get the angle of the tangent of <c>y/x</c>. To compute the value, the method takes into
+ /// account the sign of both arguments in order to determine the quadrant.
+ ///
+ /// Important note: The Y coordinate comes first, by convention.
+ /// </summary>
+ /// <param name="y">The Y coordinate of the point to find the angle to.</param>
+ /// <param name="x">The X coordinate of the point to find the angle to.</param>
+ /// <returns>
+ /// An angle that would result in the given tangent value. On the range <c>-Tau/2</c> to <c>Tau/2</c>.
+ /// </returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Atan2(float y, float x)
{
- return (real_t)Math.Atan(s);
+ return MathF.Atan2(y, x);
}
/// <summary>
@@ -113,9 +195,21 @@ namespace Godot
/// <returns>
/// An angle that would result in the given tangent value. On the range <c>-Tau/2</c> to <c>Tau/2</c>.
/// </returns>
- public static real_t Atan2(real_t y, real_t x)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Atan2(double y, double x)
+ {
+ return Math.Atan2(y, x);
+ }
+
+ /// <summary>
+ /// Rounds <paramref name="s"/> upward (towards positive infinity).
+ /// </summary>
+ /// <param name="s">The number to ceil.</param>
+ /// <returns>The smallest whole number that is not less than <paramref name="s"/>.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Ceil(float s)
{
- return (real_t)Math.Atan2(y, x);
+ return MathF.Ceiling(s);
}
/// <summary>
@@ -123,9 +217,10 @@ namespace Godot
/// </summary>
/// <param name="s">The number to ceil.</param>
/// <returns>The smallest whole number that is not less than <paramref name="s"/>.</returns>
- public static real_t Ceil(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Ceil(double s)
{
- return (real_t)Math.Ceiling(s);
+ return Math.Ceiling(s);
}
/// <summary>
@@ -136,9 +231,24 @@ namespace Godot
/// <param name="min">The minimum allowed value.</param>
/// <param name="max">The maximum allowed value.</param>
/// <returns>The clamped value.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Clamp(int value, int min, int max)
{
- return value < min ? min : value > max ? max : value;
+ return Math.Clamp(value, min, max);
+ }
+
+ /// <summary>
+ /// Clamps a <paramref name="value"/> so that it is not less than <paramref name="min"/>
+ /// and not more than <paramref name="max"/>.
+ /// </summary>
+ /// <param name="value">The value to clamp.</param>
+ /// <param name="min">The minimum allowed value.</param>
+ /// <param name="max">The maximum allowed value.</param>
+ /// <returns>The clamped value.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Clamp(float value, float min, float max)
+ {
+ return Math.Clamp(value, min, max);
}
/// <summary>
@@ -149,9 +259,21 @@ namespace Godot
/// <param name="min">The minimum allowed value.</param>
/// <param name="max">The maximum allowed value.</param>
/// <returns>The clamped value.</returns>
- public static real_t Clamp(real_t value, real_t min, real_t max)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Clamp(double value, double min, double max)
+ {
+ return Math.Clamp(value, min, max);
+ }
+
+ /// <summary>
+ /// Returns the cosine of angle <paramref name="s"/> in radians.
+ /// </summary>
+ /// <param name="s">The angle in radians.</param>
+ /// <returns>The cosine of that angle.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Cos(float s)
{
- return value < min ? min : value > max ? max : value;
+ return MathF.Cos(s);
}
/// <summary>
@@ -159,9 +281,21 @@ namespace Godot
/// </summary>
/// <param name="s">The angle in radians.</param>
/// <returns>The cosine of that angle.</returns>
- public static real_t Cos(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Cos(double s)
+ {
+ return Math.Cos(s);
+ }
+
+ /// <summary>
+ /// Returns the hyperbolic cosine of angle <paramref name="s"/> in radians.
+ /// </summary>
+ /// <param name="s">The angle in radians.</param>
+ /// <returns>The hyperbolic cosine of that angle.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Cosh(float s)
{
- return (real_t)Math.Cos(s);
+ return MathF.Cosh(s);
}
/// <summary>
@@ -169,9 +303,10 @@ namespace Godot
/// </summary>
/// <param name="s">The angle in radians.</param>
/// <returns>The hyperbolic cosine of that angle.</returns>
- public static real_t Cosh(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Cosh(double s)
{
- return (real_t)Math.Cosh(s);
+ return Math.Cosh(s);
}
/// <summary>
@@ -184,7 +319,7 @@ namespace Godot
/// <param name="post">The value which after "to" value for interpolation.</param>
/// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
/// <returns>The resulting value of the interpolation.</returns>
- public static real_t CubicInterpolate(real_t from, real_t to, real_t pre, real_t post, real_t weight)
+ public static float CubicInterpolate(float from, float to, float pre, float post, float weight)
{
return 0.5f *
((from * 2.0f) +
@@ -194,9 +329,28 @@ namespace Godot
}
/// <summary>
+ /// Cubic interpolates between two values by the factor defined in <paramref name="weight"/>
+ /// with pre and post values.
+ /// </summary>
+ /// <param name="from">The start value for interpolation.</param>
+ /// <param name="to">The destination value for interpolation.</param>
+ /// <param name="pre">The value which before "from" value for interpolation.</param>
+ /// <param name="post">The value which after "to" value for interpolation.</param>
+ /// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
+ /// <returns>The resulting value of the interpolation.</returns>
+ public static double CubicInterpolate(double from, double to, double pre, double post, double weight)
+ {
+ return 0.5 *
+ ((from * 2.0) +
+ (-pre + to) * weight +
+ (2.0 * pre - 5.0 * from + 4.0 * to - post) * (weight * weight) +
+ (-pre + 3.0 * from - 3.0 * to + post) * (weight * weight * weight));
+ }
+
+ /// <summary>
/// Cubic interpolates between two rotation values with shortest path
/// by the factor defined in <paramref name="weight"/> with pre and post values.
- /// See also <see cref="LerpAngle"/>.
+ /// See also <see cref="LerpAngle(float, float, float)"/>.
/// </summary>
/// <param name="from">The start value for interpolation.</param>
/// <param name="to">The destination value for interpolation.</param>
@@ -204,18 +358,45 @@ namespace Godot
/// <param name="post">The value which after "to" value for interpolation.</param>
/// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
/// <returns>The resulting value of the interpolation.</returns>
- public static real_t CubicInterpolateAngle(real_t from, real_t to, real_t pre, real_t post, real_t weight)
+ public static float CubicInterpolateAngle(float from, float to, float pre, float post, float weight)
{
- real_t fromRot = from % Mathf.Tau;
+ float fromRot = from % MathF.Tau;
- real_t preDiff = (pre - fromRot) % Mathf.Tau;
- real_t preRot = fromRot + (2.0f * preDiff) % Mathf.Tau - preDiff;
+ float preDiff = (pre - fromRot) % MathF.Tau;
+ float preRot = fromRot + (2.0f * preDiff) % MathF.Tau - preDiff;
- real_t toDiff = (to - fromRot) % Mathf.Tau;
- real_t toRot = fromRot + (2.0f * toDiff) % Mathf.Tau - toDiff;
+ float toDiff = (to - fromRot) % MathF.Tau;
+ float toRot = fromRot + (2.0f * toDiff) % MathF.Tau - toDiff;
- real_t postDiff = (post - toRot) % Mathf.Tau;
- real_t postRot = toRot + (2.0f * postDiff) % Mathf.Tau - postDiff;
+ float postDiff = (post - toRot) % MathF.Tau;
+ float postRot = toRot + (2.0f * postDiff) % MathF.Tau - postDiff;
+
+ return CubicInterpolate(fromRot, toRot, preRot, postRot, weight);
+ }
+
+ /// <summary>
+ /// Cubic interpolates between two rotation values with shortest path
+ /// by the factor defined in <paramref name="weight"/> with pre and post values.
+ /// See also <see cref="LerpAngle(double, double, double)"/>.
+ /// </summary>
+ /// <param name="from">The start value for interpolation.</param>
+ /// <param name="to">The destination value for interpolation.</param>
+ /// <param name="pre">The value which before "from" value for interpolation.</param>
+ /// <param name="post">The value which after "to" value for interpolation.</param>
+ /// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
+ /// <returns>The resulting value of the interpolation.</returns>
+ public static double CubicInterpolateAngle(double from, double to, double pre, double post, double weight)
+ {
+ double fromRot = from % Math.Tau;
+
+ double preDiff = (pre - fromRot) % Math.Tau;
+ double preRot = fromRot + (2.0 * preDiff) % Math.Tau - preDiff;
+
+ double toDiff = (to - fromRot) % Math.Tau;
+ double toRot = fromRot + (2.0 * toDiff) % Math.Tau - toDiff;
+
+ double postDiff = (post - toRot) % Math.Tau;
+ double postRot = toRot + (2.0 * postDiff) % Math.Tau - postDiff;
return CubicInterpolate(fromRot, toRot, preRot, postRot, weight);
}
@@ -223,7 +404,8 @@ namespace Godot
/// <summary>
/// Cubic interpolates between two values by the factor defined in <paramref name="weight"/>
/// with pre and post values.
- /// It can perform smoother interpolation than <see cref="CubicInterpolate"/>
+ /// It can perform smoother interpolation than
+ /// <see cref="CubicInterpolate(float, float, float, float, float)"/>
/// by the time values.
/// </summary>
/// <param name="from">The start value for interpolation.</param>
@@ -235,23 +417,52 @@ namespace Godot
/// <param name="preT"></param>
/// <param name="postT"></param>
/// <returns>The resulting value of the interpolation.</returns>
- public static real_t CubicInterpolateInTime(real_t from, real_t to, real_t pre, real_t post, real_t weight, real_t toT, real_t preT, real_t postT)
+ public static float CubicInterpolateInTime(float from, float to, float pre, float post, float weight, float toT, float preT, float postT)
{
/* Barry-Goldman method */
- real_t t = Lerp(0.0f, toT, weight);
- real_t a1 = Lerp(pre, from, preT == 0 ? 0.0f : (t - preT) / -preT);
- real_t a2 = Lerp(from, to, toT == 0 ? 0.5f : t / toT);
- real_t a3 = Lerp(to, post, postT - toT == 0 ? 1.0f : (t - toT) / (postT - toT));
- real_t b1 = Lerp(a1, a2, toT - preT == 0 ? 0.0f : (t - preT) / (toT - preT));
- real_t b2 = Lerp(a2, a3, postT == 0 ? 1.0f : t / postT);
+ float t = Lerp(0.0f, toT, weight);
+ float a1 = Lerp(pre, from, preT == 0 ? 0.0f : (t - preT) / -preT);
+ float a2 = Lerp(from, to, toT == 0 ? 0.5f : t / toT);
+ float a3 = Lerp(to, post, postT - toT == 0 ? 1.0f : (t - toT) / (postT - toT));
+ float b1 = Lerp(a1, a2, toT - preT == 0 ? 0.0f : (t - preT) / (toT - preT));
+ float b2 = Lerp(a2, a3, postT == 0 ? 1.0f : t / postT);
return Lerp(b1, b2, toT == 0 ? 0.5f : t / toT);
}
/// <summary>
+ /// Cubic interpolates between two values by the factor defined in <paramref name="weight"/>
+ /// with pre and post values.
+ /// It can perform smoother interpolation than
+ /// <see cref="CubicInterpolate(double, double, double, double, double)"/>
+ /// by the time values.
+ /// </summary>
+ /// <param name="from">The start value for interpolation.</param>
+ /// <param name="to">The destination value for interpolation.</param>
+ /// <param name="pre">The value which before "from" value for interpolation.</param>
+ /// <param name="post">The value which after "to" value for interpolation.</param>
+ /// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
+ /// <param name="toT"></param>
+ /// <param name="preT"></param>
+ /// <param name="postT"></param>
+ /// <returns>The resulting value of the interpolation.</returns>
+ public static double CubicInterpolateInTime(double from, double to, double pre, double post, double weight, double toT, double preT, double postT)
+ {
+ /* Barry-Goldman method */
+ double t = Lerp(0.0, toT, weight);
+ double a1 = Lerp(pre, from, preT == 0 ? 0.0 : (t - preT) / -preT);
+ double a2 = Lerp(from, to, toT == 0 ? 0.5 : t / toT);
+ double a3 = Lerp(to, post, postT - toT == 0 ? 1.0 : (t - toT) / (postT - toT));
+ double b1 = Lerp(a1, a2, toT - preT == 0 ? 0.0 : (t - preT) / (toT - preT));
+ double b2 = Lerp(a2, a3, postT == 0 ? 1.0 : t / postT);
+ return Lerp(b1, b2, toT == 0 ? 0.5 : t / toT);
+ }
+
+ /// <summary>
/// Cubic interpolates between two rotation values with shortest path
/// by the factor defined in <paramref name="weight"/> with pre and post values.
- /// See also <see cref="LerpAngle"/>.
- /// It can perform smoother interpolation than <see cref="CubicInterpolateAngle"/>
+ /// See also <see cref="LerpAngle(float, float, float)"/>.
+ /// It can perform smoother interpolation than
+ /// <see cref="CubicInterpolateAngle(float, float, float, float, float)"/>
/// by the time values.
/// </summary>
/// <param name="from">The start value for interpolation.</param>
@@ -263,24 +474,78 @@ namespace Godot
/// <param name="preT"></param>
/// <param name="postT"></param>
/// <returns>The resulting value of the interpolation.</returns>
- public static real_t CubicInterpolateAngleInTime(real_t from, real_t to, real_t pre, real_t post, real_t weight,
- real_t toT, real_t preT, real_t postT)
+ public static float CubicInterpolateAngleInTime(float from, float to, float pre, float post, float weight, float toT, float preT, float postT)
{
- real_t fromRot = from % Mathf.Tau;
+ float fromRot = from % MathF.Tau;
- real_t preDiff = (pre - fromRot) % Mathf.Tau;
- real_t preRot = fromRot + (2.0f * preDiff) % Mathf.Tau - preDiff;
+ float preDiff = (pre - fromRot) % MathF.Tau;
+ float preRot = fromRot + (2.0f * preDiff) % MathF.Tau - preDiff;
- real_t toDiff = (to - fromRot) % Mathf.Tau;
- real_t toRot = fromRot + (2.0f * toDiff) % Mathf.Tau - toDiff;
+ float toDiff = (to - fromRot) % MathF.Tau;
+ float toRot = fromRot + (2.0f * toDiff) % MathF.Tau - toDiff;
- real_t postDiff = (post - toRot) % Mathf.Tau;
- real_t postRot = toRot + (2.0f * postDiff) % Mathf.Tau - postDiff;
+ float postDiff = (post - toRot) % MathF.Tau;
+ float postRot = toRot + (2.0f * postDiff) % MathF.Tau - postDiff;
return CubicInterpolateInTime(fromRot, toRot, preRot, postRot, weight, toT, preT, postT);
}
/// <summary>
+ /// Cubic interpolates between two rotation values with shortest path
+ /// by the factor defined in <paramref name="weight"/> with pre and post values.
+ /// See also <see cref="LerpAngle(double, double, double)"/>.
+ /// It can perform smoother interpolation than
+ /// <see cref="CubicInterpolateAngle(double, double, double, double, double)"/>
+ /// by the time values.
+ /// </summary>
+ /// <param name="from">The start value for interpolation.</param>
+ /// <param name="to">The destination value for interpolation.</param>
+ /// <param name="pre">The value which before "from" value for interpolation.</param>
+ /// <param name="post">The value which after "to" value for interpolation.</param>
+ /// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
+ /// <param name="toT"></param>
+ /// <param name="preT"></param>
+ /// <param name="postT"></param>
+ /// <returns>The resulting value of the interpolation.</returns>
+ public static double CubicInterpolateAngleInTime(double from, double to, double pre, double post, double weight, double toT, double preT, double postT)
+ {
+ double fromRot = from % Math.Tau;
+
+ double preDiff = (pre - fromRot) % Math.Tau;
+ double preRot = fromRot + (2.0 * preDiff) % Math.Tau - preDiff;
+
+ double toDiff = (to - fromRot) % Math.Tau;
+ double toRot = fromRot + (2.0 * toDiff) % Math.Tau - toDiff;
+
+ double postDiff = (post - toRot) % Math.Tau;
+ double postRot = toRot + (2.0 * postDiff) % Math.Tau - postDiff;
+
+ return CubicInterpolateInTime(fromRot, toRot, preRot, postRot, weight, toT, preT, postT);
+ }
+
+ /// <summary>
+ /// Returns the point at the given <paramref name="t"/> on a one-dimensional Bezier curve defined by
+ /// the given <paramref name="control1"/>, <paramref name="control2"/>, and <paramref name="end"/> points.
+ /// </summary>
+ /// <param name="start">The start value for the interpolation.</param>
+ /// <param name="control1">Control point that defines the bezier curve.</param>
+ /// <param name="control2">Control point that defines the bezier curve.</param>
+ /// <param name="end">The destination value for the interpolation.</param>
+ /// <param name="t">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
+ /// <returns>The resulting value of the interpolation.</returns>
+ public static float BezierInterpolate(float start, float control1, float control2, float end, float t)
+ {
+ // Formula from Wikipedia article on Bezier curves
+ float omt = 1.0f - t;
+ float omt2 = omt * omt;
+ float omt3 = omt2 * omt;
+ float t2 = t * t;
+ float t3 = t2 * t;
+
+ return start * omt3 + control1 * omt2 * t * 3.0f + control2 * omt * t2 * 3.0f + end * t3;
+ }
+
+ /// <summary>
/// Returns the point at the given <paramref name="t"/> on a one-dimensional Bezier curve defined by
/// the given <paramref name="control1"/>, <paramref name="control2"/>, and <paramref name="end"/> points.
/// </summary>
@@ -290,16 +555,37 @@ namespace Godot
/// <param name="end">The destination value for the interpolation.</param>
/// <param name="t">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
/// <returns>The resulting value of the interpolation.</returns>
- public static real_t BezierInterpolate(real_t start, real_t control1, real_t control2, real_t end, real_t t)
+ public static double BezierInterpolate(double start, double control1, double control2, double end, double t)
+ {
+ // Formula from Wikipedia article on Bezier curves
+ double omt = 1.0 - t;
+ double omt2 = omt * omt;
+ double omt3 = omt2 * omt;
+ double t2 = t * t;
+ double t3 = t2 * t;
+
+ return start * omt3 + control1 * omt2 * t * 3.0 + control2 * omt * t2 * 3.0 + end * t3;
+ }
+
+ /// <summary>
+ /// Returns the derivative at the given <paramref name="t"/> on a one dimensional Bezier curve defined by
+ /// the given <paramref name="control1"/>, <paramref name="control2"/>, and <paramref name="end"/> points.
+ /// </summary>
+ /// <param name="start">The start value for the interpolation.</param>
+ /// <param name="control1">Control point that defines the bezier curve.</param>
+ /// <param name="control2">Control point that defines the bezier curve.</param>
+ /// <param name="end">The destination value for the interpolation.</param>
+ /// <param name="t">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
+ /// <returns>The resulting value of the interpolation.</returns>
+ public static float BezierDerivative(float start, float control1, float control2, float end, float t)
{
// Formula from Wikipedia article on Bezier curves
- real_t omt = 1 - t;
- real_t omt2 = omt * omt;
- real_t omt3 = omt2 * omt;
- real_t t2 = t * t;
- real_t t3 = t2 * t;
+ float omt = 1.0f - t;
+ float omt2 = omt * omt;
+ float t2 = t * t;
- return start * omt3 + control1 * omt2 * t * 3 + control2 * omt * t2 * 3 + end * t3;
+ float d = (control1 - start) * 3.0f * omt2 + (control2 - control1) * 6.0f * omt * t + (end - control2) * 3.0f * t2;
+ return d;
}
/// <summary>
@@ -312,25 +598,57 @@ namespace Godot
/// <param name="end">The destination value for the interpolation.</param>
/// <param name="t">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
/// <returns>The resulting value of the interpolation.</returns>
- public static real_t BezierDerivative(real_t start, real_t control1, real_t control2, real_t end, real_t t)
+ public static double BezierDerivative(double start, double control1, double control2, double end, double t)
{
// Formula from Wikipedia article on Bezier curves
- real_t omt = 1 - t;
- real_t omt2 = omt * omt;
- real_t t2 = t * t;
+ double omt = 1.0 - t;
+ double omt2 = omt * omt;
+ double t2 = t * t;
- real_t d = (control1 - start) * 3 * omt2 + (control2 - control1) * 6 * omt * t + (end - control2) * 3 * t2;
+ double d = (control1 - start) * 3.0 * omt2 + (control2 - control1) * 6.0 * omt * t + (end - control2) * 3.0 * t2;
return d;
}
/// <summary>
+ /// Converts from decibels to linear energy (audio).
+ /// </summary>
+ /// <seealso cref="LinearToDb(float)"/>
+ /// <param name="db">Decibels to convert.</param>
+ /// <returns>Audio volume as linear energy.</returns>
+ public static float DbToLinear(float db)
+ {
+ return MathF.Exp(db * 0.11512925464970228420089957273422f);
+ }
+
+ /// <summary>
+ /// Converts from decibels to linear energy (audio).
+ /// </summary>
+ /// <seealso cref="LinearToDb(double)"/>
+ /// <param name="db">Decibels to convert.</param>
+ /// <returns>Audio volume as linear energy.</returns>
+ public static double DbToLinear(double db)
+ {
+ return Math.Exp(db * 0.11512925464970228420089957273422);
+ }
+
+ /// <summary>
/// Converts an angle expressed in degrees to radians.
/// </summary>
/// <param name="deg">An angle expressed in degrees.</param>
/// <returns>The same angle expressed in radians.</returns>
- public static real_t DegToRad(real_t deg)
+ public static float DegToRad(float deg)
{
- return deg * _degToRadConst;
+ return deg * _degToRadConstF;
+ }
+
+ /// <summary>
+ /// Converts an angle expressed in degrees to radians.
+ /// </summary>
+ /// <param name="deg">An angle expressed in degrees.</param>
+ /// <returns>The same angle expressed in radians.</returns>
+ public static double DegToRad(double deg)
+ {
+ return deg * _degToRadConstD;
}
/// <summary>
@@ -343,38 +661,94 @@ namespace Godot
/// <c>0</c> is constant, <c>1</c> is linear, <c>0</c> to <c>1</c> is ease-in, <c>1</c> or more is ease-out.
/// </param>
/// <returns>The eased value.</returns>
- public static real_t Ease(real_t s, real_t curve)
+ public static float Ease(float s, float curve)
{
- if (s < 0f)
+ if (s < 0.0f)
{
- s = 0f;
+ s = 0.0f;
}
else if (s > 1.0f)
{
s = 1.0f;
}
- if (curve > 0f)
+ if (curve > 0.0f)
{
if (curve < 1.0f)
{
- return 1.0f - Pow(1.0f - s, 1.0f / curve);
+ return 1.0f - MathF.Pow(1.0f - s, 1.0f / curve);
}
- return Pow(s, curve);
+ return MathF.Pow(s, curve);
}
- if (curve < 0f)
+ if (curve < 0.0f)
{
if (s < 0.5f)
{
- return Pow(s * 2.0f, -curve) * 0.5f;
+ return MathF.Pow(s * 2.0f, -curve) * 0.5f;
+ }
+
+ return ((1.0f - MathF.Pow(1.0f - ((s - 0.5f) * 2.0f), -curve)) * 0.5f) + 0.5f;
+ }
+
+ return 0.0f;
+ }
+
+ /// <summary>
+ /// Easing function, based on exponent. The <paramref name="curve"/> values are:
+ /// <c>0</c> is constant, <c>1</c> is linear, <c>0</c> to <c>1</c> is ease-in, <c>1</c> or more is ease-out.
+ /// Negative values are in-out/out-in.
+ /// </summary>
+ /// <param name="s">The value to ease.</param>
+ /// <param name="curve">
+ /// <c>0</c> is constant, <c>1</c> is linear, <c>0</c> to <c>1</c> is ease-in, <c>1</c> or more is ease-out.
+ /// </param>
+ /// <returns>The eased value.</returns>
+ public static double Ease(double s, double curve)
+ {
+ if (s < 0.0)
+ {
+ s = 0.0;
+ }
+ else if (s > 1.0)
+ {
+ s = 1.0;
+ }
+
+ if (curve > 0)
+ {
+ if (curve < 1.0)
+ {
+ return 1.0 - Math.Pow(1.0 - s, 1.0 / curve);
+ }
+
+ return Math.Pow(s, curve);
+ }
+
+ if (curve < 0.0)
+ {
+ if (s < 0.5)
+ {
+ return Math.Pow(s * 2.0, -curve) * 0.5;
}
- return ((1.0f - Pow(1.0f - ((s - 0.5f) * 2.0f), -curve)) * 0.5f) + 0.5f;
+ return ((1.0 - Math.Pow(1.0 - ((s - 0.5) * 2.0), -curve)) * 0.5) + 0.5;
}
- return 0f;
+ return 0.0;
+ }
+
+ /// <summary>
+ /// The natural exponential function. It raises the mathematical
+ /// constant <c>e</c> to the power of <paramref name="s"/> and returns it.
+ /// </summary>
+ /// <param name="s">The exponent to raise <c>e</c> to.</param>
+ /// <returns><c>e</c> raised to the power of <paramref name="s"/>.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Exp(float s)
+ {
+ return MathF.Exp(s);
}
/// <summary>
@@ -383,9 +757,21 @@ namespace Godot
/// </summary>
/// <param name="s">The exponent to raise <c>e</c> to.</param>
/// <returns><c>e</c> raised to the power of <paramref name="s"/>.</returns>
- public static real_t Exp(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Exp(double s)
+ {
+ return Math.Exp(s);
+ }
+
+ /// <summary>
+ /// Rounds <paramref name="s"/> downward (towards negative infinity).
+ /// </summary>
+ /// <param name="s">The number to floor.</param>
+ /// <returns>The largest whole number that is not more than <paramref name="s"/>.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Floor(float s)
{
- return (real_t)Math.Exp(s);
+ return MathF.Floor(s);
}
/// <summary>
@@ -393,14 +779,32 @@ namespace Godot
/// </summary>
/// <param name="s">The number to floor.</param>
/// <returns>The largest whole number that is not more than <paramref name="s"/>.</returns>
- public static real_t Floor(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Floor(double s)
+ {
+ return Math.Floor(s);
+ }
+
+ /// <summary>
+ /// Returns a normalized value considering the given range.
+ /// This is the opposite of <see cref="Lerp(float, float, float)"/>.
+ /// </summary>
+ /// <param name="from">The start value for interpolation.</param>
+ /// <param name="to">The destination value for interpolation.</param>
+ /// <param name="weight">The interpolated value.</param>
+ /// <returns>
+ /// The resulting value of the inverse interpolation.
+ /// The returned value will be between 0.0 and 1.0 if <paramref name="weight"/> is
+ /// between <paramref name="from"/> and <paramref name="to"/> (inclusive).
+ /// </returns>
+ public static float InverseLerp(float from, float to, float weight)
{
- return (real_t)Math.Floor(s);
+ return (weight - from) / (to - from);
}
/// <summary>
/// Returns a normalized value considering the given range.
- /// This is the opposite of <see cref="Lerp(real_t, real_t, real_t)"/>.
+ /// This is the opposite of <see cref="Lerp(double, double, double)"/>.
/// </summary>
/// <param name="from">The start value for interpolation.</param>
/// <param name="to">The destination value for interpolation.</param>
@@ -410,7 +814,7 @@ namespace Godot
/// The returned value will be between 0.0 and 1.0 if <paramref name="weight"/> is
/// between <paramref name="from"/> and <paramref name="to"/> (inclusive).
/// </returns>
- public static real_t InverseLerp(real_t from, real_t to, real_t weight)
+ public static double InverseLerp(double from, double to, double weight)
{
return (weight - from) / (to - from);
}
@@ -423,7 +827,31 @@ namespace Godot
/// <param name="a">One of the values.</param>
/// <param name="b">The other value.</param>
/// <returns>A <see langword="bool"/> for whether or not the two values are approximately equal.</returns>
- public static bool IsEqualApprox(real_t a, real_t b)
+ public static bool IsEqualApprox(float a, float b)
+ {
+ // Check for exact equality first, required to handle "infinity" values.
+ if (a == b)
+ {
+ return true;
+ }
+ // Then check for approximate equality.
+ float tolerance = _epsilonF * Math.Abs(a);
+ if (tolerance < _epsilonF)
+ {
+ tolerance = _epsilonF;
+ }
+ return Math.Abs(a - b) < tolerance;
+ }
+
+ /// <summary>
+ /// Returns <see langword="true"/> if <paramref name="a"/> and <paramref name="b"/> are approximately equal
+ /// to each other.
+ /// The comparison is done using a tolerance calculation with <see cref="Epsilon"/>.
+ /// </summary>
+ /// <param name="a">One of the values.</param>
+ /// <param name="b">The other value.</param>
+ /// <returns>A <see langword="bool"/> for whether or not the two values are approximately equal.</returns>
+ public static bool IsEqualApprox(double a, double b)
{
// Check for exact equality first, required to handle "infinity" values.
if (a == b)
@@ -431,12 +859,24 @@ namespace Godot
return true;
}
// Then check for approximate equality.
- real_t tolerance = Epsilon * Abs(a);
- if (tolerance < Epsilon)
+ double tolerance = _epsilonD * Math.Abs(a);
+ if (tolerance < _epsilonD)
{
- tolerance = Epsilon;
+ tolerance = _epsilonD;
}
- return Abs(a - b) < tolerance;
+ return Math.Abs(a - b) < tolerance;
+ }
+
+ /// <summary>
+ /// Returns whether <paramref name="s"/> is a finite value, i.e. it is not
+ /// <see cref="NaN"/>, positive infinite, or negative infinity.
+ /// </summary>
+ /// <param name="s">The value to check.</param>
+ /// <returns>A <see langword="bool"/> for whether or not the value is a finite value.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool IsFinite(float s)
+ {
+ return float.IsFinite(s);
}
/// <summary>
@@ -445,9 +885,21 @@ namespace Godot
/// </summary>
/// <param name="s">The value to check.</param>
/// <returns>A <see langword="bool"/> for whether or not the value is a finite value.</returns>
- public static bool IsFinite(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool IsFinite(double s)
+ {
+ return double.IsFinite(s);
+ }
+
+ /// <summary>
+ /// Returns whether <paramref name="s"/> is an infinity value (either positive infinity or negative infinity).
+ /// </summary>
+ /// <param name="s">The value to check.</param>
+ /// <returns>A <see langword="bool"/> for whether or not the value is an infinity value.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool IsInf(float s)
{
- return real_t.IsFinite(s);
+ return float.IsInfinity(s);
}
/// <summary>
@@ -455,9 +907,21 @@ namespace Godot
/// </summary>
/// <param name="s">The value to check.</param>
/// <returns>A <see langword="bool"/> for whether or not the value is an infinity value.</returns>
- public static bool IsInf(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool IsInf(double s)
+ {
+ return double.IsInfinity(s);
+ }
+
+ /// <summary>
+ /// Returns whether <paramref name="s"/> is a <c>NaN</c> ("Not a Number" or invalid) value.
+ /// </summary>
+ /// <param name="s">The value to check.</param>
+ /// <returns>A <see langword="bool"/> for whether or not the value is a <c>NaN</c> value.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool IsNaN(float s)
{
- return real_t.IsInfinity(s);
+ return float.IsNaN(s);
}
/// <summary>
@@ -465,34 +929,64 @@ namespace Godot
/// </summary>
/// <param name="s">The value to check.</param>
/// <returns>A <see langword="bool"/> for whether or not the value is a <c>NaN</c> value.</returns>
- public static bool IsNaN(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool IsNaN(double s)
+ {
+ return double.IsNaN(s);
+ }
+
+ /// <summary>
+ /// Returns <see langword="true"/> if <paramref name="s"/> is zero or almost zero.
+ /// The comparison is done using a tolerance calculation with <see cref="Epsilon"/>.
+ ///
+ /// This method is faster than using <see cref="IsEqualApprox(float, float)"/> with
+ /// one value as zero.
+ /// </summary>
+ /// <param name="s">The value to check.</param>
+ /// <returns>A <see langword="bool"/> for whether or not the value is nearly zero.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool IsZeroApprox(float s)
{
- return real_t.IsNaN(s);
+ return Math.Abs(s) < _epsilonF;
}
/// <summary>
/// Returns <see langword="true"/> if <paramref name="s"/> is zero or almost zero.
/// The comparison is done using a tolerance calculation with <see cref="Epsilon"/>.
///
- /// This method is faster than using <see cref="IsEqualApprox(real_t, real_t)"/> with
+ /// This method is faster than using <see cref="IsEqualApprox(double, double)"/> with
/// one value as zero.
/// </summary>
/// <param name="s">The value to check.</param>
/// <returns>A <see langword="bool"/> for whether or not the value is nearly zero.</returns>
- public static bool IsZeroApprox(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool IsZeroApprox(double s)
+ {
+ return Math.Abs(s) < _epsilonD;
+ }
+
+ /// <summary>
+ /// Linearly interpolates between two values by a normalized value.
+ /// This is the opposite <see cref="InverseLerp(float, float, float)"/>.
+ /// </summary>
+ /// <param name="from">The start value for interpolation.</param>
+ /// <param name="to">The destination value for interpolation.</param>
+ /// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
+ /// <returns>The resulting value of the interpolation.</returns>
+ public static float Lerp(float from, float to, float weight)
{
- return Abs(s) < Epsilon;
+ return from + ((to - from) * weight);
}
/// <summary>
/// Linearly interpolates between two values by a normalized value.
- /// This is the opposite <see cref="InverseLerp(real_t, real_t, real_t)"/>.
+ /// This is the opposite <see cref="InverseLerp(double, double, double)"/>.
/// </summary>
/// <param name="from">The start value for interpolation.</param>
/// <param name="to">The destination value for interpolation.</param>
/// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
/// <returns>The resulting value of the interpolation.</returns>
- public static real_t Lerp(real_t from, real_t to, real_t weight)
+ public static double Lerp(double from, double to, double weight)
{
return from + ((to - from) * weight);
}
@@ -500,30 +994,101 @@ namespace Godot
/// <summary>
/// Linearly interpolates between two angles (in radians) by a normalized value.
///
- /// Similar to <see cref="Lerp(real_t, real_t, real_t)"/>,
+ /// Similar to <see cref="Lerp(float, float, float)"/>,
+ /// but interpolates correctly when the angles wrap around <see cref="Tau"/>.
+ /// </summary>
+ /// <param name="from">The start angle for interpolation.</param>
+ /// <param name="to">The destination angle for interpolation.</param>
+ /// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
+ /// <returns>The resulting angle of the interpolation.</returns>
+ public static float LerpAngle(float from, float to, float weight)
+ {
+ float difference = (to - from) % MathF.Tau;
+ float distance = ((2 * difference) % MathF.Tau) - difference;
+ return from + (distance * weight);
+ }
+
+ /// <summary>
+ /// Linearly interpolates between two angles (in radians) by a normalized value.
+ ///
+ /// Similar to <see cref="Lerp(double, double, double)"/>,
/// but interpolates correctly when the angles wrap around <see cref="Tau"/>.
/// </summary>
/// <param name="from">The start angle for interpolation.</param>
/// <param name="to">The destination angle for interpolation.</param>
/// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
/// <returns>The resulting angle of the interpolation.</returns>
- public static real_t LerpAngle(real_t from, real_t to, real_t weight)
+ public static double LerpAngle(double from, double to, double weight)
{
- real_t difference = (to - from) % Mathf.Tau;
- real_t distance = ((2 * difference) % Mathf.Tau) - difference;
+ double difference = (to - from) % Math.Tau;
+ double distance = ((2 * difference) % Math.Tau) - difference;
return from + (distance * weight);
}
/// <summary>
+ /// Converts from linear energy to decibels (audio).
+ /// This can be used to implement volume sliders that behave as expected (since volume isn't linear).
+ /// </summary>
+ /// <seealso cref="DbToLinear(float)"/>
+ /// <example>
+ /// <code>
+ /// // "slider" refers to a node that inherits Range such as HSlider or VSlider.
+ /// // Its range must be configured to go from 0 to 1.
+ /// // Change the bus name if you'd like to change the volume of a specific bus only.
+ /// AudioServer.SetBusVolumeDb(AudioServer.GetBusIndex("Master"), GD.LinearToDb(slider.value));
+ /// </code>
+ /// </example>
+ /// <param name="linear">The linear energy to convert.</param>
+ /// <returns>Audio as decibels.</returns>
+ public static float LinearToDb(float linear)
+ {
+ return MathF.Log(linear) * 8.6858896380650365530225783783321f;
+ }
+
+ /// <summary>
+ /// Converts from linear energy to decibels (audio).
+ /// This can be used to implement volume sliders that behave as expected (since volume isn't linear).
+ /// </summary>
+ /// <seealso cref="DbToLinear(double)"/>
+ /// <example>
+ /// <code>
+ /// // "slider" refers to a node that inherits Range such as HSlider or VSlider.
+ /// // Its range must be configured to go from 0 to 1.
+ /// // Change the bus name if you'd like to change the volume of a specific bus only.
+ /// AudioServer.SetBusVolumeDb(AudioServer.GetBusIndex("Master"), GD.LinearToDb(slider.value));
+ /// </code>
+ /// </example>
+ /// <param name="linear">The linear energy to convert.</param>
+ /// <returns>Audio as decibels.</returns>
+ public static double LinearToDb(double linear)
+ {
+ return Math.Log(linear) * 8.6858896380650365530225783783321;
+ }
+
+ /// <summary>
+ /// Natural logarithm. The amount of time needed to reach a certain level of continuous growth.
+ ///
+ /// Note: This is not the same as the "log" function on most calculators, which uses a base 10 logarithm.
+ /// </summary>
+ /// <param name="s">The input value.</param>
+ /// <returns>The natural log of <paramref name="s"/>.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Log(float s)
+ {
+ return MathF.Log(s);
+ }
+
+ /// <summary>
/// Natural logarithm. The amount of time needed to reach a certain level of continuous growth.
///
/// Note: This is not the same as the "log" function on most calculators, which uses a base 10 logarithm.
/// </summary>
/// <param name="s">The input value.</param>
/// <returns>The natural log of <paramref name="s"/>.</returns>
- public static real_t Log(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Log(double s)
{
- return (real_t)Math.Log(s);
+ return Math.Log(s);
}
/// <summary>
@@ -532,9 +1097,22 @@ namespace Godot
/// <param name="a">One of the values.</param>
/// <param name="b">The other value.</param>
/// <returns>Whichever of the two values is higher.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Max(int a, int b)
{
- return a > b ? a : b;
+ return Math.Max(a, b);
+ }
+
+ /// <summary>
+ /// Returns the maximum of two values.
+ /// </summary>
+ /// <param name="a">One of the values.</param>
+ /// <param name="b">The other value.</param>
+ /// <returns>Whichever of the two values is higher.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Max(float a, float b)
+ {
+ return Math.Max(a, b);
}
/// <summary>
@@ -543,9 +1121,10 @@ namespace Godot
/// <param name="a">One of the values.</param>
/// <param name="b">The other value.</param>
/// <returns>Whichever of the two values is higher.</returns>
- public static real_t Max(real_t a, real_t b)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Max(double a, double b)
{
- return a > b ? a : b;
+ return Math.Max(a, b);
}
/// <summary>
@@ -554,9 +1133,22 @@ namespace Godot
/// <param name="a">One of the values.</param>
/// <param name="b">The other value.</param>
/// <returns>Whichever of the two values is lower.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Min(int a, int b)
{
- return a < b ? a : b;
+ return Math.Min(a, b);
+ }
+
+ /// <summary>
+ /// Returns the minimum of two values.
+ /// </summary>
+ /// <param name="a">One of the values.</param>
+ /// <param name="b">The other value.</param>
+ /// <returns>Whichever of the two values is lower.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Min(float a, float b)
+ {
+ return Math.Min(a, b);
}
/// <summary>
@@ -565,9 +1157,27 @@ namespace Godot
/// <param name="a">One of the values.</param>
/// <param name="b">The other value.</param>
/// <returns>Whichever of the two values is lower.</returns>
- public static real_t Min(real_t a, real_t b)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Min(double a, double b)
+ {
+ return Math.Min(a, b);
+ }
+
+ /// <summary>
+ /// Moves <paramref name="from"/> toward <paramref name="to"/> by the <paramref name="delta"/> value.
+ ///
+ /// Use a negative <paramref name="delta"/> value to move away.
+ /// </summary>
+ /// <param name="from">The start value.</param>
+ /// <param name="to">The value to move towards.</param>
+ /// <param name="delta">The amount to move by.</param>
+ /// <returns>The value after moving.</returns>
+ public static float MoveToward(float from, float to, float delta)
{
- return a < b ? a : b;
+ if (Math.Abs(to - from) <= delta)
+ return to;
+
+ return from + (Math.Sign(to - from) * delta);
}
/// <summary>
@@ -579,12 +1189,12 @@ namespace Godot
/// <param name="to">The value to move towards.</param>
/// <param name="delta">The amount to move by.</param>
/// <returns>The value after moving.</returns>
- public static real_t MoveToward(real_t from, real_t to, real_t delta)
+ public static double MoveToward(double from, double to, double delta)
{
- if (Abs(to - from) <= delta)
+ if (Math.Abs(to - from) <= delta)
return to;
- return from + (Sign(to - from) * delta);
+ return from + (Math.Sign(to - from) * delta);
}
/// <summary>
@@ -626,9 +1236,25 @@ namespace Godot
/// <param name="a">The dividend, the primary input.</param>
/// <param name="b">The divisor. The output is on the range [0, <paramref name="b"/>).</param>
/// <returns>The resulting output.</returns>
- public static real_t PosMod(real_t a, real_t b)
+ public static float PosMod(float a, float b)
+ {
+ float c = a % b;
+ if ((c < 0 && b > 0) || (c > 0 && b < 0))
+ {
+ c += b;
+ }
+ return c;
+ }
+
+ /// <summary>
+ /// Performs a canonical Modulus operation, where the output is on the range [0, <paramref name="b"/>).
+ /// </summary>
+ /// <param name="a">The dividend, the primary input.</param>
+ /// <param name="b">The divisor. The output is on the range [0, <paramref name="b"/>).</param>
+ /// <returns>The resulting output.</returns>
+ public static double PosMod(double a, double b)
{
- real_t c = a % b;
+ double c = a % b;
if ((c < 0 && b > 0) || (c > 0 && b < 0))
{
c += b;
@@ -642,9 +1268,33 @@ namespace Godot
/// <param name="x">The base.</param>
/// <param name="y">The exponent.</param>
/// <returns><paramref name="x"/> raised to the power of <paramref name="y"/>.</returns>
- public static real_t Pow(real_t x, real_t y)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Pow(float x, float y)
+ {
+ return MathF.Pow(x, y);
+ }
+
+ /// <summary>
+ /// Returns the result of <paramref name="x"/> raised to the power of <paramref name="y"/>.
+ /// </summary>
+ /// <param name="x">The base.</param>
+ /// <param name="y">The exponent.</param>
+ /// <returns><paramref name="x"/> raised to the power of <paramref name="y"/>.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Pow(double x, double y)
+ {
+ return Math.Pow(x, y);
+ }
+
+ /// <summary>
+ /// Converts an angle expressed in radians to degrees.
+ /// </summary>
+ /// <param name="rad">An angle expressed in radians.</param>
+ /// <returns>The same angle expressed in degrees.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float RadToDeg(float rad)
{
- return (real_t)Math.Pow(x, y);
+ return rad * _radToDegConstF;
}
/// <summary>
@@ -652,9 +1302,25 @@ namespace Godot
/// </summary>
/// <param name="rad">An angle expressed in radians.</param>
/// <returns>The same angle expressed in degrees.</returns>
- public static real_t RadToDeg(real_t rad)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double RadToDeg(double rad)
+ {
+ return rad * _radToDegConstD;
+ }
+
+ /// <summary>
+ /// Maps a <paramref name="value"/> from [<paramref name="inFrom"/>, <paramref name="inTo"/>]
+ /// to [<paramref name="outFrom"/>, <paramref name="outTo"/>].
+ /// </summary>
+ /// <param name="value">The value to map.</param>
+ /// <param name="inFrom">The start value for the input interpolation.</param>
+ /// <param name="inTo">The destination value for the input interpolation.</param>
+ /// <param name="outFrom">The start value for the output interpolation.</param>
+ /// <param name="outTo">The destination value for the output interpolation.</param>
+ /// <returns>The resulting mapped value mapped.</returns>
+ public static float Remap(float value, float inFrom, float inTo, float outFrom, float outTo)
{
- return rad * _radToDegConst;
+ return Lerp(outFrom, outTo, InverseLerp(inFrom, inTo, value));
}
/// <summary>
@@ -667,7 +1333,7 @@ namespace Godot
/// <param name="outFrom">The start value for the output interpolation.</param>
/// <param name="outTo">The destination value for the output interpolation.</param>
/// <returns>The resulting mapped value mapped.</returns>
- public static real_t Remap(real_t value, real_t inFrom, real_t inTo, real_t outFrom, real_t outTo)
+ public static double Remap(double value, double inFrom, double inTo, double outFrom, double outTo)
{
return Lerp(outFrom, outTo, InverseLerp(inFrom, inTo, value));
}
@@ -678,9 +1344,22 @@ namespace Godot
/// </summary>
/// <param name="s">The number to round.</param>
/// <returns>The rounded number.</returns>
- public static real_t Round(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Round(float s)
+ {
+ return MathF.Round(s);
+ }
+
+ /// <summary>
+ /// Rounds <paramref name="s"/> to the nearest whole number,
+ /// with halfway cases rounded towards the nearest multiple of two.
+ /// </summary>
+ /// <param name="s">The number to round.</param>
+ /// <returns>The rounded number.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Round(double s)
{
- return (real_t)Math.Round(s);
+ return Math.Round(s);
}
/// <summary>
@@ -689,11 +1368,22 @@ namespace Godot
/// </summary>
/// <param name="s">The input number.</param>
/// <returns>One of three possible values: <c>1</c>, <c>-1</c>, or <c>0</c>.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Sign(int s)
{
- if (s == 0)
- return 0;
- return s < 0 ? -1 : 1;
+ return Math.Sign(s);
+ }
+
+ /// <summary>
+ /// Returns the sign of <paramref name="s"/>: <c>-1</c> or <c>1</c>.
+ /// Returns <c>0</c> if <paramref name="s"/> is <c>0</c>.
+ /// </summary>
+ /// <param name="s">The input number.</param>
+ /// <returns>One of three possible values: <c>1</c>, <c>-1</c>, or <c>0</c>.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static int Sign(float s)
+ {
+ return Math.Sign(s);
}
/// <summary>
@@ -702,11 +1392,21 @@ namespace Godot
/// </summary>
/// <param name="s">The input number.</param>
/// <returns>One of three possible values: <c>1</c>, <c>-1</c>, or <c>0</c>.</returns>
- public static int Sign(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static int Sign(double s)
+ {
+ return Math.Sign(s);
+ }
+
+ /// <summary>
+ /// Returns the sine of angle <paramref name="s"/> in radians.
+ /// </summary>
+ /// <param name="s">The angle in radians.</param>
+ /// <returns>The sine of that angle.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Sin(float s)
{
- if (s == 0)
- return 0;
- return s < 0 ? -1 : 1;
+ return MathF.Sin(s);
}
/// <summary>
@@ -714,9 +1414,21 @@ namespace Godot
/// </summary>
/// <param name="s">The angle in radians.</param>
/// <returns>The sine of that angle.</returns>
- public static real_t Sin(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Sin(double s)
+ {
+ return Math.Sin(s);
+ }
+
+ /// <summary>
+ /// Returns the hyperbolic sine of angle <paramref name="s"/> in radians.
+ /// </summary>
+ /// <param name="s">The angle in radians.</param>
+ /// <returns>The hyperbolic sine of that angle.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Sinh(float s)
{
- return (real_t)Math.Sin(s);
+ return MathF.Sinh(s);
}
/// <summary>
@@ -724,27 +1436,47 @@ namespace Godot
/// </summary>
/// <param name="s">The angle in radians.</param>
/// <returns>The hyperbolic sine of that angle.</returns>
- public static real_t Sinh(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Sinh(double s)
+ {
+ return Math.Sinh(s);
+ }
+
+ /// <summary>
+ /// Returns a number smoothly interpolated between <paramref name="from"/> and <paramref name="to"/>,
+ /// based on the <paramref name="weight"/>. Similar to <see cref="Lerp(float, float, float)"/>,
+ /// but interpolates faster at the beginning and slower at the end.
+ /// </summary>
+ /// <param name="from">The start value for interpolation.</param>
+ /// <param name="to">The destination value for interpolation.</param>
+ /// <param name="weight">A value representing the amount of interpolation.</param>
+ /// <returns>The resulting value of the interpolation.</returns>
+ public static float SmoothStep(float from, float to, float weight)
{
- return (real_t)Math.Sinh(s);
+ if (IsEqualApprox(from, to))
+ {
+ return from;
+ }
+ float x = Math.Clamp((weight - from) / (to - from), 0.0f, 1.0f);
+ return x * x * (3 - (2 * x));
}
/// <summary>
/// Returns a number smoothly interpolated between <paramref name="from"/> and <paramref name="to"/>,
- /// based on the <paramref name="weight"/>. Similar to <see cref="Lerp(real_t, real_t, real_t)"/>,
+ /// based on the <paramref name="weight"/>. Similar to <see cref="Lerp(double, double, double)"/>,
/// but interpolates faster at the beginning and slower at the end.
/// </summary>
/// <param name="from">The start value for interpolation.</param>
/// <param name="to">The destination value for interpolation.</param>
/// <param name="weight">A value representing the amount of interpolation.</param>
/// <returns>The resulting value of the interpolation.</returns>
- public static real_t SmoothStep(real_t from, real_t to, real_t weight)
+ public static double SmoothStep(double from, double to, double weight)
{
if (IsEqualApprox(from, to))
{
return from;
}
- real_t x = Clamp((weight - from) / (to - from), (real_t)0.0, (real_t)1.0);
+ double x = Math.Clamp((weight - from) / (to - from), 0.0, 1.0);
return x * x * (3 - (2 * x));
}
@@ -755,9 +1487,23 @@ namespace Godot
/// </summary>
/// <param name="s">The input number. Must not be negative.</param>
/// <returns>The square root of <paramref name="s"/>.</returns>
- public static real_t Sqrt(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Sqrt(float s)
+ {
+ return MathF.Sqrt(s);
+ }
+
+ /// <summary>
+ /// Returns the square root of <paramref name="s"/>, where <paramref name="s"/> is a non-negative number.
+ ///
+ /// If you need negative inputs, use <see cref="System.Numerics.Complex"/>.
+ /// </summary>
+ /// <param name="s">The input number. Must not be negative.</param>
+ /// <returns>The square root of <paramref name="s"/>.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Sqrt(double s)
{
- return (real_t)Math.Sqrt(s);
+ return Math.Sqrt(s);
}
/// <summary>
@@ -767,7 +1513,7 @@ namespace Godot
/// </summary>
/// <param name="step">The input value.</param>
/// <returns>The position of the first non-zero digit.</returns>
- public static int StepDecimals(real_t step)
+ public static int StepDecimals(double step)
{
double[] sd = new double[]
{
@@ -781,7 +1527,7 @@ namespace Godot
0.00000009999,
0.000000009999,
};
- double abs = Abs(step);
+ double abs = Math.Abs(step);
double decs = abs - (int)abs; // Strip away integer part
for (int i = 0; i < sd.Length; i++)
{
@@ -800,11 +1546,28 @@ namespace Godot
/// <param name="s">The value to snap.</param>
/// <param name="step">The step size to snap to.</param>
/// <returns>The snapped value.</returns>
- public static real_t Snapped(real_t s, real_t step)
+ public static float Snapped(float s, float step)
+ {
+ if (step != 0f)
+ {
+ return MathF.Floor((s / step) + 0.5f) * step;
+ }
+
+ return s;
+ }
+
+ /// <summary>
+ /// Snaps float value <paramref name="s"/> to a given <paramref name="step"/>.
+ /// This can also be used to round a floating point number to an arbitrary number of decimals.
+ /// </summary>
+ /// <param name="s">The value to snap.</param>
+ /// <param name="step">The step size to snap to.</param>
+ /// <returns>The snapped value.</returns>
+ public static double Snapped(double s, double step)
{
if (step != 0f)
{
- return Floor((s / step) + 0.5f) * step;
+ return Math.Floor((s / step) + 0.5f) * step;
}
return s;
@@ -815,9 +1578,32 @@ namespace Godot
/// </summary>
/// <param name="s">The angle in radians.</param>
/// <returns>The tangent of that angle.</returns>
- public static real_t Tan(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Tan(float s)
+ {
+ return MathF.Tan(s);
+ }
+
+ /// <summary>
+ /// Returns the tangent of angle <paramref name="s"/> in radians.
+ /// </summary>
+ /// <param name="s">The angle in radians.</param>
+ /// <returns>The tangent of that angle.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Tan(double s)
+ {
+ return Math.Tan(s);
+ }
+
+ /// <summary>
+ /// Returns the hyperbolic tangent of angle <paramref name="s"/> in radians.
+ /// </summary>
+ /// <param name="s">The angle in radians.</param>
+ /// <returns>The hyperbolic tangent of that angle.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static float Tanh(float s)
{
- return (real_t)Math.Tan(s);
+ return MathF.Tanh(s);
}
/// <summary>
@@ -825,9 +1611,10 @@ namespace Godot
/// </summary>
/// <param name="s">The angle in radians.</param>
/// <returns>The hyperbolic tangent of that angle.</returns>
- public static real_t Tanh(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static double Tanh(double s)
{
- return (real_t)Math.Tanh(s);
+ return Math.Tanh(s);
}
/// <summary>
@@ -853,15 +1640,35 @@ namespace Godot
/// Wraps <paramref name="value"/> between <paramref name="min"/> and <paramref name="max"/>.
/// Usable for creating loop-alike behavior or infinite surfaces.
/// If <paramref name="min"/> is <c>0</c>, this is equivalent
- /// to <see cref="PosMod(real_t, real_t)"/>, so prefer using that instead.
+ /// to <see cref="PosMod(float, float)"/>, so prefer using that instead.
+ /// </summary>
+ /// <param name="value">The value to wrap.</param>
+ /// <param name="min">The minimum allowed value and lower bound of the range.</param>
+ /// <param name="max">The maximum allowed value and upper bound of the range.</param>
+ /// <returns>The wrapped value.</returns>
+ public static float Wrap(float value, float min, float max)
+ {
+ float range = max - min;
+ if (IsZeroApprox(range))
+ {
+ return min;
+ }
+ return min + ((((value - min) % range) + range) % range);
+ }
+
+ /// <summary>
+ /// Wraps <paramref name="value"/> between <paramref name="min"/> and <paramref name="max"/>.
+ /// Usable for creating loop-alike behavior or infinite surfaces.
+ /// If <paramref name="min"/> is <c>0</c>, this is equivalent
+ /// to <see cref="PosMod(double, double)"/>, so prefer using that instead.
/// </summary>
/// <param name="value">The value to wrap.</param>
/// <param name="min">The minimum allowed value and lower bound of the range.</param>
/// <param name="max">The maximum allowed value and upper bound of the range.</param>
/// <returns>The wrapped value.</returns>
- public static real_t Wrap(real_t value, real_t min, real_t max)
+ public static double Wrap(double value, double min, double max)
{
- real_t range = max - min;
+ double range = max - min;
if (IsZeroApprox(range))
{
return min;
@@ -869,9 +1676,23 @@ namespace Godot
return min + ((((value - min) % range) + range) % range);
}
- private static real_t Fract(real_t value)
+ /// <summary>
+ /// Returns the <paramref name="value"/> wrapped between <c>0</c> and the <paramref name="length"/>.
+ /// If the limit is reached, the next value the function returned is decreased to the <c>0</c> side
+ /// or increased to the <paramref name="length"/> side (like a triangle wave).
+ /// If <paramref name="length"/> is less than zero, it becomes positive.
+ /// </summary>
+ /// <param name="value">The value to pingpong.</param>
+ /// <param name="length">The maximum value of the function.</param>
+ /// <returns>The ping-ponged value.</returns>
+ public static float PingPong(float value, float length)
{
- return value - (real_t)Math.Floor(value);
+ return (length != 0.0f) ? Math.Abs(Fract((value - length) / (length * 2.0f)) * length * 2.0f - length) : 0.0f;
+
+ static float Fract(float value)
+ {
+ return value - MathF.Floor(value);
+ }
}
/// <summary>
@@ -883,9 +1704,14 @@ namespace Godot
/// <param name="value">The value to pingpong.</param>
/// <param name="length">The maximum value of the function.</param>
/// <returns>The ping-ponged value.</returns>
- public static real_t PingPong(real_t value, real_t length)
+ public static double PingPong(double value, double length)
{
- return (length != (real_t)0.0) ? Abs(Fract((value - length) / (length * (real_t)2.0)) * length * (real_t)2.0 - length) : (real_t)0.0;
+ return (length != 0.0) ? Math.Abs(Fract((value - length) / (length * 2.0)) * length * 2.0 - length) : 0.0;
+
+ static double Fract(double value)
+ {
+ return value - Math.Floor(value);
+ }
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs
index 72a1868964..cc2d61f58d 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs
@@ -1,4 +1,8 @@
using System;
+using System.Runtime.CompilerServices;
+
+// This file contains extra members for the Mathf class that aren't part of Godot's Core API.
+// Math API that is also part of Core should go into Mathf.cs.
namespace Godot
{
@@ -16,14 +20,18 @@ namespace Godot
/// </summary>
public const real_t Sqrt2 = (real_t)1.4142135623730950488016887242M; // 1.4142136f and 1.414213562373095
+ // Epsilon size should depend on the precision used.
+ private const float _epsilonF = 1e-06f;
+ private const double _epsilonD = 1e-14;
+
/// <summary>
/// A very small number used for float comparison with error tolerance.
/// 1e-06 with single-precision floats, but 1e-14 if <c>REAL_T_IS_DOUBLE</c>.
/// </summary>
#if REAL_T_IS_DOUBLE
- public const real_t Epsilon = 1e-14; // Epsilon size should depend on the precision used.
+ public const real_t Epsilon = _epsilonD;
#else
- public const real_t Epsilon = 1e-06f;
+ public const real_t Epsilon = _epsilonF;
#endif
/// <summary>
@@ -31,7 +39,8 @@ namespace Godot
/// </summary>
/// <param name="s">The input value.</param>
/// <returns>The amount of digits.</returns>
- public static int DecimalCount(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static int DecimalCount(double s)
{
return DecimalCount((decimal)s);
}
@@ -41,6 +50,7 @@ namespace Godot
/// </summary>
/// <param name="s">The input <see langword="decimal"/> value.</param>
/// <returns>The amount of digits.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int DecimalCount(decimal s)
{
return BitConverter.GetBytes(decimal.GetBits(s)[3])[2];
@@ -49,11 +59,25 @@ namespace Godot
/// <summary>
/// Rounds <paramref name="s"/> upward (towards positive infinity).
///
- /// This is the same as <see cref="Ceil(real_t)"/>, but returns an <see langword="int"/>.
+ /// This is the same as <see cref="Ceil(float)"/>, but returns an <see langword="int"/>.
+ /// </summary>
+ /// <param name="s">The number to ceil.</param>
+ /// <returns>The smallest whole number that is not less than <paramref name="s"/>.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static int CeilToInt(float s)
+ {
+ return (int)MathF.Ceiling(s);
+ }
+
+ /// <summary>
+ /// Rounds <paramref name="s"/> upward (towards positive infinity).
+ ///
+ /// This is the same as <see cref="Ceil(double)"/>, but returns an <see langword="int"/>.
/// </summary>
/// <param name="s">The number to ceil.</param>
/// <returns>The smallest whole number that is not less than <paramref name="s"/>.</returns>
- public static int CeilToInt(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static int CeilToInt(double s)
{
return (int)Math.Ceiling(s);
}
@@ -61,11 +85,25 @@ namespace Godot
/// <summary>
/// Rounds <paramref name="s"/> downward (towards negative infinity).
///
- /// This is the same as <see cref="Floor(real_t)"/>, but returns an <see langword="int"/>.
+ /// This is the same as <see cref="Floor(float)"/>, but returns an <see langword="int"/>.
+ /// </summary>
+ /// <param name="s">The number to floor.</param>
+ /// <returns>The largest whole number that is not more than <paramref name="s"/>.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static int FloorToInt(float s)
+ {
+ return (int)MathF.Floor(s);
+ }
+
+ /// <summary>
+ /// Rounds <paramref name="s"/> downward (towards negative infinity).
+ ///
+ /// This is the same as <see cref="Floor(double)"/>, but returns an <see langword="int"/>.
/// </summary>
/// <param name="s">The number to floor.</param>
/// <returns>The largest whole number that is not more than <paramref name="s"/>.</returns>
- public static int FloorToInt(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static int FloorToInt(double s)
{
return (int)Math.Floor(s);
}
@@ -73,11 +111,25 @@ namespace Godot
/// <summary>
/// Rounds <paramref name="s"/> to the nearest whole number.
///
- /// This is the same as <see cref="Round(real_t)"/>, but returns an <see langword="int"/>.
+ /// This is the same as <see cref="Round(float)"/>, but returns an <see langword="int"/>.
/// </summary>
/// <param name="s">The number to round.</param>
/// <returns>The rounded number.</returns>
- public static int RoundToInt(real_t s)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static int RoundToInt(float s)
+ {
+ return (int)MathF.Round(s);
+ }
+
+ /// <summary>
+ /// Rounds <paramref name="s"/> to the nearest whole number.
+ ///
+ /// This is the same as <see cref="Round(double)"/>, but returns an <see langword="int"/>.
+ /// </summary>
+ /// <param name="s">The number to round.</param>
+ /// <returns>The rounded number.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static int RoundToInt(double s)
{
return (int)Math.Round(s);
}
@@ -87,23 +139,53 @@ namespace Godot
/// </summary>
/// <param name="s">The angle in radians.</param>
/// <returns>The sine and cosine of that angle.</returns>
- public static (real_t Sin, real_t Cos) SinCos(real_t s)
+ public static (float Sin, float Cos) SinCos(float s)
+ {
+ return MathF.SinCos(s);
+ }
+
+ /// <summary>
+ /// Returns the sine and cosine of angle <paramref name="s"/> in radians.
+ /// </summary>
+ /// <param name="s">The angle in radians.</param>
+ /// <returns>The sine and cosine of that angle.</returns>
+ public static (double Sin, double Cos) SinCos(double s)
{
- (double sin, double cos) = Math.SinCos(s);
- return ((real_t)sin, (real_t)cos);
+ return Math.SinCos(s);
+ }
+
+ /// <summary>
+ /// Returns <see langword="true"/> if <paramref name="a"/> and <paramref name="b"/> are approximately
+ /// equal to each other.
+ /// The comparison is done using the provided tolerance value.
+ /// If you want the tolerance to be calculated for you, use <see cref="IsEqualApprox(float, float)"/>.
+ /// </summary>
+ /// <param name="a">One of the values.</param>
+ /// <param name="b">The other value.</param>
+ /// <param name="tolerance">The pre-calculated tolerance value.</param>
+ /// <returns>A <see langword="bool"/> for whether or not the two values are equal.</returns>
+ public static bool IsEqualApprox(float a, float b, float tolerance)
+ {
+ // Check for exact equality first, required to handle "infinity" values.
+ if (a == b)
+ {
+ return true;
+ }
+ // Then check for approximate equality.
+ return Math.Abs(a - b) < tolerance;
}
/// <summary>
/// Returns <see langword="true"/> if <paramref name="a"/> and <paramref name="b"/> are approximately
/// equal to each other.
/// The comparison is done using the provided tolerance value.
- /// If you want the tolerance to be calculated for you, use <see cref="IsEqualApprox(real_t, real_t)"/>.
+ /// If you want the tolerance to be calculated for you, use <see cref="IsEqualApprox(double, double)"/>.
/// </summary>
/// <param name="a">One of the values.</param>
/// <param name="b">The other value.</param>
/// <param name="tolerance">The pre-calculated tolerance value.</param>
/// <returns>A <see langword="bool"/> for whether or not the two values are equal.</returns>
- public static bool IsEqualApprox(real_t a, real_t b, real_t tolerance)
+ public static bool IsEqualApprox(double a, double b, double tolerance)
{
// Check for exact equality first, required to handle "infinity" values.
if (a == b)
@@ -111,7 +193,7 @@ namespace Godot
return true;
}
// Then check for approximate equality.
- return Abs(a - b) < tolerance;
+ return Math.Abs(a - b) < tolerance;
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs
index 5a0ea2ba13..71a2adadcb 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs
@@ -68,7 +68,7 @@ namespace Godot.NativeInterop
string file = globalFrames.Count > 0 ? globalFrames[0].File ?? "" : "";
string func = globalFrames.Count > 0 ? globalFrames[0].Func : "";
int line = globalFrames.Count > 0 ? globalFrames[0].Line : 0;
- string errorMsg = "Exception";
+ string errorMsg = e.GetType().FullName ?? "";
using godot_string nFile = Marshaling.ConvertStringToNative(file);
using godot_string nFunc = Marshaling.ConvertStringToNative(func);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropStructs.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropStructs.cs
index fa79c2efbc..43e7c7eb9a 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropStructs.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropStructs.cs
@@ -104,7 +104,7 @@ namespace Godot.NativeInterop
}
}
- [StructLayout(LayoutKind.Explicit)]
+ [StructLayout(LayoutKind.Sequential, Pack = 8)]
// ReSharper disable once InconsistentNaming
public ref struct godot_variant
{
@@ -113,11 +113,11 @@ namespace Godot.NativeInterop
=> (godot_variant*)Unsafe.AsPointer(ref Unsafe.AsRef(in _typeField));
// Variant.Type is generated as an enum of type long, so we can't use for the field as it must only take 32-bits.
- [FieldOffset(0)] private int _typeField;
+ private int _typeField;
// There's padding here
- [FieldOffset(8)] private godot_variant_data _data;
+ private godot_variant_data _data;
[StructLayout(LayoutKind.Explicit)]
// ReSharper disable once InconsistentNaming
@@ -126,10 +126,10 @@ namespace Godot.NativeInterop
[FieldOffset(0)] public godot_bool _bool;
[FieldOffset(0)] public long _int;
[FieldOffset(0)] public double _float;
- [FieldOffset(0)] public Transform2D* _transform2D;
- [FieldOffset(0)] public AABB* _aabb;
+ [FieldOffset(0)] public Transform2D* _transform2d;
+ [FieldOffset(0)] public Aabb* _aabb;
[FieldOffset(0)] public Basis* _basis;
- [FieldOffset(0)] public Transform3D* _transform3D;
+ [FieldOffset(0)] public Transform3D* _transform3d;
[FieldOffset(0)] public Projection* _projection;
[FieldOffset(0)] private godot_variant_data_mem _mem;
@@ -137,18 +137,18 @@ namespace Godot.NativeInterop
[FieldOffset(0)] public godot_string_name _m_string_name;
[FieldOffset(0)] public godot_string _m_string;
[FieldOffset(0)] public Vector4 _m_vector4;
- [FieldOffset(0)] public Vector4i _m_vector4i;
+ [FieldOffset(0)] public Vector4I _m_vector4i;
[FieldOffset(0)] public Vector3 _m_vector3;
- [FieldOffset(0)] public Vector3i _m_vector3i;
+ [FieldOffset(0)] public Vector3I _m_vector3i;
[FieldOffset(0)] public Vector2 _m_vector2;
- [FieldOffset(0)] public Vector2i _m_vector2i;
+ [FieldOffset(0)] public Vector2I _m_vector2i;
[FieldOffset(0)] public Rect2 _m_rect2;
- [FieldOffset(0)] public Rect2i _m_rect2i;
+ [FieldOffset(0)] public Rect2I _m_rect2i;
[FieldOffset(0)] public Plane _m_plane;
[FieldOffset(0)] public Quaternion _m_quaternion;
[FieldOffset(0)] public Color _m_color;
[FieldOffset(0)] public godot_node_path _m_node_path;
- [FieldOffset(0)] public RID _m_rid;
+ [FieldOffset(0)] public Rid _m_rid;
[FieldOffset(0)] public godot_variant_obj_data _m_obj_data;
[FieldOffset(0)] public godot_callable _m_callable;
[FieldOffset(0)] public godot_signal _m_signal;
@@ -211,10 +211,10 @@ namespace Godot.NativeInterop
public readonly unsafe Transform2D* Transform2D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get => _data._transform2D;
+ get => _data._transform2d;
}
- public readonly unsafe AABB* AABB
+ public readonly unsafe Aabb* Aabb
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _data._aabb;
@@ -229,7 +229,7 @@ namespace Godot.NativeInterop
public readonly unsafe Transform3D* Transform3D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get => _data._transform3D;
+ get => _data._transform3d;
}
public readonly unsafe Projection* Projection
@@ -262,7 +262,7 @@ namespace Godot.NativeInterop
set => _data._m_vector4 = value;
}
- public Vector4i Vector4i
+ public Vector4I Vector4I
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
readonly get => _data._m_vector4i;
@@ -278,7 +278,7 @@ namespace Godot.NativeInterop
set => _data._m_vector3 = value;
}
- public Vector3i Vector3i
+ public Vector3I Vector3I
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
readonly get => _data._m_vector3i;
@@ -294,7 +294,7 @@ namespace Godot.NativeInterop
set => _data._m_vector2 = value;
}
- public Vector2i Vector2i
+ public Vector2I Vector2I
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
readonly get => _data._m_vector2i;
@@ -310,7 +310,7 @@ namespace Godot.NativeInterop
set => _data._m_rect2 = value;
}
- public Rect2i Rect2i
+ public Rect2I Rect2I
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
readonly get => _data._m_rect2i;
@@ -350,7 +350,7 @@ namespace Godot.NativeInterop
set => _data._m_node_path = value;
}
- public RID RID
+ public Rid Rid
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
readonly get => _data._m_rid;
@@ -405,13 +405,13 @@ namespace Godot.NativeInterop
case Variant.Type.Int:
case Variant.Type.Float:
case Variant.Type.Vector2:
- case Variant.Type.Vector2i:
+ case Variant.Type.Vector2I:
case Variant.Type.Rect2:
- case Variant.Type.Rect2i:
+ case Variant.Type.Rect2I:
case Variant.Type.Vector3:
- case Variant.Type.Vector3i:
+ case Variant.Type.Vector3I:
case Variant.Type.Vector4:
- case Variant.Type.Vector4i:
+ case Variant.Type.Vector4I:
case Variant.Type.Plane:
case Variant.Type.Quaternion:
case Variant.Type.Color:
@@ -697,6 +697,9 @@ namespace Godot.NativeInterop
private uint _safeRefCount;
public VariantVector _arrayVector;
+
+ private unsafe godot_variant* _readOnly;
+
// There are more fields here, but we don't care as we never store this in C#
public readonly int Size
@@ -704,6 +707,12 @@ namespace Godot.NativeInterop
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _arrayVector.Size;
}
+
+ public readonly unsafe bool IsReadOnly
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => _readOnly != null;
+ }
}
[StructLayout(LayoutKind.Sequential)]
@@ -737,6 +746,12 @@ namespace Godot.NativeInterop
get => _p != null ? _p->Size : 0;
}
+ public readonly unsafe bool IsReadOnly
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => _p != null && _p->IsReadOnly;
+ }
+
public unsafe void Dispose()
{
if (_p == null)
@@ -766,35 +781,59 @@ namespace Godot.NativeInterop
// A correctly constructed value needs to call the native default constructor to allocate `_p`.
// Don't pass a C# default constructed `godot_dictionary` to native code, unless it's going to
// be re-assigned a new value (the copy constructor checks if `_p` is null so that's fine).
- [StructLayout(LayoutKind.Sequential)]
+ [StructLayout(LayoutKind.Explicit)]
// ReSharper disable once InconsistentNaming
public ref struct godot_dictionary
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal readonly unsafe godot_dictionary* GetUnsafeAddress()
- => (godot_dictionary*)Unsafe.AsPointer(ref Unsafe.AsRef(in _p));
+ => (godot_dictionary*)Unsafe.AsPointer(ref Unsafe.AsRef(in _getUnsafeAddressHelper));
- private IntPtr _p;
+ [FieldOffset(0)] private byte _getUnsafeAddressHelper;
- public readonly bool IsAllocated
+ [FieldOffset(0)] private unsafe DictionaryPrivate* _p;
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct DictionaryPrivate
+ {
+ private uint _safeRefCount;
+
+ private unsafe godot_variant* _readOnly;
+
+ // There are more fields here, but we don't care as we never store this in C#
+
+ public readonly unsafe bool IsReadOnly
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => _readOnly != null;
+ }
+ }
+
+ public readonly unsafe bool IsAllocated
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get => _p != IntPtr.Zero;
+ get => _p != null;
}
- public void Dispose()
+ public readonly unsafe bool IsReadOnly
{
- if (_p == IntPtr.Zero)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => _p != null && _p->IsReadOnly;
+ }
+
+ public unsafe void Dispose()
+ {
+ if (_p == null)
return;
NativeFuncs.godotsharp_dictionary_destroy(ref this);
- _p = IntPtr.Zero;
+ _p = null;
}
[StructLayout(LayoutKind.Sequential)]
// ReSharper disable once InconsistentNaming
internal struct movable
{
- private IntPtr _p;
+ private unsafe DictionaryPrivate* _p;
public static unsafe explicit operator movable(in godot_dictionary value)
=> *(movable*)CustomUnsafe.AsPointer(ref CustomUnsafe.AsRef(value));
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropUtils.cs
index 82f1c04d40..cc308bfdb3 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropUtils.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/InteropUtils.cs
@@ -8,7 +8,7 @@ namespace Godot.NativeInterop
{
internal static class InteropUtils
{
- public static Object UnmanagedGetManaged(IntPtr unmanaged)
+ public static GodotObject UnmanagedGetManaged(IntPtr unmanaged)
{
// The native pointer may be null
if (unmanaged == IntPtr.Zero)
@@ -23,7 +23,7 @@ namespace Godot.NativeInterop
unmanaged, out hasCsScriptInstance);
if (gcHandlePtr != IntPtr.Zero)
- return (Object)GCHandle.FromIntPtr(gcHandlePtr).Target;
+ return (GodotObject)GCHandle.FromIntPtr(gcHandlePtr).Target;
// Otherwise, if the object has a CSharpInstance script instance, return null
@@ -37,17 +37,17 @@ namespace Godot.NativeInterop
object target = gcHandlePtr != IntPtr.Zero ? GCHandle.FromIntPtr(gcHandlePtr).Target : null;
if (target != null)
- return (Object)target;
+ return (GodotObject)target;
// If the native instance binding GC handle target was collected, create a new one
gcHandlePtr = NativeFuncs.godotsharp_internal_unmanaged_instance_binding_create_managed(
unmanaged, gcHandlePtr);
- return gcHandlePtr != IntPtr.Zero ? (Object)GCHandle.FromIntPtr(gcHandlePtr).Target : null;
+ return gcHandlePtr != IntPtr.Zero ? (GodotObject)GCHandle.FromIntPtr(gcHandlePtr).Target : null;
}
- public static void TieManagedToUnmanaged(Object managed, IntPtr unmanaged,
+ public static void TieManagedToUnmanaged(GodotObject managed, IntPtr unmanaged,
StringName nativeName, bool refCounted, Type type, Type nativeType)
{
var gcHandle = refCounted ?
@@ -76,7 +76,7 @@ namespace Godot.NativeInterop
}
}
- public static void TieManagedToUnmanagedWithPreSetup(Object managed, IntPtr unmanaged,
+ public static void TieManagedToUnmanagedWithPreSetup(GodotObject managed, IntPtr unmanaged,
Type type, Type nativeType)
{
if (type == nativeType)
@@ -87,7 +87,7 @@ namespace Godot.NativeInterop
GCHandle.ToIntPtr(strongGCHandle), unmanaged);
}
- public static Object EngineGetSingleton(string name)
+ public static GodotObject EngineGetSingleton(string name)
{
using godot_string src = Marshaling.ConvertStringToNative(name);
return UnmanagedGetManaged(NativeFuncs.godotsharp_engine_get_singleton(src));
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs
index 0d9a698af0..93a83b701b 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs
@@ -51,29 +51,29 @@ namespace Godot.NativeInterop
if (type == typeof(Vector2))
return Variant.Type.Vector2;
- if (type == typeof(Vector2i))
- return Variant.Type.Vector2i;
+ if (type == typeof(Vector2I))
+ return Variant.Type.Vector2I;
if (type == typeof(Rect2))
return Variant.Type.Rect2;
- if (type == typeof(Rect2i))
- return Variant.Type.Rect2i;
+ if (type == typeof(Rect2I))
+ return Variant.Type.Rect2I;
if (type == typeof(Transform2D))
- return Variant.Type.Transform2d;
+ return Variant.Type.Transform2D;
if (type == typeof(Vector3))
return Variant.Type.Vector3;
- if (type == typeof(Vector3i))
- return Variant.Type.Vector3i;
+ if (type == typeof(Vector3I))
+ return Variant.Type.Vector3I;
if (type == typeof(Vector4))
return Variant.Type.Vector4;
- if (type == typeof(Vector4i))
- return Variant.Type.Vector4i;
+ if (type == typeof(Vector4I))
+ return Variant.Type.Vector4I;
if (type == typeof(Basis))
return Variant.Type.Basis;
@@ -82,12 +82,12 @@ namespace Godot.NativeInterop
return Variant.Type.Quaternion;
if (type == typeof(Transform3D))
- return Variant.Type.Transform3d;
+ return Variant.Type.Transform3D;
if (type == typeof(Projection))
return Variant.Type.Projection;
- if (type == typeof(AABB))
+ if (type == typeof(Aabb))
return Variant.Type.Aabb;
if (type == typeof(Color))
@@ -140,15 +140,15 @@ namespace Godot.NativeInterop
if (type == typeof(NodePath[]))
return Variant.Type.Array;
- if (type == typeof(RID[]))
+ if (type == typeof(Rid[]))
return Variant.Type.Array;
- if (typeof(Godot.Object[]).IsAssignableFrom(type))
+ if (typeof(GodotObject[]).IsAssignableFrom(type))
return Variant.Type.Array;
}
else if (type.IsGenericType)
{
- if (typeof(Godot.Object).IsAssignableFrom(type))
+ if (typeof(GodotObject).IsAssignableFrom(type))
return Variant.Type.Object;
// We use `IsAssignableFrom` with our helper interfaces to detect generic Godot collections
@@ -167,7 +167,7 @@ namespace Godot.NativeInterop
}
else
{
- if (typeof(Godot.Object).IsAssignableFrom(type))
+ if (typeof(GodotObject).IsAssignableFrom(type))
return Variant.Type.Object;
if (typeof(StringName) == type)
@@ -176,7 +176,7 @@ namespace Godot.NativeInterop
if (typeof(NodePath) == type)
return Variant.Type.NodePath;
- if (typeof(RID) == type)
+ if (typeof(Rid) == type)
return Variant.Type.Rid;
if (typeof(Collections.Dictionary) == type)
@@ -232,7 +232,7 @@ namespace Godot.NativeInterop
var gcHandle = CustomGCHandle.AllocStrong(p_managed_callable.Delegate);
IntPtr objectPtr = p_managed_callable.Target != null ?
- Object.GetPtr(p_managed_callable.Target) :
+ GodotObject.GetPtr(p_managed_callable.Target) :
IntPtr.Zero;
unsafe
@@ -310,7 +310,7 @@ namespace Godot.NativeInterop
public static Signal ConvertSignalToManaged(in godot_signal p_signal)
{
- var owner = GD.InstanceFromId(p_signal.ObjectId);
+ var owner = GodotObject.InstanceFromId(p_signal.ObjectId);
var name = StringName.CreateTakingOwnershipOfDisposableValue(
NativeFuncs.godotsharp_string_name_new_copy(p_signal.Name));
return new Signal(owner, name);
@@ -319,7 +319,7 @@ namespace Godot.NativeInterop
// Array
internal static T[] ConvertNativeGodotArrayToSystemArrayOfGodotObjectType<T>(in godot_array p_array)
- where T : Godot.Object
+ where T : GodotObject
{
var array = Collections.Array.CreateTakingOwnershipOfDisposableValue(
NativeFuncs.godotsharp_array_new_copy(p_array));
@@ -361,16 +361,16 @@ namespace Godot.NativeInterop
return ret;
}
- internal static RID[] ConvertNativeGodotArrayToSystemArrayOfRID(in godot_array p_array)
+ internal static Rid[] ConvertNativeGodotArrayToSystemArrayOfRid(in godot_array p_array)
{
var array = Collections.Array.CreateTakingOwnershipOfDisposableValue(
NativeFuncs.godotsharp_array_new_copy(p_array));
int length = array.Count;
- var ret = new RID[length];
+ var ret = new Rid[length];
for (int i = 0; i < length; i++)
- ret[i] = array[i].AsRID();
+ ret[i] = array[i].AsRid();
return ret;
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs
index 57488bd586..1e23689c95 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs
@@ -184,7 +184,7 @@ namespace Godot.NativeInterop
public static partial void godotsharp_variant_new_projection(out godot_variant r_dest, in Projection p_proj);
- public static partial void godotsharp_variant_new_aabb(out godot_variant r_dest, in AABB p_aabb);
+ public static partial void godotsharp_variant_new_aabb(out godot_variant r_dest, in Aabb p_aabb);
public static partial void godotsharp_variant_new_dictionary(out godot_variant r_dest,
in godot_dictionary p_dict);
@@ -228,27 +228,27 @@ namespace Godot.NativeInterop
public static partial Vector2 godotsharp_variant_as_vector2(in godot_variant p_self);
- public static partial Vector2i godotsharp_variant_as_vector2i(in godot_variant p_self);
+ public static partial Vector2I godotsharp_variant_as_vector2i(in godot_variant p_self);
public static partial Rect2 godotsharp_variant_as_rect2(in godot_variant p_self);
- public static partial Rect2i godotsharp_variant_as_rect2i(in godot_variant p_self);
+ public static partial Rect2I godotsharp_variant_as_rect2i(in godot_variant p_self);
public static partial Vector3 godotsharp_variant_as_vector3(in godot_variant p_self);
- public static partial Vector3i godotsharp_variant_as_vector3i(in godot_variant p_self);
+ public static partial Vector3I godotsharp_variant_as_vector3i(in godot_variant p_self);
public static partial Transform2D godotsharp_variant_as_transform2d(in godot_variant p_self);
public static partial Vector4 godotsharp_variant_as_vector4(in godot_variant p_self);
- public static partial Vector4i godotsharp_variant_as_vector4i(in godot_variant p_self);
+ public static partial Vector4I godotsharp_variant_as_vector4i(in godot_variant p_self);
public static partial Plane godotsharp_variant_as_plane(in godot_variant p_self);
public static partial Quaternion godotsharp_variant_as_quaternion(in godot_variant p_self);
- public static partial AABB godotsharp_variant_as_aabb(in godot_variant p_self);
+ public static partial Aabb godotsharp_variant_as_aabb(in godot_variant p_self);
public static partial Basis godotsharp_variant_as_basis(in godot_variant p_self);
@@ -262,7 +262,7 @@ namespace Godot.NativeInterop
public static partial godot_node_path godotsharp_variant_as_node_path(in godot_variant p_self);
- public static partial RID godotsharp_variant_as_rid(in godot_variant p_self);
+ public static partial Rid godotsharp_variant_as_rid(in godot_variant p_self);
public static partial godot_callable godotsharp_variant_as_callable(in godot_variant p_self);
@@ -376,6 +376,8 @@ namespace Godot.NativeInterop
public static partial Error godotsharp_array_resize(ref godot_array p_self, int p_new_size);
+ public static partial void godotsharp_array_make_read_only(ref godot_array p_self);
+
public static partial void godotsharp_array_shuffle(ref godot_array p_self);
public static partial void godotsharp_array_to_string(ref godot_array p_self, out godot_string r_str);
@@ -409,9 +411,15 @@ namespace Godot.NativeInterop
public static partial void godotsharp_dictionary_duplicate(ref godot_dictionary p_self, godot_bool p_deep,
out godot_dictionary r_dest);
+ public static partial void godotsharp_dictionary_merge(ref godot_dictionary p_self, in godot_dictionary p_dictionary, godot_bool p_overwrite);
+
+ public static partial godot_bool godotsharp_dictionary_recursive_equal(ref godot_dictionary p_self, in godot_dictionary p_other);
+
public static partial godot_bool godotsharp_dictionary_remove_key(ref godot_dictionary p_self,
in godot_variant p_key);
+ public static partial void godotsharp_dictionary_make_read_only(ref godot_dictionary p_self);
+
public static partial void godotsharp_dictionary_to_string(ref godot_dictionary p_self, out godot_string r_str);
// StringExtensions
@@ -494,8 +502,6 @@ namespace Godot.NativeInterop
internal static partial void godotsharp_weakref(IntPtr p_obj, out godot_ref r_weak_ref);
- internal static partial void godotsharp_str(in godot_array p_what, out godot_string r_ret);
-
internal static partial void godotsharp_str_to_var(in godot_string p_str, out godot_variant r_ret);
internal static partial void godotsharp_var_to_bytes(in godot_variant p_what, godot_bool p_full_objects,
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.extended.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.extended.cs
index 9f0b55431b..44ec16dca9 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.extended.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.extended.cs
@@ -18,20 +18,20 @@ namespace Godot.NativeInterop
return new godot_variant() { Float = src.Float, Type = Variant.Type.Float };
case Variant.Type.Vector2:
return new godot_variant() { Vector2 = src.Vector2, Type = Variant.Type.Vector2 };
- case Variant.Type.Vector2i:
- return new godot_variant() { Vector2i = src.Vector2i, Type = Variant.Type.Vector2i };
+ case Variant.Type.Vector2I:
+ return new godot_variant() { Vector2I = src.Vector2I, Type = Variant.Type.Vector2I };
case Variant.Type.Rect2:
return new godot_variant() { Rect2 = src.Rect2, Type = Variant.Type.Rect2 };
- case Variant.Type.Rect2i:
- return new godot_variant() { Rect2i = src.Rect2i, Type = Variant.Type.Rect2i };
+ case Variant.Type.Rect2I:
+ return new godot_variant() { Rect2I = src.Rect2I, Type = Variant.Type.Rect2I };
case Variant.Type.Vector3:
return new godot_variant() { Vector3 = src.Vector3, Type = Variant.Type.Vector3 };
- case Variant.Type.Vector3i:
- return new godot_variant() { Vector3i = src.Vector3i, Type = Variant.Type.Vector3i };
+ case Variant.Type.Vector3I:
+ return new godot_variant() { Vector3I = src.Vector3I, Type = Variant.Type.Vector3I };
case Variant.Type.Vector4:
return new godot_variant() { Vector4 = src.Vector4, Type = Variant.Type.Vector4 };
- case Variant.Type.Vector4i:
- return new godot_variant() { Vector4i = src.Vector4i, Type = Variant.Type.Vector4i };
+ case Variant.Type.Vector4I:
+ return new godot_variant() { Vector4I = src.Vector4I, Type = Variant.Type.Vector4I };
case Variant.Type.Plane:
return new godot_variant() { Plane = src.Plane, Type = Variant.Type.Plane };
case Variant.Type.Quaternion:
@@ -39,7 +39,7 @@ namespace Godot.NativeInterop
case Variant.Type.Color:
return new godot_variant() { Color = src.Color, Type = Variant.Type.Color };
case Variant.Type.Rid:
- return new godot_variant() { RID = src.RID, Type = Variant.Type.Rid };
+ return new godot_variant() { Rid = src.Rid, Type = Variant.Type.Rid };
}
godotsharp_variant_new_copy(out godot_variant ret, src);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs
index 9c9258dd9e..e6bcd9393d 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs
@@ -10,8 +10,8 @@ namespace Godot.NativeInterop
{
public static partial class VariantUtils
{
- public static godot_variant CreateFromRID(RID from)
- => new() { Type = Variant.Type.Rid, RID = from };
+ public static godot_variant CreateFromRid(Rid from)
+ => new() { Type = Variant.Type.Rid, Rid = from };
public static godot_variant CreateFromBool(bool from)
=> new() { Type = Variant.Type.Bool, Bool = from.ToGodotBool() };
@@ -28,26 +28,26 @@ namespace Godot.NativeInterop
public static godot_variant CreateFromVector2(Vector2 from)
=> new() { Type = Variant.Type.Vector2, Vector2 = from };
- public static godot_variant CreateFromVector2i(Vector2i from)
- => new() { Type = Variant.Type.Vector2i, Vector2i = from };
+ public static godot_variant CreateFromVector2I(Vector2I from)
+ => new() { Type = Variant.Type.Vector2I, Vector2I = from };
public static godot_variant CreateFromVector3(Vector3 from)
=> new() { Type = Variant.Type.Vector3, Vector3 = from };
- public static godot_variant CreateFromVector3i(Vector3i from)
- => new() { Type = Variant.Type.Vector3i, Vector3i = from };
+ public static godot_variant CreateFromVector3I(Vector3I from)
+ => new() { Type = Variant.Type.Vector3I, Vector3I = from };
public static godot_variant CreateFromVector4(Vector4 from)
=> new() { Type = Variant.Type.Vector4, Vector4 = from };
- public static godot_variant CreateFromVector4i(Vector4i from)
- => new() { Type = Variant.Type.Vector4i, Vector4i = from };
+ public static godot_variant CreateFromVector4I(Vector4I from)
+ => new() { Type = Variant.Type.Vector4I, Vector4I = from };
public static godot_variant CreateFromRect2(Rect2 from)
=> new() { Type = Variant.Type.Rect2, Rect2 = from };
- public static godot_variant CreateFromRect2i(Rect2i from)
- => new() { Type = Variant.Type.Rect2i, Rect2i = from };
+ public static godot_variant CreateFromRect2I(Rect2I from)
+ => new() { Type = Variant.Type.Rect2I, Rect2I = from };
public static godot_variant CreateFromQuaternion(Quaternion from)
=> new() { Type = Variant.Type.Quaternion, Quaternion = from };
@@ -82,7 +82,7 @@ namespace Godot.NativeInterop
return ret;
}
- public static godot_variant CreateFromAABB(AABB from)
+ public static godot_variant CreateFromAabb(Aabb from)
{
NativeFuncs.godotsharp_variant_new_aabb(out godot_variant ret, from);
return ret;
@@ -237,11 +237,11 @@ namespace Godot.NativeInterop
public static godot_variant CreateFromSystemArrayOfNodePath(Span<NodePath> from)
=> CreateFromArray(new Collections.Array(from));
- public static godot_variant CreateFromSystemArrayOfRID(Span<RID> from)
+ public static godot_variant CreateFromSystemArrayOfRid(Span<Rid> from)
=> CreateFromArray(new Collections.Array(from));
// ReSharper disable once RedundantNameQualifier
- public static godot_variant CreateFromSystemArrayOfGodotObject(Godot.Object[]? from)
+ public static godot_variant CreateFromSystemArrayOfGodotObject(GodotObject[]? from)
{
if (from == null)
return default; // Nil
@@ -260,7 +260,7 @@ namespace Godot.NativeInterop
=> from != null ? CreateFromArray((godot_array)from.NativeValue) : default;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static godot_variant CreateFromArray<T>(Array<T>? from)
+ public static godot_variant CreateFromArray<[MustBeVariant] T>(Array<T>? from)
=> from != null ? CreateFromArray((godot_array)((Collections.Array)from).NativeValue) : default;
public static godot_variant CreateFromDictionary(godot_dictionary from)
@@ -274,7 +274,7 @@ namespace Godot.NativeInterop
=> from != null ? CreateFromDictionary((godot_dictionary)from.NativeValue) : default;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static godot_variant CreateFromDictionary<TKey, TValue>(Dictionary<TKey, TValue>? from)
+ public static godot_variant CreateFromDictionary<[MustBeVariant] TKey, [MustBeVariant] TValue>(Dictionary<TKey, TValue>? from)
=> from != null ? CreateFromDictionary((godot_dictionary)((Dictionary)from).NativeValue) : default;
public static godot_variant CreateFromStringName(godot_string_name from)
@@ -307,8 +307,8 @@ namespace Godot.NativeInterop
[MethodImpl(MethodImplOptions.AggressiveInlining)]
// ReSharper disable once RedundantNameQualifier
- public static godot_variant CreateFromGodotObject(Godot.Object? from)
- => from != null ? CreateFromGodotObjectPtr(Object.GetPtr(from)) : default;
+ public static godot_variant CreateFromGodotObject(GodotObject? from)
+ => from != null ? CreateFromGodotObjectPtr(GodotObject.GetPtr(from)) : default;
// We avoid the internal call if the stored type is the same we want.
@@ -375,9 +375,9 @@ namespace Godot.NativeInterop
p_var.Vector2 :
NativeFuncs.godotsharp_variant_as_vector2(p_var);
- public static Vector2i ConvertToVector2i(in godot_variant p_var)
- => p_var.Type == Variant.Type.Vector2i ?
- p_var.Vector2i :
+ public static Vector2I ConvertToVector2I(in godot_variant p_var)
+ => p_var.Type == Variant.Type.Vector2I ?
+ p_var.Vector2I :
NativeFuncs.godotsharp_variant_as_vector2i(p_var);
public static Rect2 ConvertToRect2(in godot_variant p_var)
@@ -385,13 +385,13 @@ namespace Godot.NativeInterop
p_var.Rect2 :
NativeFuncs.godotsharp_variant_as_rect2(p_var);
- public static Rect2i ConvertToRect2i(in godot_variant p_var)
- => p_var.Type == Variant.Type.Rect2i ?
- p_var.Rect2i :
+ public static Rect2I ConvertToRect2I(in godot_variant p_var)
+ => p_var.Type == Variant.Type.Rect2I ?
+ p_var.Rect2I :
NativeFuncs.godotsharp_variant_as_rect2i(p_var);
public static unsafe Transform2D ConvertToTransform2D(in godot_variant p_var)
- => p_var.Type == Variant.Type.Transform2d ?
+ => p_var.Type == Variant.Type.Transform2D ?
*p_var.Transform2D :
NativeFuncs.godotsharp_variant_as_transform2d(p_var);
@@ -400,9 +400,9 @@ namespace Godot.NativeInterop
p_var.Vector3 :
NativeFuncs.godotsharp_variant_as_vector3(p_var);
- public static Vector3i ConvertToVector3i(in godot_variant p_var)
- => p_var.Type == Variant.Type.Vector3i ?
- p_var.Vector3i :
+ public static Vector3I ConvertToVector3I(in godot_variant p_var)
+ => p_var.Type == Variant.Type.Vector3I ?
+ p_var.Vector3I :
NativeFuncs.godotsharp_variant_as_vector3i(p_var);
public static unsafe Vector4 ConvertToVector4(in godot_variant p_var)
@@ -410,9 +410,9 @@ namespace Godot.NativeInterop
p_var.Vector4 :
NativeFuncs.godotsharp_variant_as_vector4(p_var);
- public static unsafe Vector4i ConvertToVector4i(in godot_variant p_var)
- => p_var.Type == Variant.Type.Vector4i ?
- p_var.Vector4i :
+ public static unsafe Vector4I ConvertToVector4I(in godot_variant p_var)
+ => p_var.Type == Variant.Type.Vector4I ?
+ p_var.Vector4I :
NativeFuncs.godotsharp_variant_as_vector4i(p_var);
public static unsafe Basis ConvertToBasis(in godot_variant p_var)
@@ -426,7 +426,7 @@ namespace Godot.NativeInterop
NativeFuncs.godotsharp_variant_as_quaternion(p_var);
public static unsafe Transform3D ConvertToTransform3D(in godot_variant p_var)
- => p_var.Type == Variant.Type.Transform3d ?
+ => p_var.Type == Variant.Type.Transform3D ?
*p_var.Transform3D :
NativeFuncs.godotsharp_variant_as_transform3d(p_var);
@@ -435,9 +435,9 @@ namespace Godot.NativeInterop
*p_var.Projection :
NativeFuncs.godotsharp_variant_as_projection(p_var);
- public static unsafe AABB ConvertToAABB(in godot_variant p_var)
+ public static unsafe Aabb ConvertToAabb(in godot_variant p_var)
=> p_var.Type == Variant.Type.Aabb ?
- *p_var.AABB :
+ *p_var.Aabb :
NativeFuncs.godotsharp_variant_as_aabb(p_var);
public static Color ConvertToColor(in godot_variant p_var)
@@ -450,9 +450,9 @@ namespace Godot.NativeInterop
p_var.Plane :
NativeFuncs.godotsharp_variant_as_plane(p_var);
- public static RID ConvertToRID(in godot_variant p_var)
+ public static Rid ConvertToRid(in godot_variant p_var)
=> p_var.Type == Variant.Type.Rid ?
- p_var.RID :
+ p_var.Rid :
NativeFuncs.godotsharp_variant_as_rid(p_var);
public static IntPtr ConvertToGodotObjectPtr(in godot_variant p_var)
@@ -460,7 +460,7 @@ namespace Godot.NativeInterop
[MethodImpl(MethodImplOptions.AggressiveInlining)]
// ReSharper disable once RedundantNameQualifier
- public static Godot.Object ConvertToGodotObject(in godot_variant p_var)
+ public static GodotObject ConvertToGodotObject(in godot_variant p_var)
=> InteropUtils.UnmanagedGetManaged(ConvertToGodotObjectPtr(p_var));
public static string ConvertToString(in godot_variant p_var)
@@ -526,7 +526,7 @@ namespace Godot.NativeInterop
=> Collections.Array.CreateTakingOwnershipOfDisposableValue(ConvertToNativeArray(p_var));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Array<T> ConvertToArray<T>(in godot_variant p_var)
+ public static Array<T> ConvertToArray<[MustBeVariant] T>(in godot_variant p_var)
=> Array<T>.CreateTakingOwnershipOfDisposableValue(ConvertToNativeArray(p_var));
public static godot_dictionary ConvertToNativeDictionary(in godot_variant p_var)
@@ -539,7 +539,7 @@ namespace Godot.NativeInterop
=> Dictionary.CreateTakingOwnershipOfDisposableValue(ConvertToNativeDictionary(p_var));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Dictionary<TKey, TValue> ConvertToDictionary<TKey, TValue>(in godot_variant p_var)
+ public static Dictionary<TKey, TValue> ConvertToDictionary<[MustBeVariant] TKey, [MustBeVariant] TValue>(in godot_variant p_var)
=> Dictionary<TKey, TValue>.CreateTakingOwnershipOfDisposableValue(ConvertToNativeDictionary(p_var));
public static byte[] ConvertAsPackedByteArrayToSystemArray(in godot_variant p_var)
@@ -608,15 +608,15 @@ namespace Godot.NativeInterop
return Marshaling.ConvertNativeGodotArrayToSystemArrayOfNodePath(godotArray);
}
- public static RID[] ConvertToSystemArrayOfRID(in godot_variant p_var)
+ public static Rid[] ConvertToSystemArrayOfRid(in godot_variant p_var)
{
using var godotArray = NativeFuncs.godotsharp_variant_as_array(p_var);
- return Marshaling.ConvertNativeGodotArrayToSystemArrayOfRID(godotArray);
+ return Marshaling.ConvertNativeGodotArrayToSystemArrayOfRid(godotArray);
}
public static T[] ConvertToSystemArrayOfGodotObject<T>(in godot_variant p_var)
// ReSharper disable once RedundantNameQualifier
- where T : Godot.Object
+ where T : GodotObject
{
using var godotArray = NativeFuncs.godotsharp_variant_as_array(p_var);
return Marshaling.ConvertNativeGodotArrayToSystemArrayOfGodotObjectType<T>(godotArray);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.generic.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.generic.cs
index 3d64533269..12b0a47079 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.generic.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.generic.cs
@@ -80,14 +80,14 @@ public partial class VariantUtils
if (typeof(T) == typeof(Vector2))
return CreateFromVector2(UnsafeAs<Vector2>(from));
- if (typeof(T) == typeof(Vector2i))
- return CreateFromVector2i(UnsafeAs<Vector2i>(from));
+ if (typeof(T) == typeof(Vector2I))
+ return CreateFromVector2I(UnsafeAs<Vector2I>(from));
if (typeof(T) == typeof(Rect2))
return CreateFromRect2(UnsafeAs<Rect2>(from));
- if (typeof(T) == typeof(Rect2i))
- return CreateFromRect2i(UnsafeAs<Rect2i>(from));
+ if (typeof(T) == typeof(Rect2I))
+ return CreateFromRect2I(UnsafeAs<Rect2I>(from));
if (typeof(T) == typeof(Transform2D))
return CreateFromTransform2D(UnsafeAs<Transform2D>(from));
@@ -98,8 +98,8 @@ public partial class VariantUtils
if (typeof(T) == typeof(Vector3))
return CreateFromVector3(UnsafeAs<Vector3>(from));
- if (typeof(T) == typeof(Vector3i))
- return CreateFromVector3i(UnsafeAs<Vector3i>(from));
+ if (typeof(T) == typeof(Vector3I))
+ return CreateFromVector3I(UnsafeAs<Vector3I>(from));
if (typeof(T) == typeof(Basis))
return CreateFromBasis(UnsafeAs<Basis>(from));
@@ -113,11 +113,11 @@ public partial class VariantUtils
if (typeof(T) == typeof(Vector4))
return CreateFromVector4(UnsafeAs<Vector4>(from));
- if (typeof(T) == typeof(Vector4i))
- return CreateFromVector4i(UnsafeAs<Vector4i>(from));
+ if (typeof(T) == typeof(Vector4I))
+ return CreateFromVector4I(UnsafeAs<Vector4I>(from));
- if (typeof(T) == typeof(AABB))
- return CreateFromAABB(UnsafeAs<AABB>(from));
+ if (typeof(T) == typeof(Aabb))
+ return CreateFromAabb(UnsafeAs<Aabb>(from));
if (typeof(T) == typeof(Color))
return CreateFromColor(UnsafeAs<Color>(from));
@@ -167,8 +167,8 @@ public partial class VariantUtils
if (typeof(T) == typeof(NodePath[]))
return CreateFromSystemArrayOfNodePath(UnsafeAs<NodePath[]>(from));
- if (typeof(T) == typeof(RID[]))
- return CreateFromSystemArrayOfRID(UnsafeAs<RID[]>(from));
+ if (typeof(T) == typeof(Rid[]))
+ return CreateFromSystemArrayOfRid(UnsafeAs<Rid[]>(from));
if (typeof(T) == typeof(StringName))
return CreateFromStringName(UnsafeAs<StringName>(from));
@@ -176,8 +176,8 @@ public partial class VariantUtils
if (typeof(T) == typeof(NodePath))
return CreateFromNodePath(UnsafeAs<NodePath>(from));
- if (typeof(T) == typeof(RID))
- return CreateFromRID(UnsafeAs<RID>(from));
+ if (typeof(T) == typeof(Rid))
+ return CreateFromRid(UnsafeAs<Rid>(from));
if (typeof(T) == typeof(Godot.Collections.Dictionary))
return CreateFromDictionary(UnsafeAs<Godot.Collections.Dictionary>(from));
@@ -192,8 +192,8 @@ public partial class VariantUtils
// `typeof(X).IsAssignableFrom(typeof(T))` is optimized away
- if (typeof(Godot.Object).IsAssignableFrom(typeof(T)))
- return CreateFromGodotObject(UnsafeAs<Godot.Object>(from));
+ if (typeof(GodotObject).IsAssignableFrom(typeof(T)))
+ return CreateFromGodotObject(UnsafeAs<GodotObject>(from));
// `typeof(T).IsValueType` is optimized away
// `typeof(T).IsEnum` is NOT optimized away: https://github.com/dotnet/runtime/issues/67113
@@ -269,14 +269,14 @@ public partial class VariantUtils
if (typeof(T) == typeof(Vector2))
return UnsafeAsT(ConvertToVector2(variant));
- if (typeof(T) == typeof(Vector2i))
- return UnsafeAsT(ConvertToVector2i(variant));
+ if (typeof(T) == typeof(Vector2I))
+ return UnsafeAsT(ConvertToVector2I(variant));
if (typeof(T) == typeof(Rect2))
return UnsafeAsT(ConvertToRect2(variant));
- if (typeof(T) == typeof(Rect2i))
- return UnsafeAsT(ConvertToRect2i(variant));
+ if (typeof(T) == typeof(Rect2I))
+ return UnsafeAsT(ConvertToRect2I(variant));
if (typeof(T) == typeof(Transform2D))
return UnsafeAsT(ConvertToTransform2D(variant));
@@ -284,8 +284,8 @@ public partial class VariantUtils
if (typeof(T) == typeof(Vector3))
return UnsafeAsT(ConvertToVector3(variant));
- if (typeof(T) == typeof(Vector3i))
- return UnsafeAsT(ConvertToVector3i(variant));
+ if (typeof(T) == typeof(Vector3I))
+ return UnsafeAsT(ConvertToVector3I(variant));
if (typeof(T) == typeof(Basis))
return UnsafeAsT(ConvertToBasis(variant));
@@ -302,11 +302,11 @@ public partial class VariantUtils
if (typeof(T) == typeof(Vector4))
return UnsafeAsT(ConvertToVector4(variant));
- if (typeof(T) == typeof(Vector4i))
- return UnsafeAsT(ConvertToVector4i(variant));
+ if (typeof(T) == typeof(Vector4I))
+ return UnsafeAsT(ConvertToVector4I(variant));
- if (typeof(T) == typeof(AABB))
- return UnsafeAsT(ConvertToAABB(variant));
+ if (typeof(T) == typeof(Aabb))
+ return UnsafeAsT(ConvertToAabb(variant));
if (typeof(T) == typeof(Color))
return UnsafeAsT(ConvertToColor(variant));
@@ -356,8 +356,8 @@ public partial class VariantUtils
if (typeof(T) == typeof(NodePath[]))
return UnsafeAsT(ConvertToSystemArrayOfNodePath(variant));
- if (typeof(T) == typeof(RID[]))
- return UnsafeAsT(ConvertToSystemArrayOfRID(variant));
+ if (typeof(T) == typeof(Rid[]))
+ return UnsafeAsT(ConvertToSystemArrayOfRid(variant));
if (typeof(T) == typeof(StringName))
return UnsafeAsT(ConvertToStringName(variant));
@@ -365,8 +365,8 @@ public partial class VariantUtils
if (typeof(T) == typeof(NodePath))
return UnsafeAsT(ConvertToNodePath(variant));
- if (typeof(T) == typeof(RID))
- return UnsafeAsT(ConvertToRID(variant));
+ if (typeof(T) == typeof(Rid))
+ return UnsafeAsT(ConvertToRid(variant));
if (typeof(T) == typeof(Godot.Collections.Dictionary))
return UnsafeAsT(ConvertToDictionary(variant));
@@ -381,7 +381,7 @@ public partial class VariantUtils
// `typeof(X).IsAssignableFrom(typeof(T))` is optimized away
- if (typeof(Godot.Object).IsAssignableFrom(typeof(T)))
+ if (typeof(GodotObject).IsAssignableFrom(typeof(T)))
return (T)(object)ConvertToGodotObject(variant);
// `typeof(T).IsValueType` is optimized away
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
index 8a125e3c73..55b7a83fc2 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
@@ -13,13 +13,14 @@ namespace Godot
public struct Plane : IEquatable<Plane>
{
private Vector3 _normal;
+ private real_t _d;
/// <summary>
/// The normal of the plane, which must be a unit vector.
/// In the scalar equation of the plane <c>ax + by + cz = d</c>, this is
/// the vector <c>(a, b, c)</c>, where <c>d</c> is the <see cref="D"/> property.
/// </summary>
- /// <value>Equivalent to <see cref="x"/>, <see cref="y"/>, and <see cref="z"/>.</value>
+ /// <value>Equivalent to <see cref="X"/>, <see cref="Y"/>, and <see cref="Z"/>.</value>
public Vector3 Normal
{
readonly get { return _normal; }
@@ -27,18 +28,32 @@ namespace Godot
}
/// <summary>
+ /// The distance from the origin to the plane (in the direction of
+ /// <see cref="Normal"/>). This value is typically non-negative.
+ /// In the scalar equation of the plane <c>ax + by + cz = d</c>,
+ /// this is <c>d</c>, while the <c>(a, b, c)</c> coordinates are represented
+ /// by the <see cref="Normal"/> property.
+ /// </summary>
+ /// <value>The plane's distance from the origin.</value>
+ public real_t D
+ {
+ readonly get { return _d; }
+ set { _d = value; }
+ }
+
+ /// <summary>
/// The X component of the plane's normal vector.
/// </summary>
/// <value>Equivalent to <see cref="Normal"/>'s X value.</value>
- public real_t x
+ public real_t X
{
readonly get
{
- return _normal.x;
+ return _normal.X;
}
set
{
- _normal.x = value;
+ _normal.X = value;
}
}
@@ -46,15 +61,15 @@ namespace Godot
/// The Y component of the plane's normal vector.
/// </summary>
/// <value>Equivalent to <see cref="Normal"/>'s Y value.</value>
- public real_t y
+ public real_t Y
{
readonly get
{
- return _normal.y;
+ return _normal.Y;
}
set
{
- _normal.y = value;
+ _normal.Y = value;
}
}
@@ -62,36 +77,26 @@ namespace Godot
/// The Z component of the plane's normal vector.
/// </summary>
/// <value>Equivalent to <see cref="Normal"/>'s Z value.</value>
- public real_t z
+ public real_t Z
{
readonly get
{
- return _normal.z;
+ return _normal.Z;
}
set
{
- _normal.z = value;
+ _normal.Z = value;
}
}
/// <summary>
- /// The distance from the origin to the plane (in the direction of
- /// <see cref="Normal"/>). This value is typically non-negative.
- /// In the scalar equation of the plane <c>ax + by + cz = d</c>,
- /// this is <c>d</c>, while the <c>(a, b, c)</c> coordinates are represented
- /// by the <see cref="Normal"/> property.
- /// </summary>
- /// <value>The plane's distance from the origin.</value>
- public real_t D { get; set; }
-
- /// <summary>
/// Returns the shortest distance from this plane to the position <paramref name="point"/>.
/// </summary>
/// <param name="point">The position to use for the calculation.</param>
/// <returns>The shortest distance.</returns>
public readonly real_t DistanceTo(Vector3 point)
{
- return _normal.Dot(point) - D;
+ return _normal.Dot(point) - _d;
}
/// <summary>
@@ -101,7 +106,7 @@ namespace Godot
/// <value>Equivalent to <see cref="Normal"/> multiplied by <see cref="D"/>.</value>
public readonly Vector3 GetCenter()
{
- return _normal * D;
+ return _normal * _d;
}
/// <summary>
@@ -113,7 +118,7 @@ namespace Godot
/// <returns>A <see langword="bool"/> for whether or not the plane has the point.</returns>
public readonly bool HasPoint(Vector3 point, real_t tolerance = Mathf.Epsilon)
{
- real_t dist = _normal.Dot(point) - D;
+ real_t dist = _normal.Dot(point) - _d;
return Mathf.Abs(dist) <= tolerance;
}
@@ -133,9 +138,9 @@ namespace Godot
return null;
}
- Vector3 result = (b._normal.Cross(c._normal) * D) +
- (c._normal.Cross(_normal) * b.D) +
- (_normal.Cross(b._normal) * c.D);
+ Vector3 result = (b._normal.Cross(c._normal) * _d) +
+ (c._normal.Cross(_normal) * b._d) +
+ (_normal.Cross(b._normal) * c._d);
return result / denom;
}
@@ -157,7 +162,7 @@ namespace Godot
return null;
}
- real_t dist = (_normal.Dot(from) - D) / den;
+ real_t dist = (_normal.Dot(from) - _d) / den;
// This is a ray, before the emitting pos (from) does not exist
if (dist > Mathf.Epsilon)
@@ -186,7 +191,7 @@ namespace Godot
return null;
}
- real_t dist = (_normal.Dot(begin) - D) / den;
+ real_t dist = (_normal.Dot(begin) - _d) / den;
// Only allow dist to be in the range of 0 to 1, with tolerance.
if (dist < -Mathf.Epsilon || dist > 1.0f + Mathf.Epsilon)
@@ -214,7 +219,7 @@ namespace Godot
/// <returns>A <see langword="bool"/> for whether or not the point is above the plane.</returns>
public readonly bool IsPointOver(Vector3 point)
{
- return _normal.Dot(point) > D;
+ return _normal.Dot(point) > _d;
}
/// <summary>
@@ -230,7 +235,7 @@ namespace Godot
return new Plane(0, 0, 0, 0);
}
- return new Plane(_normal / len, D / len);
+ return new Plane(_normal / len, _d / len);
}
/// <summary>
@@ -279,7 +284,7 @@ namespace Godot
public Plane(real_t a, real_t b, real_t c, real_t d)
{
_normal = new Vector3(a, b, c);
- D = d;
+ _d = d;
}
/// <summary>
@@ -290,7 +295,7 @@ namespace Godot
public Plane(Vector3 normal)
{
_normal = normal;
- D = 0;
+ _d = 0;
}
/// <summary>
@@ -302,7 +307,7 @@ namespace Godot
public Plane(Vector3 normal, real_t d)
{
_normal = normal;
- D = d;
+ _d = d;
}
/// <summary>
@@ -314,7 +319,7 @@ namespace Godot
public Plane(Vector3 normal, Vector3 point)
{
_normal = normal;
- D = _normal.Dot(point);
+ _d = _normal.Dot(point);
}
/// <summary>
@@ -327,7 +332,7 @@ namespace Godot
{
_normal = (v1 - v3).Cross(v1 - v2);
_normal.Normalize();
- D = _normal.Dot(v1);
+ _d = _normal.Dot(v1);
}
/// <summary>
@@ -341,7 +346,7 @@ namespace Godot
/// <returns>The negated/flipped plane.</returns>
public static Plane operator -(Plane plane)
{
- return new Plane(-plane._normal, -plane.D);
+ return new Plane(-plane._normal, -plane._d);
}
/// <summary>
@@ -389,7 +394,7 @@ namespace Godot
/// <returns>Whether or not the planes are exactly equal.</returns>
public readonly bool Equals(Plane other)
{
- return _normal == other._normal && D == other.D;
+ return _normal == other._normal && _d == other._d;
}
/// <summary>
@@ -400,7 +405,7 @@ namespace Godot
/// <returns>Whether or not the planes are approximately equal.</returns>
public readonly bool IsEqualApprox(Plane other)
{
- return _normal.IsEqualApprox(other._normal) && Mathf.IsEqualApprox(D, other.D);
+ return _normal.IsEqualApprox(other._normal) && Mathf.IsEqualApprox(_d, other._d);
}
/// <summary>
@@ -409,7 +414,7 @@ namespace Godot
/// <returns>A hash code for this plane.</returns>
public override readonly int GetHashCode()
{
- return _normal.GetHashCode() ^ D.GetHashCode();
+ return _normal.GetHashCode() ^ _d.GetHashCode();
}
/// <summary>
@@ -418,7 +423,7 @@ namespace Godot
/// <returns>A string representation of this plane.</returns>
public override readonly string ToString()
{
- return $"{_normal}, {D}";
+ return $"{_normal}, {_d}";
}
/// <summary>
@@ -427,7 +432,7 @@ namespace Godot
/// <returns>A string representation of this plane.</returns>
public readonly string ToString(string format)
{
- return $"{_normal.ToString(format)}, {D.ToString(format)}";
+ return $"{_normal.ToString(format)}, {_d.ToString(format)}";
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs
index f11b3c553a..84fc73b87a 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs
@@ -49,22 +49,22 @@ namespace Godot
/// <summary>
/// The projection's X column. Also accessible by using the index position <c>[0]</c>.
/// </summary>
- public Vector4 x;
+ public Vector4 X;
/// <summary>
/// The projection's Y column. Also accessible by using the index position <c>[1]</c>.
/// </summary>
- public Vector4 y;
+ public Vector4 Y;
/// <summary>
/// The projection's Z column. Also accessible by using the index position <c>[2]</c>.
/// </summary>
- public Vector4 z;
+ public Vector4 Z;
/// <summary>
/// The projection's W column. Also accessible by using the index position <c>[3]</c>.
/// </summary>
- public Vector4 w;
+ public Vector4 W;
/// <summary>
/// Access whole columns in the form of <see cref="Vector4"/>.
@@ -80,13 +80,13 @@ namespace Godot
switch (column)
{
case 0:
- return x;
+ return X;
case 1:
- return y;
+ return Y;
case 2:
- return z;
+ return Z;
case 3:
- return w;
+ return W;
default:
throw new ArgumentOutOfRangeException(nameof(column));
}
@@ -96,16 +96,16 @@ namespace Godot
switch (column)
{
case 0:
- x = value;
+ X = value;
return;
case 1:
- y = value;
+ Y = value;
return;
case 2:
- z = value;
+ Z = value;
return;
case 3:
- w = value;
+ W = value;
return;
default:
throw new ArgumentOutOfRangeException(nameof(column));
@@ -128,13 +128,13 @@ namespace Godot
switch (column)
{
case 0:
- return x[row];
+ return X[row];
case 1:
- return y[row];
+ return Y[row];
case 2:
- return z[row];
+ return Z[row];
case 3:
- return w[row];
+ return W[row];
default:
throw new ArgumentOutOfRangeException(nameof(column));
}
@@ -144,16 +144,16 @@ namespace Godot
switch (column)
{
case 0:
- x[row] = value;
+ X[row] = value;
return;
case 1:
- y[row] = value;
+ Y[row] = value;
return;
case 2:
- z[row] = value;
+ Z[row] = value;
return;
case 3:
- w[row] = value;
+ W[row] = value;
return;
default:
throw new ArgumentOutOfRangeException(nameof(column));
@@ -180,20 +180,20 @@ namespace Godot
/// <summary>
/// Creates a new <see cref="Projection"/> that scales a given projection to fit around
- /// a given <see cref="AABB"/> in projection space.
+ /// a given <see cref="Aabb"/> in projection space.
/// </summary>
- /// <param name="aabb">The AABB to fit the projection around.</param>
+ /// <param name="aabb">The Aabb to fit the projection around.</param>
/// <returns>The created projection.</returns>
- public static Projection CreateFitAabb(AABB aabb)
+ public static Projection CreateFitAabb(Aabb aabb)
{
Vector3 min = aabb.Position;
Vector3 max = aabb.Position + aabb.Size;
return new Projection(
- new Vector4(2 / (max.x - min.x), 0, 0, 0),
- new Vector4(0, 2 / (max.y - min.y), 0, 0),
- new Vector4(0, 0, 2 / (max.z - min.z), 0),
- new Vector4(-(max.x + min.x) / (max.x - min.x), -(max.y + min.y) / (max.y - min.y), -(max.z + min.z) / (max.z - min.z), 1)
+ new Vector4(2 / (max.X - min.X), 0, 0, 0),
+ new Vector4(0, 2 / (max.Y - min.Y), 0, 0),
+ new Vector4(0, 0, 2 / (max.Z - min.Z), 0),
+ new Vector4(-(max.X + min.X) / (max.X - min.X), -(max.Y + min.Y) / (max.Y - min.Y), -(max.Z + min.Z) / (max.Z - min.Z), 1)
);
}
@@ -300,7 +300,7 @@ namespace Godot
{
size *= aspect;
}
- return CreateFrustum(-size / 2 + offset.x, +size / 2 + offset.x, -size / aspect / 2 + offset.y, +size / aspect / 2 + offset.y, near, far);
+ return CreateFrustum(-size / 2 + offset.X, +size / 2 + offset.X, -size / aspect / 2 + offset.Y, +size / aspect / 2 + offset.Y, near, far);
}
/// <summary>
@@ -311,10 +311,10 @@ namespace Godot
public static Projection CreateLightAtlasRect(Rect2 rect)
{
return new Projection(
- new Vector4(rect.Size.x, 0, 0, 0),
- new Vector4(0, rect.Size.y, 0, 0),
+ new Vector4(rect.Size.X, 0, 0, 0),
+ new Vector4(0, rect.Size.Y, 0, 0),
new Vector4(0, 0, 1, 0),
- new Vector4(rect.Position.x, rect.Position.y, 0, 1)
+ new Vector4(rect.Position.X, rect.Position.Y, 0, 1)
);
}
@@ -332,13 +332,13 @@ namespace Godot
public static Projection CreateOrthogonal(real_t left, real_t right, real_t bottom, real_t top, real_t zNear, real_t zFar)
{
Projection proj = Projection.Identity;
- proj.x.x = (real_t)2.0 / (right - left);
- proj.w.x = -((right + left) / (right - left));
- proj.y.y = (real_t)2.0 / (top - bottom);
- proj.w.y = -((top + bottom) / (top - bottom));
- proj.z.z = (real_t)(-2.0) / (zFar - zNear);
- proj.w.z = -((zFar + zNear) / (zFar - zNear));
- proj.w.w = (real_t)1.0;
+ proj.X.X = (real_t)2.0 / (right - left);
+ proj.W.X = -((right + left) / (right - left));
+ proj.Y.Y = (real_t)2.0 / (top - bottom);
+ proj.W.Y = -((top + bottom) / (top - bottom));
+ proj.Z.Z = (real_t)(-2.0) / (zFar - zNear);
+ proj.W.Z = -((zFar + zNear) / (zFar - zNear));
+ proj.W.W = (real_t)1.0;
return proj;
}
@@ -392,12 +392,12 @@ namespace Godot
Projection proj = Projection.Identity;
- proj.x.x = cotangent / aspect;
- proj.y.y = cotangent;
- proj.z.z = -(zFar + zNear) / deltaZ;
- proj.z.w = -1;
- proj.w.z = -2 * zNear * zFar / deltaZ;
- proj.w.w = 0;
+ proj.X.X = cotangent / aspect;
+ proj.Y.Y = cotangent;
+ proj.Z.Z = -(zFar + zNear) / deltaZ;
+ proj.Z.W = -1;
+ proj.W.Z = -2 * zNear * zFar / deltaZ;
+ proj.W.W = 0;
return proj;
}
@@ -456,7 +456,7 @@ namespace Godot
}
Projection proj = CreateFrustum(left, right, -ymax, ymax, zNear, zFar);
Projection cm = Projection.Identity;
- cm.w.x = modeltranslation;
+ cm.W.X = modeltranslation;
return proj * cm;
}
@@ -469,18 +469,18 @@ namespace Godot
/// <returns>The determinant calculated from this projection.</returns>
public readonly real_t Determinant()
{
- return x.w * y.z * z.y * w.x - x.z * y.w * z.y * w.x -
- x.w * y.y * z.z * w.x + x.y * y.w * z.z * w.x +
- x.z * y.y * z.w * w.x - x.y * y.z * z.w * w.x -
- x.w * y.z * z.x * w.y + x.z * y.w * z.x * w.y +
- x.w * y.x * z.z * w.y - x.x * y.w * z.z * w.y -
- x.z * y.x * z.w * w.y + x.x * y.z * z.w * w.y +
- x.w * y.y * z.x * w.z - x.y * y.w * z.x * w.z -
- x.w * y.x * z.y * w.z + x.x * y.w * z.y * w.z +
- x.y * y.x * z.w * w.z - x.x * y.y * z.w * w.z -
- x.z * y.y * z.x * w.w + x.y * y.z * z.x * w.w +
- x.z * y.x * z.y * w.w - x.x * y.z * z.y * w.w -
- x.y * y.x * z.z * w.w + x.x * y.y * z.z * w.w;
+ return X.W * Y.Z * Z.Y * W.X - X.Z * Y.W * Z.Y * W.X -
+ X.W * Y.Y * Z.Z * W.X + X.Y * Y.W * Z.Z * W.X +
+ X.Z * Y.Y * Z.W * W.X - X.Y * Y.Z * Z.W * W.X -
+ X.W * Y.Z * Z.X * W.Y + X.Z * Y.W * Z.X * W.Y +
+ X.W * Y.X * Z.Z * W.Y - X.X * Y.W * Z.Z * W.Y -
+ X.Z * Y.X * Z.W * W.Y + X.X * Y.Z * Z.W * W.Y +
+ X.W * Y.Y * Z.X * W.Z - X.Y * Y.W * Z.X * W.Z -
+ X.W * Y.X * Z.Y * W.Z + X.X * Y.W * Z.Y * W.Z +
+ X.Y * Y.X * Z.W * W.Z - X.X * Y.Y * Z.W * W.Z -
+ X.Z * Y.Y * Z.X * W.W + X.Y * Y.Z * Z.X * W.W +
+ X.Z * Y.X * Z.Y * W.W - X.X * Y.Z * Z.Y * W.W -
+ X.Y * Y.X * Z.Z * W.W + X.X * Y.Y * Z.Z * W.W;
}
/// <summary>
@@ -490,7 +490,7 @@ namespace Godot
public readonly real_t GetAspect()
{
Vector2 vpHe = GetViewportHalfExtents();
- return vpHe.x / vpHe.y;
+ return vpHe.X / vpHe.Y;
}
/// <summary>
@@ -499,15 +499,15 @@ namespace Godot
/// <returns>The horizontal field of view of this projection.</returns>
public readonly real_t GetFov()
{
- Plane rightPlane = new Plane(x.w - x.x, y.w - y.x, z.w - z.x, -w.w + w.x).Normalized();
- if (z.x == 0 && z.y == 0)
+ Plane rightPlane = new Plane(X.W - X.X, Y.W - Y.X, Z.W - Z.X, -W.W + W.X).Normalized();
+ if (Z.X == 0 && Z.Y == 0)
{
- return Mathf.RadToDeg(Mathf.Acos(Mathf.Abs(rightPlane.Normal.x))) * (real_t)2.0;
+ return Mathf.RadToDeg(Mathf.Acos(Mathf.Abs(rightPlane.Normal.X))) * (real_t)2.0;
}
else
{
- Plane leftPlane = new Plane(x.w + x.x, y.w + y.x, z.w + z.x, w.w + w.x).Normalized();
- return Mathf.RadToDeg(Mathf.Acos(Mathf.Abs(leftPlane.Normal.x))) + Mathf.RadToDeg(Mathf.Acos(Mathf.Abs(rightPlane.Normal.x)));
+ Plane leftPlane = new Plane(X.W + X.X, Y.W + Y.X, Z.W + Z.X, W.W + W.X).Normalized();
+ return Mathf.RadToDeg(Mathf.Acos(Mathf.Abs(leftPlane.Normal.X))) + Mathf.RadToDeg(Mathf.Acos(Mathf.Abs(rightPlane.Normal.X)));
}
}
@@ -531,12 +531,12 @@ namespace Godot
{
if (IsOrthogonal())
{
- return GetViewportHalfExtents().x;
+ return GetViewportHalfExtents().X;
}
else
{
real_t zn = GetZNear();
- real_t width = GetViewportHalfExtents().x * (real_t)2.0;
+ real_t width = GetViewportHalfExtents().X * (real_t)2.0;
return (real_t)1.0 / (zn / width);
}
}
@@ -551,7 +551,7 @@ namespace Godot
{
Vector3 result = this * new Vector3(1, 0, -1);
- return (int)((result.x * (real_t)0.5 + (real_t)0.5) * forPixelWidth);
+ return (int)((result.X * (real_t)0.5 + (real_t)0.5) * forPixelWidth);
}
/// <summary>
@@ -567,12 +567,12 @@ namespace Godot
{
Plane newPlane = plane switch
{
- Planes.Near => new Plane(x.w + x.z, y.w + y.z, z.w + z.z, w.w + w.z),
- Planes.Far => new Plane(x.w - x.z, y.w - y.z, z.w - z.z, w.w - w.z),
- Planes.Left => new Plane(x.w + x.x, y.w + y.x, z.w + z.x, w.w + w.x),
- Planes.Top => new Plane(x.w - x.y, y.w - y.y, z.w - z.y, w.w - w.y),
- Planes.Right => new Plane(x.w - x.x, y.w - y.x, z.w - z.x, w.w - w.x),
- Planes.Bottom => new Plane(x.w + x.y, y.w + y.y, z.w + z.y, w.w + w.y),
+ Planes.Near => new Plane(X.W + X.Z, Y.W + Y.Z, Z.W + Z.Z, W.W + W.Z),
+ Planes.Far => new Plane(X.W - X.Z, Y.W - Y.Z, Z.W - Z.Z, W.W - W.Z),
+ Planes.Left => new Plane(X.W + X.X, Y.W + Y.X, Z.W + Z.X, W.W + W.X),
+ Planes.Top => new Plane(X.W - X.Y, Y.W - Y.Y, Z.W - Z.Y, W.W - W.Y),
+ Planes.Right => new Plane(X.W - X.X, Y.W - Y.X, Z.W - Z.X, W.W - W.X),
+ Planes.Bottom => new Plane(X.W + X.Y, Y.W + Y.Y, Z.W + Z.Y, W.W + W.Y),
_ => new Plane(),
};
newPlane.Normal = -newPlane.Normal;
@@ -586,7 +586,7 @@ namespace Godot
public readonly Vector2 GetFarPlaneHalfExtents()
{
var res = GetProjectionPlane(Planes.Far).Intersect3(GetProjectionPlane(Planes.Right), GetProjectionPlane(Planes.Top));
- return new Vector2(res.Value.x, res.Value.y);
+ return new Vector2(res.Value.X, res.Value.Y);
}
/// <summary>
@@ -597,7 +597,7 @@ namespace Godot
public readonly Vector2 GetViewportHalfExtents()
{
var res = GetProjectionPlane(Planes.Near).Intersect3(GetProjectionPlane(Planes.Right), GetProjectionPlane(Planes.Top));
- return new Vector2(res.Value.x, res.Value.y);
+ return new Vector2(res.Value.X, res.Value.Y);
}
/// <summary>
@@ -625,7 +625,7 @@ namespace Godot
public readonly Projection FlippedY()
{
Projection proj = this;
- proj.y = -proj.y;
+ proj.Y = -proj.Y;
return proj;
}
@@ -642,8 +642,8 @@ namespace Godot
real_t zFar = GetZFar();
real_t zNear = newZNear;
real_t deltaZ = zFar - zNear;
- proj.z.z = -(zFar + zNear) / deltaZ;
- proj.w.z = -2 * zNear * zFar / deltaZ;
+ proj.Z.Z = -(zFar + zNear) / deltaZ;
+ proj.W.Z = -2 * zNear * zFar / deltaZ;
return proj;
}
@@ -656,8 +656,8 @@ namespace Godot
public readonly Projection JitterOffseted(Vector2 offset)
{
Projection proj = this;
- proj.w.x += offset.x;
- proj.w.y += offset.y;
+ proj.W.X += offset.X;
+ proj.W.Y += offset.Y;
return proj;
}
@@ -795,7 +795,7 @@ namespace Godot
/// <returns>If the projection performs an orthogonal projection.</returns>
public readonly bool IsOrthogonal()
{
- return w.w == (real_t)1.0;
+ return W.W == (real_t)1.0;
}
// Constants
@@ -835,10 +835,10 @@ namespace Godot
/// <param name="w">The W column, or column index 3.</param>
public Projection(Vector4 x, Vector4 y, Vector4 z, Vector4 w)
{
- this.x = x;
- this.y = y;
- this.z = z;
- this.w = w;
+ X = x;
+ Y = y;
+ Z = z;
+ W = w;
}
/// <summary>
@@ -847,10 +847,10 @@ namespace Godot
/// <param name="transform">The <see cref="Transform3D"/>.</param>
public Projection(Transform3D transform)
{
- x = new Vector4(transform.basis.Row0.x, transform.basis.Row1.x, transform.basis.Row2.x, 0);
- y = new Vector4(transform.basis.Row0.y, transform.basis.Row1.y, transform.basis.Row2.y, 0);
- z = new Vector4(transform.basis.Row0.z, transform.basis.Row1.z, transform.basis.Row2.z, 0);
- w = new Vector4(transform.origin.x, transform.origin.y, transform.origin.z, 1);
+ X = new Vector4(transform.Basis.Row0.X, transform.Basis.Row1.X, transform.Basis.Row2.X, 0);
+ Y = new Vector4(transform.Basis.Row0.Y, transform.Basis.Row1.Y, transform.Basis.Row2.Y, 0);
+ Z = new Vector4(transform.Basis.Row0.Z, transform.Basis.Row1.Z, transform.Basis.Row2.Z, 0);
+ W = new Vector4(transform.Origin.X, transform.Origin.Y, transform.Origin.Z, 1);
}
/// <summary>
@@ -865,25 +865,25 @@ namespace Godot
{
return new Projection(
new Vector4(
- left.x.x * right.x.x + left.y.x * right.x.y + left.z.x * right.x.z + left.w.x * right.x.w,
- left.x.y * right.x.x + left.y.y * right.x.y + left.z.y * right.x.z + left.w.y * right.x.w,
- left.x.z * right.x.x + left.y.z * right.x.y + left.z.z * right.x.z + left.w.z * right.x.w,
- left.x.w * right.x.x + left.y.w * right.x.y + left.z.w * right.x.z + left.w.w * right.x.w
+ left.X.X * right.X.X + left.Y.X * right.X.Y + left.Z.X * right.X.Z + left.W.X * right.X.W,
+ left.X.Y * right.X.X + left.Y.Y * right.X.Y + left.Z.Y * right.X.Z + left.W.Y * right.X.W,
+ left.X.Z * right.X.X + left.Y.Z * right.X.Y + left.Z.Z * right.X.Z + left.W.Z * right.X.W,
+ left.X.W * right.X.X + left.Y.W * right.X.Y + left.Z.W * right.X.Z + left.W.W * right.X.W
), new Vector4(
- left.x.x * right.y.x + left.y.x * right.y.y + left.z.x * right.y.z + left.w.x * right.y.w,
- left.x.y * right.y.x + left.y.y * right.y.y + left.z.y * right.y.z + left.w.y * right.y.w,
- left.x.z * right.y.x + left.y.z * right.y.y + left.z.z * right.y.z + left.w.z * right.y.w,
- left.x.w * right.y.x + left.y.w * right.y.y + left.z.w * right.y.z + left.w.w * right.y.w
+ left.X.X * right.Y.X + left.Y.X * right.Y.Y + left.Z.X * right.Y.Z + left.W.X * right.Y.W,
+ left.X.Y * right.Y.X + left.Y.Y * right.Y.Y + left.Z.Y * right.Y.Z + left.W.Y * right.Y.W,
+ left.X.Z * right.Y.X + left.Y.Z * right.Y.Y + left.Z.Z * right.Y.Z + left.W.Z * right.Y.W,
+ left.X.W * right.Y.X + left.Y.W * right.Y.Y + left.Z.W * right.Y.Z + left.W.W * right.Y.W
), new Vector4(
- left.x.x * right.z.x + left.y.x * right.z.y + left.z.x * right.z.z + left.w.x * right.z.w,
- left.x.y * right.z.x + left.y.y * right.z.y + left.z.y * right.z.z + left.w.y * right.z.w,
- left.x.z * right.z.x + left.y.z * right.z.y + left.z.z * right.z.z + left.w.z * right.z.w,
- left.x.w * right.z.x + left.y.w * right.z.y + left.z.w * right.z.z + left.w.w * right.z.w
+ left.X.X * right.Z.X + left.Y.X * right.Z.Y + left.Z.X * right.Z.Z + left.W.X * right.Z.W,
+ left.X.Y * right.Z.X + left.Y.Y * right.Z.Y + left.Z.Y * right.Z.Z + left.W.Y * right.Z.W,
+ left.X.Z * right.Z.X + left.Y.Z * right.Z.Y + left.Z.Z * right.Z.Z + left.W.Z * right.Z.W,
+ left.X.W * right.Z.X + left.Y.W * right.Z.Y + left.Z.W * right.Z.Z + left.W.W * right.Z.W
), new Vector4(
- left.x.x * right.w.x + left.y.x * right.w.y + left.z.x * right.w.z + left.w.x * right.w.w,
- left.x.y * right.w.x + left.y.y * right.w.y + left.z.y * right.w.z + left.w.y * right.w.w,
- left.x.z * right.w.x + left.y.z * right.w.y + left.z.z * right.w.z + left.w.z * right.w.w,
- left.x.w * right.w.x + left.y.w * right.w.y + left.z.w * right.w.z + left.w.w * right.w.w
+ left.X.X * right.W.X + left.Y.X * right.W.Y + left.Z.X * right.W.Z + left.W.X * right.W.W,
+ left.X.Y * right.W.X + left.Y.Y * right.W.Y + left.Z.Y * right.W.Z + left.W.Y * right.W.W,
+ left.X.Z * right.W.X + left.Y.Z * right.W.Y + left.Z.Z * right.W.Z + left.W.Z * right.W.W,
+ left.X.W * right.W.X + left.Y.W * right.W.Y + left.Z.W * right.W.Z + left.W.W * right.W.W
)
);
}
@@ -897,10 +897,10 @@ namespace Godot
public static Vector4 operator *(Projection proj, Vector4 vector)
{
return new Vector4(
- proj.x.x * vector.x + proj.y.x * vector.y + proj.z.x * vector.z + proj.w.x * vector.w,
- proj.x.y * vector.x + proj.y.y * vector.y + proj.z.y * vector.z + proj.w.y * vector.w,
- proj.x.z * vector.x + proj.y.z * vector.y + proj.z.z * vector.z + proj.w.z * vector.w,
- proj.x.w * vector.x + proj.y.w * vector.y + proj.z.w * vector.z + proj.w.w * vector.w
+ proj.X.X * vector.X + proj.Y.X * vector.Y + proj.Z.X * vector.Z + proj.W.X * vector.W,
+ proj.X.Y * vector.X + proj.Y.Y * vector.Y + proj.Z.Y * vector.Z + proj.W.Y * vector.W,
+ proj.X.Z * vector.X + proj.Y.Z * vector.Y + proj.Z.Z * vector.Z + proj.W.Z * vector.W,
+ proj.X.W * vector.X + proj.Y.W * vector.Y + proj.Z.W * vector.Z + proj.W.W * vector.W
);
}
@@ -913,10 +913,10 @@ namespace Godot
public static Vector4 operator *(Vector4 vector, Projection proj)
{
return new Vector4(
- proj.x.x * vector.x + proj.x.y * vector.y + proj.x.z * vector.z + proj.x.w * vector.w,
- proj.y.x * vector.x + proj.y.y * vector.y + proj.y.z * vector.z + proj.y.w * vector.w,
- proj.z.x * vector.x + proj.z.y * vector.y + proj.z.z * vector.z + proj.z.w * vector.w,
- proj.w.x * vector.x + proj.w.y * vector.y + proj.w.z * vector.z + proj.w.w * vector.w
+ proj.X.X * vector.X + proj.X.Y * vector.Y + proj.X.Z * vector.Z + proj.X.W * vector.W,
+ proj.Y.X * vector.X + proj.Y.Y * vector.Y + proj.Y.Z * vector.Z + proj.Y.W * vector.W,
+ proj.Z.X * vector.X + proj.Z.Y * vector.Y + proj.Z.Z * vector.Z + proj.Z.W * vector.W,
+ proj.W.X * vector.X + proj.W.Y * vector.Y + proj.W.Z * vector.Z + proj.W.W * vector.W
);
}
@@ -929,11 +929,11 @@ namespace Godot
public static Vector3 operator *(Projection proj, Vector3 vector)
{
Vector3 ret = new Vector3(
- proj.x.x * vector.x + proj.y.x * vector.y + proj.z.x * vector.z + proj.w.x,
- proj.x.y * vector.x + proj.y.y * vector.y + proj.z.y * vector.z + proj.w.y,
- proj.x.z * vector.x + proj.y.z * vector.y + proj.z.z * vector.z + proj.w.z
+ proj.X.X * vector.X + proj.Y.X * vector.Y + proj.Z.X * vector.Z + proj.W.X,
+ proj.X.Y * vector.X + proj.Y.Y * vector.Y + proj.Z.Y * vector.Z + proj.W.Y,
+ proj.X.Z * vector.X + proj.Y.Z * vector.Y + proj.Z.Z * vector.Z + proj.W.Z
);
- return ret / (proj.x.w * vector.x + proj.y.w * vector.y + proj.z.w * vector.z + proj.w.w);
+ return ret / (proj.X.W * vector.X + proj.Y.W * vector.Y + proj.Z.W * vector.Z + proj.W.W);
}
/// <summary>
@@ -966,11 +966,11 @@ namespace Godot
{
return new Transform3D(
new Basis(
- new Vector3(proj.x.x, proj.x.y, proj.x.z),
- new Vector3(proj.y.x, proj.y.y, proj.y.z),
- new Vector3(proj.z.x, proj.z.y, proj.z.z)
+ new Vector3(proj.X.X, proj.X.Y, proj.X.Z),
+ new Vector3(proj.Y.X, proj.Y.Y, proj.Y.Z),
+ new Vector3(proj.Z.X, proj.Z.Y, proj.Z.Z)
),
- new Vector3(proj.w.x, proj.w.y, proj.w.z)
+ new Vector3(proj.W.X, proj.W.Y, proj.W.Z)
);
}
@@ -992,7 +992,7 @@ namespace Godot
/// <returns>Whether or not the projections are exactly equal.</returns>
public readonly bool Equals(Projection other)
{
- return x == other.x && y == other.y && z == other.z && w == other.w;
+ return X == other.X && Y == other.Y && Z == other.Z && W == other.W;
}
/// <summary>
@@ -1001,7 +1001,7 @@ namespace Godot
/// <returns>A hash code for this projection.</returns>
public override readonly int GetHashCode()
{
- return y.GetHashCode() ^ x.GetHashCode() ^ z.GetHashCode() ^ w.GetHashCode();
+ return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode() ^ W.GetHashCode();
}
/// <summary>
@@ -1010,7 +1010,7 @@ namespace Godot
/// <returns>A string representation of this projection.</returns>
public override readonly string ToString()
{
- return $"{x.x}, {x.y}, {x.z}, {x.w}\n{y.x}, {y.y}, {y.z}, {y.w}\n{z.x}, {z.y}, {z.z}, {z.w}\n{w.x}, {w.y}, {w.z}, {w.w}\n";
+ return $"{X.X}, {X.Y}, {X.Z}, {X.W}\n{Y.X}, {Y.Y}, {Y.Z}, {Y.W}\n{Z.X}, {Z.Y}, {Z.Z}, {Z.W}\n{W.X}, {W.Y}, {W.Z}, {W.W}\n";
}
/// <summary>
@@ -1019,10 +1019,10 @@ namespace Godot
/// <returns>A string representation of this projection.</returns>
public readonly string ToString(string format)
{
- return $"{x.x.ToString(format)}, {x.y.ToString(format)}, {x.z.ToString(format)}, {x.w.ToString(format)}\n" +
- $"{y.x.ToString(format)}, {y.y.ToString(format)}, {y.z.ToString(format)}, {y.w.ToString(format)}\n" +
- $"{z.x.ToString(format)}, {z.y.ToString(format)}, {z.z.ToString(format)}, {z.w.ToString(format)}\n" +
- $"{w.x.ToString(format)}, {w.y.ToString(format)}, {w.z.ToString(format)}, {w.w.ToString(format)}\n";
+ return $"{X.X.ToString(format)}, {X.Y.ToString(format)}, {X.Z.ToString(format)}, {X.W.ToString(format)}\n" +
+ $"{Y.X.ToString(format)}, {Y.Y.ToString(format)}, {Y.Z.ToString(format)}, {Y.W.ToString(format)}\n" +
+ $"{Z.X.ToString(format)}, {Z.Y.ToString(format)}, {Z.Z.ToString(format)}, {Z.W.ToString(format)}\n" +
+ $"{W.X.ToString(format)}, {W.Y.ToString(format)}, {W.Z.ToString(format)}, {W.W.ToString(format)}\n";
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs
index 8e4f9178f7..9c2a6fc654 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs
@@ -24,25 +24,25 @@ namespace Godot
/// X component of the quaternion (imaginary <c>i</c> axis part).
/// Quaternion components should usually not be manipulated directly.
/// </summary>
- public real_t x;
+ public real_t X;
/// <summary>
/// Y component of the quaternion (imaginary <c>j</c> axis part).
/// Quaternion components should usually not be manipulated directly.
/// </summary>
- public real_t y;
+ public real_t Y;
/// <summary>
/// Z component of the quaternion (imaginary <c>k</c> axis part).
/// Quaternion components should usually not be manipulated directly.
/// </summary>
- public real_t z;
+ public real_t Z;
/// <summary>
/// W component of the quaternion (real part).
/// Quaternion components should usually not be manipulated directly.
/// </summary>
- public real_t w;
+ public real_t W;
/// <summary>
/// Access quaternion components using their index.
@@ -51,10 +51,10 @@ namespace Godot
/// <paramref name="index"/> is not 0, 1, 2 or 3.
/// </exception>
/// <value>
- /// <c>[0]</c> is equivalent to <see cref="x"/>,
- /// <c>[1]</c> is equivalent to <see cref="y"/>,
- /// <c>[2]</c> is equivalent to <see cref="z"/>,
- /// <c>[3]</c> is equivalent to <see cref="w"/>.
+ /// <c>[0]</c> is equivalent to <see cref="X"/>,
+ /// <c>[1]</c> is equivalent to <see cref="Y"/>,
+ /// <c>[2]</c> is equivalent to <see cref="Z"/>,
+ /// <c>[3]</c> is equivalent to <see cref="W"/>.
/// </value>
public real_t this[int index]
{
@@ -63,13 +63,13 @@ namespace Godot
switch (index)
{
case 0:
- return x;
+ return X;
case 1:
- return y;
+ return Y;
case 2:
- return z;
+ return Z;
case 3:
- return w;
+ return W;
default:
throw new ArgumentOutOfRangeException(nameof(index));
}
@@ -79,16 +79,16 @@ namespace Godot
switch (index)
{
case 0:
- x = value;
+ X = value;
break;
case 1:
- y = value;
+ Y = value;
break;
case 2:
- z = value;
+ Z = value;
break;
case 3:
- w = value;
+ W = value;
break;
default:
throw new ArgumentOutOfRangeException(nameof(index));
@@ -155,9 +155,9 @@ namespace Godot
Quaternion lnPre = (fromQ.Inverse() * preQ).Log();
Quaternion lnPost = (fromQ.Inverse() * postQ).Log();
Quaternion ln = new Quaternion(
- Mathf.CubicInterpolate(lnFrom.x, lnTo.x, lnPre.x, lnPost.x, weight),
- Mathf.CubicInterpolate(lnFrom.y, lnTo.y, lnPre.y, lnPost.y, weight),
- Mathf.CubicInterpolate(lnFrom.z, lnTo.z, lnPre.z, lnPost.z, weight),
+ Mathf.CubicInterpolate(lnFrom.X, lnTo.X, lnPre.X, lnPost.X, weight),
+ Mathf.CubicInterpolate(lnFrom.Y, lnTo.Y, lnPre.Y, lnPost.Y, weight),
+ Mathf.CubicInterpolate(lnFrom.Z, lnTo.Z, lnPre.Z, lnPost.Z, weight),
0);
Quaternion q1 = fromQ * ln.Exp();
@@ -167,9 +167,9 @@ namespace Godot
lnPre = (toQ.Inverse() * preQ).Log();
lnPost = (toQ.Inverse() * postQ).Log();
ln = new Quaternion(
- Mathf.CubicInterpolate(lnFrom.x, lnTo.x, lnPre.x, lnPost.x, weight),
- Mathf.CubicInterpolate(lnFrom.y, lnTo.y, lnPre.y, lnPost.y, weight),
- Mathf.CubicInterpolate(lnFrom.z, lnTo.z, lnPre.z, lnPost.z, weight),
+ Mathf.CubicInterpolate(lnFrom.X, lnTo.X, lnPre.X, lnPost.X, weight),
+ Mathf.CubicInterpolate(lnFrom.Y, lnTo.Y, lnPre.Y, lnPost.Y, weight),
+ Mathf.CubicInterpolate(lnFrom.Z, lnTo.Z, lnPre.Z, lnPost.Z, weight),
0);
Quaternion q2 = toQ * ln.Exp();
@@ -224,9 +224,9 @@ namespace Godot
Quaternion lnPre = (fromQ.Inverse() * preQ).Log();
Quaternion lnPost = (fromQ.Inverse() * postQ).Log();
Quaternion ln = new Quaternion(
- Mathf.CubicInterpolateInTime(lnFrom.x, lnTo.x, lnPre.x, lnPost.x, weight, bT, preAT, postBT),
- Mathf.CubicInterpolateInTime(lnFrom.y, lnTo.y, lnPre.y, lnPost.y, weight, bT, preAT, postBT),
- Mathf.CubicInterpolateInTime(lnFrom.z, lnTo.z, lnPre.z, lnPost.z, weight, bT, preAT, postBT),
+ Mathf.CubicInterpolateInTime(lnFrom.X, lnTo.X, lnPre.X, lnPost.X, weight, bT, preAT, postBT),
+ Mathf.CubicInterpolateInTime(lnFrom.Y, lnTo.Y, lnPre.Y, lnPost.Y, weight, bT, preAT, postBT),
+ Mathf.CubicInterpolateInTime(lnFrom.Z, lnTo.Z, lnPre.Z, lnPost.Z, weight, bT, preAT, postBT),
0);
Quaternion q1 = fromQ * ln.Exp();
@@ -236,9 +236,9 @@ namespace Godot
lnPre = (toQ.Inverse() * preQ).Log();
lnPost = (toQ.Inverse() * postQ).Log();
ln = new Quaternion(
- Mathf.CubicInterpolateInTime(lnFrom.x, lnTo.x, lnPre.x, lnPost.x, weight, bT, preAT, postBT),
- Mathf.CubicInterpolateInTime(lnFrom.y, lnTo.y, lnPre.y, lnPost.y, weight, bT, preAT, postBT),
- Mathf.CubicInterpolateInTime(lnFrom.z, lnTo.z, lnPre.z, lnPost.z, weight, bT, preAT, postBT),
+ Mathf.CubicInterpolateInTime(lnFrom.X, lnTo.X, lnPre.X, lnPost.X, weight, bT, preAT, postBT),
+ Mathf.CubicInterpolateInTime(lnFrom.Y, lnTo.Y, lnPre.Y, lnPost.Y, weight, bT, preAT, postBT),
+ Mathf.CubicInterpolateInTime(lnFrom.Z, lnTo.Z, lnPre.Z, lnPost.Z, weight, bT, preAT, postBT),
0);
Quaternion q2 = toQ * ln.Exp();
@@ -253,12 +253,12 @@ namespace Godot
/// <returns>The dot product.</returns>
public readonly real_t Dot(Quaternion b)
{
- return (x * b.x) + (y * b.y) + (z * b.z) + (w * b.w);
+ return (X * b.X) + (Y * b.Y) + (Z * b.Z) + (W * b.W);
}
public readonly Quaternion Exp()
{
- Vector3 v = new Vector3(x, y, z);
+ Vector3 v = new Vector3(X, Y, Z);
real_t theta = v.Length();
v = v.Normalized();
if (theta < Mathf.Epsilon || !v.IsNormalized())
@@ -270,18 +270,18 @@ namespace Godot
public readonly real_t GetAngle()
{
- return 2 * Mathf.Acos(w);
+ return 2 * Mathf.Acos(W);
}
public readonly Vector3 GetAxis()
{
- if (Mathf.Abs(w) > 1 - Mathf.Epsilon)
+ if (Mathf.Abs(W) > 1 - Mathf.Epsilon)
{
- return new Vector3(x, y, z);
+ return new Vector3(X, Y, Z);
}
- real_t r = 1 / Mathf.Sqrt(1 - w * w);
- return new Vector3(x * r, y * r, z * r);
+ real_t r = 1 / Mathf.Sqrt(1 - W * W);
+ return new Vector3(X * r, Y * r, Z * r);
}
/// <summary>
@@ -315,7 +315,7 @@ namespace Godot
throw new InvalidOperationException("Quaternion is not normalized.");
}
#endif
- return new Quaternion(-x, -y, -z, w);
+ return new Quaternion(-X, -Y, -Z, W);
}
/// <summary>
@@ -325,7 +325,7 @@ namespace Godot
/// <returns>Whether this vector is finite or not.</returns>
public readonly bool IsFinite()
{
- return Mathf.IsFinite(x) && Mathf.IsFinite(y) && Mathf.IsFinite(z) && Mathf.IsFinite(w);
+ return Mathf.IsFinite(X) && Mathf.IsFinite(Y) && Mathf.IsFinite(Z) && Mathf.IsFinite(W);
}
/// <summary>
@@ -340,7 +340,7 @@ namespace Godot
public readonly Quaternion Log()
{
Vector3 v = GetAxis() * GetAngle();
- return new Quaternion(v.x, v.y, v.z, 0);
+ return new Quaternion(v.X, v.Y, v.Z, 0);
}
/// <summary>
@@ -432,10 +432,10 @@ namespace Godot
// Calculate final values.
return new Quaternion
(
- (scale0 * x) + (scale1 * to1.x),
- (scale0 * y) + (scale1 * to1.y),
- (scale0 * z) + (scale1 * to1.z),
- (scale0 * w) + (scale1 * to1.w)
+ (scale0 * X) + (scale1 * to1.X),
+ (scale0 * Y) + (scale1 * to1.Y),
+ (scale0 * Z) + (scale1 * to1.Z),
+ (scale0 * W) + (scale1 * to1.W)
);
}
@@ -474,10 +474,10 @@ namespace Godot
return new Quaternion
(
- (invFactor * x) + (newFactor * to.x),
- (invFactor * y) + (newFactor * to.y),
- (invFactor * z) + (newFactor * to.z),
- (invFactor * w) + (newFactor * to.w)
+ (invFactor * X) + (newFactor * to.X),
+ (invFactor * Y) + (newFactor * to.Y),
+ (invFactor * Z) + (newFactor * to.Z),
+ (invFactor * W) + (newFactor * to.W)
);
}
@@ -501,10 +501,10 @@ namespace Godot
/// <param name="w">W component of the quaternion (real part).</param>
public Quaternion(real_t x, real_t y, real_t z, real_t w)
{
- this.x = x;
- this.y = y;
- this.z = z;
- this.w = w;
+ X = x;
+ Y = y;
+ Z = z;
+ W = w;
}
/// <summary>
@@ -535,20 +535,20 @@ namespace Godot
if (d == 0f)
{
- x = 0f;
- y = 0f;
- z = 0f;
- w = 0f;
+ X = 0f;
+ Y = 0f;
+ Z = 0f;
+ W = 0f;
}
else
{
(real_t sin, real_t cos) = Mathf.SinCos(angle * 0.5f);
real_t s = sin / d;
- x = axis.x * s;
- y = axis.y * s;
- z = axis.z * s;
- w = cos;
+ X = axis.X * s;
+ Y = axis.Y * s;
+ Z = axis.Z * s;
+ W = cos;
}
}
@@ -559,20 +559,20 @@ namespace Godot
if (d < -1.0f + Mathf.Epsilon)
{
- x = 0f;
- y = 1f;
- z = 0f;
- w = 0f;
+ X = 0f;
+ Y = 1f;
+ Z = 0f;
+ W = 0f;
}
else
{
real_t s = Mathf.Sqrt((1.0f + d) * 2.0f);
real_t rs = 1.0f / s;
- x = c.x * rs;
- y = c.y * rs;
- z = c.z * rs;
- w = s * 0.5f;
+ X = c.X * rs;
+ Y = c.Y * rs;
+ Z = c.Z * rs;
+ W = s * 0.5f;
}
}
@@ -584,9 +584,9 @@ namespace Godot
/// <param name="eulerYXZ">Euler angles that the quaternion will be rotated by.</param>
public static Quaternion FromEuler(Vector3 eulerYXZ)
{
- real_t halfA1 = eulerYXZ.y * 0.5f;
- real_t halfA2 = eulerYXZ.x * 0.5f;
- real_t halfA3 = eulerYXZ.z * 0.5f;
+ real_t halfA1 = eulerYXZ.Y * 0.5f;
+ real_t halfA2 = eulerYXZ.X * 0.5f;
+ real_t halfA3 = eulerYXZ.Z * 0.5f;
// R = Y(a1).X(a2).Z(a3) convention for Euler angles.
// Conversion to quaternion as listed in https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19770024290.pdf (page A-6)
@@ -616,10 +616,10 @@ namespace Godot
{
return new Quaternion
(
- (left.w * right.x) + (left.x * right.w) + (left.y * right.z) - (left.z * right.y),
- (left.w * right.y) + (left.y * right.w) + (left.z * right.x) - (left.x * right.z),
- (left.w * right.z) + (left.z * right.w) + (left.x * right.y) - (left.y * right.x),
- (left.w * right.w) - (left.x * right.x) - (left.y * right.y) - (left.z * right.z)
+ (left.W * right.X) + (left.X * right.W) + (left.Y * right.Z) - (left.Z * right.Y),
+ (left.W * right.Y) + (left.Y * right.W) + (left.Z * right.X) - (left.X * right.Z),
+ (left.W * right.Z) + (left.Z * right.W) + (left.X * right.Y) - (left.Y * right.X),
+ (left.W * right.W) - (left.X * right.X) - (left.Y * right.Y) - (left.Z * right.Z)
);
}
@@ -637,9 +637,9 @@ namespace Godot
throw new InvalidOperationException("Quaternion is not normalized.");
}
#endif
- var u = new Vector3(quaternion.x, quaternion.y, quaternion.z);
+ var u = new Vector3(quaternion.X, quaternion.Y, quaternion.Z);
Vector3 uv = u.Cross(vector);
- return vector + (((uv * quaternion.w) + u.Cross(uv)) * 2);
+ return vector + (((uv * quaternion.W) + u.Cross(uv)) * 2);
}
/// <summary>
@@ -665,7 +665,7 @@ namespace Godot
/// <returns>The added quaternion.</returns>
public static Quaternion operator +(Quaternion left, Quaternion right)
{
- return new Quaternion(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w);
+ return new Quaternion(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W);
}
/// <summary>
@@ -679,20 +679,20 @@ namespace Godot
/// <returns>The subtracted quaternion.</returns>
public static Quaternion operator -(Quaternion left, Quaternion right)
{
- return new Quaternion(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w);
+ return new Quaternion(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W);
}
/// <summary>
/// Returns the negative value of the <see cref="Quaternion"/>.
/// This is the same as writing
- /// <c>new Quaternion(-q.x, -q.y, -q.z, -q.w)</c>. This operation
+ /// <c>new Quaternion(-q.X, -q.Y, -q.Z, -q.W)</c>. This operation
/// results in a quaternion that represents the same rotation.
/// </summary>
/// <param name="quat">The quaternion to negate.</param>
/// <returns>The negated quaternion.</returns>
public static Quaternion operator -(Quaternion quat)
{
- return new Quaternion(-quat.x, -quat.y, -quat.z, -quat.w);
+ return new Quaternion(-quat.X, -quat.Y, -quat.Z, -quat.W);
}
/// <summary>
@@ -706,7 +706,7 @@ namespace Godot
/// <returns>The multiplied quaternion.</returns>
public static Quaternion operator *(Quaternion left, real_t right)
{
- return new Quaternion(left.x * right, left.y * right, left.z * right, left.w * right);
+ return new Quaternion(left.X * right, left.Y * right, left.Z * right, left.W * right);
}
/// <summary>
@@ -720,7 +720,7 @@ namespace Godot
/// <returns>The multiplied quaternion.</returns>
public static Quaternion operator *(real_t left, Quaternion right)
{
- return new Quaternion(right.x * left, right.y * left, right.z * left, right.w * left);
+ return new Quaternion(right.X * left, right.Y * left, right.Z * left, right.W * left);
}
/// <summary>
@@ -780,7 +780,7 @@ namespace Godot
/// <returns>Whether or not the quaternions are exactly equal.</returns>
public readonly bool Equals(Quaternion other)
{
- return x == other.x && y == other.y && z == other.z && w == other.w;
+ return X == other.X && Y == other.Y && Z == other.Z && W == other.W;
}
/// <summary>
@@ -791,7 +791,7 @@ namespace Godot
/// <returns>Whether or not the quaternions are approximately equal.</returns>
public readonly bool IsEqualApprox(Quaternion other)
{
- return Mathf.IsEqualApprox(x, other.x) && Mathf.IsEqualApprox(y, other.y) && Mathf.IsEqualApprox(z, other.z) && Mathf.IsEqualApprox(w, other.w);
+ return Mathf.IsEqualApprox(X, other.X) && Mathf.IsEqualApprox(Y, other.Y) && Mathf.IsEqualApprox(Z, other.Z) && Mathf.IsEqualApprox(W, other.W);
}
/// <summary>
@@ -800,7 +800,7 @@ namespace Godot
/// <returns>A hash code for this quaternion.</returns>
public override readonly int GetHashCode()
{
- return y.GetHashCode() ^ x.GetHashCode() ^ z.GetHashCode() ^ w.GetHashCode();
+ return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode() ^ W.GetHashCode();
}
/// <summary>
@@ -809,7 +809,7 @@ namespace Godot
/// <returns>A string representation of this quaternion.</returns>
public override readonly string ToString()
{
- return $"({x}, {y}, {z}, {w})";
+ return $"({X}, {Y}, {Z}, {W})";
}
/// <summary>
@@ -818,7 +818,7 @@ namespace Godot
/// <returns>A string representation of this quaternion.</returns>
public readonly string ToString(string format)
{
- return $"({x.ToString(format)}, {y.ToString(format)}, {z.ToString(format)}, {w.ToString(format)})";
+ return $"({X.ToString(format)}, {Y.ToString(format)}, {Z.ToString(format)}, {W.ToString(format)})";
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/RID.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/RID.cs
deleted file mode 100644
index 59b9faf16c..0000000000
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/RID.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using Godot.NativeInterop;
-
-namespace Godot
-{
- /// <summary>
- /// The RID type is used to access the unique integer ID of a resource.
- /// They are opaque, which means they do not grant access to the associated
- /// resource by themselves. They are used by and with the low-level Server
- /// classes such as <see cref="RenderingServer"/>.
- /// </summary>
- [StructLayout(LayoutKind.Sequential)]
- public readonly struct RID
- {
- private readonly ulong _id; // Default is 0
-
- internal RID(ulong id)
- {
- _id = id;
- }
-
- /// <summary>
- /// Constructs a new <see cref="RID"/> for the given <see cref="Object"/> <paramref name="from"/>.
- /// </summary>
- public RID(Object from)
- => _id = from is Resource res ? res.GetRid()._id : default;
-
- /// <summary>
- /// Returns the ID of the referenced resource.
- /// </summary>
- /// <returns>The ID of the referenced resource.</returns>
- public ulong Id => _id;
-
- /// <summary>
- /// Converts this <see cref="RID"/> to a string.
- /// </summary>
- /// <returns>A string representation of this RID.</returns>
- public override string ToString() => $"RID({Id})";
- }
-}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
index 1a8696d3bc..69444f8035 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
@@ -51,11 +51,11 @@ namespace Godot
/// <summary>
/// The area of this <see cref="Rect2"/>.
+ /// See also <see cref="HasArea"/>.
/// </summary>
- /// <value>Equivalent to <see cref="GetArea()"/>.</value>
public readonly real_t Area
{
- get { return GetArea(); }
+ get { return _size.X * _size.Y; }
}
/// <summary>
@@ -66,7 +66,7 @@ namespace Godot
public readonly Rect2 Abs()
{
Vector2 end = End;
- Vector2 topLeft = new Vector2(Mathf.Min(_position.x, end.x), Mathf.Min(_position.y, end.y));
+ Vector2 topLeft = new Vector2(Mathf.Min(_position.X, end.X), Mathf.Min(_position.Y, end.Y));
return new Rect2(topLeft, _size.Abs());
}
@@ -88,14 +88,14 @@ namespace Godot
return new Rect2();
}
- newRect._position.x = Mathf.Max(b._position.x, _position.x);
- newRect._position.y = Mathf.Max(b._position.y, _position.y);
+ newRect._position.X = Mathf.Max(b._position.X, _position.X);
+ newRect._position.Y = Mathf.Max(b._position.Y, _position.Y);
Vector2 bEnd = b._position + b._size;
Vector2 end = _position + _size;
- newRect._size.x = Mathf.Min(bEnd.x, end.x) - newRect._position.x;
- newRect._size.y = Mathf.Min(bEnd.y, end.y) - newRect._position.y;
+ newRect._size.X = Mathf.Min(bEnd.X, end.X) - newRect._position.X;
+ newRect._size.Y = Mathf.Min(bEnd.Y, end.Y) - newRect._position.Y;
return newRect;
}
@@ -119,9 +119,9 @@ namespace Godot
/// </returns>
public readonly bool Encloses(Rect2 b)
{
- return b._position.x >= _position.x && b._position.y >= _position.y &&
- b._position.x + b._size.x < _position.x + _size.x &&
- b._position.y + b._size.y < _position.y + _size.y;
+ return b._position.X >= _position.X && b._position.Y >= _position.Y &&
+ b._position.X + b._size.X < _position.X + _size.X &&
+ b._position.Y + b._size.Y < _position.Y + _size.Y;
}
/// <summary>
@@ -136,22 +136,22 @@ namespace Godot
Vector2 begin = expanded._position;
Vector2 end = expanded._position + expanded._size;
- if (to.x < begin.x)
+ if (to.X < begin.X)
{
- begin.x = to.x;
+ begin.X = to.X;
}
- if (to.y < begin.y)
+ if (to.Y < begin.Y)
{
- begin.y = to.y;
+ begin.Y = to.Y;
}
- if (to.x > end.x)
+ if (to.X > end.X)
{
- end.x = to.x;
+ end.X = to.X;
}
- if (to.y > end.y)
+ if (to.Y > end.Y)
{
- end.y = to.y;
+ end.Y = to.Y;
}
expanded._position = begin;
@@ -161,15 +161,6 @@ namespace Godot
}
/// <summary>
- /// Returns the area of the <see cref="Rect2"/>.
- /// </summary>
- /// <returns>The area.</returns>
- public readonly real_t GetArea()
- {
- return _size.x * _size.y;
- }
-
- /// <summary>
/// Returns the center of the <see cref="Rect2"/>, which is equal
/// to <see cref="Position"/> + (<see cref="Size"/> / 2).
/// </summary>
@@ -191,10 +182,10 @@ namespace Godot
{
Rect2 g = this;
- g._position.x -= by;
- g._position.y -= by;
- g._size.x += by * 2;
- g._size.y += by * 2;
+ g._position.X -= by;
+ g._position.Y -= by;
+ g._size.X += by * 2;
+ g._size.Y += by * 2;
return g;
}
@@ -214,10 +205,10 @@ namespace Godot
{
Rect2 g = this;
- g._position.x -= left;
- g._position.y -= top;
- g._size.x += left + right;
- g._size.y += top + bottom;
+ g._position.X -= left;
+ g._position.Y -= top;
+ g._size.X += left + right;
+ g._size.Y += top + bottom;
return g;
}
@@ -247,14 +238,14 @@ namespace Godot
/// Returns <see langword="true"/> if the <see cref="Rect2"/> has
/// area, and <see langword="false"/> if the <see cref="Rect2"/>
/// is linear, empty, or has a negative <see cref="Size"/>.
- /// See also <see cref="GetArea"/>.
+ /// See also <see cref="Area"/>.
/// </summary>
/// <returns>
/// A <see langword="bool"/> for whether or not the <see cref="Rect2"/> has area.
/// </returns>
public readonly bool HasArea()
{
- return _size.x > 0.0f && _size.y > 0.0f;
+ return _size.X > 0.0f && _size.Y > 0.0f;
}
/// <summary>
@@ -267,14 +258,14 @@ namespace Godot
/// </returns>
public readonly bool HasPoint(Vector2 point)
{
- if (point.x < _position.x)
+ if (point.X < _position.X)
return false;
- if (point.y < _position.y)
+ if (point.Y < _position.Y)
return false;
- if (point.x >= _position.x + _size.x)
+ if (point.X >= _position.X + _size.X)
return false;
- if (point.y >= _position.y + _size.y)
+ if (point.Y >= _position.Y + _size.Y)
return false;
return true;
@@ -295,38 +286,38 @@ namespace Godot
{
if (includeBorders)
{
- if (_position.x > b._position.x + b._size.x)
+ if (_position.X > b._position.X + b._size.X)
{
return false;
}
- if (_position.x + _size.x < b._position.x)
+ if (_position.X + _size.X < b._position.X)
{
return false;
}
- if (_position.y > b._position.y + b._size.y)
+ if (_position.Y > b._position.Y + b._size.Y)
{
return false;
}
- if (_position.y + _size.y < b._position.y)
+ if (_position.Y + _size.Y < b._position.Y)
{
return false;
}
}
else
{
- if (_position.x >= b._position.x + b._size.x)
+ if (_position.X >= b._position.X + b._size.X)
{
return false;
}
- if (_position.x + _size.x <= b._position.x)
+ if (_position.X + _size.X <= b._position.X)
{
return false;
}
- if (_position.y >= b._position.y + b._size.y)
+ if (_position.Y >= b._position.Y + b._size.Y)
{
return false;
}
- if (_position.y + _size.y <= b._position.y)
+ if (_position.Y + _size.Y <= b._position.Y)
{
return false;
}
@@ -344,11 +335,11 @@ namespace Godot
{
Rect2 newRect;
- newRect._position.x = Mathf.Min(b._position.x, _position.x);
- newRect._position.y = Mathf.Min(b._position.y, _position.y);
+ newRect._position.X = Mathf.Min(b._position.X, _position.X);
+ newRect._position.Y = Mathf.Min(b._position.Y, _position.Y);
- newRect._size.x = Mathf.Max(b._position.x + b._size.x, _position.x + _size.x);
- newRect._size.y = Mathf.Max(b._position.y + b._size.y, _position.y + _size.y);
+ newRect._size.X = Mathf.Max(b._position.X + b._size.X, _position.X + _size.X);
+ newRect._size.Y = Mathf.Max(b._position.Y + b._size.Y, _position.Y + _size.Y);
newRect._size -= newRect._position; // Make relative again
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2I.cs
index cf8939a859..2099d0abca 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2I.cs
@@ -4,21 +4,21 @@ using System.Runtime.InteropServices;
namespace Godot
{
/// <summary>
- /// 2D axis-aligned bounding box using integers. Rect2i consists of a position, a size, and
+ /// 2D axis-aligned bounding box using integers. Rect2I consists of a position, a size, and
/// several utility functions. It is typically used for fast overlap tests.
/// </summary>
[Serializable]
[StructLayout(LayoutKind.Sequential)]
- public struct Rect2i : IEquatable<Rect2i>
+ public struct Rect2I : IEquatable<Rect2I>
{
- private Vector2i _position;
- private Vector2i _size;
+ private Vector2I _position;
+ private Vector2I _size;
/// <summary>
/// Beginning corner. Typically has values lower than <see cref="End"/>.
/// </summary>
/// <value>Directly uses a private field.</value>
- public Vector2i Position
+ public Vector2I Position
{
readonly get { return _position; }
set { _position = value; }
@@ -29,7 +29,7 @@ namespace Godot
/// If the size is negative, you can use <see cref="Abs"/> to fix it.
/// </summary>
/// <value>Directly uses a private field.</value>
- public Vector2i Size
+ public Vector2I Size
{
readonly get { return _size; }
set { _size = value; }
@@ -43,105 +43,105 @@ namespace Godot
/// Getting is equivalent to <paramref name="value"/> = <see cref="Position"/> + <see cref="Size"/>,
/// setting is equivalent to <see cref="Size"/> = <paramref name="value"/> - <see cref="Position"/>
/// </value>
- public Vector2i End
+ public Vector2I End
{
readonly get { return _position + _size; }
set { _size = value - _position; }
}
/// <summary>
- /// The area of this <see cref="Rect2i"/>.
+ /// The area of this <see cref="Rect2I"/>.
+ /// See also <see cref="HasArea"/>.
/// </summary>
- /// <value>Equivalent to <see cref="GetArea()"/>.</value>
public readonly int Area
{
- get { return GetArea(); }
+ get { return _size.X * _size.Y; }
}
/// <summary>
- /// Returns a <see cref="Rect2i"/> with equivalent position and size, modified so that
+ /// Returns a <see cref="Rect2I"/> with equivalent position and size, modified so that
/// the top-left corner is the origin and width and height are positive.
/// </summary>
- /// <returns>The modified <see cref="Rect2i"/>.</returns>
- public readonly Rect2i Abs()
+ /// <returns>The modified <see cref="Rect2I"/>.</returns>
+ public readonly Rect2I Abs()
{
- Vector2i end = End;
- Vector2i topLeft = new Vector2i(Mathf.Min(_position.x, end.x), Mathf.Min(_position.y, end.y));
- return new Rect2i(topLeft, _size.Abs());
+ Vector2I end = End;
+ Vector2I topLeft = new Vector2I(Mathf.Min(_position.X, end.X), Mathf.Min(_position.Y, end.Y));
+ return new Rect2I(topLeft, _size.Abs());
}
/// <summary>
- /// Returns the intersection of this <see cref="Rect2i"/> and <paramref name="b"/>.
- /// If the rectangles do not intersect, an empty <see cref="Rect2i"/> is returned.
+ /// Returns the intersection of this <see cref="Rect2I"/> and <paramref name="b"/>.
+ /// If the rectangles do not intersect, an empty <see cref="Rect2I"/> is returned.
/// </summary>
- /// <param name="b">The other <see cref="Rect2i"/>.</param>
+ /// <param name="b">The other <see cref="Rect2I"/>.</param>
/// <returns>
- /// The intersection of this <see cref="Rect2i"/> and <paramref name="b"/>,
- /// or an empty <see cref="Rect2i"/> if they do not intersect.
+ /// The intersection of this <see cref="Rect2I"/> and <paramref name="b"/>,
+ /// or an empty <see cref="Rect2I"/> if they do not intersect.
/// </returns>
- public readonly Rect2i Intersection(Rect2i b)
+ public readonly Rect2I Intersection(Rect2I b)
{
- Rect2i newRect = b;
+ Rect2I newRect = b;
if (!Intersects(newRect))
{
- return new Rect2i();
+ return new Rect2I();
}
- newRect._position.x = Mathf.Max(b._position.x, _position.x);
- newRect._position.y = Mathf.Max(b._position.y, _position.y);
+ newRect._position.X = Mathf.Max(b._position.X, _position.X);
+ newRect._position.Y = Mathf.Max(b._position.Y, _position.Y);
- Vector2i bEnd = b._position + b._size;
- Vector2i end = _position + _size;
+ Vector2I bEnd = b._position + b._size;
+ Vector2I end = _position + _size;
- newRect._size.x = Mathf.Min(bEnd.x, end.x) - newRect._position.x;
- newRect._size.y = Mathf.Min(bEnd.y, end.y) - newRect._position.y;
+ newRect._size.X = Mathf.Min(bEnd.X, end.X) - newRect._position.X;
+ newRect._size.Y = Mathf.Min(bEnd.Y, end.Y) - newRect._position.Y;
return newRect;
}
/// <summary>
- /// Returns <see langword="true"/> if this <see cref="Rect2i"/> completely encloses another one.
+ /// Returns <see langword="true"/> if this <see cref="Rect2I"/> completely encloses another one.
/// </summary>
- /// <param name="b">The other <see cref="Rect2i"/> that may be enclosed.</param>
+ /// <param name="b">The other <see cref="Rect2I"/> that may be enclosed.</param>
/// <returns>
- /// A <see langword="bool"/> for whether or not this <see cref="Rect2i"/> encloses <paramref name="b"/>.
+ /// A <see langword="bool"/> for whether or not this <see cref="Rect2I"/> encloses <paramref name="b"/>.
/// </returns>
- public readonly bool Encloses(Rect2i b)
+ public readonly bool Encloses(Rect2I b)
{
- return b._position.x >= _position.x && b._position.y >= _position.y &&
- b._position.x + b._size.x < _position.x + _size.x &&
- b._position.y + b._size.y < _position.y + _size.y;
+ return b._position.X >= _position.X && b._position.Y >= _position.Y &&
+ b._position.X + b._size.X < _position.X + _size.X &&
+ b._position.Y + b._size.Y < _position.Y + _size.Y;
}
/// <summary>
- /// Returns this <see cref="Rect2i"/> expanded to include a given point.
+ /// Returns this <see cref="Rect2I"/> expanded to include a given point.
/// </summary>
/// <param name="to">The point to include.</param>
- /// <returns>The expanded <see cref="Rect2i"/>.</returns>
- public readonly Rect2i Expand(Vector2i to)
+ /// <returns>The expanded <see cref="Rect2I"/>.</returns>
+ public readonly Rect2I Expand(Vector2I to)
{
- Rect2i expanded = this;
+ Rect2I expanded = this;
- Vector2i begin = expanded._position;
- Vector2i end = expanded._position + expanded._size;
+ Vector2I begin = expanded._position;
+ Vector2I end = expanded._position + expanded._size;
- if (to.x < begin.x)
+ if (to.X < begin.X)
{
- begin.x = to.x;
+ begin.X = to.X;
}
- if (to.y < begin.y)
+ if (to.Y < begin.Y)
{
- begin.y = to.y;
+ begin.Y = to.Y;
}
- if (to.x > end.x)
+ if (to.X > end.X)
{
- end.x = to.x;
+ end.X = to.X;
}
- if (to.y > end.y)
+ if (to.Y > end.Y)
{
- end.y = to.y;
+ end.Y = to.Y;
}
expanded._position = begin;
@@ -151,48 +151,39 @@ namespace Godot
}
/// <summary>
- /// Returns the area of the <see cref="Rect2i"/>.
- /// </summary>
- /// <returns>The area.</returns>
- public readonly int GetArea()
- {
- return _size.x * _size.y;
- }
-
- /// <summary>
- /// Returns the center of the <see cref="Rect2i"/>, which is equal
+ /// Returns the center of the <see cref="Rect2I"/>, which is equal
/// to <see cref="Position"/> + (<see cref="Size"/> / 2).
/// If <see cref="Size"/> is an odd number, the returned center
/// value will be rounded towards <see cref="Position"/>.
/// </summary>
/// <returns>The center.</returns>
- public readonly Vector2i GetCenter()
+ public readonly Vector2I GetCenter()
{
return _position + (_size / 2);
}
/// <summary>
- /// Returns a copy of the <see cref="Rect2i"/> grown by the specified amount
+ /// Returns a copy of the <see cref="Rect2I"/> grown by the specified amount
/// on all sides.
/// </summary>
/// <seealso cref="GrowIndividual(int, int, int, int)"/>
/// <seealso cref="GrowSide(Side, int)"/>
/// <param name="by">The amount to grow by.</param>
- /// <returns>The grown <see cref="Rect2i"/>.</returns>
- public readonly Rect2i Grow(int by)
+ /// <returns>The grown <see cref="Rect2I"/>.</returns>
+ public readonly Rect2I Grow(int by)
{
- Rect2i g = this;
+ Rect2I g = this;
- g._position.x -= by;
- g._position.y -= by;
- g._size.x += by * 2;
- g._size.y += by * 2;
+ g._position.X -= by;
+ g._position.Y -= by;
+ g._size.X += by * 2;
+ g._size.Y += by * 2;
return g;
}
/// <summary>
- /// Returns a copy of the <see cref="Rect2i"/> grown by the specified amount
+ /// Returns a copy of the <see cref="Rect2I"/> grown by the specified amount
/// on each side individually.
/// </summary>
/// <seealso cref="Grow(int)"/>
@@ -201,31 +192,31 @@ namespace Godot
/// <param name="top">The amount to grow by on the top side.</param>
/// <param name="right">The amount to grow by on the right side.</param>
/// <param name="bottom">The amount to grow by on the bottom side.</param>
- /// <returns>The grown <see cref="Rect2i"/>.</returns>
- public readonly Rect2i GrowIndividual(int left, int top, int right, int bottom)
+ /// <returns>The grown <see cref="Rect2I"/>.</returns>
+ public readonly Rect2I GrowIndividual(int left, int top, int right, int bottom)
{
- Rect2i g = this;
+ Rect2I g = this;
- g._position.x -= left;
- g._position.y -= top;
- g._size.x += left + right;
- g._size.y += top + bottom;
+ g._position.X -= left;
+ g._position.Y -= top;
+ g._size.X += left + right;
+ g._size.Y += top + bottom;
return g;
}
/// <summary>
- /// Returns a copy of the <see cref="Rect2i"/> grown by the specified amount
+ /// Returns a copy of the <see cref="Rect2I"/> grown by the specified amount
/// on the specified <see cref="Side"/>.
/// </summary>
/// <seealso cref="Grow(int)"/>
/// <seealso cref="GrowIndividual(int, int, int, int)"/>
/// <param name="side">The side to grow.</param>
/// <param name="by">The amount to grow by.</param>
- /// <returns>The grown <see cref="Rect2i"/>.</returns>
- public readonly Rect2i GrowSide(Side side, int by)
+ /// <returns>The grown <see cref="Rect2I"/>.</returns>
+ public readonly Rect2I GrowSide(Side side, int by)
{
- Rect2i g = this;
+ Rect2I g = this;
g = g.GrowIndividual(Side.Left == side ? by : 0,
Side.Top == side ? by : 0,
@@ -236,76 +227,76 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if the <see cref="Rect2i"/> has
- /// area, and <see langword="false"/> if the <see cref="Rect2i"/>
+ /// Returns <see langword="true"/> if the <see cref="Rect2I"/> has
+ /// area, and <see langword="false"/> if the <see cref="Rect2I"/>
/// is linear, empty, or has a negative <see cref="Size"/>.
- /// See also <see cref="GetArea"/>.
+ /// See also <see cref="Area"/>.
/// </summary>
/// <returns>
- /// A <see langword="bool"/> for whether or not the <see cref="Rect2i"/> has area.
+ /// A <see langword="bool"/> for whether or not the <see cref="Rect2I"/> has area.
/// </returns>
public readonly bool HasArea()
{
- return _size.x > 0 && _size.y > 0;
+ return _size.X > 0 && _size.Y > 0;
}
/// <summary>
- /// Returns <see langword="true"/> if the <see cref="Rect2i"/> contains a point,
+ /// Returns <see langword="true"/> if the <see cref="Rect2I"/> contains a point,
/// or <see langword="false"/> otherwise.
/// </summary>
/// <param name="point">The point to check.</param>
/// <returns>
- /// A <see langword="bool"/> for whether or not the <see cref="Rect2i"/> contains <paramref name="point"/>.
+ /// A <see langword="bool"/> for whether or not the <see cref="Rect2I"/> contains <paramref name="point"/>.
/// </returns>
- public readonly bool HasPoint(Vector2i point)
+ public readonly bool HasPoint(Vector2I point)
{
- if (point.x < _position.x)
+ if (point.X < _position.X)
return false;
- if (point.y < _position.y)
+ if (point.Y < _position.Y)
return false;
- if (point.x >= _position.x + _size.x)
+ if (point.X >= _position.X + _size.X)
return false;
- if (point.y >= _position.y + _size.y)
+ if (point.Y >= _position.Y + _size.Y)
return false;
return true;
}
/// <summary>
- /// Returns <see langword="true"/> if the <see cref="Rect2i"/> overlaps with <paramref name="b"/>
+ /// Returns <see langword="true"/> if the <see cref="Rect2I"/> overlaps with <paramref name="b"/>
/// (i.e. they have at least one point in common).
/// </summary>
- /// <param name="b">The other <see cref="Rect2i"/> to check for intersections with.</param>
+ /// <param name="b">The other <see cref="Rect2I"/> to check for intersections with.</param>
/// <returns>A <see langword="bool"/> for whether or not they are intersecting.</returns>
- public readonly bool Intersects(Rect2i b)
+ public readonly bool Intersects(Rect2I b)
{
- if (_position.x >= b._position.x + b._size.x)
+ if (_position.X >= b._position.X + b._size.X)
return false;
- if (_position.x + _size.x <= b._position.x)
+ if (_position.X + _size.X <= b._position.X)
return false;
- if (_position.y >= b._position.y + b._size.y)
+ if (_position.Y >= b._position.Y + b._size.Y)
return false;
- if (_position.y + _size.y <= b._position.y)
+ if (_position.Y + _size.Y <= b._position.Y)
return false;
return true;
}
/// <summary>
- /// Returns a larger <see cref="Rect2i"/> that contains this <see cref="Rect2i"/> and <paramref name="b"/>.
+ /// Returns a larger <see cref="Rect2I"/> that contains this <see cref="Rect2I"/> and <paramref name="b"/>.
/// </summary>
- /// <param name="b">The other <see cref="Rect2i"/>.</param>
- /// <returns>The merged <see cref="Rect2i"/>.</returns>
- public readonly Rect2i Merge(Rect2i b)
+ /// <param name="b">The other <see cref="Rect2I"/>.</param>
+ /// <returns>The merged <see cref="Rect2I"/>.</returns>
+ public readonly Rect2I Merge(Rect2I b)
{
- Rect2i newRect;
+ Rect2I newRect;
- newRect._position.x = Mathf.Min(b._position.x, _position.x);
- newRect._position.y = Mathf.Min(b._position.y, _position.y);
+ newRect._position.X = Mathf.Min(b._position.X, _position.X);
+ newRect._position.Y = Mathf.Min(b._position.Y, _position.Y);
- newRect._size.x = Mathf.Max(b._position.x + b._size.x, _position.x + _size.x);
- newRect._size.y = Mathf.Max(b._position.y + b._size.y, _position.y + _size.y);
+ newRect._size.X = Mathf.Max(b._position.X + b._size.X, _position.X + _size.X);
+ newRect._size.Y = Mathf.Max(b._position.Y + b._size.Y, _position.Y + _size.Y);
newRect._size -= newRect._position; // Make relative again
@@ -313,93 +304,93 @@ namespace Godot
}
/// <summary>
- /// Constructs a <see cref="Rect2i"/> from a position and size.
+ /// Constructs a <see cref="Rect2I"/> from a position and size.
/// </summary>
/// <param name="position">The position.</param>
/// <param name="size">The size.</param>
- public Rect2i(Vector2i position, Vector2i size)
+ public Rect2I(Vector2I position, Vector2I size)
{
_position = position;
_size = size;
}
/// <summary>
- /// Constructs a <see cref="Rect2i"/> from a position, width, and height.
+ /// Constructs a <see cref="Rect2I"/> from a position, width, and height.
/// </summary>
/// <param name="position">The position.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
- public Rect2i(Vector2i position, int width, int height)
+ public Rect2I(Vector2I position, int width, int height)
{
_position = position;
- _size = new Vector2i(width, height);
+ _size = new Vector2I(width, height);
}
/// <summary>
- /// Constructs a <see cref="Rect2i"/> from x, y, and size.
+ /// Constructs a <see cref="Rect2I"/> from x, y, and size.
/// </summary>
/// <param name="x">The position's X coordinate.</param>
/// <param name="y">The position's Y coordinate.</param>
/// <param name="size">The size.</param>
- public Rect2i(int x, int y, Vector2i size)
+ public Rect2I(int x, int y, Vector2I size)
{
- _position = new Vector2i(x, y);
+ _position = new Vector2I(x, y);
_size = size;
}
/// <summary>
- /// Constructs a <see cref="Rect2i"/> from x, y, width, and height.
+ /// Constructs a <see cref="Rect2I"/> from x, y, width, and height.
/// </summary>
/// <param name="x">The position's X coordinate.</param>
/// <param name="y">The position's Y coordinate.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
- public Rect2i(int x, int y, int width, int height)
+ public Rect2I(int x, int y, int width, int height)
{
- _position = new Vector2i(x, y);
- _size = new Vector2i(width, height);
+ _position = new Vector2I(x, y);
+ _size = new Vector2I(width, height);
}
/// <summary>
/// Returns <see langword="true"/> if the
- /// <see cref="Rect2i"/>s are exactly equal.
+ /// <see cref="Rect2I"/>s are exactly equal.
/// </summary>
/// <param name="left">The left rect.</param>
/// <param name="right">The right rect.</param>
/// <returns>Whether or not the rects are equal.</returns>
- public static bool operator ==(Rect2i left, Rect2i right)
+ public static bool operator ==(Rect2I left, Rect2I right)
{
return left.Equals(right);
}
/// <summary>
/// Returns <see langword="true"/> if the
- /// <see cref="Rect2i"/>s are not equal.
+ /// <see cref="Rect2I"/>s are not equal.
/// </summary>
/// <param name="left">The left rect.</param>
/// <param name="right">The right rect.</param>
/// <returns>Whether or not the rects are not equal.</returns>
- public static bool operator !=(Rect2i left, Rect2i right)
+ public static bool operator !=(Rect2I left, Rect2I right)
{
return !left.Equals(right);
}
/// <summary>
- /// Converts this <see cref="Rect2i"/> to a <see cref="Rect2"/>.
+ /// Converts this <see cref="Rect2I"/> to a <see cref="Rect2"/>.
/// </summary>
/// <param name="value">The rect to convert.</param>
- public static implicit operator Rect2(Rect2i value)
+ public static implicit operator Rect2(Rect2I value)
{
return new Rect2(value._position, value._size);
}
/// <summary>
- /// Converts a <see cref="Rect2"/> to a <see cref="Rect2i"/>.
+ /// Converts a <see cref="Rect2"/> to a <see cref="Rect2I"/>.
/// </summary>
/// <param name="value">The rect to convert.</param>
- public static explicit operator Rect2i(Rect2 value)
+ public static explicit operator Rect2I(Rect2 value)
{
- return new Rect2i((Vector2i)value.Position, (Vector2i)value.Size);
+ return new Rect2I((Vector2I)value.Position, (Vector2I)value.Size);
}
/// <summary>
@@ -409,7 +400,7 @@ namespace Godot
/// <returns>Whether or not the rect and the other object are equal.</returns>
public override readonly bool Equals(object obj)
{
- return obj is Rect2i other && Equals(other);
+ return obj is Rect2I other && Equals(other);
}
/// <summary>
@@ -417,13 +408,13 @@ namespace Godot
/// </summary>
/// <param name="other">The other rect to compare.</param>
/// <returns>Whether or not the rects are equal.</returns>
- public readonly bool Equals(Rect2i other)
+ public readonly bool Equals(Rect2I other)
{
return _position.Equals(other._position) && _size.Equals(other._size);
}
/// <summary>
- /// Serves as the hash function for <see cref="Rect2i"/>.
+ /// Serves as the hash function for <see cref="Rect2I"/>.
/// </summary>
/// <returns>A hash code for this rect.</returns>
public override readonly int GetHashCode()
@@ -432,7 +423,7 @@ namespace Godot
}
/// <summary>
- /// Converts this <see cref="Rect2i"/> to a string.
+ /// Converts this <see cref="Rect2I"/> to a string.
/// </summary>
/// <returns>A string representation of this rect.</returns>
public override readonly string ToString()
@@ -441,7 +432,7 @@ namespace Godot
}
/// <summary>
- /// Converts this <see cref="Rect2i"/> to a string with the given <paramref name="format"/>.
+ /// Converts this <see cref="Rect2I"/> to a string with the given <paramref name="format"/>.
/// </summary>
/// <returns>A string representation of this rect.</returns>
public readonly string ToString(string format)
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rid.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rid.cs
new file mode 100644
index 0000000000..350626389b
--- /dev/null
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rid.cs
@@ -0,0 +1,104 @@
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using Godot.NativeInterop;
+
+namespace Godot
+{
+ /// <summary>
+ /// The RID type is used to access a low-level resource by its unique ID.
+ /// RIDs are opaque, which means they do not grant access to the resource
+ /// by themselves. They are used by the low-level server classes, such as
+ /// <see cref="DisplayServer"/>, <see cref="RenderingServer"/>,
+ /// <see cref="TextServer"/>, etc.
+ ///
+ /// A low-level resource may correspond to a high-level <see cref="Resource"/>,
+ /// such as <see cref="Texture"/> or <see cref="Mesh"/>
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential)]
+ public readonly struct Rid : IEquatable<Rid>
+ {
+ private readonly ulong _id; // Default is 0
+
+ internal Rid(ulong id)
+ {
+ _id = id;
+ }
+
+ /// <summary>
+ /// Constructs a new <see cref="Rid"/> for the given <see cref="GodotObject"/> <paramref name="from"/>.
+ /// </summary>
+ public Rid(GodotObject from)
+ => _id = from is Resource res ? res.GetRid()._id : default;
+
+ /// <summary>
+ /// Returns the ID of the referenced low-level resource.
+ /// </summary>
+ /// <returns>The ID of the referenced resource.</returns>
+ public ulong Id => _id;
+
+ /// <summary>
+ /// Returns <see langword="true"/> if the <see cref="Rid"/> is not <c>0</c>.
+ /// </summary>
+ /// <returns>Whether or not the ID is valid.</returns>
+ public bool IsValid => _id != 0;
+
+ /// <summary>
+ /// Returns <see langword="true"/> if both <see cref="Rid"/>s are equal,
+ /// which means they both refer to the same low-level resource.
+ /// </summary>
+ /// <param name="left">The left RID.</param>
+ /// <param name="right">The right RID.</param>
+ /// <returns>Whether or not the RIDs are equal.</returns>
+ public static bool operator ==(Rid left, Rid right)
+ {
+ return left.Equals(right);
+ }
+
+ /// <summary>
+ /// Returns <see langword="true"/> if the <see cref="Rid"/>s are not equal.
+ /// </summary>
+ /// <param name="left">The left RID.</param>
+ /// <param name="right">The right RID.</param>
+ /// <returns>Whether or not the RIDs are equal.</returns>
+ public static bool operator !=(Rid left, Rid right)
+ {
+ return !left.Equals(right);
+ }
+
+ /// <summary>
+ /// Returns <see langword="true"/> if this RID and <paramref name="obj"/> are equal.
+ /// </summary>
+ /// <param name="obj">The other object to compare.</param>
+ /// <returns>Whether or not the color and the other object are equal.</returns>
+ public override readonly bool Equals(object obj)
+ {
+ return obj is Rid other && Equals(other);
+ }
+
+ /// <summary>
+ /// Returns <see langword="true"/> if the RIDs are equal.
+ /// </summary>
+ /// <param name="other">The other RID.</param>
+ /// <returns>Whether or not the RIDs are equal.</returns>
+ public readonly bool Equals(Rid other)
+ {
+ return _id == other.Id;
+ }
+
+ /// <summary>
+ /// Serves as the hash function for <see cref="Rid"/>.
+ /// </summary>
+ /// <returns>A hash code for this RID.</returns>
+ public override readonly int GetHashCode()
+ {
+ return HashCode.Combine(_id);
+ }
+
+ /// <summary>
+ /// Converts this <see cref="Rid"/> to a string.
+ /// </summary>
+ /// <returns>A string representation of this Rid.</returns>
+ public override string ToString() => $"RID({Id})";
+ }
+}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Signal.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Signal.cs
index f9b8f06603..9ac8abd37b 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Signal.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Signal.cs
@@ -5,13 +5,14 @@ namespace Godot
/// </summary>
public readonly struct Signal : IAwaitable<Variant[]>
{
- private readonly Object _owner;
+ private readonly GodotObject _owner;
private readonly StringName _signalName;
/// <summary>
/// Object that contains the signal.
/// </summary>
- public Object Owner => _owner;
+ public GodotObject Owner => _owner;
+
/// <summary>
/// Name of the signal.
/// </summary>
@@ -23,7 +24,7 @@ namespace Godot
/// </summary>
/// <param name="owner">Object that contains the signal.</param>
/// <param name="name">Name of the signal.</param>
- public Signal(Object owner, StringName name)
+ public Signal(GodotObject owner, StringName name)
{
_owner = owner;
_signalName = name;
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/SignalAwaiter.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/SignalAwaiter.cs
index 96fb891086..a67f626d35 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/SignalAwaiter.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/SignalAwaiter.cs
@@ -10,13 +10,13 @@ namespace Godot
private Variant[] _result;
private Action _continuation;
- public SignalAwaiter(Object source, StringName signal, Object target)
+ public SignalAwaiter(GodotObject source, StringName signal, GodotObject target)
{
var awaiterGcHandle = CustomGCHandle.AllocStrong(this);
using godot_string_name signalSrc = NativeFuncs.godotsharp_string_name_new_copy(
(godot_string_name)(signal?.NativeValue ?? default));
- NativeFuncs.godotsharp_internal_signal_awaiter_connect(Object.GetPtr(source), in signalSrc,
- Object.GetPtr(target), GCHandle.ToIntPtr(awaiterGcHandle));
+ NativeFuncs.godotsharp_internal_signal_awaiter_connect(GodotObject.GetPtr(source), in signalSrc,
+ GodotObject.GetPtr(target), GCHandle.ToIntPtr(awaiterGcHandle));
}
public bool IsCompleted => _completed;
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
index d4329d78c1..df67e075ac 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
@@ -69,19 +69,6 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if the strings begins
- /// with the given string <paramref name="text"/>.
- /// </summary>
- /// <param name="instance">The string to check.</param>
- /// <param name="text">The beginning string.</param>
- /// <returns>If the string begins with the given string.</returns>
- [Obsolete("Use string.StartsWith instead.")]
- public static bool BeginsWith(this string instance, string text)
- {
- return instance.StartsWith(text);
- }
-
- /// <summary>
/// Returns the bigrams (pairs of consecutive letters) of this string.
/// </summary>
/// <param name="instance">The string that will be used.</param>
@@ -618,7 +605,7 @@ namespace Godot
}
else
{
- if (instance.BeginsWith("/"))
+ if (instance.StartsWith('/'))
{
rs = instance.Substring(1);
directory = "/";
@@ -675,15 +662,15 @@ namespace Godot
/// <summary>
/// Converts ASCII encoded array to string.
- /// Fast alternative to <see cref="GetStringFromUTF8"/> if the
+ /// Fast alternative to <see cref="GetStringFromUtf8"/> if the
/// content is ASCII-only. Unlike the UTF-8 function this function
/// maps every byte to a character in the array. Multibyte sequences
/// will not be interpreted correctly. For parsing user input always
- /// use <see cref="GetStringFromUTF8"/>.
+ /// use <see cref="GetStringFromUtf8"/>.
/// </summary>
/// <param name="bytes">A byte array of ASCII characters (on the range of 0-127).</param>
/// <returns>A string created from the bytes.</returns>
- public static string GetStringFromASCII(this byte[] bytes)
+ public static string GetStringFromAscii(this byte[] bytes)
{
return Encoding.ASCII.GetString(bytes);
}
@@ -693,7 +680,7 @@ namespace Godot
/// </summary>
/// <param name="bytes">A byte array of UTF-16 characters.</param>
/// <returns>A string created from the bytes.</returns>
- public static string GetStringFromUTF16(this byte[] bytes)
+ public static string GetStringFromUtf16(this byte[] bytes)
{
return Encoding.Unicode.GetString(bytes);
}
@@ -703,14 +690,14 @@ namespace Godot
/// </summary>
/// <param name="bytes">A byte array of UTF-32 characters.</param>
/// <returns>A string created from the bytes.</returns>
- public static string GetStringFromUTF32(this byte[] bytes)
+ public static string GetStringFromUtf32(this byte[] bytes)
{
return Encoding.UTF32.GetString(bytes);
}
/// <summary>
/// Converts UTF-8 encoded array to string.
- /// Slower than <see cref="GetStringFromASCII"/> but supports UTF-8
+ /// Slower than <see cref="GetStringFromAscii"/> but supports UTF-8
/// encoded data. Use this function if you are unsure about the
/// source of the data. For user input this function
/// should always be preferred.
@@ -719,7 +706,7 @@ namespace Godot
/// A byte array of UTF-8 characters (a character may take up multiple bytes).
/// </param>
/// <returns>A string created from the bytes.</returns>
- public static string GetStringFromUTF8(this byte[] bytes)
+ public static string GetStringFromUtf8(this byte[] bytes)
{
return Encoding.UTF8.GetString(bytes);
}
@@ -1199,23 +1186,6 @@ namespace Godot
}
/// <summary>
- /// Returns a copy of the string with characters removed from the left.
- /// The <paramref name="chars"/> argument is a string specifying the set of characters
- /// to be removed.
- /// Note: The <paramref name="chars"/> is not a prefix. See <see cref="TrimPrefix"/>
- /// method that will remove a single prefix string rather than a set of characters.
- /// </summary>
- /// <seealso cref="RStrip(string, string)"/>
- /// <param name="instance">The string to remove characters from.</param>
- /// <param name="chars">The characters to be removed.</param>
- /// <returns>A copy of the string with characters removed from the left.</returns>
- [Obsolete("Use string.TrimStart instead.")]
- public static string LStrip(this string instance, string chars)
- {
- return instance.TrimStart(chars.ToCharArray());
- }
-
- /// <summary>
/// Do a simple expression match, where '*' matches zero or more
/// arbitrary characters and '?' matches any single character except '.'.
/// </summary>
@@ -1287,10 +1257,10 @@ namespace Godot
/// <summary>
/// Returns the MD5 hash of the string as an array of bytes.
/// </summary>
- /// <seealso cref="MD5Text(string)"/>
+ /// <seealso cref="Md5Text(string)"/>
/// <param name="instance">The string to hash.</param>
/// <returns>The MD5 hash of the string.</returns>
- public static byte[] MD5Buffer(this string instance)
+ public static byte[] Md5Buffer(this string instance)
{
#pragma warning disable CA5351 // Do Not Use Broken Cryptographic Algorithms
return MD5.HashData(Encoding.UTF8.GetBytes(instance));
@@ -1300,12 +1270,12 @@ namespace Godot
/// <summary>
/// Returns the MD5 hash of the string as a string.
/// </summary>
- /// <seealso cref="MD5Buffer(string)"/>
+ /// <seealso cref="Md5Buffer(string)"/>
/// <param name="instance">The string to hash.</param>
/// <returns>The MD5 hash of the string.</returns>
- public static string MD5Text(this string instance)
+ public static string Md5Text(this string instance)
{
- return instance.MD5Buffer().HexEncode();
+ return instance.Md5Buffer().HexEncode();
}
/// <summary>
@@ -1504,29 +1474,12 @@ namespace Godot
}
/// <summary>
- /// Returns a copy of the string with characters removed from the right.
- /// The <paramref name="chars"/> argument is a string specifying the set of characters
- /// to be removed.
- /// Note: The <paramref name="chars"/> is not a suffix. See <see cref="TrimSuffix"/>
- /// method that will remove a single suffix string rather than a set of characters.
- /// </summary>
- /// <seealso cref="LStrip(string, string)"/>
- /// <param name="instance">The string to remove characters from.</param>
- /// <param name="chars">The characters to be removed.</param>
- /// <returns>A copy of the string with characters removed from the right.</returns>
- [Obsolete("Use string.TrimEnd instead.")]
- public static string RStrip(this string instance, string chars)
- {
- return instance.TrimEnd(chars.ToCharArray());
- }
-
- /// <summary>
/// Returns the SHA-1 hash of the string as an array of bytes.
/// </summary>
- /// <seealso cref="SHA1Text(string)"/>
+ /// <seealso cref="Sha1Text(string)"/>
/// <param name="instance">The string to hash.</param>
/// <returns>The SHA-1 hash of the string.</returns>
- public static byte[] SHA1Buffer(this string instance)
+ public static byte[] Sha1Buffer(this string instance)
{
#pragma warning disable CA5350 // Do Not Use Weak Cryptographic Algorithms
return SHA1.HashData(Encoding.UTF8.GetBytes(instance));
@@ -1536,21 +1489,21 @@ namespace Godot
/// <summary>
/// Returns the SHA-1 hash of the string as a string.
/// </summary>
- /// <seealso cref="SHA1Buffer(string)"/>
+ /// <seealso cref="Sha1Buffer(string)"/>
/// <param name="instance">The string to hash.</param>
/// <returns>The SHA-1 hash of the string.</returns>
- public static string SHA1Text(this string instance)
+ public static string Sha1Text(this string instance)
{
- return instance.SHA1Buffer().HexEncode();
+ return instance.Sha1Buffer().HexEncode();
}
/// <summary>
/// Returns the SHA-256 hash of the string as an array of bytes.
/// </summary>
- /// <seealso cref="SHA256Text(string)"/>
+ /// <seealso cref="Sha256Text(string)"/>
/// <param name="instance">The string to hash.</param>
/// <returns>The SHA-256 hash of the string.</returns>
- public static byte[] SHA256Buffer(this string instance)
+ public static byte[] Sha256Buffer(this string instance)
{
return SHA256.HashData(Encoding.UTF8.GetBytes(instance));
}
@@ -1558,12 +1511,12 @@ namespace Godot
/// <summary>
/// Returns the SHA-256 hash of the string as a string.
/// </summary>
- /// <seealso cref="SHA256Buffer(string)"/>
+ /// <seealso cref="Sha256Buffer(string)"/>
/// <param name="instance">The string to hash.</param>
/// <returns>The SHA-256 hash of the string.</returns>
- public static string SHA256Text(this string instance)
+ public static string Sha256Text(this string instance)
{
- return instance.SHA256Buffer().HexEncode();
+ return instance.Sha256Buffer().HexEncode();
}
/// <summary>
@@ -1745,15 +1698,15 @@ namespace Godot
/// <summary>
/// Converts the String (which is a character array) to PackedByteArray (which is an array of bytes).
- /// The conversion is faster compared to <see cref="ToUTF8Buffer(string)"/>,
+ /// The conversion is faster compared to <see cref="ToUtf8Buffer(string)"/>,
/// as this method assumes that all the characters in the String are ASCII characters.
/// </summary>
- /// <seealso cref="ToUTF8Buffer(string)"/>
- /// <seealso cref="ToUTF16Buffer(string)"/>
- /// <seealso cref="ToUTF32Buffer(string)"/>
+ /// <seealso cref="ToUtf8Buffer(string)"/>
+ /// <seealso cref="ToUtf16Buffer(string)"/>
+ /// <seealso cref="ToUtf32Buffer(string)"/>
/// <param name="instance">The string to convert.</param>
/// <returns>The string as ASCII encoded bytes.</returns>
- public static byte[] ToASCIIBuffer(this string instance)
+ public static byte[] ToAsciiBuffer(this string instance)
{
return Encoding.ASCII.GetBytes(instance);
}
@@ -1783,12 +1736,12 @@ namespace Godot
/// <summary>
/// Converts the string (which is an array of characters) to an UTF-16 encoded array of bytes.
/// </summary>
- /// <seealso cref="ToASCIIBuffer(string)"/>
- /// <seealso cref="ToUTF32Buffer(string)"/>
- /// <seealso cref="ToUTF8Buffer(string)"/>
+ /// <seealso cref="ToAsciiBuffer(string)"/>
+ /// <seealso cref="ToUtf32Buffer(string)"/>
+ /// <seealso cref="ToUtf8Buffer(string)"/>
/// <param name="instance">The string to convert.</param>
/// <returns>The string as UTF-16 encoded bytes.</returns>
- public static byte[] ToUTF16Buffer(this string instance)
+ public static byte[] ToUtf16Buffer(this string instance)
{
return Encoding.Unicode.GetBytes(instance);
}
@@ -1796,28 +1749,28 @@ namespace Godot
/// <summary>
/// Converts the string (which is an array of characters) to an UTF-32 encoded array of bytes.
/// </summary>
- /// <seealso cref="ToASCIIBuffer(string)"/>
- /// <seealso cref="ToUTF16Buffer(string)"/>
- /// <seealso cref="ToUTF8Buffer(string)"/>
+ /// <seealso cref="ToAsciiBuffer(string)"/>
+ /// <seealso cref="ToUtf16Buffer(string)"/>
+ /// <seealso cref="ToUtf8Buffer(string)"/>
/// <param name="instance">The string to convert.</param>
/// <returns>The string as UTF-32 encoded bytes.</returns>
- public static byte[] ToUTF32Buffer(this string instance)
+ public static byte[] ToUtf32Buffer(this string instance)
{
return Encoding.UTF32.GetBytes(instance);
}
/// <summary>
/// Converts the string (which is an array of characters) to an UTF-8 encoded array of bytes.
- /// The conversion is a bit slower than <see cref="ToASCIIBuffer(string)"/>,
+ /// The conversion is a bit slower than <see cref="ToAsciiBuffer(string)"/>,
/// but supports all UTF-8 characters. Therefore, you should prefer this function
- /// over <see cref="ToASCIIBuffer(string)"/>.
+ /// over <see cref="ToAsciiBuffer(string)"/>.
/// </summary>
- /// <seealso cref="ToASCIIBuffer(string)"/>
- /// <seealso cref="ToUTF16Buffer(string)"/>
- /// <seealso cref="ToUTF32Buffer(string)"/>
+ /// <seealso cref="ToAsciiBuffer(string)"/>
+ /// <seealso cref="ToUtf16Buffer(string)"/>
+ /// <seealso cref="ToUtf32Buffer(string)"/>
/// <param name="instance">The string to convert.</param>
/// <returns>The string as UTF-8 encoded bytes.</returns>
- public static byte[] ToUTF8Buffer(this string instance)
+ public static byte[] ToUtf8Buffer(this string instance)
{
return Encoding.UTF8.GetBytes(instance);
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
index fa060e3a53..5283dc7ec6 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
@@ -1,4 +1,5 @@
using System;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Godot
@@ -18,22 +19,51 @@ namespace Godot
/// <summary>
/// The basis matrix's X vector (column 0). Equivalent to array index <c>[0]</c>.
/// </summary>
- public Vector2 x;
+ public Vector2 X;
/// <summary>
/// The basis matrix's Y vector (column 1). Equivalent to array index <c>[1]</c>.
/// </summary>
- public Vector2 y;
+ public Vector2 Y;
/// <summary>
/// The origin vector (column 2, the third column). Equivalent to array index <c>[2]</c>.
/// The origin vector represents translation.
/// </summary>
- public Vector2 origin;
+ public Vector2 Origin;
+
+ /// <summary>
+ /// Returns the transform's rotation (in radians).
+ /// </summary>
+ public readonly real_t Rotation => Mathf.Atan2(X.Y, X.X);
+
+ /// <summary>
+ /// Returns the scale.
+ /// </summary>
+ public readonly Vector2 Scale
+ {
+ get
+ {
+ real_t detSign = Mathf.Sign(BasisDeterminant());
+ return new Vector2(X.Length(), detSign * Y.Length());
+ }
+ }
+
+ /// <summary>
+ /// Returns the transform's skew (in radians).
+ /// </summary>
+ public readonly real_t Skew
+ {
+ get
+ {
+ real_t detSign = Mathf.Sign(BasisDeterminant());
+ return Mathf.Acos(X.Normalized().Dot(detSign * Y.Normalized())) - Mathf.Pi * 0.5f;
+ }
+ }
/// <summary>
/// Access whole columns in the form of <see cref="Vector2"/>.
- /// The third column is the <see cref="origin"/> vector.
+ /// The third column is the <see cref="Origin"/> vector.
/// </summary>
/// <param name="column">Which column vector.</param>
/// <exception cref="ArgumentOutOfRangeException">
@@ -46,11 +76,11 @@ namespace Godot
switch (column)
{
case 0:
- return x;
+ return X;
case 1:
- return y;
+ return Y;
case 2:
- return origin;
+ return Origin;
default:
throw new ArgumentOutOfRangeException(nameof(column));
}
@@ -60,13 +90,13 @@ namespace Godot
switch (column)
{
case 0:
- x = value;
+ X = value;
return;
case 1:
- y = value;
+ Y = value;
return;
case 2:
- origin = value;
+ Origin = value;
return;
default:
throw new ArgumentOutOfRangeException(nameof(column));
@@ -76,7 +106,7 @@ namespace Godot
/// <summary>
/// Access matrix elements in column-major order.
- /// The third column is the <see cref="origin"/> vector.
+ /// The third column is the <see cref="Origin"/> vector.
/// </summary>
/// <param name="column">Which column, the matrix horizontal position.</param>
/// <param name="row">Which row, the matrix vertical position.</param>
@@ -131,14 +161,15 @@ namespace Godot
/// and is usually considered invalid.
/// </summary>
/// <returns>The determinant of the basis matrix.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
private readonly real_t BasisDeterminant()
{
- return (x.x * y.y) - (x.y * y.x);
+ return (X.X * Y.Y) - (X.Y * Y.X);
}
/// <summary>
/// Returns a vector transformed (multiplied) by the basis matrix.
- /// This method does not account for translation (the <see cref="origin"/> vector).
+ /// This method does not account for translation (the <see cref="Origin"/> vector).
/// </summary>
/// <seealso cref="BasisXformInv(Vector2)"/>
/// <param name="v">A vector to transform.</param>
@@ -150,7 +181,7 @@ namespace Godot
/// <summary>
/// Returns a vector transformed (multiplied) by the inverse basis matrix.
- /// This method does not account for translation (the <see cref="origin"/> vector).
+ /// This method does not account for translation (the <see cref="Origin"/> vector).
///
/// Note: This results in a multiplication by the inverse of the
/// basis matrix only if it represents a rotation-reflection.
@@ -160,24 +191,7 @@ namespace Godot
/// <returns>The inversely transformed vector.</returns>
public readonly Vector2 BasisXformInv(Vector2 v)
{
- return new Vector2(x.Dot(v), y.Dot(v));
- }
-
- /// <summary>
- /// Returns the transform's rotation (in radians).
- /// </summary>
- public readonly real_t GetRotation()
- {
- return Mathf.Atan2(x.y, x.x);
- }
-
- /// <summary>
- /// Returns the scale.
- /// </summary>
- public readonly Vector2 GetScale()
- {
- real_t detSign = Mathf.Sign(BasisDeterminant());
- return new Vector2(x.Length(), detSign * y.Length());
+ return new Vector2(X.Dot(v), Y.Dot(v));
}
/// <summary>
@@ -188,48 +202,13 @@ namespace Godot
/// <returns>The interpolated transform.</returns>
public readonly Transform2D InterpolateWith(Transform2D transform, real_t weight)
{
- real_t r1 = GetRotation();
- real_t r2 = transform.GetRotation();
-
- Vector2 s1 = GetScale();
- Vector2 s2 = transform.GetScale();
-
- // Slerp rotation
- (real_t sin1, real_t cos1) = Mathf.SinCos(r1);
- (real_t sin2, real_t cos2) = Mathf.SinCos(r2);
- var v1 = new Vector2(cos1, sin1);
- var v2 = new Vector2(cos2, sin2);
-
- real_t dot = v1.Dot(v2);
-
- dot = Mathf.Clamp(dot, -1.0f, 1.0f);
-
- Vector2 v;
-
- if (dot > 0.9995f)
- {
- // Linearly interpolate to avoid numerical precision issues
- v = v1.Lerp(v2, weight).Normalized();
- }
- else
- {
- real_t angle = weight * Mathf.Acos(dot);
- Vector2 v3 = (v2 - (v1 * dot)).Normalized();
- (real_t sine, real_t cos) = Mathf.SinCos(angle);
- v = (v1 * sine) + (v3 * cos);
- }
-
- // Extract parameters
- Vector2 p1 = origin;
- Vector2 p2 = transform.origin;
-
- // Construct matrix
- var res = new Transform2D(Mathf.Atan2(v.y, v.x), p1.Lerp(p2, weight));
- Vector2 scale = s1.Lerp(s2, weight);
- res.x *= scale;
- res.y *= scale;
-
- return res;
+ return new Transform2D
+ (
+ Mathf.LerpAngle(Rotation, transform.Rotation, weight),
+ Scale.Lerp(transform.Scale, weight),
+ Mathf.LerpAngle(Skew, transform.Skew, weight),
+ Origin.Lerp(transform.Origin, weight)
+ );
}
/// <summary>
@@ -243,10 +222,10 @@ namespace Godot
Transform2D inv = this;
// Swap
- inv.x.y = y.x;
- inv.y.x = x.y;
+ inv.X.Y = Y.X;
+ inv.Y.X = X.Y;
- inv.origin = inv.BasisXform(-inv.origin);
+ inv.Origin = inv.BasisXform(-inv.Origin);
return inv;
}
@@ -258,7 +237,7 @@ namespace Godot
/// <returns>Whether this vector is finite or not.</returns>
public readonly bool IsFinite()
{
- return x.IsFinite() && y.IsFinite() && origin.IsFinite();
+ return X.IsFinite() && Y.IsFinite() && Origin.IsFinite();
}
/// <summary>
@@ -270,15 +249,15 @@ namespace Godot
{
Transform2D on = this;
- Vector2 onX = on.x;
- Vector2 onY = on.y;
+ Vector2 onX = on.X;
+ Vector2 onY = on.Y;
onX.Normalize();
onY = onY - (onX * onX.Dot(onY));
onY.Normalize();
- on.x = onX;
- on.y = onY;
+ on.X = onX;
+ on.Y = onY;
return on;
}
@@ -292,7 +271,7 @@ namespace Godot
/// <returns>The rotated transformation matrix.</returns>
public readonly Transform2D Rotated(real_t angle)
{
- return this * new Transform2D(angle, new Vector2());
+ return new Transform2D(angle, new Vector2()) * this;
}
/// <summary>
@@ -304,7 +283,7 @@ namespace Godot
/// <returns>The rotated transformation matrix.</returns>
public readonly Transform2D RotatedLocal(real_t angle)
{
- return new Transform2D(angle, new Vector2()) * this;
+ return this * new Transform2D(angle, new Vector2());
}
/// <summary>
@@ -317,9 +296,9 @@ namespace Godot
public readonly Transform2D Scaled(Vector2 scale)
{
Transform2D copy = this;
- copy.x *= scale;
- copy.y *= scale;
- copy.origin *= scale;
+ copy.X *= scale;
+ copy.Y *= scale;
+ copy.Origin *= scale;
return copy;
}
@@ -333,8 +312,8 @@ namespace Godot
public readonly Transform2D ScaledLocal(Vector2 scale)
{
Transform2D copy = this;
- copy.x *= scale;
- copy.y *= scale;
+ copy.X *= scale;
+ copy.Y *= scale;
return copy;
}
@@ -358,7 +337,7 @@ namespace Godot
public readonly Transform2D Translated(Vector2 offset)
{
Transform2D copy = this;
- copy.origin += offset;
+ copy.Origin += offset;
return copy;
}
@@ -372,7 +351,7 @@ namespace Godot
public readonly Transform2D TranslatedLocal(Vector2 offset)
{
Transform2D copy = this;
- copy.origin += copy.BasisXform(offset);
+ copy.Origin += copy.BasisXform(offset);
return copy;
}
@@ -407,26 +386,26 @@ namespace Godot
/// <param name="originPos">The origin vector, or column index 2.</param>
public Transform2D(Vector2 xAxis, Vector2 yAxis, Vector2 originPos)
{
- x = xAxis;
- y = yAxis;
- origin = originPos;
+ X = xAxis;
+ Y = yAxis;
+ Origin = originPos;
}
/// <summary>
/// Constructs a transformation matrix from the given components.
- /// Arguments are named such that xy is equal to calling <c>x.y</c>.
- /// </summary>
- /// <param name="xx">The X component of the X column vector, accessed via <c>t.x.x</c> or <c>[0][0]</c>.</param>
- /// <param name="xy">The Y component of the X column vector, accessed via <c>t.x.y</c> or <c>[0][1]</c>.</param>
- /// <param name="yx">The X component of the Y column vector, accessed via <c>t.y.x</c> or <c>[1][0]</c>.</param>
- /// <param name="yy">The Y component of the Y column vector, accessed via <c>t.y.y</c> or <c>[1][1]</c>.</param>
- /// <param name="ox">The X component of the origin vector, accessed via <c>t.origin.x</c> or <c>[2][0]</c>.</param>
- /// <param name="oy">The Y component of the origin vector, accessed via <c>t.origin.y</c> or <c>[2][1]</c>.</param>
+ /// Arguments are named such that xy is equal to calling <c>X.Y</c>.
+ /// </summary>
+ /// <param name="xx">The X component of the X column vector, accessed via <c>t.X.X</c> or <c>[0][0]</c>.</param>
+ /// <param name="xy">The Y component of the X column vector, accessed via <c>t.X.Y</c> or <c>[0][1]</c>.</param>
+ /// <param name="yx">The X component of the Y column vector, accessed via <c>t.Y.X</c> or <c>[1][0]</c>.</param>
+ /// <param name="yy">The Y component of the Y column vector, accessed via <c>t.Y.Y</c> or <c>[1][1]</c>.</param>
+ /// <param name="ox">The X component of the origin vector, accessed via <c>t.Origin.X</c> or <c>[2][0]</c>.</param>
+ /// <param name="oy">The Y component of the origin vector, accessed via <c>t.Origin.Y</c> or <c>[2][1]</c>.</param>
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);
- y = new Vector2(yx, yy);
- origin = new Vector2(ox, oy);
+ X = new Vector2(xx, xy);
+ Y = new Vector2(yx, yy);
+ Origin = new Vector2(ox, oy);
}
/// <summary>
@@ -438,10 +417,10 @@ namespace Godot
public Transform2D(real_t rotation, Vector2 origin)
{
(real_t sin, real_t cos) = Mathf.SinCos(rotation);
- x.x = y.y = cos;
- x.y = y.x = sin;
- y.x *= -1;
- this.origin = origin;
+ X.X = Y.Y = cos;
+ X.Y = Y.X = sin;
+ Y.X *= -1;
+ Origin = origin;
}
/// <summary>
@@ -457,11 +436,11 @@ namespace Godot
{
(real_t rotationSin, real_t rotationCos) = Mathf.SinCos(rotation);
(real_t rotationSkewSin, real_t rotationSkewCos) = Mathf.SinCos(rotation + skew);
- x.x = rotationCos * scale.x;
- y.y = rotationSkewCos * scale.y;
- y.x = -rotationSkewSin * scale.y;
- x.y = rotationSin * scale.x;
- this.origin = origin;
+ X.X = rotationCos * scale.X;
+ Y.Y = rotationSkewCos * scale.Y;
+ Y.X = -rotationSkewSin * scale.Y;
+ X.Y = rotationSin * scale.X;
+ Origin = origin;
}
/// <summary>
@@ -474,17 +453,17 @@ namespace Godot
/// <returns>The composed transform.</returns>
public static Transform2D operator *(Transform2D left, Transform2D right)
{
- left.origin = left * right.origin;
+ left.Origin = left * right.Origin;
- real_t x0 = left.Tdotx(right.x);
- real_t x1 = left.Tdoty(right.x);
- real_t y0 = left.Tdotx(right.y);
- real_t y1 = left.Tdoty(right.y);
+ real_t x0 = left.Tdotx(right.X);
+ real_t x1 = left.Tdoty(right.X);
+ real_t y0 = left.Tdotx(right.Y);
+ real_t y1 = left.Tdoty(right.Y);
- left.x.x = x0;
- left.x.y = x1;
- left.y.x = y0;
- left.y.y = y1;
+ left.X.X = x0;
+ left.X.Y = x1;
+ left.Y.X = y0;
+ left.Y.Y = y1;
return left;
}
@@ -497,7 +476,7 @@ namespace Godot
/// <returns>The transformed Vector2.</returns>
public static Vector2 operator *(Transform2D transform, Vector2 vector)
{
- return new Vector2(transform.Tdotx(vector), transform.Tdoty(vector)) + transform.origin;
+ return new Vector2(transform.Tdotx(vector), transform.Tdoty(vector)) + transform.Origin;
}
/// <summary>
@@ -508,8 +487,8 @@ namespace Godot
/// <returns>The inversely transformed Vector2.</returns>
public static Vector2 operator *(Vector2 vector, Transform2D transform)
{
- Vector2 vInv = vector - transform.origin;
- return new Vector2(transform.x.Dot(vInv), transform.y.Dot(vInv));
+ Vector2 vInv = vector - transform.Origin;
+ return new Vector2(transform.X.Dot(vInv), transform.Y.Dot(vInv));
}
/// <summary>
@@ -521,8 +500,8 @@ namespace Godot
public static Rect2 operator *(Transform2D transform, Rect2 rect)
{
Vector2 pos = transform * rect.Position;
- Vector2 toX = transform.x * rect.Size.x;
- Vector2 toY = transform.y * rect.Size.y;
+ Vector2 toX = transform.X * rect.Size.X;
+ Vector2 toY = transform.Y * rect.Size.Y;
return new Rect2(pos, new Vector2()).Expand(pos + toX).Expand(pos + toY).Expand(pos + toX + toY);
}
@@ -536,9 +515,9 @@ namespace Godot
public static Rect2 operator *(Rect2 rect, Transform2D transform)
{
Vector2 pos = rect.Position * transform;
- Vector2 to1 = new Vector2(rect.Position.x, rect.Position.y + rect.Size.y) * transform;
- Vector2 to2 = new Vector2(rect.Position.x + rect.Size.x, rect.Position.y + rect.Size.y) * transform;
- Vector2 to3 = new Vector2(rect.Position.x + rect.Size.x, rect.Position.y) * transform;
+ Vector2 to1 = new Vector2(rect.Position.X, rect.Position.Y + rect.Size.Y) * transform;
+ Vector2 to2 = new Vector2(rect.Position.X + rect.Size.X, rect.Position.Y + rect.Size.Y) * transform;
+ Vector2 to3 = new Vector2(rect.Position.X + rect.Size.X, rect.Position.Y) * transform;
return new Rect2(pos, new Vector2()).Expand(to1).Expand(to2).Expand(to3);
}
@@ -627,7 +606,7 @@ namespace Godot
/// <returns>Whether or not the matrices are exactly equal.</returns>
public readonly bool Equals(Transform2D other)
{
- return x.Equals(other.x) && y.Equals(other.y) && origin.Equals(other.origin);
+ return X.Equals(other.X) && Y.Equals(other.Y) && Origin.Equals(other.Origin);
}
/// <summary>
@@ -638,7 +617,7 @@ namespace Godot
/// <returns>Whether or not the matrices are approximately equal.</returns>
public readonly bool IsEqualApprox(Transform2D other)
{
- return x.IsEqualApprox(other.x) && y.IsEqualApprox(other.y) && origin.IsEqualApprox(other.origin);
+ return X.IsEqualApprox(other.X) && Y.IsEqualApprox(other.Y) && Origin.IsEqualApprox(other.Origin);
}
/// <summary>
@@ -647,7 +626,7 @@ namespace Godot
/// <returns>A hash code for this transform.</returns>
public override readonly int GetHashCode()
{
- return x.GetHashCode() ^ y.GetHashCode() ^ origin.GetHashCode();
+ return X.GetHashCode() ^ Y.GetHashCode() ^ Origin.GetHashCode();
}
/// <summary>
@@ -656,7 +635,7 @@ namespace Godot
/// <returns>A string representation of this transform.</returns>
public override readonly string ToString()
{
- return $"[X: {x}, Y: {y}, O: {origin}]";
+ return $"[X: {X}, Y: {Y}, O: {Origin}]";
}
/// <summary>
@@ -665,7 +644,7 @@ namespace Godot
/// <returns>A string representation of this transform.</returns>
public readonly string ToString(string format)
{
- return $"[X: {x.ToString(format)}, Y: {y.ToString(format)}, O: {origin.ToString(format)}]";
+ return $"[X: {X.ToString(format)}, Y: {Y.ToString(format)}, O: {Origin.ToString(format)}]";
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
index 6b2475fc59..b34e95c04d 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
@@ -6,7 +6,7 @@ namespace Godot
/// <summary>
/// 3×4 matrix (3 rows, 4 columns) used for 3D linear transformations.
/// It can represent transformations such as translation, rotation, or scaling.
- /// It consists of a <see cref="Basis"/> (first 3 columns) and a
+ /// It consists of a <see cref="Godot.Basis"/> (first 3 columns) and a
/// <see cref="Vector3"/> for the origin (last column).
///
/// For more information, read this documentation article:
@@ -17,19 +17,19 @@ namespace Godot
public struct Transform3D : IEquatable<Transform3D>
{
/// <summary>
- /// The <see cref="Basis"/> of this transform. Contains the X, Y, and Z basis
+ /// The <see cref="Godot.Basis"/> of this transform. Contains the X, Y, and Z basis
/// vectors (columns 0 to 2) and is responsible for rotation and scale.
/// </summary>
- public Basis basis;
+ public Basis Basis;
/// <summary>
/// The origin vector (column 3, the fourth column). Equivalent to array index <c>[3]</c>.
/// </summary>
- public Vector3 origin;
+ public Vector3 Origin;
/// <summary>
/// Access whole columns in the form of <see cref="Vector3"/>.
- /// The fourth column is the <see cref="origin"/> vector.
+ /// The fourth column is the <see cref="Origin"/> vector.
/// </summary>
/// <param name="column">Which column vector.</param>
/// <exception cref="ArgumentOutOfRangeException">
@@ -42,13 +42,13 @@ namespace Godot
switch (column)
{
case 0:
- return basis.Column0;
+ return Basis.Column0;
case 1:
- return basis.Column1;
+ return Basis.Column1;
case 2:
- return basis.Column2;
+ return Basis.Column2;
case 3:
- return origin;
+ return Origin;
default:
throw new ArgumentOutOfRangeException(nameof(column));
}
@@ -58,16 +58,16 @@ namespace Godot
switch (column)
{
case 0:
- basis.Column0 = value;
+ Basis.Column0 = value;
return;
case 1:
- basis.Column1 = value;
+ Basis.Column1 = value;
return;
case 2:
- basis.Column2 = value;
+ Basis.Column2 = value;
return;
case 3:
- origin = value;
+ Origin = value;
return;
default:
throw new ArgumentOutOfRangeException(nameof(column));
@@ -77,7 +77,7 @@ namespace Godot
/// <summary>
/// Access matrix elements in column-major order.
- /// The fourth column is the <see cref="origin"/> vector.
+ /// The fourth column is the <see cref="Origin"/> vector.
/// </summary>
/// <param name="column">Which column, the matrix horizontal position.</param>
/// <param name="row">Which row, the matrix vertical position.</param>
@@ -87,18 +87,18 @@ namespace Godot
{
if (column == 3)
{
- return origin[row];
+ return Origin[row];
}
- return basis[column, row];
+ return Basis[column, row];
}
set
{
if (column == 3)
{
- origin[row] = value;
+ Origin[row] = value;
return;
}
- basis[column, row] = value;
+ Basis[column, row] = value;
}
}
@@ -110,8 +110,8 @@ namespace Godot
/// <returns>The inverse transformation matrix.</returns>
public readonly Transform3D AffineInverse()
{
- Basis basisInv = basis.Inverse();
- return new Transform3D(basisInv, basisInv * -origin);
+ Basis basisInv = Basis.Inverse();
+ return new Transform3D(basisInv, basisInv * -Origin);
}
/// <summary>
@@ -124,19 +124,19 @@ namespace Godot
/// <returns>The interpolated transform.</returns>
public readonly Transform3D InterpolateWith(Transform3D transform, real_t weight)
{
- Vector3 sourceScale = basis.GetScale();
- Quaternion sourceRotation = basis.GetRotationQuaternion();
- Vector3 sourceLocation = origin;
+ Vector3 sourceScale = Basis.Scale;
+ Quaternion sourceRotation = Basis.GetRotationQuaternion();
+ Vector3 sourceLocation = Origin;
- Vector3 destinationScale = transform.basis.GetScale();
- Quaternion destinationRotation = transform.basis.GetRotationQuaternion();
- Vector3 destinationLocation = transform.origin;
+ Vector3 destinationScale = transform.Basis.Scale;
+ Quaternion destinationRotation = transform.Basis.GetRotationQuaternion();
+ Vector3 destinationLocation = transform.Origin;
var interpolated = new Transform3D();
Quaternion quaternion = sourceRotation.Slerp(destinationRotation, weight).Normalized();
Vector3 scale = sourceScale.Lerp(destinationScale, weight);
- interpolated.basis.SetQuaternionScale(quaternion, scale);
- interpolated.origin = sourceLocation.Lerp(destinationLocation, weight);
+ interpolated.Basis.SetQuaternionScale(quaternion, scale);
+ interpolated.Origin = sourceLocation.Lerp(destinationLocation, weight);
return interpolated;
}
@@ -149,8 +149,8 @@ namespace Godot
/// <returns>The inverse matrix.</returns>
public readonly Transform3D Inverse()
{
- Basis basisTr = basis.Transposed();
- return new Transform3D(basisTr, basisTr * -origin);
+ Basis basisTr = Basis.Transposed();
+ return new Transform3D(basisTr, basisTr * -Origin);
}
/// <summary>
@@ -160,7 +160,7 @@ namespace Godot
/// <returns>Whether this vector is finite or not.</returns>
public readonly bool IsFinite()
{
- return basis.IsFinite() && origin.IsFinite();
+ return Basis.IsFinite() && Origin.IsFinite();
}
/// <summary>
@@ -179,7 +179,7 @@ namespace Godot
public readonly Transform3D LookingAt(Vector3 target, Vector3 up)
{
Transform3D t = this;
- t.SetLookAt(origin, target, up);
+ t.SetLookAt(Origin, target, up);
return t;
}
@@ -190,7 +190,7 @@ namespace Godot
/// <returns>The orthonormalized transform.</returns>
public readonly Transform3D Orthonormalized()
{
- return new Transform3D(basis.Orthonormalized(), origin);
+ return new Transform3D(Basis.Orthonormalized(), Origin);
}
/// <summary>
@@ -219,7 +219,7 @@ namespace Godot
public readonly Transform3D RotatedLocal(Vector3 axis, real_t angle)
{
Basis tmpBasis = new Basis(axis, angle);
- return new Transform3D(basis * tmpBasis, origin);
+ return new Transform3D(Basis * tmpBasis, Origin);
}
/// <summary>
@@ -231,7 +231,7 @@ namespace Godot
/// <returns>The scaled transformation matrix.</returns>
public readonly Transform3D Scaled(Vector3 scale)
{
- return new Transform3D(basis.Scaled(scale), origin * scale);
+ return new Transform3D(Basis.Scaled(scale), Origin * scale);
}
/// <summary>
@@ -244,7 +244,7 @@ namespace Godot
public readonly Transform3D ScaledLocal(Vector3 scale)
{
Basis tmpBasis = Basis.FromScale(scale);
- return new Transform3D(basis * tmpBasis, origin);
+ return new Transform3D(Basis * tmpBasis, Origin);
}
private void SetLookAt(Vector3 eye, Vector3 target, Vector3 up)
@@ -265,9 +265,9 @@ namespace Godot
column0.Normalize();
column1.Normalize();
- basis = new Basis(column0, column1, column2);
+ Basis = new Basis(column0, column1, column2);
- origin = eye;
+ Origin = eye;
}
/// <summary>
@@ -279,7 +279,7 @@ namespace Godot
/// <returns>The translated matrix.</returns>
public readonly Transform3D Translated(Vector3 offset)
{
- return new Transform3D(basis, origin + offset);
+ return new Transform3D(Basis, Origin + offset);
}
/// <summary>
@@ -291,11 +291,11 @@ namespace Godot
/// <returns>The translated matrix.</returns>
public readonly Transform3D TranslatedLocal(Vector3 offset)
{
- return new Transform3D(basis, new Vector3
+ return new Transform3D(Basis, new Vector3
(
- origin[0] + basis.Row0.Dot(offset),
- origin[1] + basis.Row1.Dot(offset),
- origin[2] + basis.Row2.Dot(offset)
+ Origin[0] + Basis.Row0.Dot(offset),
+ Origin[1] + Basis.Row1.Dot(offset),
+ Origin[2] + Basis.Row2.Dot(offset)
));
}
@@ -337,64 +337,64 @@ namespace Godot
/// <param name="origin">The origin vector, or column index 3.</param>
public Transform3D(Vector3 column0, Vector3 column1, Vector3 column2, Vector3 origin)
{
- basis = new Basis(column0, column1, column2);
- this.origin = origin;
+ Basis = new Basis(column0, column1, column2);
+ Origin = origin;
}
/// <summary>
/// Constructs a transformation matrix from the given components.
- /// Arguments are named such that xy is equal to calling <c>basis.x.y</c>.
- /// </summary>
- /// <param name="xx">The X component of the X column vector, accessed via <c>t.basis.x.x</c> or <c>[0][0]</c>.</param>
- /// <param name="yx">The X component of the Y column vector, accessed via <c>t.basis.y.x</c> or <c>[1][0]</c>.</param>
- /// <param name="zx">The X component of the Z column vector, accessed via <c>t.basis.z.x</c> or <c>[2][0]</c>.</param>
- /// <param name="xy">The Y component of the X column vector, accessed via <c>t.basis.x.y</c> or <c>[0][1]</c>.</param>
- /// <param name="yy">The Y component of the Y column vector, accessed via <c>t.basis.y.y</c> or <c>[1][1]</c>.</param>
- /// <param name="zy">The Y component of the Z column vector, accessed via <c>t.basis.y.y</c> or <c>[2][1]</c>.</param>
- /// <param name="xz">The Z component of the X column vector, accessed via <c>t.basis.x.y</c> or <c>[0][2]</c>.</param>
- /// <param name="yz">The Z component of the Y column vector, accessed via <c>t.basis.y.y</c> or <c>[1][2]</c>.</param>
- /// <param name="zz">The Z component of the Z column vector, accessed via <c>t.basis.y.y</c> or <c>[2][2]</c>.</param>
- /// <param name="ox">The X component of the origin vector, accessed via <c>t.origin.x</c> or <c>[2][0]</c>.</param>
- /// <param name="oy">The Y component of the origin vector, accessed via <c>t.origin.y</c> or <c>[2][1]</c>.</param>
- /// <param name="oz">The Z component of the origin vector, accessed via <c>t.origin.z</c> or <c>[2][2]</c>.</param>
+ /// Arguments are named such that xy is equal to calling <c>Basis.X.Y</c>.
+ /// </summary>
+ /// <param name="xx">The X component of the X column vector, accessed via <c>t.Basis.X.X</c> or <c>[0][0]</c>.</param>
+ /// <param name="yx">The X component of the Y column vector, accessed via <c>t.Basis.Y.X</c> or <c>[1][0]</c>.</param>
+ /// <param name="zx">The X component of the Z column vector, accessed via <c>t.Basis.Z.X</c> or <c>[2][0]</c>.</param>
+ /// <param name="xy">The Y component of the X column vector, accessed via <c>t.Basis.X.Y</c> or <c>[0][1]</c>.</param>
+ /// <param name="yy">The Y component of the Y column vector, accessed via <c>t.Basis.Y.Y</c> or <c>[1][1]</c>.</param>
+ /// <param name="zy">The Y component of the Z column vector, accessed via <c>t.Basis.Y.Y</c> or <c>[2][1]</c>.</param>
+ /// <param name="xz">The Z component of the X column vector, accessed via <c>t.Basis.X.Y</c> or <c>[0][2]</c>.</param>
+ /// <param name="yz">The Z component of the Y column vector, accessed via <c>t.Basis.Y.Y</c> or <c>[1][2]</c>.</param>
+ /// <param name="zz">The Z component of the Z column vector, accessed via <c>t.Basis.Y.Y</c> or <c>[2][2]</c>.</param>
+ /// <param name="ox">The X component of the origin vector, accessed via <c>t.Origin.X</c> or <c>[2][0]</c>.</param>
+ /// <param name="oy">The Y component of the origin vector, accessed via <c>t.Origin.Y</c> or <c>[2][1]</c>.</param>
+ /// <param name="oz">The Z component of the origin vector, accessed via <c>t.Origin.Z</c> or <c>[2][2]</c>.</param>
public Transform3D(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, real_t ox, real_t oy, real_t oz)
{
- basis = new Basis(xx, yx, zx, xy, yy, zy, xz, yz, zz);
- origin = new Vector3(ox, oy, oz);
+ Basis = new Basis(xx, yx, zx, xy, yy, zy, xz, yz, zz);
+ Origin = new Vector3(ox, oy, oz);
}
/// <summary>
/// Constructs a transformation matrix from the given <paramref name="basis"/> and
/// <paramref name="origin"/> vector.
/// </summary>
- /// <param name="basis">The <see cref="Basis"/> to create the basis from.</param>
+ /// <param name="basis">The <see cref="Godot.Basis"/> to create the basis from.</param>
/// <param name="origin">The origin vector, or column index 3.</param>
public Transform3D(Basis basis, Vector3 origin)
{
- this.basis = basis;
- this.origin = origin;
+ Basis = basis;
+ Origin = origin;
}
/// <summary>
/// Constructs a transformation matrix from the given <paramref name="projection"/>
- /// by trimming the last row of the projection matrix (<c>projection.x.w</c>,
- /// <c>projection.y.w</c>, <c>projection.z.w</c>, and <c>projection.w.w</c>
+ /// by trimming the last row of the projection matrix (<c>projection.X.W</c>,
+ /// <c>projection.Y.W</c>, <c>projection.Z.W</c>, and <c>projection.W.W</c>
/// are not copied over).
/// </summary>
/// <param name="projection">The <see cref="Projection"/> to create the transform from.</param>
public Transform3D(Projection projection)
{
- basis = new Basis
+ Basis = new Basis
(
- projection.x.x, projection.y.x, projection.z.x,
- projection.x.y, projection.y.y, projection.z.y,
- projection.x.z, projection.y.z, projection.z.z
+ projection.X.X, projection.Y.X, projection.Z.X,
+ projection.X.Y, projection.Y.Y, projection.Z.Y,
+ projection.X.Z, projection.Y.Z, projection.Z.Z
);
- origin = new Vector3
+ Origin = new Vector3
(
- projection.w.x,
- projection.w.y,
- projection.w.z
+ projection.W.X,
+ projection.W.Y,
+ projection.W.Z
);
}
@@ -408,8 +408,8 @@ namespace Godot
/// <returns>The composed transform.</returns>
public static Transform3D operator *(Transform3D left, Transform3D right)
{
- left.origin = left * right.origin;
- left.basis *= right.basis;
+ left.Origin = left * right.Origin;
+ left.Basis *= right.Basis;
return left;
}
@@ -423,9 +423,9 @@ namespace Godot
{
return new Vector3
(
- transform.basis.Row0.Dot(vector) + transform.origin.x,
- transform.basis.Row1.Dot(vector) + transform.origin.y,
- transform.basis.Row2.Dot(vector) + transform.origin.z
+ transform.Basis.Row0.Dot(vector) + transform.Origin.X,
+ transform.Basis.Row1.Dot(vector) + transform.Origin.Y,
+ transform.Basis.Row2.Dot(vector) + transform.Origin.Z
);
}
@@ -440,13 +440,13 @@ namespace Godot
/// <returns>The inversely transformed Vector3.</returns>
public static Vector3 operator *(Vector3 vector, Transform3D transform)
{
- Vector3 vInv = vector - transform.origin;
+ Vector3 vInv = vector - transform.Origin;
return new Vector3
(
- (transform.basis.Row0[0] * vInv.x) + (transform.basis.Row1[0] * vInv.y) + (transform.basis.Row2[0] * vInv.z),
- (transform.basis.Row0[1] * vInv.x) + (transform.basis.Row1[1] * vInv.y) + (transform.basis.Row2[1] * vInv.z),
- (transform.basis.Row0[2] * vInv.x) + (transform.basis.Row1[2] * vInv.y) + (transform.basis.Row2[2] * vInv.z)
+ (transform.Basis.Row0[0] * vInv.X) + (transform.Basis.Row1[0] * vInv.Y) + (transform.Basis.Row2[0] * vInv.Z),
+ (transform.Basis.Row0[1] * vInv.X) + (transform.Basis.Row1[1] * vInv.Y) + (transform.Basis.Row2[1] * vInv.Z),
+ (transform.Basis.Row0[2] * vInv.X) + (transform.Basis.Row1[2] * vInv.Y) + (transform.Basis.Row2[2] * vInv.Z)
);
}
@@ -456,19 +456,19 @@ namespace Godot
/// <param name="transform">The transformation to apply.</param>
/// <param name="aabb">An AABB to transform.</param>
/// <returns>The transformed AABB.</returns>
- public static AABB operator *(Transform3D transform, AABB aabb)
+ public static Aabb operator *(Transform3D transform, Aabb aabb)
{
Vector3 min = aabb.Position;
Vector3 max = aabb.Position + aabb.Size;
- Vector3 tmin = transform.origin;
- Vector3 tmax = transform.origin;
+ Vector3 tmin = transform.Origin;
+ Vector3 tmax = transform.Origin;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
- real_t e = transform.basis[i][j] * min[j];
- real_t f = transform.basis[i][j] * max[j];
+ real_t e = transform.Basis[i][j] * min[j];
+ real_t f = transform.Basis[i][j] * max[j];
if (e < f)
{
tmin[i] += e;
@@ -482,7 +482,7 @@ namespace Godot
}
}
- return new AABB(tmin, tmax - tmin);
+ return new Aabb(tmin, tmax - tmin);
}
/// <summary>
@@ -491,18 +491,18 @@ namespace Godot
/// <param name="aabb">An AABB to inversely transform.</param>
/// <param name="transform">The transformation to apply.</param>
/// <returns>The inversely transformed AABB.</returns>
- public static AABB operator *(AABB aabb, Transform3D transform)
+ public static Aabb operator *(Aabb aabb, Transform3D transform)
{
- Vector3 pos = new Vector3(aabb.Position.x + aabb.Size.x, aabb.Position.y + aabb.Size.y, aabb.Position.z + aabb.Size.z) * transform;
- Vector3 to1 = new Vector3(aabb.Position.x + aabb.Size.x, aabb.Position.y + aabb.Size.y, aabb.Position.z) * transform;
- Vector3 to2 = new Vector3(aabb.Position.x + aabb.Size.x, aabb.Position.y, aabb.Position.z + aabb.Size.z) * transform;
- Vector3 to3 = new Vector3(aabb.Position.x + aabb.Size.x, aabb.Position.y, aabb.Position.z) * transform;
- Vector3 to4 = new Vector3(aabb.Position.x, aabb.Position.y + aabb.Size.y, aabb.Position.z + aabb.Size.z) * transform;
- Vector3 to5 = new Vector3(aabb.Position.x, aabb.Position.y + aabb.Size.y, aabb.Position.z) * transform;
- Vector3 to6 = new Vector3(aabb.Position.x, aabb.Position.y, aabb.Position.z + aabb.Size.z) * transform;
- Vector3 to7 = new Vector3(aabb.Position.x, aabb.Position.y, aabb.Position.z) * transform;
+ Vector3 pos = new Vector3(aabb.Position.X + aabb.Size.X, aabb.Position.Y + aabb.Size.Y, aabb.Position.Z + aabb.Size.Z) * transform;
+ Vector3 to1 = new Vector3(aabb.Position.X + aabb.Size.X, aabb.Position.Y + aabb.Size.Y, aabb.Position.Z) * transform;
+ Vector3 to2 = new Vector3(aabb.Position.X + aabb.Size.X, aabb.Position.Y, aabb.Position.Z + aabb.Size.Z) * transform;
+ Vector3 to3 = new Vector3(aabb.Position.X + aabb.Size.X, aabb.Position.Y, aabb.Position.Z) * transform;
+ Vector3 to4 = new Vector3(aabb.Position.X, aabb.Position.Y + aabb.Size.Y, aabb.Position.Z + aabb.Size.Z) * transform;
+ Vector3 to5 = new Vector3(aabb.Position.X, aabb.Position.Y + aabb.Size.Y, aabb.Position.Z) * transform;
+ Vector3 to6 = new Vector3(aabb.Position.X, aabb.Position.Y, aabb.Position.Z + aabb.Size.Z) * transform;
+ Vector3 to7 = new Vector3(aabb.Position.X, aabb.Position.Y, aabb.Position.Z) * transform;
- return new AABB(pos, new Vector3()).Expand(to1).Expand(to2).Expand(to3).Expand(to4).Expand(to5).Expand(to6).Expand(to7);
+ return new Aabb(pos, new Vector3()).Expand(to1).Expand(to2).Expand(to3).Expand(to4).Expand(to5).Expand(to6).Expand(to7);
}
/// <summary>
@@ -513,7 +513,7 @@ namespace Godot
/// <returns>The transformed Plane.</returns>
public static Plane operator *(Transform3D transform, Plane plane)
{
- Basis bInvTrans = transform.basis.Inverse().Transposed();
+ Basis bInvTrans = transform.Basis.Inverse().Transposed();
// Transform a single point on the plane.
Vector3 point = transform * (plane.Normal * plane.D);
@@ -534,7 +534,7 @@ namespace Godot
public static Plane operator *(Plane plane, Transform3D transform)
{
Transform3D tInv = transform.AffineInverse();
- Basis bTrans = transform.basis.Transposed();
+ Basis bTrans = transform.Basis.Transposed();
// Transform a single point on the plane.
Vector3 point = tInv * (plane.Normal * plane.D);
@@ -637,7 +637,7 @@ namespace Godot
/// <returns>Whether or not the matrices are exactly equal.</returns>
public readonly bool Equals(Transform3D other)
{
- return basis.Equals(other.basis) && origin.Equals(other.origin);
+ return Basis.Equals(other.Basis) && Origin.Equals(other.Origin);
}
/// <summary>
@@ -648,7 +648,7 @@ namespace Godot
/// <returns>Whether or not the matrices are approximately equal.</returns>
public readonly bool IsEqualApprox(Transform3D other)
{
- return basis.IsEqualApprox(other.basis) && origin.IsEqualApprox(other.origin);
+ return Basis.IsEqualApprox(other.Basis) && Origin.IsEqualApprox(other.Origin);
}
/// <summary>
@@ -657,7 +657,7 @@ namespace Godot
/// <returns>A hash code for this transform.</returns>
public override readonly int GetHashCode()
{
- return basis.GetHashCode() ^ origin.GetHashCode();
+ return Basis.GetHashCode() ^ Origin.GetHashCode();
}
/// <summary>
@@ -666,7 +666,7 @@ namespace Godot
/// <returns>A string representation of this transform.</returns>
public override readonly string ToString()
{
- return $"[X: {basis.x}, Y: {basis.y}, Z: {basis.z}, O: {origin}]";
+ return $"[X: {Basis.X}, Y: {Basis.Y}, Z: {Basis.Z}, O: {Origin}]";
}
/// <summary>
@@ -675,7 +675,7 @@ namespace Godot
/// <returns>A string representation of this transform.</returns>
public readonly string ToString(string format)
{
- return $"[X: {basis.x.ToString(format)}, Y: {basis.y.ToString(format)}, Z: {basis.z.ToString(format)}, O: {origin.ToString(format)}]";
+ return $"[X: {Basis.X.ToString(format)}, Y: {Basis.Y.ToString(format)}, Z: {Basis.Z.ToString(format)}, O: {Origin.ToString(format)}]";
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Variant.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Variant.cs
index da12309217..9aad965ad0 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Variant.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Variant.cs
@@ -60,13 +60,13 @@ public partial struct Variant : IDisposable
case Type.Int:
case Type.Float:
case Type.Vector2:
- case Type.Vector2i:
+ case Type.Vector2I:
case Type.Rect2:
- case Type.Rect2i:
+ case Type.Rect2I:
case Type.Vector3:
- case Type.Vector3i:
+ case Type.Vector3I:
case Type.Vector4:
- case Type.Vector4i:
+ case Type.Vector4I:
case Type.Plane:
case Type.Quaternion:
case Type.Color:
@@ -117,24 +117,24 @@ public partial struct Variant : IDisposable
Type.Float => AsDouble(),
Type.String => AsString(),
Type.Vector2 => AsVector2(),
- Type.Vector2i => AsVector2i(),
+ Type.Vector2I => AsVector2I(),
Type.Rect2 => AsRect2(),
- Type.Rect2i => AsRect2i(),
+ Type.Rect2I => AsRect2I(),
Type.Vector3 => AsVector3(),
- Type.Vector3i => AsVector3i(),
- Type.Transform2d => AsTransform2D(),
+ Type.Vector3I => AsVector3I(),
+ Type.Transform2D => AsTransform2D(),
Type.Vector4 => AsVector4(),
- Type.Vector4i => AsVector4i(),
+ Type.Vector4I => AsVector4I(),
Type.Plane => AsPlane(),
Type.Quaternion => AsQuaternion(),
- Type.Aabb => AsAABB(),
+ Type.Aabb => AsAabb(),
Type.Basis => AsBasis(),
- Type.Transform3d => AsTransform3D(),
+ Type.Transform3D => AsTransform3D(),
Type.Projection => AsProjection(),
Type.Color => AsColor(),
Type.StringName => AsStringName(),
Type.NodePath => AsNodePath(),
- Type.Rid => AsRID(),
+ Type.Rid => AsRid(),
Type.Object => AsGodotObject(),
Type.Callable => AsCallable(),
Type.Signal => AsSignal(),
@@ -219,16 +219,16 @@ public partial struct Variant : IDisposable
VariantUtils.ConvertToVector2((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public Vector2i AsVector2i() =>
- VariantUtils.ConvertToVector2i((godot_variant)NativeVar);
+ public Vector2I AsVector2I() =>
+ VariantUtils.ConvertToVector2I((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Rect2 AsRect2() =>
VariantUtils.ConvertToRect2((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public Rect2i AsRect2i() =>
- VariantUtils.ConvertToRect2i((godot_variant)NativeVar);
+ public Rect2I AsRect2I() =>
+ VariantUtils.ConvertToRect2I((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Transform2D AsTransform2D() =>
@@ -239,8 +239,8 @@ public partial struct Variant : IDisposable
VariantUtils.ConvertToVector3((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public Vector3i AsVector3i() =>
- VariantUtils.ConvertToVector3i((godot_variant)NativeVar);
+ public Vector3I AsVector3I() =>
+ VariantUtils.ConvertToVector3I((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Basis AsBasis() =>
@@ -259,16 +259,16 @@ public partial struct Variant : IDisposable
VariantUtils.ConvertToVector4((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public Vector4i AsVector4i() =>
- VariantUtils.ConvertToVector4i((godot_variant)NativeVar);
+ public Vector4I AsVector4I() =>
+ VariantUtils.ConvertToVector4I((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Projection AsProjection() =>
VariantUtils.ConvertToProjection((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public AABB AsAABB() =>
- VariantUtils.ConvertToAABB((godot_variant)NativeVar);
+ public Aabb AsAabb() =>
+ VariantUtils.ConvertToAabb((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Color AsColor() =>
@@ -324,15 +324,15 @@ public partial struct Variant : IDisposable
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public T[] AsGodotObjectArray<T>()
- where T : Godot.Object =>
+ where T : GodotObject =>
VariantUtils.ConvertToSystemArrayOfGodotObject<T>((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public Collections.Dictionary<TKey, TValue> AsGodotDictionary<TKey, TValue>() =>
+ public Collections.Dictionary<TKey, TValue> AsGodotDictionary<[MustBeVariant] TKey, [MustBeVariant] TValue>() =>
VariantUtils.ConvertToDictionary<TKey, TValue>((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public Collections.Array<T> AsGodotArray<T>() =>
+ public Collections.Array<T> AsGodotArray<[MustBeVariant] T>() =>
VariantUtils.ConvertToArray<T>((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -344,11 +344,11 @@ public partial struct Variant : IDisposable
VariantUtils.ConvertToSystemArrayOfNodePath((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public RID[] AsSystemArrayOfRID() =>
- VariantUtils.ConvertToSystemArrayOfRID((godot_variant)NativeVar);
+ public Rid[] AsSystemArrayOfRid() =>
+ VariantUtils.ConvertToSystemArrayOfRid((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public Godot.Object AsGodotObject() =>
+ public GodotObject AsGodotObject() =>
VariantUtils.ConvertToGodotObject((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -360,8 +360,8 @@ public partial struct Variant : IDisposable
VariantUtils.ConvertToNodePath((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public RID AsRID() =>
- VariantUtils.ConvertToRID((godot_variant)NativeVar);
+ public Rid AsRid() =>
+ VariantUtils.ConvertToRid((godot_variant)NativeVar);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Collections.Dictionary AsGodotDictionary() =>
@@ -416,13 +416,13 @@ public partial struct Variant : IDisposable
public static explicit operator Vector2(Variant from) => from.AsVector2();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static explicit operator Vector2i(Variant from) => from.AsVector2i();
+ public static explicit operator Vector2I(Variant from) => from.AsVector2I();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Rect2(Variant from) => from.AsRect2();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static explicit operator Rect2i(Variant from) => from.AsRect2i();
+ public static explicit operator Rect2I(Variant from) => from.AsRect2I();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Transform2D(Variant from) => from.AsTransform2D();
@@ -431,7 +431,7 @@ public partial struct Variant : IDisposable
public static explicit operator Vector3(Variant from) => from.AsVector3();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static explicit operator Vector3i(Variant from) => from.AsVector3i();
+ public static explicit operator Vector3I(Variant from) => from.AsVector3I();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Basis(Variant from) => from.AsBasis();
@@ -446,13 +446,13 @@ public partial struct Variant : IDisposable
public static explicit operator Vector4(Variant from) => from.AsVector4();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static explicit operator Vector4i(Variant from) => from.AsVector4i();
+ public static explicit operator Vector4I(Variant from) => from.AsVector4I();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Projection(Variant from) => from.AsProjection();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static explicit operator AABB(Variant from) => from.AsAABB();
+ public static explicit operator Aabb(Variant from) => from.AsAabb();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Color(Variant from) => from.AsColor();
@@ -500,10 +500,10 @@ public partial struct Variant : IDisposable
public static explicit operator NodePath[](Variant from) => from.AsSystemArrayOfNodePath();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static explicit operator RID[](Variant from) => from.AsSystemArrayOfRID();
+ public static explicit operator Rid[](Variant from) => from.AsSystemArrayOfRid();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static explicit operator Godot.Object(Variant from) => from.AsGodotObject();
+ public static explicit operator GodotObject(Variant from) => from.AsGodotObject();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator StringName(Variant from) => from.AsStringName();
@@ -512,7 +512,7 @@ public partial struct Variant : IDisposable
public static explicit operator NodePath(Variant from) => from.AsNodePath();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static explicit operator RID(Variant from) => from.AsRID();
+ public static explicit operator Rid(Variant from) => from.AsRid();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Collections.Dictionary(Variant from) => from.AsGodotDictionary();
@@ -566,13 +566,13 @@ public partial struct Variant : IDisposable
public static Variant CreateFrom(Vector2 from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Variant CreateFrom(Vector2i from) => from;
+ public static Variant CreateFrom(Vector2I from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Rect2 from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Variant CreateFrom(Rect2i from) => from;
+ public static Variant CreateFrom(Rect2I from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Transform2D from) => from;
@@ -581,7 +581,7 @@ public partial struct Variant : IDisposable
public static Variant CreateFrom(Vector3 from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Variant CreateFrom(Vector3i from) => from;
+ public static Variant CreateFrom(Vector3I from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Basis from) => from;
@@ -596,13 +596,13 @@ public partial struct Variant : IDisposable
public static Variant CreateFrom(Vector4 from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Variant CreateFrom(Vector4i from) => from;
+ public static Variant CreateFrom(Vector4I from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Projection from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Variant CreateFrom(AABB from) => from;
+ public static Variant CreateFrom(Aabb from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Color from) => from;
@@ -644,14 +644,14 @@ public partial struct Variant : IDisposable
public static Variant CreateFrom(Span<Color> from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Variant CreateFrom(Godot.Object[] from) => from;
+ public static Variant CreateFrom(GodotObject[] from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Variant CreateFrom<TKey, TValue>(Collections.Dictionary<TKey, TValue> from) =>
+ public static Variant CreateFrom<[MustBeVariant] TKey, [MustBeVariant] TValue>(Collections.Dictionary<TKey, TValue> from) =>
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromDictionary(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Variant CreateFrom<T>(Collections.Array<T> from) =>
+ public static Variant CreateFrom<[MustBeVariant] T>(Collections.Array<T> from) =>
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromArray(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -661,10 +661,10 @@ public partial struct Variant : IDisposable
public static Variant CreateFrom(Span<NodePath> from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Variant CreateFrom(Span<RID> from) => from;
+ public static Variant CreateFrom(Span<Rid> from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Variant CreateFrom(Godot.Object from) => from;
+ public static Variant CreateFrom(GodotObject from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(StringName from) => from;
@@ -673,7 +673,7 @@ public partial struct Variant : IDisposable
public static Variant CreateFrom(NodePath from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Variant CreateFrom(RID from) => from;
+ public static Variant CreateFrom(Rid from) => from;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Variant CreateFrom(Collections.Dictionary from) => from;
@@ -740,16 +740,16 @@ public partial struct Variant : IDisposable
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector2(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static implicit operator Variant(Vector2i from) =>
- CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector2i(from));
+ public static implicit operator Variant(Vector2I from) =>
+ CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector2I(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Rect2 from) =>
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromRect2(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static implicit operator Variant(Rect2i from) =>
- CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromRect2i(from));
+ public static implicit operator Variant(Rect2I from) =>
+ CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromRect2I(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Transform2D from) =>
@@ -760,8 +760,8 @@ public partial struct Variant : IDisposable
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector3(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static implicit operator Variant(Vector3i from) =>
- CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector3i(from));
+ public static implicit operator Variant(Vector3I from) =>
+ CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector3I(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Basis from) =>
@@ -780,16 +780,16 @@ public partial struct Variant : IDisposable
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector4(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static implicit operator Variant(Vector4i from) =>
- CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector4i(from));
+ public static implicit operator Variant(Vector4I from) =>
+ CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromVector4I(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Projection from) =>
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromProjection(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static implicit operator Variant(AABB from) =>
- CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromAABB(from));
+ public static implicit operator Variant(Aabb from) =>
+ CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromAabb(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Color from) =>
@@ -844,7 +844,7 @@ public partial struct Variant : IDisposable
(Variant)from.AsSpan();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static implicit operator Variant(Godot.Object[] from) =>
+ public static implicit operator Variant(GodotObject[] from) =>
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromSystemArrayOfGodotObject(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -856,7 +856,7 @@ public partial struct Variant : IDisposable
(Variant)from.AsSpan();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static implicit operator Variant(RID[] from) =>
+ public static implicit operator Variant(Rid[] from) =>
(Variant)from.AsSpan();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -904,11 +904,11 @@ public partial struct Variant : IDisposable
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromSystemArrayOfNodePath(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static implicit operator Variant(Span<RID> from) =>
- CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromSystemArrayOfRID(from));
+ public static implicit operator Variant(Span<Rid> from) =>
+ CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromSystemArrayOfRid(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static implicit operator Variant(Godot.Object from) =>
+ public static implicit operator Variant(GodotObject from) =>
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromGodotObject(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -920,8 +920,8 @@ public partial struct Variant : IDisposable
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromNodePath(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static implicit operator Variant(RID from) =>
- CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromRID(from));
+ public static implicit operator Variant(Rid from) =>
+ CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromRid(from));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Variant(Collections.Dictionary from) =>
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
index 07cb34cadd..0bf8f25f06 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
@@ -29,12 +29,12 @@ namespace Godot
/// <summary>
/// The vector's X component. Also accessible by using the index position <c>[0]</c>.
/// </summary>
- public real_t x;
+ public real_t X;
/// <summary>
/// The vector's Y component. Also accessible by using the index position <c>[1]</c>.
/// </summary>
- public real_t y;
+ public real_t Y;
/// <summary>
/// Access vector components using their index.
@@ -43,8 +43,8 @@ namespace Godot
/// <paramref name="index"/> is not 0 or 1.
/// </exception>
/// <value>
- /// <c>[0]</c> is equivalent to <see cref="x"/>,
- /// <c>[1]</c> is equivalent to <see cref="y"/>.
+ /// <c>[0]</c> is equivalent to <see cref="X"/>,
+ /// <c>[1]</c> is equivalent to <see cref="Y"/>.
/// </value>
public real_t this[int index]
{
@@ -53,9 +53,9 @@ namespace Godot
switch (index)
{
case 0:
- return x;
+ return X;
case 1:
- return y;
+ return Y;
default:
throw new ArgumentOutOfRangeException(nameof(index));
}
@@ -65,10 +65,10 @@ namespace Godot
switch (index)
{
case 0:
- x = value;
+ X = value;
return;
case 1:
- y = value;
+ Y = value;
return;
default:
throw new ArgumentOutOfRangeException(nameof(index));
@@ -81,8 +81,8 @@ namespace Godot
/// </summary>
public readonly void Deconstruct(out real_t x, out real_t y)
{
- x = this.x;
- y = this.y;
+ x = X;
+ y = Y;
}
internal void Normalize()
@@ -91,13 +91,13 @@ namespace Godot
if (lengthsq == 0)
{
- x = y = 0f;
+ X = Y = 0f;
}
else
{
real_t length = Mathf.Sqrt(lengthsq);
- x /= length;
- y /= length;
+ X /= length;
+ Y /= length;
}
}
@@ -107,19 +107,19 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Abs(real_t)"/> called on each component.</returns>
public readonly Vector2 Abs()
{
- return new Vector2(Mathf.Abs(x), Mathf.Abs(y));
+ return new Vector2(Mathf.Abs(X), Mathf.Abs(Y));
}
/// <summary>
/// Returns this vector's angle with respect to the X axis, or (1, 0) vector, in radians.
///
/// Equivalent to the result of <see cref="Mathf.Atan2(real_t, real_t)"/> when
- /// called with the vector's <see cref="y"/> and <see cref="x"/> as parameters: <c>Mathf.Atan2(v.y, v.x)</c>.
+ /// called with the vector's <see cref="Y"/> and <see cref="X"/> as parameters: <c>Mathf.Atan2(v.Y, v.X)</c>.
/// </summary>
/// <returns>The angle of this vector, in radians.</returns>
public readonly real_t Angle()
{
- return Mathf.Atan2(y, x);
+ return Mathf.Atan2(Y, X);
}
/// <summary>
@@ -139,16 +139,16 @@ namespace Godot
/// <returns>The angle between the two vectors, in radians.</returns>
public readonly real_t AngleToPoint(Vector2 to)
{
- return Mathf.Atan2(to.y - y, to.x - x);
+ return Mathf.Atan2(to.Y - Y, to.X - X);
}
/// <summary>
- /// Returns the aspect ratio of this vector, the ratio of <see cref="x"/> to <see cref="y"/>.
+ /// Returns the aspect ratio of this vector, the ratio of <see cref="X"/> to <see cref="Y"/>.
/// </summary>
- /// <returns>The <see cref="x"/> component divided by the <see cref="y"/> component.</returns>
+ /// <returns>The <see cref="X"/> component divided by the <see cref="Y"/> component.</returns>
public readonly real_t Aspect()
{
- return x / y;
+ return X / Y;
}
/// <summary>
@@ -167,7 +167,7 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Ceil"/> called on each component.</returns>
public readonly Vector2 Ceil()
{
- return new Vector2(Mathf.Ceil(x), Mathf.Ceil(y));
+ return new Vector2(Mathf.Ceil(X), Mathf.Ceil(Y));
}
/// <summary>
@@ -182,8 +182,8 @@ namespace Godot
{
return new Vector2
(
- Mathf.Clamp(x, min.x, max.x),
- Mathf.Clamp(y, min.y, max.y)
+ Mathf.Clamp(X, min.X, max.X),
+ Mathf.Clamp(Y, min.Y, max.Y)
);
}
@@ -194,7 +194,7 @@ namespace Godot
/// <returns>The cross product value.</returns>
public readonly real_t Cross(Vector2 with)
{
- return (x * with.y) - (y * with.x);
+ return (X * with.Y) - (Y * with.X);
}
/// <summary>
@@ -210,8 +210,8 @@ namespace Godot
{
return new Vector2
(
- Mathf.CubicInterpolate(x, b.x, preA.x, postB.x, weight),
- Mathf.CubicInterpolate(y, b.y, preA.y, postB.y, weight)
+ Mathf.CubicInterpolate(X, b.X, preA.X, postB.X, weight),
+ Mathf.CubicInterpolate(Y, b.Y, preA.Y, postB.Y, weight)
);
}
@@ -233,8 +233,8 @@ namespace Godot
{
return new Vector2
(
- Mathf.CubicInterpolateInTime(x, b.x, preA.x, postB.x, weight, t, preAT, postBT),
- Mathf.CubicInterpolateInTime(y, b.y, preA.y, postB.y, weight, t, preAT, postBT)
+ Mathf.CubicInterpolateInTime(X, b.X, preA.X, postB.X, weight, t, preAT, postBT),
+ Mathf.CubicInterpolateInTime(Y, b.Y, preA.Y, postB.Y, weight, t, preAT, postBT)
);
}
@@ -251,8 +251,8 @@ namespace Godot
{
return new Vector2
(
- Mathf.BezierInterpolate(x, control1.x, control2.x, end.x, t),
- Mathf.BezierInterpolate(y, control1.y, control2.y, end.y, t)
+ Mathf.BezierInterpolate(X, control1.X, control2.X, end.X, t),
+ Mathf.BezierInterpolate(Y, control1.Y, control2.Y, end.Y, t)
);
}
@@ -268,8 +268,8 @@ namespace Godot
public readonly Vector2 BezierDerivative(Vector2 control1, Vector2 control2, Vector2 end, real_t t)
{
return new Vector2(
- Mathf.BezierDerivative(x, control1.x, control2.x, end.x, t),
- Mathf.BezierDerivative(y, control1.y, control2.y, end.y, t)
+ Mathf.BezierDerivative(X, control1.X, control2.X, end.X, t),
+ Mathf.BezierDerivative(Y, control1.Y, control2.Y, end.Y, t)
);
}
@@ -280,7 +280,7 @@ namespace Godot
/// <returns>The direction from this vector to <paramref name="to"/>.</returns>
public readonly Vector2 DirectionTo(Vector2 to)
{
- return new Vector2(to.x - x, to.y - y).Normalized();
+ return new Vector2(to.X - X, to.Y - Y).Normalized();
}
/// <summary>
@@ -292,7 +292,7 @@ namespace Godot
/// <returns>The squared distance between the two vectors.</returns>
public readonly real_t DistanceSquaredTo(Vector2 to)
{
- return (x - to.x) * (x - to.x) + (y - to.y) * (y - to.y);
+ return (X - to.X) * (X - to.X) + (Y - to.Y) * (Y - to.Y);
}
/// <summary>
@@ -302,7 +302,7 @@ namespace Godot
/// <returns>The distance between the two vectors.</returns>
public readonly real_t DistanceTo(Vector2 to)
{
- return Mathf.Sqrt((x - to.x) * (x - to.x) + (y - to.y) * (y - to.y));
+ return Mathf.Sqrt((X - to.X) * (X - to.X) + (Y - to.Y) * (Y - to.Y));
}
/// <summary>
@@ -312,7 +312,7 @@ namespace Godot
/// <returns>The dot product of the two vectors.</returns>
public readonly real_t Dot(Vector2 with)
{
- return (x * with.x) + (y * with.y);
+ return (X * with.X) + (Y * with.Y);
}
/// <summary>
@@ -321,16 +321,16 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Floor"/> called on each component.</returns>
public readonly Vector2 Floor()
{
- return new Vector2(Mathf.Floor(x), Mathf.Floor(y));
+ return new Vector2(Mathf.Floor(X), Mathf.Floor(Y));
}
/// <summary>
- /// Returns the inverse of this vector. This is the same as <c>new Vector2(1 / v.x, 1 / v.y)</c>.
+ /// Returns the inverse of this vector. This is the same as <c>new Vector2(1 / v.X, 1 / v.Y)</c>.
/// </summary>
/// <returns>The inverse of this vector.</returns>
public readonly Vector2 Inverse()
{
- return new Vector2(1 / x, 1 / y);
+ return new Vector2(1 / X, 1 / Y);
}
/// <summary>
@@ -340,7 +340,7 @@ namespace Godot
/// <returns>Whether this vector is finite or not.</returns>
public readonly bool IsFinite()
{
- return Mathf.IsFinite(x) && Mathf.IsFinite(y);
+ return Mathf.IsFinite(X) && Mathf.IsFinite(Y);
}
/// <summary>
@@ -359,7 +359,7 @@ namespace Godot
/// <returns>The length of this vector.</returns>
public readonly real_t Length()
{
- return Mathf.Sqrt((x * x) + (y * y));
+ return Mathf.Sqrt((X * X) + (Y * Y));
}
/// <summary>
@@ -370,7 +370,7 @@ namespace Godot
/// <returns>The squared length of this vector.</returns>
public readonly real_t LengthSquared()
{
- return (x * x) + (y * y);
+ return (X * X) + (Y * Y);
}
/// <summary>
@@ -384,8 +384,8 @@ namespace Godot
{
return new Vector2
(
- Mathf.Lerp(x, to.x, weight),
- Mathf.Lerp(y, to.y, weight)
+ Mathf.Lerp(X, to.X, weight),
+ Mathf.Lerp(Y, to.Y, weight)
);
}
@@ -415,7 +415,7 @@ namespace Godot
/// <returns>The index of the highest axis.</returns>
public readonly Axis MaxAxisIndex()
{
- return x < y ? Axis.Y : Axis.X;
+ return X < Y ? Axis.Y : Axis.X;
}
/// <summary>
@@ -425,7 +425,7 @@ namespace Godot
/// <returns>The index of the lowest axis.</returns>
public readonly Axis MinAxisIndex()
{
- return x < y ? Axis.X : Axis.Y;
+ return X < Y ? Axis.X : Axis.Y;
}
/// <summary>
@@ -467,8 +467,8 @@ namespace Godot
public readonly Vector2 PosMod(real_t mod)
{
Vector2 v;
- v.x = Mathf.PosMod(x, mod);
- v.y = Mathf.PosMod(y, mod);
+ v.X = Mathf.PosMod(X, mod);
+ v.Y = Mathf.PosMod(Y, mod);
return v;
}
@@ -483,8 +483,8 @@ namespace Godot
public readonly Vector2 PosMod(Vector2 modv)
{
Vector2 v;
- v.x = Mathf.PosMod(x, modv.x);
- v.y = Mathf.PosMod(y, modv.y);
+ v.X = Mathf.PosMod(X, modv.X);
+ v.Y = Mathf.PosMod(Y, modv.Y);
return v;
}
@@ -524,8 +524,8 @@ namespace Godot
(real_t sin, real_t cos) = Mathf.SinCos(angle);
return new Vector2
(
- x * cos - y * sin,
- x * sin + y * cos
+ X * cos - Y * sin,
+ X * sin + Y * cos
);
}
@@ -536,7 +536,7 @@ namespace Godot
/// <returns>The rounded vector.</returns>
public readonly Vector2 Round()
{
- return new Vector2(Mathf.Round(x), Mathf.Round(y));
+ return new Vector2(Mathf.Round(X), Mathf.Round(Y));
}
/// <summary>
@@ -548,8 +548,8 @@ namespace Godot
public readonly Vector2 Sign()
{
Vector2 v;
- v.x = Mathf.Sign(x);
- v.y = Mathf.Sign(y);
+ v.X = Mathf.Sign(X);
+ v.Y = Mathf.Sign(Y);
return v;
}
@@ -597,7 +597,7 @@ namespace Godot
/// <returns>The snapped vector.</returns>
public readonly Vector2 Snapped(Vector2 step)
{
- return new Vector2(Mathf.Snapped(x, step.x), Mathf.Snapped(y, step.y));
+ return new Vector2(Mathf.Snapped(X, step.X), Mathf.Snapped(Y, step.Y));
}
/// <summary>
@@ -607,7 +607,7 @@ namespace Godot
/// <returns>The perpendicular vector.</returns>
public readonly Vector2 Orthogonal()
{
- return new Vector2(y, -x);
+ return new Vector2(Y, -X);
}
// Constants
@@ -664,8 +664,8 @@ namespace Godot
/// <param name="y">The vector's Y component.</param>
public Vector2(real_t x, real_t y)
{
- this.x = x;
- this.y = y;
+ X = x;
+ Y = y;
}
/// <summary>
@@ -689,8 +689,8 @@ namespace Godot
/// <returns>The added vector.</returns>
public static Vector2 operator +(Vector2 left, Vector2 right)
{
- left.x += right.x;
- left.y += right.y;
+ left.X += right.X;
+ left.Y += right.Y;
return left;
}
@@ -703,14 +703,14 @@ namespace Godot
/// <returns>The subtracted vector.</returns>
public static Vector2 operator -(Vector2 left, Vector2 right)
{
- left.x -= right.x;
- left.y -= right.y;
+ left.X -= right.X;
+ left.Y -= right.Y;
return left;
}
/// <summary>
/// Returns the negative value of the <see cref="Vector2"/>.
- /// This is the same as writing <c>new Vector2(-v.x, -v.y)</c>.
+ /// This is the same as writing <c>new Vector2(-v.X, -v.Y)</c>.
/// This operation flips the direction of the vector while
/// keeping the same magnitude.
/// With floats, the number zero can be either positive or negative.
@@ -719,8 +719,8 @@ namespace Godot
/// <returns>The negated/flipped vector.</returns>
public static Vector2 operator -(Vector2 vec)
{
- vec.x = -vec.x;
- vec.y = -vec.y;
+ vec.X = -vec.X;
+ vec.Y = -vec.Y;
return vec;
}
@@ -733,8 +733,8 @@ namespace Godot
/// <returns>The multiplied vector.</returns>
public static Vector2 operator *(Vector2 vec, real_t scale)
{
- vec.x *= scale;
- vec.y *= scale;
+ vec.X *= scale;
+ vec.Y *= scale;
return vec;
}
@@ -747,8 +747,8 @@ namespace Godot
/// <returns>The multiplied vector.</returns>
public static Vector2 operator *(real_t scale, Vector2 vec)
{
- vec.x *= scale;
- vec.y *= scale;
+ vec.X *= scale;
+ vec.Y *= scale;
return vec;
}
@@ -761,8 +761,8 @@ namespace Godot
/// <returns>The multiplied vector.</returns>
public static Vector2 operator *(Vector2 left, Vector2 right)
{
- left.x *= right.x;
- left.y *= right.y;
+ left.X *= right.X;
+ left.Y *= right.Y;
return left;
}
@@ -775,8 +775,8 @@ namespace Godot
/// <returns>The divided vector.</returns>
public static Vector2 operator /(Vector2 vec, real_t divisor)
{
- vec.x /= divisor;
- vec.y /= divisor;
+ vec.X /= divisor;
+ vec.Y /= divisor;
return vec;
}
@@ -789,8 +789,8 @@ namespace Godot
/// <returns>The divided vector.</returns>
public static Vector2 operator /(Vector2 vec, Vector2 divisorv)
{
- vec.x /= divisorv.x;
- vec.y /= divisorv.y;
+ vec.X /= divisorv.X;
+ vec.Y /= divisorv.Y;
return vec;
}
@@ -812,8 +812,8 @@ namespace Godot
/// <returns>The remainder vector.</returns>
public static Vector2 operator %(Vector2 vec, real_t divisor)
{
- vec.x %= divisor;
- vec.y %= divisor;
+ vec.X %= divisor;
+ vec.Y %= divisor;
return vec;
}
@@ -835,8 +835,8 @@ namespace Godot
/// <returns>The remainder vector.</returns>
public static Vector2 operator %(Vector2 vec, Vector2 divisorv)
{
- vec.x %= divisorv.x;
- vec.y %= divisorv.y;
+ vec.X %= divisorv.X;
+ vec.Y %= divisorv.Y;
return vec;
}
@@ -879,11 +879,11 @@ namespace Godot
/// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Vector2 left, Vector2 right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- return left.y < right.y;
+ return left.Y < right.Y;
}
- return left.x < right.x;
+ return left.X < right.X;
}
/// <summary>
@@ -899,11 +899,11 @@ namespace Godot
/// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Vector2 left, Vector2 right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- return left.y > right.y;
+ return left.Y > right.Y;
}
- return left.x > right.x;
+ return left.X > right.X;
}
/// <summary>
@@ -919,11 +919,11 @@ namespace Godot
/// <returns>Whether or not the left is less than or equal to the right.</returns>
public static bool operator <=(Vector2 left, Vector2 right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- return left.y <= right.y;
+ return left.Y <= right.Y;
}
- return left.x < right.x;
+ return left.X < right.X;
}
/// <summary>
@@ -939,11 +939,11 @@ namespace Godot
/// <returns>Whether or not the left is greater than or equal to the right.</returns>
public static bool operator >=(Vector2 left, Vector2 right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- return left.y >= right.y;
+ return left.Y >= right.Y;
}
- return left.x > right.x;
+ return left.X > right.X;
}
/// <summary>
@@ -968,7 +968,7 @@ namespace Godot
/// <returns>Whether or not the vectors are exactly equal.</returns>
public readonly bool Equals(Vector2 other)
{
- return x == other.x && y == other.y;
+ return X == other.X && Y == other.Y;
}
/// <summary>
@@ -979,7 +979,7 @@ namespace Godot
/// <returns>Whether or not the vectors are approximately equal.</returns>
public readonly bool IsEqualApprox(Vector2 other)
{
- return Mathf.IsEqualApprox(x, other.x) && Mathf.IsEqualApprox(y, other.y);
+ return Mathf.IsEqualApprox(X, other.X) && Mathf.IsEqualApprox(Y, other.Y);
}
/// <summary>
@@ -991,7 +991,7 @@ namespace Godot
/// <returns>Whether or not the vector is approximately zero.</returns>
public readonly bool IsZeroApprox()
{
- return Mathf.IsZeroApprox(x) && Mathf.IsZeroApprox(y);
+ return Mathf.IsZeroApprox(X) && Mathf.IsZeroApprox(Y);
}
/// <summary>
@@ -1000,7 +1000,7 @@ namespace Godot
/// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode()
{
- return y.GetHashCode() ^ x.GetHashCode();
+ return Y.GetHashCode() ^ X.GetHashCode();
}
/// <summary>
@@ -1009,7 +1009,7 @@ namespace Godot
/// <returns>A string representation of this vector.</returns>
public override readonly string ToString()
{
- return $"({x}, {y})";
+ return $"({X}, {Y})";
}
/// <summary>
@@ -1018,7 +1018,7 @@ namespace Godot
/// <returns>A string representation of this vector.</returns>
public readonly string ToString(string format)
{
- return $"({x.ToString(format)}, {y.ToString(format)})";
+ return $"({X.ToString(format)}, {Y.ToString(format)})";
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs
index 740fedec66..e849939ebb 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs
@@ -8,7 +8,7 @@ namespace Godot
/// </summary>
[Serializable]
[StructLayout(LayoutKind.Sequential)]
- public struct Vector2i : IEquatable<Vector2i>
+ public struct Vector2I : IEquatable<Vector2I>
{
/// <summary>
/// Enumerated index values for the axes.
@@ -29,12 +29,12 @@ namespace Godot
/// <summary>
/// The vector's X component. Also accessible by using the index position <c>[0]</c>.
/// </summary>
- public int x;
+ public int X;
/// <summary>
/// The vector's Y component. Also accessible by using the index position <c>[1]</c>.
/// </summary>
- public int y;
+ public int Y;
/// <summary>
/// Access vector components using their index.
@@ -43,8 +43,8 @@ namespace Godot
/// <paramref name="index"/> is not 0 or 1.
/// </exception>
/// <value>
- /// <c>[0]</c> is equivalent to <see cref="x"/>,
- /// <c>[1]</c> is equivalent to <see cref="y"/>.
+ /// <c>[0]</c> is equivalent to <see cref="X"/>,
+ /// <c>[1]</c> is equivalent to <see cref="Y"/>.
/// </value>
public int this[int index]
{
@@ -53,9 +53,9 @@ namespace Godot
switch (index)
{
case 0:
- return x;
+ return X;
case 1:
- return y;
+ return Y;
default:
throw new ArgumentOutOfRangeException(nameof(index));
}
@@ -65,10 +65,10 @@ namespace Godot
switch (index)
{
case 0:
- x = value;
+ X = value;
return;
case 1:
- y = value;
+ Y = value;
return;
default:
throw new ArgumentOutOfRangeException(nameof(index));
@@ -81,26 +81,26 @@ namespace Godot
/// </summary>
public readonly void Deconstruct(out int x, out int y)
{
- x = this.x;
- y = this.y;
+ x = X;
+ y = Y;
}
/// <summary>
/// Returns a new vector with all components in absolute values (i.e. positive).
/// </summary>
/// <returns>A vector with <see cref="Mathf.Abs(int)"/> called on each component.</returns>
- public readonly Vector2i Abs()
+ public readonly Vector2I Abs()
{
- return new Vector2i(Mathf.Abs(x), Mathf.Abs(y));
+ return new Vector2I(Mathf.Abs(X), Mathf.Abs(Y));
}
/// <summary>
- /// Returns the aspect ratio of this vector, the ratio of <see cref="x"/> to <see cref="y"/>.
+ /// Returns the aspect ratio of this vector, the ratio of <see cref="X"/> to <see cref="Y"/>.
/// </summary>
- /// <returns>The <see cref="x"/> component divided by the <see cref="y"/> component.</returns>
+ /// <returns>The <see cref="X"/> component divided by the <see cref="Y"/> component.</returns>
public readonly real_t Aspect()
{
- return x / (real_t)y;
+ return X / (real_t)Y;
}
/// <summary>
@@ -111,12 +111,12 @@ namespace Godot
/// <param name="min">The vector with minimum allowed values.</param>
/// <param name="max">The vector with maximum allowed values.</param>
/// <returns>The vector with all components clamped.</returns>
- public readonly Vector2i Clamp(Vector2i min, Vector2i max)
+ public readonly Vector2I Clamp(Vector2I min, Vector2I max)
{
- return new Vector2i
+ return new Vector2I
(
- Mathf.Clamp(x, min.x, max.x),
- Mathf.Clamp(y, min.y, max.y)
+ Mathf.Clamp(X, min.X, max.X),
+ Mathf.Clamp(Y, min.Y, max.Y)
);
}
@@ -127,8 +127,8 @@ namespace Godot
/// <returns>The length of this vector.</returns>
public readonly real_t Length()
{
- int x2 = x * x;
- int y2 = y * y;
+ int x2 = X * X;
+ int y2 = Y * Y;
return Mathf.Sqrt(x2 + y2);
}
@@ -141,8 +141,8 @@ namespace Godot
/// <returns>The squared length of this vector.</returns>
public readonly int LengthSquared()
{
- int x2 = x * x;
- int y2 = y * y;
+ int x2 = X * X;
+ int y2 = Y * Y;
return x2 + y2;
}
@@ -154,7 +154,7 @@ namespace Godot
/// <returns>The index of the highest axis.</returns>
public readonly Axis MaxAxisIndex()
{
- return x < y ? Axis.Y : Axis.X;
+ return X < Y ? Axis.Y : Axis.X;
}
/// <summary>
@@ -164,7 +164,7 @@ namespace Godot
/// <returns>The index of the lowest axis.</returns>
public readonly Axis MinAxisIndex()
{
- return x < y ? Axis.X : Axis.Y;
+ return X < Y ? Axis.X : Axis.Y;
}
/// <summary>
@@ -173,181 +173,181 @@ namespace Godot
/// by calling <see cref="Mathf.Sign(int)"/> on each component.
/// </summary>
/// <returns>A vector with all components as either <c>1</c>, <c>-1</c>, or <c>0</c>.</returns>
- public readonly Vector2i Sign()
+ public readonly Vector2I Sign()
{
- Vector2i v = this;
- v.x = Mathf.Sign(v.x);
- v.y = Mathf.Sign(v.y);
+ Vector2I v = this;
+ v.X = Mathf.Sign(v.X);
+ v.Y = Mathf.Sign(v.Y);
return v;
}
// Constants
- private static readonly Vector2i _zero = new Vector2i(0, 0);
- private static readonly Vector2i _one = new Vector2i(1, 1);
+ private static readonly Vector2I _zero = new Vector2I(0, 0);
+ private static readonly Vector2I _one = new Vector2I(1, 1);
- private static readonly Vector2i _up = new Vector2i(0, -1);
- private static readonly Vector2i _down = new Vector2i(0, 1);
- private static readonly Vector2i _right = new Vector2i(1, 0);
- private static readonly Vector2i _left = new Vector2i(-1, 0);
+ private static readonly Vector2I _up = new Vector2I(0, -1);
+ private static readonly Vector2I _down = new Vector2I(0, 1);
+ private static readonly Vector2I _right = new Vector2I(1, 0);
+ private static readonly Vector2I _left = new Vector2I(-1, 0);
/// <summary>
/// Zero vector, a vector with all components set to <c>0</c>.
/// </summary>
- /// <value>Equivalent to <c>new Vector2i(0, 0)</c>.</value>
- public static Vector2i Zero { get { return _zero; } }
+ /// <value>Equivalent to <c>new Vector2I(0, 0)</c>.</value>
+ public static Vector2I Zero { get { return _zero; } }
/// <summary>
/// One vector, a vector with all components set to <c>1</c>.
/// </summary>
- /// <value>Equivalent to <c>new Vector2i(1, 1)</c>.</value>
- public static Vector2i One { get { return _one; } }
+ /// <value>Equivalent to <c>new Vector2I(1, 1)</c>.</value>
+ public static Vector2I One { get { return _one; } }
/// <summary>
/// Up unit vector. Y is down in 2D, so this vector points -Y.
/// </summary>
- /// <value>Equivalent to <c>new Vector2i(0, -1)</c>.</value>
- public static Vector2i Up { get { return _up; } }
+ /// <value>Equivalent to <c>new Vector2I(0, -1)</c>.</value>
+ public static Vector2I Up { get { return _up; } }
/// <summary>
/// Down unit vector. Y is down in 2D, so this vector points +Y.
/// </summary>
- /// <value>Equivalent to <c>new Vector2i(0, 1)</c>.</value>
- public static Vector2i Down { get { return _down; } }
+ /// <value>Equivalent to <c>new Vector2I(0, 1)</c>.</value>
+ public static Vector2I Down { get { return _down; } }
/// <summary>
/// Right unit vector. Represents the direction of right.
/// </summary>
- /// <value>Equivalent to <c>new Vector2i(1, 0)</c>.</value>
- public static Vector2i Right { get { return _right; } }
+ /// <value>Equivalent to <c>new Vector2I(1, 0)</c>.</value>
+ public static Vector2I Right { get { return _right; } }
/// <summary>
/// Left unit vector. Represents the direction of left.
/// </summary>
- /// <value>Equivalent to <c>new Vector2i(-1, 0)</c>.</value>
- public static Vector2i Left { get { return _left; } }
+ /// <value>Equivalent to <c>new Vector2I(-1, 0)</c>.</value>
+ public static Vector2I Left { get { return _left; } }
/// <summary>
- /// Constructs a new <see cref="Vector2i"/> with the given components.
+ /// Constructs a new <see cref="Vector2I"/> with the given components.
/// </summary>
/// <param name="x">The vector's X component.</param>
/// <param name="y">The vector's Y component.</param>
- public Vector2i(int x, int y)
+ public Vector2I(int x, int y)
{
- this.x = x;
- this.y = y;
+ X = x;
+ Y = y;
}
/// <summary>
- /// Adds each component of the <see cref="Vector2i"/>
- /// with the components of the given <see cref="Vector2i"/>.
+ /// Adds each component of the <see cref="Vector2I"/>
+ /// with the components of the given <see cref="Vector2I"/>.
/// </summary>
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>The added vector.</returns>
- public static Vector2i operator +(Vector2i left, Vector2i right)
+ public static Vector2I operator +(Vector2I left, Vector2I right)
{
- left.x += right.x;
- left.y += right.y;
+ left.X += right.X;
+ left.Y += right.Y;
return left;
}
/// <summary>
- /// Subtracts each component of the <see cref="Vector2i"/>
- /// by the components of the given <see cref="Vector2i"/>.
+ /// Subtracts each component of the <see cref="Vector2I"/>
+ /// by the components of the given <see cref="Vector2I"/>.
/// </summary>
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>The subtracted vector.</returns>
- public static Vector2i operator -(Vector2i left, Vector2i right)
+ public static Vector2I operator -(Vector2I left, Vector2I right)
{
- left.x -= right.x;
- left.y -= right.y;
+ left.X -= right.X;
+ left.Y -= right.Y;
return left;
}
/// <summary>
- /// Returns the negative value of the <see cref="Vector2i"/>.
- /// This is the same as writing <c>new Vector2i(-v.x, -v.y)</c>.
+ /// Returns the negative value of the <see cref="Vector2I"/>.
+ /// This is the same as writing <c>new Vector2I(-v.X, -v.Y)</c>.
/// This operation flips the direction of the vector while
/// keeping the same magnitude.
/// </summary>
/// <param name="vec">The vector to negate/flip.</param>
/// <returns>The negated/flipped vector.</returns>
- public static Vector2i operator -(Vector2i vec)
+ public static Vector2I operator -(Vector2I vec)
{
- vec.x = -vec.x;
- vec.y = -vec.y;
+ vec.X = -vec.X;
+ vec.Y = -vec.Y;
return vec;
}
/// <summary>
- /// Multiplies each component of the <see cref="Vector2i"/>
+ /// Multiplies each component of the <see cref="Vector2I"/>
/// by the given <see langword="int"/>.
/// </summary>
/// <param name="vec">The vector to multiply.</param>
/// <param name="scale">The scale to multiply by.</param>
/// <returns>The multiplied vector.</returns>
- public static Vector2i operator *(Vector2i vec, int scale)
+ public static Vector2I operator *(Vector2I vec, int scale)
{
- vec.x *= scale;
- vec.y *= scale;
+ vec.X *= scale;
+ vec.Y *= scale;
return vec;
}
/// <summary>
- /// Multiplies each component of the <see cref="Vector2i"/>
+ /// Multiplies each component of the <see cref="Vector2I"/>
/// by the given <see langword="int"/>.
/// </summary>
/// <param name="scale">The scale to multiply by.</param>
/// <param name="vec">The vector to multiply.</param>
/// <returns>The multiplied vector.</returns>
- public static Vector2i operator *(int scale, Vector2i vec)
+ public static Vector2I operator *(int scale, Vector2I vec)
{
- vec.x *= scale;
- vec.y *= scale;
+ vec.X *= scale;
+ vec.Y *= scale;
return vec;
}
/// <summary>
- /// Multiplies each component of the <see cref="Vector2i"/>
- /// by the components of the given <see cref="Vector2i"/>.
+ /// Multiplies each component of the <see cref="Vector2I"/>
+ /// by the components of the given <see cref="Vector2I"/>.
/// </summary>
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>The multiplied vector.</returns>
- public static Vector2i operator *(Vector2i left, Vector2i right)
+ public static Vector2I operator *(Vector2I left, Vector2I right)
{
- left.x *= right.x;
- left.y *= right.y;
+ left.X *= right.X;
+ left.Y *= right.Y;
return left;
}
/// <summary>
- /// Divides each component of the <see cref="Vector2i"/>
+ /// Divides each component of the <see cref="Vector2I"/>
/// by the given <see langword="int"/>.
/// </summary>
/// <param name="vec">The dividend vector.</param>
/// <param name="divisor">The divisor value.</param>
/// <returns>The divided vector.</returns>
- public static Vector2i operator /(Vector2i vec, int divisor)
+ public static Vector2I operator /(Vector2I vec, int divisor)
{
- vec.x /= divisor;
- vec.y /= divisor;
+ vec.X /= divisor;
+ vec.Y /= divisor;
return vec;
}
/// <summary>
- /// Divides each component of the <see cref="Vector2i"/>
- /// by the components of the given <see cref="Vector2i"/>.
+ /// Divides each component of the <see cref="Vector2I"/>
+ /// by the components of the given <see cref="Vector2I"/>.
/// </summary>
/// <param name="vec">The dividend vector.</param>
/// <param name="divisorv">The divisor vector.</param>
/// <returns>The divided vector.</returns>
- public static Vector2i operator /(Vector2i vec, Vector2i divisorv)
+ public static Vector2I operator /(Vector2I vec, Vector2I divisorv)
{
- vec.x /= divisorv.x;
- vec.y /= divisorv.y;
+ vec.X /= divisorv.X;
+ vec.Y /= divisorv.Y;
return vec;
}
/// <summary>
- /// Gets the remainder of each component of the <see cref="Vector2i"/>
+ /// Gets the remainder of each component of the <see cref="Vector2I"/>
/// with the components of the given <see langword="int"/>.
/// This operation uses truncated division, which is often not desired
/// as it does not work well with negative numbers.
@@ -356,22 +356,22 @@ namespace Godot
/// </summary>
/// <example>
/// <code>
- /// GD.Print(new Vector2i(10, -20) % 7); // Prints "(3, -6)"
+ /// GD.Print(new Vector2I(10, -20) % 7); // Prints "(3, -6)"
/// </code>
/// </example>
/// <param name="vec">The dividend vector.</param>
/// <param name="divisor">The divisor value.</param>
/// <returns>The remainder vector.</returns>
- public static Vector2i operator %(Vector2i vec, int divisor)
+ public static Vector2I operator %(Vector2I vec, int divisor)
{
- vec.x %= divisor;
- vec.y %= divisor;
+ vec.X %= divisor;
+ vec.Y %= divisor;
return vec;
}
/// <summary>
- /// Gets the remainder of each component of the <see cref="Vector2i"/>
- /// with the components of the given <see cref="Vector2i"/>.
+ /// Gets the remainder of each component of the <see cref="Vector2I"/>
+ /// with the components of the given <see cref="Vector2I"/>.
/// This operation uses truncated division, which is often not desired
/// as it does not work well with negative numbers.
/// Consider using <see cref="Mathf.PosMod(int, int)"/> instead
@@ -379,16 +379,16 @@ namespace Godot
/// </summary>
/// <example>
/// <code>
- /// GD.Print(new Vector2i(10, -20) % new Vector2i(7, 8)); // Prints "(3, -4)"
+ /// GD.Print(new Vector2I(10, -20) % new Vector2I(7, 8)); // Prints "(3, -4)"
/// </code>
/// </example>
/// <param name="vec">The dividend vector.</param>
/// <param name="divisorv">The divisor vector.</param>
/// <returns>The remainder vector.</returns>
- public static Vector2i operator %(Vector2i vec, Vector2i divisorv)
+ public static Vector2I operator %(Vector2I vec, Vector2I divisorv)
{
- vec.x %= divisorv.x;
- vec.y %= divisorv.y;
+ vec.X %= divisorv.X;
+ vec.Y %= divisorv.Y;
return vec;
}
@@ -398,7 +398,7 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the vectors are equal.</returns>
- public static bool operator ==(Vector2i left, Vector2i right)
+ public static bool operator ==(Vector2I left, Vector2I right)
{
return left.Equals(right);
}
@@ -409,13 +409,13 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the vectors are not equal.</returns>
- public static bool operator !=(Vector2i left, Vector2i right)
+ public static bool operator !=(Vector2I left, Vector2I right)
{
return !left.Equals(right);
}
/// <summary>
- /// Compares two <see cref="Vector2i"/> vectors by first checking if
+ /// Compares two <see cref="Vector2I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is less than
/// the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check
@@ -425,17 +425,17 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is less than the right.</returns>
- public static bool operator <(Vector2i left, Vector2i right)
+ public static bool operator <(Vector2I left, Vector2I right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- return left.y < right.y;
+ return left.Y < right.Y;
}
- return left.x < right.x;
+ return left.X < right.X;
}
/// <summary>
- /// Compares two <see cref="Vector2i"/> vectors by first checking if
+ /// Compares two <see cref="Vector2I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is greater than
/// the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check
@@ -445,17 +445,17 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is greater than the right.</returns>
- public static bool operator >(Vector2i left, Vector2i right)
+ public static bool operator >(Vector2I left, Vector2I right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- return left.y > right.y;
+ return left.Y > right.Y;
}
- return left.x > right.x;
+ return left.X > right.X;
}
/// <summary>
- /// Compares two <see cref="Vector2i"/> vectors by first checking if
+ /// Compares two <see cref="Vector2I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is less than
/// or equal to the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check
@@ -465,17 +465,17 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is less than or equal to the right.</returns>
- public static bool operator <=(Vector2i left, Vector2i right)
+ public static bool operator <=(Vector2I left, Vector2I right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- return left.y <= right.y;
+ return left.Y <= right.Y;
}
- return left.x < right.x;
+ return left.X < right.X;
}
/// <summary>
- /// Compares two <see cref="Vector2i"/> vectors by first checking if
+ /// Compares two <see cref="Vector2I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is greater than
/// or equal to the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check
@@ -485,33 +485,33 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is greater than or equal to the right.</returns>
- public static bool operator >=(Vector2i left, Vector2i right)
+ public static bool operator >=(Vector2I left, Vector2I right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- return left.y >= right.y;
+ return left.Y >= right.Y;
}
- return left.x > right.x;
+ return left.X > right.X;
}
/// <summary>
- /// Converts this <see cref="Vector2i"/> to a <see cref="Vector2"/>.
+ /// Converts this <see cref="Vector2I"/> to a <see cref="Vector2"/>.
/// </summary>
/// <param name="value">The vector to convert.</param>
- public static implicit operator Vector2(Vector2i value)
+ public static implicit operator Vector2(Vector2I value)
{
- return new Vector2(value.x, value.y);
+ return new Vector2(value.X, value.Y);
}
/// <summary>
- /// Converts a <see cref="Vector2"/> to a <see cref="Vector2i"/>.
+ /// Converts a <see cref="Vector2"/> to a <see cref="Vector2I"/>.
/// </summary>
/// <param name="value">The vector to convert.</param>
- public static explicit operator Vector2i(Vector2 value)
+ public static explicit operator Vector2I(Vector2 value)
{
- return new Vector2i(
- Mathf.RoundToInt(value.x),
- Mathf.RoundToInt(value.y)
+ return new Vector2I(
+ Mathf.RoundToInt(value.X),
+ Mathf.RoundToInt(value.Y)
);
}
@@ -523,7 +523,7 @@ namespace Godot
/// <returns>Whether or not the vector and the object are equal.</returns>
public override readonly bool Equals(object obj)
{
- return obj is Vector2i other && Equals(other);
+ return obj is Vector2I other && Equals(other);
}
/// <summary>
@@ -531,36 +531,36 @@ namespace Godot
/// </summary>
/// <param name="other">The other vector.</param>
/// <returns>Whether or not the vectors are equal.</returns>
- public readonly bool Equals(Vector2i other)
+ public readonly bool Equals(Vector2I other)
{
- return x == other.x && y == other.y;
+ return X == other.X && Y == other.Y;
}
/// <summary>
- /// Serves as the hash function for <see cref="Vector2i"/>.
+ /// Serves as the hash function for <see cref="Vector2I"/>.
/// </summary>
/// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode()
{
- return y.GetHashCode() ^ x.GetHashCode();
+ return Y.GetHashCode() ^ X.GetHashCode();
}
/// <summary>
- /// Converts this <see cref="Vector2i"/> to a string.
+ /// Converts this <see cref="Vector2I"/> to a string.
/// </summary>
/// <returns>A string representation of this vector.</returns>
public override readonly string ToString()
{
- return $"({x}, {y})";
+ return $"({X}, {Y})";
}
/// <summary>
- /// Converts this <see cref="Vector2i"/> to a string with the given <paramref name="format"/>.
+ /// Converts this <see cref="Vector2I"/> to a string with the given <paramref name="format"/>.
/// </summary>
/// <returns>A string representation of this vector.</returns>
public readonly string ToString(string format)
{
- return $"({x.ToString(format)}, {y.ToString(format)})";
+ return $"({X.ToString(format)}, {Y.ToString(format)})";
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
index b017ba5853..c773c0fda6 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
@@ -33,17 +33,17 @@ namespace Godot
/// <summary>
/// The vector's X component. Also accessible by using the index position <c>[0]</c>.
/// </summary>
- public real_t x;
+ public real_t X;
/// <summary>
/// The vector's Y component. Also accessible by using the index position <c>[1]</c>.
/// </summary>
- public real_t y;
+ public real_t Y;
/// <summary>
/// The vector's Z component. Also accessible by using the index position <c>[2]</c>.
/// </summary>
- public real_t z;
+ public real_t Z;
/// <summary>
/// Access vector components using their index.
@@ -52,9 +52,9 @@ namespace Godot
/// <paramref name="index"/> is not 0, 1 or 2.
/// </exception>
/// <value>
- /// <c>[0]</c> is equivalent to <see cref="x"/>,
- /// <c>[1]</c> is equivalent to <see cref="y"/>,
- /// <c>[2]</c> is equivalent to <see cref="z"/>.
+ /// <c>[0]</c> is equivalent to <see cref="X"/>,
+ /// <c>[1]</c> is equivalent to <see cref="Y"/>,
+ /// <c>[2]</c> is equivalent to <see cref="Z"/>.
/// </value>
public real_t this[int index]
{
@@ -63,11 +63,11 @@ namespace Godot
switch (index)
{
case 0:
- return x;
+ return X;
case 1:
- return y;
+ return Y;
case 2:
- return z;
+ return Z;
default:
throw new ArgumentOutOfRangeException(nameof(index));
}
@@ -77,13 +77,13 @@ namespace Godot
switch (index)
{
case 0:
- x = value;
+ X = value;
return;
case 1:
- y = value;
+ Y = value;
return;
case 2:
- z = value;
+ Z = value;
return;
default:
throw new ArgumentOutOfRangeException(nameof(index));
@@ -96,9 +96,9 @@ namespace Godot
/// </summary>
public readonly void Deconstruct(out real_t x, out real_t y, out real_t z)
{
- x = this.x;
- y = this.y;
- z = this.z;
+ x = X;
+ y = Y;
+ z = Z;
}
internal void Normalize()
@@ -107,14 +107,14 @@ namespace Godot
if (lengthsq == 0)
{
- x = y = z = 0f;
+ X = Y = Z = 0f;
}
else
{
real_t length = Mathf.Sqrt(lengthsq);
- x /= length;
- y /= length;
- z /= length;
+ X /= length;
+ Y /= length;
+ Z /= length;
}
}
@@ -124,7 +124,7 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Abs(real_t)"/> called on each component.</returns>
public readonly Vector3 Abs()
{
- return new Vector3(Mathf.Abs(x), Mathf.Abs(y), Mathf.Abs(z));
+ return new Vector3(Mathf.Abs(X), Mathf.Abs(Y), Mathf.Abs(Z));
}
/// <summary>
@@ -153,7 +153,7 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Ceil"/> called on each component.</returns>
public readonly Vector3 Ceil()
{
- return new Vector3(Mathf.Ceil(x), Mathf.Ceil(y), Mathf.Ceil(z));
+ return new Vector3(Mathf.Ceil(X), Mathf.Ceil(Y), Mathf.Ceil(Z));
}
/// <summary>
@@ -168,9 +168,9 @@ namespace Godot
{
return new Vector3
(
- Mathf.Clamp(x, min.x, max.x),
- Mathf.Clamp(y, min.y, max.y),
- Mathf.Clamp(z, min.z, max.z)
+ Mathf.Clamp(X, min.X, max.X),
+ Mathf.Clamp(Y, min.Y, max.Y),
+ Mathf.Clamp(Z, min.Z, max.Z)
);
}
@@ -183,9 +183,9 @@ namespace Godot
{
return new Vector3
(
- (y * with.z) - (z * with.y),
- (z * with.x) - (x * with.z),
- (x * with.y) - (y * with.x)
+ (Y * with.Z) - (Z * with.Y),
+ (Z * with.X) - (X * with.Z),
+ (X * with.Y) - (Y * with.X)
);
}
@@ -202,9 +202,9 @@ namespace Godot
{
return new Vector3
(
- Mathf.CubicInterpolate(x, b.x, preA.x, postB.x, weight),
- Mathf.CubicInterpolate(y, b.y, preA.y, postB.y, weight),
- Mathf.CubicInterpolate(z, b.z, preA.z, postB.z, weight)
+ Mathf.CubicInterpolate(X, b.X, preA.X, postB.X, weight),
+ Mathf.CubicInterpolate(Y, b.Y, preA.Y, postB.Y, weight),
+ Mathf.CubicInterpolate(Z, b.Z, preA.Z, postB.Z, weight)
);
}
@@ -226,9 +226,9 @@ namespace Godot
{
return new Vector3
(
- Mathf.CubicInterpolateInTime(x, b.x, preA.x, postB.x, weight, t, preAT, postBT),
- Mathf.CubicInterpolateInTime(y, b.y, preA.y, postB.y, weight, t, preAT, postBT),
- Mathf.CubicInterpolateInTime(z, b.z, preA.z, postB.z, weight, t, preAT, postBT)
+ Mathf.CubicInterpolateInTime(X, b.X, preA.X, postB.X, weight, t, preAT, postBT),
+ Mathf.CubicInterpolateInTime(Y, b.Y, preA.Y, postB.Y, weight, t, preAT, postBT),
+ Mathf.CubicInterpolateInTime(Z, b.Z, preA.Z, postB.Z, weight, t, preAT, postBT)
);
}
@@ -245,9 +245,9 @@ namespace Godot
{
return new Vector3
(
- Mathf.BezierInterpolate(x, control1.x, control2.x, end.x, t),
- Mathf.BezierInterpolate(y, control1.y, control2.y, end.y, t),
- Mathf.BezierInterpolate(z, control1.z, control2.z, end.z, t)
+ Mathf.BezierInterpolate(X, control1.X, control2.X, end.X, t),
+ Mathf.BezierInterpolate(Y, control1.Y, control2.Y, end.Y, t),
+ Mathf.BezierInterpolate(Z, control1.Z, control2.Z, end.Z, t)
);
}
@@ -263,9 +263,9 @@ namespace Godot
public readonly Vector3 BezierDerivative(Vector3 control1, Vector3 control2, Vector3 end, real_t t)
{
return new Vector3(
- Mathf.BezierDerivative(x, control1.x, control2.x, end.x, t),
- Mathf.BezierDerivative(y, control1.y, control2.y, end.y, t),
- Mathf.BezierDerivative(z, control1.z, control2.z, end.y, t)
+ Mathf.BezierDerivative(X, control1.X, control2.X, end.X, t),
+ Mathf.BezierDerivative(Y, control1.Y, control2.Y, end.Y, t),
+ Mathf.BezierDerivative(Z, control1.Z, control2.Z, end.Y, t)
);
}
@@ -276,7 +276,7 @@ namespace Godot
/// <returns>The direction from this vector to <paramref name="to"/>.</returns>
public readonly Vector3 DirectionTo(Vector3 to)
{
- return new Vector3(to.x - x, to.y - y, to.z - z).Normalized();
+ return new Vector3(to.X - X, to.Y - Y, to.Z - Z).Normalized();
}
/// <summary>
@@ -309,7 +309,7 @@ namespace Godot
/// <returns>The dot product of the two vectors.</returns>
public readonly real_t Dot(Vector3 with)
{
- return (x * with.x) + (y * with.y) + (z * with.z);
+ return (X * with.X) + (Y * with.Y) + (Z * with.Z);
}
/// <summary>
@@ -318,16 +318,16 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Floor"/> called on each component.</returns>
public readonly Vector3 Floor()
{
- return new Vector3(Mathf.Floor(x), Mathf.Floor(y), Mathf.Floor(z));
+ return new Vector3(Mathf.Floor(X), Mathf.Floor(Y), Mathf.Floor(Z));
}
/// <summary>
- /// Returns the inverse of this vector. This is the same as <c>new Vector3(1 / v.x, 1 / v.y, 1 / v.z)</c>.
+ /// Returns the inverse of this vector. This is the same as <c>new Vector3(1 / v.X, 1 / v.Y, 1 / v.Z)</c>.
/// </summary>
/// <returns>The inverse of this vector.</returns>
public readonly Vector3 Inverse()
{
- return new Vector3(1 / x, 1 / y, 1 / z);
+ return new Vector3(1 / X, 1 / Y, 1 / Z);
}
/// <summary>
@@ -337,7 +337,7 @@ namespace Godot
/// <returns>Whether this vector is finite or not.</returns>
public readonly bool IsFinite()
{
- return Mathf.IsFinite(x) && Mathf.IsFinite(y) && Mathf.IsFinite(z);
+ return Mathf.IsFinite(X) && Mathf.IsFinite(Y) && Mathf.IsFinite(Z);
}
/// <summary>
@@ -356,9 +356,9 @@ namespace Godot
/// <returns>The length of this vector.</returns>
public readonly real_t Length()
{
- real_t x2 = x * x;
- real_t y2 = y * y;
- real_t z2 = z * z;
+ real_t x2 = X * X;
+ real_t y2 = Y * Y;
+ real_t z2 = Z * Z;
return Mathf.Sqrt(x2 + y2 + z2);
}
@@ -371,9 +371,9 @@ namespace Godot
/// <returns>The squared length of this vector.</returns>
public readonly real_t LengthSquared()
{
- real_t x2 = x * x;
- real_t y2 = y * y;
- real_t z2 = z * z;
+ real_t x2 = X * X;
+ real_t y2 = Y * Y;
+ real_t z2 = Z * Z;
return x2 + y2 + z2;
}
@@ -389,9 +389,9 @@ namespace Godot
{
return new Vector3
(
- Mathf.Lerp(x, to.x, weight),
- Mathf.Lerp(y, to.y, weight),
- Mathf.Lerp(z, to.z, weight)
+ Mathf.Lerp(X, to.X, weight),
+ Mathf.Lerp(Y, to.Y, weight),
+ Mathf.Lerp(Z, to.Z, weight)
);
}
@@ -421,7 +421,7 @@ namespace Godot
/// <returns>The index of the highest axis.</returns>
public readonly Axis MaxAxisIndex()
{
- return x < y ? (y < z ? Axis.Z : Axis.Y) : (x < z ? Axis.Z : Axis.X);
+ return X < Y ? (Y < Z ? Axis.Z : Axis.Y) : (X < Z ? Axis.Z : Axis.X);
}
/// <summary>
@@ -431,7 +431,7 @@ namespace Godot
/// <returns>The index of the lowest axis.</returns>
public readonly Axis MinAxisIndex()
{
- return x < y ? (x < z ? Axis.X : Axis.Z) : (y < z ? Axis.Y : Axis.Z);
+ return X < Y ? (X < Z ? Axis.X : Axis.Z) : (Y < Z ? Axis.Y : Axis.Z);
}
/// <summary>
@@ -470,9 +470,9 @@ namespace Godot
public readonly Basis Outer(Vector3 with)
{
return new Basis(
- x * with.x, x * with.y, x * with.z,
- y * with.x, y * with.y, y * with.z,
- z * with.x, z * with.y, z * with.z
+ X * with.X, X * with.Y, X * with.Z,
+ Y * with.X, Y * with.Y, Y * with.Z,
+ Z * with.X, Z * with.Y, Z * with.Z
);
}
@@ -487,9 +487,9 @@ namespace Godot
public readonly Vector3 PosMod(real_t mod)
{
Vector3 v;
- v.x = Mathf.PosMod(x, mod);
- v.y = Mathf.PosMod(y, mod);
- v.z = Mathf.PosMod(z, mod);
+ v.X = Mathf.PosMod(X, mod);
+ v.Y = Mathf.PosMod(Y, mod);
+ v.Z = Mathf.PosMod(Z, mod);
return v;
}
@@ -504,9 +504,9 @@ namespace Godot
public readonly Vector3 PosMod(Vector3 modv)
{
Vector3 v;
- v.x = Mathf.PosMod(x, modv.x);
- v.y = Mathf.PosMod(y, modv.y);
- v.z = Mathf.PosMod(z, modv.z);
+ v.X = Mathf.PosMod(X, modv.X);
+ v.Y = Mathf.PosMod(Y, modv.Y);
+ v.Z = Mathf.PosMod(Z, modv.Z);
return v;
}
@@ -561,7 +561,7 @@ namespace Godot
/// <returns>The rounded vector.</returns>
public readonly Vector3 Round()
{
- return new Vector3(Mathf.Round(x), Mathf.Round(y), Mathf.Round(z));
+ return new Vector3(Mathf.Round(X), Mathf.Round(Y), Mathf.Round(Z));
}
/// <summary>
@@ -573,9 +573,9 @@ namespace Godot
public readonly Vector3 Sign()
{
Vector3 v;
- v.x = Mathf.Sign(x);
- v.y = Mathf.Sign(y);
- v.z = Mathf.Sign(z);
+ v.X = Mathf.Sign(X);
+ v.Y = Mathf.Sign(Y);
+ v.Z = Mathf.Sign(Z);
return v;
}
@@ -642,9 +642,9 @@ namespace Godot
{
return new Vector3
(
- Mathf.Snapped(x, step.x),
- Mathf.Snapped(y, step.y),
- Mathf.Snapped(z, step.z)
+ Mathf.Snapped(X, step.X),
+ Mathf.Snapped(Y, step.Y),
+ Mathf.Snapped(Z, step.Z)
);
}
@@ -719,9 +719,9 @@ namespace Godot
/// <param name="z">The vector's Z component.</param>
public Vector3(real_t x, real_t y, real_t z)
{
- this.x = x;
- this.y = y;
- this.z = z;
+ X = x;
+ Y = y;
+ Z = z;
}
/// <summary>
@@ -733,9 +733,9 @@ namespace Godot
/// <returns>The added vector.</returns>
public static Vector3 operator +(Vector3 left, Vector3 right)
{
- left.x += right.x;
- left.y += right.y;
- left.z += right.z;
+ left.X += right.X;
+ left.Y += right.Y;
+ left.Z += right.Z;
return left;
}
@@ -748,15 +748,15 @@ namespace Godot
/// <returns>The subtracted vector.</returns>
public static Vector3 operator -(Vector3 left, Vector3 right)
{
- left.x -= right.x;
- left.y -= right.y;
- left.z -= right.z;
+ left.X -= right.X;
+ left.Y -= right.Y;
+ left.Z -= right.Z;
return left;
}
/// <summary>
/// Returns the negative value of the <see cref="Vector3"/>.
- /// This is the same as writing <c>new Vector3(-v.x, -v.y, -v.z)</c>.
+ /// This is the same as writing <c>new Vector3(-v.X, -v.Y, -v.Z)</c>.
/// This operation flips the direction of the vector while
/// keeping the same magnitude.
/// With floats, the number zero can be either positive or negative.
@@ -765,9 +765,9 @@ namespace Godot
/// <returns>The negated/flipped vector.</returns>
public static Vector3 operator -(Vector3 vec)
{
- vec.x = -vec.x;
- vec.y = -vec.y;
- vec.z = -vec.z;
+ vec.X = -vec.X;
+ vec.Y = -vec.Y;
+ vec.Z = -vec.Z;
return vec;
}
@@ -780,9 +780,9 @@ namespace Godot
/// <returns>The multiplied vector.</returns>
public static Vector3 operator *(Vector3 vec, real_t scale)
{
- vec.x *= scale;
- vec.y *= scale;
- vec.z *= scale;
+ vec.X *= scale;
+ vec.Y *= scale;
+ vec.Z *= scale;
return vec;
}
@@ -795,9 +795,9 @@ namespace Godot
/// <returns>The multiplied vector.</returns>
public static Vector3 operator *(real_t scale, Vector3 vec)
{
- vec.x *= scale;
- vec.y *= scale;
- vec.z *= scale;
+ vec.X *= scale;
+ vec.Y *= scale;
+ vec.Z *= scale;
return vec;
}
@@ -810,9 +810,9 @@ namespace Godot
/// <returns>The multiplied vector.</returns>
public static Vector3 operator *(Vector3 left, Vector3 right)
{
- left.x *= right.x;
- left.y *= right.y;
- left.z *= right.z;
+ left.X *= right.X;
+ left.Y *= right.Y;
+ left.Z *= right.Z;
return left;
}
@@ -825,9 +825,9 @@ namespace Godot
/// <returns>The divided vector.</returns>
public static Vector3 operator /(Vector3 vec, real_t divisor)
{
- vec.x /= divisor;
- vec.y /= divisor;
- vec.z /= divisor;
+ vec.X /= divisor;
+ vec.Y /= divisor;
+ vec.Z /= divisor;
return vec;
}
@@ -840,9 +840,9 @@ namespace Godot
/// <returns>The divided vector.</returns>
public static Vector3 operator /(Vector3 vec, Vector3 divisorv)
{
- vec.x /= divisorv.x;
- vec.y /= divisorv.y;
- vec.z /= divisorv.z;
+ vec.X /= divisorv.X;
+ vec.Y /= divisorv.Y;
+ vec.Z /= divisorv.Z;
return vec;
}
@@ -864,9 +864,9 @@ namespace Godot
/// <returns>The remainder vector.</returns>
public static Vector3 operator %(Vector3 vec, real_t divisor)
{
- vec.x %= divisor;
- vec.y %= divisor;
- vec.z %= divisor;
+ vec.X %= divisor;
+ vec.Y %= divisor;
+ vec.Z %= divisor;
return vec;
}
@@ -888,9 +888,9 @@ namespace Godot
/// <returns>The remainder vector.</returns>
public static Vector3 operator %(Vector3 vec, Vector3 divisorv)
{
- vec.x %= divisorv.x;
- vec.y %= divisorv.y;
- vec.z %= divisorv.z;
+ vec.X %= divisorv.X;
+ vec.Y %= divisorv.Y;
+ vec.Z %= divisorv.Z;
return vec;
}
@@ -933,15 +933,15 @@ namespace Godot
/// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Vector3 left, Vector3 right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- return left.z < right.z;
+ return left.Z < right.Z;
}
- return left.y < right.y;
+ return left.Y < right.Y;
}
- return left.x < right.x;
+ return left.X < right.X;
}
/// <summary>
@@ -957,15 +957,15 @@ namespace Godot
/// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Vector3 left, Vector3 right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- return left.z > right.z;
+ return left.Z > right.Z;
}
- return left.y > right.y;
+ return left.Y > right.Y;
}
- return left.x > right.x;
+ return left.X > right.X;
}
/// <summary>
@@ -981,15 +981,15 @@ namespace Godot
/// <returns>Whether or not the left is less than or equal to the right.</returns>
public static bool operator <=(Vector3 left, Vector3 right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- return left.z <= right.z;
+ return left.Z <= right.Z;
}
- return left.y < right.y;
+ return left.Y < right.Y;
}
- return left.x < right.x;
+ return left.X < right.X;
}
/// <summary>
@@ -1005,15 +1005,15 @@ namespace Godot
/// <returns>Whether or not the left is greater than or equal to the right.</returns>
public static bool operator >=(Vector3 left, Vector3 right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- return left.z >= right.z;
+ return left.Z >= right.Z;
}
- return left.y > right.y;
+ return left.Y > right.Y;
}
- return left.x > right.x;
+ return left.X > right.X;
}
/// <summary>
@@ -1038,7 +1038,7 @@ namespace Godot
/// <returns>Whether or not the vectors are exactly equal.</returns>
public readonly bool Equals(Vector3 other)
{
- return x == other.x && y == other.y && z == other.z;
+ return X == other.X && Y == other.Y && Z == other.Z;
}
/// <summary>
@@ -1049,7 +1049,7 @@ namespace Godot
/// <returns>Whether or not the vectors are approximately equal.</returns>
public readonly bool IsEqualApprox(Vector3 other)
{
- return Mathf.IsEqualApprox(x, other.x) && Mathf.IsEqualApprox(y, other.y) && Mathf.IsEqualApprox(z, other.z);
+ return Mathf.IsEqualApprox(X, other.X) && Mathf.IsEqualApprox(Y, other.Y) && Mathf.IsEqualApprox(Z, other.Z);
}
/// <summary>
@@ -1061,7 +1061,7 @@ namespace Godot
/// <returns>Whether or not the vector is approximately zero.</returns>
public readonly bool IsZeroApprox()
{
- return Mathf.IsZeroApprox(x) && Mathf.IsZeroApprox(y) && Mathf.IsZeroApprox(z);
+ return Mathf.IsZeroApprox(X) && Mathf.IsZeroApprox(Y) && Mathf.IsZeroApprox(Z);
}
/// <summary>
@@ -1070,7 +1070,7 @@ namespace Godot
/// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode()
{
- return y.GetHashCode() ^ x.GetHashCode() ^ z.GetHashCode();
+ return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode();
}
/// <summary>
@@ -1079,7 +1079,7 @@ namespace Godot
/// <returns>A string representation of this vector.</returns>
public override readonly string ToString()
{
- return $"({x}, {y}, {z})";
+ return $"({X}, {Y}, {Z})";
}
/// <summary>
@@ -1088,7 +1088,7 @@ namespace Godot
/// <returns>A string representation of this vector.</returns>
public readonly string ToString(string format)
{
- return $"({x.ToString(format)}, {y.ToString(format)}, {z.ToString(format)})";
+ return $"({X.ToString(format)}, {Y.ToString(format)}, {Z.ToString(format)})";
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs
index de0c6d27e7..fe899527ef 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs
@@ -8,7 +8,7 @@ namespace Godot
/// </summary>
[Serializable]
[StructLayout(LayoutKind.Sequential)]
- public struct Vector3i : IEquatable<Vector3i>
+ public struct Vector3I : IEquatable<Vector3I>
{
/// <summary>
/// Enumerated index values for the axes.
@@ -33,17 +33,17 @@ namespace Godot
/// <summary>
/// The vector's X component. Also accessible by using the index position <c>[0]</c>.
/// </summary>
- public int x;
+ public int X;
/// <summary>
/// The vector's Y component. Also accessible by using the index position <c>[1]</c>.
/// </summary>
- public int y;
+ public int Y;
/// <summary>
/// The vector's Z component. Also accessible by using the index position <c>[2]</c>.
/// </summary>
- public int z;
+ public int Z;
/// <summary>
/// Access vector components using their <paramref name="index"/>.
@@ -52,9 +52,9 @@ namespace Godot
/// <paramref name="index"/> is not 0, 1 or 2.
/// </exception>
/// <value>
- /// <c>[0]</c> is equivalent to <see cref="x"/>,
- /// <c>[1]</c> is equivalent to <see cref="y"/>,
- /// <c>[2]</c> is equivalent to <see cref="z"/>.
+ /// <c>[0]</c> is equivalent to <see cref="X"/>,
+ /// <c>[1]</c> is equivalent to <see cref="Y"/>,
+ /// <c>[2]</c> is equivalent to <see cref="Z"/>.
/// </value>
public int this[int index]
{
@@ -63,11 +63,11 @@ namespace Godot
switch (index)
{
case 0:
- return x;
+ return X;
case 1:
- return y;
+ return Y;
case 2:
- return z;
+ return Z;
default:
throw new ArgumentOutOfRangeException(nameof(index));
}
@@ -77,13 +77,13 @@ namespace Godot
switch (index)
{
case 0:
- x = value;
+ X = value;
return;
case 1:
- y = value;
+ Y = value;
return;
case 2:
- z = value;
+ Z = value;
return;
default:
throw new ArgumentOutOfRangeException(nameof(index));
@@ -96,18 +96,18 @@ namespace Godot
/// </summary>
public readonly void Deconstruct(out int x, out int y, out int z)
{
- x = this.x;
- y = this.y;
- z = this.z;
+ x = X;
+ y = Y;
+ z = Z;
}
/// <summary>
/// Returns a new vector with all components in absolute values (i.e. positive).
/// </summary>
/// <returns>A vector with <see cref="Mathf.Abs(int)"/> called on each component.</returns>
- public readonly Vector3i Abs()
+ public readonly Vector3I Abs()
{
- return new Vector3i(Mathf.Abs(x), Mathf.Abs(y), Mathf.Abs(z));
+ return new Vector3I(Mathf.Abs(X), Mathf.Abs(Y), Mathf.Abs(Z));
}
/// <summary>
@@ -118,13 +118,13 @@ namespace Godot
/// <param name="min">The vector with minimum allowed values.</param>
/// <param name="max">The vector with maximum allowed values.</param>
/// <returns>The vector with all components clamped.</returns>
- public readonly Vector3i Clamp(Vector3i min, Vector3i max)
+ public readonly Vector3I Clamp(Vector3I min, Vector3I max)
{
- return new Vector3i
+ return new Vector3I
(
- Mathf.Clamp(x, min.x, max.x),
- Mathf.Clamp(y, min.y, max.y),
- Mathf.Clamp(z, min.z, max.z)
+ Mathf.Clamp(X, min.X, max.X),
+ Mathf.Clamp(Y, min.Y, max.Y),
+ Mathf.Clamp(Z, min.Z, max.Z)
);
}
@@ -135,9 +135,9 @@ namespace Godot
/// <returns>The length of this vector.</returns>
public readonly real_t Length()
{
- int x2 = x * x;
- int y2 = y * y;
- int z2 = z * z;
+ int x2 = X * X;
+ int y2 = Y * Y;
+ int z2 = Z * Z;
return Mathf.Sqrt(x2 + y2 + z2);
}
@@ -150,9 +150,9 @@ namespace Godot
/// <returns>The squared length of this vector.</returns>
public readonly int LengthSquared()
{
- int x2 = x * x;
- int y2 = y * y;
- int z2 = z * z;
+ int x2 = X * X;
+ int y2 = Y * Y;
+ int z2 = Z * Z;
return x2 + y2 + z2;
}
@@ -164,7 +164,7 @@ namespace Godot
/// <returns>The index of the highest axis.</returns>
public readonly Axis MaxAxisIndex()
{
- return x < y ? (y < z ? Axis.Z : Axis.Y) : (x < z ? Axis.Z : Axis.X);
+ return X < Y ? (Y < Z ? Axis.Z : Axis.Y) : (X < Z ? Axis.Z : Axis.X);
}
/// <summary>
@@ -174,7 +174,7 @@ namespace Godot
/// <returns>The index of the lowest axis.</returns>
public readonly Axis MinAxisIndex()
{
- return x < y ? (x < z ? Axis.X : Axis.Z) : (y < z ? Axis.Y : Axis.Z);
+ return X < Y ? (X < Z ? Axis.X : Axis.Z) : (Y < Z ? Axis.Y : Axis.Z);
}
/// <summary>
@@ -183,208 +183,208 @@ namespace Godot
/// by calling <see cref="Mathf.Sign(int)"/> on each component.
/// </summary>
/// <returns>A vector with all components as either <c>1</c>, <c>-1</c>, or <c>0</c>.</returns>
- public readonly Vector3i Sign()
+ public readonly Vector3I Sign()
{
- Vector3i v = this;
- v.x = Mathf.Sign(v.x);
- v.y = Mathf.Sign(v.y);
- v.z = Mathf.Sign(v.z);
+ Vector3I v = this;
+ v.X = Mathf.Sign(v.X);
+ v.Y = Mathf.Sign(v.Y);
+ v.Z = Mathf.Sign(v.Z);
return v;
}
// Constants
- private static readonly Vector3i _zero = new Vector3i(0, 0, 0);
- private static readonly Vector3i _one = new Vector3i(1, 1, 1);
+ private static readonly Vector3I _zero = new Vector3I(0, 0, 0);
+ private static readonly Vector3I _one = new Vector3I(1, 1, 1);
- private static readonly Vector3i _up = new Vector3i(0, 1, 0);
- private static readonly Vector3i _down = new Vector3i(0, -1, 0);
- private static readonly Vector3i _right = new Vector3i(1, 0, 0);
- private static readonly Vector3i _left = new Vector3i(-1, 0, 0);
- private static readonly Vector3i _forward = new Vector3i(0, 0, -1);
- private static readonly Vector3i _back = new Vector3i(0, 0, 1);
+ private static readonly Vector3I _up = new Vector3I(0, 1, 0);
+ private static readonly Vector3I _down = new Vector3I(0, -1, 0);
+ private static readonly Vector3I _right = new Vector3I(1, 0, 0);
+ private static readonly Vector3I _left = new Vector3I(-1, 0, 0);
+ private static readonly Vector3I _forward = new Vector3I(0, 0, -1);
+ private static readonly Vector3I _back = new Vector3I(0, 0, 1);
/// <summary>
/// Zero vector, a vector with all components set to <c>0</c>.
/// </summary>
- /// <value>Equivalent to <c>new Vector3i(0, 0, 0)</c>.</value>
- public static Vector3i Zero { get { return _zero; } }
+ /// <value>Equivalent to <c>new Vector3I(0, 0, 0)</c>.</value>
+ public static Vector3I Zero { get { return _zero; } }
/// <summary>
/// One vector, a vector with all components set to <c>1</c>.
/// </summary>
- /// <value>Equivalent to <c>new Vector3i(1, 1, 1)</c>.</value>
- public static Vector3i One { get { return _one; } }
+ /// <value>Equivalent to <c>new Vector3I(1, 1, 1)</c>.</value>
+ public static Vector3I One { get { return _one; } }
/// <summary>
/// Up unit vector.
/// </summary>
- /// <value>Equivalent to <c>new Vector3i(0, 1, 0)</c>.</value>
- public static Vector3i Up { get { return _up; } }
+ /// <value>Equivalent to <c>new Vector3I(0, 1, 0)</c>.</value>
+ public static Vector3I Up { get { return _up; } }
/// <summary>
/// Down unit vector.
/// </summary>
- /// <value>Equivalent to <c>new Vector3i(0, -1, 0)</c>.</value>
- public static Vector3i Down { get { return _down; } }
+ /// <value>Equivalent to <c>new Vector3I(0, -1, 0)</c>.</value>
+ public static Vector3I Down { get { return _down; } }
/// <summary>
/// Right unit vector. Represents the local direction of right,
/// and the global direction of east.
/// </summary>
- /// <value>Equivalent to <c>new Vector3i(1, 0, 0)</c>.</value>
- public static Vector3i Right { get { return _right; } }
+ /// <value>Equivalent to <c>new Vector3I(1, 0, 0)</c>.</value>
+ public static Vector3I Right { get { return _right; } }
/// <summary>
/// Left unit vector. Represents the local direction of left,
/// and the global direction of west.
/// </summary>
- /// <value>Equivalent to <c>new Vector3i(-1, 0, 0)</c>.</value>
- public static Vector3i Left { get { return _left; } }
+ /// <value>Equivalent to <c>new Vector3I(-1, 0, 0)</c>.</value>
+ public static Vector3I Left { get { return _left; } }
/// <summary>
/// Forward unit vector. Represents the local direction of forward,
/// and the global direction of north.
/// </summary>
- /// <value>Equivalent to <c>new Vector3i(0, 0, -1)</c>.</value>
- public static Vector3i Forward { get { return _forward; } }
+ /// <value>Equivalent to <c>new Vector3I(0, 0, -1)</c>.</value>
+ public static Vector3I Forward { get { return _forward; } }
/// <summary>
/// Back unit vector. Represents the local direction of back,
/// and the global direction of south.
/// </summary>
- /// <value>Equivalent to <c>new Vector3i(0, 0, 1)</c>.</value>
- public static Vector3i Back { get { return _back; } }
+ /// <value>Equivalent to <c>new Vector3I(0, 0, 1)</c>.</value>
+ public static Vector3I Back { get { return _back; } }
/// <summary>
- /// Constructs a new <see cref="Vector3i"/> with the given components.
+ /// Constructs a new <see cref="Vector3I"/> with the given components.
/// </summary>
/// <param name="x">The vector's X component.</param>
/// <param name="y">The vector's Y component.</param>
/// <param name="z">The vector's Z component.</param>
- public Vector3i(int x, int y, int z)
+ public Vector3I(int x, int y, int z)
{
- this.x = x;
- this.y = y;
- this.z = z;
+ X = x;
+ Y = y;
+ Z = z;
}
/// <summary>
- /// Adds each component of the <see cref="Vector3i"/>
- /// with the components of the given <see cref="Vector3i"/>.
+ /// Adds each component of the <see cref="Vector3I"/>
+ /// with the components of the given <see cref="Vector3I"/>.
/// </summary>
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>The added vector.</returns>
- public static Vector3i operator +(Vector3i left, Vector3i right)
+ public static Vector3I operator +(Vector3I left, Vector3I right)
{
- left.x += right.x;
- left.y += right.y;
- left.z += right.z;
+ left.X += right.X;
+ left.Y += right.Y;
+ left.Z += right.Z;
return left;
}
/// <summary>
- /// Subtracts each component of the <see cref="Vector3i"/>
- /// by the components of the given <see cref="Vector3i"/>.
+ /// Subtracts each component of the <see cref="Vector3I"/>
+ /// by the components of the given <see cref="Vector3I"/>.
/// </summary>
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>The subtracted vector.</returns>
- public static Vector3i operator -(Vector3i left, Vector3i right)
+ public static Vector3I operator -(Vector3I left, Vector3I right)
{
- left.x -= right.x;
- left.y -= right.y;
- left.z -= right.z;
+ left.X -= right.X;
+ left.Y -= right.Y;
+ left.Z -= right.Z;
return left;
}
/// <summary>
- /// Returns the negative value of the <see cref="Vector3i"/>.
- /// This is the same as writing <c>new Vector3i(-v.x, -v.y, -v.z)</c>.
+ /// Returns the negative value of the <see cref="Vector3I"/>.
+ /// This is the same as writing <c>new Vector3I(-v.X, -v.Y, -v.Z)</c>.
/// This operation flips the direction of the vector while
/// keeping the same magnitude.
/// </summary>
/// <param name="vec">The vector to negate/flip.</param>
/// <returns>The negated/flipped vector.</returns>
- public static Vector3i operator -(Vector3i vec)
+ public static Vector3I operator -(Vector3I vec)
{
- vec.x = -vec.x;
- vec.y = -vec.y;
- vec.z = -vec.z;
+ vec.X = -vec.X;
+ vec.Y = -vec.Y;
+ vec.Z = -vec.Z;
return vec;
}
/// <summary>
- /// Multiplies each component of the <see cref="Vector3i"/>
+ /// Multiplies each component of the <see cref="Vector3I"/>
/// by the given <see langword="int"/>.
/// </summary>
/// <param name="vec">The vector to multiply.</param>
/// <param name="scale">The scale to multiply by.</param>
/// <returns>The multiplied vector.</returns>
- public static Vector3i operator *(Vector3i vec, int scale)
+ public static Vector3I operator *(Vector3I vec, int scale)
{
- vec.x *= scale;
- vec.y *= scale;
- vec.z *= scale;
+ vec.X *= scale;
+ vec.Y *= scale;
+ vec.Z *= scale;
return vec;
}
/// <summary>
- /// Multiplies each component of the <see cref="Vector3i"/>
+ /// Multiplies each component of the <see cref="Vector3I"/>
/// by the given <see langword="int"/>.
/// </summary>
/// <param name="scale">The scale to multiply by.</param>
/// <param name="vec">The vector to multiply.</param>
/// <returns>The multiplied vector.</returns>
- public static Vector3i operator *(int scale, Vector3i vec)
+ public static Vector3I operator *(int scale, Vector3I vec)
{
- vec.x *= scale;
- vec.y *= scale;
- vec.z *= scale;
+ vec.X *= scale;
+ vec.Y *= scale;
+ vec.Z *= scale;
return vec;
}
/// <summary>
- /// Multiplies each component of the <see cref="Vector3i"/>
- /// by the components of the given <see cref="Vector3i"/>.
+ /// Multiplies each component of the <see cref="Vector3I"/>
+ /// by the components of the given <see cref="Vector3I"/>.
/// </summary>
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>The multiplied vector.</returns>
- public static Vector3i operator *(Vector3i left, Vector3i right)
+ public static Vector3I operator *(Vector3I left, Vector3I right)
{
- left.x *= right.x;
- left.y *= right.y;
- left.z *= right.z;
+ left.X *= right.X;
+ left.Y *= right.Y;
+ left.Z *= right.Z;
return left;
}
/// <summary>
- /// Divides each component of the <see cref="Vector3i"/>
+ /// Divides each component of the <see cref="Vector3I"/>
/// by the given <see langword="int"/>.
/// </summary>
/// <param name="vec">The dividend vector.</param>
/// <param name="divisor">The divisor value.</param>
/// <returns>The divided vector.</returns>
- public static Vector3i operator /(Vector3i vec, int divisor)
+ public static Vector3I operator /(Vector3I vec, int divisor)
{
- vec.x /= divisor;
- vec.y /= divisor;
- vec.z /= divisor;
+ vec.X /= divisor;
+ vec.Y /= divisor;
+ vec.Z /= divisor;
return vec;
}
/// <summary>
- /// Divides each component of the <see cref="Vector3i"/>
- /// by the components of the given <see cref="Vector3i"/>.
+ /// Divides each component of the <see cref="Vector3I"/>
+ /// by the components of the given <see cref="Vector3I"/>.
/// </summary>
/// <param name="vec">The dividend vector.</param>
/// <param name="divisorv">The divisor vector.</param>
/// <returns>The divided vector.</returns>
- public static Vector3i operator /(Vector3i vec, Vector3i divisorv)
+ public static Vector3I operator /(Vector3I vec, Vector3I divisorv)
{
- vec.x /= divisorv.x;
- vec.y /= divisorv.y;
- vec.z /= divisorv.z;
+ vec.X /= divisorv.X;
+ vec.Y /= divisorv.Y;
+ vec.Z /= divisorv.Z;
return vec;
}
/// <summary>
- /// Gets the remainder of each component of the <see cref="Vector3i"/>
+ /// Gets the remainder of each component of the <see cref="Vector3I"/>
/// with the components of the given <see langword="int"/>.
/// This operation uses truncated division, which is often not desired
/// as it does not work well with negative numbers.
@@ -393,23 +393,23 @@ namespace Godot
/// </summary>
/// <example>
/// <code>
- /// GD.Print(new Vector3i(10, -20, 30) % 7); // Prints "(3, -6, 2)"
+ /// GD.Print(new Vector3I(10, -20, 30) % 7); // Prints "(3, -6, 2)"
/// </code>
/// </example>
/// <param name="vec">The dividend vector.</param>
/// <param name="divisor">The divisor value.</param>
/// <returns>The remainder vector.</returns>
- public static Vector3i operator %(Vector3i vec, int divisor)
+ public static Vector3I operator %(Vector3I vec, int divisor)
{
- vec.x %= divisor;
- vec.y %= divisor;
- vec.z %= divisor;
+ vec.X %= divisor;
+ vec.Y %= divisor;
+ vec.Z %= divisor;
return vec;
}
/// <summary>
- /// Gets the remainder of each component of the <see cref="Vector3i"/>
- /// with the components of the given <see cref="Vector3i"/>.
+ /// Gets the remainder of each component of the <see cref="Vector3I"/>
+ /// with the components of the given <see cref="Vector3I"/>.
/// This operation uses truncated division, which is often not desired
/// as it does not work well with negative numbers.
/// Consider using <see cref="Mathf.PosMod(int, int)"/> instead
@@ -417,17 +417,17 @@ namespace Godot
/// </summary>
/// <example>
/// <code>
- /// GD.Print(new Vector3i(10, -20, 30) % new Vector3i(7, 8, 9)); // Prints "(3, -4, 3)"
+ /// GD.Print(new Vector3I(10, -20, 30) % new Vector3I(7, 8, 9)); // Prints "(3, -4, 3)"
/// </code>
/// </example>
/// <param name="vec">The dividend vector.</param>
/// <param name="divisorv">The divisor vector.</param>
/// <returns>The remainder vector.</returns>
- public static Vector3i operator %(Vector3i vec, Vector3i divisorv)
+ public static Vector3I operator %(Vector3I vec, Vector3I divisorv)
{
- vec.x %= divisorv.x;
- vec.y %= divisorv.y;
- vec.z %= divisorv.z;
+ vec.X %= divisorv.X;
+ vec.Y %= divisorv.Y;
+ vec.Z %= divisorv.Z;
return vec;
}
@@ -437,7 +437,7 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the vectors are equal.</returns>
- public static bool operator ==(Vector3i left, Vector3i right)
+ public static bool operator ==(Vector3I left, Vector3I right)
{
return left.Equals(right);
}
@@ -448,13 +448,13 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the vectors are not equal.</returns>
- public static bool operator !=(Vector3i left, Vector3i right)
+ public static bool operator !=(Vector3I left, Vector3I right)
{
return !left.Equals(right);
}
/// <summary>
- /// Compares two <see cref="Vector3i"/> vectors by first checking if
+ /// Compares two <see cref="Vector3I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is less than
/// the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check
@@ -464,21 +464,21 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is less than the right.</returns>
- public static bool operator <(Vector3i left, Vector3i right)
+ public static bool operator <(Vector3I left, Vector3I right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- return left.z < right.z;
+ return left.Z < right.Z;
}
- return left.y < right.y;
+ return left.Y < right.Y;
}
- return left.x < right.x;
+ return left.X < right.X;
}
/// <summary>
- /// Compares two <see cref="Vector3i"/> vectors by first checking if
+ /// Compares two <see cref="Vector3I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is greater than
/// the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check
@@ -488,21 +488,21 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is greater than the right.</returns>
- public static bool operator >(Vector3i left, Vector3i right)
+ public static bool operator >(Vector3I left, Vector3I right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- return left.z > right.z;
+ return left.Z > right.Z;
}
- return left.y > right.y;
+ return left.Y > right.Y;
}
- return left.x > right.x;
+ return left.X > right.X;
}
/// <summary>
- /// Compares two <see cref="Vector3i"/> vectors by first checking if
+ /// Compares two <see cref="Vector3I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is less than
/// or equal to the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check
@@ -512,21 +512,21 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is less than or equal to the right.</returns>
- public static bool operator <=(Vector3i left, Vector3i right)
+ public static bool operator <=(Vector3I left, Vector3I right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- return left.z <= right.z;
+ return left.Z <= right.Z;
}
- return left.y < right.y;
+ return left.Y < right.Y;
}
- return left.x < right.x;
+ return left.X < right.X;
}
/// <summary>
- /// Compares two <see cref="Vector3i"/> vectors by first checking if
+ /// Compares two <see cref="Vector3I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is greater than
/// or equal to the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check
@@ -536,38 +536,38 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is greater than or equal to the right.</returns>
- public static bool operator >=(Vector3i left, Vector3i right)
+ public static bool operator >=(Vector3I left, Vector3I right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- return left.z >= right.z;
+ return left.Z >= right.Z;
}
- return left.y > right.y;
+ return left.Y > right.Y;
}
- return left.x > right.x;
+ return left.X > right.X;
}
/// <summary>
- /// Converts this <see cref="Vector3i"/> to a <see cref="Vector3"/>.
+ /// Converts this <see cref="Vector3I"/> to a <see cref="Vector3"/>.
/// </summary>
/// <param name="value">The vector to convert.</param>
- public static implicit operator Vector3(Vector3i value)
+ public static implicit operator Vector3(Vector3I value)
{
- return new Vector3(value.x, value.y, value.z);
+ return new Vector3(value.X, value.Y, value.Z);
}
/// <summary>
- /// Converts a <see cref="Vector3"/> to a <see cref="Vector3i"/>.
+ /// Converts a <see cref="Vector3"/> to a <see cref="Vector3I"/>.
/// </summary>
/// <param name="value">The vector to convert.</param>
- public static explicit operator Vector3i(Vector3 value)
+ public static explicit operator Vector3I(Vector3 value)
{
- return new Vector3i(
- Mathf.RoundToInt(value.x),
- Mathf.RoundToInt(value.y),
- Mathf.RoundToInt(value.z)
+ return new Vector3I(
+ Mathf.RoundToInt(value.X),
+ Mathf.RoundToInt(value.Y),
+ Mathf.RoundToInt(value.Z)
);
}
@@ -579,7 +579,7 @@ namespace Godot
/// <returns>Whether or not the vector and the object are equal.</returns>
public override readonly bool Equals(object obj)
{
- return obj is Vector3i other && Equals(other);
+ return obj is Vector3I other && Equals(other);
}
/// <summary>
@@ -587,36 +587,36 @@ namespace Godot
/// </summary>
/// <param name="other">The other vector.</param>
/// <returns>Whether or not the vectors are equal.</returns>
- public readonly bool Equals(Vector3i other)
+ public readonly bool Equals(Vector3I other)
{
- return x == other.x && y == other.y && z == other.z;
+ return X == other.X && Y == other.Y && Z == other.Z;
}
/// <summary>
- /// Serves as the hash function for <see cref="Vector3i"/>.
+ /// Serves as the hash function for <see cref="Vector3I"/>.
/// </summary>
/// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode()
{
- return y.GetHashCode() ^ x.GetHashCode() ^ z.GetHashCode();
+ return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode();
}
/// <summary>
- /// Converts this <see cref="Vector3i"/> to a string.
+ /// Converts this <see cref="Vector3I"/> to a string.
/// </summary>
/// <returns>A string representation of this vector.</returns>
public override readonly string ToString()
{
- return $"({x}, {y}, {z})";
+ return $"({X}, {Y}, {Z})";
}
/// <summary>
- /// Converts this <see cref="Vector3i"/> to a string with the given <paramref name="format"/>.
+ /// Converts this <see cref="Vector3I"/> to a string with the given <paramref name="format"/>.
/// </summary>
/// <returns>A string representation of this vector.</returns>
public readonly string ToString(string format)
{
- return $"({x.ToString(format)}, {y.ToString(format)}, {z.ToString(format)})";
+ return $"({X.ToString(format)}, {Y.ToString(format)}, {Z.ToString(format)})";
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs
index 0f4528bb40..1fd39632b0 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs
@@ -37,22 +37,22 @@ namespace Godot
/// <summary>
/// The vector's X component. Also accessible by using the index position <c>[0]</c>.
/// </summary>
- public real_t x;
+ public real_t X;
/// <summary>
/// The vector's Y component. Also accessible by using the index position <c>[1]</c>.
/// </summary>
- public real_t y;
+ public real_t Y;
/// <summary>
/// The vector's Z component. Also accessible by using the index position <c>[2]</c>.
/// </summary>
- public real_t z;
+ public real_t Z;
/// <summary>
/// The vector's W component. Also accessible by using the index position <c>[3]</c>.
/// </summary>
- public real_t w;
+ public real_t W;
/// <summary>
/// Access vector components using their index.
@@ -61,10 +61,10 @@ namespace Godot
/// <paramref name="index"/> is not 0, 1, 2 or 3.
/// </exception>
/// <value>
- /// <c>[0]</c> is equivalent to <see cref="x"/>,
- /// <c>[1]</c> is equivalent to <see cref="y"/>,
- /// <c>[2]</c> is equivalent to <see cref="z"/>.
- /// <c>[3]</c> is equivalent to <see cref="w"/>.
+ /// <c>[0]</c> is equivalent to <see cref="X"/>,
+ /// <c>[1]</c> is equivalent to <see cref="Y"/>,
+ /// <c>[2]</c> is equivalent to <see cref="Z"/>.
+ /// <c>[3]</c> is equivalent to <see cref="W"/>.
/// </value>
public real_t this[int index]
{
@@ -73,13 +73,13 @@ namespace Godot
switch (index)
{
case 0:
- return x;
+ return X;
case 1:
- return y;
+ return Y;
case 2:
- return z;
+ return Z;
case 3:
- return w;
+ return W;
default:
throw new ArgumentOutOfRangeException(nameof(index));
}
@@ -89,16 +89,16 @@ namespace Godot
switch (index)
{
case 0:
- x = value;
+ X = value;
return;
case 1:
- y = value;
+ Y = value;
return;
case 2:
- z = value;
+ Z = value;
return;
case 3:
- w = value;
+ W = value;
return;
default:
throw new ArgumentOutOfRangeException(nameof(index));
@@ -111,10 +111,10 @@ namespace Godot
/// </summary>
public readonly void Deconstruct(out real_t x, out real_t y, out real_t z, out real_t w)
{
- x = this.x;
- y = this.y;
- z = this.z;
- w = this.w;
+ x = X;
+ y = Y;
+ z = Z;
+ w = W;
}
internal void Normalize()
@@ -123,15 +123,15 @@ namespace Godot
if (lengthsq == 0)
{
- x = y = z = w = 0f;
+ X = Y = Z = W = 0f;
}
else
{
real_t length = Mathf.Sqrt(lengthsq);
- x /= length;
- y /= length;
- z /= length;
- w /= length;
+ X /= length;
+ Y /= length;
+ Z /= length;
+ W /= length;
}
}
@@ -141,7 +141,7 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Abs(real_t)"/> called on each component.</returns>
public readonly Vector4 Abs()
{
- return new Vector4(Mathf.Abs(x), Mathf.Abs(y), Mathf.Abs(z), Mathf.Abs(w));
+ return new Vector4(Mathf.Abs(X), Mathf.Abs(Y), Mathf.Abs(Z), Mathf.Abs(W));
}
/// <summary>
@@ -150,7 +150,7 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Ceil"/> called on each component.</returns>
public readonly Vector4 Ceil()
{
- return new Vector4(Mathf.Ceil(x), Mathf.Ceil(y), Mathf.Ceil(z), Mathf.Ceil(w));
+ return new Vector4(Mathf.Ceil(X), Mathf.Ceil(Y), Mathf.Ceil(Z), Mathf.Ceil(W));
}
/// <summary>
@@ -165,10 +165,10 @@ namespace Godot
{
return new Vector4
(
- Mathf.Clamp(x, min.x, max.x),
- Mathf.Clamp(y, min.y, max.y),
- Mathf.Clamp(z, min.z, max.z),
- Mathf.Clamp(w, min.w, max.w)
+ Mathf.Clamp(X, min.X, max.X),
+ Mathf.Clamp(Y, min.Y, max.Y),
+ Mathf.Clamp(Z, min.Z, max.Z),
+ Mathf.Clamp(W, min.W, max.W)
);
}
@@ -185,10 +185,10 @@ namespace Godot
{
return new Vector4
(
- Mathf.CubicInterpolate(x, b.x, preA.x, postB.x, weight),
- Mathf.CubicInterpolate(y, b.y, preA.y, postB.y, weight),
- Mathf.CubicInterpolate(z, b.z, preA.z, postB.z, weight),
- Mathf.CubicInterpolate(w, b.w, preA.w, postB.w, weight)
+ Mathf.CubicInterpolate(X, b.X, preA.X, postB.X, weight),
+ Mathf.CubicInterpolate(Y, b.Y, preA.Y, postB.Y, weight),
+ Mathf.CubicInterpolate(Z, b.Z, preA.Z, postB.Z, weight),
+ Mathf.CubicInterpolate(W, b.W, preA.W, postB.W, weight)
);
}
@@ -210,10 +210,10 @@ namespace Godot
{
return new Vector4
(
- Mathf.CubicInterpolateInTime(x, b.x, preA.x, postB.x, weight, t, preAT, postBT),
- Mathf.CubicInterpolateInTime(y, b.y, preA.y, postB.y, weight, t, preAT, postBT),
- Mathf.CubicInterpolateInTime(z, b.z, preA.z, postB.z, weight, t, preAT, postBT),
- Mathf.CubicInterpolateInTime(w, b.w, preA.w, postB.w, weight, t, preAT, postBT)
+ Mathf.CubicInterpolateInTime(X, b.X, preA.X, postB.X, weight, t, preAT, postBT),
+ Mathf.CubicInterpolateInTime(Y, b.Y, preA.Y, postB.Y, weight, t, preAT, postBT),
+ Mathf.CubicInterpolateInTime(Z, b.Z, preA.Z, postB.Z, weight, t, preAT, postBT),
+ Mathf.CubicInterpolateInTime(W, b.W, preA.W, postB.W, weight, t, preAT, postBT)
);
}
@@ -224,7 +224,7 @@ namespace Godot
/// <returns>The direction from this vector to <paramref name="to"/>.</returns>
public readonly Vector4 DirectionTo(Vector4 to)
{
- Vector4 ret = new Vector4(to.x - x, to.y - y, to.z - z, to.w - w);
+ Vector4 ret = new Vector4(to.X - X, to.Y - Y, to.Z - Z, to.W - W);
ret.Normalize();
return ret;
}
@@ -258,7 +258,7 @@ namespace Godot
/// <returns>The dot product of the two vectors.</returns>
public readonly real_t Dot(Vector4 with)
{
- return (x * with.x) + (y * with.y) + (z * with.z) + (w * with.w);
+ return (X * with.X) + (Y * with.Y) + (Z * with.Z) + (W * with.W);
}
/// <summary>
@@ -267,16 +267,16 @@ namespace Godot
/// <returns>A vector with <see cref="Mathf.Floor"/> called on each component.</returns>
public readonly Vector4 Floor()
{
- return new Vector4(Mathf.Floor(x), Mathf.Floor(y), Mathf.Floor(z), Mathf.Floor(w));
+ return new Vector4(Mathf.Floor(X), Mathf.Floor(Y), Mathf.Floor(Z), Mathf.Floor(W));
}
/// <summary>
- /// Returns the inverse of this vector. This is the same as <c>new Vector4(1 / v.x, 1 / v.y, 1 / v.z, 1 / v.w)</c>.
+ /// Returns the inverse of this vector. This is the same as <c>new Vector4(1 / v.X, 1 / v.Y, 1 / v.Z, 1 / v.W)</c>.
/// </summary>
/// <returns>The inverse of this vector.</returns>
public readonly Vector4 Inverse()
{
- return new Vector4(1 / x, 1 / y, 1 / z, 1 / w);
+ return new Vector4(1 / X, 1 / Y, 1 / Z, 1 / W);
}
/// <summary>
@@ -286,7 +286,7 @@ namespace Godot
/// <returns>Whether this vector is finite or not.</returns>
public readonly bool IsFinite()
{
- return Mathf.IsFinite(x) && Mathf.IsFinite(y) && Mathf.IsFinite(z) && Mathf.IsFinite(w);
+ return Mathf.IsFinite(X) && Mathf.IsFinite(Y) && Mathf.IsFinite(Z) && Mathf.IsFinite(W);
}
/// <summary>
@@ -305,10 +305,10 @@ namespace Godot
/// <returns>The length of this vector.</returns>
public readonly real_t Length()
{
- real_t x2 = x * x;
- real_t y2 = y * y;
- real_t z2 = z * z;
- real_t w2 = w * w;
+ real_t x2 = X * X;
+ real_t y2 = Y * Y;
+ real_t z2 = Z * Z;
+ real_t w2 = W * W;
return Mathf.Sqrt(x2 + y2 + z2 + w2);
}
@@ -321,10 +321,10 @@ namespace Godot
/// <returns>The squared length of this vector.</returns>
public readonly real_t LengthSquared()
{
- real_t x2 = x * x;
- real_t y2 = y * y;
- real_t z2 = z * z;
- real_t w2 = w * w;
+ real_t x2 = X * X;
+ real_t y2 = Y * Y;
+ real_t z2 = Z * Z;
+ real_t w2 = W * W;
return x2 + y2 + z2 + w2;
}
@@ -340,10 +340,10 @@ namespace Godot
{
return new Vector4
(
- Mathf.Lerp(x, to.x, weight),
- Mathf.Lerp(y, to.y, weight),
- Mathf.Lerp(z, to.z, weight),
- Mathf.Lerp(w, to.w, weight)
+ Mathf.Lerp(X, to.X, weight),
+ Mathf.Lerp(Y, to.Y, weight),
+ Mathf.Lerp(Z, to.Z, weight),
+ Mathf.Lerp(W, to.W, weight)
);
}
@@ -355,7 +355,7 @@ namespace Godot
public readonly Axis MaxAxisIndex()
{
int max_index = 0;
- real_t max_value = x;
+ real_t max_value = X;
for (int i = 1; i < 4; i++)
{
if (this[i] > max_value)
@@ -375,7 +375,7 @@ namespace Godot
public readonly Axis MinAxisIndex()
{
int min_index = 0;
- real_t min_value = x;
+ real_t min_value = X;
for (int i = 1; i < 4; i++)
{
if (this[i] <= min_value)
@@ -409,10 +409,10 @@ namespace Godot
public readonly Vector4 PosMod(real_t mod)
{
return new Vector4(
- Mathf.PosMod(x, mod),
- Mathf.PosMod(y, mod),
- Mathf.PosMod(z, mod),
- Mathf.PosMod(w, mod)
+ Mathf.PosMod(X, mod),
+ Mathf.PosMod(Y, mod),
+ Mathf.PosMod(Z, mod),
+ Mathf.PosMod(W, mod)
);
}
@@ -427,10 +427,10 @@ namespace Godot
public readonly Vector4 PosMod(Vector4 modv)
{
return new Vector4(
- Mathf.PosMod(x, modv.x),
- Mathf.PosMod(y, modv.y),
- Mathf.PosMod(z, modv.z),
- Mathf.PosMod(w, modv.w)
+ Mathf.PosMod(X, modv.X),
+ Mathf.PosMod(Y, modv.Y),
+ Mathf.PosMod(Z, modv.Z),
+ Mathf.PosMod(W, modv.W)
);
}
@@ -441,7 +441,7 @@ namespace Godot
/// <returns>The rounded vector.</returns>
public readonly Vector4 Round()
{
- return new Vector4(Mathf.Round(x), Mathf.Round(y), Mathf.Round(z), Mathf.Round(w));
+ return new Vector4(Mathf.Round(X), Mathf.Round(Y), Mathf.Round(Z), Mathf.Round(W));
}
/// <summary>
@@ -453,10 +453,10 @@ namespace Godot
public readonly Vector4 Sign()
{
Vector4 v;
- v.x = Mathf.Sign(x);
- v.y = Mathf.Sign(y);
- v.z = Mathf.Sign(z);
- v.w = Mathf.Sign(w);
+ v.X = Mathf.Sign(X);
+ v.Y = Mathf.Sign(Y);
+ v.Z = Mathf.Sign(Z);
+ v.W = Mathf.Sign(W);
return v;
}
@@ -469,10 +469,10 @@ namespace Godot
public readonly Vector4 Snapped(Vector4 step)
{
return new Vector4(
- Mathf.Snapped(x, step.x),
- Mathf.Snapped(y, step.y),
- Mathf.Snapped(z, step.z),
- Mathf.Snapped(w, step.w)
+ Mathf.Snapped(X, step.X),
+ Mathf.Snapped(Y, step.Y),
+ Mathf.Snapped(Z, step.Z),
+ Mathf.Snapped(W, step.W)
);
}
@@ -506,10 +506,10 @@ namespace Godot
/// <param name="w">The vector's W component.</param>
public Vector4(real_t x, real_t y, real_t z, real_t w)
{
- this.x = x;
- this.y = y;
- this.z = z;
- this.w = w;
+ X = x;
+ Y = y;
+ Z = z;
+ W = w;
}
/// <summary>
@@ -521,10 +521,10 @@ namespace Godot
/// <returns>The added vector.</returns>
public static Vector4 operator +(Vector4 left, Vector4 right)
{
- left.x += right.x;
- left.y += right.y;
- left.z += right.z;
- left.w += right.w;
+ left.X += right.X;
+ left.Y += right.Y;
+ left.Z += right.Z;
+ left.W += right.W;
return left;
}
@@ -537,16 +537,16 @@ namespace Godot
/// <returns>The subtracted vector.</returns>
public static Vector4 operator -(Vector4 left, Vector4 right)
{
- left.x -= right.x;
- left.y -= right.y;
- left.z -= right.z;
- left.w -= right.w;
+ left.X -= right.X;
+ left.Y -= right.Y;
+ left.Z -= right.Z;
+ left.W -= right.W;
return left;
}
/// <summary>
/// Returns the negative value of the <see cref="Vector4"/>.
- /// This is the same as writing <c>new Vector4(-v.x, -v.y, -v.z, -v.w)</c>.
+ /// This is the same as writing <c>new Vector4(-v.X, -v.Y, -v.Z, -v.W)</c>.
/// This operation flips the direction of the vector while
/// keeping the same magnitude.
/// With floats, the number zero can be either positive or negative.
@@ -555,10 +555,10 @@ namespace Godot
/// <returns>The negated/flipped vector.</returns>
public static Vector4 operator -(Vector4 vec)
{
- vec.x = -vec.x;
- vec.y = -vec.y;
- vec.z = -vec.z;
- vec.w = -vec.w;
+ vec.X = -vec.X;
+ vec.Y = -vec.Y;
+ vec.Z = -vec.Z;
+ vec.W = -vec.W;
return vec;
}
@@ -571,10 +571,10 @@ namespace Godot
/// <returns>The multiplied vector.</returns>
public static Vector4 operator *(Vector4 vec, real_t scale)
{
- vec.x *= scale;
- vec.y *= scale;
- vec.z *= scale;
- vec.w *= scale;
+ vec.X *= scale;
+ vec.Y *= scale;
+ vec.Z *= scale;
+ vec.W *= scale;
return vec;
}
@@ -587,10 +587,10 @@ namespace Godot
/// <returns>The multiplied vector.</returns>
public static Vector4 operator *(real_t scale, Vector4 vec)
{
- vec.x *= scale;
- vec.y *= scale;
- vec.z *= scale;
- vec.w *= scale;
+ vec.X *= scale;
+ vec.Y *= scale;
+ vec.Z *= scale;
+ vec.W *= scale;
return vec;
}
@@ -603,10 +603,10 @@ namespace Godot
/// <returns>The multiplied vector.</returns>
public static Vector4 operator *(Vector4 left, Vector4 right)
{
- left.x *= right.x;
- left.y *= right.y;
- left.z *= right.z;
- left.w *= right.w;
+ left.X *= right.X;
+ left.Y *= right.Y;
+ left.Z *= right.Z;
+ left.W *= right.W;
return left;
}
@@ -619,10 +619,10 @@ namespace Godot
/// <returns>The divided vector.</returns>
public static Vector4 operator /(Vector4 vec, real_t divisor)
{
- vec.x /= divisor;
- vec.y /= divisor;
- vec.z /= divisor;
- vec.w /= divisor;
+ vec.X /= divisor;
+ vec.Y /= divisor;
+ vec.Z /= divisor;
+ vec.W /= divisor;
return vec;
}
@@ -635,10 +635,10 @@ namespace Godot
/// <returns>The divided vector.</returns>
public static Vector4 operator /(Vector4 vec, Vector4 divisorv)
{
- vec.x /= divisorv.x;
- vec.y /= divisorv.y;
- vec.z /= divisorv.z;
- vec.w /= divisorv.w;
+ vec.X /= divisorv.X;
+ vec.Y /= divisorv.Y;
+ vec.Z /= divisorv.Z;
+ vec.W /= divisorv.W;
return vec;
}
@@ -660,10 +660,10 @@ namespace Godot
/// <returns>The remainder vector.</returns>
public static Vector4 operator %(Vector4 vec, real_t divisor)
{
- vec.x %= divisor;
- vec.y %= divisor;
- vec.z %= divisor;
- vec.w %= divisor;
+ vec.X %= divisor;
+ vec.Y %= divisor;
+ vec.Z %= divisor;
+ vec.W %= divisor;
return vec;
}
@@ -685,10 +685,10 @@ namespace Godot
/// <returns>The remainder vector.</returns>
public static Vector4 operator %(Vector4 vec, Vector4 divisorv)
{
- vec.x %= divisorv.x;
- vec.y %= divisorv.y;
- vec.z %= divisorv.z;
- vec.w %= divisorv.w;
+ vec.X %= divisorv.X;
+ vec.Y %= divisorv.Y;
+ vec.Z %= divisorv.Z;
+ vec.W %= divisorv.W;
return vec;
}
@@ -731,19 +731,19 @@ namespace Godot
/// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Vector4 left, Vector4 right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- if (left.z == right.z)
+ if (left.Z == right.Z)
{
- return left.w < right.w;
+ return left.W < right.W;
}
- return left.z < right.z;
+ return left.Z < right.Z;
}
- return left.y < right.y;
+ return left.Y < right.Y;
}
- return left.x < right.x;
+ return left.X < right.X;
}
/// <summary>
@@ -759,19 +759,19 @@ namespace Godot
/// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Vector4 left, Vector4 right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- if (left.z == right.z)
+ if (left.Z == right.Z)
{
- return left.w > right.w;
+ return left.W > right.W;
}
- return left.z > right.z;
+ return left.Z > right.Z;
}
- return left.y > right.y;
+ return left.Y > right.Y;
}
- return left.x > right.x;
+ return left.X > right.X;
}
/// <summary>
@@ -787,19 +787,19 @@ namespace Godot
/// <returns>Whether or not the left is less than or equal to the right.</returns>
public static bool operator <=(Vector4 left, Vector4 right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- if (left.z == right.z)
+ if (left.Z == right.Z)
{
- return left.w <= right.w;
+ return left.W <= right.W;
}
- return left.z < right.z;
+ return left.Z < right.Z;
}
- return left.y < right.y;
+ return left.Y < right.Y;
}
- return left.x < right.x;
+ return left.X < right.X;
}
/// <summary>
@@ -815,19 +815,19 @@ namespace Godot
/// <returns>Whether or not the left is greater than or equal to the right.</returns>
public static bool operator >=(Vector4 left, Vector4 right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- if (left.z == right.z)
+ if (left.Z == right.Z)
{
- return left.w >= right.w;
+ return left.W >= right.W;
}
- return left.z > right.z;
+ return left.Z > right.Z;
}
- return left.y > right.y;
+ return left.Y > right.Y;
}
- return left.x > right.x;
+ return left.X > right.X;
}
/// <summary>
@@ -852,7 +852,7 @@ namespace Godot
/// <returns>Whether or not the vectors are exactly equal.</returns>
public readonly bool Equals(Vector4 other)
{
- return x == other.x && y == other.y && z == other.z && w == other.w;
+ return X == other.X && Y == other.Y && Z == other.Z && W == other.W;
}
/// <summary>
@@ -863,7 +863,7 @@ namespace Godot
/// <returns>Whether or not the vectors are approximately equal.</returns>
public readonly bool IsEqualApprox(Vector4 other)
{
- return Mathf.IsEqualApprox(x, other.x) && Mathf.IsEqualApprox(y, other.y) && Mathf.IsEqualApprox(z, other.z) && Mathf.IsEqualApprox(w, other.w);
+ return Mathf.IsEqualApprox(X, other.X) && Mathf.IsEqualApprox(Y, other.Y) && Mathf.IsEqualApprox(Z, other.Z) && Mathf.IsEqualApprox(W, other.W);
}
/// <summary>
@@ -875,7 +875,7 @@ namespace Godot
/// <returns>Whether or not the vector is approximately zero.</returns>
public readonly bool IsZeroApprox()
{
- return Mathf.IsZeroApprox(x) && Mathf.IsZeroApprox(y) && Mathf.IsZeroApprox(z) && Mathf.IsZeroApprox(w);
+ return Mathf.IsZeroApprox(X) && Mathf.IsZeroApprox(Y) && Mathf.IsZeroApprox(Z) && Mathf.IsZeroApprox(W);
}
/// <summary>
@@ -884,7 +884,7 @@ namespace Godot
/// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode()
{
- return y.GetHashCode() ^ x.GetHashCode() ^ z.GetHashCode() ^ w.GetHashCode();
+ return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode() ^ W.GetHashCode();
}
/// <summary>
@@ -893,7 +893,7 @@ namespace Godot
/// <returns>A string representation of this vector.</returns>
public override string ToString()
{
- return $"({x}, {y}, {z}, {w})";
+ return $"({X}, {Y}, {Z}, {W})";
}
/// <summary>
@@ -902,7 +902,7 @@ namespace Godot
/// <returns>A string representation of this vector.</returns>
public readonly string ToString(string format)
{
- return $"({x.ToString(format)}, {y.ToString(format)}, {z.ToString(format)}, {w.ToString(format)})";
+ return $"({X.ToString(format)}, {Y.ToString(format)}, {Z.ToString(format)}, {W.ToString(format)})";
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs
index 00ecc64856..f065327066 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4i.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs
@@ -8,7 +8,7 @@ namespace Godot
/// </summary>
[Serializable]
[StructLayout(LayoutKind.Sequential)]
- public struct Vector4i : IEquatable<Vector4i>
+ public struct Vector4I : IEquatable<Vector4I>
{
/// <summary>
/// Enumerated index values for the axes.
@@ -37,22 +37,22 @@ namespace Godot
/// <summary>
/// The vector's X component. Also accessible by using the index position <c>[0]</c>.
/// </summary>
- public int x;
+ public int X;
/// <summary>
/// The vector's Y component. Also accessible by using the index position <c>[1]</c>.
/// </summary>
- public int y;
+ public int Y;
/// <summary>
/// The vector's Z component. Also accessible by using the index position <c>[2]</c>.
/// </summary>
- public int z;
+ public int Z;
/// <summary>
/// The vector's W component. Also accessible by using the index position <c>[3]</c>.
/// </summary>
- public int w;
+ public int W;
/// <summary>
/// Access vector components using their <paramref name="index"/>.
@@ -61,10 +61,10 @@ namespace Godot
/// <paramref name="index"/> is not 0, 1, 2 or 3.
/// </exception>
/// <value>
- /// <c>[0]</c> is equivalent to <see cref="x"/>,
- /// <c>[1]</c> is equivalent to <see cref="y"/>,
- /// <c>[2]</c> is equivalent to <see cref="z"/>.
- /// <c>[3]</c> is equivalent to <see cref="w"/>.
+ /// <c>[0]</c> is equivalent to <see cref="X"/>,
+ /// <c>[1]</c> is equivalent to <see cref="Y"/>,
+ /// <c>[2]</c> is equivalent to <see cref="Z"/>.
+ /// <c>[3]</c> is equivalent to <see cref="W"/>.
/// </value>
public int this[int index]
{
@@ -73,13 +73,13 @@ namespace Godot
switch (index)
{
case 0:
- return x;
+ return X;
case 1:
- return y;
+ return Y;
case 2:
- return z;
+ return Z;
case 3:
- return w;
+ return W;
default:
throw new ArgumentOutOfRangeException(nameof(index));
}
@@ -89,16 +89,16 @@ namespace Godot
switch (index)
{
case 0:
- x = value;
+ X = value;
return;
case 1:
- y = value;
+ Y = value;
return;
case 2:
- z = value;
+ Z = value;
return;
case 3:
- w = value;
+ W = value;
return;
default:
throw new ArgumentOutOfRangeException(nameof(index));
@@ -111,19 +111,19 @@ namespace Godot
/// </summary>
public readonly void Deconstruct(out int x, out int y, out int z, out int w)
{
- x = this.x;
- y = this.y;
- z = this.z;
- w = this.w;
+ x = X;
+ y = Y;
+ z = Z;
+ w = W;
}
/// <summary>
/// Returns a new vector with all components in absolute values (i.e. positive).
/// </summary>
/// <returns>A vector with <see cref="Mathf.Abs(int)"/> called on each component.</returns>
- public readonly Vector4i Abs()
+ public readonly Vector4I Abs()
{
- return new Vector4i(Mathf.Abs(x), Mathf.Abs(y), Mathf.Abs(z), Mathf.Abs(w));
+ return new Vector4I(Mathf.Abs(X), Mathf.Abs(Y), Mathf.Abs(Z), Mathf.Abs(W));
}
/// <summary>
@@ -134,14 +134,14 @@ namespace Godot
/// <param name="min">The vector with minimum allowed values.</param>
/// <param name="max">The vector with maximum allowed values.</param>
/// <returns>The vector with all components clamped.</returns>
- public readonly Vector4i Clamp(Vector4i min, Vector4i max)
+ public readonly Vector4I Clamp(Vector4I min, Vector4I max)
{
- return new Vector4i
+ return new Vector4I
(
- Mathf.Clamp(x, min.x, max.x),
- Mathf.Clamp(y, min.y, max.y),
- Mathf.Clamp(z, min.z, max.z),
- Mathf.Clamp(w, min.w, max.w)
+ Mathf.Clamp(X, min.X, max.X),
+ Mathf.Clamp(Y, min.Y, max.Y),
+ Mathf.Clamp(Z, min.Z, max.Z),
+ Mathf.Clamp(W, min.W, max.W)
);
}
@@ -152,10 +152,10 @@ namespace Godot
/// <returns>The length of this vector.</returns>
public readonly real_t Length()
{
- int x2 = x * x;
- int y2 = y * y;
- int z2 = z * z;
- int w2 = w * w;
+ int x2 = X * X;
+ int y2 = Y * Y;
+ int z2 = Z * Z;
+ int w2 = W * W;
return Mathf.Sqrt(x2 + y2 + z2 + w2);
}
@@ -168,10 +168,10 @@ namespace Godot
/// <returns>The squared length of this vector.</returns>
public readonly int LengthSquared()
{
- int x2 = x * x;
- int y2 = y * y;
- int z2 = z * z;
- int w2 = w * w;
+ int x2 = X * X;
+ int y2 = Y * Y;
+ int z2 = Z * Z;
+ int w2 = W * W;
return x2 + y2 + z2 + w2;
}
@@ -184,7 +184,7 @@ namespace Godot
public readonly Axis MaxAxisIndex()
{
int max_index = 0;
- int max_value = x;
+ int max_value = X;
for (int i = 1; i < 4; i++)
{
if (this[i] > max_value)
@@ -204,7 +204,7 @@ namespace Godot
public readonly Axis MinAxisIndex()
{
int min_index = 0;
- int min_value = x;
+ int min_value = X;
for (int i = 1; i < 4; i++)
{
if (this[i] <= min_value)
@@ -222,213 +222,217 @@ namespace Godot
/// by calling <see cref="Mathf.Sign(int)"/> on each component.
/// </summary>
/// <returns>A vector with all components as either <c>1</c>, <c>-1</c>, or <c>0</c>.</returns>
- public readonly Vector4i Sign()
+ public readonly Vector4I Sign()
{
- return new Vector4i(Mathf.Sign(x), Mathf.Sign(y), Mathf.Sign(z), Mathf.Sign(w));
+ return new Vector4I(Mathf.Sign(X), Mathf.Sign(Y), Mathf.Sign(Z), Mathf.Sign(W));
}
// Constants
- private static readonly Vector4i _zero = new Vector4i(0, 0, 0, 0);
- private static readonly Vector4i _one = new Vector4i(1, 1, 1, 1);
+ private static readonly Vector4I _zero = new Vector4I(0, 0, 0, 0);
+ private static readonly Vector4I _one = new Vector4I(1, 1, 1, 1);
/// <summary>
/// Zero vector, a vector with all components set to <c>0</c>.
/// </summary>
- /// <value>Equivalent to <c>new Vector4i(0, 0, 0, 0)</c>.</value>
- public static Vector4i Zero { get { return _zero; } }
+ /// <value>Equivalent to <c>new Vector4I(0, 0, 0, 0)</c>.</value>
+ public static Vector4I Zero { get { return _zero; } }
/// <summary>
/// One vector, a vector with all components set to <c>1</c>.
/// </summary>
- /// <value>Equivalent to <c>new Vector4i(1, 1, 1, 1)</c>.</value>
- public static Vector4i One { get { return _one; } }
+ /// <value>Equivalent to <c>new Vector4I(1, 1, 1, 1)</c>.</value>
+ public static Vector4I One { get { return _one; } }
/// <summary>
- /// Constructs a new <see cref="Vector4i"/> with the given components.
+ /// Constructs a new <see cref="Vector4I"/> with the given components.
/// </summary>
/// <param name="x">The vector's X component.</param>
/// <param name="y">The vector's Y component.</param>
/// <param name="z">The vector's Z component.</param>
/// <param name="w">The vector's W component.</param>
- public Vector4i(int x, int y, int z, int w)
+ public Vector4I(int x, int y, int z, int w)
{
- this.x = x;
- this.y = y;
- this.z = z;
- this.w = w;
+ X = x;
+ Y = y;
+ Z = z;
+ W = w;
}
/// <summary>
- /// Adds each component of the <see cref="Vector4i"/>
- /// with the components of the given <see cref="Vector4i"/>.
+ /// Adds each component of the <see cref="Vector4I"/>
+ /// with the components of the given <see cref="Vector4I"/>.
/// </summary>
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>The added vector.</returns>
- public static Vector4i operator +(Vector4i left, Vector4i right)
+ public static Vector4I operator +(Vector4I left, Vector4I right)
{
- left.x += right.x;
- left.y += right.y;
- left.z += right.z;
- left.w += right.w;
+ left.X += right.X;
+ left.Y += right.Y;
+ left.Z += right.Z;
+ left.W += right.W;
return left;
}
/// <summary>
- /// Subtracts each component of the <see cref="Vector4i"/>
- /// by the components of the given <see cref="Vector4i"/>.
+ /// Subtracts each component of the <see cref="Vector4I"/>
+ /// by the components of the given <see cref="Vector4I"/>.
/// </summary>
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>The subtracted vector.</returns>
- public static Vector4i operator -(Vector4i left, Vector4i right)
+ public static Vector4I operator -(Vector4I left, Vector4I right)
{
- left.x -= right.x;
- left.y -= right.y;
- left.z -= right.z;
- left.w -= right.w;
+ left.X -= right.X;
+ left.Y -= right.Y;
+ left.Z -= right.Z;
+ left.W -= right.W;
return left;
}
/// <summary>
- /// Returns the negative value of the <see cref="Vector4i"/>.
- /// This is the same as writing <c>new Vector4i(-v.x, -v.y, -v.z, -v.w)</c>.
+ /// Returns the negative value of the <see cref="Vector4I"/>.
+ /// This is the same as writing <c>new Vector4I(-v.X, -v.Y, -v.Z, -v.W)</c>.
/// This operation flips the direction of the vector while
/// keeping the same magnitude.
/// </summary>
/// <param name="vec">The vector to negate/flip.</param>
/// <returns>The negated/flipped vector.</returns>
- public static Vector4i operator -(Vector4i vec)
+ public static Vector4I operator -(Vector4I vec)
{
- vec.x = -vec.x;
- vec.y = -vec.y;
- vec.z = -vec.z;
- vec.w = -vec.w;
+ vec.X = -vec.X;
+ vec.Y = -vec.Y;
+ vec.Z = -vec.Z;
+ vec.W = -vec.W;
return vec;
}
/// <summary>
- /// Multiplies each component of the <see cref="Vector4i"/>
+ /// Multiplies each component of the <see cref="Vector4I"/>
/// by the given <see langword="int"/>.
/// </summary>
/// <param name="vec">The vector to multiply.</param>
/// <param name="scale">The scale to multiply by.</param>
/// <returns>The multiplied vector.</returns>
- public static Vector4i operator *(Vector4i vec, int scale)
+ public static Vector4I operator *(Vector4I vec, int scale)
{
- vec.x *= scale;
- vec.y *= scale;
- vec.z *= scale;
- vec.w *= scale;
+ vec.X *= scale;
+ vec.Y *= scale;
+ vec.Z *= scale;
+ vec.W *= scale;
return vec;
}
/// <summary>
- /// Multiplies each component of the <see cref="Vector4i"/>
+ /// Multiplies each component of the <see cref="Vector4I"/>
/// by the given <see langword="int"/>.
/// </summary>
/// <param name="scale">The scale to multiply by.</param>
/// <param name="vec">The vector to multiply.</param>
/// <returns>The multiplied vector.</returns>
- public static Vector4i operator *(int scale, Vector4i vec)
+ public static Vector4I operator *(int scale, Vector4I vec)
{
- vec.x *= scale;
- vec.y *= scale;
- vec.z *= scale;
- vec.w *= scale;
+ vec.X *= scale;
+ vec.Y *= scale;
+ vec.Z *= scale;
+ vec.W *= scale;
return vec;
}
/// <summary>
- /// Multiplies each component of the <see cref="Vector4i"/>
- /// by the components of the given <see cref="Vector4i"/>.
+ /// Multiplies each component of the <see cref="Vector4I"/>
+ /// by the components of the given <see cref="Vector4I"/>.
/// </summary>
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>The multiplied vector.</returns>
- public static Vector4i operator *(Vector4i left, Vector4i right)
+ public static Vector4I operator *(Vector4I left, Vector4I right)
{
- left.x *= right.x;
- left.y *= right.y;
- left.z *= right.z;
- left.w *= right.w;
+ left.X *= right.X;
+ left.Y *= right.Y;
+ left.Z *= right.Z;
+ left.W *= right.W;
return left;
}
/// <summary>
- /// Divides each component of the <see cref="Vector4i"/>
+ /// Divides each component of the <see cref="Vector4I"/>
/// by the given <see langword="int"/>.
/// </summary>
/// <param name="vec">The dividend vector.</param>
/// <param name="divisor">The divisor value.</param>
/// <returns>The divided vector.</returns>
- public static Vector4i operator /(Vector4i vec, int divisor)
+ public static Vector4I operator /(Vector4I vec, int divisor)
{
- vec.x /= divisor;
- vec.y /= divisor;
- vec.z /= divisor;
- vec.w /= divisor;
+ vec.X /= divisor;
+ vec.Y /= divisor;
+ vec.Z /= divisor;
+ vec.W /= divisor;
return vec;
}
/// <summary>
- /// Divides each component of the <see cref="Vector4i"/>
- /// by the components of the given <see cref="Vector4i"/>.
+ /// Divides each component of the <see cref="Vector4I"/>
+ /// by the components of the given <see cref="Vector4I"/>.
/// </summary>
/// <param name="vec">The dividend vector.</param>
/// <param name="divisorv">The divisor vector.</param>
/// <returns>The divided vector.</returns>
- public static Vector4i operator /(Vector4i vec, Vector4i divisorv)
+ public static Vector4I operator /(Vector4I vec, Vector4I divisorv)
{
- vec.x /= divisorv.x;
- vec.y /= divisorv.y;
- vec.z /= divisorv.z;
- vec.w /= divisorv.w;
+ vec.X /= divisorv.X;
+ vec.Y /= divisorv.Y;
+ vec.Z /= divisorv.Z;
+ vec.W /= divisorv.W;
return vec;
}
/// <summary>
- /// Gets the remainder of each component of the <see cref="Vector4i"/>
+ /// Gets the remainder of each component of the <see cref="Vector4I"/>
/// with the components of the given <see langword="int"/>.
/// This operation uses truncated division, which is often not desired
/// as it does not work well with negative numbers.
+ /// Consider using <see cref="Mathf.PosMod(int, int)"/> instead
+ /// if you want to handle negative numbers.
/// </summary>
/// <example>
/// <code>
- /// GD.Print(new Vecto43i(10, -20, 30, -40) % 7); // Prints "(3, -6, 2, -5)"
+ /// GD.Print(new Vector4I(10, -20, 30, -40) % 7); // Prints "(3, -6, 2, -5)"
/// </code>
/// </example>
/// <param name="vec">The dividend vector.</param>
/// <param name="divisor">The divisor value.</param>
/// <returns>The remainder vector.</returns>
- public static Vector4i operator %(Vector4i vec, int divisor)
+ public static Vector4I operator %(Vector4I vec, int divisor)
{
- vec.x %= divisor;
- vec.y %= divisor;
- vec.z %= divisor;
- vec.w %= divisor;
+ vec.X %= divisor;
+ vec.Y %= divisor;
+ vec.Z %= divisor;
+ vec.W %= divisor;
return vec;
}
/// <summary>
- /// Gets the remainder of each component of the <see cref="Vector4i"/>
- /// with the components of the given <see cref="Vector4i"/>.
+ /// Gets the remainder of each component of the <see cref="Vector4I"/>
+ /// with the components of the given <see cref="Vector4I"/>.
/// This operation uses truncated division, which is often not desired
/// as it does not work well with negative numbers.
+ /// Consider using <see cref="Mathf.PosMod(int, int)"/> instead
+ /// if you want to handle negative numbers.
/// </summary>
/// <example>
/// <code>
- /// GD.Print(new Vector4i(10, -20, 30, -40) % new Vector4i(6, 7, 8, 9)); // Prints "(4, -6, 6, -4)"
+ /// GD.Print(new Vector4I(10, -20, 30, -40) % new Vector4I(6, 7, 8, 9)); // Prints "(4, -6, 6, -4)"
/// </code>
/// </example>
/// <param name="vec">The dividend vector.</param>
/// <param name="divisorv">The divisor vector.</param>
/// <returns>The remainder vector.</returns>
- public static Vector4i operator %(Vector4i vec, Vector4i divisorv)
+ public static Vector4I operator %(Vector4I vec, Vector4I divisorv)
{
- vec.x %= divisorv.x;
- vec.y %= divisorv.y;
- vec.z %= divisorv.z;
- vec.w %= divisorv.w;
+ vec.X %= divisorv.X;
+ vec.Y %= divisorv.Y;
+ vec.Z %= divisorv.Z;
+ vec.W %= divisorv.W;
return vec;
}
@@ -438,7 +442,7 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the vectors are equal.</returns>
- public static bool operator ==(Vector4i left, Vector4i right)
+ public static bool operator ==(Vector4I left, Vector4I right)
{
return left.Equals(right);
}
@@ -449,13 +453,13 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the vectors are not equal.</returns>
- public static bool operator !=(Vector4i left, Vector4i right)
+ public static bool operator !=(Vector4I left, Vector4I right)
{
return !left.Equals(right);
}
/// <summary>
- /// Compares two <see cref="Vector4i"/> vectors by first checking if
+ /// Compares two <see cref="Vector4I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is less than
/// the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check
@@ -465,25 +469,25 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is less than the right.</returns>
- public static bool operator <(Vector4i left, Vector4i right)
+ public static bool operator <(Vector4I left, Vector4I right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- if (left.z == right.z)
+ if (left.Z == right.Z)
{
- return left.w < right.w;
+ return left.W < right.W;
}
- return left.z < right.z;
+ return left.Z < right.Z;
}
- return left.y < right.y;
+ return left.Y < right.Y;
}
- return left.x < right.x;
+ return left.X < right.X;
}
/// <summary>
- /// Compares two <see cref="Vector4i"/> vectors by first checking if
+ /// Compares two <see cref="Vector4I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is greater than
/// the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check
@@ -493,25 +497,25 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is greater than the right.</returns>
- public static bool operator >(Vector4i left, Vector4i right)
+ public static bool operator >(Vector4I left, Vector4I right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- if (left.z == right.z)
+ if (left.Z == right.Z)
{
- return left.w > right.w;
+ return left.W > right.W;
}
- return left.z > right.z;
+ return left.Z > right.Z;
}
- return left.y > right.y;
+ return left.Y > right.Y;
}
- return left.x > right.x;
+ return left.X > right.X;
}
/// <summary>
- /// Compares two <see cref="Vector4i"/> vectors by first checking if
+ /// Compares two <see cref="Vector4I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is less than
/// or equal to the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check
@@ -521,25 +525,25 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is less than or equal to the right.</returns>
- public static bool operator <=(Vector4i left, Vector4i right)
+ public static bool operator <=(Vector4I left, Vector4I right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- if (left.z == right.z)
+ if (left.Z == right.Z)
{
- return left.w <= right.w;
+ return left.W <= right.W;
}
- return left.z < right.z;
+ return left.Z < right.Z;
}
- return left.y < right.y;
+ return left.Y < right.Y;
}
- return left.x < right.x;
+ return left.X < right.X;
}
/// <summary>
- /// Compares two <see cref="Vector4i"/> vectors by first checking if
+ /// Compares two <see cref="Vector4I"/> vectors by first checking if
/// the X value of the <paramref name="left"/> vector is greater than
/// or equal to the X value of the <paramref name="right"/> vector.
/// If the X values are exactly equal, then it repeats this check
@@ -549,43 +553,43 @@ namespace Godot
/// <param name="left">The left vector.</param>
/// <param name="right">The right vector.</param>
/// <returns>Whether or not the left is greater than or equal to the right.</returns>
- public static bool operator >=(Vector4i left, Vector4i right)
+ public static bool operator >=(Vector4I left, Vector4I right)
{
- if (left.x == right.x)
+ if (left.X == right.X)
{
- if (left.y == right.y)
+ if (left.Y == right.Y)
{
- if (left.z == right.z)
+ if (left.Z == right.Z)
{
- return left.w >= right.w;
+ return left.W >= right.W;
}
- return left.z > right.z;
+ return left.Z > right.Z;
}
- return left.y > right.y;
+ return left.Y > right.Y;
}
- return left.x > right.x;
+ return left.X > right.X;
}
/// <summary>
- /// Converts this <see cref="Vector4i"/> to a <see cref="Vector4"/>.
+ /// Converts this <see cref="Vector4I"/> to a <see cref="Vector4"/>.
/// </summary>
/// <param name="value">The vector to convert.</param>
- public static implicit operator Vector4(Vector4i value)
+ public static implicit operator Vector4(Vector4I value)
{
- return new Vector4(value.x, value.y, value.z, value.w);
+ return new Vector4(value.X, value.Y, value.Z, value.W);
}
/// <summary>
- /// Converts a <see cref="Vector4"/> to a <see cref="Vector4i"/>.
+ /// Converts a <see cref="Vector4"/> to a <see cref="Vector4I"/>.
/// </summary>
/// <param name="value">The vector to convert.</param>
- public static explicit operator Vector4i(Vector4 value)
+ public static explicit operator Vector4I(Vector4 value)
{
- return new Vector4i(
- Mathf.RoundToInt(value.x),
- Mathf.RoundToInt(value.y),
- Mathf.RoundToInt(value.z),
- Mathf.RoundToInt(value.w)
+ return new Vector4I(
+ Mathf.RoundToInt(value.X),
+ Mathf.RoundToInt(value.Y),
+ Mathf.RoundToInt(value.Z),
+ Mathf.RoundToInt(value.W)
);
}
@@ -597,7 +601,7 @@ namespace Godot
/// <returns>Whether or not the vector and the object are equal.</returns>
public override readonly bool Equals(object obj)
{
- return obj is Vector4i other && Equals(other);
+ return obj is Vector4I other && Equals(other);
}
/// <summary>
@@ -605,36 +609,36 @@ namespace Godot
/// </summary>
/// <param name="other">The other vector.</param>
/// <returns>Whether or not the vectors are equal.</returns>
- public readonly bool Equals(Vector4i other)
+ public readonly bool Equals(Vector4I other)
{
- return x == other.x && y == other.y && z == other.z && w == other.w;
+ return X == other.X && Y == other.Y && Z == other.Z && W == other.W;
}
/// <summary>
- /// Serves as the hash function for <see cref="Vector4i"/>.
+ /// Serves as the hash function for <see cref="Vector4I"/>.
/// </summary>
/// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode()
{
- return y.GetHashCode() ^ x.GetHashCode() ^ z.GetHashCode() ^ w.GetHashCode();
+ return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode() ^ W.GetHashCode();
}
/// <summary>
- /// Converts this <see cref="Vector4i"/> to a string.
+ /// Converts this <see cref="Vector4I"/> to a string.
/// </summary>
/// <returns>A string representation of this vector.</returns>
public override readonly string ToString()
{
- return $"({x}, {y}, {z}, {w})";
+ return $"({X}, {Y}, {Z}, {W})";
}
/// <summary>
- /// Converts this <see cref="Vector4i"/> to a string with the given <paramref name="format"/>.
+ /// Converts this <see cref="Vector4I"/> to a string with the given <paramref name="format"/>.
/// </summary>
/// <returns>A string representation of this vector.</returns>
public readonly string ToString(string format)
{
- return $"({x.ToString(format)}, {y.ToString(format)}, {z.ToString(format)}), {w.ToString(format)})";
+ return $"({X.ToString(format)}, {Y.ToString(format)}, {Z.ToString(format)}), {W.ToString(format)})";
}
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj
index 644212c74d..7aa2f7e959 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj
+++ b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj
@@ -49,7 +49,7 @@
</ItemGroup>
<!-- Sources -->
<ItemGroup>
- <Compile Include="Core\AABB.cs" />
+ <Compile Include="Core\Aabb.cs" />
<Compile Include="Core\Bridge\GodotSerializationInfo.cs" />
<Compile Include="Core\Bridge\MethodInfo.cs" />
<Compile Include="Core\Callable.generics.cs" />
@@ -60,8 +60,9 @@
<Compile Include="Core\Attributes\ExportCategoryAttribute.cs" />
<Compile Include="Core\Attributes\ExportGroupAttribute.cs" />
<Compile Include="Core\Attributes\ExportSubgroupAttribute.cs" />
+ <Compile Include="Core\Attributes\GodotClassNameAttribute.cs" />
<Compile Include="Core\Attributes\MustBeVariantAttribute.cs" />
- <Compile Include="Core\Attributes\RPCAttribute.cs" />
+ <Compile Include="Core\Attributes\RpcAttribute.cs" />
<Compile Include="Core\Attributes\ScriptPathAttribute.cs" />
<Compile Include="Core\Attributes\SignalAttribute.cs" />
<Compile Include="Core\Attributes\ToolAttribute.cs" />
@@ -80,11 +81,13 @@
<Compile Include="Core\DelegateUtils.cs" />
<Compile Include="Core\Dictionary.cs" />
<Compile Include="Core\Dispatcher.cs" />
+ <Compile Include="Core\Extensions\GodotObjectExtensions.cs" />
<Compile Include="Core\Extensions\NodeExtensions.cs" />
- <Compile Include="Core\Extensions\ObjectExtensions.cs" />
<Compile Include="Core\Extensions\PackedSceneExtensions.cs" />
<Compile Include="Core\Extensions\ResourceLoaderExtensions.cs" />
<Compile Include="Core\GD.cs" />
+ <Compile Include="Core\GodotObject.base.cs" />
+ <Compile Include="Core\GodotObject.exceptions.cs" />
<Compile Include="Core\GodotSynchronizationContext.cs" />
<Compile Include="Core\GodotTaskScheduler.cs" />
<Compile Include="Core\GodotTraceListener.cs" />
@@ -104,15 +107,13 @@
<Compile Include="Core\NativeInterop\VariantUtils.cs" />
<Compile Include="Core\NativeInterop\VariantUtils.generic.cs" />
<Compile Include="Core\NodePath.cs" />
- <Compile Include="Core\Object.base.cs" />
- <Compile Include="Core\Object.exceptions.cs" />
<Compile Include="Core\Plane.cs" />
<Compile Include="Core\Projection.cs" />
<Compile Include="Core\Quaternion.cs" />
<Compile Include="Core\Rect2.cs" />
- <Compile Include="Core\Rect2i.cs" />
+ <Compile Include="Core\Rect2I.cs" />
<Compile Include="Core\ReflectionUtils.cs" />
- <Compile Include="Core\RID.cs" />
+ <Compile Include="Core\Rid.cs" />
<Compile Include="Core\NativeInterop\NativeFuncs.cs" />
<Compile Include="Core\NativeInterop\InteropStructs.cs" />
<Compile Include="Core\NativeInterop\Marshaling.cs" />
@@ -124,11 +125,11 @@
<Compile Include="Core\Transform3D.cs" />
<Compile Include="Core\Variant.cs" />
<Compile Include="Core\Vector2.cs" />
- <Compile Include="Core\Vector2i.cs" />
+ <Compile Include="Core\Vector2I.cs" />
<Compile Include="Core\Vector3.cs" />
- <Compile Include="Core\Vector3i.cs" />
+ <Compile Include="Core\Vector3I.cs" />
<Compile Include="Core\Vector4.cs" />
- <Compile Include="Core\Vector4i.cs" />
+ <Compile Include="Core\Vector4I.cs" />
<Compile Include="GlobalUsings.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
diff --git a/modules/mono/glue/runtime_interop.cpp b/modules/mono/glue/runtime_interop.cpp
index f0ea0313ea..d17fe3e75f 100644
--- a/modules/mono/glue/runtime_interop.cpp
+++ b/modules/mono/glue/runtime_interop.cpp
@@ -31,6 +31,7 @@
#include "runtime_interop.h"
#include "core/config/engine.h"
+#include "core/config/project_settings.h"
#include "core/debugger/engine_debugger.h"
#include "core/debugger/script_debugger.h"
#include "core/io/marshalls.h"
@@ -45,6 +46,7 @@
#include "modules/mono/managed_callable.h"
#include "modules/mono/mono_gd/gd_mono_cache.h"
#include "modules/mono/signal_awaiter_utils.h"
+#include "modules/mono/utils/path_utils.h"
#ifdef __cplusplus
extern "C" {
@@ -84,7 +86,8 @@ void godotsharp_stack_info_vector_destroy(
void godotsharp_internal_script_debugger_send_error(const String *p_func,
const String *p_file, int32_t p_line, const String *p_err, const String *p_descr,
bool p_warning, const Vector<ScriptLanguage::StackInfo> *p_stack_info_vector) {
- EngineDebugger::get_script_debugger()->send_error(*p_func, *p_file, p_line, *p_err, *p_descr,
+ const String file = ProjectSettings::get_singleton()->localize_path(p_file->simplify_path());
+ EngineDebugger::get_script_debugger()->send_error(*p_func, file, p_line, *p_err, *p_descr,
true, p_warning ? ERR_HANDLER_WARNING : ERR_HANDLER_ERROR, *p_stack_info_vector);
}
@@ -1009,6 +1012,10 @@ int32_t godotsharp_array_resize(Array *p_self, int32_t p_new_size) {
return (int32_t)p_self->resize(p_new_size);
}
+void godotsharp_array_make_read_only(Array *p_self) {
+ p_self->make_read_only();
+}
+
void godotsharp_array_shuffle(Array *p_self) {
p_self->shuffle();
}
@@ -1066,10 +1073,22 @@ void godotsharp_dictionary_duplicate(const Dictionary *p_self, bool p_deep, Dict
memnew_placement(r_dest, Dictionary(p_self->duplicate(p_deep)));
}
+void godotsharp_dictionary_merge(Dictionary *p_self, const Dictionary *p_dictionary, bool p_overwrite) {
+ p_self->merge(*p_dictionary, p_overwrite);
+}
+
+bool godotsharp_dictionary_recursive_equal(const Dictionary *p_self, const Dictionary *p_other) {
+ return p_self->recursive_equal(*p_other, 0);
+}
+
bool godotsharp_dictionary_remove_key(Dictionary *p_self, const Variant *p_key) {
return p_self->erase(*p_key);
}
+void godotsharp_dictionary_make_read_only(Dictionary *p_self) {
+ p_self->make_read_only();
+}
+
void godotsharp_dictionary_to_string(const Dictionary *p_self, String *r_str) {
*r_str = Variant(*p_self).operator String();
}
@@ -1180,21 +1199,6 @@ void godotsharp_weakref(Object *p_ptr, Ref<RefCounted> *r_weak_ref) {
memnew_placement(r_weak_ref, Ref<RefCounted>(wref));
}
-void godotsharp_str(const godot_array *p_what, godot_string *r_ret) {
- String &str = *memnew_placement(r_ret, String);
- const Array &what = *reinterpret_cast<const Array *>(p_what);
-
- for (int i = 0; i < what.size(); i++) {
- String os = what[i].operator String();
-
- if (i == 0) {
- str = os;
- } else {
- str += os;
- }
- }
-}
-
void godotsharp_print(const godot_string *p_what) {
print_line(*reinterpret_cast<const String *>(p_what));
}
@@ -1443,6 +1447,7 @@ static const void *unmanaged_callbacks[]{
(void *)godotsharp_array_insert,
(void *)godotsharp_array_remove_at,
(void *)godotsharp_array_resize,
+ (void *)godotsharp_array_make_read_only,
(void *)godotsharp_array_shuffle,
(void *)godotsharp_array_to_string,
(void *)godotsharp_dictionary_try_get_value,
@@ -1455,7 +1460,10 @@ static const void *unmanaged_callbacks[]{
(void *)godotsharp_dictionary_clear,
(void *)godotsharp_dictionary_contains_key,
(void *)godotsharp_dictionary_duplicate,
+ (void *)godotsharp_dictionary_merge,
+ (void *)godotsharp_dictionary_recursive_equal,
(void *)godotsharp_dictionary_remove_key,
+ (void *)godotsharp_dictionary_make_read_only,
(void *)godotsharp_dictionary_to_string,
(void *)godotsharp_string_simplify_path,
(void *)godotsharp_string_to_camel_case,
@@ -1488,7 +1496,6 @@ static const void *unmanaged_callbacks[]{
(void *)godotsharp_rand_from_seed,
(void *)godotsharp_seed,
(void *)godotsharp_weakref,
- (void *)godotsharp_str,
(void *)godotsharp_str_to_var,
(void *)godotsharp_var_to_bytes,
(void *)godotsharp_var_to_str,
diff --git a/modules/mono/utils/naming_utils.cpp b/modules/mono/utils/naming_utils.cpp
new file mode 100644
index 0000000000..62fbf815f8
--- /dev/null
+++ b/modules/mono/utils/naming_utils.cpp
@@ -0,0 +1,293 @@
+/**************************************************************************/
+/* naming_utils.cpp */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 "naming_utils.h"
+
+#include "core/string/ucaps.h"
+#include "core/templates/hash_map.h"
+
+HashMap<String, String> _create_hashmap_from_vector(Vector<Pair<String, String>> vector) {
+ HashMap<String, String> hashmap = HashMap<String, String>(vector.size());
+ for (const Pair<String, String> &pair : vector) {
+ hashmap.insert(pair.first, pair.second);
+ }
+ return hashmap;
+}
+
+// Hardcoded collection of PascalCase name conversions.
+const HashMap<String, String> pascal_case_name_overrides = _create_hashmap_from_vector({
+ { "BitMap", "Bitmap" },
+ { "JSONRPC", "JsonRpc" },
+ { "Object", "GodotObject" },
+ { "OpenXRIPBinding", "OpenXRIPBinding" },
+ { "SkeletonModification2DCCDIK", "SkeletonModification2DCcdik" },
+ { "SkeletonModification2DFABRIK", "SkeletonModification2DFabrik" },
+ { "SkeletonModification3DCCDIK", "SkeletonModification3DCcdik" },
+ { "SkeletonModification3DFABRIK", "SkeletonModification3DFabrik" },
+ { "System", "System_" },
+ { "Thread", "GodotThread" },
+});
+
+// Hardcoded collection of PascalCase part conversions.
+const HashMap<String, String> pascal_case_part_overrides = _create_hashmap_from_vector({
+ { "AA", "AA" }, // Anti Aliasing
+ { "AO", "AO" }, // Ambient Occlusion
+ { "FILENAME", "FileName" },
+ { "FADEIN", "FadeIn" },
+ { "FADEOUT", "FadeOut" },
+ { "FX", "FX" },
+ { "GI", "GI" }, // Global Illumination
+ { "GZIP", "GZip" },
+ { "HBOX", "HBox" }, // Horizontal Box
+ { "ID", "Id" },
+ { "IO", "IO" }, // Input/Output
+ { "IP", "IP" }, // Internet Protocol
+ { "IV", "IV" }, // Initialization Vector
+ { "MACOS", "MacOS" },
+ { "NODEPATH", "NodePath" },
+ { "SPIRV", "SpirV" },
+ { "STDIN", "StdIn" },
+ { "STDOUT", "StdOut" },
+ { "USERNAME", "UserName" },
+ { "UV", "UV" },
+ { "UV2", "UV2" },
+ { "VBOX", "VBox" }, // Vertical Box
+ { "WHITESPACE", "WhiteSpace" },
+ { "WM", "WM" },
+ { "XR", "XR" },
+ { "XRAPI", "XRApi" },
+});
+
+String _get_pascal_case_part_override(String p_part, bool p_input_is_upper = true) {
+ if (!p_input_is_upper) {
+ for (int i = 0; i < p_part.length(); i++) {
+ p_part[i] = _find_upper(p_part[i]);
+ }
+ }
+
+ if (pascal_case_part_overrides.has(p_part)) {
+ return pascal_case_part_overrides.get(p_part);
+ }
+
+ return String();
+}
+
+Vector<String> _split_pascal_case(const String &p_identifier) {
+ Vector<String> parts;
+ int current_part_start = 0;
+ bool prev_was_upper = is_ascii_upper_case(p_identifier[0]);
+ for (int i = 1; i < p_identifier.length(); i++) {
+ if (prev_was_upper) {
+ if (is_digit(p_identifier[i]) || is_ascii_lower_case(p_identifier[i])) {
+ if (!is_digit(p_identifier[i])) {
+ // These conditions only apply when the separator is not a digit.
+ if (i - current_part_start == 1) {
+ // Upper character was only the beginning of a word.
+ prev_was_upper = false;
+ continue;
+ }
+ if (i != p_identifier.length()) {
+ // If this is not the last character, the last uppercase
+ // character is the start of the next word.
+ i--;
+ }
+ }
+ if (i - current_part_start > 0) {
+ parts.append(p_identifier.substr(current_part_start, i - current_part_start));
+ current_part_start = i;
+ prev_was_upper = false;
+ }
+ }
+ } else {
+ if (is_digit(p_identifier[i]) || is_ascii_upper_case(p_identifier[i])) {
+ parts.append(p_identifier.substr(current_part_start, i - current_part_start));
+ current_part_start = i;
+ prev_was_upper = true;
+ }
+ }
+ }
+
+ // Add the rest of the identifier as the last part.
+ if (current_part_start != p_identifier.length()) {
+ parts.append(p_identifier.substr(current_part_start));
+ }
+
+ return parts;
+}
+
+String pascal_to_pascal_case(const String &p_identifier) {
+ if (p_identifier.length() == 0) {
+ return p_identifier;
+ }
+
+ if (p_identifier.length() <= 2) {
+ return p_identifier.to_upper();
+ }
+
+ if (pascal_case_name_overrides.has(p_identifier)) {
+ // Use hardcoded value for the identifier.
+ return pascal_case_name_overrides.get(p_identifier);
+ }
+
+ Vector<String> parts = _split_pascal_case(p_identifier);
+
+ String ret;
+
+ for (String &part : parts) {
+ String part_override = _get_pascal_case_part_override(part);
+ if (!part_override.is_empty()) {
+ // Use hardcoded value for part.
+ ret += part_override;
+ continue;
+ }
+
+ if (part.length() <= 2 && part.to_upper() == part) {
+ // Acronym of length 1 or 2.
+ for (int j = 0; j < part.length(); j++) {
+ part[j] = _find_upper(part[j]);
+ }
+ ret += part;
+ continue;
+ }
+
+ part[0] = _find_upper(part[0]);
+ for (int i = 1; i < part.length(); i++) {
+ if (is_digit(part[i - 1])) {
+ // Use uppercase after digits.
+ part[i] = _find_upper(part[i]);
+ continue;
+ }
+
+ part[i] = _find_lower(part[i]);
+ }
+ ret += part;
+ }
+
+ return ret;
+}
+
+String snake_to_pascal_case(const String &p_identifier, bool p_input_is_upper) {
+ String ret;
+ Vector<String> parts = p_identifier.split("_", true);
+
+ for (int i = 0; i < parts.size(); i++) {
+ String part = parts[i];
+
+ String part_override = _get_pascal_case_part_override(part, p_input_is_upper);
+ if (!part_override.is_empty()) {
+ // Use hardcoded value for part.
+ ret += part_override;
+ continue;
+ }
+
+ if (!part.is_empty()) {
+ part[0] = _find_upper(part[0]);
+ for (int j = 1; j < part.length(); j++) {
+ if (is_digit(part[j - 1])) {
+ // Use uppercase after digits.
+ part[j] = _find_upper(part[j]);
+ continue;
+ }
+
+ if (p_input_is_upper) {
+ part[j] = _find_lower(part[j]);
+ }
+ }
+ ret += part;
+ } else {
+ if (i == 0 || i == (parts.size() - 1)) {
+ // Preserve underscores at the beginning and end
+ ret += "_";
+ } else {
+ // Preserve contiguous underscores
+ if (parts[i - 1].length()) {
+ ret += "__";
+ } else {
+ ret += "_";
+ }
+ }
+ }
+ }
+
+ return ret;
+}
+
+String snake_to_camel_case(const String &p_identifier, bool p_input_is_upper) {
+ String ret;
+ Vector<String> parts = p_identifier.split("_", true);
+
+ for (int i = 0; i < parts.size(); i++) {
+ String part = parts[i];
+
+ String part_override = _get_pascal_case_part_override(part, p_input_is_upper);
+ if (!part_override.is_empty()) {
+ // Use hardcoded value for part.
+ if (i == 0) {
+ part_override[0] = _find_lower(part_override[0]);
+ }
+ ret += part_override;
+ continue;
+ }
+
+ if (!part.is_empty()) {
+ if (i == 0) {
+ part[0] = _find_lower(part[0]);
+ } else {
+ part[0] = _find_upper(part[0]);
+ }
+ for (int j = 1; j < part.length(); j++) {
+ if (is_digit(part[j - 1])) {
+ // Use uppercase after digits.
+ part[j] = _find_upper(part[j]);
+ continue;
+ }
+
+ if (p_input_is_upper) {
+ part[j] = _find_lower(part[j]);
+ }
+ }
+ ret += part;
+ } else {
+ if (i == 0 || i == (parts.size() - 1)) {
+ // Preserve underscores at the beginning and end
+ ret += "_";
+ } else {
+ // Preserve contiguous underscores
+ if (parts[i - 1].length()) {
+ ret += "__";
+ } else {
+ ret += "_";
+ }
+ }
+ }
+ }
+
+ return ret;
+}
diff --git a/editor/array_property_edit.h b/modules/mono/utils/naming_utils.h
index 6e34a06943..ac64a5c114 100644
--- a/editor/array_property_edit.h
+++ b/modules/mono/utils/naming_utils.h
@@ -1,5 +1,5 @@
/**************************************************************************/
-/* array_property_edit.h */
+/* naming_utils.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,42 +28,15 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
-#ifndef ARRAY_PROPERTY_EDIT_H
-#define ARRAY_PROPERTY_EDIT_H
+#ifndef MONO_NAMING_UTILS_H
+#define MONO_NAMING_UTILS_H
-#include "scene/main/node.h"
+#include "core/string/ustring.h"
-class ArrayPropertyEdit : public RefCounted {
- GDCLASS(ArrayPropertyEdit, RefCounted);
+String pascal_to_pascal_case(const String &p_identifier);
- int page;
- ObjectID obj;
- StringName property;
- String vtypes;
- String subtype_hint_string;
- PropertyHint subtype_hint;
- Variant::Type subtype;
- Variant get_array() const;
- Variant::Type default_type;
+String snake_to_pascal_case(const String &p_identifier, bool p_input_is_upper = false);
- void _notif_change();
- void _set_size(int p_size);
- void _set_value(int p_idx, const Variant &p_value);
+String snake_to_camel_case(const String &p_identifier, bool p_input_is_upper = false);
- bool _dont_undo_redo();
-
-protected:
- static void _bind_methods();
- bool _set(const StringName &p_name, const Variant &p_value);
- bool _get(const StringName &p_name, Variant &r_ret) const;
- void _get_property_list(List<PropertyInfo> *p_list) const;
-
-public:
- void edit(Object *p_obj, const StringName &p_prop, const String &p_hint_string, Variant::Type p_deftype);
-
- Node *get_node();
-
- ArrayPropertyEdit();
-};
-
-#endif // ARRAY_PROPERTY_EDIT_H
+#endif // MONO_NAMING_UTILS_H
diff --git a/modules/multiplayer/editor/replication_editor.cpp b/modules/multiplayer/editor/replication_editor.cpp
index 66e12a338a..9e542828ee 100644
--- a/modules/multiplayer/editor/replication_editor.cpp
+++ b/modules/multiplayer/editor/replication_editor.cpp
@@ -172,7 +172,7 @@ ReplicationEditor::ReplicationEditor() {
set_custom_minimum_size(Size2(0, 200) * EDSCALE);
delete_dialog = memnew(ConfirmationDialog);
- delete_dialog->connect("cancelled", callable_mp(this, &ReplicationEditor::_dialog_closed).bind(false));
+ delete_dialog->connect("canceled", callable_mp(this, &ReplicationEditor::_dialog_closed).bind(false));
delete_dialog->connect("confirmed", callable_mp(this, &ReplicationEditor::_dialog_closed).bind(true));
add_child(delete_dialog);
diff --git a/modules/multiplayer/scene_replication_interface.cpp b/modules/multiplayer/scene_replication_interface.cpp
index 233ff76c7d..3466cb10df 100644
--- a/modules/multiplayer/scene_replication_interface.cpp
+++ b/modules/multiplayer/scene_replication_interface.cpp
@@ -125,7 +125,7 @@ void SceneReplicationInterface::on_reset() {
}
void SceneReplicationInterface::on_network_process() {
- // Prevent endless stalling in case of unforseen spawn errors.
+ // Prevent endless stalling in case of unforeseen spawn errors.
if (spawn_queue.size()) {
ERR_PRINT("An error happened during last spawn, this usually means the 'ready' signal was not emitted by the spawned node.");
for (const ObjectID &oid : spawn_queue) {
diff --git a/modules/navigation/editor/navigation_mesh_editor_plugin.cpp b/modules/navigation/editor/navigation_mesh_editor_plugin.cpp
index 54f7abda8d..557d45b386 100644
--- a/modules/navigation/editor/navigation_mesh_editor_plugin.cpp
+++ b/modules/navigation/editor/navigation_mesh_editor_plugin.cpp
@@ -60,12 +60,40 @@ void NavigationMeshEditor::_bake_pressed() {
button_bake->set_pressed(false);
ERR_FAIL_COND(!node);
- if (!node->get_navigation_mesh().is_valid()) {
+ Ref<NavigationMesh> navmesh = node->get_navigation_mesh();
+ if (!navmesh.is_valid()) {
err_dialog->set_text(TTR("A NavigationMesh resource must be set or created for this node to work."));
err_dialog->popup_centered();
return;
}
+ String path = navmesh->get_path();
+ if (!path.is_resource_file()) {
+ int srpos = path.find("::");
+ if (srpos != -1) {
+ String base = path.substr(0, srpos);
+ if (ResourceLoader::get_resource_type(base) == "PackedScene") {
+ if (!get_tree()->get_edited_scene_root() || get_tree()->get_edited_scene_root()->get_scene_file_path() != base) {
+ err_dialog->set_text(TTR("Cannot generate navigation mesh because it does not belong to the edited scene. Make it unique first."));
+ err_dialog->popup_centered();
+ return;
+ }
+ } else {
+ if (FileAccess::exists(base + ".import")) {
+ err_dialog->set_text(TTR("Cannot generate navigation mesh because it belongs to a resource which was imported."));
+ err_dialog->popup_centered();
+ return;
+ }
+ }
+ }
+ } else {
+ if (FileAccess::exists(path + ".import")) {
+ err_dialog->set_text(TTR("Cannot generate navigation mesh because the resource was imported from another type."));
+ err_dialog->popup_centered();
+ return;
+ }
+ }
+
NavigationMeshGenerator::get_singleton()->clear(node->get_navigation_mesh());
NavigationMeshGenerator::get_singleton()->bake(node->get_navigation_mesh(), node);
diff --git a/modules/navigation/godot_navigation_server.cpp b/modules/navigation/godot_navigation_server.cpp
index 9b5d78d465..d546c5d3ba 100644
--- a/modules/navigation/godot_navigation_server.cpp
+++ b/modules/navigation/godot_navigation_server.cpp
@@ -81,36 +81,6 @@ using namespace NavigationUtilities;
} \
void GodotNavigationServer::MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1)
-#define COMMAND_4(F_NAME, T_0, D_0, T_1, D_1, T_2, D_2, T_3, D_3) \
- struct MERGE(F_NAME, _command) : public SetCommand { \
- T_0 d_0; \
- T_1 d_1; \
- T_2 d_2; \
- T_3 d_3; \
- MERGE(F_NAME, _command) \
- ( \
- T_0 p_d_0, \
- T_1 p_d_1, \
- T_2 p_d_2, \
- T_3 p_d_3) : \
- d_0(p_d_0), \
- d_1(p_d_1), \
- d_2(p_d_2), \
- d_3(p_d_3) {} \
- virtual void exec(GodotNavigationServer *server) override { \
- server->MERGE(_cmd_, F_NAME)(d_0, d_1, d_2, d_3); \
- } \
- }; \
- void GodotNavigationServer::F_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3) { \
- auto cmd = memnew(MERGE(F_NAME, _command)( \
- D_0, \
- D_1, \
- D_2, \
- D_3)); \
- add_command(cmd); \
- } \
- void GodotNavigationServer::MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3)
-
GodotNavigationServer::GodotNavigationServer() {}
GodotNavigationServer::~GodotNavigationServer() {
@@ -535,32 +505,32 @@ uint32_t GodotNavigationServer::link_get_navigation_layers(const RID p_link) con
return link->get_navigation_layers();
}
-COMMAND_2(link_set_start_location, RID, p_link, Vector3, p_location) {
+COMMAND_2(link_set_start_position, RID, p_link, Vector3, p_position) {
NavLink *link = link_owner.get_or_null(p_link);
ERR_FAIL_COND(link == nullptr);
- link->set_start_location(p_location);
+ link->set_start_position(p_position);
}
-Vector3 GodotNavigationServer::link_get_start_location(RID p_link) const {
+Vector3 GodotNavigationServer::link_get_start_position(RID p_link) const {
const NavLink *link = link_owner.get_or_null(p_link);
ERR_FAIL_COND_V(link == nullptr, Vector3());
- return link->get_start_location();
+ return link->get_start_position();
}
-COMMAND_2(link_set_end_location, RID, p_link, Vector3, p_location) {
+COMMAND_2(link_set_end_position, RID, p_link, Vector3, p_position) {
NavLink *link = link_owner.get_or_null(p_link);
ERR_FAIL_COND(link == nullptr);
- link->set_end_location(p_location);
+ link->set_end_position(p_position);
}
-Vector3 GodotNavigationServer::link_get_end_location(RID p_link) const {
+Vector3 GodotNavigationServer::link_get_end_position(RID p_link) const {
const NavLink *link = link_owner.get_or_null(p_link);
ERR_FAIL_COND_V(link == nullptr, Vector3());
- return link->get_end_location();
+ return link->get_end_position();
}
COMMAND_2(link_set_enter_cost, RID, p_link, real_t, p_enter_cost) {
@@ -711,17 +681,17 @@ bool GodotNavigationServer::agent_is_map_changed(RID p_agent) const {
return agent->is_map_changed();
}
-COMMAND_4(agent_set_callback, RID, p_agent, ObjectID, p_object_id, StringName, p_method, Variant, p_udata) {
+COMMAND_2(agent_set_callback, RID, p_agent, Callable, p_callback) {
RvoAgent *agent = agent_owner.get_or_null(p_agent);
ERR_FAIL_COND(agent == nullptr);
- agent->set_callback(p_object_id, p_method, p_udata);
+ agent->set_callback(p_callback);
if (agent->get_map()) {
- if (p_object_id == ObjectID()) {
- agent->get_map()->remove_agent_as_controlled(agent);
- } else {
+ if (p_callback.is_valid()) {
agent->get_map()->set_agent_as_controlled(agent);
+ } else {
+ agent->get_map()->remove_agent_as_controlled(agent);
}
}
}
@@ -731,24 +701,21 @@ COMMAND_1(free, RID, p_object) {
NavMap *map = map_owner.get_or_null(p_object);
// Removes any assigned region
- LocalVector<NavRegion *> regions = map->get_regions();
- for (uint32_t i = 0; i < regions.size(); i++) {
- map->remove_region(regions[i]);
- regions[i]->set_map(nullptr);
+ for (NavRegion *region : map->get_regions()) {
+ map->remove_region(region);
+ region->set_map(nullptr);
}
// Removes any assigned links
- LocalVector<NavLink *> links = map->get_links();
- for (uint32_t i = 0; i < links.size(); i++) {
- map->remove_link(links[i]);
- links[i]->set_map(nullptr);
+ for (NavLink *link : map->get_links()) {
+ map->remove_link(link);
+ link->set_map(nullptr);
}
// Remove any assigned agent
- LocalVector<RvoAgent *> agents = map->get_agents();
- for (uint32_t i = 0; i < agents.size(); i++) {
- map->remove_agent(agents[i]);
- agents[i]->set_map(nullptr);
+ for (RvoAgent *agent : map->get_agents()) {
+ map->remove_agent(agent);
+ agent->set_map(nullptr);
}
int map_index = active_maps.find(map);
@@ -806,9 +773,9 @@ void GodotNavigationServer::flush_queries() {
MutexLock lock(commands_mutex);
MutexLock lock2(operations_mutex);
- for (size_t i(0); i < commands.size(); i++) {
- commands[i]->exec(this);
- memdelete(commands[i]);
+ for (SetCommand *command : commands) {
+ command->exec(this);
+ memdelete(command);
}
commands.clear();
}
@@ -949,4 +916,3 @@ int GodotNavigationServer::get_process_info(ProcessInfo p_info) const {
#undef COMMAND_1
#undef COMMAND_2
-#undef COMMAND_4
diff --git a/modules/navigation/godot_navigation_server.h b/modules/navigation/godot_navigation_server.h
index a87a88d3bc..eea5713c40 100644
--- a/modules/navigation/godot_navigation_server.h
+++ b/modules/navigation/godot_navigation_server.h
@@ -54,10 +54,6 @@
virtual void F_NAME(T_0 D_0, T_1 D_1) override; \
void MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1)
-#define COMMAND_4_DEF(F_NAME, T_0, D_0, T_1, D_1, T_2, D_2, T_3, D_3, D_3_DEF) \
- virtual void F_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3 = D_3_DEF) override; \
- void MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3)
-
class GodotNavigationServer;
struct SetCommand {
@@ -158,10 +154,10 @@ public:
virtual bool link_is_bidirectional(RID p_link) const override;
COMMAND_2(link_set_navigation_layers, RID, p_link, uint32_t, p_navigation_layers);
virtual uint32_t link_get_navigation_layers(RID p_link) const override;
- COMMAND_2(link_set_start_location, RID, p_link, Vector3, p_location);
- virtual Vector3 link_get_start_location(RID p_link) const override;
- COMMAND_2(link_set_end_location, RID, p_link, Vector3, p_location);
- virtual Vector3 link_get_end_location(RID p_link) const override;
+ COMMAND_2(link_set_start_position, RID, p_link, Vector3, p_position);
+ virtual Vector3 link_get_start_position(RID p_link) const override;
+ COMMAND_2(link_set_end_position, RID, p_link, Vector3, p_position);
+ virtual Vector3 link_get_end_position(RID p_link) const override;
COMMAND_2(link_set_enter_cost, RID, p_link, real_t, p_enter_cost);
virtual real_t link_get_enter_cost(RID p_link) const override;
COMMAND_2(link_set_travel_cost, RID, p_link, real_t, p_travel_cost);
@@ -182,7 +178,7 @@ public:
COMMAND_2(agent_set_position, RID, p_agent, Vector3, p_position);
COMMAND_2(agent_set_ignore_y, RID, p_agent, bool, p_ignore);
virtual bool agent_is_map_changed(RID p_agent) const override;
- COMMAND_4_DEF(agent_set_callback, RID, p_agent, ObjectID, p_object_id, StringName, p_method, Variant, p_udata, Variant());
+ COMMAND_2(agent_set_callback, RID, p_agent, Callable, p_callback);
COMMAND_1(free, RID, p_object);
@@ -198,6 +194,5 @@ public:
#undef COMMAND_1
#undef COMMAND_2
-#undef COMMAND_4_DEF
#endif // GODOT_NAVIGATION_SERVER_H
diff --git a/modules/navigation/nav_link.cpp b/modules/navigation/nav_link.cpp
index 05d2b21487..ad87cc0b05 100644
--- a/modules/navigation/nav_link.cpp
+++ b/modules/navigation/nav_link.cpp
@@ -42,13 +42,13 @@ void NavLink::set_bidirectional(bool p_bidirectional) {
link_dirty = true;
}
-void NavLink::set_start_location(const Vector3 p_location) {
- start_location = p_location;
+void NavLink::set_start_position(const Vector3 p_position) {
+ start_position = p_position;
link_dirty = true;
}
-void NavLink::set_end_location(const Vector3 p_location) {
- end_location = p_location;
+void NavLink::set_end_position(const Vector3 p_position) {
+ end_position = p_position;
link_dirty = true;
}
diff --git a/modules/navigation/nav_link.h b/modules/navigation/nav_link.h
index 47c1211db8..0b8ad4db69 100644
--- a/modules/navigation/nav_link.h
+++ b/modules/navigation/nav_link.h
@@ -37,8 +37,8 @@
class NavLink : public NavBase {
NavMap *map = nullptr;
bool bidirectional = true;
- Vector3 start_location;
- Vector3 end_location;
+ Vector3 start_position;
+ Vector3 end_position;
bool link_dirty = true;
@@ -57,14 +57,14 @@ public:
return bidirectional;
}
- void set_start_location(Vector3 p_location);
- Vector3 get_start_location() const {
- return start_location;
+ void set_start_position(Vector3 p_position);
+ Vector3 get_start_position() const {
+ return start_position;
}
- void set_end_location(Vector3 p_location);
- Vector3 get_end_location() const {
- return end_location;
+ void set_end_position(Vector3 p_position);
+ Vector3 get_end_position() const {
+ return end_position;
}
bool check_dirty();
diff --git a/modules/navigation/nav_map.cpp b/modules/navigation/nav_map.cpp
index fd735f8793..d763b1d3bc 100644
--- a/modules/navigation/nav_map.cpp
+++ b/modules/navigation/nav_map.cpp
@@ -103,9 +103,7 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
float begin_d = 1e20;
float end_d = 1e20;
// Find the initial poly and the end poly on this map.
- for (size_t i(0); i < polygons.size(); i++) {
- const gd::Polygon &p = polygons[i];
-
+ for (const gd::Polygon &p : polygons) {
// Only consider the polygon if it in a region with compatible layers.
if ((p_navigation_layers & p.owner->get_navigation_layers()) == 0) {
continue;
@@ -190,9 +188,7 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
while (true) {
// Takes the current least_cost_poly neighbors (iterating over its edges) and compute the traveled_distance.
- for (size_t i = 0; i < navigation_polys[least_cost_id].poly->edges.size(); i++) {
- const gd::Edge &edge = navigation_polys[least_cost_id].poly->edges[i];
-
+ for (const gd::Edge &edge : navigation_polys[least_cost_id].poly->edges) {
// Iterate over connections in this edge, then compute the new optimized travel distance assigned to this polygon.
for (int connection_index = 0; connection_index < edge.connections.size(); connection_index++) {
const gd::Edge::Connection &connection = edge.connections[connection_index];
@@ -229,7 +225,7 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
avp.entry = new_entry;
}
} else {
- // Add the neighbour polygon to the reachable ones.
+ // Add the neighbor polygon to the reachable ones.
gd::NavigationPoly new_navigation_poly = gd::NavigationPoly(connection.polygon);
new_navigation_poly.self_id = navigation_polys.size();
new_navigation_poly.back_navigation_poly_id = least_cost_id;
@@ -240,7 +236,7 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
new_navigation_poly.entry = new_entry;
navigation_polys.push_back(new_navigation_poly);
- // Add the neighbour polygon to the polygons to visit.
+ // Add the neighbor polygon to the polygons to visit.
to_visit.push_back(navigation_polys.size() - 1);
}
}
@@ -465,9 +461,7 @@ Vector3 NavMap::get_closest_point_to_segment(const Vector3 &p_from, const Vector
Vector3 closest_point;
real_t closest_point_d = 1e20;
- for (size_t i(0); i < polygons.size(); i++) {
- const gd::Polygon &p = polygons[i];
-
+ for (const gd::Polygon &p : polygons) {
// For each face check the distance to the segment
for (size_t point_id = 2; point_id < p.points.size(); point_id += 1) {
const Face3 f(p.points[0].pos, p.points[point_id - 1].pos, p.points[point_id].pos);
@@ -623,20 +617,20 @@ void NavMap::sync() {
// Check if we need to update the links.
if (regenerate_polygons) {
- for (uint32_t r = 0; r < regions.size(); r++) {
- regions[r]->scratch_polygons();
+ for (NavRegion *region : regions) {
+ region->scratch_polygons();
}
regenerate_links = true;
}
- for (uint32_t r = 0; r < regions.size(); r++) {
- if (regions[r]->sync()) {
+ for (NavRegion *region : regions) {
+ if (region->sync()) {
regenerate_links = true;
}
}
- for (uint32_t l = 0; l < links.size(); l++) {
- if (links[l]->check_dirty()) {
+ for (NavLink *link : links) {
+ if (link->check_dirty()) {
regenerate_links = true;
}
}
@@ -649,34 +643,32 @@ void NavMap::sync() {
_new_pm_edge_free_count = 0;
// Remove regions connections.
- for (uint32_t r = 0; r < regions.size(); r++) {
- regions[r]->get_connections().clear();
+ for (NavRegion *region : regions) {
+ region->get_connections().clear();
}
// Resize the polygon count.
int count = 0;
- for (uint32_t r = 0; r < regions.size(); r++) {
- count += regions[r]->get_polygons().size();
+ for (const NavRegion *region : regions) {
+ count += region->get_polygons().size();
}
polygons.resize(count);
// Copy all region polygons in the map.
count = 0;
- for (uint32_t r = 0; r < regions.size(); r++) {
- const LocalVector<gd::Polygon> &polygons_source = regions[r]->get_polygons();
+ for (const NavRegion *region : regions) {
+ const LocalVector<gd::Polygon> &polygons_source = region->get_polygons();
for (uint32_t n = 0; n < polygons_source.size(); n++) {
polygons[count + n] = polygons_source[n];
}
- count += regions[r]->get_polygons().size();
+ count += region->get_polygons().size();
}
_new_pm_polygon_count = polygons.size();
// Group all edges per key.
HashMap<gd::EdgeKey, Vector<gd::Edge::Connection>, gd::EdgeKey> connections;
- for (uint32_t poly_id = 0; poly_id < polygons.size(); poly_id++) {
- gd::Polygon &poly(polygons[poly_id]);
-
+ for (gd::Polygon &poly : polygons) {
for (uint32_t p = 0; p < poly.points.size(); p++) {
int next_point = (p + 1) % poly.points.size();
gd::EdgeKey ek(poly.points[p].key, poly.points[next_point].key);
@@ -787,10 +779,9 @@ void NavMap::sync() {
link_polygons.resize(links.size());
// Search for polygons within range of a nav link.
- for (uint32_t l = 0; l < links.size(); l++) {
- const NavLink *link = links[l];
- const Vector3 start = link->get_start_location();
- const Vector3 end = link->get_end_location();
+ for (const NavLink *link : links) {
+ const Vector3 start = link->get_start_position();
+ const Vector3 end = link->get_end_position();
gd::Polygon *closest_start_polygon = nullptr;
real_t closest_start_distance = link_connection_radius;
@@ -820,9 +811,7 @@ void NavMap::sync() {
}
// Find any polygons within the search radius of the end point.
- for (uint32_t end_index = 0; end_index < polygons.size(); end_index++) {
- gd::Polygon &end_poly = polygons[end_index];
-
+ for (gd::Polygon &end_poly : polygons) {
// For each face check the distance to the end
for (uint32_t end_point_id = 2; end_point_id < end_poly.points.size(); end_point_id += 1) {
const Face3 end_face(end_poly.points[0].pos, end_poly.points[end_point_id - 1].pos, end_poly.points[end_point_id].pos);
@@ -906,8 +895,8 @@ void NavMap::sync() {
// cannot use LocalVector here as RVO library expects std::vector to build KdTree
std::vector<RVO::Agent *> raw_agents;
raw_agents.reserve(agents.size());
- for (size_t i(0); i < agents.size(); i++) {
- raw_agents.push_back(agents[i]->get_agent());
+ for (RvoAgent *agent : agents) {
+ raw_agents.push_back(agent->get_agent());
}
rvo.buildAgentTree(raw_agents);
}
@@ -941,8 +930,8 @@ void NavMap::step(real_t p_deltatime) {
}
void NavMap::dispatch_callbacks() {
- for (int i(0); i < static_cast<int>(controlled_agents.size()); i++) {
- controlled_agents[i]->dispatch_callback();
+ for (RvoAgent *agent : controlled_agents) {
+ agent->dispatch_callback();
}
}
diff --git a/modules/navigation/nav_utils.h b/modules/navigation/nav_utils.h
index 50437469aa..06a1a1f403 100644
--- a/modules/navigation/nav_utils.h
+++ b/modules/navigation/nav_utils.h
@@ -125,7 +125,7 @@ struct NavigationPoly {
Vector3 back_navigation_edge_pathway_start;
Vector3 back_navigation_edge_pathway_end;
- /// The entry location of this poly.
+ /// The entry position of this poly.
Vector3 entry;
/// The distance to the destination.
float traveled_distance = 0.0;
diff --git a/modules/navigation/navigation_mesh_generator.cpp b/modules/navigation/navigation_mesh_generator.cpp
index fff7a02fc4..74ff9312fd 100644
--- a/modules/navigation/navigation_mesh_generator.cpp
+++ b/modules/navigation/navigation_mesh_generator.cpp
@@ -266,9 +266,7 @@ void NavigationMeshGenerator::_parse_geometry(const Transform3D &p_navmesh_trans
if (err == OK) {
PackedVector3Array faces;
- for (uint32_t j = 0; j < md.faces.size(); ++j) {
- const Geometry3D::MeshData::Face &face = md.faces[j];
-
+ for (const Geometry3D::MeshData::Face &face : md.faces) {
for (uint32_t k = 2; k < face.indices.size(); ++k) {
faces.push_back(md.vertices[face.indices[0]]);
faces.push_back(md.vertices[face.indices[k - 1]]);
@@ -392,9 +390,7 @@ void NavigationMeshGenerator::_parse_geometry(const Transform3D &p_navmesh_trans
if (err == OK) {
PackedVector3Array faces;
- for (uint32_t j = 0; j < md.faces.size(); ++j) {
- const Geometry3D::MeshData::Face &face = md.faces[j];
-
+ for (const Geometry3D::MeshData::Face &face : md.faces) {
for (uint32_t k = 2; k < face.indices.size(); ++k) {
faces.push_back(md.vertices[face.indices[0]]);
faces.push_back(md.vertices[face.indices[k - 1]]);
diff --git a/modules/navigation/rvo_agent.cpp b/modules/navigation/rvo_agent.cpp
index 979ef0d917..40f1e925be 100644
--- a/modules/navigation/rvo_agent.cpp
+++ b/modules/navigation/rvo_agent.cpp
@@ -32,10 +32,6 @@
#include "nav_map.h"
-RvoAgent::RvoAgent() {
- callback.id = ObjectID();
-}
-
void RvoAgent::set_map(NavMap *p_map) {
map = p_map;
}
@@ -50,31 +46,25 @@ bool RvoAgent::is_map_changed() {
}
}
-void RvoAgent::set_callback(ObjectID p_id, const StringName p_method, const Variant p_udata) {
- callback.id = p_id;
- callback.method = p_method;
- callback.udata = p_udata;
+void RvoAgent::set_callback(Callable p_callback) {
+ callback = p_callback;
}
bool RvoAgent::has_callback() const {
- return callback.id.is_valid();
+ return callback.is_valid();
}
void RvoAgent::dispatch_callback() {
- if (callback.id.is_null()) {
+ if (!callback.is_valid()) {
return;
}
- Object *obj = ObjectDB::get_instance(callback.id);
- if (!obj) {
- callback.id = ObjectID();
- return;
- }
-
- Callable::CallError responseCallError;
- callback.new_velocity = Vector3(agent.newVelocity_.x(), agent.newVelocity_.y(), agent.newVelocity_.z());
+ Vector3 new_velocity = Vector3(agent.newVelocity_.x(), agent.newVelocity_.y(), agent.newVelocity_.z());
- const Variant *vp[2] = { &callback.new_velocity, &callback.udata };
- int argc = (callback.udata.get_type() == Variant::NIL) ? 1 : 2;
- obj->callp(callback.method, vp, argc, responseCallError);
+ // Invoke the callback with the new velocity.
+ Variant args[] = { new_velocity };
+ const Variant *args_p[] = { &args[0] };
+ Variant return_value;
+ Callable::CallError call_error;
+ callback.callp(args_p, 1, return_value, call_error);
}
diff --git a/modules/navigation/rvo_agent.h b/modules/navigation/rvo_agent.h
index 7b19907b2b..5f377b6079 100644
--- a/modules/navigation/rvo_agent.h
+++ b/modules/navigation/rvo_agent.h
@@ -39,21 +39,12 @@
class NavMap;
class RvoAgent : public NavRid {
- struct AvoidanceComputedCallback {
- ObjectID id;
- StringName method;
- Variant udata;
- Variant new_velocity;
- };
-
NavMap *map = nullptr;
RVO::Agent agent;
- AvoidanceComputedCallback callback;
+ Callable callback = Callable();
uint32_t map_update_id = 0;
public:
- RvoAgent();
-
void set_map(NavMap *p_map);
NavMap *get_map() {
return map;
@@ -65,7 +56,7 @@ public:
bool is_map_changed();
- void set_callback(ObjectID p_id, const StringName p_method, const Variant p_udata = Variant());
+ void set_callback(Callable p_callback);
bool has_callback() const;
void dispatch_callback();
diff --git a/modules/noise/doc_classes/Noise.xml b/modules/noise/doc_classes/Noise.xml
index 735ca388de..78d7d6a15b 100644
--- a/modules/noise/doc_classes/Noise.xml
+++ b/modules/noise/doc_classes/Noise.xml
@@ -17,8 +17,10 @@
<param index="1" name="height" type="int" />
<param index="2" name="invert" type="bool" default="false" />
<param index="3" name="in_3d_space" type="bool" default="false" />
+ <param index="4" name="normalize" type="bool" default="true" />
<description>
Returns a 2D [Image] noise image.
+ Note: With [param normalize] set to [code]false[/code] the default implementation expects the noise generator to return values in the range [code]-1.0[/code] to [code]1.0[/code].
</description>
</method>
<method name="get_noise_1d" qualifiers="const">
@@ -66,8 +68,10 @@
<param index="2" name="invert" type="bool" default="false" />
<param index="3" name="in_3d_space" type="bool" default="false" />
<param index="4" name="skirt" type="float" default="0.1" />
+ <param index="5" name="normalize" type="bool" default="true" />
<description>
Returns a seamless 2D [Image] noise image.
+ Note: With [param normalize] set to [code]false[/code] the default implementation expects the noise generator to return values in the range [code]-1.0[/code] to [code]1.0[/code].
</description>
</method>
</methods>
diff --git a/modules/noise/doc_classes/NoiseTexture2D.xml b/modules/noise/doc_classes/NoiseTexture2D.xml
index 0a800a143b..0f10a3f32f 100644
--- a/modules/noise/doc_classes/NoiseTexture2D.xml
+++ b/modules/noise/doc_classes/NoiseTexture2D.xml
@@ -44,6 +44,10 @@
<member name="noise" type="Noise" setter="set_noise" getter="get_noise">
The instance of the [Noise] object.
</member>
+ <member name="normalize" type="bool" setter="set_normalize" getter="is_normalized" default="true">
+ If [code]true[/code], the noise image coming from the noise generator is normalized to the range [code]0.0[/code] to [code]1.0[/code].
+ Turning normalization off can affect the contrast and allows you to generate non repeating tileable noise textures.
+ </member>
<member name="resource_local_to_scene" type="bool" setter="set_local_to_scene" getter="is_local_to_scene" overrides="Resource" default="false" />
<member name="seamless" type="bool" setter="set_seamless" getter="get_seamless" default="false">
If [code]true[/code], a seamless texture is requested from the [Noise] resource.
diff --git a/modules/noise/noise.cpp b/modules/noise/noise.cpp
index 5a901cb6e1..e95788b863 100644
--- a/modules/noise/noise.cpp
+++ b/modules/noise/noise.cpp
@@ -32,7 +32,7 @@
#include <float.h>
-Ref<Image> Noise::get_seamless_image(int p_width, int p_height, bool p_invert, bool p_in_3d_space, real_t p_blend_skirt) const {
+Ref<Image> Noise::get_seamless_image(int p_width, int p_height, bool p_invert, bool p_in_3d_space, real_t p_blend_skirt, bool p_normalize) const {
ERR_FAIL_COND_V(p_width <= 0 || p_height <= 0, Ref<Image>());
int skirt_width = MAX(1, p_width * p_blend_skirt);
@@ -40,7 +40,7 @@ Ref<Image> Noise::get_seamless_image(int p_width, int p_height, bool p_invert, b
int src_width = p_width + skirt_width;
int src_height = p_height + skirt_height;
- Ref<Image> src = get_image(src_width, src_height, p_invert, p_in_3d_space);
+ Ref<Image> src = get_image(src_width, src_height, p_invert, p_in_3d_space, p_normalize);
bool grayscale = (src->get_format() == Image::FORMAT_L8);
if (grayscale) {
return _generate_seamless_image<uint8_t>(src, p_width, p_height, p_invert, p_blend_skirt);
@@ -58,7 +58,7 @@ uint8_t Noise::_alpha_blend<uint8_t>(uint8_t p_bg, uint8_t p_fg, int p_alpha) co
return (uint8_t)((alpha * p_fg + inv_alpha * p_bg) >> 8);
}
-Ref<Image> Noise::get_image(int p_width, int p_height, bool p_invert, bool p_in_3d_space) const {
+Ref<Image> Noise::get_image(int p_width, int p_height, bool p_invert, bool p_in_3d_space, bool p_normalize) const {
ERR_FAIL_COND_V(p_width <= 0 || p_height <= 0, Ref<Image>());
Vector<uint8_t> data;
@@ -66,38 +66,49 @@ Ref<Image> Noise::get_image(int p_width, int p_height, bool p_invert, bool p_in_
uint8_t *wd8 = data.ptrw();
- // Get all values and identify min/max values.
- Vector<real_t> values;
- values.resize(p_width * p_height);
- real_t min_val = FLT_MAX;
- real_t max_val = -FLT_MAX;
-
- for (int y = 0, i = 0; y < p_height; y++) {
- for (int x = 0; x < p_width; x++, i++) {
- values.set(i, p_in_3d_space ? get_noise_3d(x, y, 0.0) : get_noise_2d(x, y));
- if (values[i] > max_val) {
- max_val = values[i];
- }
- if (values[i] < min_val) {
- min_val = values[i];
+ if (p_normalize) {
+ // Get all values and identify min/max values.
+ Vector<real_t> values;
+ values.resize(p_width * p_height);
+ real_t min_val = FLT_MAX;
+ real_t max_val = -FLT_MAX;
+ for (int y = 0, i = 0; y < p_height; y++) {
+ for (int x = 0; x < p_width; x++, i++) {
+ values.set(i, p_in_3d_space ? get_noise_3d(x, y, 0.0) : get_noise_2d(x, y));
+ if (values[i] > max_val) {
+ max_val = values[i];
+ }
+ if (values[i] < min_val) {
+ min_val = values[i];
+ }
}
}
- }
-
- // Normalize values and write to texture.
- uint8_t value;
- for (int i = 0, x = 0; i < p_height; i++) {
- for (int j = 0; j < p_width; j++, x++) {
- if (max_val == min_val) {
- value = 0;
- } else {
- value = uint8_t(CLAMP((values[x] - min_val) / (max_val - min_val) * 255.f, 0, 255));
+ // Normalize values and write to texture.
+ uint8_t ivalue;
+ for (int i = 0, x = 0; i < p_height; i++) {
+ for (int j = 0; j < p_width; j++, x++) {
+ if (max_val == min_val) {
+ ivalue = 0;
+ } else {
+ ivalue = static_cast<uint8_t>(CLAMP((values[x] - min_val) / (max_val - min_val) * 255.f, 0, 255));
+ }
+
+ if (p_invert) {
+ ivalue = 255 - ivalue;
+ }
+
+ wd8[x] = ivalue;
}
- if (p_invert) {
- value = 255 - value;
+ }
+ } else {
+ // Without normalization, the expected range of the noise function is [-1, 1].
+ uint8_t ivalue;
+ for (int y = 0, i = 0; y < p_height; y++) {
+ for (int x = 0; x < p_width; x++, i++) {
+ float value = (p_in_3d_space ? get_noise_3d(x, y, 0.0) : get_noise_2d(x, y));
+ ivalue = static_cast<uint8_t>(CLAMP(value * 127.5f + 127.5f, 0.0f, 255.0f));
+ wd8[i] = p_invert ? (255 - ivalue) : ivalue;
}
-
- wd8[x] = value;
}
}
@@ -113,6 +124,6 @@ void Noise::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_noise_3dv", "v"), &Noise::get_noise_3dv);
// Textures.
- ClassDB::bind_method(D_METHOD("get_image", "width", "height", "invert", "in_3d_space"), &Noise::get_image, DEFVAL(false), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("get_seamless_image", "width", "height", "invert", "in_3d_space", "skirt"), &Noise::get_seamless_image, DEFVAL(false), DEFVAL(false), DEFVAL(0.1));
+ ClassDB::bind_method(D_METHOD("get_image", "width", "height", "invert", "in_3d_space", "normalize"), &Noise::get_image, DEFVAL(false), DEFVAL(false), DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("get_seamless_image", "width", "height", "invert", "in_3d_space", "skirt", "normalize"), &Noise::get_seamless_image, DEFVAL(false), DEFVAL(false), DEFVAL(0.1), DEFVAL(true));
}
diff --git a/modules/noise/noise.h b/modules/noise/noise.h
index 8f8ecf29a5..f7e615c2aa 100644
--- a/modules/noise/noise.h
+++ b/modules/noise/noise.h
@@ -233,8 +233,8 @@ public:
virtual real_t get_noise_3dv(Vector3 p_v) const = 0;
virtual real_t get_noise_3d(real_t p_x, real_t p_y, real_t p_z) const = 0;
- virtual Ref<Image> get_image(int p_width, int p_height, bool p_invert = false, bool p_in_3d_space = false) const;
- virtual Ref<Image> get_seamless_image(int p_width, int p_height, bool p_invert = false, bool p_in_3d_space = false, real_t p_blend_skirt = 0.1) const;
+ virtual Ref<Image> get_image(int p_width, int p_height, bool p_invert = false, bool p_in_3d_space = false, bool p_normalize = true) const;
+ virtual Ref<Image> get_seamless_image(int p_width, int p_height, bool p_invert = false, bool p_in_3d_space = false, real_t p_blend_skirt = 0.1, bool p_normalize = true) const;
};
#endif // NOISE_H
diff --git a/modules/noise/noise_texture_2d.cpp b/modules/noise/noise_texture_2d.cpp
index 0eedb286bd..0d5e778875 100644
--- a/modules/noise/noise_texture_2d.cpp
+++ b/modules/noise/noise_texture_2d.cpp
@@ -76,6 +76,9 @@ void NoiseTexture2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_bump_strength", "bump_strength"), &NoiseTexture2D::set_bump_strength);
ClassDB::bind_method(D_METHOD("get_bump_strength"), &NoiseTexture2D::get_bump_strength);
+ ClassDB::bind_method(D_METHOD("set_normalize", "normalize"), &NoiseTexture2D::set_normalize);
+ ClassDB::bind_method(D_METHOD("is_normalized"), &NoiseTexture2D::is_normalized);
+
ClassDB::bind_method(D_METHOD("set_color_ramp", "gradient"), &NoiseTexture2D::set_color_ramp);
ClassDB::bind_method(D_METHOD("get_color_ramp"), &NoiseTexture2D::get_color_ramp);
@@ -91,6 +94,7 @@ void NoiseTexture2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "seamless_blend_skirt", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_seamless_blend_skirt", "get_seamless_blend_skirt");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "as_normal_map"), "set_as_normal_map", "is_normal_map");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "bump_strength", PROPERTY_HINT_RANGE, "0,32,0.1,or_greater"), "set_bump_strength", "get_bump_strength");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "normalize"), "set_normalize", "is_normalized");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "color_ramp", PROPERTY_HINT_RESOURCE_TYPE, "Gradient"), "set_color_ramp", "get_color_ramp");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "noise", PROPERTY_HINT_RESOURCE_TYPE, "Noise"), "set_noise", "get_noise");
}
@@ -156,9 +160,9 @@ Ref<Image> NoiseTexture2D::_generate_texture() {
Ref<Image> new_image;
if (seamless) {
- new_image = ref_noise->get_seamless_image(size.x, size.y, invert, in_3d_space, seamless_blend_skirt);
+ new_image = ref_noise->get_seamless_image(size.x, size.y, invert, in_3d_space, seamless_blend_skirt, normalize);
} else {
- new_image = ref_noise->get_image(size.x, size.y, invert, in_3d_space);
+ new_image = ref_noise->get_image(size.x, size.y, invert, in_3d_space, normalize);
}
if (color_ramp.is_valid()) {
new_image = _modulate_with_gradient(new_image, color_ramp);
@@ -349,6 +353,18 @@ void NoiseTexture2D::set_color_ramp(const Ref<Gradient> &p_gradient) {
_queue_update();
}
+void NoiseTexture2D::set_normalize(bool p_normalize) {
+ if (normalize == p_normalize) {
+ return;
+ }
+ normalize = p_normalize;
+ _queue_update();
+}
+
+bool NoiseTexture2D::is_normalized() const {
+ return normalize;
+}
+
Ref<Gradient> NoiseTexture2D::get_color_ramp() const {
return color_ramp;
}
diff --git a/modules/noise/noise_texture_2d.h b/modules/noise/noise_texture_2d.h
index cda14df6c2..f53670b690 100644
--- a/modules/noise/noise_texture_2d.h
+++ b/modules/noise/noise_texture_2d.h
@@ -59,6 +59,7 @@ private:
real_t seamless_blend_skirt = 0.1;
bool as_normal_map = false;
float bump_strength = 8.0;
+ bool normalize = true;
Ref<Gradient> color_ramp;
Ref<Noise> noise;
@@ -105,6 +106,9 @@ public:
void set_bump_strength(float p_bump_strength);
float get_bump_strength();
+ void set_normalize(bool p_normalize);
+ bool is_normalized() const;
+
void set_color_ramp(const Ref<Gradient> &p_gradient);
Ref<Gradient> get_color_ramp() const;
diff --git a/modules/ogg/ogg_packet_sequence.cpp b/modules/ogg/ogg_packet_sequence.cpp
index 0acaaf5fc9..d473f3b4a0 100644
--- a/modules/ogg/ogg_packet_sequence.cpp
+++ b/modules/ogg/ogg_packet_sequence.cpp
@@ -136,6 +136,8 @@ bool OggPacketSequencePlayback::next_ogg_packet(ogg_packet **p_packet) const {
ERR_FAIL_COND_V(data_version != ogg_packet_sequence->data_version, false);
ERR_FAIL_COND_V(ogg_packet_sequence->page_data.is_empty(), false);
ERR_FAIL_COND_V(ogg_packet_sequence->page_granule_positions.is_empty(), false);
+ ERR_FAIL_COND_V(page_cursor >= ogg_packet_sequence->page_data.size(), false);
+
// Move on to the next page if need be. This happens first to help simplify seek logic.
while (packet_cursor >= ogg_packet_sequence->page_data[page_cursor].size()) {
packet_cursor = 0;
diff --git a/modules/openxr/doc_classes/OpenXRAction.xml b/modules/openxr/doc_classes/OpenXRAction.xml
index a3a45ebb4c..d53648723a 100644
--- a/modules/openxr/doc_classes/OpenXRAction.xml
+++ b/modules/openxr/doc_classes/OpenXRAction.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
This resource defines an OpenXR action. Actions can be used both for inputs (buttons/joystick/trigger/etc) and outputs (haptics).
- OpenXR performs automatic conversion between action type and input type whenever possible. An analogue trigger bound to a boolean action will thus return [code]false[/code] if the trigger is depressed and [code]true[/code] if pressed fully.
+ OpenXR performs automatic conversion between action type and input type whenever possible. An analog trigger bound to a boolean action will thus return [code]false[/code] if the trigger is depressed and [code]true[/code] if pressed fully.
Actions are not directly bound to specific devices, instead OpenXR recognizes a limited number of top level paths that identify devices by usage. We can restrict which devices an action can be bound to by these top level paths. For instance an action that should only be used for hand held controllers can have the top level paths "/user/hand/left" and "/user/hand/right" associated with them. See the [url=https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#semantic-path-reserved]reserved path section in the OpenXR specification[/url] for more info on the top level paths.
Note that the name of the resource is used to register the action with.
</description>
@@ -27,7 +27,7 @@
This action provides a boolean value.
</constant>
<constant name="OPENXR_ACTION_FLOAT" value="1" enum="ActionType">
- This action provides a float value between [code]0.0[/code] and [code]1.0[/code] for any analogue input such as triggers.
+ This action provides a float value between [code]0.0[/code] and [code]1.0[/code] for any analog input such as triggers.
</constant>
<constant name="OPENXR_ACTION_VECTOR2" value="2" enum="ActionType">
This action provides a vector2 value and can be bound to embedded trackpads and joysticks
diff --git a/modules/openxr/doc_classes/OpenXRInterface.xml b/modules/openxr/doc_classes/OpenXRInterface.xml
index 7251a4a9bd..f3cc469c9d 100644
--- a/modules/openxr/doc_classes/OpenXRInterface.xml
+++ b/modules/openxr/doc_classes/OpenXRInterface.xml
@@ -11,12 +11,33 @@
<link title="Setting up XR">$DOCS_URL/tutorials/xr/setting_up_xr.html</link>
</tutorials>
<methods>
+ <method name="get_action_sets" qualifiers="const">
+ <return type="Array" />
+ <description>
+ Returns a list of action sets registered with Godot (loaded from the action map at runtime).
+ </description>
+ </method>
<method name="get_available_display_refresh_rates" qualifiers="const">
<return type="Array" />
<description>
Returns display refresh rates supported by the current HMD. Only returned if this feature is supported by the OpenXR runtime and after the interface has been initialized.
</description>
</method>
+ <method name="is_action_set_active" qualifiers="const">
+ <return type="bool" />
+ <param index="0" name="name" type="String" />
+ <description>
+ Returns [code]true[/code] if the given action set is active.
+ </description>
+ </method>
+ <method name="set_action_set_active">
+ <return type="void" />
+ <param index="0" name="name" type="String" />
+ <param index="1" name="active" type="bool" />
+ <description>
+ Sets the given action set as active or inactive.
+ </description>
+ </method>
</methods>
<members>
<member name="display_refresh_rate" type="float" setter="set_display_refresh_rate" getter="get_display_refresh_rate" default="0.0">
diff --git a/modules/openxr/extensions/openxr_opengl_extension.cpp b/modules/openxr/extensions/openxr_opengl_extension.cpp
index 6ce8f0805f..0d201161f1 100644
--- a/modules/openxr/extensions/openxr_opengl_extension.cpp
+++ b/modules/openxr/extensions/openxr_opengl_extension.cpp
@@ -158,12 +158,14 @@ void *OpenXROpenGLExtension::set_session_create_and_get_next_pointer(void *p_nex
void OpenXROpenGLExtension::get_usable_swapchain_formats(Vector<int64_t> &p_usable_swap_chains) {
p_usable_swap_chains.push_back(GL_RGBA8);
+ p_usable_swap_chains.push_back(GL_SRGB8_ALPHA8);
}
void OpenXROpenGLExtension::get_usable_depth_formats(Vector<int64_t> &p_usable_depth_formats) {
p_usable_depth_formats.push_back(GL_DEPTH_COMPONENT32F);
p_usable_depth_formats.push_back(GL_DEPTH24_STENCIL8);
p_usable_depth_formats.push_back(GL_DEPTH32F_STENCIL8);
+ p_usable_depth_formats.push_back(GL_DEPTH_COMPONENT24);
}
bool OpenXROpenGLExtension::get_swapchain_image_data(XrSwapchain p_swapchain, int64_t p_swapchain_format, uint32_t p_width, uint32_t p_height, uint32_t p_sample_count, uint32_t p_array_size, void **r_swapchain_graphics_data) {
diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp
index 6b8f140923..0a25cd68b7 100644
--- a/modules/openxr/openxr_api.cpp
+++ b/modules/openxr/openxr_api.cpp
@@ -751,7 +751,7 @@ bool OpenXRAPI::create_swapchains() {
Also Godot only creates a swapchain for the main output.
OpenXR will require us to create swapchains as the render target for additional viewports if we want to use the layer system
- to optimise text rendering and background rendering as OpenXR may choose to re-use the results for reprojection while we're
+ to optimize text rendering and background rendering as OpenXR may choose to re-use the results for reprojection while we're
already rendering the next frame.
Finally an area we need to expand upon is that Foveated rendering is only enabled for the swap chain we create,
diff --git a/modules/openxr/openxr_api.h b/modules/openxr/openxr_api.h
index 52a1af5a09..e1787c6da0 100644
--- a/modules/openxr/openxr_api.h
+++ b/modules/openxr/openxr_api.h
@@ -53,7 +53,7 @@
#include "util.h"
-// Note, OpenXR code that we wrote for our plugin makes use of C++20 notation for initialising structs which ensures zeroing out unspecified members.
+// Note, OpenXR code that we wrote for our plugin makes use of C++20 notation for initializing structs which ensures zeroing out unspecified members.
// Godot is currently restricted to C++17 which doesn't allow this notation. Make sure critical fields are set.
// forward declarations, we don't want to include these fully
diff --git a/modules/openxr/openxr_interface.cpp b/modules/openxr/openxr_interface.cpp
index f9afdf2d4a..702e56b410 100644
--- a/modules/openxr/openxr_interface.cpp
+++ b/modules/openxr/openxr_interface.cpp
@@ -47,6 +47,10 @@ void OpenXRInterface::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_display_refresh_rate", "refresh_rate"), &OpenXRInterface::set_display_refresh_rate);
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "display_refresh_rate"), "set_display_refresh_rate", "get_display_refresh_rate");
+ ClassDB::bind_method(D_METHOD("is_action_set_active", "name"), &OpenXRInterface::is_action_set_active);
+ ClassDB::bind_method(D_METHOD("set_action_set_active", "name", "active"), &OpenXRInterface::set_action_set_active);
+ ClassDB::bind_method(D_METHOD("get_action_sets"), &OpenXRInterface::get_action_sets);
+
ClassDB::bind_method(D_METHOD("get_available_display_refresh_rates"), &OpenXRInterface::get_available_display_refresh_rates);
}
@@ -621,6 +625,38 @@ Array OpenXRInterface::get_available_display_refresh_rates() const {
}
}
+bool OpenXRInterface::is_action_set_active(const String &p_action_set) const {
+ for (ActionSet *action_set : action_sets) {
+ if (action_set->action_set_name == p_action_set) {
+ return action_set->is_active;
+ }
+ }
+
+ WARN_PRINT("OpenXR: Unknown action set " + p_action_set);
+ return false;
+}
+
+void OpenXRInterface::set_action_set_active(const String &p_action_set, bool p_active) {
+ for (ActionSet *action_set : action_sets) {
+ if (action_set->action_set_name == p_action_set) {
+ action_set->is_active = p_active;
+ return;
+ }
+ }
+
+ WARN_PRINT("OpenXR: Unknown action set " + p_action_set);
+}
+
+Array OpenXRInterface::get_action_sets() const {
+ Array arr;
+
+ for (ActionSet *action_set : action_sets) {
+ arr.push_back(action_set->action_set_name);
+ }
+
+ return arr;
+}
+
Size2 OpenXRInterface::get_render_target_size() {
if (openxr_api == nullptr) {
return Size2();
diff --git a/modules/openxr/openxr_interface.h b/modules/openxr/openxr_interface.h
index 2b43369523..cce329d8e6 100644
--- a/modules/openxr/openxr_interface.h
+++ b/modules/openxr/openxr_interface.h
@@ -123,6 +123,10 @@ public:
void set_display_refresh_rate(float p_refresh_rate);
Array get_available_display_refresh_rates() const;
+ bool is_action_set_active(const String &p_action_set) const;
+ void set_action_set_active(const String &p_action_set, bool p_active);
+ Array get_action_sets() const;
+
virtual Size2 get_render_target_size() override;
virtual uint32_t get_view_count() override;
virtual Transform3D get_camera_transform() override;
diff --git a/modules/openxr/register_types.cpp b/modules/openxr/register_types.cpp
index 1c4d53c43a..306a2f1bbd 100644
--- a/modules/openxr/register_types.cpp
+++ b/modules/openxr/register_types.cpp
@@ -70,7 +70,7 @@ static void _editor_init() {
// Only add our OpenXR action map editor if OpenXR is enabled for our project
if (openxr_interaction_profile_meta_data == nullptr) {
- // If we didn't initialize our actionmap meta data at startup, we initialise it now.
+ // If we didn't initialize our actionmap meta data at startup, we initialize it now.
openxr_interaction_profile_meta_data = memnew(OpenXRInteractionProfileMetaData);
ERR_FAIL_NULL(openxr_interaction_profile_meta_data);
}
@@ -85,7 +85,7 @@ static void _editor_init() {
void initialize_openxr_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
if (OpenXRAPI::openxr_is_enabled(false)) {
- // Always register our extension wrappers even if we don't initialise OpenXR.
+ // Always register our extension wrappers even if we don't initialize OpenXR.
// Some of these wrappers will add functionality to our editor.
#ifdef ANDROID_ENABLED
OpenXRAPI::register_extension_wrapper(memnew(OpenXRAndroidExtension));
diff --git a/modules/raycast/raycast_occlusion_cull.cpp b/modules/raycast/raycast_occlusion_cull.cpp
index c74799caa3..9394f71e40 100644
--- a/modules/raycast/raycast_occlusion_cull.cpp
+++ b/modules/raycast/raycast_occlusion_cull.cpp
@@ -426,8 +426,8 @@ bool RaycastOcclusionCull::Scenario::update() {
return false;
}
- for (unsigned int i = 0; i < removed_instances.size(); i++) {
- instances.erase(removed_instances[i]);
+ for (const RID &scenario : removed_instances) {
+ instances.erase(scenario);
}
if (dirty_instances_array.size() / WorkerThreadPool::get_singleton()->get_thread_count() > 128) {
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index 8e9ff61ad0..9b474bf2ce 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -443,19 +443,11 @@ bool TextServerAdvanced::_load_support_data(const String &p_filename) {
}
String TextServerAdvanced::_get_support_data_filename() const {
-#ifdef ICU_STATIC_DATA
return _MKSTR(ICU_DATA_NAME);
-#else
- return String();
-#endif
}
String TextServerAdvanced::_get_support_data_info() const {
-#ifdef ICU_STATIC_DATA
return String("ICU break iteration data (") + _MKSTR(ICU_DATA_NAME) + String(").");
-#else
- return String();
-#endif
}
bool TextServerAdvanced::_save_support_data(const String &p_filename) const {
@@ -3654,6 +3646,7 @@ void TextServerAdvanced::full_copy(ShapedTextDataAdvanced *p_shaped) {
RID TextServerAdvanced::_create_shaped_text(TextServer::Direction p_direction, TextServer::Orientation p_orientation) {
_THREAD_SAFE_METHOD_
+ ERR_FAIL_COND_V_MSG(p_direction == DIRECTION_INHERITED, RID(), "Invalid text direction.");
ShapedTextDataAdvanced *sd = memnew(ShapedTextDataAdvanced);
sd->hb_buffer = hb_buffer_create();
@@ -3679,6 +3672,7 @@ void TextServerAdvanced::_shaped_text_clear(const RID &p_shaped) {
void TextServerAdvanced::_shaped_text_set_direction(const RID &p_shaped, TextServer::Direction p_direction) {
ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped);
+ ERR_FAIL_COND_MSG(p_direction == DIRECTION_INHERITED, "Invalid text direction.");
ERR_FAIL_COND(!sd);
MutexLock lock(sd->mutex);
@@ -3738,8 +3732,12 @@ void TextServerAdvanced::_shaped_text_set_bidi_override(const RID &p_shaped, con
}
sd->bidi_override.clear();
for (int i = 0; i < p_override.size(); i++) {
- if (p_override[i].get_type() == Variant::VECTOR2I) {
- sd->bidi_override.push_back(p_override[i]);
+ if (p_override[i].get_type() == Variant::VECTOR3I) {
+ const Vector3i &r = p_override[i];
+ sd->bidi_override.push_back(r);
+ } else if (p_override[i].get_type() == Variant::VECTOR2I) {
+ const Vector2i &r = p_override[i];
+ sd->bidi_override.push_back(Vector3i(r.x, r.y, DIRECTION_INHERITED));
}
}
invalidate(sd, false);
@@ -4070,7 +4068,6 @@ void TextServerAdvanced::_realign(ShapedTextDataAdvanced *p_sd) const {
RID TextServerAdvanced::_shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const {
_THREAD_SAFE_METHOD_
-
const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped);
ERR_FAIL_COND_V(!sd, RID());
@@ -4130,8 +4127,9 @@ bool TextServerAdvanced::_shape_substr(ShapedTextDataAdvanced *p_new_sd, const S
if (p_sd->bidi_override[ov].x >= p_start + p_length || p_sd->bidi_override[ov].y <= p_start) {
continue;
}
- int start = _convert_pos_inv(p_sd, MAX(0, p_start - p_sd->bidi_override[ov].x));
- int end = _convert_pos_inv(p_sd, MIN(p_start + p_length, p_sd->bidi_override[ov].y) - p_sd->bidi_override[ov].x);
+ int ov_start = _convert_pos_inv(p_sd, p_sd->bidi_override[ov].x);
+ int start = MAX(0, _convert_pos_inv(p_sd, p_start) - ov_start);
+ int end = MIN(_convert_pos_inv(p_sd, p_start + p_length), _convert_pos_inv(p_sd, p_sd->bidi_override[ov].y)) - ov_start;
ERR_FAIL_COND_V_MSG((start < 0 || end - start > p_new_sd->utf16.length()), false, "Invalid BiDi override range.");
@@ -4153,8 +4151,8 @@ bool TextServerAdvanced::_shape_substr(ShapedTextDataAdvanced *p_new_sd, const S
int32_t _bidi_run_length = 0;
ubidi_getVisualRun(bidi_iter, i, &_bidi_run_start, &_bidi_run_length);
- int32_t bidi_run_start = _convert_pos(p_sd, p_sd->bidi_override[ov].x + start + _bidi_run_start);
- int32_t bidi_run_end = _convert_pos(p_sd, p_sd->bidi_override[ov].x + start + _bidi_run_start + _bidi_run_length);
+ int32_t bidi_run_start = _convert_pos(p_sd, ov_start + start + _bidi_run_start);
+ int32_t bidi_run_end = _convert_pos(p_sd, ov_start + start + _bidi_run_start + _bidi_run_length);
for (int j = 0; j < sd_size; j++) {
if ((sd_glyphs[j].start >= bidi_run_start) && (sd_glyphs[j].end <= bidi_run_end)) {
@@ -5514,6 +5512,7 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_star
}
bool TextServerAdvanced::_shaped_text_shape(const RID &p_shaped) {
+ _THREAD_SAFE_METHOD_
ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped);
ERR_FAIL_COND_V(!sd, false);
@@ -5544,8 +5543,31 @@ bool TextServerAdvanced::_shaped_text_shape(const RID &p_shaped) {
sd->script_iter = memnew(ScriptIterator(sd->text, 0, sd->text.length()));
}
+ int base_para_direction = UBIDI_DEFAULT_LTR;
+ switch (sd->direction) {
+ case DIRECTION_LTR: {
+ sd->para_direction = DIRECTION_LTR;
+ base_para_direction = UBIDI_LTR;
+ } break;
+ case DIRECTION_RTL: {
+ sd->para_direction = DIRECTION_RTL;
+ base_para_direction = UBIDI_RTL;
+ } break;
+ case DIRECTION_INHERITED:
+ case DIRECTION_AUTO: {
+ UBiDiDirection direction = ubidi_getBaseDirection(data, sd->utf16.length());
+ if (direction != UBIDI_NEUTRAL) {
+ sd->para_direction = (direction == UBIDI_RTL) ? DIRECTION_RTL : DIRECTION_LTR;
+ base_para_direction = direction;
+ } else {
+ sd->para_direction = DIRECTION_LTR;
+ base_para_direction = UBIDI_DEFAULT_LTR;
+ }
+ } break;
+ }
+
if (sd->bidi_override.is_empty()) {
- sd->bidi_override.push_back(Vector2i(sd->start, sd->end));
+ sd->bidi_override.push_back(Vector3i(sd->start, sd->end, DIRECTION_INHERITED));
}
for (int ov = 0; ov < sd->bidi_override.size(); ov++) {
@@ -5558,26 +5580,25 @@ bool TextServerAdvanced::_shaped_text_shape(const RID &p_shaped) {
}
UErrorCode err = U_ZERO_ERROR;
- UBiDi *bidi_iter = ubidi_openSized(end, 0, &err);
+ UBiDi *bidi_iter = ubidi_openSized(end - start, 0, &err);
ERR_FAIL_COND_V_MSG(U_FAILURE(err), false, u_errorName(err));
- switch (sd->direction) {
+ switch (static_cast<TextServer::Direction>(sd->bidi_override[ov].z)) {
case DIRECTION_LTR: {
ubidi_setPara(bidi_iter, data + start, end - start, UBIDI_LTR, nullptr, &err);
- sd->para_direction = DIRECTION_LTR;
} break;
case DIRECTION_RTL: {
ubidi_setPara(bidi_iter, data + start, end - start, UBIDI_RTL, nullptr, &err);
- sd->para_direction = DIRECTION_RTL;
+ } break;
+ case DIRECTION_INHERITED: {
+ ubidi_setPara(bidi_iter, data + start, end - start, base_para_direction, nullptr, &err);
} break;
case DIRECTION_AUTO: {
UBiDiDirection direction = ubidi_getBaseDirection(data + start, end - start);
if (direction != UBIDI_NEUTRAL) {
ubidi_setPara(bidi_iter, data + start, end - start, direction, nullptr, &err);
- sd->para_direction = (direction == UBIDI_RTL) ? DIRECTION_RTL : DIRECTION_LTR;
} else {
- ubidi_setPara(bidi_iter, data + start, end - start, UBIDI_DEFAULT_LTR, nullptr, &err);
- sd->para_direction = DIRECTION_LTR;
+ ubidi_setPara(bidi_iter, data + start, end - start, base_para_direction, nullptr, &err);
}
} break;
}
@@ -5609,8 +5630,8 @@ bool TextServerAdvanced::_shaped_text_shape(const RID &p_shaped) {
}
}
- int32_t bidi_run_start = _convert_pos(sd, sd->bidi_override[ov].x - sd->start + _bidi_run_start);
- int32_t bidi_run_end = _convert_pos(sd, sd->bidi_override[ov].x - sd->start + _bidi_run_start + _bidi_run_length);
+ int32_t bidi_run_start = _convert_pos(sd, start + _bidi_run_start);
+ int32_t bidi_run_end = _convert_pos(sd, start + _bidi_run_start + _bidi_run_length);
// Shape runs.
@@ -6085,6 +6106,11 @@ String TextServerAdvanced::_percent_sign(const String &p_language) const {
}
int64_t TextServerAdvanced::_is_confusable(const String &p_string, const PackedStringArray &p_dict) const {
+#ifndef ICU_STATIC_DATA
+ if (!icu_data_loaded) {
+ return -1;
+ }
+#endif
UErrorCode status = U_ZERO_ERROR;
int64_t match_index = -1;
@@ -6125,6 +6151,11 @@ int64_t TextServerAdvanced::_is_confusable(const String &p_string, const PackedS
}
bool TextServerAdvanced::_spoof_check(const String &p_string) const {
+#ifndef ICU_STATIC_DATA
+ if (!icu_data_loaded) {
+ return false;
+ }
+#endif
UErrorCode status = U_ZERO_ERROR;
Char16String utf16 = p_string.utf16();
@@ -6147,6 +6178,11 @@ bool TextServerAdvanced::_spoof_check(const String &p_string) const {
}
String TextServerAdvanced::_strip_diacritics(const String &p_string) const {
+#ifndef ICU_STATIC_DATA
+ if (!icu_data_loaded) {
+ return TextServer::strip_diacritics(p_string);
+ }
+#endif
UErrorCode err = U_ZERO_ERROR;
// Get NFKD normalizer singleton.
@@ -6184,6 +6220,12 @@ String TextServerAdvanced::_strip_diacritics(const String &p_string) const {
}
String TextServerAdvanced::_string_to_upper(const String &p_string, const String &p_language) const {
+#ifndef ICU_STATIC_DATA
+ if (!icu_data_loaded) {
+ return p_string.to_upper();
+ }
+#endif
+
if (p_string.is_empty()) {
return p_string;
}
@@ -6206,6 +6248,12 @@ String TextServerAdvanced::_string_to_upper(const String &p_string, const String
}
String TextServerAdvanced::_string_to_lower(const String &p_string, const String &p_language) const {
+#ifndef ICU_STATIC_DATA
+ if (!icu_data_loaded) {
+ return p_string.to_lower();
+ }
+#endif
+
if (p_string.is_empty()) {
return p_string;
}
@@ -6241,8 +6289,8 @@ PackedInt32Array TextServerAdvanced::_string_get_word_breaks(const String &p_str
breaks.insert(pos);
}
}
+ ubrk_close(bi);
}
- ubrk_close(bi);
PackedInt32Array ret;
@@ -6323,6 +6371,13 @@ PackedInt32Array TextServerAdvanced::_string_get_word_breaks(const String &p_str
}
bool TextServerAdvanced::_is_valid_identifier(const String &p_string) const {
+#ifndef ICU_STATIC_DATA
+ if (!icu_data_loaded) {
+ WARN_PRINT_ONCE("ICU data is not loaded, Unicode security and spoofing detection disabled.");
+ return TextServer::is_valid_identifier(p_string);
+ }
+#endif
+
enum UAX31SequenceStatus {
SEQ_NOT_STARTED,
SEQ_STARTED,
@@ -6514,6 +6569,7 @@ TextServerAdvanced::TextServerAdvanced() {
}
void TextServerAdvanced::_cleanup() {
+ _THREAD_SAFE_METHOD_
for (const KeyValue<SystemFontKey, SystemFontCache> &E : system_fonts) {
const Vector<SystemFontCacheRec> &sysf_cache = E.value.var;
for (const SystemFontCacheRec &F : sysf_cache) {
diff --git a/modules/text_server_adv/text_server_adv.h b/modules/text_server_adv/text_server_adv.h
index 5920ddaa50..c7fe46d554 100644
--- a/modules/text_server_adv/text_server_adv.h
+++ b/modules/text_server_adv/text_server_adv.h
@@ -499,7 +499,7 @@ class TextServerAdvanced : public TextServerExtension {
/* Intermediate data */
Char16String utf16;
Vector<UBiDi *> bidi_iter;
- Vector<Vector2i> bidi_override;
+ Vector<Vector3i> bidi_override;
ScriptIterator *script_iter = nullptr;
hb_buffer_t *hb_buffer = nullptr;
diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp
index ece34f56d6..b5d7d3a3cf 100644
--- a/modules/text_server_fb/text_server_fb.cpp
+++ b/modules/text_server_fb/text_server_fb.cpp
@@ -51,7 +51,6 @@ using namespace godot;
#include "core/error/error_macros.h"
#include "core/string/print_string.h"
#include "core/string/translation.h"
-#include "core/string/ucaps.h"
#include "modules/modules_enabled.gen.h" // For freetype, msdfgen, svg.
@@ -2665,6 +2664,7 @@ void TextServerFallback::full_copy(ShapedTextDataFallback *p_shaped) {
RID TextServerFallback::_create_shaped_text(TextServer::Direction p_direction, TextServer::Orientation p_orientation) {
_THREAD_SAFE_METHOD_
+ ERR_FAIL_COND_V_MSG(p_direction == DIRECTION_INHERITED, RID(), "Invalid text direction.");
ShapedTextDataFallback *sd = memnew(ShapedTextDataFallback);
sd->direction = p_direction;
@@ -2688,6 +2688,7 @@ void TextServerFallback::_shaped_text_clear(const RID &p_shaped) {
}
void TextServerFallback::_shaped_text_set_direction(const RID &p_shaped, TextServer::Direction p_direction) {
+ ERR_FAIL_COND_MSG(p_direction == DIRECTION_INHERITED, "Invalid text direction.");
if (p_direction == DIRECTION_RTL) {
ERR_PRINT_ONCE("Right-to-left layout is not supported by this text server.");
}
@@ -4060,31 +4061,11 @@ double TextServerFallback::_shaped_text_get_underline_thickness(const RID &p_sha
}
String TextServerFallback::_string_to_upper(const String &p_string, const String &p_language) const {
- String upper = p_string;
-
- for (int i = 0; i <= upper.length(); i++) {
- const char32_t s = upper[i];
- const char32_t t = _find_upper(s);
- if (s != t) { // avoid copy on write
- upper[i] = t;
- }
- }
-
- return upper;
+ return p_string.to_upper();
}
String TextServerFallback::_string_to_lower(const String &p_string, const String &p_language) const {
- String lower = p_string;
-
- for (int i = 0; i <= lower.length(); i++) {
- const char32_t s = lower[i];
- const char32_t t = _find_lower(s);
- if (s != t) { // avoid copy on write
- lower[i] = t;
- }
- }
-
- return lower;
+ return p_string.to_lower();
}
PackedInt32Array TextServerFallback::_string_get_word_breaks(const String &p_string, const String &p_language, int p_chars_per_line) const {
diff --git a/modules/theora/doc_classes/VideoStreamTheora.xml b/modules/theora/doc_classes/VideoStreamTheora.xml
index e07af8f169..3ec762a880 100644
--- a/modules/theora/doc_classes/VideoStreamTheora.xml
+++ b/modules/theora/doc_classes/VideoStreamTheora.xml
@@ -9,19 +9,4 @@
</description>
<tutorials>
</tutorials>
- <methods>
- <method name="get_file">
- <return type="String" />
- <description>
- Returns the Ogg Theora video file handled by this [VideoStreamTheora].
- </description>
- </method>
- <method name="set_file">
- <return type="void" />
- <param index="0" name="file" type="String" />
- <description>
- Sets the Ogg Theora video file that this [VideoStreamTheora] resource handles. The [code]file[/code] name should have the [code].ogv[/code] extension.
- </description>
- </method>
- </methods>
</class>
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index c600924a3e..b38f7225a2 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -574,25 +574,10 @@ bool VideoStreamPlaybackTheora::is_paused() const {
return paused;
}
-void VideoStreamPlaybackTheora::set_loop(bool p_enable) {
-}
-
-bool VideoStreamPlaybackTheora::has_loop() const {
- return false;
-}
-
double VideoStreamPlaybackTheora::get_length() const {
return 0;
}
-String VideoStreamPlaybackTheora::get_stream_name() const {
- return "";
-}
-
-int VideoStreamPlaybackTheora::get_loop_count() const {
- return 0;
-}
-
double VideoStreamPlaybackTheora::get_playback_position() const {
return get_time();
}
@@ -601,11 +586,6 @@ void VideoStreamPlaybackTheora::seek(double p_time) {
WARN_PRINT_ONCE("Seeking in Theora videos is not implemented yet (it's only supported for GDExtension-provided video streams).");
}
-void VideoStreamPlaybackTheora::set_mix_callback(AudioMixCallback p_callback, void *p_userdata) {
- mix_callback = p_callback;
- mix_udata = p_userdata;
-}
-
int VideoStreamPlaybackTheora::get_channels() const {
return vi.channels;
}
@@ -657,16 +637,9 @@ VideoStreamPlaybackTheora::~VideoStreamPlaybackTheora() {
memdelete(thread_sem);
#endif
clear();
-}
-
-void VideoStreamTheora::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_file", "file"), &VideoStreamTheora::set_file);
- ClassDB::bind_method(D_METHOD("get_file"), &VideoStreamTheora::get_file);
-
- ADD_PROPERTY(PropertyInfo(Variant::STRING, "file", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL), "set_file", "get_file");
-}
+};
-////////////
+void VideoStreamTheora::_bind_methods() {}
Ref<Resource> ResourceFormatLoaderTheora::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) {
Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index f047440df7..32adc28a88 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -99,8 +99,6 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
Ref<ImageTexture> texture;
- AudioMixCallback mix_callback = nullptr;
- void *mix_udata = nullptr;
bool paused = false;
#ifdef THEORA_USE_THREAD_STREAMING
@@ -133,15 +131,8 @@ public:
virtual void set_paused(bool p_paused) override;
virtual bool is_paused() const override;
- virtual void set_loop(bool p_enable) override;
- virtual bool has_loop() const override;
-
virtual double get_length() const override;
- virtual String get_stream_name() const;
-
- virtual int get_loop_count() const;
-
virtual double get_playback_position() const override;
virtual void seek(double p_time) override;
@@ -150,7 +141,6 @@ public:
virtual Ref<Texture2D> get_texture() const override;
virtual void update(double p_delta) override;
- virtual void set_mix_callback(AudioMixCallback p_callback, void *p_userdata) override;
virtual int get_channels() const override;
virtual int get_mix_rate() const override;
@@ -163,9 +153,6 @@ public:
class VideoStreamTheora : public VideoStream {
GDCLASS(VideoStreamTheora, VideoStream);
- String file;
- int audio_track;
-
protected:
static void _bind_methods();
@@ -177,8 +164,6 @@ public:
return pb;
}
- void set_file(const String &p_file) { file = p_file; }
- String get_file() { return file; }
void set_audio_track(int p_track) override { audio_track = p_track; }
VideoStreamTheora() { audio_track = 0; }
diff --git a/modules/vorbis/resource_importer_ogg_vorbis.cpp b/modules/vorbis/resource_importer_ogg_vorbis.cpp
index 64d254f221..b712d63030 100644
--- a/modules/vorbis/resource_importer_ogg_vorbis.cpp
+++ b/modules/vorbis/resource_importer_ogg_vorbis.cpp
@@ -73,7 +73,7 @@ String ResourceImporterOggVorbis::get_preset_name(int p_idx) const {
}
void ResourceImporterOggVorbis::get_import_options(const String &p_path, List<ImportOption> *r_options, int p_preset) const {
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "loop"), true));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "loop"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "loop_offset"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "bpm", PROPERTY_HINT_RANGE, "0,400,0.01,or_greater"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "beat_count", PROPERTY_HINT_RANGE, "0,512,or_greater"), 0));
diff --git a/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml b/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml
index 7e896a0ca3..aaeb2025ee 100644
--- a/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml
+++ b/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml
@@ -13,10 +13,9 @@
<method name="create_client">
<return type="int" enum="Error" />
<param index="0" name="url" type="String" />
- <param index="1" name="verify_tls" type="bool" default="true" />
- <param index="2" name="tls_certificate" type="X509Certificate" default="null" />
+ <param index="1" name="tls_client_options" type="TLSOptions" default="null" />
<description>
- Starts a new multiplayer client connecting to the given [param url]. If [param verify_tls] is [code]false[/code] certificate validation will be disabled. If specified, the [param tls_certificate] will be used to verify the TLS host.
+ Starts a new multiplayer client connecting to the given [param url]. TLS certificates will be verified against the hostname when connecting using the [code]wss://[/code] protocol. You can pass the optional [param tls_client_options] parameter to customize the trusted certification authorities, or disable the common name verification. See [method TLSOptions.client] and [method TLSOptions.client_unsafe].
[b]Note[/b]: It is recommended to specify the scheme part of the URL, i.e. the [param url] should start with either [code]ws://[/code] or [code]wss://[/code].
</description>
</method>
@@ -24,10 +23,9 @@
<return type="int" enum="Error" />
<param index="0" name="port" type="int" />
<param index="1" name="bind_address" type="String" default="&quot;*&quot;" />
- <param index="2" name="tls_key" type="CryptoKey" default="null" />
- <param index="3" name="tls_certificate" type="X509Certificate" default="null" />
+ <param index="2" name="tls_server_options" type="TLSOptions" default="null" />
<description>
- Starts a new multiplayer server listening on the given [param port]. You can optionally specify a [param bind_address], and provide a [param tls_key] and [param tls_certificate] to use TLS.
+ Starts a new multiplayer server listening on the given [param port]. You can optionally specify a [param bind_address], and provide valiid [param tls_server_options] to use TLS. See [method TLSOptions.server].
</description>
</method>
<method name="get_peer" qualifiers="const">
diff --git a/modules/websocket/doc_classes/WebSocketPeer.xml b/modules/websocket/doc_classes/WebSocketPeer.xml
index 41d166a0f5..0f8c27c4cc 100644
--- a/modules/websocket/doc_classes/WebSocketPeer.xml
+++ b/modules/websocket/doc_classes/WebSocketPeer.xml
@@ -58,10 +58,9 @@
<method name="connect_to_url">
<return type="int" enum="Error" />
<param index="0" name="url" type="String" />
- <param index="1" name="verify_tls" type="bool" default="true" />
- <param index="2" name="trusted_tls_certificate" type="X509Certificate" default="null" />
+ <param index="1" name="tls_client_options" type="TLSOptions" default="null" />
<description>
- Connects to the given URL. If [param verify_tls] is [code]false[/code] certificate validation will be disabled. If specified, the [param trusted_tls_certificate] will be the only one accepted when connecting to a TLS host.
+ Connects to the given URL. TLS certificates will be verified against the hostname when connecting using the [code]wss://[/code] protocol. You can pass the optional [param tls_client_options] parameter to customize the trusted certification authorities, or disable the common name verification. See [method TLSOptions.client] and [method TLSOptions.client_unsafe].
[b]Note:[/b] To avoid mixed content warnings or errors in Web, you may have to use a [code]url[/code] that starts with [code]wss://[/code] (secure) instead of [code]ws://[/code]. When doing so, make sure to use the fully qualified domain name that matches the one defined in the server's TLS certificate. Do not connect directly via the IP address for [code]wss://[/code] connections, as it won't match with the TLS certificate.
</description>
</method>
diff --git a/modules/websocket/emws_peer.cpp b/modules/websocket/emws_peer.cpp
index 1ec557427f..7b14a3a61d 100644
--- a/modules/websocket/emws_peer.cpp
+++ b/modules/websocket/emws_peer.cpp
@@ -58,7 +58,8 @@ void EMWSPeer::_esws_on_close(void *p_obj, int p_code, const char *p_reason, int
peer->ready_state = STATE_CLOSED;
}
-Error EMWSPeer::connect_to_url(const String &p_url, bool p_verify_tls, Ref<X509Certificate> p_tls_certificate) {
+Error EMWSPeer::connect_to_url(const String &p_url, Ref<TLSOptions> p_tls_options) {
+ ERR_FAIL_COND_V(p_tls_options.is_valid() && p_tls_options->is_server(), ERR_INVALID_PARAMETER);
ERR_FAIL_COND_V(ready_state != STATE_CLOSED, ERR_ALREADY_IN_USE);
_clear();
@@ -85,9 +86,6 @@ Error EMWSPeer::connect_to_url(const String &p_url, bool p_verify_tls, Ref<X509C
if (handshake_headers.size()) {
WARN_PRINT_ONCE("Custom headers are not supported in Web platform.");
}
- if (p_tls_certificate.is_valid()) {
- WARN_PRINT_ONCE("Custom SSL certificates are not supported in Web platform.");
- }
requested_url = scheme + host;
diff --git a/modules/websocket/emws_peer.h b/modules/websocket/emws_peer.h
index 66c5283d5c..08b2dad977 100644
--- a/modules/websocket/emws_peer.h
+++ b/modules/websocket/emws_peer.h
@@ -86,7 +86,7 @@ public:
// WebSocketPeer
virtual Error send(const uint8_t *p_buffer, int p_buffer_size, WriteMode p_mode) override;
- virtual Error connect_to_url(const String &p_url, bool p_verify_tls = true, Ref<X509Certificate> p_cert = Ref<X509Certificate>()) override;
+ virtual Error connect_to_url(const String &p_url, Ref<TLSOptions> p_tls_client_options) override;
virtual Error accept_stream(Ref<StreamPeer> p_stream) override;
virtual void close(int p_code = 1000, String p_reason = "") override;
virtual void poll() override;
diff --git a/modules/websocket/websocket_multiplayer_peer.cpp b/modules/websocket/websocket_multiplayer_peer.cpp
index 36b4215f8c..389d8c56ad 100644
--- a/modules/websocket/websocket_multiplayer_peer.cpp
+++ b/modules/websocket/websocket_multiplayer_peer.cpp
@@ -54,11 +54,9 @@ void WebSocketMultiplayerPeer::_clear() {
connection_status = CONNECTION_DISCONNECTED;
unique_id = 0;
peers_map.clear();
- use_tls = false;
tcp_server.unref();
pending_peers.clear();
- tls_certificate.unref();
- tls_key.unref();
+ tls_server_options.unref();
if (current_packet.data != nullptr) {
memfree(current_packet.data);
current_packet.data = nullptr;
@@ -73,8 +71,8 @@ void WebSocketMultiplayerPeer::_clear() {
}
void WebSocketMultiplayerPeer::_bind_methods() {
- ClassDB::bind_method(D_METHOD("create_client", "url", "verify_tls", "tls_certificate"), &WebSocketMultiplayerPeer::create_client, DEFVAL(true), DEFVAL(Ref<X509Certificate>()));
- ClassDB::bind_method(D_METHOD("create_server", "port", "bind_address", "tls_key", "tls_certificate"), &WebSocketMultiplayerPeer::create_server, DEFVAL("*"), DEFVAL(Ref<CryptoKey>()), DEFVAL(Ref<X509Certificate>()));
+ ClassDB::bind_method(D_METHOD("create_client", "url", "tls_client_options"), &WebSocketMultiplayerPeer::create_client, DEFVAL(Ref<TLSOptions>()));
+ ClassDB::bind_method(D_METHOD("create_server", "port", "bind_address", "tls_server_options"), &WebSocketMultiplayerPeer::create_server, DEFVAL("*"), DEFVAL(Ref<TLSOptions>()));
ClassDB::bind_method(D_METHOD("get_peer", "peer_id"), &WebSocketMultiplayerPeer::get_peer);
ClassDB::bind_method(D_METHOD("get_peer_address", "id"), &WebSocketMultiplayerPeer::get_peer_address);
@@ -179,8 +177,9 @@ int WebSocketMultiplayerPeer::get_max_packet_size() const {
return get_outbound_buffer_size() - PROTO_SIZE;
}
-Error WebSocketMultiplayerPeer::create_server(int p_port, IPAddress p_bind_ip, Ref<CryptoKey> p_tls_key, Ref<X509Certificate> p_tls_certificate) {
+Error WebSocketMultiplayerPeer::create_server(int p_port, IPAddress p_bind_ip, Ref<TLSOptions> p_options) {
ERR_FAIL_COND_V(get_connection_status() != CONNECTION_DISCONNECTED, ERR_ALREADY_IN_USE);
+ ERR_FAIL_COND_V(p_options.is_valid() && !p_options->is_server(), ERR_INVALID_PARAMETER);
_clear();
tcp_server.instantiate();
Error err = tcp_server->listen(p_port, p_bind_ip);
@@ -190,20 +189,16 @@ Error WebSocketMultiplayerPeer::create_server(int p_port, IPAddress p_bind_ip, R
}
unique_id = 1;
connection_status = CONNECTION_CONNECTED;
- // TLS config
- tls_key = p_tls_key;
- tls_certificate = p_tls_certificate;
- if (tls_key.is_valid() && tls_certificate.is_valid()) {
- use_tls = true;
- }
+ tls_server_options = p_options;
return OK;
}
-Error WebSocketMultiplayerPeer::create_client(const String &p_url, bool p_verify_tls, Ref<X509Certificate> p_tls_certificate) {
+Error WebSocketMultiplayerPeer::create_client(const String &p_url, Ref<TLSOptions> p_options) {
ERR_FAIL_COND_V(get_connection_status() != CONNECTION_DISCONNECTED, ERR_ALREADY_IN_USE);
+ ERR_FAIL_COND_V(p_options.is_valid() && p_options->is_server(), ERR_INVALID_PARAMETER);
_clear();
Ref<WebSocketPeer> peer = _create_peer();
- Error err = peer->connect_to_url(p_url, p_verify_tls, p_tls_certificate);
+ Error err = peer->connect_to_url(p_url, p_options);
if (err != OK) {
return err;
}
@@ -334,14 +329,14 @@ void WebSocketMultiplayerPeer::_poll_server() {
to_remove.insert(id); // Error.
continue;
}
- if (!use_tls) {
+ if (tls_server_options.is_null()) {
peer.ws = _create_peer();
peer.ws->accept_stream(peer.tcp);
continue;
} else {
if (peer.connection == peer.tcp) {
Ref<StreamPeerTLS> tls = Ref<StreamPeerTLS>(StreamPeerTLS::create());
- Error err = tls->accept_stream(peer.tcp, tls_key, tls_certificate);
+ Error err = tls->accept_stream(peer.tcp, tls_server_options);
if (err != OK) {
to_remove.insert(id);
continue;
diff --git a/modules/websocket/websocket_multiplayer_peer.h b/modules/websocket/websocket_multiplayer_peer.h
index ea10e8799f..22f1bc939b 100644
--- a/modules/websocket/websocket_multiplayer_peer.h
+++ b/modules/websocket/websocket_multiplayer_peer.h
@@ -71,9 +71,7 @@ protected:
Ref<WebSocketPeer> peer_config;
HashMap<int, PendingPeer> pending_peers;
Ref<TCPServer> tcp_server;
- bool use_tls = false;
- Ref<X509Certificate> tls_certificate;
- Ref<CryptoKey> tls_key;
+ Ref<TLSOptions> tls_server_options;
ConnectionStatus connection_status = CONNECTION_DISCONNECTED;
@@ -115,8 +113,8 @@ public:
/* WebSocketPeer */
virtual Ref<WebSocketPeer> get_peer(int p_peer_id) const;
- Error create_client(const String &p_url, bool p_verify_tls, Ref<X509Certificate> p_tls_certificate);
- Error create_server(int p_port, IPAddress p_bind_ip, Ref<CryptoKey> p_tls_key, Ref<X509Certificate> p_tls_certificate);
+ Error create_client(const String &p_url, Ref<TLSOptions> p_options);
+ Error create_server(int p_port, IPAddress p_bind_ip, Ref<TLSOptions> p_options);
void set_supported_protocols(const Vector<String> &p_protocols);
Vector<String> get_supported_protocols() const;
diff --git a/modules/websocket/websocket_peer.cpp b/modules/websocket/websocket_peer.cpp
index d10315f64c..3c0d316bc9 100644
--- a/modules/websocket/websocket_peer.cpp
+++ b/modules/websocket/websocket_peer.cpp
@@ -39,7 +39,7 @@ WebSocketPeer::~WebSocketPeer() {
}
void WebSocketPeer::_bind_methods() {
- ClassDB::bind_method(D_METHOD("connect_to_url", "url", "verify_tls", "trusted_tls_certificate"), &WebSocketPeer::connect_to_url, DEFVAL(true), DEFVAL(Ref<X509Certificate>()));
+ ClassDB::bind_method(D_METHOD("connect_to_url", "url", "tls_client_options"), &WebSocketPeer::connect_to_url, DEFVAL(Ref<TLSOptions>()));
ClassDB::bind_method(D_METHOD("accept_stream", "stream"), &WebSocketPeer::accept_stream);
ClassDB::bind_method(D_METHOD("send", "message", "write_mode"), &WebSocketPeer::_send_bind, DEFVAL(WRITE_MODE_BINARY));
ClassDB::bind_method(D_METHOD("send_text", "message"), &WebSocketPeer::send_text);
diff --git a/modules/websocket/websocket_peer.h b/modules/websocket/websocket_peer.h
index 3a1527b769..3110e87071 100644
--- a/modules/websocket/websocket_peer.h
+++ b/modules/websocket/websocket_peer.h
@@ -81,7 +81,7 @@ public:
return _create();
}
- virtual Error connect_to_url(const String &p_url, bool p_verify_tls = true, Ref<X509Certificate> p_cert = Ref<X509Certificate>()) { return ERR_UNAVAILABLE; };
+ virtual Error connect_to_url(const String &p_url, Ref<TLSOptions> p_options = Ref<TLSOptions>()) = 0;
virtual Error accept_stream(Ref<StreamPeer> p_stream) = 0;
virtual Error send(const uint8_t *p_buffer, int p_buffer_size, WriteMode p_mode) = 0;
diff --git a/modules/websocket/wsl_peer.cpp b/modules/websocket/wsl_peer.cpp
index 9ba286d5ee..8a150c8561 100644
--- a/modules/websocket/wsl_peer.cpp
+++ b/modules/websocket/wsl_peer.cpp
@@ -333,8 +333,7 @@ void WSLPeer::_do_client_handshake() {
// Start SSL handshake
tls = Ref<StreamPeerTLS>(StreamPeerTLS::create());
ERR_FAIL_COND_MSG(tls.is_null(), "SSL is not available in this build.");
- tls->set_blocking_handshake_enabled(false);
- if (tls->connect_to_stream(tcp, verify_tls, requested_host, tls_cert) != OK) {
+ if (tls->connect_to_stream(tcp, requested_host, tls_options) != OK) {
close(-1);
return; // Error.
}
@@ -476,9 +475,10 @@ bool WSLPeer::_verify_server_response() {
return true;
}
-Error WSLPeer::connect_to_url(const String &p_url, bool p_verify_tls, Ref<X509Certificate> p_cert) {
+Error WSLPeer::connect_to_url(const String &p_url, Ref<TLSOptions> p_options) {
ERR_FAIL_COND_V(wsl_ctx || tcp.is_valid(), ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V(p_url.is_empty(), ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_options.is_valid() && p_options->is_server(), ERR_INVALID_PARAMETER);
_clear();
@@ -506,8 +506,13 @@ Error WSLPeer::connect_to_url(const String &p_url, bool p_verify_tls, Ref<X509Ce
requested_url = p_url;
requested_host = host;
- verify_tls = p_verify_tls;
- tls_cert = p_cert;
+
+ if (p_options.is_valid()) {
+ tls_options = p_options;
+ } else {
+ tls_options = TLSOptions::client();
+ }
+
tcp.instantiate();
resolver.start(host, port);
diff --git a/modules/websocket/wsl_peer.h b/modules/websocket/wsl_peer.h
index fc81d39a37..c06e768b6d 100644
--- a/modules/websocket/wsl_peer.h
+++ b/modules/websocket/wsl_peer.h
@@ -102,8 +102,7 @@ private:
// WebSocket configuration.
bool use_tls = true;
- bool verify_tls = true;
- Ref<X509Certificate> tls_cert;
+ Ref<TLSOptions> tls_options;
// Packet buffers.
Vector<uint8_t> packet_buffer;
@@ -132,7 +131,7 @@ public:
// WebSocketPeer
virtual Error send(const uint8_t *p_buffer, int p_buffer_size, WriteMode p_mode) override;
- virtual Error connect_to_url(const String &p_url, bool p_verify_tls = true, Ref<X509Certificate> p_cert = Ref<X509Certificate>()) override;
+ virtual Error connect_to_url(const String &p_url, Ref<TLSOptions> p_options = Ref<TLSOptions>()) override;
virtual Error accept_stream(Ref<StreamPeer> p_stream) override;
virtual void close(int p_code = 1000, String p_reason = "") override;
virtual void poll() override;
diff --git a/modules/webxr/doc_classes/WebXRInterface.xml b/modules/webxr/doc_classes/WebXRInterface.xml
index ba1750386f..0c18acbcb1 100644
--- a/modules/webxr/doc_classes/WebXRInterface.xml
+++ b/modules/webxr/doc_classes/WebXRInterface.xml
@@ -90,7 +90,7 @@
You can use both methods to allow your game or app to support a wider or narrower set of devices and input methods, or to allow more advanced interactions with more advanced devices.
</description>
<tutorials>
- <link title="How to make a VR game for WebXR with Godot">https://www.snopekgames.com/blog/2020/how-make-vr-game-webxr-godot</link>
+ <link title="How to make a VR game for WebXR with Godot 4">https://www.snopekgames.com/tutorial/2023/how-make-vr-game-webxr-godot-4</link>
</tutorials>
<methods>
<method name="get_input_source_target_ray_mode" qualifiers="const">
diff --git a/modules/webxr/webxr_interface_js.cpp b/modules/webxr/webxr_interface_js.cpp
index 8485c62218..97b2eea4d7 100644
--- a/modules/webxr/webxr_interface_js.cpp
+++ b/modules/webxr/webxr_interface_js.cpp
@@ -347,9 +347,8 @@ Transform3D WebXRInterfaceJS::get_camera_transform() {
ERR_FAIL_NULL_V(xr_server, camera_transform);
if (initialized) {
- float world_scale = xr_server->get_world_scale();
+ double world_scale = xr_server->get_world_scale();
- // just scale our origin point of our transform
Transform3D _head_transform = head_transform;
_head_transform.origin *= world_scale;
@@ -372,13 +371,8 @@ Transform3D WebXRInterfaceJS::get_transform_for_view(uint32_t p_view, const Tran
Transform3D transform_for_view = _js_matrix_to_transform(js_matrix);
- float world_scale = xr_server->get_world_scale();
- // Scale only the center point of our eye transform, so we don't scale the
- // distance between the eyes.
- Transform3D _head_transform = head_transform;
- transform_for_view.origin -= _head_transform.origin;
- _head_transform.origin *= world_scale;
- transform_for_view.origin += _head_transform.origin;
+ double world_scale = xr_server->get_world_scale();
+ transform_for_view.origin *= world_scale;
return p_cam_transform * xr_server->get_reference_frame() * transform_for_view;
};
diff --git a/platform/android/android_input_handler.cpp b/platform/android/android_input_handler.cpp
index e3f93086dc..17903b3965 100644
--- a/platform/android/android_input_handler.cpp
+++ b/platform/android/android_input_handler.cpp
@@ -56,7 +56,7 @@ void AndroidInputHandler::_set_key_modifier_state(Ref<InputEventWithModifiers> e
ev->set_ctrl_pressed(control_mem);
}
-void AndroidInputHandler::process_key_event(int p_keycode, int p_physical_keycode, int p_unicode, bool p_pressed) {
+void AndroidInputHandler::process_key_event(int p_physical_keycode, int p_unicode, int p_key_label, bool p_pressed) {
static char32_t prev_wc = 0;
char32_t unicode = p_unicode;
if ((p_unicode & 0xfffffc00) == 0xd800) {
@@ -81,8 +81,18 @@ void AndroidInputHandler::process_key_event(int p_keycode, int p_physical_keycod
Key physical_keycode = godot_code_from_android_code(p_physical_keycode);
Key keycode = physical_keycode;
- if (p_keycode != 0) {
- keycode = godot_code_from_unicode(p_keycode);
+ if (unicode == '\b') { // 0x08
+ keycode = Key::BACKSPACE;
+ } else if (unicode == '\t') { // 0x09
+ keycode = Key::TAB;
+ } else if (unicode == '\n') { // 0x0A
+ keycode = Key::ENTER;
+ } else if (unicode == 0x1B) {
+ keycode = Key::ESCAPE;
+ } else if (unicode == 0x1F) {
+ keycode = Key::KEY_DELETE;
+ } else {
+ keycode = fix_keycode(unicode, physical_keycode);
}
switch (physical_keycode) {
@@ -104,7 +114,8 @@ void AndroidInputHandler::process_key_event(int p_keycode, int p_physical_keycod
ev->set_keycode(keycode);
ev->set_physical_keycode(physical_keycode);
- ev->set_unicode(unicode);
+ ev->set_key_label(fix_key_label(p_key_label, keycode));
+ ev->set_unicode(fix_unicode(unicode));
ev->set_pressed(p_pressed);
_set_key_modifier_state(ev);
diff --git a/platform/android/android_input_handler.h b/platform/android/android_input_handler.h
index 34259efd81..6e53dcfc89 100644
--- a/platform/android/android_input_handler.h
+++ b/platform/android/android_input_handler.h
@@ -97,7 +97,7 @@ public:
void process_magnify(Point2 p_pos, float p_factor);
void process_pan(Point2 p_pos, Vector2 p_delta);
void process_joy_event(JoypadEvent p_event);
- void process_key_event(int p_keycode, int p_physical_keycode, int p_unicode, bool p_pressed);
+ void process_key_event(int p_physical_keycode, int p_unicode, int p_key_label, bool p_pressed);
};
#endif // ANDROID_INPUT_HANDLER_H
diff --git a/platform/android/android_keys_utils.cpp b/platform/android/android_keys_utils.cpp
index 0dc2d19cdd..f50437e82a 100644
--- a/platform/android/android_keys_utils.cpp
+++ b/platform/android/android_keys_utils.cpp
@@ -38,41 +38,3 @@ Key godot_code_from_android_code(unsigned int p_code) {
}
return Key::UNKNOWN;
}
-
-Key godot_code_from_unicode(unsigned int p_code) {
- unsigned int code = p_code;
- if (code > 0xFF) {
- return Key::UNKNOWN;
- }
- // Known control codes.
- if (code == '\b') { // 0x08
- return Key::BACKSPACE;
- }
- if (code == '\t') { // 0x09
- return Key::TAB;
- }
- if (code == '\n') { // 0x0A
- return Key::ENTER;
- }
- if (code == 0x1B) {
- return Key::ESCAPE;
- }
- if (code == 0x1F) {
- return Key::KEY_DELETE;
- }
- // Unknown control codes.
- if (code <= 0x1F || (code >= 0x80 && code <= 0x9F)) {
- return Key::UNKNOWN;
- }
- // Convert to uppercase.
- if (code >= 'a' && code <= 'z') { // 0x61 - 0x7A
- code -= ('a' - 'A');
- }
- if (code >= u'à' && code <= u'ö') { // 0xE0 - 0xF6
- code -= (u'à' - u'À'); // 0xE0 - 0xC0
- }
- if (code >= u'ø' && code <= u'þ') { // 0xF8 - 0xFF
- code -= (u'ø' - u'Ø'); // 0xF8 - 0xD8
- }
- return Key(code);
-}
diff --git a/platform/android/android_keys_utils.h b/platform/android/android_keys_utils.h
index 33e7929278..3a587dd680 100644
--- a/platform/android/android_keys_utils.h
+++ b/platform/android/android_keys_utils.h
@@ -165,13 +165,14 @@ static AndroidGodotCodePair android_godot_code_pairs[] = {
{ AKEYCODE_NUMPAD_DOT, Key::KP_PERIOD }, // (158) Numeric keypad '.' key (for decimals or digit grouping).
{ AKEYCODE_NUMPAD_ENTER, Key::KP_ENTER }, // (160) Numeric keypad Enter key.
{ AKEYCODE_VOLUME_MUTE, Key::VOLUMEMUTE }, // (164) Volume Mute key.
+ { AKEYCODE_EISU, Key::JIS_EISU }, // (212) JIS EISU key.
{ AKEYCODE_YEN, Key::YEN }, // (216) Japanese Yen key.
+ { AKEYCODE_KANA, Key::JIS_KANA }, // (218) JIS KANA key.
{ AKEYCODE_HELP, Key::HELP }, // (259) Help key.
{ AKEYCODE_REFRESH, Key::REFRESH }, // (285) Refresh key.
{ AKEYCODE_MAX, Key::UNKNOWN }
};
Key godot_code_from_android_code(unsigned int p_code);
-Key godot_code_from_unicode(unsigned int p_code);
#endif // ANDROID_KEYS_UTILS_H
diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp
index 27cb84fb9d..9dad0c9357 100644
--- a/platform/android/audio_driver_opensl.cpp
+++ b/platform/android/audio_driver_opensl.cpp
@@ -44,7 +44,7 @@ void AudioDriverOpenSL::_buffer_callback(
if (pause) {
mix = false;
} else {
- mix = mutex.try_lock() == OK;
+ mix = mutex.try_lock();
}
if (mix) {
diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp
index 6b3bdb7fe6..3fcb926f86 100644
--- a/platform/android/display_server_android.cpp
+++ b/platform/android/display_server_android.cpp
@@ -212,7 +212,18 @@ float DisplayServerAndroid::screen_get_scale(int p_screen) const {
GodotIOJavaWrapper *godot_io_java = OS_Android::get_singleton()->get_godot_io_java();
ERR_FAIL_NULL_V(godot_io_java, 1.0f);
- return godot_io_java->get_scaled_density();
+ float screen_scale = godot_io_java->get_scaled_density();
+
+ // Update the scale to avoid cropping.
+ Size2i screen_size = screen_get_size(p_screen);
+ if (screen_size != Size2i()) {
+ float width_scale = screen_size.width / (float)OS_Android::DEFAULT_WINDOW_WIDTH;
+ float height_scale = screen_size.height / (float)OS_Android::DEFAULT_WINDOW_HEIGHT;
+ screen_scale = MIN(screen_scale, MIN(width_scale, height_scale));
+ }
+
+ print_line("Selected screen scale: ", screen_scale);
+ return screen_scale;
}
float DisplayServerAndroid::screen_get_refresh_rate(int p_screen) const {
diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp
index bb1ad3d83b..9ebb8aa102 100644
--- a/platform/android/export/export_plugin.cpp
+++ b/platform/android/export/export_plugin.cpp
@@ -437,6 +437,14 @@ String EditorExportPlatformAndroid::get_project_name(const String &p_name) const
String EditorExportPlatformAndroid::get_package_name(const String &p_package) const {
String pname = p_package;
+ String name = get_valid_basename();
+ pname = pname.replace("$genname", name);
+ return pname;
+}
+
+// Returns the project name without invalid characters
+// or the "noname" string if all characters are invalid.
+String EditorExportPlatformAndroid::get_valid_basename() const {
String basename = GLOBAL_GET("application/config/name");
basename = basename.to_lower();
@@ -452,13 +460,12 @@ String EditorExportPlatformAndroid::get_package_name(const String &p_package) co
first = false;
}
}
+
if (name.is_empty()) {
name = "noname";
}
- pname = pname.replace("$genname", name);
-
- return pname;
+ return name;
}
String EditorExportPlatformAndroid::get_assets_directory(const Ref<EditorExportPreset> &p_preset, int p_export_format) const {
@@ -466,7 +473,7 @@ String EditorExportPlatformAndroid::get_assets_directory(const Ref<EditorExportP
}
bool EditorExportPlatformAndroid::is_package_name_valid(const String &p_package, String *r_error) const {
- String pname = p_package;
+ String pname = get_package_name(p_package);
if (pname.length() == 0) {
if (r_error) {
@@ -525,6 +532,24 @@ bool EditorExportPlatformAndroid::is_package_name_valid(const String &p_package,
return false;
}
+ if (p_package.find("$genname") >= 0 && !is_project_name_valid()) {
+ if (r_error) {
+ *r_error = TTR("The project name does not meet the requirement for the package name format. Please explicitly specify the package name.");
+ }
+ return false;
+ }
+
+ return true;
+}
+
+bool EditorExportPlatformAndroid::is_project_name_valid() const {
+ // Get the original project name and convert to lowercase.
+ String basename = GLOBAL_GET("application/config/name");
+ basename = basename.to_lower();
+ // Check if there are invalid characters.
+ if (basename != get_valid_basename()) {
+ return false;
+ }
return true;
}
@@ -1051,11 +1076,6 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref<EditorExportPreset> &p
Vector<int> feature_versions;
if (xr_mode_index == XR_MODE_OPENXR) {
- // Set degrees of freedom
- feature_names.push_back("android.hardware.vr.headtracking");
- feature_required_list.push_back(true);
- feature_versions.push_back(1);
-
// Check for hand tracking
if (hand_tracking_index > XR_HAND_TRACKING_NONE) {
feature_names.push_back("oculus.software.handtracking");
@@ -1691,6 +1711,7 @@ Vector<EditorExportPlatformAndroid::ABI> EditorExportPlatformAndroid::get_enable
void EditorExportPlatformAndroid::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const {
r_features->push_back("etc2");
+ r_features->push_back("astc");
Vector<ABI> abis = get_enabled_abis(p_preset);
for (int i = 0; i < abis.size(); ++i) {
@@ -2286,7 +2307,7 @@ bool EditorExportPlatformAndroid::has_valid_project_configuration(const Ref<Edit
String pn = p_preset->get("package/unique_name");
String pn_err;
- if (!is_package_name_valid(get_package_name(pn), &pn_err)) {
+ if (!is_package_name_valid(pn, &pn_err)) {
valid = false;
err += TTR("Invalid package name:") + " " + pn_err + "\n";
}
diff --git a/platform/android/export/export_plugin.h b/platform/android/export/export_plugin.h
index a6dfc9fcb3..bff769fcba 100644
--- a/platform/android/export/export_plugin.h
+++ b/platform/android/export/export_plugin.h
@@ -91,9 +91,12 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
String get_package_name(const String &p_package) const;
+ String get_valid_basename() const;
+
String get_assets_directory(const Ref<EditorExportPreset> &p_preset, int p_export_format) const;
bool is_package_name_valid(const String &p_package, String *r_error = nullptr) const;
+ bool is_project_name_valid() const;
static bool _should_compress_asset(const String &p_path, const Vector<uint8_t> &p_data);
diff --git a/platform/android/export/gradle_export_util.cpp b/platform/android/export/gradle_export_util.cpp
index e450f3edb3..4fdcca68e9 100644
--- a/platform/android/export/gradle_export_util.cpp
+++ b/platform/android/export/gradle_export_util.cpp
@@ -259,8 +259,6 @@ String _get_xr_features_tag(const Ref<EditorExportPreset> &p_preset) {
int xr_mode_index = (int)(p_preset->get("xr_features/xr_mode"));
bool uses_xr = xr_mode_index == XR_MODE_OPENXR;
if (uses_xr) {
- manifest_xr_features += " <uses-feature tools:node=\"replace\" android:name=\"android.hardware.vr.headtracking\" android:required=\"true\" android:version=\"1\" />\n";
-
int hand_tracking_index = p_preset->get("xr_features/hand_tracking"); // 0: none, 1: optional, 2: required
if (hand_tracking_index == XR_HAND_TRACKING_OPTIONAL) {
manifest_xr_features += " <uses-feature tools:node=\"replace\" android:name=\"oculus.software.handtracking\" android:required=\"false\" />\n";
@@ -279,8 +277,6 @@ String _get_xr_features_tag(const Ref<EditorExportPreset> &p_preset) {
}
String _get_activity_tag(const Ref<EditorExportPreset> &p_preset) {
- int xr_mode_index = (int)(p_preset->get("xr_features/xr_mode"));
- bool uses_xr = xr_mode_index == XR_MODE_OPENXR;
String orientation = _get_android_orientation_label(DisplayServer::ScreenOrientation(int(GLOBAL_GET("display/window/handheld/orientation"))));
String manifest_activity_text = vformat(
" <activity android:name=\"com.godot.game.GodotApp\" "
@@ -291,11 +287,6 @@ String _get_activity_tag(const Ref<EditorExportPreset> &p_preset) {
bool_to_string(p_preset->get("package/exclude_from_recents")),
orientation,
bool_to_string(bool(GLOBAL_GET("display/window/size/resizable"))));
- if (uses_xr) {
- manifest_activity_text += " <meta-data tools:node=\"replace\" android:name=\"com.oculus.vr.focusaware\" android:value=\"true\" />\n";
- } else {
- manifest_activity_text += " <meta-data tools:node=\"remove\" android:name=\"com.oculus.vr.focusaware\" />\n";
- }
manifest_activity_text += " </activity>\n";
return manifest_activity_text;
}
@@ -335,8 +326,6 @@ String _get_application_tag(const Ref<EditorExportPreset> &p_preset, bool p_has_
hand_tracking_frequency);
manifest_application_text += " <meta-data tools:node=\"replace\" android:name=\"com.oculus.handtracking.version\" android:value=\"V2.0\" />\n";
}
- } else {
- manifest_application_text += " <meta-data tools:node=\"remove\" android:name=\"com.oculus.supportedDevices\" />\n";
}
manifest_application_text += _get_activity_tag(p_preset);
manifest_application_text += " </application>\n";
diff --git a/platform/android/java/app/AndroidManifest.xml b/platform/android/java/app/AndroidManifest.xml
index 8c8608cbbb..1969f9c814 100644
--- a/platform/android/java/app/AndroidManifest.xml
+++ b/platform/android/java/app/AndroidManifest.xml
@@ -48,12 +48,6 @@
android:name="xr_hand_tracking_version_name"
android:value="xr_hand_tracking_version_value"/>
- <!-- Supported Meta devices -->
- <!-- This is removed by the exporter if the xr mode is not VR. -->
- <meta-data
- android:name="com.oculus.supportedDevices"
- android:value="all" />
-
<activity
android:name=".GodotApp"
android:label="@string/godot_project_name_string"
@@ -66,9 +60,6 @@
android:resizeableActivity="false"
tools:ignore="UnusedAttribute" >
- <!-- Focus awareness metadata is removed at export time if the xr mode is not VR. -->
- <meta-data android:name="com.oculus.vr.focusaware" android:value="true" />
-
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
diff --git a/platform/android/java/editor/src/dev/res/values/strings.xml b/platform/android/java/editor/src/dev/res/values/strings.xml
index 45fae3fd39..215f2c7d0a 100644
--- a/platform/android/java/editor/src/dev/res/values/strings.xml
+++ b/platform/android/java/editor/src/dev/res/values/strings.xml
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="godot_editor_name_string">Godot Editor 4.x (dev)</string>
+ <string name="godot_editor_name_string">Godot Editor 4 (dev)</string>
</resources>
diff --git a/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt b/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt
index f848089aa8..71385315ae 100644
--- a/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt
+++ b/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt
@@ -31,12 +31,11 @@
package org.godotengine.editor
import android.Manifest
+import android.app.ActivityManager
+import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
-import android.os.Build
-import android.os.Bundle
-import android.os.Debug
-import android.os.Environment
+import android.os.*
import android.util.Log
import android.widget.Toast
import androidx.window.layout.WindowMetricsCalculator
@@ -64,11 +63,18 @@ open class GodotEditor : FullScreenGodotApp() {
private const val COMMAND_LINE_PARAMS = "command_line_params"
+ private const val EDITOR_ID = 777
private const val EDITOR_ARG = "--editor"
private const val EDITOR_ARG_SHORT = "-e"
+ private const val EDITOR_PROCESS_NAME_SUFFIX = ":GodotEditor"
+ private const val GAME_ID = 667
+ private const val GAME_PROCESS_NAME_SUFFIX = ":GodotGame"
+
+ private const val PROJECT_MANAGER_ID = 555
private const val PROJECT_MANAGER_ARG = "--project-manager"
private const val PROJECT_MANAGER_ARG_SHORT = "-p"
+ private const val PROJECT_MANAGER_PROCESS_NAME_SUFFIX = ":GodotProjectManager"
}
private val commandLineParams = ArrayList<String>()
@@ -102,9 +108,10 @@ open class GodotEditor : FullScreenGodotApp() {
override fun getCommandLine() = commandLineParams
- override fun onNewGodotInstanceRequested(args: Array<String>) {
+ override fun onNewGodotInstanceRequested(args: Array<String>): Int {
// Parse the arguments to figure out which activity to start.
var targetClass: Class<*> = GodotGame::class.java
+ var instanceId = GAME_ID
// Whether we should launch the new godot instance in an adjacent window
// https://developer.android.com/reference/android/content/Intent#FLAG_ACTIVITY_LAUNCH_ADJACENT
@@ -115,12 +122,14 @@ open class GodotEditor : FullScreenGodotApp() {
if (EDITOR_ARG == arg || EDITOR_ARG_SHORT == arg) {
targetClass = GodotEditor::class.java
launchAdjacent = false
+ instanceId = EDITOR_ID
break
}
if (PROJECT_MANAGER_ARG == arg || PROJECT_MANAGER_ARG_SHORT == arg) {
targetClass = GodotProjectManager::class.java
launchAdjacent = false
+ instanceId = PROJECT_MANAGER_ID
break
}
}
@@ -139,6 +148,37 @@ open class GodotEditor : FullScreenGodotApp() {
Log.d(TAG, "Starting $targetClass")
startActivity(newInstance)
}
+ return instanceId
+ }
+
+ override fun onGodotForceQuit(godotInstanceId: Int): Boolean {
+ val processNameSuffix = when (godotInstanceId) {
+ GAME_ID -> {
+ GAME_PROCESS_NAME_SUFFIX
+ }
+ EDITOR_ID -> {
+ EDITOR_PROCESS_NAME_SUFFIX
+ }
+ PROJECT_MANAGER_ID -> {
+ PROJECT_MANAGER_PROCESS_NAME_SUFFIX
+ }
+ else -> ""
+ }
+ if (processNameSuffix.isBlank()) {
+ return false
+ }
+
+ val activityManager = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
+ val runningProcesses = activityManager.runningAppProcesses
+ for (runningProcess in runningProcesses) {
+ if (runningProcess.processName.endsWith(processNameSuffix)) {
+ Log.v(TAG, "Killing Godot process ${runningProcess.processName}")
+ Process.killProcess(runningProcess.pid)
+ return true
+ }
+ }
+
+ return false
}
// Get the screen's density scale
diff --git a/platform/android/java/editor/src/main/res/values/strings.xml b/platform/android/java/editor/src/main/res/values/strings.xml
index 837a5d62e1..216d02d9c7 100644
--- a/platform/android/java/editor/src/main/res/values/strings.xml
+++ b/platform/android/java/editor/src/main/res/values/strings.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="godot_editor_name_string">Godot Editor 4.x</string>
+ <string name="godot_editor_name_string">Godot Editor 4</string>
<string name="denied_storage_permission_error_msg">Missing storage access permission!</string>
</resources>
diff --git a/platform/android/java/lib/res/values/strings.xml b/platform/android/java/lib/res/values/strings.xml
index f5a4ab1071..7efac4ce71 100644
--- a/platform/android/java/lib/res/values/strings.xml
+++ b/platform/android/java/lib/res/values/strings.xml
@@ -48,7 +48,7 @@
<string name="state_failed_unlicensed">Download failed because you may not have purchased this app</string>
<string name="state_failed_fetching_url">Download failed because the resources could not be found</string>
<string name="state_failed_sdcard_full">Download failed because the external storage is full</string>
- <string name="state_failed_cancelled">Download cancelled</string>
+ <string name="state_failed_cancelled">Download canceled</string>
<string name="state_failed">Download failed</string>
<string name="kilobytes_per_second">%1$s KB/s</string>
diff --git a/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java b/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java
index 863e67f1e9..65032d6a68 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java
@@ -74,28 +74,36 @@ public abstract class FullScreenGodotApp extends FragmentActivity implements God
public void onDestroy() {
Log.v(TAG, "Destroying Godot app...");
super.onDestroy();
- onGodotForceQuit(godotFragment);
+ terminateGodotInstance(godotFragment);
}
@Override
public final void onGodotForceQuit(Godot instance) {
+ runOnUiThread(() -> {
+ terminateGodotInstance(instance);
+ });
+ }
+
+ private void terminateGodotInstance(Godot instance) {
if (instance == godotFragment) {
Log.v(TAG, "Force quitting Godot instance");
- ProcessPhoenix.forceQuit(this);
+ ProcessPhoenix.forceQuit(FullScreenGodotApp.this);
}
}
@Override
public final void onGodotRestartRequested(Godot instance) {
- if (instance == godotFragment) {
- // It's very hard to properly de-initialize Godot on Android to restart the game
- // from scratch. Therefore, we need to kill the whole app process and relaunch it.
- //
- // Restarting only the activity, wouldn't be enough unless it did proper cleanup (including
- // releasing and reloading native libs or resetting their state somehow and clearing statics).
- Log.v(TAG, "Restarting Godot instance...");
- ProcessPhoenix.triggerRebirth(this);
- }
+ runOnUiThread(() -> {
+ if (instance == godotFragment) {
+ // It's very hard to properly de-initialize Godot on Android to restart the game
+ // from scratch. Therefore, we need to kill the whole app process and relaunch it.
+ //
+ // Restarting only the activity, wouldn't be enough unless it did proper cleanup (including
+ // releasing and reloading native libs or resetting their state somehow and clearing statics).
+ Log.v(TAG, "Restarting Godot instance...");
+ ProcessPhoenix.triggerRebirth(FullScreenGodotApp.this);
+ }
+ });
}
@Override
diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java
index 905db13c85..50263bc392 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java
@@ -348,11 +348,9 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
}
public void restart() {
- runOnUiThread(() -> {
- if (godotHost != null) {
- godotHost.onGodotRestartRequested(this);
- }
- });
+ if (godotHost != null) {
+ godotHost.onGodotRestartRequested(this);
+ }
}
public void alert(final String message, final String title) {
@@ -889,11 +887,20 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
private void forceQuit() {
// TODO: This is a temp solution. The proper fix will involve tracking down and properly shutting down each
// native Godot components that is started in Godot#onVideoInit.
- runOnUiThread(() -> {
- if (godotHost != null) {
- godotHost.onGodotForceQuit(this);
- }
- });
+ forceQuit(0);
+ }
+
+ @Keep
+ private boolean forceQuit(int instanceId) {
+ if (godotHost == null) {
+ return false;
+ }
+ if (instanceId == 0) {
+ godotHost.onGodotForceQuit(this);
+ return true;
+ } else {
+ return godotHost.onGodotForceQuit(instanceId);
+ }
}
private boolean obbIsCorrupted(String f, String main_pack_md5) {
@@ -1052,11 +1059,10 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
}
@Keep
- private void createNewGodotInstance(String[] args) {
- runOnUiThread(() -> {
- if (godotHost != null) {
- godotHost.onNewGodotInstanceRequested(args);
- }
- });
+ private int createNewGodotInstance(String[] args) {
+ if (godotHost != null) {
+ return godotHost.onNewGodotInstanceRequested(args);
+ }
+ return 0;
}
}
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotHost.java b/platform/android/java/lib/src/org/godotengine/godot/GodotHost.java
index 256d04e3a5..7700b9b628 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotHost.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotHost.java
@@ -55,21 +55,35 @@ public interface GodotHost {
default void onGodotMainLoopStarted() {}
/**
- * Invoked on the UI thread as the last step of the Godot instance clean up phase.
+ * Invoked on the render thread to terminate the given Godot instance.
*/
default void onGodotForceQuit(Godot instance) {}
/**
- * Invoked on the UI thread when the Godot instance wants to be restarted. It's up to the host
+ * Invoked on the render thread to terminate the Godot instance with the given id.
+ * @param godotInstanceId id of the Godot instance to terminate. See {@code onNewGodotInstanceRequested}
+ *
+ * @return true if successful, false otherwise.
+ */
+ default boolean onGodotForceQuit(int godotInstanceId) {
+ return false;
+ }
+
+ /**
+ * Invoked on the render thread when the Godot instance wants to be restarted. It's up to the host
* to perform the appropriate action(s).
*/
default void onGodotRestartRequested(Godot instance) {}
/**
- * Invoked on the UI thread when a new Godot instance is requested. It's up to the host to
+ * Invoked on the render thread when a new Godot instance is requested. It's up to the host to
* perform the appropriate action(s).
*
* @param args Arguments used to initialize the new instance.
+ *
+ * @return the id of the new instance. See {@code onGodotForceQuit}
*/
- default void onNewGodotInstanceRequested(String[] args) {}
+ default int onNewGodotInstanceRequested(String[] args) {
+ return 0;
+ }
}
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
index aca0c4381b..41d06a6458 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
@@ -150,7 +150,6 @@ public class GodotIO {
} else {
selectedScaledDensity = 0.75f;
}
- Log.d(TAG, "Selected scaled density: " + selectedScaledDensity);
return selectedScaledDensity;
}
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java
index 31b512d2dd..75a01dc787 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java
@@ -148,7 +148,7 @@ public class GodotLib {
/**
* Forward regular key events.
*/
- public static native void key(int p_keycode, int p_physical_keycode, int p_unicode, boolean p_pressed);
+ public static native void key(int p_physical_keycode, int p_unicode, int p_key_label, boolean p_pressed);
/**
* Forward game device's key events.
diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java
index f2bd3e28e6..cedbbfb7c3 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java
@@ -129,12 +129,10 @@ public class GodotInputHandler implements InputManager.InputDeviceListener {
}
} else {
// getKeyCode(): The physical key that was pressed.
- // Godot's keycodes match the ASCII codes, so for single byte unicode characters,
- // we can use the unmodified unicode character to determine Godot's keycode.
- final int keycode = event.getUnicodeChar(0);
final int physical_keycode = event.getKeyCode();
final int unicode = event.getUnicodeChar();
- GodotLib.key(keycode, physical_keycode, unicode, false);
+ final int key_label = event.getDisplayLabel();
+ GodotLib.key(physical_keycode, unicode, key_label, false);
};
return true;
@@ -166,10 +164,10 @@ public class GodotInputHandler implements InputManager.InputDeviceListener {
GodotLib.joybutton(godotJoyId, button, true);
}
} else {
- final int keycode = event.getUnicodeChar(0);
final int physical_keycode = event.getKeyCode();
final int unicode = event.getUnicodeChar();
- GodotLib.key(keycode, physical_keycode, unicode, true);
+ final int key_label = event.getDisplayLabel();
+ GodotLib.key(physical_keycode, unicode, key_label, true);
}
return true;
diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java
index fdfe20f32b..7b628e25ed 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java
@@ -93,8 +93,8 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
@Override
public void beforeTextChanged(final CharSequence pCharSequence, final int start, final int count, final int after) {
for (int i = 0; i < count; ++i) {
- GodotLib.key(0, KeyEvent.KEYCODE_DEL, 0, true);
- GodotLib.key(0, KeyEvent.KEYCODE_DEL, 0, false);
+ GodotLib.key(KeyEvent.KEYCODE_DEL, 0, 0, true);
+ GodotLib.key(KeyEvent.KEYCODE_DEL, 0, 0, false);
if (mHasSelection) {
mHasSelection = false;
@@ -110,13 +110,13 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
newChars[i - start] = pCharSequence.charAt(i);
}
for (int i = 0; i < count; ++i) {
- int key = newChars[i];
- if ((key == '\n') && !(mEdit.getKeyboardType() == GodotEditText.VirtualKeyboardType.KEYBOARD_TYPE_MULTILINE)) {
+ final int character = newChars[i];
+ if ((character == '\n') && !(mEdit.getKeyboardType() == GodotEditText.VirtualKeyboardType.KEYBOARD_TYPE_MULTILINE)) {
// Return keys are handled through action events
continue;
}
- GodotLib.key(key, 0, key, true);
- GodotLib.key(key, 0, key, false);
+ GodotLib.key(0, character, 0, true);
+ GodotLib.key(0, character, 0, false);
}
}
@@ -126,17 +126,17 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
final String characters = pKeyEvent.getCharacters();
for (int i = 0; i < characters.length(); i++) {
- final int ch = characters.codePointAt(i);
- GodotLib.key(ch, 0, ch, true);
- GodotLib.key(ch, 0, ch, false);
+ final int character = characters.codePointAt(i);
+ GodotLib.key(0, character, 0, true);
+ GodotLib.key(0, character, 0, false);
}
}
if (pActionID == EditorInfo.IME_ACTION_DONE) {
// Enter key has been pressed
mRenderView.queueOnRenderThread(() -> {
- GodotLib.key(0, KeyEvent.KEYCODE_ENTER, 0, true);
- GodotLib.key(0, KeyEvent.KEYCODE_ENTER, 0, false);
+ GodotLib.key(KeyEvent.KEYCODE_ENTER, 0, 0, true);
+ GodotLib.key(KeyEvent.KEYCODE_ENTER, 0, 0, false);
});
mRenderView.getView().requestFocus();
return true;
diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/directory/AssetsDirectoryAccess.kt b/platform/android/java/lib/src/org/godotengine/godot/io/directory/AssetsDirectoryAccess.kt
index 9649b0aecc..b9b7ebac6e 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/io/directory/AssetsDirectoryAccess.kt
+++ b/platform/android/java/lib/src/org/godotengine/godot/io/directory/AssetsDirectoryAccess.kt
@@ -64,7 +64,7 @@ internal class AssetsDirectoryAccess(context: Context) : DirectoryAccessHandler.
override fun hasDirId(dirId: Int) = dirs.indexOfKey(dirId) >= 0
override fun dirOpen(path: String): Int {
- val assetsPath = getAssetsPath(path) ?: return INVALID_DIR_ID
+ val assetsPath = getAssetsPath(path)
try {
val files = assetManager.list(assetsPath) ?: return INVALID_DIR_ID
// Empty directories don't get added to the 'assets' directory, so
@@ -99,7 +99,7 @@ internal class AssetsDirectoryAccess(context: Context) : DirectoryAccessHandler.
}
override fun fileExists(path: String): Boolean {
- val assetsPath = getAssetsPath(path) ?: return false
+ val assetsPath = getAssetsPath(path)
try {
val files = assetManager.list(assetsPath) ?: return false
// Empty directories don't get added to the 'assets' directory, so
diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix.java b/platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix.java
index 2cc37b627a..3ee3478fcb 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix.java
@@ -120,7 +120,7 @@ public final class ProcessPhoenix extends Activity {
/**
* Checks if the current process is a temporary Phoenix Process.
- * This can be used to avoid initialisation of unused resources or to prevent running code that
+ * This can be used to avoid initialization of unused resources or to prevent running code that
* is not multi-process ready.
*
* @return true if the current process is a temporary Phoenix Process
diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp
index e6cdd7932a..1ee1cccb82 100644
--- a/platform/android/java_godot_lib_jni.cpp
+++ b/platform/android/java_godot_lib_jni.cpp
@@ -382,11 +382,11 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged(
}
// Called on the UI thread
-JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jclass clazz, jint p_keycode, jint p_physical_keycode, jint p_unicode, jboolean p_pressed) {
+JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jclass clazz, jint p_physical_keycode, jint p_unicode, jint p_key_label, jboolean p_pressed) {
if (step.get() <= 0) {
return;
}
- input_handler->process_key_event(p_keycode, p_physical_keycode, p_unicode, p_pressed);
+ input_handler->process_key_event(p_physical_keycode, p_unicode, p_key_label, p_pressed);
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_accelerometer(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z) {
diff --git a/platform/android/java_godot_lib_jni.h b/platform/android/java_godot_lib_jni.h
index 3f07a8cfe1..0020ddffd2 100644
--- a/platform/android/java_godot_lib_jni.h
+++ b/platform/android/java_godot_lib_jni.h
@@ -49,7 +49,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_dispatchMouseEvent(JN
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_dispatchTouchEvent(JNIEnv *env, jclass clazz, jint ev, jint pointer, jint pointer_count, jfloatArray positions, jboolean p_double_tap);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnify(JNIEnv *env, jclass clazz, jfloat p_x, jfloat p_y, jfloat p_factor);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_pan(JNIEnv *env, jclass clazz, jfloat p_x, jfloat p_y, jfloat p_delta_x, jfloat p_delta_y);
-JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jclass clazz, jint p_keycode, jint p_physical_keycode, jint p_unicode, jboolean p_pressed);
+JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jclass clazz, jint p_physical_keycode, jint p_unicode, jint p_key_label, jboolean p_pressed);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv *env, jclass clazz, jint p_device, jint p_button, jboolean p_pressed);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env, jclass clazz, jint p_device, jint p_axis, jfloat p_value);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, jclass clazz, jint p_device, jint p_hat_x, jint p_hat_y);
diff --git a/platform/android/java_godot_wrapper.cpp b/platform/android/java_godot_wrapper.cpp
index 03548d11f6..9d9d087896 100644
--- a/platform/android/java_godot_wrapper.cpp
+++ b/platform/android/java_godot_wrapper.cpp
@@ -60,7 +60,7 @@ GodotJavaWrapper::GodotJavaWrapper(JNIEnv *p_env, jobject p_activity, jobject p_
// get some Godot method pointers...
_on_video_init = p_env->GetMethodID(godot_class, "onVideoInit", "()Z");
_restart = p_env->GetMethodID(godot_class, "restart", "()V");
- _finish = p_env->GetMethodID(godot_class, "forceQuit", "()V");
+ _finish = p_env->GetMethodID(godot_class, "forceQuit", "(I)Z");
_set_keep_screen_on = p_env->GetMethodID(godot_class, "setKeepScreenOn", "(Z)V");
_alert = p_env->GetMethodID(godot_class, "alert", "(Ljava/lang/String;Ljava/lang/String;)V");
_get_GLES_version_code = p_env->GetMethodID(godot_class, "getGLESVersionCode", "()I");
@@ -77,7 +77,7 @@ GodotJavaWrapper::GodotJavaWrapper(JNIEnv *p_env, jobject p_activity, jobject p_
_get_input_fallback_mapping = p_env->GetMethodID(godot_class, "getInputFallbackMapping", "()Ljava/lang/String;");
_on_godot_setup_completed = p_env->GetMethodID(godot_class, "onGodotSetupCompleted", "()V");
_on_godot_main_loop_started = p_env->GetMethodID(godot_class, "onGodotMainLoopStarted", "()V");
- _create_new_godot_instance = p_env->GetMethodID(godot_class, "createNewGodotInstance", "([Ljava/lang/String;)V");
+ _create_new_godot_instance = p_env->GetMethodID(godot_class, "createNewGodotInstance", "([Ljava/lang/String;)I");
_get_render_view = p_env->GetMethodID(godot_class, "getRenderView", "()Lorg/godotengine/godot/GodotRenderView;");
// get some Activity method pointers...
@@ -179,14 +179,15 @@ void GodotJavaWrapper::restart(JNIEnv *p_env) {
}
}
-void GodotJavaWrapper::force_quit(JNIEnv *p_env) {
+bool GodotJavaWrapper::force_quit(JNIEnv *p_env, int p_instance_id) {
if (_finish) {
if (p_env == nullptr) {
p_env = get_jni_env();
}
- ERR_FAIL_NULL(p_env);
- p_env->CallVoidMethod(godot_instance, _finish);
+ ERR_FAIL_NULL_V(p_env, false);
+ return p_env->CallBooleanMethod(godot_instance, _finish, p_instance_id);
}
+ return false;
}
void GodotJavaWrapper::set_keep_screen_on(bool p_enabled) {
@@ -345,14 +346,16 @@ void GodotJavaWrapper::vibrate(int p_duration_ms) {
}
}
-void GodotJavaWrapper::create_new_godot_instance(List<String> args) {
+int GodotJavaWrapper::create_new_godot_instance(List<String> args) {
if (_create_new_godot_instance) {
JNIEnv *env = get_jni_env();
- ERR_FAIL_NULL(env);
+ ERR_FAIL_NULL_V(env, 0);
jobjectArray jargs = env->NewObjectArray(args.size(), env->FindClass("java/lang/String"), env->NewStringUTF(""));
for (int i = 0; i < args.size(); i++) {
env->SetObjectArrayElement(jargs, i, env->NewStringUTF(args[i].utf8().get_data()));
}
- env->CallVoidMethod(godot_instance, _create_new_godot_instance, jargs);
+ return env->CallIntMethod(godot_instance, _create_new_godot_instance, jargs);
+ } else {
+ return 0;
}
}
diff --git a/platform/android/java_godot_wrapper.h b/platform/android/java_godot_wrapper.h
index 5dad2a3eb9..1bd79584d8 100644
--- a/platform/android/java_godot_wrapper.h
+++ b/platform/android/java_godot_wrapper.h
@@ -85,7 +85,7 @@ public:
void on_godot_setup_completed(JNIEnv *p_env = nullptr);
void on_godot_main_loop_started(JNIEnv *p_env = nullptr);
void restart(JNIEnv *p_env = nullptr);
- void force_quit(JNIEnv *p_env = nullptr);
+ bool force_quit(JNIEnv *p_env = nullptr, int p_instance_id = 0);
void set_keep_screen_on(bool p_enabled);
void alert(const String &p_message, const String &p_title);
int get_gles_version_code();
@@ -103,7 +103,7 @@ public:
bool is_activity_resumed();
void vibrate(int p_duration_ms);
String get_input_fallback_mapping();
- void create_new_godot_instance(List<String> args);
+ int create_new_godot_instance(List<String> args);
};
#endif // JAVA_GODOT_WRAPPER_H
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 942bf0a904..725fea8d54 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -695,8 +695,8 @@ bool OS_Android::_check_internal_feature_support(const String &p_feature) {
}
OS_Android::OS_Android(GodotJavaWrapper *p_godot_java, GodotIOJavaWrapper *p_godot_io_java, bool p_use_apk_expansion) {
- display_size.width = 800;
- display_size.height = 600;
+ display_size.width = DEFAULT_WINDOW_WIDTH;
+ display_size.height = DEFAULT_WINDOW_HEIGHT;
use_apk_expansion = p_use_apk_expansion;
@@ -739,9 +739,19 @@ Error OS_Android::create_process(const String &p_path, const List<String> &p_arg
}
Error OS_Android::create_instance(const List<String> &p_arguments, ProcessID *r_child_id) {
- godot_java->create_new_godot_instance(p_arguments);
+ int instance_id = godot_java->create_new_godot_instance(p_arguments);
+ if (r_child_id) {
+ *r_child_id = instance_id;
+ }
return OK;
}
+Error OS_Android::kill(const ProcessID &p_pid) {
+ if (godot_java->force_quit(nullptr, p_pid)) {
+ return OK;
+ }
+ return OS_Unix::kill(p_pid);
+}
+
OS_Android::~OS_Android() {
}
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index 68b6fefe33..53910b1498 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -86,6 +86,8 @@ private:
public:
static const char *ANDROID_EXEC_PATH;
+ static const int DEFAULT_WINDOW_WIDTH = 800;
+ static const int DEFAULT_WINDOW_HEIGHT = 600;
virtual void initialize_core() override;
virtual void initialize() override;
@@ -156,6 +158,7 @@ public:
virtual Error execute(const String &p_path, const List<String> &p_arguments, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr, bool p_open_console = false) override;
virtual Error create_process(const String &p_path, const List<String> &p_arguments, ProcessID *r_child_id = nullptr, bool p_open_console = false) override;
virtual Error create_instance(const List<String> &p_arguments, ProcessID *r_child_id = nullptr) override;
+ virtual Error kill(const ProcessID &p_pid) override;
virtual bool _check_internal_feature_support(const String &p_feature) override;
OS_Android(GodotJavaWrapper *p_godot_java, GodotIOJavaWrapper *p_godot_io_java, bool p_use_apk_expansion);
diff --git a/platform/ios/SCsub b/platform/ios/SCsub
index bf12ab6dd7..f3925c146f 100644
--- a/platform/ios/SCsub
+++ b/platform/ios/SCsub
@@ -20,6 +20,7 @@ ios_lib = [
"godot_view_gesture_recognizer.mm",
"device_metrics.m",
"keyboard_input_view.mm",
+ "key_mapping_ios.mm",
]
env_ios = env.Clone()
diff --git a/platform/ios/detect.py b/platform/ios/detect.py
index 38e62134b5..71612cf1fa 100644
--- a/platform/ios/detect.py
+++ b/platform/ios/detect.py
@@ -99,8 +99,8 @@ def configure(env: "Environment"):
if env["ios_simulator"]:
detect_darwin_sdk_path("iossimulator", env)
- env.Append(ASFLAGS=["-mios-simulator-version-min=13.0"])
- env.Append(CCFLAGS=["-mios-simulator-version-min=13.0"])
+ env.Append(ASFLAGS=["-mios-simulator-version-min=11.0"])
+ env.Append(CCFLAGS=["-mios-simulator-version-min=11.0"])
env.extra_suffix = ".simulator" + env.extra_suffix
else:
detect_darwin_sdk_path("ios", env)
@@ -153,3 +153,11 @@ def configure(env: "Environment"):
if env["vulkan"]:
env.Append(CPPDEFINES=["VULKAN_ENABLED"])
+
+ if env["opengl3"]:
+ env.Append(CPPDEFINES=["GLES3_ENABLED"])
+ env.Prepend(
+ CPPPATH=[
+ "$IOS_SDK_PATH/System/Library/Frameworks/OpenGLES.framework/Headers",
+ ]
+ )
diff --git a/platform/ios/display_layer.h b/platform/ios/display_layer.h
index 10f42264df..e719a42cd9 100644
--- a/platform/ios/display_layer.h
+++ b/platform/ios/display_layer.h
@@ -33,7 +33,8 @@
@protocol DisplayLayer <NSObject>
-- (void)renderDisplayLayer;
+- (void)startRenderDisplayLayer;
+- (void)stopRenderDisplayLayer;
- (void)initializeDisplayLayer;
- (void)layoutDisplayLayer;
diff --git a/platform/ios/display_layer.mm b/platform/ios/display_layer.mm
index 24614fea56..3129ebb276 100644
--- a/platform/ios/display_layer.mm
+++ b/platform/ios/display_layer.mm
@@ -60,7 +60,10 @@
- (void)layoutDisplayLayer {
}
-- (void)renderDisplayLayer {
+- (void)startRenderDisplayLayer {
+}
+
+- (void)stopRenderDisplayLayer {
}
@end
@@ -76,8 +79,6 @@
}
- (void)initializeDisplayLayer {
- // Get our backing layer
-
// Configure it so that it is opaque, does not retain the contents of the backbuffer when displayed, and uses RGBA8888 color.
self.opaque = YES;
self.drawableProperties = [NSDictionary
@@ -87,8 +88,6 @@
kEAGLDrawablePropertyColorFormat,
nil];
- // FIXME: Add Vulkan support via MoltenVK. Add fallback code back?
-
// Create GL ES 3 context
if (GLOBAL_GET("rendering/renderer/rendering_method") == "gl_compatibility") {
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
@@ -115,8 +114,22 @@
[self createFramebuffer];
}
-- (void)renderDisplayLayer {
+- (void)startRenderDisplayLayer {
[EAGLContext setCurrentContext:context];
+
+ glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
+}
+
+- (void)stopRenderDisplayLayer {
+ glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
+ [context presentRenderbuffer:GL_RENDERBUFFER_OES];
+
+#ifdef DEBUG_ENABLED
+ GLenum err = glGetError();
+ if (err) {
+ NSLog(@"DrawView: %x error", err);
+ }
+#endif
}
- (void)dealloc {
@@ -154,11 +167,15 @@
return NO;
}
+ GLES3::TextureStorage::system_fbo = viewFramebuffer;
+
return YES;
}
// Clean up any buffers we have allocated.
- (void)destroyFramebuffer {
+ GLES3::TextureStorage::system_fbo = 0;
+
glDeleteFramebuffersOES(1, &viewFramebuffer);
viewFramebuffer = 0;
glDeleteRenderbuffersOES(1, &viewRenderbuffer);
diff --git a/platform/ios/display_server_ios.h b/platform/ios/display_server_ios.h
index dd1157f668..6eaa7c8edc 100644
--- a/platform/ios/display_server_ios.h
+++ b/platform/ios/display_server_ios.h
@@ -47,6 +47,10 @@
#endif
#endif
+#if defined(GLES3_ENABLED)
+#include "drivers/gles3/rasterizer_gles3.h"
+#endif // GLES3_ENABLED
+
#import <Foundation/Foundation.h>
#import <QuartzCore/CAMetalLayer.h>
@@ -109,11 +113,12 @@ public:
void touch_press(int p_idx, int p_x, int p_y, bool p_pressed, bool p_double_click);
void touch_drag(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_y, float p_pressure, Vector2 p_tilt);
- void touches_cancelled(int p_idx);
+ void touches_canceled(int p_idx);
// MARK: Keyboard
- void key(Key p_key, char32_t p_char, bool p_pressed);
+ void key(Key p_key, char32_t p_char, Key p_unshifted, Key p_physical, NSInteger p_modifier, bool p_pressed);
+ bool is_keyboard_active() const;
// MARK: Motion
@@ -216,6 +221,7 @@ public:
virtual bool screen_is_kept_on() const override;
void resize_window(CGSize size);
+ virtual void swap_buffers() override {}
};
#endif // DISPLAY_SERVER_IOS_H
diff --git a/platform/ios/display_server_ios.mm b/platform/ios/display_server_ios.mm
index 86ea602a98..469bc9be17 100644
--- a/platform/ios/display_server_ios.mm
+++ b/platform/ios/display_server_ios.mm
@@ -36,6 +36,7 @@
#import "device_metrics.h"
#import "godot_view.h"
#include "ios.h"
+#import "key_mapping_ios.h"
#import "keyboard_input_view.h"
#include "os_ios.h"
#include "tts_ios.h"
@@ -50,33 +51,14 @@ DisplayServerIOS *DisplayServerIOS::get_singleton() {
}
DisplayServerIOS::DisplayServerIOS(const String &p_rendering_driver, WindowMode p_mode, DisplayServer::VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Error &r_error) {
+ KeyMappingIOS::initialize();
+
rendering_driver = p_rendering_driver;
// Init TTS
tts = [[TTS_IOS alloc] init];
-#if defined(GLES3_ENABLED)
- if (rendering_driver == "opengl3") {
- bool gl_initialization_error = false;
-
- if (RasterizerGLES3::is_viable() == OK) {
- RasterizerGLES3::register_config();
- RasterizerGLES3::make_current();
- } else {
- gl_initialization_error = true;
- }
-
- if (gl_initialization_error) {
- OS::get_singleton()->alert(
- "Your device seems not to support the required OpenGL ES 3.0 version.\n\n",
- "Unable to initialize OpenGL video driver");
- }
- }
-#endif
-
#if defined(VULKAN_ENABLED)
- rendering_driver = "vulkan";
-
context_vulkan = nullptr;
rendering_device_vulkan = nullptr;
@@ -91,13 +73,14 @@ DisplayServerIOS::DisplayServerIOS(const String &p_rendering_driver, WindowMode
CALayer *layer = [AppDelegate.viewController.godotView initializeRenderingForDriver:@"vulkan"];
if (!layer) {
- ERR_FAIL_MSG("Failed to create iOS rendering layer.");
+ ERR_FAIL_MSG("Failed to create iOS Vulkan rendering layer.");
}
Size2i size = Size2i(layer.bounds.size.width, layer.bounds.size.height) * screen_get_max_scale();
if (context_vulkan->window_create(MAIN_WINDOW_ID, p_vsync_mode, layer, size.width, size.height) != OK) {
memdelete(context_vulkan);
context_vulkan = nullptr;
+ r_error = ERR_UNAVAILABLE;
ERR_FAIL_MSG("Failed to create Vulkan window.");
}
@@ -108,6 +91,18 @@ DisplayServerIOS::DisplayServerIOS(const String &p_rendering_driver, WindowMode
}
#endif
+#if defined(GLES3_ENABLED)
+ if (rendering_driver == "opengl3") {
+ CALayer *layer = [AppDelegate.viewController.godotView initializeRenderingForDriver:@"opengl3"];
+
+ if (!layer) {
+ ERR_FAIL_MSG("Failed to create iOS OpenGLES rendering layer.");
+ }
+
+ RasterizerGLES3::make_current();
+ }
+#endif
+
bool keep_screen_on = bool(GLOBAL_GET("display/window/energy_saving/keep_screen_on"));
screen_set_keep_on(keep_screen_on);
@@ -233,20 +228,35 @@ void DisplayServerIOS::perform_event(const Ref<InputEvent> &p_event) {
Input::get_singleton()->parse_input_event(p_event);
}
-void DisplayServerIOS::touches_cancelled(int p_idx) {
+void DisplayServerIOS::touches_canceled(int p_idx) {
touch_press(p_idx, -1, -1, false, false);
}
// MARK: Keyboard
-void DisplayServerIOS::key(Key p_key, char32_t p_char, bool p_pressed) {
+void DisplayServerIOS::key(Key p_key, char32_t p_char, Key p_unshifted, Key p_physical, NSInteger p_modifier, bool p_pressed) {
Ref<InputEventKey> ev;
ev.instantiate();
ev->set_echo(false);
ev->set_pressed(p_pressed);
- ev->set_keycode(p_key);
- ev->set_physical_keycode(p_key);
- ev->set_unicode(p_char);
+ ev->set_keycode(fix_keycode(p_char, p_key));
+ if (@available(iOS 13.4, *)) {
+ if (p_key != Key::SHIFT) {
+ ev->set_shift_pressed(p_modifier & UIKeyModifierShift);
+ }
+ if (p_key != Key::CTRL) {
+ ev->set_ctrl_pressed(p_modifier & UIKeyModifierControl);
+ }
+ if (p_key != Key::ALT) {
+ ev->set_alt_pressed(p_modifier & UIKeyModifierAlternate);
+ }
+ if (p_key != Key::META) {
+ ev->set_meta_pressed(p_modifier & UIKeyModifierCommand);
+ }
+ }
+ ev->set_key_label(p_unshifted);
+ ev->set_physical_keycode(p_physical);
+ ev->set_unicode(fix_unicode(p_char));
perform_event(ev);
}
@@ -624,6 +634,10 @@ void DisplayServerIOS::virtual_keyboard_show(const String &p_existing_text, cons
cursorEnd:_convert_utf32_offset_to_utf16(p_existing_text, p_cursor_end)];
}
+bool DisplayServerIOS::is_keyboard_active() const {
+ return [AppDelegate.viewController.keyboardView isFirstResponder];
+}
+
void DisplayServerIOS::virtual_keyboard_hide() {
[AppDelegate.viewController.keyboardView resignFirstResponder];
}
@@ -670,15 +684,18 @@ void DisplayServerIOS::resize_window(CGSize viewSize) {
void DisplayServerIOS::window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window) {
_THREAD_SAFE_METHOD_
#if defined(VULKAN_ENABLED)
- context_vulkan->set_vsync_mode(p_window, p_vsync_mode);
+ if (context_vulkan) {
+ context_vulkan->set_vsync_mode(p_window, p_vsync_mode);
+ }
#endif
}
DisplayServer::VSyncMode DisplayServerIOS::window_get_vsync_mode(WindowID p_window) const {
_THREAD_SAFE_METHOD_
#if defined(VULKAN_ENABLED)
- return context_vulkan->get_vsync_mode(p_window);
-#else
- return DisplayServer::VSYNC_ENABLED;
+ if (context_vulkan) {
+ return context_vulkan->get_vsync_mode(p_window);
+ }
#endif
+ return DisplayServer::VSYNC_ENABLED;
}
diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cpp
index 87b599bc81..c6f7ec09b1 100644
--- a/platform/ios/export/export_plugin.cpp
+++ b/platform/ios/export/export_plugin.cpp
@@ -43,6 +43,7 @@
void EditorExportPlatformIOS::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const {
// Vulkan and OpenGL ES 3.0 both mandate ETC2 support.
r_features->push_back("etc2");
+ r_features->push_back("astc");
Vector<String> architectures = _get_preset_architectures(p_preset);
for (int i = 0; i < architectures.size(); ++i) {
diff --git a/platform/ios/godot_view.mm b/platform/ios/godot_view.mm
index 1c8c578bd2..4b10f95ab8 100644
--- a/platform/ios/godot_view.mm
+++ b/platform/ios/godot_view.mm
@@ -74,16 +74,20 @@ static const float earth_gravity = 9.80665;
CALayer<DisplayLayer> *layer;
if ([driverName isEqualToString:@"vulkan"]) {
+#if defined(TARGET_OS_SIMULATOR) && TARGET_OS_SIMULATOR
+ if (@available(iOS 13, *)) {
+ layer = [GodotMetalLayer layer];
+ } else {
+ return nil;
+ }
+#else
layer = [GodotMetalLayer layer];
+#endif
} else if ([driverName isEqualToString:@"opengl3"]) {
if (@available(iOS 13, *)) {
NSLog(@"OpenGL ES is deprecated on iOS 13");
}
-#if defined(TARGET_OS_SIMULATOR) && TARGET_OS_SIMULATOR
- return nil;
-#else
layer = [GodotOpenGLLayer layer];
-#endif
} else {
return nil;
}
@@ -238,7 +242,7 @@ static const float earth_gravity = 9.80665;
[self.displayLink setPaused:NO];
}
- [self.renderingLayer renderDisplayLayer];
+ [self.renderingLayer startRenderDisplayLayer];
if (!self.renderer) {
return;
@@ -258,6 +262,8 @@ static const float earth_gravity = 9.80665;
[self handleMotion];
[self.renderer renderOnView:self];
+
+ [self.renderingLayer stopRenderDisplayLayer];
}
- (BOOL)canRender {
@@ -391,7 +397,7 @@ static const float earth_gravity = 9.80665;
UITouch *touch = [tlist objectAtIndex:i];
int tid = [self getTouchIDForTouch:touch];
ERR_FAIL_COND(tid == -1);
- DisplayServerIOS::get_singleton()->touches_cancelled(tid);
+ DisplayServerIOS::get_singleton()->touches_canceled(tid);
}
}
[self clearTouches];
diff --git a/editor/dictionary_property_edit.h b/platform/ios/key_mapping_ios.h
index 197bb394d4..6cc61175bb 100644
--- a/editor/dictionary_property_edit.h
+++ b/platform/ios/key_mapping_ios.h
@@ -1,5 +1,5 @@
/**************************************************************************/
-/* dictionary_property_edit.h */
+/* key_mapping_ios.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,37 +28,19 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
-#ifndef DICTIONARY_PROPERTY_EDIT_H
-#define DICTIONARY_PROPERTY_EDIT_H
+#ifndef KEY_MAPPING_IOS_H
+#define KEY_MAPPING_IOS_H
-#include "scene/main/node.h"
+#include "core/os/keyboard.h"
-class DictionaryPropertyEdit : public RefCounted {
- GDCLASS(DictionaryPropertyEdit, RefCounted);
+#import <UIKit/UIKit.h>
- ObjectID obj;
- StringName property;
-
- void _notif_change();
- void _set_key(const Variant &p_old_key, const Variant &p_new_key);
- void _set_value(const Variant &p_key, const Variant &p_value);
-
- Variant get_dictionary() const;
-
- bool _dont_undo_redo();
-
-protected:
- static void _bind_methods();
- bool _set(const StringName &p_name, const Variant &p_value);
- bool _get(const StringName &p_name, Variant &r_ret) const;
- void _get_property_list(List<PropertyInfo> *p_list) const;
+class KeyMappingIOS {
+ KeyMappingIOS() {}
public:
- void edit(Object *p_obj, const StringName &p_prop);
-
- Node *get_node();
-
- DictionaryPropertyEdit();
+ static void initialize();
+ static Key remap_key(CFIndex p_keycode);
};
-#endif // DICTIONARY_PROPERTY_EDIT_H
+#endif // KEY_MAPPING_IOS_H
diff --git a/platform/ios/key_mapping_ios.mm b/platform/ios/key_mapping_ios.mm
new file mode 100644
index 0000000000..c378186778
--- /dev/null
+++ b/platform/ios/key_mapping_ios.mm
@@ -0,0 +1,186 @@
+/**************************************************************************/
+/* key_mapping_ios.mm */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 "key_mapping_ios.h"
+
+#include "core/templates/hash_map.h"
+
+struct HashMapHasherKeys {
+ static _FORCE_INLINE_ uint32_t hash(const Key p_key) { return hash_fmix32(static_cast<uint32_t>(p_key)); }
+ static _FORCE_INLINE_ uint32_t hash(const CFIndex p_key) { return hash_fmix32(p_key); }
+};
+
+HashMap<CFIndex, Key, HashMapHasherKeys> keyusage_map;
+
+void KeyMappingIOS::initialize() {
+ if (@available(iOS 13.4, *)) {
+ keyusage_map[UIKeyboardHIDUsageKeyboardA] = Key::A;
+ keyusage_map[UIKeyboardHIDUsageKeyboardB] = Key::B;
+ keyusage_map[UIKeyboardHIDUsageKeyboardC] = Key::C;
+ keyusage_map[UIKeyboardHIDUsageKeyboardD] = Key::D;
+ keyusage_map[UIKeyboardHIDUsageKeyboardE] = Key::E;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF] = Key::F;
+ keyusage_map[UIKeyboardHIDUsageKeyboardG] = Key::G;
+ keyusage_map[UIKeyboardHIDUsageKeyboardH] = Key::H;
+ keyusage_map[UIKeyboardHIDUsageKeyboardI] = Key::I;
+ keyusage_map[UIKeyboardHIDUsageKeyboardJ] = Key::J;
+ keyusage_map[UIKeyboardHIDUsageKeyboardK] = Key::K;
+ keyusage_map[UIKeyboardHIDUsageKeyboardL] = Key::L;
+ keyusage_map[UIKeyboardHIDUsageKeyboardM] = Key::M;
+ keyusage_map[UIKeyboardHIDUsageKeyboardN] = Key::N;
+ keyusage_map[UIKeyboardHIDUsageKeyboardO] = Key::O;
+ keyusage_map[UIKeyboardHIDUsageKeyboardP] = Key::P;
+ keyusage_map[UIKeyboardHIDUsageKeyboardQ] = Key::Q;
+ keyusage_map[UIKeyboardHIDUsageKeyboardR] = Key::R;
+ keyusage_map[UIKeyboardHIDUsageKeyboardS] = Key::S;
+ keyusage_map[UIKeyboardHIDUsageKeyboardT] = Key::T;
+ keyusage_map[UIKeyboardHIDUsageKeyboardU] = Key::U;
+ keyusage_map[UIKeyboardHIDUsageKeyboardV] = Key::V;
+ keyusage_map[UIKeyboardHIDUsageKeyboardW] = Key::W;
+ keyusage_map[UIKeyboardHIDUsageKeyboardX] = Key::X;
+ keyusage_map[UIKeyboardHIDUsageKeyboardY] = Key::Y;
+ keyusage_map[UIKeyboardHIDUsageKeyboardZ] = Key::Z;
+ keyusage_map[UIKeyboardHIDUsageKeyboard0] = Key::KEY_0;
+ keyusage_map[UIKeyboardHIDUsageKeyboard1] = Key::KEY_1;
+ keyusage_map[UIKeyboardHIDUsageKeyboard2] = Key::KEY_2;
+ keyusage_map[UIKeyboardHIDUsageKeyboard3] = Key::KEY_3;
+ keyusage_map[UIKeyboardHIDUsageKeyboard4] = Key::KEY_4;
+ keyusage_map[UIKeyboardHIDUsageKeyboard5] = Key::KEY_5;
+ keyusage_map[UIKeyboardHIDUsageKeyboard6] = Key::KEY_6;
+ keyusage_map[UIKeyboardHIDUsageKeyboard7] = Key::KEY_7;
+ keyusage_map[UIKeyboardHIDUsageKeyboard8] = Key::KEY_8;
+ keyusage_map[UIKeyboardHIDUsageKeyboard9] = Key::KEY_9;
+ keyusage_map[UIKeyboardHIDUsageKeyboardBackslash] = Key::BACKSLASH;
+ keyusage_map[UIKeyboardHIDUsageKeyboardCloseBracket] = Key::BRACKETRIGHT;
+ keyusage_map[UIKeyboardHIDUsageKeyboardComma] = Key::COMMA;
+ keyusage_map[UIKeyboardHIDUsageKeyboardEqualSign] = Key::EQUAL;
+ keyusage_map[UIKeyboardHIDUsageKeyboardHyphen] = Key::MINUS;
+ keyusage_map[UIKeyboardHIDUsageKeyboardNonUSBackslash] = Key::SECTION;
+ keyusage_map[UIKeyboardHIDUsageKeyboardNonUSPound] = Key::ASCIITILDE;
+ keyusage_map[UIKeyboardHIDUsageKeyboardOpenBracket] = Key::BRACKETLEFT;
+ keyusage_map[UIKeyboardHIDUsageKeyboardPeriod] = Key::PERIOD;
+ keyusage_map[UIKeyboardHIDUsageKeyboardQuote] = Key::QUOTEDBL;
+ keyusage_map[UIKeyboardHIDUsageKeyboardSemicolon] = Key::SEMICOLON;
+ keyusage_map[UIKeyboardHIDUsageKeyboardSeparator] = Key::SECTION;
+ keyusage_map[UIKeyboardHIDUsageKeyboardSlash] = Key::SLASH;
+ keyusage_map[UIKeyboardHIDUsageKeyboardSpacebar] = Key::SPACE;
+ keyusage_map[UIKeyboardHIDUsageKeyboardCapsLock] = Key::CAPSLOCK;
+ keyusage_map[UIKeyboardHIDUsageKeyboardLeftAlt] = Key::ALT;
+ keyusage_map[UIKeyboardHIDUsageKeyboardLeftControl] = Key::CTRL;
+ keyusage_map[UIKeyboardHIDUsageKeyboardLeftShift] = Key::SHIFT;
+ keyusage_map[UIKeyboardHIDUsageKeyboardRightAlt] = Key::ALT;
+ keyusage_map[UIKeyboardHIDUsageKeyboardRightControl] = Key::CTRL;
+ keyusage_map[UIKeyboardHIDUsageKeyboardRightShift] = Key::SHIFT;
+ keyusage_map[UIKeyboardHIDUsageKeyboardScrollLock] = Key::SCROLLLOCK;
+ keyusage_map[UIKeyboardHIDUsageKeyboardLeftArrow] = Key::LEFT;
+ keyusage_map[UIKeyboardHIDUsageKeyboardRightArrow] = Key::RIGHT;
+ keyusage_map[UIKeyboardHIDUsageKeyboardUpArrow] = Key::UP;
+ keyusage_map[UIKeyboardHIDUsageKeyboardDownArrow] = Key::DOWN;
+ keyusage_map[UIKeyboardHIDUsageKeyboardPageUp] = Key::PAGEUP;
+ keyusage_map[UIKeyboardHIDUsageKeyboardPageDown] = Key::PAGEDOWN;
+ keyusage_map[UIKeyboardHIDUsageKeyboardHome] = Key::HOME;
+ keyusage_map[UIKeyboardHIDUsageKeyboardEnd] = Key::END;
+ keyusage_map[UIKeyboardHIDUsageKeyboardDeleteForward] = Key::KEY_DELETE;
+ keyusage_map[UIKeyboardHIDUsageKeyboardDeleteOrBackspace] = Key::BACKSPACE;
+ keyusage_map[UIKeyboardHIDUsageKeyboardEscape] = Key::ESCAPE;
+ keyusage_map[UIKeyboardHIDUsageKeyboardInsert] = Key::INSERT;
+ keyusage_map[UIKeyboardHIDUsageKeyboardReturn] = Key::ENTER;
+ keyusage_map[UIKeyboardHIDUsageKeyboardTab] = Key::TAB;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF1] = Key::F1;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF2] = Key::F2;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF3] = Key::F3;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF4] = Key::F4;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF5] = Key::F5;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF6] = Key::F6;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF7] = Key::F7;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF8] = Key::F8;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF9] = Key::F9;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF10] = Key::F10;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF11] = Key::F11;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF12] = Key::F12;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF13] = Key::F13;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF14] = Key::F14;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF15] = Key::F15;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF16] = Key::F16;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF17] = Key::F17;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF18] = Key::F18;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF19] = Key::F19;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF20] = Key::F20;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF21] = Key::F21;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF22] = Key::F22;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF23] = Key::F23;
+ keyusage_map[UIKeyboardHIDUsageKeyboardF24] = Key::F24;
+ keyusage_map[UIKeyboardHIDUsageKeypad0] = Key::KP_0;
+ keyusage_map[UIKeyboardHIDUsageKeypad1] = Key::KP_1;
+ keyusage_map[UIKeyboardHIDUsageKeypad2] = Key::KP_2;
+ keyusage_map[UIKeyboardHIDUsageKeypad3] = Key::KP_3;
+ keyusage_map[UIKeyboardHIDUsageKeypad4] = Key::KP_4;
+ keyusage_map[UIKeyboardHIDUsageKeypad5] = Key::KP_5;
+ keyusage_map[UIKeyboardHIDUsageKeypad6] = Key::KP_6;
+ keyusage_map[UIKeyboardHIDUsageKeypad7] = Key::KP_7;
+ keyusage_map[UIKeyboardHIDUsageKeypad8] = Key::KP_8;
+ keyusage_map[UIKeyboardHIDUsageKeypad9] = Key::KP_9;
+ keyusage_map[UIKeyboardHIDUsageKeypadAsterisk] = Key::KP_MULTIPLY;
+ keyusage_map[UIKeyboardHIDUsageKeyboardGraveAccentAndTilde] = Key::BAR;
+ keyusage_map[UIKeyboardHIDUsageKeypadEnter] = Key::KP_ENTER;
+ keyusage_map[UIKeyboardHIDUsageKeypadHyphen] = Key::KP_SUBTRACT;
+ keyusage_map[UIKeyboardHIDUsageKeypadNumLock] = Key::NUMLOCK;
+ keyusage_map[UIKeyboardHIDUsageKeypadPeriod] = Key::KP_PERIOD;
+ keyusage_map[UIKeyboardHIDUsageKeypadPlus] = Key::KP_ADD;
+ keyusage_map[UIKeyboardHIDUsageKeypadSlash] = Key::KP_DIVIDE;
+ keyusage_map[UIKeyboardHIDUsageKeyboardPause] = Key::PAUSE;
+ keyusage_map[UIKeyboardHIDUsageKeyboardStop] = Key::STOP;
+ keyusage_map[UIKeyboardHIDUsageKeyboardMute] = Key::VOLUMEMUTE;
+ keyusage_map[UIKeyboardHIDUsageKeyboardVolumeUp] = Key::VOLUMEUP;
+ keyusage_map[UIKeyboardHIDUsageKeyboardVolumeDown] = Key::VOLUMEDOWN;
+ keyusage_map[UIKeyboardHIDUsageKeyboardFind] = Key::SEARCH;
+ keyusage_map[UIKeyboardHIDUsageKeyboardHelp] = Key::HELP;
+ keyusage_map[UIKeyboardHIDUsageKeyboardLeftGUI] = Key::META;
+ keyusage_map[UIKeyboardHIDUsageKeyboardRightGUI] = Key::META;
+ keyusage_map[UIKeyboardHIDUsageKeyboardMenu] = Key::MENU;
+ keyusage_map[UIKeyboardHIDUsageKeyboardPrintScreen] = Key::PRINT;
+ keyusage_map[UIKeyboardHIDUsageKeyboardReturnOrEnter] = Key::ENTER;
+ keyusage_map[UIKeyboardHIDUsageKeyboardSysReqOrAttention] = Key::SYSREQ;
+ keyusage_map[0x01AE] = Key::KEYBOARD; // On-screen keyboard key on smart connector keyboard.
+ keyusage_map[0x029D] = Key::GLOBE; // "Globe" key on smart connector / Mac keyboard.
+ keyusage_map[UIKeyboardHIDUsageKeyboardLANG1] = Key::JIS_EISU;
+ keyusage_map[UIKeyboardHIDUsageKeyboardLANG2] = Key::JIS_KANA;
+ }
+}
+
+Key KeyMappingIOS::remap_key(CFIndex p_keycode) {
+ if (@available(iOS 13.4, *)) {
+ const Key *key = keyusage_map.getptr(p_keycode);
+ if (key) {
+ return *key;
+ }
+ }
+ return Key::NONE;
+}
diff --git a/platform/ios/keyboard_input_view.mm b/platform/ios/keyboard_input_view.mm
index f40db48ee3..2764403d68 100644
--- a/platform/ios/keyboard_input_view.mm
+++ b/platform/ios/keyboard_input_view.mm
@@ -115,8 +115,8 @@
- (void)deleteText:(NSInteger)charactersToDelete {
for (int i = 0; i < charactersToDelete; i++) {
- DisplayServerIOS::get_singleton()->key(Key::BACKSPACE, 0, true);
- DisplayServerIOS::get_singleton()->key(Key::BACKSPACE, 0, false);
+ DisplayServerIOS::get_singleton()->key(Key::BACKSPACE, 0, Key::BACKSPACE, Key::NONE, 0, true);
+ DisplayServerIOS::get_singleton()->key(Key::BACKSPACE, 0, Key::BACKSPACE, Key::NONE, 0, false);
}
}
@@ -134,20 +134,10 @@
key = Key::ENTER;
} else if (character == 0x2006) {
key = Key::SPACE;
- } else if (character == U'Â¥') {
- key = Key::YEN;
- } else if (character == U'§') {
- key = Key::SECTION;
- } else if (character >= 0x20 && character <= 0x7E) { // ASCII.
- if (character > 0x60 && character < 0x7B) { // Lowercase ASCII.
- key = (Key)(character - 32);
- } else {
- key = (Key)character;
- }
}
- DisplayServerIOS::get_singleton()->key(key, character, true);
- DisplayServerIOS::get_singleton()->key(key, character, false);
+ DisplayServerIOS::get_singleton()->key(key, character, key, Key::NONE, 0, true);
+ DisplayServerIOS::get_singleton()->key(key, character, key, Key::NONE, 0, false);
}
}
diff --git a/platform/ios/view_controller.mm b/platform/ios/view_controller.mm
index b787ed6709..a5aba201d7 100644
--- a/platform/ios/view_controller.mm
+++ b/platform/ios/view_controller.mm
@@ -33,6 +33,7 @@
#include "display_server_ios.h"
#import "godot_view.h"
#import "godot_view_renderer.h"
+#import "key_mapping_ios.h"
#import "keyboard_input_view.h"
#include "os_ios.h"
@@ -54,6 +55,64 @@
return (GodotView *)self.view;
}
+- (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event {
+ [super pressesBegan:presses withEvent:event];
+
+ if (!DisplayServerIOS::get_singleton() || DisplayServerIOS::get_singleton()->is_keyboard_active()) {
+ return;
+ }
+ if (@available(iOS 13.4, *)) {
+ for (UIPress *press in presses) {
+ String u32lbl = String::utf8([press.key.charactersIgnoringModifiers UTF8String]);
+ String u32text = String::utf8([press.key.characters UTF8String]);
+ Key key = KeyMappingIOS::remap_key(press.key.keyCode);
+
+ if (press.key.keyCode == 0 && u32text.is_empty() && u32lbl.is_empty()) {
+ continue;
+ }
+
+ char32_t us = 0;
+ if (!u32lbl.is_empty() && !u32lbl.begins_with("UIKey")) {
+ us = u32lbl[0];
+ }
+
+ if (!u32text.is_empty() && !u32text.begins_with("UIKey")) {
+ for (int i = 0; i < u32text.length(); i++) {
+ const char32_t c = u32text[i];
+ DisplayServerIOS::get_singleton()->key(fix_keycode(us, key), c, fix_key_label(us, key), key, press.key.modifierFlags, true);
+ }
+ } else {
+ DisplayServerIOS::get_singleton()->key(fix_keycode(us, key), 0, fix_key_label(us, key), key, press.key.modifierFlags, true);
+ }
+ }
+ }
+}
+
+- (void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event {
+ [super pressesEnded:presses withEvent:event];
+
+ if (!DisplayServerIOS::get_singleton() || DisplayServerIOS::get_singleton()->is_keyboard_active()) {
+ return;
+ }
+ if (@available(iOS 13.4, *)) {
+ for (UIPress *press in presses) {
+ String u32lbl = String::utf8([press.key.charactersIgnoringModifiers UTF8String]);
+ Key key = KeyMappingIOS::remap_key(press.key.keyCode);
+
+ if (press.key.keyCode == 0 && u32lbl.is_empty()) {
+ continue;
+ }
+
+ char32_t us = 0;
+ if (!u32lbl.is_empty() && !u32lbl.begins_with("UIKey")) {
+ us = u32lbl[0];
+ }
+
+ DisplayServerIOS::get_singleton()->key(fix_keycode(us, key), 0, fix_key_label(us, key), key, press.key.modifierFlags, false);
+ }
+ }
+}
+
- (void)loadView {
GodotView *view = [[GodotView alloc] init];
GodotViewRenderer *renderer = [[GodotViewRenderer alloc] init];
diff --git a/platform/linuxbsd/SCsub b/platform/linuxbsd/SCsub
index fcd739cdc9..3c5dc78c60 100644
--- a/platform/linuxbsd/SCsub
+++ b/platform/linuxbsd/SCsub
@@ -11,6 +11,7 @@ common_linuxbsd = [
"joypad_linux.cpp",
"freedesktop_portal_desktop.cpp",
"freedesktop_screensaver.cpp",
+ "xkbcommon-so_wrap.c",
]
if env["x11"]:
diff --git a/platform/linuxbsd/crash_handler_linuxbsd.cpp b/platform/linuxbsd/crash_handler_linuxbsd.cpp
index 8d03e3d31c..3a245460b4 100644
--- a/platform/linuxbsd/crash_handler_linuxbsd.cpp
+++ b/platform/linuxbsd/crash_handler_linuxbsd.cpp
@@ -81,7 +81,13 @@ static void handle_crash(int sig) {
print_error(vformat("Dumping the backtrace. %s", msg));
char **strings = backtrace_symbols(bt_buffer, size);
// PIE executable relocation, zero for non-PIE executables
+#ifdef __GLIBC__
+ // This is a glibc only thing apparently.
uintptr_t relocation = _r_debug.r_map->l_addr;
+#else
+ // Non glibc systems apparently don't give PIE relocation info.
+ uintptr_t relocation = 0;
+#endif //__GLIBC__
if (strings) {
List<String> args;
for (size_t i = 0; i < size; i++) {
diff --git a/platform/linuxbsd/dbus-so_wrap.c b/platform/linuxbsd/dbus-so_wrap.c
index 48d0d9b907..4aec9dc48f 100644
--- a/platform/linuxbsd/dbus-so_wrap.c
+++ b/platform/linuxbsd/dbus-so_wrap.c
@@ -1,7 +1,7 @@
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-07-29 07:23:21
-// flags: ./generate-wrapper.py --include /usr/include/dbus-1.0/dbus/dbus.h --sys-include <dbus/dbus.h> --soname libdbus-1.so.3 --init-name dbus --output-header dbus-so_wrap.h --output-implementation dbus-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-12 10:26:35
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/dbus/dbus.h --sys-include "thirdparty/linuxbsd_headers/dbus/dbus.h" --soname libdbus-1.so.3 --init-name dbus --output-header ./platform/linuxbsd/dbus-so_wrap.h --output-implementation ./platform/linuxbsd/dbus-so_wrap.c
//
#include <stdint.h>
@@ -243,7 +243,7 @@
#define dbus_validate_utf8 dbus_validate_utf8_dylibloader_orig_dbus
#define dbus_threads_init dbus_threads_init_dylibloader_orig_dbus
#define dbus_threads_init_default dbus_threads_init_default_dylibloader_orig_dbus
-#include <dbus/dbus.h>
+#include "thirdparty/linuxbsd_headers/dbus/dbus.h"
#undef dbus_error_init
#undef dbus_error_free
#undef dbus_set_error
diff --git a/platform/linuxbsd/dbus-so_wrap.h b/platform/linuxbsd/dbus-so_wrap.h
index 52e1dd300c..2c63757932 100644
--- a/platform/linuxbsd/dbus-so_wrap.h
+++ b/platform/linuxbsd/dbus-so_wrap.h
@@ -2,8 +2,8 @@
#define DYLIBLOAD_WRAPPER_DBUS
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-07-29 07:23:21
-// flags: ./generate-wrapper.py --include /usr/include/dbus-1.0/dbus/dbus.h --sys-include <dbus/dbus.h> --soname libdbus-1.so --init-name dbus --output-header dbus-so_wrap.h --output-implementation dbus-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-12 10:26:35
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/dbus/dbus.h --sys-include "thirdparty/linuxbsd_headers/dbus/dbus.h" --soname libdbus-1.so.3 --init-name dbus --output-header ./platform/linuxbsd/dbus-so_wrap.h --output-implementation ./platform/linuxbsd/dbus-so_wrap.c
//
#include <stdint.h>
@@ -245,7 +245,7 @@
#define dbus_validate_utf8 dbus_validate_utf8_dylibloader_orig_dbus
#define dbus_threads_init dbus_threads_init_dylibloader_orig_dbus
#define dbus_threads_init_default dbus_threads_init_default_dylibloader_orig_dbus
-#include <dbus/dbus.h>
+#include "thirdparty/linuxbsd_headers/dbus/dbus.h"
#undef dbus_error_init
#undef dbus_error_free
#undef dbus_set_error
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index f4d36f1a87..36e149f2b4 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -43,10 +43,11 @@ def get_opts():
BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN)", False),
BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN)", False),
BoolVariable("use_msan", "Use LLVM compiler memory sanitizer (MSAN)", False),
- BoolVariable("pulseaudio", "Detect and use PulseAudio", True),
- BoolVariable("dbus", "Detect and use D-Bus to handle screensaver and portal desktop settings", True),
- BoolVariable("speechd", "Detect and use Speech Dispatcher for Text-to-Speech support", True),
- BoolVariable("fontconfig", "Detect and use fontconfig for system fonts support", True),
+ BoolVariable("alsa", "Use ALSA", True),
+ BoolVariable("pulseaudio", "Use PulseAudio", True),
+ BoolVariable("dbus", "Use D-Bus to handle screensaver and portal desktop settings", True),
+ BoolVariable("speechd", "Use Speech Dispatcher for Text-to-Speech support", True),
+ BoolVariable("fontconfig", "Use fontconfig for system fonts support", True),
BoolVariable("udev", "Use udev for gamepad connection callbacks", True),
BoolVariable("x11", "Enable X11 display", True),
BoolVariable("touch", "Enable touch events", True),
@@ -183,16 +184,6 @@ def configure(env: "Environment"):
## Dependencies
- if env["x11"]:
- # Only cflags, we dlopen the libraries.
- env.ParseConfig("pkg-config x11 --cflags")
- env.ParseConfig("pkg-config xcursor --cflags")
- env.ParseConfig("pkg-config xinerama --cflags")
- env.ParseConfig("pkg-config xext --cflags")
- env.ParseConfig("pkg-config xrandr --cflags")
- env.ParseConfig("pkg-config xrender --cflags")
- env.ParseConfig("pkg-config xi --cflags")
-
if env["touch"]:
env.Append(CPPDEFINES=["TOUCH_ENABLED"])
@@ -271,7 +262,7 @@ def configure(env: "Environment"):
env.Append(LIBS=["miniupnpc"])
# On Linux wchar_t should be 32-bits
- # 16-bit library shouldn't be required due to compiler optimisations
+ # 16-bit library shouldn't be required due to compiler optimizations
if not env["builtin_pcre2"]:
env.ParseConfig("pkg-config libpcre2-32 --cflags --libs")
@@ -282,53 +273,24 @@ def configure(env: "Environment"):
## Flags
if env["fontconfig"]:
- if os.system("pkg-config --exists fontconfig") == 0: # 0 means found
- env.Append(CPPDEFINES=["FONTCONFIG_ENABLED"])
- env.ParseConfig("pkg-config fontconfig --cflags") # Only cflags, we dlopen the library.
- else:
- env["fontconfig"] = False
- print("Warning: fontconfig libraries not found. Disabling the system fonts support.")
+ env.Append(CPPDEFINES=["FONTCONFIG_ENABLED"])
- if os.system("pkg-config --exists alsa") == 0: # 0 means found
- env["alsa"] = True
+ if env["alsa"]:
env.Append(CPPDEFINES=["ALSA_ENABLED", "ALSAMIDI_ENABLED"])
- env.ParseConfig("pkg-config alsa --cflags") # Only cflags, we dlopen the library.
- else:
- print("Warning: ALSA libraries not found. Disabling the ALSA audio driver.")
if env["pulseaudio"]:
- if os.system("pkg-config --exists libpulse") == 0: # 0 means found
- env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED"])
- env.ParseConfig("pkg-config libpulse --cflags") # Only cflags, we dlopen the library.
- else:
- env["pulseaudio"] = False
- print("Warning: PulseAudio development libraries not found. Disabling the PulseAudio audio driver.")
+ env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED", "_REENTRANT"])
if env["dbus"]:
- if os.system("pkg-config --exists dbus-1") == 0: # 0 means found
- env.Append(CPPDEFINES=["DBUS_ENABLED"])
- env.ParseConfig("pkg-config dbus-1 --cflags") # Only cflags, we dlopen the library.
- else:
- env["dbus"] = False
- print("Warning: D-Bus development libraries not found. Disabling screensaver prevention.")
+ env.Append(CPPDEFINES=["DBUS_ENABLED"])
if env["speechd"]:
- if os.system("pkg-config --exists speech-dispatcher") == 0: # 0 means found
- env.Append(CPPDEFINES=["SPEECHD_ENABLED"])
- env.ParseConfig("pkg-config speech-dispatcher --cflags") # Only cflags, we dlopen the library.
- else:
- env["speechd"] = False
- print("Warning: Speech Dispatcher development libraries not found. Disabling Text-to-Speech support.")
+ env.Append(CPPDEFINES=["SPEECHD_ENABLED"])
if platform.system() == "Linux":
env.Append(CPPDEFINES=["JOYDEV_ENABLED"])
if env["udev"]:
- if os.system("pkg-config --exists libudev") == 0: # 0 means found
- env.Append(CPPDEFINES=["UDEV_ENABLED"])
- env.ParseConfig("pkg-config libudev --cflags") # Only cflags, we dlopen the library.
- else:
- env["udev"] = False
- print("Warning: libudev development libraries not found. Disabling controller hotplugging support.")
+ env.Append(CPPDEFINES=["UDEV_ENABLED"])
else:
env["udev"] = False # Linux specific
@@ -336,7 +298,7 @@ def configure(env: "Environment"):
if not env["builtin_zlib"]:
env.ParseConfig("pkg-config zlib --cflags --libs")
- env.Prepend(CPPPATH=["#platform/linuxbsd"])
+ env.Prepend(CPPPATH=["#platform/linuxbsd", "#thirdparty/linuxbsd_headers"])
env.Append(
CPPDEFINES=[
@@ -405,9 +367,9 @@ def configure(env: "Environment"):
# Link those statically for portability
if env["use_static_cpp"]:
env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"])
- if env["use_llvm"]:
+ if env["use_llvm"] and platform.system() != "FreeBSD":
env["LINKCOM"] = env["LINKCOM"] + " -l:libatomic.a"
else:
- if env["use_llvm"]:
+ if env["use_llvm"] and platform.system() != "FreeBSD":
env.Append(LIBS=["atomic"])
diff --git a/platform/linuxbsd/export/export_plugin.cpp b/platform/linuxbsd/export/export_plugin.cpp
index c900cad007..2528bb2b99 100644
--- a/platform/linuxbsd/export/export_plugin.cpp
+++ b/platform/linuxbsd/export/export_plugin.cpp
@@ -378,8 +378,8 @@ Error EditorExportPlatformLinuxBSD::run(const Ref<EditorExportPreset> &p_preset,
if (port.is_empty()) {
port = "22";
}
- Vector<String> extra_args_ssh = p_preset->get("ssh_remote_deploy/extra_args_ssh").operator String().split(" ");
- Vector<String> extra_args_scp = p_preset->get("ssh_remote_deploy/extra_args_scp").operator String().split(" ");
+ Vector<String> extra_args_ssh = p_preset->get("ssh_remote_deploy/extra_args_ssh").operator String().split(" ", false);
+ Vector<String> extra_args_scp = p_preset->get("ssh_remote_deploy/extra_args_scp").operator String().split(" ", false);
const String basepath = dest.path_join("tmp_linuxbsd_export");
diff --git a/platform/linuxbsd/fontconfig-so_wrap.c b/platform/linuxbsd/fontconfig-so_wrap.c
index 62901b14a9..86aacbc647 100644
--- a/platform/linuxbsd/fontconfig-so_wrap.c
+++ b/platform/linuxbsd/fontconfig-so_wrap.c
@@ -1,7 +1,7 @@
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-11-22 10:28:00
-// flags: ./generate-wrapper.py --include /usr/include/fontconfig/fontconfig.h --sys-include <fontconfig/fontconfig.h> --soname libfontconfig.so.1 --init-name fontconfig --output-header fontconfig-so_wrap.h --output-implementation fontconfig-so_wrap.c --omit-prefix FcCharSetFirst --omit-prefix FcCharSetNext
+// generated by generate-wrapper.py 0.3 on 2023-01-12 10:15:54
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/fontconfig/fontconfig.h --sys-include "thirdparty/linuxbsd_headers/fontconfig/fontconfig.h" --soname libfontconfig.so.1 --init-name fontconfig --omit-prefix FcCharSetFirst --omit-prefix FcCharSetNext --output-header ./platform/linuxbsd/fontconfig-so_wrap.h --output-implementation ./platform/linuxbsd/fontconfig-so_wrap.c
//
#include <stdint.h>
@@ -18,8 +18,6 @@
#define FcDirCacheValid FcDirCacheValid_dylibloader_orig_fontconfig
#define FcDirCacheClean FcDirCacheClean_dylibloader_orig_fontconfig
#define FcCacheCreateTagFile FcCacheCreateTagFile_dylibloader_orig_fontconfig
-#define FcDirCacheCreateUUID FcDirCacheCreateUUID_dylibloader_orig_fontconfig
-#define FcDirCacheDeleteUUID FcDirCacheDeleteUUID_dylibloader_orig_fontconfig
#define FcConfigHome FcConfigHome_dylibloader_orig_fontconfig
#define FcConfigEnableHome FcConfigEnableHome_dylibloader_orig_fontconfig
#define FcConfigFilename FcConfigFilename_dylibloader_orig_fontconfig
@@ -46,9 +44,6 @@
#define FcConfigSubstitute FcConfigSubstitute_dylibloader_orig_fontconfig
#define FcConfigGetSysRoot FcConfigGetSysRoot_dylibloader_orig_fontconfig
#define FcConfigSetSysRoot FcConfigSetSysRoot_dylibloader_orig_fontconfig
-#define FcConfigFileInfoIterInit FcConfigFileInfoIterInit_dylibloader_orig_fontconfig
-#define FcConfigFileInfoIterNext FcConfigFileInfoIterNext_dylibloader_orig_fontconfig
-#define FcConfigFileInfoIterGet FcConfigFileInfoIterGet_dylibloader_orig_fontconfig
#define FcCharSetCreate FcCharSetCreate_dylibloader_orig_fontconfig
#define FcCharSetNew FcCharSetNew_dylibloader_orig_fontconfig
#define FcCharSetDestroy FcCharSetDestroy_dylibloader_orig_fontconfig
@@ -81,7 +76,6 @@
#define FcDirCacheLoadFile FcDirCacheLoadFile_dylibloader_orig_fontconfig
#define FcDirCacheUnload FcDirCacheUnload_dylibloader_orig_fontconfig
#define FcFreeTypeQuery FcFreeTypeQuery_dylibloader_orig_fontconfig
-#define FcFreeTypeQueryAll FcFreeTypeQueryAll_dylibloader_orig_fontconfig
#define FcFontSetCreate FcFontSetCreate_dylibloader_orig_fontconfig
#define FcFontSetDestroy FcFontSetDestroy_dylibloader_orig_fontconfig
#define FcFontSetAdd FcFontSetAdd_dylibloader_orig_fontconfig
@@ -152,7 +146,6 @@
#define FcValueEqual FcValueEqual_dylibloader_orig_fontconfig
#define FcValueSave FcValueSave_dylibloader_orig_fontconfig
#define FcPatternDestroy FcPatternDestroy_dylibloader_orig_fontconfig
-#define FcPatternObjectCount FcPatternObjectCount_dylibloader_orig_fontconfig
#define FcPatternEqual FcPatternEqual_dylibloader_orig_fontconfig
#define FcPatternEqualSubset FcPatternEqualSubset_dylibloader_orig_fontconfig
#define FcPatternHash FcPatternHash_dylibloader_orig_fontconfig
@@ -186,18 +179,8 @@
#define FcRangeDestroy FcRangeDestroy_dylibloader_orig_fontconfig
#define FcRangeCopy FcRangeCopy_dylibloader_orig_fontconfig
#define FcRangeGetDouble FcRangeGetDouble_dylibloader_orig_fontconfig
-#define FcPatternIterStart FcPatternIterStart_dylibloader_orig_fontconfig
-#define FcPatternIterNext FcPatternIterNext_dylibloader_orig_fontconfig
-#define FcPatternIterEqual FcPatternIterEqual_dylibloader_orig_fontconfig
-#define FcPatternFindIter FcPatternFindIter_dylibloader_orig_fontconfig
-#define FcPatternIterIsValid FcPatternIterIsValid_dylibloader_orig_fontconfig
-#define FcPatternIterGetObject FcPatternIterGetObject_dylibloader_orig_fontconfig
-#define FcPatternIterValueCount FcPatternIterValueCount_dylibloader_orig_fontconfig
-#define FcPatternIterGetValue FcPatternIterGetValue_dylibloader_orig_fontconfig
#define FcWeightFromOpenType FcWeightFromOpenType_dylibloader_orig_fontconfig
-#define FcWeightFromOpenTypeDouble FcWeightFromOpenTypeDouble_dylibloader_orig_fontconfig
#define FcWeightToOpenType FcWeightToOpenType_dylibloader_orig_fontconfig
-#define FcWeightToOpenTypeDouble FcWeightToOpenTypeDouble_dylibloader_orig_fontconfig
#define FcStrCopy FcStrCopy_dylibloader_orig_fontconfig
#define FcStrCopyFilename FcStrCopyFilename_dylibloader_orig_fontconfig
#define FcStrPlus FcStrPlus_dylibloader_orig_fontconfig
@@ -227,7 +210,7 @@
#define FcStrListDone FcStrListDone_dylibloader_orig_fontconfig
#define FcConfigParseAndLoad FcConfigParseAndLoad_dylibloader_orig_fontconfig
#define FcConfigParseAndLoadFromMemory FcConfigParseAndLoadFromMemory_dylibloader_orig_fontconfig
-#include <fontconfig/fontconfig.h>
+#include "thirdparty/linuxbsd_headers/fontconfig/fontconfig.h"
#undef FcBlanksCreate
#undef FcBlanksDestroy
#undef FcBlanksAdd
@@ -241,8 +224,6 @@
#undef FcDirCacheValid
#undef FcDirCacheClean
#undef FcCacheCreateTagFile
-#undef FcDirCacheCreateUUID
-#undef FcDirCacheDeleteUUID
#undef FcConfigHome
#undef FcConfigEnableHome
#undef FcConfigFilename
@@ -269,9 +250,6 @@
#undef FcConfigSubstitute
#undef FcConfigGetSysRoot
#undef FcConfigSetSysRoot
-#undef FcConfigFileInfoIterInit
-#undef FcConfigFileInfoIterNext
-#undef FcConfigFileInfoIterGet
#undef FcCharSetCreate
#undef FcCharSetNew
#undef FcCharSetDestroy
@@ -304,7 +282,6 @@
#undef FcDirCacheLoadFile
#undef FcDirCacheUnload
#undef FcFreeTypeQuery
-#undef FcFreeTypeQueryAll
#undef FcFontSetCreate
#undef FcFontSetDestroy
#undef FcFontSetAdd
@@ -375,7 +352,6 @@
#undef FcValueEqual
#undef FcValueSave
#undef FcPatternDestroy
-#undef FcPatternObjectCount
#undef FcPatternEqual
#undef FcPatternEqualSubset
#undef FcPatternHash
@@ -409,18 +385,8 @@
#undef FcRangeDestroy
#undef FcRangeCopy
#undef FcRangeGetDouble
-#undef FcPatternIterStart
-#undef FcPatternIterNext
-#undef FcPatternIterEqual
-#undef FcPatternFindIter
-#undef FcPatternIterIsValid
-#undef FcPatternIterGetObject
-#undef FcPatternIterValueCount
-#undef FcPatternIterGetValue
#undef FcWeightFromOpenType
-#undef FcWeightFromOpenTypeDouble
#undef FcWeightToOpenType
-#undef FcWeightToOpenTypeDouble
#undef FcStrCopy
#undef FcStrCopyFilename
#undef FcStrPlus
@@ -465,8 +431,6 @@ FcBool (*FcDirCacheUnlink_dylibloader_wrapper_fontconfig)(const FcChar8*, FcConf
FcBool (*FcDirCacheValid_dylibloader_wrapper_fontconfig)(const FcChar8*);
FcBool (*FcDirCacheClean_dylibloader_wrapper_fontconfig)(const FcChar8*, FcBool);
void (*FcCacheCreateTagFile_dylibloader_wrapper_fontconfig)(const FcConfig*);
-FcBool (*FcDirCacheCreateUUID_dylibloader_wrapper_fontconfig)( FcChar8*, FcBool, FcConfig*);
-FcBool (*FcDirCacheDeleteUUID_dylibloader_wrapper_fontconfig)(const FcChar8*, FcConfig*);
FcChar8* (*FcConfigHome_dylibloader_wrapper_fontconfig)( void);
FcBool (*FcConfigEnableHome_dylibloader_wrapper_fontconfig)( FcBool);
FcChar8* (*FcConfigFilename_dylibloader_wrapper_fontconfig)(const FcChar8*);
@@ -493,9 +457,6 @@ FcBool (*FcConfigSubstituteWithPat_dylibloader_wrapper_fontconfig)( FcConfig*, F
FcBool (*FcConfigSubstitute_dylibloader_wrapper_fontconfig)( FcConfig*, FcPattern*, FcMatchKind);
const FcChar8* (*FcConfigGetSysRoot_dylibloader_wrapper_fontconfig)(const FcConfig*);
void (*FcConfigSetSysRoot_dylibloader_wrapper_fontconfig)( FcConfig*,const FcChar8*);
-void (*FcConfigFileInfoIterInit_dylibloader_wrapper_fontconfig)( FcConfig*, FcConfigFileInfoIter*);
-FcBool (*FcConfigFileInfoIterNext_dylibloader_wrapper_fontconfig)( FcConfig*, FcConfigFileInfoIter*);
-FcBool (*FcConfigFileInfoIterGet_dylibloader_wrapper_fontconfig)( FcConfig*, FcConfigFileInfoIter*, FcChar8**, FcChar8**, FcBool*);
FcCharSet* (*FcCharSetCreate_dylibloader_wrapper_fontconfig)( void);
FcCharSet* (*FcCharSetNew_dylibloader_wrapper_fontconfig)( void);
void (*FcCharSetDestroy_dylibloader_wrapper_fontconfig)( FcCharSet*);
@@ -527,8 +488,7 @@ FcCache* (*FcDirCacheRescan_dylibloader_wrapper_fontconfig)(const FcChar8*, FcCo
FcCache* (*FcDirCacheRead_dylibloader_wrapper_fontconfig)(const FcChar8*, FcBool, FcConfig*);
FcCache* (*FcDirCacheLoadFile_dylibloader_wrapper_fontconfig)(const FcChar8*,struct stat*);
void (*FcDirCacheUnload_dylibloader_wrapper_fontconfig)( FcCache*);
-FcPattern* (*FcFreeTypeQuery_dylibloader_wrapper_fontconfig)(const FcChar8*, unsigned int, FcBlanks*, int*);
-unsigned int (*FcFreeTypeQueryAll_dylibloader_wrapper_fontconfig)(const FcChar8*, unsigned int, FcBlanks*, int*, FcFontSet*);
+FcPattern* (*FcFreeTypeQuery_dylibloader_wrapper_fontconfig)(const FcChar8*, int, FcBlanks*, int*);
FcFontSet* (*FcFontSetCreate_dylibloader_wrapper_fontconfig)( void);
void (*FcFontSetDestroy_dylibloader_wrapper_fontconfig)( FcFontSet*);
FcBool (*FcFontSetAdd_dylibloader_wrapper_fontconfig)( FcFontSet*, FcPattern*);
@@ -599,7 +559,6 @@ void (*FcValueDestroy_dylibloader_wrapper_fontconfig)( FcValue);
FcBool (*FcValueEqual_dylibloader_wrapper_fontconfig)( FcValue, FcValue);
FcValue (*FcValueSave_dylibloader_wrapper_fontconfig)( FcValue);
void (*FcPatternDestroy_dylibloader_wrapper_fontconfig)( FcPattern*);
-int (*FcPatternObjectCount_dylibloader_wrapper_fontconfig)(const FcPattern*);
FcBool (*FcPatternEqual_dylibloader_wrapper_fontconfig)(const FcPattern*,const FcPattern*);
FcBool (*FcPatternEqualSubset_dylibloader_wrapper_fontconfig)(const FcPattern*,const FcPattern*,const FcObjectSet*);
FcChar32 (*FcPatternHash_dylibloader_wrapper_fontconfig)(const FcPattern*);
@@ -633,18 +592,8 @@ FcRange* (*FcRangeCreateInteger_dylibloader_wrapper_fontconfig)( FcChar32, FcCha
void (*FcRangeDestroy_dylibloader_wrapper_fontconfig)( FcRange*);
FcRange* (*FcRangeCopy_dylibloader_wrapper_fontconfig)(const FcRange*);
FcBool (*FcRangeGetDouble_dylibloader_wrapper_fontconfig)(const FcRange*, double*, double*);
-void (*FcPatternIterStart_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*);
-FcBool (*FcPatternIterNext_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*);
-FcBool (*FcPatternIterEqual_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*,const FcPattern*, FcPatternIter*);
-FcBool (*FcPatternFindIter_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*,const char*);
-FcBool (*FcPatternIterIsValid_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*);
-const char* (*FcPatternIterGetObject_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*);
-int (*FcPatternIterValueCount_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*);
-FcResult (*FcPatternIterGetValue_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*, int, FcValue*, FcValueBinding*);
int (*FcWeightFromOpenType_dylibloader_wrapper_fontconfig)( int);
-double (*FcWeightFromOpenTypeDouble_dylibloader_wrapper_fontconfig)( double);
int (*FcWeightToOpenType_dylibloader_wrapper_fontconfig)( int);
-double (*FcWeightToOpenTypeDouble_dylibloader_wrapper_fontconfig)( double);
FcChar8* (*FcStrCopy_dylibloader_wrapper_fontconfig)(const FcChar8*);
FcChar8* (*FcStrCopyFilename_dylibloader_wrapper_fontconfig)(const FcChar8*);
FcChar8* (*FcStrPlus_dylibloader_wrapper_fontconfig)(const FcChar8*,const FcChar8*);
@@ -789,22 +738,6 @@ int initialize_fontconfig(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// FcDirCacheCreateUUID
- *(void **) (&FcDirCacheCreateUUID_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcDirCacheCreateUUID");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// FcDirCacheDeleteUUID
- *(void **) (&FcDirCacheDeleteUUID_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcDirCacheDeleteUUID");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// FcConfigHome
*(void **) (&FcConfigHome_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcConfigHome");
if (verbose) {
@@ -1013,30 +946,6 @@ int initialize_fontconfig(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// FcConfigFileInfoIterInit
- *(void **) (&FcConfigFileInfoIterInit_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcConfigFileInfoIterInit");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// FcConfigFileInfoIterNext
- *(void **) (&FcConfigFileInfoIterNext_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcConfigFileInfoIterNext");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// FcConfigFileInfoIterGet
- *(void **) (&FcConfigFileInfoIterGet_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcConfigFileInfoIterGet");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// FcCharSetCreate
*(void **) (&FcCharSetCreate_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcCharSetCreate");
if (verbose) {
@@ -1293,14 +1202,6 @@ int initialize_fontconfig(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// FcFreeTypeQueryAll
- *(void **) (&FcFreeTypeQueryAll_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcFreeTypeQueryAll");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// FcFontSetCreate
*(void **) (&FcFontSetCreate_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcFontSetCreate");
if (verbose) {
@@ -1861,14 +1762,6 @@ int initialize_fontconfig(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// FcPatternObjectCount
- *(void **) (&FcPatternObjectCount_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternObjectCount");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// FcPatternEqual
*(void **) (&FcPatternEqual_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternEqual");
if (verbose) {
@@ -2133,70 +2026,6 @@ int initialize_fontconfig(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// FcPatternIterStart
- *(void **) (&FcPatternIterStart_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternIterStart");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// FcPatternIterNext
- *(void **) (&FcPatternIterNext_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternIterNext");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// FcPatternIterEqual
- *(void **) (&FcPatternIterEqual_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternIterEqual");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// FcPatternFindIter
- *(void **) (&FcPatternFindIter_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternFindIter");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// FcPatternIterIsValid
- *(void **) (&FcPatternIterIsValid_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternIterIsValid");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// FcPatternIterGetObject
- *(void **) (&FcPatternIterGetObject_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternIterGetObject");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// FcPatternIterValueCount
- *(void **) (&FcPatternIterValueCount_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternIterValueCount");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// FcPatternIterGetValue
- *(void **) (&FcPatternIterGetValue_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcPatternIterGetValue");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// FcWeightFromOpenType
*(void **) (&FcWeightFromOpenType_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcWeightFromOpenType");
if (verbose) {
@@ -2205,14 +2034,6 @@ int initialize_fontconfig(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// FcWeightFromOpenTypeDouble
- *(void **) (&FcWeightFromOpenTypeDouble_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcWeightFromOpenTypeDouble");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// FcWeightToOpenType
*(void **) (&FcWeightToOpenType_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcWeightToOpenType");
if (verbose) {
@@ -2221,14 +2042,6 @@ int initialize_fontconfig(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// FcWeightToOpenTypeDouble
- *(void **) (&FcWeightToOpenTypeDouble_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcWeightToOpenTypeDouble");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// FcStrCopy
*(void **) (&FcStrCopy_dylibloader_wrapper_fontconfig) = dlsym(handle, "FcStrCopy");
if (verbose) {
diff --git a/platform/linuxbsd/fontconfig-so_wrap.h b/platform/linuxbsd/fontconfig-so_wrap.h
index 0c8259deb7..956c094711 100644
--- a/platform/linuxbsd/fontconfig-so_wrap.h
+++ b/platform/linuxbsd/fontconfig-so_wrap.h
@@ -2,8 +2,8 @@
#define DYLIBLOAD_WRAPPER_FONTCONFIG
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-11-22 10:28:00
-// flags: ./generate-wrapper.py --include /usr/include/fontconfig/fontconfig.h --sys-include <fontconfig/fontconfig.h> --soname libfontconfig.so --init-name fontconfig --output-header fontconfig-so_wrap.h --output-implementation fontconfig-so_wrap.c --omit-prefix FcCharSetFirst --omit-prefix FcCharSetNext
+// generated by generate-wrapper.py 0.3 on 2023-01-12 10:15:54
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/fontconfig/fontconfig.h --sys-include "thirdparty/linuxbsd_headers/fontconfig/fontconfig.h" --soname libfontconfig.so.1 --init-name fontconfig --omit-prefix FcCharSetFirst --omit-prefix FcCharSetNext --output-header ./platform/linuxbsd/fontconfig-so_wrap.h --output-implementation ./platform/linuxbsd/fontconfig-so_wrap.c
//
#include <stdint.h>
@@ -20,8 +20,6 @@
#define FcDirCacheValid FcDirCacheValid_dylibloader_orig_fontconfig
#define FcDirCacheClean FcDirCacheClean_dylibloader_orig_fontconfig
#define FcCacheCreateTagFile FcCacheCreateTagFile_dylibloader_orig_fontconfig
-#define FcDirCacheCreateUUID FcDirCacheCreateUUID_dylibloader_orig_fontconfig
-#define FcDirCacheDeleteUUID FcDirCacheDeleteUUID_dylibloader_orig_fontconfig
#define FcConfigHome FcConfigHome_dylibloader_orig_fontconfig
#define FcConfigEnableHome FcConfigEnableHome_dylibloader_orig_fontconfig
#define FcConfigFilename FcConfigFilename_dylibloader_orig_fontconfig
@@ -48,9 +46,6 @@
#define FcConfigSubstitute FcConfigSubstitute_dylibloader_orig_fontconfig
#define FcConfigGetSysRoot FcConfigGetSysRoot_dylibloader_orig_fontconfig
#define FcConfigSetSysRoot FcConfigSetSysRoot_dylibloader_orig_fontconfig
-#define FcConfigFileInfoIterInit FcConfigFileInfoIterInit_dylibloader_orig_fontconfig
-#define FcConfigFileInfoIterNext FcConfigFileInfoIterNext_dylibloader_orig_fontconfig
-#define FcConfigFileInfoIterGet FcConfigFileInfoIterGet_dylibloader_orig_fontconfig
#define FcCharSetCreate FcCharSetCreate_dylibloader_orig_fontconfig
#define FcCharSetNew FcCharSetNew_dylibloader_orig_fontconfig
#define FcCharSetDestroy FcCharSetDestroy_dylibloader_orig_fontconfig
@@ -83,7 +78,6 @@
#define FcDirCacheLoadFile FcDirCacheLoadFile_dylibloader_orig_fontconfig
#define FcDirCacheUnload FcDirCacheUnload_dylibloader_orig_fontconfig
#define FcFreeTypeQuery FcFreeTypeQuery_dylibloader_orig_fontconfig
-#define FcFreeTypeQueryAll FcFreeTypeQueryAll_dylibloader_orig_fontconfig
#define FcFontSetCreate FcFontSetCreate_dylibloader_orig_fontconfig
#define FcFontSetDestroy FcFontSetDestroy_dylibloader_orig_fontconfig
#define FcFontSetAdd FcFontSetAdd_dylibloader_orig_fontconfig
@@ -154,7 +148,6 @@
#define FcValueEqual FcValueEqual_dylibloader_orig_fontconfig
#define FcValueSave FcValueSave_dylibloader_orig_fontconfig
#define FcPatternDestroy FcPatternDestroy_dylibloader_orig_fontconfig
-#define FcPatternObjectCount FcPatternObjectCount_dylibloader_orig_fontconfig
#define FcPatternEqual FcPatternEqual_dylibloader_orig_fontconfig
#define FcPatternEqualSubset FcPatternEqualSubset_dylibloader_orig_fontconfig
#define FcPatternHash FcPatternHash_dylibloader_orig_fontconfig
@@ -188,18 +181,8 @@
#define FcRangeDestroy FcRangeDestroy_dylibloader_orig_fontconfig
#define FcRangeCopy FcRangeCopy_dylibloader_orig_fontconfig
#define FcRangeGetDouble FcRangeGetDouble_dylibloader_orig_fontconfig
-#define FcPatternIterStart FcPatternIterStart_dylibloader_orig_fontconfig
-#define FcPatternIterNext FcPatternIterNext_dylibloader_orig_fontconfig
-#define FcPatternIterEqual FcPatternIterEqual_dylibloader_orig_fontconfig
-#define FcPatternFindIter FcPatternFindIter_dylibloader_orig_fontconfig
-#define FcPatternIterIsValid FcPatternIterIsValid_dylibloader_orig_fontconfig
-#define FcPatternIterGetObject FcPatternIterGetObject_dylibloader_orig_fontconfig
-#define FcPatternIterValueCount FcPatternIterValueCount_dylibloader_orig_fontconfig
-#define FcPatternIterGetValue FcPatternIterGetValue_dylibloader_orig_fontconfig
#define FcWeightFromOpenType FcWeightFromOpenType_dylibloader_orig_fontconfig
-#define FcWeightFromOpenTypeDouble FcWeightFromOpenTypeDouble_dylibloader_orig_fontconfig
#define FcWeightToOpenType FcWeightToOpenType_dylibloader_orig_fontconfig
-#define FcWeightToOpenTypeDouble FcWeightToOpenTypeDouble_dylibloader_orig_fontconfig
#define FcStrCopy FcStrCopy_dylibloader_orig_fontconfig
#define FcStrCopyFilename FcStrCopyFilename_dylibloader_orig_fontconfig
#define FcStrPlus FcStrPlus_dylibloader_orig_fontconfig
@@ -229,7 +212,7 @@
#define FcStrListDone FcStrListDone_dylibloader_orig_fontconfig
#define FcConfigParseAndLoad FcConfigParseAndLoad_dylibloader_orig_fontconfig
#define FcConfigParseAndLoadFromMemory FcConfigParseAndLoadFromMemory_dylibloader_orig_fontconfig
-#include <fontconfig/fontconfig.h>
+#include "thirdparty/linuxbsd_headers/fontconfig/fontconfig.h"
#undef FcBlanksCreate
#undef FcBlanksDestroy
#undef FcBlanksAdd
@@ -243,8 +226,6 @@
#undef FcDirCacheValid
#undef FcDirCacheClean
#undef FcCacheCreateTagFile
-#undef FcDirCacheCreateUUID
-#undef FcDirCacheDeleteUUID
#undef FcConfigHome
#undef FcConfigEnableHome
#undef FcConfigFilename
@@ -271,9 +252,6 @@
#undef FcConfigSubstitute
#undef FcConfigGetSysRoot
#undef FcConfigSetSysRoot
-#undef FcConfigFileInfoIterInit
-#undef FcConfigFileInfoIterNext
-#undef FcConfigFileInfoIterGet
#undef FcCharSetCreate
#undef FcCharSetNew
#undef FcCharSetDestroy
@@ -306,7 +284,6 @@
#undef FcDirCacheLoadFile
#undef FcDirCacheUnload
#undef FcFreeTypeQuery
-#undef FcFreeTypeQueryAll
#undef FcFontSetCreate
#undef FcFontSetDestroy
#undef FcFontSetAdd
@@ -377,7 +354,6 @@
#undef FcValueEqual
#undef FcValueSave
#undef FcPatternDestroy
-#undef FcPatternObjectCount
#undef FcPatternEqual
#undef FcPatternEqualSubset
#undef FcPatternHash
@@ -411,18 +387,8 @@
#undef FcRangeDestroy
#undef FcRangeCopy
#undef FcRangeGetDouble
-#undef FcPatternIterStart
-#undef FcPatternIterNext
-#undef FcPatternIterEqual
-#undef FcPatternFindIter
-#undef FcPatternIterIsValid
-#undef FcPatternIterGetObject
-#undef FcPatternIterValueCount
-#undef FcPatternIterGetValue
#undef FcWeightFromOpenType
-#undef FcWeightFromOpenTypeDouble
#undef FcWeightToOpenType
-#undef FcWeightToOpenTypeDouble
#undef FcStrCopy
#undef FcStrCopyFilename
#undef FcStrPlus
@@ -468,8 +434,6 @@ extern "C" {
#define FcDirCacheValid FcDirCacheValid_dylibloader_wrapper_fontconfig
#define FcDirCacheClean FcDirCacheClean_dylibloader_wrapper_fontconfig
#define FcCacheCreateTagFile FcCacheCreateTagFile_dylibloader_wrapper_fontconfig
-#define FcDirCacheCreateUUID FcDirCacheCreateUUID_dylibloader_wrapper_fontconfig
-#define FcDirCacheDeleteUUID FcDirCacheDeleteUUID_dylibloader_wrapper_fontconfig
#define FcConfigHome FcConfigHome_dylibloader_wrapper_fontconfig
#define FcConfigEnableHome FcConfigEnableHome_dylibloader_wrapper_fontconfig
#define FcConfigFilename FcConfigFilename_dylibloader_wrapper_fontconfig
@@ -496,9 +460,6 @@ extern "C" {
#define FcConfigSubstitute FcConfigSubstitute_dylibloader_wrapper_fontconfig
#define FcConfigGetSysRoot FcConfigGetSysRoot_dylibloader_wrapper_fontconfig
#define FcConfigSetSysRoot FcConfigSetSysRoot_dylibloader_wrapper_fontconfig
-#define FcConfigFileInfoIterInit FcConfigFileInfoIterInit_dylibloader_wrapper_fontconfig
-#define FcConfigFileInfoIterNext FcConfigFileInfoIterNext_dylibloader_wrapper_fontconfig
-#define FcConfigFileInfoIterGet FcConfigFileInfoIterGet_dylibloader_wrapper_fontconfig
#define FcCharSetCreate FcCharSetCreate_dylibloader_wrapper_fontconfig
#define FcCharSetNew FcCharSetNew_dylibloader_wrapper_fontconfig
#define FcCharSetDestroy FcCharSetDestroy_dylibloader_wrapper_fontconfig
@@ -531,7 +492,6 @@ extern "C" {
#define FcDirCacheLoadFile FcDirCacheLoadFile_dylibloader_wrapper_fontconfig
#define FcDirCacheUnload FcDirCacheUnload_dylibloader_wrapper_fontconfig
#define FcFreeTypeQuery FcFreeTypeQuery_dylibloader_wrapper_fontconfig
-#define FcFreeTypeQueryAll FcFreeTypeQueryAll_dylibloader_wrapper_fontconfig
#define FcFontSetCreate FcFontSetCreate_dylibloader_wrapper_fontconfig
#define FcFontSetDestroy FcFontSetDestroy_dylibloader_wrapper_fontconfig
#define FcFontSetAdd FcFontSetAdd_dylibloader_wrapper_fontconfig
@@ -602,7 +562,6 @@ extern "C" {
#define FcValueEqual FcValueEqual_dylibloader_wrapper_fontconfig
#define FcValueSave FcValueSave_dylibloader_wrapper_fontconfig
#define FcPatternDestroy FcPatternDestroy_dylibloader_wrapper_fontconfig
-#define FcPatternObjectCount FcPatternObjectCount_dylibloader_wrapper_fontconfig
#define FcPatternEqual FcPatternEqual_dylibloader_wrapper_fontconfig
#define FcPatternEqualSubset FcPatternEqualSubset_dylibloader_wrapper_fontconfig
#define FcPatternHash FcPatternHash_dylibloader_wrapper_fontconfig
@@ -636,18 +595,8 @@ extern "C" {
#define FcRangeDestroy FcRangeDestroy_dylibloader_wrapper_fontconfig
#define FcRangeCopy FcRangeCopy_dylibloader_wrapper_fontconfig
#define FcRangeGetDouble FcRangeGetDouble_dylibloader_wrapper_fontconfig
-#define FcPatternIterStart FcPatternIterStart_dylibloader_wrapper_fontconfig
-#define FcPatternIterNext FcPatternIterNext_dylibloader_wrapper_fontconfig
-#define FcPatternIterEqual FcPatternIterEqual_dylibloader_wrapper_fontconfig
-#define FcPatternFindIter FcPatternFindIter_dylibloader_wrapper_fontconfig
-#define FcPatternIterIsValid FcPatternIterIsValid_dylibloader_wrapper_fontconfig
-#define FcPatternIterGetObject FcPatternIterGetObject_dylibloader_wrapper_fontconfig
-#define FcPatternIterValueCount FcPatternIterValueCount_dylibloader_wrapper_fontconfig
-#define FcPatternIterGetValue FcPatternIterGetValue_dylibloader_wrapper_fontconfig
#define FcWeightFromOpenType FcWeightFromOpenType_dylibloader_wrapper_fontconfig
-#define FcWeightFromOpenTypeDouble FcWeightFromOpenTypeDouble_dylibloader_wrapper_fontconfig
#define FcWeightToOpenType FcWeightToOpenType_dylibloader_wrapper_fontconfig
-#define FcWeightToOpenTypeDouble FcWeightToOpenTypeDouble_dylibloader_wrapper_fontconfig
#define FcStrCopy FcStrCopy_dylibloader_wrapper_fontconfig
#define FcStrCopyFilename FcStrCopyFilename_dylibloader_wrapper_fontconfig
#define FcStrPlus FcStrPlus_dylibloader_wrapper_fontconfig
@@ -690,8 +639,6 @@ extern FcBool (*FcDirCacheUnlink_dylibloader_wrapper_fontconfig)(const FcChar8*,
extern FcBool (*FcDirCacheValid_dylibloader_wrapper_fontconfig)(const FcChar8*);
extern FcBool (*FcDirCacheClean_dylibloader_wrapper_fontconfig)(const FcChar8*, FcBool);
extern void (*FcCacheCreateTagFile_dylibloader_wrapper_fontconfig)(const FcConfig*);
-extern FcBool (*FcDirCacheCreateUUID_dylibloader_wrapper_fontconfig)( FcChar8*, FcBool, FcConfig*);
-extern FcBool (*FcDirCacheDeleteUUID_dylibloader_wrapper_fontconfig)(const FcChar8*, FcConfig*);
extern FcChar8* (*FcConfigHome_dylibloader_wrapper_fontconfig)( void);
extern FcBool (*FcConfigEnableHome_dylibloader_wrapper_fontconfig)( FcBool);
extern FcChar8* (*FcConfigFilename_dylibloader_wrapper_fontconfig)(const FcChar8*);
@@ -718,9 +665,6 @@ extern FcBool (*FcConfigSubstituteWithPat_dylibloader_wrapper_fontconfig)( FcCon
extern FcBool (*FcConfigSubstitute_dylibloader_wrapper_fontconfig)( FcConfig*, FcPattern*, FcMatchKind);
extern const FcChar8* (*FcConfigGetSysRoot_dylibloader_wrapper_fontconfig)(const FcConfig*);
extern void (*FcConfigSetSysRoot_dylibloader_wrapper_fontconfig)( FcConfig*,const FcChar8*);
-extern void (*FcConfigFileInfoIterInit_dylibloader_wrapper_fontconfig)( FcConfig*, FcConfigFileInfoIter*);
-extern FcBool (*FcConfigFileInfoIterNext_dylibloader_wrapper_fontconfig)( FcConfig*, FcConfigFileInfoIter*);
-extern FcBool (*FcConfigFileInfoIterGet_dylibloader_wrapper_fontconfig)( FcConfig*, FcConfigFileInfoIter*, FcChar8**, FcChar8**, FcBool*);
extern FcCharSet* (*FcCharSetCreate_dylibloader_wrapper_fontconfig)( void);
extern FcCharSet* (*FcCharSetNew_dylibloader_wrapper_fontconfig)( void);
extern void (*FcCharSetDestroy_dylibloader_wrapper_fontconfig)( FcCharSet*);
@@ -752,8 +696,7 @@ extern FcCache* (*FcDirCacheRescan_dylibloader_wrapper_fontconfig)(const FcChar8
extern FcCache* (*FcDirCacheRead_dylibloader_wrapper_fontconfig)(const FcChar8*, FcBool, FcConfig*);
extern FcCache* (*FcDirCacheLoadFile_dylibloader_wrapper_fontconfig)(const FcChar8*,struct stat*);
extern void (*FcDirCacheUnload_dylibloader_wrapper_fontconfig)( FcCache*);
-extern FcPattern* (*FcFreeTypeQuery_dylibloader_wrapper_fontconfig)(const FcChar8*, unsigned int, FcBlanks*, int*);
-extern unsigned int (*FcFreeTypeQueryAll_dylibloader_wrapper_fontconfig)(const FcChar8*, unsigned int, FcBlanks*, int*, FcFontSet*);
+extern FcPattern* (*FcFreeTypeQuery_dylibloader_wrapper_fontconfig)(const FcChar8*, int, FcBlanks*, int*);
extern FcFontSet* (*FcFontSetCreate_dylibloader_wrapper_fontconfig)( void);
extern void (*FcFontSetDestroy_dylibloader_wrapper_fontconfig)( FcFontSet*);
extern FcBool (*FcFontSetAdd_dylibloader_wrapper_fontconfig)( FcFontSet*, FcPattern*);
@@ -824,7 +767,6 @@ extern void (*FcValueDestroy_dylibloader_wrapper_fontconfig)( FcValue);
extern FcBool (*FcValueEqual_dylibloader_wrapper_fontconfig)( FcValue, FcValue);
extern FcValue (*FcValueSave_dylibloader_wrapper_fontconfig)( FcValue);
extern void (*FcPatternDestroy_dylibloader_wrapper_fontconfig)( FcPattern*);
-extern int (*FcPatternObjectCount_dylibloader_wrapper_fontconfig)(const FcPattern*);
extern FcBool (*FcPatternEqual_dylibloader_wrapper_fontconfig)(const FcPattern*,const FcPattern*);
extern FcBool (*FcPatternEqualSubset_dylibloader_wrapper_fontconfig)(const FcPattern*,const FcPattern*,const FcObjectSet*);
extern FcChar32 (*FcPatternHash_dylibloader_wrapper_fontconfig)(const FcPattern*);
@@ -858,18 +800,8 @@ extern FcRange* (*FcRangeCreateInteger_dylibloader_wrapper_fontconfig)( FcChar32
extern void (*FcRangeDestroy_dylibloader_wrapper_fontconfig)( FcRange*);
extern FcRange* (*FcRangeCopy_dylibloader_wrapper_fontconfig)(const FcRange*);
extern FcBool (*FcRangeGetDouble_dylibloader_wrapper_fontconfig)(const FcRange*, double*, double*);
-extern void (*FcPatternIterStart_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*);
-extern FcBool (*FcPatternIterNext_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*);
-extern FcBool (*FcPatternIterEqual_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*,const FcPattern*, FcPatternIter*);
-extern FcBool (*FcPatternFindIter_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*,const char*);
-extern FcBool (*FcPatternIterIsValid_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*);
-extern const char* (*FcPatternIterGetObject_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*);
-extern int (*FcPatternIterValueCount_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*);
-extern FcResult (*FcPatternIterGetValue_dylibloader_wrapper_fontconfig)(const FcPattern*, FcPatternIter*, int, FcValue*, FcValueBinding*);
extern int (*FcWeightFromOpenType_dylibloader_wrapper_fontconfig)( int);
-extern double (*FcWeightFromOpenTypeDouble_dylibloader_wrapper_fontconfig)( double);
extern int (*FcWeightToOpenType_dylibloader_wrapper_fontconfig)( int);
-extern double (*FcWeightToOpenTypeDouble_dylibloader_wrapper_fontconfig)( double);
extern FcChar8* (*FcStrCopy_dylibloader_wrapper_fontconfig)(const FcChar8*);
extern FcChar8* (*FcStrCopyFilename_dylibloader_wrapper_fontconfig)(const FcChar8*);
extern FcChar8* (*FcStrPlus_dylibloader_wrapper_fontconfig)(const FcChar8*,const FcChar8*);
diff --git a/platform/linuxbsd/libudev-so_wrap.c b/platform/linuxbsd/libudev-so_wrap.c
index a9fa4a494a..5455c1ab4e 100644
--- a/platform/linuxbsd/libudev-so_wrap.c
+++ b/platform/linuxbsd/libudev-so_wrap.c
@@ -1,7 +1,7 @@
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by /home/hp/Projects/godot/pulse/generate-wrapper.py 0.3 on 2021-02-20 00:08:59
-// flags: /home/hp/Projects/godot/pulse/generate-wrapper.py --include /usr/include/libudev.h --sys-include <libudev.h> --soname libudev.so.1 --init-name libudev --omit-prefix gnu_ --output-header libudev-so_wrap.h --output-implementation libudev-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-12 10:23:01
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/udev/libudev.h --sys-include "thirdparty/linuxbsd_headers/udev/libudev.h" --soname libudev.so.1 --init-name libudev --omit-prefix gnu_ --output-header ./platform/linuxbsd/libudev-so_wrap.h --output-implementation ./platform/linuxbsd/libudev-so_wrap.c
//
#include <stdint.h>
@@ -95,7 +95,7 @@
#define udev_hwdb_unref udev_hwdb_unref_dylibloader_orig_libudev
#define udev_hwdb_get_properties_list_entry udev_hwdb_get_properties_list_entry_dylibloader_orig_libudev
#define udev_util_encode_string udev_util_encode_string_dylibloader_orig_libudev
-#include <libudev.h>
+#include "thirdparty/linuxbsd_headers/udev/libudev.h"
#undef udev_ref
#undef udev_unref
#undef udev_new
@@ -229,7 +229,7 @@ const char* (*udev_device_get_action_dylibloader_wrapper_libudev)(struct udev_de
unsigned long long int (*udev_device_get_seqnum_dylibloader_wrapper_libudev)(struct udev_device*);
unsigned long long int (*udev_device_get_usec_since_initialized_dylibloader_wrapper_libudev)(struct udev_device*);
const char* (*udev_device_get_sysattr_value_dylibloader_wrapper_libudev)(struct udev_device*,const char*);
-int (*udev_device_set_sysattr_value_dylibloader_wrapper_libudev)(struct udev_device*,const char*,const char*);
+int (*udev_device_set_sysattr_value_dylibloader_wrapper_libudev)(struct udev_device*,const char*, char*);
int (*udev_device_has_tag_dylibloader_wrapper_libudev)(struct udev_device*,const char*);
struct udev_monitor* (*udev_monitor_ref_dylibloader_wrapper_libudev)(struct udev_monitor*);
struct udev_monitor* (*udev_monitor_unref_dylibloader_wrapper_libudev)(struct udev_monitor*);
@@ -276,7 +276,7 @@ struct udev_list_entry* (*udev_queue_get_queued_list_entry_dylibloader_wrapper_l
struct udev_hwdb* (*udev_hwdb_new_dylibloader_wrapper_libudev)(struct udev*);
struct udev_hwdb* (*udev_hwdb_ref_dylibloader_wrapper_libudev)(struct udev_hwdb*);
struct udev_hwdb* (*udev_hwdb_unref_dylibloader_wrapper_libudev)(struct udev_hwdb*);
-struct udev_list_entry* (*udev_hwdb_get_properties_list_entry_dylibloader_wrapper_libudev)(struct udev_hwdb*,const char*, unsigned);
+struct udev_list_entry* (*udev_hwdb_get_properties_list_entry_dylibloader_wrapper_libudev)(struct udev_hwdb*,const char*, unsigned int);
int (*udev_util_encode_string_dylibloader_wrapper_libudev)(const char*, char*, size_t);
int initialize_libudev(int verbose) {
void *handle;
diff --git a/platform/linuxbsd/libudev-so_wrap.h b/platform/linuxbsd/libudev-so_wrap.h
index dd43fd1191..174a3663d4 100644
--- a/platform/linuxbsd/libudev-so_wrap.h
+++ b/platform/linuxbsd/libudev-so_wrap.h
@@ -2,8 +2,8 @@
#define DYLIBLOAD_WRAPPER_LIBUDEV
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by /home/hp/Projects/godot/pulse/generate-wrapper.py 0.3 on 2021-02-20 00:08:59
-// flags: /home/hp/Projects/godot/pulse/generate-wrapper.py --include /usr/include/libudev.h --sys-include <libudev.h> --soname libudev.so.1 --init-name libudev --omit-prefix gnu_ --output-header libudev-so_wrap.h --output-implementation libudev-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-12 10:23:01
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/udev/libudev.h --sys-include "thirdparty/linuxbsd_headers/udev/libudev.h" --soname libudev.so.1 --init-name libudev --omit-prefix gnu_ --output-header ./platform/linuxbsd/libudev-so_wrap.h --output-implementation ./platform/linuxbsd/libudev-so_wrap.c
//
#include <stdint.h>
@@ -97,7 +97,7 @@
#define udev_hwdb_unref udev_hwdb_unref_dylibloader_orig_libudev
#define udev_hwdb_get_properties_list_entry udev_hwdb_get_properties_list_entry_dylibloader_orig_libudev
#define udev_util_encode_string udev_util_encode_string_dylibloader_orig_libudev
-#include <libudev.h>
+#include "thirdparty/linuxbsd_headers/udev/libudev.h"
#undef udev_ref
#undef udev_unref
#undef udev_new
@@ -322,7 +322,7 @@ extern const char* (*udev_device_get_action_dylibloader_wrapper_libudev)(struct
extern unsigned long long int (*udev_device_get_seqnum_dylibloader_wrapper_libudev)(struct udev_device*);
extern unsigned long long int (*udev_device_get_usec_since_initialized_dylibloader_wrapper_libudev)(struct udev_device*);
extern const char* (*udev_device_get_sysattr_value_dylibloader_wrapper_libudev)(struct udev_device*,const char*);
-extern int (*udev_device_set_sysattr_value_dylibloader_wrapper_libudev)(struct udev_device*,const char*,const char*);
+extern int (*udev_device_set_sysattr_value_dylibloader_wrapper_libudev)(struct udev_device*,const char*, char*);
extern int (*udev_device_has_tag_dylibloader_wrapper_libudev)(struct udev_device*,const char*);
extern struct udev_monitor* (*udev_monitor_ref_dylibloader_wrapper_libudev)(struct udev_monitor*);
extern struct udev_monitor* (*udev_monitor_unref_dylibloader_wrapper_libudev)(struct udev_monitor*);
@@ -369,7 +369,7 @@ extern struct udev_list_entry* (*udev_queue_get_queued_list_entry_dylibloader_wr
extern struct udev_hwdb* (*udev_hwdb_new_dylibloader_wrapper_libudev)(struct udev*);
extern struct udev_hwdb* (*udev_hwdb_ref_dylibloader_wrapper_libudev)(struct udev_hwdb*);
extern struct udev_hwdb* (*udev_hwdb_unref_dylibloader_wrapper_libudev)(struct udev_hwdb*);
-extern struct udev_list_entry* (*udev_hwdb_get_properties_list_entry_dylibloader_wrapper_libudev)(struct udev_hwdb*,const char*, unsigned);
+extern struct udev_list_entry* (*udev_hwdb_get_properties_list_entry_dylibloader_wrapper_libudev)(struct udev_hwdb*,const char*, unsigned int);
extern int (*udev_util_encode_string_dylibloader_wrapper_libudev)(const char*, char*, size_t);
int initialize_libudev(int verbose);
#ifdef __cplusplus
diff --git a/platform/linuxbsd/speechd-so_wrap.c b/platform/linuxbsd/speechd-so_wrap.c
index 749474e181..1dc5f08c10 100644
--- a/platform/linuxbsd/speechd-so_wrap.c
+++ b/platform/linuxbsd/speechd-so_wrap.c
@@ -1,7 +1,7 @@
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./dynload-wrapper/generate-wrapper.py 0.3 on 2022-04-28 14:34:21
-// flags: ./dynload-wrapper/generate-wrapper.py --sys-include <libspeechd.h> --include /usr/include/speech-dispatcher/libspeechd.h --soname libspeechd.so.2 --init-name speechd --omit-prefix spd_get_client_list --output-header speechd-so_wrap.h --output-implementation speechd-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-12 10:07:46
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/speechd/libspeechd.h --sys-include "thirdparty/linuxbsd_headers/speechd/libspeechd.h" --soname libspeechd.so.2 --init-name speechd --omit-prefix spd_get_client_list --output-header ./platform/linuxbsd/speechd-so_wrap.h --output-implementation ./platform/linuxbsd/speechd-so_wrap.c
//
#include <stdint.h>
@@ -47,9 +47,6 @@
#define spd_set_voice_pitch_all spd_set_voice_pitch_all_dylibloader_orig_speechd
#define spd_set_voice_pitch_uid spd_set_voice_pitch_uid_dylibloader_orig_speechd
#define spd_get_voice_pitch spd_get_voice_pitch_dylibloader_orig_speechd
-#define spd_set_voice_pitch_range spd_set_voice_pitch_range_dylibloader_orig_speechd
-#define spd_set_voice_pitch_range_all spd_set_voice_pitch_range_all_dylibloader_orig_speechd
-#define spd_set_voice_pitch_range_uid spd_set_voice_pitch_range_uid_dylibloader_orig_speechd
#define spd_set_volume spd_set_volume_dylibloader_orig_speechd
#define spd_set_volume_all spd_set_volume_all_dylibloader_orig_speechd
#define spd_set_volume_uid spd_set_volume_uid_dylibloader_orig_speechd
@@ -83,7 +80,7 @@
#define spd_execute_command_wo_mutex spd_execute_command_wo_mutex_dylibloader_orig_speechd
#define spd_send_data spd_send_data_dylibloader_orig_speechd
#define spd_send_data_wo_mutex spd_send_data_wo_mutex_dylibloader_orig_speechd
-#include <libspeechd.h>
+#include "thirdparty/linuxbsd_headers/speechd/libspeechd.h"
#undef SPDConnectionAddress__free
#undef spd_get_default_address
#undef spd_open
@@ -126,9 +123,6 @@
#undef spd_set_voice_pitch_all
#undef spd_set_voice_pitch_uid
#undef spd_get_voice_pitch
-#undef spd_set_voice_pitch_range
-#undef spd_set_voice_pitch_range_all
-#undef spd_set_voice_pitch_range_uid
#undef spd_set_volume
#undef spd_set_volume_all
#undef spd_set_volume_uid
@@ -206,9 +200,6 @@ int (*spd_set_voice_pitch_dylibloader_wrapper_speechd)( SPDConnection*, signed i
int (*spd_set_voice_pitch_all_dylibloader_wrapper_speechd)( SPDConnection*, signed int);
int (*spd_set_voice_pitch_uid_dylibloader_wrapper_speechd)( SPDConnection*, signed int, unsigned int);
int (*spd_get_voice_pitch_dylibloader_wrapper_speechd)( SPDConnection*);
-int (*spd_set_voice_pitch_range_dylibloader_wrapper_speechd)( SPDConnection*, signed int);
-int (*spd_set_voice_pitch_range_all_dylibloader_wrapper_speechd)( SPDConnection*, signed int);
-int (*spd_set_voice_pitch_range_uid_dylibloader_wrapper_speechd)( SPDConnection*, signed int, unsigned int);
int (*spd_set_volume_dylibloader_wrapper_speechd)( SPDConnection*, signed int);
int (*spd_set_volume_all_dylibloader_wrapper_speechd)( SPDConnection*, signed int);
int (*spd_set_volume_uid_dylibloader_wrapper_speechd)( SPDConnection*, signed int, unsigned int);
@@ -589,30 +580,6 @@ int initialize_speechd(int verbose) {
fprintf(stderr, "%s\n", error);
}
}
-// spd_set_voice_pitch_range
- *(void **) (&spd_set_voice_pitch_range_dylibloader_wrapper_speechd) = dlsym(handle, "spd_set_voice_pitch_range");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// spd_set_voice_pitch_range_all
- *(void **) (&spd_set_voice_pitch_range_all_dylibloader_wrapper_speechd) = dlsym(handle, "spd_set_voice_pitch_range_all");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
-// spd_set_voice_pitch_range_uid
- *(void **) (&spd_set_voice_pitch_range_uid_dylibloader_wrapper_speechd) = dlsym(handle, "spd_set_voice_pitch_range_uid");
- if (verbose) {
- error = dlerror();
- if (error != NULL) {
- fprintf(stderr, "%s\n", error);
- }
- }
// spd_set_volume
*(void **) (&spd_set_volume_dylibloader_wrapper_speechd) = dlsym(handle, "spd_set_volume");
if (verbose) {
diff --git a/platform/linuxbsd/speechd-so_wrap.h b/platform/linuxbsd/speechd-so_wrap.h
index 8e1c053348..2967cfa929 100644
--- a/platform/linuxbsd/speechd-so_wrap.h
+++ b/platform/linuxbsd/speechd-so_wrap.h
@@ -2,8 +2,8 @@
#define DYLIBLOAD_WRAPPER_SPEECHD
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./dynload-wrapper/generate-wrapper.py 0.3 on 2022-04-28 14:34:21
-// flags: ./dynload-wrapper/generate-wrapper.py --sys-include <libspeechd.h> --include /usr/include/speech-dispatcher/libspeechd.h --soname libspeechd.so.2 --init-name speechd --omit-prefix spd_get_client_list --output-header speechd-so_wrap.h --output-implementation speechd-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-12 10:07:46
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/speechd/libspeechd.h --sys-include "thirdparty/linuxbsd_headers/speechd/libspeechd.h" --soname libspeechd.so.2 --init-name speechd --omit-prefix spd_get_client_list --output-header ./platform/linuxbsd/speechd-so_wrap.h --output-implementation ./platform/linuxbsd/speechd-so_wrap.c
//
#include <stdint.h>
@@ -49,9 +49,6 @@
#define spd_set_voice_pitch_all spd_set_voice_pitch_all_dylibloader_orig_speechd
#define spd_set_voice_pitch_uid spd_set_voice_pitch_uid_dylibloader_orig_speechd
#define spd_get_voice_pitch spd_get_voice_pitch_dylibloader_orig_speechd
-#define spd_set_voice_pitch_range spd_set_voice_pitch_range_dylibloader_orig_speechd
-#define spd_set_voice_pitch_range_all spd_set_voice_pitch_range_all_dylibloader_orig_speechd
-#define spd_set_voice_pitch_range_uid spd_set_voice_pitch_range_uid_dylibloader_orig_speechd
#define spd_set_volume spd_set_volume_dylibloader_orig_speechd
#define spd_set_volume_all spd_set_volume_all_dylibloader_orig_speechd
#define spd_set_volume_uid spd_set_volume_uid_dylibloader_orig_speechd
@@ -85,7 +82,7 @@
#define spd_execute_command_wo_mutex spd_execute_command_wo_mutex_dylibloader_orig_speechd
#define spd_send_data spd_send_data_dylibloader_orig_speechd
#define spd_send_data_wo_mutex spd_send_data_wo_mutex_dylibloader_orig_speechd
-#include <libspeechd.h>
+#include "thirdparty/linuxbsd_headers/speechd/libspeechd.h"
#undef SPDConnectionAddress__free
#undef spd_get_default_address
#undef spd_open
@@ -128,9 +125,6 @@
#undef spd_set_voice_pitch_all
#undef spd_set_voice_pitch_uid
#undef spd_get_voice_pitch
-#undef spd_set_voice_pitch_range
-#undef spd_set_voice_pitch_range_all
-#undef spd_set_voice_pitch_range_uid
#undef spd_set_volume
#undef spd_set_volume_all
#undef spd_set_volume_uid
@@ -209,9 +203,6 @@ extern "C" {
#define spd_set_voice_pitch_all spd_set_voice_pitch_all_dylibloader_wrapper_speechd
#define spd_set_voice_pitch_uid spd_set_voice_pitch_uid_dylibloader_wrapper_speechd
#define spd_get_voice_pitch spd_get_voice_pitch_dylibloader_wrapper_speechd
-#define spd_set_voice_pitch_range spd_set_voice_pitch_range_dylibloader_wrapper_speechd
-#define spd_set_voice_pitch_range_all spd_set_voice_pitch_range_all_dylibloader_wrapper_speechd
-#define spd_set_voice_pitch_range_uid spd_set_voice_pitch_range_uid_dylibloader_wrapper_speechd
#define spd_set_volume spd_set_volume_dylibloader_wrapper_speechd
#define spd_set_volume_all spd_set_volume_all_dylibloader_wrapper_speechd
#define spd_set_volume_uid spd_set_volume_uid_dylibloader_wrapper_speechd
@@ -287,9 +278,6 @@ extern int (*spd_set_voice_pitch_dylibloader_wrapper_speechd)( SPDConnection*, s
extern int (*spd_set_voice_pitch_all_dylibloader_wrapper_speechd)( SPDConnection*, signed int);
extern int (*spd_set_voice_pitch_uid_dylibloader_wrapper_speechd)( SPDConnection*, signed int, unsigned int);
extern int (*spd_get_voice_pitch_dylibloader_wrapper_speechd)( SPDConnection*);
-extern int (*spd_set_voice_pitch_range_dylibloader_wrapper_speechd)( SPDConnection*, signed int);
-extern int (*spd_set_voice_pitch_range_all_dylibloader_wrapper_speechd)( SPDConnection*, signed int);
-extern int (*spd_set_voice_pitch_range_uid_dylibloader_wrapper_speechd)( SPDConnection*, signed int, unsigned int);
extern int (*spd_set_volume_dylibloader_wrapper_speechd)( SPDConnection*, signed int);
extern int (*spd_set_volume_all_dylibloader_wrapper_speechd)( SPDConnection*, signed int);
extern int (*spd_set_volume_uid_dylibloader_wrapper_speechd)( SPDConnection*, signed int, unsigned int);
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index d4f82cc81e..c09da2f7b3 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -1324,12 +1324,20 @@ void DisplayServerX11::delete_sub_window(WindowID p_id) {
}
#endif
- XUnmapWindow(x11_display, wd.x11_window);
- XDestroyWindow(x11_display, wd.x11_window);
if (wd.xic) {
XDestroyIC(wd.xic);
wd.xic = nullptr;
}
+ XDestroyWindow(x11_display, wd.x11_xim_window);
+ if (xkb_loaded) {
+ if (wd.xkb_state) {
+ xkb_compose_state_unref(wd.xkb_state);
+ wd.xkb_state = nullptr;
+ }
+ }
+
+ XUnmapWindow(x11_display, wd.x11_window);
+ XDestroyWindow(x11_display, wd.x11_window);
windows.erase(p_id);
}
@@ -2490,23 +2498,40 @@ void DisplayServerX11::window_set_ime_active(const bool p_active, WindowID p_win
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
- wd.im_active = p_active;
-
if (!wd.xic) {
return;
}
+ if (!wd.focused) {
+ wd.ime_active = false;
+ im_text = String();
+ im_selection = Vector2i();
+ return;
+ }
// Block events polling while changing input focus
// because it triggers some event polling internally.
if (p_active) {
- {
- MutexLock mutex_lock(events_mutex);
- XSetICFocus(wd.xic);
+ MutexLock mutex_lock(events_mutex);
+
+ wd.ime_active = true;
+
+ XMapWindow(x11_display, wd.x11_xim_window);
+
+ XWindowAttributes xwa;
+ XSync(x11_display, False);
+ XGetWindowAttributes(x11_display, wd.x11_xim_window, &xwa);
+ if (xwa.map_state == IsViewable) {
+ XSetInputFocus(x11_display, wd.x11_xim_window, RevertToParent, CurrentTime);
}
- window_set_ime_position(wd.im_position, p_window);
+ XSetICFocus(wd.xic);
} else {
MutexLock mutex_lock(events_mutex);
XUnsetICFocus(wd.xic);
+ XUnmapWindow(x11_display, wd.x11_xim_window);
+ wd.ime_active = false;
+
+ im_text = String();
+ im_selection = Vector2i();
}
}
@@ -2516,25 +2541,29 @@ void DisplayServerX11::window_set_ime_position(const Point2i &p_pos, WindowID p_
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
- wd.im_position = p_pos;
-
if (!wd.xic) {
return;
}
+ if (!wd.focused) {
+ return;
+ }
- ::XPoint spot;
- spot.x = short(p_pos.x);
- spot.y = short(p_pos.y);
- XVaNestedList preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, nullptr);
-
- {
- // Block events polling during this call
- // because it triggers some event polling internally.
- MutexLock mutex_lock(events_mutex);
- XSetICValues(wd.xic, XNPreeditAttributes, preedit_attr, nullptr);
+ if (wd.ime_active) {
+ XWindowAttributes xwa;
+ XSync(x11_display, False);
+ XGetWindowAttributes(x11_display, wd.x11_xim_window, &xwa);
+ if (xwa.map_state == IsViewable) {
+ XMoveWindow(x11_display, wd.x11_xim_window, p_pos.x, p_pos.y);
+ }
}
+}
+
+Point2i DisplayServerX11::ime_get_selection() const {
+ return im_selection;
+}
- XFree(preedit_attr);
+String DisplayServerX11::ime_get_text() const {
+ return im_text;
}
void DisplayServerX11::cursor_set_shape(CursorShape p_shape) {
@@ -2872,6 +2901,16 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
// X11 functions don't know what const is
XKeyEvent *xkeyevent = p_event;
+ if (wd.ime_in_progress) {
+ return;
+ }
+ if (wd.ime_suppress_next_keyup) {
+ wd.ime_suppress_next_keyup = false;
+ if (xkeyevent->type != KeyPress) {
+ return;
+ }
+ }
+
// This code was pretty difficult to write.
// The docs stink and every toolkit seems to
// do it in a different way.
@@ -2895,13 +2934,20 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
KeySym keysym_unicode = 0; // keysym used to find unicode
// XLookupString returns keysyms usable as nice keycodes.
- char str[256 + 1];
+ char str[256] = {};
XKeyEvent xkeyevent_no_mod = *xkeyevent;
xkeyevent_no_mod.state &= ~ShiftMask;
xkeyevent_no_mod.state &= ~ControlMask;
- XLookupString(xkeyevent, str, 256, &keysym_unicode, nullptr);
+ XLookupString(xkeyevent, str, 255, &keysym_unicode, nullptr);
XLookupString(&xkeyevent_no_mod, nullptr, 0, &keysym_keycode, nullptr);
+ String keysym;
+ if (xkb_loaded) {
+ KeySym keysym_unicode_nm = 0; // keysym used to find unicode
+ XLookupString(&xkeyevent_no_mod, nullptr, 0, &keysym_unicode_nm, nullptr);
+ keysym = String::chr(xkb_keysym_to_utf32(xkb_keysym_to_upper(keysym_unicode_nm)));
+ }
+
// Meanwhile, XLookupString returns keysyms useful for unicode.
if (!xmbstring) {
@@ -2950,13 +2996,18 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
_get_key_modifier_state(xkeyevent->state, k);
k->set_window_id(p_window);
- k->set_unicode(tmp[i]);
-
k->set_pressed(keypress);
k->set_keycode(keycode);
-
- k->set_physical_keycode((Key)physical_keycode);
+ k->set_physical_keycode(physical_keycode);
+ if (!keysym.is_empty()) {
+ k->set_key_label(fix_key_label(keysym[0], keycode));
+ } else {
+ k->set_key_label(keycode);
+ }
+ if (keypress) {
+ k->set_unicode(fix_unicode(tmp[i]));
+ }
k->set_echo(false);
@@ -2984,6 +3035,64 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
}
} while (status == XBufferOverflow);
#endif
+ } else if (xkeyevent->type == KeyPress && wd.xkb_state && xkb_loaded) {
+ xkb_compose_feed_result res = xkb_compose_state_feed(wd.xkb_state, keysym_unicode);
+ if (res == XKB_COMPOSE_FEED_ACCEPTED) {
+ if (xkb_compose_state_get_status(wd.xkb_state) == XKB_COMPOSE_COMPOSED) {
+ bool keypress = xkeyevent->type == KeyPress;
+ Key keycode = KeyMappingX11::get_keycode(keysym_keycode);
+ Key physical_keycode = KeyMappingX11::get_scancode(xkeyevent->keycode);
+
+ if (keycode >= Key::A + 32 && keycode <= Key::Z + 32) {
+ keycode -= 'a' - 'A';
+ }
+
+ char str_xkb[256] = {};
+ int str_xkb_size = xkb_compose_state_get_utf8(wd.xkb_state, str_xkb, 255);
+
+ String tmp;
+ tmp.parse_utf8(str_xkb, str_xkb_size);
+ for (int i = 0; i < tmp.length(); i++) {
+ Ref<InputEventKey> k;
+ k.instantiate();
+ if (physical_keycode == Key::NONE && keycode == Key::NONE && tmp[i] == 0) {
+ continue;
+ }
+
+ if (keycode == Key::NONE) {
+ keycode = (Key)physical_keycode;
+ }
+
+ _get_key_modifier_state(xkeyevent->state, k);
+
+ k->set_window_id(p_window);
+ k->set_pressed(keypress);
+
+ k->set_keycode(keycode);
+ k->set_physical_keycode(physical_keycode);
+ if (!keysym.is_empty()) {
+ k->set_key_label(fix_key_label(keysym[0], keycode));
+ } else {
+ k->set_key_label(keycode);
+ }
+ if (keypress) {
+ k->set_unicode(fix_unicode(tmp[i]));
+ }
+
+ k->set_echo(false);
+
+ if (k->get_keycode() == Key::BACKTAB) {
+ //make it consistent across platforms.
+ k->set_keycode(Key::TAB);
+ k->set_physical_keycode(Key::TAB);
+ k->set_shift_pressed(true);
+ }
+
+ Input::get_singleton()->parse_input_event(k);
+ }
+ return;
+ }
+ }
}
/* Phase 2, obtain a Godot keycode from the keysym */
@@ -2999,7 +3108,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
// KeyMappingX11 also translates keysym to unicode.
// It does a binary search on a table to translate
// most properly.
- unsigned int unicode = keysym_unicode > 0 ? KeyMappingX11::get_unicode_from_keysym(keysym_unicode) : 0;
+ char32_t unicode = keysym_unicode > 0 ? KeyMappingX11::get_unicode_from_keysym(keysym_unicode) : 0;
/* Phase 4, determine if event must be filtered */
@@ -3085,7 +3194,14 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
k->set_keycode(keycode);
k->set_physical_keycode((Key)physical_keycode);
- k->set_unicode(unicode);
+ if (!keysym.is_empty()) {
+ k->set_key_label(fix_key_label(keysym[0], keycode));
+ } else {
+ k->set_key_label(keycode);
+ }
+ if (keypress) {
+ k->set_unicode(fix_unicode(unicode));
+ }
k->set_echo(p_echo);
if (k->get_keycode() == Key::BACKTAB) {
@@ -3237,6 +3353,81 @@ void DisplayServerX11::_handle_selection_request_event(XSelectionRequestEvent *p
XFlush(x11_display);
}
+int DisplayServerX11::_xim_preedit_start_callback(::XIM xim, ::XPointer client_data,
+ ::XPointer call_data) {
+ DisplayServerX11 *ds = reinterpret_cast<DisplayServerX11 *>(client_data);
+ WindowID window_id = ds->_get_focused_window_or_popup();
+ WindowData &wd = ds->windows[window_id];
+ if (wd.ime_active) {
+ wd.ime_in_progress = true;
+ }
+
+ return -1; // Allow preedit strings of any length (no limit).
+}
+
+void DisplayServerX11::_xim_preedit_done_callback(::XIM xim, ::XPointer client_data,
+ ::XPointer call_data) {
+ DisplayServerX11 *ds = reinterpret_cast<DisplayServerX11 *>(client_data);
+ WindowID window_id = ds->_get_focused_window_or_popup();
+ WindowData &wd = ds->windows[window_id];
+ if (wd.ime_active) {
+ wd.ime_in_progress = false;
+ wd.ime_suppress_next_keyup = true;
+ }
+}
+
+void DisplayServerX11::_xim_preedit_draw_callback(::XIM xim, ::XPointer client_data,
+ ::XIMPreeditDrawCallbackStruct *call_data) {
+ DisplayServerX11 *ds = reinterpret_cast<DisplayServerX11 *>(client_data);
+ WindowID window_id = ds->_get_focused_window_or_popup();
+ WindowData &wd = ds->windows[window_id];
+
+ XIMText *xim_text = call_data->text;
+ if (wd.ime_active) {
+ if (xim_text != nullptr) {
+ String changed_text;
+ if (xim_text->encoding_is_wchar) {
+ changed_text = String(xim_text->string.wide_char);
+ } else {
+ changed_text.parse_utf8(xim_text->string.multi_byte);
+ }
+
+ if (call_data->chg_length < 0) {
+ ds->im_text = ds->im_text.substr(0, call_data->chg_first) + changed_text;
+ } else {
+ ds->im_text = ds->im_text.substr(0, call_data->chg_first) + changed_text + ds->im_text.substr(call_data->chg_length);
+ }
+
+ // Find the start and end of the selection.
+ int start = 0, count = 0;
+ for (int i = 0; i < xim_text->length; i++) {
+ if (xim_text->feedback[i] & XIMReverse) {
+ if (count == 0) {
+ start = i;
+ count = 1;
+ } else {
+ count++;
+ }
+ }
+ }
+ if (count > 0) {
+ ds->im_selection = Point2i(start + call_data->chg_first, count);
+ } else {
+ ds->im_selection = Point2i(call_data->caret, 0);
+ }
+ } else {
+ ds->im_text = String();
+ ds->im_selection = Point2i();
+ }
+
+ OS_Unix::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_OS_IME_UPDATE);
+ }
+}
+
+void DisplayServerX11::_xim_preedit_caret_callback(::XIM xim, ::XPointer client_data,
+ ::XIMPreeditCaretCallbackStruct *call_data) {
+}
+
void DisplayServerX11::_xim_destroy_callback(::XIM im, ::XPointer client_data,
::XPointer call_data) {
WARN_PRINT("Input method stopped");
@@ -3286,10 +3477,6 @@ void DisplayServerX11::_window_changed(XEvent *event) {
if (new_rect == Rect2i(wd.position, wd.size)) {
return;
}
- if (wd.xic) {
- // Not portable.
- window_set_ime_position(Point2(0, 1));
- }
wd.position = new_rect.position;
wd.size = new_rect.size;
@@ -3637,6 +3824,7 @@ void DisplayServerX11::process_events() {
continue;
}
+ bool ime_window_event = false;
WindowID window_id = MAIN_WINDOW_ID;
// Assign the event to the relevant window
@@ -3645,6 +3833,11 @@ void DisplayServerX11::process_events() {
window_id = E.key;
break;
}
+ if (event.xany.window == E.value.x11_xim_window) {
+ window_id = E.key;
+ ime_window_event = true;
+ break;
+ }
}
if (XGetEventData(x11_display, &event.xcookie)) {
@@ -3659,6 +3852,9 @@ void DisplayServerX11::process_events() {
_refresh_device_info();
} break;
case XI_RawMotion: {
+ if (ime_window_event) {
+ break;
+ }
XIRawEvent *raw_event = (XIRawEvent *)event_data;
int device_id = raw_event->sourceid;
@@ -3761,6 +3957,9 @@ void DisplayServerX11::process_events() {
#ifdef TOUCH_ENABLED
case XI_TouchBegin:
case XI_TouchEnd: {
+ if (ime_window_event) {
+ break;
+ }
bool is_begin = event_data->evtype == XI_TouchBegin;
Ref<InputEventScreenTouch> st;
@@ -3791,6 +3990,9 @@ void DisplayServerX11::process_events() {
} break;
case XI_TouchUpdate: {
+ if (ime_window_event) {
+ break;
+ }
HashMap<int, Vector2>::Iterator curr_pos_elem = xi.state.find(index);
if (!curr_pos_elem) { // Defensive
break;
@@ -3817,6 +4019,9 @@ void DisplayServerX11::process_events() {
switch (event.type) {
case MapNotify: {
DEBUG_LOG_X11("[%u] MapNotify window=%lu (%u) \n", frame, event.xmap.window, window_id);
+ if (ime_window_event) {
+ break;
+ }
const WindowData &wd = windows[window_id];
@@ -3837,6 +4042,9 @@ void DisplayServerX11::process_events() {
case Expose: {
DEBUG_LOG_X11("[%u] Expose window=%lu (%u), count='%u' \n", frame, event.xexpose.window, window_id, event.xexpose.count);
+ if (ime_window_event) {
+ break;
+ }
windows[window_id].fullscreen = _window_fullscreen_check(window_id);
@@ -3845,18 +4053,27 @@ void DisplayServerX11::process_events() {
case NoExpose: {
DEBUG_LOG_X11("[%u] NoExpose drawable=%lu (%u) \n", frame, event.xnoexpose.drawable, window_id);
+ if (ime_window_event) {
+ break;
+ }
windows[window_id].minimized = true;
} break;
case VisibilityNotify: {
DEBUG_LOG_X11("[%u] VisibilityNotify window=%lu (%u), state=%u \n", frame, event.xvisibility.window, window_id, event.xvisibility.state);
+ if (ime_window_event) {
+ break;
+ }
windows[window_id].minimized = _window_minimize_check(window_id);
} break;
case LeaveNotify: {
DEBUG_LOG_X11("[%u] LeaveNotify window=%lu (%u), mode='%u' \n", frame, event.xcrossing.window, window_id, event.xcrossing.mode);
+ if (ime_window_event) {
+ break;
+ }
if (!mouse_mode_grab) {
_send_window_event(windows[window_id], WINDOW_EVENT_MOUSE_EXIT);
@@ -3866,6 +4083,9 @@ void DisplayServerX11::process_events() {
case EnterNotify: {
DEBUG_LOG_X11("[%u] EnterNotify window=%lu (%u), mode='%u' \n", frame, event.xcrossing.window, window_id, event.xcrossing.mode);
+ if (ime_window_event) {
+ break;
+ }
if (!mouse_mode_grab) {
_send_window_event(windows[window_id], WINDOW_EVENT_MOUSE_ENTER);
@@ -3874,18 +4094,14 @@ void DisplayServerX11::process_events() {
case FocusIn: {
DEBUG_LOG_X11("[%u] FocusIn window=%lu (%u), mode='%u' \n", frame, event.xfocus.window, window_id, event.xfocus.mode);
+ if (ime_window_event) {
+ break;
+ }
WindowData &wd = windows[window_id];
last_focused_window = window_id;
wd.focused = true;
- if (wd.xic) {
- // Block events polling while changing input focus
- // because it triggers some event polling internally.
- MutexLock mutex_lock(events_mutex);
- XSetICFocus(wd.xic);
- }
-
// Keep track of focus order for overlapping windows.
static unsigned int focus_order = 0;
wd.focus_order = ++focus_order;
@@ -3925,17 +4141,20 @@ void DisplayServerX11::process_events() {
case FocusOut: {
DEBUG_LOG_X11("[%u] FocusOut window=%lu (%u), mode='%u' \n", frame, event.xfocus.window, window_id, event.xfocus.mode);
-
WindowData &wd = windows[window_id];
-
- wd.focused = false;
-
- if (wd.xic) {
- // Block events polling while changing input focus
- // because it triggers some event polling internally.
+ if (wd.ime_active && event.xfocus.detail == NotifyInferior) {
+ break;
+ }
+ if (wd.ime_active) {
MutexLock mutex_lock(events_mutex);
XUnsetICFocus(wd.xic);
+ XUnmapWindow(x11_display, wd.x11_xim_window);
+ wd.ime_active = false;
+ im_text = String();
+ im_selection = Vector2i();
+ OS_Unix::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_OS_IME_UPDATE);
}
+ wd.focused = false;
Input::get_singleton()->release_pressed_events();
_send_window_event(wd, WINDOW_EVENT_FOCUS_OUT);
@@ -3971,6 +4190,9 @@ void DisplayServerX11::process_events() {
case ConfigureNotify: {
DEBUG_LOG_X11("[%u] ConfigureNotify window=%lu (%u), event=%lu, above=%lu, override_redirect=%u \n", frame, event.xconfigure.window, window_id, event.xconfigure.event, event.xconfigure.above, event.xconfigure.override_redirect);
+ if (event.xconfigure.window == windows[window_id].x11_xim_window) {
+ break;
+ }
const WindowData &wd = windows[window_id];
@@ -3990,6 +4212,9 @@ void DisplayServerX11::process_events() {
case ButtonPress:
case ButtonRelease: {
+ if (ime_window_event) {
+ break;
+ }
/* exit in case of a mouse button press */
last_timestamp = event.xbutton.time;
if (mouse_mode == MOUSE_MODE_CAPTURED) {
@@ -4088,6 +4313,9 @@ void DisplayServerX11::process_events() {
} break;
case MotionNotify: {
+ if (ime_window_event) {
+ break;
+ }
// The X11 API requires filtering one-by-one through the motion
// notify events, in order to figure out which event is the one
// generated by warping the mouse pointer.
@@ -4248,7 +4476,9 @@ void DisplayServerX11::process_events() {
} break;
case SelectionNotify:
-
+ if (ime_window_event) {
+ break;
+ }
if (event.xselection.target == requested) {
Property p = _read_property(x11_display, windows[window_id].x11_window, XInternAtom(x11_display, "PRIMARY", 0));
@@ -4283,7 +4513,9 @@ void DisplayServerX11::process_events() {
break;
case ClientMessage:
-
+ if (ime_window_event) {
+ break;
+ }
if ((unsigned int)event.xclient.data.l[0] == (unsigned int)wm_delete) {
_send_window_event(windows[window_id], WINDOW_EVENT_CLOSE_REQUEST);
}
@@ -4693,6 +4925,15 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, V
{
wd.x11_window = XCreateWindow(x11_display, RootWindow(x11_display, visualInfo.screen), win_rect.position.x, win_rect.position.y, win_rect.size.width > 0 ? win_rect.size.width : 1, win_rect.size.height > 0 ? win_rect.size.height : 1, 0, visualInfo.depth, InputOutput, visualInfo.visual, valuemask, &windowAttributes);
+ XSetWindowAttributes window_attributes_ime = {};
+ window_attributes_ime.event_mask = KeyPressMask | KeyReleaseMask | StructureNotifyMask | ExposureMask;
+
+ wd.x11_xim_window = XCreateWindow(x11_display, wd.x11_window, 0, 0, 1, 1, 0, CopyFromParent, InputOnly, CopyFromParent, CWEventMask, &window_attributes_ime);
+
+ if (dead_tbl && xkb_loaded) {
+ wd.xkb_state = xkb_compose_state_new(dead_tbl, XKB_COMPOSE_STATE_NO_FLAGS);
+ }
+
// Enable receiving notification when the window is initialized (MapNotify)
// so the focus can be set at the right time.
if (!wd.no_focus && !wd.is_popup) {
@@ -4763,7 +5004,50 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, V
// because it triggers some event polling internally.
MutexLock mutex_lock(events_mutex);
- wd.xic = XCreateIC(xim, XNInputStyle, xim_style, XNClientWindow, wd.x11_window, XNFocusWindow, wd.x11_window, (char *)nullptr);
+ // Force on-the-spot for the over-the-spot style.
+ if ((xim_style & XIMPreeditPosition) != 0) {
+ xim_style &= ~XIMPreeditPosition;
+ xim_style |= XIMPreeditCallbacks;
+ }
+ if ((xim_style & XIMPreeditCallbacks) != 0) {
+ ::XIMCallback preedit_start_callback;
+ preedit_start_callback.client_data = (::XPointer)(this);
+ preedit_start_callback.callback = (::XIMProc)(void *)(_xim_preedit_start_callback);
+
+ ::XIMCallback preedit_done_callback;
+ preedit_done_callback.client_data = (::XPointer)(this);
+ preedit_done_callback.callback = (::XIMProc)(_xim_preedit_done_callback);
+
+ ::XIMCallback preedit_draw_callback;
+ preedit_draw_callback.client_data = (::XPointer)(this);
+ preedit_draw_callback.callback = (::XIMProc)(_xim_preedit_draw_callback);
+
+ ::XIMCallback preedit_caret_callback;
+ preedit_caret_callback.client_data = (::XPointer)(this);
+ preedit_caret_callback.callback = (::XIMProc)(_xim_preedit_caret_callback);
+
+ ::XVaNestedList preedit_attributes = XVaCreateNestedList(0,
+ XNPreeditStartCallback, &preedit_start_callback,
+ XNPreeditDoneCallback, &preedit_done_callback,
+ XNPreeditDrawCallback, &preedit_draw_callback,
+ XNPreeditCaretCallback, &preedit_caret_callback,
+ (char *)nullptr);
+
+ wd.xic = XCreateIC(xim,
+ XNInputStyle, xim_style,
+ XNClientWindow, wd.x11_xim_window,
+ XNFocusWindow, wd.x11_xim_window,
+ XNPreeditAttributes, preedit_attributes,
+ (char *)nullptr);
+ XFree(preedit_attributes);
+ } else {
+ wd.xic = XCreateIC(xim,
+ XNInputStyle, xim_style,
+ XNClientWindow, wd.x11_xim_window,
+ XNFocusWindow, wd.x11_xim_window,
+ (char *)nullptr);
+ }
+
if (XGetICValues(wd.xic, XNFilterEvents, &im_event_mask, nullptr) != nullptr) {
WARN_PRINT("XGetICValues couldn't obtain XNFilterEvents value");
XDestroyIC(wd.xic);
@@ -4854,7 +5138,66 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, V
return id;
}
+static bool _is_xim_style_supported(const ::XIMStyle &p_style) {
+ const ::XIMStyle supported_preedit = XIMPreeditCallbacks | XIMPreeditPosition | XIMPreeditNothing | XIMPreeditNone;
+ const ::XIMStyle supported_status = XIMStatusNothing | XIMStatusNone;
+
+ // Check preedit style is supported
+ if ((p_style & supported_preedit) == 0) {
+ return false;
+ }
+
+ // Check status style is supported
+ if ((p_style & supported_status) == 0) {
+ return false;
+ }
+
+ return true;
+}
+
+static ::XIMStyle _get_best_xim_style(const ::XIMStyle &p_style_a, const ::XIMStyle &p_style_b) {
+ if (p_style_a == 0) {
+ return p_style_b;
+ }
+ if (p_style_b == 0) {
+ return p_style_a;
+ }
+
+ const ::XIMStyle preedit = XIMPreeditArea | XIMPreeditCallbacks | XIMPreeditPosition | XIMPreeditNothing | XIMPreeditNone;
+ const ::XIMStyle status = XIMStatusArea | XIMStatusCallbacks | XIMStatusNothing | XIMStatusNone;
+
+ ::XIMStyle a = p_style_a & preedit;
+ ::XIMStyle b = p_style_b & preedit;
+ if (a != b) {
+ // Compare preedit styles.
+ if ((a | b) & XIMPreeditCallbacks) {
+ return a == XIMPreeditCallbacks ? p_style_a : p_style_b;
+ } else if ((a | b) & XIMPreeditPosition) {
+ return a == XIMPreeditPosition ? p_style_a : p_style_b;
+ } else if ((a | b) & XIMPreeditArea) {
+ return a == XIMPreeditArea ? p_style_a : p_style_b;
+ } else if ((a | b) & XIMPreeditNothing) {
+ return a == XIMPreeditNothing ? p_style_a : p_style_b;
+ }
+ } else {
+ // Preedit styles are the same, compare status styles.
+ a = p_style_a & status;
+ b = p_style_b & status;
+
+ if ((a | b) & XIMStatusCallbacks) {
+ return a == XIMStatusCallbacks ? p_style_a : p_style_b;
+ } else if ((a | b) & XIMStatusArea) {
+ return a == XIMStatusArea ? p_style_a : p_style_b;
+ } else if ((a | b) & XIMStatusNothing) {
+ return a == XIMStatusNothing ? p_style_a : p_style_b;
+ }
+ }
+ return p_style_a;
+}
+
DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Error &r_error) {
+ KeyMappingX11::initialize();
+
#ifdef DEBUG_ENABLED
int dylibloader_verbose = 1;
#else
@@ -4870,6 +5213,8 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
ERR_FAIL_MSG("Can't load XCursor dynamically.");
}
+ xkb_loaded = (initialize_xkbcommon(dylibloader_verbose) == 0);
+
if (initialize_xext(dylibloader_verbose) != 0) {
r_error = ERR_UNAVAILABLE;
ERR_FAIL_MSG("Can't load Xext dynamically.");
@@ -4895,6 +5240,23 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
ERR_FAIL_MSG("Can't load Xinput2 dynamically.");
}
+ if (xkb_loaded) {
+ xkb_ctx = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
+ if (xkb_ctx) {
+ const char *locale = getenv("LC_ALL");
+ if (!locale || !*locale) {
+ locale = getenv("LC_CTYPE");
+ }
+ if (!locale || !*locale) {
+ locale = getenv("LANG");
+ }
+ if (!locale || !*locale) {
+ locale = "C";
+ }
+ dead_tbl = xkb_compose_table_new_from_locale(xkb_ctx, locale, XKB_COMPOSE_COMPILE_NO_FLAGS);
+ }
+ }
+
Input::get_singleton()->set_event_dispatch_function(_dispatch_input_events);
r_error = OK;
@@ -5001,11 +5363,13 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
if (xim_styles) {
xim_style = 0L;
for (int i = 0; i < xim_styles->count_styles; i++) {
- if (xim_styles->supported_styles[i] ==
- (XIMPreeditNothing | XIMStatusNothing)) {
- xim_style = xim_styles->supported_styles[i];
- break;
+ const ::XIMStyle &style = xim_styles->supported_styles[i];
+
+ if (!_is_xim_style_supported(style)) {
+ continue;
}
+
+ xim_style = _get_best_xim_style(xim_style, style);
}
XFree(xim_styles);
@@ -5333,10 +5697,26 @@ DisplayServerX11::~DisplayServerX11() {
XDestroyIC(wd.xic);
wd.xic = nullptr;
}
+ XDestroyWindow(x11_display, wd.x11_xim_window);
+ if (xkb_loaded) {
+ if (wd.xkb_state) {
+ xkb_compose_state_unref(wd.xkb_state);
+ wd.xkb_state = nullptr;
+ }
+ }
XUnmapWindow(x11_display, wd.x11_window);
XDestroyWindow(x11_display, wd.x11_window);
}
+ if (xkb_loaded) {
+ if (dead_tbl) {
+ xkb_compose_table_unref(dead_tbl);
+ }
+ if (xkb_ctx) {
+ xkb_context_unref(xkb_ctx);
+ }
+ }
+
//destroy drivers
#if defined(VULKAN_ENABLED)
if (rendering_device_vulkan) {
diff --git a/platform/linuxbsd/x11/display_server_x11.h b/platform/linuxbsd/x11/display_server_x11.h
index 437766d953..ea54b42262 100644
--- a/platform/linuxbsd/x11/display_server_x11.h
+++ b/platform/linuxbsd/x11/display_server_x11.h
@@ -78,6 +78,8 @@
#include "dynwrappers/xrandr-so_wrap.h"
#include "dynwrappers/xrender-so_wrap.h"
+#include "../xkbcommon-so_wrap.h"
+
typedef struct _xrr_monitor_info {
Atom name;
Bool primary = false;
@@ -135,14 +137,17 @@ class DisplayServerX11 : public DisplayServer {
struct WindowData {
Window x11_window;
+ Window x11_xim_window;
::XIC xic;
+ bool ime_active = false;
+ bool ime_in_progress = false;
+ bool ime_suppress_next_keyup = false;
+ xkb_compose_state *xkb_state = nullptr;
Size2i min_size;
Size2i max_size;
Point2i position;
Size2i size;
- Point2i im_position;
- bool im_active = false;
Callable rect_changed_callback;
Callable event_callback;
Callable input_event_callback;
@@ -178,6 +183,13 @@ class DisplayServerX11 : public DisplayServer {
unsigned int focus_order = 0;
};
+ Point2i im_selection;
+ String im_text;
+
+ bool xkb_loaded = false;
+ xkb_context *xkb_ctx = nullptr;
+ xkb_compose_table *dead_tbl = nullptr;
+
HashMap<WindowID, WindowData> windows;
unsigned int last_mouse_monitor_mask = 0;
@@ -200,6 +212,15 @@ class DisplayServerX11 : public DisplayServer {
::Time last_keyrelease_time = 0;
::XIM xim;
::XIMStyle xim_style;
+
+ static int _xim_preedit_start_callback(::XIM xim, ::XPointer client_data,
+ ::XPointer call_data);
+ static void _xim_preedit_done_callback(::XIM xim, ::XPointer client_data,
+ ::XPointer call_data);
+ static void _xim_preedit_draw_callback(::XIM xim, ::XPointer client_data,
+ ::XIMPreeditDrawCallbackStruct *call_data);
+ static void _xim_preedit_caret_callback(::XIM xim, ::XPointer client_data,
+ ::XIMPreeditCaretCallbackStruct *call_data);
static void _xim_destroy_callback(::XIM im, ::XPointer client_data,
::XPointer call_data);
@@ -433,6 +454,9 @@ public:
virtual void window_set_ime_active(const bool p_active, WindowID p_window = MAIN_WINDOW_ID) override;
virtual void window_set_ime_position(const Point2i &p_pos, WindowID p_window = MAIN_WINDOW_ID) override;
+ virtual Point2i ime_get_selection() const override;
+ virtual String ime_get_text() const override;
+
virtual void window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window = MAIN_WINDOW_ID) override;
virtual DisplayServer::VSyncMode window_get_vsync_mode(WindowID p_vsync_mode) const override;
diff --git a/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.c
index 7042a60d47..bba21b9cb7 100644
--- a/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.c
+++ b/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.c
@@ -1,7 +1,7 @@
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:48:06
-// flags: ./generate-wrapper.py --include /usr/include/X11/Xcursor/Xcursor.h --sys-include <X11/Xcursor/Xcursor.h> --soname libXcursor.so.1 --init-name xcursor --output-header xcursor-so_wrap.h --output-implementation xcursor-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-23 15:09:53
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/X11/Xcursor/Xcursor.h --sys-include "thirdparty/linuxbsd_headers/X11/Xcursor/Xcursor.h" --soname libXcursor.so.1 --init-name xcursor --output-header ./platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.h --output-implementation ./platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.c
//
// NOTE: Generated from Xcursor 1.2.0.
// This has been handpatched to workaround some issues with the generator that
@@ -68,7 +68,7 @@
#define XcursorGetTheme XcursorGetTheme_dylibloader_orig_xcursor
#define XcursorGetThemeCore XcursorGetThemeCore_dylibloader_orig_xcursor
#define XcursorSetThemeCore XcursorSetThemeCore_dylibloader_orig_xcursor
-#include <X11/Xcursor/Xcursor.h>
+#include "thirdparty/linuxbsd_headers/X11/Xcursor/Xcursor.h"
#undef XcursorImageCreate
#undef XcursorImageDestroy
#undef XcursorImagesCreate
diff --git a/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.h b/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.h
index d00fccffda..9f8d8bbca2 100644
--- a/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.h
+++ b/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.h
@@ -2,8 +2,8 @@
#define DYLIBLOAD_WRAPPER_XCURSOR
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:48:06
-// flags: ./generate-wrapper.py --include /usr/include/X11/Xcursor/Xcursor.h --sys-include <X11/Xcursor/Xcursor.h> --soname libXcursor.so.1 --init-name xcursor --output-header xcursor-so_wrap.h --output-implementation xcursor-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-23 15:09:53
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/X11/Xcursor/Xcursor.h --sys-include "thirdparty/linuxbsd_headers/X11/Xcursor/Xcursor.h" --soname libXcursor.so.1 --init-name xcursor --output-header ./platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.h --output-implementation ./platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.c
//
// NOTE: Generated from Xcursor 1.2.0.
// This has been handpatched to workaround some issues with the generator that
@@ -70,7 +70,7 @@
#define XcursorGetTheme XcursorGetTheme_dylibloader_orig_xcursor
#define XcursorGetThemeCore XcursorGetThemeCore_dylibloader_orig_xcursor
#define XcursorSetThemeCore XcursorSetThemeCore_dylibloader_orig_xcursor
-#include <X11/Xcursor/Xcursor.h>
+#include "thirdparty/linuxbsd_headers/X11/Xcursor/Xcursor.h"
#undef XcursorImageCreate
#undef XcursorImageDestroy
#undef XcursorImagesCreate
diff --git a/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c
index c8e87a6b85..4e3349c574 100644
--- a/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c
+++ b/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c
@@ -1,7 +1,7 @@
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:51:55
-// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xext.h --sys-include <X11/extensions/Xext.h> --include /usr/include/X11/extensions/shape.h --sys-include <X11/extensions/shape.h> --soname libXext.so.6 --init-name xext --output-header xext-so_wrap.h --output-implementation xext-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-23 15:11:29
+// flags: generate-wrapper.py --sys-include "thirdparty/linuxbsd_headers/X11/extensions/Xext.h" --include ./thirdparty/linuxbsd_headers/X11/extensions/shape.h --sys-include "thirdparty/linuxbsd_headers/X11/extensions/shape.h" --soname libXext.so.6 --init-name xext --output-header ./platform/linuxbsd/x11/dynwrappers/xext-so_wrap.h --output-implementation ./platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c
//
// NOTE: Generated from Xext 1.3.5.
// This has been handpatched to workaround some issues with the generator that
@@ -12,7 +12,7 @@
#include <stdint.h>
// HANDPATCH: Needed for a successful compilation.
-#include <X11/Xlib.h>
+#include "thirdparty/linuxbsd_headers/X11/Xlib.h"
#define XShapeQueryExtension XShapeQueryExtension_dylibloader_orig_xext
#define XShapeQueryVersion XShapeQueryVersion_dylibloader_orig_xext
@@ -25,8 +25,8 @@
#define XShapeSelectInput XShapeSelectInput_dylibloader_orig_xext
#define XShapeInputSelected XShapeInputSelected_dylibloader_orig_xext
#define XShapeGetRectangles XShapeGetRectangles_dylibloader_orig_xext
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/shape.h>
+#include "thirdparty/linuxbsd_headers/X11/extensions/Xext.h"
+#include "thirdparty/linuxbsd_headers/X11/extensions/shape.h"
#undef XShapeQueryExtension
#undef XShapeQueryVersion
#undef XShapeCombineRegion
diff --git a/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.h b/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.h
index aee92b593e..e535756d82 100644
--- a/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.h
+++ b/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.h
@@ -2,8 +2,8 @@
#define DYLIBLOAD_WRAPPER_XEXT
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:51:55
-// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xext.h --sys-include <X11/extensions/Xext.h> --include /usr/include/X11/extensions/shape.h --sys-include <X11/extensions/shape.h> --soname libXext.so.6 --init-name xext --output-header xext-so_wrap.h --output-implementation xext-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-23 15:11:29
+// flags: generate-wrapper.py --sys-include "thirdparty/linuxbsd_headers/X11/extensions/Xext.h" --include ./thirdparty/linuxbsd_headers/X11/extensions/shape.h --sys-include "thirdparty/linuxbsd_headers/X11/extensions/shape.h" --soname libXext.so.6 --init-name xext --output-header ./platform/linuxbsd/x11/dynwrappers/xext-so_wrap.h --output-implementation ./platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c
//
// NOTE: Generated from Xext 1.3.5.
// This has been handpatched to workaround some issues with the generator that
@@ -14,7 +14,7 @@
#include <stdint.h>
// HANDPATCH: Needed for a successful compilation.
-#include <X11/Xlib.h>
+#include "thirdparty/linuxbsd_headers/X11/Xlib.h"
#define XShapeQueryExtension XShapeQueryExtension_dylibloader_orig_xext
#define XShapeQueryVersion XShapeQueryVersion_dylibloader_orig_xext
@@ -27,8 +27,8 @@
#define XShapeSelectInput XShapeSelectInput_dylibloader_orig_xext
#define XShapeInputSelected XShapeInputSelected_dylibloader_orig_xext
#define XShapeGetRectangles XShapeGetRectangles_dylibloader_orig_xext
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/shape.h>
+#include "thirdparty/linuxbsd_headers/X11/extensions/Xext.h"
+#include "thirdparty/linuxbsd_headers/X11/extensions/shape.h"
#undef XShapeQueryExtension
#undef XShapeQueryVersion
#undef XShapeCombineRegion
diff --git a/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c
index 85ac80e3f2..850ed1fc6b 100644
--- a/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c
+++ b/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c
@@ -1,7 +1,7 @@
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:53:11
-// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xinerama.h --sys-include <X11/extensions/Xinerama.h> --soname libXinerama.so.1 --init-name xinerama --output-header xinerama-so_wrap.h --output-implementation xinerama-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-23 15:11:35
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/X11/extensions/Xinerama.h --sys-include "thirdparty/linuxbsd_headers/X11/extensions/Xinerama.h" --soname libXinerama.so.1 --init-name xinerama --output-header ./platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.h --output-implementation ./platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c
//
// NOTE: Generated from Xinerama 1.1.4.
// This has been handpatched to workaround some issues with the generator that
@@ -13,7 +13,7 @@
#define XineramaQueryVersion XineramaQueryVersion_dylibloader_orig_xinerama
#define XineramaIsActive XineramaIsActive_dylibloader_orig_xinerama
#define XineramaQueryScreens XineramaQueryScreens_dylibloader_orig_xinerama
-#include <X11/extensions/Xinerama.h>
+#include "thirdparty/linuxbsd_headers/X11/extensions/Xinerama.h"
#undef XineramaQueryExtension
#undef XineramaQueryVersion
#undef XineramaIsActive
diff --git a/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.h b/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.h
index 9139421cd6..e3cedfc8ad 100644
--- a/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.h
+++ b/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.h
@@ -2,8 +2,8 @@
#define DYLIBLOAD_WRAPPER_XINERAMA
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:53:11
-// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xinerama.h --sys-include <X11/extensions/Xinerama.h> --soname libXinerama.so.1 --init-name xinerama --output-header xinerama-so_wrap.h --output-implementation xinerama-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-23 15:11:35
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/X11/extensions/Xinerama.h --sys-include "thirdparty/linuxbsd_headers/X11/extensions/Xinerama.h" --soname libXinerama.so.1 --init-name xinerama --output-header ./platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.h --output-implementation ./platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c
//
// NOTE: Generated from Xinerama 1.1.4.
// This has been handpatched to workaround some issues with the generator that
@@ -15,7 +15,7 @@
#define XineramaQueryVersion XineramaQueryVersion_dylibloader_orig_xinerama
#define XineramaIsActive XineramaIsActive_dylibloader_orig_xinerama
#define XineramaQueryScreens XineramaQueryScreens_dylibloader_orig_xinerama
-#include <X11/extensions/Xinerama.h>
+#include "thirdparty/linuxbsd_headers/X11/extensions/Xinerama.h"
#undef XineramaQueryExtension
#undef XineramaQueryVersion
#undef XineramaIsActive
diff --git a/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.c
index 5f16bc6111..fc08b97e3c 100644
--- a/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.c
+++ b/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.c
@@ -1,7 +1,7 @@
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:54:10
-// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/XInput2.h --sys-include <X11/extensions/XInput2.h> --soname libXi.so.6 --init-name xinput2 --output-header xinput2-so_wrap.h --output-implementation xinput2-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-23 15:12:16
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/X11/extensions/XInput2.h --sys-include "thirdparty/linuxbsd_headers/X11/extensions/XInput2.h" --soname libXi.so.6 --init-name xinput2 --output-header ./platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.h --output-implementation ./platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.c
//
// NOTE: Generated from Xi 1.7.10.
// This has been handpatched to workaround some issues with the generator that
@@ -43,7 +43,7 @@
#define XIBarrierReleasePointers XIBarrierReleasePointers_dylibloader_orig_xinput2
#define XIBarrierReleasePointer XIBarrierReleasePointer_dylibloader_orig_xinput2
#define XIFreeDeviceInfo XIFreeDeviceInfo_dylibloader_orig_xinput2
-#include <X11/extensions/XInput2.h>
+#include "thirdparty/linuxbsd_headers/X11/extensions/XInput2.h"
#undef XIQueryPointer
#undef XIWarpPointer
#undef XIDefineCursor
diff --git a/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.h b/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.h
index ecb7aa5048..571072c3cd 100644
--- a/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.h
+++ b/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.h
@@ -2,8 +2,8 @@
#define DYLIBLOAD_WRAPPER_XINPUT2
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:54:10
-// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/XInput2.h --sys-include <X11/extensions/XInput2.h> --soname libXi.so.6 --init-name xinput2 --output-header xinput2-so_wrap.h --output-implementation xinput2-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-23 15:12:16
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/X11/extensions/XInput2.h --sys-include "thirdparty/linuxbsd_headers/X11/extensions/XInput2.h" --soname libXi.so.6 --init-name xinput2 --output-header ./platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.h --output-implementation ./platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.c
//
// NOTE: Generated from Xi 1.7.10.
// This has been handpatched to workaround some issues with the generator that
@@ -45,7 +45,7 @@
#define XIBarrierReleasePointers XIBarrierReleasePointers_dylibloader_orig_xinput2
#define XIBarrierReleasePointer XIBarrierReleasePointer_dylibloader_orig_xinput2
#define XIFreeDeviceInfo XIFreeDeviceInfo_dylibloader_orig_xinput2
-#include <X11/extensions/XInput2.h>
+#include "thirdparty/linuxbsd_headers/X11/extensions/XInput2.h"
#undef XIQueryPointer
#undef XIWarpPointer
#undef XIDefineCursor
diff --git a/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.c
index 12097a2987..d2838569b0 100644
--- a/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.c
+++ b/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.c
@@ -1,7 +1,7 @@
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:54:53
-// flags: ./generate-wrapper.py --include /usr/include/X11/Xlib.h --include /usr/include/X11/Xutil.h --include /usr/include/X11/XKBlib.h --sys-include <X11/Xlib.h> --sys-include <X11/Xutil.h> --sys-include <X11/XKBlib.h> --soname libX11.so.6 --init-name xlib --omit-prefix XkbGetDeviceIndicatorState --omit-prefix XkbAddSymInterpret --output-header xlib-so_wrap.h --output-implementation xlib-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-23 15:13:26
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/X11/Xlib.h --include ./thirdparty/linuxbsd_headers/X11/Xutil.h --include ./thirdparty/linuxbsd_headers/X11/XKBlib.h --sys-include "thirdparty/linuxbsd_headers/X11/Xlib.h" --sys-include "thirdparty/linuxbsd_headers/X11/Xutil.h" --sys-include "thirdparty/linuxbsd_headers/X11/XKBlib.h" --soname libX11.so.6 --init-name xlib --omit-prefix XkbGetDeviceIndicatorState --omit-prefix XkbAddSymInterpret --output-header ./platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.h --output-implementation ./platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.c~
//
// NOTE: Generated from Xlib 1.6.9.
// This has been handpatched to workaround some issues with the generator that
@@ -614,9 +614,9 @@
#define XkbApplyVirtualModChanges XkbApplyVirtualModChanges_dylibloader_orig_xlib
#define XkbUpdateActionVirtualMods XkbUpdateActionVirtualMods_dylibloader_orig_xlib
#define XkbUpdateKeyTypeVirtualMods XkbUpdateKeyTypeVirtualMods_dylibloader_orig_xlib
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/XKBlib.h>
+#include "thirdparty/linuxbsd_headers/X11/Xlib.h"
+#include "thirdparty/linuxbsd_headers/X11/Xutil.h"
+#include "thirdparty/linuxbsd_headers/X11/XKBlib.h"
#undef _Xmblen
#undef XLoadQueryFont
#undef XQueryFont
diff --git a/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.h b/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.h
index 47464078e3..5bad21002d 100644
--- a/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.h
+++ b/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.h
@@ -2,8 +2,8 @@
#define DYLIBLOAD_WRAPPER_XLIB
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:54:53
-// flags: ./generate-wrapper.py --include /usr/include/X11/Xlib.h --include /usr/include/X11/Xutil.h --include /usr/include/X11/XKBlib.h --sys-include <X11/Xlib.h> --sys-include <X11/Xutil.h> --sys-include <X11/XKBlib.h> --soname libX11.so.6 --init-name xlib --omit-prefix XkbGetDeviceIndicatorState --omit-prefix XkbAddSymInterpret --output-header xlib-so_wrap.h --output-implementation xlib-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-23 15:13:26
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/X11/Xlib.h --include ./thirdparty/linuxbsd_headers/X11/Xutil.h --include ./thirdparty/linuxbsd_headers/X11/XKBlib.h --sys-include "thirdparty/linuxbsd_headers/X11/Xlib.h" --sys-include "thirdparty/linuxbsd_headers/X11/Xutil.h" --sys-include "thirdparty/linuxbsd_headers/X11/XKBlib.h" --soname libX11.so.6 --init-name xlib --omit-prefix XkbGetDeviceIndicatorState --omit-prefix XkbAddSymInterpret --output-header ./platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.h --output-implementation ./platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.c~
//
// NOTE: Generated from Xlib 1.6.9.
// This has been handpatched to workaround some issues with the generator that
@@ -617,9 +617,9 @@
#define XkbApplyVirtualModChanges XkbApplyVirtualModChanges_dylibloader_orig_xlib
#define XkbUpdateActionVirtualMods XkbUpdateActionVirtualMods_dylibloader_orig_xlib
#define XkbUpdateKeyTypeVirtualMods XkbUpdateKeyTypeVirtualMods_dylibloader_orig_xlib
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/XKBlib.h>
+#include "thirdparty/linuxbsd_headers/X11/Xlib.h"
+#include "thirdparty/linuxbsd_headers/X11/Xutil.h"
+#include "thirdparty/linuxbsd_headers/X11/XKBlib.h"
#undef _Xmblen
#undef XLoadQueryFont
#undef XQueryFont
diff --git a/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.c
index f37f3a9db0..05f98d2506 100644
--- a/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.c
+++ b/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.c
@@ -1,7 +1,7 @@
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:55:12
-// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xrandr.h --sys-include <X11/extensions/Xrandr.h> --soname libXrandr.so.2 --init-name xrandr --output-header xrandr-so_wrap.h --output-implementation xrandr-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-23 15:13:54
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/X11/extensions/Xrandr.h --sys-include "thirdparty/linuxbsd_headers/X11/extensions/Xrandr.h" --soname libXrandr.so.2 --init-name xrandr --output-header ./platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.h --output-implementation ./platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.c
//
// NOTE: Generated from Xrandr 1.5.2.
// This has been handpatched to workaround some issues with the generator that
@@ -79,7 +79,7 @@
#define XRRSetMonitor XRRSetMonitor_dylibloader_orig_xrandr
#define XRRDeleteMonitor XRRDeleteMonitor_dylibloader_orig_xrandr
#define XRRFreeMonitors XRRFreeMonitors_dylibloader_orig_xrandr
-#include <X11/extensions/Xrandr.h>
+#include "thirdparty/linuxbsd_headers/X11/extensions/Xrandr.h"
#undef XRRQueryExtension
#undef XRRQueryVersion
#undef XRRGetScreenInfo
diff --git a/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.h b/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.h
index 046d4c7de3..db5d44203d 100644
--- a/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.h
+++ b/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.h
@@ -2,8 +2,8 @@
#define DYLIBLOAD_WRAPPER_XRANDR
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:55:12
-// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xrandr.h --sys-include <X11/extensions/Xrandr.h> --soname libXrandr.so.2 --init-name xrandr --output-header xrandr-so_wrap.h --output-implementation xrandr-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-23 15:13:54
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/X11/extensions/Xrandr.h --sys-include "thirdparty/linuxbsd_headers/X11/extensions/Xrandr.h" --soname libXrandr.so.2 --init-name xrandr --output-header ./platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.h --output-implementation ./platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.c
//
// NOTE: Generated from Xrandr 1.5.2.
// This has been handpatched to workaround some issues with the generator that
@@ -81,7 +81,7 @@
#define XRRSetMonitor XRRSetMonitor_dylibloader_orig_xrandr
#define XRRDeleteMonitor XRRDeleteMonitor_dylibloader_orig_xrandr
#define XRRFreeMonitors XRRFreeMonitors_dylibloader_orig_xrandr
-#include <X11/extensions/Xrandr.h>
+#include "thirdparty/linuxbsd_headers/X11/extensions/Xrandr.h"
#undef XRRQueryExtension
#undef XRRQueryVersion
#undef XRRGetScreenInfo
diff --git a/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.c
index 2d3847e584..7421f94601 100644
--- a/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.c
+++ b/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.c
@@ -1,7 +1,7 @@
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:55:28
-// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xrender.h --sys-include <X11/extensions/Xrender.h> --soname libXrender.so.1 --init-name xrender --output-header xrender-so_wrap.h --output-implementation xrender-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-23 15:14:14
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/X11/extensions/Xrender.h --sys-include "thirdparty/linuxbsd_headers/X11/extensions/Xrender.h" --soname libXrender.so.1 --init-name xrender --output-header ./platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.h --output-implementation ./platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.c~
//
// NOTE: Generated from Xrender 0.9.10.
// This has been handpatched to workaround some issues with the generator that
@@ -53,7 +53,7 @@
#define XRenderCreateLinearGradient XRenderCreateLinearGradient_dylibloader_orig_xrender
#define XRenderCreateRadialGradient XRenderCreateRadialGradient_dylibloader_orig_xrender
#define XRenderCreateConicalGradient XRenderCreateConicalGradient_dylibloader_orig_xrender
-#include <X11/extensions/Xrender.h>
+#include "thirdparty/linuxbsd_headers/X11/extensions/Xrender.h"
#undef XRenderQueryExtension
#undef XRenderQueryVersion
#undef XRenderQueryFormats
diff --git a/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.h b/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.h
index e873448ec5..5d3f695959 100644
--- a/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.h
+++ b/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.h
@@ -2,8 +2,8 @@
#define DYLIBLOAD_WRAPPER_XRENDER
// This file is generated. Do not edit!
// see https://github.com/hpvb/dynload-wrapper for details
-// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:55:28
-// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xrender.h --sys-include <X11/extensions/Xrender.h> --soname libXrender.so.1 --init-name xrender --output-header xrender-so_wrap.h --output-implementation xrender-so_wrap.c
+// generated by generate-wrapper.py 0.3 on 2023-01-23 15:14:14
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/X11/extensions/Xrender.h --sys-include "thirdparty/linuxbsd_headers/X11/extensions/Xrender.h" --soname libXrender.so.1 --init-name xrender --output-header ./platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.h --output-implementation ./platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.c~
//
// NOTE: Generated from Xrender 0.9.10.
// This has been handpatched to workaround some issues with the generator that
@@ -55,7 +55,7 @@
#define XRenderCreateLinearGradient XRenderCreateLinearGradient_dylibloader_orig_xrender
#define XRenderCreateRadialGradient XRenderCreateRadialGradient_dylibloader_orig_xrender
#define XRenderCreateConicalGradient XRenderCreateConicalGradient_dylibloader_orig_xrender
-#include <X11/extensions/Xrender.h>
+#include "thirdparty/linuxbsd_headers/X11/extensions/Xrender.h"
#undef XRenderQueryExtension
#undef XRenderQueryVersion
#undef XRenderQueryFormats
diff --git a/platform/linuxbsd/x11/key_mapping_x11.cpp b/platform/linuxbsd/x11/key_mapping_x11.cpp
index 52b7e865bd..e5eba6ccad 100644
--- a/platform/linuxbsd/x11/key_mapping_x11.cpp
+++ b/platform/linuxbsd/x11/key_mapping_x11.cpp
@@ -30,1972 +30,1122 @@
#include "key_mapping_x11.h"
-/***** SCAN CODE CONVERSION ******/
+void KeyMappingX11::initialize() {
+ // X11 Keysym to Godot Key map.
-struct _XTranslatePair {
- KeySym keysym;
- Key keycode;
-};
+ xkeysym_map[XK_Escape] = Key::ESCAPE;
+ xkeysym_map[XK_Tab] = Key::TAB;
+ xkeysym_map[XK_ISO_Left_Tab] = Key::BACKTAB;
+ xkeysym_map[XK_BackSpace] = Key::BACKSPACE;
+ xkeysym_map[XK_Return] = Key::ENTER;
+ xkeysym_map[XK_Insert] = Key::INSERT;
+ xkeysym_map[XK_Delete] = Key::KEY_DELETE;
+ xkeysym_map[XK_Clear] = Key::KEY_DELETE;
+ xkeysym_map[XK_Pause] = Key::PAUSE;
+ xkeysym_map[XK_Print] = Key::PRINT;
+ xkeysym_map[XK_Home] = Key::HOME;
+ xkeysym_map[XK_End] = Key::END;
+ xkeysym_map[XK_Left] = Key::LEFT;
+ xkeysym_map[XK_Up] = Key::UP;
+ xkeysym_map[XK_Right] = Key::RIGHT;
+ xkeysym_map[XK_Down] = Key::DOWN;
+ xkeysym_map[XK_Prior] = Key::PAGEUP;
+ xkeysym_map[XK_Next] = Key::PAGEDOWN;
+ xkeysym_map[XK_Shift_L] = Key::SHIFT;
+ xkeysym_map[XK_Shift_R] = Key::SHIFT;
+ xkeysym_map[XK_Shift_Lock] = Key::SHIFT;
+ xkeysym_map[XK_Control_L] = Key::CTRL;
+ xkeysym_map[XK_Control_R] = Key::CTRL;
+ xkeysym_map[XK_Meta_L] = Key::META;
+ xkeysym_map[XK_Meta_R] = Key::META;
+ xkeysym_map[XK_Alt_L] = Key::ALT;
+ xkeysym_map[XK_Alt_R] = Key::ALT;
+ xkeysym_map[XK_Caps_Lock] = Key::CAPSLOCK;
+ xkeysym_map[XK_Num_Lock] = Key::NUMLOCK;
+ xkeysym_map[XK_Scroll_Lock] = Key::SCROLLLOCK;
+ xkeysym_map[XK_less] = Key::QUOTELEFT;
+ xkeysym_map[XK_grave] = Key::SECTION;
+ xkeysym_map[XK_Super_L] = Key::META;
+ xkeysym_map[XK_Super_R] = Key::META;
+ xkeysym_map[XK_Menu] = Key::MENU;
+ xkeysym_map[XK_Hyper_L] = Key::HYPER;
+ xkeysym_map[XK_Hyper_R] = Key::HYPER;
+ xkeysym_map[XK_Help] = Key::HELP;
+ xkeysym_map[XK_KP_Space] = Key::SPACE;
+ xkeysym_map[XK_KP_Tab] = Key::TAB;
+ xkeysym_map[XK_KP_Enter] = Key::KP_ENTER;
+ xkeysym_map[XK_Home] = Key::HOME;
+ xkeysym_map[XK_Left] = Key::LEFT;
+ xkeysym_map[XK_Up] = Key::UP;
+ xkeysym_map[XK_Right] = Key::RIGHT;
+ xkeysym_map[XK_Down] = Key::DOWN;
+ xkeysym_map[XK_Prior] = Key::PAGEUP;
+ xkeysym_map[XK_Next] = Key::PAGEDOWN;
+ xkeysym_map[XK_End] = Key::END;
+ xkeysym_map[XK_Begin] = Key::CLEAR;
+ xkeysym_map[XK_Insert] = Key::INSERT;
+ xkeysym_map[XK_Delete] = Key::KEY_DELETE;
+ //xkeysym_map[XK_KP_Equal]
+ //xkeysym_map[XK_KP_Separator]
+ xkeysym_map[XK_KP_Decimal] = Key::KP_PERIOD;
+ xkeysym_map[XK_KP_Delete] = Key::KP_PERIOD;
+ xkeysym_map[XK_KP_Multiply] = Key::KP_MULTIPLY;
+ xkeysym_map[XK_KP_Divide] = Key::KP_DIVIDE;
+ xkeysym_map[XK_KP_Subtract] = Key::KP_SUBTRACT;
+ xkeysym_map[XK_KP_Add] = Key::KP_ADD;
+ xkeysym_map[XK_KP_0] = Key::KP_0;
+ xkeysym_map[XK_KP_1] = Key::KP_1;
+ xkeysym_map[XK_KP_2] = Key::KP_2;
+ xkeysym_map[XK_KP_3] = Key::KP_3;
+ xkeysym_map[XK_KP_4] = Key::KP_4;
+ xkeysym_map[XK_KP_5] = Key::KP_5;
+ xkeysym_map[XK_KP_6] = Key::KP_6;
+ xkeysym_map[XK_KP_7] = Key::KP_7;
+ xkeysym_map[XK_KP_8] = Key::KP_8;
+ xkeysym_map[XK_KP_9] = Key::KP_9;
+ // Same keys but with numlock off.
+ xkeysym_map[XK_KP_Insert] = Key::INSERT;
+ xkeysym_map[XK_KP_End] = Key::END;
+ xkeysym_map[XK_KP_Down] = Key::DOWN;
+ xkeysym_map[XK_KP_Page_Down] = Key::PAGEDOWN;
+ xkeysym_map[XK_KP_Left] = Key::LEFT;
+ // X11 documents this (numpad 5) as "begin of line" but no toolkit seems to interpret it this way.
+ // On Windows this is emitting Key::Clear so for consistency it will be mapped to Key::Clear
+ xkeysym_map[XK_KP_Begin] = Key::CLEAR;
+ xkeysym_map[XK_KP_Right] = Key::RIGHT;
+ xkeysym_map[XK_KP_Home] = Key::HOME;
+ xkeysym_map[XK_KP_Up] = Key::UP;
+ xkeysym_map[XK_KP_Page_Up] = Key::PAGEUP;
+ xkeysym_map[XK_F1] = Key::F1;
+ xkeysym_map[XK_F2] = Key::F2;
+ xkeysym_map[XK_F3] = Key::F3;
+ xkeysym_map[XK_F4] = Key::F4;
+ xkeysym_map[XK_F5] = Key::F5;
+ xkeysym_map[XK_F6] = Key::F6;
+ xkeysym_map[XK_F7] = Key::F7;
+ xkeysym_map[XK_F8] = Key::F8;
+ xkeysym_map[XK_F9] = Key::F9;
+ xkeysym_map[XK_F10] = Key::F10;
+ xkeysym_map[XK_F11] = Key::F11;
+ xkeysym_map[XK_F12] = Key::F12;
+ xkeysym_map[XK_F13] = Key::F13;
+ xkeysym_map[XK_F14] = Key::F14;
+ xkeysym_map[XK_F15] = Key::F15;
+ xkeysym_map[XK_F16] = Key::F16;
+ xkeysym_map[XK_F17] = Key::F17;
+ xkeysym_map[XK_F18] = Key::F18;
+ xkeysym_map[XK_F19] = Key::F19;
+ xkeysym_map[XK_F20] = Key::F20;
+ xkeysym_map[XK_F21] = Key::F21;
+ xkeysym_map[XK_F22] = Key::F22;
+ xkeysym_map[XK_F23] = Key::F23;
+ xkeysym_map[XK_F24] = Key::F24;
+ xkeysym_map[XK_F25] = Key::F25;
+ xkeysym_map[XK_F26] = Key::F26;
+ xkeysym_map[XK_F27] = Key::F27;
+ xkeysym_map[XK_F28] = Key::F28;
+ xkeysym_map[XK_F29] = Key::F29;
+ xkeysym_map[XK_F30] = Key::F30;
+ xkeysym_map[XK_F31] = Key::F31;
+ xkeysym_map[XK_F32] = Key::F32;
+ xkeysym_map[XK_F33] = Key::F33;
+ xkeysym_map[XK_F34] = Key::F34;
+ xkeysym_map[XK_F35] = Key::F35;
+ xkeysym_map[XK_yen] = Key::YEN;
+ xkeysym_map[XK_section] = Key::SECTION;
+ // Media keys.
+ xkeysym_map[XF86XK_Back] = Key::BACK;
+ xkeysym_map[XF86XK_Forward] = Key::FORWARD;
+ xkeysym_map[XF86XK_Stop] = Key::STOP;
+ xkeysym_map[XF86XK_Refresh] = Key::REFRESH;
+ xkeysym_map[XF86XK_Favorites] = Key::FAVORITES;
+ xkeysym_map[XF86XK_OpenURL] = Key::OPENURL;
+ xkeysym_map[XF86XK_HomePage] = Key::HOMEPAGE;
+ xkeysym_map[XF86XK_Search] = Key::SEARCH;
+ xkeysym_map[XF86XK_AudioLowerVolume] = Key::VOLUMEDOWN;
+ xkeysym_map[XF86XK_AudioMute] = Key::VOLUMEMUTE;
+ xkeysym_map[XF86XK_AudioRaiseVolume] = Key::VOLUMEUP;
+ xkeysym_map[XF86XK_AudioPlay] = Key::MEDIAPLAY;
+ xkeysym_map[XF86XK_AudioStop] = Key::MEDIASTOP;
+ xkeysym_map[XF86XK_AudioPrev] = Key::MEDIAPREVIOUS;
+ xkeysym_map[XF86XK_AudioNext] = Key::MEDIANEXT;
+ xkeysym_map[XF86XK_AudioRecord] = Key::MEDIARECORD;
+ xkeysym_map[XF86XK_Standby] = Key::STANDBY;
+ // Launch keys.
+ xkeysym_map[XF86XK_Mail] = Key::LAUNCHMAIL;
+ xkeysym_map[XF86XK_AudioMedia] = Key::LAUNCHMEDIA;
+ xkeysym_map[XF86XK_MyComputer] = Key::LAUNCH0;
+ xkeysym_map[XF86XK_Calculator] = Key::LAUNCH1;
+ xkeysym_map[XF86XK_Launch0] = Key::LAUNCH2;
+ xkeysym_map[XF86XK_Launch1] = Key::LAUNCH3;
+ xkeysym_map[XF86XK_Launch2] = Key::LAUNCH4;
+ xkeysym_map[XF86XK_Launch3] = Key::LAUNCH5;
+ xkeysym_map[XF86XK_Launch4] = Key::LAUNCH6;
+ xkeysym_map[XF86XK_Launch5] = Key::LAUNCH7;
+ xkeysym_map[XF86XK_Launch6] = Key::LAUNCH8;
+ xkeysym_map[XF86XK_Launch7] = Key::LAUNCH9;
+ xkeysym_map[XF86XK_Launch8] = Key::LAUNCHA;
+ xkeysym_map[XF86XK_Launch9] = Key::LAUNCHB;
+ xkeysym_map[XF86XK_LaunchA] = Key::LAUNCHC;
+ xkeysym_map[XF86XK_LaunchB] = Key::LAUNCHD;
+ xkeysym_map[XF86XK_LaunchC] = Key::LAUNCHE;
+ xkeysym_map[XF86XK_LaunchD] = Key::LAUNCHF;
-static _XTranslatePair _xkeysym_to_keycode[] = {
- // misc keys
+ // Scancode to Godot Key map.
+ scancode_map[0x09] = Key::ESCAPE;
+ scancode_map[0x0A] = Key::KEY_1;
+ scancode_map[0x0B] = Key::KEY_2;
+ scancode_map[0x0C] = Key::KEY_3;
+ scancode_map[0x0D] = Key::KEY_4;
+ scancode_map[0x0E] = Key::KEY_5;
+ scancode_map[0x0F] = Key::KEY_6;
+ scancode_map[0x10] = Key::KEY_7;
+ scancode_map[0x11] = Key::KEY_8;
+ scancode_map[0x12] = Key::KEY_9;
+ scancode_map[0x13] = Key::KEY_0;
+ scancode_map[0x14] = Key::MINUS;
+ scancode_map[0x15] = Key::EQUAL;
+ scancode_map[0x16] = Key::BACKSPACE;
+ scancode_map[0x17] = Key::TAB;
+ scancode_map[0x18] = Key::Q;
+ scancode_map[0x19] = Key::W;
+ scancode_map[0x1A] = Key::E;
+ scancode_map[0x1B] = Key::R;
+ scancode_map[0x1C] = Key::T;
+ scancode_map[0x1D] = Key::Y;
+ scancode_map[0x1E] = Key::U;
+ scancode_map[0x1F] = Key::I;
+ scancode_map[0x20] = Key::O;
+ scancode_map[0x21] = Key::P;
+ scancode_map[0x22] = Key::BRACELEFT;
+ scancode_map[0x23] = Key::BRACERIGHT;
+ scancode_map[0x24] = Key::ENTER;
+ scancode_map[0x25] = Key::CTRL;
+ scancode_map[0x26] = Key::A;
+ scancode_map[0x27] = Key::S;
+ scancode_map[0x28] = Key::D;
+ scancode_map[0x29] = Key::F;
+ scancode_map[0x2A] = Key::G;
+ scancode_map[0x2B] = Key::H;
+ scancode_map[0x2C] = Key::J;
+ scancode_map[0x2D] = Key::K;
+ scancode_map[0x2E] = Key::L;
+ scancode_map[0x2F] = Key::SEMICOLON;
+ scancode_map[0x30] = Key::APOSTROPHE;
+ scancode_map[0x31] = Key::SECTION;
+ scancode_map[0x32] = Key::SHIFT;
+ scancode_map[0x33] = Key::BACKSLASH;
+ scancode_map[0x34] = Key::Z;
+ scancode_map[0x35] = Key::X;
+ scancode_map[0x36] = Key::C;
+ scancode_map[0x37] = Key::V;
+ scancode_map[0x38] = Key::B;
+ scancode_map[0x39] = Key::N;
+ scancode_map[0x3A] = Key::M;
+ scancode_map[0x3B] = Key::COMMA;
+ scancode_map[0x3C] = Key::PERIOD;
+ scancode_map[0x3D] = Key::SLASH;
+ scancode_map[0x3E] = Key::SHIFT;
+ scancode_map[0x3F] = Key::KP_MULTIPLY;
+ scancode_map[0x40] = Key::ALT;
+ scancode_map[0x41] = Key::SPACE;
+ scancode_map[0x42] = Key::CAPSLOCK;
+ scancode_map[0x43] = Key::F1;
+ scancode_map[0x44] = Key::F2;
+ scancode_map[0x45] = Key::F3;
+ scancode_map[0x46] = Key::F4;
+ scancode_map[0x47] = Key::F5;
+ scancode_map[0x48] = Key::F6;
+ scancode_map[0x49] = Key::F7;
+ scancode_map[0x4A] = Key::F8;
+ scancode_map[0x4B] = Key::F9;
+ scancode_map[0x4C] = Key::F10;
+ scancode_map[0x4D] = Key::NUMLOCK;
+ scancode_map[0x4E] = Key::SCROLLLOCK;
+ scancode_map[0x4F] = Key::KP_7;
+ scancode_map[0x50] = Key::KP_8;
+ scancode_map[0x51] = Key::KP_9;
+ scancode_map[0x52] = Key::KP_SUBTRACT;
+ scancode_map[0x53] = Key::KP_4;
+ scancode_map[0x54] = Key::KP_5;
+ scancode_map[0x55] = Key::KP_6;
+ scancode_map[0x56] = Key::KP_ADD;
+ scancode_map[0x57] = Key::KP_1;
+ scancode_map[0x58] = Key::KP_2;
+ scancode_map[0x59] = Key::KP_3;
+ scancode_map[0x5A] = Key::KP_0;
+ scancode_map[0x5B] = Key::KP_PERIOD;
+ scancode_map[0x5E] = Key::QUOTELEFT;
+ scancode_map[0x5F] = Key::F11;
+ scancode_map[0x60] = Key::F12;
+ scancode_map[0x68] = Key::KP_ENTER;
+ scancode_map[0x69] = Key::CTRL;
+ scancode_map[0x6A] = Key::KP_DIVIDE;
+ scancode_map[0x6B] = Key::PRINT;
+ scancode_map[0x6C] = Key::ALT;
+ scancode_map[0x6D] = Key::ENTER;
+ scancode_map[0x6E] = Key::HOME;
+ scancode_map[0x6F] = Key::UP;
+ scancode_map[0x70] = Key::PAGEUP;
+ scancode_map[0x71] = Key::LEFT;
+ scancode_map[0x72] = Key::RIGHT;
+ scancode_map[0x73] = Key::END;
+ scancode_map[0x74] = Key::DOWN;
+ scancode_map[0x75] = Key::PAGEDOWN;
+ scancode_map[0x76] = Key::INSERT;
+ scancode_map[0x77] = Key::KEY_DELETE;
+ scancode_map[0x79] = Key::VOLUMEMUTE;
+ scancode_map[0x7A] = Key::VOLUMEDOWN;
+ scancode_map[0x7B] = Key::VOLUMEUP;
+ scancode_map[0x7F] = Key::PAUSE;
+ scancode_map[0x85] = Key::META;
+ scancode_map[0x86] = Key::META;
+ scancode_map[0x87] = Key::MENU;
+ scancode_map[0xBF] = Key::F13;
+ scancode_map[0xC0] = Key::F14;
+ scancode_map[0xC1] = Key::F15;
+ scancode_map[0xC2] = Key::F16;
+ scancode_map[0xC3] = Key::F17;
+ scancode_map[0xC4] = Key::F18;
+ scancode_map[0xC5] = Key::F19;
+ scancode_map[0xC6] = Key::F20;
+ scancode_map[0xC7] = Key::F21;
+ scancode_map[0xC8] = Key::F22;
+ scancode_map[0xC9] = Key::F23;
+ scancode_map[0xCA] = Key::F24;
+ scancode_map[0xCB] = Key::F25;
+ scancode_map[0xCC] = Key::F26;
+ scancode_map[0xCD] = Key::F27;
+ scancode_map[0xCE] = Key::F28;
+ scancode_map[0xCF] = Key::F29;
+ scancode_map[0xD0] = Key::F30;
+ scancode_map[0xD1] = Key::F31;
+ scancode_map[0xD2] = Key::F32;
+ scancode_map[0xD3] = Key::F33;
+ scancode_map[0xD4] = Key::F34;
+ scancode_map[0xD5] = Key::F35;
- { XK_Escape, Key::ESCAPE },
- { XK_Tab, Key::TAB },
- { XK_ISO_Left_Tab, Key::BACKTAB },
- { XK_BackSpace, Key::BACKSPACE },
- { XK_Return, Key::ENTER },
- { XK_Insert, Key::INSERT },
- { XK_Delete, Key::KEY_DELETE },
- { XK_Clear, Key::KEY_DELETE },
- { XK_Pause, Key::PAUSE },
- { XK_Print, Key::PRINT },
- { XK_Home, Key::HOME },
- { XK_End, Key::END },
- { XK_Left, Key::LEFT },
- { XK_Up, Key::UP },
- { XK_Right, Key::RIGHT },
- { XK_Down, Key::DOWN },
- { XK_Prior, Key::PAGEUP },
- { XK_Next, Key::PAGEDOWN },
- { XK_Shift_L, Key::SHIFT },
- { XK_Shift_R, Key::SHIFT },
- { XK_Shift_Lock, Key::SHIFT },
- { XK_Control_L, Key::CTRL },
- { XK_Control_R, Key::CTRL },
- { XK_Meta_L, Key::META },
- { XK_Meta_R, Key::META },
- { XK_Alt_L, Key::ALT },
- { XK_Alt_R, Key::ALT },
- { XK_Caps_Lock, Key::CAPSLOCK },
- { XK_Num_Lock, Key::NUMLOCK },
- { XK_Scroll_Lock, Key::SCROLLLOCK },
- { XK_Super_L, Key::SUPER_L },
- { XK_Super_R, Key::SUPER_R },
- { XK_Menu, Key::MENU },
- { XK_Hyper_L, Key::HYPER_L },
- { XK_Hyper_R, Key::HYPER_R },
- { XK_Help, Key::HELP },
- { XK_KP_Space, Key::SPACE },
- { XK_KP_Tab, Key::TAB },
- { XK_KP_Enter, Key::KP_ENTER },
- { XK_Home, Key::HOME },
- { XK_Left, Key::LEFT },
- { XK_Up, Key::UP },
- { XK_Right, Key::RIGHT },
- { XK_Down, Key::DOWN },
- { XK_Prior, Key::PAGEUP },
- { XK_Next, Key::PAGEDOWN },
- { XK_End, Key::END },
- { XK_Begin, Key::CLEAR },
- { XK_Insert, Key::INSERT },
- { XK_Delete, Key::KEY_DELETE },
- //{ XK_KP_Equal, Key::EQUAL },
- //{ XK_KP_Separator, Key::COMMA },
- { XK_KP_Decimal, Key::KP_PERIOD },
- { XK_KP_Delete, Key::KP_PERIOD },
- { XK_KP_Multiply, Key::KP_MULTIPLY },
- { XK_KP_Divide, Key::KP_DIVIDE },
- { XK_KP_Subtract, Key::KP_SUBTRACT },
- { XK_KP_Add, Key::KP_ADD },
- { XK_KP_0, Key::KP_0 },
- { XK_KP_1, Key::KP_1 },
- { XK_KP_2, Key::KP_2 },
- { XK_KP_3, Key::KP_3 },
- { XK_KP_4, Key::KP_4 },
- { XK_KP_5, Key::KP_5 },
- { XK_KP_6, Key::KP_6 },
- { XK_KP_7, Key::KP_7 },
- { XK_KP_8, Key::KP_8 },
- { XK_KP_9, Key::KP_9 },
- // same keys but with numlock off
- { XK_KP_Insert, Key::INSERT },
- { XK_KP_End, Key::END },
- { XK_KP_Down, Key::DOWN },
- { XK_KP_Page_Down, Key::PAGEDOWN },
- { XK_KP_Left, Key::LEFT },
- // X11 documents this (numpad 5) as "begin of line" but no toolkit
- // seems to interpret it this way.
- // On Windows this is emitting Key::Clear so for consistency it
- // will be mapped to Key::Clear
- { XK_KP_Begin, Key::CLEAR },
- { XK_KP_Right, Key::RIGHT },
- { XK_KP_Home, Key::HOME },
- { XK_KP_Up, Key::UP },
- { XK_KP_Page_Up, Key::PAGEUP },
- { XK_F1, Key::F1 },
- { XK_F2, Key::F2 },
- { XK_F3, Key::F3 },
- { XK_F4, Key::F4 },
- { XK_F5, Key::F5 },
- { XK_F6, Key::F6 },
- { XK_F7, Key::F7 },
- { XK_F8, Key::F8 },
- { XK_F9, Key::F9 },
- { XK_F10, Key::F10 },
- { XK_F11, Key::F11 },
- { XK_F12, Key::F12 },
- { XK_F13, Key::F13 },
- { XK_F14, Key::F14 },
- { XK_F15, Key::F15 },
- { XK_F16, Key::F16 },
- { XK_F17, Key::F17 },
- { XK_F18, Key::F18 },
- { XK_F19, Key::F19 },
- { XK_F20, Key::F20 },
- { XK_F21, Key::F21 },
- { XK_F22, Key::F22 },
- { XK_F23, Key::F23 },
- { XK_F24, Key::F24 },
- { XK_F25, Key::F25 },
- { XK_F26, Key::F26 },
- { XK_F27, Key::F27 },
- { XK_F28, Key::F28 },
- { XK_F29, Key::F29 },
- { XK_F30, Key::F30 },
- { XK_F31, Key::F31 },
- { XK_F32, Key::F32 },
- { XK_F33, Key::F33 },
- { XK_F34, Key::F34 },
- { XK_F35, Key::F35 },
-
- // media keys
- { XF86XK_Back, Key::BACK },
- { XF86XK_Forward, Key::FORWARD },
- { XF86XK_Stop, Key::STOP },
- { XF86XK_Refresh, Key::REFRESH },
- { XF86XK_Favorites, Key::FAVORITES },
- { XF86XK_AudioMedia, Key::LAUNCHMEDIA },
- { XF86XK_OpenURL, Key::OPENURL },
- { XF86XK_HomePage, Key::HOMEPAGE },
- { XF86XK_Search, Key::SEARCH },
- { XF86XK_AudioLowerVolume, Key::VOLUMEDOWN },
- { XF86XK_AudioMute, Key::VOLUMEMUTE },
- { XF86XK_AudioRaiseVolume, Key::VOLUMEUP },
- { XF86XK_AudioPlay, Key::MEDIAPLAY },
- { XF86XK_AudioStop, Key::MEDIASTOP },
- { XF86XK_AudioPrev, Key::MEDIAPREVIOUS },
- { XF86XK_AudioNext, Key::MEDIANEXT },
- { XF86XK_AudioRecord, Key::MEDIARECORD },
-
- // launch keys
- { XF86XK_Mail, Key::LAUNCHMAIL },
- { XF86XK_MyComputer, Key::LAUNCH0 },
- { XF86XK_Calculator, Key::LAUNCH1 },
- { XF86XK_Standby, Key::STANDBY },
-
- { XF86XK_Launch0, Key::LAUNCH2 },
- { XF86XK_Launch1, Key::LAUNCH3 },
- { XF86XK_Launch2, Key::LAUNCH4 },
- { XF86XK_Launch3, Key::LAUNCH5 },
- { XF86XK_Launch4, Key::LAUNCH6 },
- { XF86XK_Launch5, Key::LAUNCH7 },
- { XF86XK_Launch6, Key::LAUNCH8 },
- { XF86XK_Launch7, Key::LAUNCH9 },
- { XF86XK_Launch8, Key::LAUNCHA },
- { XF86XK_Launch9, Key::LAUNCHB },
- { XF86XK_LaunchA, Key::LAUNCHC },
- { XF86XK_LaunchB, Key::LAUNCHD },
- { XF86XK_LaunchC, Key::LAUNCHE },
- { XF86XK_LaunchD, Key::LAUNCHF },
-
- { 0, Key::NONE }
-};
-
-struct _TranslatePair {
- Key keysym;
- unsigned int keycode;
-};
-
-static _TranslatePair _scancode_to_keycode[] = {
- { Key::ESCAPE, 0x09 },
- { Key::KEY_1, 0x0A },
- { Key::KEY_2, 0x0B },
- { Key::KEY_3, 0x0C },
- { Key::KEY_4, 0x0D },
- { Key::KEY_5, 0x0E },
- { Key::KEY_6, 0x0F },
- { Key::KEY_7, 0x10 },
- { Key::KEY_8, 0x11 },
- { Key::KEY_9, 0x12 },
- { Key::KEY_0, 0x13 },
- { Key::MINUS, 0x14 },
- { Key::EQUAL, 0x15 },
- { Key::BACKSPACE, 0x16 },
- { Key::TAB, 0x17 },
- { Key::Q, 0x18 },
- { Key::W, 0x19 },
- { Key::E, 0x1A },
- { Key::R, 0x1B },
- { Key::T, 0x1C },
- { Key::Y, 0x1D },
- { Key::U, 0x1E },
- { Key::I, 0x1F },
- { Key::O, 0x20 },
- { Key::P, 0x21 },
- { Key::BRACELEFT, 0x22 },
- { Key::BRACERIGHT, 0x23 },
- { Key::ENTER, 0x24 },
- { Key::CTRL, 0x25 },
- { Key::A, 0x26 },
- { Key::S, 0x27 },
- { Key::D, 0x28 },
- { Key::F, 0x29 },
- { Key::G, 0x2A },
- { Key::H, 0x2B },
- { Key::J, 0x2C },
- { Key::K, 0x2D },
- { Key::L, 0x2E },
- { Key::SEMICOLON, 0x2F },
- { Key::APOSTROPHE, 0x30 },
- { Key::QUOTELEFT, 0x31 },
- { Key::SHIFT, 0x32 },
- { Key::BACKSLASH, 0x33 },
- { Key::Z, 0x34 },
- { Key::X, 0x35 },
- { Key::C, 0x36 },
- { Key::V, 0x37 },
- { Key::B, 0x38 },
- { Key::N, 0x39 },
- { Key::M, 0x3A },
- { Key::COMMA, 0x3B },
- { Key::PERIOD, 0x3C },
- { Key::SLASH, 0x3D },
- { Key::SHIFT, 0x3E },
- { Key::KP_MULTIPLY, 0x3F },
- { Key::ALT, 0x40 },
- { Key::SPACE, 0x41 },
- { Key::CAPSLOCK, 0x42 },
- { Key::F1, 0x43 },
- { Key::F2, 0x44 },
- { Key::F3, 0x45 },
- { Key::F4, 0x46 },
- { Key::F5, 0x47 },
- { Key::F6, 0x48 },
- { Key::F7, 0x49 },
- { Key::F8, 0x4A },
- { Key::F9, 0x4B },
- { Key::F10, 0x4C },
- { Key::NUMLOCK, 0x4D },
- { Key::SCROLLLOCK, 0x4E },
- { Key::KP_7, 0x4F },
- { Key::KP_8, 0x50 },
- { Key::KP_9, 0x51 },
- { Key::KP_SUBTRACT, 0x52 },
- { Key::KP_4, 0x53 },
- { Key::KP_5, 0x54 },
- { Key::KP_6, 0x55 },
- { Key::KP_ADD, 0x56 },
- { Key::KP_1, 0x57 },
- { Key::KP_2, 0x58 },
- { Key::KP_3, 0x59 },
- { Key::KP_0, 0x5A },
- { Key::KP_PERIOD, 0x5B },
- //{ Key::???, 0x5E }, //NON US BACKSLASH
- { Key::F11, 0x5F },
- { Key::F12, 0x60 },
- { Key::KP_ENTER, 0x68 },
- { Key::CTRL, 0x69 },
- { Key::KP_DIVIDE, 0x6A },
- { Key::PRINT, 0x6B },
- { Key::ALT, 0x6C },
- { Key::ENTER, 0x6D },
- { Key::HOME, 0x6E },
- { Key::UP, 0x6F },
- { Key::PAGEUP, 0x70 },
- { Key::LEFT, 0x71 },
- { Key::RIGHT, 0x72 },
- { Key::END, 0x73 },
- { Key::DOWN, 0x74 },
- { Key::PAGEDOWN, 0x75 },
- { Key::INSERT, 0x76 },
- { Key::KEY_DELETE, 0x77 },
- { Key::VOLUMEMUTE, 0x79 },
- { Key::VOLUMEDOWN, 0x7A },
- { Key::VOLUMEUP, 0x7B },
- { Key::PAUSE, 0x7F },
- { Key::SUPER_L, 0x85 },
- { Key::SUPER_R, 0x86 },
- { Key::MENU, 0x87 },
- { Key::F13, 0xBF },
- { Key::F14, 0xC0 },
- { Key::F15, 0xC1 },
- { Key::F16, 0xC2 },
- { Key::F17, 0xC3 },
- { Key::F18, 0xC4 },
- { Key::F19, 0xC5 },
- { Key::F20, 0xC6 },
- { Key::F21, 0xC7 },
- { Key::F22, 0xC8 },
- { Key::F23, 0xC9 },
- { Key::F24, 0xCA },
- { Key::F25, 0xCB },
- { Key::F26, 0xCC },
- { Key::F27, 0xCD },
- { Key::F28, 0xCE },
- { Key::F29, 0xCF },
- { Key::F30, 0xD0 },
- { Key::F31, 0xD1 },
- { Key::F32, 0xD2 },
- { Key::F33, 0xD3 },
- { Key::F34, 0xD4 },
- { Key::F35, 0xD5 },
- { Key::UNKNOWN, 0 }
-};
-
-Key KeyMappingX11::get_scancode(unsigned int p_code) {
- Key keycode = Key::UNKNOWN;
- for (int i = 0; _scancode_to_keycode[i].keysym != Key::UNKNOWN; i++) {
- if (_scancode_to_keycode[i].keycode == p_code) {
- keycode = _scancode_to_keycode[i].keysym;
- break;
- }
+ // Godot to scancode map.
+ for (const KeyValue<unsigned int, Key> &E : scancode_map) {
+ scancode_map_inv[E.value] = E.key;
}
- return keycode;
+ // Keysym to Unicode map, tables taken from FOX toolkit.
+ xkeysym_unicode_map[0x01A1] = 0x0104;
+ xkeysym_unicode_map[0x01A2] = 0x02D8;
+ xkeysym_unicode_map[0x01A3] = 0x0141;
+ xkeysym_unicode_map[0x01A5] = 0x013D;
+ xkeysym_unicode_map[0x01A6] = 0x015A;
+ xkeysym_unicode_map[0x01A9] = 0x0160;
+ xkeysym_unicode_map[0x01AA] = 0x015E;
+ xkeysym_unicode_map[0x01AB] = 0x0164;
+ xkeysym_unicode_map[0x01AC] = 0x0179;
+ xkeysym_unicode_map[0x01AE] = 0x017D;
+ xkeysym_unicode_map[0x01AF] = 0x017B;
+ xkeysym_unicode_map[0x01B1] = 0x0105;
+ xkeysym_unicode_map[0x01B2] = 0x02DB;
+ xkeysym_unicode_map[0x01B3] = 0x0142;
+ xkeysym_unicode_map[0x01B5] = 0x013E;
+ xkeysym_unicode_map[0x01B6] = 0x015B;
+ xkeysym_unicode_map[0x01B7] = 0x02C7;
+ xkeysym_unicode_map[0x01B9] = 0x0161;
+ xkeysym_unicode_map[0x01BA] = 0x015F;
+ xkeysym_unicode_map[0x01BB] = 0x0165;
+ xkeysym_unicode_map[0x01BC] = 0x017A;
+ xkeysym_unicode_map[0x01BD] = 0x02DD;
+ xkeysym_unicode_map[0x01BE] = 0x017E;
+ xkeysym_unicode_map[0x01BF] = 0x017C;
+ xkeysym_unicode_map[0x01C0] = 0x0154;
+ xkeysym_unicode_map[0x01C3] = 0x0102;
+ xkeysym_unicode_map[0x01C5] = 0x0139;
+ xkeysym_unicode_map[0x01C6] = 0x0106;
+ xkeysym_unicode_map[0x01C8] = 0x010C;
+ xkeysym_unicode_map[0x01CA] = 0x0118;
+ xkeysym_unicode_map[0x01CC] = 0x011A;
+ xkeysym_unicode_map[0x01CF] = 0x010E;
+ xkeysym_unicode_map[0x01D0] = 0x0110;
+ xkeysym_unicode_map[0x01D1] = 0x0143;
+ xkeysym_unicode_map[0x01D2] = 0x0147;
+ xkeysym_unicode_map[0x01D5] = 0x0150;
+ xkeysym_unicode_map[0x01D8] = 0x0158;
+ xkeysym_unicode_map[0x01D9] = 0x016E;
+ xkeysym_unicode_map[0x01DB] = 0x0170;
+ xkeysym_unicode_map[0x01DE] = 0x0162;
+ xkeysym_unicode_map[0x01E0] = 0x0155;
+ xkeysym_unicode_map[0x01E3] = 0x0103;
+ xkeysym_unicode_map[0x01E5] = 0x013A;
+ xkeysym_unicode_map[0x01E6] = 0x0107;
+ xkeysym_unicode_map[0x01E8] = 0x010D;
+ xkeysym_unicode_map[0x01EA] = 0x0119;
+ xkeysym_unicode_map[0x01EC] = 0x011B;
+ xkeysym_unicode_map[0x01EF] = 0x010F;
+ xkeysym_unicode_map[0x01F0] = 0x0111;
+ xkeysym_unicode_map[0x01F1] = 0x0144;
+ xkeysym_unicode_map[0x01F2] = 0x0148;
+ xkeysym_unicode_map[0x01F5] = 0x0151;
+ xkeysym_unicode_map[0x01F8] = 0x0159;
+ xkeysym_unicode_map[0x01F9] = 0x016F;
+ xkeysym_unicode_map[0x01FB] = 0x0171;
+ xkeysym_unicode_map[0x01FE] = 0x0163;
+ xkeysym_unicode_map[0x01FF] = 0x02D9;
+ xkeysym_unicode_map[0x02A1] = 0x0126;
+ xkeysym_unicode_map[0x02A6] = 0x0124;
+ xkeysym_unicode_map[0x02A9] = 0x0130;
+ xkeysym_unicode_map[0x02AB] = 0x011E;
+ xkeysym_unicode_map[0x02AC] = 0x0134;
+ xkeysym_unicode_map[0x02B1] = 0x0127;
+ xkeysym_unicode_map[0x02B6] = 0x0125;
+ xkeysym_unicode_map[0x02B9] = 0x0131;
+ xkeysym_unicode_map[0x02BB] = 0x011F;
+ xkeysym_unicode_map[0x02BC] = 0x0135;
+ xkeysym_unicode_map[0x02C5] = 0x010A;
+ xkeysym_unicode_map[0x02C6] = 0x0108;
+ xkeysym_unicode_map[0x02D5] = 0x0120;
+ xkeysym_unicode_map[0x02D8] = 0x011C;
+ xkeysym_unicode_map[0x02DD] = 0x016C;
+ xkeysym_unicode_map[0x02DE] = 0x015C;
+ xkeysym_unicode_map[0x02E5] = 0x010B;
+ xkeysym_unicode_map[0x02E6] = 0x0109;
+ xkeysym_unicode_map[0x02F5] = 0x0121;
+ xkeysym_unicode_map[0x02F8] = 0x011D;
+ xkeysym_unicode_map[0x02FD] = 0x016D;
+ xkeysym_unicode_map[0x02FE] = 0x015D;
+ xkeysym_unicode_map[0x03A2] = 0x0138;
+ xkeysym_unicode_map[0x03A3] = 0x0156;
+ xkeysym_unicode_map[0x03A5] = 0x0128;
+ xkeysym_unicode_map[0x03A6] = 0x013B;
+ xkeysym_unicode_map[0x03AA] = 0x0112;
+ xkeysym_unicode_map[0x03AB] = 0x0122;
+ xkeysym_unicode_map[0x03AC] = 0x0166;
+ xkeysym_unicode_map[0x03B3] = 0x0157;
+ xkeysym_unicode_map[0x03B5] = 0x0129;
+ xkeysym_unicode_map[0x03B6] = 0x013C;
+ xkeysym_unicode_map[0x03BA] = 0x0113;
+ xkeysym_unicode_map[0x03BB] = 0x0123;
+ xkeysym_unicode_map[0x03BC] = 0x0167;
+ xkeysym_unicode_map[0x03BD] = 0x014A;
+ xkeysym_unicode_map[0x03BF] = 0x014B;
+ xkeysym_unicode_map[0x03C0] = 0x0100;
+ xkeysym_unicode_map[0x03C7] = 0x012E;
+ xkeysym_unicode_map[0x03CC] = 0x0116;
+ xkeysym_unicode_map[0x03CF] = 0x012A;
+ xkeysym_unicode_map[0x03D1] = 0x0145;
+ xkeysym_unicode_map[0x03D2] = 0x014C;
+ xkeysym_unicode_map[0x03D3] = 0x0136;
+ xkeysym_unicode_map[0x03D9] = 0x0172;
+ xkeysym_unicode_map[0x03DD] = 0x0168;
+ xkeysym_unicode_map[0x03DE] = 0x016A;
+ xkeysym_unicode_map[0x03E0] = 0x0101;
+ xkeysym_unicode_map[0x03E7] = 0x012F;
+ xkeysym_unicode_map[0x03EC] = 0x0117;
+ xkeysym_unicode_map[0x03EF] = 0x012B;
+ xkeysym_unicode_map[0x03F1] = 0x0146;
+ xkeysym_unicode_map[0x03F2] = 0x014D;
+ xkeysym_unicode_map[0x03F3] = 0x0137;
+ xkeysym_unicode_map[0x03F9] = 0x0173;
+ xkeysym_unicode_map[0x03FD] = 0x0169;
+ xkeysym_unicode_map[0x03FE] = 0x016B;
+ xkeysym_unicode_map[0x047E] = 0x203E;
+ xkeysym_unicode_map[0x04A1] = 0x3002;
+ xkeysym_unicode_map[0x04A2] = 0x300C;
+ xkeysym_unicode_map[0x04A3] = 0x300D;
+ xkeysym_unicode_map[0x04A4] = 0x3001;
+ xkeysym_unicode_map[0x04A5] = 0x30FB;
+ xkeysym_unicode_map[0x04A6] = 0x30F2;
+ xkeysym_unicode_map[0x04A7] = 0x30A1;
+ xkeysym_unicode_map[0x04A8] = 0x30A3;
+ xkeysym_unicode_map[0x04A9] = 0x30A5;
+ xkeysym_unicode_map[0x04AA] = 0x30A7;
+ xkeysym_unicode_map[0x04AB] = 0x30A9;
+ xkeysym_unicode_map[0x04AC] = 0x30E3;
+ xkeysym_unicode_map[0x04AD] = 0x30E5;
+ xkeysym_unicode_map[0x04AE] = 0x30E7;
+ xkeysym_unicode_map[0x04AF] = 0x30C3;
+ xkeysym_unicode_map[0x04B0] = 0x30FC;
+ xkeysym_unicode_map[0x04B1] = 0x30A2;
+ xkeysym_unicode_map[0x04B2] = 0x30A4;
+ xkeysym_unicode_map[0x04B3] = 0x30A6;
+ xkeysym_unicode_map[0x04B4] = 0x30A8;
+ xkeysym_unicode_map[0x04B5] = 0x30AA;
+ xkeysym_unicode_map[0x04B6] = 0x30AB;
+ xkeysym_unicode_map[0x04B7] = 0x30AD;
+ xkeysym_unicode_map[0x04B8] = 0x30AF;
+ xkeysym_unicode_map[0x04B9] = 0x30B1;
+ xkeysym_unicode_map[0x04BA] = 0x30B3;
+ xkeysym_unicode_map[0x04BB] = 0x30B5;
+ xkeysym_unicode_map[0x04BC] = 0x30B7;
+ xkeysym_unicode_map[0x04BD] = 0x30B9;
+ xkeysym_unicode_map[0x04BE] = 0x30BB;
+ xkeysym_unicode_map[0x04BF] = 0x30BD;
+ xkeysym_unicode_map[0x04C0] = 0x30BF;
+ xkeysym_unicode_map[0x04C1] = 0x30C1;
+ xkeysym_unicode_map[0x04C2] = 0x30C4;
+ xkeysym_unicode_map[0x04C3] = 0x30C6;
+ xkeysym_unicode_map[0x04C4] = 0x30C8;
+ xkeysym_unicode_map[0x04C5] = 0x30CA;
+ xkeysym_unicode_map[0x04C6] = 0x30CB;
+ xkeysym_unicode_map[0x04C7] = 0x30CC;
+ xkeysym_unicode_map[0x04C8] = 0x30CD;
+ xkeysym_unicode_map[0x04C9] = 0x30CE;
+ xkeysym_unicode_map[0x04CA] = 0x30CF;
+ xkeysym_unicode_map[0x04CB] = 0x30D2;
+ xkeysym_unicode_map[0x04CC] = 0x30D5;
+ xkeysym_unicode_map[0x04CD] = 0x30D8;
+ xkeysym_unicode_map[0x04CE] = 0x30DB;
+ xkeysym_unicode_map[0x04CF] = 0x30DE;
+ xkeysym_unicode_map[0x04D0] = 0x30DF;
+ xkeysym_unicode_map[0x04D1] = 0x30E0;
+ xkeysym_unicode_map[0x04D2] = 0x30E1;
+ xkeysym_unicode_map[0x04D3] = 0x30E2;
+ xkeysym_unicode_map[0x04D4] = 0x30E4;
+ xkeysym_unicode_map[0x04D5] = 0x30E6;
+ xkeysym_unicode_map[0x04D6] = 0x30E8;
+ xkeysym_unicode_map[0x04D7] = 0x30E9;
+ xkeysym_unicode_map[0x04D8] = 0x30EA;
+ xkeysym_unicode_map[0x04D9] = 0x30EB;
+ xkeysym_unicode_map[0x04DA] = 0x30EC;
+ xkeysym_unicode_map[0x04DB] = 0x30ED;
+ xkeysym_unicode_map[0x04DC] = 0x30EF;
+ xkeysym_unicode_map[0x04DD] = 0x30F3;
+ xkeysym_unicode_map[0x04DE] = 0x309B;
+ xkeysym_unicode_map[0x04DF] = 0x309C;
+ xkeysym_unicode_map[0x05AC] = 0x060C;
+ xkeysym_unicode_map[0x05BB] = 0x061B;
+ xkeysym_unicode_map[0x05BF] = 0x061F;
+ xkeysym_unicode_map[0x05C1] = 0x0621;
+ xkeysym_unicode_map[0x05C2] = 0x0622;
+ xkeysym_unicode_map[0x05C3] = 0x0623;
+ xkeysym_unicode_map[0x05C4] = 0x0624;
+ xkeysym_unicode_map[0x05C5] = 0x0625;
+ xkeysym_unicode_map[0x05C6] = 0x0626;
+ xkeysym_unicode_map[0x05C7] = 0x0627;
+ xkeysym_unicode_map[0x05C8] = 0x0628;
+ xkeysym_unicode_map[0x05C9] = 0x0629;
+ xkeysym_unicode_map[0x05CA] = 0x062A;
+ xkeysym_unicode_map[0x05CB] = 0x062B;
+ xkeysym_unicode_map[0x05CC] = 0x062C;
+ xkeysym_unicode_map[0x05CD] = 0x062D;
+ xkeysym_unicode_map[0x05CE] = 0x062E;
+ xkeysym_unicode_map[0x05CF] = 0x062F;
+ xkeysym_unicode_map[0x05D0] = 0x0630;
+ xkeysym_unicode_map[0x05D1] = 0x0631;
+ xkeysym_unicode_map[0x05D2] = 0x0632;
+ xkeysym_unicode_map[0x05D3] = 0x0633;
+ xkeysym_unicode_map[0x05D4] = 0x0634;
+ xkeysym_unicode_map[0x05D5] = 0x0635;
+ xkeysym_unicode_map[0x05D6] = 0x0636;
+ xkeysym_unicode_map[0x05D7] = 0x0637;
+ xkeysym_unicode_map[0x05D8] = 0x0638;
+ xkeysym_unicode_map[0x05D9] = 0x0639;
+ xkeysym_unicode_map[0x05DA] = 0x063A;
+ xkeysym_unicode_map[0x05E0] = 0x0640;
+ xkeysym_unicode_map[0x05E1] = 0x0641;
+ xkeysym_unicode_map[0x05E2] = 0x0642;
+ xkeysym_unicode_map[0x05E3] = 0x0643;
+ xkeysym_unicode_map[0x05E4] = 0x0644;
+ xkeysym_unicode_map[0x05E5] = 0x0645;
+ xkeysym_unicode_map[0x05E6] = 0x0646;
+ xkeysym_unicode_map[0x05E7] = 0x0647;
+ xkeysym_unicode_map[0x05E8] = 0x0648;
+ xkeysym_unicode_map[0x05E9] = 0x0649;
+ xkeysym_unicode_map[0x05EA] = 0x064A;
+ xkeysym_unicode_map[0x05EB] = 0x064B;
+ xkeysym_unicode_map[0x05EC] = 0x064C;
+ xkeysym_unicode_map[0x05ED] = 0x064D;
+ xkeysym_unicode_map[0x05EE] = 0x064E;
+ xkeysym_unicode_map[0x05EF] = 0x064F;
+ xkeysym_unicode_map[0x05F0] = 0x0650;
+ xkeysym_unicode_map[0x05F1] = 0x0651;
+ xkeysym_unicode_map[0x05F2] = 0x0652;
+ xkeysym_unicode_map[0x06A1] = 0x0452;
+ xkeysym_unicode_map[0x06A2] = 0x0453;
+ xkeysym_unicode_map[0x06A3] = 0x0451;
+ xkeysym_unicode_map[0x06A4] = 0x0454;
+ xkeysym_unicode_map[0x06A5] = 0x0455;
+ xkeysym_unicode_map[0x06A6] = 0x0456;
+ xkeysym_unicode_map[0x06A7] = 0x0457;
+ xkeysym_unicode_map[0x06A8] = 0x0458;
+ xkeysym_unicode_map[0x06A9] = 0x0459;
+ xkeysym_unicode_map[0x06AA] = 0x045A;
+ xkeysym_unicode_map[0x06AB] = 0x045B;
+ xkeysym_unicode_map[0x06AC] = 0x045C;
+ xkeysym_unicode_map[0x06AE] = 0x045E;
+ xkeysym_unicode_map[0x06AF] = 0x045F;
+ xkeysym_unicode_map[0x06B0] = 0x2116;
+ xkeysym_unicode_map[0x06B1] = 0x0402;
+ xkeysym_unicode_map[0x06B2] = 0x0403;
+ xkeysym_unicode_map[0x06B3] = 0x0401;
+ xkeysym_unicode_map[0x06B4] = 0x0404;
+ xkeysym_unicode_map[0x06B5] = 0x0405;
+ xkeysym_unicode_map[0x06B6] = 0x0406;
+ xkeysym_unicode_map[0x06B7] = 0x0407;
+ xkeysym_unicode_map[0x06B8] = 0x0408;
+ xkeysym_unicode_map[0x06B9] = 0x0409;
+ xkeysym_unicode_map[0x06BA] = 0x040A;
+ xkeysym_unicode_map[0x06BB] = 0x040B;
+ xkeysym_unicode_map[0x06BC] = 0x040C;
+ xkeysym_unicode_map[0x06BE] = 0x040E;
+ xkeysym_unicode_map[0x06BF] = 0x040F;
+ xkeysym_unicode_map[0x06C0] = 0x044E;
+ xkeysym_unicode_map[0x06C1] = 0x0430;
+ xkeysym_unicode_map[0x06C2] = 0x0431;
+ xkeysym_unicode_map[0x06C3] = 0x0446;
+ xkeysym_unicode_map[0x06C4] = 0x0434;
+ xkeysym_unicode_map[0x06C5] = 0x0435;
+ xkeysym_unicode_map[0x06C6] = 0x0444;
+ xkeysym_unicode_map[0x06C7] = 0x0433;
+ xkeysym_unicode_map[0x06C8] = 0x0445;
+ xkeysym_unicode_map[0x06C9] = 0x0438;
+ xkeysym_unicode_map[0x06CA] = 0x0439;
+ xkeysym_unicode_map[0x06CB] = 0x043A;
+ xkeysym_unicode_map[0x06CC] = 0x043B;
+ xkeysym_unicode_map[0x06CD] = 0x043C;
+ xkeysym_unicode_map[0x06CE] = 0x043D;
+ xkeysym_unicode_map[0x06CF] = 0x043E;
+ xkeysym_unicode_map[0x06D0] = 0x043F;
+ xkeysym_unicode_map[0x06D1] = 0x044F;
+ xkeysym_unicode_map[0x06D2] = 0x0440;
+ xkeysym_unicode_map[0x06D3] = 0x0441;
+ xkeysym_unicode_map[0x06D4] = 0x0442;
+ xkeysym_unicode_map[0x06D5] = 0x0443;
+ xkeysym_unicode_map[0x06D6] = 0x0436;
+ xkeysym_unicode_map[0x06D7] = 0x0432;
+ xkeysym_unicode_map[0x06D8] = 0x044C;
+ xkeysym_unicode_map[0x06D9] = 0x044B;
+ xkeysym_unicode_map[0x06DA] = 0x0437;
+ xkeysym_unicode_map[0x06DB] = 0x0448;
+ xkeysym_unicode_map[0x06DC] = 0x044D;
+ xkeysym_unicode_map[0x06DD] = 0x0449;
+ xkeysym_unicode_map[0x06DE] = 0x0447;
+ xkeysym_unicode_map[0x06DF] = 0x044A;
+ xkeysym_unicode_map[0x06E0] = 0x042E;
+ xkeysym_unicode_map[0x06E1] = 0x0410;
+ xkeysym_unicode_map[0x06E2] = 0x0411;
+ xkeysym_unicode_map[0x06E3] = 0x0426;
+ xkeysym_unicode_map[0x06E4] = 0x0414;
+ xkeysym_unicode_map[0x06E5] = 0x0415;
+ xkeysym_unicode_map[0x06E6] = 0x0424;
+ xkeysym_unicode_map[0x06E7] = 0x0413;
+ xkeysym_unicode_map[0x06E8] = 0x0425;
+ xkeysym_unicode_map[0x06E9] = 0x0418;
+ xkeysym_unicode_map[0x06EA] = 0x0419;
+ xkeysym_unicode_map[0x06EB] = 0x041A;
+ xkeysym_unicode_map[0x06EC] = 0x041B;
+ xkeysym_unicode_map[0x06ED] = 0x041C;
+ xkeysym_unicode_map[0x06EE] = 0x041D;
+ xkeysym_unicode_map[0x06EF] = 0x041E;
+ xkeysym_unicode_map[0x06F0] = 0x041F;
+ xkeysym_unicode_map[0x06F1] = 0x042F;
+ xkeysym_unicode_map[0x06F2] = 0x0420;
+ xkeysym_unicode_map[0x06F3] = 0x0421;
+ xkeysym_unicode_map[0x06F4] = 0x0422;
+ xkeysym_unicode_map[0x06F5] = 0x0423;
+ xkeysym_unicode_map[0x06F6] = 0x0416;
+ xkeysym_unicode_map[0x06F7] = 0x0412;
+ xkeysym_unicode_map[0x06F8] = 0x042C;
+ xkeysym_unicode_map[0x06F9] = 0x042B;
+ xkeysym_unicode_map[0x06FA] = 0x0417;
+ xkeysym_unicode_map[0x06FB] = 0x0428;
+ xkeysym_unicode_map[0x06FC] = 0x042D;
+ xkeysym_unicode_map[0x06FD] = 0x0429;
+ xkeysym_unicode_map[0x06FE] = 0x0427;
+ xkeysym_unicode_map[0x06FF] = 0x042A;
+ xkeysym_unicode_map[0x07A1] = 0x0386;
+ xkeysym_unicode_map[0x07A2] = 0x0388;
+ xkeysym_unicode_map[0x07A3] = 0x0389;
+ xkeysym_unicode_map[0x07A4] = 0x038A;
+ xkeysym_unicode_map[0x07A5] = 0x03AA;
+ xkeysym_unicode_map[0x07A7] = 0x038C;
+ xkeysym_unicode_map[0x07A8] = 0x038E;
+ xkeysym_unicode_map[0x07A9] = 0x03AB;
+ xkeysym_unicode_map[0x07AB] = 0x038F;
+ xkeysym_unicode_map[0x07AE] = 0x0385;
+ xkeysym_unicode_map[0x07AF] = 0x2015;
+ xkeysym_unicode_map[0x07B1] = 0x03AC;
+ xkeysym_unicode_map[0x07B2] = 0x03AD;
+ xkeysym_unicode_map[0x07B3] = 0x03AE;
+ xkeysym_unicode_map[0x07B4] = 0x03AF;
+ xkeysym_unicode_map[0x07B5] = 0x03CA;
+ xkeysym_unicode_map[0x07B6] = 0x0390;
+ xkeysym_unicode_map[0x07B7] = 0x03CC;
+ xkeysym_unicode_map[0x07B8] = 0x03CD;
+ xkeysym_unicode_map[0x07B9] = 0x03CB;
+ xkeysym_unicode_map[0x07BA] = 0x03B0;
+ xkeysym_unicode_map[0x07BB] = 0x03CE;
+ xkeysym_unicode_map[0x07C1] = 0x0391;
+ xkeysym_unicode_map[0x07C2] = 0x0392;
+ xkeysym_unicode_map[0x07C3] = 0x0393;
+ xkeysym_unicode_map[0x07C4] = 0x0394;
+ xkeysym_unicode_map[0x07C5] = 0x0395;
+ xkeysym_unicode_map[0x07C6] = 0x0396;
+ xkeysym_unicode_map[0x07C7] = 0x0397;
+ xkeysym_unicode_map[0x07C8] = 0x0398;
+ xkeysym_unicode_map[0x07C9] = 0x0399;
+ xkeysym_unicode_map[0x07CA] = 0x039A;
+ xkeysym_unicode_map[0x07CB] = 0x039B;
+ xkeysym_unicode_map[0x07CC] = 0x039C;
+ xkeysym_unicode_map[0x07CD] = 0x039D;
+ xkeysym_unicode_map[0x07CE] = 0x039E;
+ xkeysym_unicode_map[0x07CF] = 0x039F;
+ xkeysym_unicode_map[0x07D0] = 0x03A0;
+ xkeysym_unicode_map[0x07D1] = 0x03A1;
+ xkeysym_unicode_map[0x07D2] = 0x03A3;
+ xkeysym_unicode_map[0x07D4] = 0x03A4;
+ xkeysym_unicode_map[0x07D5] = 0x03A5;
+ xkeysym_unicode_map[0x07D6] = 0x03A6;
+ xkeysym_unicode_map[0x07D7] = 0x03A7;
+ xkeysym_unicode_map[0x07D8] = 0x03A8;
+ xkeysym_unicode_map[0x07D9] = 0x03A9;
+ xkeysym_unicode_map[0x07E1] = 0x03B1;
+ xkeysym_unicode_map[0x07E2] = 0x03B2;
+ xkeysym_unicode_map[0x07E3] = 0x03B3;
+ xkeysym_unicode_map[0x07E4] = 0x03B4;
+ xkeysym_unicode_map[0x07E5] = 0x03B5;
+ xkeysym_unicode_map[0x07E6] = 0x03B6;
+ xkeysym_unicode_map[0x07E7] = 0x03B7;
+ xkeysym_unicode_map[0x07E8] = 0x03B8;
+ xkeysym_unicode_map[0x07E9] = 0x03B9;
+ xkeysym_unicode_map[0x07EA] = 0x03BA;
+ xkeysym_unicode_map[0x07EB] = 0x03BB;
+ xkeysym_unicode_map[0x07EC] = 0x03BC;
+ xkeysym_unicode_map[0x07ED] = 0x03BD;
+ xkeysym_unicode_map[0x07EE] = 0x03BE;
+ xkeysym_unicode_map[0x07EF] = 0x03BF;
+ xkeysym_unicode_map[0x07F0] = 0x03C0;
+ xkeysym_unicode_map[0x07F1] = 0x03C1;
+ xkeysym_unicode_map[0x07F2] = 0x03C3;
+ xkeysym_unicode_map[0x07F3] = 0x03C2;
+ xkeysym_unicode_map[0x07F4] = 0x03C4;
+ xkeysym_unicode_map[0x07F5] = 0x03C5;
+ xkeysym_unicode_map[0x07F6] = 0x03C6;
+ xkeysym_unicode_map[0x07F7] = 0x03C7;
+ xkeysym_unicode_map[0x07F8] = 0x03C8;
+ xkeysym_unicode_map[0x07F9] = 0x03C9;
+ xkeysym_unicode_map[0x08A1] = 0x23B7;
+ xkeysym_unicode_map[0x08A2] = 0x250C;
+ xkeysym_unicode_map[0x08A3] = 0x2500;
+ xkeysym_unicode_map[0x08A4] = 0x2320;
+ xkeysym_unicode_map[0x08A5] = 0x2321;
+ xkeysym_unicode_map[0x08A6] = 0x2502;
+ xkeysym_unicode_map[0x08A7] = 0x23A1;
+ xkeysym_unicode_map[0x08A8] = 0x23A3;
+ xkeysym_unicode_map[0x08A9] = 0x23A4;
+ xkeysym_unicode_map[0x08AA] = 0x23A6;
+ xkeysym_unicode_map[0x08AB] = 0x239B;
+ xkeysym_unicode_map[0x08AC] = 0x239D;
+ xkeysym_unicode_map[0x08AD] = 0x239E;
+ xkeysym_unicode_map[0x08AE] = 0x23A0;
+ xkeysym_unicode_map[0x08AF] = 0x23A8;
+ xkeysym_unicode_map[0x08B0] = 0x23AC;
+ xkeysym_unicode_map[0x08BC] = 0x2264;
+ xkeysym_unicode_map[0x08BD] = 0x2260;
+ xkeysym_unicode_map[0x08BE] = 0x2265;
+ xkeysym_unicode_map[0x08BF] = 0x222B;
+ xkeysym_unicode_map[0x08C0] = 0x2234;
+ xkeysym_unicode_map[0x08C1] = 0x221D;
+ xkeysym_unicode_map[0x08C2] = 0x221E;
+ xkeysym_unicode_map[0x08C5] = 0x2207;
+ xkeysym_unicode_map[0x08C8] = 0x223C;
+ xkeysym_unicode_map[0x08C9] = 0x2243;
+ xkeysym_unicode_map[0x08CD] = 0x21D4;
+ xkeysym_unicode_map[0x08CE] = 0x21D2;
+ xkeysym_unicode_map[0x08CF] = 0x2261;
+ xkeysym_unicode_map[0x08D6] = 0x221A;
+ xkeysym_unicode_map[0x08DA] = 0x2282;
+ xkeysym_unicode_map[0x08DB] = 0x2283;
+ xkeysym_unicode_map[0x08DC] = 0x2229;
+ xkeysym_unicode_map[0x08DD] = 0x222A;
+ xkeysym_unicode_map[0x08DE] = 0x2227;
+ xkeysym_unicode_map[0x08DF] = 0x2228;
+ xkeysym_unicode_map[0x08EF] = 0x2202;
+ xkeysym_unicode_map[0x08F6] = 0x0192;
+ xkeysym_unicode_map[0x08FB] = 0x2190;
+ xkeysym_unicode_map[0x08FC] = 0x2191;
+ xkeysym_unicode_map[0x08FD] = 0x2192;
+ xkeysym_unicode_map[0x08FE] = 0x2193;
+ xkeysym_unicode_map[0x09E0] = 0x25C6;
+ xkeysym_unicode_map[0x09E1] = 0x2592;
+ xkeysym_unicode_map[0x09E2] = 0x2409;
+ xkeysym_unicode_map[0x09E3] = 0x240C;
+ xkeysym_unicode_map[0x09E4] = 0x240D;
+ xkeysym_unicode_map[0x09E5] = 0x240A;
+ xkeysym_unicode_map[0x09E8] = 0x2424;
+ xkeysym_unicode_map[0x09E9] = 0x240B;
+ xkeysym_unicode_map[0x09EA] = 0x2518;
+ xkeysym_unicode_map[0x09EB] = 0x2510;
+ xkeysym_unicode_map[0x09EC] = 0x250C;
+ xkeysym_unicode_map[0x09ED] = 0x2514;
+ xkeysym_unicode_map[0x09EE] = 0x253C;
+ xkeysym_unicode_map[0x09EF] = 0x23BA;
+ xkeysym_unicode_map[0x09F0] = 0x23BB;
+ xkeysym_unicode_map[0x09F1] = 0x2500;
+ xkeysym_unicode_map[0x09F2] = 0x23BC;
+ xkeysym_unicode_map[0x09F3] = 0x23BD;
+ xkeysym_unicode_map[0x09F4] = 0x251C;
+ xkeysym_unicode_map[0x09F5] = 0x2524;
+ xkeysym_unicode_map[0x09F6] = 0x2534;
+ xkeysym_unicode_map[0x09F7] = 0x252C;
+ xkeysym_unicode_map[0x09F8] = 0x2502;
+ xkeysym_unicode_map[0x0AA1] = 0x2003;
+ xkeysym_unicode_map[0x0AA2] = 0x2002;
+ xkeysym_unicode_map[0x0AA3] = 0x2004;
+ xkeysym_unicode_map[0x0AA4] = 0x2005;
+ xkeysym_unicode_map[0x0AA5] = 0x2007;
+ xkeysym_unicode_map[0x0AA6] = 0x2008;
+ xkeysym_unicode_map[0x0AA7] = 0x2009;
+ xkeysym_unicode_map[0x0AA8] = 0x200A;
+ xkeysym_unicode_map[0x0AA9] = 0x2014;
+ xkeysym_unicode_map[0x0AAA] = 0x2013;
+ xkeysym_unicode_map[0x0AAE] = 0x2026;
+ xkeysym_unicode_map[0x0AAF] = 0x2025;
+ xkeysym_unicode_map[0x0AB0] = 0x2153;
+ xkeysym_unicode_map[0x0AB1] = 0x2154;
+ xkeysym_unicode_map[0x0AB2] = 0x2155;
+ xkeysym_unicode_map[0x0AB3] = 0x2156;
+ xkeysym_unicode_map[0x0AB4] = 0x2157;
+ xkeysym_unicode_map[0x0AB5] = 0x2158;
+ xkeysym_unicode_map[0x0AB6] = 0x2159;
+ xkeysym_unicode_map[0x0AB7] = 0x215A;
+ xkeysym_unicode_map[0x0AB8] = 0x2105;
+ xkeysym_unicode_map[0x0ABB] = 0x2012;
+ xkeysym_unicode_map[0x0ABC] = 0x2329;
+ xkeysym_unicode_map[0x0ABE] = 0x232A;
+ xkeysym_unicode_map[0x0AC3] = 0x215B;
+ xkeysym_unicode_map[0x0AC4] = 0x215C;
+ xkeysym_unicode_map[0x0AC5] = 0x215D;
+ xkeysym_unicode_map[0x0AC6] = 0x215E;
+ xkeysym_unicode_map[0x0AC9] = 0x2122;
+ xkeysym_unicode_map[0x0ACA] = 0x2613;
+ xkeysym_unicode_map[0x0ACC] = 0x25C1;
+ xkeysym_unicode_map[0x0ACD] = 0x25B7;
+ xkeysym_unicode_map[0x0ACE] = 0x25CB;
+ xkeysym_unicode_map[0x0ACF] = 0x25AF;
+ xkeysym_unicode_map[0x0AD0] = 0x2018;
+ xkeysym_unicode_map[0x0AD1] = 0x2019;
+ xkeysym_unicode_map[0x0AD2] = 0x201C;
+ xkeysym_unicode_map[0x0AD3] = 0x201D;
+ xkeysym_unicode_map[0x0AD4] = 0x211E;
+ xkeysym_unicode_map[0x0AD6] = 0x2032;
+ xkeysym_unicode_map[0x0AD7] = 0x2033;
+ xkeysym_unicode_map[0x0AD9] = 0x271D;
+ xkeysym_unicode_map[0x0ADB] = 0x25AC;
+ xkeysym_unicode_map[0x0ADC] = 0x25C0;
+ xkeysym_unicode_map[0x0ADD] = 0x25B6;
+ xkeysym_unicode_map[0x0ADE] = 0x25CF;
+ xkeysym_unicode_map[0x0ADF] = 0x25AE;
+ xkeysym_unicode_map[0x0AE0] = 0x25E6;
+ xkeysym_unicode_map[0x0AE1] = 0x25AB;
+ xkeysym_unicode_map[0x0AE2] = 0x25AD;
+ xkeysym_unicode_map[0x0AE3] = 0x25B3;
+ xkeysym_unicode_map[0x0AE4] = 0x25BD;
+ xkeysym_unicode_map[0x0AE5] = 0x2606;
+ xkeysym_unicode_map[0x0AE6] = 0x2022;
+ xkeysym_unicode_map[0x0AE7] = 0x25AA;
+ xkeysym_unicode_map[0x0AE8] = 0x25B2;
+ xkeysym_unicode_map[0x0AE9] = 0x25BC;
+ xkeysym_unicode_map[0x0AEA] = 0x261C;
+ xkeysym_unicode_map[0x0AEB] = 0x261E;
+ xkeysym_unicode_map[0x0AEC] = 0x2663;
+ xkeysym_unicode_map[0x0AED] = 0x2666;
+ xkeysym_unicode_map[0x0AEE] = 0x2665;
+ xkeysym_unicode_map[0x0AF0] = 0x2720;
+ xkeysym_unicode_map[0x0AF1] = 0x2020;
+ xkeysym_unicode_map[0x0AF2] = 0x2021;
+ xkeysym_unicode_map[0x0AF3] = 0x2713;
+ xkeysym_unicode_map[0x0AF4] = 0x2717;
+ xkeysym_unicode_map[0x0AF5] = 0x266F;
+ xkeysym_unicode_map[0x0AF6] = 0x266D;
+ xkeysym_unicode_map[0x0AF7] = 0x2642;
+ xkeysym_unicode_map[0x0AF8] = 0x2640;
+ xkeysym_unicode_map[0x0AF9] = 0x260E;
+ xkeysym_unicode_map[0x0AFA] = 0x2315;
+ xkeysym_unicode_map[0x0AFB] = 0x2117;
+ xkeysym_unicode_map[0x0AFC] = 0x2038;
+ xkeysym_unicode_map[0x0AFD] = 0x201A;
+ xkeysym_unicode_map[0x0AFE] = 0x201E;
+ xkeysym_unicode_map[0x0BA3] = 0x003C;
+ xkeysym_unicode_map[0x0BA6] = 0x003E;
+ xkeysym_unicode_map[0x0BA8] = 0x2228;
+ xkeysym_unicode_map[0x0BA9] = 0x2227;
+ xkeysym_unicode_map[0x0BC0] = 0x00AF;
+ xkeysym_unicode_map[0x0BC2] = 0x22A5;
+ xkeysym_unicode_map[0x0BC3] = 0x2229;
+ xkeysym_unicode_map[0x0BC4] = 0x230A;
+ xkeysym_unicode_map[0x0BC6] = 0x005F;
+ xkeysym_unicode_map[0x0BCA] = 0x2218;
+ xkeysym_unicode_map[0x0BCC] = 0x2395;
+ xkeysym_unicode_map[0x0BCE] = 0x22A4;
+ xkeysym_unicode_map[0x0BCF] = 0x25CB;
+ xkeysym_unicode_map[0x0BD3] = 0x2308;
+ xkeysym_unicode_map[0x0BD6] = 0x222A;
+ xkeysym_unicode_map[0x0BD8] = 0x2283;
+ xkeysym_unicode_map[0x0BDA] = 0x2282;
+ xkeysym_unicode_map[0x0BDC] = 0x22A2;
+ xkeysym_unicode_map[0x0BFC] = 0x22A3;
+ xkeysym_unicode_map[0x0CDF] = 0x2017;
+ xkeysym_unicode_map[0x0CE0] = 0x05D0;
+ xkeysym_unicode_map[0x0CE1] = 0x05D1;
+ xkeysym_unicode_map[0x0CE2] = 0x05D2;
+ xkeysym_unicode_map[0x0CE3] = 0x05D3;
+ xkeysym_unicode_map[0x0CE4] = 0x05D4;
+ xkeysym_unicode_map[0x0CE5] = 0x05D5;
+ xkeysym_unicode_map[0x0CE6] = 0x05D6;
+ xkeysym_unicode_map[0x0CE7] = 0x05D7;
+ xkeysym_unicode_map[0x0CE8] = 0x05D8;
+ xkeysym_unicode_map[0x0CE9] = 0x05D9;
+ xkeysym_unicode_map[0x0CEA] = 0x05DA;
+ xkeysym_unicode_map[0x0CEB] = 0x05DB;
+ xkeysym_unicode_map[0x0CEC] = 0x05DC;
+ xkeysym_unicode_map[0x0CED] = 0x05DD;
+ xkeysym_unicode_map[0x0CEE] = 0x05DE;
+ xkeysym_unicode_map[0x0CEF] = 0x05DF;
+ xkeysym_unicode_map[0x0CF0] = 0x05E0;
+ xkeysym_unicode_map[0x0CF1] = 0x05E1;
+ xkeysym_unicode_map[0x0CF2] = 0x05E2;
+ xkeysym_unicode_map[0x0CF3] = 0x05E3;
+ xkeysym_unicode_map[0x0CF4] = 0x05E4;
+ xkeysym_unicode_map[0x0CF5] = 0x05E5;
+ xkeysym_unicode_map[0x0CF6] = 0x05E6;
+ xkeysym_unicode_map[0x0CF7] = 0x05E7;
+ xkeysym_unicode_map[0x0CF8] = 0x05E8;
+ xkeysym_unicode_map[0x0CF9] = 0x05E9;
+ xkeysym_unicode_map[0x0CFA] = 0x05EA;
+ xkeysym_unicode_map[0x0DA1] = 0x0E01;
+ xkeysym_unicode_map[0x0DA2] = 0x0E02;
+ xkeysym_unicode_map[0x0DA3] = 0x0E03;
+ xkeysym_unicode_map[0x0DA4] = 0x0E04;
+ xkeysym_unicode_map[0x0DA5] = 0x0E05;
+ xkeysym_unicode_map[0x0DA6] = 0x0E06;
+ xkeysym_unicode_map[0x0DA7] = 0x0E07;
+ xkeysym_unicode_map[0x0DA8] = 0x0E08;
+ xkeysym_unicode_map[0x0DA9] = 0x0E09;
+ xkeysym_unicode_map[0x0DAA] = 0x0E0A;
+ xkeysym_unicode_map[0x0DAB] = 0x0E0B;
+ xkeysym_unicode_map[0x0DAC] = 0x0E0C;
+ xkeysym_unicode_map[0x0DAD] = 0x0E0D;
+ xkeysym_unicode_map[0x0DAE] = 0x0E0E;
+ xkeysym_unicode_map[0x0DAF] = 0x0E0F;
+ xkeysym_unicode_map[0x0DB0] = 0x0E10;
+ xkeysym_unicode_map[0x0DB1] = 0x0E11;
+ xkeysym_unicode_map[0x0DB2] = 0x0E12;
+ xkeysym_unicode_map[0x0DB3] = 0x0E13;
+ xkeysym_unicode_map[0x0DB4] = 0x0E14;
+ xkeysym_unicode_map[0x0DB5] = 0x0E15;
+ xkeysym_unicode_map[0x0DB6] = 0x0E16;
+ xkeysym_unicode_map[0x0DB7] = 0x0E17;
+ xkeysym_unicode_map[0x0DB8] = 0x0E18;
+ xkeysym_unicode_map[0x0DB9] = 0x0E19;
+ xkeysym_unicode_map[0x0DBA] = 0x0E1A;
+ xkeysym_unicode_map[0x0DBB] = 0x0E1B;
+ xkeysym_unicode_map[0x0DBC] = 0x0E1C;
+ xkeysym_unicode_map[0x0DBD] = 0x0E1D;
+ xkeysym_unicode_map[0x0DBE] = 0x0E1E;
+ xkeysym_unicode_map[0x0DBF] = 0x0E1F;
+ xkeysym_unicode_map[0x0DC0] = 0x0E20;
+ xkeysym_unicode_map[0x0DC1] = 0x0E21;
+ xkeysym_unicode_map[0x0DC2] = 0x0E22;
+ xkeysym_unicode_map[0x0DC3] = 0x0E23;
+ xkeysym_unicode_map[0x0DC4] = 0x0E24;
+ xkeysym_unicode_map[0x0DC5] = 0x0E25;
+ xkeysym_unicode_map[0x0DC6] = 0x0E26;
+ xkeysym_unicode_map[0x0DC7] = 0x0E27;
+ xkeysym_unicode_map[0x0DC8] = 0x0E28;
+ xkeysym_unicode_map[0x0DC9] = 0x0E29;
+ xkeysym_unicode_map[0x0DCA] = 0x0E2A;
+ xkeysym_unicode_map[0x0DCB] = 0x0E2B;
+ xkeysym_unicode_map[0x0DCC] = 0x0E2C;
+ xkeysym_unicode_map[0x0DCD] = 0x0E2D;
+ xkeysym_unicode_map[0x0DCE] = 0x0E2E;
+ xkeysym_unicode_map[0x0DCF] = 0x0E2F;
+ xkeysym_unicode_map[0x0DD0] = 0x0E30;
+ xkeysym_unicode_map[0x0DD1] = 0x0E31;
+ xkeysym_unicode_map[0x0DD2] = 0x0E32;
+ xkeysym_unicode_map[0x0DD3] = 0x0E33;
+ xkeysym_unicode_map[0x0DD4] = 0x0E34;
+ xkeysym_unicode_map[0x0DD5] = 0x0E35;
+ xkeysym_unicode_map[0x0DD6] = 0x0E36;
+ xkeysym_unicode_map[0x0DD7] = 0x0E37;
+ xkeysym_unicode_map[0x0DD8] = 0x0E38;
+ xkeysym_unicode_map[0x0DD9] = 0x0E39;
+ xkeysym_unicode_map[0x0DDA] = 0x0E3A;
+ xkeysym_unicode_map[0x0DDF] = 0x0E3F;
+ xkeysym_unicode_map[0x0DE0] = 0x0E40;
+ xkeysym_unicode_map[0x0DE1] = 0x0E41;
+ xkeysym_unicode_map[0x0DE2] = 0x0E42;
+ xkeysym_unicode_map[0x0DE3] = 0x0E43;
+ xkeysym_unicode_map[0x0DE4] = 0x0E44;
+ xkeysym_unicode_map[0x0DE5] = 0x0E45;
+ xkeysym_unicode_map[0x0DE6] = 0x0E46;
+ xkeysym_unicode_map[0x0DE7] = 0x0E47;
+ xkeysym_unicode_map[0x0DE8] = 0x0E48;
+ xkeysym_unicode_map[0x0DE9] = 0x0E49;
+ xkeysym_unicode_map[0x0DEA] = 0x0E4A;
+ xkeysym_unicode_map[0x0DEB] = 0x0E4B;
+ xkeysym_unicode_map[0x0DEC] = 0x0E4C;
+ xkeysym_unicode_map[0x0DED] = 0x0E4D;
+ xkeysym_unicode_map[0x0DF0] = 0x0E50;
+ xkeysym_unicode_map[0x0DF1] = 0x0E51;
+ xkeysym_unicode_map[0x0DF2] = 0x0E52;
+ xkeysym_unicode_map[0x0DF3] = 0x0E53;
+ xkeysym_unicode_map[0x0DF4] = 0x0E54;
+ xkeysym_unicode_map[0x0DF5] = 0x0E55;
+ xkeysym_unicode_map[0x0DF6] = 0x0E56;
+ xkeysym_unicode_map[0x0DF7] = 0x0E57;
+ xkeysym_unicode_map[0x0DF8] = 0x0E58;
+ xkeysym_unicode_map[0x0DF9] = 0x0E59;
+ xkeysym_unicode_map[0x0EA1] = 0x3131;
+ xkeysym_unicode_map[0x0EA2] = 0x3132;
+ xkeysym_unicode_map[0x0EA3] = 0x3133;
+ xkeysym_unicode_map[0x0EA4] = 0x3134;
+ xkeysym_unicode_map[0x0EA5] = 0x3135;
+ xkeysym_unicode_map[0x0EA6] = 0x3136;
+ xkeysym_unicode_map[0x0EA7] = 0x3137;
+ xkeysym_unicode_map[0x0EA8] = 0x3138;
+ xkeysym_unicode_map[0x0EA9] = 0x3139;
+ xkeysym_unicode_map[0x0EAA] = 0x313A;
+ xkeysym_unicode_map[0x0EAB] = 0x313B;
+ xkeysym_unicode_map[0x0EAC] = 0x313C;
+ xkeysym_unicode_map[0x0EAD] = 0x313D;
+ xkeysym_unicode_map[0x0EAE] = 0x313E;
+ xkeysym_unicode_map[0x0EAF] = 0x313F;
+ xkeysym_unicode_map[0x0EB0] = 0x3140;
+ xkeysym_unicode_map[0x0EB1] = 0x3141;
+ xkeysym_unicode_map[0x0EB2] = 0x3142;
+ xkeysym_unicode_map[0x0EB3] = 0x3143;
+ xkeysym_unicode_map[0x0EB4] = 0x3144;
+ xkeysym_unicode_map[0x0EB5] = 0x3145;
+ xkeysym_unicode_map[0x0EB6] = 0x3146;
+ xkeysym_unicode_map[0x0EB7] = 0x3147;
+ xkeysym_unicode_map[0x0EB8] = 0x3148;
+ xkeysym_unicode_map[0x0EB9] = 0x3149;
+ xkeysym_unicode_map[0x0EBA] = 0x314A;
+ xkeysym_unicode_map[0x0EBB] = 0x314B;
+ xkeysym_unicode_map[0x0EBC] = 0x314C;
+ xkeysym_unicode_map[0x0EBD] = 0x314D;
+ xkeysym_unicode_map[0x0EBE] = 0x314E;
+ xkeysym_unicode_map[0x0EBF] = 0x314F;
+ xkeysym_unicode_map[0x0EC0] = 0x3150;
+ xkeysym_unicode_map[0x0EC1] = 0x3151;
+ xkeysym_unicode_map[0x0EC2] = 0x3152;
+ xkeysym_unicode_map[0x0EC3] = 0x3153;
+ xkeysym_unicode_map[0x0EC4] = 0x3154;
+ xkeysym_unicode_map[0x0EC5] = 0x3155;
+ xkeysym_unicode_map[0x0EC6] = 0x3156;
+ xkeysym_unicode_map[0x0EC7] = 0x3157;
+ xkeysym_unicode_map[0x0EC8] = 0x3158;
+ xkeysym_unicode_map[0x0EC9] = 0x3159;
+ xkeysym_unicode_map[0x0ECA] = 0x315A;
+ xkeysym_unicode_map[0x0ECB] = 0x315B;
+ xkeysym_unicode_map[0x0ECC] = 0x315C;
+ xkeysym_unicode_map[0x0ECD] = 0x315D;
+ xkeysym_unicode_map[0x0ECE] = 0x315E;
+ xkeysym_unicode_map[0x0ECF] = 0x315F;
+ xkeysym_unicode_map[0x0ED0] = 0x3160;
+ xkeysym_unicode_map[0x0ED1] = 0x3161;
+ xkeysym_unicode_map[0x0ED2] = 0x3162;
+ xkeysym_unicode_map[0x0ED3] = 0x3163;
+ xkeysym_unicode_map[0x0ED4] = 0x11A8;
+ xkeysym_unicode_map[0x0ED5] = 0x11A9;
+ xkeysym_unicode_map[0x0ED6] = 0x11AA;
+ xkeysym_unicode_map[0x0ED7] = 0x11AB;
+ xkeysym_unicode_map[0x0ED8] = 0x11AC;
+ xkeysym_unicode_map[0x0ED9] = 0x11AD;
+ xkeysym_unicode_map[0x0EDA] = 0x11AE;
+ xkeysym_unicode_map[0x0EDB] = 0x11AF;
+ xkeysym_unicode_map[0x0EDC] = 0x11B0;
+ xkeysym_unicode_map[0x0EDD] = 0x11B1;
+ xkeysym_unicode_map[0x0EDE] = 0x11B2;
+ xkeysym_unicode_map[0x0EDF] = 0x11B3;
+ xkeysym_unicode_map[0x0EE0] = 0x11B4;
+ xkeysym_unicode_map[0x0EE1] = 0x11B5;
+ xkeysym_unicode_map[0x0EE2] = 0x11B6;
+ xkeysym_unicode_map[0x0EE3] = 0x11B7;
+ xkeysym_unicode_map[0x0EE4] = 0x11B8;
+ xkeysym_unicode_map[0x0EE5] = 0x11B9;
+ xkeysym_unicode_map[0x0EE6] = 0x11BA;
+ xkeysym_unicode_map[0x0EE7] = 0x11BB;
+ xkeysym_unicode_map[0x0EE8] = 0x11BC;
+ xkeysym_unicode_map[0x0EE9] = 0x11BD;
+ xkeysym_unicode_map[0x0EEA] = 0x11BE;
+ xkeysym_unicode_map[0x0EEB] = 0x11BF;
+ xkeysym_unicode_map[0x0EEC] = 0x11C0;
+ xkeysym_unicode_map[0x0EED] = 0x11C1;
+ xkeysym_unicode_map[0x0EEE] = 0x11C2;
+ xkeysym_unicode_map[0x0EEF] = 0x316D;
+ xkeysym_unicode_map[0x0EF0] = 0x3171;
+ xkeysym_unicode_map[0x0EF1] = 0x3178;
+ xkeysym_unicode_map[0x0EF2] = 0x317F;
+ xkeysym_unicode_map[0x0EF3] = 0x3181;
+ xkeysym_unicode_map[0x0EF4] = 0x3184;
+ xkeysym_unicode_map[0x0EF5] = 0x3186;
+ xkeysym_unicode_map[0x0EF6] = 0x318D;
+ xkeysym_unicode_map[0x0EF7] = 0x318E;
+ xkeysym_unicode_map[0x0EF8] = 0x11EB;
+ xkeysym_unicode_map[0x0EF9] = 0x11F0;
+ xkeysym_unicode_map[0x0EFA] = 0x11F9;
+ xkeysym_unicode_map[0x0EFF] = 0x20A9;
+ xkeysym_unicode_map[0x13A4] = 0x20AC;
+ xkeysym_unicode_map[0x13BC] = 0x0152;
+ xkeysym_unicode_map[0x13BD] = 0x0153;
+ xkeysym_unicode_map[0x13BE] = 0x0178;
+ xkeysym_unicode_map[0x20AC] = 0x20AC;
}
-unsigned int KeyMappingX11::get_xlibcode(Key p_keysym) {
- unsigned int code = 0;
- for (int i = 0; _scancode_to_keycode[i].keysym != Key::UNKNOWN; i++) {
- if (_scancode_to_keycode[i].keysym == p_keysym) {
- code = _scancode_to_keycode[i].keycode;
- break;
+Key KeyMappingX11::get_keycode(KeySym p_keysym) {
+ if (p_keysym >= 0x20 && p_keysym < 0x7E) { // ASCII, maps 1-1
+ if (p_keysym > 0x60 && p_keysym < 0x7B) { // Lowercase ASCII.
+ return (Key)(p_keysym - 32);
+ } else {
+ return (Key)p_keysym;
}
}
- return code;
-}
-
-Key KeyMappingX11::get_keycode(KeySym p_keysym) {
- // kinda bruteforce.. could optimize.
-
- if (p_keysym < 0x100) { // Latin 1, maps 1-1
- return (Key)p_keysym;
+ const Key *key = xkeysym_map.getptr(p_keysym);
+ if (key) {
+ return *key;
}
+ return Key::NONE;
+}
- // look for special key
- for (int idx = 0; _xkeysym_to_keycode[idx].keysym != 0; idx++) {
- if (_xkeysym_to_keycode[idx].keysym == p_keysym) {
- return _xkeysym_to_keycode[idx].keycode;
- }
+Key KeyMappingX11::get_scancode(unsigned int p_code) {
+ const Key *key = scancode_map.getptr(p_code);
+ if (key) {
+ return *key;
}
return Key::NONE;
}
-KeySym KeyMappingX11::get_keysym(Key p_code) {
- // kinda bruteforce.. could optimize.
-
- if (p_code < Key::END_LATIN1) { // Latin 1, maps 1-1
- return (KeySym)p_code;
- }
-
- // look for special key
- for (int idx = 0; _xkeysym_to_keycode[idx].keysym != 0; idx++) {
- if (_xkeysym_to_keycode[idx].keycode == p_code) {
- return _xkeysym_to_keycode[idx].keysym;
- }
+unsigned int KeyMappingX11::get_xlibcode(Key p_keysym) {
+ const unsigned int *key = scancode_map_inv.getptr(p_keysym);
+ if (key) {
+ return *key;
}
-
- return (KeySym)Key::NONE;
+ return 0x00;
}
-/***** UNICODE CONVERSION ******/
-
-// Tables taken from FOX toolkit
-
-struct _XTranslateUnicodePair {
- KeySym keysym;
- unsigned int unicode;
-};
-
-enum {
- _KEYSYM_MAX = 759
-};
-
-static _XTranslateUnicodePair _xkeysym_to_unicode[_KEYSYM_MAX] = {
- { 0x01A1, 0x0104 },
- { 0x01A2, 0x02D8 },
- { 0x01A3, 0x0141 },
- { 0x01A5, 0x013D },
- { 0x01A6, 0x015A },
- { 0x01A9, 0x0160 },
- { 0x01AA, 0x015E },
- { 0x01AB, 0x0164 },
- { 0x01AC, 0x0179 },
- { 0x01AE, 0x017D },
- { 0x01AF, 0x017B },
- { 0x01B1, 0x0105 },
- { 0x01B2, 0x02DB },
- { 0x01B3, 0x0142 },
- { 0x01B5, 0x013E },
- { 0x01B6, 0x015B },
- { 0x01B7, 0x02C7 },
- { 0x01B9, 0x0161 },
- { 0x01BA, 0x015F },
- { 0x01BB, 0x0165 },
- { 0x01BC, 0x017A },
- { 0x01BD, 0x02DD },
- { 0x01BE, 0x017E },
- { 0x01BF, 0x017C },
- { 0x01C0, 0x0154 },
- { 0x01C3, 0x0102 },
- { 0x01C5, 0x0139 },
- { 0x01C6, 0x0106 },
- { 0x01C8, 0x010C },
- { 0x01CA, 0x0118 },
- { 0x01CC, 0x011A },
- { 0x01CF, 0x010E },
- { 0x01D0, 0x0110 },
- { 0x01D1, 0x0143 },
- { 0x01D2, 0x0147 },
- { 0x01D5, 0x0150 },
- { 0x01D8, 0x0158 },
- { 0x01D9, 0x016E },
- { 0x01DB, 0x0170 },
- { 0x01DE, 0x0162 },
- { 0x01E0, 0x0155 },
- { 0x01E3, 0x0103 },
- { 0x01E5, 0x013A },
- { 0x01E6, 0x0107 },
- { 0x01E8, 0x010D },
- { 0x01EA, 0x0119 },
- { 0x01EC, 0x011B },
- { 0x01EF, 0x010F },
- { 0x01F0, 0x0111 },
- { 0x01F1, 0x0144 },
- { 0x01F2, 0x0148 },
- { 0x01F5, 0x0151 },
- { 0x01F8, 0x0159 },
- { 0x01F9, 0x016F },
- { 0x01FB, 0x0171 },
- { 0x01FE, 0x0163 },
- { 0x01FF, 0x02D9 },
- { 0x02A1, 0x0126 },
- { 0x02A6, 0x0124 },
- { 0x02A9, 0x0130 },
- { 0x02AB, 0x011E },
- { 0x02AC, 0x0134 },
- { 0x02B1, 0x0127 },
- { 0x02B6, 0x0125 },
- { 0x02B9, 0x0131 },
- { 0x02BB, 0x011F },
- { 0x02BC, 0x0135 },
- { 0x02C5, 0x010A },
- { 0x02C6, 0x0108 },
- { 0x02D5, 0x0120 },
- { 0x02D8, 0x011C },
- { 0x02DD, 0x016C },
- { 0x02DE, 0x015C },
- { 0x02E5, 0x010B },
- { 0x02E6, 0x0109 },
- { 0x02F5, 0x0121 },
- { 0x02F8, 0x011D },
- { 0x02FD, 0x016D },
- { 0x02FE, 0x015D },
- { 0x03A2, 0x0138 },
- { 0x03A3, 0x0156 },
- { 0x03A5, 0x0128 },
- { 0x03A6, 0x013B },
- { 0x03AA, 0x0112 },
- { 0x03AB, 0x0122 },
- { 0x03AC, 0x0166 },
- { 0x03B3, 0x0157 },
- { 0x03B5, 0x0129 },
- { 0x03B6, 0x013C },
- { 0x03BA, 0x0113 },
- { 0x03BB, 0x0123 },
- { 0x03BC, 0x0167 },
- { 0x03BD, 0x014A },
- { 0x03BF, 0x014B },
- { 0x03C0, 0x0100 },
- { 0x03C7, 0x012E },
- { 0x03CC, 0x0116 },
- { 0x03CF, 0x012A },
- { 0x03D1, 0x0145 },
- { 0x03D2, 0x014C },
- { 0x03D3, 0x0136 },
- { 0x03D9, 0x0172 },
- { 0x03DD, 0x0168 },
- { 0x03DE, 0x016A },
- { 0x03E0, 0x0101 },
- { 0x03E7, 0x012F },
- { 0x03EC, 0x0117 },
- { 0x03EF, 0x012B },
- { 0x03F1, 0x0146 },
- { 0x03F2, 0x014D },
- { 0x03F3, 0x0137 },
- { 0x03F9, 0x0173 },
- { 0x03FD, 0x0169 },
- { 0x03FE, 0x016B },
- { 0x047E, 0x203E },
- { 0x04A1, 0x3002 },
- { 0x04A2, 0x300C },
- { 0x04A3, 0x300D },
- { 0x04A4, 0x3001 },
- { 0x04A5, 0x30FB },
- { 0x04A6, 0x30F2 },
- { 0x04A7, 0x30A1 },
- { 0x04A8, 0x30A3 },
- { 0x04A9, 0x30A5 },
- { 0x04AA, 0x30A7 },
- { 0x04AB, 0x30A9 },
- { 0x04AC, 0x30E3 },
- { 0x04AD, 0x30E5 },
- { 0x04AE, 0x30E7 },
- { 0x04AF, 0x30C3 },
- { 0x04B0, 0x30FC },
- { 0x04B1, 0x30A2 },
- { 0x04B2, 0x30A4 },
- { 0x04B3, 0x30A6 },
- { 0x04B4, 0x30A8 },
- { 0x04B5, 0x30AA },
- { 0x04B6, 0x30AB },
- { 0x04B7, 0x30AD },
- { 0x04B8, 0x30AF },
- { 0x04B9, 0x30B1 },
- { 0x04BA, 0x30B3 },
- { 0x04BB, 0x30B5 },
- { 0x04BC, 0x30B7 },
- { 0x04BD, 0x30B9 },
- { 0x04BE, 0x30BB },
- { 0x04BF, 0x30BD },
- { 0x04C0, 0x30BF },
- { 0x04C1, 0x30C1 },
- { 0x04C2, 0x30C4 },
- { 0x04C3, 0x30C6 },
- { 0x04C4, 0x30C8 },
- { 0x04C5, 0x30CA },
- { 0x04C6, 0x30CB },
- { 0x04C7, 0x30CC },
- { 0x04C8, 0x30CD },
- { 0x04C9, 0x30CE },
- { 0x04CA, 0x30CF },
- { 0x04CB, 0x30D2 },
- { 0x04CC, 0x30D5 },
- { 0x04CD, 0x30D8 },
- { 0x04CE, 0x30DB },
- { 0x04CF, 0x30DE },
- { 0x04D0, 0x30DF },
- { 0x04D1, 0x30E0 },
- { 0x04D2, 0x30E1 },
- { 0x04D3, 0x30E2 },
- { 0x04D4, 0x30E4 },
- { 0x04D5, 0x30E6 },
- { 0x04D6, 0x30E8 },
- { 0x04D7, 0x30E9 },
- { 0x04D8, 0x30EA },
- { 0x04D9, 0x30EB },
- { 0x04DA, 0x30EC },
- { 0x04DB, 0x30ED },
- { 0x04DC, 0x30EF },
- { 0x04DD, 0x30F3 },
- { 0x04DE, 0x309B },
- { 0x04DF, 0x309C },
- { 0x05AC, 0x060C },
- { 0x05BB, 0x061B },
- { 0x05BF, 0x061F },
- { 0x05C1, 0x0621 },
- { 0x05C2, 0x0622 },
- { 0x05C3, 0x0623 },
- { 0x05C4, 0x0624 },
- { 0x05C5, 0x0625 },
- { 0x05C6, 0x0626 },
- { 0x05C7, 0x0627 },
- { 0x05C8, 0x0628 },
- { 0x05C9, 0x0629 },
- { 0x05CA, 0x062A },
- { 0x05CB, 0x062B },
- { 0x05CC, 0x062C },
- { 0x05CD, 0x062D },
- { 0x05CE, 0x062E },
- { 0x05CF, 0x062F },
- { 0x05D0, 0x0630 },
- { 0x05D1, 0x0631 },
- { 0x05D2, 0x0632 },
- { 0x05D3, 0x0633 },
- { 0x05D4, 0x0634 },
- { 0x05D5, 0x0635 },
- { 0x05D6, 0x0636 },
- { 0x05D7, 0x0637 },
- { 0x05D8, 0x0638 },
- { 0x05D9, 0x0639 },
- { 0x05DA, 0x063A },
- { 0x05E0, 0x0640 },
- { 0x05E1, 0x0641 },
- { 0x05E2, 0x0642 },
- { 0x05E3, 0x0643 },
- { 0x05E4, 0x0644 },
- { 0x05E5, 0x0645 },
- { 0x05E6, 0x0646 },
- { 0x05E7, 0x0647 },
- { 0x05E8, 0x0648 },
- { 0x05E9, 0x0649 },
- { 0x05EA, 0x064A },
- { 0x05EB, 0x064B },
- { 0x05EC, 0x064C },
- { 0x05ED, 0x064D },
- { 0x05EE, 0x064E },
- { 0x05EF, 0x064F },
- { 0x05F0, 0x0650 },
- { 0x05F1, 0x0651 },
- { 0x05F2, 0x0652 },
- { 0x06A1, 0x0452 },
- { 0x06A2, 0x0453 },
- { 0x06A3, 0x0451 },
- { 0x06A4, 0x0454 },
- { 0x06A5, 0x0455 },
- { 0x06A6, 0x0456 },
- { 0x06A7, 0x0457 },
- { 0x06A8, 0x0458 },
- { 0x06A9, 0x0459 },
- { 0x06AA, 0x045A },
- { 0x06AB, 0x045B },
- { 0x06AC, 0x045C },
- { 0x06AE, 0x045E },
- { 0x06AF, 0x045F },
- { 0x06B0, 0x2116 },
- { 0x06B1, 0x0402 },
- { 0x06B2, 0x0403 },
- { 0x06B3, 0x0401 },
- { 0x06B4, 0x0404 },
- { 0x06B5, 0x0405 },
- { 0x06B6, 0x0406 },
- { 0x06B7, 0x0407 },
- { 0x06B8, 0x0408 },
- { 0x06B9, 0x0409 },
- { 0x06BA, 0x040A },
- { 0x06BB, 0x040B },
- { 0x06BC, 0x040C },
- { 0x06BE, 0x040E },
- { 0x06BF, 0x040F },
- { 0x06C0, 0x044E },
- { 0x06C1, 0x0430 },
- { 0x06C2, 0x0431 },
- { 0x06C3, 0x0446 },
- { 0x06C4, 0x0434 },
- { 0x06C5, 0x0435 },
- { 0x06C6, 0x0444 },
- { 0x06C7, 0x0433 },
- { 0x06C8, 0x0445 },
- { 0x06C9, 0x0438 },
- { 0x06CA, 0x0439 },
- { 0x06CB, 0x043A },
- { 0x06CC, 0x043B },
- { 0x06CD, 0x043C },
- { 0x06CE, 0x043D },
- { 0x06CF, 0x043E },
- { 0x06D0, 0x043F },
- { 0x06D1, 0x044F },
- { 0x06D2, 0x0440 },
- { 0x06D3, 0x0441 },
- { 0x06D4, 0x0442 },
- { 0x06D5, 0x0443 },
- { 0x06D6, 0x0436 },
- { 0x06D7, 0x0432 },
- { 0x06D8, 0x044C },
- { 0x06D9, 0x044B },
- { 0x06DA, 0x0437 },
- { 0x06DB, 0x0448 },
- { 0x06DC, 0x044D },
- { 0x06DD, 0x0449 },
- { 0x06DE, 0x0447 },
- { 0x06DF, 0x044A },
- { 0x06E0, 0x042E },
- { 0x06E1, 0x0410 },
- { 0x06E2, 0x0411 },
- { 0x06E3, 0x0426 },
- { 0x06E4, 0x0414 },
- { 0x06E5, 0x0415 },
- { 0x06E6, 0x0424 },
- { 0x06E7, 0x0413 },
- { 0x06E8, 0x0425 },
- { 0x06E9, 0x0418 },
- { 0x06EA, 0x0419 },
- { 0x06EB, 0x041A },
- { 0x06EC, 0x041B },
- { 0x06ED, 0x041C },
- { 0x06EE, 0x041D },
- { 0x06EF, 0x041E },
- { 0x06F0, 0x041F },
- { 0x06F1, 0x042F },
- { 0x06F2, 0x0420 },
- { 0x06F3, 0x0421 },
- { 0x06F4, 0x0422 },
- { 0x06F5, 0x0423 },
- { 0x06F6, 0x0416 },
- { 0x06F7, 0x0412 },
- { 0x06F8, 0x042C },
- { 0x06F9, 0x042B },
- { 0x06FA, 0x0417 },
- { 0x06FB, 0x0428 },
- { 0x06FC, 0x042D },
- { 0x06FD, 0x0429 },
- { 0x06FE, 0x0427 },
- { 0x06FF, 0x042A },
- { 0x07A1, 0x0386 },
- { 0x07A2, 0x0388 },
- { 0x07A3, 0x0389 },
- { 0x07A4, 0x038A },
- { 0x07A5, 0x03AA },
- { 0x07A7, 0x038C },
- { 0x07A8, 0x038E },
- { 0x07A9, 0x03AB },
- { 0x07AB, 0x038F },
- { 0x07AE, 0x0385 },
- { 0x07AF, 0x2015 },
- { 0x07B1, 0x03AC },
- { 0x07B2, 0x03AD },
- { 0x07B3, 0x03AE },
- { 0x07B4, 0x03AF },
- { 0x07B5, 0x03CA },
- { 0x07B6, 0x0390 },
- { 0x07B7, 0x03CC },
- { 0x07B8, 0x03CD },
- { 0x07B9, 0x03CB },
- { 0x07BA, 0x03B0 },
- { 0x07BB, 0x03CE },
- { 0x07C1, 0x0391 },
- { 0x07C2, 0x0392 },
- { 0x07C3, 0x0393 },
- { 0x07C4, 0x0394 },
- { 0x07C5, 0x0395 },
- { 0x07C6, 0x0396 },
- { 0x07C7, 0x0397 },
- { 0x07C8, 0x0398 },
- { 0x07C9, 0x0399 },
- { 0x07CA, 0x039A },
- { 0x07CB, 0x039B },
- { 0x07CC, 0x039C },
- { 0x07CD, 0x039D },
- { 0x07CE, 0x039E },
- { 0x07CF, 0x039F },
- { 0x07D0, 0x03A0 },
- { 0x07D1, 0x03A1 },
- { 0x07D2, 0x03A3 },
- { 0x07D4, 0x03A4 },
- { 0x07D5, 0x03A5 },
- { 0x07D6, 0x03A6 },
- { 0x07D7, 0x03A7 },
- { 0x07D8, 0x03A8 },
- { 0x07D9, 0x03A9 },
- { 0x07E1, 0x03B1 },
- { 0x07E2, 0x03B2 },
- { 0x07E3, 0x03B3 },
- { 0x07E4, 0x03B4 },
- { 0x07E5, 0x03B5 },
- { 0x07E6, 0x03B6 },
- { 0x07E7, 0x03B7 },
- { 0x07E8, 0x03B8 },
- { 0x07E9, 0x03B9 },
- { 0x07EA, 0x03BA },
- { 0x07EB, 0x03BB },
- { 0x07EC, 0x03BC },
- { 0x07ED, 0x03BD },
- { 0x07EE, 0x03BE },
- { 0x07EF, 0x03BF },
- { 0x07F0, 0x03C0 },
- { 0x07F1, 0x03C1 },
- { 0x07F2, 0x03C3 },
- { 0x07F3, 0x03C2 },
- { 0x07F4, 0x03C4 },
- { 0x07F5, 0x03C5 },
- { 0x07F6, 0x03C6 },
- { 0x07F7, 0x03C7 },
- { 0x07F8, 0x03C8 },
- { 0x07F9, 0x03C9 },
- { 0x08A1, 0x23B7 },
- { 0x08A2, 0x250C },
- { 0x08A3, 0x2500 },
- { 0x08A4, 0x2320 },
- { 0x08A5, 0x2321 },
- { 0x08A6, 0x2502 },
- { 0x08A7, 0x23A1 },
- { 0x08A8, 0x23A3 },
- { 0x08A9, 0x23A4 },
- { 0x08AA, 0x23A6 },
- { 0x08AB, 0x239B },
- { 0x08AC, 0x239D },
- { 0x08AD, 0x239E },
- { 0x08AE, 0x23A0 },
- { 0x08AF, 0x23A8 },
- { 0x08B0, 0x23AC },
- { 0x08BC, 0x2264 },
- { 0x08BD, 0x2260 },
- { 0x08BE, 0x2265 },
- { 0x08BF, 0x222B },
- { 0x08C0, 0x2234 },
- { 0x08C1, 0x221D },
- { 0x08C2, 0x221E },
- { 0x08C5, 0x2207 },
- { 0x08C8, 0x223C },
- { 0x08C9, 0x2243 },
- { 0x08CD, 0x21D4 },
- { 0x08CE, 0x21D2 },
- { 0x08CF, 0x2261 },
- { 0x08D6, 0x221A },
- { 0x08DA, 0x2282 },
- { 0x08DB, 0x2283 },
- { 0x08DC, 0x2229 },
- { 0x08DD, 0x222A },
- { 0x08DE, 0x2227 },
- { 0x08DF, 0x2228 },
- { 0x08EF, 0x2202 },
- { 0x08F6, 0x0192 },
- { 0x08FB, 0x2190 },
- { 0x08FC, 0x2191 },
- { 0x08FD, 0x2192 },
- { 0x08FE, 0x2193 },
- { 0x09E0, 0x25C6 },
- { 0x09E1, 0x2592 },
- { 0x09E2, 0x2409 },
- { 0x09E3, 0x240C },
- { 0x09E4, 0x240D },
- { 0x09E5, 0x240A },
- { 0x09E8, 0x2424 },
- { 0x09E9, 0x240B },
- { 0x09EA, 0x2518 },
- { 0x09EB, 0x2510 },
- { 0x09EC, 0x250C },
- { 0x09ED, 0x2514 },
- { 0x09EE, 0x253C },
- { 0x09EF, 0x23BA },
- { 0x09F0, 0x23BB },
- { 0x09F1, 0x2500 },
- { 0x09F2, 0x23BC },
- { 0x09F3, 0x23BD },
- { 0x09F4, 0x251C },
- { 0x09F5, 0x2524 },
- { 0x09F6, 0x2534 },
- { 0x09F7, 0x252C },
- { 0x09F8, 0x2502 },
- { 0x0AA1, 0x2003 },
- { 0x0AA2, 0x2002 },
- { 0x0AA3, 0x2004 },
- { 0x0AA4, 0x2005 },
- { 0x0AA5, 0x2007 },
- { 0x0AA6, 0x2008 },
- { 0x0AA7, 0x2009 },
- { 0x0AA8, 0x200A },
- { 0x0AA9, 0x2014 },
- { 0x0AAA, 0x2013 },
- { 0x0AAE, 0x2026 },
- { 0x0AAF, 0x2025 },
- { 0x0AB0, 0x2153 },
- { 0x0AB1, 0x2154 },
- { 0x0AB2, 0x2155 },
- { 0x0AB3, 0x2156 },
- { 0x0AB4, 0x2157 },
- { 0x0AB5, 0x2158 },
- { 0x0AB6, 0x2159 },
- { 0x0AB7, 0x215A },
- { 0x0AB8, 0x2105 },
- { 0x0ABB, 0x2012 },
- { 0x0ABC, 0x2329 },
- { 0x0ABE, 0x232A },
- { 0x0AC3, 0x215B },
- { 0x0AC4, 0x215C },
- { 0x0AC5, 0x215D },
- { 0x0AC6, 0x215E },
- { 0x0AC9, 0x2122 },
- { 0x0ACA, 0x2613 },
- { 0x0ACC, 0x25C1 },
- { 0x0ACD, 0x25B7 },
- { 0x0ACE, 0x25CB },
- { 0x0ACF, 0x25AF },
- { 0x0AD0, 0x2018 },
- { 0x0AD1, 0x2019 },
- { 0x0AD2, 0x201C },
- { 0x0AD3, 0x201D },
- { 0x0AD4, 0x211E },
- { 0x0AD6, 0x2032 },
- { 0x0AD7, 0x2033 },
- { 0x0AD9, 0x271D },
- { 0x0ADB, 0x25AC },
- { 0x0ADC, 0x25C0 },
- { 0x0ADD, 0x25B6 },
- { 0x0ADE, 0x25CF },
- { 0x0ADF, 0x25AE },
- { 0x0AE0, 0x25E6 },
- { 0x0AE1, 0x25AB },
- { 0x0AE2, 0x25AD },
- { 0x0AE3, 0x25B3 },
- { 0x0AE4, 0x25BD },
- { 0x0AE5, 0x2606 },
- { 0x0AE6, 0x2022 },
- { 0x0AE7, 0x25AA },
- { 0x0AE8, 0x25B2 },
- { 0x0AE9, 0x25BC },
- { 0x0AEA, 0x261C },
- { 0x0AEB, 0x261E },
- { 0x0AEC, 0x2663 },
- { 0x0AED, 0x2666 },
- { 0x0AEE, 0x2665 },
- { 0x0AF0, 0x2720 },
- { 0x0AF1, 0x2020 },
- { 0x0AF2, 0x2021 },
- { 0x0AF3, 0x2713 },
- { 0x0AF4, 0x2717 },
- { 0x0AF5, 0x266F },
- { 0x0AF6, 0x266D },
- { 0x0AF7, 0x2642 },
- { 0x0AF8, 0x2640 },
- { 0x0AF9, 0x260E },
- { 0x0AFA, 0x2315 },
- { 0x0AFB, 0x2117 },
- { 0x0AFC, 0x2038 },
- { 0x0AFD, 0x201A },
- { 0x0AFE, 0x201E },
- { 0x0BA3, 0x003C },
- { 0x0BA6, 0x003E },
- { 0x0BA8, 0x2228 },
- { 0x0BA9, 0x2227 },
- { 0x0BC0, 0x00AF },
- { 0x0BC2, 0x22A5 },
- { 0x0BC3, 0x2229 },
- { 0x0BC4, 0x230A },
- { 0x0BC6, 0x005F },
- { 0x0BCA, 0x2218 },
- { 0x0BCC, 0x2395 },
- { 0x0BCE, 0x22A4 },
- { 0x0BCF, 0x25CB },
- { 0x0BD3, 0x2308 },
- { 0x0BD6, 0x222A },
- { 0x0BD8, 0x2283 },
- { 0x0BDA, 0x2282 },
- { 0x0BDC, 0x22A2 },
- { 0x0BFC, 0x22A3 },
- { 0x0CDF, 0x2017 },
- { 0x0CE0, 0x05D0 },
- { 0x0CE1, 0x05D1 },
- { 0x0CE2, 0x05D2 },
- { 0x0CE3, 0x05D3 },
- { 0x0CE4, 0x05D4 },
- { 0x0CE5, 0x05D5 },
- { 0x0CE6, 0x05D6 },
- { 0x0CE7, 0x05D7 },
- { 0x0CE8, 0x05D8 },
- { 0x0CE9, 0x05D9 },
- { 0x0CEA, 0x05DA },
- { 0x0CEB, 0x05DB },
- { 0x0CEC, 0x05DC },
- { 0x0CED, 0x05DD },
- { 0x0CEE, 0x05DE },
- { 0x0CEF, 0x05DF },
- { 0x0CF0, 0x05E0 },
- { 0x0CF1, 0x05E1 },
- { 0x0CF2, 0x05E2 },
- { 0x0CF3, 0x05E3 },
- { 0x0CF4, 0x05E4 },
- { 0x0CF5, 0x05E5 },
- { 0x0CF6, 0x05E6 },
- { 0x0CF7, 0x05E7 },
- { 0x0CF8, 0x05E8 },
- { 0x0CF9, 0x05E9 },
- { 0x0CFA, 0x05EA },
- { 0x0DA1, 0x0E01 },
- { 0x0DA2, 0x0E02 },
- { 0x0DA3, 0x0E03 },
- { 0x0DA4, 0x0E04 },
- { 0x0DA5, 0x0E05 },
- { 0x0DA6, 0x0E06 },
- { 0x0DA7, 0x0E07 },
- { 0x0DA8, 0x0E08 },
- { 0x0DA9, 0x0E09 },
- { 0x0DAA, 0x0E0A },
- { 0x0DAB, 0x0E0B },
- { 0x0DAC, 0x0E0C },
- { 0x0DAD, 0x0E0D },
- { 0x0DAE, 0x0E0E },
- { 0x0DAF, 0x0E0F },
- { 0x0DB0, 0x0E10 },
- { 0x0DB1, 0x0E11 },
- { 0x0DB2, 0x0E12 },
- { 0x0DB3, 0x0E13 },
- { 0x0DB4, 0x0E14 },
- { 0x0DB5, 0x0E15 },
- { 0x0DB6, 0x0E16 },
- { 0x0DB7, 0x0E17 },
- { 0x0DB8, 0x0E18 },
- { 0x0DB9, 0x0E19 },
- { 0x0DBA, 0x0E1A },
- { 0x0DBB, 0x0E1B },
- { 0x0DBC, 0x0E1C },
- { 0x0DBD, 0x0E1D },
- { 0x0DBE, 0x0E1E },
- { 0x0DBF, 0x0E1F },
- { 0x0DC0, 0x0E20 },
- { 0x0DC1, 0x0E21 },
- { 0x0DC2, 0x0E22 },
- { 0x0DC3, 0x0E23 },
- { 0x0DC4, 0x0E24 },
- { 0x0DC5, 0x0E25 },
- { 0x0DC6, 0x0E26 },
- { 0x0DC7, 0x0E27 },
- { 0x0DC8, 0x0E28 },
- { 0x0DC9, 0x0E29 },
- { 0x0DCA, 0x0E2A },
- { 0x0DCB, 0x0E2B },
- { 0x0DCC, 0x0E2C },
- { 0x0DCD, 0x0E2D },
- { 0x0DCE, 0x0E2E },
- { 0x0DCF, 0x0E2F },
- { 0x0DD0, 0x0E30 },
- { 0x0DD1, 0x0E31 },
- { 0x0DD2, 0x0E32 },
- { 0x0DD3, 0x0E33 },
- { 0x0DD4, 0x0E34 },
- { 0x0DD5, 0x0E35 },
- { 0x0DD6, 0x0E36 },
- { 0x0DD7, 0x0E37 },
- { 0x0DD8, 0x0E38 },
- { 0x0DD9, 0x0E39 },
- { 0x0DDA, 0x0E3A },
- { 0x0DDF, 0x0E3F },
- { 0x0DE0, 0x0E40 },
- { 0x0DE1, 0x0E41 },
- { 0x0DE2, 0x0E42 },
- { 0x0DE3, 0x0E43 },
- { 0x0DE4, 0x0E44 },
- { 0x0DE5, 0x0E45 },
- { 0x0DE6, 0x0E46 },
- { 0x0DE7, 0x0E47 },
- { 0x0DE8, 0x0E48 },
- { 0x0DE9, 0x0E49 },
- { 0x0DEA, 0x0E4A },
- { 0x0DEB, 0x0E4B },
- { 0x0DEC, 0x0E4C },
- { 0x0DED, 0x0E4D },
- { 0x0DF0, 0x0E50 },
- { 0x0DF1, 0x0E51 },
- { 0x0DF2, 0x0E52 },
- { 0x0DF3, 0x0E53 },
- { 0x0DF4, 0x0E54 },
- { 0x0DF5, 0x0E55 },
- { 0x0DF6, 0x0E56 },
- { 0x0DF7, 0x0E57 },
- { 0x0DF8, 0x0E58 },
- { 0x0DF9, 0x0E59 },
- { 0x0EA1, 0x3131 },
- { 0x0EA2, 0x3132 },
- { 0x0EA3, 0x3133 },
- { 0x0EA4, 0x3134 },
- { 0x0EA5, 0x3135 },
- { 0x0EA6, 0x3136 },
- { 0x0EA7, 0x3137 },
- { 0x0EA8, 0x3138 },
- { 0x0EA9, 0x3139 },
- { 0x0EAA, 0x313A },
- { 0x0EAB, 0x313B },
- { 0x0EAC, 0x313C },
- { 0x0EAD, 0x313D },
- { 0x0EAE, 0x313E },
- { 0x0EAF, 0x313F },
- { 0x0EB0, 0x3140 },
- { 0x0EB1, 0x3141 },
- { 0x0EB2, 0x3142 },
- { 0x0EB3, 0x3143 },
- { 0x0EB4, 0x3144 },
- { 0x0EB5, 0x3145 },
- { 0x0EB6, 0x3146 },
- { 0x0EB7, 0x3147 },
- { 0x0EB8, 0x3148 },
- { 0x0EB9, 0x3149 },
- { 0x0EBA, 0x314A },
- { 0x0EBB, 0x314B },
- { 0x0EBC, 0x314C },
- { 0x0EBD, 0x314D },
- { 0x0EBE, 0x314E },
- { 0x0EBF, 0x314F },
- { 0x0EC0, 0x3150 },
- { 0x0EC1, 0x3151 },
- { 0x0EC2, 0x3152 },
- { 0x0EC3, 0x3153 },
- { 0x0EC4, 0x3154 },
- { 0x0EC5, 0x3155 },
- { 0x0EC6, 0x3156 },
- { 0x0EC7, 0x3157 },
- { 0x0EC8, 0x3158 },
- { 0x0EC9, 0x3159 },
- { 0x0ECA, 0x315A },
- { 0x0ECB, 0x315B },
- { 0x0ECC, 0x315C },
- { 0x0ECD, 0x315D },
- { 0x0ECE, 0x315E },
- { 0x0ECF, 0x315F },
- { 0x0ED0, 0x3160 },
- { 0x0ED1, 0x3161 },
- { 0x0ED2, 0x3162 },
- { 0x0ED3, 0x3163 },
- { 0x0ED4, 0x11A8 },
- { 0x0ED5, 0x11A9 },
- { 0x0ED6, 0x11AA },
- { 0x0ED7, 0x11AB },
- { 0x0ED8, 0x11AC },
- { 0x0ED9, 0x11AD },
- { 0x0EDA, 0x11AE },
- { 0x0EDB, 0x11AF },
- { 0x0EDC, 0x11B0 },
- { 0x0EDD, 0x11B1 },
- { 0x0EDE, 0x11B2 },
- { 0x0EDF, 0x11B3 },
- { 0x0EE0, 0x11B4 },
- { 0x0EE1, 0x11B5 },
- { 0x0EE2, 0x11B6 },
- { 0x0EE3, 0x11B7 },
- { 0x0EE4, 0x11B8 },
- { 0x0EE5, 0x11B9 },
- { 0x0EE6, 0x11BA },
- { 0x0EE7, 0x11BB },
- { 0x0EE8, 0x11BC },
- { 0x0EE9, 0x11BD },
- { 0x0EEA, 0x11BE },
- { 0x0EEB, 0x11BF },
- { 0x0EEC, 0x11C0 },
- { 0x0EED, 0x11C1 },
- { 0x0EEE, 0x11C2 },
- { 0x0EEF, 0x316D },
- { 0x0EF0, 0x3171 },
- { 0x0EF1, 0x3178 },
- { 0x0EF2, 0x317F },
- { 0x0EF3, 0x3181 },
- { 0x0EF4, 0x3184 },
- { 0x0EF5, 0x3186 },
- { 0x0EF6, 0x318D },
- { 0x0EF7, 0x318E },
- { 0x0EF8, 0x11EB },
- { 0x0EF9, 0x11F0 },
- { 0x0EFA, 0x11F9 },
- { 0x0EFF, 0x20A9 },
- { 0x13A4, 0x20AC },
- { 0x13BC, 0x0152 },
- { 0x13BD, 0x0153 },
- { 0x13BE, 0x0178 },
- { 0x20AC, 0x20AC },
-};
-
-unsigned int KeyMappingX11::get_unicode_from_keysym(KeySym p_keysym) {
- /* Latin-1 */
- if (p_keysym >= 0x20 && p_keysym <= 0x7e) {
+char32_t KeyMappingX11::get_unicode_from_keysym(KeySym p_keysym) {
+ // Latin-1
+ if (p_keysym >= 0x20 && p_keysym <= 0x7E) {
return p_keysym;
}
- if (p_keysym >= 0xa0 && p_keysym <= 0xff) {
+ if (p_keysym >= 0xA0 && p_keysym <= 0xFF) {
return p_keysym;
}
- // keypad to latin1 is easy
- if (p_keysym >= 0xffaa && p_keysym <= 0xffb9) {
- return p_keysym - 0xff80;
- }
- /* Unicode (may be present)*/
-
- if ((p_keysym & 0xff000000) == 0x01000000) {
- return p_keysym & 0x00ffffff;
+ // Keypad to Latin-1.
+ if (p_keysym >= 0xFFAA && p_keysym <= 0xFFB9) {
+ return p_keysym - 0xFF80;
}
- int middle, low = 0, high = _KEYSYM_MAX - 1;
- do {
- middle = (high + low) / 2;
- if (_xkeysym_to_unicode[middle].keysym == p_keysym) {
- return _xkeysym_to_unicode[middle].unicode;
- }
- if (_xkeysym_to_unicode[middle].keysym <= p_keysym) {
- low = middle + 1;
- } else {
- high = middle - 1;
- }
- } while (high >= low);
-
- return 0;
-}
-
-struct _XTranslateUnicodePairReverse {
- unsigned int unicode;
- KeySym keysym;
-};
-
-enum {
- _UNICODE_MAX = 750
-};
-
-static _XTranslateUnicodePairReverse _unicode_to_xkeysym[_UNICODE_MAX] = {
- { 0x0ABD, 0x002E },
- { 0x0BA3, 0x003C },
- { 0x0BA6, 0x003E },
- { 0x0BC6, 0x005F },
- { 0x0BC0, 0x00AF },
- { 0x03C0, 0x0100 },
- { 0x03E0, 0x0101 },
- { 0x01C3, 0x0102 },
- { 0x01E3, 0x0103 },
- { 0x01A1, 0x0104 },
- { 0x01B1, 0x0105 },
- { 0x01C6, 0x0106 },
- { 0x01E6, 0x0107 },
- { 0x02C6, 0x0108 },
- { 0x02E6, 0x0109 },
- { 0x02C5, 0x010A },
- { 0x02E5, 0x010B },
- { 0x01C8, 0x010C },
- { 0x01E8, 0x010D },
- { 0x01CF, 0x010E },
- { 0x01EF, 0x010F },
- { 0x01D0, 0x0110 },
- { 0x01F0, 0x0111 },
- { 0x03AA, 0x0112 },
- { 0x03BA, 0x0113 },
- { 0x03CC, 0x0116 },
- { 0x03EC, 0x0117 },
- { 0x01CA, 0x0118 },
- { 0x01EA, 0x0119 },
- { 0x01CC, 0x011A },
- { 0x01EC, 0x011B },
- { 0x02D8, 0x011C },
- { 0x02F8, 0x011D },
- { 0x02AB, 0x011E },
- { 0x02BB, 0x011F },
- { 0x02D5, 0x0120 },
- { 0x02F5, 0x0121 },
- { 0x03AB, 0x0122 },
- { 0x03BB, 0x0123 },
- { 0x02A6, 0x0124 },
- { 0x02B6, 0x0125 },
- { 0x02A1, 0x0126 },
- { 0x02B1, 0x0127 },
- { 0x03A5, 0x0128 },
- { 0x03B5, 0x0129 },
- { 0x03CF, 0x012A },
- { 0x03EF, 0x012B },
- { 0x03C7, 0x012E },
- { 0x03E7, 0x012F },
- { 0x02A9, 0x0130 },
- { 0x02B9, 0x0131 },
- { 0x02AC, 0x0134 },
- { 0x02BC, 0x0135 },
- { 0x03D3, 0x0136 },
- { 0x03F3, 0x0137 },
- { 0x03A2, 0x0138 },
- { 0x01C5, 0x0139 },
- { 0x01E5, 0x013A },
- { 0x03A6, 0x013B },
- { 0x03B6, 0x013C },
- { 0x01A5, 0x013D },
- { 0x01B5, 0x013E },
- { 0x01A3, 0x0141 },
- { 0x01B3, 0x0142 },
- { 0x01D1, 0x0143 },
- { 0x01F1, 0x0144 },
- { 0x03D1, 0x0145 },
- { 0x03F1, 0x0146 },
- { 0x01D2, 0x0147 },
- { 0x01F2, 0x0148 },
- { 0x03BD, 0x014A },
- { 0x03BF, 0x014B },
- { 0x03D2, 0x014C },
- { 0x03F2, 0x014D },
- { 0x01D5, 0x0150 },
- { 0x01F5, 0x0151 },
- { 0x13BC, 0x0152 },
- { 0x13BD, 0x0153 },
- { 0x01C0, 0x0154 },
- { 0x01E0, 0x0155 },
- { 0x03A3, 0x0156 },
- { 0x03B3, 0x0157 },
- { 0x01D8, 0x0158 },
- { 0x01F8, 0x0159 },
- { 0x01A6, 0x015A },
- { 0x01B6, 0x015B },
- { 0x02DE, 0x015C },
- { 0x02FE, 0x015D },
- { 0x01AA, 0x015E },
- { 0x01BA, 0x015F },
- { 0x01A9, 0x0160 },
- { 0x01B9, 0x0161 },
- { 0x01DE, 0x0162 },
- { 0x01FE, 0x0163 },
- { 0x01AB, 0x0164 },
- { 0x01BB, 0x0165 },
- { 0x03AC, 0x0166 },
- { 0x03BC, 0x0167 },
- { 0x03DD, 0x0168 },
- { 0x03FD, 0x0169 },
- { 0x03DE, 0x016A },
- { 0x03FE, 0x016B },
- { 0x02DD, 0x016C },
- { 0x02FD, 0x016D },
- { 0x01D9, 0x016E },
- { 0x01F9, 0x016F },
- { 0x01DB, 0x0170 },
- { 0x01FB, 0x0171 },
- { 0x03D9, 0x0172 },
- { 0x03F9, 0x0173 },
- { 0x13BE, 0x0178 },
- { 0x01AC, 0x0179 },
- { 0x01BC, 0x017A },
- { 0x01AF, 0x017B },
- { 0x01BF, 0x017C },
- { 0x01AE, 0x017D },
- { 0x01BE, 0x017E },
- { 0x08F6, 0x0192 },
- { 0x01B7, 0x02C7 },
- { 0x01A2, 0x02D8 },
- { 0x01FF, 0x02D9 },
- { 0x01B2, 0x02DB },
- { 0x01BD, 0x02DD },
- { 0x07AE, 0x0385 },
- { 0x07A1, 0x0386 },
- { 0x07A2, 0x0388 },
- { 0x07A3, 0x0389 },
- { 0x07A4, 0x038A },
- { 0x07A7, 0x038C },
- { 0x07A8, 0x038E },
- { 0x07AB, 0x038F },
- { 0x07B6, 0x0390 },
- { 0x07C1, 0x0391 },
- { 0x07C2, 0x0392 },
- { 0x07C3, 0x0393 },
- { 0x07C4, 0x0394 },
- { 0x07C5, 0x0395 },
- { 0x07C6, 0x0396 },
- { 0x07C7, 0x0397 },
- { 0x07C8, 0x0398 },
- { 0x07C9, 0x0399 },
- { 0x07CA, 0x039A },
- { 0x07CB, 0x039B },
- { 0x07CC, 0x039C },
- { 0x07CD, 0x039D },
- { 0x07CE, 0x039E },
- { 0x07CF, 0x039F },
- { 0x07D0, 0x03A0 },
- { 0x07D1, 0x03A1 },
- { 0x07D2, 0x03A3 },
- { 0x07D4, 0x03A4 },
- { 0x07D5, 0x03A5 },
- { 0x07D6, 0x03A6 },
- { 0x07D7, 0x03A7 },
- { 0x07D8, 0x03A8 },
- { 0x07D9, 0x03A9 },
- { 0x07A5, 0x03AA },
- { 0x07A9, 0x03AB },
- { 0x07B1, 0x03AC },
- { 0x07B2, 0x03AD },
- { 0x07B3, 0x03AE },
- { 0x07B4, 0x03AF },
- { 0x07BA, 0x03B0 },
- { 0x07E1, 0x03B1 },
- { 0x07E2, 0x03B2 },
- { 0x07E3, 0x03B3 },
- { 0x07E4, 0x03B4 },
- { 0x07E5, 0x03B5 },
- { 0x07E6, 0x03B6 },
- { 0x07E7, 0x03B7 },
- { 0x07E8, 0x03B8 },
- { 0x07E9, 0x03B9 },
- { 0x07EA, 0x03BA },
- { 0x07EB, 0x03BB },
- { 0x07EC, 0x03BC },
- { 0x07ED, 0x03BD },
- { 0x07EE, 0x03BE },
- { 0x07EF, 0x03BF },
- { 0x07F0, 0x03C0 },
- { 0x07F1, 0x03C1 },
- { 0x07F3, 0x03C2 },
- { 0x07F2, 0x03C3 },
- { 0x07F4, 0x03C4 },
- { 0x07F5, 0x03C5 },
- { 0x07F6, 0x03C6 },
- { 0x07F7, 0x03C7 },
- { 0x07F8, 0x03C8 },
- { 0x07F9, 0x03C9 },
- { 0x07B5, 0x03CA },
- { 0x07B9, 0x03CB },
- { 0x07B7, 0x03CC },
- { 0x07B8, 0x03CD },
- { 0x07BB, 0x03CE },
- { 0x06B3, 0x0401 },
- { 0x06B1, 0x0402 },
- { 0x06B2, 0x0403 },
- { 0x06B4, 0x0404 },
- { 0x06B5, 0x0405 },
- { 0x06B6, 0x0406 },
- { 0x06B7, 0x0407 },
- { 0x06B8, 0x0408 },
- { 0x06B9, 0x0409 },
- { 0x06BA, 0x040A },
- { 0x06BB, 0x040B },
- { 0x06BC, 0x040C },
- { 0x06BE, 0x040E },
- { 0x06BF, 0x040F },
- { 0x06E1, 0x0410 },
- { 0x06E2, 0x0411 },
- { 0x06F7, 0x0412 },
- { 0x06E7, 0x0413 },
- { 0x06E4, 0x0414 },
- { 0x06E5, 0x0415 },
- { 0x06F6, 0x0416 },
- { 0x06FA, 0x0417 },
- { 0x06E9, 0x0418 },
- { 0x06EA, 0x0419 },
- { 0x06EB, 0x041A },
- { 0x06EC, 0x041B },
- { 0x06ED, 0x041C },
- { 0x06EE, 0x041D },
- { 0x06EF, 0x041E },
- { 0x06F0, 0x041F },
- { 0x06F2, 0x0420 },
- { 0x06F3, 0x0421 },
- { 0x06F4, 0x0422 },
- { 0x06F5, 0x0423 },
- { 0x06E6, 0x0424 },
- { 0x06E8, 0x0425 },
- { 0x06E3, 0x0426 },
- { 0x06FE, 0x0427 },
- { 0x06FB, 0x0428 },
- { 0x06FD, 0x0429 },
- { 0x06FF, 0x042A },
- { 0x06F9, 0x042B },
- { 0x06F8, 0x042C },
- { 0x06FC, 0x042D },
- { 0x06E0, 0x042E },
- { 0x06F1, 0x042F },
- { 0x06C1, 0x0430 },
- { 0x06C2, 0x0431 },
- { 0x06D7, 0x0432 },
- { 0x06C7, 0x0433 },
- { 0x06C4, 0x0434 },
- { 0x06C5, 0x0435 },
- { 0x06D6, 0x0436 },
- { 0x06DA, 0x0437 },
- { 0x06C9, 0x0438 },
- { 0x06CA, 0x0439 },
- { 0x06CB, 0x043A },
- { 0x06CC, 0x043B },
- { 0x06CD, 0x043C },
- { 0x06CE, 0x043D },
- { 0x06CF, 0x043E },
- { 0x06D0, 0x043F },
- { 0x06D2, 0x0440 },
- { 0x06D3, 0x0441 },
- { 0x06D4, 0x0442 },
- { 0x06D5, 0x0443 },
- { 0x06C6, 0x0444 },
- { 0x06C8, 0x0445 },
- { 0x06C3, 0x0446 },
- { 0x06DE, 0x0447 },
- { 0x06DB, 0x0448 },
- { 0x06DD, 0x0449 },
- { 0x06DF, 0x044A },
- { 0x06D9, 0x044B },
- { 0x06D8, 0x044C },
- { 0x06DC, 0x044D },
- { 0x06C0, 0x044E },
- { 0x06D1, 0x044F },
- { 0x06A3, 0x0451 },
- { 0x06A1, 0x0452 },
- { 0x06A2, 0x0453 },
- { 0x06A4, 0x0454 },
- { 0x06A5, 0x0455 },
- { 0x06A6, 0x0456 },
- { 0x06A7, 0x0457 },
- { 0x06A8, 0x0458 },
- { 0x06A9, 0x0459 },
- { 0x06AA, 0x045A },
- { 0x06AB, 0x045B },
- { 0x06AC, 0x045C },
- { 0x06AE, 0x045E },
- { 0x06AF, 0x045F },
- { 0x0CE0, 0x05D0 },
- { 0x0CE1, 0x05D1 },
- { 0x0CE2, 0x05D2 },
- { 0x0CE3, 0x05D3 },
- { 0x0CE4, 0x05D4 },
- { 0x0CE5, 0x05D5 },
- { 0x0CE6, 0x05D6 },
- { 0x0CE7, 0x05D7 },
- { 0x0CE8, 0x05D8 },
- { 0x0CE9, 0x05D9 },
- { 0x0CEA, 0x05DA },
- { 0x0CEB, 0x05DB },
- { 0x0CEC, 0x05DC },
- { 0x0CED, 0x05DD },
- { 0x0CEE, 0x05DE },
- { 0x0CEF, 0x05DF },
- { 0x0CF0, 0x05E0 },
- { 0x0CF1, 0x05E1 },
- { 0x0CF2, 0x05E2 },
- { 0x0CF3, 0x05E3 },
- { 0x0CF4, 0x05E4 },
- { 0x0CF5, 0x05E5 },
- { 0x0CF6, 0x05E6 },
- { 0x0CF7, 0x05E7 },
- { 0x0CF8, 0x05E8 },
- { 0x0CF9, 0x05E9 },
- { 0x0CFA, 0x05EA },
- { 0x05AC, 0x060C },
- { 0x05BB, 0x061B },
- { 0x05BF, 0x061F },
- { 0x05C1, 0x0621 },
- { 0x05C2, 0x0622 },
- { 0x05C3, 0x0623 },
- { 0x05C4, 0x0624 },
- { 0x05C5, 0x0625 },
- { 0x05C6, 0x0626 },
- { 0x05C7, 0x0627 },
- { 0x05C8, 0x0628 },
- { 0x05C9, 0x0629 },
- { 0x05CA, 0x062A },
- { 0x05CB, 0x062B },
- { 0x05CC, 0x062C },
- { 0x05CD, 0x062D },
- { 0x05CE, 0x062E },
- { 0x05CF, 0x062F },
- { 0x05D0, 0x0630 },
- { 0x05D1, 0x0631 },
- { 0x05D2, 0x0632 },
- { 0x05D3, 0x0633 },
- { 0x05D4, 0x0634 },
- { 0x05D5, 0x0635 },
- { 0x05D6, 0x0636 },
- { 0x05D7, 0x0637 },
- { 0x05D8, 0x0638 },
- { 0x05D9, 0x0639 },
- { 0x05DA, 0x063A },
- { 0x05E0, 0x0640 },
- { 0x05E1, 0x0641 },
- { 0x05E2, 0x0642 },
- { 0x05E3, 0x0643 },
- { 0x05E4, 0x0644 },
- { 0x05E5, 0x0645 },
- { 0x05E6, 0x0646 },
- { 0x05E7, 0x0647 },
- { 0x05E8, 0x0648 },
- { 0x05E9, 0x0649 },
- { 0x05EA, 0x064A },
- { 0x05EB, 0x064B },
- { 0x05EC, 0x064C },
- { 0x05ED, 0x064D },
- { 0x05EE, 0x064E },
- { 0x05EF, 0x064F },
- { 0x05F0, 0x0650 },
- { 0x05F1, 0x0651 },
- { 0x05F2, 0x0652 },
- { 0x0DA1, 0x0E01 },
- { 0x0DA2, 0x0E02 },
- { 0x0DA3, 0x0E03 },
- { 0x0DA4, 0x0E04 },
- { 0x0DA5, 0x0E05 },
- { 0x0DA6, 0x0E06 },
- { 0x0DA7, 0x0E07 },
- { 0x0DA8, 0x0E08 },
- { 0x0DA9, 0x0E09 },
- { 0x0DAA, 0x0E0A },
- { 0x0DAB, 0x0E0B },
- { 0x0DAC, 0x0E0C },
- { 0x0DAD, 0x0E0D },
- { 0x0DAE, 0x0E0E },
- { 0x0DAF, 0x0E0F },
- { 0x0DB0, 0x0E10 },
- { 0x0DB1, 0x0E11 },
- { 0x0DB2, 0x0E12 },
- { 0x0DB3, 0x0E13 },
- { 0x0DB4, 0x0E14 },
- { 0x0DB5, 0x0E15 },
- { 0x0DB6, 0x0E16 },
- { 0x0DB7, 0x0E17 },
- { 0x0DB8, 0x0E18 },
- { 0x0DB9, 0x0E19 },
- { 0x0DBA, 0x0E1A },
- { 0x0DBB, 0x0E1B },
- { 0x0DBC, 0x0E1C },
- { 0x0DBD, 0x0E1D },
- { 0x0DBE, 0x0E1E },
- { 0x0DBF, 0x0E1F },
- { 0x0DC0, 0x0E20 },
- { 0x0DC1, 0x0E21 },
- { 0x0DC2, 0x0E22 },
- { 0x0DC3, 0x0E23 },
- { 0x0DC4, 0x0E24 },
- { 0x0DC5, 0x0E25 },
- { 0x0DC6, 0x0E26 },
- { 0x0DC7, 0x0E27 },
- { 0x0DC8, 0x0E28 },
- { 0x0DC9, 0x0E29 },
- { 0x0DCA, 0x0E2A },
- { 0x0DCB, 0x0E2B },
- { 0x0DCC, 0x0E2C },
- { 0x0DCD, 0x0E2D },
- { 0x0DCE, 0x0E2E },
- { 0x0DCF, 0x0E2F },
- { 0x0DD0, 0x0E30 },
- { 0x0DD1, 0x0E31 },
- { 0x0DD2, 0x0E32 },
- { 0x0DD3, 0x0E33 },
- { 0x0DD4, 0x0E34 },
- { 0x0DD5, 0x0E35 },
- { 0x0DD6, 0x0E36 },
- { 0x0DD7, 0x0E37 },
- { 0x0DD8, 0x0E38 },
- { 0x0DD9, 0x0E39 },
- { 0x0DDA, 0x0E3A },
- { 0x0DDF, 0x0E3F },
- { 0x0DE0, 0x0E40 },
- { 0x0DE1, 0x0E41 },
- { 0x0DE2, 0x0E42 },
- { 0x0DE3, 0x0E43 },
- { 0x0DE4, 0x0E44 },
- { 0x0DE5, 0x0E45 },
- { 0x0DE6, 0x0E46 },
- { 0x0DE7, 0x0E47 },
- { 0x0DE8, 0x0E48 },
- { 0x0DE9, 0x0E49 },
- { 0x0DEA, 0x0E4A },
- { 0x0DEB, 0x0E4B },
- { 0x0DEC, 0x0E4C },
- { 0x0DED, 0x0E4D },
- { 0x0DF0, 0x0E50 },
- { 0x0DF1, 0x0E51 },
- { 0x0DF2, 0x0E52 },
- { 0x0DF3, 0x0E53 },
- { 0x0DF4, 0x0E54 },
- { 0x0DF5, 0x0E55 },
- { 0x0DF6, 0x0E56 },
- { 0x0DF7, 0x0E57 },
- { 0x0DF8, 0x0E58 },
- { 0x0DF9, 0x0E59 },
- { 0x0ED4, 0x11A8 },
- { 0x0ED5, 0x11A9 },
- { 0x0ED6, 0x11AA },
- { 0x0ED7, 0x11AB },
- { 0x0ED8, 0x11AC },
- { 0x0ED9, 0x11AD },
- { 0x0EDA, 0x11AE },
- { 0x0EDB, 0x11AF },
- { 0x0EDC, 0x11B0 },
- { 0x0EDD, 0x11B1 },
- { 0x0EDE, 0x11B2 },
- { 0x0EDF, 0x11B3 },
- { 0x0EE0, 0x11B4 },
- { 0x0EE1, 0x11B5 },
- { 0x0EE2, 0x11B6 },
- { 0x0EE3, 0x11B7 },
- { 0x0EE4, 0x11B8 },
- { 0x0EE5, 0x11B9 },
- { 0x0EE6, 0x11BA },
- { 0x0EE7, 0x11BB },
- { 0x0EE8, 0x11BC },
- { 0x0EE9, 0x11BD },
- { 0x0EEA, 0x11BE },
- { 0x0EEB, 0x11BF },
- { 0x0EEC, 0x11C0 },
- { 0x0EED, 0x11C1 },
- { 0x0EEE, 0x11C2 },
- { 0x0EF8, 0x11EB },
- { 0x0EFA, 0x11F9 },
- { 0x0AA2, 0x2002 },
- { 0x0AA1, 0x2003 },
- { 0x0AA3, 0x2004 },
- { 0x0AA4, 0x2005 },
- { 0x0AA5, 0x2007 },
- { 0x0AA6, 0x2008 },
- { 0x0AA7, 0x2009 },
- { 0x0AA8, 0x200A },
- { 0x0ABB, 0x2012 },
- { 0x0AAA, 0x2013 },
- { 0x0AA9, 0x2014 },
- { 0x07AF, 0x2015 },
- { 0x0CDF, 0x2017 },
- { 0x0AD0, 0x2018 },
- { 0x0AD1, 0x2019 },
- { 0x0AFD, 0x201A },
- { 0x0AD2, 0x201C },
- { 0x0AD3, 0x201D },
- { 0x0AFE, 0x201E },
- { 0x0AF1, 0x2020 },
- { 0x0AF2, 0x2021 },
- { 0x0AE6, 0x2022 },
- { 0x0AAE, 0x2026 },
- { 0x0AD6, 0x2032 },
- { 0x0AD7, 0x2033 },
- { 0x0AFC, 0x2038 },
- { 0x047E, 0x203E },
- { 0x20A0, 0x20A0 },
- { 0x20A1, 0x20A1 },
- { 0x20A2, 0x20A2 },
- { 0x20A3, 0x20A3 },
- { 0x20A4, 0x20A4 },
- { 0x20A5, 0x20A5 },
- { 0x20A6, 0x20A6 },
- { 0x20A7, 0x20A7 },
- { 0x20A8, 0x20A8 },
- { 0x0EFF, 0x20A9 },
- { 0x20A9, 0x20A9 },
- { 0x20AA, 0x20AA },
- { 0x20AB, 0x20AB },
- { 0x20AC, 0x20AC },
- { 0x0AB8, 0x2105 },
- { 0x06B0, 0x2116 },
- { 0x0AFB, 0x2117 },
- { 0x0AD4, 0x211E },
- { 0x0AC9, 0x2122 },
- { 0x0AB0, 0x2153 },
- { 0x0AB1, 0x2154 },
- { 0x0AB2, 0x2155 },
- { 0x0AB3, 0x2156 },
- { 0x0AB4, 0x2157 },
- { 0x0AB5, 0x2158 },
- { 0x0AB6, 0x2159 },
- { 0x0AB7, 0x215A },
- { 0x0AC3, 0x215B },
- { 0x0AC4, 0x215C },
- { 0x0AC5, 0x215D },
- { 0x0AC6, 0x215E },
- { 0x08FB, 0x2190 },
- { 0x08FC, 0x2191 },
- { 0x08FD, 0x2192 },
- { 0x08FE, 0x2193 },
- { 0x08CE, 0x21D2 },
- { 0x08CD, 0x21D4 },
- { 0x08EF, 0x2202 },
- { 0x08C5, 0x2207 },
- { 0x0BCA, 0x2218 },
- { 0x08D6, 0x221A },
- { 0x08C1, 0x221D },
- { 0x08C2, 0x221E },
- { 0x08DE, 0x2227 },
- { 0x0BA9, 0x2227 },
- { 0x08DF, 0x2228 },
- { 0x0BA8, 0x2228 },
- { 0x08DC, 0x2229 },
- { 0x0BC3, 0x2229 },
- { 0x08DD, 0x222A },
- { 0x0BD6, 0x222A },
- { 0x08BF, 0x222B },
- { 0x08C0, 0x2234 },
- { 0x08C8, 0x2245 },
- { 0x08BD, 0x2260 },
- { 0x08CF, 0x2261 },
- { 0x08BC, 0x2264 },
- { 0x08BE, 0x2265 },
- { 0x08DA, 0x2282 },
- { 0x0BDA, 0x2282 },
- { 0x08DB, 0x2283 },
- { 0x0BD8, 0x2283 },
- { 0x0BFC, 0x22A2 },
- { 0x0BDC, 0x22A3 },
- { 0x0BC2, 0x22A4 },
- { 0x0BCE, 0x22A5 },
- { 0x0BD3, 0x2308 },
- { 0x0BC4, 0x230A },
- { 0x0AFA, 0x2315 },
- { 0x08A4, 0x2320 },
- { 0x08A5, 0x2321 },
- { 0x0ABC, 0x2329 },
- { 0x0ABE, 0x232A },
- { 0x0BCC, 0x2395 },
- { 0x09E2, 0x2409 },
- { 0x09E5, 0x240A },
- { 0x09E9, 0x240B },
- { 0x09E3, 0x240C },
- { 0x09E4, 0x240D },
- { 0x09DF, 0x2422 },
- { 0x09E8, 0x2424 },
- { 0x09F1, 0x2500 },
- { 0x08A6, 0x2502 },
- { 0x09F8, 0x2502 },
- { 0x09EC, 0x250C },
- { 0x09EB, 0x2510 },
- { 0x09ED, 0x2514 },
- { 0x09EA, 0x2518 },
- { 0x09F4, 0x251C },
- { 0x09F5, 0x2524 },
- { 0x09F7, 0x252C },
- { 0x09F6, 0x2534 },
- { 0x09EE, 0x253C },
- { 0x09E1, 0x2592 },
- { 0x0ADF, 0x25A0 },
- { 0x0ACF, 0x25A1 },
- { 0x0AE7, 0x25AA },
- { 0x0AE1, 0x25AB },
- { 0x0ADB, 0x25AC },
- { 0x0AE2, 0x25AD },
- { 0x0AE8, 0x25B2 },
- { 0x0AE3, 0x25B3 },
- { 0x0ADD, 0x25B6 },
- { 0x0ACD, 0x25B7 },
- { 0x0AE9, 0x25BC },
- { 0x0AE4, 0x25BD },
- { 0x0ADC, 0x25C0 },
- { 0x0ACC, 0x25C1 },
- { 0x09E0, 0x25C6 },
- { 0x0ACE, 0x25CB },
- { 0x0BCF, 0x25CB },
- { 0x0ADE, 0x25CF },
- { 0x0AE0, 0x25E6 },
- { 0x0AE5, 0x2606 },
- { 0x0AF9, 0x260E },
- { 0x0ACA, 0x2613 },
- { 0x0AEA, 0x261C },
- { 0x0AEB, 0x261E },
- { 0x0AF8, 0x2640 },
- { 0x0AF7, 0x2642 },
- { 0x0AEC, 0x2663 },
- { 0x0AEE, 0x2665 },
- { 0x0AED, 0x2666 },
- { 0x0AF6, 0x266D },
- { 0x0AF5, 0x266F },
- { 0x0AF3, 0x2713 },
- { 0x0AF4, 0x2717 },
- { 0x0AD9, 0x271D },
- { 0x0AF0, 0x2720 },
- { 0x04A4, 0x3001 },
- { 0x04A1, 0x3002 },
- { 0x04A2, 0x300C },
- { 0x04A3, 0x300D },
- { 0x04DE, 0x309B },
- { 0x04DF, 0x309C },
- { 0x04A7, 0x30A1 },
- { 0x04B1, 0x30A2 },
- { 0x04A8, 0x30A3 },
- { 0x04B2, 0x30A4 },
- { 0x04A9, 0x30A5 },
- { 0x04B3, 0x30A6 },
- { 0x04AA, 0x30A7 },
- { 0x04B4, 0x30A8 },
- { 0x04AB, 0x30A9 },
- { 0x04B5, 0x30AA },
- { 0x04B6, 0x30AB },
- { 0x04B7, 0x30AD },
- { 0x04B8, 0x30AF },
- { 0x04B9, 0x30B1 },
- { 0x04BA, 0x30B3 },
- { 0x04BB, 0x30B5 },
- { 0x04BC, 0x30B7 },
- { 0x04BD, 0x30B9 },
- { 0x04BE, 0x30BB },
- { 0x04BF, 0x30BD },
- { 0x04C0, 0x30BF },
- { 0x04C1, 0x30C1 },
- { 0x04AF, 0x30C3 },
- { 0x04C2, 0x30C4 },
- { 0x04C3, 0x30C6 },
- { 0x04C4, 0x30C8 },
- { 0x04C5, 0x30CA },
- { 0x04C6, 0x30CB },
- { 0x04C7, 0x30CC },
- { 0x04C8, 0x30CD },
- { 0x04C9, 0x30CE },
- { 0x04CA, 0x30CF },
- { 0x04CB, 0x30D2 },
- { 0x04CC, 0x30D5 },
- { 0x04CD, 0x30D8 },
- { 0x04CE, 0x30DB },
- { 0x04CF, 0x30DE },
- { 0x04D0, 0x30DF },
- { 0x04D1, 0x30E0 },
- { 0x04D2, 0x30E1 },
- { 0x04D3, 0x30E2 },
- { 0x04AC, 0x30E3 },
- { 0x04D4, 0x30E4 },
- { 0x04AD, 0x30E5 },
- { 0x04D5, 0x30E6 },
- { 0x04AE, 0x30E7 },
- { 0x04D6, 0x30E8 },
- { 0x04D7, 0x30E9 },
- { 0x04D8, 0x30EA },
- { 0x04D9, 0x30EB },
- { 0x04DA, 0x30EC },
- { 0x04DB, 0x30ED },
- { 0x04DC, 0x30EF },
- { 0x04A6, 0x30F2 },
- { 0x04DD, 0x30F3 },
- { 0x04A5, 0x30FB },
- { 0x04B0, 0x30FC },
- { 0x0EA1, 0x3131 },
- { 0x0EA2, 0x3132 },
- { 0x0EA3, 0x3133 },
- { 0x0EA4, 0x3134 },
- { 0x0EA5, 0x3135 },
- { 0x0EA6, 0x3136 },
- { 0x0EA7, 0x3137 },
- { 0x0EA8, 0x3138 },
- { 0x0EA9, 0x3139 },
- { 0x0EAA, 0x313A },
- { 0x0EAB, 0x313B },
- { 0x0EAC, 0x313C },
- { 0x0EAD, 0x313D },
- { 0x0EAE, 0x313E },
- { 0x0EAF, 0x313F },
- { 0x0EB0, 0x3140 },
- { 0x0EB1, 0x3141 },
- { 0x0EB2, 0x3142 },
- { 0x0EB3, 0x3143 },
- { 0x0EB4, 0x3144 },
- { 0x0EB5, 0x3145 },
- { 0x0EB6, 0x3146 },
- { 0x0EB7, 0x3147 },
- { 0x0EB8, 0x3148 },
- { 0x0EB9, 0x3149 },
- { 0x0EBA, 0x314A },
- { 0x0EBB, 0x314B },
- { 0x0EBC, 0x314C },
- { 0x0EBD, 0x314D },
- { 0x0EBE, 0x314E },
- { 0x0EBF, 0x314F },
- { 0x0EC0, 0x3150 },
- { 0x0EC1, 0x3151 },
- { 0x0EC2, 0x3152 },
- { 0x0EC3, 0x3153 },
- { 0x0EC4, 0x3154 },
- { 0x0EC5, 0x3155 },
- { 0x0EC6, 0x3156 },
- { 0x0EC7, 0x3157 },
- { 0x0EC8, 0x3158 },
- { 0x0EC9, 0x3159 },
- { 0x0ECA, 0x315A },
- { 0x0ECB, 0x315B },
- { 0x0ECC, 0x315C },
- { 0x0ECD, 0x315D },
- { 0x0ECE, 0x315E },
- { 0x0ECF, 0x315F },
- { 0x0ED0, 0x3160 },
- { 0x0ED1, 0x3161 },
- { 0x0ED2, 0x3162 },
- { 0x0ED3, 0x3163 },
- { 0x0EEF, 0x316D },
- { 0x0EF0, 0x3171 },
- { 0x0EF1, 0x3178 },
- { 0x0EF2, 0x317F },
- { 0x0EF4, 0x3184 },
- { 0x0EF5, 0x3186 },
- { 0x0EF6, 0x318D },
- { 0x0EF7, 0x318E }
-};
-
-KeySym KeyMappingX11::get_keysym_from_unicode(unsigned int p_unicode) {
- /* Latin 1 */
-
- if (p_unicode >= 0x20 && p_unicode <= 0x7e) {
- return p_unicode;
+ // Unicode (may be present).
+ if ((p_keysym & 0xFF000000) == 0x01000000) {
+ return p_keysym & 0x00FFFFFF;
}
- if (p_unicode >= 0xa0 && p_unicode <= 0xff) {
- return p_unicode;
+ const char32_t *c = xkeysym_unicode_map.getptr(p_keysym);
+ if (c) {
+ return *c;
}
-
- int middle, low = 0, high = _UNICODE_MAX - 1;
- do {
- middle = (high + low) / 2;
- if (_unicode_to_xkeysym[middle].keysym == p_unicode) {
- return _unicode_to_xkeysym[middle].keysym;
- }
- if (_unicode_to_xkeysym[middle].keysym <= p_unicode) {
- low = middle + 1;
- } else {
- high = middle - 1;
- }
- } while (high >= low);
-
- // if not found, let's hope X understands it as unicode
- return p_unicode | 0x01000000;
+ return 0;
}
diff --git a/platform/linuxbsd/x11/key_mapping_x11.h b/platform/linuxbsd/x11/key_mapping_x11.h
index 2b411e21d2..48beefff4c 100644
--- a/platform/linuxbsd/x11/key_mapping_x11.h
+++ b/platform/linuxbsd/x11/key_mapping_x11.h
@@ -39,17 +39,30 @@
#include <X11/keysymdef.h>
#include "core/os/keyboard.h"
+#include "core/templates/hash_map.h"
class KeyMappingX11 {
+ struct HashMapHasherKeys {
+ static _FORCE_INLINE_ uint32_t hash(const Key p_key) { return hash_fmix32(static_cast<uint32_t>(p_key)); }
+ static _FORCE_INLINE_ uint32_t hash(const char32_t p_uchar) { return hash_fmix32(p_uchar); }
+ static _FORCE_INLINE_ uint32_t hash(const unsigned p_key) { return hash_fmix32(p_key); }
+ static _FORCE_INLINE_ uint32_t hash(const KeySym p_key) { return hash_fmix32(p_key); }
+ };
+
+ static inline HashMap<KeySym, Key, HashMapHasherKeys> xkeysym_map;
+ static inline HashMap<unsigned int, Key, HashMapHasherKeys> scancode_map;
+ static inline HashMap<Key, unsigned int, HashMapHasherKeys> scancode_map_inv;
+ static inline HashMap<KeySym, char32_t, HashMapHasherKeys> xkeysym_unicode_map;
+
KeyMappingX11() {}
public:
+ static void initialize();
+
static Key get_keycode(KeySym p_keysym);
static unsigned int get_xlibcode(Key p_keysym);
static Key get_scancode(unsigned int p_code);
- static KeySym get_keysym(Key p_code);
- static unsigned int get_unicode_from_keysym(KeySym p_keysym);
- static KeySym get_keysym_from_unicode(unsigned int p_unicode);
+ static char32_t get_unicode_from_keysym(KeySym p_keysym);
};
#endif // KEY_MAPPING_X11_H
diff --git a/platform/linuxbsd/xkbcommon-so_wrap.c b/platform/linuxbsd/xkbcommon-so_wrap.c
new file mode 100644
index 0000000000..3382e2e553
--- /dev/null
+++ b/platform/linuxbsd/xkbcommon-so_wrap.c
@@ -0,0 +1,1015 @@
+// This file is generated. Do not edit!
+// see https://github.com/hpvb/dynload-wrapper for details
+// generated by generate-wrapper.py 0.3 on 2023-01-30 10:40:26
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon.h --include ./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-compose.h --include ./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-keysyms.h --sys-include "./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon.h" --sys-include "./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-compose.h" --sys-include "./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-keysyms.h" --soname libxkbcommon.so.0 --init-name xkbcommon --output-header ./platform/linuxbsd/xkbcommon-so_wrap.h --output-implementation ./platform/linuxbsd/xkbcommon-so_wrap.c
+//
+#include <stdint.h>
+
+#define xkb_keysym_get_name xkb_keysym_get_name_dylibloader_orig_xkbcommon
+#define xkb_keysym_from_name xkb_keysym_from_name_dylibloader_orig_xkbcommon
+#define xkb_keysym_to_utf8 xkb_keysym_to_utf8_dylibloader_orig_xkbcommon
+#define xkb_keysym_to_utf32 xkb_keysym_to_utf32_dylibloader_orig_xkbcommon
+#define xkb_utf32_to_keysym xkb_utf32_to_keysym_dylibloader_orig_xkbcommon
+#define xkb_keysym_to_upper xkb_keysym_to_upper_dylibloader_orig_xkbcommon
+#define xkb_keysym_to_lower xkb_keysym_to_lower_dylibloader_orig_xkbcommon
+#define xkb_context_new xkb_context_new_dylibloader_orig_xkbcommon
+#define xkb_context_ref xkb_context_ref_dylibloader_orig_xkbcommon
+#define xkb_context_unref xkb_context_unref_dylibloader_orig_xkbcommon
+#define xkb_context_set_user_data xkb_context_set_user_data_dylibloader_orig_xkbcommon
+#define xkb_context_get_user_data xkb_context_get_user_data_dylibloader_orig_xkbcommon
+#define xkb_context_include_path_append xkb_context_include_path_append_dylibloader_orig_xkbcommon
+#define xkb_context_include_path_append_default xkb_context_include_path_append_default_dylibloader_orig_xkbcommon
+#define xkb_context_include_path_reset_defaults xkb_context_include_path_reset_defaults_dylibloader_orig_xkbcommon
+#define xkb_context_include_path_clear xkb_context_include_path_clear_dylibloader_orig_xkbcommon
+#define xkb_context_num_include_paths xkb_context_num_include_paths_dylibloader_orig_xkbcommon
+#define xkb_context_include_path_get xkb_context_include_path_get_dylibloader_orig_xkbcommon
+#define xkb_context_set_log_level xkb_context_set_log_level_dylibloader_orig_xkbcommon
+#define xkb_context_get_log_level xkb_context_get_log_level_dylibloader_orig_xkbcommon
+#define xkb_context_set_log_verbosity xkb_context_set_log_verbosity_dylibloader_orig_xkbcommon
+#define xkb_context_get_log_verbosity xkb_context_get_log_verbosity_dylibloader_orig_xkbcommon
+#define xkb_context_set_log_fn xkb_context_set_log_fn_dylibloader_orig_xkbcommon
+#define xkb_keymap_new_from_names xkb_keymap_new_from_names_dylibloader_orig_xkbcommon
+#define xkb_keymap_new_from_file xkb_keymap_new_from_file_dylibloader_orig_xkbcommon
+#define xkb_keymap_new_from_string xkb_keymap_new_from_string_dylibloader_orig_xkbcommon
+#define xkb_keymap_new_from_buffer xkb_keymap_new_from_buffer_dylibloader_orig_xkbcommon
+#define xkb_keymap_ref xkb_keymap_ref_dylibloader_orig_xkbcommon
+#define xkb_keymap_unref xkb_keymap_unref_dylibloader_orig_xkbcommon
+#define xkb_keymap_get_as_string xkb_keymap_get_as_string_dylibloader_orig_xkbcommon
+#define xkb_keymap_min_keycode xkb_keymap_min_keycode_dylibloader_orig_xkbcommon
+#define xkb_keymap_max_keycode xkb_keymap_max_keycode_dylibloader_orig_xkbcommon
+#define xkb_keymap_key_for_each xkb_keymap_key_for_each_dylibloader_orig_xkbcommon
+#define xkb_keymap_key_get_name xkb_keymap_key_get_name_dylibloader_orig_xkbcommon
+#define xkb_keymap_key_by_name xkb_keymap_key_by_name_dylibloader_orig_xkbcommon
+#define xkb_keymap_num_mods xkb_keymap_num_mods_dylibloader_orig_xkbcommon
+#define xkb_keymap_mod_get_name xkb_keymap_mod_get_name_dylibloader_orig_xkbcommon
+#define xkb_keymap_mod_get_index xkb_keymap_mod_get_index_dylibloader_orig_xkbcommon
+#define xkb_keymap_num_layouts xkb_keymap_num_layouts_dylibloader_orig_xkbcommon
+#define xkb_keymap_layout_get_name xkb_keymap_layout_get_name_dylibloader_orig_xkbcommon
+#define xkb_keymap_layout_get_index xkb_keymap_layout_get_index_dylibloader_orig_xkbcommon
+#define xkb_keymap_num_leds xkb_keymap_num_leds_dylibloader_orig_xkbcommon
+#define xkb_keymap_led_get_name xkb_keymap_led_get_name_dylibloader_orig_xkbcommon
+#define xkb_keymap_led_get_index xkb_keymap_led_get_index_dylibloader_orig_xkbcommon
+#define xkb_keymap_num_layouts_for_key xkb_keymap_num_layouts_for_key_dylibloader_orig_xkbcommon
+#define xkb_keymap_num_levels_for_key xkb_keymap_num_levels_for_key_dylibloader_orig_xkbcommon
+#define xkb_keymap_key_get_mods_for_level xkb_keymap_key_get_mods_for_level_dylibloader_orig_xkbcommon
+#define xkb_keymap_key_get_syms_by_level xkb_keymap_key_get_syms_by_level_dylibloader_orig_xkbcommon
+#define xkb_keymap_key_repeats xkb_keymap_key_repeats_dylibloader_orig_xkbcommon
+#define xkb_state_new xkb_state_new_dylibloader_orig_xkbcommon
+#define xkb_state_ref xkb_state_ref_dylibloader_orig_xkbcommon
+#define xkb_state_unref xkb_state_unref_dylibloader_orig_xkbcommon
+#define xkb_state_get_keymap xkb_state_get_keymap_dylibloader_orig_xkbcommon
+#define xkb_state_update_key xkb_state_update_key_dylibloader_orig_xkbcommon
+#define xkb_state_update_mask xkb_state_update_mask_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_syms xkb_state_key_get_syms_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_utf8 xkb_state_key_get_utf8_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_utf32 xkb_state_key_get_utf32_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_one_sym xkb_state_key_get_one_sym_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_layout xkb_state_key_get_layout_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_level xkb_state_key_get_level_dylibloader_orig_xkbcommon
+#define xkb_state_serialize_mods xkb_state_serialize_mods_dylibloader_orig_xkbcommon
+#define xkb_state_serialize_layout xkb_state_serialize_layout_dylibloader_orig_xkbcommon
+#define xkb_state_mod_name_is_active xkb_state_mod_name_is_active_dylibloader_orig_xkbcommon
+#define xkb_state_mod_names_are_active xkb_state_mod_names_are_active_dylibloader_orig_xkbcommon
+#define xkb_state_mod_index_is_active xkb_state_mod_index_is_active_dylibloader_orig_xkbcommon
+#define xkb_state_mod_indices_are_active xkb_state_mod_indices_are_active_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_consumed_mods2 xkb_state_key_get_consumed_mods2_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_consumed_mods xkb_state_key_get_consumed_mods_dylibloader_orig_xkbcommon
+#define xkb_state_mod_index_is_consumed2 xkb_state_mod_index_is_consumed2_dylibloader_orig_xkbcommon
+#define xkb_state_mod_index_is_consumed xkb_state_mod_index_is_consumed_dylibloader_orig_xkbcommon
+#define xkb_state_mod_mask_remove_consumed xkb_state_mod_mask_remove_consumed_dylibloader_orig_xkbcommon
+#define xkb_state_layout_name_is_active xkb_state_layout_name_is_active_dylibloader_orig_xkbcommon
+#define xkb_state_layout_index_is_active xkb_state_layout_index_is_active_dylibloader_orig_xkbcommon
+#define xkb_state_led_name_is_active xkb_state_led_name_is_active_dylibloader_orig_xkbcommon
+#define xkb_state_led_index_is_active xkb_state_led_index_is_active_dylibloader_orig_xkbcommon
+#define xkb_compose_table_new_from_locale xkb_compose_table_new_from_locale_dylibloader_orig_xkbcommon
+#define xkb_compose_table_new_from_file xkb_compose_table_new_from_file_dylibloader_orig_xkbcommon
+#define xkb_compose_table_new_from_buffer xkb_compose_table_new_from_buffer_dylibloader_orig_xkbcommon
+#define xkb_compose_table_ref xkb_compose_table_ref_dylibloader_orig_xkbcommon
+#define xkb_compose_table_unref xkb_compose_table_unref_dylibloader_orig_xkbcommon
+#define xkb_compose_state_new xkb_compose_state_new_dylibloader_orig_xkbcommon
+#define xkb_compose_state_ref xkb_compose_state_ref_dylibloader_orig_xkbcommon
+#define xkb_compose_state_unref xkb_compose_state_unref_dylibloader_orig_xkbcommon
+#define xkb_compose_state_get_compose_table xkb_compose_state_get_compose_table_dylibloader_orig_xkbcommon
+#define xkb_compose_state_feed xkb_compose_state_feed_dylibloader_orig_xkbcommon
+#define xkb_compose_state_reset xkb_compose_state_reset_dylibloader_orig_xkbcommon
+#define xkb_compose_state_get_status xkb_compose_state_get_status_dylibloader_orig_xkbcommon
+#define xkb_compose_state_get_utf8 xkb_compose_state_get_utf8_dylibloader_orig_xkbcommon
+#define xkb_compose_state_get_one_sym xkb_compose_state_get_one_sym_dylibloader_orig_xkbcommon
+#include "./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon.h"
+#include "./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-compose.h"
+#include "./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-keysyms.h"
+#undef xkb_keysym_get_name
+#undef xkb_keysym_from_name
+#undef xkb_keysym_to_utf8
+#undef xkb_keysym_to_utf32
+#undef xkb_utf32_to_keysym
+#undef xkb_keysym_to_upper
+#undef xkb_keysym_to_lower
+#undef xkb_context_new
+#undef xkb_context_ref
+#undef xkb_context_unref
+#undef xkb_context_set_user_data
+#undef xkb_context_get_user_data
+#undef xkb_context_include_path_append
+#undef xkb_context_include_path_append_default
+#undef xkb_context_include_path_reset_defaults
+#undef xkb_context_include_path_clear
+#undef xkb_context_num_include_paths
+#undef xkb_context_include_path_get
+#undef xkb_context_set_log_level
+#undef xkb_context_get_log_level
+#undef xkb_context_set_log_verbosity
+#undef xkb_context_get_log_verbosity
+#undef xkb_context_set_log_fn
+#undef xkb_keymap_new_from_names
+#undef xkb_keymap_new_from_file
+#undef xkb_keymap_new_from_string
+#undef xkb_keymap_new_from_buffer
+#undef xkb_keymap_ref
+#undef xkb_keymap_unref
+#undef xkb_keymap_get_as_string
+#undef xkb_keymap_min_keycode
+#undef xkb_keymap_max_keycode
+#undef xkb_keymap_key_for_each
+#undef xkb_keymap_key_get_name
+#undef xkb_keymap_key_by_name
+#undef xkb_keymap_num_mods
+#undef xkb_keymap_mod_get_name
+#undef xkb_keymap_mod_get_index
+#undef xkb_keymap_num_layouts
+#undef xkb_keymap_layout_get_name
+#undef xkb_keymap_layout_get_index
+#undef xkb_keymap_num_leds
+#undef xkb_keymap_led_get_name
+#undef xkb_keymap_led_get_index
+#undef xkb_keymap_num_layouts_for_key
+#undef xkb_keymap_num_levels_for_key
+#undef xkb_keymap_key_get_mods_for_level
+#undef xkb_keymap_key_get_syms_by_level
+#undef xkb_keymap_key_repeats
+#undef xkb_state_new
+#undef xkb_state_ref
+#undef xkb_state_unref
+#undef xkb_state_get_keymap
+#undef xkb_state_update_key
+#undef xkb_state_update_mask
+#undef xkb_state_key_get_syms
+#undef xkb_state_key_get_utf8
+#undef xkb_state_key_get_utf32
+#undef xkb_state_key_get_one_sym
+#undef xkb_state_key_get_layout
+#undef xkb_state_key_get_level
+#undef xkb_state_serialize_mods
+#undef xkb_state_serialize_layout
+#undef xkb_state_mod_name_is_active
+#undef xkb_state_mod_names_are_active
+#undef xkb_state_mod_index_is_active
+#undef xkb_state_mod_indices_are_active
+#undef xkb_state_key_get_consumed_mods2
+#undef xkb_state_key_get_consumed_mods
+#undef xkb_state_mod_index_is_consumed2
+#undef xkb_state_mod_index_is_consumed
+#undef xkb_state_mod_mask_remove_consumed
+#undef xkb_state_layout_name_is_active
+#undef xkb_state_layout_index_is_active
+#undef xkb_state_led_name_is_active
+#undef xkb_state_led_index_is_active
+#undef xkb_compose_table_new_from_locale
+#undef xkb_compose_table_new_from_file
+#undef xkb_compose_table_new_from_buffer
+#undef xkb_compose_table_ref
+#undef xkb_compose_table_unref
+#undef xkb_compose_state_new
+#undef xkb_compose_state_ref
+#undef xkb_compose_state_unref
+#undef xkb_compose_state_get_compose_table
+#undef xkb_compose_state_feed
+#undef xkb_compose_state_reset
+#undef xkb_compose_state_get_status
+#undef xkb_compose_state_get_utf8
+#undef xkb_compose_state_get_one_sym
+#include <dlfcn.h>
+#include <stdio.h>
+int (*xkb_keysym_get_name_dylibloader_wrapper_xkbcommon)( xkb_keysym_t, char*, size_t);
+xkb_keysym_t (*xkb_keysym_from_name_dylibloader_wrapper_xkbcommon)(const char*,enum xkb_keysym_flags);
+int (*xkb_keysym_to_utf8_dylibloader_wrapper_xkbcommon)( xkb_keysym_t, char*, size_t);
+uint32_t (*xkb_keysym_to_utf32_dylibloader_wrapper_xkbcommon)( xkb_keysym_t);
+xkb_keysym_t (*xkb_utf32_to_keysym_dylibloader_wrapper_xkbcommon)( uint32_t);
+xkb_keysym_t (*xkb_keysym_to_upper_dylibloader_wrapper_xkbcommon)( xkb_keysym_t);
+xkb_keysym_t (*xkb_keysym_to_lower_dylibloader_wrapper_xkbcommon)( xkb_keysym_t);
+struct xkb_context* (*xkb_context_new_dylibloader_wrapper_xkbcommon)(enum xkb_context_flags);
+struct xkb_context* (*xkb_context_ref_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+void (*xkb_context_unref_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+void (*xkb_context_set_user_data_dylibloader_wrapper_xkbcommon)(struct xkb_context*, void*);
+void* (*xkb_context_get_user_data_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+int (*xkb_context_include_path_append_dylibloader_wrapper_xkbcommon)(struct xkb_context*,const char*);
+int (*xkb_context_include_path_append_default_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+int (*xkb_context_include_path_reset_defaults_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+void (*xkb_context_include_path_clear_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+unsigned int (*xkb_context_num_include_paths_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+const char* (*xkb_context_include_path_get_dylibloader_wrapper_xkbcommon)(struct xkb_context*, unsigned int);
+void (*xkb_context_set_log_level_dylibloader_wrapper_xkbcommon)(struct xkb_context*,enum xkb_log_level);
+enum xkb_log_level (*xkb_context_get_log_level_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+void (*xkb_context_set_log_verbosity_dylibloader_wrapper_xkbcommon)(struct xkb_context*, int);
+int (*xkb_context_get_log_verbosity_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+void (*xkb_context_set_log_fn_dylibloader_wrapper_xkbcommon)(struct xkb_context*, void*);
+struct xkb_keymap* (*xkb_keymap_new_from_names_dylibloader_wrapper_xkbcommon)(struct xkb_context*,struct xkb_rule_names*,enum xkb_keymap_compile_flags);
+struct xkb_keymap* (*xkb_keymap_new_from_file_dylibloader_wrapper_xkbcommon)(struct xkb_context*, FILE*,enum xkb_keymap_format,enum xkb_keymap_compile_flags);
+struct xkb_keymap* (*xkb_keymap_new_from_string_dylibloader_wrapper_xkbcommon)(struct xkb_context*,const char*,enum xkb_keymap_format,enum xkb_keymap_compile_flags);
+struct xkb_keymap* (*xkb_keymap_new_from_buffer_dylibloader_wrapper_xkbcommon)(struct xkb_context*,const char*, size_t,enum xkb_keymap_format,enum xkb_keymap_compile_flags);
+struct xkb_keymap* (*xkb_keymap_ref_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+void (*xkb_keymap_unref_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+char* (*xkb_keymap_get_as_string_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*,enum xkb_keymap_format);
+xkb_keycode_t (*xkb_keymap_min_keycode_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+xkb_keycode_t (*xkb_keymap_max_keycode_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+void (*xkb_keymap_key_for_each_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_keymap_key_iter_t, void*);
+const char* (*xkb_keymap_key_get_name_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_keycode_t);
+xkb_keycode_t (*xkb_keymap_key_by_name_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*,const char*);
+xkb_mod_index_t (*xkb_keymap_num_mods_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+const char* (*xkb_keymap_mod_get_name_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_mod_index_t);
+xkb_mod_index_t (*xkb_keymap_mod_get_index_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*,const char*);
+xkb_layout_index_t (*xkb_keymap_num_layouts_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+const char* (*xkb_keymap_layout_get_name_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_layout_index_t);
+xkb_layout_index_t (*xkb_keymap_layout_get_index_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*,const char*);
+xkb_led_index_t (*xkb_keymap_num_leds_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+const char* (*xkb_keymap_led_get_name_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_led_index_t);
+xkb_led_index_t (*xkb_keymap_led_get_index_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*,const char*);
+xkb_layout_index_t (*xkb_keymap_num_layouts_for_key_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_keycode_t);
+xkb_level_index_t (*xkb_keymap_num_levels_for_key_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_keycode_t, xkb_layout_index_t);
+size_t (*xkb_keymap_key_get_mods_for_level_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_keycode_t, xkb_layout_index_t, xkb_level_index_t, xkb_mod_mask_t*, size_t);
+int (*xkb_keymap_key_get_syms_by_level_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_keycode_t, xkb_layout_index_t, xkb_level_index_t,const xkb_keysym_t**);
+int (*xkb_keymap_key_repeats_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_keycode_t);
+struct xkb_state* (*xkb_state_new_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+struct xkb_state* (*xkb_state_ref_dylibloader_wrapper_xkbcommon)(struct xkb_state*);
+void (*xkb_state_unref_dylibloader_wrapper_xkbcommon)(struct xkb_state*);
+struct xkb_keymap* (*xkb_state_get_keymap_dylibloader_wrapper_xkbcommon)(struct xkb_state*);
+enum xkb_state_component (*xkb_state_update_key_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t,enum xkb_key_direction);
+enum xkb_state_component (*xkb_state_update_mask_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t);
+int (*xkb_state_key_get_syms_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t,const xkb_keysym_t**);
+int (*xkb_state_key_get_utf8_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t, char*, size_t);
+uint32_t (*xkb_state_key_get_utf32_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t);
+xkb_keysym_t (*xkb_state_key_get_one_sym_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t);
+xkb_layout_index_t (*xkb_state_key_get_layout_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t);
+xkb_level_index_t (*xkb_state_key_get_level_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t, xkb_layout_index_t);
+xkb_mod_mask_t (*xkb_state_serialize_mods_dylibloader_wrapper_xkbcommon)(struct xkb_state*,enum xkb_state_component);
+xkb_layout_index_t (*xkb_state_serialize_layout_dylibloader_wrapper_xkbcommon)(struct xkb_state*,enum xkb_state_component);
+int (*xkb_state_mod_name_is_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*,const char*,enum xkb_state_component);
+int (*xkb_state_mod_names_are_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*,enum xkb_state_component,enum xkb_state_match,...);
+int (*xkb_state_mod_index_is_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_mod_index_t,enum xkb_state_component);
+int (*xkb_state_mod_indices_are_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*,enum xkb_state_component,enum xkb_state_match,...);
+xkb_mod_mask_t (*xkb_state_key_get_consumed_mods2_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t,enum xkb_consumed_mode);
+xkb_mod_mask_t (*xkb_state_key_get_consumed_mods_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t);
+int (*xkb_state_mod_index_is_consumed2_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t, xkb_mod_index_t,enum xkb_consumed_mode);
+int (*xkb_state_mod_index_is_consumed_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t, xkb_mod_index_t);
+xkb_mod_mask_t (*xkb_state_mod_mask_remove_consumed_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t, xkb_mod_mask_t);
+int (*xkb_state_layout_name_is_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*,const char*,enum xkb_state_component);
+int (*xkb_state_layout_index_is_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_layout_index_t,enum xkb_state_component);
+int (*xkb_state_led_name_is_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*,const char*);
+int (*xkb_state_led_index_is_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_led_index_t);
+struct xkb_compose_table* (*xkb_compose_table_new_from_locale_dylibloader_wrapper_xkbcommon)(struct xkb_context*,const char*,enum xkb_compose_compile_flags);
+struct xkb_compose_table* (*xkb_compose_table_new_from_file_dylibloader_wrapper_xkbcommon)(struct xkb_context*, FILE*,const char*,enum xkb_compose_format,enum xkb_compose_compile_flags);
+struct xkb_compose_table* (*xkb_compose_table_new_from_buffer_dylibloader_wrapper_xkbcommon)(struct xkb_context*,const char*, size_t,const char*,enum xkb_compose_format,enum xkb_compose_compile_flags);
+struct xkb_compose_table* (*xkb_compose_table_ref_dylibloader_wrapper_xkbcommon)(struct xkb_compose_table*);
+void (*xkb_compose_table_unref_dylibloader_wrapper_xkbcommon)(struct xkb_compose_table*);
+struct xkb_compose_state* (*xkb_compose_state_new_dylibloader_wrapper_xkbcommon)(struct xkb_compose_table*,enum xkb_compose_state_flags);
+struct xkb_compose_state* (*xkb_compose_state_ref_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*);
+void (*xkb_compose_state_unref_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*);
+struct xkb_compose_table* (*xkb_compose_state_get_compose_table_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*);
+enum xkb_compose_feed_result (*xkb_compose_state_feed_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*, xkb_keysym_t);
+void (*xkb_compose_state_reset_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*);
+enum xkb_compose_status (*xkb_compose_state_get_status_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*);
+int (*xkb_compose_state_get_utf8_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*, char*, size_t);
+xkb_keysym_t (*xkb_compose_state_get_one_sym_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*);
+int initialize_xkbcommon(int verbose) {
+ void *handle;
+ char *error;
+ handle = dlopen("libxkbcommon.so.0", RTLD_LAZY);
+ if (!handle) {
+ if (verbose) {
+ fprintf(stderr, "%s\n", dlerror());
+ }
+ return(1);
+ }
+ dlerror();
+// xkb_keysym_get_name
+ *(void **) (&xkb_keysym_get_name_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keysym_get_name");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keysym_from_name
+ *(void **) (&xkb_keysym_from_name_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keysym_from_name");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keysym_to_utf8
+ *(void **) (&xkb_keysym_to_utf8_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keysym_to_utf8");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keysym_to_utf32
+ *(void **) (&xkb_keysym_to_utf32_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keysym_to_utf32");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_utf32_to_keysym
+ *(void **) (&xkb_utf32_to_keysym_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_utf32_to_keysym");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keysym_to_upper
+ *(void **) (&xkb_keysym_to_upper_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keysym_to_upper");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keysym_to_lower
+ *(void **) (&xkb_keysym_to_lower_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keysym_to_lower");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_new
+ *(void **) (&xkb_context_new_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_new");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_ref
+ *(void **) (&xkb_context_ref_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_ref");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_unref
+ *(void **) (&xkb_context_unref_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_unref");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_set_user_data
+ *(void **) (&xkb_context_set_user_data_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_set_user_data");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_get_user_data
+ *(void **) (&xkb_context_get_user_data_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_get_user_data");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_include_path_append
+ *(void **) (&xkb_context_include_path_append_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_include_path_append");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_include_path_append_default
+ *(void **) (&xkb_context_include_path_append_default_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_include_path_append_default");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_include_path_reset_defaults
+ *(void **) (&xkb_context_include_path_reset_defaults_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_include_path_reset_defaults");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_include_path_clear
+ *(void **) (&xkb_context_include_path_clear_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_include_path_clear");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_num_include_paths
+ *(void **) (&xkb_context_num_include_paths_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_num_include_paths");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_include_path_get
+ *(void **) (&xkb_context_include_path_get_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_include_path_get");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_set_log_level
+ *(void **) (&xkb_context_set_log_level_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_set_log_level");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_get_log_level
+ *(void **) (&xkb_context_get_log_level_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_get_log_level");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_set_log_verbosity
+ *(void **) (&xkb_context_set_log_verbosity_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_set_log_verbosity");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_get_log_verbosity
+ *(void **) (&xkb_context_get_log_verbosity_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_get_log_verbosity");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_context_set_log_fn
+ *(void **) (&xkb_context_set_log_fn_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_context_set_log_fn");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_new_from_names
+ *(void **) (&xkb_keymap_new_from_names_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_new_from_names");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_new_from_file
+ *(void **) (&xkb_keymap_new_from_file_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_new_from_file");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_new_from_string
+ *(void **) (&xkb_keymap_new_from_string_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_new_from_string");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_new_from_buffer
+ *(void **) (&xkb_keymap_new_from_buffer_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_new_from_buffer");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_ref
+ *(void **) (&xkb_keymap_ref_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_ref");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_unref
+ *(void **) (&xkb_keymap_unref_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_unref");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_get_as_string
+ *(void **) (&xkb_keymap_get_as_string_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_get_as_string");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_min_keycode
+ *(void **) (&xkb_keymap_min_keycode_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_min_keycode");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_max_keycode
+ *(void **) (&xkb_keymap_max_keycode_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_max_keycode");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_key_for_each
+ *(void **) (&xkb_keymap_key_for_each_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_key_for_each");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_key_get_name
+ *(void **) (&xkb_keymap_key_get_name_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_key_get_name");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_key_by_name
+ *(void **) (&xkb_keymap_key_by_name_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_key_by_name");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_num_mods
+ *(void **) (&xkb_keymap_num_mods_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_num_mods");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_mod_get_name
+ *(void **) (&xkb_keymap_mod_get_name_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_mod_get_name");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_mod_get_index
+ *(void **) (&xkb_keymap_mod_get_index_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_mod_get_index");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_num_layouts
+ *(void **) (&xkb_keymap_num_layouts_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_num_layouts");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_layout_get_name
+ *(void **) (&xkb_keymap_layout_get_name_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_layout_get_name");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_layout_get_index
+ *(void **) (&xkb_keymap_layout_get_index_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_layout_get_index");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_num_leds
+ *(void **) (&xkb_keymap_num_leds_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_num_leds");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_led_get_name
+ *(void **) (&xkb_keymap_led_get_name_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_led_get_name");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_led_get_index
+ *(void **) (&xkb_keymap_led_get_index_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_led_get_index");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_num_layouts_for_key
+ *(void **) (&xkb_keymap_num_layouts_for_key_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_num_layouts_for_key");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_num_levels_for_key
+ *(void **) (&xkb_keymap_num_levels_for_key_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_num_levels_for_key");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_key_get_mods_for_level
+ *(void **) (&xkb_keymap_key_get_mods_for_level_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_key_get_mods_for_level");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_key_get_syms_by_level
+ *(void **) (&xkb_keymap_key_get_syms_by_level_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_key_get_syms_by_level");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_keymap_key_repeats
+ *(void **) (&xkb_keymap_key_repeats_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_keymap_key_repeats");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_new
+ *(void **) (&xkb_state_new_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_new");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_ref
+ *(void **) (&xkb_state_ref_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_ref");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_unref
+ *(void **) (&xkb_state_unref_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_unref");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_get_keymap
+ *(void **) (&xkb_state_get_keymap_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_get_keymap");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_update_key
+ *(void **) (&xkb_state_update_key_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_update_key");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_update_mask
+ *(void **) (&xkb_state_update_mask_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_update_mask");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_key_get_syms
+ *(void **) (&xkb_state_key_get_syms_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_key_get_syms");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_key_get_utf8
+ *(void **) (&xkb_state_key_get_utf8_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_key_get_utf8");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_key_get_utf32
+ *(void **) (&xkb_state_key_get_utf32_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_key_get_utf32");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_key_get_one_sym
+ *(void **) (&xkb_state_key_get_one_sym_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_key_get_one_sym");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_key_get_layout
+ *(void **) (&xkb_state_key_get_layout_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_key_get_layout");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_key_get_level
+ *(void **) (&xkb_state_key_get_level_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_key_get_level");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_serialize_mods
+ *(void **) (&xkb_state_serialize_mods_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_serialize_mods");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_serialize_layout
+ *(void **) (&xkb_state_serialize_layout_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_serialize_layout");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_mod_name_is_active
+ *(void **) (&xkb_state_mod_name_is_active_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_mod_name_is_active");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_mod_names_are_active
+ *(void **) (&xkb_state_mod_names_are_active_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_mod_names_are_active");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_mod_index_is_active
+ *(void **) (&xkb_state_mod_index_is_active_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_mod_index_is_active");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_mod_indices_are_active
+ *(void **) (&xkb_state_mod_indices_are_active_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_mod_indices_are_active");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_key_get_consumed_mods2
+ *(void **) (&xkb_state_key_get_consumed_mods2_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_key_get_consumed_mods2");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_key_get_consumed_mods
+ *(void **) (&xkb_state_key_get_consumed_mods_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_key_get_consumed_mods");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_mod_index_is_consumed2
+ *(void **) (&xkb_state_mod_index_is_consumed2_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_mod_index_is_consumed2");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_mod_index_is_consumed
+ *(void **) (&xkb_state_mod_index_is_consumed_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_mod_index_is_consumed");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_mod_mask_remove_consumed
+ *(void **) (&xkb_state_mod_mask_remove_consumed_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_mod_mask_remove_consumed");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_layout_name_is_active
+ *(void **) (&xkb_state_layout_name_is_active_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_layout_name_is_active");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_layout_index_is_active
+ *(void **) (&xkb_state_layout_index_is_active_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_layout_index_is_active");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_led_name_is_active
+ *(void **) (&xkb_state_led_name_is_active_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_led_name_is_active");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_state_led_index_is_active
+ *(void **) (&xkb_state_led_index_is_active_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_state_led_index_is_active");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_compose_table_new_from_locale
+ *(void **) (&xkb_compose_table_new_from_locale_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_compose_table_new_from_locale");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_compose_table_new_from_file
+ *(void **) (&xkb_compose_table_new_from_file_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_compose_table_new_from_file");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_compose_table_new_from_buffer
+ *(void **) (&xkb_compose_table_new_from_buffer_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_compose_table_new_from_buffer");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_compose_table_ref
+ *(void **) (&xkb_compose_table_ref_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_compose_table_ref");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_compose_table_unref
+ *(void **) (&xkb_compose_table_unref_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_compose_table_unref");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_compose_state_new
+ *(void **) (&xkb_compose_state_new_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_compose_state_new");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_compose_state_ref
+ *(void **) (&xkb_compose_state_ref_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_compose_state_ref");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_compose_state_unref
+ *(void **) (&xkb_compose_state_unref_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_compose_state_unref");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_compose_state_get_compose_table
+ *(void **) (&xkb_compose_state_get_compose_table_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_compose_state_get_compose_table");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_compose_state_feed
+ *(void **) (&xkb_compose_state_feed_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_compose_state_feed");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_compose_state_reset
+ *(void **) (&xkb_compose_state_reset_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_compose_state_reset");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_compose_state_get_status
+ *(void **) (&xkb_compose_state_get_status_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_compose_state_get_status");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_compose_state_get_utf8
+ *(void **) (&xkb_compose_state_get_utf8_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_compose_state_get_utf8");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// xkb_compose_state_get_one_sym
+ *(void **) (&xkb_compose_state_get_one_sym_dylibloader_wrapper_xkbcommon) = dlsym(handle, "xkb_compose_state_get_one_sym");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+return 0;
+}
diff --git a/platform/linuxbsd/xkbcommon-so_wrap.h b/platform/linuxbsd/xkbcommon-so_wrap.h
new file mode 100644
index 0000000000..4ae69fdf1f
--- /dev/null
+++ b/platform/linuxbsd/xkbcommon-so_wrap.h
@@ -0,0 +1,380 @@
+#ifndef DYLIBLOAD_WRAPPER_XKBCOMMON
+#define DYLIBLOAD_WRAPPER_XKBCOMMON
+// This file is generated. Do not edit!
+// see https://github.com/hpvb/dynload-wrapper for details
+// generated by generate-wrapper.py 0.3 on 2023-01-30 10:40:26
+// flags: generate-wrapper.py --include ./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon.h --include ./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-compose.h --include ./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-keysyms.h --sys-include "./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon.h" --sys-include "./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-compose.h" --sys-include "./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-keysyms.h" --soname libxkbcommon.so.0 --init-name xkbcommon --output-header ./platform/linuxbsd/xkbcommon-so_wrap.h --output-implementation ./platform/linuxbsd/xkbcommon-so_wrap.c
+//
+#include <stdint.h>
+
+#define xkb_keysym_get_name xkb_keysym_get_name_dylibloader_orig_xkbcommon
+#define xkb_keysym_from_name xkb_keysym_from_name_dylibloader_orig_xkbcommon
+#define xkb_keysym_to_utf8 xkb_keysym_to_utf8_dylibloader_orig_xkbcommon
+#define xkb_keysym_to_utf32 xkb_keysym_to_utf32_dylibloader_orig_xkbcommon
+#define xkb_utf32_to_keysym xkb_utf32_to_keysym_dylibloader_orig_xkbcommon
+#define xkb_keysym_to_upper xkb_keysym_to_upper_dylibloader_orig_xkbcommon
+#define xkb_keysym_to_lower xkb_keysym_to_lower_dylibloader_orig_xkbcommon
+#define xkb_context_new xkb_context_new_dylibloader_orig_xkbcommon
+#define xkb_context_ref xkb_context_ref_dylibloader_orig_xkbcommon
+#define xkb_context_unref xkb_context_unref_dylibloader_orig_xkbcommon
+#define xkb_context_set_user_data xkb_context_set_user_data_dylibloader_orig_xkbcommon
+#define xkb_context_get_user_data xkb_context_get_user_data_dylibloader_orig_xkbcommon
+#define xkb_context_include_path_append xkb_context_include_path_append_dylibloader_orig_xkbcommon
+#define xkb_context_include_path_append_default xkb_context_include_path_append_default_dylibloader_orig_xkbcommon
+#define xkb_context_include_path_reset_defaults xkb_context_include_path_reset_defaults_dylibloader_orig_xkbcommon
+#define xkb_context_include_path_clear xkb_context_include_path_clear_dylibloader_orig_xkbcommon
+#define xkb_context_num_include_paths xkb_context_num_include_paths_dylibloader_orig_xkbcommon
+#define xkb_context_include_path_get xkb_context_include_path_get_dylibloader_orig_xkbcommon
+#define xkb_context_set_log_level xkb_context_set_log_level_dylibloader_orig_xkbcommon
+#define xkb_context_get_log_level xkb_context_get_log_level_dylibloader_orig_xkbcommon
+#define xkb_context_set_log_verbosity xkb_context_set_log_verbosity_dylibloader_orig_xkbcommon
+#define xkb_context_get_log_verbosity xkb_context_get_log_verbosity_dylibloader_orig_xkbcommon
+#define xkb_context_set_log_fn xkb_context_set_log_fn_dylibloader_orig_xkbcommon
+#define xkb_keymap_new_from_names xkb_keymap_new_from_names_dylibloader_orig_xkbcommon
+#define xkb_keymap_new_from_file xkb_keymap_new_from_file_dylibloader_orig_xkbcommon
+#define xkb_keymap_new_from_string xkb_keymap_new_from_string_dylibloader_orig_xkbcommon
+#define xkb_keymap_new_from_buffer xkb_keymap_new_from_buffer_dylibloader_orig_xkbcommon
+#define xkb_keymap_ref xkb_keymap_ref_dylibloader_orig_xkbcommon
+#define xkb_keymap_unref xkb_keymap_unref_dylibloader_orig_xkbcommon
+#define xkb_keymap_get_as_string xkb_keymap_get_as_string_dylibloader_orig_xkbcommon
+#define xkb_keymap_min_keycode xkb_keymap_min_keycode_dylibloader_orig_xkbcommon
+#define xkb_keymap_max_keycode xkb_keymap_max_keycode_dylibloader_orig_xkbcommon
+#define xkb_keymap_key_for_each xkb_keymap_key_for_each_dylibloader_orig_xkbcommon
+#define xkb_keymap_key_get_name xkb_keymap_key_get_name_dylibloader_orig_xkbcommon
+#define xkb_keymap_key_by_name xkb_keymap_key_by_name_dylibloader_orig_xkbcommon
+#define xkb_keymap_num_mods xkb_keymap_num_mods_dylibloader_orig_xkbcommon
+#define xkb_keymap_mod_get_name xkb_keymap_mod_get_name_dylibloader_orig_xkbcommon
+#define xkb_keymap_mod_get_index xkb_keymap_mod_get_index_dylibloader_orig_xkbcommon
+#define xkb_keymap_num_layouts xkb_keymap_num_layouts_dylibloader_orig_xkbcommon
+#define xkb_keymap_layout_get_name xkb_keymap_layout_get_name_dylibloader_orig_xkbcommon
+#define xkb_keymap_layout_get_index xkb_keymap_layout_get_index_dylibloader_orig_xkbcommon
+#define xkb_keymap_num_leds xkb_keymap_num_leds_dylibloader_orig_xkbcommon
+#define xkb_keymap_led_get_name xkb_keymap_led_get_name_dylibloader_orig_xkbcommon
+#define xkb_keymap_led_get_index xkb_keymap_led_get_index_dylibloader_orig_xkbcommon
+#define xkb_keymap_num_layouts_for_key xkb_keymap_num_layouts_for_key_dylibloader_orig_xkbcommon
+#define xkb_keymap_num_levels_for_key xkb_keymap_num_levels_for_key_dylibloader_orig_xkbcommon
+#define xkb_keymap_key_get_mods_for_level xkb_keymap_key_get_mods_for_level_dylibloader_orig_xkbcommon
+#define xkb_keymap_key_get_syms_by_level xkb_keymap_key_get_syms_by_level_dylibloader_orig_xkbcommon
+#define xkb_keymap_key_repeats xkb_keymap_key_repeats_dylibloader_orig_xkbcommon
+#define xkb_state_new xkb_state_new_dylibloader_orig_xkbcommon
+#define xkb_state_ref xkb_state_ref_dylibloader_orig_xkbcommon
+#define xkb_state_unref xkb_state_unref_dylibloader_orig_xkbcommon
+#define xkb_state_get_keymap xkb_state_get_keymap_dylibloader_orig_xkbcommon
+#define xkb_state_update_key xkb_state_update_key_dylibloader_orig_xkbcommon
+#define xkb_state_update_mask xkb_state_update_mask_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_syms xkb_state_key_get_syms_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_utf8 xkb_state_key_get_utf8_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_utf32 xkb_state_key_get_utf32_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_one_sym xkb_state_key_get_one_sym_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_layout xkb_state_key_get_layout_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_level xkb_state_key_get_level_dylibloader_orig_xkbcommon
+#define xkb_state_serialize_mods xkb_state_serialize_mods_dylibloader_orig_xkbcommon
+#define xkb_state_serialize_layout xkb_state_serialize_layout_dylibloader_orig_xkbcommon
+#define xkb_state_mod_name_is_active xkb_state_mod_name_is_active_dylibloader_orig_xkbcommon
+#define xkb_state_mod_names_are_active xkb_state_mod_names_are_active_dylibloader_orig_xkbcommon
+#define xkb_state_mod_index_is_active xkb_state_mod_index_is_active_dylibloader_orig_xkbcommon
+#define xkb_state_mod_indices_are_active xkb_state_mod_indices_are_active_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_consumed_mods2 xkb_state_key_get_consumed_mods2_dylibloader_orig_xkbcommon
+#define xkb_state_key_get_consumed_mods xkb_state_key_get_consumed_mods_dylibloader_orig_xkbcommon
+#define xkb_state_mod_index_is_consumed2 xkb_state_mod_index_is_consumed2_dylibloader_orig_xkbcommon
+#define xkb_state_mod_index_is_consumed xkb_state_mod_index_is_consumed_dylibloader_orig_xkbcommon
+#define xkb_state_mod_mask_remove_consumed xkb_state_mod_mask_remove_consumed_dylibloader_orig_xkbcommon
+#define xkb_state_layout_name_is_active xkb_state_layout_name_is_active_dylibloader_orig_xkbcommon
+#define xkb_state_layout_index_is_active xkb_state_layout_index_is_active_dylibloader_orig_xkbcommon
+#define xkb_state_led_name_is_active xkb_state_led_name_is_active_dylibloader_orig_xkbcommon
+#define xkb_state_led_index_is_active xkb_state_led_index_is_active_dylibloader_orig_xkbcommon
+#define xkb_compose_table_new_from_locale xkb_compose_table_new_from_locale_dylibloader_orig_xkbcommon
+#define xkb_compose_table_new_from_file xkb_compose_table_new_from_file_dylibloader_orig_xkbcommon
+#define xkb_compose_table_new_from_buffer xkb_compose_table_new_from_buffer_dylibloader_orig_xkbcommon
+#define xkb_compose_table_ref xkb_compose_table_ref_dylibloader_orig_xkbcommon
+#define xkb_compose_table_unref xkb_compose_table_unref_dylibloader_orig_xkbcommon
+#define xkb_compose_state_new xkb_compose_state_new_dylibloader_orig_xkbcommon
+#define xkb_compose_state_ref xkb_compose_state_ref_dylibloader_orig_xkbcommon
+#define xkb_compose_state_unref xkb_compose_state_unref_dylibloader_orig_xkbcommon
+#define xkb_compose_state_get_compose_table xkb_compose_state_get_compose_table_dylibloader_orig_xkbcommon
+#define xkb_compose_state_feed xkb_compose_state_feed_dylibloader_orig_xkbcommon
+#define xkb_compose_state_reset xkb_compose_state_reset_dylibloader_orig_xkbcommon
+#define xkb_compose_state_get_status xkb_compose_state_get_status_dylibloader_orig_xkbcommon
+#define xkb_compose_state_get_utf8 xkb_compose_state_get_utf8_dylibloader_orig_xkbcommon
+#define xkb_compose_state_get_one_sym xkb_compose_state_get_one_sym_dylibloader_orig_xkbcommon
+#include "./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon.h"
+#include "./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-compose.h"
+#include "./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-keysyms.h"
+#undef xkb_keysym_get_name
+#undef xkb_keysym_from_name
+#undef xkb_keysym_to_utf8
+#undef xkb_keysym_to_utf32
+#undef xkb_utf32_to_keysym
+#undef xkb_keysym_to_upper
+#undef xkb_keysym_to_lower
+#undef xkb_context_new
+#undef xkb_context_ref
+#undef xkb_context_unref
+#undef xkb_context_set_user_data
+#undef xkb_context_get_user_data
+#undef xkb_context_include_path_append
+#undef xkb_context_include_path_append_default
+#undef xkb_context_include_path_reset_defaults
+#undef xkb_context_include_path_clear
+#undef xkb_context_num_include_paths
+#undef xkb_context_include_path_get
+#undef xkb_context_set_log_level
+#undef xkb_context_get_log_level
+#undef xkb_context_set_log_verbosity
+#undef xkb_context_get_log_verbosity
+#undef xkb_context_set_log_fn
+#undef xkb_keymap_new_from_names
+#undef xkb_keymap_new_from_file
+#undef xkb_keymap_new_from_string
+#undef xkb_keymap_new_from_buffer
+#undef xkb_keymap_ref
+#undef xkb_keymap_unref
+#undef xkb_keymap_get_as_string
+#undef xkb_keymap_min_keycode
+#undef xkb_keymap_max_keycode
+#undef xkb_keymap_key_for_each
+#undef xkb_keymap_key_get_name
+#undef xkb_keymap_key_by_name
+#undef xkb_keymap_num_mods
+#undef xkb_keymap_mod_get_name
+#undef xkb_keymap_mod_get_index
+#undef xkb_keymap_num_layouts
+#undef xkb_keymap_layout_get_name
+#undef xkb_keymap_layout_get_index
+#undef xkb_keymap_num_leds
+#undef xkb_keymap_led_get_name
+#undef xkb_keymap_led_get_index
+#undef xkb_keymap_num_layouts_for_key
+#undef xkb_keymap_num_levels_for_key
+#undef xkb_keymap_key_get_mods_for_level
+#undef xkb_keymap_key_get_syms_by_level
+#undef xkb_keymap_key_repeats
+#undef xkb_state_new
+#undef xkb_state_ref
+#undef xkb_state_unref
+#undef xkb_state_get_keymap
+#undef xkb_state_update_key
+#undef xkb_state_update_mask
+#undef xkb_state_key_get_syms
+#undef xkb_state_key_get_utf8
+#undef xkb_state_key_get_utf32
+#undef xkb_state_key_get_one_sym
+#undef xkb_state_key_get_layout
+#undef xkb_state_key_get_level
+#undef xkb_state_serialize_mods
+#undef xkb_state_serialize_layout
+#undef xkb_state_mod_name_is_active
+#undef xkb_state_mod_names_are_active
+#undef xkb_state_mod_index_is_active
+#undef xkb_state_mod_indices_are_active
+#undef xkb_state_key_get_consumed_mods2
+#undef xkb_state_key_get_consumed_mods
+#undef xkb_state_mod_index_is_consumed2
+#undef xkb_state_mod_index_is_consumed
+#undef xkb_state_mod_mask_remove_consumed
+#undef xkb_state_layout_name_is_active
+#undef xkb_state_layout_index_is_active
+#undef xkb_state_led_name_is_active
+#undef xkb_state_led_index_is_active
+#undef xkb_compose_table_new_from_locale
+#undef xkb_compose_table_new_from_file
+#undef xkb_compose_table_new_from_buffer
+#undef xkb_compose_table_ref
+#undef xkb_compose_table_unref
+#undef xkb_compose_state_new
+#undef xkb_compose_state_ref
+#undef xkb_compose_state_unref
+#undef xkb_compose_state_get_compose_table
+#undef xkb_compose_state_feed
+#undef xkb_compose_state_reset
+#undef xkb_compose_state_get_status
+#undef xkb_compose_state_get_utf8
+#undef xkb_compose_state_get_one_sym
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define xkb_keysym_get_name xkb_keysym_get_name_dylibloader_wrapper_xkbcommon
+#define xkb_keysym_from_name xkb_keysym_from_name_dylibloader_wrapper_xkbcommon
+#define xkb_keysym_to_utf8 xkb_keysym_to_utf8_dylibloader_wrapper_xkbcommon
+#define xkb_keysym_to_utf32 xkb_keysym_to_utf32_dylibloader_wrapper_xkbcommon
+#define xkb_utf32_to_keysym xkb_utf32_to_keysym_dylibloader_wrapper_xkbcommon
+#define xkb_keysym_to_upper xkb_keysym_to_upper_dylibloader_wrapper_xkbcommon
+#define xkb_keysym_to_lower xkb_keysym_to_lower_dylibloader_wrapper_xkbcommon
+#define xkb_context_new xkb_context_new_dylibloader_wrapper_xkbcommon
+#define xkb_context_ref xkb_context_ref_dylibloader_wrapper_xkbcommon
+#define xkb_context_unref xkb_context_unref_dylibloader_wrapper_xkbcommon
+#define xkb_context_set_user_data xkb_context_set_user_data_dylibloader_wrapper_xkbcommon
+#define xkb_context_get_user_data xkb_context_get_user_data_dylibloader_wrapper_xkbcommon
+#define xkb_context_include_path_append xkb_context_include_path_append_dylibloader_wrapper_xkbcommon
+#define xkb_context_include_path_append_default xkb_context_include_path_append_default_dylibloader_wrapper_xkbcommon
+#define xkb_context_include_path_reset_defaults xkb_context_include_path_reset_defaults_dylibloader_wrapper_xkbcommon
+#define xkb_context_include_path_clear xkb_context_include_path_clear_dylibloader_wrapper_xkbcommon
+#define xkb_context_num_include_paths xkb_context_num_include_paths_dylibloader_wrapper_xkbcommon
+#define xkb_context_include_path_get xkb_context_include_path_get_dylibloader_wrapper_xkbcommon
+#define xkb_context_set_log_level xkb_context_set_log_level_dylibloader_wrapper_xkbcommon
+#define xkb_context_get_log_level xkb_context_get_log_level_dylibloader_wrapper_xkbcommon
+#define xkb_context_set_log_verbosity xkb_context_set_log_verbosity_dylibloader_wrapper_xkbcommon
+#define xkb_context_get_log_verbosity xkb_context_get_log_verbosity_dylibloader_wrapper_xkbcommon
+#define xkb_context_set_log_fn xkb_context_set_log_fn_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_new_from_names xkb_keymap_new_from_names_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_new_from_file xkb_keymap_new_from_file_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_new_from_string xkb_keymap_new_from_string_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_new_from_buffer xkb_keymap_new_from_buffer_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_ref xkb_keymap_ref_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_unref xkb_keymap_unref_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_get_as_string xkb_keymap_get_as_string_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_min_keycode xkb_keymap_min_keycode_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_max_keycode xkb_keymap_max_keycode_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_key_for_each xkb_keymap_key_for_each_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_key_get_name xkb_keymap_key_get_name_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_key_by_name xkb_keymap_key_by_name_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_num_mods xkb_keymap_num_mods_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_mod_get_name xkb_keymap_mod_get_name_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_mod_get_index xkb_keymap_mod_get_index_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_num_layouts xkb_keymap_num_layouts_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_layout_get_name xkb_keymap_layout_get_name_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_layout_get_index xkb_keymap_layout_get_index_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_num_leds xkb_keymap_num_leds_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_led_get_name xkb_keymap_led_get_name_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_led_get_index xkb_keymap_led_get_index_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_num_layouts_for_key xkb_keymap_num_layouts_for_key_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_num_levels_for_key xkb_keymap_num_levels_for_key_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_key_get_mods_for_level xkb_keymap_key_get_mods_for_level_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_key_get_syms_by_level xkb_keymap_key_get_syms_by_level_dylibloader_wrapper_xkbcommon
+#define xkb_keymap_key_repeats xkb_keymap_key_repeats_dylibloader_wrapper_xkbcommon
+#define xkb_state_new xkb_state_new_dylibloader_wrapper_xkbcommon
+#define xkb_state_ref xkb_state_ref_dylibloader_wrapper_xkbcommon
+#define xkb_state_unref xkb_state_unref_dylibloader_wrapper_xkbcommon
+#define xkb_state_get_keymap xkb_state_get_keymap_dylibloader_wrapper_xkbcommon
+#define xkb_state_update_key xkb_state_update_key_dylibloader_wrapper_xkbcommon
+#define xkb_state_update_mask xkb_state_update_mask_dylibloader_wrapper_xkbcommon
+#define xkb_state_key_get_syms xkb_state_key_get_syms_dylibloader_wrapper_xkbcommon
+#define xkb_state_key_get_utf8 xkb_state_key_get_utf8_dylibloader_wrapper_xkbcommon
+#define xkb_state_key_get_utf32 xkb_state_key_get_utf32_dylibloader_wrapper_xkbcommon
+#define xkb_state_key_get_one_sym xkb_state_key_get_one_sym_dylibloader_wrapper_xkbcommon
+#define xkb_state_key_get_layout xkb_state_key_get_layout_dylibloader_wrapper_xkbcommon
+#define xkb_state_key_get_level xkb_state_key_get_level_dylibloader_wrapper_xkbcommon
+#define xkb_state_serialize_mods xkb_state_serialize_mods_dylibloader_wrapper_xkbcommon
+#define xkb_state_serialize_layout xkb_state_serialize_layout_dylibloader_wrapper_xkbcommon
+#define xkb_state_mod_name_is_active xkb_state_mod_name_is_active_dylibloader_wrapper_xkbcommon
+#define xkb_state_mod_names_are_active xkb_state_mod_names_are_active_dylibloader_wrapper_xkbcommon
+#define xkb_state_mod_index_is_active xkb_state_mod_index_is_active_dylibloader_wrapper_xkbcommon
+#define xkb_state_mod_indices_are_active xkb_state_mod_indices_are_active_dylibloader_wrapper_xkbcommon
+#define xkb_state_key_get_consumed_mods2 xkb_state_key_get_consumed_mods2_dylibloader_wrapper_xkbcommon
+#define xkb_state_key_get_consumed_mods xkb_state_key_get_consumed_mods_dylibloader_wrapper_xkbcommon
+#define xkb_state_mod_index_is_consumed2 xkb_state_mod_index_is_consumed2_dylibloader_wrapper_xkbcommon
+#define xkb_state_mod_index_is_consumed xkb_state_mod_index_is_consumed_dylibloader_wrapper_xkbcommon
+#define xkb_state_mod_mask_remove_consumed xkb_state_mod_mask_remove_consumed_dylibloader_wrapper_xkbcommon
+#define xkb_state_layout_name_is_active xkb_state_layout_name_is_active_dylibloader_wrapper_xkbcommon
+#define xkb_state_layout_index_is_active xkb_state_layout_index_is_active_dylibloader_wrapper_xkbcommon
+#define xkb_state_led_name_is_active xkb_state_led_name_is_active_dylibloader_wrapper_xkbcommon
+#define xkb_state_led_index_is_active xkb_state_led_index_is_active_dylibloader_wrapper_xkbcommon
+#define xkb_compose_table_new_from_locale xkb_compose_table_new_from_locale_dylibloader_wrapper_xkbcommon
+#define xkb_compose_table_new_from_file xkb_compose_table_new_from_file_dylibloader_wrapper_xkbcommon
+#define xkb_compose_table_new_from_buffer xkb_compose_table_new_from_buffer_dylibloader_wrapper_xkbcommon
+#define xkb_compose_table_ref xkb_compose_table_ref_dylibloader_wrapper_xkbcommon
+#define xkb_compose_table_unref xkb_compose_table_unref_dylibloader_wrapper_xkbcommon
+#define xkb_compose_state_new xkb_compose_state_new_dylibloader_wrapper_xkbcommon
+#define xkb_compose_state_ref xkb_compose_state_ref_dylibloader_wrapper_xkbcommon
+#define xkb_compose_state_unref xkb_compose_state_unref_dylibloader_wrapper_xkbcommon
+#define xkb_compose_state_get_compose_table xkb_compose_state_get_compose_table_dylibloader_wrapper_xkbcommon
+#define xkb_compose_state_feed xkb_compose_state_feed_dylibloader_wrapper_xkbcommon
+#define xkb_compose_state_reset xkb_compose_state_reset_dylibloader_wrapper_xkbcommon
+#define xkb_compose_state_get_status xkb_compose_state_get_status_dylibloader_wrapper_xkbcommon
+#define xkb_compose_state_get_utf8 xkb_compose_state_get_utf8_dylibloader_wrapper_xkbcommon
+#define xkb_compose_state_get_one_sym xkb_compose_state_get_one_sym_dylibloader_wrapper_xkbcommon
+extern int (*xkb_keysym_get_name_dylibloader_wrapper_xkbcommon)( xkb_keysym_t, char*, size_t);
+extern xkb_keysym_t (*xkb_keysym_from_name_dylibloader_wrapper_xkbcommon)(const char*,enum xkb_keysym_flags);
+extern int (*xkb_keysym_to_utf8_dylibloader_wrapper_xkbcommon)( xkb_keysym_t, char*, size_t);
+extern uint32_t (*xkb_keysym_to_utf32_dylibloader_wrapper_xkbcommon)( xkb_keysym_t);
+extern xkb_keysym_t (*xkb_utf32_to_keysym_dylibloader_wrapper_xkbcommon)( uint32_t);
+extern xkb_keysym_t (*xkb_keysym_to_upper_dylibloader_wrapper_xkbcommon)( xkb_keysym_t);
+extern xkb_keysym_t (*xkb_keysym_to_lower_dylibloader_wrapper_xkbcommon)( xkb_keysym_t);
+extern struct xkb_context* (*xkb_context_new_dylibloader_wrapper_xkbcommon)(enum xkb_context_flags);
+extern struct xkb_context* (*xkb_context_ref_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+extern void (*xkb_context_unref_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+extern void (*xkb_context_set_user_data_dylibloader_wrapper_xkbcommon)(struct xkb_context*, void*);
+extern void* (*xkb_context_get_user_data_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+extern int (*xkb_context_include_path_append_dylibloader_wrapper_xkbcommon)(struct xkb_context*,const char*);
+extern int (*xkb_context_include_path_append_default_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+extern int (*xkb_context_include_path_reset_defaults_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+extern void (*xkb_context_include_path_clear_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+extern unsigned int (*xkb_context_num_include_paths_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+extern const char* (*xkb_context_include_path_get_dylibloader_wrapper_xkbcommon)(struct xkb_context*, unsigned int);
+extern void (*xkb_context_set_log_level_dylibloader_wrapper_xkbcommon)(struct xkb_context*,enum xkb_log_level);
+extern enum xkb_log_level (*xkb_context_get_log_level_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+extern void (*xkb_context_set_log_verbosity_dylibloader_wrapper_xkbcommon)(struct xkb_context*, int);
+extern int (*xkb_context_get_log_verbosity_dylibloader_wrapper_xkbcommon)(struct xkb_context*);
+extern void (*xkb_context_set_log_fn_dylibloader_wrapper_xkbcommon)(struct xkb_context*, void*);
+extern struct xkb_keymap* (*xkb_keymap_new_from_names_dylibloader_wrapper_xkbcommon)(struct xkb_context*,struct xkb_rule_names*,enum xkb_keymap_compile_flags);
+extern struct xkb_keymap* (*xkb_keymap_new_from_file_dylibloader_wrapper_xkbcommon)(struct xkb_context*, FILE*,enum xkb_keymap_format,enum xkb_keymap_compile_flags);
+extern struct xkb_keymap* (*xkb_keymap_new_from_string_dylibloader_wrapper_xkbcommon)(struct xkb_context*,const char*,enum xkb_keymap_format,enum xkb_keymap_compile_flags);
+extern struct xkb_keymap* (*xkb_keymap_new_from_buffer_dylibloader_wrapper_xkbcommon)(struct xkb_context*,const char*, size_t,enum xkb_keymap_format,enum xkb_keymap_compile_flags);
+extern struct xkb_keymap* (*xkb_keymap_ref_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+extern void (*xkb_keymap_unref_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+extern char* (*xkb_keymap_get_as_string_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*,enum xkb_keymap_format);
+extern xkb_keycode_t (*xkb_keymap_min_keycode_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+extern xkb_keycode_t (*xkb_keymap_max_keycode_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+extern void (*xkb_keymap_key_for_each_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_keymap_key_iter_t, void*);
+extern const char* (*xkb_keymap_key_get_name_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_keycode_t);
+extern xkb_keycode_t (*xkb_keymap_key_by_name_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*,const char*);
+extern xkb_mod_index_t (*xkb_keymap_num_mods_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+extern const char* (*xkb_keymap_mod_get_name_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_mod_index_t);
+extern xkb_mod_index_t (*xkb_keymap_mod_get_index_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*,const char*);
+extern xkb_layout_index_t (*xkb_keymap_num_layouts_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+extern const char* (*xkb_keymap_layout_get_name_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_layout_index_t);
+extern xkb_layout_index_t (*xkb_keymap_layout_get_index_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*,const char*);
+extern xkb_led_index_t (*xkb_keymap_num_leds_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+extern const char* (*xkb_keymap_led_get_name_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_led_index_t);
+extern xkb_led_index_t (*xkb_keymap_led_get_index_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*,const char*);
+extern xkb_layout_index_t (*xkb_keymap_num_layouts_for_key_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_keycode_t);
+extern xkb_level_index_t (*xkb_keymap_num_levels_for_key_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_keycode_t, xkb_layout_index_t);
+extern size_t (*xkb_keymap_key_get_mods_for_level_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_keycode_t, xkb_layout_index_t, xkb_level_index_t, xkb_mod_mask_t*, size_t);
+extern int (*xkb_keymap_key_get_syms_by_level_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_keycode_t, xkb_layout_index_t, xkb_level_index_t,const xkb_keysym_t**);
+extern int (*xkb_keymap_key_repeats_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*, xkb_keycode_t);
+extern struct xkb_state* (*xkb_state_new_dylibloader_wrapper_xkbcommon)(struct xkb_keymap*);
+extern struct xkb_state* (*xkb_state_ref_dylibloader_wrapper_xkbcommon)(struct xkb_state*);
+extern void (*xkb_state_unref_dylibloader_wrapper_xkbcommon)(struct xkb_state*);
+extern struct xkb_keymap* (*xkb_state_get_keymap_dylibloader_wrapper_xkbcommon)(struct xkb_state*);
+extern enum xkb_state_component (*xkb_state_update_key_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t,enum xkb_key_direction);
+extern enum xkb_state_component (*xkb_state_update_mask_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t);
+extern int (*xkb_state_key_get_syms_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t,const xkb_keysym_t**);
+extern int (*xkb_state_key_get_utf8_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t, char*, size_t);
+extern uint32_t (*xkb_state_key_get_utf32_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t);
+extern xkb_keysym_t (*xkb_state_key_get_one_sym_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t);
+extern xkb_layout_index_t (*xkb_state_key_get_layout_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t);
+extern xkb_level_index_t (*xkb_state_key_get_level_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t, xkb_layout_index_t);
+extern xkb_mod_mask_t (*xkb_state_serialize_mods_dylibloader_wrapper_xkbcommon)(struct xkb_state*,enum xkb_state_component);
+extern xkb_layout_index_t (*xkb_state_serialize_layout_dylibloader_wrapper_xkbcommon)(struct xkb_state*,enum xkb_state_component);
+extern int (*xkb_state_mod_name_is_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*,const char*,enum xkb_state_component);
+extern int (*xkb_state_mod_names_are_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*,enum xkb_state_component,enum xkb_state_match,...);
+extern int (*xkb_state_mod_index_is_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_mod_index_t,enum xkb_state_component);
+extern int (*xkb_state_mod_indices_are_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*,enum xkb_state_component,enum xkb_state_match,...);
+extern xkb_mod_mask_t (*xkb_state_key_get_consumed_mods2_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t,enum xkb_consumed_mode);
+extern xkb_mod_mask_t (*xkb_state_key_get_consumed_mods_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t);
+extern int (*xkb_state_mod_index_is_consumed2_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t, xkb_mod_index_t,enum xkb_consumed_mode);
+extern int (*xkb_state_mod_index_is_consumed_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t, xkb_mod_index_t);
+extern xkb_mod_mask_t (*xkb_state_mod_mask_remove_consumed_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_keycode_t, xkb_mod_mask_t);
+extern int (*xkb_state_layout_name_is_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*,const char*,enum xkb_state_component);
+extern int (*xkb_state_layout_index_is_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_layout_index_t,enum xkb_state_component);
+extern int (*xkb_state_led_name_is_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*,const char*);
+extern int (*xkb_state_led_index_is_active_dylibloader_wrapper_xkbcommon)(struct xkb_state*, xkb_led_index_t);
+extern struct xkb_compose_table* (*xkb_compose_table_new_from_locale_dylibloader_wrapper_xkbcommon)(struct xkb_context*,const char*,enum xkb_compose_compile_flags);
+extern struct xkb_compose_table* (*xkb_compose_table_new_from_file_dylibloader_wrapper_xkbcommon)(struct xkb_context*, FILE*,const char*,enum xkb_compose_format,enum xkb_compose_compile_flags);
+extern struct xkb_compose_table* (*xkb_compose_table_new_from_buffer_dylibloader_wrapper_xkbcommon)(struct xkb_context*,const char*, size_t,const char*,enum xkb_compose_format,enum xkb_compose_compile_flags);
+extern struct xkb_compose_table* (*xkb_compose_table_ref_dylibloader_wrapper_xkbcommon)(struct xkb_compose_table*);
+extern void (*xkb_compose_table_unref_dylibloader_wrapper_xkbcommon)(struct xkb_compose_table*);
+extern struct xkb_compose_state* (*xkb_compose_state_new_dylibloader_wrapper_xkbcommon)(struct xkb_compose_table*,enum xkb_compose_state_flags);
+extern struct xkb_compose_state* (*xkb_compose_state_ref_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*);
+extern void (*xkb_compose_state_unref_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*);
+extern struct xkb_compose_table* (*xkb_compose_state_get_compose_table_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*);
+extern enum xkb_compose_feed_result (*xkb_compose_state_feed_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*, xkb_keysym_t);
+extern void (*xkb_compose_state_reset_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*);
+extern enum xkb_compose_status (*xkb_compose_state_get_status_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*);
+extern int (*xkb_compose_state_get_utf8_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*, char*, size_t);
+extern xkb_keysym_t (*xkb_compose_state_get_one_sym_dylibloader_wrapper_xkbcommon)(struct xkb_compose_state*);
+int initialize_xkbcommon(int verbose);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/platform/macos/detect.py b/platform/macos/detect.py
index 67e4b49b14..cd46dab4f3 100644
--- a/platform/macos/detect.py
+++ b/platform/macos/detect.py
@@ -230,8 +230,7 @@ def configure(env: "Environment"):
env.Append(LIBS=["pthread", "z"])
if env["opengl3"]:
- env.Append(CPPDEFINES=["GLES_ENABLED", "GLES3_ENABLED"])
- env.Append(CCFLAGS=["-Wno-deprecated-declarations"]) # Disable deprecation warnings
+ env.Append(CPPDEFINES=["GLES3_ENABLED"])
env.Append(LINKFLAGS=["-framework", "OpenGL"])
env.Append(LINKFLAGS=["-rpath", "@executable_path/../Frameworks", "-rpath", "@executable_path"])
diff --git a/platform/macos/display_server_macos.h b/platform/macos/display_server_macos.h
index 4873db4b64..fb9bcdfe56 100644
--- a/platform/macos/display_server_macos.h
+++ b/platform/macos/display_server_macos.h
@@ -69,6 +69,7 @@ public:
bool raw = false;
Key keycode = Key::NONE;
Key physical_keycode = Key::NONE;
+ Key key_label = Key::NONE;
uint32_t unicode = 0;
};
@@ -201,8 +202,6 @@ private:
Point2i _get_native_screen_position(int p_screen) const;
static void _displays_arrangement_changed(CGDirectDisplayID display_id, CGDisplayChangeSummaryFlags flags, void *user_info);
- WindowID _get_focused_window_or_popup() const;
-
static void _dispatch_input_events(const Ref<InputEvent> &p_event);
void _dispatch_input_event(const Ref<InputEvent> &p_event);
void _push_input(const Ref<InputEvent> &p_event);
@@ -229,6 +228,7 @@ public:
void get_key_modifier_state(unsigned int p_macos_state, Ref<InputEventWithModifiers> r_state) const;
void update_mouse_pos(WindowData &p_wd, NSPoint p_location_in_window);
void push_to_key_event_buffer(const KeyEvent &p_event);
+ void pop_last_key_event();
void update_im_text(const Point2i &p_selection, const String &p_text);
void set_last_focused_window(WindowID p_window);
bool mouse_process_popups(bool p_close = false);
@@ -237,6 +237,7 @@ public:
void set_is_resizing(bool p_is_resizing);
bool get_is_resizing() const;
void reparent_check(WindowID p_window);
+ WindowID _get_focused_window_or_popup() const;
void window_update(WindowID p_window);
void window_destroy(WindowID p_window);
diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm
index d992467042..2832495693 100644
--- a/platform/macos/display_server_macos.mm
+++ b/platform/macos/display_server_macos.mm
@@ -434,7 +434,8 @@ void DisplayServerMacOS::_process_key_events() {
k->set_pressed(ke.pressed);
k->set_echo(ke.echo);
k->set_keycode(ke.keycode);
- k->set_physical_keycode((Key)ke.physical_keycode);
+ k->set_physical_keycode(ke.physical_keycode);
+ k->set_key_label(ke.key_label);
k->set_unicode(ke.unicode);
_push_input(k);
@@ -449,6 +450,7 @@ void DisplayServerMacOS::_process_key_events() {
k->set_echo(ke.echo);
k->set_keycode(Key::NONE);
k->set_physical_keycode(Key::NONE);
+ k->set_key_label(Key::NONE);
k->set_unicode(ke.unicode);
_push_input(k);
@@ -461,7 +463,8 @@ void DisplayServerMacOS::_process_key_events() {
k->set_pressed(ke.pressed);
k->set_echo(ke.echo);
k->set_keycode(ke.keycode);
- k->set_physical_keycode((Key)ke.physical_keycode);
+ k->set_physical_keycode(ke.physical_keycode);
+ k->set_key_label(ke.key_label);
if (i + 1 < key_event_pos && key_event_buffer[i + 1].keycode == Key::NONE) {
k->set_unicode(key_event_buffer[i + 1].unicode);
@@ -633,6 +636,7 @@ void DisplayServerMacOS::send_event(NSEvent *p_event) {
k->set_pressed(true);
k->set_keycode(Key::PERIOD);
k->set_physical_keycode(Key::PERIOD);
+ k->set_key_label(Key::PERIOD);
k->set_echo([p_event isARepeat]);
Input::get_singleton()->parse_input_event(k);
@@ -674,6 +678,12 @@ void DisplayServerMacOS::update_mouse_pos(DisplayServerMacOS::WindowData &p_wd,
Input::get_singleton()->set_mouse_position(p_wd.mouse_pos);
}
+void DisplayServerMacOS::pop_last_key_event() {
+ if (key_event_pos > 0) {
+ key_event_pos--;
+ }
+}
+
void DisplayServerMacOS::push_to_key_event_buffer(const DisplayServerMacOS::KeyEvent &p_event) {
if (key_event_pos >= key_event_buffer.size()) {
key_event_buffer.resize(1 + key_event_pos);
@@ -3142,7 +3152,9 @@ ObjectID DisplayServerMacOS::window_get_attached_instance_id(WindowID p_window)
void DisplayServerMacOS::gl_window_make_current(DisplayServer::WindowID p_window_id) {
#if defined(GLES3_ENABLED)
- gl_manager->window_make_current(p_window_id);
+ if (gl_manager) {
+ gl_manager->window_make_current(p_window_id);
+ }
#endif
}
@@ -3449,14 +3461,14 @@ String DisplayServerMacOS::keyboard_get_layout_name(int p_index) const {
}
Key DisplayServerMacOS::keyboard_get_keycode_from_physical(Key p_keycode) const {
- if (p_keycode == Key::PAUSE) {
+ if (p_keycode == Key::PAUSE || p_keycode == Key::NONE) {
return p_keycode;
}
Key modifiers = p_keycode & KeyModifierMask::MODIFIER_MASK;
Key keycode_no_mod = p_keycode & KeyModifierMask::CODE_MASK;
- unsigned int macos_keycode = KeyMappingMacOS::unmap_key((Key)keycode_no_mod);
- return (Key)(KeyMappingMacOS::remap_key(macos_keycode, 0) | modifiers);
+ unsigned int macos_keycode = KeyMappingMacOS::unmap_key(keycode_no_mod);
+ return (Key)(KeyMappingMacOS::remap_key(macos_keycode, 0, false) | modifiers);
}
void DisplayServerMacOS::process_events() {
@@ -3768,6 +3780,8 @@ bool DisplayServerMacOS::mouse_process_popups(bool p_close) {
}
DisplayServerMacOS::DisplayServerMacOS(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Error &r_error) {
+ KeyMappingMacOS::initialize();
+
Input::get_singleton()->set_event_dispatch_function(_dispatch_input_events);
r_error = OK;
diff --git a/platform/macos/export/export_plugin.cpp b/platform/macos/export/export_plugin.cpp
index 73fbd45400..bb96308a75 100644
--- a/platform/macos/export/export_plugin.cpp
+++ b/platform/macos/export/export_plugin.cpp
@@ -48,16 +48,18 @@
#endif
void EditorExportPlatformMacOS::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const {
- if (p_preset->get("texture_format/s3tc")) {
+ r_features->push_back(p_preset->get("binary_format/architecture"));
+ String architecture = p_preset->get("binary_format/architecture");
+
+ if (architecture == "universal" || architecture == "x86_64") {
r_features->push_back("s3tc");
- }
- if (p_preset->get("texture_format/etc")) {
- r_features->push_back("etc");
- }
- if (p_preset->get("texture_format/etc2")) {
+ r_features->push_back("bptc");
+ } else if (architecture == "arm64") {
r_features->push_back("etc2");
+ r_features->push_back("astc");
+ } else {
+ ERR_PRINT("Invalid architecture");
}
- r_features->push_back(p_preset->get("binary_format/architecture"));
}
bool EditorExportPlatformMacOS::get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option, const HashMap<StringName, Variant> &p_options) const {
@@ -210,10 +212,6 @@ void EditorExportPlatformMacOS::get_export_options(List<ExportOption> *r_options
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "privacy/removable_volumes_usage_description", PROPERTY_HINT_PLACEHOLDER_TEXT, "Provide a message if you need to use removable volumes"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::DICTIONARY, "privacy/removable_volumes_usage_description_localized", PROPERTY_HINT_LOCALIZABLE_STRING), Dictionary()));
- r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), true));
- r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc"), false));
- r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), false));
-
String run_script = "#!/usr/bin/env bash\n"
"unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"\n"
"open \"{temp_dir}/{exe_name}.app\" --args {cmd_args}";
@@ -1766,6 +1764,24 @@ bool EditorExportPlatformMacOS::has_valid_export_configuration(const Ref<EditorE
}
}
+ String architecture = p_preset->get("binary_format/architecture");
+
+ if (architecture == "universal" || architecture == "x86_64") {
+ const String bc_error = test_bc();
+ if (!bc_error.is_empty()) {
+ valid = false;
+ err += bc_error;
+ }
+ } else if (architecture == "arm64") {
+ const String etc_error = test_etc2();
+ if (!etc_error.is_empty()) {
+ valid = false;
+ err += etc_error;
+ }
+ } else {
+ ERR_PRINT("Invalid architecture");
+ }
+
// Look for export templates (official templates, check only is custom templates are not set).
if (!dvalid || !rvalid) {
dvalid = exists_export_template("macos.zip", &err);
@@ -2016,8 +2032,8 @@ Error EditorExportPlatformMacOS::run(const Ref<EditorExportPreset> &p_preset, in
if (port.is_empty()) {
port = "22";
}
- Vector<String> extra_args_ssh = p_preset->get("ssh_remote_deploy/extra_args_ssh").operator String().split(" ");
- Vector<String> extra_args_scp = p_preset->get("ssh_remote_deploy/extra_args_scp").operator String().split(" ");
+ Vector<String> extra_args_ssh = p_preset->get("ssh_remote_deploy/extra_args_ssh").operator String().split(" ", false);
+ Vector<String> extra_args_scp = p_preset->get("ssh_remote_deploy/extra_args_scp").operator String().split(" ", false);
const String basepath = dest.path_join("tmp_macos_export");
diff --git a/platform/macos/gl_manager_macos_legacy.h b/platform/macos/gl_manager_macos_legacy.h
index 663bc5ea7b..c33b803d81 100644
--- a/platform/macos/gl_manager_macos_legacy.h
+++ b/platform/macos/gl_manager_macos_legacy.h
@@ -33,6 +33,9 @@
#if defined(MACOS_ENABLED) && defined(GLES3_ENABLED)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // OpenGL is deprecated in macOS 10.14
+
#include "core/error/error_list.h"
#include "core/os/os.h"
#include "core/templates/local_vector.h"
@@ -95,6 +98,8 @@ public:
~GLManager_MacOS();
};
+#pragma clang diagnostic push
+
#endif // MACOS_ENABLED && GLES3_ENABLED
#endif // GL_MANAGER_MACOS_LEGACY_H
diff --git a/platform/macos/gl_manager_macos_legacy.mm b/platform/macos/gl_manager_macos_legacy.mm
index a53b737289..65e978bfe6 100644
--- a/platform/macos/gl_manager_macos_legacy.mm
+++ b/platform/macos/gl_manager_macos_legacy.mm
@@ -33,6 +33,9 @@
#ifdef MACOS_ENABLED
#ifdef GLES3_ENABLED
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // OpenGL is deprecated in macOS 10.14
+
#include <stdio.h>
#include <stdlib.h>
@@ -232,5 +235,7 @@ GLManager_MacOS::~GLManager_MacOS() {
release_current();
}
+#pragma clang diagnostic pop
+
#endif // GLES3_ENABLED
#endif // MACOS_ENABLED
diff --git a/platform/macos/godot_application.h b/platform/macos/godot_application.h
index f41fc2646d..8749c8fbb0 100644
--- a/platform/macos/godot_application.h
+++ b/platform/macos/godot_application.h
@@ -35,6 +35,7 @@
#import <AppKit/AppKit.h>
#import <Foundation/Foundation.h>
+#import <IOKit/hidsystem/ev_keymap.h>
@interface GodotApplication : NSApplication
@end
diff --git a/platform/macos/godot_application.mm b/platform/macos/godot_application.mm
index 0c282930f4..e3a744caa2 100644
--- a/platform/macos/godot_application.mm
+++ b/platform/macos/godot_application.mm
@@ -34,7 +34,81 @@
@implementation GodotApplication
+- (void)mediaKeyEvent:(int)key state:(BOOL)state repeat:(BOOL)repeat {
+ Key keycode = Key::NONE;
+ switch (key) {
+ case NX_KEYTYPE_SOUND_UP: {
+ keycode = Key::VOLUMEUP;
+ } break;
+ case NX_KEYTYPE_SOUND_DOWN: {
+ keycode = Key::VOLUMEUP;
+ } break;
+ //NX_KEYTYPE_BRIGHTNESS_UP
+ //NX_KEYTYPE_BRIGHTNESS_DOWN
+ case NX_KEYTYPE_CAPS_LOCK: {
+ keycode = Key::CAPSLOCK;
+ } break;
+ case NX_KEYTYPE_HELP: {
+ keycode = Key::HELP;
+ } break;
+ case NX_POWER_KEY: {
+ keycode = Key::STANDBY;
+ } break;
+ case NX_KEYTYPE_MUTE: {
+ keycode = Key::VOLUMEMUTE;
+ } break;
+ //NX_KEYTYPE_CONTRAST_UP
+ //NX_KEYTYPE_CONTRAST_DOWN
+ //NX_KEYTYPE_LAUNCH_PANEL
+ //NX_KEYTYPE_EJECT
+ //NX_KEYTYPE_VIDMIRROR
+ //NX_KEYTYPE_FAST
+ //NX_KEYTYPE_REWIND
+ //NX_KEYTYPE_ILLUMINATION_UP
+ //NX_KEYTYPE_ILLUMINATION_DOWN
+ //NX_KEYTYPE_ILLUMINATION_TOGGLE
+ case NX_KEYTYPE_PLAY: {
+ keycode = Key::MEDIAPLAY;
+ } break;
+ case NX_KEYTYPE_NEXT: {
+ keycode = Key::MEDIANEXT;
+ } break;
+ case NX_KEYTYPE_PREVIOUS: {
+ keycode = Key::MEDIAPREVIOUS;
+ } break;
+ default: {
+ keycode = Key::NONE;
+ } break;
+ }
+
+ DisplayServerMacOS *ds = (DisplayServerMacOS *)DisplayServer::get_singleton();
+ if (ds && keycode != Key::NONE) {
+ DisplayServerMacOS::KeyEvent ke;
+
+ ke.window_id = ds->_get_focused_window_or_popup();
+ ke.macos_state = 0;
+ ke.pressed = state;
+ ke.echo = repeat;
+ ke.keycode = keycode;
+ ke.physical_keycode = keycode;
+ ke.key_label = keycode;
+ ke.unicode = 0;
+ ke.raw = true;
+
+ ds->push_to_key_event_buffer(ke);
+ }
+}
+
- (void)sendEvent:(NSEvent *)event {
+ if ([event type] == NSSystemDefined && [event subtype] == 8) {
+ int keyCode = (([event data1] & 0xFFFF0000) >> 16);
+ int keyFlags = ([event data1] & 0x0000FFFF);
+ int keyState = (((keyFlags & 0xFF00) >> 8)) == 0xA;
+ int keyRepeat = (keyFlags & 0x1);
+
+ [self mediaKeyEvent:keyCode state:keyState repeat:keyRepeat];
+ }
+
DisplayServerMacOS *ds = (DisplayServerMacOS *)DisplayServer::get_singleton();
if (ds) {
if ([event type] == NSEventTypeLeftMouseDown || [event type] == NSEventTypeRightMouseDown || [event type] == NSEventTypeOtherMouseDown) {
diff --git a/platform/macos/godot_content_view.h b/platform/macos/godot_content_view.h
index ba7f15c32b..0d18ac742a 100644
--- a/platform/macos/godot_content_view.h
+++ b/platform/macos/godot_content_view.h
@@ -53,6 +53,9 @@
@end
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // OpenGL is deprecated in macOS 10.14
+
@interface GodotContentView : RootView <NSTextInputClient> {
DisplayServer::WindowID window_id;
NSTrackingArea *tracking_area;
@@ -61,6 +64,7 @@
bool mouse_down_control;
bool ignore_momentum_scroll;
bool last_pen_inverted;
+ bool ime_suppress_next_keyup;
id layer_delegate;
}
@@ -73,4 +77,6 @@
@end
+#pragma clang diagnostic pop
+
#endif // GODOT_CONTENT_VIEW_H
diff --git a/platform/macos/godot_content_view.mm b/platform/macos/godot_content_view.mm
index 337aa59a5e..485f80a22e 100644
--- a/platform/macos/godot_content_view.mm
+++ b/platform/macos/godot_content_view.mm
@@ -185,6 +185,7 @@
DisplayServerMacOS::WindowData &wd = ds->get_window(window_id);
if (wd.im_active) {
ime_input_event_in_progress = true;
+ ds->pop_last_key_event();
ds->update_im_text(Point2i(selectedRange.location, selectedRange.length), String::utf8([[marked_text mutableString] UTF8String]));
}
}
@@ -194,6 +195,9 @@
}
- (void)unmarkText {
+ if (ime_input_event_in_progress) {
+ ime_suppress_next_keyup = true;
+ }
ime_input_event_in_progress = false;
[[marked_text mutableString] setString:@""];
@@ -245,8 +249,6 @@
}
- (void)insertText:(id)aString replacementRange:(NSRange)replacementRange {
- NSEvent *event = [NSApp currentEvent];
-
NSString *characters;
if ([aString isKindOfClass:[NSAttributedString class]]) {
characters = [aString string];
@@ -284,13 +286,14 @@
DisplayServerMacOS::KeyEvent ke;
ke.window_id = window_id;
- ke.macos_state = [event modifierFlags];
+ ke.macos_state = 0;
ke.pressed = true;
ke.echo = false;
ke.raw = false; // IME input event.
ke.keycode = Key::NONE;
ke.physical_keycode = Key::NONE;
- ke.unicode = codepoint;
+ ke.key_label = Key::NONE;
+ ke.unicode = fix_unicode(codepoint);
ds->push_to_key_event_buffer(ke);
}
@@ -584,7 +587,7 @@
NSString *characters = [event characters];
NSUInteger length = [characters length];
- if (!wd.im_active && length > 0 && keycode_has_unicode(KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags]))) {
+ if (!wd.im_active && length > 0 && keycode_has_unicode(KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags], true))) {
// Fallback unicode character handler used if IME is not active.
Char16String text;
text.resize([characters length] + 1);
@@ -602,10 +605,11 @@
ke.macos_state = [event modifierFlags];
ke.pressed = true;
ke.echo = [event isARepeat];
- ke.keycode = KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags]);
+ ke.keycode = KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags], false);
ke.physical_keycode = KeyMappingMacOS::translate_key([event keyCode]);
+ ke.key_label = KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags], true);
+ ke.unicode = fix_unicode(codepoint);
ke.raw = true;
- ke.unicode = codepoint;
ds->push_to_key_event_buffer(ke);
}
@@ -616,10 +620,11 @@
ke.macos_state = [event modifierFlags];
ke.pressed = true;
ke.echo = [event isARepeat];
- ke.keycode = KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags]);
+ ke.keycode = KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags], false);
ke.physical_keycode = KeyMappingMacOS::translate_key([event keyCode]);
- ke.raw = false;
+ ke.key_label = KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags], true);
ke.unicode = 0;
+ ke.raw = false;
ds->push_to_key_event_buffer(ke);
}
@@ -638,56 +643,54 @@
}
ignore_momentum_scroll = true;
- // Ignore all input if IME input is in progress
- if (!ime_input_event_in_progress) {
- DisplayServerMacOS::KeyEvent ke;
+ DisplayServerMacOS::KeyEvent ke;
- ke.window_id = window_id;
- ke.echo = false;
- ke.raw = true;
+ ke.window_id = window_id;
+ ke.echo = false;
+ ke.raw = true;
- int key = [event keyCode];
- int mod = [event modifierFlags];
+ int key = [event keyCode];
+ int mod = [event modifierFlags];
- if (key == 0x36 || key == 0x37) {
- if (mod & NSEventModifierFlagCommand) {
- mod &= ~NSEventModifierFlagCommand;
- ke.pressed = true;
- } else {
- ke.pressed = false;
- }
- } else if (key == 0x38 || key == 0x3c) {
- if (mod & NSEventModifierFlagShift) {
- mod &= ~NSEventModifierFlagShift;
- ke.pressed = true;
- } else {
- ke.pressed = false;
- }
- } else if (key == 0x3a || key == 0x3d) {
- if (mod & NSEventModifierFlagOption) {
- mod &= ~NSEventModifierFlagOption;
- ke.pressed = true;
- } else {
- ke.pressed = false;
- }
- } else if (key == 0x3b || key == 0x3e) {
- if (mod & NSEventModifierFlagControl) {
- mod &= ~NSEventModifierFlagControl;
- ke.pressed = true;
- } else {
- ke.pressed = false;
- }
+ if (key == 0x36 || key == 0x37) {
+ if (mod & NSEventModifierFlagCommand) {
+ mod &= ~NSEventModifierFlagCommand;
+ ke.pressed = true;
} else {
- return;
+ ke.pressed = false;
}
+ } else if (key == 0x38 || key == 0x3c) {
+ if (mod & NSEventModifierFlagShift) {
+ mod &= ~NSEventModifierFlagShift;
+ ke.pressed = true;
+ } else {
+ ke.pressed = false;
+ }
+ } else if (key == 0x3a || key == 0x3d) {
+ if (mod & NSEventModifierFlagOption) {
+ mod &= ~NSEventModifierFlagOption;
+ ke.pressed = true;
+ } else {
+ ke.pressed = false;
+ }
+ } else if (key == 0x3b || key == 0x3e) {
+ if (mod & NSEventModifierFlagControl) {
+ mod &= ~NSEventModifierFlagControl;
+ ke.pressed = true;
+ } else {
+ ke.pressed = false;
+ }
+ } else {
+ return;
+ }
- ke.macos_state = mod;
- ke.keycode = KeyMappingMacOS::remap_key(key, mod);
- ke.physical_keycode = KeyMappingMacOS::translate_key(key);
- ke.unicode = 0;
+ ke.macos_state = mod;
+ ke.keycode = KeyMappingMacOS::remap_key(key, mod, false);
+ ke.physical_keycode = KeyMappingMacOS::translate_key(key);
+ ke.key_label = KeyMappingMacOS::remap_key(key, mod, true);
+ ke.unicode = 0;
- ds->push_to_key_event_buffer(ke);
- }
+ ds->push_to_key_event_buffer(ke);
}
- (void)keyUp:(NSEvent *)event {
@@ -696,51 +699,26 @@
return;
}
- DisplayServerMacOS::WindowData &wd = ds->get_window(window_id);
-
// Ignore all input if IME input is in progress.
- if (!ime_input_event_in_progress) {
- NSString *characters = [event characters];
- NSUInteger length = [characters length];
-
- // Fallback unicode character handler used if IME is not active.
- if (!wd.im_active && length > 0 && keycode_has_unicode(KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags]))) {
- Char16String text;
- text.resize([characters length] + 1);
- [characters getCharacters:(unichar *)text.ptrw() range:NSMakeRange(0, [characters length])];
-
- String u32text;
- u32text.parse_utf16(text.ptr(), text.length());
-
- for (int i = 0; i < u32text.length(); i++) {
- const char32_t codepoint = u32text[i];
- DisplayServerMacOS::KeyEvent ke;
-
- ke.window_id = window_id;
- ke.macos_state = [event modifierFlags];
- ke.pressed = false;
- ke.echo = [event isARepeat];
- ke.keycode = KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags]);
- ke.physical_keycode = KeyMappingMacOS::translate_key([event keyCode]);
- ke.raw = true;
- ke.unicode = codepoint;
+ if (ime_suppress_next_keyup) {
+ ime_suppress_next_keyup = false;
+ return;
+ }
- ds->push_to_key_event_buffer(ke);
- }
- } else {
- DisplayServerMacOS::KeyEvent ke;
+ if (!ime_input_event_in_progress) {
+ DisplayServerMacOS::KeyEvent ke;
- ke.window_id = window_id;
- ke.macos_state = [event modifierFlags];
- ke.pressed = false;
- ke.echo = [event isARepeat];
- ke.keycode = KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags]);
- ke.physical_keycode = KeyMappingMacOS::translate_key([event keyCode]);
- ke.raw = true;
- ke.unicode = 0;
+ ke.window_id = window_id;
+ ke.macos_state = [event modifierFlags];
+ ke.pressed = false;
+ ke.echo = [event isARepeat];
+ ke.keycode = KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags], false);
+ ke.physical_keycode = KeyMappingMacOS::translate_key([event keyCode]);
+ ke.key_label = KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags], true);
+ ke.unicode = 0;
+ ke.raw = true;
- ds->push_to_key_event_buffer(ke);
- }
+ ds->push_to_key_event_buffer(ke);
}
}
diff --git a/platform/macos/godot_menu_delegate.mm b/platform/macos/godot_menu_delegate.mm
index 02cfca0841..ebfe8b1f6d 100644
--- a/platform/macos/godot_menu_delegate.mm
+++ b/platform/macos/godot_menu_delegate.mm
@@ -41,7 +41,7 @@
- (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id *)target action:(SEL *)action {
NSString *ev_key = [[event charactersIgnoringModifiers] lowercaseString];
- NSUInteger ev_modifiers = [event modifierFlags] & NSDeviceIndependentModifierFlagsMask;
+ NSUInteger ev_modifiers = [event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask;
for (int i = 0; i < [menu numberOfItems]; i++) {
const NSMenuItem *menu_item = [menu itemAtIndex:i];
if ([menu_item isEnabled] && [[menu_item keyEquivalent] compare:ev_key] == NSOrderedSame) {
diff --git a/platform/macos/joypad_macos.cpp b/platform/macos/joypad_macos.cpp
index b7b8e0604c..1fcd636a4b 100644
--- a/platform/macos/joypad_macos.cpp
+++ b/platform/macos/joypad_macos.cpp
@@ -316,7 +316,7 @@ bool JoypadMacOS::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) {
if (vendor && product_id) {
char uid[128];
- sprintf(uid, "%08x%08x%08x%08x", OSSwapHostToBigInt32(3), OSSwapHostToBigInt32(vendor), OSSwapHostToBigInt32(product_id), OSSwapHostToBigInt32(version));
+ snprintf(uid, 128, "%08x%08x%08x%08x", OSSwapHostToBigInt32(3), OSSwapHostToBigInt32(vendor), OSSwapHostToBigInt32(product_id), OSSwapHostToBigInt32(version));
input->joy_connection_changed(id, true, name, uid);
} else {
// Bluetooth device.
diff --git a/platform/macos/key_mapping_macos.h b/platform/macos/key_mapping_macos.h
index 5128005627..1bda4eb406 100644
--- a/platform/macos/key_mapping_macos.h
+++ b/platform/macos/key_mapping_macos.h
@@ -36,13 +36,15 @@
class KeyMappingMacOS {
KeyMappingMacOS() {}
- static bool is_numpad_key(unsigned int key);
+ static bool is_numpad_key(unsigned int p_key);
public:
+ static void initialize();
+
// Mappings input.
- static Key translate_key(unsigned int key);
- static unsigned int unmap_key(Key key);
- static Key remap_key(unsigned int key, unsigned int state);
+ static Key translate_key(unsigned int p_key);
+ static unsigned int unmap_key(Key p_key);
+ static Key remap_key(unsigned int p_key, unsigned int p_state, bool p_unicode);
// Mapping for menu shortcuts.
static String keycode_get_native_string(Key p_keycode);
diff --git a/platform/macos/key_mapping_macos.mm b/platform/macos/key_mapping_macos.mm
index 478c84e81c..31b71ac1b8 100644
--- a/platform/macos/key_mapping_macos.mm
+++ b/platform/macos/key_mapping_macos.mm
@@ -33,277 +33,345 @@
#import <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
-bool KeyMappingMacOS::is_numpad_key(unsigned int key) {
- static const unsigned int table[] = {
- 0x41, /* kVK_ANSI_KeypadDecimal */
- 0x43, /* kVK_ANSI_KeypadMultiply */
- 0x45, /* kVK_ANSI_KeypadPlus */
- 0x47, /* kVK_ANSI_KeypadClear */
- 0x4b, /* kVK_ANSI_KeypadDivide */
- 0x4c, /* kVK_ANSI_KeypadEnter */
- 0x4e, /* kVK_ANSI_KeypadMinus */
- 0x51, /* kVK_ANSI_KeypadEquals */
- 0x52, /* kVK_ANSI_Keypad0 */
- 0x53, /* kVK_ANSI_Keypad1 */
- 0x54, /* kVK_ANSI_Keypad2 */
- 0x55, /* kVK_ANSI_Keypad3 */
- 0x56, /* kVK_ANSI_Keypad4 */
- 0x57, /* kVK_ANSI_Keypad5 */
- 0x58, /* kVK_ANSI_Keypad6 */
- 0x59, /* kVK_ANSI_Keypad7 */
- 0x5b, /* kVK_ANSI_Keypad8 */
- 0x5c, /* kVK_ANSI_Keypad9 */
- 0x5f, /* kVK_JIS_KeypadComma */
- 0x00
- };
- for (int i = 0; table[i] != 0; i++) {
- if (key == table[i]) {
- return true;
- }
+#include "core/templates/hash_map.h"
+#include "core/templates/hash_set.h"
+
+struct HashMapHasherKeys {
+ static _FORCE_INLINE_ uint32_t hash(const Key p_key) { return hash_fmix32(static_cast<uint32_t>(p_key)); }
+ static _FORCE_INLINE_ uint32_t hash(const char32_t p_uchar) { return hash_fmix32(p_uchar); }
+ static _FORCE_INLINE_ uint32_t hash(const unsigned p_key) { return hash_fmix32(p_key); }
+};
+
+HashSet<unsigned int> numpad_keys;
+HashMap<unsigned int, Key, HashMapHasherKeys> keysym_map;
+HashMap<Key, unsigned int, HashMapHasherKeys> keysym_map_inv;
+HashMap<Key, char32_t, HashMapHasherKeys> keycode_map;
+
+void KeyMappingMacOS::initialize() {
+ numpad_keys.insert(0x41); //kVK_ANSI_KeypadDecimal
+ numpad_keys.insert(0x43); //kVK_ANSI_KeypadMultiply
+ numpad_keys.insert(0x45); //kVK_ANSI_KeypadPlus
+ numpad_keys.insert(0x47); //kVK_ANSI_KeypadClear
+ numpad_keys.insert(0x4b); //kVK_ANSI_KeypadDivide
+ numpad_keys.insert(0x4c); //kVK_ANSI_KeypadEnter
+ numpad_keys.insert(0x4e); //kVK_ANSI_KeypadMinus
+ numpad_keys.insert(0x51); //kVK_ANSI_KeypadEquals
+ numpad_keys.insert(0x52); //kVK_ANSI_Keypad0
+ numpad_keys.insert(0x53); //kVK_ANSI_Keypad1
+ numpad_keys.insert(0x54); //kVK_ANSI_Keypad2
+ numpad_keys.insert(0x55); //kVK_ANSI_Keypad3
+ numpad_keys.insert(0x56); //kVK_ANSI_Keypad4
+ numpad_keys.insert(0x57); //kVK_ANSI_Keypad5
+ numpad_keys.insert(0x58); //kVK_ANSI_Keypad6
+ numpad_keys.insert(0x59); //kVK_ANSI_Keypad7
+ numpad_keys.insert(0x5b); //kVK_ANSI_Keypad8
+ numpad_keys.insert(0x5c); //kVK_ANSI_Keypad9
+ numpad_keys.insert(0x5f); //kVK_JIS_KeypadComma
+
+ keysym_map[0x00] = Key::A;
+ keysym_map[0x01] = Key::S;
+ keysym_map[0x02] = Key::D;
+ keysym_map[0x03] = Key::F;
+ keysym_map[0x04] = Key::H;
+ keysym_map[0x05] = Key::G;
+ keysym_map[0x06] = Key::Z;
+ keysym_map[0x07] = Key::X;
+ keysym_map[0x08] = Key::C;
+ keysym_map[0x09] = Key::V;
+ keysym_map[0x0a] = Key::SECTION;
+ keysym_map[0x0b] = Key::B;
+ keysym_map[0x0c] = Key::Q;
+ keysym_map[0x0d] = Key::W;
+ keysym_map[0x0e] = Key::E;
+ keysym_map[0x0f] = Key::R;
+ keysym_map[0x10] = Key::Y;
+ keysym_map[0x11] = Key::T;
+ keysym_map[0x12] = Key::KEY_1;
+ keysym_map[0x13] = Key::KEY_2;
+ keysym_map[0x14] = Key::KEY_3;
+ keysym_map[0x15] = Key::KEY_4;
+ keysym_map[0x16] = Key::KEY_6;
+ keysym_map[0x17] = Key::KEY_5;
+ keysym_map[0x18] = Key::EQUAL;
+ keysym_map[0x19] = Key::KEY_9;
+ keysym_map[0x1a] = Key::KEY_7;
+ keysym_map[0x1b] = Key::MINUS;
+ keysym_map[0x1c] = Key::KEY_8;
+ keysym_map[0x1d] = Key::KEY_0;
+ keysym_map[0x1e] = Key::BRACERIGHT;
+ keysym_map[0x1f] = Key::O;
+ keysym_map[0x20] = Key::U;
+ keysym_map[0x21] = Key::BRACELEFT;
+ keysym_map[0x22] = Key::I;
+ keysym_map[0x23] = Key::P;
+ keysym_map[0x24] = Key::ENTER;
+ keysym_map[0x25] = Key::L;
+ keysym_map[0x26] = Key::J;
+ keysym_map[0x27] = Key::APOSTROPHE;
+ keysym_map[0x28] = Key::K;
+ keysym_map[0x29] = Key::SEMICOLON;
+ keysym_map[0x2a] = Key::BACKSLASH;
+ keysym_map[0x2b] = Key::COMMA;
+ keysym_map[0x2c] = Key::SLASH;
+ keysym_map[0x2d] = Key::N;
+ keysym_map[0x2e] = Key::M;
+ keysym_map[0x2f] = Key::PERIOD;
+ keysym_map[0x30] = Key::TAB;
+ keysym_map[0x31] = Key::SPACE;
+ keysym_map[0x32] = Key::QUOTELEFT;
+ keysym_map[0x33] = Key::BACKSPACE;
+ keysym_map[0x35] = Key::ESCAPE;
+ keysym_map[0x36] = Key::META;
+ keysym_map[0x37] = Key::META;
+ keysym_map[0x38] = Key::SHIFT;
+ keysym_map[0x39] = Key::CAPSLOCK;
+ keysym_map[0x3a] = Key::ALT;
+ keysym_map[0x3b] = Key::CTRL;
+ keysym_map[0x3c] = Key::SHIFT;
+ keysym_map[0x3d] = Key::ALT;
+ keysym_map[0x3e] = Key::CTRL;
+ keysym_map[0x40] = Key::F17;
+ keysym_map[0x41] = Key::KP_PERIOD;
+ keysym_map[0x43] = Key::KP_MULTIPLY;
+ keysym_map[0x45] = Key::KP_ADD;
+ keysym_map[0x47] = Key::NUMLOCK;
+ keysym_map[0x48] = Key::VOLUMEUP;
+ keysym_map[0x49] = Key::VOLUMEDOWN;
+ keysym_map[0x4a] = Key::VOLUMEMUTE;
+ keysym_map[0x4b] = Key::KP_DIVIDE;
+ keysym_map[0x4c] = Key::KP_ENTER;
+ keysym_map[0x4e] = Key::KP_SUBTRACT;
+ keysym_map[0x4f] = Key::F18;
+ keysym_map[0x50] = Key::F19;
+ keysym_map[0x51] = Key::EQUAL;
+ keysym_map[0x52] = Key::KP_0;
+ keysym_map[0x53] = Key::KP_1;
+ keysym_map[0x54] = Key::KP_2;
+ keysym_map[0x55] = Key::KP_3;
+ keysym_map[0x56] = Key::KP_4;
+ keysym_map[0x57] = Key::KP_5;
+ keysym_map[0x58] = Key::KP_6;
+ keysym_map[0x59] = Key::KP_7;
+ keysym_map[0x5a] = Key::F20;
+ keysym_map[0x5b] = Key::KP_8;
+ keysym_map[0x5c] = Key::KP_9;
+ keysym_map[0x5d] = Key::YEN;
+ keysym_map[0x5e] = Key::UNDERSCORE;
+ keysym_map[0x5f] = Key::COMMA;
+ keysym_map[0x60] = Key::F5;
+ keysym_map[0x61] = Key::F6;
+ keysym_map[0x62] = Key::F7;
+ keysym_map[0x63] = Key::F3;
+ keysym_map[0x64] = Key::F8;
+ keysym_map[0x65] = Key::F9;
+ keysym_map[0x66] = Key::JIS_EISU;
+ keysym_map[0x67] = Key::F11;
+ keysym_map[0x68] = Key::JIS_KANA;
+ keysym_map[0x69] = Key::F13;
+ keysym_map[0x6a] = Key::F16;
+ keysym_map[0x6b] = Key::F14;
+ keysym_map[0x6d] = Key::F10;
+ keysym_map[0x6e] = Key::MENU;
+ keysym_map[0x6f] = Key::F12;
+ keysym_map[0x71] = Key::F15;
+ keysym_map[0x72] = Key::INSERT;
+ keysym_map[0x73] = Key::HOME;
+ keysym_map[0x74] = Key::PAGEUP;
+ keysym_map[0x75] = Key::KEY_DELETE;
+ keysym_map[0x76] = Key::F4;
+ keysym_map[0x77] = Key::END;
+ keysym_map[0x78] = Key::F2;
+ keysym_map[0x79] = Key::PAGEDOWN;
+ keysym_map[0x7a] = Key::F1;
+ keysym_map[0x7b] = Key::LEFT;
+ keysym_map[0x7c] = Key::RIGHT;
+ keysym_map[0x7d] = Key::DOWN;
+ keysym_map[0x7e] = Key::UP;
+
+ for (const KeyValue<unsigned int, Key> &E : keysym_map) {
+ keysym_map_inv[E.value] = E.key;
}
- return false;
+
+ keycode_map[Key::ESCAPE] = 0x001B;
+ keycode_map[Key::TAB] = 0x0009;
+ keycode_map[Key::BACKTAB] = 0x007F;
+ keycode_map[Key::BACKSPACE] = 0x0008;
+ keycode_map[Key::ENTER] = 0x000D;
+ keycode_map[Key::INSERT] = NSInsertFunctionKey;
+ keycode_map[Key::KEY_DELETE] = 0x007F;
+ keycode_map[Key::PAUSE] = NSPauseFunctionKey;
+ keycode_map[Key::PRINT] = NSPrintScreenFunctionKey;
+ keycode_map[Key::SYSREQ] = NSSysReqFunctionKey;
+ keycode_map[Key::CLEAR] = NSClearLineFunctionKey;
+ keycode_map[Key::HOME] = 0x2196;
+ keycode_map[Key::END] = 0x2198;
+ keycode_map[Key::LEFT] = 0x001C;
+ keycode_map[Key::UP] = 0x001E;
+ keycode_map[Key::RIGHT] = 0x001D;
+ keycode_map[Key::DOWN] = 0x001F;
+ keycode_map[Key::PAGEUP] = 0x21DE;
+ keycode_map[Key::PAGEDOWN] = 0x21DF;
+ keycode_map[Key::NUMLOCK] = NSClearLineFunctionKey;
+ keycode_map[Key::SCROLLLOCK] = NSScrollLockFunctionKey;
+ keycode_map[Key::F1] = NSF1FunctionKey;
+ keycode_map[Key::F2] = NSF2FunctionKey;
+ keycode_map[Key::F3] = NSF3FunctionKey;
+ keycode_map[Key::F4] = NSF4FunctionKey;
+ keycode_map[Key::F5] = NSF5FunctionKey;
+ keycode_map[Key::F6] = NSF6FunctionKey;
+ keycode_map[Key::F7] = NSF7FunctionKey;
+ keycode_map[Key::F8] = NSF8FunctionKey;
+ keycode_map[Key::F9] = NSF9FunctionKey;
+ keycode_map[Key::F10] = NSF10FunctionKey;
+ keycode_map[Key::F11] = NSF11FunctionKey;
+ keycode_map[Key::F12] = NSF12FunctionKey;
+ keycode_map[Key::F13] = NSF13FunctionKey;
+ keycode_map[Key::F14] = NSF14FunctionKey;
+ keycode_map[Key::F15] = NSF15FunctionKey;
+ keycode_map[Key::F16] = NSF16FunctionKey;
+ keycode_map[Key::F17] = NSF17FunctionKey;
+ keycode_map[Key::F18] = NSF18FunctionKey;
+ keycode_map[Key::F19] = NSF19FunctionKey;
+ keycode_map[Key::F20] = NSF20FunctionKey;
+ keycode_map[Key::F21] = NSF21FunctionKey;
+ keycode_map[Key::F22] = NSF22FunctionKey;
+ keycode_map[Key::F23] = NSF23FunctionKey;
+ keycode_map[Key::F24] = NSF24FunctionKey;
+ keycode_map[Key::F25] = NSF25FunctionKey;
+ keycode_map[Key::F26] = NSF26FunctionKey;
+ keycode_map[Key::F27] = NSF27FunctionKey;
+ keycode_map[Key::F28] = NSF28FunctionKey;
+ keycode_map[Key::F29] = NSF29FunctionKey;
+ keycode_map[Key::F30] = NSF30FunctionKey;
+ keycode_map[Key::F31] = NSF31FunctionKey;
+ keycode_map[Key::F32] = NSF32FunctionKey;
+ keycode_map[Key::F33] = NSF33FunctionKey;
+ keycode_map[Key::F34] = NSF34FunctionKey;
+ keycode_map[Key::F35] = NSF35FunctionKey;
+ keycode_map[Key::MENU] = NSMenuFunctionKey;
+ keycode_map[Key::HELP] = NSHelpFunctionKey;
+ keycode_map[Key::STOP] = NSStopFunctionKey;
+ keycode_map[Key::LAUNCH0] = NSUserFunctionKey;
+ keycode_map[Key::SPACE] = 0x0020;
+ keycode_map[Key::EXCLAM] = '!';
+ keycode_map[Key::QUOTEDBL] = '\"';
+ keycode_map[Key::NUMBERSIGN] = '#';
+ keycode_map[Key::DOLLAR] = '$';
+ keycode_map[Key::PERCENT] = '\%';
+ keycode_map[Key::AMPERSAND] = '&';
+ keycode_map[Key::APOSTROPHE] = '\'';
+ keycode_map[Key::PARENLEFT] = '(';
+ keycode_map[Key::PARENRIGHT] = ')';
+ keycode_map[Key::ASTERISK] = '*';
+ keycode_map[Key::PLUS] = '+';
+ keycode_map[Key::COMMA] = ',';
+ keycode_map[Key::MINUS] = '-';
+ keycode_map[Key::PERIOD] = '.';
+ keycode_map[Key::SLASH] = '/';
+ keycode_map[Key::KEY_0] = '0';
+ keycode_map[Key::KEY_1] = '1';
+ keycode_map[Key::KEY_2] = '2';
+ keycode_map[Key::KEY_3] = '3';
+ keycode_map[Key::KEY_4] = '4';
+ keycode_map[Key::KEY_5] = '5';
+ keycode_map[Key::KEY_6] = '6';
+ keycode_map[Key::KEY_7] = '7';
+ keycode_map[Key::KEY_8] = '8';
+ keycode_map[Key::KEY_9] = '9';
+ keycode_map[Key::COLON] = ':';
+ keycode_map[Key::SEMICOLON] = ';';
+ keycode_map[Key::LESS] = '<';
+ keycode_map[Key::EQUAL] = '=';
+ keycode_map[Key::GREATER] = '>';
+ keycode_map[Key::QUESTION] = '?';
+ keycode_map[Key::AT] = '@';
+ keycode_map[Key::A] = 'a';
+ keycode_map[Key::B] = 'b';
+ keycode_map[Key::C] = 'c';
+ keycode_map[Key::D] = 'd';
+ keycode_map[Key::E] = 'e';
+ keycode_map[Key::F] = 'f';
+ keycode_map[Key::G] = 'g';
+ keycode_map[Key::H] = 'h';
+ keycode_map[Key::I] = 'i';
+ keycode_map[Key::J] = 'j';
+ keycode_map[Key::K] = 'k';
+ keycode_map[Key::L] = 'l';
+ keycode_map[Key::M] = 'm';
+ keycode_map[Key::N] = 'n';
+ keycode_map[Key::O] = 'o';
+ keycode_map[Key::P] = 'p';
+ keycode_map[Key::Q] = 'q';
+ keycode_map[Key::R] = 'r';
+ keycode_map[Key::S] = 's';
+ keycode_map[Key::T] = 't';
+ keycode_map[Key::U] = 'u';
+ keycode_map[Key::V] = 'v';
+ keycode_map[Key::W] = 'w';
+ keycode_map[Key::X] = 'x';
+ keycode_map[Key::Y] = 'y';
+ keycode_map[Key::Z] = 'z';
+ keycode_map[Key::BRACKETLEFT] = '[';
+ keycode_map[Key::BACKSLASH] = '\\';
+ keycode_map[Key::BRACKETRIGHT] = ']';
+ keycode_map[Key::ASCIICIRCUM] = '^';
+ keycode_map[Key::UNDERSCORE] = '_';
+ keycode_map[Key::QUOTELEFT] = '`';
+ keycode_map[Key::BRACELEFT] = '{';
+ keycode_map[Key::BAR] = '|';
+ keycode_map[Key::BRACERIGHT] = '}';
+ keycode_map[Key::ASCIITILDE] = '~';
}
-// Keyboard symbol translation table.
-static const Key _macos_to_godot_table[128] = {
- /* 00 */ Key::A,
- /* 01 */ Key::S,
- /* 02 */ Key::D,
- /* 03 */ Key::F,
- /* 04 */ Key::H,
- /* 05 */ Key::G,
- /* 06 */ Key::Z,
- /* 07 */ Key::X,
- /* 08 */ Key::C,
- /* 09 */ Key::V,
- /* 0a */ Key::SECTION, /* ISO Section */
- /* 0b */ Key::B,
- /* 0c */ Key::Q,
- /* 0d */ Key::W,
- /* 0e */ Key::E,
- /* 0f */ Key::R,
- /* 10 */ Key::Y,
- /* 11 */ Key::T,
- /* 12 */ Key::KEY_1,
- /* 13 */ Key::KEY_2,
- /* 14 */ Key::KEY_3,
- /* 15 */ Key::KEY_4,
- /* 16 */ Key::KEY_6,
- /* 17 */ Key::KEY_5,
- /* 18 */ Key::EQUAL,
- /* 19 */ Key::KEY_9,
- /* 1a */ Key::KEY_7,
- /* 1b */ Key::MINUS,
- /* 1c */ Key::KEY_8,
- /* 1d */ Key::KEY_0,
- /* 1e */ Key::BRACERIGHT,
- /* 1f */ Key::O,
- /* 20 */ Key::U,
- /* 21 */ Key::BRACELEFT,
- /* 22 */ Key::I,
- /* 23 */ Key::P,
- /* 24 */ Key::ENTER,
- /* 25 */ Key::L,
- /* 26 */ Key::J,
- /* 27 */ Key::APOSTROPHE,
- /* 28 */ Key::K,
- /* 29 */ Key::SEMICOLON,
- /* 2a */ Key::BACKSLASH,
- /* 2b */ Key::COMMA,
- /* 2c */ Key::SLASH,
- /* 2d */ Key::N,
- /* 2e */ Key::M,
- /* 2f */ Key::PERIOD,
- /* 30 */ Key::TAB,
- /* 31 */ Key::SPACE,
- /* 32 */ Key::QUOTELEFT,
- /* 33 */ Key::BACKSPACE,
- /* 34 */ Key::UNKNOWN,
- /* 35 */ Key::ESCAPE,
- /* 36 */ Key::META,
- /* 37 */ Key::META,
- /* 38 */ Key::SHIFT,
- /* 39 */ Key::CAPSLOCK,
- /* 3a */ Key::ALT,
- /* 3b */ Key::CTRL,
- /* 3c */ Key::SHIFT,
- /* 3d */ Key::ALT,
- /* 3e */ Key::CTRL,
- /* 3f */ Key::UNKNOWN, /* Function */
- /* 40 */ Key::F17,
- /* 41 */ Key::KP_PERIOD,
- /* 42 */ Key::UNKNOWN,
- /* 43 */ Key::KP_MULTIPLY,
- /* 44 */ Key::UNKNOWN,
- /* 45 */ Key::KP_ADD,
- /* 46 */ Key::UNKNOWN,
- /* 47 */ Key::NUMLOCK, /* Really KeypadClear... */
- /* 48 */ Key::VOLUMEUP, /* VolumeUp */
- /* 49 */ Key::VOLUMEDOWN, /* VolumeDown */
- /* 4a */ Key::VOLUMEMUTE, /* Mute */
- /* 4b */ Key::KP_DIVIDE,
- /* 4c */ Key::KP_ENTER,
- /* 4d */ Key::UNKNOWN,
- /* 4e */ Key::KP_SUBTRACT,
- /* 4f */ Key::F18,
- /* 50 */ Key::F19,
- /* 51 */ Key::EQUAL, /* KeypadEqual */
- /* 52 */ Key::KP_0,
- /* 53 */ Key::KP_1,
- /* 54 */ Key::KP_2,
- /* 55 */ Key::KP_3,
- /* 56 */ Key::KP_4,
- /* 57 */ Key::KP_5,
- /* 58 */ Key::KP_6,
- /* 59 */ Key::KP_7,
- /* 5a */ Key::F20,
- /* 5b */ Key::KP_8,
- /* 5c */ Key::KP_9,
- /* 5d */ Key::YEN, /* JIS Yen */
- /* 5e */ Key::UNDERSCORE, /* JIS Underscore */
- /* 5f */ Key::COMMA, /* JIS KeypadComma */
- /* 60 */ Key::F5,
- /* 61 */ Key::F6,
- /* 62 */ Key::F7,
- /* 63 */ Key::F3,
- /* 64 */ Key::F8,
- /* 65 */ Key::F9,
- /* 66 */ Key::UNKNOWN, /* JIS Eisu */
- /* 67 */ Key::F11,
- /* 68 */ Key::UNKNOWN, /* JIS Kana */
- /* 69 */ Key::F13,
- /* 6a */ Key::F16,
- /* 6b */ Key::F14,
- /* 6c */ Key::UNKNOWN,
- /* 6d */ Key::F10,
- /* 6e */ Key::MENU,
- /* 6f */ Key::F12,
- /* 70 */ Key::UNKNOWN,
- /* 71 */ Key::F15,
- /* 72 */ Key::INSERT, /* Really Help... */
- /* 73 */ Key::HOME,
- /* 74 */ Key::PAGEUP,
- /* 75 */ Key::KEY_DELETE,
- /* 76 */ Key::F4,
- /* 77 */ Key::END,
- /* 78 */ Key::F2,
- /* 79 */ Key::PAGEDOWN,
- /* 7a */ Key::F1,
- /* 7b */ Key::LEFT,
- /* 7c */ Key::RIGHT,
- /* 7d */ Key::DOWN,
- /* 7e */ Key::UP,
- /* 7f */ Key::UNKNOWN,
-};
+bool KeyMappingMacOS::is_numpad_key(unsigned int p_key) {
+ return numpad_keys.has(p_key);
+}
// Translates a OS X keycode to a Godot keycode.
-Key KeyMappingMacOS::translate_key(unsigned int key) {
- if (key >= 128) {
- return Key::UNKNOWN;
+Key KeyMappingMacOS::translate_key(unsigned int p_key) {
+ const Key *key = keysym_map.getptr(p_key);
+ if (key) {
+ return *key;
}
-
- return _macos_to_godot_table[key];
+ return Key::NONE;
}
// Translates a Godot keycode back to a macOS keycode.
-unsigned int KeyMappingMacOS::unmap_key(Key key) {
- for (int i = 0; i <= 126; i++) {
- if (_macos_to_godot_table[i] == key) {
- return i;
- }
+unsigned int KeyMappingMacOS::unmap_key(Key p_key) {
+ const unsigned int *key = keysym_map_inv.getptr(p_key);
+ if (key) {
+ return *key;
}
return 127;
}
-struct _KeyCodeMap {
- UniChar kchar;
- Key kcode;
-};
-
-static const _KeyCodeMap _keycodes[55] = {
- { '`', Key::QUOTELEFT },
- { '~', Key::ASCIITILDE },
- { '0', Key::KEY_0 },
- { '1', Key::KEY_1 },
- { '2', Key::KEY_2 },
- { '3', Key::KEY_3 },
- { '4', Key::KEY_4 },
- { '5', Key::KEY_5 },
- { '6', Key::KEY_6 },
- { '7', Key::KEY_7 },
- { '8', Key::KEY_8 },
- { '9', Key::KEY_9 },
- { '-', Key::MINUS },
- { '_', Key::UNDERSCORE },
- { '=', Key::EQUAL },
- { '+', Key::PLUS },
- { 'q', Key::Q },
- { 'w', Key::W },
- { 'e', Key::E },
- { 'r', Key::R },
- { 't', Key::T },
- { 'y', Key::Y },
- { 'u', Key::U },
- { 'i', Key::I },
- { 'o', Key::O },
- { 'p', Key::P },
- { '[', Key::BRACELEFT },
- { ']', Key::BRACERIGHT },
- { '{', Key::BRACELEFT },
- { '}', Key::BRACERIGHT },
- { 'a', Key::A },
- { 's', Key::S },
- { 'd', Key::D },
- { 'f', Key::F },
- { 'g', Key::G },
- { 'h', Key::H },
- { 'j', Key::J },
- { 'k', Key::K },
- { 'l', Key::L },
- { ';', Key::SEMICOLON },
- { ':', Key::COLON },
- { '\'', Key::APOSTROPHE },
- { '\"', Key::QUOTEDBL },
- { '\\', Key::BACKSLASH },
- { '#', Key::NUMBERSIGN },
- { 'z', Key::Z },
- { 'x', Key::X },
- { 'c', Key::C },
- { 'v', Key::V },
- { 'b', Key::B },
- { 'n', Key::N },
- { 'm', Key::M },
- { ',', Key::COMMA },
- { '.', Key::PERIOD },
- { '/', Key::SLASH }
-};
-
// Remap key according to current keyboard layout.
-Key KeyMappingMacOS::remap_key(unsigned int key, unsigned int state) {
- if (is_numpad_key(key)) {
- return translate_key(key);
+Key KeyMappingMacOS::remap_key(unsigned int p_key, unsigned int p_state, bool p_unicode) {
+ if (is_numpad_key(p_key)) {
+ return translate_key(p_key);
}
TISInputSourceRef current_keyboard = TISCopyCurrentKeyboardInputSource();
if (!current_keyboard) {
- return translate_key(key);
+ return translate_key(p_key);
}
CFDataRef layout_data = (CFDataRef)TISGetInputSourceProperty(current_keyboard, kTISPropertyUnicodeKeyLayoutData);
if (!layout_data) {
- return translate_key(key);
+ return translate_key(p_key);
}
const UCKeyboardLayout *keyboard_layout = (const UCKeyboardLayout *)CFDataGetBytePtr(layout_data);
+ String keysym;
UInt32 keys_down = 0;
- UniChar chars[4];
- UniCharCount real_length;
+ UniChar chars[256] = {};
+ UniCharCount real_length = 0;
OSStatus err = UCKeyTranslate(keyboard_layout,
- key,
+ p_key,
kUCKeyActionDisplay,
- (state >> 8) & 0xFF,
+ (p_unicode) ? 0 : (p_state >> 8) & 0xFF,
LMGetKbdType(),
kUCKeyTranslateNoDeadKeysBit,
&keys_down,
@@ -312,165 +380,26 @@ Key KeyMappingMacOS::remap_key(unsigned int key, unsigned int state) {
chars);
if (err != noErr) {
- return translate_key(key);
+ return translate_key(p_key);
}
- for (unsigned int i = 0; i < 55; i++) {
- if (_keycodes[i].kchar == chars[0]) {
- return _keycodes[i].kcode;
- }
+ keysym = String::utf16((char16_t *)chars, real_length);
+ if (keysym.is_empty()) {
+ return translate_key(p_key);
}
- return translate_key(key);
-}
-
-struct _KeyCodeText {
- Key code;
- char32_t text;
-};
-static const _KeyCodeText _native_keycodes[] = {
- /* clang-format off */
- {Key::ESCAPE ,0x001B},
- {Key::TAB ,0x0009},
- {Key::BACKTAB ,0x007F},
- {Key::BACKSPACE ,0x0008},
- {Key::ENTER ,0x000D},
- {Key::INSERT ,NSInsertFunctionKey},
- {Key::KEY_DELETE ,0x007F},
- {Key::PAUSE ,NSPauseFunctionKey},
- {Key::PRINT ,NSPrintScreenFunctionKey},
- {Key::SYSREQ ,NSSysReqFunctionKey},
- {Key::CLEAR ,NSClearLineFunctionKey},
- {Key::HOME ,0x2196},
- {Key::END ,0x2198},
- {Key::LEFT ,0x001C},
- {Key::UP ,0x001E},
- {Key::RIGHT ,0x001D},
- {Key::DOWN ,0x001F},
- {Key::PAGEUP ,0x21DE},
- {Key::PAGEDOWN ,0x21DF},
- {Key::NUMLOCK ,NSClearLineFunctionKey},
- {Key::SCROLLLOCK ,NSScrollLockFunctionKey},
- {Key::F1 ,NSF1FunctionKey},
- {Key::F2 ,NSF2FunctionKey},
- {Key::F3 ,NSF3FunctionKey},
- {Key::F4 ,NSF4FunctionKey},
- {Key::F5 ,NSF5FunctionKey},
- {Key::F6 ,NSF6FunctionKey},
- {Key::F7 ,NSF7FunctionKey},
- {Key::F8 ,NSF8FunctionKey},
- {Key::F9 ,NSF9FunctionKey},
- {Key::F10 ,NSF10FunctionKey},
- {Key::F11 ,NSF11FunctionKey},
- {Key::F12 ,NSF12FunctionKey},
- {Key::F13 ,NSF13FunctionKey},
- {Key::F14 ,NSF14FunctionKey},
- {Key::F15 ,NSF15FunctionKey},
- {Key::F16 ,NSF16FunctionKey},
- {Key::F17 ,NSF17FunctionKey},
- {Key::F18 ,NSF18FunctionKey},
- {Key::F19 ,NSF19FunctionKey},
- {Key::F20 ,NSF20FunctionKey},
- {Key::F21 ,NSF21FunctionKey},
- {Key::F22 ,NSF22FunctionKey},
- {Key::F23 ,NSF23FunctionKey},
- {Key::F24 ,NSF24FunctionKey},
- {Key::F25 ,NSF25FunctionKey},
- {Key::F26 ,NSF26FunctionKey},
- {Key::F27 ,NSF27FunctionKey},
- {Key::F28 ,NSF28FunctionKey},
- {Key::F29 ,NSF29FunctionKey},
- {Key::F30 ,NSF30FunctionKey},
- {Key::F31 ,NSF31FunctionKey},
- {Key::F32 ,NSF32FunctionKey},
- {Key::F33 ,NSF33FunctionKey},
- {Key::F34 ,NSF34FunctionKey},
- {Key::F35 ,NSF35FunctionKey},
- {Key::MENU ,NSMenuFunctionKey},
- {Key::HELP ,NSHelpFunctionKey},
- {Key::STOP ,NSStopFunctionKey},
- {Key::LAUNCH0 ,NSUserFunctionKey},
- {Key::SPACE ,0x0020},
- {Key::EXCLAM ,'!'},
- {Key::QUOTEDBL ,'\"'},
- {Key::NUMBERSIGN ,'#'},
- {Key::DOLLAR ,'$'},
- {Key::PERCENT ,'\%'},
- {Key::AMPERSAND ,'&'},
- {Key::APOSTROPHE ,'\''},
- {Key::PARENLEFT ,'('},
- {Key::PARENRIGHT ,')'},
- {Key::ASTERISK ,'*'},
- {Key::PLUS ,'+'},
- {Key::COMMA ,','},
- {Key::MINUS ,'-'},
- {Key::PERIOD ,'.'},
- {Key::SLASH ,'/'},
- {Key::KEY_0 ,'0'},
- {Key::KEY_1 ,'1'},
- {Key::KEY_2 ,'2'},
- {Key::KEY_3 ,'3'},
- {Key::KEY_4 ,'4'},
- {Key::KEY_5 ,'5'},
- {Key::KEY_6 ,'6'},
- {Key::KEY_7 ,'7'},
- {Key::KEY_8 ,'8'},
- {Key::KEY_9 ,'9'},
- {Key::COLON ,':'},
- {Key::SEMICOLON ,';'},
- {Key::LESS ,'<'},
- {Key::EQUAL ,'='},
- {Key::GREATER ,'>'},
- {Key::QUESTION ,'?'},
- {Key::AT ,'@'},
- {Key::A ,'a'},
- {Key::B ,'b'},
- {Key::C ,'c'},
- {Key::D ,'d'},
- {Key::E ,'e'},
- {Key::F ,'f'},
- {Key::G ,'g'},
- {Key::H ,'h'},
- {Key::I ,'i'},
- {Key::J ,'j'},
- {Key::K ,'k'},
- {Key::L ,'l'},
- {Key::M ,'m'},
- {Key::N ,'n'},
- {Key::O ,'o'},
- {Key::P ,'p'},
- {Key::Q ,'q'},
- {Key::R ,'r'},
- {Key::S ,'s'},
- {Key::T ,'t'},
- {Key::U ,'u'},
- {Key::V ,'v'},
- {Key::W ,'w'},
- {Key::X ,'x'},
- {Key::Y ,'y'},
- {Key::Z ,'z'},
- {Key::BRACKETLEFT ,'['},
- {Key::BACKSLASH ,'\\'},
- {Key::BRACKETRIGHT ,']'},
- {Key::ASCIICIRCUM ,'^'},
- {Key::UNDERSCORE ,'_'},
- {Key::QUOTELEFT ,'`'},
- {Key::BRACELEFT ,'{'},
- {Key::BAR ,'|'},
- {Key::BRACERIGHT ,'}'},
- {Key::ASCIITILDE ,'~'},
- {Key::NONE ,0x0000}
- /* clang-format on */
-};
+ char32_t c = keysym[0];
+ if (p_unicode) {
+ return fix_key_label(c, translate_key(p_key));
+ } else {
+ return fix_keycode(c, translate_key(p_key));
+ }
+}
String KeyMappingMacOS::keycode_get_native_string(Key p_keycode) {
- const _KeyCodeText *kct = &_native_keycodes[0];
-
- while (kct->text) {
- if (kct->code == p_keycode) {
- return String::chr(kct->text);
- }
- kct++;
+ const char32_t *key = keycode_map.getptr(p_keycode);
+ if (key) {
+ return String::chr(*key);
}
return String();
}
diff --git a/platform/web/api/web_tools_editor_plugin.cpp b/platform/web/api/web_tools_editor_plugin.cpp
index 7df9555b50..146a48db81 100644
--- a/platform/web/api/web_tools_editor_plugin.cpp
+++ b/platform/web/api/web_tools_editor_plugin.cpp
@@ -57,7 +57,7 @@ WebToolsEditorPlugin::WebToolsEditorPlugin() {
add_tool_menu_item("Download Project Source", callable_mp(this, &WebToolsEditorPlugin::_download_zip));
}
-void WebToolsEditorPlugin::_download_zip(Variant p_v) {
+void WebToolsEditorPlugin::_download_zip() {
if (!Engine::get_singleton() || !Engine::get_singleton()->is_editor_hint()) {
ERR_PRINT("Downloading the project as a ZIP archive is only available in Editor mode.");
return;
diff --git a/platform/web/api/web_tools_editor_plugin.h b/platform/web/api/web_tools_editor_plugin.h
index 72f4950b36..fc74899a58 100644
--- a/platform/web/api/web_tools_editor_plugin.h
+++ b/platform/web/api/web_tools_editor_plugin.h
@@ -41,7 +41,7 @@ class WebToolsEditorPlugin : public EditorPlugin {
private:
void _zip_file(String p_path, String p_base_path, zipFile p_zip);
void _zip_recursive(String p_path, String p_base_path, zipFile p_zip);
- void _download_zip(Variant p_v);
+ void _download_zip();
public:
static void initialize();
diff --git a/platform/web/display_server_web.cpp b/platform/web/display_server_web.cpp
index fdb9d107a7..d71fd60543 100644
--- a/platform/web/display_server_web.cpp
+++ b/platform/web/display_server_web.cpp
@@ -121,18 +121,25 @@ void DisplayServerWeb::key_callback(int p_pressed, int p_repeat, int p_modifiers
// Resume audio context after input in case autoplay was denied.
OS_Web::get_singleton()->resume_audio();
+ char32_t c = 0x00;
+ String unicode = String::utf8(key_event.key);
+ if (unicode.length() == 1) {
+ c = unicode[0];
+ }
+
+ Key keycode = dom_code2godot_scancode(key_event.code, key_event.key, false);
+ Key scancode = dom_code2godot_scancode(key_event.code, key_event.key, true);
+
Ref<InputEventKey> ev;
ev.instantiate();
ev->set_echo(p_repeat);
- ev->set_keycode(dom_code2godot_scancode(key_event.code, key_event.key, false));
- ev->set_physical_keycode(dom_code2godot_scancode(key_event.code, key_event.key, true));
+ ev->set_keycode(fix_keycode(c, keycode));
+ ev->set_physical_keycode(scancode);
+ ev->set_key_label(fix_key_label(c, keycode));
+ ev->set_unicode(fix_unicode(c));
ev->set_pressed(p_pressed);
dom2godot_mod(ev, p_modifiers);
- String unicode = String::utf8(key_event.key);
- if (unicode.length() == 1) {
- ev->set_unicode(unicode[0]);
- }
Input::get_singleton()->parse_input_event(ev);
// Make sure to flush all events so we can call restricted APIs inside the event.
diff --git a/platform/web/dom_keys.inc b/platform/web/dom_keys.inc
index 5f8d921bfb..e63bd7c69f 100644
--- a/platform/web/dom_keys.inc
+++ b/platform/web/dom_keys.inc
@@ -32,9 +32,9 @@
// See https://w3c.github.io/uievents-code/#code-value-tables
Key dom_code2godot_scancode(EM_UTF8 const p_code[32], EM_UTF8 const p_key[32], bool p_physical) {
-#define DOM2GODOT(p_str, p_godot_code) \
- if (memcmp((const void *)p_str, (void *)p_code, strlen(p_str) + 1) == 0) { \
- return Key::p_godot_code; \
+#define DOM2GODOT(p_str, p_godot_code) \
+ if (memcmp((const void *)p_str, (void *)(p_physical ? p_key : p_code), strlen(p_str) + 1) == 0) { \
+ return Key::p_godot_code; \
}
// Numpad section.
@@ -70,35 +70,6 @@ Key dom_code2godot_scancode(EM_UTF8 const p_code[32], EM_UTF8 const p_key[32], b
DOM2GODOT("NumpadStar", KP_MULTIPLY); // or ASTERISK ?
DOM2GODOT("NumpadSubtract", KP_SUBTRACT);
- // Printable ASCII.
- if (!p_physical) {
- uint8_t b0 = (uint8_t)p_key[0];
- uint8_t b1 = (uint8_t)p_key[1];
- uint8_t b2 = (uint8_t)p_key[2];
- if (b1 == 0 && b0 > 0x1F && b0 < 0x7F) { // ASCII.
- if (b0 > 0x60 && b0 < 0x7B) { // Lowercase ASCII.
- b0 -= 32;
- }
- return (Key)b0;
- }
-
-#define _U_2BYTES_MASK 0xE0
-#define _U_2BYTES 0xC0
- // Latin-1 codes.
- if (b2 == 0 && (b0 & _U_2BYTES_MASK) == _U_2BYTES) { // 2-bytes utf8, only known latin.
- uint32_t key = ((b0 & ~_U_2BYTES_MASK) << 6) | (b1 & 0x3F);
- if (key >= 0xA0 && key <= 0xDF) {
- return (Key)key;
- }
- if (key >= 0xE0 && key <= 0xFF) { // Lowercase known latin.
- key -= 0x20;
- return (Key)key;
- }
- }
-#undef _U_2BYTES_MASK
-#undef _U_2BYTES
- }
-
// Alphanumeric section.
DOM2GODOT("Backquote", QUOTELEFT);
DOM2GODOT("Backslash", BACKSLASH);
@@ -162,8 +133,8 @@ Key dom_code2godot_scancode(EM_UTF8 const p_code[32], EM_UTF8 const p_key[32], b
DOM2GODOT("ControlLeft", CTRL);
DOM2GODOT("ControlRight", CTRL);
DOM2GODOT("Enter", ENTER);
- DOM2GODOT("MetaLeft", SUPER_L);
- DOM2GODOT("MetaRight", SUPER_R);
+ DOM2GODOT("MetaLeft", META);
+ DOM2GODOT("MetaRight", META);
DOM2GODOT("ShiftLeft", SHIFT);
DOM2GODOT("ShiftRight", SHIFT);
DOM2GODOT("Space", SPACE);
@@ -227,6 +198,21 @@ Key dom_code2godot_scancode(EM_UTF8 const p_code[32], EM_UTF8 const p_key[32], b
DOM2GODOT("AudioVolumeMute", VOLUMEMUTE);
DOM2GODOT("AudioVolumeUp", VOLUMEUP);
//DOM2GODOT("WakeUp", UNKNOWN);
- return Key::UNKNOWN;
+
+ // Printable ASCII.
+ uint8_t b0 = (uint8_t)p_key[0];
+ uint8_t b1 = (uint8_t)p_key[1];
+ if (b0 >= 0x20 && b0 < 0x7F) { // ASCII.
+ if (b0 > 0x60 && b0 < 0x7B) { // Lowercase ASCII.
+ b0 -= 32;
+ }
+ return (Key)b0;
+ } else if (b0 == 0xC2 && b1 == 0xA5) {
+ return Key::YEN;
+ } else if (b0 == 0xC2 && b1 == 0xA7) {
+ return Key::SECTION;
+ }
+
+ return Key::NONE;
#undef DOM2GODOT
}
diff --git a/platform/web/export/editor_http_server.h b/platform/web/export/editor_http_server.h
index ce6b0be713..3f87288537 100644
--- a/platform/web/export/editor_http_server.h
+++ b/platform/web/export/editor_http_server.h
@@ -205,8 +205,7 @@ public:
if (tls.is_null()) {
tls = Ref<StreamPeerTLS>(StreamPeerTLS::create());
peer = tls;
- tls->set_blocking_handshake_enabled(false);
- if (tls->accept_stream(tcp, key, cert) != OK) {
+ if (tls->accept_stream(tcp, TLSOptions::server(key, cert)) != OK) {
_clear_client();
return;
}
diff --git a/platform/web/http_client_web.cpp b/platform/web/http_client_web.cpp
index 31f54dad9f..3e4ba5a2ae 100644
--- a/platform/web/http_client_web.cpp
+++ b/platform/web/http_client_web.cpp
@@ -37,20 +37,20 @@ void HTTPClientWeb::_parse_headers(int p_len, const char **p_headers, void *p_re
}
}
-Error HTTPClientWeb::connect_to_host(const String &p_host, int p_port, bool p_tls, bool p_verify_host) {
+Error HTTPClientWeb::connect_to_host(const String &p_host, int p_port, Ref<TLSOptions> p_tls_options) {
+ ERR_FAIL_COND_V(p_tls_options.is_valid() && p_tls_options->is_server(), ERR_INVALID_PARAMETER);
+
close();
- if (p_tls && !p_verify_host) {
- WARN_PRINT("Disabling HTTPClientWeb's host verification is not supported for the Web platform, host will be verified");
- }
port = p_port;
- use_tls = p_tls;
+ use_tls = p_tls_options.is_valid();
host = p_host;
String host_lower = host.to_lower();
if (host_lower.begins_with("http://")) {
host = host.substr(7, host.length() - 7);
+ use_tls = false;
} else if (host_lower.begins_with("https://")) {
use_tls = true;
host = host.substr(8, host.length() - 8);
diff --git a/platform/web/http_client_web.h b/platform/web/http_client_web.h
index 993ec6c0e2..def7837a27 100644
--- a/platform/web/http_client_web.h
+++ b/platform/web/http_client_web.h
@@ -86,7 +86,7 @@ public:
Error request(Method p_method, const String &p_url, const Vector<String> &p_headers, const uint8_t *p_body, int p_body_size) override;
- Error connect_to_host(const String &p_host, int p_port = -1, bool p_tls = false, bool p_verify_host = true) override;
+ Error connect_to_host(const String &p_host, int p_port = -1, Ref<TLSOptions> p_tls_options = Ref<TLSOptions>()) override;
void set_connection(const Ref<StreamPeer> &p_connection) override;
Ref<StreamPeer> get_connection() const override;
void close() override;
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 631543763b..cc230575c8 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -991,15 +991,6 @@ void DisplayServerWindows::window_set_current_screen(int p_screen, WindowID p_wi
wpos.y = CLAMP(wpos.y, srect.position.y, srect.position.y + srect.size.height - wsize.height / 3);
window_set_position(wpos, p_window);
}
-
- // Don't let the mouse leave the window when resizing to a smaller resolution.
- if (mouse_mode == MOUSE_MODE_CONFINED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN) {
- RECT crect;
- GetClientRect(wd.hWnd, &crect);
- ClientToScreen(wd.hWnd, (POINT *)&crect.left);
- ClientToScreen(wd.hWnd, (POINT *)&crect.right);
- ClipCursor(&crect);
- }
}
Point2i DisplayServerWindows::window_get_position(WindowID p_window) const {
@@ -1077,15 +1068,6 @@ void DisplayServerWindows::window_set_position(const Point2i &p_position, Window
AdjustWindowRectEx(&rc, style, false, exStyle);
MoveWindow(wd.hWnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE);
- // Don't let the mouse leave the window when moved.
- if (mouse_mode == MOUSE_MODE_CONFINED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN) {
- RECT rect;
- GetClientRect(wd.hWnd, &rect);
- ClientToScreen(wd.hWnd, (POINT *)&rect.left);
- ClientToScreen(wd.hWnd, (POINT *)&rect.right);
- ClipCursor(&rect);
- }
-
wd.last_pos = p_position;
_update_real_mouse_position(p_window);
}
@@ -1227,15 +1209,6 @@ void DisplayServerWindows::window_set_size(const Size2i p_size, WindowID p_windo
}
MoveWindow(wd.hWnd, rect.left, rect.top, w, h, TRUE);
-
- // Don't let the mouse leave the window when resizing to a smaller resolution.
- if (mouse_mode == MOUSE_MODE_CONFINED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN) {
- RECT crect;
- GetClientRect(wd.hWnd, &crect);
- ClientToScreen(wd.hWnd, (POINT *)&crect.left);
- ClientToScreen(wd.hWnd, (POINT *)&crect.right);
- ClipCursor(&crect);
- }
}
Size2i DisplayServerWindows::window_get_size(WindowID p_window) const {
@@ -1423,15 +1396,6 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window)
SystemParametersInfoA(SPI_SETMOUSETRAILS, 0, 0, 0);
}
}
-
- // Don't let the mouse leave the window when resizing to a smaller resolution.
- if (mouse_mode == MOUSE_MODE_CONFINED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN) {
- RECT crect;
- GetClientRect(wd.hWnd, &crect);
- ClientToScreen(wd.hWnd, (POINT *)&crect.left);
- ClientToScreen(wd.hWnd, (POINT *)&crect.right);
- ClipCursor(&crect);
- }
}
DisplayServer::WindowMode DisplayServerWindows::window_get_mode(WindowID p_window) const {
@@ -1610,6 +1574,58 @@ bool DisplayServerWindows::can_any_window_draw() const {
return false;
}
+Vector2i DisplayServerWindows::ime_get_selection() const {
+ _THREAD_SAFE_METHOD_
+
+ DisplayServer::WindowID window_id = _get_focused_window_or_popup();
+ const WindowData &wd = windows[window_id];
+ if (!wd.ime_active) {
+ return Vector2i();
+ }
+
+ int cursor = ImmGetCompositionStringW(wd.im_himc, GCS_CURSORPOS, nullptr, 0);
+
+ int32_t length = ImmGetCompositionStringW(wd.im_himc, GCS_COMPSTR, nullptr, 0);
+ wchar_t *string = reinterpret_cast<wchar_t *>(memalloc(length));
+ ImmGetCompositionStringW(wd.im_himc, GCS_COMPSTR, string, length);
+
+ int32_t utf32_cursor = 0;
+ for (int32_t i = 0; i < length / int32_t(sizeof(wchar_t)); i++) {
+ if ((string[i] & 0xfffffc00) == 0xd800) {
+ i++;
+ }
+ if (i < cursor) {
+ utf32_cursor++;
+ } else {
+ break;
+ }
+ }
+
+ memdelete(string);
+
+ return Vector2i(utf32_cursor, 0);
+}
+
+String DisplayServerWindows::ime_get_text() const {
+ _THREAD_SAFE_METHOD_
+
+ DisplayServer::WindowID window_id = _get_focused_window_or_popup();
+ const WindowData &wd = windows[window_id];
+ if (!wd.ime_active) {
+ return String();
+ }
+
+ String ret;
+ int32_t length = ImmGetCompositionStringW(wd.im_himc, GCS_COMPSTR, nullptr, 0);
+ wchar_t *string = reinterpret_cast<wchar_t *>(memalloc(length));
+ ImmGetCompositionStringW(wd.im_himc, GCS_COMPSTR, string, length);
+ ret.parse_utf16((char16_t *)string, length / sizeof(wchar_t));
+
+ memdelete(string);
+
+ return ret;
+}
+
void DisplayServerWindows::window_set_ime_active(const bool p_active, WindowID p_window) {
_THREAD_SAFE_METHOD_
@@ -1617,11 +1633,14 @@ void DisplayServerWindows::window_set_ime_active(const bool p_active, WindowID p
WindowData &wd = windows[p_window];
if (p_active) {
+ wd.ime_active = true;
ImmAssociateContext(wd.hWnd, wd.im_himc);
-
+ CreateCaret(wd.hWnd, NULL, 1, 1);
window_set_ime_position(wd.im_position, p_window);
} else {
ImmAssociateContext(wd.hWnd, (HIMC)0);
+ DestroyCaret();
+ wd.ime_active = false;
}
}
@@ -1639,7 +1658,7 @@ void DisplayServerWindows::window_set_ime_position(const Point2i &p_pos, WindowI
}
COMPOSITIONFORM cps;
- cps.dwStyle = CFS_FORCE_POSITION;
+ cps.dwStyle = CFS_POINT;
cps.ptCurrentPos.x = wd.im_position.x;
cps.ptCurrentPos.y = wd.im_position.y;
ImmSetCompositionWindow(himc, &cps);
@@ -3326,6 +3345,15 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
Callable::CallError ce;
window.rect_changed_callback.callp(args, 1, ret, ce);
}
+
+ // Update cursor clip region after window rect has changed.
+ if (mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN) {
+ RECT crect;
+ GetClientRect(window.hWnd, &crect);
+ ClientToScreen(window.hWnd, (POINT *)&crect.left);
+ ClientToScreen(window.hWnd, (POINT *)&crect.right);
+ ClipCursor(&crect);
+ }
}
// Return here to prevent WM_MOVE and WM_SIZE from being sent
@@ -3353,10 +3381,18 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
windows[window_id].focus_timer_id = 0U;
}
} break;
- case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
case WM_KEYUP:
+ if (windows[window_id].ime_suppress_next_keyup) {
+ windows[window_id].ime_suppress_next_keyup = false;
+ break;
+ }
+ [[fallthrough]];
+ case WM_SYSKEYDOWN:
case WM_KEYDOWN: {
+ if (windows[window_id].ime_in_progress) {
+ break;
+ }
if (wParam == VK_SHIFT) {
shift_mem = (uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN);
}
@@ -3402,9 +3438,49 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
key_event_buffer[key_event_pos++] = ke;
} break;
+ case WM_IME_COMPOSITION: {
+ CANDIDATEFORM cf;
+ cf.dwIndex = 0;
+
+ cf.dwStyle = CFS_CANDIDATEPOS;
+ cf.ptCurrentPos.x = windows[window_id].im_position.x;
+ cf.ptCurrentPos.y = windows[window_id].im_position.y;
+ ImmSetCandidateWindow(windows[window_id].im_himc, &cf);
+
+ cf.dwStyle = CFS_EXCLUDE;
+ cf.rcArea.left = windows[window_id].im_position.x;
+ cf.rcArea.right = windows[window_id].im_position.x;
+ cf.rcArea.top = windows[window_id].im_position.y;
+ cf.rcArea.bottom = windows[window_id].im_position.y;
+ ImmSetCandidateWindow(windows[window_id].im_himc, &cf);
+
+ if (windows[window_id].ime_active) {
+ SetCaretPos(windows[window_id].im_position.x, windows[window_id].im_position.y);
+ OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_OS_IME_UPDATE);
+ }
+ } break;
case WM_INPUTLANGCHANGEREQUEST: {
// FIXME: Do something?
} break;
+ case WM_IME_STARTCOMPOSITION: {
+ if (windows[window_id].ime_active) {
+ windows[window_id].ime_in_progress = true;
+ if (key_event_pos > 0) {
+ key_event_pos--;
+ }
+ }
+ return 0;
+ } break;
+ case WM_IME_ENDCOMPOSITION: {
+ if (windows[window_id].ime_active) {
+ windows[window_id].ime_in_progress = false;
+ windows[window_id].ime_suppress_next_keyup = true;
+ }
+ return 0;
+ } break;
+ case WM_IME_NOTIFY: {
+ return 0;
+ } break;
case WM_TOUCH: {
BOOL bHandled = FALSE;
UINT cInputs = LOWORD(wParam);
@@ -3513,6 +3589,7 @@ void DisplayServerWindows::_process_activate_event(WindowID p_window_id, WPARAM
alt_mem = false;
control_mem = false;
shift_mem = false;
+ gr_mem = false;
// Restore mouse mode.
_set_mouse_mode_impl(mouse_mode);
@@ -3556,24 +3633,36 @@ void DisplayServerWindows::_process_key_events() {
Ref<InputEventKey> k;
k.instantiate();
+ Key keycode = KeyMappingWindows::get_keysym(MapVirtualKey((ke.lParam >> 16) & 0xFF, MAPVK_VSC_TO_VK));
+ Key key_label = keycode;
+ Key physical_keycode = KeyMappingWindows::get_scansym((ke.lParam >> 16) & 0xFF, ke.lParam & (1 << 24));
+
+ static BYTE keyboard_state[256];
+ memset(keyboard_state, 0, 256);
+ wchar_t chars[256] = {};
+ UINT extended_code = MapVirtualKey((ke.lParam >> 16) & 0xFF, MAPVK_VSC_TO_VK_EX);
+ if (!(ke.lParam & (1 << 24)) && ToUnicodeEx(extended_code, (ke.lParam >> 16) & 0xFF, keyboard_state, chars, 255, 4, GetKeyboardLayout(0)) > 0) {
+ String keysym = String::utf16((char16_t *)chars, 255);
+ if (!keysym.is_empty()) {
+ key_label = fix_key_label(keysym[0], keycode);
+ }
+ }
+
k->set_window_id(ke.window_id);
k->set_shift_pressed(ke.shift);
k->set_alt_pressed(ke.alt);
k->set_ctrl_pressed(ke.control);
k->set_meta_pressed(ke.meta);
k->set_pressed(true);
- k->set_keycode((Key)KeyMappingWindows::get_keysym(MapVirtualKey((ke.lParam >> 16) & 0xFF, MAPVK_VSC_TO_VK)));
- k->set_physical_keycode((Key)(KeyMappingWindows::get_scansym((ke.lParam >> 16) & 0xFF, ke.lParam & (1 << 24))));
- k->set_unicode(unicode);
+ k->set_keycode(keycode);
+ k->set_physical_keycode(physical_keycode);
+ k->set_key_label(key_label);
+ k->set_unicode(fix_unicode(unicode));
if (k->get_unicode() && gr_mem) {
k->set_alt_pressed(false);
k->set_ctrl_pressed(false);
}
- if (k->get_unicode() < 32) {
- k->set_unicode(0);
- }
-
Input::get_singleton()->parse_input_event(k);
} else {
// Do nothing.
@@ -3592,14 +3681,28 @@ void DisplayServerWindows::_process_key_events() {
k->set_pressed(ke.uMsg == WM_KEYDOWN);
+ Key keycode = KeyMappingWindows::get_keysym(ke.wParam);
if ((ke.lParam & (1 << 24)) && (ke.wParam == VK_RETURN)) {
// Special case for Numpad Enter key.
- k->set_keycode(Key::KP_ENTER);
- } else {
- k->set_keycode((Key)KeyMappingWindows::get_keysym(ke.wParam));
+ keycode = Key::KP_ENTER;
+ }
+ Key key_label = keycode;
+ Key physical_keycode = KeyMappingWindows::get_scansym((ke.lParam >> 16) & 0xFF, ke.lParam & (1 << 24));
+
+ static BYTE keyboard_state[256];
+ memset(keyboard_state, 0, 256);
+ wchar_t chars[256] = {};
+ UINT extended_code = MapVirtualKey((ke.lParam >> 16) & 0xFF, MAPVK_VSC_TO_VK_EX);
+ if (!(ke.lParam & (1 << 24)) && ToUnicodeEx(extended_code, (ke.lParam >> 16) & 0xFF, keyboard_state, chars, 255, 4, GetKeyboardLayout(0)) > 0) {
+ String keysym = String::utf16((char16_t *)chars, 255);
+ if (!keysym.is_empty()) {
+ key_label = fix_key_label(keysym[0], keycode);
+ }
}
- k->set_physical_keycode((Key)(KeyMappingWindows::get_scansym((ke.lParam >> 16) & 0xFF, ke.lParam & (1 << 24))));
+ k->set_keycode(keycode);
+ k->set_physical_keycode(physical_keycode);
+ k->set_key_label(key_label);
if (i + 1 < key_event_pos && key_event_buffer[i + 1].uMsg == WM_CHAR) {
char32_t unicode = key_event_buffer[i + 1].wParam;
@@ -3620,17 +3723,13 @@ void DisplayServerWindows::_process_key_events() {
} else {
prev_wck = 0;
}
- k->set_unicode(unicode);
+ k->set_unicode(fix_unicode(unicode));
}
if (k->get_unicode() && gr_mem) {
k->set_alt_pressed(false);
k->set_ctrl_pressed(false);
}
- if (k->get_unicode() < 32) {
- k->set_unicode(0);
- }
-
k->set_echo((ke.uMsg == WM_KEYDOWN && (ke.lParam & (1 << 30))));
Input::get_singleton()->parse_input_event(k);
@@ -3841,7 +3940,7 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode,
// IME.
wd.im_himc = ImmGetContext(wd.hWnd);
- ImmReleaseContext(wd.hWnd, wd.im_himc);
+ ImmAssociateContext(wd.hWnd, (HIMC)0);
wd.im_position = Vector2();
@@ -3935,6 +4034,8 @@ void DisplayServerWindows::tablet_set_current_driver(const String &p_driver) {
}
DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Error &r_error) {
+ KeyMappingWindows::initialize();
+
drop_events = false;
key_event_pos = 0;
@@ -4042,7 +4143,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
wc.lpszClassName = L"Engine";
if (!RegisterClassExW(&wc)) {
- MessageBox(nullptr, "Failed To Register The Window Class.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
+ MessageBoxW(nullptr, L"Failed To Register The Window Class.", L"ERROR", MB_OK | MB_ICONEXCLAMATION);
r_error = ERR_UNAVAILABLE;
return;
}
@@ -4121,7 +4222,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
// from making the system unresponsive.
SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS);
DWORD index = 0;
- HANDLE handle = AvSetMmThreadCharacteristics("Games", &index);
+ HANDLE handle = AvSetMmThreadCharacteristicsW(L"Games", &index);
if (handle) {
AvSetMmThreadPriority(handle, AVRT_PRIORITY_CRITICAL);
}
diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h
index ce4b94af59..0d2137d048 100644
--- a/platform/windows/display_server_windows.h
+++ b/platform/windows/display_server_windows.h
@@ -405,6 +405,9 @@ class DisplayServerWindows : public DisplayServer {
// IME
HIMC im_himc;
Vector2 im_position;
+ bool ime_active = false;
+ bool ime_in_progress = false;
+ bool ime_suppress_next_keyup = false;
bool layered_window = false;
@@ -592,6 +595,9 @@ public:
virtual void window_set_ime_active(const bool p_active, WindowID p_window = MAIN_WINDOW_ID) override;
virtual void window_set_ime_position(const Point2i &p_pos, WindowID p_window = MAIN_WINDOW_ID) override;
+ virtual Point2i ime_get_selection() const override;
+ virtual String ime_get_text() const override;
+
virtual void window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window = MAIN_WINDOW_ID) override;
virtual DisplayServer::VSyncMode window_get_vsync_mode(WindowID p_vsync_mode) const override;
diff --git a/platform/windows/export/export_plugin.cpp b/platform/windows/export/export_plugin.cpp
index bf32b16018..4107a8a17e 100644
--- a/platform/windows/export/export_plugin.cpp
+++ b/platform/windows/export/export_plugin.cpp
@@ -831,8 +831,8 @@ Error EditorExportPlatformWindows::run(const Ref<EditorExportPreset> &p_preset,
if (port.is_empty()) {
port = "22";
}
- Vector<String> extra_args_ssh = p_preset->get("ssh_remote_deploy/extra_args_ssh").operator String().split(" ");
- Vector<String> extra_args_scp = p_preset->get("ssh_remote_deploy/extra_args_scp").operator String().split(" ");
+ Vector<String> extra_args_ssh = p_preset->get("ssh_remote_deploy/extra_args_ssh").operator String().split(" ", false);
+ Vector<String> extra_args_scp = p_preset->get("ssh_remote_deploy/extra_args_scp").operator String().split(" ", false);
const String basepath = dest.path_join("tmp_windows_export");
diff --git a/platform/windows/gl_manager_windows.h b/platform/windows/gl_manager_windows.h
index b97d0f667c..361c559a5a 100644
--- a/platform/windows/gl_manager_windows.h
+++ b/platform/windows/gl_manager_windows.h
@@ -74,7 +74,6 @@ private:
GLWindow *_current_window = nullptr;
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = nullptr;
- PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT = nullptr;
// funcs
void _internal_set_current_window(GLWindow *p_win);
diff --git a/platform/windows/joypad_windows.cpp b/platform/windows/joypad_windows.cpp
index 183958cf40..7ae26e6cf4 100644
--- a/platform/windows/joypad_windows.cpp
+++ b/platform/windows/joypad_windows.cpp
@@ -101,10 +101,12 @@ bool JoypadWindows::is_xinput_device(const GUID *p_guid) {
static GUID IID_ValveStreamingGamepad = { MAKELONG(0x28DE, 0x11FF), 0x28DE, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
static GUID IID_X360WiredGamepad = { MAKELONG(0x045E, 0x02A1), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
static GUID IID_X360WirelessGamepad = { MAKELONG(0x045E, 0x028E), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
+ static GUID IID_XSWirelessGamepad = { MAKELONG(0x045E, 0x0B13), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
if (memcmp(p_guid, &IID_ValveStreamingGamepad, sizeof(*p_guid)) == 0 ||
memcmp(p_guid, &IID_X360WiredGamepad, sizeof(*p_guid)) == 0 ||
- memcmp(p_guid, &IID_X360WirelessGamepad, sizeof(*p_guid)) == 0)
+ memcmp(p_guid, &IID_X360WirelessGamepad, sizeof(*p_guid)) == 0 ||
+ memcmp(p_guid, &IID_XSWirelessGamepad, sizeof(*p_guid)) == 0)
return true;
PRAWINPUTDEVICELIST dev_list = nullptr;
diff --git a/platform/windows/key_mapping_windows.cpp b/platform/windows/key_mapping_windows.cpp
index 86471f188f..d43f74126d 100644
--- a/platform/windows/key_mapping_windows.cpp
+++ b/platform/windows/key_mapping_windows.cpp
@@ -30,490 +30,386 @@
#include "key_mapping_windows.h"
-#include <stdio.h>
+#include "core/templates/hash_map.h"
// This provides translation from Windows virtual key codes to Godot and back.
// See WinUser.h and the below for documentation:
// https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
-struct _WinTranslatePair {
- Key keysym;
- unsigned int keycode;
+struct HashMapHasherKeys {
+ static _FORCE_INLINE_ uint32_t hash(const Key p_key) { return hash_fmix32(static_cast<uint32_t>(p_key)); }
+ static _FORCE_INLINE_ uint32_t hash(const char32_t p_uchar) { return hash_fmix32(p_uchar); }
+ static _FORCE_INLINE_ uint32_t hash(const unsigned p_key) { return hash_fmix32(p_key); }
};
-static _WinTranslatePair _vk_to_keycode[] = {
+HashMap<unsigned int, Key, HashMapHasherKeys> vk_map;
+HashMap<unsigned int, Key, HashMapHasherKeys> scansym_map;
+HashMap<Key, unsigned int, HashMapHasherKeys> scansym_map_inv;
+HashMap<unsigned int, Key, HashMapHasherKeys> scansym_map_ext;
+
+void KeyMappingWindows::initialize() {
// VK_LBUTTON (0x01)
// VK_RBUTTON (0x02)
// VK_CANCEL (0x03)
// VK_MBUTTON (0x04)
// VK_XBUTTON1 (0x05)
- // VK_XBUTTON2 (0x06)
- // We have no mappings for the above, as we only map keyboard buttons here.
-
+ // VK_XBUTTON2 (0x06), We have no mappings for the above;as we only map keyboard buttons here.
// 0x07 is undefined.
-
- { Key::BACKSPACE, VK_BACK }, // (0x08)
- { Key::TAB, VK_TAB }, // (0x09)
-
+ vk_map[VK_BACK] = Key::BACKSPACE; // (0x08)
+ vk_map[VK_TAB] = Key::TAB; // (0x09)
// 0x0A-0B are reserved.
-
- { Key::CLEAR, VK_CLEAR }, // (0x0C)
- { Key::ENTER, VK_RETURN }, // (0x0D)
-
+ vk_map[VK_CLEAR] = Key::CLEAR; // (0x0C)
+ vk_map[VK_RETURN] = Key::ENTER; // (0x0D)
// 0x0E-0F are undefined.
-
- { Key::SHIFT, VK_SHIFT }, // (0x10)
- { Key::CTRL, VK_CONTROL }, // (0x11)
- { Key::ALT, VK_MENU }, // (0x12)
- { Key::PAUSE, VK_PAUSE }, // (0x13)
- { Key::CAPSLOCK, VK_CAPITAL }, // (0x14)
-
- // 0x15-1A are IME keys. We have no mapping.
-
- { Key::ESCAPE, VK_ESCAPE }, // (0x1B)
-
- // 0x1C-1F are IME keys. We have no mapping.
-
- { Key::SPACE, VK_SPACE }, // (0x20)
- { Key::PAGEUP, VK_PRIOR }, // (0x21)
- { Key::PAGEDOWN, VK_NEXT }, // (0x22)
- { Key::END, VK_END }, // (0x23)
- { Key::HOME, VK_HOME }, // (0x24)
- { Key::LEFT, VK_LEFT }, // (0x25)
- { Key::UP, VK_UP }, // (0x26)
- { Key::RIGHT, VK_RIGHT }, // (0x27)
- { Key::DOWN, VK_DOWN }, // (0x28)
-
- // VK_SELECT (0x29)
- // Old select key, e.g. on Digital Equipment Corporation keyboards.
- // Old and uncommon, we have no mapping.
-
- { Key::PRINT, VK_PRINT }, // (0x2A)
- // Old IBM key, modern keyboards use VK_SNAPSHOT. Map to VK_SNAPSHOT.
-
- // VK_EXECUTE (0x2B)
- // Old and uncommon, we have no mapping.
-
- { Key::PRINT, VK_SNAPSHOT }, // (0x2C)
- { Key::INSERT, VK_INSERT }, // (0x2D)
- { Key::KEY_DELETE, VK_DELETE }, // (0x2E)
-
- { Key::HELP, VK_HELP }, // (0x2F)
- // Old and uncommon, but we have a mapping.
-
- { Key::KEY_0, (0x30) }, // 0 key.
- { Key::KEY_1, (0x31) }, // 1 key.
- { Key::KEY_2, (0x32) }, // 2 key.
- { Key::KEY_3, (0x33) }, // 3 key.
- { Key::KEY_4, (0x34) }, // 4 key.
- { Key::KEY_5, (0x35) }, // 5 key.
- { Key::KEY_6, (0x36) }, // 6 key.
- { Key::KEY_7, (0x37) }, // 7 key.
- { Key::KEY_8, (0x38) }, // 8 key.
- { Key::KEY_9, (0x39) }, // 9 key.
+ vk_map[VK_SHIFT] = Key::SHIFT; // (0x10)
+ vk_map[VK_CONTROL] = Key::CTRL; // (0x11)
+ vk_map[VK_MENU] = Key::ALT; // (0x12)
+ vk_map[VK_PAUSE] = Key::PAUSE; // (0x13)
+ vk_map[VK_CAPITAL] = Key::CAPSLOCK; // (0x14)
+ // 0x15-1A are IME keys.
+ vk_map[VK_ESCAPE] = Key::ESCAPE; // (0x1B)
+ // 0x1C-1F are IME keys.
+ vk_map[VK_SPACE] = Key::SPACE; // (0x20)
+ vk_map[VK_PRIOR] = Key::PAGEUP; // (0x21)
+ vk_map[VK_NEXT] = Key::PAGEDOWN; // (0x22)
+ vk_map[VK_END] = Key::END; // (0x23)
+ vk_map[VK_HOME] = Key::HOME; // (0x24)
+ vk_map[VK_LEFT] = Key::LEFT; // (0x25)
+ vk_map[VK_UP] = Key::UP; // (0x26)
+ vk_map[VK_RIGHT] = Key::RIGHT; // (0x27)
+ vk_map[VK_DOWN] = Key::DOWN; // (0x28)
+ // VK_SELECT (0x29), Old select key; e.g. on Digital Equipment Corporation keyboards.
+ vk_map[VK_PRINT] = Key::PRINT; // (0x2A), Old IBM key; modern keyboards use VK_SNAPSHOT.
+ // VK_EXECUTE (0x2B), Old and uncommon.
+ vk_map[VK_SNAPSHOT] = Key::PRINT; // (0x2C)
+ vk_map[VK_INSERT] = Key::INSERT; // (0x2D)
+ vk_map[VK_DELETE] = Key::KEY_DELETE; // (0x2E)
+ vk_map[VK_HELP] = Key::HELP; // (0x2F)
+ vk_map[0x30] = Key::KEY_0; // 0 key.
+ vk_map[0x31] = Key::KEY_1; // 1 key.
+ vk_map[0x32] = Key::KEY_2; // 2 key.
+ vk_map[0x33] = Key::KEY_3; // 3 key.
+ vk_map[0x34] = Key::KEY_4; // 4 key.
+ vk_map[0x35] = Key::KEY_5; // 5 key.
+ vk_map[0x36] = Key::KEY_6; // 6 key.
+ vk_map[0x37] = Key::KEY_7; // 7 key.
+ vk_map[0x38] = Key::KEY_8; // 8 key.
+ vk_map[0x39] = Key::KEY_9; // 9 key.
// 0x3A-40 are undefined.
- { Key::A, (0x41) }, // A key.
- { Key::B, (0x42) }, // B key.
- { Key::C, (0x43) }, // C key.
- { Key::D, (0x44) }, // D key.
- { Key::E, (0x45) }, // E key.
- { Key::F, (0x46) }, // F key.
- { Key::G, (0x47) }, // G key.
- { Key::H, (0x48) }, // H key.
- { Key::I, (0x49) }, // I key
- { Key::J, (0x4A) }, // J key.
- { Key::K, (0x4B) }, // K key.
- { Key::L, (0x4C) }, // L key.
- { Key::M, (0x4D) }, // M key.
- { Key::N, (0x4E) }, // N key.
- { Key::O, (0x4F) }, // O key.
- { Key::P, (0x50) }, // P key.
- { Key::Q, (0x51) }, // Q key.
- { Key::R, (0x52) }, // R key.
- { Key::S, (0x53) }, // S key.
- { Key::T, (0x54) }, // T key.
- { Key::U, (0x55) }, // U key.
- { Key::V, (0x56) }, // V key.
- { Key::W, (0x57) }, // W key.
- { Key::X, (0x58) }, // X key.
- { Key::Y, (0x59) }, // Y key.
- { Key::Z, (0x5A) }, // Z key.
-
- { (Key)KeyModifierMask::META, VK_LWIN }, // (0x5B)
- { (Key)KeyModifierMask::META, VK_RWIN }, // (0x5C)
- { Key::MENU, VK_APPS }, // (0x5D)
+ vk_map[0x41] = Key::A; // A key.
+ vk_map[0x42] = Key::B; // B key.
+ vk_map[0x43] = Key::C; // C key.
+ vk_map[0x44] = Key::D; // D key.
+ vk_map[0x45] = Key::E; // E key.
+ vk_map[0x46] = Key::F; // F key.
+ vk_map[0x47] = Key::G; // G key.
+ vk_map[0x48] = Key::H; // H key.
+ vk_map[0x49] = Key::I; // I key
+ vk_map[0x4A] = Key::J; // J key.
+ vk_map[0x4B] = Key::K; // K key.
+ vk_map[0x4C] = Key::L; // L key.
+ vk_map[0x4D] = Key::M; // M key.
+ vk_map[0x4E] = Key::N; // N key.
+ vk_map[0x4F] = Key::O; // O key.
+ vk_map[0x50] = Key::P; // P key.
+ vk_map[0x51] = Key::Q; // Q key.
+ vk_map[0x52] = Key::R; // R key.
+ vk_map[0x53] = Key::S; // S key.
+ vk_map[0x54] = Key::T; // T key.
+ vk_map[0x55] = Key::U; // U key.
+ vk_map[0x56] = Key::V; // V key.
+ vk_map[0x57] = Key::W; // W key.
+ vk_map[0x58] = Key::X; // X key.
+ vk_map[0x59] = Key::Y; // Y key.
+ vk_map[0x5A] = Key::Z; // Z key.
+ vk_map[VK_LWIN] = (Key)Key::META; // (0x5B)
+ vk_map[VK_RWIN] = (Key)Key::META; // (0x5C)
+ vk_map[VK_APPS] = Key::MENU; // (0x5D)
// 0x5E is reserved.
- { Key::STANDBY, VK_SLEEP }, // (0x5F)
- { Key::KP_0, VK_NUMPAD0 }, // (0x60)
- { Key::KP_1, VK_NUMPAD1 }, // (0x61)
- { Key::KP_2, VK_NUMPAD2 }, // (0x62)
- { Key::KP_3, VK_NUMPAD3 }, // (0x63)
- { Key::KP_4, VK_NUMPAD4 }, // (0x64)
- { Key::KP_5, VK_NUMPAD5 }, // (0x65)
- { Key::KP_6, VK_NUMPAD6 }, // (0x66)
- { Key::KP_7, VK_NUMPAD7 }, // (0x67)
- { Key::KP_8, VK_NUMPAD8 }, // (0x68)
- { Key::KP_9, VK_NUMPAD9 }, // (0x69)
- { Key::KP_MULTIPLY, VK_MULTIPLY }, // (0x6A)
- { Key::KP_ADD, VK_ADD }, // (0x6B)
- { Key::KP_PERIOD, VK_SEPARATOR }, // (0x6C)
- // VK_SEPERATOR (key 0x6C) is not found on US keyboards.
- // It is used on some Brazilian and Far East keyboards.
- // We don't have a direct mapping, map to period.
- { Key::KP_SUBTRACT, VK_SUBTRACT }, // (0x6D)
- { Key::KP_PERIOD, VK_DECIMAL }, // (0x6E)
- { Key::KP_DIVIDE, VK_DIVIDE }, // (0x6F)
- { Key::F1, VK_F1 }, // (0x70)
- { Key::F2, VK_F2 }, // (0x71)
- { Key::F3, VK_F3 }, // (0x72)
- { Key::F4, VK_F4 }, // (0x73)
- { Key::F5, VK_F5 }, // (0x74)
- { Key::F6, VK_F6 }, // (0x75)
- { Key::F7, VK_F7 }, // (0x76)
- { Key::F8, VK_F8 }, // (0x77)
- { Key::F9, VK_F9 }, // (0x78)
- { Key::F10, VK_F10 }, // (0x79)
- { Key::F11, VK_F11 }, // (0x7A)
- { Key::F12, VK_F12 }, // (0x7B)
- { Key::F13, VK_F13 }, // (0x7C)
- { Key::F14, VK_F14 }, // (0x7D)
- { Key::F15, VK_F15 }, // (0x7E)
- { Key::F16, VK_F16 }, // (0x7F)
- { Key::F17, VK_F17 }, // (0x80)
- { Key::F18, VK_F18 }, // (0x81)
- { Key::F19, VK_F19 }, // (0x82)
- { Key::F20, VK_F20 }, // (0x83)
- { Key::F21, VK_F21 }, // (0x84)
- { Key::F22, VK_F22 }, // (0x85)
- { Key::F23, VK_F23 }, // (0x86)
- { Key::F24, VK_F24 }, // (0x87)
+ vk_map[VK_SLEEP] = Key::STANDBY; // (0x5F)
+ vk_map[VK_NUMPAD0] = Key::KP_0; // (0x60)
+ vk_map[VK_NUMPAD1] = Key::KP_1; // (0x61)
+ vk_map[VK_NUMPAD2] = Key::KP_2; // (0x62)
+ vk_map[VK_NUMPAD3] = Key::KP_3; // (0x63)
+ vk_map[VK_NUMPAD4] = Key::KP_4; // (0x64)
+ vk_map[VK_NUMPAD5] = Key::KP_5; // (0x65)
+ vk_map[VK_NUMPAD6] = Key::KP_6; // (0x66)
+ vk_map[VK_NUMPAD7] = Key::KP_7; // (0x67)
+ vk_map[VK_NUMPAD8] = Key::KP_8; // (0x68)
+ vk_map[VK_NUMPAD9] = Key::KP_9; // (0x69)
+ vk_map[VK_MULTIPLY] = Key::KP_MULTIPLY; // (0x6A)
+ vk_map[VK_ADD] = Key::KP_ADD; // (0x6B)
+ vk_map[VK_SEPARATOR] = Key::KP_PERIOD; // (0x6C)
+ vk_map[VK_SUBTRACT] = Key::KP_SUBTRACT; // (0x6D)
+ vk_map[VK_DECIMAL] = Key::KP_PERIOD; // (0x6E)
+ vk_map[VK_DIVIDE] = Key::KP_DIVIDE; // (0x6F)
+ vk_map[VK_F1] = Key::F1; // (0x70)
+ vk_map[VK_F2] = Key::F2; // (0x71)
+ vk_map[VK_F3] = Key::F3; // (0x72)
+ vk_map[VK_F4] = Key::F4; // (0x73)
+ vk_map[VK_F5] = Key::F5; // (0x74)
+ vk_map[VK_F6] = Key::F6; // (0x75)
+ vk_map[VK_F7] = Key::F7; // (0x76)
+ vk_map[VK_F8] = Key::F8; // (0x77)
+ vk_map[VK_F9] = Key::F9; // (0x78)
+ vk_map[VK_F10] = Key::F10; // (0x79)
+ vk_map[VK_F11] = Key::F11; // (0x7A)
+ vk_map[VK_F12] = Key::F12; // (0x7B)
+ vk_map[VK_F13] = Key::F13; // (0x7C)
+ vk_map[VK_F14] = Key::F14; // (0x7D)
+ vk_map[VK_F15] = Key::F15; // (0x7E)
+ vk_map[VK_F16] = Key::F16; // (0x7F)
+ vk_map[VK_F17] = Key::F17; // (0x80)
+ vk_map[VK_F18] = Key::F18; // (0x81)
+ vk_map[VK_F19] = Key::F19; // (0x82)
+ vk_map[VK_F20] = Key::F20; // (0x83)
+ vk_map[VK_F21] = Key::F21; // (0x84)
+ vk_map[VK_F22] = Key::F22; // (0x85)
+ vk_map[VK_F23] = Key::F23; // (0x86)
+ vk_map[VK_F24] = Key::F24; // (0x87)
// 0x88-8F are reserved for UI navigation.
- { Key::NUMLOCK, VK_NUMLOCK }, // (0x90)
- { Key::SCROLLLOCK, VK_SCROLL }, // (0x91)
-
- { Key::EQUAL, VK_OEM_NEC_EQUAL }, // (0x92)
- // OEM NEC PC-9800 numpad '=' key.
-
- // 0x93-96 are OEM specific (e.g. used by Fujitsu/OASYS), we have no mappings.
+ vk_map[VK_NUMLOCK] = Key::NUMLOCK; // (0x90)
+ vk_map[VK_SCROLL] = Key::SCROLLLOCK; // (0x91)
+ vk_map[VK_OEM_NEC_EQUAL] = Key::EQUAL; // (0x92), OEM NEC PC-9800 numpad '=' key.
+ // 0x93-96 are OEM specific (e.g. used by Fujitsu/OASYS);
// 0x97-9F are unassigned.
-
- { Key::SHIFT, VK_LSHIFT }, // (0xA0)
- { Key::SHIFT, VK_RSHIFT }, // (0xA1)
- { Key::CTRL, VK_LCONTROL }, // (0xA2)
- { Key::CTRL, VK_RCONTROL }, // (0xA3)
- { Key::MENU, VK_LMENU }, // (0xA4)
- { Key::MENU, VK_RMENU }, // (0xA5)
-
- { Key::BACK, VK_BROWSER_BACK }, // (0xA6)
- { Key::FORWARD, VK_BROWSER_FORWARD }, // (0xA7)
- { Key::REFRESH, VK_BROWSER_REFRESH }, // (0xA8)
- { Key::STOP, VK_BROWSER_STOP }, // (0xA9)
- { Key::SEARCH, VK_BROWSER_SEARCH }, // (0xAA)
- { Key::FAVORITES, VK_BROWSER_FAVORITES }, // (0xAB)
- { Key::HOMEPAGE, VK_BROWSER_HOME }, // (0xAC)
- { Key::VOLUMEMUTE, VK_VOLUME_MUTE }, // (0xAD)
- { Key::VOLUMEDOWN, VK_VOLUME_DOWN }, // (0xAE)
- { Key::VOLUMEUP, VK_VOLUME_UP }, // (0xAF)
- { Key::MEDIANEXT, VK_MEDIA_NEXT_TRACK }, // (0xB0)
- { Key::MEDIAPREVIOUS, VK_MEDIA_PREV_TRACK }, // (0xB1)
- { Key::MEDIASTOP, VK_MEDIA_STOP }, // (0xB2)
-
- { Key::MEDIAPLAY, VK_MEDIA_PLAY_PAUSE }, // (0xB3)
- // Media button play/pause toggle.
- // Map to media play (there is no other 'play' mapping on Windows).
-
- { Key::LAUNCHMAIL, VK_LAUNCH_MAIL }, // (0xB4)
- { Key::LAUNCHMEDIA, VK_LAUNCH_MEDIA_SELECT }, // (0xB5)
- { Key::LAUNCH0, VK_LAUNCH_APP1 }, // (0xB6)
- { Key::LAUNCH1, VK_LAUNCH_APP2 }, // (0xB7)
-
+ vk_map[VK_LSHIFT] = Key::SHIFT; // (0xA0)
+ vk_map[VK_RSHIFT] = Key::SHIFT; // (0xA1)
+ vk_map[VK_LCONTROL] = Key::CTRL; // (0xA2)
+ vk_map[VK_RCONTROL] = Key::CTRL; // (0xA3)
+ vk_map[VK_LMENU] = Key::MENU; // (0xA4)
+ vk_map[VK_RMENU] = Key::MENU; // (0xA5)
+ vk_map[VK_BROWSER_BACK] = Key::BACK; // (0xA6)
+ vk_map[VK_BROWSER_FORWARD] = Key::FORWARD; // (0xA7)
+ vk_map[VK_BROWSER_REFRESH] = Key::REFRESH; // (0xA8)
+ vk_map[VK_BROWSER_STOP] = Key::STOP; // (0xA9)
+ vk_map[VK_BROWSER_SEARCH] = Key::SEARCH; // (0xAA)
+ vk_map[VK_BROWSER_FAVORITES] = Key::FAVORITES; // (0xAB)
+ vk_map[VK_BROWSER_HOME] = Key::HOMEPAGE; // (0xAC)
+ vk_map[VK_VOLUME_MUTE] = Key::VOLUMEMUTE; // (0xAD)
+ vk_map[VK_VOLUME_DOWN] = Key::VOLUMEDOWN; // (0xAE)
+ vk_map[VK_VOLUME_UP] = Key::VOLUMEUP; // (0xAF)
+ vk_map[VK_MEDIA_NEXT_TRACK] = Key::MEDIANEXT; // (0xB0)
+ vk_map[VK_MEDIA_PREV_TRACK] = Key::MEDIAPREVIOUS; // (0xB1)
+ vk_map[VK_MEDIA_STOP] = Key::MEDIASTOP; // (0xB2)
+ vk_map[VK_MEDIA_PLAY_PAUSE] = Key::MEDIAPLAY; // (0xB3), Media button play/pause toggle.
+ vk_map[VK_LAUNCH_MAIL] = Key::LAUNCHMAIL; // (0xB4)
+ vk_map[VK_LAUNCH_MEDIA_SELECT] = Key::LAUNCHMEDIA; // (0xB5)
+ vk_map[VK_LAUNCH_APP1] = Key::LAUNCH0; // (0xB6)
+ vk_map[VK_LAUNCH_APP2] = Key::LAUNCH1; // (0xB7)
// 0xB8-B9 are reserved.
-
- { Key::SEMICOLON, VK_OEM_1 }, // (0xBA)
- // Misc. character, can vary by keyboard/region.
- // Windows 2000/XP: For US standard keyboards, the ';:' key.
-
- { Key::EQUAL, VK_OEM_PLUS }, // (0xBB)
- // Windows 2000/XP: For any country/region, the '+' key.
- { Key::COMMA, VK_OEM_COMMA }, // (0xBC)
- // Windows 2000/XP: For any country/region, the ',' key.
- { Key::MINUS, VK_OEM_MINUS }, // (0xBD)
- // Windows 2000/XP: For any country/region, the '-' key.
- { Key::PERIOD, VK_OEM_PERIOD }, // (0xBE)
- // Windows 2000/XP: For any country/region, the '.' key.
-
- { Key::SLASH, VK_OEM_2 }, // (0xBF)
- // Windows 2000/XP: For US standard keyboards, the '/?' key.
-
- { Key::QUOTELEFT, VK_OEM_3 }, // (0xC0)
- // Windows 2000/XP: For US standard keyboards, the '`~' key.
-
+ vk_map[VK_OEM_1] = Key::SEMICOLON; // (0xBA), Misc. character;can vary by keyboard/region. For US standard keyboards;the ';:' key.
+ vk_map[VK_OEM_PLUS] = Key::EQUAL; // (0xBB)
+ vk_map[VK_OEM_COMMA] = Key::COMMA; // (0xBC)
+ vk_map[VK_OEM_MINUS] = Key::MINUS; // (0xBD)
+ vk_map[VK_OEM_PERIOD] = Key::PERIOD; // (0xBE)
+ vk_map[VK_OEM_2] = Key::SLASH; // (0xBF), For US standard keyboards;the '/?' key.
+ vk_map[VK_OEM_3] = Key::QUOTELEFT; // (0xC0), For US standard keyboards;the '`~' key.
// 0xC1-D7 are reserved. 0xD8-DA are unassigned.
- // TODO: 0xC3-DA may be used for old gamepads? Maybe we want to support this? See WinUser.h.
-
- { Key::BRACKETLEFT, VK_OEM_4 }, // (0xDB)
- // Misc. character, can vary by keyboard/region.
- // Windows 2000/XP: For US standard keyboards, the '[{' key.
-
- { Key::BACKSLASH, VK_OEM_5 }, // (0xDC)
- // Misc. character, can vary by keyboard/region.
- // Windows 2000/XP: For US standard keyboards, the '\|' key.
-
- { Key::BRACKETRIGHT, VK_OEM_6 }, // (0xDD)
- // Misc. character, can vary by keyboard/region.
- // Windows 2000/XP: For US standard keyboards, the ']}' key.
-
- { Key::APOSTROPHE, VK_OEM_7 }, // (0xDE)
- // Misc. character, can vary by keyboard/region.
- // Windows 2000/XP: For US standard keyboards, single quote/double quote.
-
+ // 0xC3-DA may be used for old gamepads? Maybe we want to support this? See WinUser.h.
+ vk_map[VK_OEM_4] = Key::BRACKETLEFT; // (0xDB), For US standard keyboards;the '[{' key.
+ vk_map[VK_OEM_5] = Key::BACKSLASH; // (0xDC), For US standard keyboards;the '\|' key.
+ vk_map[VK_OEM_6] = Key::BRACKETRIGHT; // (0xDD), For US standard keyboards;the ']}' key.
+ vk_map[VK_OEM_7] = Key::APOSTROPHE; // (0xDE), For US standard keyboards;single quote/double quote.
// VK_OEM_8 (0xDF)
- // Misc. character, can vary by keyboard/region. We have no mapping.
-
- // 0xE0 is reserved. 0xE1 is OEM specific, we have no mapping.
-
- // VK_OEM_102 (0xE2)
- // Either angle bracket or backslash key on the RT 102-key keyboard.
- // Old and uncommon, we have no mapping.
-
- { Key::HELP, VK_ICO_HELP }, // (0xE3)
- // OEM (ICO) help key. Map to help.
-
- // 0xE4 is OEM (e.g. ICO) specific, we have no mapping.
-
- // VK_PROCESSKEY (0xE5)
- // For IME, we have no mapping.
-
- { Key::CLEAR, VK_ICO_CLEAR }, // (0xE6)
- // OEM (ICO) clear key. Map to clear.
-
- // VK_PACKET (0xE7)
- // Used to pass Unicode characters as if they were keystrokes.
- // See Win32 API docs. We have no mapping.
-
- // 0xE8 is unassigned, 0xE9-F5 are OEM (Nokia/Ericsson) specific, we have no mappings.
-
- { Key::ESCAPE, VK_ATTN }, // (0xF6)
- // Old IBM 'ATTN' key used on midrange computers, e.g. AS/400, map to Escape.
-
- { Key::TAB, VK_CRSEL }, // (0xF7)
- // Old IBM 3270 'CrSel' (cursor select) key, used to select data fields, map to Tab.
-
- // VK_EXSEL (0xF7)
- // Old IBM 3270 extended selection key. No mapping.
-
- // VK_EREOF (0xF8)
- // Old IBM 3270 erase to end of field key. No mapping.
-
- { Key::MEDIAPLAY, VK_PLAY }, // (0xFA)
- // Old IBM 3270 'Play' key. Map to media play.
-
- // VK_ZOOM (0xFB)
- // Old IBM 3290 'Zoom' key. No mapping.
-
- // VK_NONAME (0xFC)
- // Reserved. No mapping.
-
- // VK_PA1 (0xFD)
- // Old IBM 3270 PA1 key. No mapping.
-
- { Key::CLEAR, VK_OEM_CLEAR }, // (0xFE)
- // OEM specific clear key. Unclear how it differs from normal clear. Map to clear.
-
- { Key::UNKNOWN, 0 }
-};
+ // 0xE0 is reserved. 0xE1 is OEM specific.
+ vk_map[VK_OEM_102] = Key::BAR; // (0xE2), Either angle bracket or backslash key on the RT 102-key keyboard.
+ vk_map[VK_ICO_HELP] = Key::HELP; // (0xE3)
+ // 0xE4 is OEM (e.g. ICO) specific.
+ // VK_PROCESSKEY (0xE5), For IME.
+ vk_map[VK_ICO_CLEAR] = Key::CLEAR; // (0xE6)
+ // VK_PACKET (0xE7), Used to pass Unicode characters as if they were keystrokes.
+ // 0xE8 is unassigned.
+ // 0xE9-F5 are OEM (Nokia/Ericsson) specific.
+ vk_map[VK_ATTN] = Key::ESCAPE; // (0xF6), Old IBM 'ATTN' key used on midrange computers ;e.g. AS/400.
+ vk_map[VK_CRSEL] = Key::TAB; // (0xF7), Old IBM 3270 'CrSel' (cursor select) key; used to select data fields.
+ // VK_EXSEL (0xF7), Old IBM 3270 extended selection key.
+ // VK_EREOF (0xF8), Old IBM 3270 erase to end of field key.
+ vk_map[VK_PLAY] = Key::MEDIAPLAY; // (0xFA), Old IBM 3270 'Play' key.
+ // VK_ZOOM (0xFB), Old IBM 3290 'Zoom' key.
+ // VK_NONAME (0xFC), Reserved.
+ // VK_PA1 (0xFD), Old IBM 3270 PA1 key.
+ vk_map[VK_OEM_CLEAR] = Key::CLEAR; // (0xFE), OEM specific clear key. Unclear how it differs from normal clear.
+
+ scansym_map[0x00] = Key::PAUSE;
+ scansym_map[0x01] = Key::ESCAPE;
+ scansym_map[0x02] = Key::KEY_1;
+ scansym_map[0x03] = Key::KEY_2;
+ scansym_map[0x04] = Key::KEY_3;
+ scansym_map[0x05] = Key::KEY_4;
+ scansym_map[0x06] = Key::KEY_5;
+ scansym_map[0x07] = Key::KEY_6;
+ scansym_map[0x08] = Key::KEY_7;
+ scansym_map[0x09] = Key::KEY_8;
+ scansym_map[0x0A] = Key::KEY_9;
+ scansym_map[0x0B] = Key::KEY_0;
+ scansym_map[0x0C] = Key::MINUS;
+ scansym_map[0x0D] = Key::EQUAL;
+ scansym_map[0x0E] = Key::BACKSPACE;
+ scansym_map[0x0F] = Key::TAB;
+ scansym_map[0x10] = Key::Q;
+ scansym_map[0x11] = Key::W;
+ scansym_map[0x12] = Key::E;
+ scansym_map[0x13] = Key::R;
+ scansym_map[0x14] = Key::T;
+ scansym_map[0x15] = Key::Y;
+ scansym_map[0x16] = Key::U;
+ scansym_map[0x17] = Key::I;
+ scansym_map[0x18] = Key::O;
+ scansym_map[0x19] = Key::P;
+ scansym_map[0x1A] = Key::BRACELEFT;
+ scansym_map[0x1B] = Key::BRACERIGHT;
+ scansym_map[0x1C] = Key::ENTER;
+ scansym_map[0x1D] = Key::CTRL;
+ scansym_map[0x1E] = Key::A;
+ scansym_map[0x1F] = Key::S;
+ scansym_map[0x20] = Key::D;
+ scansym_map[0x21] = Key::F;
+ scansym_map[0x22] = Key::G;
+ scansym_map[0x23] = Key::H;
+ scansym_map[0x24] = Key::J;
+ scansym_map[0x25] = Key::K;
+ scansym_map[0x26] = Key::L;
+ scansym_map[0x27] = Key::SEMICOLON;
+ scansym_map[0x28] = Key::APOSTROPHE;
+ scansym_map[0x29] = Key::QUOTELEFT;
+ scansym_map[0x2A] = Key::SHIFT;
+ scansym_map[0x2B] = Key::BACKSLASH;
+ scansym_map[0x2C] = Key::Z;
+ scansym_map[0x2D] = Key::X;
+ scansym_map[0x2E] = Key::C;
+ scansym_map[0x2F] = Key::V;
+ scansym_map[0x30] = Key::B;
+ scansym_map[0x31] = Key::N;
+ scansym_map[0x32] = Key::M;
+ scansym_map[0x33] = Key::COMMA;
+ scansym_map[0x34] = Key::PERIOD;
+ scansym_map[0x35] = Key::SLASH;
+ scansym_map[0x36] = Key::SHIFT;
+ scansym_map[0x37] = Key::KP_MULTIPLY;
+ scansym_map[0x38] = Key::ALT;
+ scansym_map[0x39] = Key::SPACE;
+ scansym_map[0x3A] = Key::CAPSLOCK;
+ scansym_map[0x3B] = Key::F1;
+ scansym_map[0x3C] = Key::F2;
+ scansym_map[0x3D] = Key::F3;
+ scansym_map[0x3E] = Key::F4;
+ scansym_map[0x3F] = Key::F5;
+ scansym_map[0x40] = Key::F6;
+ scansym_map[0x41] = Key::F7;
+ scansym_map[0x42] = Key::F8;
+ scansym_map[0x43] = Key::F9;
+ scansym_map[0x44] = Key::F10;
+ scansym_map[0x45] = Key::NUMLOCK;
+ scansym_map[0x46] = Key::SCROLLLOCK;
+ scansym_map[0x47] = Key::KP_7;
+ scansym_map[0x48] = Key::KP_8;
+ scansym_map[0x49] = Key::KP_9;
+ scansym_map[0x4A] = Key::KP_SUBTRACT;
+ scansym_map[0x4B] = Key::KP_4;
+ scansym_map[0x4C] = Key::KP_5;
+ scansym_map[0x4D] = Key::KP_6;
+ scansym_map[0x4E] = Key::KP_ADD;
+ scansym_map[0x4F] = Key::KP_1;
+ scansym_map[0x50] = Key::KP_2;
+ scansym_map[0x51] = Key::KP_3;
+ scansym_map[0x52] = Key::KP_0;
+ scansym_map[0x53] = Key::KP_PERIOD;
+ scansym_map[0x57] = Key::SECTION;
+ scansym_map[0x57] = Key::F11;
+ scansym_map[0x58] = Key::F12;
+ scansym_map[0x5B] = Key::META;
+ scansym_map[0x5C] = Key::META;
+ scansym_map[0x5D] = Key::MENU;
+ scansym_map[0x64] = Key::F13;
+ scansym_map[0x65] = Key::F14;
+ scansym_map[0x66] = Key::F15;
+ scansym_map[0x67] = Key::F16;
+ scansym_map[0x68] = Key::F17;
+ scansym_map[0x69] = Key::F18;
+ scansym_map[0x6A] = Key::F19;
+ scansym_map[0x6B] = Key::F20;
+ scansym_map[0x6C] = Key::F21;
+ scansym_map[0x6D] = Key::F22;
+ scansym_map[0x6E] = Key::F23;
+ // scansym_map[0x71] = Key::JIS_KANA;
+ // scansym_map[0x72] = Key::JIS_EISU;
+ scansym_map[0x76] = Key::F24;
+
+ for (const KeyValue<unsigned int, Key> &E : scansym_map) {
+ scansym_map_inv[E.value] = E.key;
+ }
-static _WinTranslatePair _scancode_to_keycode[] = {
- { Key::ESCAPE, 0x01 },
- { Key::KEY_1, 0x02 },
- { Key::KEY_2, 0x03 },
- { Key::KEY_3, 0x04 },
- { Key::KEY_4, 0x05 },
- { Key::KEY_5, 0x06 },
- { Key::KEY_6, 0x07 },
- { Key::KEY_7, 0x08 },
- { Key::KEY_8, 0x09 },
- { Key::KEY_9, 0x0A },
- { Key::KEY_0, 0x0B },
- { Key::MINUS, 0x0C },
- { Key::EQUAL, 0x0D },
- { Key::BACKSPACE, 0x0E },
- { Key::TAB, 0x0F },
- { Key::Q, 0x10 },
- { Key::W, 0x11 },
- { Key::E, 0x12 },
- { Key::R, 0x13 },
- { Key::T, 0x14 },
- { Key::Y, 0x15 },
- { Key::U, 0x16 },
- { Key::I, 0x17 },
- { Key::O, 0x18 },
- { Key::P, 0x19 },
- { Key::BRACELEFT, 0x1A },
- { Key::BRACERIGHT, 0x1B },
- { Key::ENTER, 0x1C },
- { Key::CTRL, 0x1D },
- { Key::A, 0x1E },
- { Key::S, 0x1F },
- { Key::D, 0x20 },
- { Key::F, 0x21 },
- { Key::G, 0x22 },
- { Key::H, 0x23 },
- { Key::J, 0x24 },
- { Key::K, 0x25 },
- { Key::L, 0x26 },
- { Key::SEMICOLON, 0x27 },
- { Key::APOSTROPHE, 0x28 },
- { Key::QUOTELEFT, 0x29 },
- { Key::SHIFT, 0x2A },
- { Key::BACKSLASH, 0x2B },
- { Key::Z, 0x2C },
- { Key::X, 0x2D },
- { Key::C, 0x2E },
- { Key::V, 0x2F },
- { Key::B, 0x30 },
- { Key::N, 0x31 },
- { Key::M, 0x32 },
- { Key::COMMA, 0x33 },
- { Key::PERIOD, 0x34 },
- { Key::SLASH, 0x35 },
- { Key::SHIFT, 0x36 },
- { Key::PRINT, 0x37 },
- { Key::ALT, 0x38 },
- { Key::SPACE, 0x39 },
- { Key::CAPSLOCK, 0x3A },
- { Key::F1, 0x3B },
- { Key::F2, 0x3C },
- { Key::F3, 0x3D },
- { Key::F4, 0x3E },
- { Key::F5, 0x3F },
- { Key::F6, 0x40 },
- { Key::F7, 0x41 },
- { Key::F8, 0x42 },
- { Key::F9, 0x43 },
- { Key::F10, 0x44 },
- { Key::NUMLOCK, 0x45 },
- { Key::SCROLLLOCK, 0x46 },
- { Key::HOME, 0x47 },
- { Key::UP, 0x48 },
- { Key::PAGEUP, 0x49 },
- { Key::KP_SUBTRACT, 0x4A },
- { Key::LEFT, 0x4B },
- { Key::KP_5, 0x4C },
- { Key::RIGHT, 0x4D },
- { Key::KP_ADD, 0x4E },
- { Key::END, 0x4F },
- { Key::DOWN, 0x50 },
- { Key::PAGEDOWN, 0x51 },
- { Key::INSERT, 0x52 },
- { Key::KEY_DELETE, 0x53 },
- { Key::F11, 0x57 },
- { Key::F12, 0x58 },
- { Key::META, 0x5B },
- { Key::META, 0x5C },
- { Key::MENU, 0x5D },
- { Key::F13, 0x64 },
- { Key::F14, 0x65 },
- { Key::F15, 0x66 },
- { Key::F16, 0x67 },
- { Key::F17, 0x68 },
- { Key::F18, 0x69 },
- { Key::F19, 0x6A },
- { Key::F20, 0x6B },
- { Key::F21, 0x6C },
- { Key::F22, 0x6D },
- { Key::F23, 0x6E },
- { Key::F24, 0x76 },
- { Key::UNKNOWN, 0 }
-};
+ scansym_map_ext[0x09] = Key::MENU;
+ scansym_map_ext[0x10] = Key::MEDIAPREVIOUS;
+ scansym_map_ext[0x19] = Key::MEDIANEXT;
+ scansym_map_ext[0x1C] = Key::KP_ENTER;
+ scansym_map_ext[0x20] = Key::VOLUMEMUTE;
+ scansym_map_ext[0x21] = Key::LAUNCH1;
+ scansym_map_ext[0x22] = Key::MEDIAPLAY;
+ scansym_map_ext[0x24] = Key::MEDIASTOP;
+ scansym_map_ext[0x2E] = Key::VOLUMEDOWN;
+ scansym_map_ext[0x30] = Key::VOLUMEUP;
+ scansym_map_ext[0x32] = Key::HOMEPAGE;
+ scansym_map_ext[0x35] = Key::KP_DIVIDE;
+ scansym_map_ext[0x37] = Key::PRINT;
+ scansym_map_ext[0x3A] = Key::KP_ADD;
+ scansym_map_ext[0x45] = Key::NUMLOCK;
+ scansym_map_ext[0x47] = Key::HOME;
+ scansym_map_ext[0x48] = Key::UP;
+ scansym_map_ext[0x49] = Key::PAGEUP;
+ scansym_map_ext[0x4A] = Key::KP_SUBTRACT;
+ scansym_map_ext[0x4B] = Key::LEFT;
+ scansym_map_ext[0x4C] = Key::KP_5;
+ scansym_map_ext[0x4D] = Key::RIGHT;
+ scansym_map_ext[0x4E] = Key::KP_ADD;
+ scansym_map_ext[0x4F] = Key::END;
+ scansym_map_ext[0x50] = Key::DOWN;
+ scansym_map_ext[0x51] = Key::PAGEDOWN;
+ scansym_map_ext[0x52] = Key::INSERT;
+ scansym_map_ext[0x53] = Key::KEY_DELETE;
+ scansym_map_ext[0x5D] = Key::MENU;
+ scansym_map_ext[0x5F] = Key::STANDBY;
+ scansym_map_ext[0x65] = Key::SEARCH;
+ scansym_map_ext[0x66] = Key::FAVORITES;
+ scansym_map_ext[0x67] = Key::REFRESH;
+ scansym_map_ext[0x68] = Key::STOP;
+ scansym_map_ext[0x69] = Key::FORWARD;
+ scansym_map_ext[0x6A] = Key::BACK;
+ scansym_map_ext[0x6B] = Key::LAUNCH0;
+ scansym_map_ext[0x6C] = Key::LAUNCHMAIL;
+ scansym_map_ext[0x6D] = Key::LAUNCHMEDIA;
+ scansym_map_ext[0x78] = Key::MEDIARECORD;
+}
Key KeyMappingWindows::get_keysym(unsigned int p_code) {
- for (int i = 0; _vk_to_keycode[i].keysym != Key::UNKNOWN; i++) {
- if (_vk_to_keycode[i].keycode == p_code) {
- return _vk_to_keycode[i].keysym;
- }
+ const Key *key = vk_map.getptr(p_code);
+ if (key) {
+ return *key;
}
-
return Key::UNKNOWN;
}
unsigned int KeyMappingWindows::get_scancode(Key p_keycode) {
- for (int i = 0; _scancode_to_keycode[i].keysym != Key::UNKNOWN; i++) {
- if (_scancode_to_keycode[i].keysym == p_keycode) {
- return _scancode_to_keycode[i].keycode;
- }
+ const unsigned int *key = scansym_map_inv.getptr(p_keycode);
+ if (key) {
+ return *key;
}
-
return 0;
}
Key KeyMappingWindows::get_scansym(unsigned int p_code, bool p_extended) {
- Key keycode = Key::UNKNOWN;
- for (int i = 0; _scancode_to_keycode[i].keysym != Key::UNKNOWN; i++) {
- if (_scancode_to_keycode[i].keycode == p_code) {
- keycode = _scancode_to_keycode[i].keysym;
- break;
- }
- }
-
if (p_extended) {
- switch (keycode) {
- case Key::ENTER: {
- keycode = Key::KP_ENTER;
- } break;
- case Key::SLASH: {
- keycode = Key::KP_DIVIDE;
- } break;
- case Key::CAPSLOCK: {
- keycode = Key::KP_ADD;
- } break;
- default:
- break;
- }
- } else {
- switch (keycode) {
- case Key::NUMLOCK: {
- keycode = Key::PAUSE;
- } break;
- case Key::HOME: {
- keycode = Key::KP_7;
- } break;
- case Key::UP: {
- keycode = Key::KP_8;
- } break;
- case Key::PAGEUP: {
- keycode = Key::KP_9;
- } break;
- case Key::LEFT: {
- keycode = Key::KP_4;
- } break;
- case Key::RIGHT: {
- keycode = Key::KP_6;
- } break;
- case Key::END: {
- keycode = Key::KP_1;
- } break;
- case Key::DOWN: {
- keycode = Key::KP_2;
- } break;
- case Key::PAGEDOWN: {
- keycode = Key::KP_3;
- } break;
- case Key::INSERT: {
- keycode = Key::KP_0;
- } break;
- case Key::KEY_DELETE: {
- keycode = Key::KP_PERIOD;
- } break;
- case Key::PRINT: {
- keycode = Key::KP_MULTIPLY;
- } break;
- default:
- break;
+ const Key *key = scansym_map_ext.getptr(p_code);
+ if (key) {
+ return *key;
}
}
-
- return keycode;
+ const Key *key = scansym_map.getptr(p_code);
+ if (key) {
+ return *key;
+ }
+ return Key::NONE;
}
bool KeyMappingWindows::is_extended_key(unsigned int p_code) {
diff --git a/platform/windows/key_mapping_windows.h b/platform/windows/key_mapping_windows.h
index ef5bec2b76..a98aa7ed68 100644
--- a/platform/windows/key_mapping_windows.h
+++ b/platform/windows/key_mapping_windows.h
@@ -41,6 +41,8 @@ class KeyMappingWindows {
KeyMappingWindows() {}
public:
+ static void initialize();
+
static Key get_keysym(unsigned int p_code);
static unsigned int get_scancode(Key p_keycode);
static Key get_scansym(unsigned int p_code, bool p_extended);
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 130c5f7b97..d384049fb5 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -210,6 +210,8 @@ void OS_Windows::initialize() {
} else if (!dwrite2_init) {
print_verbose("Unable to load IDWriteFactory2, automatic system font fallback is disabled.");
}
+
+ FileAccessWindows::initialize();
}
void OS_Windows::delete_main_loop() {
@@ -252,6 +254,8 @@ void OS_Windows::finalize() {
}
void OS_Windows::finalize_core() {
+ FileAccessWindows::finalize();
+
timeEndPeriod(1);
memdelete(process_map);
@@ -826,7 +830,7 @@ class FallbackTextAnalysisSource : public IDWriteTextAnalysisSource {
IDWriteNumberSubstitution *n_sub = nullptr;
public:
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, VOID **ppvInterface) {
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, VOID **ppvInterface) override {
if (IID_IUnknown == riid) {
AddRef();
*ppvInterface = (IUnknown *)this;
@@ -840,11 +844,11 @@ public:
return S_OK;
}
- ULONG STDMETHODCALLTYPE AddRef() {
+ ULONG STDMETHODCALLTYPE AddRef() override {
return InterlockedIncrement(&_cRef);
}
- ULONG STDMETHODCALLTYPE Release() {
+ ULONG STDMETHODCALLTYPE Release() override {
ULONG ulRef = InterlockedDecrement(&_cRef);
if (0 == ulRef) {
delete this;
diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp
index a4a965aa41..8f7006caca 100644
--- a/scene/2d/animated_sprite_2d.cpp
+++ b/scene/2d/animated_sprite_2d.cpp
@@ -117,7 +117,6 @@ void AnimatedSprite2D::_validate_property(PropertyInfo &p_property) const {
}
if (p_property.name == "animation") {
- p_property.hint = PROPERTY_HINT_ENUM;
List<StringName> names;
frames->get_animation_list(&names);
names.sort_custom<StringName::AlphCompare>();
@@ -167,6 +166,12 @@ void AnimatedSprite2D::_validate_property(PropertyInfo &p_property) const {
void AnimatedSprite2D::_notification(int p_what) {
switch (p_what) {
+ case NOTIFICATION_READY: {
+ if (!Engine::get_singleton()->is_editor_hint() && !frames.is_null() && frames->has_animation(autoplay)) {
+ play(autoplay);
+ }
+ } break;
+
case NOTIFICATION_INTERNAL_PROCESS: {
if (frames.is_null() || !frames->has_animation(animation)) {
return;
@@ -176,7 +181,8 @@ void AnimatedSprite2D::_notification(int p_what) {
int i = 0;
while (remaining) {
// Animation speed may be changed by animation_finished or frame_changed signals.
- double speed = frames->get_animation_speed(animation) * Math::abs(speed_scale);
+ double speed = frames->get_animation_speed(animation) * speed_scale * custom_speed_scale * frame_speed_scale;
+ double abs_speed = Math::abs(speed);
if (speed == 0) {
return; // Do nothing.
@@ -185,53 +191,57 @@ void AnimatedSprite2D::_notification(int p_what) {
// Frame count may be changed by animation_finished or frame_changed signals.
int fc = frames->get_frame_count(animation);
- if (timeout <= 0) {
- int last_frame = fc - 1;
- if (!playing_backwards) {
- // Forward.
+ int last_frame = fc - 1;
+ if (!signbit(speed)) {
+ // Forwards.
+ if (frame_progress >= 1.0) {
if (frame >= last_frame) {
if (frames->get_animation_loop(animation)) {
frame = 0;
- emit_signal(SceneStringNames::get_singleton()->animation_finished);
+ emit_signal("animation_looped");
} else {
frame = last_frame;
- if (!is_over) {
- is_over = true;
- emit_signal(SceneStringNames::get_singleton()->animation_finished);
- }
+ pause();
+ emit_signal(SceneStringNames::get_singleton()->animation_finished);
+ return;
}
} else {
frame++;
}
- } else {
- // Reversed.
+ _calc_frame_speed_scale();
+ frame_progress = 0.0;
+ queue_redraw();
+ emit_signal(SceneStringNames::get_singleton()->frame_changed);
+ }
+ double to_process = MIN((1.0 - frame_progress) / abs_speed, remaining);
+ frame_progress += to_process * abs_speed;
+ remaining -= to_process;
+ } else {
+ // Backwards.
+ if (frame_progress <= 0) {
if (frame <= 0) {
if (frames->get_animation_loop(animation)) {
frame = last_frame;
- emit_signal(SceneStringNames::get_singleton()->animation_finished);
+ emit_signal("animation_looped");
} else {
frame = 0;
- if (!is_over) {
- is_over = true;
- emit_signal(SceneStringNames::get_singleton()->animation_finished);
- }
+ pause();
+ emit_signal(SceneStringNames::get_singleton()->animation_finished);
+ return;
}
} else {
frame--;
}
+ _calc_frame_speed_scale();
+ frame_progress = 1.0;
+ queue_redraw();
+ emit_signal(SceneStringNames::get_singleton()->frame_changed);
}
-
- timeout = _get_frame_duration();
-
- queue_redraw();
-
- emit_signal(SceneStringNames::get_singleton()->frame_changed);
+ double to_process = MIN(frame_progress / abs_speed, remaining);
+ frame_progress -= to_process * abs_speed;
+ remaining -= to_process;
}
- double to_process = MIN(timeout / speed, remaining);
- timeout -= to_process * speed;
- remaining -= to_process;
-
i++;
if (i > fc) {
return; // Prevents freezing if to_process is each time much less than remaining.
@@ -275,25 +285,37 @@ void AnimatedSprite2D::_notification(int p_what) {
}
void AnimatedSprite2D::set_sprite_frames(const Ref<SpriteFrames> &p_frames) {
+ if (frames == p_frames) {
+ return;
+ }
+
if (frames.is_valid()) {
frames->disconnect(SceneStringNames::get_singleton()->changed, callable_mp(this, &AnimatedSprite2D::_res_changed));
}
-
+ stop();
frames = p_frames;
if (frames.is_valid()) {
frames->connect(SceneStringNames::get_singleton()->changed, callable_mp(this, &AnimatedSprite2D::_res_changed));
- }
- if (frames.is_null()) {
- frame = 0;
- } else {
- set_frame(frame);
+ List<StringName> al;
+ frames->get_animation_list(&al);
+ if (al.size() == 0) {
+ set_animation(StringName());
+ set_autoplay(String());
+ } else {
+ if (!frames->has_animation(animation)) {
+ set_animation(al[0]);
+ }
+ if (!frames->has_animation(autoplay)) {
+ set_autoplay(String());
+ }
+ }
}
notify_property_list_changed();
- _reset_timeout();
queue_redraw();
update_configuration_warnings();
+ emit_signal("sprite_frames_changed");
}
Ref<SpriteFrames> AnimatedSprite2D::get_sprite_frames() const {
@@ -301,44 +323,63 @@ Ref<SpriteFrames> AnimatedSprite2D::get_sprite_frames() const {
}
void AnimatedSprite2D::set_frame(int p_frame) {
+ set_frame_and_progress(p_frame, signbit(get_playing_speed()) ? 1.0 : 0.0);
+}
+
+int AnimatedSprite2D::get_frame() const {
+ return frame;
+}
+
+void AnimatedSprite2D::set_frame_progress(real_t p_progress) {
+ frame_progress = p_progress;
+}
+
+real_t AnimatedSprite2D::get_frame_progress() const {
+ return frame_progress;
+}
+
+void AnimatedSprite2D::set_frame_and_progress(int p_frame, real_t p_progress) {
if (frames.is_null()) {
return;
}
- if (frames->has_animation(animation)) {
- int limit = frames->get_frame_count(animation);
- if (p_frame >= limit) {
- p_frame = limit - 1;
- }
- }
+ bool has_animation = frames->has_animation(animation);
+ int end_frame = has_animation ? MAX(0, frames->get_frame_count(animation) - 1) : 0;
+ bool is_changed = frame != p_frame;
if (p_frame < 0) {
- p_frame = 0;
+ frame = 0;
+ } else if (has_animation && p_frame > end_frame) {
+ frame = end_frame;
+ } else {
+ frame = p_frame;
}
- if (frame == p_frame) {
- return;
- }
+ _calc_frame_speed_scale();
+ frame_progress = p_progress;
- frame = p_frame;
- _reset_timeout();
+ if (!is_changed) {
+ return; // No change, don't redraw.
+ }
queue_redraw();
emit_signal(SceneStringNames::get_singleton()->frame_changed);
}
-int AnimatedSprite2D::get_frame() const {
- return frame;
-}
-
void AnimatedSprite2D::set_speed_scale(float p_speed_scale) {
speed_scale = p_speed_scale;
- playing_backwards = signbit(speed_scale) != backwards;
}
float AnimatedSprite2D::get_speed_scale() const {
return speed_scale;
}
+float AnimatedSprite2D::get_playing_speed() const {
+ if (!playing) {
+ return 0;
+ }
+ return speed_scale * custom_speed_scale;
+}
+
void AnimatedSprite2D::set_centered(bool p_center) {
centered = p_center;
queue_redraw();
@@ -378,69 +419,131 @@ bool AnimatedSprite2D::is_flipped_v() const {
}
void AnimatedSprite2D::_res_changed() {
- set_frame(frame);
+ set_frame_and_progress(frame, frame_progress);
queue_redraw();
notify_property_list_changed();
}
-void AnimatedSprite2D::set_playing(bool p_playing) {
- if (playing == p_playing) {
- return;
+bool AnimatedSprite2D::is_playing() const {
+ return playing;
+}
+
+void AnimatedSprite2D::set_autoplay(const String &p_name) {
+ if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) {
+ WARN_PRINT("Setting autoplay after the node has been added to the scene has no effect.");
}
- playing = p_playing;
- playing_backwards = signbit(speed_scale) != backwards;
- set_process_internal(playing);
- notify_property_list_changed();
+
+ autoplay = p_name;
}
-bool AnimatedSprite2D::is_playing() const {
- return playing;
+String AnimatedSprite2D::get_autoplay() const {
+ return autoplay;
}
-void AnimatedSprite2D::play(const StringName &p_animation, bool p_backwards) {
- backwards = p_backwards;
- playing_backwards = signbit(speed_scale) != backwards;
+void AnimatedSprite2D::play(const StringName &p_name, float p_custom_scale, bool p_from_end) {
+ StringName name = p_name;
- if (p_animation) {
- set_animation(p_animation);
- if (frames.is_valid() && playing_backwards && get_frame() == 0) {
- set_frame(frames->get_frame_count(p_animation) - 1);
+ if (name == StringName()) {
+ name = animation;
+ }
+
+ ERR_FAIL_COND_MSG(frames == nullptr, vformat("There is no animation with name '%s'.", name));
+ ERR_FAIL_COND_MSG(!frames->get_animation_names().has(name), vformat("There is no animation with name '%s'.", name));
+
+ if (frames->get_frame_count(name) == 0) {
+ return;
+ }
+
+ playing = true;
+ custom_speed_scale = p_custom_scale;
+
+ int end_frame = MAX(0, frames->get_frame_count(animation) - 1);
+ if (name != animation) {
+ animation = name;
+ if (p_from_end) {
+ set_frame_and_progress(end_frame, 1.0);
+ } else {
+ set_frame_and_progress(0, 0.0);
+ }
+ emit_signal("animation_changed");
+ } else {
+ bool is_backward = signbit(speed_scale * custom_speed_scale);
+ if (p_from_end && is_backward && frame == 0 && frame_progress <= 0.0) {
+ set_frame_and_progress(end_frame, 1.0);
+ } else if (!p_from_end && !is_backward && frame == end_frame && frame_progress >= 1.0) {
+ set_frame_and_progress(0, 0.0);
}
}
- is_over = false;
- set_playing(true);
+ set_process_internal(true);
+ notify_property_list_changed();
+ queue_redraw();
+}
+
+void AnimatedSprite2D::play_backwards(const StringName &p_name) {
+ play(p_name, -1, true);
+}
+
+void AnimatedSprite2D::_stop_internal(bool p_reset) {
+ playing = false;
+ if (p_reset) {
+ custom_speed_scale = 1.0;
+ set_frame_and_progress(0, 0.0);
+ }
+ notify_property_list_changed();
+ set_process_internal(false);
+}
+
+void AnimatedSprite2D::pause() {
+ _stop_internal(false);
}
void AnimatedSprite2D::stop() {
- set_playing(false);
- backwards = false;
- _reset_timeout();
+ _stop_internal(true);
}
double AnimatedSprite2D::_get_frame_duration() {
if (frames.is_valid() && frames->has_animation(animation)) {
return frames->get_frame_duration(animation, frame);
}
- return 0.0;
+ return 1.0;
}
-void AnimatedSprite2D::_reset_timeout() {
- timeout = _get_frame_duration();
- is_over = false;
+void AnimatedSprite2D::_calc_frame_speed_scale() {
+ frame_speed_scale = 1.0 / _get_frame_duration();
}
-void AnimatedSprite2D::set_animation(const StringName &p_animation) {
- ERR_FAIL_COND_MSG(frames == nullptr, vformat("There is no animation with name '%s'.", p_animation));
- ERR_FAIL_COND_MSG(!frames->get_animation_names().has(p_animation), vformat("There is no animation with name '%s'.", p_animation));
+void AnimatedSprite2D::set_animation(const StringName &p_name) {
+ if (animation == p_name) {
+ return;
+ }
+
+ animation = p_name;
+
+ emit_signal("animation_changed");
- if (animation == p_animation) {
+ if (frames == nullptr) {
+ animation = StringName();
+ stop();
+ ERR_FAIL_MSG(vformat("There is no animation with name '%s'.", p_name));
+ }
+
+ int frame_count = frames->get_frame_count(animation);
+ if (animation == StringName() || frame_count == 0) {
+ stop();
return;
+ } else if (!frames->get_animation_names().has(animation)) {
+ animation = StringName();
+ stop();
+ ERR_FAIL_MSG(vformat("There is no animation with name '%s'.", p_name));
+ }
+
+ if (signbit(get_playing_speed())) {
+ set_frame_and_progress(frame_count - 1, 1.0);
+ } else {
+ set_frame_and_progress(0, 0.0);
}
- animation = p_animation;
- set_frame(0);
- _reset_timeout();
notify_property_list_changed();
queue_redraw();
}
@@ -468,17 +571,30 @@ void AnimatedSprite2D::get_argument_options(const StringName &p_function, int p_
Node::get_argument_options(p_function, p_idx, r_options);
}
+#ifndef DISABLE_DEPRECATED
+bool AnimatedSprite2D::_set(const StringName &p_name, const Variant &p_value) {
+ if ((p_name == SNAME("frames"))) {
+ set_sprite_frames(p_value);
+ return true;
+ }
+ return false;
+}
+#endif
void AnimatedSprite2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_sprite_frames", "sprite_frames"), &AnimatedSprite2D::set_sprite_frames);
ClassDB::bind_method(D_METHOD("get_sprite_frames"), &AnimatedSprite2D::get_sprite_frames);
- ClassDB::bind_method(D_METHOD("set_animation", "animation"), &AnimatedSprite2D::set_animation);
+ ClassDB::bind_method(D_METHOD("set_animation", "name"), &AnimatedSprite2D::set_animation);
ClassDB::bind_method(D_METHOD("get_animation"), &AnimatedSprite2D::get_animation);
- ClassDB::bind_method(D_METHOD("set_playing", "playing"), &AnimatedSprite2D::set_playing);
+ ClassDB::bind_method(D_METHOD("set_autoplay", "name"), &AnimatedSprite2D::set_autoplay);
+ ClassDB::bind_method(D_METHOD("get_autoplay"), &AnimatedSprite2D::get_autoplay);
+
ClassDB::bind_method(D_METHOD("is_playing"), &AnimatedSprite2D::is_playing);
- ClassDB::bind_method(D_METHOD("play", "anim", "backwards"), &AnimatedSprite2D::play, DEFVAL(StringName()), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("play", "name", "custom_speed", "from_end"), &AnimatedSprite2D::play, DEFVAL(StringName()), DEFVAL(1.0), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("play_backwards", "name"), &AnimatedSprite2D::play_backwards, DEFVAL(StringName()));
+ ClassDB::bind_method(D_METHOD("pause"), &AnimatedSprite2D::pause);
ClassDB::bind_method(D_METHOD("stop"), &AnimatedSprite2D::stop);
ClassDB::bind_method(D_METHOD("set_centered", "centered"), &AnimatedSprite2D::set_centered);
@@ -496,18 +612,28 @@ void AnimatedSprite2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_frame", "frame"), &AnimatedSprite2D::set_frame);
ClassDB::bind_method(D_METHOD("get_frame"), &AnimatedSprite2D::get_frame);
+ ClassDB::bind_method(D_METHOD("set_frame_progress", "progress"), &AnimatedSprite2D::set_frame_progress);
+ ClassDB::bind_method(D_METHOD("get_frame_progress"), &AnimatedSprite2D::get_frame_progress);
+
+ ClassDB::bind_method(D_METHOD("set_frame_and_progress", "frame", "progress"), &AnimatedSprite2D::set_frame_and_progress);
+
ClassDB::bind_method(D_METHOD("set_speed_scale", "speed_scale"), &AnimatedSprite2D::set_speed_scale);
ClassDB::bind_method(D_METHOD("get_speed_scale"), &AnimatedSprite2D::get_speed_scale);
+ ClassDB::bind_method(D_METHOD("get_playing_speed"), &AnimatedSprite2D::get_playing_speed);
+ ADD_SIGNAL(MethodInfo("sprite_frames_changed"));
+ ADD_SIGNAL(MethodInfo("animation_changed"));
ADD_SIGNAL(MethodInfo("frame_changed"));
+ ADD_SIGNAL(MethodInfo("animation_looped"));
ADD_SIGNAL(MethodInfo("animation_finished"));
ADD_GROUP("Animation", "");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "frames", PROPERTY_HINT_RESOURCE_TYPE, "SpriteFrames"), "set_sprite_frames", "get_sprite_frames");
- ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "animation"), "set_animation", "get_animation");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "sprite_frames", PROPERTY_HINT_RESOURCE_TYPE, "SpriteFrames"), "set_sprite_frames", "get_sprite_frames");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "animation", PROPERTY_HINT_ENUM, ""), "set_animation", "get_animation");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "autoplay", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_autoplay", "get_autoplay");
ADD_PROPERTY(PropertyInfo(Variant::INT, "frame"), "set_frame", "get_frame");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "frame_progress", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_frame_progress", "get_frame_progress");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "speed_scale"), "set_speed_scale", "get_speed_scale");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing"), "set_playing", "is_playing");
ADD_GROUP("Offset", "");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "centered"), "set_centered", "is_centered");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset", PROPERTY_HINT_NONE, "suffix:px"), "set_offset", "get_offset");
diff --git a/scene/2d/animated_sprite_2d.h b/scene/2d/animated_sprite_2d.h
index c1d35f3a2f..ac53bd26ee 100644
--- a/scene/2d/animated_sprite_2d.h
+++ b/scene/2d/animated_sprite_2d.h
@@ -38,18 +38,19 @@ class AnimatedSprite2D : public Node2D {
GDCLASS(AnimatedSprite2D, Node2D);
Ref<SpriteFrames> frames;
+ String autoplay;
+
bool playing = false;
- bool playing_backwards = false;
- bool backwards = false;
StringName animation = "default";
int frame = 0;
float speed_scale = 1.0;
+ float custom_speed_scale = 1.0;
bool centered = true;
Point2 offset;
- bool is_over = false;
- float timeout = 0.0;
+ real_t frame_speed_scale = 1.0;
+ real_t frame_progress = 0.0;
bool hflip = false;
bool vflip = false;
@@ -57,10 +58,15 @@ class AnimatedSprite2D : public Node2D {
void _res_changed();
double _get_frame_duration();
- void _reset_timeout();
+ void _calc_frame_speed_scale();
+ void _stop_internal(bool p_reset);
+
Rect2 _get_rect() const;
protected:
+#ifndef DISABLE_DEPRECATED
+ bool _set(const StringName &p_name, const Variant &p_value);
+#endif
static void _bind_methods();
void _notification(int p_what);
void _validate_property(PropertyInfo &p_property) const;
@@ -82,20 +88,30 @@ public:
void set_sprite_frames(const Ref<SpriteFrames> &p_frames);
Ref<SpriteFrames> get_sprite_frames() const;
- void play(const StringName &p_animation = StringName(), bool p_backwards = false);
+ void play(const StringName &p_name = StringName(), float p_custom_scale = 1.0, bool p_from_end = false);
+ void play_backwards(const StringName &p_name = StringName());
+ void pause();
void stop();
- void set_playing(bool p_playing);
bool is_playing() const;
- void set_animation(const StringName &p_animation);
+ void set_animation(const StringName &p_name);
StringName get_animation() const;
+ void set_autoplay(const String &p_name);
+ String get_autoplay() const;
+
void set_frame(int p_frame);
int get_frame() const;
+ void set_frame_progress(real_t p_progress);
+ real_t get_frame_progress() const;
+
+ void set_frame_and_progress(int p_frame, real_t p_progress);
+
void set_speed_scale(float p_speed_scale);
float get_speed_scale() const;
+ float get_playing_speed() const;
void set_centered(bool p_center);
bool is_centered() const;
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp
index 5eb76bdbb5..a37fabf21f 100644
--- a/scene/2d/area_2d.cpp
+++ b/scene/2d/area_2d.cpp
@@ -51,13 +51,13 @@ bool Area2D::is_gravity_a_point() const {
return gravity_is_point;
}
-void Area2D::set_gravity_point_distance_scale(real_t p_scale) {
- gravity_distance_scale = p_scale;
- PhysicsServer2D::get_singleton()->area_set_param(get_rid(), PhysicsServer2D::AREA_PARAM_GRAVITY_DISTANCE_SCALE, p_scale);
+void Area2D::set_gravity_point_unit_distance(real_t p_scale) {
+ gravity_point_unit_distance = p_scale;
+ PhysicsServer2D::get_singleton()->area_set_param(get_rid(), PhysicsServer2D::AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE, p_scale);
}
-real_t Area2D::get_gravity_point_distance_scale() const {
- return gravity_distance_scale;
+real_t Area2D::get_gravity_point_unit_distance() const {
+ return gravity_point_unit_distance;
}
void Area2D::set_gravity_point_center(const Vector2 &p_center) {
@@ -175,6 +175,7 @@ void Area2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i
return; //does not exist because it was likely removed from the tree
}
+ lock_callback();
locked = true;
if (body_in) {
@@ -224,6 +225,7 @@ void Area2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i
}
locked = false;
+ unlock_callback();
}
void Area2D::_area_enter_tree(ObjectID p_id) {
@@ -268,6 +270,8 @@ void Area2D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i
if (!area_in && !E) {
return; //likely removed from the tree
}
+
+ lock_callback();
locked = true;
if (area_in) {
@@ -317,6 +321,7 @@ void Area2D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i
}
locked = false;
+ unlock_callback();
}
void Area2D::_clear_monitoring() {
@@ -552,8 +557,8 @@ void Area2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_gravity_is_point", "enable"), &Area2D::set_gravity_is_point);
ClassDB::bind_method(D_METHOD("is_gravity_a_point"), &Area2D::is_gravity_a_point);
- ClassDB::bind_method(D_METHOD("set_gravity_point_distance_scale", "distance_scale"), &Area2D::set_gravity_point_distance_scale);
- ClassDB::bind_method(D_METHOD("get_gravity_point_distance_scale"), &Area2D::get_gravity_point_distance_scale);
+ ClassDB::bind_method(D_METHOD("set_gravity_point_unit_distance", "distance_scale"), &Area2D::set_gravity_point_unit_distance);
+ ClassDB::bind_method(D_METHOD("get_gravity_point_unit_distance"), &Area2D::get_gravity_point_unit_distance);
ClassDB::bind_method(D_METHOD("set_gravity_point_center", "center"), &Area2D::set_gravity_point_center);
ClassDB::bind_method(D_METHOD("get_gravity_point_center"), &Area2D::get_gravity_point_center);
@@ -617,7 +622,7 @@ void Area2D::_bind_methods() {
ADD_GROUP("Gravity", "gravity_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "gravity_space_override", PROPERTY_HINT_ENUM, "Disabled,Combine,Combine-Replace,Replace,Replace-Combine", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_gravity_space_override_mode", "get_gravity_space_override_mode");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "gravity_point", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_gravity_is_point", "is_gravity_a_point");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "gravity_point_distance_scale", PROPERTY_HINT_RANGE, "0,1024,0.001,or_greater,exp"), "set_gravity_point_distance_scale", "get_gravity_point_distance_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "gravity_point_unit_distance", PROPERTY_HINT_RANGE, "0,1024,0.001,or_greater,exp,suffix:px"), "set_gravity_point_unit_distance", "get_gravity_point_unit_distance");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "gravity_point_center", PROPERTY_HINT_NONE, "suffix:px"), "set_gravity_point_center", "get_gravity_point_center");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "gravity_direction"), "set_gravity_direction", "get_gravity_direction");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "gravity", PROPERTY_HINT_RANGE, U"-4096,4096,0.001,or_less,or_greater,suffix:px/s\u00B2"), "set_gravity", "get_gravity");
@@ -647,6 +652,7 @@ Area2D::Area2D() :
set_gravity_direction(Vector2(0, 1));
set_monitoring(true);
set_monitorable(true);
+ set_hide_clip_children(true);
}
Area2D::~Area2D() {
diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h
index aaf7ea28f8..8f4bbe3219 100644
--- a/scene/2d/area_2d.h
+++ b/scene/2d/area_2d.h
@@ -51,7 +51,7 @@ private:
Vector2 gravity_vec;
real_t gravity = 0.0;
bool gravity_is_point = false;
- real_t gravity_distance_scale = 0.0;
+ real_t gravity_point_unit_distance = 0.0;
SpaceOverride linear_damp_space_override = SPACE_OVERRIDE_DISABLED;
SpaceOverride angular_damp_space_override = SPACE_OVERRIDE_DISABLED;
@@ -144,8 +144,8 @@ public:
void set_gravity_is_point(bool p_enabled);
bool is_gravity_a_point() const;
- void set_gravity_point_distance_scale(real_t p_scale);
- real_t get_gravity_point_distance_scale() const;
+ void set_gravity_point_unit_distance(real_t p_scale);
+ real_t get_gravity_point_unit_distance() const;
void set_gravity_point_center(const Vector2 &p_center);
const Vector2 &get_gravity_point_center() const;
diff --git a/scene/2d/audio_listener_2d.cpp b/scene/2d/audio_listener_2d.cpp
index 5b8833ce62..b4484694a5 100644
--- a/scene/2d/audio_listener_2d.cpp
+++ b/scene/2d/audio_listener_2d.cpp
@@ -110,3 +110,7 @@ void AudioListener2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("clear_current"), &AudioListener2D::clear_current);
ClassDB::bind_method(D_METHOD("is_current"), &AudioListener2D::is_current);
}
+
+AudioListener2D::AudioListener2D() {
+ set_hide_clip_children(true);
+}
diff --git a/scene/2d/audio_listener_2d.h b/scene/2d/audio_listener_2d.h
index 12a44f26ae..abada06971 100644
--- a/scene/2d/audio_listener_2d.h
+++ b/scene/2d/audio_listener_2d.h
@@ -54,6 +54,8 @@ public:
void make_current();
void clear_current();
bool is_current() const;
+
+ AudioListener2D();
};
#endif // AUDIO_LISTENER_2D_H
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index c4de3a124b..902fba38bf 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -72,12 +72,10 @@ void AudioStreamPlayer2D::_notification(int p_what) {
_update_panning();
}
- if (setplay.get() >= 0 && stream.is_valid()) {
+ if (setplayback.is_valid() && setplay.get() >= 0) {
active.set();
- Ref<AudioStreamPlayback> new_playback = stream->instantiate_playback();
- ERR_FAIL_COND_MSG(new_playback.is_null(), "Failed to instantiate playback.");
- AudioServer::get_singleton()->start_playback_stream(new_playback, _get_actual_bus(), volume_vector, setplay.get(), pitch_scale);
- stream_playbacks.push_back(new_playback);
+ AudioServer::get_singleton()->start_playback_stream(setplayback, _get_actual_bus(), volume_vector, setplay.get(), pitch_scale);
+ setplayback.unref();
setplay.set(-1);
}
@@ -255,7 +253,11 @@ void AudioStreamPlayer2D::play(float p_from_pos) {
if (stream->is_monophonic() && is_playing()) {
stop();
}
+ Ref<AudioStreamPlayback> stream_playback = stream->instantiate_playback();
+ ERR_FAIL_COND_MSG(stream_playback.is_null(), "Failed to instantiate playback.");
+ stream_playbacks.push_back(stream_playback);
+ setplayback = stream_playback;
setplay.set(p_from_pos);
active.set();
set_physics_process_internal(true);
@@ -390,11 +392,13 @@ bool AudioStreamPlayer2D::get_stream_paused() const {
return false;
}
+bool AudioStreamPlayer2D::has_stream_playback() {
+ return !stream_playbacks.is_empty();
+}
+
Ref<AudioStreamPlayback> AudioStreamPlayer2D::get_stream_playback() {
- if (!stream_playbacks.is_empty()) {
- return stream_playbacks[stream_playbacks.size() - 1];
- }
- return nullptr;
+ ERR_FAIL_COND_V_MSG(stream_playbacks.is_empty(), Ref<AudioStreamPlayback>(), "Player is inactive. Call play() before requesting get_stream_playback().");
+ return stream_playbacks[stream_playbacks.size() - 1];
}
void AudioStreamPlayer2D::set_max_polyphony(int p_max_polyphony) {
@@ -460,6 +464,7 @@ void AudioStreamPlayer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_panning_strength", "panning_strength"), &AudioStreamPlayer2D::set_panning_strength);
ClassDB::bind_method(D_METHOD("get_panning_strength"), &AudioStreamPlayer2D::get_panning_strength);
+ ClassDB::bind_method(D_METHOD("has_stream_playback"), &AudioStreamPlayer2D::has_stream_playback);
ClassDB::bind_method(D_METHOD("get_stream_playback"), &AudioStreamPlayer2D::get_stream_playback);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"), "set_stream", "get_stream");
@@ -481,6 +486,7 @@ void AudioStreamPlayer2D::_bind_methods() {
AudioStreamPlayer2D::AudioStreamPlayer2D() {
AudioServer::get_singleton()->connect("bus_layout_changed", callable_mp(this, &AudioStreamPlayer2D::_bus_layout_changed));
cached_global_panning_strength = GLOBAL_GET("audio/general/2d_panning_strength");
+ set_hide_clip_children(true);
}
AudioStreamPlayer2D::~AudioStreamPlayer2D() {
diff --git a/scene/2d/audio_stream_player_2d.h b/scene/2d/audio_stream_player_2d.h
index a5fd584513..79a026fed2 100644
--- a/scene/2d/audio_stream_player_2d.h
+++ b/scene/2d/audio_stream_player_2d.h
@@ -56,6 +56,7 @@ private:
SafeFlag active{ false };
SafeNumeric<float> setplay{ -1.0 };
+ Ref<AudioStreamPlayback> setplayback;
Vector<AudioFrame> volume_vector;
@@ -129,6 +130,7 @@ public:
void set_panning_strength(float p_panning_strength);
float get_panning_strength() const;
+ bool has_stream_playback();
Ref<AudioStreamPlayback> get_stream_playback();
AudioStreamPlayer2D();
diff --git a/scene/2d/back_buffer_copy.cpp b/scene/2d/back_buffer_copy.cpp
index ab048f0cd7..60b344b002 100644
--- a/scene/2d/back_buffer_copy.cpp
+++ b/scene/2d/back_buffer_copy.cpp
@@ -101,6 +101,7 @@ void BackBufferCopy::_bind_methods() {
BackBufferCopy::BackBufferCopy() {
_update_copy_mode();
+ set_hide_clip_children(true);
}
BackBufferCopy::~BackBufferCopy() {
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index c4647ae9ff..71b8fdb539 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -832,4 +832,5 @@ Camera2D::Camera2D() {
drag_margin[SIDE_BOTTOM] = 0.2;
set_notify_transform(true);
+ set_hide_clip_children(true);
}
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index b2fee6ad82..ba3b0cec5c 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -94,10 +94,14 @@ void CollisionObject2D::_notification(int p_what) {
bool disabled = !is_enabled();
if (!disabled || (disable_mode != DISABLE_MODE_REMOVE)) {
- if (area) {
- PhysicsServer2D::get_singleton()->area_set_space(rid, RID());
+ if (callback_lock > 0) {
+ ERR_PRINT("Removing a CollisionObject node during a physics callback is not allowed and will cause undesired behavior. Remove with call_deferred() instead.");
} else {
- PhysicsServer2D::get_singleton()->body_set_space(rid, RID());
+ if (area) {
+ PhysicsServer2D::get_singleton()->area_set_space(rid, RID());
+ } else {
+ PhysicsServer2D::get_singleton()->body_set_space(rid, RID());
+ }
}
}
@@ -225,10 +229,14 @@ void CollisionObject2D::_apply_disabled() {
switch (disable_mode) {
case DISABLE_MODE_REMOVE: {
if (is_inside_tree()) {
- if (area) {
- PhysicsServer2D::get_singleton()->area_set_space(rid, RID());
+ if (callback_lock > 0) {
+ ERR_PRINT("Disabling a CollisionObject node during a physics callback is not allowed and will cause undesired behavior. Disable with call_deferred() instead.");
} else {
- PhysicsServer2D::get_singleton()->body_set_space(rid, RID());
+ if (area) {
+ PhysicsServer2D::get_singleton()->area_set_space(rid, RID());
+ } else {
+ PhysicsServer2D::get_singleton()->body_set_space(rid, RID());
+ }
}
}
} break;
@@ -643,6 +651,7 @@ CollisionObject2D::CollisionObject2D(RID p_rid, bool p_area) {
area = p_area;
pickable = true;
set_notify_transform(true);
+ set_hide_clip_children(true);
total_subshapes = 0;
only_update_transform_changes = false;
diff --git a/scene/2d/collision_object_2d.h b/scene/2d/collision_object_2d.h
index d44e402e96..88429b145d 100644
--- a/scene/2d/collision_object_2d.h
+++ b/scene/2d/collision_object_2d.h
@@ -53,6 +53,7 @@ private:
bool area = false;
RID rid;
+ uint32_t callback_lock = 0;
bool pickable = false;
DisableMode disable_mode = DISABLE_MODE_REMOVE;
@@ -83,6 +84,12 @@ private:
void _apply_enabled();
protected:
+ _FORCE_INLINE_ void lock_callback() { callback_lock++; }
+ _FORCE_INLINE_ void unlock_callback() {
+ ERR_FAIL_COND(callback_lock == 0);
+ callback_lock--;
+ }
+
CollisionObject2D(RID p_rid, bool p_area);
void _notification(int p_what);
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index 0e18f77b8a..32dea80650 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -131,15 +131,7 @@ void CollisionPolygon2D::_notification(int p_what) {
break;
}
- int polygon_count = polygon.size();
- for (int i = 0; i < polygon_count; i++) {
- Vector2 p = polygon[i];
- Vector2 n = polygon[(i + 1) % polygon_count];
- // draw line with width <= 1, so it does not scale with zoom and break pixel exact editing
- draw_line(p, n, Color(0.9, 0.2, 0.0, 0.8), 1);
- }
-
- if (polygon_count > 2) {
+ if (polygon.size() > 2) {
#define DEBUG_DECOMPOSE
#if defined(TOOLS_ENABLED) && defined(DEBUG_DECOMPOSE)
Vector<Vector<Vector2>> decomp = _decompose_in_convex();
@@ -152,6 +144,11 @@ void CollisionPolygon2D::_notification(int p_what) {
#else
draw_colored_polygon(polygon, get_tree()->get_debug_collisions_color());
#endif
+
+ const Color stroke_color = Color(0.9, 0.2, 0.0);
+ draw_polyline(polygon, stroke_color);
+ // Draw the last segment.
+ draw_line(polygon[polygon.size() - 1], polygon[0], stroke_color);
}
if (one_way_collision) {
@@ -323,4 +320,5 @@ void CollisionPolygon2D::_bind_methods() {
CollisionPolygon2D::CollisionPolygon2D() {
set_notify_local_transform(true);
+ set_hide_clip_children(true);
}
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index 6ff789cad2..5951405bbe 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -288,5 +288,6 @@ void CollisionShape2D::_bind_methods() {
CollisionShape2D::CollisionShape2D() {
set_notify_local_transform(true);
+ set_hide_clip_children(true);
debug_color = _get_default_debug_color();
}
diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp
index 9a3b7c8687..00d13c59b9 100644
--- a/scene/2d/gpu_particles_2d.cpp
+++ b/scene/2d/gpu_particles_2d.cpp
@@ -638,7 +638,7 @@ void GPUParticles2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interpolate"), "set_interpolate", "get_interpolate");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fract_delta"), "set_fractional_delta", "get_fractional_delta");
ADD_GROUP("Collision", "collision_");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "collision_base_size", PROPERTY_HINT_RANGE, "0,128,0.01,or_greater,suffix:px"), "set_collision_base_size", "get_collision_base_size");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "collision_base_size", PROPERTY_HINT_RANGE, "0,128,0.01,or_greater"), "set_collision_base_size", "get_collision_base_size");
ADD_GROUP("Drawing", "");
ADD_PROPERTY(PropertyInfo(Variant::RECT2, "visibility_rect", PROPERTY_HINT_NONE, "suffix:px"), "set_visibility_rect", "get_visibility_rect");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "local_coords"), "set_use_local_coordinates", "get_use_local_coordinates");
diff --git a/scene/2d/joint_2d.cpp b/scene/2d/joint_2d.cpp
index 47d0ac6e35..ce427d47aa 100644
--- a/scene/2d/joint_2d.cpp
+++ b/scene/2d/joint_2d.cpp
@@ -243,6 +243,7 @@ void Joint2D::_bind_methods() {
Joint2D::Joint2D() {
joint = PhysicsServer2D::get_singleton()->joint_create();
+ set_hide_clip_children(true);
}
Joint2D::~Joint2D() {
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp
index fb53400fd6..15b638ed92 100644
--- a/scene/2d/light_2d.cpp
+++ b/scene/2d/light_2d.cpp
@@ -443,6 +443,7 @@ void PointLight2D::_bind_methods() {
PointLight2D::PointLight2D() {
RS::get_singleton()->canvas_light_set_mode(_get_light(), RS::CANVAS_LIGHT_MODE_POINT);
+ set_hide_clip_children(true);
}
//////////
@@ -467,4 +468,5 @@ void DirectionalLight2D::_bind_methods() {
DirectionalLight2D::DirectionalLight2D() {
RS::get_singleton()->canvas_light_set_mode(_get_light(), RS::CANVAS_LIGHT_MODE_DIRECTIONAL);
set_max_distance(max_distance); // Update RenderingServer.
+ set_hide_clip_children(true);
}
diff --git a/scene/2d/marker_2d.cpp b/scene/2d/marker_2d.cpp
index 512875833c..9595fcfffe 100644
--- a/scene/2d/marker_2d.cpp
+++ b/scene/2d/marker_2d.cpp
@@ -117,4 +117,5 @@ void Marker2D::_bind_methods() {
}
Marker2D::Marker2D() {
+ set_hide_clip_children(true);
}
diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp
index 6b842e6e6b..e73b6e7e23 100644
--- a/scene/2d/navigation_agent_2d.cpp
+++ b/scene/2d/navigation_agent_2d.cpp
@@ -76,10 +76,10 @@ void NavigationAgent2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_navigation_map", "navigation_map"), &NavigationAgent2D::set_navigation_map);
ClassDB::bind_method(D_METHOD("get_navigation_map"), &NavigationAgent2D::get_navigation_map);
- ClassDB::bind_method(D_METHOD("set_target_location", "location"), &NavigationAgent2D::set_target_location);
- ClassDB::bind_method(D_METHOD("get_target_location"), &NavigationAgent2D::get_target_location);
+ ClassDB::bind_method(D_METHOD("set_target_position", "position"), &NavigationAgent2D::set_target_position);
+ ClassDB::bind_method(D_METHOD("get_target_position"), &NavigationAgent2D::get_target_position);
- ClassDB::bind_method(D_METHOD("get_next_location"), &NavigationAgent2D::get_next_location);
+ ClassDB::bind_method(D_METHOD("get_next_path_position"), &NavigationAgent2D::get_next_path_position);
ClassDB::bind_method(D_METHOD("distance_to_target"), &NavigationAgent2D::distance_to_target);
ClassDB::bind_method(D_METHOD("set_velocity", "velocity"), &NavigationAgent2D::set_velocity);
ClassDB::bind_method(D_METHOD("get_current_navigation_result"), &NavigationAgent2D::get_current_navigation_result);
@@ -88,12 +88,12 @@ void NavigationAgent2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_target_reached"), &NavigationAgent2D::is_target_reached);
ClassDB::bind_method(D_METHOD("is_target_reachable"), &NavigationAgent2D::is_target_reachable);
ClassDB::bind_method(D_METHOD("is_navigation_finished"), &NavigationAgent2D::is_navigation_finished);
- ClassDB::bind_method(D_METHOD("get_final_location"), &NavigationAgent2D::get_final_location);
+ ClassDB::bind_method(D_METHOD("get_final_position"), &NavigationAgent2D::get_final_position);
ClassDB::bind_method(D_METHOD("_avoidance_done", "new_velocity"), &NavigationAgent2D::_avoidance_done);
ADD_GROUP("Pathfinding", "");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "target_location", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_target_location", "get_target_location");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "target_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_target_position", "get_target_position");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "path_desired_distance", PROPERTY_HINT_RANGE, "0.1,1000,0.01,suffix:px"), "set_path_desired_distance", "get_path_desired_distance");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "target_desired_distance", PROPERTY_HINT_RANGE, "0.1,1000,0.01,suffix:px"), "set_target_desired_distance", "get_target_desired_distance");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "path_max_distance", PROPERTY_HINT_RANGE, "10,1000,1,suffix:px"), "set_path_max_distance", "get_path_max_distance");
@@ -205,9 +205,9 @@ NavigationAgent2D::~NavigationAgent2D() {
void NavigationAgent2D::set_avoidance_enabled(bool p_enabled) {
avoidance_enabled = p_enabled;
if (avoidance_enabled) {
- NavigationServer2D::get_singleton()->agent_set_callback(agent, get_instance_id(), "_avoidance_done");
+ NavigationServer2D::get_singleton()->agent_set_callback(agent, callable_mp(this, &NavigationAgent2D::_avoidance_done));
} else {
- NavigationServer2D::get_singleton()->agent_set_callback(agent, ObjectID(), "_avoidance_done");
+ NavigationServer2D::get_singleton()->agent_set_callback(agent, Callable());
}
}
@@ -217,7 +217,8 @@ bool NavigationAgent2D::get_avoidance_enabled() const {
void NavigationAgent2D::set_agent_parent(Node *p_agent_parent) {
// remove agent from any avoidance map before changing parent or there will be leftovers on the RVO map
- NavigationServer2D::get_singleton()->agent_set_callback(agent, ObjectID(), "_avoidance_done");
+ NavigationServer2D::get_singleton()->agent_set_callback(agent, Callable());
+
if (Object::cast_to<Node2D>(p_agent_parent) != nullptr) {
// place agent on navigation map first or else the RVO agent callback creation fails silently later
agent_parent = Object::cast_to<Node2D>(p_agent_parent);
@@ -226,6 +227,7 @@ void NavigationAgent2D::set_agent_parent(Node *p_agent_parent) {
} else {
NavigationServer2D::get_singleton()->agent_set_map(get_rid(), agent_parent->get_world_2d()->get_navigation_map());
}
+
// create new avoidance callback if enabled
set_avoidance_enabled(avoidance_enabled);
} else {
@@ -328,17 +330,17 @@ real_t NavigationAgent2D::get_path_max_distance() {
return path_max_distance;
}
-void NavigationAgent2D::set_target_location(Vector2 p_location) {
- target_location = p_location;
+void NavigationAgent2D::set_target_position(Vector2 p_position) {
+ target_position = p_position;
target_position_submitted = true;
_request_repath();
}
-Vector2 NavigationAgent2D::get_target_location() const {
- return target_location;
+Vector2 NavigationAgent2D::get_target_position() const {
+ return target_position;
}
-Vector2 NavigationAgent2D::get_next_location() {
+Vector2 NavigationAgent2D::get_next_path_position() {
update_navigation();
const Vector<Vector2> &navigation_path = navigation_result->get_path();
@@ -352,7 +354,7 @@ Vector2 NavigationAgent2D::get_next_location() {
real_t NavigationAgent2D::distance_to_target() const {
ERR_FAIL_COND_V_MSG(agent_parent == nullptr, 0.0, "The agent has no parent.");
- return agent_parent->get_global_position().distance_to(target_location);
+ return agent_parent->get_global_position().distance_to(target_position);
}
bool NavigationAgent2D::is_target_reached() const {
@@ -360,7 +362,7 @@ bool NavigationAgent2D::is_target_reached() const {
}
bool NavigationAgent2D::is_target_reachable() {
- return target_desired_distance >= get_final_location().distance_to(target_location);
+ return target_desired_distance >= get_final_position().distance_to(target_position);
}
bool NavigationAgent2D::is_navigation_finished() {
@@ -368,7 +370,7 @@ bool NavigationAgent2D::is_navigation_finished() {
return navigation_finished;
}
-Vector2 NavigationAgent2D::get_final_location() {
+Vector2 NavigationAgent2D::get_final_position() {
update_navigation();
const Vector<Vector2> &navigation_path = navigation_result->get_path();
@@ -450,7 +452,7 @@ void NavigationAgent2D::update_navigation() {
if (reload_path) {
navigation_query->set_start_position(origin);
- navigation_query->set_target_position(target_location);
+ navigation_query->set_target_position(target_position);
navigation_query->set_navigation_layers(navigation_layers);
navigation_query->set_metadata_flags(path_metadata_flags);
@@ -472,7 +474,7 @@ void NavigationAgent2D::update_navigation() {
// Check if we can advance the navigation path
if (navigation_finished == false) {
- // Advances to the next far away location.
+ // Advances to the next far away position.
const Vector<Vector2> &navigation_path = navigation_result->get_path();
const Vector<int32_t> &navigation_path_types = navigation_result->get_path_types();
const TypedArray<RID> &navigation_path_rids = navigation_result->get_path_rids();
@@ -482,7 +484,7 @@ void NavigationAgent2D::update_navigation() {
Dictionary details;
const Vector2 waypoint = navigation_path[navigation_path_index];
- details[SNAME("location")] = waypoint;
+ details[SNAME("position")] = waypoint;
int waypoint_type = -1;
if (path_metadata_flags.has_flag(NavigationPathQueryParameters2D::PathMetadataFlags::PATH_METADATA_INCLUDE_TYPES)) {
diff --git a/scene/2d/navigation_agent_2d.h b/scene/2d/navigation_agent_2d.h
index 190a2fcbda..9787bb1bdb 100644
--- a/scene/2d/navigation_agent_2d.h
+++ b/scene/2d/navigation_agent_2d.h
@@ -60,7 +60,7 @@ class NavigationAgent2D : public Node {
real_t path_max_distance = 100.0;
- Vector2 target_location;
+ Vector2 target_position;
bool target_position_submitted = false;
Ref<NavigationPathQueryParameters2D> navigation_query;
Ref<NavigationPathQueryResult2D> navigation_result;
@@ -143,10 +143,10 @@ public:
void set_path_max_distance(real_t p_pmd);
real_t get_path_max_distance();
- void set_target_location(Vector2 p_location);
- Vector2 get_target_location() const;
+ void set_target_position(Vector2 p_position);
+ Vector2 get_target_position() const;
- Vector2 get_next_location();
+ Vector2 get_next_path_position();
Ref<NavigationPathQueryResult2D> get_current_navigation_result() const {
return navigation_result;
@@ -162,7 +162,7 @@ public:
bool is_target_reached() const;
bool is_target_reachable();
bool is_navigation_finished();
- Vector2 get_final_location();
+ Vector2 get_final_position();
void set_velocity(Vector2 p_velocity);
void _avoidance_done(Vector3 p_new_velocity);
diff --git a/scene/2d/navigation_link_2d.cpp b/scene/2d/navigation_link_2d.cpp
index 9ef0ba617e..26dca40176 100644
--- a/scene/2d/navigation_link_2d.cpp
+++ b/scene/2d/navigation_link_2d.cpp
@@ -48,11 +48,11 @@ void NavigationLink2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_navigation_layer_value", "layer_number", "value"), &NavigationLink2D::set_navigation_layer_value);
ClassDB::bind_method(D_METHOD("get_navigation_layer_value", "layer_number"), &NavigationLink2D::get_navigation_layer_value);
- ClassDB::bind_method(D_METHOD("set_start_location", "location"), &NavigationLink2D::set_start_location);
- ClassDB::bind_method(D_METHOD("get_start_location"), &NavigationLink2D::get_start_location);
+ ClassDB::bind_method(D_METHOD("set_start_position", "position"), &NavigationLink2D::set_start_position);
+ ClassDB::bind_method(D_METHOD("get_start_position"), &NavigationLink2D::get_start_position);
- ClassDB::bind_method(D_METHOD("set_end_location", "location"), &NavigationLink2D::set_end_location);
- ClassDB::bind_method(D_METHOD("get_end_location"), &NavigationLink2D::get_end_location);
+ ClassDB::bind_method(D_METHOD("set_end_position", "position"), &NavigationLink2D::set_end_position);
+ ClassDB::bind_method(D_METHOD("get_end_position"), &NavigationLink2D::get_end_position);
ClassDB::bind_method(D_METHOD("set_enter_cost", "enter_cost"), &NavigationLink2D::set_enter_cost);
ClassDB::bind_method(D_METHOD("get_enter_cost"), &NavigationLink2D::get_enter_cost);
@@ -63,12 +63,38 @@ void NavigationLink2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bidirectional"), "set_bidirectional", "is_bidirectional");
ADD_PROPERTY(PropertyInfo(Variant::INT, "navigation_layers", PROPERTY_HINT_LAYERS_2D_NAVIGATION), "set_navigation_layers", "get_navigation_layers");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "start_location"), "set_start_location", "get_start_location");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "end_location"), "set_end_location", "get_end_location");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "start_position"), "set_start_position", "get_start_position");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "end_position"), "set_end_position", "get_end_position");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "enter_cost"), "set_enter_cost", "get_enter_cost");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "travel_cost"), "set_travel_cost", "get_travel_cost");
}
+#ifndef DISABLE_DEPRECATED
+bool NavigationLink2D::_set(const StringName &p_name, const Variant &p_value) {
+ if (p_name == "start_location") {
+ set_start_position(p_value);
+ return true;
+ }
+ if (p_name == "end_location") {
+ set_end_position(p_value);
+ return true;
+ }
+ return false;
+}
+
+bool NavigationLink2D::_get(const StringName &p_name, Variant &r_ret) const {
+ if (p_name == "start_location") {
+ r_ret = get_start_position();
+ return true;
+ }
+ if (p_name == "end_location") {
+ r_ret = get_end_position();
+ return true;
+ }
+ return false;
+}
+#endif // DISABLE_DEPRECATED
+
void NavigationLink2D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
@@ -77,15 +103,15 @@ void NavigationLink2D::_notification(int p_what) {
// Update global positions for the link.
Transform2D gt = get_global_transform();
- NavigationServer2D::get_singleton()->link_set_start_location(link, gt.xform(start_location));
- NavigationServer2D::get_singleton()->link_set_end_location(link, gt.xform(end_location));
+ NavigationServer2D::get_singleton()->link_set_start_position(link, gt.xform(start_position));
+ NavigationServer2D::get_singleton()->link_set_end_position(link, gt.xform(end_position));
}
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
// Update global positions for the link.
Transform2D gt = get_global_transform();
- NavigationServer2D::get_singleton()->link_set_start_location(link, gt.xform(start_location));
- NavigationServer2D::get_singleton()->link_set_end_location(link, gt.xform(end_location));
+ NavigationServer2D::get_singleton()->link_set_start_position(link, gt.xform(start_position));
+ NavigationServer2D::get_singleton()->link_set_end_position(link, gt.xform(end_position));
} break;
case NOTIFICATION_EXIT_TREE: {
NavigationServer2D::get_singleton()->link_set_map(link, RID());
@@ -102,9 +128,9 @@ void NavigationLink2D::_notification(int p_what) {
real_t radius = NavigationServer2D::get_singleton()->map_get_link_connection_radius(get_world_2d()->get_navigation_map());
- draw_line(get_start_location(), get_end_location(), color);
- draw_arc(get_start_location(), radius, 0, Math_TAU, 10, color);
- draw_arc(get_end_location(), radius, 0, Math_TAU, 10, color);
+ draw_line(get_start_position(), get_end_position(), color);
+ draw_arc(get_start_position(), radius, 0, Math_TAU, 10, color);
+ draw_arc(get_end_position(), radius, 0, Math_TAU, 10, color);
}
#endif // DEBUG_ENABLED
} break;
@@ -119,14 +145,14 @@ Rect2 NavigationLink2D::_edit_get_rect() const {
real_t radius = NavigationServer2D::get_singleton()->map_get_link_connection_radius(get_world_2d()->get_navigation_map());
- Rect2 rect(get_start_location(), Size2());
- rect.expand_to(get_end_location());
+ Rect2 rect(get_start_position(), Size2());
+ rect.expand_to(get_end_position());
rect.grow_by(radius);
return rect;
}
bool NavigationLink2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
- Point2 segment[2] = { get_start_location(), get_end_location() };
+ Point2 segment[2] = { get_start_position(), get_end_position() };
Vector2 closest_point = Geometry2D::get_closest_point_to_segment(p_point, segment);
return p_point.distance_to(closest_point) < p_tolerance;
@@ -199,19 +225,19 @@ bool NavigationLink2D::get_navigation_layer_value(int p_layer_number) const {
return get_navigation_layers() & (1 << (p_layer_number - 1));
}
-void NavigationLink2D::set_start_location(Vector2 p_location) {
- if (start_location.is_equal_approx(p_location)) {
+void NavigationLink2D::set_start_position(Vector2 p_position) {
+ if (start_position.is_equal_approx(p_position)) {
return;
}
- start_location = p_location;
+ start_position = p_position;
if (!is_inside_tree()) {
return;
}
Transform2D gt = get_global_transform();
- NavigationServer2D::get_singleton()->link_set_start_location(link, gt.xform(start_location));
+ NavigationServer2D::get_singleton()->link_set_start_position(link, gt.xform(start_position));
update_configuration_warnings();
@@ -222,19 +248,19 @@ void NavigationLink2D::set_start_location(Vector2 p_location) {
#endif // DEBUG_ENABLED
}
-void NavigationLink2D::set_end_location(Vector2 p_location) {
- if (end_location.is_equal_approx(p_location)) {
+void NavigationLink2D::set_end_position(Vector2 p_position) {
+ if (end_position.is_equal_approx(p_position)) {
return;
}
- end_location = p_location;
+ end_position = p_position;
if (!is_inside_tree()) {
return;
}
Transform2D gt = get_global_transform();
- NavigationServer2D::get_singleton()->link_set_end_location(link, gt.xform(end_location));
+ NavigationServer2D::get_singleton()->link_set_end_position(link, gt.xform(end_position));
update_configuration_warnings();
@@ -270,8 +296,8 @@ void NavigationLink2D::set_travel_cost(real_t p_travel_cost) {
PackedStringArray NavigationLink2D::get_configuration_warnings() const {
PackedStringArray warnings = Node::get_configuration_warnings();
- if (start_location.is_equal_approx(end_location)) {
- warnings.push_back(RTR("NavigationLink2D start location should be different than the end location to be useful."));
+ if (start_position.is_equal_approx(end_position)) {
+ warnings.push_back(RTR("NavigationLink2D start position should be different than the end position to be useful."));
}
return warnings;
@@ -282,6 +308,7 @@ NavigationLink2D::NavigationLink2D() {
NavigationServer2D::get_singleton()->link_set_owner_id(link, get_instance_id());
set_notify_transform(true);
+ set_hide_clip_children(true);
}
NavigationLink2D::~NavigationLink2D() {
diff --git a/scene/2d/navigation_link_2d.h b/scene/2d/navigation_link_2d.h
index e14ee5adb9..5bf2a72358 100644
--- a/scene/2d/navigation_link_2d.h
+++ b/scene/2d/navigation_link_2d.h
@@ -40,8 +40,8 @@ class NavigationLink2D : public Node2D {
RID link;
bool bidirectional = true;
uint32_t navigation_layers = 1;
- Vector2 end_location;
- Vector2 start_location;
+ Vector2 end_position;
+ Vector2 start_position;
real_t enter_cost = 0.0;
real_t travel_cost = 1.0;
@@ -49,6 +49,11 @@ protected:
static void _bind_methods();
void _notification(int p_what);
+#ifndef DISABLE_DEPRECATED
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_ret) const;
+#endif // DISABLE_DEPRECATED
+
public:
#ifdef TOOLS_ENABLED
virtual Rect2 _edit_get_rect() const override;
@@ -67,11 +72,11 @@ public:
void set_navigation_layer_value(int p_layer_number, bool p_value);
bool get_navigation_layer_value(int p_layer_number) const;
- void set_start_location(Vector2 p_location);
- Vector2 get_start_location() const { return start_location; }
+ void set_start_position(Vector2 p_position);
+ Vector2 get_start_position() const { return start_position; }
- void set_end_location(Vector2 p_location);
- Vector2 get_end_location() const { return end_location; }
+ void set_end_position(Vector2 p_position);
+ Vector2 get_end_position() const { return end_position; }
void set_enter_cost(real_t p_enter_cost);
real_t get_enter_cost() const { return enter_cost; }
diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp
index fe6af8dad2..3484a9de65 100644
--- a/scene/2d/navigation_region_2d.cpp
+++ b/scene/2d/navigation_region_2d.cpp
@@ -330,6 +330,7 @@ bool NavigationRegion2D::_get(const StringName &p_name, Variant &r_ret) const {
NavigationRegion2D::NavigationRegion2D() {
set_notify_transform(true);
+ set_hide_clip_children(true);
region = NavigationServer2D::get_singleton()->region_create();
NavigationServer2D::get_singleton()->region_set_owner_id(region, get_instance_id());
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 9fee99c6a7..1721bcde3b 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -434,6 +434,8 @@ struct _RigidBody2DInOut {
};
void RigidBody2D::_body_state_changed(PhysicsDirectBodyState2D *p_state) {
+ lock_callback();
+
set_block_transform_notify(true); // don't want notify (would feedback loop)
if (!freeze || freeze_mode != FREEZE_MODE_KINEMATIC) {
set_global_transform(p_state->get_transform());
@@ -527,6 +529,8 @@ void RigidBody2D::_body_state_changed(PhysicsDirectBodyState2D *p_state) {
contact_monitor->locked = false;
}
+
+ unlock_callback();
}
void RigidBody2D::_apply_body_mode() {
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index 39f88a0b5e..988ea87054 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -370,4 +370,5 @@ void RayCast2D::_bind_methods() {
}
RayCast2D::RayCast2D() {
+ set_hide_clip_children(true);
}
diff --git a/scene/2d/remote_transform_2d.cpp b/scene/2d/remote_transform_2d.cpp
index e9ce9560d3..c6730f7ab2 100644
--- a/scene/2d/remote_transform_2d.cpp
+++ b/scene/2d/remote_transform_2d.cpp
@@ -219,4 +219,5 @@ void RemoteTransform2D::_bind_methods() {
RemoteTransform2D::RemoteTransform2D() {
set_notify_transform(true);
+ set_hide_clip_children(true);
}
diff --git a/scene/2d/shape_cast_2d.cpp b/scene/2d/shape_cast_2d.cpp
index 24821858cf..bafb83361a 100644
--- a/scene/2d/shape_cast_2d.cpp
+++ b/scene/2d/shape_cast_2d.cpp
@@ -472,3 +472,7 @@ void ShapeCast2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_areas", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collide_with_areas", "is_collide_with_areas_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_bodies", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collide_with_bodies", "is_collide_with_bodies_enabled");
}
+
+ShapeCast2D::ShapeCast2D() {
+ set_hide_clip_children(true);
+}
diff --git a/scene/2d/shape_cast_2d.h b/scene/2d/shape_cast_2d.h
index 182614a721..8a62b799f8 100644
--- a/scene/2d/shape_cast_2d.h
+++ b/scene/2d/shape_cast_2d.h
@@ -119,6 +119,8 @@ public:
void clear_exceptions();
PackedStringArray get_configuration_warnings() const override;
+
+ ShapeCast2D();
};
#endif // SHAPE_CAST_2D_H
diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp
index 02388a7681..96711bbe72 100644
--- a/scene/2d/skeleton_2d.cpp
+++ b/scene/2d/skeleton_2d.cpp
@@ -519,6 +519,7 @@ Bone2D::Bone2D() {
bone_angle = 0;
autocalculate_length_and_angle = true;
set_notify_local_transform(true);
+ set_hide_clip_children(true);
//this is a clever hack so the bone knows no rest has been set yet, allowing to show an error.
for (int i = 0; i < 3; i++) {
rest[i] = Vector2(0, 0);
@@ -562,7 +563,7 @@ void Skeleton2D::_get_property_list(List<PropertyInfo> *p_list) const {
PropertyInfo(Variant::OBJECT, PNAME("modification_stack"),
PROPERTY_HINT_RESOURCE_TYPE,
"SkeletonModificationStack2D",
- PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DEFERRED_SET_RESOURCE | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE));
+ PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DEFERRED_SET_RESOURCE | PROPERTY_USAGE_ALWAYS_DUPLICATE));
}
void Skeleton2D::_make_bone_setup_dirty() {
@@ -801,6 +802,7 @@ void Skeleton2D::_bind_methods() {
Skeleton2D::Skeleton2D() {
skeleton = RS::get_singleton()->skeleton_create();
set_notify_transform(true);
+ set_hide_clip_children(true);
}
Skeleton2D::~Skeleton2D() {
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 4f282dc0ab..95bf67d38d 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -803,10 +803,10 @@ void TileMap::_make_quadrant_dirty(HashMap<Vector2i, TileMapQuadrant>::Iterator
void TileMap::_make_all_quadrants_dirty() {
// Make all quandrants dirty, then trigger an update later.
- for (unsigned int layer = 0; layer < layers.size(); layer++) {
- for (KeyValue<Vector2i, TileMapQuadrant> &E : layers[layer].quadrant_map) {
+ for (TileMapLayer &layer : layers) {
+ for (KeyValue<Vector2i, TileMapQuadrant> &E : layer.quadrant_map) {
if (!E.value.dirty_list_element.in_list()) {
- layers[layer].dirty_quadrant_list.add(&E.value.dirty_list_element);
+ layer.dirty_quadrant_list.add(&E.value.dirty_list_element);
}
}
}
@@ -1014,8 +1014,8 @@ void TileMap::_rendering_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_CANVAS: {
bool node_visible = is_visible_in_tree();
- for (int layer = 0; layer < (int)layers.size(); layer++) {
- for (KeyValue<Vector2i, TileMapQuadrant> &E_quadrant : layers[layer].quadrant_map) {
+ for (TileMapLayer &layer : layers) {
+ for (KeyValue<Vector2i, TileMapQuadrant> &E_quadrant : layer.quadrant_map) {
TileMapQuadrant &q = E_quadrant.value;
for (const KeyValue<Vector2i, RID> &kv : q.occluders) {
Transform2D xform;
@@ -1030,8 +1030,8 @@ void TileMap::_rendering_notification(int p_what) {
case NOTIFICATION_VISIBILITY_CHANGED: {
bool node_visible = is_visible_in_tree();
- for (int layer = 0; layer < (int)layers.size(); layer++) {
- for (KeyValue<Vector2i, TileMapQuadrant> &E_quadrant : layers[layer].quadrant_map) {
+ for (TileMapLayer &layer : layers) {
+ for (KeyValue<Vector2i, TileMapQuadrant> &E_quadrant : layer.quadrant_map) {
TileMapQuadrant &q = E_quadrant.value;
// Update occluders transform.
@@ -1050,8 +1050,8 @@ void TileMap::_rendering_notification(int p_what) {
if (!is_inside_tree()) {
return;
}
- for (int layer = 0; layer < (int)layers.size(); layer++) {
- for (KeyValue<Vector2i, TileMapQuadrant> &E_quadrant : layers[layer].quadrant_map) {
+ for (TileMapLayer &layer : layers) {
+ for (KeyValue<Vector2i, TileMapQuadrant> &E_quadrant : layer.quadrant_map) {
TileMapQuadrant &q = E_quadrant.value;
// Update occluders transform.
@@ -1071,8 +1071,8 @@ void TileMap::_rendering_notification(int p_what) {
} break;
case NOTIFICATION_EXIT_CANVAS: {
- for (int layer = 0; layer < (int)layers.size(); layer++) {
- for (KeyValue<Vector2i, TileMapQuadrant> &E_quadrant : layers[layer].quadrant_map) {
+ for (TileMapLayer &layer : layers) {
+ for (KeyValue<Vector2i, TileMapQuadrant> &E_quadrant : layer.quadrant_map) {
TileMapQuadrant &q = E_quadrant.value;
for (const KeyValue<Vector2i, RID> &kv : q.occluders) {
RS::get_singleton()->canvas_light_occluder_attach_to_canvas(kv.value, RID());
@@ -1257,16 +1257,16 @@ void TileMap::_rendering_update_dirty_quadrants(SelfList<TileMapQuadrant>::List
if (_rendering_quadrant_order_dirty) {
int index = -(int64_t)0x80000000; //always must be drawn below children.
- for (int layer = 0; layer < (int)layers.size(); layer++) {
+ for (TileMapLayer &layer : layers) {
// Sort the quadrants coords per local coordinates.
RBMap<Vector2i, Vector2i, TileMapQuadrant::CoordsWorldComparator> local_to_map;
- for (const KeyValue<Vector2i, TileMapQuadrant> &E : layers[layer].quadrant_map) {
+ for (const KeyValue<Vector2i, TileMapQuadrant> &E : layer.quadrant_map) {
local_to_map[map_to_local(E.key)] = E.key;
}
// Sort the quadrants.
for (const KeyValue<Vector2i, Vector2i> &E : local_to_map) {
- TileMapQuadrant &q = layers[layer].quadrant_map[E.value];
+ TileMapQuadrant &q = layer.quadrant_map[E.value];
for (const RID &ci : q.canvas_items) {
RS::get_singleton()->canvas_item_set_draw_index(ci, index++);
}
@@ -1379,7 +1379,7 @@ void TileMap::draw_tile(RID p_canvas_item, const Vector2i &p_position, const Ref
Color modulate = tile_data->get_modulate() * p_modulation;
// Compute the offset.
- Vector2i tile_offset = atlas_source->get_tile_effective_texture_offset(p_atlas_coords, p_alternative_tile);
+ Vector2i tile_offset = tile_data->get_texture_origin();
// Get destination rect.
Rect2 dest_rect;
@@ -1453,8 +1453,8 @@ void TileMap::_physics_notification(int p_what) {
if (is_inside_tree() && (!collision_animatable || in_editor)) {
// Update the new transform directly if we are not in animatable mode.
Transform2D gl_transform = get_global_transform();
- for (int layer = 0; layer < (int)layers.size(); layer++) {
- for (KeyValue<Vector2i, TileMapQuadrant> &E : layers[layer].quadrant_map) {
+ for (TileMapLayer &layer : layers) {
+ for (KeyValue<Vector2i, TileMapQuadrant> &E : layer.quadrant_map) {
TileMapQuadrant &q = E.value;
for (RID body : q.bodies) {
@@ -1476,8 +1476,8 @@ void TileMap::_physics_notification(int p_what) {
if (is_inside_tree() && !in_editor && collision_animatable) {
// Only active when animatable. Send the new transform to the physics...
new_transform = get_global_transform();
- for (int layer = 0; layer < (int)layers.size(); layer++) {
- for (KeyValue<Vector2i, TileMapQuadrant> &E : layers[layer].quadrant_map) {
+ for (TileMapLayer &layer : layers) {
+ for (KeyValue<Vector2i, TileMapQuadrant> &E : layer.quadrant_map) {
TileMapQuadrant &q = E.value;
for (RID body : q.bodies) {
@@ -1667,13 +1667,12 @@ void TileMap::_navigation_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_TRANSFORM_CHANGED: {
if (is_inside_tree()) {
- for (int layer = 0; layer < (int)layers.size(); layer++) {
+ for (TileMapLayer &layer : layers) {
Transform2D tilemap_xform = get_global_transform();
- for (KeyValue<Vector2i, TileMapQuadrant> &E_quadrant : layers[layer].quadrant_map) {
+ for (KeyValue<Vector2i, TileMapQuadrant> &E_quadrant : layer.quadrant_map) {
TileMapQuadrant &q = E_quadrant.value;
for (const KeyValue<Vector2i, Vector<RID>> &E_region : q.navigation_regions) {
- for (int layer_index = 0; layer_index < E_region.value.size(); layer_index++) {
- RID region = E_region.value[layer_index];
+ for (const RID &region : E_region.value) {
if (!region.is_valid()) {
continue;
}
@@ -2073,7 +2072,7 @@ void TileMap::erase_cell(int p_layer, const Vector2i &p_coords) {
int TileMap::get_cell_source_id(int p_layer, const Vector2i &p_coords, bool p_use_proxies) const {
ERR_FAIL_INDEX_V(p_layer, (int)layers.size(), TileSet::INVALID_SOURCE);
- // Get a cell source id from position
+ // Get a cell source id from position.
const HashMap<Vector2i, TileMapCell> &tile_map = layers[p_layer].tile_map;
HashMap<Vector2i, TileMapCell>::ConstIterator E = tile_map.find(p_coords);
@@ -2129,7 +2128,9 @@ int TileMap::get_cell_alternative_tile(int p_layer, const Vector2i &p_coords, bo
TileData *TileMap::get_cell_tile_data(int p_layer, const Vector2i &p_coords, bool p_use_proxies) const {
int source_id = get_cell_source_id(p_layer, p_coords, p_use_proxies);
- ERR_FAIL_COND_V_MSG(source_id == TileSet::INVALID_SOURCE, nullptr, vformat("Invalid TileSetSource at cell %s. Make sure a tile exists at this cell.", p_coords));
+ if (source_id == TileSet::INVALID_SOURCE) {
+ return nullptr;
+ }
Ref<TileSetAtlasSource> source = tile_set->get_source(source_id);
if (source.is_valid()) {
@@ -2567,7 +2568,7 @@ HashMap<Vector2i, TileSet::TerrainsPattern> TileMap::terrain_fill_path(int p_lay
}
}
}
- ERR_FAIL_COND_V_MSG(found_bit == TileSet::CELL_NEIGHBOR_MAX, output, vformat("Invalid terrain path, %s is not a neighbouring tile of %s", p_path[i + 1], p_path[i]));
+ ERR_FAIL_COND_V_MSG(found_bit == TileSet::CELL_NEIGHBOR_MAX, output, vformat("Invalid terrain path, %s is not a neighboring tile of %s", p_path[i + 1], p_path[i]));
neighbor_list.push_back(found_bit);
}
@@ -2813,8 +2814,8 @@ void TileMap::clear_layer(int p_layer) {
void TileMap::clear() {
// Remove all tiles.
_clear_internals();
- for (unsigned int i = 0; i < layers.size(); i++) {
- layers[i].tile_map.clear();
+ for (TileMapLayer &layer : layers) {
+ layer.tile_map.clear();
}
_recreate_internals();
used_rect_cache_dirty = true;
@@ -3219,7 +3220,7 @@ Vector2i TileMap::local_to_map(const Vector2 &p_local_position) const {
ret = ret.floor();
}
- // Compute the tile offset, and if we might the output for a neighbour top tile
+ // Compute the tile offset, and if we might the output for a neighbor top tile
Vector2 in_tile_pos = raw_pos - ret;
bool in_top_left_triangle = (in_tile_pos - Vector2(0.5, 0.0)).cross(Vector2(-0.5, 1.0 / overlapping_ratio - 1)) <= 0;
bool in_top_right_triangle = (in_tile_pos - Vector2(0.5, 0.0)).cross(Vector2(0.5, 1.0 / overlapping_ratio - 1)) > 0;
@@ -3283,7 +3284,7 @@ Vector2i TileMap::local_to_map(const Vector2 &p_local_position) const {
ret = ret.floor();
}
- // Compute the tile offset, and if we might the output for a neighbour top tile
+ // Compute the tile offset, and if we might the output for a neighbor top tile
Vector2 in_tile_pos = raw_pos - ret;
bool in_top_left_triangle = (in_tile_pos - Vector2(0.0, 0.5)).cross(Vector2(1.0 / overlapping_ratio - 1, -0.5)) > 0;
bool in_bottom_left_triangle = (in_tile_pos - Vector2(0.0, 0.5)).cross(Vector2(1.0 / overlapping_ratio - 1, 0.5)) <= 0;
@@ -3954,25 +3955,36 @@ PackedStringArray TileMap::get_configuration_warnings() const {
// Retrieve the set of Z index values with a Y-sorted layer.
RBSet<int> y_sorted_z_index;
- for (int layer = 0; layer < (int)layers.size(); layer++) {
- if (layers[layer].y_sort_enabled) {
- y_sorted_z_index.insert(layers[layer].z_index);
+ for (const TileMapLayer &layer : layers) {
+ if (layer.y_sort_enabled) {
+ y_sorted_z_index.insert(layer.z_index);
}
}
// Check if we have a non-sorted layer in a Z-index with a Y-sorted layer.
- for (int layer = 0; layer < (int)layers.size(); layer++) {
- if (!layers[layer].y_sort_enabled && y_sorted_z_index.has(layers[layer].z_index)) {
+ for (const TileMapLayer &layer : layers) {
+ if (!layer.y_sort_enabled && y_sorted_z_index.has(layer.z_index)) {
warnings.push_back(RTR("A Y-sorted layer has the same Z-index value as a not Y-sorted layer.\nThis may lead to unwanted behaviors, as a layer that is not Y-sorted will be Y-sorted as a whole with tiles from Y-sorted layers."));
break;
}
}
+ // Check if Y-sort is enabled on a layer but not on the node.
+ if (!is_y_sort_enabled()) {
+ for (const TileMapLayer &layer : layers) {
+ if (layer.y_sort_enabled) {
+ warnings.push_back(RTR("A TileMap layer is set as Y-sorted, but Y-sort is not enabled on the TileMap node itself."));
+ break;
+ }
+ }
+ }
+
+ // Check if we are in isometric mode without Y-sort enabled.
if (tile_set.is_valid() && tile_set->get_tile_shape() == TileSet::TILE_SHAPE_ISOMETRIC) {
bool warn = !is_y_sort_enabled();
if (!warn) {
- for (int layer = 0; layer < (int)layers.size(); layer++) {
- if (!layers[layer].y_sort_enabled) {
+ for (const TileMapLayer &layer : layers) {
+ if (!layer.y_sort_enabled) {
warn = true;
break;
}
diff --git a/scene/2d/visible_on_screen_notifier_2d.cpp b/scene/2d/visible_on_screen_notifier_2d.cpp
index 237eb3d987..1177cdb811 100644
--- a/scene/2d/visible_on_screen_notifier_2d.cpp
+++ b/scene/2d/visible_on_screen_notifier_2d.cpp
@@ -110,6 +110,7 @@ void VisibleOnScreenNotifier2D::_bind_methods() {
VisibleOnScreenNotifier2D::VisibleOnScreenNotifier2D() {
rect = Rect2(-10, -10, 20, 20);
+ set_hide_clip_children(true);
}
//////////////////////////////////////
diff --git a/scene/3d/area_3d.cpp b/scene/3d/area_3d.cpp
index fa61ce5546..5901e38bb4 100644
--- a/scene/3d/area_3d.cpp
+++ b/scene/3d/area_3d.cpp
@@ -51,13 +51,13 @@ bool Area3D::is_gravity_a_point() const {
return gravity_is_point;
}
-void Area3D::set_gravity_point_distance_scale(real_t p_scale) {
- gravity_distance_scale = p_scale;
- PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE, p_scale);
+void Area3D::set_gravity_point_unit_distance(real_t p_scale) {
+ gravity_point_unit_distance = p_scale;
+ PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE, p_scale);
}
-real_t Area3D::get_gravity_point_distance_scale() const {
- return gravity_distance_scale;
+real_t Area3D::get_gravity_point_unit_distance() const {
+ return gravity_point_unit_distance;
}
void Area3D::set_gravity_point_center(const Vector3 &p_center) {
@@ -230,6 +230,7 @@ void Area3D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i
return; //likely removed from the tree
}
+ lock_callback();
locked = true;
if (body_in) {
@@ -279,6 +280,7 @@ void Area3D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i
}
locked = false;
+ unlock_callback();
}
void Area3D::_clear_monitoring() {
@@ -417,6 +419,7 @@ void Area3D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i
return; //likely removed from the tree
}
+ lock_callback();
locked = true;
if (area_in) {
@@ -466,6 +469,7 @@ void Area3D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i
}
locked = false;
+ unlock_callback();
}
bool Area3D::is_monitoring() const {
@@ -651,8 +655,8 @@ void Area3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_gravity_is_point", "enable"), &Area3D::set_gravity_is_point);
ClassDB::bind_method(D_METHOD("is_gravity_a_point"), &Area3D::is_gravity_a_point);
- ClassDB::bind_method(D_METHOD("set_gravity_point_distance_scale", "distance_scale"), &Area3D::set_gravity_point_distance_scale);
- ClassDB::bind_method(D_METHOD("get_gravity_point_distance_scale"), &Area3D::get_gravity_point_distance_scale);
+ ClassDB::bind_method(D_METHOD("set_gravity_point_unit_distance", "distance_scale"), &Area3D::set_gravity_point_unit_distance);
+ ClassDB::bind_method(D_METHOD("get_gravity_point_unit_distance"), &Area3D::get_gravity_point_unit_distance);
ClassDB::bind_method(D_METHOD("set_gravity_point_center", "center"), &Area3D::set_gravity_point_center);
ClassDB::bind_method(D_METHOD("get_gravity_point_center"), &Area3D::get_gravity_point_center);
@@ -737,7 +741,7 @@ void Area3D::_bind_methods() {
ADD_GROUP("Gravity", "gravity_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "gravity_space_override", PROPERTY_HINT_ENUM, "Disabled,Combine,Combine-Replace,Replace,Replace-Combine", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_gravity_space_override_mode", "get_gravity_space_override_mode");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "gravity_point", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_gravity_is_point", "is_gravity_a_point");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "gravity_point_distance_scale", PROPERTY_HINT_RANGE, "0,1024,0.001,or_greater,exp"), "set_gravity_point_distance_scale", "get_gravity_point_distance_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "gravity_point_unit_distance", PROPERTY_HINT_RANGE, "0,1024,0.001,or_greater,exp,suffix:m"), "set_gravity_point_unit_distance", "get_gravity_point_unit_distance");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "gravity_point_center", PROPERTY_HINT_NONE, "suffix:m"), "set_gravity_point_center", "get_gravity_point_center");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "gravity_direction"), "set_gravity_direction", "get_gravity_direction");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "gravity", PROPERTY_HINT_RANGE, U"-32,32,0.001,or_less,or_greater,suffix:m/s\u00B2"), "set_gravity", "get_gravity");
diff --git a/scene/3d/area_3d.h b/scene/3d/area_3d.h
index 91b91f741a..607e0d2af8 100644
--- a/scene/3d/area_3d.h
+++ b/scene/3d/area_3d.h
@@ -51,7 +51,7 @@ private:
Vector3 gravity_vec;
real_t gravity = 0.0;
bool gravity_is_point = false;
- real_t gravity_distance_scale = 0.0;
+ real_t gravity_point_unit_distance = 0.0;
SpaceOverride linear_damp_space_override = SPACE_OVERRIDE_DISABLED;
SpaceOverride angular_damp_space_override = SPACE_OVERRIDE_DISABLED;
@@ -155,8 +155,8 @@ public:
void set_gravity_is_point(bool p_enabled);
bool is_gravity_a_point() const;
- void set_gravity_point_distance_scale(real_t p_scale);
- real_t get_gravity_point_distance_scale() const;
+ void set_gravity_point_unit_distance(real_t p_scale);
+ real_t get_gravity_point_unit_distance() const;
void set_gravity_point_center(const Vector3 &p_center);
const Vector3 &get_gravity_point_center() const;
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 574f5363d4..436b936586 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -284,14 +284,12 @@ void AudioStreamPlayer3D::_notification(int p_what) {
volume_vector = _update_panning();
}
- if (setplay.get() >= 0 && stream.is_valid()) {
+ if (setplayback.is_valid() && setplay.get() >= 0) {
active.set();
- Ref<AudioStreamPlayback> new_playback = stream->instantiate_playback();
- ERR_FAIL_COND_MSG(new_playback.is_null(), "Failed to instantiate playback.");
HashMap<StringName, Vector<AudioFrame>> bus_map;
bus_map[_get_actual_bus()] = volume_vector;
- AudioServer::get_singleton()->start_playback_stream(new_playback, bus_map, setplay.get(), actual_pitch_scale, linear_attenuation, attenuation_filter_cutoff_hz);
- stream_playbacks.push_back(new_playback);
+ AudioServer::get_singleton()->start_playback_stream(setplayback, bus_map, setplay.get(), actual_pitch_scale, linear_attenuation, attenuation_filter_cutoff_hz);
+ setplayback.unref();
setplay.set(-1);
}
@@ -580,14 +578,21 @@ void AudioStreamPlayer3D::play(float p_from_pos) {
if (stream->is_monophonic() && is_playing()) {
stop();
}
+ Ref<AudioStreamPlayback> stream_playback = stream->instantiate_playback();
+ ERR_FAIL_COND_MSG(stream_playback.is_null(), "Failed to instantiate playback.");
+
+ stream_playbacks.push_back(stream_playback);
+ setplayback = stream_playback;
setplay.set(p_from_pos);
active.set();
set_physics_process_internal(true);
}
void AudioStreamPlayer3D::seek(float p_seconds) {
- stop();
- play(p_seconds);
+ if (is_playing()) {
+ stop();
+ play(p_seconds);
+ }
}
void AudioStreamPlayer3D::stop() {
@@ -783,11 +788,13 @@ bool AudioStreamPlayer3D::get_stream_paused() const {
return false;
}
+bool AudioStreamPlayer3D::has_stream_playback() {
+ return !stream_playbacks.is_empty();
+}
+
Ref<AudioStreamPlayback> AudioStreamPlayer3D::get_stream_playback() {
- if (!stream_playbacks.is_empty()) {
- return stream_playbacks[stream_playbacks.size() - 1];
- }
- return nullptr;
+ ERR_FAIL_COND_V_MSG(stream_playbacks.is_empty(), Ref<AudioStreamPlayback>(), "Player is inactive. Call play() before requesting get_stream_playback().");
+ return stream_playbacks[stream_playbacks.size() - 1];
}
void AudioStreamPlayer3D::set_max_polyphony(int p_max_polyphony) {
@@ -841,7 +848,7 @@ void AudioStreamPlayer3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("_set_playing", "enable"), &AudioStreamPlayer3D::_set_playing);
ClassDB::bind_method(D_METHOD("_is_active"), &AudioStreamPlayer3D::_is_active);
- ClassDB::bind_method(D_METHOD("set_max_distance", "metres"), &AudioStreamPlayer3D::set_max_distance);
+ ClassDB::bind_method(D_METHOD("set_max_distance", "meters"), &AudioStreamPlayer3D::set_max_distance);
ClassDB::bind_method(D_METHOD("get_max_distance"), &AudioStreamPlayer3D::get_max_distance);
ClassDB::bind_method(D_METHOD("set_area_mask", "mask"), &AudioStreamPlayer3D::set_area_mask);
@@ -877,6 +884,7 @@ void AudioStreamPlayer3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_panning_strength", "panning_strength"), &AudioStreamPlayer3D::set_panning_strength);
ClassDB::bind_method(D_METHOD("get_panning_strength"), &AudioStreamPlayer3D::get_panning_strength);
+ ClassDB::bind_method(D_METHOD("has_stream_playback"), &AudioStreamPlayer3D::has_stream_playback);
ClassDB::bind_method(D_METHOD("get_stream_playback"), &AudioStreamPlayer3D::get_stream_playback);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"), "set_stream", "get_stream");
diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h
index 67cec91896..bba8f10761 100644
--- a/scene/3d/audio_stream_player_3d.h
+++ b/scene/3d/audio_stream_player_3d.h
@@ -69,6 +69,7 @@ private:
SafeFlag active{ false };
SafeNumeric<float> setplay{ -1.0 };
+ Ref<AudioStreamPlayback> setplayback;
AttenuationModel attenuation_model = ATTENUATION_INVERSE_DISTANCE;
float volume_db = 0.0;
@@ -188,6 +189,7 @@ public:
void set_panning_strength(float p_panning_strength);
float get_panning_strength() const;
+ bool has_stream_playback();
Ref<AudioStreamPlayback> get_stream_playback();
AudioStreamPlayer3D();
diff --git a/scene/3d/bone_attachment_3d.cpp b/scene/3d/bone_attachment_3d.cpp
index fe7f6837f0..ba5ff02862 100644
--- a/scene/3d/bone_attachment_3d.cpp
+++ b/scene/3d/bone_attachment_3d.cpp
@@ -81,11 +81,6 @@ bool BoneAttachment3D::_get(const StringName &p_path, Variant &r_ret) const {
}
void BoneAttachment3D::_get_property_list(List<PropertyInfo> *p_list) const {
- p_list->push_back(PropertyInfo(Variant::BOOL, "override_pose", PROPERTY_HINT_NONE, ""));
- if (override_pose) {
- p_list->push_back(PropertyInfo(Variant::INT, "override_mode", PROPERTY_HINT_ENUM, "Global Pose Override,Local Pose Override,Custom Pose"));
- }
-
p_list->push_back(PropertyInfo(Variant::BOOL, "use_external_skeleton", PROPERTY_HINT_NONE, ""));
if (use_external_skeleton) {
p_list->push_back(PropertyInfo(Variant::NODE_PATH, "external_skeleton", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Skeleton3D"));
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp
index e91948c6e1..47eb1eaa40 100644
--- a/scene/3d/camera_3d.cpp
+++ b/scene/3d/camera_3d.cpp
@@ -554,7 +554,7 @@ void Camera3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "projection", PROPERTY_HINT_ENUM, "Perspective,Orthogonal,Frustum"), "set_projection", "get_projection");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "current"), "set_current", "is_current");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fov", PROPERTY_HINT_RANGE, "1,179,0.1,degrees"), "set_fov", "get_fov");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "size", PROPERTY_HINT_RANGE, "0.001,16384,0.001,suffix:m"), "set_size", "get_size");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "size", PROPERTY_HINT_RANGE, "0.001,16384,0.001,or_greater,suffix:m"), "set_size", "get_size");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "frustum_offset", PROPERTY_HINT_NONE, "suffix:m"), "set_frustum_offset", "get_frustum_offset");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "near", PROPERTY_HINT_RANGE, "0.001,10,0.001,or_greater,exp,suffix:m"), "set_near", "get_near");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "far", PROPERTY_HINT_RANGE, "0.01,4000,0.01,or_greater,exp,suffix:m"), "set_far", "get_far");
@@ -602,7 +602,7 @@ void Camera3D::set_fov(real_t p_fov) {
}
void Camera3D::set_size(real_t p_size) {
- ERR_FAIL_COND(p_size < 0.001 || p_size > 16384);
+ ERR_FAIL_COND(p_size <= CMP_EPSILON);
size = p_size;
_update_camera_mode();
}
diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp
index c408b0714a..19d1b83cab 100644
--- a/scene/3d/collision_object_3d.cpp
+++ b/scene/3d/collision_object_3d.cpp
@@ -43,6 +43,11 @@ void CollisionObject3D::_notification(int p_what) {
}
_update_debug_shapes();
}
+#ifdef TOOLS_ENABLED
+ if (Engine::get_singleton()->is_editor_hint()) {
+ set_notify_local_transform(true); // Used for warnings and only in editor.
+ }
+#endif
} break;
case NOTIFICATION_EXIT_TREE: {
@@ -78,6 +83,14 @@ void CollisionObject3D::_notification(int p_what) {
_update_pickable();
} break;
+#ifdef TOOLS_ENABLED
+ case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
+ if (Engine::get_singleton()->is_editor_hint()) {
+ update_configuration_warnings();
+ }
+ } break;
+#endif
+
case NOTIFICATION_TRANSFORM_CHANGED: {
if (only_update_transform_changes) {
return;
@@ -100,10 +113,14 @@ void CollisionObject3D::_notification(int p_what) {
bool disabled = !is_enabled();
if (!disabled || (disable_mode != DISABLE_MODE_REMOVE)) {
- if (area) {
- PhysicsServer3D::get_singleton()->area_set_space(rid, RID());
+ if (callback_lock > 0) {
+ ERR_PRINT("Removing a CollisionObject node during a physics callback is not allowed and will cause undesired behavior. Remove with call_deferred() instead.");
} else {
- PhysicsServer3D::get_singleton()->body_set_space(rid, RID());
+ if (area) {
+ PhysicsServer3D::get_singleton()->area_set_space(rid, RID());
+ } else {
+ PhysicsServer3D::get_singleton()->body_set_space(rid, RID());
+ }
}
}
@@ -223,10 +240,14 @@ void CollisionObject3D::_apply_disabled() {
switch (disable_mode) {
case DISABLE_MODE_REMOVE: {
if (is_inside_tree()) {
- if (area) {
- PhysicsServer3D::get_singleton()->area_set_space(rid, RID());
+ if (callback_lock > 0) {
+ ERR_PRINT("Disabling a CollisionObject node during a physics callback is not allowed and will cause undesired behavior. Disable with call_deferred() instead.");
} else {
- PhysicsServer3D::get_singleton()->body_set_space(rid, RID());
+ if (area) {
+ PhysicsServer3D::get_singleton()->area_set_space(rid, RID());
+ } else {
+ PhysicsServer3D::get_singleton()->body_set_space(rid, RID());
+ }
}
}
} break;
@@ -716,6 +737,11 @@ PackedStringArray CollisionObject3D::get_configuration_warnings() const {
warnings.push_back(RTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape3D or CollisionPolygon3D as a child to define its shape."));
}
+ Vector3 scale = get_transform().get_basis().get_scale();
+ if (!(Math::is_zero_approx(scale.x - scale.y) && Math::is_zero_approx(scale.y - scale.z))) {
+ warnings.push_back(RTR("With a non-uniform scale this node will probably not function as expected.\nPlease make its scale uniform (i.e. the same on all axes), and change the size in children collision shapes instead."));
+ }
+
return warnings;
}
diff --git a/scene/3d/collision_object_3d.h b/scene/3d/collision_object_3d.h
index 656b8c9bf1..ebcbb39e0d 100644
--- a/scene/3d/collision_object_3d.h
+++ b/scene/3d/collision_object_3d.h
@@ -52,6 +52,7 @@ private:
bool area = false;
RID rid;
+ uint32_t callback_lock = 0;
DisableMode disable_mode = DISABLE_MODE_REMOVE;
@@ -97,6 +98,12 @@ private:
protected:
CollisionObject3D(RID p_rid, bool p_area);
+ _FORCE_INLINE_ void lock_callback() { callback_lock++; }
+ _FORCE_INLINE_ void unlock_callback() {
+ ERR_FAIL_COND(callback_lock == 0);
+ callback_lock--;
+ }
+
void _notification(int p_what);
static void _bind_methods();
diff --git a/scene/3d/collision_polygon_3d.cpp b/scene/3d/collision_polygon_3d.cpp
index 5fb8970085..53a61c1368 100644
--- a/scene/3d/collision_polygon_3d.cpp
+++ b/scene/3d/collision_polygon_3d.cpp
@@ -104,6 +104,11 @@ void CollisionPolygon3D::_notification(int p_what) {
if (parent) {
_update_in_shape_owner(true);
}
+#ifdef TOOLS_ENABLED
+ if (Engine::get_singleton()->is_editor_hint()) {
+ update_configuration_warnings();
+ }
+#endif
} break;
case NOTIFICATION_UNPARENTED: {
@@ -171,13 +176,18 @@ PackedStringArray CollisionPolygon3D::get_configuration_warnings() const {
PackedStringArray warnings = Node::get_configuration_warnings();
if (!Object::cast_to<CollisionObject3D>(get_parent())) {
- warnings.push_back(RTR("CollisionPolygon3D only serves to provide a collision shape to a CollisionObject3D derived node. Please only use it as a child of Area3D, StaticBody3D, RigidBody3D, CharacterBody3D, etc. to give them a shape."));
+ warnings.push_back(RTR("CollisionPolygon3D only serves to provide a collision shape to a CollisionObject3D derived node.\nPlease only use it as a child of Area3D, StaticBody3D, RigidBody3D, CharacterBody3D, etc. to give them a shape."));
}
if (polygon.is_empty()) {
warnings.push_back(RTR("An empty CollisionPolygon3D has no effect on collision."));
}
+ Vector3 scale = get_transform().get_basis().get_scale();
+ if (!(Math::is_zero_approx(scale.x - scale.y) && Math::is_zero_approx(scale.y - scale.z))) {
+ warnings.push_back(RTR("A non-uniformly scaled CollisionPolygon3D node will probably not function as expected.\nPlease make its scale uniform (i.e. the same on all axes), and change its polygon's vertices instead."));
+ }
+
return warnings;
}
diff --git a/scene/3d/collision_shape_3d.cpp b/scene/3d/collision_shape_3d.cpp
index 1709a17bce..dbd50cfd19 100644
--- a/scene/3d/collision_shape_3d.cpp
+++ b/scene/3d/collision_shape_3d.cpp
@@ -99,6 +99,11 @@ void CollisionShape3D::_notification(int p_what) {
if (parent) {
_update_in_shape_owner(true);
}
+#ifdef TOOLS_ENABLED
+ if (Engine::get_singleton()->is_editor_hint()) {
+ update_configuration_warnings();
+ }
+#endif
} break;
case NOTIFICATION_UNPARENTED: {
@@ -134,6 +139,11 @@ PackedStringArray CollisionShape3D::get_configuration_warnings() const {
}
}
+ Vector3 scale = get_transform().get_basis().get_scale();
+ if (!(Math::is_zero_approx(scale.x - scale.y) && Math::is_zero_approx(scale.y - scale.z))) {
+ warnings.push_back(RTR("A non-uniformly scaled CollisionShape3D node will probably not function as expected.\nPlease make its scale uniform (i.e. the same on all axes), and change the size of its shape resource instead."));
+ }
+
return warnings;
}
diff --git a/scene/3d/decal.cpp b/scene/3d/decal.cpp
index e9cc4e9479..fbcb1c8f2c 100644
--- a/scene/3d/decal.cpp
+++ b/scene/3d/decal.cpp
@@ -156,6 +156,10 @@ void Decal::_validate_property(PropertyInfo &p_property) const {
if (!distance_fade_enabled && (p_property.name == "distance_fade_begin" || p_property.name == "distance_fade_length")) {
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
}
+
+ if (p_property.name == "sorting_offset") {
+ p_property.usage = PROPERTY_USAGE_DEFAULT;
+ }
}
PackedStringArray Decal::get_configuration_warnings() const {
diff --git a/scene/3d/label_3d.cpp b/scene/3d/label_3d.cpp
index f8c54809da..b39ca43d2e 100644
--- a/scene/3d/label_3d.cpp
+++ b/scene/3d/label_3d.cpp
@@ -109,6 +109,15 @@ void Label3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_alpha_scissor_threshold", "threshold"), &Label3D::set_alpha_scissor_threshold);
ClassDB::bind_method(D_METHOD("get_alpha_scissor_threshold"), &Label3D::get_alpha_scissor_threshold);
+ ClassDB::bind_method(D_METHOD("set_alpha_hash_scale", "threshold"), &Label3D::set_alpha_hash_scale);
+ ClassDB::bind_method(D_METHOD("get_alpha_hash_scale"), &Label3D::get_alpha_hash_scale);
+
+ ClassDB::bind_method(D_METHOD("set_alpha_antialiasing", "alpha_aa"), &Label3D::set_alpha_antialiasing);
+ ClassDB::bind_method(D_METHOD("get_alpha_antialiasing"), &Label3D::get_alpha_antialiasing);
+
+ ClassDB::bind_method(D_METHOD("set_alpha_antialiasing_edge", "edge"), &Label3D::set_alpha_antialiasing_edge);
+ ClassDB::bind_method(D_METHOD("get_alpha_antialiasing_edge"), &Label3D::get_alpha_antialiasing_edge);
+
ClassDB::bind_method(D_METHOD("set_texture_filter", "mode"), &Label3D::set_texture_filter);
ClassDB::bind_method(D_METHOD("get_texture_filter"), &Label3D::get_texture_filter);
@@ -127,8 +136,11 @@ void Label3D::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "double_sided"), "set_draw_flag", "get_draw_flag", FLAG_DOUBLE_SIDED);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "no_depth_test"), "set_draw_flag", "get_draw_flag", FLAG_DISABLE_DEPTH_TEST);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "fixed_size"), "set_draw_flag", "get_draw_flag", FLAG_FIXED_SIZE);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "alpha_cut", PROPERTY_HINT_ENUM, "Disabled,Discard,Opaque Pre-Pass"), "set_alpha_cut_mode", "get_alpha_cut_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "alpha_cut", PROPERTY_HINT_ENUM, "Disabled,Discard,Opaque Pre-Pass,Alpha Hash"), "set_alpha_cut_mode", "get_alpha_cut_mode");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "alpha_scissor_threshold", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_alpha_scissor_threshold", "get_alpha_scissor_threshold");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "alpha_hash_scale", PROPERTY_HINT_RANGE, "0,2,0.01"), "set_alpha_hash_scale", "get_alpha_hash_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "alpha_antialiasing_mode", PROPERTY_HINT_ENUM, "Disabled,Alpha Edge Blend,Alpha Edge Clip"), "set_alpha_antialiasing", "get_alpha_antialiasing");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "alpha_antialiasing_edge", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_alpha_antialiasing_edge", "get_alpha_antialiasing_edge");
ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Nearest Mipmap,Linear Mipmap,Nearest Mipmap Anisotropic,Linear Mipmap Anisotropic"), "set_texture_filter", "get_texture_filter");
ADD_PROPERTY(PropertyInfo(Variant::INT, "render_priority", PROPERTY_HINT_RANGE, itos(RS::MATERIAL_RENDER_PRIORITY_MIN) + "," + itos(RS::MATERIAL_RENDER_PRIORITY_MAX) + ",1"), "set_render_priority", "get_render_priority");
ADD_PROPERTY(PropertyInfo(Variant::INT, "outline_render_priority", PROPERTY_HINT_RANGE, itos(RS::MATERIAL_RENDER_PRIORITY_MIN) + "," + itos(RS::MATERIAL_RENDER_PRIORITY_MAX) + ",1"), "set_outline_render_priority", "get_outline_render_priority");
@@ -162,6 +174,7 @@ void Label3D::_bind_methods() {
BIND_ENUM_CONSTANT(ALPHA_CUT_DISABLED);
BIND_ENUM_CONSTANT(ALPHA_CUT_DISCARD);
BIND_ENUM_CONSTANT(ALPHA_CUT_OPAQUE_PREPASS);
+ BIND_ENUM_CONSTANT(ALPHA_CUT_HASH);
}
void Label3D::_validate_property(PropertyInfo &p_property) const {
@@ -350,13 +363,24 @@ void Label3D::_generate_glyph_surfaces(const Glyph &p_glyph, Vector2 &r_offset,
RS::get_singleton()->material_set_param(surf.material, "uv2_offset", Vector3(0, 0, 0));
RS::get_singleton()->material_set_param(surf.material, "uv2_scale", Vector3(1, 1, 1));
RS::get_singleton()->material_set_param(surf.material, "alpha_scissor_threshold", alpha_scissor_threshold);
+ RS::get_singleton()->material_set_param(surf.material, "alpha_hash_scale", alpha_hash_scale);
+ RS::get_singleton()->material_set_param(surf.material, "alpha_antialiasing_edge", alpha_antialiasing_edge);
if (msdf) {
RS::get_singleton()->material_set_param(surf.material, "msdf_pixel_range", TS->font_get_msdf_pixel_range(p_glyph.font_rid));
RS::get_singleton()->material_set_param(surf.material, "msdf_outline_size", p_outline_size);
}
+ BaseMaterial3D::Transparency mat_transparency = BaseMaterial3D::Transparency::TRANSPARENCY_ALPHA;
+ if (get_alpha_cut_mode() == ALPHA_CUT_DISCARD) {
+ mat_transparency = BaseMaterial3D::Transparency::TRANSPARENCY_ALPHA_SCISSOR;
+ } else if (get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS) {
+ mat_transparency = BaseMaterial3D::Transparency::TRANSPARENCY_ALPHA_DEPTH_PRE_PASS;
+ } else if (get_alpha_cut_mode() == ALPHA_CUT_HASH) {
+ mat_transparency = BaseMaterial3D::Transparency::TRANSPARENCY_ALPHA_HASH;
+ }
+
RID shader_rid;
- StandardMaterial3D::get_material_for_2d(get_draw_flag(FLAG_SHADED), true, get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS, get_billboard_mode() == StandardMaterial3D::BILLBOARD_ENABLED, get_billboard_mode() == StandardMaterial3D::BILLBOARD_FIXED_Y, msdf, get_draw_flag(FLAG_DISABLE_DEPTH_TEST), get_draw_flag(FLAG_FIXED_SIZE), texture_filter, &shader_rid);
+ StandardMaterial3D::get_material_for_2d(get_draw_flag(FLAG_SHADED), mat_transparency, get_draw_flag(FLAG_DOUBLE_SIDED), get_billboard_mode() == StandardMaterial3D::BILLBOARD_ENABLED, get_billboard_mode() == StandardMaterial3D::BILLBOARD_FIXED_Y, msdf, get_draw_flag(FLAG_DISABLE_DEPTH_TEST), get_draw_flag(FLAG_FIXED_SIZE), texture_filter, alpha_antialiasing_mode, &shader_rid);
RS::get_singleton()->material_set_shader(surf.material, shader_rid);
RS::get_singleton()->material_set_param(surf.material, "texture_albedo", tex);
@@ -442,7 +466,7 @@ void Label3D::_shape() {
TS->shaped_text_set_spacing(text_rid, TextServer::SpacingType(i), font->get_spacing(TextServer::SpacingType(i)));
}
- TypedArray<Vector2i> stt;
+ TypedArray<Vector3i> stt;
if (st_parser == TextServer::STRUCTURED_TEXT_CUSTOM) {
GDVIRTUAL_CALL(_structured_text_parser, st_args, txt, stt);
} else {
@@ -906,7 +930,7 @@ StandardMaterial3D::BillboardMode Label3D::get_billboard_mode() const {
}
void Label3D::set_alpha_cut_mode(AlphaCutMode p_mode) {
- ERR_FAIL_INDEX(p_mode, 3);
+ ERR_FAIL_INDEX(p_mode, ALPHA_CUT_MAX);
if (alpha_cut != p_mode) {
alpha_cut = p_mode;
_queue_update();
@@ -929,6 +953,17 @@ Label3D::AlphaCutMode Label3D::get_alpha_cut_mode() const {
return alpha_cut;
}
+void Label3D::set_alpha_hash_scale(float p_hash_scale) {
+ if (alpha_hash_scale != p_hash_scale) {
+ alpha_hash_scale = p_hash_scale;
+ _queue_update();
+ }
+}
+
+float Label3D::get_alpha_hash_scale() const {
+ return alpha_hash_scale;
+}
+
void Label3D::set_alpha_scissor_threshold(float p_threshold) {
if (alpha_scissor_threshold != p_threshold) {
alpha_scissor_threshold = p_threshold;
@@ -940,6 +975,28 @@ float Label3D::get_alpha_scissor_threshold() const {
return alpha_scissor_threshold;
}
+void Label3D::set_alpha_antialiasing(BaseMaterial3D::AlphaAntiAliasing p_alpha_aa) {
+ if (alpha_antialiasing_mode != p_alpha_aa) {
+ alpha_antialiasing_mode = p_alpha_aa;
+ _queue_update();
+ }
+}
+
+BaseMaterial3D::AlphaAntiAliasing Label3D::get_alpha_antialiasing() const {
+ return alpha_antialiasing_mode;
+}
+
+void Label3D::set_alpha_antialiasing_edge(float p_edge) {
+ if (alpha_antialiasing_edge != p_edge) {
+ alpha_antialiasing_edge = p_edge;
+ _queue_update();
+ }
+}
+
+float Label3D::get_alpha_antialiasing_edge() const {
+ return alpha_antialiasing_edge;
+}
+
Label3D::Label3D() {
for (int i = 0; i < FLAG_MAX; i++) {
flags[i] = (i == FLAG_DOUBLE_SIDED);
diff --git a/scene/3d/label_3d.h b/scene/3d/label_3d.h
index 8fc772e4b0..912f485354 100644
--- a/scene/3d/label_3d.h
+++ b/scene/3d/label_3d.h
@@ -51,7 +51,9 @@ public:
enum AlphaCutMode {
ALPHA_CUT_DISABLED,
ALPHA_CUT_DISCARD,
- ALPHA_CUT_OPAQUE_PREPASS
+ ALPHA_CUT_OPAQUE_PREPASS,
+ ALPHA_CUT_HASH,
+ ALPHA_CUT_MAX
};
private:
@@ -59,6 +61,9 @@ private:
bool flags[FLAG_MAX] = {};
AlphaCutMode alpha_cut = ALPHA_CUT_DISABLED;
float alpha_scissor_threshold = 0.5;
+ float alpha_hash_scale = 1.0;
+ StandardMaterial3D::AlphaAntiAliasing alpha_antialiasing_mode = StandardMaterial3D::ALPHA_ANTIALIASING_OFF;
+ float alpha_antialiasing_edge = 0.0f;
AABB aabb;
@@ -143,7 +148,7 @@ private:
void _generate_glyph_surfaces(const Glyph &p_glyph, Vector2 &r_offset, const Color &p_modulate, int p_priority = 0, int p_outline_size = 0);
protected:
- GDVIRTUAL2RC(Array, _structured_text_parser, Array, String)
+ GDVIRTUAL2RC(TypedArray<Vector3i>, _structured_text_parser, Array, String)
void _notification(int p_what);
@@ -228,6 +233,15 @@ public:
void set_alpha_scissor_threshold(float p_threshold);
float get_alpha_scissor_threshold() const;
+ void set_alpha_hash_scale(float p_hash_scale);
+ float get_alpha_hash_scale() const;
+
+ void set_alpha_antialiasing(BaseMaterial3D::AlphaAntiAliasing p_alpha_aa);
+ BaseMaterial3D::AlphaAntiAliasing get_alpha_antialiasing() const;
+
+ void set_alpha_antialiasing_edge(float p_edge);
+ float get_alpha_antialiasing_edge() const;
+
void set_billboard_mode(StandardMaterial3D::BillboardMode p_mode);
StandardMaterial3D::BillboardMode get_billboard_mode() const;
diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp
index 77073ff763..cca84c2b85 100644
--- a/scene/3d/light_3d.cpp
+++ b/scene/3d/light_3d.cpp
@@ -157,9 +157,16 @@ AABB Light3D::get_aabb() const {
return AABB(Vector3(-1, -1, -1) * param[PARAM_RANGE], Vector3(2, 2, 2) * param[PARAM_RANGE]);
} else if (type == RenderingServer::LIGHT_SPOT) {
- real_t len = param[PARAM_RANGE];
- real_t size = Math::tan(Math::deg_to_rad(param[PARAM_SPOT_ANGLE])) * len;
- return AABB(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len));
+ real_t cone_slant_height = param[PARAM_RANGE];
+ real_t cone_angle_rad = Math::deg_to_rad(param[PARAM_SPOT_ANGLE]);
+
+ if (cone_angle_rad > Math_PI / 2.0) {
+ // Just return the AABB of an omni light if the spot angle is above 90 degrees.
+ return AABB(Vector3(-1, -1, -1) * cone_slant_height, Vector3(2, 2, 2) * cone_slant_height);
+ }
+
+ real_t size = Math::sin(cone_angle_rad) * cone_slant_height;
+ return AABB(Vector3(-size, -size, -cone_slant_height), Vector3(2 * size, 2 * size, cone_slant_height));
}
return AABB();
diff --git a/scene/3d/lightmap_gi.cpp b/scene/3d/lightmap_gi.cpp
index 6940bad4a6..fb74cffc94 100644
--- a/scene/3d/lightmap_gi.cpp
+++ b/scene/3d/lightmap_gi.cpp
@@ -455,8 +455,8 @@ int32_t LightmapGI::_compute_bsp_tree(const Vector<Vector3> &p_points, const Loc
Plane best_plane;
float best_plane_score = -1.0;
- for (uint32_t i = 0; i < p_simplex_indices.size(); i++) {
- const BSPSimplex &s = p_simplices[p_simplex_indices[i]];
+ for (const int idx : p_simplex_indices) {
+ const BSPSimplex &s = p_simplices[idx];
for (int j = 0; j < 4; j++) {
uint32_t plane_index = s.planes[j];
if (planes_tested[plane_index] == node_index) {
@@ -484,8 +484,8 @@ int32_t LightmapGI::_compute_bsp_tree(const Vector<Vector3> &p_points, const Loc
int over_count = 0;
int under_count = 0;
- for (uint32_t k = 0; k < p_simplex_indices.size(); k++) {
- int side = _bsp_get_simplex_side(p_points, p_simplices, plane, p_simplex_indices[k]);
+ for (const int &index : p_simplex_indices) {
+ int side = _bsp_get_simplex_side(p_points, p_simplices, plane, index);
if (side == -2) {
continue; //this simplex is invalid, skip for now
} else if (side < 0) {
@@ -523,8 +523,7 @@ int32_t LightmapGI::_compute_bsp_tree(const Vector<Vector3> &p_points, const Loc
LocalVector<int32_t> indices_under;
//split again, but add to list
- for (uint32_t i = 0; i < p_simplex_indices.size(); i++) {
- uint32_t index = p_simplex_indices[i];
+ for (const uint32_t index : p_simplex_indices) {
int side = _bsp_get_simplex_side(p_points, p_simplices, best_plane, index);
if (side == -2) {
@@ -977,8 +976,8 @@ LightmapGI::BakeError LightmapGI::bake(Node *p_from_node, String p_image_data_pa
}
}
- for (uint32_t i = 0; i < new_probe_positions.size(); i++) {
- probes_found.push_back(new_probe_positions[i]);
+ for (const Vector3 &position : new_probe_positions) {
+ probes_found.push_back(position);
}
}
@@ -1219,8 +1218,8 @@ LightmapGI::BakeError LightmapGI::bake(Node *p_from_node, String p_image_data_pa
LocalVector<BSPNode> bsp_nodes;
LocalVector<int32_t> planes_tested;
planes_tested.resize(bsp_planes.size());
- for (uint32_t i = 0; i < planes_tested.size(); i++) {
- planes_tested[i] = 0x7FFFFFFF;
+ for (int &index : planes_tested) {
+ index = 0x7FFFFFFF;
}
if (p_bake_step) {
@@ -1546,6 +1545,8 @@ void LightmapGI::_bind_methods() {
BIND_ENUM_CONSTANT(GENERATE_PROBES_SUBDIV_32);
BIND_ENUM_CONSTANT(BAKE_ERROR_OK);
+ BIND_ENUM_CONSTANT(BAKE_ERROR_NO_SCENE_ROOT);
+ BIND_ENUM_CONSTANT(BAKE_ERROR_FOREIGN_DATA);
BIND_ENUM_CONSTANT(BAKE_ERROR_NO_LIGHTMAPPER);
BIND_ENUM_CONSTANT(BAKE_ERROR_NO_SAVE_PATH);
BIND_ENUM_CONSTANT(BAKE_ERROR_NO_MESHES);
diff --git a/scene/3d/lightmap_gi.h b/scene/3d/lightmap_gi.h
index 1294571cc0..40ff9e4cad 100644
--- a/scene/3d/lightmap_gi.h
+++ b/scene/3d/lightmap_gi.h
@@ -124,6 +124,8 @@ public:
enum BakeError {
BAKE_ERROR_OK,
+ BAKE_ERROR_NO_SCENE_ROOT,
+ BAKE_ERROR_FOREIGN_DATA,
BAKE_ERROR_NO_LIGHTMAPPER,
BAKE_ERROR_NO_SAVE_PATH,
BAKE_ERROR_NO_MESHES,
diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp
index 0034bf78b9..4aa6e61ec5 100644
--- a/scene/3d/navigation_agent_3d.cpp
+++ b/scene/3d/navigation_agent_3d.cpp
@@ -80,10 +80,10 @@ void NavigationAgent3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_navigation_map", "navigation_map"), &NavigationAgent3D::set_navigation_map);
ClassDB::bind_method(D_METHOD("get_navigation_map"), &NavigationAgent3D::get_navigation_map);
- ClassDB::bind_method(D_METHOD("set_target_location", "location"), &NavigationAgent3D::set_target_location);
- ClassDB::bind_method(D_METHOD("get_target_location"), &NavigationAgent3D::get_target_location);
+ ClassDB::bind_method(D_METHOD("set_target_position", "position"), &NavigationAgent3D::set_target_position);
+ ClassDB::bind_method(D_METHOD("get_target_position"), &NavigationAgent3D::get_target_position);
- ClassDB::bind_method(D_METHOD("get_next_location"), &NavigationAgent3D::get_next_location);
+ ClassDB::bind_method(D_METHOD("get_next_path_position"), &NavigationAgent3D::get_next_path_position);
ClassDB::bind_method(D_METHOD("distance_to_target"), &NavigationAgent3D::distance_to_target);
ClassDB::bind_method(D_METHOD("set_velocity", "velocity"), &NavigationAgent3D::set_velocity);
ClassDB::bind_method(D_METHOD("get_current_navigation_result"), &NavigationAgent3D::get_current_navigation_result);
@@ -92,12 +92,12 @@ void NavigationAgent3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_target_reached"), &NavigationAgent3D::is_target_reached);
ClassDB::bind_method(D_METHOD("is_target_reachable"), &NavigationAgent3D::is_target_reachable);
ClassDB::bind_method(D_METHOD("is_navigation_finished"), &NavigationAgent3D::is_navigation_finished);
- ClassDB::bind_method(D_METHOD("get_final_location"), &NavigationAgent3D::get_final_location);
+ ClassDB::bind_method(D_METHOD("get_final_position"), &NavigationAgent3D::get_final_position);
ClassDB::bind_method(D_METHOD("_avoidance_done", "new_velocity"), &NavigationAgent3D::_avoidance_done);
ADD_GROUP("Pathfinding", "");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "target_location", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_target_location", "get_target_location");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "target_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_target_position", "get_target_position");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "path_desired_distance", PROPERTY_HINT_RANGE, "0.1,100,0.01,suffix:m"), "set_path_desired_distance", "get_path_desired_distance");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "target_desired_distance", PROPERTY_HINT_RANGE, "0.1,100,0.01,suffix:m"), "set_target_desired_distance", "get_target_desired_distance");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "agent_height_offset", PROPERTY_HINT_RANGE, "-100.0,100,0.01,suffix:m"), "set_agent_height_offset", "get_agent_height_offset");
@@ -212,9 +212,9 @@ NavigationAgent3D::~NavigationAgent3D() {
void NavigationAgent3D::set_avoidance_enabled(bool p_enabled) {
avoidance_enabled = p_enabled;
if (avoidance_enabled) {
- NavigationServer3D::get_singleton()->agent_set_callback(agent, get_instance_id(), "_avoidance_done");
+ NavigationServer3D::get_singleton()->agent_set_callback(agent, callable_mp(this, &NavigationAgent3D::_avoidance_done));
} else {
- NavigationServer3D::get_singleton()->agent_set_callback(agent, ObjectID(), "_avoidance_done");
+ NavigationServer3D::get_singleton()->agent_set_callback(agent, Callable());
}
}
@@ -224,7 +224,8 @@ bool NavigationAgent3D::get_avoidance_enabled() const {
void NavigationAgent3D::set_agent_parent(Node *p_agent_parent) {
// remove agent from any avoidance map before changing parent or there will be leftovers on the RVO map
- NavigationServer3D::get_singleton()->agent_set_callback(agent, ObjectID(), "_avoidance_done");
+ NavigationServer3D::get_singleton()->agent_set_callback(agent, Callable());
+
if (Object::cast_to<Node3D>(p_agent_parent) != nullptr) {
// place agent on navigation map first or else the RVO agent callback creation fails silently later
agent_parent = Object::cast_to<Node3D>(p_agent_parent);
@@ -233,6 +234,7 @@ void NavigationAgent3D::set_agent_parent(Node *p_agent_parent) {
} else {
NavigationServer3D::get_singleton()->agent_set_map(get_rid(), agent_parent->get_world_3d()->get_navigation_map());
}
+
// create new avoidance callback if enabled
set_avoidance_enabled(avoidance_enabled);
} else {
@@ -344,17 +346,17 @@ real_t NavigationAgent3D::get_path_max_distance() {
return path_max_distance;
}
-void NavigationAgent3D::set_target_location(Vector3 p_location) {
- target_location = p_location;
+void NavigationAgent3D::set_target_position(Vector3 p_position) {
+ target_position = p_position;
target_position_submitted = true;
_request_repath();
}
-Vector3 NavigationAgent3D::get_target_location() const {
- return target_location;
+Vector3 NavigationAgent3D::get_target_position() const {
+ return target_position;
}
-Vector3 NavigationAgent3D::get_next_location() {
+Vector3 NavigationAgent3D::get_next_path_position() {
update_navigation();
const Vector<Vector3> &navigation_path = navigation_result->get_path();
@@ -368,7 +370,7 @@ Vector3 NavigationAgent3D::get_next_location() {
real_t NavigationAgent3D::distance_to_target() const {
ERR_FAIL_COND_V_MSG(agent_parent == nullptr, 0.0, "The agent has no parent.");
- return agent_parent->get_global_transform().origin.distance_to(target_location);
+ return agent_parent->get_global_transform().origin.distance_to(target_position);
}
bool NavigationAgent3D::is_target_reached() const {
@@ -376,7 +378,7 @@ bool NavigationAgent3D::is_target_reached() const {
}
bool NavigationAgent3D::is_target_reachable() {
- return target_desired_distance >= get_final_location().distance_to(target_location);
+ return target_desired_distance >= get_final_position().distance_to(target_position);
}
bool NavigationAgent3D::is_navigation_finished() {
@@ -384,7 +386,7 @@ bool NavigationAgent3D::is_navigation_finished() {
return navigation_finished;
}
-Vector3 NavigationAgent3D::get_final_location() {
+Vector3 NavigationAgent3D::get_final_position() {
update_navigation();
const Vector<Vector3> &navigation_path = navigation_result->get_path();
@@ -467,7 +469,7 @@ void NavigationAgent3D::update_navigation() {
if (reload_path) {
navigation_query->set_start_position(origin);
- navigation_query->set_target_position(target_location);
+ navigation_query->set_target_position(target_position);
navigation_query->set_navigation_layers(navigation_layers);
navigation_query->set_metadata_flags(path_metadata_flags);
@@ -489,7 +491,7 @@ void NavigationAgent3D::update_navigation() {
// Check if we can advance the navigation path
if (navigation_finished == false) {
- // Advances to the next far away location.
+ // Advances to the next far away position.
const Vector<Vector3> &navigation_path = navigation_result->get_path();
const Vector<int32_t> &navigation_path_types = navigation_result->get_path_types();
const TypedArray<RID> &navigation_path_rids = navigation_result->get_path_rids();
@@ -499,7 +501,7 @@ void NavigationAgent3D::update_navigation() {
Dictionary details;
const Vector3 waypoint = navigation_path[navigation_path_index];
- details[SNAME("location")] = waypoint;
+ details[SNAME("position")] = waypoint;
int waypoint_type = -1;
if (path_metadata_flags.has_flag(NavigationPathQueryParameters3D::PathMetadataFlags::PATH_METADATA_INCLUDE_TYPES)) {
diff --git a/scene/3d/navigation_agent_3d.h b/scene/3d/navigation_agent_3d.h
index 91be068392..12f83ce6a8 100644
--- a/scene/3d/navigation_agent_3d.h
+++ b/scene/3d/navigation_agent_3d.h
@@ -62,7 +62,7 @@ class NavigationAgent3D : public Node {
real_t path_max_distance = 3.0;
- Vector3 target_location;
+ Vector3 target_position;
bool target_position_submitted = false;
Ref<NavigationPathQueryParameters3D> navigation_query;
Ref<NavigationPathQueryResult3D> navigation_result;
@@ -155,10 +155,10 @@ public:
void set_path_max_distance(real_t p_pmd);
real_t get_path_max_distance();
- void set_target_location(Vector3 p_location);
- Vector3 get_target_location() const;
+ void set_target_position(Vector3 p_position);
+ Vector3 get_target_position() const;
- Vector3 get_next_location();
+ Vector3 get_next_path_position();
Ref<NavigationPathQueryResult3D> get_current_navigation_result() const {
return navigation_result;
@@ -174,7 +174,7 @@ public:
bool is_target_reached() const;
bool is_target_reachable();
bool is_navigation_finished();
- Vector3 get_final_location();
+ Vector3 get_final_position();
void set_velocity(Vector3 p_velocity);
void _avoidance_done(Vector3 p_new_velocity);
diff --git a/scene/3d/navigation_link_3d.cpp b/scene/3d/navigation_link_3d.cpp
index e058ef62d0..f47fcfaf51 100644
--- a/scene/3d/navigation_link_3d.cpp
+++ b/scene/3d/navigation_link_3d.cpp
@@ -70,10 +70,10 @@ void NavigationLink3D::_update_debug_mesh() {
Vector<Vector3> lines;
// Draw line between the points.
- lines.push_back(start_location);
- lines.push_back(end_location);
+ lines.push_back(start_position);
+ lines.push_back(end_position);
- // Draw start location search radius
+ // Draw start position search radius
for (int i = 0; i < 30; i++) {
// Create a circle
const float ra = Math::deg_to_rad((float)(i * 12));
@@ -84,21 +84,21 @@ void NavigationLink3D::_update_debug_mesh() {
// Draw axis-aligned circle
switch (up_axis) {
case Vector3::AXIS_X:
- lines.append(start_location + Vector3(0, a.x, a.y));
- lines.append(start_location + Vector3(0, b.x, b.y));
+ lines.append(start_position + Vector3(0, a.x, a.y));
+ lines.append(start_position + Vector3(0, b.x, b.y));
break;
case Vector3::AXIS_Y:
- lines.append(start_location + Vector3(a.x, 0, a.y));
- lines.append(start_location + Vector3(b.x, 0, b.y));
+ lines.append(start_position + Vector3(a.x, 0, a.y));
+ lines.append(start_position + Vector3(b.x, 0, b.y));
break;
case Vector3::AXIS_Z:
- lines.append(start_location + Vector3(a.x, a.y, 0));
- lines.append(start_location + Vector3(b.x, b.y, 0));
+ lines.append(start_position + Vector3(a.x, a.y, 0));
+ lines.append(start_position + Vector3(b.x, b.y, 0));
break;
}
}
- // Draw end location search radius
+ // Draw end position search radius
for (int i = 0; i < 30; i++) {
// Create a circle
const float ra = Math::deg_to_rad((float)(i * 12));
@@ -109,16 +109,16 @@ void NavigationLink3D::_update_debug_mesh() {
// Draw axis-aligned circle
switch (up_axis) {
case Vector3::AXIS_X:
- lines.append(end_location + Vector3(0, a.x, a.y));
- lines.append(end_location + Vector3(0, b.x, b.y));
+ lines.append(end_position + Vector3(0, a.x, a.y));
+ lines.append(end_position + Vector3(0, b.x, b.y));
break;
case Vector3::AXIS_Y:
- lines.append(end_location + Vector3(a.x, 0, a.y));
- lines.append(end_location + Vector3(b.x, 0, b.y));
+ lines.append(end_position + Vector3(a.x, 0, a.y));
+ lines.append(end_position + Vector3(b.x, 0, b.y));
break;
case Vector3::AXIS_Z:
- lines.append(end_location + Vector3(a.x, a.y, 0));
- lines.append(end_location + Vector3(b.x, b.y, 0));
+ lines.append(end_position + Vector3(a.x, a.y, 0));
+ lines.append(end_position + Vector3(b.x, b.y, 0));
break;
}
}
@@ -157,11 +157,11 @@ void NavigationLink3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_navigation_layer_value", "layer_number", "value"), &NavigationLink3D::set_navigation_layer_value);
ClassDB::bind_method(D_METHOD("get_navigation_layer_value", "layer_number"), &NavigationLink3D::get_navigation_layer_value);
- ClassDB::bind_method(D_METHOD("set_start_location", "location"), &NavigationLink3D::set_start_location);
- ClassDB::bind_method(D_METHOD("get_start_location"), &NavigationLink3D::get_start_location);
+ ClassDB::bind_method(D_METHOD("set_start_position", "position"), &NavigationLink3D::set_start_position);
+ ClassDB::bind_method(D_METHOD("get_start_position"), &NavigationLink3D::get_start_position);
- ClassDB::bind_method(D_METHOD("set_end_location", "location"), &NavigationLink3D::set_end_location);
- ClassDB::bind_method(D_METHOD("get_end_location"), &NavigationLink3D::get_end_location);
+ ClassDB::bind_method(D_METHOD("set_end_position", "position"), &NavigationLink3D::set_end_position);
+ ClassDB::bind_method(D_METHOD("get_end_position"), &NavigationLink3D::get_end_position);
ClassDB::bind_method(D_METHOD("set_enter_cost", "enter_cost"), &NavigationLink3D::set_enter_cost);
ClassDB::bind_method(D_METHOD("get_enter_cost"), &NavigationLink3D::get_enter_cost);
@@ -172,12 +172,38 @@ void NavigationLink3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bidirectional"), "set_bidirectional", "is_bidirectional");
ADD_PROPERTY(PropertyInfo(Variant::INT, "navigation_layers", PROPERTY_HINT_LAYERS_3D_NAVIGATION), "set_navigation_layers", "get_navigation_layers");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "start_location"), "set_start_location", "get_start_location");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "end_location"), "set_end_location", "get_end_location");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "start_position"), "set_start_position", "get_start_position");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "end_position"), "set_end_position", "get_end_position");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "enter_cost"), "set_enter_cost", "get_enter_cost");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "travel_cost"), "set_travel_cost", "get_travel_cost");
}
+#ifndef DISABLE_DEPRECATED
+bool NavigationLink3D::_set(const StringName &p_name, const Variant &p_value) {
+ if (p_name == "start_location") {
+ set_start_position(p_value);
+ return true;
+ }
+ if (p_name == "end_location") {
+ set_end_position(p_value);
+ return true;
+ }
+ return false;
+}
+
+bool NavigationLink3D::_get(const StringName &p_name, Variant &r_ret) const {
+ if (p_name == "start_location") {
+ r_ret = get_start_position();
+ return true;
+ }
+ if (p_name == "end_location") {
+ r_ret = get_end_position();
+ return true;
+ }
+ return false;
+}
+#endif // DISABLE_DEPRECATED
+
void NavigationLink3D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
@@ -186,8 +212,8 @@ void NavigationLink3D::_notification(int p_what) {
// Update global positions for the link.
Transform3D gt = get_global_transform();
- NavigationServer3D::get_singleton()->link_set_start_location(link, gt.xform(start_location));
- NavigationServer3D::get_singleton()->link_set_end_location(link, gt.xform(end_location));
+ NavigationServer3D::get_singleton()->link_set_start_position(link, gt.xform(start_position));
+ NavigationServer3D::get_singleton()->link_set_end_position(link, gt.xform(end_position));
}
#ifdef DEBUG_ENABLED
@@ -197,8 +223,8 @@ void NavigationLink3D::_notification(int p_what) {
case NOTIFICATION_TRANSFORM_CHANGED: {
// Update global positions for the link.
Transform3D gt = get_global_transform();
- NavigationServer3D::get_singleton()->link_set_start_location(link, gt.xform(start_location));
- NavigationServer3D::get_singleton()->link_set_end_location(link, gt.xform(end_location));
+ NavigationServer3D::get_singleton()->link_set_start_position(link, gt.xform(start_position));
+ NavigationServer3D::get_singleton()->link_set_end_position(link, gt.xform(end_position));
#ifdef DEBUG_ENABLED
if (is_inside_tree() && debug_instance.is_valid()) {
@@ -316,19 +342,19 @@ bool NavigationLink3D::get_navigation_layer_value(int p_layer_number) const {
return get_navigation_layers() & (1 << (p_layer_number - 1));
}
-void NavigationLink3D::set_start_location(Vector3 p_location) {
- if (start_location.is_equal_approx(p_location)) {
+void NavigationLink3D::set_start_position(Vector3 p_position) {
+ if (start_position.is_equal_approx(p_position)) {
return;
}
- start_location = p_location;
+ start_position = p_position;
if (!is_inside_tree()) {
return;
}
Transform3D gt = get_global_transform();
- NavigationServer3D::get_singleton()->link_set_start_location(link, gt.xform(start_location));
+ NavigationServer3D::get_singleton()->link_set_start_position(link, gt.xform(start_position));
#ifdef DEBUG_ENABLED
_update_debug_mesh();
@@ -338,19 +364,19 @@ void NavigationLink3D::set_start_location(Vector3 p_location) {
update_configuration_warnings();
}
-void NavigationLink3D::set_end_location(Vector3 p_location) {
- if (end_location.is_equal_approx(p_location)) {
+void NavigationLink3D::set_end_position(Vector3 p_position) {
+ if (end_position.is_equal_approx(p_position)) {
return;
}
- end_location = p_location;
+ end_position = p_position;
if (!is_inside_tree()) {
return;
}
Transform3D gt = get_global_transform();
- NavigationServer3D::get_singleton()->link_set_end_location(link, gt.xform(end_location));
+ NavigationServer3D::get_singleton()->link_set_end_position(link, gt.xform(end_position));
#ifdef DEBUG_ENABLED
_update_debug_mesh();
@@ -385,8 +411,8 @@ void NavigationLink3D::set_travel_cost(real_t p_travel_cost) {
PackedStringArray NavigationLink3D::get_configuration_warnings() const {
PackedStringArray warnings = Node::get_configuration_warnings();
- if (start_location.is_equal_approx(end_location)) {
- warnings.push_back(RTR("NavigationLink3D start location should be different than the end location to be useful."));
+ if (start_position.is_equal_approx(end_position)) {
+ warnings.push_back(RTR("NavigationLink3D start position should be different than the end position to be useful."));
}
return warnings;
diff --git a/scene/3d/navigation_link_3d.h b/scene/3d/navigation_link_3d.h
index 175c5cdd5d..5c9ec36189 100644
--- a/scene/3d/navigation_link_3d.h
+++ b/scene/3d/navigation_link_3d.h
@@ -40,8 +40,8 @@ class NavigationLink3D : public Node3D {
RID link;
bool bidirectional = true;
uint32_t navigation_layers = 1;
- Vector3 end_location;
- Vector3 start_location;
+ Vector3 end_position;
+ Vector3 start_position;
real_t enter_cost = 0.0;
real_t travel_cost = 1.0;
@@ -56,6 +56,11 @@ protected:
static void _bind_methods();
void _notification(int p_what);
+#ifndef DISABLE_DEPRECATED
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_ret) const;
+#endif // DISABLE_DEPRECATED
+
public:
NavigationLink3D();
~NavigationLink3D();
@@ -72,11 +77,11 @@ public:
void set_navigation_layer_value(int p_layer_number, bool p_value);
bool get_navigation_layer_value(int p_layer_number) const;
- void set_start_location(Vector3 p_location);
- Vector3 get_start_location() const { return start_location; }
+ void set_start_position(Vector3 p_position);
+ Vector3 get_start_position() const { return start_position; }
- void set_end_location(Vector3 p_location);
- Vector3 get_end_location() const { return end_location; }
+ void set_end_position(Vector3 p_position);
+ Vector3 get_end_position() const { return end_position; }
void set_enter_cost(real_t p_enter_cost);
real_t get_enter_cost() const { return enter_cost; }
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index 46956b0a2e..f4ab09cd9b 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -484,6 +484,8 @@ struct _RigidBodyInOut {
};
void RigidBody3D::_body_state_changed(PhysicsDirectBodyState3D *p_state) {
+ lock_callback();
+
set_ignore_transform_notification(true);
set_global_transform(p_state->get_transform());
@@ -578,6 +580,8 @@ void RigidBody3D::_body_state_changed(PhysicsDirectBodyState3D *p_state) {
contact_monitor->locked = false;
}
+
+ unlock_callback();
}
void RigidBody3D::_notification(int p_what) {
@@ -973,12 +977,11 @@ TypedArray<Node3D> RigidBody3D::get_colliding_bodies() const {
}
PackedStringArray RigidBody3D::get_configuration_warnings() const {
- Transform3D t = get_transform();
-
- PackedStringArray warnings = Node::get_configuration_warnings();
+ PackedStringArray warnings = CollisionObject3D::get_configuration_warnings();
- if (ABS(t.basis.get_column(0).length() - 1.0) > 0.05 || ABS(t.basis.get_column(1).length() - 1.0) > 0.05 || ABS(t.basis.get_column(2).length() - 1.0) > 0.05) {
- warnings.push_back(RTR("Size changes to RigidBody will be overridden by the physics engine when running.\nChange the size in children collision shapes instead."));
+ Vector3 scale = get_transform().get_basis().get_scale();
+ if (ABS(scale.x - 1.0) > 0.05 || ABS(scale.y - 1.0) > 0.05 || ABS(scale.z - 1.0) > 0.05) {
+ warnings.push_back(RTR("Scale changes to RigidBody3D will be overridden by the physics engine when running.\nPlease change the size in children collision shapes instead."));
}
return warnings;
@@ -1343,7 +1346,7 @@ void CharacterBody3D::_move_and_slide_grounded(double p_delta, bool p_was_on_flo
motion = motion.slide(up_direction);
result.travel = Vector3();
} else {
- // Travel is too high to be safely cancelled, we take it into account.
+ // Travel is too high to be safely canceled, we take it into account.
result.travel = result.travel.slide(up_direction);
motion = motion.normalized() * result.travel.length();
}
@@ -1351,7 +1354,7 @@ void CharacterBody3D::_move_and_slide_grounded(double p_delta, bool p_was_on_flo
// Determines if you are on the ground, and limits the possibility of climbing on the walls because of the approximations.
_snap_on_floor(true, false);
} else {
- // If the movement is not cancelled we only keep the remaining.
+ // If the movement is not canceled we only keep the remaining.
motion = result.remainder;
}
diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp
index e8b51ceb92..e7e3084037 100644
--- a/scene/3d/soft_body_3d.cpp
+++ b/scene/3d/soft_body_3d.cpp
@@ -302,14 +302,6 @@ void SoftBody3D::_notification(int p_what) {
_prepare_physics_server();
}
} break;
-
-#ifdef TOOLS_ENABLED
- case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
- if (Engine::get_singleton()->is_editor_hint()) {
- update_configuration_warnings();
- }
- } break;
-#endif
}
}
@@ -391,11 +383,6 @@ PackedStringArray SoftBody3D::get_configuration_warnings() const {
warnings.push_back(RTR("This body will be ignored until you set a mesh."));
}
- Transform3D t = get_transform();
- if ((ABS(t.basis.get_column(0).length() - 1.0) > 0.05 || ABS(t.basis.get_column(1).length() - 1.0) > 0.05 || ABS(t.basis.get_column(2).length() - 1.0) > 0.05)) {
- warnings.push_back(RTR("Size changes to SoftBody3D will be overridden by the physics engine when running.\nChange the size in children collision shapes instead."));
- }
-
return warnings;
}
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 71d76c0d1c..59e4a0b718 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -245,8 +245,26 @@ void SpriteBase3D::draw_texture_rect(Ref<Texture2D> p_texture, Rect2 p_dst_rect,
RS::get_singleton()->mesh_set_custom_aabb(mesh_new, aabb_new);
set_aabb(aabb_new);
+ RS::get_singleton()->material_set_param(get_material(), "alpha_scissor_threshold", alpha_scissor_threshold);
+ RS::get_singleton()->material_set_param(get_material(), "alpha_hash_scale", alpha_hash_scale);
+ RS::get_singleton()->material_set_param(get_material(), "alpha_antialiasing_edge", alpha_antialiasing_edge);
+
+ BaseMaterial3D::Transparency mat_transparency = BaseMaterial3D::Transparency::TRANSPARENCY_DISABLED;
+ if (get_draw_flag(FLAG_TRANSPARENT)) {
+ if (get_alpha_cut_mode() == ALPHA_CUT_DISCARD) {
+ mat_transparency = BaseMaterial3D::Transparency::TRANSPARENCY_ALPHA_SCISSOR;
+ } else if (get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS) {
+ mat_transparency = BaseMaterial3D::Transparency::TRANSPARENCY_ALPHA_DEPTH_PRE_PASS;
+ } else if (get_alpha_cut_mode() == ALPHA_CUT_HASH) {
+ mat_transparency = BaseMaterial3D::Transparency::TRANSPARENCY_ALPHA_HASH;
+ } else {
+ mat_transparency = BaseMaterial3D::Transparency::TRANSPARENCY_ALPHA;
+ }
+ }
+
RID shader_rid;
- StandardMaterial3D::get_material_for_2d(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS, get_billboard_mode() == StandardMaterial3D::BILLBOARD_ENABLED, get_billboard_mode() == StandardMaterial3D::BILLBOARD_FIXED_Y, false, get_draw_flag(FLAG_DISABLE_DEPTH_TEST), get_draw_flag(FLAG_FIXED_SIZE), get_texture_filter(), &shader_rid);
+ StandardMaterial3D::get_material_for_2d(get_draw_flag(FLAG_SHADED), mat_transparency, get_draw_flag(FLAG_DOUBLE_SIDED), get_billboard_mode() == StandardMaterial3D::BILLBOARD_ENABLED, get_billboard_mode() == StandardMaterial3D::BILLBOARD_FIXED_Y, false, get_draw_flag(FLAG_DISABLE_DEPTH_TEST), get_draw_flag(FLAG_FIXED_SIZE), get_texture_filter(), alpha_antialiasing_mode, &shader_rid);
+
if (last_shader != shader_rid) {
RS::get_singleton()->material_set_shader(get_material(), shader_rid);
last_shader = shader_rid;
@@ -433,7 +451,7 @@ bool SpriteBase3D::get_draw_flag(DrawFlags p_flag) const {
}
void SpriteBase3D::set_alpha_cut_mode(AlphaCutMode p_mode) {
- ERR_FAIL_INDEX(p_mode, 3);
+ ERR_FAIL_INDEX(p_mode, ALPHA_CUT_MAX);
alpha_cut = p_mode;
_queue_redraw();
}
@@ -442,6 +460,50 @@ SpriteBase3D::AlphaCutMode SpriteBase3D::get_alpha_cut_mode() const {
return alpha_cut;
}
+void SpriteBase3D::set_alpha_hash_scale(float p_hash_scale) {
+ if (alpha_hash_scale != p_hash_scale) {
+ alpha_hash_scale = p_hash_scale;
+ _queue_redraw();
+ }
+}
+
+float SpriteBase3D::get_alpha_hash_scale() const {
+ return alpha_hash_scale;
+}
+
+void SpriteBase3D::set_alpha_scissor_threshold(float p_threshold) {
+ if (alpha_scissor_threshold != p_threshold) {
+ alpha_scissor_threshold = p_threshold;
+ _queue_redraw();
+ }
+}
+
+float SpriteBase3D::get_alpha_scissor_threshold() const {
+ return alpha_scissor_threshold;
+}
+
+void SpriteBase3D::set_alpha_antialiasing(BaseMaterial3D::AlphaAntiAliasing p_alpha_aa) {
+ if (alpha_antialiasing_mode != p_alpha_aa) {
+ alpha_antialiasing_mode = p_alpha_aa;
+ _queue_redraw();
+ }
+}
+
+BaseMaterial3D::AlphaAntiAliasing SpriteBase3D::get_alpha_antialiasing() const {
+ return alpha_antialiasing_mode;
+}
+
+void SpriteBase3D::set_alpha_antialiasing_edge(float p_edge) {
+ if (alpha_antialiasing_edge != p_edge) {
+ alpha_antialiasing_edge = p_edge;
+ _queue_redraw();
+ }
+}
+
+float SpriteBase3D::get_alpha_antialiasing_edge() const {
+ return alpha_antialiasing_edge;
+}
+
void SpriteBase3D::set_billboard_mode(StandardMaterial3D::BillboardMode p_mode) {
ERR_FAIL_INDEX(p_mode, 3); // Cannot use BILLBOARD_PARTICLES.
billboard_mode = p_mode;
@@ -494,6 +556,18 @@ void SpriteBase3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_alpha_cut_mode", "mode"), &SpriteBase3D::set_alpha_cut_mode);
ClassDB::bind_method(D_METHOD("get_alpha_cut_mode"), &SpriteBase3D::get_alpha_cut_mode);
+ ClassDB::bind_method(D_METHOD("set_alpha_scissor_threshold", "threshold"), &SpriteBase3D::set_alpha_scissor_threshold);
+ ClassDB::bind_method(D_METHOD("get_alpha_scissor_threshold"), &SpriteBase3D::get_alpha_scissor_threshold);
+
+ ClassDB::bind_method(D_METHOD("set_alpha_hash_scale", "threshold"), &SpriteBase3D::set_alpha_hash_scale);
+ ClassDB::bind_method(D_METHOD("get_alpha_hash_scale"), &SpriteBase3D::get_alpha_hash_scale);
+
+ ClassDB::bind_method(D_METHOD("set_alpha_antialiasing", "alpha_aa"), &SpriteBase3D::set_alpha_antialiasing);
+ ClassDB::bind_method(D_METHOD("get_alpha_antialiasing"), &SpriteBase3D::get_alpha_antialiasing);
+
+ ClassDB::bind_method(D_METHOD("set_alpha_antialiasing_edge", "edge"), &SpriteBase3D::set_alpha_antialiasing_edge);
+ ClassDB::bind_method(D_METHOD("get_alpha_antialiasing_edge"), &SpriteBase3D::get_alpha_antialiasing_edge);
+
ClassDB::bind_method(D_METHOD("set_billboard_mode", "mode"), &SpriteBase3D::set_billboard_mode);
ClassDB::bind_method(D_METHOD("get_billboard_mode"), &SpriteBase3D::get_billboard_mode);
@@ -519,7 +593,11 @@ void SpriteBase3D::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "double_sided"), "set_draw_flag", "get_draw_flag", FLAG_DOUBLE_SIDED);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "no_depth_test"), "set_draw_flag", "get_draw_flag", FLAG_DISABLE_DEPTH_TEST);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "fixed_size"), "set_draw_flag", "get_draw_flag", FLAG_FIXED_SIZE);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "alpha_cut", PROPERTY_HINT_ENUM, "Disabled,Discard,Opaque Pre-Pass"), "set_alpha_cut_mode", "get_alpha_cut_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "alpha_cut", PROPERTY_HINT_ENUM, "Disabled,Discard,Opaque Pre-Pass,Alpha Hash"), "set_alpha_cut_mode", "get_alpha_cut_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "alpha_scissor_threshold", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_alpha_scissor_threshold", "get_alpha_scissor_threshold");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "alpha_hash_scale", PROPERTY_HINT_RANGE, "0,2,0.01"), "set_alpha_hash_scale", "get_alpha_hash_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "alpha_antialiasing_mode", PROPERTY_HINT_ENUM, "Disabled,Alpha Edge Blend,Alpha Edge Clip"), "set_alpha_antialiasing", "get_alpha_antialiasing");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "alpha_antialiasing_edge", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_alpha_antialiasing_edge", "get_alpha_antialiasing_edge");
ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Nearest Mipmap,Linear Mipmap,Nearest Mipmap Anisotropic,Linear Mipmap Anisotropic"), "set_texture_filter", "get_texture_filter");
ADD_PROPERTY(PropertyInfo(Variant::INT, "render_priority", PROPERTY_HINT_RANGE, itos(RS::MATERIAL_RENDER_PRIORITY_MIN) + "," + itos(RS::MATERIAL_RENDER_PRIORITY_MAX) + ",1"), "set_render_priority", "get_render_priority");
@@ -533,6 +611,7 @@ void SpriteBase3D::_bind_methods() {
BIND_ENUM_CONSTANT(ALPHA_CUT_DISABLED);
BIND_ENUM_CONSTANT(ALPHA_CUT_DISCARD);
BIND_ENUM_CONSTANT(ALPHA_CUT_OPAQUE_PREPASS);
+ BIND_ENUM_CONSTANT(ALPHA_CUT_HASH);
}
SpriteBase3D::SpriteBase3D() {
@@ -550,7 +629,6 @@ SpriteBase3D::SpriteBase3D() {
RS::get_singleton()->material_set_param(material, "uv1_scale", Vector3(1, 1, 1));
RS::get_singleton()->material_set_param(material, "uv2_offset", Vector3(0, 0, 0));
RS::get_singleton()->material_set_param(material, "uv2_scale", Vector3(1, 1, 1));
- RS::get_singleton()->material_set_param(material, "alpha_scissor_threshold", 0.5);
mesh = RenderingServer::get_singleton()->mesh_create();
@@ -866,7 +944,6 @@ void AnimatedSprite3D::_validate_property(PropertyInfo &p_property) const {
}
if (p_property.name == "animation") {
- p_property.hint = PROPERTY_HINT_ENUM;
List<StringName> names;
frames->get_animation_list(&names);
names.sort_custom<StringName::AlphCompare>();
@@ -916,6 +993,12 @@ void AnimatedSprite3D::_validate_property(PropertyInfo &p_property) const {
void AnimatedSprite3D::_notification(int p_what) {
switch (p_what) {
+ case NOTIFICATION_READY: {
+ if (!Engine::get_singleton()->is_editor_hint() && !frames.is_null() && frames->has_animation(autoplay)) {
+ play(autoplay);
+ }
+ } break;
+
case NOTIFICATION_INTERNAL_PROCESS: {
if (frames.is_null() || !frames->has_animation(animation)) {
return;
@@ -925,7 +1008,8 @@ void AnimatedSprite3D::_notification(int p_what) {
int i = 0;
while (remaining) {
// Animation speed may be changed by animation_finished or frame_changed signals.
- double speed = frames->get_animation_speed(animation) * Math::abs(speed_scale);
+ double speed = frames->get_animation_speed(animation) * speed_scale * custom_speed_scale * frame_speed_scale;
+ double abs_speed = Math::abs(speed);
if (speed == 0) {
return; // Do nothing.
@@ -934,53 +1018,57 @@ void AnimatedSprite3D::_notification(int p_what) {
// Frame count may be changed by animation_finished or frame_changed signals.
int fc = frames->get_frame_count(animation);
- if (timeout <= 0) {
- int last_frame = fc - 1;
- if (!playing_backwards) {
- // Forward.
+ int last_frame = fc - 1;
+ if (!signbit(speed)) {
+ // Forwards.
+ if (frame_progress >= 1.0) {
if (frame >= last_frame) {
if (frames->get_animation_loop(animation)) {
frame = 0;
- emit_signal(SceneStringNames::get_singleton()->animation_finished);
+ emit_signal("animation_looped");
} else {
frame = last_frame;
- if (!is_over) {
- is_over = true;
- emit_signal(SceneStringNames::get_singleton()->animation_finished);
- }
+ pause();
+ emit_signal(SceneStringNames::get_singleton()->animation_finished);
+ return;
}
} else {
frame++;
}
- } else {
- // Reversed.
+ _calc_frame_speed_scale();
+ frame_progress = 0.0;
+ _queue_redraw();
+ emit_signal(SceneStringNames::get_singleton()->frame_changed);
+ }
+ double to_process = MIN((1.0 - frame_progress) / abs_speed, remaining);
+ frame_progress += to_process * abs_speed;
+ remaining -= to_process;
+ } else {
+ // Backwards.
+ if (frame_progress <= 0) {
if (frame <= 0) {
if (frames->get_animation_loop(animation)) {
frame = last_frame;
- emit_signal(SceneStringNames::get_singleton()->animation_finished);
+ emit_signal("animation_looped");
} else {
frame = 0;
- if (!is_over) {
- is_over = true;
- emit_signal(SceneStringNames::get_singleton()->animation_finished);
- }
+ pause();
+ emit_signal(SceneStringNames::get_singleton()->animation_finished);
+ return;
}
} else {
frame--;
}
+ _calc_frame_speed_scale();
+ frame_progress = 1.0;
+ _queue_redraw();
+ emit_signal(SceneStringNames::get_singleton()->frame_changed);
}
-
- timeout = _get_frame_duration();
-
- _queue_redraw();
-
- emit_signal(SceneStringNames::get_singleton()->frame_changed);
+ double to_process = MIN(frame_progress / abs_speed, remaining);
+ frame_progress -= to_process * abs_speed;
+ remaining -= to_process;
}
- double to_process = MIN(timeout / speed, remaining);
- timeout -= to_process * speed;
- remaining -= to_process;
-
i++;
if (i > fc) {
return; // Prevents freezing if to_process is each time much less than remaining.
@@ -991,25 +1079,37 @@ void AnimatedSprite3D::_notification(int p_what) {
}
void AnimatedSprite3D::set_sprite_frames(const Ref<SpriteFrames> &p_frames) {
+ if (frames == p_frames) {
+ return;
+ }
+
if (frames.is_valid()) {
frames->disconnect(SceneStringNames::get_singleton()->changed, callable_mp(this, &AnimatedSprite3D::_res_changed));
}
-
+ stop();
frames = p_frames;
if (frames.is_valid()) {
frames->connect(SceneStringNames::get_singleton()->changed, callable_mp(this, &AnimatedSprite3D::_res_changed));
- }
- if (frames.is_null()) {
- frame = 0;
- } else {
- set_frame(frame);
+ List<StringName> al;
+ frames->get_animation_list(&al);
+ if (al.size() == 0) {
+ set_animation(StringName());
+ set_autoplay(String());
+ } else {
+ if (!frames->has_animation(animation)) {
+ set_animation(al[0]);
+ }
+ if (!frames->has_animation(autoplay)) {
+ set_autoplay(String());
+ }
+ }
}
notify_property_list_changed();
- _reset_timeout();
_queue_redraw();
update_configuration_warnings();
+ emit_signal("sprite_frames_changed");
}
Ref<SpriteFrames> AnimatedSprite3D::get_sprite_frames() const {
@@ -1017,44 +1117,63 @@ Ref<SpriteFrames> AnimatedSprite3D::get_sprite_frames() const {
}
void AnimatedSprite3D::set_frame(int p_frame) {
+ set_frame_and_progress(p_frame, signbit(get_playing_speed()) ? 1.0 : 0.0);
+}
+
+int AnimatedSprite3D::get_frame() const {
+ return frame;
+}
+
+void AnimatedSprite3D::set_frame_progress(real_t p_progress) {
+ frame_progress = p_progress;
+}
+
+real_t AnimatedSprite3D::get_frame_progress() const {
+ return frame_progress;
+}
+
+void AnimatedSprite3D::set_frame_and_progress(int p_frame, real_t p_progress) {
if (frames.is_null()) {
return;
}
- if (frames->has_animation(animation)) {
- int limit = frames->get_frame_count(animation);
- if (p_frame >= limit) {
- p_frame = limit - 1;
- }
- }
+ bool has_animation = frames->has_animation(animation);
+ int end_frame = has_animation ? MAX(0, frames->get_frame_count(animation) - 1) : 0;
+ bool is_changed = frame != p_frame;
if (p_frame < 0) {
- p_frame = 0;
+ frame = 0;
+ } else if (has_animation && p_frame > end_frame) {
+ frame = end_frame;
+ } else {
+ frame = p_frame;
}
- if (frame == p_frame) {
- return;
- }
+ _calc_frame_speed_scale();
+ frame_progress = p_progress;
- frame = p_frame;
- _reset_timeout();
+ if (!is_changed) {
+ return; // No change, don't redraw.
+ }
_queue_redraw();
emit_signal(SceneStringNames::get_singleton()->frame_changed);
}
-int AnimatedSprite3D::get_frame() const {
- return frame;
-}
-
void AnimatedSprite3D::set_speed_scale(float p_speed_scale) {
speed_scale = p_speed_scale;
- playing_backwards = signbit(speed_scale) != backwards;
}
float AnimatedSprite3D::get_speed_scale() const {
return speed_scale;
}
+float AnimatedSprite3D::get_playing_speed() const {
+ if (!playing) {
+ return 0;
+ }
+ return speed_scale * custom_speed_scale;
+}
+
Rect2 AnimatedSprite3D::get_item_rect() const {
if (frames.is_null() || !frames->has_animation(animation)) {
return Rect2(0, 0, 1, 1);
@@ -1085,69 +1204,131 @@ Rect2 AnimatedSprite3D::get_item_rect() const {
}
void AnimatedSprite3D::_res_changed() {
- set_frame(frame);
+ set_frame_and_progress(frame, frame_progress);
_queue_redraw();
notify_property_list_changed();
}
-void AnimatedSprite3D::set_playing(bool p_playing) {
- if (playing == p_playing) {
- return;
+bool AnimatedSprite3D::is_playing() const {
+ return playing;
+}
+
+void AnimatedSprite3D::set_autoplay(const String &p_name) {
+ if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) {
+ WARN_PRINT("Setting autoplay after the node has been added to the scene has no effect.");
}
- playing = p_playing;
- playing_backwards = signbit(speed_scale) != backwards;
- set_process_internal(playing);
- notify_property_list_changed();
+
+ autoplay = p_name;
}
-bool AnimatedSprite3D::is_playing() const {
- return playing;
+String AnimatedSprite3D::get_autoplay() const {
+ return autoplay;
}
-void AnimatedSprite3D::play(const StringName &p_animation, bool p_backwards) {
- backwards = p_backwards;
- playing_backwards = signbit(speed_scale) != backwards;
+void AnimatedSprite3D::play(const StringName &p_name, float p_custom_scale, bool p_from_end) {
+ StringName name = p_name;
+
+ if (name == StringName()) {
+ name = animation;
+ }
+
+ ERR_FAIL_COND_MSG(frames == nullptr, vformat("There is no animation with name '%s'.", name));
+ ERR_FAIL_COND_MSG(!frames->get_animation_names().has(name), vformat("There is no animation with name '%s'.", name));
- if (p_animation) {
- set_animation(p_animation);
- if (frames.is_valid() && playing_backwards && get_frame() == 0) {
- set_frame(frames->get_frame_count(p_animation) - 1);
+ if (frames->get_frame_count(name) == 0) {
+ return;
+ }
+
+ playing = true;
+ custom_speed_scale = p_custom_scale;
+
+ int end_frame = MAX(0, frames->get_frame_count(animation) - 1);
+ if (name != animation) {
+ animation = name;
+ if (p_from_end) {
+ set_frame_and_progress(end_frame, 1.0);
+ } else {
+ set_frame_and_progress(0, 0.0);
+ }
+ emit_signal("animation_changed");
+ } else {
+ bool is_backward = signbit(speed_scale * custom_speed_scale);
+ if (p_from_end && is_backward && frame == 0 && frame_progress <= 0.0) {
+ set_frame_and_progress(end_frame, 1.0);
+ } else if (!p_from_end && !is_backward && frame == end_frame && frame_progress >= 1.0) {
+ set_frame_and_progress(0, 0.0);
}
}
- is_over = false;
- set_playing(true);
+ set_process_internal(true);
+ notify_property_list_changed();
+ _queue_redraw();
+}
+
+void AnimatedSprite3D::play_backwards(const StringName &p_name) {
+ play(p_name, -1, true);
+}
+
+void AnimatedSprite3D::_stop_internal(bool p_reset) {
+ playing = false;
+ if (p_reset) {
+ custom_speed_scale = 1.0;
+ set_frame_and_progress(0, 0.0);
+ }
+ notify_property_list_changed();
+ set_process_internal(false);
+}
+
+void AnimatedSprite3D::pause() {
+ _stop_internal(false);
}
void AnimatedSprite3D::stop() {
- set_playing(false);
- backwards = false;
- _reset_timeout();
+ _stop_internal(true);
}
double AnimatedSprite3D::_get_frame_duration() {
if (frames.is_valid() && frames->has_animation(animation)) {
return frames->get_frame_duration(animation, frame);
}
- return 0.0;
+ return 1.0;
}
-void AnimatedSprite3D::_reset_timeout() {
- timeout = _get_frame_duration();
- is_over = false;
+void AnimatedSprite3D::_calc_frame_speed_scale() {
+ frame_speed_scale = 1.0 / _get_frame_duration();
}
-void AnimatedSprite3D::set_animation(const StringName &p_animation) {
- ERR_FAIL_COND_MSG(frames == nullptr, vformat("There is no animation with name '%s'.", p_animation));
- ERR_FAIL_COND_MSG(!frames->get_animation_names().has(p_animation), vformat("There is no animation with name '%s'.", p_animation));
+void AnimatedSprite3D::set_animation(const StringName &p_name) {
+ if (animation == p_name) {
+ return;
+ }
+
+ animation = p_name;
- if (animation == p_animation) {
+ emit_signal("animation_changed");
+
+ if (frames == nullptr) {
+ animation = StringName();
+ stop();
+ ERR_FAIL_MSG(vformat("There is no animation with name '%s'.", p_name));
+ }
+
+ int frame_count = frames->get_frame_count(animation);
+ if (animation == StringName() || frame_count == 0) {
+ stop();
return;
+ } else if (!frames->get_animation_names().has(animation)) {
+ animation = StringName();
+ stop();
+ ERR_FAIL_MSG(vformat("There is no animation with name '%s'.", p_name));
+ }
+
+ if (signbit(get_playing_speed())) {
+ set_frame_and_progress(frame_count - 1, 1.0);
+ } else {
+ set_frame_and_progress(0, 0.0);
}
- animation = p_animation;
- set_frame(0);
- _reset_timeout();
notify_property_list_changed();
_queue_redraw();
}
@@ -1175,35 +1356,58 @@ void AnimatedSprite3D::get_argument_options(const StringName &p_function, int p_
Node::get_argument_options(p_function, p_idx, r_options);
}
+#ifndef DISABLE_DEPRECATED
+bool AnimatedSprite3D::_set(const StringName &p_name, const Variant &p_value) {
+ if ((p_name == SNAME("frames"))) {
+ set_sprite_frames(p_value);
+ return true;
+ }
+ return false;
+}
+#endif
void AnimatedSprite3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_sprite_frames", "sprite_frames"), &AnimatedSprite3D::set_sprite_frames);
ClassDB::bind_method(D_METHOD("get_sprite_frames"), &AnimatedSprite3D::get_sprite_frames);
- ClassDB::bind_method(D_METHOD("set_animation", "animation"), &AnimatedSprite3D::set_animation);
+ ClassDB::bind_method(D_METHOD("set_animation", "name"), &AnimatedSprite3D::set_animation);
ClassDB::bind_method(D_METHOD("get_animation"), &AnimatedSprite3D::get_animation);
- ClassDB::bind_method(D_METHOD("set_playing", "playing"), &AnimatedSprite3D::set_playing);
+ ClassDB::bind_method(D_METHOD("set_autoplay", "name"), &AnimatedSprite3D::set_autoplay);
+ ClassDB::bind_method(D_METHOD("get_autoplay"), &AnimatedSprite3D::get_autoplay);
+
ClassDB::bind_method(D_METHOD("is_playing"), &AnimatedSprite3D::is_playing);
- ClassDB::bind_method(D_METHOD("play", "anim", "backwards"), &AnimatedSprite3D::play, DEFVAL(StringName()), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("play", "name", "custom_speed", "from_end"), &AnimatedSprite3D::play, DEFVAL(StringName()), DEFVAL(1.0), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("play_backwards", "name"), &AnimatedSprite3D::play_backwards, DEFVAL(StringName()));
+ ClassDB::bind_method(D_METHOD("pause"), &AnimatedSprite3D::pause);
ClassDB::bind_method(D_METHOD("stop"), &AnimatedSprite3D::stop);
ClassDB::bind_method(D_METHOD("set_frame", "frame"), &AnimatedSprite3D::set_frame);
ClassDB::bind_method(D_METHOD("get_frame"), &AnimatedSprite3D::get_frame);
+ ClassDB::bind_method(D_METHOD("set_frame_progress", "progress"), &AnimatedSprite3D::set_frame_progress);
+ ClassDB::bind_method(D_METHOD("get_frame_progress"), &AnimatedSprite3D::get_frame_progress);
+
+ ClassDB::bind_method(D_METHOD("set_frame_and_progress", "frame", "progress"), &AnimatedSprite3D::set_frame_and_progress);
+
ClassDB::bind_method(D_METHOD("set_speed_scale", "speed_scale"), &AnimatedSprite3D::set_speed_scale);
ClassDB::bind_method(D_METHOD("get_speed_scale"), &AnimatedSprite3D::get_speed_scale);
+ ClassDB::bind_method(D_METHOD("get_playing_speed"), &AnimatedSprite3D::get_playing_speed);
ClassDB::bind_method(D_METHOD("_res_changed"), &AnimatedSprite3D::_res_changed);
+ ADD_SIGNAL(MethodInfo("sprite_frames_changed"));
+ ADD_SIGNAL(MethodInfo("animation_changed"));
ADD_SIGNAL(MethodInfo("frame_changed"));
+ ADD_SIGNAL(MethodInfo("animation_looped"));
ADD_SIGNAL(MethodInfo("animation_finished"));
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "frames", PROPERTY_HINT_RESOURCE_TYPE, "SpriteFrames"), "set_sprite_frames", "get_sprite_frames");
- ADD_PROPERTY(PropertyInfo(Variant::STRING, "animation"), "set_animation", "get_animation");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "sprite_frames", PROPERTY_HINT_RESOURCE_TYPE, "SpriteFrames"), "set_sprite_frames", "get_sprite_frames");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "animation", PROPERTY_HINT_ENUM, ""), "set_animation", "get_animation");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "autoplay", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_autoplay", "get_autoplay");
ADD_PROPERTY(PropertyInfo(Variant::INT, "frame"), "set_frame", "get_frame");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "frame_progress", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_frame_progress", "get_frame_progress");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "speed_scale"), "set_speed_scale", "get_speed_scale");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing"), "set_playing", "is_playing");
}
AnimatedSprite3D::AnimatedSprite3D() {
diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h
index c5509aa723..1eb1211951 100644
--- a/scene/3d/sprite_3d.h
+++ b/scene/3d/sprite_3d.h
@@ -53,7 +53,9 @@ public:
enum AlphaCutMode {
ALPHA_CUT_DISABLED,
ALPHA_CUT_DISCARD,
- ALPHA_CUT_OPAQUE_PREPASS
+ ALPHA_CUT_OPAQUE_PREPASS,
+ ALPHA_CUT_HASH,
+ ALPHA_CUT_MAX
};
private:
@@ -85,6 +87,10 @@ private:
bool flags[FLAG_MAX] = {};
AlphaCutMode alpha_cut = ALPHA_CUT_DISABLED;
+ float alpha_scissor_threshold = 0.5;
+ float alpha_hash_scale = 1.0;
+ StandardMaterial3D::AlphaAntiAliasing alpha_antialiasing_mode = StandardMaterial3D::ALPHA_ANTIALIASING_OFF;
+ float alpha_antialiasing_edge = 0.0f;
StandardMaterial3D::BillboardMode billboard_mode = StandardMaterial3D::BILLBOARD_DISABLED;
StandardMaterial3D::TextureFilter texture_filter = StandardMaterial3D::TEXTURE_FILTER_LINEAR_WITH_MIPMAPS;
bool pending_update = false;
@@ -143,6 +149,18 @@ public:
void set_alpha_cut_mode(AlphaCutMode p_mode);
AlphaCutMode get_alpha_cut_mode() const;
+ void set_alpha_scissor_threshold(float p_threshold);
+ float get_alpha_scissor_threshold() const;
+
+ void set_alpha_hash_scale(float p_hash_scale);
+ float get_alpha_hash_scale() const;
+
+ void set_alpha_antialiasing(BaseMaterial3D::AlphaAntiAliasing p_alpha_aa);
+ BaseMaterial3D::AlphaAntiAliasing get_alpha_antialiasing() const;
+
+ void set_alpha_antialiasing_edge(float p_edge);
+ float get_alpha_antialiasing_edge() const;
+
void set_billboard_mode(StandardMaterial3D::BillboardMode p_mode);
StandardMaterial3D::BillboardMode get_billboard_mode() const;
@@ -209,24 +227,29 @@ class AnimatedSprite3D : public SpriteBase3D {
GDCLASS(AnimatedSprite3D, SpriteBase3D);
Ref<SpriteFrames> frames;
+ String autoplay;
+
bool playing = false;
- bool playing_backwards = false;
- bool backwards = false;
StringName animation = "default";
int frame = 0;
float speed_scale = 1.0;
+ float custom_speed_scale = 1.0;
bool centered = false;
- bool is_over = false;
- double timeout = 0.0;
+ real_t frame_speed_scale = 1.0;
+ real_t frame_progress = 0.0;
void _res_changed();
double _get_frame_duration();
- void _reset_timeout();
+ void _calc_frame_speed_scale();
+ void _stop_internal(bool p_reset);
protected:
+#ifndef DISABLE_DEPRECATED
+ bool _set(const StringName &p_name, const Variant &p_value);
+#endif
virtual void _draw() override;
static void _bind_methods();
void _notification(int p_what);
@@ -236,20 +259,30 @@ public:
void set_sprite_frames(const Ref<SpriteFrames> &p_frames);
Ref<SpriteFrames> get_sprite_frames() const;
- void play(const StringName &p_animation = StringName(), bool p_backwards = false);
+ void play(const StringName &p_name = StringName(), float p_custom_scale = 1.0, bool p_from_end = false);
+ void play_backwards(const StringName &p_name = StringName());
+ void pause();
void stop();
- void set_playing(bool p_playing);
bool is_playing() const;
- void set_animation(const StringName &p_animation);
+ void set_animation(const StringName &p_name);
StringName get_animation() const;
+ void set_autoplay(const String &p_name);
+ String get_autoplay() const;
+
void set_frame(int p_frame);
int get_frame() const;
+ void set_frame_progress(real_t p_progress);
+ real_t get_frame_progress() const;
+
+ void set_frame_and_progress(int p_frame, real_t p_progress);
+
void set_speed_scale(float p_speed_scale);
float get_speed_scale() const;
+ float get_playing_speed() const;
virtual Rect2 get_item_rect() const override;
diff --git a/scene/3d/visual_instance_3d.cpp b/scene/3d/visual_instance_3d.cpp
index 64fb0a7657..8026b12c2b 100644
--- a/scene/3d/visual_instance_3d.cpp
+++ b/scene/3d/visual_instance_3d.cpp
@@ -120,6 +120,12 @@ bool VisualInstance3D::is_sorting_use_aabb_center() const {
return sorting_use_aabb_center;
}
+void VisualInstance3D::_validate_property(PropertyInfo &p_property) const {
+ if (p_property.name == "sorting_offset" || p_property.name == "sorting_use_aabb_center") {
+ p_property.usage = PROPERTY_USAGE_NONE;
+ }
+}
+
void VisualInstance3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_base", "base"), &VisualInstance3D::set_base);
ClassDB::bind_method(D_METHOD("get_base"), &VisualInstance3D::get_base);
@@ -437,6 +443,12 @@ PackedStringArray GeometryInstance3D::get_configuration_warnings() const {
return warnings;
}
+void GeometryInstance3D::_validate_property(PropertyInfo &p_property) const {
+ if (p_property.name == "sorting_offset" || p_property.name == "sorting_use_aabb_center") {
+ p_property.usage = PROPERTY_USAGE_DEFAULT;
+ }
+}
+
void GeometryInstance3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_material_override", "material"), &GeometryInstance3D::set_material_override);
ClassDB::bind_method(D_METHOD("get_material_override"), &GeometryInstance3D::get_material_override);
diff --git a/scene/3d/visual_instance_3d.h b/scene/3d/visual_instance_3d.h
index 190ed17753..ef0f7966e2 100644
--- a/scene/3d/visual_instance_3d.h
+++ b/scene/3d/visual_instance_3d.h
@@ -47,6 +47,7 @@ protected:
void _notification(int p_what);
static void _bind_methods();
+ void _validate_property(PropertyInfo &p_property) const;
GDVIRTUAL0RC(AABB, _get_aabb)
public:
@@ -140,6 +141,7 @@ protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const;
+ void _validate_property(PropertyInfo &p_property) const;
static void _bind_methods();
diff --git a/scene/3d/voxel_gi.cpp b/scene/3d/voxel_gi.cpp
index 4325152a7b..41dc27352f 100644
--- a/scene/3d/voxel_gi.cpp
+++ b/scene/3d/voxel_gi.cpp
@@ -502,7 +502,7 @@ void VoxelGI::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "subdiv", PROPERTY_HINT_ENUM, "64,128,256,512"), "set_subdiv", "get_subdiv");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_NONE, "suffix:m"), "set_extents", "get_extents");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "camera_attributes", PROPERTY_HINT_RESOURCE_TYPE, "CameraAttributesPractical,CameraAttributesPhysical"), "set_camera_attributes", "get_camera_attributes");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "VoxelGIData", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE), "set_probe_data", "get_probe_data");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "VoxelGIData", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_ALWAYS_DUPLICATE), "set_probe_data", "get_probe_data");
BIND_ENUM_CONSTANT(SUBDIV_64);
BIND_ENUM_CONSTANT(SUBDIV_128);
diff --git a/scene/3d/xr_nodes.cpp b/scene/3d/xr_nodes.cpp
index a758cc5e5e..ac0a47d1a1 100644
--- a/scene/3d/xr_nodes.cpp
+++ b/scene/3d/xr_nodes.cpp
@@ -432,15 +432,16 @@ PackedStringArray XRNode3D::get_configuration_warnings() const {
void XRController3D::_bind_methods() {
// passthroughs to information about our related joystick
ClassDB::bind_method(D_METHOD("is_button_pressed", "name"), &XRController3D::is_button_pressed);
- ClassDB::bind_method(D_METHOD("get_value", "name"), &XRController3D::get_value);
- ClassDB::bind_method(D_METHOD("get_axis", "name"), &XRController3D::get_axis);
+ ClassDB::bind_method(D_METHOD("get_input", "name"), &XRController3D::get_input);
+ ClassDB::bind_method(D_METHOD("get_float", "name"), &XRController3D::get_float);
+ ClassDB::bind_method(D_METHOD("get_vector2", "name"), &XRController3D::get_vector2);
ClassDB::bind_method(D_METHOD("get_tracker_hand"), &XRController3D::get_tracker_hand);
ADD_SIGNAL(MethodInfo("button_pressed", PropertyInfo(Variant::STRING, "name")));
ADD_SIGNAL(MethodInfo("button_released", PropertyInfo(Variant::STRING, "name")));
- ADD_SIGNAL(MethodInfo("input_value_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::FLOAT, "value")));
- ADD_SIGNAL(MethodInfo("input_axis_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::VECTOR2, "value")));
+ ADD_SIGNAL(MethodInfo("input_float_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::FLOAT, "value")));
+ ADD_SIGNAL(MethodInfo("input_vector2_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::VECTOR2, "value")));
};
void XRController3D::_bind_tracker() {
@@ -449,8 +450,8 @@ void XRController3D::_bind_tracker() {
// bind to input signals
tracker->connect("button_pressed", callable_mp(this, &XRController3D::_button_pressed));
tracker->connect("button_released", callable_mp(this, &XRController3D::_button_released));
- tracker->connect("input_value_changed", callable_mp(this, &XRController3D::_input_value_changed));
- tracker->connect("input_axis_changed", callable_mp(this, &XRController3D::_input_axis_changed));
+ tracker->connect("input_float_changed", callable_mp(this, &XRController3D::_input_float_changed));
+ tracker->connect("input_vector2_changed", callable_mp(this, &XRController3D::_input_vector2_changed));
}
}
@@ -459,8 +460,8 @@ void XRController3D::_unbind_tracker() {
// unbind input signals
tracker->disconnect("button_pressed", callable_mp(this, &XRController3D::_button_pressed));
tracker->disconnect("button_released", callable_mp(this, &XRController3D::_button_released));
- tracker->disconnect("input_value_changed", callable_mp(this, &XRController3D::_input_value_changed));
- tracker->disconnect("input_axis_changed", callable_mp(this, &XRController3D::_input_axis_changed));
+ tracker->disconnect("input_float_changed", callable_mp(this, &XRController3D::_input_float_changed));
+ tracker->disconnect("input_vector2_changed", callable_mp(this, &XRController3D::_input_vector2_changed));
}
XRNode3D::_unbind_tracker();
@@ -476,14 +477,14 @@ void XRController3D::_button_released(const String &p_name) {
emit_signal(SNAME("button_released"), p_name);
}
-void XRController3D::_input_value_changed(const String &p_name, float p_value) {
+void XRController3D::_input_float_changed(const String &p_name, float p_value) {
// just pass it on...
- emit_signal(SNAME("input_value_changed"), p_name, p_value);
+ emit_signal(SNAME("input_float_changed"), p_name, p_value);
}
-void XRController3D::_input_axis_changed(const String &p_name, Vector2 p_value) {
+void XRController3D::_input_vector2_changed(const String &p_name, Vector2 p_value) {
// just pass it on...
- emit_signal(SNAME("input_axis_changed"), p_name, p_value);
+ emit_signal(SNAME("input_vector2_changed"), p_name, p_value);
}
bool XRController3D::is_button_pressed(const StringName &p_name) const {
@@ -496,7 +497,15 @@ bool XRController3D::is_button_pressed(const StringName &p_name) const {
}
}
-float XRController3D::get_value(const StringName &p_name) const {
+Variant XRController3D::get_input(const StringName &p_name) const {
+ if (tracker.is_valid()) {
+ return tracker->get_input(p_name);
+ } else {
+ return Variant();
+ }
+}
+
+float XRController3D::get_float(const StringName &p_name) const {
if (tracker.is_valid()) {
// Inputs should already be of the correct type, our XR runtime handles conversions between raw input and the desired type, but just in case we convert
Variant input = tracker->get_input(p_name);
@@ -517,7 +526,7 @@ float XRController3D::get_value(const StringName &p_name) const {
}
}
-Vector2 XRController3D::get_axis(const StringName &p_name) const {
+Vector2 XRController3D::get_vector2(const StringName &p_name) const {
if (tracker.is_valid()) {
// Inputs should already be of the correct type, our XR runtime handles conversions between raw input and the desired type, but just in case we convert
Variant input = tracker->get_input(p_name);
diff --git a/scene/3d/xr_nodes.h b/scene/3d/xr_nodes.h
index c93cb14d62..6e56aa28de 100644
--- a/scene/3d/xr_nodes.h
+++ b/scene/3d/xr_nodes.h
@@ -131,13 +131,14 @@ protected:
void _button_pressed(const String &p_name);
void _button_released(const String &p_name);
- void _input_value_changed(const String &p_name, float p_value);
- void _input_axis_changed(const String &p_name, Vector2 p_value);
+ void _input_float_changed(const String &p_name, float p_value);
+ void _input_vector2_changed(const String &p_name, Vector2 p_value);
public:
bool is_button_pressed(const StringName &p_name) const;
- float get_value(const StringName &p_name) const;
- Vector2 get_axis(const StringName &p_name) const;
+ Variant get_input(const StringName &p_name) const;
+ float get_float(const StringName &p_name) const;
+ Vector2 get_vector2(const StringName &p_name) const;
XRPositionalTracker::TrackerHand get_tracker_hand() const;
diff --git a/scene/animation/animation_blend_space_1d.cpp b/scene/animation/animation_blend_space_1d.cpp
index a2028b8de8..d28a6fcc04 100644
--- a/scene/animation/animation_blend_space_1d.cpp
+++ b/scene/animation/animation_blend_space_1d.cpp
@@ -30,12 +30,20 @@
#include "animation_blend_space_1d.h"
+#include "animation_blend_tree.h"
+
void AnimationNodeBlendSpace1D::get_parameter_list(List<PropertyInfo> *r_list) const {
r_list->push_back(PropertyInfo(Variant::FLOAT, blend_position));
+ r_list->push_back(PropertyInfo(Variant::INT, closest, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
+ r_list->push_back(PropertyInfo(Variant::FLOAT, length_internal, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
}
Variant AnimationNodeBlendSpace1D::get_parameter_default_value(const StringName &p_parameter) const {
- return 0;
+ if (p_parameter == closest) {
+ return -1;
+ } else {
+ return 0;
+ }
}
Ref<AnimationNode> AnimationNodeBlendSpace1D::get_child_by_name(const StringName &p_name) {
@@ -77,6 +85,9 @@ void AnimationNodeBlendSpace1D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_value_label", "text"), &AnimationNodeBlendSpace1D::set_value_label);
ClassDB::bind_method(D_METHOD("get_value_label"), &AnimationNodeBlendSpace1D::get_value_label);
+ ClassDB::bind_method(D_METHOD("set_blend_mode", "mode"), &AnimationNodeBlendSpace1D::set_blend_mode);
+ ClassDB::bind_method(D_METHOD("get_blend_mode"), &AnimationNodeBlendSpace1D::get_blend_mode);
+
ClassDB::bind_method(D_METHOD("set_use_sync", "enable"), &AnimationNodeBlendSpace1D::set_use_sync);
ClassDB::bind_method(D_METHOD("is_using_sync"), &AnimationNodeBlendSpace1D::is_using_sync);
@@ -91,7 +102,12 @@ void AnimationNodeBlendSpace1D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max_space", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_max_space", "get_max_space");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "snap", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_snap", "get_snap");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "value_label", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_value_label", "get_value_label");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "blend_mode", PROPERTY_HINT_ENUM, "Interpolated,Discrete,Carry", PROPERTY_USAGE_NO_EDITOR), "set_blend_mode", "get_blend_mode");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sync", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_use_sync", "is_using_sync");
+
+ BIND_ENUM_CONSTANT(BLEND_MODE_INTERPOLATED);
+ BIND_ENUM_CONSTANT(BLEND_MODE_DISCRETE);
+ BIND_ENUM_CONSTANT(BLEND_MODE_DISCRETE_CARRY);
}
void AnimationNodeBlendSpace1D::get_child_nodes(List<ChildNode> *r_child_nodes) {
@@ -214,6 +230,14 @@ String AnimationNodeBlendSpace1D::get_value_label() const {
return value_label;
}
+void AnimationNodeBlendSpace1D::set_blend_mode(BlendMode p_blend_mode) {
+ blend_mode = p_blend_mode;
+}
+
+AnimationNodeBlendSpace1D::BlendMode AnimationNodeBlendSpace1D::get_blend_mode() const {
+ return blend_mode;
+}
+
void AnimationNodeBlendSpace1D::set_use_sync(bool p_sync) {
sync = p_sync;
}
@@ -241,79 +265,125 @@ double AnimationNodeBlendSpace1D::process(double p_time, bool p_seek, bool p_is_
}
double blend_pos = get_parameter(blend_position);
+ int cur_closest = get_parameter(closest);
+ double cur_length_internal = get_parameter(length_internal);
+ double max_time_remaining = 0.0;
- float weights[MAX_BLEND_POINTS] = {};
+ if (blend_mode == BLEND_MODE_INTERPOLATED) {
+ float weights[MAX_BLEND_POINTS] = {};
+
+ int point_lower = -1;
+ float pos_lower = 0.0;
+ int point_higher = -1;
+ float pos_higher = 0.0;
+
+ // find the closest two points to blend between
+ for (int i = 0; i < blend_points_used; i++) {
+ float pos = blend_points[i].position;
+
+ if (pos <= blend_pos) {
+ if (point_lower == -1) {
+ point_lower = i;
+ pos_lower = pos;
+ } else if ((blend_pos - pos) < (blend_pos - pos_lower)) {
+ point_lower = i;
+ pos_lower = pos;
+ }
+ } else {
+ if (point_higher == -1) {
+ point_higher = i;
+ pos_higher = pos;
+ } else if ((pos - blend_pos) < (pos_higher - blend_pos)) {
+ point_higher = i;
+ pos_higher = pos;
+ }
+ }
+ }
- int point_lower = -1;
- float pos_lower = 0.0;
- int point_higher = -1;
- float pos_higher = 0.0;
+ // fill in weights
- // find the closest two points to blend between
- for (int i = 0; i < blend_points_used; i++) {
- float pos = blend_points[i].position;
-
- if (pos <= blend_pos) {
- if (point_lower == -1) {
- point_lower = i;
- pos_lower = pos;
- } else if ((blend_pos - pos) < (blend_pos - pos_lower)) {
- point_lower = i;
- pos_lower = pos;
- }
+ if (point_lower == -1 && point_higher != -1) {
+ // we are on the left side, no other point to the left
+ // we just play the next point.
+
+ weights[point_higher] = 1.0;
+ } else if (point_higher == -1) {
+ // we are on the right side, no other point to the right
+ // we just play the previous point
+
+ weights[point_lower] = 1.0;
} else {
- if (point_higher == -1) {
- point_higher = i;
- pos_higher = pos;
- } else if ((pos - blend_pos) < (pos_higher - blend_pos)) {
- point_higher = i;
- pos_higher = pos;
- }
- }
- }
+ // we are between two points.
+ // figure out weights, then blend the animations
- // fill in weights
+ float distance_between_points = pos_higher - pos_lower;
- if (point_lower == -1 && point_higher != -1) {
- // we are on the left side, no other point to the left
- // we just play the next point.
+ float current_pos_inbetween = blend_pos - pos_lower;
- weights[point_higher] = 1.0;
- } else if (point_higher == -1) {
- // we are on the right side, no other point to the right
- // we just play the previous point
+ float blend_percentage = current_pos_inbetween / distance_between_points;
- weights[point_lower] = 1.0;
- } else {
- // we are between two points.
- // figure out weights, then blend the animations
+ float blend_lower = 1.0 - blend_percentage;
+ float blend_higher = blend_percentage;
- float distance_between_points = pos_higher - pos_lower;
+ weights[point_lower] = blend_lower;
+ weights[point_higher] = blend_higher;
+ }
- float current_pos_inbetween = blend_pos - pos_lower;
+ // actually blend the animations now
- float blend_percentage = current_pos_inbetween / distance_between_points;
+ for (int i = 0; i < blend_points_used; i++) {
+ if (i == point_lower || i == point_higher) {
+ double remaining = blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_is_external_seeking, weights[i], FILTER_IGNORE, true);
+ max_time_remaining = MAX(max_time_remaining, remaining);
+ } else if (sync) {
+ blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_is_external_seeking, 0, FILTER_IGNORE, true);
+ }
+ }
+ } else {
+ int new_closest = -1;
+ double new_closest_dist = 1e20;
+
+ for (int i = 0; i < blend_points_used; i++) {
+ double d = abs(blend_points[i].position - blend_pos);
+ if (d < new_closest_dist) {
+ new_closest = i;
+ new_closest_dist = d;
+ }
+ }
- float blend_lower = 1.0 - blend_percentage;
- float blend_higher = blend_percentage;
+ if (new_closest != cur_closest && new_closest != -1) {
+ double from = 0.0;
+ if (blend_mode == BLEND_MODE_DISCRETE_CARRY && cur_closest != -1) {
+ //for ping-pong loop
+ Ref<AnimationNodeAnimation> na_c = static_cast<Ref<AnimationNodeAnimation>>(blend_points[cur_closest].node);
+ Ref<AnimationNodeAnimation> na_n = static_cast<Ref<AnimationNodeAnimation>>(blend_points[new_closest].node);
+ if (!na_c.is_null() && !na_n.is_null()) {
+ na_n->set_backward(na_c->is_backward());
+ }
+ //see how much animation remains
+ from = cur_length_internal - blend_node(blend_points[cur_closest].name, blend_points[cur_closest].node, p_time, false, p_is_external_seeking, 0.0, FILTER_IGNORE, true);
+ }
- weights[point_lower] = blend_lower;
- weights[point_higher] = blend_higher;
- }
+ max_time_remaining = blend_node(blend_points[new_closest].name, blend_points[new_closest].node, from, true, p_is_external_seeking, 1.0, FILTER_IGNORE, true);
+ cur_length_internal = from + max_time_remaining;
- // actually blend the animations now
+ cur_closest = new_closest;
- double max_time_remaining = 0.0;
+ } else {
+ max_time_remaining = blend_node(blend_points[cur_closest].name, blend_points[cur_closest].node, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, true);
+ }
- for (int i = 0; i < blend_points_used; i++) {
- if (i == point_lower || i == point_higher) {
- double remaining = blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_is_external_seeking, weights[i], FILTER_IGNORE, true);
- max_time_remaining = MAX(max_time_remaining, remaining);
- } else if (sync) {
- blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_is_external_seeking, 0, FILTER_IGNORE, true);
+ if (sync) {
+ for (int i = 0; i < blend_points_used; i++) {
+ if (i != cur_closest) {
+ blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_is_external_seeking, 0, FILTER_IGNORE, true);
+ }
+ }
}
}
+ set_parameter(this->closest, cur_closest);
+ set_parameter(this->length_internal, cur_length_internal);
return max_time_remaining;
}
diff --git a/scene/animation/animation_blend_space_1d.h b/scene/animation/animation_blend_space_1d.h
index af93783c0d..a1e9a7a764 100644
--- a/scene/animation/animation_blend_space_1d.h
+++ b/scene/animation/animation_blend_space_1d.h
@@ -36,6 +36,14 @@
class AnimationNodeBlendSpace1D : public AnimationRootNode {
GDCLASS(AnimationNodeBlendSpace1D, AnimationRootNode);
+public:
+ enum BlendMode {
+ BLEND_MODE_INTERPOLATED,
+ BLEND_MODE_DISCRETE,
+ BLEND_MODE_DISCRETE_CARRY,
+ };
+
+protected:
enum {
MAX_BLEND_POINTS = 64
};
@@ -61,6 +69,10 @@ class AnimationNodeBlendSpace1D : public AnimationRootNode {
void _tree_changed();
StringName blend_position = "blend_position";
+ StringName closest = "closest";
+ StringName length_internal = "length_internal";
+
+ BlendMode blend_mode = BLEND_MODE_INTERPOLATED;
protected:
bool sync = false;
@@ -95,6 +107,9 @@ public:
void set_value_label(const String &p_label);
String get_value_label() const;
+ void set_blend_mode(BlendMode p_blend_mode);
+ BlendMode get_blend_mode() const;
+
void set_use_sync(bool p_sync);
bool is_using_sync() const;
@@ -107,4 +122,6 @@ public:
~AnimationNodeBlendSpace1D();
};
+VARIANT_ENUM_CAST(AnimationNodeBlendSpace1D::BlendMode)
+
#endif // ANIMATION_BLEND_SPACE_1D_H
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index 1ef0774828..45f4f690b9 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -229,15 +229,17 @@ AnimationNodeSync::AnimationNodeSync() {
////////////////////////////////////////////////////////
void AnimationNodeOneShot::get_parameter_list(List<PropertyInfo> *r_list) const {
- r_list->push_back(PropertyInfo(Variant::BOOL, active));
- r_list->push_back(PropertyInfo(Variant::BOOL, prev_active, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
+ r_list->push_back(PropertyInfo(Variant::BOOL, active, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_READ_ONLY));
+ r_list->push_back(PropertyInfo(Variant::INT, request, PROPERTY_HINT_ENUM, ",Fire,Abort"));
r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
r_list->push_back(PropertyInfo(Variant::FLOAT, remaining, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
r_list->push_back(PropertyInfo(Variant::FLOAT, time_to_restart, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
}
Variant AnimationNodeOneShot::get_parameter_default_value(const StringName &p_parameter) const {
- if (p_parameter == active || p_parameter == prev_active) {
+ if (p_parameter == request) {
+ return ONE_SHOT_REQUEST_NONE;
+ } else if (p_parameter == active) {
return false;
} else if (p_parameter == time_to_restart) {
return -1;
@@ -246,6 +248,13 @@ Variant AnimationNodeOneShot::get_parameter_default_value(const StringName &p_pa
}
}
+bool AnimationNodeOneShot::is_parameter_read_only(const StringName &p_parameter) const {
+ if (p_parameter == active) {
+ return true;
+ }
+ return false;
+}
+
void AnimationNodeOneShot::set_fadein_time(double p_time) {
fade_in = p_time;
}
@@ -303,41 +312,42 @@ bool AnimationNodeOneShot::has_filter() const {
}
double AnimationNodeOneShot::process(double p_time, bool p_seek, bool p_is_external_seeking) {
+ OneShotRequest cur_request = static_cast<OneShotRequest>((int)get_parameter(request));
bool cur_active = get_parameter(active);
- bool cur_prev_active = get_parameter(prev_active);
double cur_time = get_parameter(time);
double cur_remaining = get_parameter(remaining);
double cur_time_to_restart = get_parameter(time_to_restart);
- if (!cur_active) {
- //make it as if this node doesn't exist, pass input 0 by.
- if (cur_prev_active) {
- set_parameter(prev_active, false);
- }
+ set_parameter(request, ONE_SHOT_REQUEST_NONE);
+
+ bool do_start = cur_request == ONE_SHOT_REQUEST_FIRE;
+ if (cur_request == ONE_SHOT_REQUEST_ABORT) {
+ set_parameter(active, false);
+ set_parameter(time_to_restart, -1);
+ return blend_input(0, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, sync);
+ } else if (!do_start && !cur_active) {
if (cur_time_to_restart >= 0.0 && !p_seek) {
cur_time_to_restart -= p_time;
if (cur_time_to_restart < 0) {
- //restart
- set_parameter(active, true);
- cur_active = true;
+ do_start = true; // Restart.
}
set_parameter(time_to_restart, cur_time_to_restart);
}
-
- return blend_input(0, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, sync);
+ if (!do_start) {
+ return blend_input(0, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, sync);
+ }
}
bool os_seek = p_seek;
-
if (p_seek) {
cur_time = p_time;
}
- bool do_start = !cur_prev_active;
if (do_start) {
cur_time = 0;
os_seek = true;
- set_parameter(prev_active, true);
+ set_parameter(request, ONE_SHOT_REQUEST_NONE);
+ set_parameter(active, true);
}
real_t blend;
@@ -375,7 +385,6 @@ double AnimationNodeOneShot::process(double p_time, bool p_seek, bool p_is_exter
cur_remaining = os_rem;
if (cur_remaining <= 0) {
set_parameter(active, false);
- set_parameter(prev_active, false);
if (autorestart) {
double restart_sec = autorestart_delay + Math::randd() * autorestart_random_delay;
set_parameter(time_to_restart, restart_sec);
@@ -419,6 +428,10 @@ void AnimationNodeOneShot::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "autorestart_delay", PROPERTY_HINT_RANGE, "0,60,0.01,or_greater,suffix:s"), "set_autorestart_delay", "get_autorestart_delay");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "autorestart_random_delay", PROPERTY_HINT_RANGE, "0,60,0.01,or_greater,suffix:s"), "set_autorestart_random_delay", "get_autorestart_random_delay");
+ BIND_ENUM_CONSTANT(ONE_SHOT_REQUEST_NONE);
+ BIND_ENUM_CONSTANT(ONE_SHOT_REQUEST_FIRE);
+ BIND_ENUM_CONSTANT(ONE_SHOT_REQUEST_ABORT);
+
BIND_ENUM_CONSTANT(MIX_MODE_BLEND);
BIND_ENUM_CONSTANT(MIX_MODE_ADD);
}
@@ -631,18 +644,76 @@ AnimationNodeTimeSeek::AnimationNodeTimeSeek() {
/////////////////////////////////////////////////
+bool AnimationNodeTransition::_set(const StringName &p_path, const Variant &p_value) {
+ String path = p_path;
+
+ if (!path.begins_with("input_")) {
+ return false;
+ }
+
+ int which = path.get_slicec('/', 0).get_slicec('_', 1).to_int();
+ String what = path.get_slicec('/', 1);
+
+ if (which == get_input_count() && what == "name") {
+ if (add_input(p_value)) {
+ return true;
+ }
+ return false;
+ }
+
+ ERR_FAIL_INDEX_V(which, get_input_count(), false);
+
+ if (what == "name") {
+ set_input_name(which, p_value);
+ } else if (what == "auto_advance") {
+ set_input_as_auto_advance(which, p_value);
+ } else if (what == "reset") {
+ set_input_reset(which, p_value);
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
+bool AnimationNodeTransition::_get(const StringName &p_path, Variant &r_ret) const {
+ String path = p_path;
+
+ if (!path.begins_with("input_")) {
+ return false;
+ }
+
+ int which = path.get_slicec('/', 0).get_slicec('_', 1).to_int();
+ String what = path.get_slicec('/', 1);
+
+ ERR_FAIL_INDEX_V(which, get_input_count(), false);
+
+ if (what == "name") {
+ r_ret = get_input_name(which);
+ } else if (what == "auto_advance") {
+ r_ret = is_input_set_as_auto_advance(which);
+ } else if (what == "reset") {
+ r_ret = is_input_reset(which);
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
void AnimationNodeTransition::get_parameter_list(List<PropertyInfo> *r_list) const {
String anims;
- for (int i = 0; i < enabled_inputs; i++) {
+ for (int i = 0; i < get_input_count(); i++) {
if (i > 0) {
anims += ",";
}
anims += inputs[i].name;
}
- r_list->push_back(PropertyInfo(Variant::INT, current, PROPERTY_HINT_ENUM, anims));
- r_list->push_back(PropertyInfo(Variant::INT, prev_current, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
- r_list->push_back(PropertyInfo(Variant::INT, prev, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
+ r_list->push_back(PropertyInfo(Variant::STRING, current_state, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_READ_ONLY)); // For interface.
+ r_list->push_back(PropertyInfo(Variant::STRING, transition_request, PROPERTY_HINT_ENUM, anims)); // For transition request. It will be cleared after setting the value immediately.
+ r_list->push_back(PropertyInfo(Variant::INT, current_index, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_READ_ONLY)); // To avoid finding the index every frame, use this internally.
+ r_list->push_back(PropertyInfo(Variant::INT, prev_index, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
r_list->push_back(PropertyInfo(Variant::FLOAT, prev_xfading, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
}
@@ -650,56 +721,67 @@ void AnimationNodeTransition::get_parameter_list(List<PropertyInfo> *r_list) con
Variant AnimationNodeTransition::get_parameter_default_value(const StringName &p_parameter) const {
if (p_parameter == time || p_parameter == prev_xfading) {
return 0.0;
- } else if (p_parameter == prev || p_parameter == prev_current) {
+ } else if (p_parameter == prev_index) {
return -1;
+ } else if (p_parameter == transition_request || p_parameter == current_state) {
+ return String();
} else {
return 0;
}
}
+bool AnimationNodeTransition::is_parameter_read_only(const StringName &p_parameter) const {
+ if (p_parameter == current_state || p_parameter == current_index) {
+ return true;
+ }
+ return false;
+}
+
String AnimationNodeTransition::get_caption() const {
return "Transition";
}
-void AnimationNodeTransition::_update_inputs() {
- while (get_input_count() < enabled_inputs) {
- add_input(inputs[get_input_count()].name);
+void AnimationNodeTransition::set_input_count(int p_inputs) {
+ for (int i = get_input_count(); i < p_inputs; i++) {
+ add_input("state_" + itos(i));
}
-
- while (get_input_count() > enabled_inputs) {
+ while (get_input_count() > p_inputs) {
remove_input(get_input_count() - 1);
}
+ notify_property_list_changed();
}
-void AnimationNodeTransition::set_enabled_inputs(int p_inputs) {
- ERR_FAIL_INDEX(p_inputs, MAX_INPUTS);
- enabled_inputs = p_inputs;
- _update_inputs();
+bool AnimationNodeTransition::add_input(const String &p_name) {
+ if (AnimationNode::add_input(p_name)) {
+ input_data.push_back(InputData());
+ return true;
+ }
+ return false;
}
-int AnimationNodeTransition::get_enabled_inputs() {
- return enabled_inputs;
+void AnimationNodeTransition::remove_input(int p_index) {
+ input_data.remove_at(p_index);
+ AnimationNode::remove_input(p_index);
}
void AnimationNodeTransition::set_input_as_auto_advance(int p_input, bool p_enable) {
- ERR_FAIL_INDEX(p_input, MAX_INPUTS);
- inputs[p_input].auto_advance = p_enable;
+ ERR_FAIL_INDEX(p_input, get_input_count());
+ input_data.write[p_input].auto_advance = p_enable;
}
bool AnimationNodeTransition::is_input_set_as_auto_advance(int p_input) const {
- ERR_FAIL_INDEX_V(p_input, MAX_INPUTS, false);
- return inputs[p_input].auto_advance;
+ ERR_FAIL_INDEX_V(p_input, get_input_count(), false);
+ return input_data[p_input].auto_advance;
}
-void AnimationNodeTransition::set_input_caption(int p_input, const String &p_name) {
- ERR_FAIL_INDEX(p_input, MAX_INPUTS);
- inputs[p_input].name = p_name;
- set_input_name(p_input, p_name);
+void AnimationNodeTransition::set_input_reset(int p_input, bool p_enable) {
+ ERR_FAIL_INDEX(p_input, get_input_count());
+ input_data.write[p_input].reset = p_enable;
}
-String AnimationNodeTransition::get_input_caption(int p_input) const {
- ERR_FAIL_INDEX_V(p_input, MAX_INPUTS, String());
- return inputs[p_input].name;
+bool AnimationNodeTransition::is_input_reset(int p_input) const {
+ ERR_FAIL_INDEX_V(p_input, get_input_count(), true);
+ return input_data[p_input].reset;
}
void AnimationNodeTransition::set_xfade_time(double p_fade) {
@@ -718,51 +800,70 @@ Ref<Curve> AnimationNodeTransition::get_xfade_curve() const {
return xfade_curve;
}
-void AnimationNodeTransition::set_from_start(bool p_from_start) {
- from_start = p_from_start;
-}
-
-bool AnimationNodeTransition::is_from_start() const {
- return from_start;
-}
-
double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_is_external_seeking) {
- int cur_current = get_parameter(current);
- int cur_prev = get_parameter(prev);
- int cur_prev_current = get_parameter(prev_current);
+ String cur_transition_request = get_parameter(transition_request);
+ int cur_current_index = get_parameter(current_index);
+ int cur_prev_index = get_parameter(prev_index);
double cur_time = get_parameter(time);
double cur_prev_xfading = get_parameter(prev_xfading);
- bool switched = cur_current != cur_prev_current;
+ bool switched = false;
+ bool restart = false;
+
+ if (!cur_transition_request.is_empty()) {
+ int new_idx = find_input(cur_transition_request);
+ if (new_idx >= 0) {
+ if (cur_current_index == new_idx) {
+ // Transition to same state.
+ restart = input_data[cur_current_index].reset;
+ cur_prev_xfading = 0;
+ set_parameter(prev_xfading, 0);
+ cur_prev_index = -1;
+ set_parameter(prev_index, -1);
+ } else {
+ switched = true;
+ cur_prev_index = cur_current_index;
+ set_parameter(prev_index, cur_current_index);
+ }
+ cur_current_index = new_idx;
+ set_parameter(current_index, cur_current_index);
+ set_parameter(current_state, cur_transition_request);
+ } else {
+ ERR_PRINT("No such input: '" + cur_transition_request + "'");
+ }
+ cur_transition_request = String();
+ set_parameter(transition_request, cur_transition_request);
+ }
- if (switched) {
- set_parameter(prev_current, cur_current);
- set_parameter(prev, cur_prev_current);
+ // Special case for restart.
+ if (restart) {
+ set_parameter(time, 0);
+ return blend_input(cur_current_index, 0, true, p_is_external_seeking, 1.0, FILTER_IGNORE, true);
+ }
- cur_prev = cur_prev_current;
+ if (switched) {
cur_prev_xfading = xfade_time;
cur_time = 0;
- switched = true;
}
- if (cur_current < 0 || cur_current >= enabled_inputs || cur_prev >= enabled_inputs) {
+ if (cur_current_index < 0 || cur_current_index >= get_input_count() || cur_prev_index >= get_input_count()) {
return 0;
}
double rem = 0.0;
if (sync) {
- for (int i = 0; i < enabled_inputs; i++) {
- if (i != cur_current && i != cur_prev) {
+ for (int i = 0; i < get_input_count(); i++) {
+ if (i != cur_current_index && i != cur_prev_index) {
blend_input(i, p_time, p_seek, p_is_external_seeking, 0, FILTER_IGNORE, true);
}
}
}
- if (cur_prev < 0) { // process current animation, check for transition
+ if (cur_prev_index < 0) { // process current animation, check for transition
- rem = blend_input(cur_current, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, true);
+ rem = blend_input(cur_current_index, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, true);
if (p_seek) {
cur_time = p_time;
@@ -770,8 +871,8 @@ double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_is_ex
cur_time += p_time;
}
- if (inputs[cur_current].auto_advance && rem <= xfade_time) {
- set_parameter(current, (cur_current + 1) % enabled_inputs);
+ if (input_data[cur_current_index].auto_advance && rem <= xfade_time) {
+ set_parameter(transition_request, get_input_name((cur_current_index + 1) % get_input_count()));
}
} else { // cross-fading from prev to current
@@ -783,21 +884,21 @@ double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_is_ex
// Blend values must be more than CMP_EPSILON to process discrete keys in edge.
real_t blend_inv = 1.0 - blend;
- if (from_start && !p_seek && switched) { //just switched, seek to start of current
- rem = blend_input(cur_current, 0, true, p_is_external_seeking, Math::is_zero_approx(blend_inv) ? CMP_EPSILON : blend_inv, FILTER_IGNORE, true);
+ if (input_data[cur_current_index].reset && !p_seek && switched) { //just switched, seek to start of current
+ rem = blend_input(cur_current_index, 0, true, p_is_external_seeking, Math::is_zero_approx(blend_inv) ? CMP_EPSILON : blend_inv, FILTER_IGNORE, true);
} else {
- rem = blend_input(cur_current, p_time, p_seek, p_is_external_seeking, Math::is_zero_approx(blend_inv) ? CMP_EPSILON : blend_inv, FILTER_IGNORE, true);
+ rem = blend_input(cur_current_index, p_time, p_seek, p_is_external_seeking, Math::is_zero_approx(blend_inv) ? CMP_EPSILON : blend_inv, FILTER_IGNORE, true);
}
if (p_seek) {
- blend_input(cur_prev, p_time, true, p_is_external_seeking, Math::is_zero_approx(blend) ? CMP_EPSILON : blend, FILTER_IGNORE, true);
+ blend_input(cur_prev_index, p_time, true, p_is_external_seeking, Math::is_zero_approx(blend) ? CMP_EPSILON : blend, FILTER_IGNORE, true);
cur_time = p_time;
} else {
- blend_input(cur_prev, p_time, false, p_is_external_seeking, Math::is_zero_approx(blend) ? CMP_EPSILON : blend, FILTER_IGNORE, true);
+ blend_input(cur_prev_index, p_time, false, p_is_external_seeking, Math::is_zero_approx(blend) ? CMP_EPSILON : blend, FILTER_IGNORE, true);
cur_time += p_time;
cur_prev_xfading -= p_time;
if (cur_prev_xfading < 0) {
- set_parameter(prev, -1);
+ set_parameter(prev_index, -1);
}
}
}
@@ -808,27 +909,22 @@ double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_is_ex
return rem;
}
-void AnimationNodeTransition::_validate_property(PropertyInfo &p_property) const {
- if (p_property.name.begins_with("input_")) {
- String n = p_property.name.get_slicec('/', 0).get_slicec('_', 1);
- if (n != "count") {
- int idx = n.to_int();
- if (idx >= enabled_inputs) {
- p_property.usage = PROPERTY_USAGE_NONE;
- }
- }
+void AnimationNodeTransition::_get_property_list(List<PropertyInfo> *p_list) const {
+ for (int i = 0; i < get_input_count(); i++) {
+ p_list->push_back(PropertyInfo(Variant::STRING, "input_" + itos(i) + "/name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL));
+ p_list->push_back(PropertyInfo(Variant::BOOL, "input_" + itos(i) + "/auto_advance", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL));
+ p_list->push_back(PropertyInfo(Variant::BOOL, "input_" + itos(i) + "/reset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL));
}
}
void AnimationNodeTransition::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_enabled_inputs", "amount"), &AnimationNodeTransition::set_enabled_inputs);
- ClassDB::bind_method(D_METHOD("get_enabled_inputs"), &AnimationNodeTransition::get_enabled_inputs);
+ ClassDB::bind_method(D_METHOD("set_input_count", "input_count"), &AnimationNodeTransition::set_input_count);
ClassDB::bind_method(D_METHOD("set_input_as_auto_advance", "input", "enable"), &AnimationNodeTransition::set_input_as_auto_advance);
ClassDB::bind_method(D_METHOD("is_input_set_as_auto_advance", "input"), &AnimationNodeTransition::is_input_set_as_auto_advance);
- ClassDB::bind_method(D_METHOD("set_input_caption", "input", "caption"), &AnimationNodeTransition::set_input_caption);
- ClassDB::bind_method(D_METHOD("get_input_caption", "input"), &AnimationNodeTransition::get_input_caption);
+ ClassDB::bind_method(D_METHOD("set_input_reset", "input", "enable"), &AnimationNodeTransition::set_input_reset);
+ ClassDB::bind_method(D_METHOD("is_input_reset", "input"), &AnimationNodeTransition::is_input_reset);
ClassDB::bind_method(D_METHOD("set_xfade_time", "time"), &AnimationNodeTransition::set_xfade_time);
ClassDB::bind_method(D_METHOD("get_xfade_time"), &AnimationNodeTransition::get_xfade_time);
@@ -836,24 +932,12 @@ void AnimationNodeTransition::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_xfade_curve", "curve"), &AnimationNodeTransition::set_xfade_curve);
ClassDB::bind_method(D_METHOD("get_xfade_curve"), &AnimationNodeTransition::get_xfade_curve);
- ClassDB::bind_method(D_METHOD("set_from_start", "from_start"), &AnimationNodeTransition::set_from_start);
- ClassDB::bind_method(D_METHOD("is_from_start"), &AnimationNodeTransition::is_from_start);
-
- ADD_PROPERTY(PropertyInfo(Variant::INT, "enabled_inputs", PROPERTY_HINT_RANGE, "0,64,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_enabled_inputs", "get_enabled_inputs");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "xfade_time", PROPERTY_HINT_RANGE, "0,120,0.01,suffix:s"), "set_xfade_time", "get_xfade_time");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "xfade_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"), "set_xfade_curve", "get_xfade_curve");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "from_start"), "set_from_start", "is_from_start");
-
- for (int i = 0; i < MAX_INPUTS; i++) {
- ADD_PROPERTYI(PropertyInfo(Variant::STRING, "input_" + itos(i) + "/name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_input_caption", "get_input_caption", i);
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "input_" + itos(i) + "/auto_advance", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_input_as_auto_advance", "is_input_set_as_auto_advance", i);
- }
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "input_count", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_ARRAY | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED, "Inputs,input_"), "set_input_count", "get_input_count");
}
AnimationNodeTransition::AnimationNodeTransition() {
- for (int i = 0; i < MAX_INPUTS; i++) {
- inputs[i].name = "state " + itos(i);
- }
}
/////////////////////
diff --git a/scene/animation/animation_blend_tree.h b/scene/animation/animation_blend_tree.h
index e72471202e..3c27edbf70 100644
--- a/scene/animation/animation_blend_tree.h
+++ b/scene/animation/animation_blend_tree.h
@@ -96,6 +96,12 @@ class AnimationNodeOneShot : public AnimationNodeSync {
GDCLASS(AnimationNodeOneShot, AnimationNodeSync);
public:
+ enum OneShotRequest {
+ ONE_SHOT_REQUEST_NONE,
+ ONE_SHOT_REQUEST_FIRE,
+ ONE_SHOT_REQUEST_ABORT,
+ };
+
enum MixMode {
MIX_MODE_BLEND,
MIX_MODE_ADD
@@ -110,13 +116,8 @@ private:
double autorestart_random_delay = 0.0;
MixMode mix = MIX_MODE_BLEND;
- /* bool active;
- bool do_start;
- double time;
- double remaining;*/
-
+ StringName request = PNAME("request");
StringName active = PNAME("active");
- StringName prev_active = "prev_active";
StringName time = "time";
StringName remaining = "remaining";
StringName time_to_restart = "time_to_restart";
@@ -127,6 +128,7 @@ protected:
public:
virtual void get_parameter_list(List<PropertyInfo> *r_list) const override;
virtual Variant get_parameter_default_value(const StringName &p_parameter) const override;
+ virtual bool is_parameter_read_only(const StringName &p_parameter) const override;
virtual String get_caption() const override;
@@ -153,6 +155,7 @@ public:
AnimationNodeOneShot();
};
+VARIANT_ENUM_CAST(AnimationNodeOneShot::OneShotRequest)
VARIANT_ENUM_CAST(AnimationNodeOneShot::MixMode)
class AnimationNodeAdd2 : public AnimationNodeSync {
@@ -273,54 +276,48 @@ public:
class AnimationNodeTransition : public AnimationNodeSync {
GDCLASS(AnimationNodeTransition, AnimationNodeSync);
- enum {
- MAX_INPUTS = 32
- };
struct InputData {
- String name;
bool auto_advance = false;
+ bool reset = true;
};
+ Vector<InputData> input_data;
- InputData inputs[MAX_INPUTS];
- int enabled_inputs = 0;
-
- /*
- double prev_xfading;
- int prev;
- double time;
- int current;
- int prev_current; */
-
- StringName prev_xfading = "prev_xfading";
- StringName prev = "prev";
StringName time = "time";
- StringName current = PNAME("current");
- StringName prev_current = "prev_current";
+ StringName prev_xfading = "prev_xfading";
+ StringName prev_index = "prev_index";
+ StringName current_index = PNAME("current_index");
+ StringName current_state = PNAME("current_state");
+ StringName transition_request = PNAME("transition_request");
+
+ StringName prev_frame_current = "pf_current";
+ StringName prev_frame_current_idx = "pf_current_idx";
double xfade_time = 0.0;
Ref<Curve> xfade_curve;
- bool from_start = true;
-
- void _update_inputs();
protected:
+ bool _get(const StringName &p_path, Variant &r_ret) const;
+ bool _set(const StringName &p_path, const Variant &p_value);
static void _bind_methods();
- void _validate_property(PropertyInfo &p_property) const;
+ void _get_property_list(List<PropertyInfo> *p_list) const;
public:
virtual void get_parameter_list(List<PropertyInfo> *r_list) const override;
virtual Variant get_parameter_default_value(const StringName &p_parameter) const override;
+ virtual bool is_parameter_read_only(const StringName &p_parameter) const override;
virtual String get_caption() const override;
- void set_enabled_inputs(int p_inputs);
- int get_enabled_inputs();
+ void set_input_count(int p_inputs);
+
+ virtual bool add_input(const String &p_name) override;
+ virtual void remove_input(int p_index) override;
void set_input_as_auto_advance(int p_input, bool p_enable);
bool is_input_set_as_auto_advance(int p_input) const;
- void set_input_caption(int p_input, const String &p_name);
- String get_input_caption(int p_input) const;
+ void set_input_reset(int p_input, bool p_enable);
+ bool is_input_reset(int p_input) const;
void set_xfade_time(double p_fade);
double get_xfade_time() const;
@@ -328,9 +325,6 @@ public:
void set_xfade_curve(const Ref<Curve> &p_curve);
Ref<Curve> get_xfade_curve() const;
- void set_from_start(bool p_from_start);
- bool is_from_start() const;
-
double process(double p_time, bool p_seek, bool p_is_external_seeking) override;
AnimationNodeTransition();
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index f5df64dbdd..7fb831b3b2 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -107,6 +107,15 @@ Ref<Curve> AnimationNodeStateMachineTransition::get_xfade_curve() const {
return xfade_curve;
}
+void AnimationNodeStateMachineTransition::set_reset(bool p_reset) {
+ reset = p_reset;
+ emit_changed();
+}
+
+bool AnimationNodeStateMachineTransition::is_reset() const {
+ return reset;
+}
+
void AnimationNodeStateMachineTransition::set_priority(int p_priority) {
priority = p_priority;
emit_changed();
@@ -132,6 +141,9 @@ void AnimationNodeStateMachineTransition::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_xfade_curve", "curve"), &AnimationNodeStateMachineTransition::set_xfade_curve);
ClassDB::bind_method(D_METHOD("get_xfade_curve"), &AnimationNodeStateMachineTransition::get_xfade_curve);
+ ClassDB::bind_method(D_METHOD("set_reset", "reset"), &AnimationNodeStateMachineTransition::set_reset);
+ ClassDB::bind_method(D_METHOD("is_reset"), &AnimationNodeStateMachineTransition::is_reset);
+
ClassDB::bind_method(D_METHOD("set_priority", "priority"), &AnimationNodeStateMachineTransition::set_priority);
ClassDB::bind_method(D_METHOD("get_priority"), &AnimationNodeStateMachineTransition::get_priority);
@@ -140,6 +152,9 @@ void AnimationNodeStateMachineTransition::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "xfade_time", PROPERTY_HINT_RANGE, "0,240,0.01,suffix:s"), "set_xfade_time", "get_xfade_time");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "xfade_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"), "set_xfade_curve", "get_xfade_curve");
+
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "reset"), "set_reset", "is_reset");
+
ADD_PROPERTY(PropertyInfo(Variant::INT, "priority", PROPERTY_HINT_RANGE, "0,32,1"), "set_priority", "get_priority");
ADD_GROUP("Switch", "");
ADD_PROPERTY(PropertyInfo(Variant::INT, "switch_mode", PROPERTY_HINT_ENUM, "Immediate,Sync,At End"), "set_switch_mode", "get_switch_mode");
@@ -164,18 +179,27 @@ AnimationNodeStateMachineTransition::AnimationNodeStateMachineTransition() {
////////////////////////////////////////////////////////
-void AnimationNodeStateMachinePlayback::travel(const StringName &p_state) {
- start_request_travel = true;
- start_request = p_state;
+void AnimationNodeStateMachinePlayback::travel(const StringName &p_state, bool p_reset_on_teleport) {
+ travel_request = p_state;
+ reset_request_on_teleport = p_reset_on_teleport;
stop_request = false;
}
-void AnimationNodeStateMachinePlayback::start(const StringName &p_state) {
- start_request_travel = false;
+void AnimationNodeStateMachinePlayback::start(const StringName &p_state, bool p_reset) {
+ travel_request = StringName();
+ reset_request = p_reset;
+ _start(p_state);
+}
+
+void AnimationNodeStateMachinePlayback::_start(const StringName &p_state) {
start_request = p_state;
stop_request = false;
}
+void AnimationNodeStateMachinePlayback::next() {
+ next_request = true;
+}
+
void AnimationNodeStateMachinePlayback::stop() {
stop_request = true;
}
@@ -188,7 +212,7 @@ StringName AnimationNodeStateMachinePlayback::get_current_node() const {
return current;
}
-StringName AnimationNodeStateMachinePlayback::get_blend_from_node() const {
+StringName AnimationNodeStateMachinePlayback::get_fading_from_node() const {
return fading_from;
}
@@ -204,6 +228,22 @@ float AnimationNodeStateMachinePlayback::get_current_length() const {
return len_current;
}
+float AnimationNodeStateMachinePlayback::get_fade_from_play_pos() const {
+ return pos_fade_from;
+}
+
+float AnimationNodeStateMachinePlayback::get_fade_from_length() const {
+ return len_fade_from;
+}
+
+float AnimationNodeStateMachinePlayback::get_fading_time() const {
+ return fading_time;
+}
+
+float AnimationNodeStateMachinePlayback::get_fading_pos() const {
+ return fading_pos;
+}
+
bool AnimationNodeStateMachinePlayback::_travel(AnimationNodeStateMachine *p_state_machine, const StringName &p_travel) {
ERR_FAIL_COND_V(!playing, false);
ERR_FAIL_COND_V(!p_state_machine->states.has(p_travel), false);
@@ -212,7 +252,7 @@ bool AnimationNodeStateMachinePlayback::_travel(AnimationNodeStateMachine *p_sta
path.clear(); //a new one will be needed
if (current == p_travel) {
- return true; //nothing to do
+ return false; // Will teleport oneself (restart).
}
Vector2 current_pos = p_state_machine->states[current].position;
@@ -323,6 +363,15 @@ bool AnimationNodeStateMachinePlayback::_travel(AnimationNodeStateMachine *p_sta
}
double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_state_machine, double p_time, bool p_seek, bool p_is_external_seeking) {
+ double rem = _process(p_state_machine, p_time, p_seek, p_is_external_seeking);
+ start_request = StringName();
+ next_request = false;
+ stop_request = false;
+ reset_request_on_teleport = false;
+ return rem;
+}
+
+double AnimationNodeStateMachinePlayback::_process(AnimationNodeStateMachine *p_state_machine, double p_time, bool p_seek, bool p_is_external_seeking) {
if (p_time == -1) {
Ref<AnimationNodeStateMachine> anodesm = p_state_machine->states[current].node;
if (anodesm.is_valid()) {
@@ -335,14 +384,13 @@ double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_s
//if not playing and it can restart, then restart
if (!playing && start_request == StringName()) {
if (!stop_request && p_state_machine->start_node) {
- start(p_state_machine->start_node);
+ _start(p_state_machine->start_node);
} else {
return 0;
}
}
if (playing && stop_request) {
- stop_request = false;
playing = false;
return 0;
}
@@ -350,42 +398,47 @@ double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_s
bool play_start = false;
if (start_request != StringName()) {
- if (start_request_travel) {
- if (!playing) {
- if (!stop_request && p_state_machine->start_node) {
- // can restart, just postpone traveling
- path.clear();
- current = p_state_machine->start_node;
- playing = true;
- play_start = true;
- } else {
- // stopped, invalid state
- String node_name = start_request;
- start_request = StringName(); //clear start request
- ERR_FAIL_V_MSG(0, "Can't travel to '" + node_name + "' if state machine is not playing. Maybe you need to enable Autoplay on Load for one of the nodes in your state machine or call .start() first?");
- }
- } else {
- if (!_travel(p_state_machine, start_request)) {
- // can't travel, then teleport
- path.clear();
- current = start_request;
- play_start = true;
- }
- start_request = StringName(); //clear start request
- }
+ // teleport to start
+ if (p_state_machine->states.has(start_request)) {
+ path.clear();
+ current = start_request;
+ playing = true;
+ play_start = true;
} else {
- // teleport to start
- if (p_state_machine->states.has(start_request)) {
+ StringName node = start_request;
+ ERR_FAIL_V_MSG(0, "No such node: '" + node + "'");
+ }
+ } else if (travel_request != StringName()) {
+ if (!playing) {
+ if (!stop_request && p_state_machine->start_node) {
+ // can restart, just postpone traveling
path.clear();
- current = start_request;
+ current = p_state_machine->start_node;
playing = true;
play_start = true;
- start_request = StringName(); //clear start request
} else {
- StringName node = start_request;
- start_request = StringName(); //clear start request
- ERR_FAIL_V_MSG(0, "No such node: '" + node + "'");
+ // stopped, invalid state
+ String node_name = travel_request;
+ travel_request = StringName();
+ ERR_FAIL_V_MSG(0, "Can't travel to '" + node_name + "' if state machine is not playing. Maybe you need to enable Autoplay on Load for one of the nodes in your state machine or call .start() first?");
+ }
+ } else {
+ if (!_travel(p_state_machine, travel_request)) {
+ // can't travel, then teleport
+ if (p_state_machine->states.has(travel_request)) {
+ path.clear();
+ if (current != travel_request || reset_request_on_teleport) {
+ current = travel_request;
+ play_start = true;
+ reset_request = reset_request_on_teleport;
+ }
+ } else {
+ StringName node = travel_request;
+ travel_request = StringName();
+ ERR_FAIL_V_MSG(0, "No such node: '" + node + "'");
+ }
}
+ travel_request = StringName();
}
}
@@ -396,8 +449,11 @@ double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_s
current = p_state_machine->start_node;
}
- len_current = p_state_machine->blend_node(current, p_state_machine->states[current].node, 0, true, p_is_external_seeking, 1.0, AnimationNode::FILTER_IGNORE, true);
- pos_current = 0;
+ if (reset_request) {
+ len_current = p_state_machine->blend_node(current, p_state_machine->states[current].node, 0, true, p_is_external_seeking, 1.0, AnimationNode::FILTER_IGNORE, true);
+ pos_current = 0;
+ reset_request = false;
+ }
}
if (!p_state_machine->states.has(current)) {
@@ -421,11 +477,22 @@ double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_s
if (current_curve.is_valid()) {
fade_blend = current_curve->sample(fade_blend);
}
- double rem = p_state_machine->blend_node(current, p_state_machine->states[current].node, p_time, p_seek, p_is_external_seeking, Math::is_zero_approx(fade_blend) ? CMP_EPSILON : fade_blend, AnimationNode::FILTER_IGNORE, true); // Blend values must be more than CMP_EPSILON to process discrete keys in edge.
+
+ double rem = do_start ? len_current : p_state_machine->blend_node(current, p_state_machine->states[current].node, p_time, p_seek, p_is_external_seeking, Math::is_zero_approx(fade_blend) ? CMP_EPSILON : fade_blend, AnimationNode::FILTER_IGNORE, true); // Blend values must be more than CMP_EPSILON to process discrete keys in edge.
if (fading_from != StringName()) {
double fade_blend_inv = 1.0 - fade_blend;
- p_state_machine->blend_node(fading_from, p_state_machine->states[fading_from].node, p_time, p_seek, p_is_external_seeking, Math::is_zero_approx(fade_blend_inv) ? CMP_EPSILON : fade_blend_inv, AnimationNode::FILTER_IGNORE, true); // Blend values must be more than CMP_EPSILON to process discrete keys in edge.
+ float fading_from_rem = 0.0;
+ fading_from_rem = p_state_machine->blend_node(fading_from, p_state_machine->states[fading_from].node, p_time, p_seek, p_is_external_seeking, Math::is_zero_approx(fade_blend_inv) ? CMP_EPSILON : fade_blend_inv, AnimationNode::FILTER_IGNORE, true); // Blend values must be more than CMP_EPSILON to process discrete keys in edge.
+ //guess playback position
+ if (fading_from_rem > len_fade_from) { // weird but ok
+ len_fade_from = fading_from_rem;
+ }
+
+ { //advance and loop check
+ float next_pos = len_fade_from - fading_from_rem;
+ pos_fade_from = next_pos; //looped
+ }
if (fade_blend >= 1.0) {
fading_from = StringName();
}
@@ -457,6 +524,7 @@ double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_s
next_xfade = p_state_machine->transitions[i].transition->get_xfade_time();
current_curve = p_state_machine->transitions[i].transition->get_xfade_curve();
switch_mode = p_state_machine->transitions[i].transition->get_switch_mode();
+ reset_request = p_state_machine->transitions[i].transition->is_reset();
next = path[0];
}
}
@@ -513,6 +581,7 @@ double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_s
current_curve = p_state_machine->transitions[auto_advance_to].transition->get_xfade_curve();
next_xfade = p_state_machine->transitions[auto_advance_to].transition->get_xfade_time();
switch_mode = p_state_machine->transitions[auto_advance_to].transition->get_switch_mode();
+ reset_request = p_state_machine->transitions[auto_advance_to].transition->is_reset();
}
}
@@ -567,7 +636,7 @@ double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_s
goto_next = fading_from == StringName();
}
- if (goto_next) { //end_loop should be used because fade time may be too small or zero and animation may have looped
+ if (next_request || goto_next) { //end_loop should be used because fade time may be too small or zero and animation may have looped
if (next_xfade) {
//time to fade, baby
fading_from = current;
@@ -590,8 +659,12 @@ double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_s
}
current = next;
+ pos_fade_from = pos_current;
+ len_fade_from = len_current;
- len_current = p_state_machine->blend_node(current, p_state_machine->states[current].node, 0, true, p_is_external_seeking, CMP_EPSILON, AnimationNode::FILTER_IGNORE, true); // Process next node's first key in here.
+ if (reset_request) {
+ len_current = p_state_machine->blend_node(current, p_state_machine->states[current].node, 0, true, p_is_external_seeking, CMP_EPSILON, AnimationNode::FILTER_IGNORE, true); // Process next node's first key in here.
+ }
if (switch_mode == AnimationNodeStateMachineTransition::SWITCH_MODE_SYNC) {
pos_current = MIN(pos_current, len_current);
p_state_machine->blend_node(current, p_state_machine->states[current].node, pos_current, true, p_is_external_seeking, 0, AnimationNode::FILTER_IGNORE, true);
@@ -652,13 +725,15 @@ bool AnimationNodeStateMachinePlayback::_check_advance_condition(const Ref<Anima
}
void AnimationNodeStateMachinePlayback::_bind_methods() {
- ClassDB::bind_method(D_METHOD("travel", "to_node"), &AnimationNodeStateMachinePlayback::travel);
- ClassDB::bind_method(D_METHOD("start", "node"), &AnimationNodeStateMachinePlayback::start);
+ ClassDB::bind_method(D_METHOD("travel", "to_node", "reset_on_teleport"), &AnimationNodeStateMachinePlayback::travel, DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("start", "node", "reset"), &AnimationNodeStateMachinePlayback::start, DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("next"), &AnimationNodeStateMachinePlayback::next);
ClassDB::bind_method(D_METHOD("stop"), &AnimationNodeStateMachinePlayback::stop);
ClassDB::bind_method(D_METHOD("is_playing"), &AnimationNodeStateMachinePlayback::is_playing);
ClassDB::bind_method(D_METHOD("get_current_node"), &AnimationNodeStateMachinePlayback::get_current_node);
ClassDB::bind_method(D_METHOD("get_current_play_position"), &AnimationNodeStateMachinePlayback::get_current_play_pos);
ClassDB::bind_method(D_METHOD("get_current_length"), &AnimationNodeStateMachinePlayback::get_current_length);
+ ClassDB::bind_method(D_METHOD("get_fading_from_node"), &AnimationNodeStateMachinePlayback::get_fading_from_node);
ClassDB::bind_method(D_METHOD("get_travel_path"), &AnimationNodeStateMachinePlayback::get_travel_path);
}
@@ -669,7 +744,7 @@ AnimationNodeStateMachinePlayback::AnimationNodeStateMachinePlayback() {
///////////////////////////////////////////////////////
void AnimationNodeStateMachine::get_parameter_list(List<PropertyInfo> *r_list) const {
- r_list->push_back(PropertyInfo(Variant::OBJECT, playback, PROPERTY_HINT_RESOURCE_TYPE, "AnimationNodeStateMachinePlayback", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE));
+ r_list->push_back(PropertyInfo(Variant::OBJECT, playback, PROPERTY_HINT_RESOURCE_TYPE, "AnimationNodeStateMachinePlayback", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_ALWAYS_DUPLICATE));
List<StringName> advance_conditions;
for (int i = 0; i < transitions.size(); i++) {
StringName ac = transitions[i].transition->get_advance_condition_name();
diff --git a/scene/animation/animation_node_state_machine.h b/scene/animation/animation_node_state_machine.h
index 116589eb2f..cf4d850aa6 100644
--- a/scene/animation/animation_node_state_machine.h
+++ b/scene/animation/animation_node_state_machine.h
@@ -57,6 +57,7 @@ private:
StringName advance_condition_name;
float xfade_time = 0.0;
Ref<Curve> xfade_curve;
+ bool reset = true;
int priority = 1;
String advance_expression;
@@ -84,6 +85,9 @@ public:
void set_xfade_time(float p_xfade);
float get_xfade_time() const;
+ void set_reset(bool p_reset);
+ bool is_reset() const;
+
void set_xfade_curve(const Ref<Curve> &p_curve);
Ref<Curve> get_xfade_curve() const;
@@ -114,6 +118,9 @@ class AnimationNodeStateMachinePlayback : public Resource {
StringName next;
};
+ double len_fade_from = 0.0;
+ double pos_fade_from = 0.0;
+
double len_current = 0.0;
double pos_current = 0.0;
bool end_loop = false;
@@ -131,10 +138,15 @@ class AnimationNodeStateMachinePlayback : public Resource {
bool playing = false;
StringName start_request;
- bool start_request_travel = false;
+ StringName travel_request;
+ bool reset_request = false;
+ bool reset_request_on_teleport = false;
+ bool next_request = false;
bool stop_request = false;
bool _travel(AnimationNodeStateMachine *p_state_machine, const StringName &p_travel);
+ void _start(const StringName &p_state);
+ double _process(AnimationNodeStateMachine *p_state_machine, double p_time, bool p_seek, bool p_is_external_seeking);
double process(AnimationNodeStateMachine *p_state_machine, double p_time, bool p_seek, bool p_is_external_seeking);
@@ -144,16 +156,23 @@ protected:
static void _bind_methods();
public:
- void travel(const StringName &p_state);
- void start(const StringName &p_state);
+ void travel(const StringName &p_state, bool p_reset_on_teleport = true);
+ void start(const StringName &p_state, bool p_reset = true);
+ void next();
void stop();
bool is_playing() const;
StringName get_current_node() const;
- StringName get_blend_from_node() const;
+ StringName get_fading_from_node() const;
Vector<StringName> get_travel_path() const;
float get_current_play_pos() const;
float get_current_length() const;
+ float get_fade_from_play_pos() const;
+ float get_fade_from_length() const;
+
+ float get_fading_time() const;
+ float get_fading_pos() const;
+
AnimationNodeStateMachinePlayback();
};
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 0febe580db..2e25d685d6 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -143,8 +143,8 @@ bool AnimationPlayer::_get(const StringName &p_name, Variant &r_ret) const {
} else if (name.begins_with("libraries")) {
Dictionary d;
- for (uint32_t i = 0; i < animation_libraries.size(); i++) {
- d[animation_libraries[i].name] = animation_libraries[i].library;
+ for (const AnimationLibraryData &lib : animation_libraries) {
+ d[lib.name] = lib.library;
}
r_ret = d;
@@ -431,6 +431,17 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim, Node *p_root_ov
}
}
+ if (a->track_get_type(i) == Animation::TYPE_AUDIO) {
+ if (!node_cache->audio_anim.has(a->track_get_path(i).get_concatenated_names())) {
+ TrackNodeCache::AudioAnim aa;
+ aa.object = (Object *)child;
+ aa.audio_stream.instantiate();
+ aa.audio_stream->set_polyphony(audio_max_polyphony);
+
+ node_cache->audio_anim[a->track_get_path(i).get_concatenated_names()] = aa;
+ }
+ }
+
node_cache->last_setup_pass = setup_pass;
}
}
@@ -451,6 +462,15 @@ static void _call_object(Object *p_object, const StringName &p_method, const Vec
}
}
+Variant AnimationPlayer::post_process_key_value(const Ref<Animation> &p_anim, int p_track, Variant p_value, const Object *p_object, int p_object_idx) {
+ Variant res;
+ if (GDVIRTUAL_CALL(_post_process_key_value, p_anim, p_track, p_value, const_cast<Object *>(p_object), p_object_idx, res)) {
+ return res;
+ }
+
+ return _post_process_key_value(p_anim, p_track, p_value, p_object, p_object_idx);
+}
+
Variant AnimationPlayer::_post_process_key_value(const Ref<Animation> &p_anim, int p_track, Variant p_value, const Object *p_object, int p_object_idx) {
switch (p_anim->track_get_type(p_track)) {
#ifndef _3D_DISABLED
@@ -473,7 +493,9 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double
ERR_FAIL_COND(p_anim->node_cache.size() != p_anim->animation->get_track_count());
Animation *a = p_anim->animation.operator->();
+#ifdef TOOLS_ENABLED
bool can_call = is_inside_tree() && !Engine::get_singleton()->is_editor_hint();
+#endif // TOOLS_ENABLED
bool backward = signbit(p_delta);
for (int i = 0; i < a->get_track_count(); i++) {
@@ -512,7 +534,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double
if (err != OK) {
continue;
}
- loc = _post_process_key_value(a, i, loc, nc->node_3d, nc->bone_idx);
+ loc = post_process_key_value(a, i, loc, nc->node_3d, nc->bone_idx);
if (nc->accum_pass != accum_pass) {
ERR_CONTINUE(cache_update_size >= NODE_CACHE_UPDATE_MAX);
@@ -540,7 +562,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double
if (err != OK) {
continue;
}
- rot = _post_process_key_value(a, i, rot, nc->node_3d, nc->bone_idx);
+ rot = post_process_key_value(a, i, rot, nc->node_3d, nc->bone_idx);
if (nc->accum_pass != accum_pass) {
ERR_CONTINUE(cache_update_size >= NODE_CACHE_UPDATE_MAX);
@@ -568,7 +590,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double
if (err != OK) {
continue;
}
- scale = _post_process_key_value(a, i, scale, nc->node_3d, nc->bone_idx);
+ scale = post_process_key_value(a, i, scale, nc->node_3d, nc->bone_idx);
if (nc->accum_pass != accum_pass) {
ERR_CONTINUE(cache_update_size >= NODE_CACHE_UPDATE_MAX);
@@ -596,7 +618,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double
if (err != OK) {
continue;
}
- blend = _post_process_key_value(a, i, blend, nc->node_blend_shape, nc->blend_shape_idx);
+ blend = post_process_key_value(a, i, blend, nc->node_blend_shape, nc->blend_shape_idx);
if (nc->accum_pass != accum_pass) {
ERR_CONTINUE(cache_update_size >= NODE_CACHE_UPDATE_MAX);
@@ -649,7 +671,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double
if (p_time < first_key_time) {
double c = Math::ease(p_time / first_key_time, transition);
Variant first_value = a->track_get_key_value(i, first_key);
- first_value = _post_process_key_value(a, i, first_value, nc->node);
+ first_value = post_process_key_value(a, i, first_value, nc->node);
Variant interp_value = Animation::interpolate_variant(pa->capture, first_value, c);
if (pa->accum_pass != accum_pass) {
ERR_CONTINUE(cache_update_prop_size >= NODE_CACHE_UPDATE_MAX);
@@ -670,7 +692,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double
if (value == Variant()) {
continue;
}
- value = _post_process_key_value(a, i, value, nc->node);
+ value = post_process_key_value(a, i, value, nc->node);
if (pa->accum_pass != accum_pass) {
ERR_CONTINUE(cache_update_prop_size >= NODE_CACHE_UPDATE_MAX);
@@ -701,7 +723,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double
for (int &F : indices) {
Variant value = a->track_get_key_value(i, F);
- value = _post_process_key_value(a, i, value, nc->node);
+ value = post_process_key_value(a, i, value, nc->node);
switch (pa->special) {
case SP_NONE: {
bool valid;
@@ -745,11 +767,13 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double
} break;
case Animation::TYPE_METHOD: {
- if (!nc->node || is_stopping) {
+#ifdef TOOLS_ENABLED
+ if (!can_call) {
continue;
}
- if (!p_is_current) {
- break;
+#endif // TOOLS_ENABLED
+ if (!p_is_current || !nc->node || is_stopping) {
+ continue;
}
List<int> indices;
@@ -772,16 +796,12 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double
for (int &E : indices) {
StringName method = a->method_track_get_name(i, E);
Vector<Variant> params = a->method_track_get_params(i, E);
-
#ifdef DEBUG_ENABLED
if (!nc->node->has_method(method)) {
ERR_PRINT("Invalid method call '" + method + "'. '" + a->get_name() + "' at node '" + get_path() + "'.");
}
#endif
-
- if (can_call) {
- _call_object(nc->node, method, params, method_call_mode == ANIMATION_METHOD_CALL_DEFERRED);
- }
+ _call_object(nc->node, method, params, method_call_mode == ANIMATION_METHOD_CALL_DEFERRED);
}
} break;
@@ -796,7 +816,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double
TrackNodeCache::BezierAnim *ba = &E->value;
real_t bezier = a->bezier_track_interpolate(i, p_time);
- bezier = _post_process_key_value(a, i, bezier, nc->node);
+ bezier = post_process_key_value(a, i, bezier, nc->node);
if (ba->accum_pass != accum_pass) {
ERR_CONTINUE(cache_update_bezier_size >= NODE_CACHE_UPDATE_MAX);
cache_update_bezier[cache_update_bezier_size++] = ba;
@@ -811,48 +831,40 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double
if (!nc->node || is_stopping) {
continue;
}
+#ifdef TOOLS_ENABLED
+ if (p_seeked && !can_call) {
+ continue; // To avoid spamming the preview in editor.
+ }
+#endif // TOOLS_ENABLED
+ HashMap<StringName, TrackNodeCache::AudioAnim>::Iterator E = nc->audio_anim.find(a->track_get_path(i).get_concatenated_names());
+ ERR_CONTINUE(!E); //should it continue, or create a new one?
- if (p_seeked) {
- //find whatever should be playing
- int idx = a->track_find_key(i, p_time);
- if (idx < 0) {
- continue;
- }
-
- Ref<AudioStream> stream = a->audio_track_get_key_stream(i, idx);
- if (!stream.is_valid()) {
- nc->node->call(SNAME("stop"));
- nc->audio_playing = false;
- playing_caches.erase(nc);
- } else {
- float start_ofs = a->audio_track_get_key_start_offset(i, idx);
- start_ofs += p_time - a->track_get_key_time(i, idx);
- float end_ofs = a->audio_track_get_key_end_offset(i, idx);
- float len = stream->get_length();
-
- if (start_ofs > len - end_ofs) {
- nc->node->call(SNAME("stop"));
- nc->audio_playing = false;
- playing_caches.erase(nc);
- continue;
- }
-
- nc->node->call(SNAME("set_stream"), stream);
- nc->node->call(SNAME("play"), start_ofs);
-
- nc->audio_playing = true;
- playing_caches.insert(nc);
- if (len && end_ofs > 0) { //force an end at a time
- nc->audio_len = len - start_ofs - end_ofs;
- } else {
- nc->audio_len = 0;
- }
+ TrackNodeCache::AudioAnim *aa = &E->value;
+ Node *asp = Object::cast_to<Node>(aa->object);
+ if (!asp) {
+ continue;
+ }
+ aa->length = a->get_length();
+ aa->time = p_time;
+ aa->loop = a->get_loop_mode() != Animation::LOOP_NONE;
+ aa->backward = backward;
+ if (aa->accum_pass != accum_pass) {
+ ERR_CONTINUE(cache_update_audio_size >= NODE_CACHE_UPDATE_MAX);
+ cache_update_audio[cache_update_audio_size++] = aa;
+ aa->accum_pass = accum_pass;
+ }
- nc->audio_start = p_time;
+ HashMap<int, TrackNodeCache::PlayingAudioStreamInfo> &map = aa->playing_streams;
+ // Find stream.
+ int idx = -1;
+ if (p_seeked) {
+ idx = a->track_find_key(i, p_time);
+ // Discard previous stream when seeking.
+ if (map.has(idx)) {
+ aa->audio_stream_playback->stop_stream(map[idx].index);
+ map.erase(idx);
}
-
} else {
- //find stuff to play
List<int> to_play;
if (p_started) {
int first_key = a->track_find_key(i, p_prev_time, Animation::FIND_MODE_EXACT);
@@ -862,55 +874,47 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double
}
a->track_get_key_indices_in_range(i, p_time, p_delta, &to_play, p_looped_flag);
if (to_play.size()) {
- int idx = to_play.back()->get();
-
- Ref<AudioStream> stream = a->audio_track_get_key_stream(i, idx);
- if (!stream.is_valid()) {
- nc->node->call(SNAME("stop"));
- nc->audio_playing = false;
- playing_caches.erase(nc);
- } else {
- float start_ofs = a->audio_track_get_key_start_offset(i, idx);
- float end_ofs = a->audio_track_get_key_end_offset(i, idx);
- float len = stream->get_length();
-
- nc->node->call(SNAME("set_stream"), stream);
- nc->node->call(SNAME("play"), start_ofs);
-
- nc->audio_playing = true;
- playing_caches.insert(nc);
- if (len && end_ofs > 0) { //force an end at a time
- nc->audio_len = len - start_ofs - end_ofs;
- } else {
- nc->audio_len = 0;
- }
-
- nc->audio_start = p_time;
- }
- } else if (nc->audio_playing) {
- bool loop = a->get_loop_mode() != Animation::LOOP_NONE;
-
- bool stop = false;
-
- if (!loop) {
- if ((p_time < nc->audio_start && !backward) || (p_time > nc->audio_start && backward)) {
- stop = true;
- }
- } else if (nc->audio_len > 0) {
- float len = nc->audio_start > p_time ? (a->get_length() - nc->audio_start) + p_time : p_time - nc->audio_start;
+ idx = to_play.back()->get();
+ }
+ }
+ if (idx < 0) {
+ continue;
+ }
- if (len > nc->audio_len) {
- stop = true;
- }
+ // Play stream.
+ Ref<AudioStream> stream = a->audio_track_get_key_stream(i, idx);
+ if (stream.is_valid()) {
+ double start_ofs = a->audio_track_get_key_start_offset(i, idx);
+ double end_ofs = a->audio_track_get_key_end_offset(i, idx);
+ double len = stream->get_length();
+
+ if (aa->object->call(SNAME("get_stream")) != aa->audio_stream) {
+ aa->object->call(SNAME("set_stream"), aa->audio_stream);
+ aa->audio_stream_playback.unref();
+ if (!playing_audio_stream_players.has(asp)) {
+ playing_audio_stream_players.push_back(asp);
}
+ }
+ if (!aa->object->call(SNAME("is_playing"))) {
+ aa->object->call(SNAME("play"));
+ }
+ if (!aa->object->call(SNAME("has_stream_playback"))) {
+ aa->audio_stream_playback.unref();
+ continue;
+ }
+ if (aa->audio_stream_playback.is_null()) {
+ aa->audio_stream_playback = aa->object->call(SNAME("get_stream_playback"));
+ }
- if (stop) {
- //time to stop
- nc->node->call(SNAME("stop"));
- nc->audio_playing = false;
- playing_caches.erase(nc);
- }
+ TrackNodeCache::PlayingAudioStreamInfo pasi;
+ pasi.index = aa->audio_stream_playback->play_stream(stream, start_ofs);
+ pasi.start = p_time;
+ if (len && end_ofs > 0) { // Force an end at a time.
+ pasi.len = len - start_ofs - end_ofs;
+ } else {
+ pasi.len = 0;
}
+ map[idx] = pasi;
}
} break;
@@ -1210,6 +1214,53 @@ void AnimationPlayer::_animation_update_transforms() {
ERR_CONTINUE(ba->accum_pass != accum_pass);
ba->object->set_indexed(ba->bezier_property, ba->bezier_accum);
}
+
+ for (int i = 0; i < cache_update_audio_size; i++) {
+ TrackNodeCache::AudioAnim *aa = cache_update_audio[i];
+
+ ERR_CONTINUE(aa->accum_pass != accum_pass);
+
+ // Audio ending process.
+ LocalVector<int> erase_list;
+ for (const KeyValue<int, TrackNodeCache::PlayingAudioStreamInfo> &K : aa->playing_streams) {
+ TrackNodeCache::PlayingAudioStreamInfo pasi = K.value;
+
+ bool stop = false;
+ if (!aa->audio_stream_playback->is_stream_playing(pasi.index)) {
+ stop = true;
+ }
+ if (!aa->loop) {
+ if (!aa->backward) {
+ if (aa->time < pasi.start) {
+ stop = true;
+ }
+ } else if (aa->backward) {
+ if (aa->time > pasi.start) {
+ stop = true;
+ }
+ }
+ }
+ if (pasi.len > 0) {
+ double len = 0.0;
+ if (!aa->backward) {
+ len = pasi.start > aa->time ? (aa->length - pasi.start) + aa->time : aa->time - pasi.start;
+ } else {
+ len = pasi.start < aa->time ? (aa->length - aa->time) + pasi.start : pasi.start - aa->time;
+ }
+ if (len > pasi.len) {
+ stop = true;
+ }
+ }
+ if (stop) {
+ // Time to stop.
+ aa->audio_stream_playback->stop_stream(pasi.index);
+ erase_list.push_back(K.key);
+ }
+ }
+ for (uint32_t erase_idx = 0; erase_idx < erase_list.size(); erase_idx++) {
+ aa->playing_streams.erase(erase_list[erase_idx]);
+ }
+ }
}
void AnimationPlayer::_animation_process(double p_delta) {
@@ -1225,6 +1276,7 @@ void AnimationPlayer::_animation_process(double p_delta) {
cache_update_size = 0;
cache_update_prop_size = 0;
cache_update_bezier_size = 0;
+ cache_update_audio_size = 0;
AnimationData *prev_from = playback.current.from;
_animation_process2(p_delta, started);
@@ -1269,13 +1321,13 @@ void AnimationPlayer::_animation_set_cache_update() {
bool clear_cache_needed = false;
// Update changed and add otherwise
- for (uint32_t i = 0; i < animation_libraries.size(); i++) {
- for (const KeyValue<StringName, Ref<Animation>> &K : animation_libraries[i].library->animations) {
- StringName key = animation_libraries[i].name == StringName() ? K.key : StringName(String(animation_libraries[i].name) + "/" + String(K.key));
+ for (const AnimationLibraryData &lib : animation_libraries) {
+ for (const KeyValue<StringName, Ref<Animation>> &K : lib.library->animations) {
+ StringName key = lib.name == StringName() ? K.key : StringName(String(lib.name) + "/" + String(K.key));
if (!animation_set.has(key)) {
AnimationData ad;
ad.animation = K.value;
- ad.animation_library = animation_libraries[i].name;
+ ad.animation_library = lib.name;
ad.name = key;
ad.last_update = animation_set_update_pass;
animation_set.insert(ad.name, ad);
@@ -1283,11 +1335,11 @@ void AnimationPlayer::_animation_set_cache_update() {
AnimationData &ad = animation_set[key];
if (ad.last_update != animation_set_update_pass) {
// Was not updated, update. If the animation is duplicated, the second one will be ignored.
- if (ad.animation != K.value || ad.animation_library != animation_libraries[i].name) {
+ if (ad.animation != K.value || ad.animation_library != lib.name) {
// Animation changed, update and clear caches.
clear_cache_needed = true;
ad.animation = K.value;
- ad.animation_library = animation_libraries[i].name;
+ ad.animation_library = lib.name;
}
ad.last_update = animation_set_update_pass;
@@ -1405,11 +1457,11 @@ Error AnimationPlayer::add_animation_library(const StringName &p_name, const Ref
int insert_pos = 0;
- for (uint32_t i = 0; i < animation_libraries.size(); i++) {
- ERR_FAIL_COND_V_MSG(animation_libraries[i].name == p_name, ERR_ALREADY_EXISTS, "Can't add animation library twice with name: " + String(p_name));
- ERR_FAIL_COND_V_MSG(animation_libraries[i].library == p_animation_library, ERR_ALREADY_EXISTS, "Can't add animation library twice (adding as '" + p_name.operator String() + "', exists as '" + animation_libraries[i].name.operator String() + "'.");
+ for (const AnimationLibraryData &lib : animation_libraries) {
+ ERR_FAIL_COND_V_MSG(lib.name == p_name, ERR_ALREADY_EXISTS, "Can't add animation library twice with name: " + String(p_name));
+ ERR_FAIL_COND_V_MSG(lib.library == p_animation_library, ERR_ALREADY_EXISTS, "Can't add animation library twice (adding as '" + p_name.operator String() + "', exists as '" + lib.name.operator String() + "'.");
- if (animation_libraries[i].name.operator String() >= p_name.operator String()) {
+ if (lib.name.operator String() >= p_name.operator String()) {
break;
}
@@ -1468,21 +1520,21 @@ void AnimationPlayer::rename_animation_library(const StringName &p_name, const S
#endif
bool found = false;
- for (uint32_t i = 0; i < animation_libraries.size(); i++) {
- ERR_FAIL_COND_MSG(animation_libraries[i].name == p_new_name, "Can't rename animation library to another existing name: " + String(p_new_name));
- if (animation_libraries[i].name == p_name) {
+ for (AnimationLibraryData &lib : animation_libraries) {
+ ERR_FAIL_COND_MSG(lib.name == p_new_name, "Can't rename animation library to another existing name: " + String(p_new_name));
+ if (lib.name == p_name) {
found = true;
- animation_libraries[i].name = p_new_name;
+ lib.name = p_new_name;
// rename connections
- animation_libraries[i].library->disconnect(SNAME("animation_added"), callable_mp(this, &AnimationPlayer::_animation_added));
- animation_libraries[i].library->disconnect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_removed));
- animation_libraries[i].library->disconnect(SNAME("animation_renamed"), callable_mp(this, &AnimationPlayer::_animation_renamed));
+ lib.library->disconnect(SNAME("animation_added"), callable_mp(this, &AnimationPlayer::_animation_added));
+ lib.library->disconnect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_removed));
+ lib.library->disconnect(SNAME("animation_renamed"), callable_mp(this, &AnimationPlayer::_animation_renamed));
- animation_libraries[i].library->connect(SNAME("animation_added"), callable_mp(this, &AnimationPlayer::_animation_added).bind(p_new_name));
- animation_libraries[i].library->connect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_removed).bind(p_new_name));
- animation_libraries[i].library->connect(SNAME("animation_renamed"), callable_mp(this, &AnimationPlayer::_animation_renamed).bind(p_new_name));
+ lib.library->connect(SNAME("animation_added"), callable_mp(this, &AnimationPlayer::_animation_added).bind(p_new_name));
+ lib.library->connect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_removed).bind(p_new_name));
+ lib.library->connect(SNAME("animation_renamed"), callable_mp(this, &AnimationPlayer::_animation_renamed).bind(p_new_name));
- for (const KeyValue<StringName, Ref<Animation>> &K : animation_libraries[i].library->animations) {
+ for (const KeyValue<StringName, Ref<Animation>> &K : lib.library->animations) {
StringName old_name = p_name == StringName() ? K.key : StringName(String(p_name) + "/" + String(K.key));
StringName new_name = p_new_name == StringName() ? K.key : StringName(String(p_new_name) + "/" + String(K.key));
_rename_animation(old_name, new_name);
@@ -1502,8 +1554,8 @@ void AnimationPlayer::rename_animation_library(const StringName &p_name, const S
}
bool AnimationPlayer::has_animation_library(const StringName &p_name) const {
- for (uint32_t i = 0; i < animation_libraries.size(); i++) {
- if (animation_libraries[i].name == p_name) {
+ for (const AnimationLibraryData &lib : animation_libraries) {
+ if (lib.name == p_name) {
return true;
}
}
@@ -1512,9 +1564,9 @@ bool AnimationPlayer::has_animation_library(const StringName &p_name) const {
}
Ref<AnimationLibrary> AnimationPlayer::get_animation_library(const StringName &p_name) const {
- for (uint32_t i = 0; i < animation_libraries.size(); i++) {
- if (animation_libraries[i].name == p_name) {
- return animation_libraries[i].library;
+ for (const AnimationLibraryData &lib : animation_libraries) {
+ if (lib.name == p_name) {
+ return lib.library;
}
}
ERR_FAIL_V(Ref<AnimationLibrary>());
@@ -1522,15 +1574,15 @@ Ref<AnimationLibrary> AnimationPlayer::get_animation_library(const StringName &p
TypedArray<StringName> AnimationPlayer::_get_animation_library_list() const {
TypedArray<StringName> ret;
- for (uint32_t i = 0; i < animation_libraries.size(); i++) {
- ret.push_back(animation_libraries[i].name);
+ for (const AnimationLibraryData &lib : animation_libraries) {
+ ret.push_back(lib.name);
}
return ret;
}
void AnimationPlayer::get_animation_library_list(List<StringName> *p_libraries) const {
- for (uint32_t i = 0; i < animation_libraries.size(); i++) {
- p_libraries->push_back(animation_libraries[i].name);
+ for (const AnimationLibraryData &lib : animation_libraries) {
+ p_libraries->push_back(lib.name);
}
}
@@ -1662,6 +1714,7 @@ void AnimationPlayer::play(const StringName &p_name, double p_custom_blend, floa
}
if (get_current_animation() != p_name) {
+ _clear_audio_streams();
_stop_playing_caches(false);
}
@@ -1709,8 +1762,11 @@ bool AnimationPlayer::is_playing() const {
void AnimationPlayer::set_current_animation(const String &p_anim) {
if (p_anim == "[stop]" || p_anim.is_empty()) {
stop();
- } else if (!is_playing() || playback.assigned != p_anim) {
+ } else if (!is_playing()) {
play(p_anim);
+ } else if (playback.assigned != p_anim) {
+ float speed = get_playing_speed();
+ play(p_anim, -1.0, speed, signbit(speed));
} else {
// Same animation, do not replay from start
}
@@ -1722,7 +1778,8 @@ String AnimationPlayer::get_current_animation() const {
void AnimationPlayer::set_assigned_animation(const String &p_anim) {
if (is_playing()) {
- play(p_anim);
+ float speed = get_playing_speed();
+ play(p_anim, -1.0, speed, signbit(speed));
} else {
ERR_FAIL_COND_MSG(!animation_set.has(p_anim), vformat("Animation not found: %s.", p_anim));
playback.current.pos = 0;
@@ -1759,15 +1816,18 @@ float AnimationPlayer::get_playing_speed() const {
}
void AnimationPlayer::seek(double p_time, bool p_update) {
+ playback.current.pos = p_time;
+
if (!playback.current.from) {
if (playback.assigned) {
ERR_FAIL_COND_MSG(!animation_set.has(playback.assigned), vformat("Animation not found: %s.", playback.assigned));
playback.current.from = &animation_set[playback.assigned];
}
- ERR_FAIL_COND(!playback.current.from);
+ if (!playback.current.from) {
+ return; // There is no animation.
+ }
}
- playback.current.pos = p_time;
playback.seeked = true;
if (p_update) {
_animation_process(0);
@@ -1775,20 +1835,22 @@ void AnimationPlayer::seek(double p_time, bool p_update) {
}
void AnimationPlayer::seek_delta(double p_time, double p_delta) {
+ playback.current.pos = p_time - p_delta;
+
if (!playback.current.from) {
if (playback.assigned) {
ERR_FAIL_COND_MSG(!animation_set.has(playback.assigned), vformat("Animation not found: %s.", playback.assigned));
playback.current.from = &animation_set[playback.assigned];
}
- ERR_FAIL_COND(!playback.current.from);
+ if (!playback.current.from) {
+ return; // There is no animation.
+ }
}
- playback.current.pos = p_time - p_delta;
if (speed_scale != 0.0) {
p_delta /= speed_scale;
}
_animation_process(p_delta);
- //playback.current.pos=p_time;
}
bool AnimationPlayer::is_valid() const {
@@ -1839,6 +1901,7 @@ void AnimationPlayer::_node_removed(Node *p_node) {
}
void AnimationPlayer::clear_caches() {
+ _clear_audio_streams();
_stop_playing_caches(true);
node_cache_map.clear();
@@ -1850,10 +1913,19 @@ void AnimationPlayer::clear_caches() {
cache_update_size = 0;
cache_update_prop_size = 0;
cache_update_bezier_size = 0;
+ cache_update_audio_size = 0;
emit_signal(SNAME("caches_cleared"));
}
+void AnimationPlayer::_clear_audio_streams() {
+ for (int i = 0; i < playing_audio_stream_players.size(); i++) {
+ playing_audio_stream_players[i]->call(SNAME("stop"));
+ playing_audio_stream_players[i]->call(SNAME("set_stream"), Ref<AudioStream>());
+ }
+ playing_audio_stream_players.clear();
+}
+
void AnimationPlayer::set_active(bool p_active) {
if (active == p_active) {
return;
@@ -1933,6 +2005,15 @@ AnimationPlayer::AnimationMethodCallMode AnimationPlayer::get_method_call_mode()
return method_call_mode;
}
+void AnimationPlayer::set_audio_max_polyphony(int p_audio_max_polyphony) {
+ ERR_FAIL_COND(p_audio_max_polyphony < 0 || p_audio_max_polyphony > 128);
+ audio_max_polyphony = p_audio_max_polyphony;
+}
+
+int AnimationPlayer::get_audio_max_polyphony() const {
+ return audio_max_polyphony;
+}
+
void AnimationPlayer::set_movie_quit_on_finish_enabled(bool p_enabled) {
movie_quit_on_finish = p_enabled;
}
@@ -1961,6 +2042,7 @@ void AnimationPlayer::_set_process(bool p_process, bool p_force) {
}
void AnimationPlayer::_stop_internal(bool p_reset, bool p_keep_state) {
+ _clear_audio_streams();
_stop_playing_caches(p_reset);
Playback &c = playback;
c.blend.clear();
@@ -2181,6 +2263,9 @@ void AnimationPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_method_call_mode", "mode"), &AnimationPlayer::set_method_call_mode);
ClassDB::bind_method(D_METHOD("get_method_call_mode"), &AnimationPlayer::get_method_call_mode);
+ ClassDB::bind_method(D_METHOD("set_audio_max_polyphony", "max_polyphony"), &AnimationPlayer::set_audio_max_polyphony);
+ ClassDB::bind_method(D_METHOD("get_audio_max_polyphony"), &AnimationPlayer::get_audio_max_polyphony);
+
ClassDB::bind_method(D_METHOD("set_movie_quit_on_finish_enabled", "enabled"), &AnimationPlayer::set_movie_quit_on_finish_enabled);
ClassDB::bind_method(D_METHOD("is_movie_quit_on_finish_enabled"), &AnimationPlayer::is_movie_quit_on_finish_enabled);
@@ -2190,6 +2275,8 @@ void AnimationPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("seek", "seconds", "update"), &AnimationPlayer::seek, DEFVAL(false));
ClassDB::bind_method(D_METHOD("advance", "delta"), &AnimationPlayer::advance);
+ GDVIRTUAL_BIND(_post_process_key_value, "animation", "track", "value", "object", "object_idx");
+
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "root_node"), "set_root", "get_root");
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "current_animation", PROPERTY_HINT_ENUM, "", PROPERTY_USAGE_EDITOR), "set_current_animation", "get_current_animation");
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "assigned_animation", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_assigned_animation", "get_assigned_animation");
@@ -2202,8 +2289,9 @@ void AnimationPlayer::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Physics,Idle,Manual"), "set_process_callback", "get_process_callback");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "playback_default_blend_time", PROPERTY_HINT_RANGE, "0,4096,0.01,suffix:s"), "set_default_blend_time", "get_default_blend_time");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playback_active", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_active", "is_active");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "playback_speed", PROPERTY_HINT_RANGE, "-64,64,0.01"), "set_speed_scale", "get_speed_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "speed_scale", PROPERTY_HINT_RANGE, "-64,64,0.01"), "set_speed_scale", "get_speed_scale");
ADD_PROPERTY(PropertyInfo(Variant::INT, "method_call_mode", PROPERTY_HINT_ENUM, "Deferred,Immediate"), "set_method_call_mode", "get_method_call_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "audio_max_polyphony", PROPERTY_HINT_RANGE, "1,127,1"), "set_audio_max_polyphony", "get_audio_max_polyphony");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "movie_quit_on_finish"), "set_movie_quit_on_finish_enabled", "is_movie_quit_on_finish_enabled");
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index 7e7d12f982..b0975fbead 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -37,6 +37,7 @@
#include "scene/3d/skeleton_3d.h"
#include "scene/resources/animation.h"
#include "scene/resources/animation_library.h"
+#include "scene/resources/audio_stream_polyphonic.h"
#ifdef TOOLS_ENABLED
class AnimatedValuesBackup : public RefCounted {
@@ -147,6 +148,26 @@ private:
HashMap<StringName, BezierAnim> bezier_anim;
+ struct PlayingAudioStreamInfo {
+ AudioStreamPlaybackPolyphonic::ID index = -1;
+ double start = 0.0;
+ double len = 0.0;
+ };
+
+ struct AudioAnim {
+ Ref<AudioStreamPolyphonic> audio_stream;
+ Ref<AudioStreamPlaybackPolyphonic> audio_stream_playback;
+ HashMap<int, PlayingAudioStreamInfo> playing_streams;
+ Object *object = nullptr;
+ uint64_t accum_pass = 0;
+ double length = 0.0;
+ double time = 0.0;
+ bool loop = false;
+ bool backward = false;
+ };
+
+ HashMap<StringName, AudioAnim> audio_anim;
+
uint32_t last_setup_pass = 0;
TrackNodeCache() {}
};
@@ -187,7 +208,10 @@ private:
int cache_update_prop_size = 0;
TrackNodeCache::BezierAnim *cache_update_bezier[NODE_CACHE_UPDATE_MAX];
int cache_update_bezier_size = 0;
+ TrackNodeCache::AudioAnim *cache_update_audio[NODE_CACHE_UPDATE_MAX];
+ int cache_update_audio_size = 0;
HashSet<TrackNodeCache *> playing_caches;
+ Vector<Node *> playing_audio_stream_players;
uint64_t accum_pass = 1;
float speed_scale = 1.0;
@@ -263,6 +287,7 @@ private:
bool reset_on_save = true;
AnimationProcessCallback process_callback = ANIMATION_PROCESS_IDLE;
AnimationMethodCallMode method_call_mode = ANIMATION_METHOD_CALL_DEFERRED;
+ int audio_max_polyphony = 32;
bool movie_quit_on_finish = false;
bool processing = false;
bool active = true;
@@ -278,6 +303,7 @@ private:
void _animation_process(double p_delta);
void _node_removed(Node *p_node);
+ void _clear_audio_streams();
void _stop_playing_caches(bool p_reset);
// bind helpers
@@ -317,6 +343,8 @@ protected:
static void _bind_methods();
+ GDVIRTUAL5RC(Variant, _post_process_key_value, Ref<Animation>, int, Variant, Object *, int);
+ Variant post_process_key_value(const Ref<Animation> &p_anim, int p_track, Variant p_value, const Object *p_object, int p_object_idx = -1);
virtual Variant _post_process_key_value(const Ref<Animation> &p_anim, int p_track, Variant p_value, const Object *p_object, int p_object_idx = -1);
public:
@@ -375,6 +403,9 @@ public:
void set_method_call_mode(AnimationMethodCallMode p_mode);
AnimationMethodCallMode get_method_call_mode() const;
+ void set_audio_max_polyphony(int p_audio_max_polyphony);
+ int get_audio_max_polyphony() const;
+
void set_movie_quit_on_finish_enabled(bool p_enabled);
bool is_movie_quit_on_finish_enabled() const;
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index ab341797c7..fa72bbc593 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -54,13 +54,19 @@ Variant AnimationNode::get_parameter_default_value(const StringName &p_parameter
return ret;
}
+bool AnimationNode::is_parameter_read_only(const StringName &p_parameter) const {
+ bool ret = false;
+ GDVIRTUAL_CALL(_is_parameter_read_only, p_parameter, ret);
+ return ret;
+}
+
void AnimationNode::set_parameter(const StringName &p_name, const Variant &p_value) {
ERR_FAIL_COND(!state);
ERR_FAIL_COND(!state->tree->property_parent_map.has(base_path));
ERR_FAIL_COND(!state->tree->property_parent_map[base_path].has(p_name));
StringName path = state->tree->property_parent_map[base_path][p_name];
- state->tree->property_map[path] = p_value;
+ state->tree->property_map[path].first = p_value;
}
Variant AnimationNode::get_parameter(const StringName &p_name) const {
@@ -69,7 +75,7 @@ Variant AnimationNode::get_parameter(const StringName &p_name) const {
ERR_FAIL_COND_V(!state->tree->property_parent_map[base_path].has(p_name), Variant());
StringName path = state->tree->property_parent_map[base_path][p_name];
- return state->tree->property_map[path];
+ return state->tree->property_map[path].first;
}
void AnimationNode::get_child_nodes(List<ChildNode> *r_child_nodes) {
@@ -297,36 +303,21 @@ double AnimationNode::_blend_node(const StringName &p_subpath, const Vector<Stri
return p_node->_pre_process(new_path, new_parent, state, p_time, p_seek, p_is_external_seeking, p_connections);
}
-int AnimationNode::get_input_count() const {
- return inputs.size();
-}
-
-String AnimationNode::get_input_name(int p_input) {
- ERR_FAIL_INDEX_V(p_input, inputs.size(), String());
- return inputs[p_input].name;
-}
-
String AnimationNode::get_caption() const {
String ret = "Node";
GDVIRTUAL_CALL(_get_caption, ret);
return ret;
}
-void AnimationNode::add_input(const String &p_name) {
+bool AnimationNode::add_input(const String &p_name) {
//root nodes can't add inputs
- ERR_FAIL_COND(Object::cast_to<AnimationRootNode>(this) != nullptr);
+ ERR_FAIL_COND_V(Object::cast_to<AnimationRootNode>(this) != nullptr, false);
Input input;
- ERR_FAIL_COND(p_name.contains(".") || p_name.contains("/"));
+ ERR_FAIL_COND_V(p_name.contains(".") || p_name.contains("/"), false);
input.name = p_name;
inputs.push_back(input);
emit_changed();
-}
-
-void AnimationNode::set_input_name(int p_input, const String &p_name) {
- ERR_FAIL_INDEX(p_input, inputs.size());
- ERR_FAIL_COND(p_name.contains(".") || p_name.contains("/"));
- inputs.write[p_input].name = p_name;
- emit_changed();
+ return true;
}
void AnimationNode::remove_input(int p_index) {
@@ -335,6 +326,34 @@ void AnimationNode::remove_input(int p_index) {
emit_changed();
}
+bool AnimationNode::set_input_name(int p_input, const String &p_name) {
+ ERR_FAIL_INDEX_V(p_input, inputs.size(), false);
+ ERR_FAIL_COND_V(p_name.contains(".") || p_name.contains("/"), false);
+ inputs.write[p_input].name = p_name;
+ emit_changed();
+ return true;
+}
+
+String AnimationNode::get_input_name(int p_input) const {
+ ERR_FAIL_INDEX_V(p_input, inputs.size(), String());
+ return inputs[p_input].name;
+}
+
+int AnimationNode::get_input_count() const {
+ return inputs.size();
+}
+
+int AnimationNode::find_input(const String &p_name) const {
+ int idx = -1;
+ for (int i = 0; i < inputs.size(); i++) {
+ if (inputs[i].name == p_name) {
+ idx = i;
+ break;
+ }
+ }
+ return idx;
+}
+
double AnimationNode::process(double p_time, bool p_seek, bool p_is_external_seeking) {
double ret = 0;
GDVIRTUAL_CALL(_process, p_time, p_seek, p_is_external_seeking, ret);
@@ -398,11 +417,12 @@ Ref<AnimationNode> AnimationNode::get_child_by_name(const StringName &p_name) {
}
void AnimationNode::_bind_methods() {
- ClassDB::bind_method(D_METHOD("get_input_count"), &AnimationNode::get_input_count);
- ClassDB::bind_method(D_METHOD("get_input_name", "input"), &AnimationNode::get_input_name);
-
ClassDB::bind_method(D_METHOD("add_input", "name"), &AnimationNode::add_input);
ClassDB::bind_method(D_METHOD("remove_input", "index"), &AnimationNode::remove_input);
+ ClassDB::bind_method(D_METHOD("set_input_name", "input", "name"), &AnimationNode::set_input_name);
+ ClassDB::bind_method(D_METHOD("get_input_name", "input"), &AnimationNode::get_input_name);
+ ClassDB::bind_method(D_METHOD("get_input_count"), &AnimationNode::get_input_count);
+ ClassDB::bind_method(D_METHOD("find_input", "name"), &AnimationNode::find_input);
ClassDB::bind_method(D_METHOD("set_filter_path", "path", "enable"), &AnimationNode::set_filter_path);
ClassDB::bind_method(D_METHOD("is_path_filtered", "path"), &AnimationNode::is_path_filtered);
@@ -427,6 +447,7 @@ void AnimationNode::_bind_methods() {
GDVIRTUAL_BIND(_get_parameter_list);
GDVIRTUAL_BIND(_get_child_by_name, "name");
GDVIRTUAL_BIND(_get_parameter_default_value, "parameter");
+ GDVIRTUAL_BIND(_is_parameter_read_only, "parameter");
GDVIRTUAL_BIND(_process, "time", "seek", "is_external_seeking");
GDVIRTUAL_BIND(_get_caption);
GDVIRTUAL_BIND(_has_filter);
@@ -479,13 +500,7 @@ void AnimationTree::set_active(bool p_active) {
}
if (!active && is_inside_tree()) {
- for (const TrackCache *E : playing_caches) {
- if (ObjectDB::get_instance(E->object_id)) {
- E->object->call(SNAME("stop"));
- }
- }
-
- playing_caches.clear();
+ _clear_caches();
}
}
@@ -524,6 +539,7 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) {
if (!player->has_node(player->get_root())) {
ERR_PRINT("AnimationTree: AnimationPlayer root is invalid.");
set_active(false);
+ _clear_caches();
return false;
}
Node *parent = player->get_node(player->get_root());
@@ -747,7 +763,7 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) {
if (has_reset_anim) {
int rt = reset_anim->find_track(path, track_type);
if (rt >= 0 && reset_anim->track_get_key_count(rt) > 0) {
- track_bezier->init_value = reset_anim->track_get_key_value(rt, 0);
+ track_bezier->init_value = (reset_anim->track_get_key_value(rt, 0).operator Array())[0];
}
}
} break;
@@ -756,6 +772,8 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) {
track_audio->object = child;
track_audio->object_id = track_audio->object->get_instance_id();
+ track_audio->audio_stream.instantiate();
+ track_audio->audio_stream->set_polyphony(audio_max_polyphony);
track = track_audio;
@@ -853,14 +871,32 @@ void AnimationTree::_animation_player_changed() {
}
void AnimationTree::_clear_caches() {
+ _clear_audio_streams();
+ _clear_playing_caches();
for (KeyValue<NodePath, TrackCache *> &K : track_cache) {
memdelete(K.value);
}
- playing_caches.clear();
track_cache.clear();
cache_valid = false;
}
+void AnimationTree::_clear_audio_streams() {
+ for (int i = 0; i < playing_audio_stream_players.size(); i++) {
+ playing_audio_stream_players[i]->call(SNAME("stop"));
+ playing_audio_stream_players[i]->call(SNAME("set_stream"), Ref<AudioStream>());
+ }
+ playing_audio_stream_players.clear();
+}
+
+void AnimationTree::_clear_playing_caches() {
+ for (const TrackCache *E : playing_caches) {
+ if (ObjectDB::get_instance(E->object_id)) {
+ E->object->call(SNAME("stop"));
+ }
+ }
+ playing_caches.clear();
+}
+
static void _call_object(Object *p_object, const StringName &p_method, const Vector<Variant> &p_params, bool p_deferred) {
// Separate function to use alloca() more efficiently
const Variant **argptrs = (const Variant **)alloca(sizeof(const Variant **) * p_params.size());
@@ -1000,6 +1036,13 @@ void AnimationTree::_process_graph(double p_delta) {
TrackCacheBezier *t = static_cast<TrackCacheBezier *>(track);
t->value = t->init_value;
} break;
+ case Animation::TYPE_AUDIO: {
+ TrackCacheAudio *t = static_cast<TrackCacheAudio *>(track);
+ for (KeyValue<ObjectID, PlayingAudioTrackInfo> &L : t->playing_streams) {
+ PlayingAudioTrackInfo &track_info = L.value;
+ track_info.volume = 0.0;
+ }
+ } break;
default: {
} break;
}
@@ -1008,8 +1051,9 @@ void AnimationTree::_process_graph(double p_delta) {
// Apply value/transform/blend/bezier blends to track caches and execute method/audio/animation tracks.
{
+#ifdef TOOLS_ENABLED
bool can_call = is_inside_tree() && !Engine::get_singleton()->is_editor_hint();
-
+#endif // TOOLS_ENABLED
for (const AnimationNode::AnimationState &as : state.animation_states) {
Ref<Animation> a = as.animation;
double time = as.time;
@@ -1018,8 +1062,8 @@ void AnimationTree::_process_graph(double p_delta) {
bool seeked = as.seeked;
Animation::LoopedFlag looped_flag = as.looped_flag;
bool is_external_seeking = as.is_external_seeking;
+ bool backward = signbit(delta); // This flag is used by the root motion calculates or detecting the end of audio stream.
#ifndef _3D_DISABLED
- bool backward = signbit(delta); // This flag is required only for the root motion since it calculates the difference between the previous and current frames.
bool calc_root = !seeked || is_external_seeking;
#endif // _3D_DISABLED
@@ -1038,9 +1082,6 @@ void AnimationTree::_process_graph(double p_delta) {
int blend_idx = state.track_map[path];
ERR_CONTINUE(blend_idx < 0 || blend_idx >= state.track_count);
real_t blend = (*as.track_blends)[blend_idx] * weight;
- if (Math::is_zero_approx(blend)) {
- continue; // Nothing to blend.
- }
Animation::TrackType ttype = a->track_get_type(i);
if (ttype != Animation::TYPE_POSITION_3D && ttype != Animation::TYPE_ROTATION_3D && ttype != Animation::TYPE_SCALE_3D && track->type != ttype) {
@@ -1052,6 +1093,9 @@ void AnimationTree::_process_graph(double p_delta) {
switch (ttype) {
case Animation::TYPE_POSITION_3D: {
#ifndef _3D_DISABLED
+ if (Math::is_zero_approx(blend)) {
+ continue; // Nothing to blend.
+ }
TrackCacheTransform *t = static_cast<TrackCacheTransform *>(track);
if (track->root_motion && calc_root) {
double prev_time = time - delta;
@@ -1097,9 +1141,9 @@ void AnimationTree::_process_graph(double p_delta) {
if (err != OK) {
continue;
}
- loc[0] = _post_process_key_value(a, i, loc[0], t->object, t->bone_idx);
+ loc[0] = post_process_key_value(a, i, loc[0], t->object, t->bone_idx);
a->position_track_interpolate(i, (double)a->get_length(), &loc[1]);
- loc[1] = _post_process_key_value(a, i, loc[1], t->object, t->bone_idx);
+ loc[1] = post_process_key_value(a, i, loc[1], t->object, t->bone_idx);
t->loc += (loc[1] - loc[0]) * blend;
prev_time = 0;
}
@@ -1109,9 +1153,9 @@ void AnimationTree::_process_graph(double p_delta) {
if (err != OK) {
continue;
}
- loc[0] = _post_process_key_value(a, i, loc[0], t->object, t->bone_idx);
+ loc[0] = post_process_key_value(a, i, loc[0], t->object, t->bone_idx);
a->position_track_interpolate(i, 0, &loc[1]);
- loc[1] = _post_process_key_value(a, i, loc[1], t->object, t->bone_idx);
+ loc[1] = post_process_key_value(a, i, loc[1], t->object, t->bone_idx);
t->loc += (loc[1] - loc[0]) * blend;
prev_time = (double)a->get_length();
}
@@ -1121,10 +1165,10 @@ void AnimationTree::_process_graph(double p_delta) {
if (err != OK) {
continue;
}
- loc[0] = _post_process_key_value(a, i, loc[0], t->object, t->bone_idx);
+ loc[0] = post_process_key_value(a, i, loc[0], t->object, t->bone_idx);
a->position_track_interpolate(i, time, &loc[1]);
- loc[1] = _post_process_key_value(a, i, loc[1], t->object, t->bone_idx);
+ loc[1] = post_process_key_value(a, i, loc[1], t->object, t->bone_idx);
t->loc += (loc[1] - loc[0]) * blend;
prev_time = !backward ? 0 : (double)a->get_length();
@@ -1135,7 +1179,7 @@ void AnimationTree::_process_graph(double p_delta) {
if (err != OK) {
continue;
}
- loc = _post_process_key_value(a, i, loc, t->object, t->bone_idx);
+ loc = post_process_key_value(a, i, loc, t->object, t->bone_idx);
t->loc += (loc - t->init_loc) * blend;
}
@@ -1143,6 +1187,9 @@ void AnimationTree::_process_graph(double p_delta) {
} break;
case Animation::TYPE_ROTATION_3D: {
#ifndef _3D_DISABLED
+ if (Math::is_zero_approx(blend)) {
+ continue; // Nothing to blend.
+ }
TrackCacheTransform *t = static_cast<TrackCacheTransform *>(track);
if (track->root_motion && calc_root) {
double prev_time = time - delta;
@@ -1188,9 +1235,9 @@ void AnimationTree::_process_graph(double p_delta) {
if (err != OK) {
continue;
}
- rot[0] = _post_process_key_value(a, i, rot[0], t->object, t->bone_idx);
+ rot[0] = post_process_key_value(a, i, rot[0], t->object, t->bone_idx);
a->rotation_track_interpolate(i, (double)a->get_length(), &rot[1]);
- rot[1] = _post_process_key_value(a, i, rot[1], t->object, t->bone_idx);
+ rot[1] = post_process_key_value(a, i, rot[1], t->object, t->bone_idx);
t->rot = (t->rot * Quaternion().slerp(rot[0].inverse() * rot[1], blend)).normalized();
prev_time = 0;
}
@@ -1200,7 +1247,7 @@ void AnimationTree::_process_graph(double p_delta) {
if (err != OK) {
continue;
}
- rot[0] = _post_process_key_value(a, i, rot[0], t->object, t->bone_idx);
+ rot[0] = post_process_key_value(a, i, rot[0], t->object, t->bone_idx);
a->rotation_track_interpolate(i, 0, &rot[1]);
t->rot = (t->rot * Quaternion().slerp(rot[0].inverse() * rot[1], blend)).normalized();
prev_time = (double)a->get_length();
@@ -1211,10 +1258,10 @@ void AnimationTree::_process_graph(double p_delta) {
if (err != OK) {
continue;
}
- rot[0] = _post_process_key_value(a, i, rot[0], t->object, t->bone_idx);
+ rot[0] = post_process_key_value(a, i, rot[0], t->object, t->bone_idx);
a->rotation_track_interpolate(i, time, &rot[1]);
- rot[1] = _post_process_key_value(a, i, rot[1], t->object, t->bone_idx);
+ rot[1] = post_process_key_value(a, i, rot[1], t->object, t->bone_idx);
t->rot = (t->rot * Quaternion().slerp(rot[0].inverse() * rot[1], blend)).normalized();
prev_time = !backward ? 0 : (double)a->get_length();
@@ -1225,7 +1272,7 @@ void AnimationTree::_process_graph(double p_delta) {
if (err != OK) {
continue;
}
- rot = _post_process_key_value(a, i, rot, t->object, t->bone_idx);
+ rot = post_process_key_value(a, i, rot, t->object, t->bone_idx);
t->rot = (t->rot * Quaternion().slerp(t->init_rot.inverse() * rot, blend)).normalized();
}
@@ -1233,6 +1280,9 @@ void AnimationTree::_process_graph(double p_delta) {
} break;
case Animation::TYPE_SCALE_3D: {
#ifndef _3D_DISABLED
+ if (Math::is_zero_approx(blend)) {
+ continue; // Nothing to blend.
+ }
TrackCacheTransform *t = static_cast<TrackCacheTransform *>(track);
if (track->root_motion && calc_root) {
double prev_time = time - delta;
@@ -1278,10 +1328,10 @@ void AnimationTree::_process_graph(double p_delta) {
if (err != OK) {
continue;
}
- scale[0] = _post_process_key_value(a, i, scale[0], t->object, t->bone_idx);
+ scale[0] = post_process_key_value(a, i, scale[0], t->object, t->bone_idx);
a->scale_track_interpolate(i, (double)a->get_length(), &scale[1]);
t->scale += (scale[1] - scale[0]) * blend;
- scale[1] = _post_process_key_value(a, i, scale[1], t->object, t->bone_idx);
+ scale[1] = post_process_key_value(a, i, scale[1], t->object, t->bone_idx);
prev_time = 0;
}
} else {
@@ -1290,9 +1340,9 @@ void AnimationTree::_process_graph(double p_delta) {
if (err != OK) {
continue;
}
- scale[0] = _post_process_key_value(a, i, scale[0], t->object, t->bone_idx);
+ scale[0] = post_process_key_value(a, i, scale[0], t->object, t->bone_idx);
a->scale_track_interpolate(i, 0, &scale[1]);
- scale[1] = _post_process_key_value(a, i, scale[1], t->object, t->bone_idx);
+ scale[1] = post_process_key_value(a, i, scale[1], t->object, t->bone_idx);
t->scale += (scale[1] - scale[0]) * blend;
prev_time = (double)a->get_length();
}
@@ -1302,10 +1352,10 @@ void AnimationTree::_process_graph(double p_delta) {
if (err != OK) {
continue;
}
- scale[0] = _post_process_key_value(a, i, scale[0], t->object, t->bone_idx);
+ scale[0] = post_process_key_value(a, i, scale[0], t->object, t->bone_idx);
a->scale_track_interpolate(i, time, &scale[1]);
- scale[1] = _post_process_key_value(a, i, scale[1], t->object, t->bone_idx);
+ scale[1] = post_process_key_value(a, i, scale[1], t->object, t->bone_idx);
t->scale += (scale[1] - scale[0]) * blend;
prev_time = !backward ? 0 : (double)a->get_length();
@@ -1316,7 +1366,7 @@ void AnimationTree::_process_graph(double p_delta) {
if (err != OK) {
continue;
}
- scale = _post_process_key_value(a, i, scale, t->object, t->bone_idx);
+ scale = post_process_key_value(a, i, scale, t->object, t->bone_idx);
t->scale += (scale - t->init_scale) * blend;
}
@@ -1324,6 +1374,9 @@ void AnimationTree::_process_graph(double p_delta) {
} break;
case Animation::TYPE_BLEND_SHAPE: {
#ifndef _3D_DISABLED
+ if (Math::is_zero_approx(blend)) {
+ continue; // Nothing to blend.
+ }
TrackCacheBlendShape *t = static_cast<TrackCacheBlendShape *>(track);
float value;
@@ -1334,19 +1387,22 @@ void AnimationTree::_process_graph(double p_delta) {
if (err != OK) {
continue;
}
- value = _post_process_key_value(a, i, value, t->object, t->shape_index);
+ value = post_process_key_value(a, i, value, t->object, t->shape_index);
t->value += (value - t->init_value) * blend;
#endif // _3D_DISABLED
} break;
case Animation::TYPE_VALUE: {
+ if (Math::is_zero_approx(blend)) {
+ continue; // Nothing to blend.
+ }
TrackCacheValue *t = static_cast<TrackCacheValue *>(track);
Animation::UpdateMode update_mode = a->value_track_get_update_mode(i);
if (update_mode == Animation::UPDATE_CONTINUOUS || update_mode == Animation::UPDATE_CAPTURE) {
Variant value = a->value_track_interpolate(i, time);
- value = _post_process_key_value(a, i, value, t->object);
+ value = post_process_key_value(a, i, value, t->object);
if (value == Variant()) {
continue;
@@ -1386,14 +1442,14 @@ void AnimationTree::_process_graph(double p_delta) {
continue;
}
Variant value = a->track_get_key_value(i, idx);
- value = _post_process_key_value(a, i, value, t->object);
+ value = post_process_key_value(a, i, value, t->object);
t->object->set_indexed(t->subpath, value);
} else {
List<int> indices;
a->track_get_key_indices_in_range(i, time, delta, &indices, looped_flag);
for (int &F : indices) {
Variant value = a->track_get_key_value(i, F);
- value = _post_process_key_value(a, i, value, t->object);
+ value = post_process_key_value(a, i, value, t->object);
t->object->set_indexed(t->subpath, value);
}
}
@@ -1401,6 +1457,14 @@ void AnimationTree::_process_graph(double p_delta) {
} break;
case Animation::TYPE_METHOD: {
+#ifdef TOOLS_ENABLED
+ if (!can_call) {
+ continue;
+ }
+#endif // TOOLS_ENABLED
+ if (Math::is_zero_approx(blend)) {
+ continue; // Nothing to blend.
+ }
TrackCacheMethod *t = static_cast<TrackCacheMethod *>(track);
if (seeked) {
@@ -1410,137 +1474,112 @@ void AnimationTree::_process_graph(double p_delta) {
}
StringName method = a->method_track_get_name(i, idx);
Vector<Variant> params = a->method_track_get_params(i, idx);
- if (can_call) {
- _call_object(t->object, method, params, false);
- }
+ _call_object(t->object, method, params, false);
} else {
List<int> indices;
a->track_get_key_indices_in_range(i, time, delta, &indices, looped_flag);
for (int &F : indices) {
StringName method = a->method_track_get_name(i, F);
Vector<Variant> params = a->method_track_get_params(i, F);
- if (can_call) {
- _call_object(t->object, method, params, true);
- }
+ _call_object(t->object, method, params, true);
}
}
} break;
case Animation::TYPE_BEZIER: {
+ if (Math::is_zero_approx(blend)) {
+ continue; // Nothing to blend.
+ }
TrackCacheBezier *t = static_cast<TrackCacheBezier *>(track);
real_t bezier = a->bezier_track_interpolate(i, time);
- bezier = _post_process_key_value(a, i, bezier, t->object);
+ bezier = post_process_key_value(a, i, bezier, t->object);
t->value += (bezier - t->init_value) * blend;
} break;
case Animation::TYPE_AUDIO: {
TrackCacheAudio *t = static_cast<TrackCacheAudio *>(track);
- if (seeked) {
- //find whatever should be playing
- int idx = a->track_find_key(i, time, is_external_seeking ? Animation::FIND_MODE_NEAREST : Animation::FIND_MODE_EXACT);
- if (idx < 0) {
- continue;
- }
-
- Ref<AudioStream> stream = a->audio_track_get_key_stream(i, idx);
- if (!stream.is_valid()) {
- t->object->call(SNAME("stop"));
- t->playing = false;
- playing_caches.erase(t);
- } else {
- double start_ofs = a->audio_track_get_key_start_offset(i, idx);
- start_ofs += time - a->track_get_key_time(i, idx);
- double end_ofs = a->audio_track_get_key_end_offset(i, idx);
- double len = stream->get_length();
-
- if (start_ofs > len - end_ofs) {
- t->object->call(SNAME("stop"));
- t->playing = false;
- playing_caches.erase(t);
- continue;
- }
-
- t->object->call(SNAME("set_stream"), stream);
- t->object->call(SNAME("play"), start_ofs);
-
- t->playing = true;
- playing_caches.insert(t);
- if (len && end_ofs > 0) { //force an end at a time
- t->len = len - start_ofs - end_ofs;
- } else {
- t->len = 0;
- }
+ Node *asp = Object::cast_to<Node>(t->object);
+ if (!asp) {
+ t->playing_streams.clear();
+ continue;
+ }
- t->start = time;
+ ObjectID oid = a->get_instance_id();
+ if (!t->playing_streams.has(oid)) {
+ t->playing_streams[oid] = PlayingAudioTrackInfo();
+ }
+ // The end of audio should be observed even if the blend value is 0, build up the information and store to the cache for that.
+ PlayingAudioTrackInfo &track_info = t->playing_streams[oid];
+ track_info.length = a->get_length();
+ track_info.time = time;
+ track_info.volume += blend;
+ track_info.loop = a->get_loop_mode() != Animation::LOOP_NONE;
+ track_info.backward = backward;
+ track_info.use_blend = a->audio_track_is_use_blend(i);
+
+ HashMap<int, PlayingAudioStreamInfo> &map = track_info.stream_info;
+ // Find stream.
+ int idx = -1;
+ if (seeked) {
+ idx = a->track_find_key(i, time, is_external_seeking ? Animation::FIND_MODE_NEAREST : Animation::FIND_MODE_EXACT);
+ // Discard previous stream when seeking.
+ if (map.has(idx)) {
+ t->audio_stream_playback->stop_stream(map[idx].index);
+ map.erase(idx);
}
-
} else {
- //find stuff to play
List<int> to_play;
a->track_get_key_indices_in_range(i, time, delta, &to_play, looped_flag);
if (to_play.size()) {
- int idx = to_play.back()->get();
-
- Ref<AudioStream> stream = a->audio_track_get_key_stream(i, idx);
- if (!stream.is_valid()) {
- t->object->call(SNAME("stop"));
- t->playing = false;
- playing_caches.erase(t);
- } else {
- double start_ofs = a->audio_track_get_key_start_offset(i, idx);
- double end_ofs = a->audio_track_get_key_end_offset(i, idx);
- double len = stream->get_length();
-
- t->object->call(SNAME("set_stream"), stream);
- t->object->call(SNAME("play"), start_ofs);
-
- t->playing = true;
- playing_caches.insert(t);
- if (len && end_ofs > 0) { //force an end at a time
- t->len = len - start_ofs - end_ofs;
- } else {
- t->len = 0;
- }
-
- t->start = time;
- }
- } else if (t->playing) {
- bool loop = a->get_loop_mode() != Animation::LOOP_NONE;
-
- bool stop = false;
-
- if (!loop) {
- if (delta > 0) {
- if (time < t->start) {
- stop = true;
- }
- } else if (delta < 0) {
- if (time > t->start) {
- stop = true;
- }
- }
- } else if (t->len > 0) {
- double len = t->start > time ? (a->get_length() - t->start) + time : time - t->start;
+ idx = to_play.back()->get();
+ }
+ }
+ if (idx < 0) {
+ continue;
+ }
- if (len > t->len) {
- stop = true;
- }
+ // Play stream.
+ Ref<AudioStream> stream = a->audio_track_get_key_stream(i, idx);
+ if (stream.is_valid()) {
+ double start_ofs = a->audio_track_get_key_start_offset(i, idx);
+ double end_ofs = a->audio_track_get_key_end_offset(i, idx);
+ double len = stream->get_length();
+
+ if (t->object->call(SNAME("get_stream")) != t->audio_stream) {
+ t->object->call(SNAME("set_stream"), t->audio_stream);
+ t->audio_stream_playback.unref();
+ if (!playing_audio_stream_players.has(asp)) {
+ playing_audio_stream_players.push_back(asp);
}
+ }
+ if (!t->object->call(SNAME("is_playing"))) {
+ t->object->call(SNAME("play"));
+ }
+ if (!t->object->call(SNAME("has_stream_playback"))) {
+ t->audio_stream_playback.unref();
+ continue;
+ }
+ if (t->audio_stream_playback.is_null()) {
+ t->audio_stream_playback = t->object->call(SNAME("get_stream_playback"));
+ }
- if (stop) {
- //time to stop
- t->object->call(SNAME("stop"));
- t->playing = false;
- playing_caches.erase(t);
- }
+ PlayingAudioStreamInfo pasi;
+ pasi.index = t->audio_stream_playback->play_stream(stream, start_ofs);
+ pasi.start = time;
+ if (len && end_ofs > 0) { // Force an end at a time.
+ pasi.len = len - start_ofs - end_ofs;
+ } else {
+ pasi.len = 0;
}
+ map[idx] = pasi;
}
- real_t db = Math::linear_to_db(MAX(blend, 0.00001));
- t->object->call(SNAME("set_volume_db"), db);
} break;
case Animation::TYPE_ANIMATION: {
+ if (Math::is_zero_approx(blend)) {
+ continue; // Nothing to blend.
+ }
TrackCacheAnimation *t = static_cast<TrackCacheAnimation *>(track);
AnimationPlayer *player2 = Object::cast_to<AnimationPlayer>(t->object);
@@ -1686,6 +1725,64 @@ void AnimationTree::_process_graph(double p_delta) {
t->object->set_indexed(t->subpath, t->value);
} break;
+ case Animation::TYPE_AUDIO: {
+ TrackCacheAudio *t = static_cast<TrackCacheAudio *>(track);
+
+ // Audio ending process.
+ LocalVector<ObjectID> erase_maps;
+ for (KeyValue<ObjectID, PlayingAudioTrackInfo> &L : t->playing_streams) {
+ PlayingAudioTrackInfo &track_info = L.value;
+ float db = Math::linear_to_db(track_info.use_blend ? track_info.volume : 1.0);
+ LocalVector<int> erase_streams;
+ HashMap<int, PlayingAudioStreamInfo> &map = track_info.stream_info;
+ for (const KeyValue<int, PlayingAudioStreamInfo> &M : map) {
+ PlayingAudioStreamInfo pasi = M.value;
+
+ bool stop = false;
+ if (!t->audio_stream_playback->is_stream_playing(pasi.index)) {
+ stop = true;
+ }
+ if (!track_info.loop) {
+ if (!track_info.backward) {
+ if (track_info.time < pasi.start) {
+ stop = true;
+ }
+ } else if (track_info.backward) {
+ if (track_info.time > pasi.start) {
+ stop = true;
+ }
+ }
+ }
+ if (pasi.len > 0) {
+ double len = 0.0;
+ if (!track_info.backward) {
+ len = pasi.start > track_info.time ? (track_info.length - pasi.start) + track_info.time : track_info.time - pasi.start;
+ } else {
+ len = pasi.start < track_info.time ? (track_info.length - track_info.time) + pasi.start : pasi.start - track_info.time;
+ }
+ if (len > pasi.len) {
+ stop = true;
+ }
+ }
+ if (stop) {
+ // Time to stop.
+ t->audio_stream_playback->stop_stream(pasi.index);
+ erase_streams.push_back(M.key);
+ } else {
+ t->audio_stream_playback->set_stream_volume(pasi.index, db);
+ }
+ }
+ for (uint32_t erase_idx = 0; erase_idx < erase_streams.size(); erase_idx++) {
+ map.erase(erase_streams[erase_idx]);
+ }
+ if (map.size() == 0) {
+ erase_maps.push_back(L.key);
+ }
+ }
+ for (uint32_t erase_idx = 0; erase_idx < erase_maps.size(); erase_idx++) {
+ t->playing_streams.erase(erase_maps[erase_idx]);
+ }
+ } break;
default: {
} //the rest don't matter
}
@@ -1693,6 +1790,15 @@ void AnimationTree::_process_graph(double p_delta) {
}
}
+Variant AnimationTree::post_process_key_value(const Ref<Animation> &p_anim, int p_track, Variant p_value, const Object *p_object, int p_object_idx) {
+ Variant res;
+ if (GDVIRTUAL_CALL(_post_process_key_value, p_anim, p_track, p_value, const_cast<Object *>(p_object), p_object_idx, res)) {
+ return res;
+ }
+
+ return _post_process_key_value(p_anim, p_track, p_value, p_object, p_object_idx);
+}
+
Variant AnimationTree::_post_process_key_value(const Ref<Animation> &p_anim, int p_track, Variant p_value, const Object *p_object, int p_object_idx) {
switch (p_anim->track_get_type(p_track)) {
#ifndef _3D_DISABLED
@@ -1755,6 +1861,8 @@ void AnimationTree::_setup_animation_player() {
return;
}
+ cache_valid = false;
+
AnimationPlayer *new_player = nullptr;
if (!animation_player.is_empty()) {
new_player = Object::cast_to<AnimationPlayer>(get_node_or_null(animation_player));
@@ -1802,6 +1910,15 @@ NodePath AnimationTree::get_advance_expression_base_node() const {
return advance_expression_base_node;
}
+void AnimationTree::set_audio_max_polyphony(int p_audio_max_polyphony) {
+ ERR_FAIL_COND(p_audio_max_polyphony < 0 || p_audio_max_polyphony > 128);
+ audio_max_polyphony = p_audio_max_polyphony;
+}
+
+int AnimationTree::get_audio_max_polyphony() const {
+ return audio_max_polyphony;
+}
+
bool AnimationTree::is_state_invalid() const {
return !state.valid;
}
@@ -1889,7 +2006,10 @@ void AnimationTree::_update_properties_for_node(const String &p_base_path, Ref<A
StringName key = pinfo.name;
if (!property_map.has(p_base_path + key)) {
- property_map[p_base_path + key] = node->get_parameter_default_value(key);
+ Pair<Variant, bool> param;
+ param.first = node->get_parameter_default_value(key);
+ param.second = node->is_parameter_read_only(key);
+ property_map[p_base_path + key] = param;
}
property_parent_map[p_base_path][key] = p_base_path + key;
@@ -1931,7 +2051,10 @@ bool AnimationTree::_set(const StringName &p_name, const Variant &p_value) {
}
if (property_map.has(p_name)) {
- property_map[p_name] = p_value;
+ if (is_inside_tree() && property_map[p_name].second) {
+ return false; // Prevent to set property by user.
+ }
+ property_map[p_name].first = p_value;
return true;
}
@@ -1944,7 +2067,7 @@ bool AnimationTree::_get(const StringName &p_name, Variant &r_ret) const {
}
if (property_map.has(p_name)) {
- r_ret = property_map[p_name];
+ r_ret = property_map[p_name].first;
return true;
}
@@ -2011,6 +2134,9 @@ void AnimationTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_root_motion_track", "path"), &AnimationTree::set_root_motion_track);
ClassDB::bind_method(D_METHOD("get_root_motion_track"), &AnimationTree::get_root_motion_track);
+ ClassDB::bind_method(D_METHOD("set_audio_max_polyphony", "max_polyphony"), &AnimationTree::set_audio_max_polyphony);
+ ClassDB::bind_method(D_METHOD("get_audio_max_polyphony"), &AnimationTree::get_audio_max_polyphony);
+
ClassDB::bind_method(D_METHOD("get_root_motion_position"), &AnimationTree::get_root_motion_position);
ClassDB::bind_method(D_METHOD("get_root_motion_rotation"), &AnimationTree::get_root_motion_rotation);
ClassDB::bind_method(D_METHOD("get_root_motion_scale"), &AnimationTree::get_root_motion_scale);
@@ -2021,12 +2147,16 @@ void AnimationTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("advance", "delta"), &AnimationTree::advance);
+ GDVIRTUAL_BIND(_post_process_key_value, "animation", "track", "value", "object", "object_idx");
+
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "tree_root", PROPERTY_HINT_RESOURCE_TYPE, "AnimationRootNode"), "set_tree_root", "get_tree_root");
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "anim_player", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "AnimationPlayer"), "set_animation_player", "get_animation_player");
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "advance_expression_base_node", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Node"), "set_advance_expression_base_node", "get_advance_expression_base_node");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "active"), "set_active", "is_active");
ADD_PROPERTY(PropertyInfo(Variant::INT, "process_callback", PROPERTY_HINT_ENUM, "Physics,Idle,Manual"), "set_process_callback", "get_process_callback");
+ ADD_GROUP("Audio", "audio_");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "audio_max_polyphony", PROPERTY_HINT_RANGE, "1,127,1"), "set_audio_max_polyphony", "get_audio_max_polyphony");
ADD_GROUP("Root Motion", "root_motion_");
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "root_motion_track"), "set_root_motion_track", "get_root_motion_track");
diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h
index 2c1be6199c..a6fb4a8430 100644
--- a/scene/animation/animation_tree.h
+++ b/scene/animation/animation_tree.h
@@ -35,6 +35,7 @@
#include "scene/3d/node_3d.h"
#include "scene/3d/skeleton_3d.h"
#include "scene/resources/animation.h"
+#include "scene/resources/audio_stream_polyphonic.h"
class AnimationNodeBlendTree;
class AnimationNodeStartState;
@@ -117,6 +118,7 @@ protected:
GDVIRTUAL0RC(Array, _get_parameter_list)
GDVIRTUAL1RC(Ref<AnimationNode>, _get_child_by_name, StringName)
GDVIRTUAL1RC(Variant, _get_parameter_default_value, StringName)
+ GDVIRTUAL1RC(bool, _is_parameter_read_only, StringName)
GDVIRTUAL3RC(double, _process, double, bool, bool)
GDVIRTUAL0RC(String, _get_caption)
GDVIRTUAL0RC(bool, _has_filter)
@@ -124,6 +126,7 @@ protected:
public:
virtual void get_parameter_list(List<PropertyInfo> *r_list) const;
virtual Variant get_parameter_default_value(const StringName &p_parameter) const;
+ virtual bool is_parameter_read_only(const StringName &p_parameter) const;
void set_parameter(const StringName &p_name, const Variant &p_value);
Variant get_parameter(const StringName &p_name) const;
@@ -138,12 +141,12 @@ public:
virtual double process(double p_time, bool p_seek, bool p_is_external_seeking);
virtual String get_caption() const;
+ virtual bool add_input(const String &p_name);
+ virtual void remove_input(int p_index);
+ virtual bool set_input_name(int p_input, const String &p_name);
+ virtual String get_input_name(int p_input) const;
int get_input_count() const;
- String get_input_name(int p_input);
-
- void add_input(const String &p_name);
- void set_input_name(int p_input, const String &p_name);
- void remove_input(int p_index);
+ int find_input(const String &p_name) const;
void set_filter_path(const NodePath &p_path, bool p_enable);
bool is_path_filtered(const NodePath &p_path) const;
@@ -250,10 +253,28 @@ private:
}
};
- struct TrackCacheAudio : public TrackCache {
- bool playing = false;
+ // Audio stream information for each audio stream placed on the track.
+ struct PlayingAudioStreamInfo {
+ AudioStreamPlaybackPolyphonic::ID index = -1; // ID retrieved from AudioStreamPlaybackPolyphonic.
double start = 0.0;
double len = 0.0;
+ };
+
+ // Audio track information for mixng and ending.
+ struct PlayingAudioTrackInfo {
+ HashMap<int, PlayingAudioStreamInfo> stream_info;
+ double length = 0.0;
+ double time = 0.0;
+ real_t volume = 0.0;
+ bool loop = false;
+ bool backward = false;
+ bool use_blend = false;
+ };
+
+ struct TrackCacheAudio : public TrackCache {
+ Ref<AudioStreamPolyphonic> audio_stream;
+ Ref<AudioStreamPlaybackPolyphonic> audio_stream_playback;
+ HashMap<ObjectID, PlayingAudioTrackInfo> playing_streams; // Key is Animation resource ObjectID.
TrackCacheAudio() {
type = Animation::TYPE_AUDIO;
@@ -270,6 +291,7 @@ private:
HashMap<NodePath, TrackCache *> track_cache;
HashSet<TrackCache *> playing_caches;
+ Vector<Node *> playing_audio_stream_players;
Ref<AnimationNode> root;
NodePath advance_expression_base_node = NodePath(String("."));
@@ -277,6 +299,7 @@ private:
AnimationProcessCallback process_callback = ANIMATION_PROCESS_IDLE;
bool active = false;
NodePath animation_player;
+ int audio_max_polyphony = 32;
AnimationNode::State state;
bool cache_valid = false;
@@ -285,6 +308,8 @@ private:
void _setup_animation_player();
void _animation_player_changed();
void _clear_caches();
+ void _clear_playing_caches();
+ void _clear_audio_streams();
bool _update_caches(AnimationPlayer *player);
void _process_graph(double p_delta);
@@ -304,7 +329,7 @@ private:
void _update_properties();
List<PropertyInfo> properties;
HashMap<StringName, HashMap<StringName, StringName>> property_parent_map;
- HashMap<StringName, Variant> property_map;
+ HashMap<StringName, Pair<Variant, bool>> property_map; // Property value and read-only flag.
struct Activity {
uint64_t last_pass = 0;
@@ -326,6 +351,8 @@ protected:
void _notification(int p_what);
static void _bind_methods();
+ GDVIRTUAL5RC(Variant, _post_process_key_value, Ref<Animation>, int, Variant, Object *, int);
+ Variant post_process_key_value(const Ref<Animation> &p_anim, int p_track, Variant p_value, const Object *p_object, int p_object_idx = -1);
virtual Variant _post_process_key_value(const Ref<Animation> &p_anim, int p_track, Variant p_value, const Object *p_object, int p_object_idx = -1);
public:
@@ -344,6 +371,9 @@ public:
void set_advance_expression_base_node(const NodePath &p_advance_expression_base_node);
NodePath get_advance_expression_base_node() const;
+ void set_audio_max_polyphony(int p_audio_max_polyphony);
+ int get_audio_max_polyphony() const;
+
PackedStringArray get_configuration_warnings() const override;
bool is_state_invalid() const;
diff --git a/scene/animation/root_motion_view.cpp b/scene/animation/root_motion_view.cpp
index e6b258df3e..3d8d451c70 100644
--- a/scene/animation/root_motion_view.cpp
+++ b/scene/animation/root_motion_view.cpp
@@ -80,7 +80,8 @@ bool RootMotionView::get_zero_y() const {
void RootMotionView::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
- immediate_material = StandardMaterial3D::get_material_for_2d(false, true, false, false, false);
+ immediate_material = StandardMaterial3D::get_material_for_2d(false, BaseMaterial3D::TRANSPARENCY_ALPHA, false);
+
first = true;
} break;
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index 39d1793368..abc7814877 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -594,7 +594,7 @@ PropertyTweener::PropertyTweener(Object *p_target, NodePath p_property, Variant
}
PropertyTweener::PropertyTweener() {
- ERR_FAIL_MSG("Can't create empty PropertyTweener. Use get_tree().tween_property() or tween_property() instead.");
+ ERR_FAIL_MSG("PropertyTweener can't be created directly. Use the tween_property() method in Tween.");
}
void IntervalTweener::start() {
@@ -625,7 +625,7 @@ IntervalTweener::IntervalTweener(double p_time) {
}
IntervalTweener::IntervalTweener() {
- ERR_FAIL_MSG("Can't create empty IntervalTweener. Use get_tree().tween_interval() instead.");
+ ERR_FAIL_MSG("IntervalTweener can't be created directly. Use the tween_interval() method in Tween.");
}
Ref<CallbackTweener> CallbackTweener::set_delay(double p_delay) {
@@ -676,7 +676,7 @@ CallbackTweener::CallbackTweener(Callable p_callback) {
}
CallbackTweener::CallbackTweener() {
- ERR_FAIL_MSG("Can't create empty CallbackTweener. Use get_tree().tween_callback() instead.");
+ ERR_FAIL_MSG("CallbackTweener can't be created directly. Use the tween_callback() method in Tween.");
}
Ref<MethodTweener> MethodTweener::set_delay(double p_delay) {
@@ -769,5 +769,5 @@ MethodTweener::MethodTweener(Callable p_callback, Variant p_from, Variant p_to,
}
MethodTweener::MethodTweener() {
- ERR_FAIL_MSG("Can't create empty MethodTweener. Use get_tree().tween_method() instead.");
+ ERR_FAIL_MSG("MethodTweener can't be created directly. Use the tween_method() method in Tween.");
}
diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp
index 42f76068e7..7533a56b59 100644
--- a/scene/audio/audio_stream_player.cpp
+++ b/scene/audio/audio_stream_player.cpp
@@ -307,11 +307,13 @@ void AudioStreamPlayer::_bus_layout_changed() {
notify_property_list_changed();
}
+bool AudioStreamPlayer::has_stream_playback() {
+ return !stream_playbacks.is_empty();
+}
+
Ref<AudioStreamPlayback> AudioStreamPlayer::get_stream_playback() {
- if (!stream_playbacks.is_empty()) {
- return stream_playbacks[stream_playbacks.size() - 1];
- }
- return nullptr;
+ ERR_FAIL_COND_V_MSG(stream_playbacks.is_empty(), Ref<AudioStreamPlayback>(), "Player is inactive. Call play() before requesting get_stream_playback().");
+ return stream_playbacks[stream_playbacks.size() - 1];
}
void AudioStreamPlayer::_bind_methods() {
@@ -349,6 +351,7 @@ void AudioStreamPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_max_polyphony", "max_polyphony"), &AudioStreamPlayer::set_max_polyphony);
ClassDB::bind_method(D_METHOD("get_max_polyphony"), &AudioStreamPlayer::get_max_polyphony);
+ ClassDB::bind_method(D_METHOD("has_stream_playback"), &AudioStreamPlayer::has_stream_playback);
ClassDB::bind_method(D_METHOD("get_stream_playback"), &AudioStreamPlayer::get_stream_playback);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"), "set_stream", "get_stream");
diff --git a/scene/audio/audio_stream_player.h b/scene/audio/audio_stream_player.h
index 5368391073..d1f6fca2ee 100644
--- a/scene/audio/audio_stream_player.h
+++ b/scene/audio/audio_stream_player.h
@@ -107,6 +107,7 @@ public:
void set_stream_paused(bool p_pause);
bool get_stream_paused() const;
+ bool has_stream_playback();
Ref<AudioStreamPlayback> get_stream_playback();
AudioStreamPlayer();
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index d0326290ac..c26a00221a 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -385,6 +385,7 @@ void BaseButton::shortcut_input(const Ref<InputEvent> &p_event) {
if (shortcut_feedback) {
if (shortcut_feedback_timer == nullptr) {
shortcut_feedback_timer = memnew(Timer);
+ shortcut_feedback_timer->set_one_shot(true);
add_child(shortcut_feedback_timer);
shortcut_feedback_timer->set_wait_time(GLOBAL_GET("gui/timers/button_shortcut_feedback_highlight_time"));
shortcut_feedback_timer->connect("timeout", callable_mp(this, &BaseButton::_shortcut_feedback_timeout));
@@ -478,14 +479,16 @@ void BaseButton::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disabled"), "set_disabled", "is_disabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "toggle_mode"), "set_toggle_mode", "is_toggle_mode");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shortcut_in_tooltip"), "set_shortcut_in_tooltip", "is_shortcut_in_tooltip_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "button_pressed"), "set_pressed", "is_pressed");
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::BOOL, "keep_pressed_outside"), "set_keep_pressed_outside", "is_keep_pressed_outside");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "button_group", PROPERTY_HINT_RESOURCE_TYPE, "ButtonGroup"), "set_button_group", "get_button_group");
+
+ ADD_GROUP("Shortcut", "");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "Shortcut"), "set_shortcut", "get_shortcut");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shortcut_feedback"), "set_shortcut_feedback", "is_shortcut_feedback");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "button_group", PROPERTY_HINT_RESOURCE_TYPE, "ButtonGroup"), "set_button_group", "get_button_group");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shortcut_in_tooltip"), "set_shortcut_in_tooltip", "is_shortcut_in_tooltip_enabled");
BIND_ENUM_CONSTANT(DRAW_NORMAL);
BIND_ENUM_CONSTANT(DRAW_PRESSED);
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index 1e07a53642..2a8b1cd8c4 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -575,9 +575,13 @@ void Button::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text", PROPERTY_HINT_MULTILINE_TEXT), "set_text", "get_text");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_button_icon", "get_button_icon");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flat"), "set_flat", "is_flat");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "clip_text"), "set_clip_text", "get_clip_text");
+
+ ADD_GROUP("Text Behavior", "");
ADD_PROPERTY(PropertyInfo(Variant::INT, "alignment", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_text_alignment", "get_text_alignment");
ADD_PROPERTY(PropertyInfo(Variant::INT, "text_overrun_behavior", PROPERTY_HINT_ENUM, "Trim Nothing,Trim Characters,Trim Words,Ellipsis,Word Ellipsis"), "set_text_overrun_behavior", "get_text_overrun_behavior");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "clip_text"), "set_clip_text", "get_clip_text");
+
+ ADD_GROUP("Icon Behavior", "");
ADD_PROPERTY(PropertyInfo(Variant::INT, "icon_alignment", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_icon_alignment", "get_icon_alignment");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "expand_icon"), "set_expand_icon", "is_expand_icon");
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index c977d9d2fb..b084cb5bea 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -3088,6 +3088,8 @@ void CodeEdit::_filter_code_completion_candidates_impl() {
}
code_completion_options.append_array(completion_options_casei);
+ code_completion_options.append_array(completion_options_substr);
+ code_completion_options.append_array(completion_options_substr_casei);
code_completion_options.append_array(completion_options_subseq);
code_completion_options.append_array(completion_options_subseq_casei);
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index b0261dcf23..da29bc823f 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -35,11 +35,6 @@
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "scene/gui/color_mode.h"
-
-#ifdef TOOLS_ENABLED
-#include "editor/editor_settings.h"
-#endif
-
#include "thirdparty/misc/ok_color.h"
#include "thirdparty/misc/ok_color_shader.h"
@@ -50,31 +45,6 @@ void ColorPicker::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
_update_color();
-#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
- if (preset_cache.is_empty()) {
- PackedColorArray saved_presets = EditorSettings::get_singleton()->get_project_metadata("color_picker", "presets", PackedColorArray());
- for (int i = 0; i < saved_presets.size(); i++) {
- preset_cache.push_back(saved_presets[i]);
- }
- }
-
- for (int i = 0; i < preset_cache.size(); i++) {
- presets.push_back(preset_cache[i]);
- }
-
- if (recent_preset_cache.is_empty()) {
- PackedColorArray saved_recent_presets = EditorSettings::get_singleton()->get_project_metadata("color_picker", "recent_presets", PackedColorArray());
- for (int i = 0; i < saved_recent_presets.size(); i++) {
- recent_preset_cache.push_back(saved_recent_presets[i]);
- }
- }
-
- for (int i = 0; i < recent_preset_cache.size(); i++) {
- recent_presets.push_back(recent_preset_cache[i]);
- }
- }
-#endif
[[fallthrough]];
}
case NOTIFICATION_THEME_CHANGED: {
@@ -404,6 +374,40 @@ void ColorPicker::create_slider(GridContainer *gc, int idx) {
}
}
+#ifdef TOOLS_ENABLED
+void ColorPicker::set_editor_settings(Object *p_editor_settings) {
+ if (editor_settings) {
+ return;
+ }
+ editor_settings = p_editor_settings;
+
+ if (preset_cache.is_empty()) {
+ PackedColorArray saved_presets = editor_settings->call(SNAME("get_project_metadata"), "color_picker", "presets", PackedColorArray());
+ for (int i = 0; i < saved_presets.size(); i++) {
+ preset_cache.push_back(saved_presets[i]);
+ }
+ }
+
+ for (int i = 0; i < preset_cache.size(); i++) {
+ presets.push_back(preset_cache[i]);
+ }
+
+ if (recent_preset_cache.is_empty()) {
+ PackedColorArray saved_recent_presets = editor_settings->call(SNAME("get_project_metadata"), "color_picker", "recent_presets", PackedColorArray());
+ for (int i = 0; i < saved_recent_presets.size(); i++) {
+ recent_preset_cache.push_back(saved_recent_presets[i]);
+ }
+ }
+
+ for (int i = 0; i < recent_preset_cache.size(); i++) {
+ recent_presets.push_back(recent_preset_cache[i]);
+ }
+
+ _update_presets();
+ _update_recent_presets();
+}
+#endif
+
HSlider *ColorPicker::get_slider(int p_idx) {
if (p_idx < SLIDER_COUNT) {
return sliders[p_idx];
@@ -471,7 +475,7 @@ ColorPicker::PickerShapeType ColorPicker::_get_actual_shape() const {
void ColorPicker::_reset_theme() {
Ref<StyleBoxFlat> style_box_flat(memnew(StyleBoxFlat));
- style_box_flat->set_default_margin(SIDE_TOP, 16 * get_theme_default_base_scale());
+ style_box_flat->set_content_margin(SIDE_TOP, 16 * get_theme_default_base_scale());
style_box_flat->set_bg_color(Color(0.2, 0.23, 0.31).lerp(Color(0, 0, 0, 1), 0.3).clamp());
for (int i = 0; i < SLIDER_COUNT; i++) {
sliders[i]->add_theme_icon_override("grabber", get_theme_icon(SNAME("bar_arrow"), SNAME("ColorPicker")));
@@ -553,7 +557,7 @@ void ColorPicker::_update_presets() {
}
#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (editor_settings) {
// Only load preset buttons when the only child is the add-preset button.
if (preset_container->get_child_count() == 1) {
for (int i = 0; i < preset_cache.size(); i++) {
@@ -567,7 +571,7 @@ void ColorPicker::_update_presets() {
void ColorPicker::_update_recent_presets() {
#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (editor_settings) {
int recent_preset_count = recent_preset_hbc->get_child_count();
for (int i = 0; i < recent_preset_count; i++) {
memdelete(recent_preset_hbc->get_child(0));
@@ -743,9 +747,9 @@ void ColorPicker::add_preset(const Color &p_color) {
}
#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (editor_settings) {
PackedColorArray arr_to_save = get_presets();
- EditorSettings::get_singleton()->set_project_metadata("color_picker", "presets", arr_to_save);
+ editor_settings->call(SNAME("set_project_metadata"), "color_picker", "presets", arr_to_save);
}
#endif
}
@@ -764,9 +768,9 @@ void ColorPicker::add_recent_preset(const Color &p_color) {
_select_from_preset_container(p_color);
#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (editor_settings) {
PackedColorArray arr_to_save = get_recent_presets();
- EditorSettings::get_singleton()->set_project_metadata("color_picker", "recent_presets", arr_to_save);
+ editor_settings->call(SNAME("set_project_metadata"), "color_picker", "recent_presets", arr_to_save);
}
#endif
}
@@ -787,9 +791,9 @@ void ColorPicker::erase_preset(const Color &p_color) {
}
#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (editor_settings) {
PackedColorArray arr_to_save = get_presets();
- EditorSettings::get_singleton()->set_project_metadata("color_picker", "presets", arr_to_save);
+ editor_settings->call(SNAME("set_project_metadata"), "color_picker", "presets", arr_to_save);
}
#endif
}
@@ -811,9 +815,9 @@ void ColorPicker::erase_recent_preset(const Color &p_color) {
}
#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (editor_settings) {
PackedColorArray arr_to_save = get_recent_presets();
- EditorSettings::get_singleton()->set_project_metadata("color_picker", "recent_presets", arr_to_save);
+ editor_settings->call(SNAME("set_project_metadata"), "color_picker", "recent_presets", arr_to_save);
}
#endif
}
@@ -890,7 +894,7 @@ void ColorPicker::set_colorize_sliders(bool p_colorize_sliders) {
alpha_slider->add_theme_style_override("slider", style_box_empty);
} else {
Ref<StyleBoxFlat> style_box_flat(memnew(StyleBoxFlat));
- style_box_flat->set_default_margin(SIDE_TOP, 16 * get_theme_default_base_scale());
+ style_box_flat->set_content_margin(SIDE_TOP, 16 * get_theme_default_base_scale());
style_box_flat->set_bg_color(Color(0.2, 0.23, 0.31).lerp(Color(0, 0, 0, 1), 0.3).clamp());
if (!slider_theme_modified) {
diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h
index 5eaeecca2a..f7578612cd 100644
--- a/scene/gui/color_picker.h
+++ b/scene/gui/color_picker.h
@@ -100,6 +100,10 @@ private:
static List<Color> preset_cache;
static List<Color> recent_preset_cache;
+#ifdef TOOLS_ENABLED
+ Object *editor_settings = nullptr;
+#endif
+
int current_slider_count = SLIDER_COUNT;
static const int MODE_BUTTON_COUNT = 3;
@@ -231,6 +235,10 @@ protected:
static void _bind_methods();
public:
+#ifdef TOOLS_ENABLED
+ void set_editor_settings(Object *p_editor_settings);
+#endif
+
HSlider *get_slider(int idx);
Vector<float> get_active_slider_values();
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 5930818763..6f5e2cf058 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -692,6 +692,12 @@ Transform2D Control::get_transform() const {
return xform;
}
+void Control::_toplevel_changed_on_parent() {
+ // Update root control status.
+ _notification(NOTIFICATION_EXIT_CANVAS);
+ _notification(NOTIFICATION_ENTER_CANVAS);
+}
+
/// Anchors and offsets.
void Control::_set_anchor(Side p_side, real_t p_anchor) {
@@ -1387,13 +1393,7 @@ Point2 Control::get_global_position() const {
Point2 Control::get_screen_position() const {
ERR_FAIL_COND_V(!is_inside_tree(), Point2());
- Point2 global_pos = get_global_transform_with_canvas().get_origin();
- Window *w = Object::cast_to<Window>(get_viewport());
- if (w && !w->is_embedding_subwindows()) {
- global_pos += w->get_position();
- }
-
- return global_pos;
+ return get_screen_transform().get_origin();
}
void Control::_set_size(const Size2 &p_size) {
@@ -1444,24 +1444,20 @@ void Control::set_rect(const Rect2 &p_rect) {
}
Rect2 Control::get_rect() const {
- return Rect2(get_position(), get_size());
+ Transform2D xform = get_transform();
+ return Rect2(xform.get_origin(), xform.get_scale() * get_size());
}
Rect2 Control::get_global_rect() const {
- return Rect2(get_global_position(), get_size());
+ Transform2D xform = get_global_transform();
+ return Rect2(xform.get_origin(), xform.get_scale() * get_size());
}
Rect2 Control::get_screen_rect() const {
ERR_FAIL_COND_V(!is_inside_tree(), Rect2());
- Rect2 r(get_global_position(), get_size());
-
- Window *w = Object::cast_to<Window>(get_viewport());
- if (w && !w->is_embedding_subwindows()) {
- r.position += w->get_position();
- }
-
- return r;
+ Transform2D xform = get_screen_transform();
+ return Rect2(xform.get_origin(), xform.get_scale() * get_size());
}
Rect2 Control::get_anchorable_rect() const {
@@ -1582,10 +1578,6 @@ void Control::set_block_minimum_size_adjust(bool p_block) {
data.block_minimum_size_adjust = p_block;
}
-bool Control::is_minimum_size_adjust_blocked() const {
- return data.block_minimum_size_adjust;
-}
-
Size2 Control::get_minimum_size() const {
Vector2 ms;
GDVIRTUAL_CALL(_get_minimum_size, ms);
@@ -2769,9 +2761,9 @@ void Control::end_bulk_theme_override() {
// Internationalization.
-TypedArray<Vector2i> Control::structured_text_parser(TextServer::StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const {
+TypedArray<Vector3i> Control::structured_text_parser(TextServer::StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const {
if (p_parser_type == TextServer::STRUCTURED_TEXT_CUSTOM) {
- TypedArray<Vector2i> ret;
+ TypedArray<Vector3i> ret;
GDVIRTUAL_CALL(_structured_text_parser, p_args, p_text, ret);
return ret;
} else {
diff --git a/scene/gui/control.h b/scene/gui/control.h
index aaab9f530c..5977f4dbea 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -145,7 +145,7 @@ public:
TEXT_DIRECTION_AUTO = TextServer::DIRECTION_AUTO,
TEXT_DIRECTION_LTR = TextServer::DIRECTION_LTR,
TEXT_DIRECTION_RTL = TextServer::DIRECTION_RTL,
- TEXT_DIRECTION_INHERITED,
+ TEXT_DIRECTION_INHERITED = TextServer::DIRECTION_INHERITED,
};
private:
@@ -292,6 +292,9 @@ private:
void _update_minimum_size();
void _size_changed();
+ void _toplevel_changed() override{}; // Controls don't need to do anything, only other CanvasItems.
+ void _toplevel_changed_on_parent() override;
+
void _clear_size_warning();
// Input events.
@@ -330,7 +333,7 @@ protected:
// Internationalization.
- virtual TypedArray<Vector2i> structured_text_parser(TextServer::StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const;
+ virtual TypedArray<Vector3i> structured_text_parser(TextServer::StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const;
// Base object overrides.
@@ -340,7 +343,7 @@ protected:
// Exposed virtual methods.
GDVIRTUAL1RC(bool, _has_point, Vector2)
- GDVIRTUAL2RC(TypedArray<Vector2i>, _structured_text_parser, Array, String)
+ GDVIRTUAL2RC(TypedArray<Vector3i>, _structured_text_parser, Array, String)
GDVIRTUAL0RC(Vector2, _get_minimum_size)
GDVIRTUAL1RC(Variant, _get_drag_data, Vector2)
@@ -464,7 +467,6 @@ public:
void update_minimum_size();
void set_block_minimum_size_adjust(bool p_block);
- bool is_minimum_size_adjust_blocked() const;
virtual Size2 get_minimum_size() const;
virtual Size2 get_combined_minimum_size() const;
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 4365db2ea2..dfe9ea3b08 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -136,7 +136,7 @@ void AcceptDialog::_cancel_pressed() {
call_deferred(SNAME("hide"));
- emit_signal(SNAME("cancelled"));
+ emit_signal(SNAME("canceled"));
cancel_pressed();
@@ -372,7 +372,7 @@ void AcceptDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_ok_button_text"), &AcceptDialog::get_ok_button_text);
ADD_SIGNAL(MethodInfo("confirmed"));
- ADD_SIGNAL(MethodInfo("cancelled"));
+ ADD_SIGNAL(MethodInfo("canceled"));
ADD_SIGNAL(MethodInfo("custom_action", PropertyInfo(Variant::STRING_NAME, "action")));
ADD_PROPERTY(PropertyInfo(Variant::STRING, "ok_button_text"), "set_ok_button_text", "get_ok_button_text");
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 6c495ab2c9..dc23bcb14a 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -920,7 +920,8 @@ void GraphEdit::_draw_connection_line(CanvasItem *p_where, const Vector2 &p_from
scaled_points.push_back(points[i] * p_zoom);
}
- p_where->draw_polyline_colors(scaled_points, colors, Math::floor(p_width * get_theme_default_base_scale()), lines_antialiased);
+ // Thickness below 0.5 doesn't look good on the graph or its minimap.
+ p_where->draw_polyline_colors(scaled_points, colors, MAX(0.5, Math::floor(p_width * get_theme_default_base_scale())), lines_antialiased);
}
void GraphEdit::_connections_layer_draw() {
@@ -1088,7 +1089,7 @@ void GraphEdit::_minimap_draw() {
from_color = from_color.lerp(activity_color, E.activity);
to_color = to_color.lerp(activity_color, E.activity);
}
- _draw_connection_line(minimap, from_position, to_position, from_color, to_color, 0.1, minimap->_convert_from_graph_position(Vector2(zoom, zoom)).length());
+ _draw_connection_line(minimap, from_position, to_position, from_color, to_color, 0.5, minimap->_convert_from_graph_position(Vector2(zoom, zoom)).length());
}
// Draw the "camera" viewport.
@@ -1380,34 +1381,15 @@ void GraphEdit::gui_input(const Ref<InputEvent> &p_ev) {
accept_event();
}
}
-
- Ref<InputEventMagnifyGesture> magnify_gesture = p_ev;
- if (magnify_gesture.is_valid()) {
- set_zoom_custom(zoom * magnify_gesture->get_factor(), magnify_gesture->get_position());
- }
-
- Ref<InputEventPanGesture> pan_gesture = p_ev;
- if (pan_gesture.is_valid()) {
- h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() * pan_gesture->get_delta().x / 8);
- v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * pan_gesture->get_delta().y / 8);
- }
-}
-
-void GraphEdit::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
- if (p_scroll_vec.x != 0) {
- h_scroll->set_value(h_scroll->get_value() + (h_scroll->get_page() * Math::abs(p_scroll_vec.x) / 8) * SIGN(p_scroll_vec.x));
- } else {
- v_scroll->set_value(v_scroll->get_value() + (v_scroll->get_page() * Math::abs(p_scroll_vec.y) / 8) * SIGN(p_scroll_vec.y));
- }
}
-void GraphEdit::_pan_callback(Vector2 p_scroll_vec) {
+void GraphEdit::_pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event) {
h_scroll->set_value(h_scroll->get_value() - p_scroll_vec.x);
v_scroll->set_value(v_scroll->get_value() - p_scroll_vec.y);
}
-void GraphEdit::_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt) {
- set_zoom_custom(p_scroll_vec.y < 0 ? zoom * zoom_step : zoom / zoom_step, p_origin);
+void GraphEdit::_zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event) {
+ set_zoom_custom(zoom * p_zoom_factor, p_origin);
}
void GraphEdit::set_connection_activity(const StringName &p_from, int p_from_port, const StringName &p_to, int p_to_port, float p_activity) {
@@ -1502,6 +1484,7 @@ void GraphEdit::set_zoom_step(float p_zoom_step) {
}
zoom_step = p_zoom_step;
+ panner->set_scroll_zoom_factor(zoom_step);
}
float GraphEdit::get_zoom_step() const {
@@ -2421,7 +2404,7 @@ GraphEdit::GraphEdit() {
zoom_max = (1 * Math::pow(zoom_step, 4));
panner.instantiate();
- panner->set_callbacks(callable_mp(this, &GraphEdit::_scroll_callback), callable_mp(this, &GraphEdit::_pan_callback), callable_mp(this, &GraphEdit::_zoom_callback));
+ panner->set_callbacks(callable_mp(this, &GraphEdit::_pan_callback), callable_mp(this, &GraphEdit::_zoom_callback));
top_layer = memnew(GraphEditFilter(this));
add_child(top_layer, false, INTERNAL_MODE_BACK);
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index 030f40e370..dfe6b94906 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -129,9 +129,8 @@ private:
Ref<ViewPanner> panner;
bool warped_panning = true;
- void _scroll_callback(Vector2 p_scroll_vec, bool p_alt);
- void _pan_callback(Vector2 p_scroll_vec);
- void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
+ void _pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event);
+ void _zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event);
bool arrange_nodes_button_hidden = false;
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 372baeadae..25a27d5e1a 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -309,12 +309,6 @@ void ItemList::set_item_tag_icon(int p_idx, const Ref<Texture2D> &p_tag_icon) {
shape_changed = true;
}
-Ref<Texture2D> ItemList::get_item_tag_icon(int p_idx) const {
- ERR_FAIL_INDEX_V(p_idx, items.size(), Ref<Texture2D>());
-
- return items[p_idx].tag_icon;
-}
-
void ItemList::set_item_selectable(int p_idx, bool p_selectable) {
if (p_idx < 0) {
p_idx += get_item_count();
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index 848f9a2ba9..934318dbb4 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -191,7 +191,6 @@ public:
Variant get_item_metadata(int p_idx) const;
void set_item_tag_icon(int p_idx, const Ref<Texture2D> &p_tag_icon);
- Ref<Texture2D> get_item_tag_icon(int p_idx) const;
void set_item_tooltip_enabled(int p_idx, const bool p_enabled);
bool is_item_tooltip_enabled(int p_idx) const;
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index e5bb64b225..dba08e16cb 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -247,7 +247,7 @@ void LineEdit::gui_input(const Ref<InputEvent> &p_event) {
return;
}
if (b->is_pressed() && b->get_button_index() == MouseButton::RIGHT && context_menu_enabled) {
- _ensure_menu();
+ _update_context_menu();
menu->set_position(get_screen_position() + get_local_mouse_position());
menu->reset_size();
menu->popup();
@@ -452,7 +452,7 @@ void LineEdit::gui_input(const Ref<InputEvent> &p_event) {
if (context_menu_enabled) {
if (k->is_action("ui_menu", true)) {
- _ensure_menu();
+ _update_context_menu();
Point2 pos = Point2(get_caret_pixel_pos().x, (get_size().y + theme_cache.font->get_height(theme_cache.font_size)) / 2);
menu->set_position(get_screen_position() + pos);
menu->reset_size();
@@ -952,9 +952,9 @@ void LineEdit::_notification(int p_what) {
// Prevent carets from disappearing at theme scales below 1.0 (if the caret width is 1).
const int caret_width = theme_cache.caret_width * MAX(1, theme_cache.base_scale);
- if (ime_text.length() == 0) {
+ if (ime_text.is_empty() || ime_selection.y == 0) {
// Normal caret.
- CaretInfo caret = TS->shaped_text_get_carets(text_rid, caret_column);
+ CaretInfo caret = TS->shaped_text_get_carets(text_rid, ime_text.is_empty() ? caret_column : caret_column + ime_selection.x);
if (using_placeholder || (caret.l_caret == Rect2() && caret.t_caret == Rect2())) {
// No carets, add one at the start.
int h = theme_cache.font->get_height(theme_cache.font_size);
@@ -980,6 +980,7 @@ void LineEdit::_notification(int p_what) {
}
} break;
}
+
RenderingServer::get_singleton()->canvas_item_add_rect(ci, caret.l_caret, caret_color);
} else {
if (caret.l_caret != Rect2() && caret.l_dir == TextServer::DIRECTION_AUTO) {
@@ -1009,7 +1010,8 @@ void LineEdit::_notification(int p_what) {
RenderingServer::get_singleton()->canvas_item_add_rect(ci, caret.t_caret, caret_color);
}
- } else {
+ }
+ if (!ime_text.is_empty()) {
{
// IME intermediate text range.
Vector<Vector2> sel = TS->shaped_text_get_selection(text_rid, caret_column, caret_column + ime_text.length());
@@ -1030,20 +1032,22 @@ void LineEdit::_notification(int p_what) {
}
{
// IME caret.
- Vector<Vector2> sel = TS->shaped_text_get_selection(text_rid, caret_column + ime_selection.x, caret_column + ime_selection.x + ime_selection.y);
- for (int i = 0; i < sel.size(); i++) {
- Rect2 rect = Rect2(sel[i].x + ofs.x, ofs.y, sel[i].y - sel[i].x, text_height);
- if (rect.position.x + rect.size.x <= x_ofs || rect.position.x > ofs_max) {
- continue;
- }
- if (rect.position.x < x_ofs) {
- rect.size.x -= (x_ofs - rect.position.x);
- rect.position.x = x_ofs;
- } else if (rect.position.x + rect.size.x > ofs_max) {
- rect.size.x = ofs_max - rect.position.x;
+ if (ime_selection.y > 0) {
+ Vector<Vector2> sel = TS->shaped_text_get_selection(text_rid, caret_column + ime_selection.x, caret_column + ime_selection.x + ime_selection.y);
+ for (int i = 0; i < sel.size(); i++) {
+ Rect2 rect = Rect2(sel[i].x + ofs.x, ofs.y, sel[i].y - sel[i].x, text_height);
+ if (rect.position.x + rect.size.x <= x_ofs || rect.position.x > ofs_max) {
+ continue;
+ }
+ if (rect.position.x < x_ofs) {
+ rect.size.x -= (x_ofs - rect.position.x);
+ rect.position.x = x_ofs;
+ } else if (rect.position.x + rect.size.x > ofs_max) {
+ rect.size.x = ofs_max - rect.position.x;
+ }
+ rect.size.y = caret_width * 3;
+ RenderingServer::get_singleton()->canvas_item_add_rect(ci, rect, caret_color);
}
- rect.size.y = caret_width * 3;
- RenderingServer::get_singleton()->canvas_item_add_rect(ci, rect, caret_color);
}
}
}
@@ -1052,7 +1056,8 @@ void LineEdit::_notification(int p_what) {
if (has_focus()) {
if (get_viewport()->get_window_id() != DisplayServer::INVALID_WINDOW_ID && DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_IME)) {
DisplayServer::get_singleton()->window_set_ime_active(true, get_viewport()->get_window_id());
- DisplayServer::get_singleton()->window_set_ime_position(get_global_position() + Point2(using_placeholder ? 0 : x_ofs, y_ofs + TS->shaped_text_get_size(text_rid).y), get_viewport()->get_window_id());
+ Point2 pos = Point2(get_caret_pixel_pos().x, (get_size().y + theme_cache.font->get_height(theme_cache.font_size)) / 2);
+ DisplayServer::get_singleton()->window_set_ime_position(get_global_position() + pos, get_viewport()->get_window_id());
}
}
} break;
@@ -1071,8 +1076,8 @@ void LineEdit::_notification(int p_what) {
if (get_viewport()->get_window_id() != DisplayServer::INVALID_WINDOW_ID && DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_IME)) {
DisplayServer::get_singleton()->window_set_ime_active(true, get_viewport()->get_window_id());
- Point2 column = Point2(get_caret_column(), 1) * get_minimum_size().height;
- DisplayServer::get_singleton()->window_set_ime_position(get_global_position() + column, get_viewport()->get_window_id());
+ Point2 pos = Point2(get_caret_pixel_pos().x, (get_size().y + theme_cache.font->get_height(theme_cache.font_size)) / 2);
+ DisplayServer::get_singleton()->window_set_ime_position(get_global_position() + pos, get_viewport()->get_window_id());
}
show_virtual_keyboard();
@@ -1103,6 +1108,11 @@ void LineEdit::_notification(int p_what) {
if (has_focus()) {
ime_text = DisplayServer::get_singleton()->ime_get_text();
ime_selection = DisplayServer::get_singleton()->ime_get_selection();
+
+ if (!ime_text.is_empty()) {
+ selection_delete();
+ }
+
_shape();
set_caret_column(caret_column); // Update scroll_offset
@@ -1714,6 +1724,10 @@ void LineEdit::insert_text_at_caret(String p_text) {
input_direction = (TextDirection)dir;
}
set_caret_column(caret_column + p_text.length());
+
+ if (!ime_text.is_empty()) {
+ _shape();
+ }
}
void LineEdit::clear_internal() {
@@ -2063,7 +2077,9 @@ bool LineEdit::is_menu_visible() const {
}
PopupMenu *LineEdit::get_menu() const {
- const_cast<LineEdit *>(this)->_ensure_menu();
+ if (!menu) {
+ const_cast<LineEdit *>(this)->_generate_context_menu();
+ }
return menu;
}
@@ -2321,6 +2337,115 @@ Key LineEdit::_get_menu_action_accelerator(const String &p_action) {
}
}
+void LineEdit::_generate_context_menu() {
+ menu = memnew(PopupMenu);
+ add_child(menu, false, INTERNAL_MODE_FRONT);
+
+ menu_dir = memnew(PopupMenu);
+ menu_dir->set_name("DirMenu");
+ menu_dir->add_radio_check_item(RTR("Same as Layout Direction"), MENU_DIR_INHERITED);
+ menu_dir->add_radio_check_item(RTR("Auto-Detect Direction"), MENU_DIR_AUTO);
+ menu_dir->add_radio_check_item(RTR("Left-to-Right"), MENU_DIR_LTR);
+ menu_dir->add_radio_check_item(RTR("Right-to-Left"), MENU_DIR_RTL);
+ menu->add_child(menu_dir, false, INTERNAL_MODE_FRONT);
+
+ menu_ctl = memnew(PopupMenu);
+ menu_ctl->set_name("CTLMenu");
+ menu_ctl->add_item(RTR("Left-to-Right Mark (LRM)"), MENU_INSERT_LRM);
+ menu_ctl->add_item(RTR("Right-to-Left Mark (RLM)"), MENU_INSERT_RLM);
+ menu_ctl->add_item(RTR("Start of Left-to-Right Embedding (LRE)"), MENU_INSERT_LRE);
+ menu_ctl->add_item(RTR("Start of Right-to-Left Embedding (RLE)"), MENU_INSERT_RLE);
+ menu_ctl->add_item(RTR("Start of Left-to-Right Override (LRO)"), MENU_INSERT_LRO);
+ menu_ctl->add_item(RTR("Start of Right-to-Left Override (RLO)"), MENU_INSERT_RLO);
+ menu_ctl->add_item(RTR("Pop Direction Formatting (PDF)"), MENU_INSERT_PDF);
+ menu_ctl->add_separator();
+ menu_ctl->add_item(RTR("Arabic Letter Mark (ALM)"), MENU_INSERT_ALM);
+ menu_ctl->add_item(RTR("Left-to-Right Isolate (LRI)"), MENU_INSERT_LRI);
+ menu_ctl->add_item(RTR("Right-to-Left Isolate (RLI)"), MENU_INSERT_RLI);
+ menu_ctl->add_item(RTR("First Strong Isolate (FSI)"), MENU_INSERT_FSI);
+ menu_ctl->add_item(RTR("Pop Direction Isolate (PDI)"), MENU_INSERT_PDI);
+ menu_ctl->add_separator();
+ menu_ctl->add_item(RTR("Zero-Width Joiner (ZWJ)"), MENU_INSERT_ZWJ);
+ menu_ctl->add_item(RTR("Zero-Width Non-Joiner (ZWNJ)"), MENU_INSERT_ZWNJ);
+ menu_ctl->add_item(RTR("Word Joiner (WJ)"), MENU_INSERT_WJ);
+ menu_ctl->add_item(RTR("Soft Hyphen (SHY)"), MENU_INSERT_SHY);
+ menu->add_child(menu_ctl, false, INTERNAL_MODE_FRONT);
+
+ menu->add_item(RTR("Cut"), MENU_CUT);
+ menu->add_item(RTR("Copy"), MENU_COPY);
+ menu->add_item(RTR("Paste"), MENU_PASTE);
+ menu->add_separator();
+ menu->add_item(RTR("Select All"), MENU_SELECT_ALL);
+ menu->add_item(RTR("Clear"), MENU_CLEAR);
+ menu->add_separator();
+ menu->add_item(RTR("Undo"), MENU_UNDO);
+ menu->add_item(RTR("Redo"), MENU_REDO);
+ menu->add_separator();
+ menu->add_submenu_item(RTR("Text Writing Direction"), "DirMenu", MENU_SUBMENU_TEXT_DIR);
+ menu->add_separator();
+ menu->add_check_item(RTR("Display Control Characters"), MENU_DISPLAY_UCC);
+ menu->add_submenu_item(RTR("Insert Control Character"), "CTLMenu", MENU_SUBMENU_INSERT_UCC);
+
+ menu->connect("id_pressed", callable_mp(this, &LineEdit::menu_option));
+ menu_dir->connect("id_pressed", callable_mp(this, &LineEdit::menu_option));
+ menu_ctl->connect("id_pressed", callable_mp(this, &LineEdit::menu_option));
+
+ menu->connect(SNAME("focus_entered"), callable_mp(this, &LineEdit::_validate_caret_can_draw));
+ menu->connect(SNAME("focus_exited"), callable_mp(this, &LineEdit::_validate_caret_can_draw));
+}
+
+void LineEdit::_update_context_menu() {
+ if (!menu) {
+ _generate_context_menu();
+ }
+
+ int idx = -1;
+
+#define MENU_ITEM_ACTION_DISABLED(m_menu, m_id, m_action, m_disabled) \
+ idx = m_menu->get_item_index(m_id); \
+ if (idx >= 0) { \
+ m_menu->set_item_accelerator(idx, shortcut_keys_enabled ? _get_menu_action_accelerator(m_action) : Key::NONE); \
+ m_menu->set_item_disabled(idx, m_disabled); \
+ }
+
+#define MENU_ITEM_ACTION(m_menu, m_id, m_action) \
+ idx = m_menu->get_item_index(m_id); \
+ if (idx >= 0) { \
+ m_menu->set_item_accelerator(idx, shortcut_keys_enabled ? _get_menu_action_accelerator(m_action) : Key::NONE); \
+ }
+
+#define MENU_ITEM_DISABLED(m_menu, m_id, m_disabled) \
+ idx = m_menu->get_item_index(m_id); \
+ if (idx >= 0) { \
+ m_menu->set_item_disabled(idx, m_disabled); \
+ }
+
+#define MENU_ITEM_CHECKED(m_menu, m_id, m_checked) \
+ idx = m_menu->get_item_index(m_id); \
+ if (idx >= 0) { \
+ m_menu->set_item_checked(idx, m_checked); \
+ }
+
+ MENU_ITEM_ACTION_DISABLED(menu, MENU_CUT, "ui_cut", !editable)
+ MENU_ITEM_ACTION(menu, MENU_COPY, "ui_copy")
+ MENU_ITEM_ACTION_DISABLED(menu, MENU_PASTE, "ui_paste", !editable)
+ MENU_ITEM_ACTION_DISABLED(menu, MENU_SELECT_ALL, "ui_text_select_all", !selecting_enabled)
+ MENU_ITEM_DISABLED(menu, MENU_CLEAR, !editable)
+ MENU_ITEM_ACTION_DISABLED(menu, MENU_UNDO, "ui_undo", !editable || !has_undo())
+ MENU_ITEM_ACTION_DISABLED(menu, MENU_REDO, "ui_redo", !editable || !has_redo())
+ MENU_ITEM_CHECKED(menu_dir, MENU_DIR_INHERITED, text_direction == TEXT_DIRECTION_INHERITED)
+ MENU_ITEM_CHECKED(menu_dir, MENU_DIR_AUTO, text_direction == TEXT_DIRECTION_AUTO)
+ MENU_ITEM_CHECKED(menu_dir, MENU_DIR_LTR, text_direction == TEXT_DIRECTION_LTR)
+ MENU_ITEM_CHECKED(menu_dir, MENU_DIR_RTL, text_direction == TEXT_DIRECTION_RTL)
+ MENU_ITEM_CHECKED(menu, MENU_DISPLAY_UCC, draw_control_chars)
+ MENU_ITEM_DISABLED(menu, MENU_SUBMENU_INSERT_UCC, !editable)
+
+#undef MENU_ITEM_ACTION_DISABLED
+#undef MENU_ITEM_ACTION
+#undef MENU_ITEM_DISABLED
+#undef MENU_ITEM_CHECKED
+}
+
void LineEdit::_validate_property(PropertyInfo &p_property) const {
if (!caret_blink_enabled && p_property.name == "caret_blink_interval") {
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
@@ -2415,11 +2540,13 @@ void LineEdit::_bind_methods() {
BIND_ENUM_CONSTANT(MENU_SELECT_ALL);
BIND_ENUM_CONSTANT(MENU_UNDO);
BIND_ENUM_CONSTANT(MENU_REDO);
+ BIND_ENUM_CONSTANT(MENU_SUBMENU_TEXT_DIR);
BIND_ENUM_CONSTANT(MENU_DIR_INHERITED);
BIND_ENUM_CONSTANT(MENU_DIR_AUTO);
BIND_ENUM_CONSTANT(MENU_DIR_LTR);
BIND_ENUM_CONSTANT(MENU_DIR_RTL);
BIND_ENUM_CONSTANT(MENU_DISPLAY_UCC);
+ BIND_ENUM_CONSTANT(MENU_SUBMENU_INSERT_UCC);
BIND_ENUM_CONSTANT(MENU_INSERT_LRM);
BIND_ENUM_CONSTANT(MENU_INSERT_RLM);
BIND_ENUM_CONSTANT(MENU_INSERT_LRE);
@@ -2482,86 +2609,6 @@ void LineEdit::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "structured_text_bidi_override_options"), "set_structured_text_bidi_override_options", "get_structured_text_bidi_override_options");
}
-void LineEdit::_ensure_menu() {
- if (!menu) {
- menu = memnew(PopupMenu);
- add_child(menu, false, INTERNAL_MODE_FRONT);
-
- menu_dir = memnew(PopupMenu);
- menu_dir->set_name("DirMenu");
- menu_dir->add_radio_check_item(RTR("Same as Layout Direction"), MENU_DIR_INHERITED);
- menu_dir->add_radio_check_item(RTR("Auto-Detect Direction"), MENU_DIR_AUTO);
- menu_dir->add_radio_check_item(RTR("Left-to-Right"), MENU_DIR_LTR);
- menu_dir->add_radio_check_item(RTR("Right-to-Left"), MENU_DIR_RTL);
- menu->add_child(menu_dir, false, INTERNAL_MODE_FRONT);
-
- menu_ctl = memnew(PopupMenu);
- menu_ctl->set_name("CTLMenu");
- menu_ctl->add_item(RTR("Left-to-Right Mark (LRM)"), MENU_INSERT_LRM);
- menu_ctl->add_item(RTR("Right-to-Left Mark (RLM)"), MENU_INSERT_RLM);
- menu_ctl->add_item(RTR("Start of Left-to-Right Embedding (LRE)"), MENU_INSERT_LRE);
- menu_ctl->add_item(RTR("Start of Right-to-Left Embedding (RLE)"), MENU_INSERT_RLE);
- menu_ctl->add_item(RTR("Start of Left-to-Right Override (LRO)"), MENU_INSERT_LRO);
- menu_ctl->add_item(RTR("Start of Right-to-Left Override (RLO)"), MENU_INSERT_RLO);
- menu_ctl->add_item(RTR("Pop Direction Formatting (PDF)"), MENU_INSERT_PDF);
- menu_ctl->add_separator();
- menu_ctl->add_item(RTR("Arabic Letter Mark (ALM)"), MENU_INSERT_ALM);
- menu_ctl->add_item(RTR("Left-to-Right Isolate (LRI)"), MENU_INSERT_LRI);
- menu_ctl->add_item(RTR("Right-to-Left Isolate (RLI)"), MENU_INSERT_RLI);
- menu_ctl->add_item(RTR("First Strong Isolate (FSI)"), MENU_INSERT_FSI);
- menu_ctl->add_item(RTR("Pop Direction Isolate (PDI)"), MENU_INSERT_PDI);
- menu_ctl->add_separator();
- menu_ctl->add_item(RTR("Zero-Width Joiner (ZWJ)"), MENU_INSERT_ZWJ);
- menu_ctl->add_item(RTR("Zero-Width Non-Joiner (ZWNJ)"), MENU_INSERT_ZWNJ);
- menu_ctl->add_item(RTR("Word Joiner (WJ)"), MENU_INSERT_WJ);
- menu_ctl->add_item(RTR("Soft Hyphen (SHY)"), MENU_INSERT_SHY);
- menu->add_child(menu_ctl, false, INTERNAL_MODE_FRONT);
-
- menu->connect("id_pressed", callable_mp(this, &LineEdit::menu_option));
- menu->connect(SNAME("focus_entered"), callable_mp(this, &LineEdit::_validate_caret_can_draw));
- menu->connect(SNAME("focus_exited"), callable_mp(this, &LineEdit::_validate_caret_can_draw));
- menu_dir->connect("id_pressed", callable_mp(this, &LineEdit::menu_option));
- menu_ctl->connect("id_pressed", callable_mp(this, &LineEdit::menu_option));
- }
-
- // Reorganize context menu.
- menu->clear();
- if (editable) {
- menu->add_item(RTR("Cut"), MENU_CUT, is_shortcut_keys_enabled() ? _get_menu_action_accelerator("ui_cut") : Key::NONE);
- }
- menu->add_item(RTR("Copy"), MENU_COPY, is_shortcut_keys_enabled() ? _get_menu_action_accelerator("ui_copy") : Key::NONE);
- if (editable) {
- menu->add_item(RTR("Paste"), MENU_PASTE, is_shortcut_keys_enabled() ? _get_menu_action_accelerator("ui_paste") : Key::NONE);
- }
- menu->add_separator();
- if (is_selecting_enabled()) {
- menu->add_item(RTR("Select All"), MENU_SELECT_ALL, is_shortcut_keys_enabled() ? _get_menu_action_accelerator("ui_text_select_all") : Key::NONE);
- }
- if (editable) {
- menu->add_item(RTR("Clear"), MENU_CLEAR);
- menu->add_separator();
- menu->add_item(RTR("Undo"), MENU_UNDO, is_shortcut_keys_enabled() ? _get_menu_action_accelerator("ui_undo") : Key::NONE);
- menu->add_item(RTR("Redo"), MENU_REDO, is_shortcut_keys_enabled() ? _get_menu_action_accelerator("ui_redo") : Key::NONE);
- }
- menu->add_separator();
- menu->add_submenu_item(RTR("Text Writing Direction"), "DirMenu");
- menu->add_separator();
- menu->add_check_item(RTR("Display Control Characters"), MENU_DISPLAY_UCC);
- menu->set_item_checked(menu->get_item_index(MENU_DISPLAY_UCC), draw_control_chars);
- if (editable) {
- menu->add_submenu_item(RTR("Insert Control Character"), "CTLMenu");
- }
- menu_dir->set_item_checked(menu_dir->get_item_index(MENU_DIR_INHERITED), text_direction == TEXT_DIRECTION_INHERITED);
- menu_dir->set_item_checked(menu_dir->get_item_index(MENU_DIR_AUTO), text_direction == TEXT_DIRECTION_AUTO);
- menu_dir->set_item_checked(menu_dir->get_item_index(MENU_DIR_LTR), text_direction == TEXT_DIRECTION_LTR);
- menu_dir->set_item_checked(menu_dir->get_item_index(MENU_DIR_RTL), text_direction == TEXT_DIRECTION_RTL);
-
- if (editable) {
- menu->set_item_disabled(menu->get_item_index(MENU_UNDO), !has_undo());
- menu->set_item_disabled(menu->get_item_index(MENU_REDO), !has_redo());
- }
-}
-
LineEdit::LineEdit(const String &p_placeholder) {
text_rid = TS->create_shaped_text();
_create_undo_state();
@@ -2576,7 +2623,7 @@ LineEdit::LineEdit(const String &p_placeholder) {
set_placeholder(p_placeholder);
- set_editable(true); // Initialise to opposite first, so we get past the early-out in set_editable.
+ set_editable(true); // Initialize to opposite first, so we get past the early-out in set_editable.
}
LineEdit::~LineEdit() {
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index 5107845a5e..81c506069a 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -46,11 +46,13 @@ public:
MENU_SELECT_ALL,
MENU_UNDO,
MENU_REDO,
+ MENU_SUBMENU_TEXT_DIR,
MENU_DIR_INHERITED,
MENU_DIR_AUTO,
MENU_DIR_LTR,
MENU_DIR_RTL,
MENU_DISPLAY_UCC,
+ MENU_SUBMENU_INSERT_UCC,
MENU_INSERT_LRM,
MENU_INSERT_RLM,
MENU_INSERT_LRE,
@@ -207,6 +209,8 @@ private:
void _create_undo_state();
Key _get_menu_action_accelerator(const String &p_action);
+ void _generate_context_menu();
+ void _update_context_menu();
void _shape();
void _fit_to_width();
@@ -239,8 +243,6 @@ private:
void _backspace(bool p_word = false, bool p_all_to_left = false);
void _delete(bool p_word = false, bool p_all_to_right = false);
- void _ensure_menu();
-
protected:
bool _is_over_clear_button(const Point2 &p_pos) const;
virtual void _update_theme_item_cache() override;
diff --git a/scene/gui/menu_bar.cpp b/scene/gui/menu_bar.cpp
index 224e405d41..5b27983851 100644
--- a/scene/gui/menu_bar.cpp
+++ b/scene/gui/menu_bar.cpp
@@ -214,10 +214,10 @@ void MenuBar::_update_submenu(const String &p_menu_name, PopupMenu *p_child) {
PopupMenu *pm = Object::cast_to<PopupMenu>(n);
ERR_FAIL_COND_MSG(!pm, "Item subnode is not a PopupMenu: " + p_child->get_item_submenu(i) + ".");
- DisplayServer::get_singleton()->global_menu_add_submenu_item(p_menu_name, p_child->get_item_text(i), p_menu_name + "/" + itos(i));
+ DisplayServer::get_singleton()->global_menu_add_submenu_item(p_menu_name, atr(p_child->get_item_text(i)), p_menu_name + "/" + itos(i));
_update_submenu(p_menu_name + "/" + itos(i), pm);
} else {
- int index = DisplayServer::get_singleton()->global_menu_add_item(p_menu_name, p_child->get_item_text(i), callable_mp(p_child, &PopupMenu::activate_item), Callable(), i);
+ int index = DisplayServer::get_singleton()->global_menu_add_item(p_menu_name, atr(p_child->get_item_text(i)), callable_mp(p_child, &PopupMenu::activate_item), Callable(), i);
if (p_child->is_item_checkable(i)) {
DisplayServer::get_singleton()->global_menu_set_item_checkable(p_menu_name, index, true);
@@ -290,7 +290,7 @@ void MenuBar::_update_menu() {
if (menu_cache[i].hidden) {
continue;
}
- String menu_name = String(popups[i]->get_meta("_menu_name", popups[i]->get_name()));
+ String menu_name = atr(String(popups[i]->get_meta("_menu_name", popups[i]->get_name())));
index = DisplayServer::get_singleton()->global_menu_add_submenu_item("_main", menu_name, root_name + "/" + itos(i), index);
if (menu_cache[i].disabled) {
@@ -525,7 +525,7 @@ void MenuBar::shape(Menu &p_menu) {
} else {
p_menu.text_buf->set_direction((TextServer::Direction)text_direction);
}
- p_menu.text_buf->add_string(p_menu.name, theme_cache.font, theme_cache.font_size, language);
+ p_menu.text_buf->add_string(atr(p_menu.name), theme_cache.font, theme_cache.font_size, language);
}
void MenuBar::_refresh_menu_names() {
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index c939e7a48a..2ea1b93810 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -59,9 +59,9 @@ void Popup::_initialize_visible_parents() {
void Popup::_deinitialize_visible_parents() {
if (is_embedded()) {
- for (uint32_t i = 0; i < visible_parents.size(); ++i) {
- visible_parents[i]->disconnect("focus_entered", callable_mp(this, &Popup::_parent_focused));
- visible_parents[i]->disconnect("tree_exited", callable_mp(this, &Popup::_deinitialize_visible_parents));
+ for (Window *parent_window : visible_parents) {
+ parent_window->disconnect("focus_entered", callable_mp(this, &Popup::_parent_focused));
+ parent_window->disconnect("tree_exited", callable_mp(this, &Popup::_deinitialize_visible_parents));
}
visible_parents.clear();
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 4e8a44dd63..ddc11d97b9 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -594,17 +594,17 @@ void PopupMenu::_draw_items() {
int content_left = content_center - content_size / 2;
int content_right = content_center + content_size / 2;
if (content_left > item_ofs.x) {
- int sep_h = theme_cache.labeled_separator_left->get_center_size().height + theme_cache.labeled_separator_left->get_minimum_size().height;
+ int sep_h = theme_cache.labeled_separator_left->get_minimum_size().height;
int sep_ofs = Math::floor((h - sep_h) / 2.0);
theme_cache.labeled_separator_left->draw(ci, Rect2(item_ofs + Point2(0, sep_ofs), Size2(MAX(0, content_left - item_ofs.x), sep_h)));
}
if (content_right < display_width) {
- int sep_h = theme_cache.labeled_separator_right->get_center_size().height + theme_cache.labeled_separator_right->get_minimum_size().height;
+ int sep_h = theme_cache.labeled_separator_right->get_minimum_size().height;
int sep_ofs = Math::floor((h - sep_h) / 2.0);
theme_cache.labeled_separator_right->draw(ci, Rect2(Point2(content_right, item_ofs.y + sep_ofs), Size2(MAX(0, display_width - content_right), sep_h)));
}
} else {
- int sep_h = theme_cache.separator_style->get_center_size().height + theme_cache.separator_style->get_minimum_size().height;
+ int sep_h = theme_cache.separator_style->get_minimum_size().height;
int sep_ofs = Math::floor((h - sep_h) / 2.0);
theme_cache.separator_style->draw(ci, Rect2(item_ofs + Point2(0, sep_ofs), Size2(display_width, sep_h)));
}
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 5ab64b35fd..3051502dd0 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -1797,7 +1797,9 @@ void RichTextLabel::_notification(int p_what) {
} break;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
- queue_redraw();
+ if (is_visible_in_tree()) {
+ queue_redraw();
+ }
} break;
case NOTIFICATION_DRAW: {
@@ -2665,19 +2667,26 @@ bool RichTextLabel::_find_layout_subitem(Item *from, Item *to) {
return false;
}
-void RichTextLabel::_thread_function(void *self) {
- RichTextLabel *rtl = reinterpret_cast<RichTextLabel *>(self);
- rtl->set_physics_process_internal(true);
- rtl->_process_line_caches();
- rtl->set_physics_process_internal(false);
- rtl->updating.store(false);
- rtl->call_deferred(SNAME("queue_redraw"));
+void RichTextLabel::_thread_function(void *p_userdata) {
+ _process_line_caches();
+ updating.store(false);
+ call_deferred(SNAME("thread_end"));
+}
+
+void RichTextLabel::_thread_end() {
+ set_physics_process_internal(false);
+ if (is_visible_in_tree()) {
+ queue_redraw();
+ }
}
void RichTextLabel::_stop_thread() {
if (threaded) {
stop_thread.store(true);
- thread.wait_to_finish();
+ if (task != WorkerThreadPool::INVALID_TASK_ID) {
+ WorkerThreadPool::get_singleton()->wait_for_task_completion(task);
+ task = WorkerThreadPool::INVALID_TASK_ID;
+ }
}
}
@@ -2778,7 +2787,7 @@ bool RichTextLabel::_validate_line_caches() {
main->first_resized_line.store(main->lines.size());
- if (fit_content_height) {
+ if (fit_content) {
update_minimum_size();
}
return true;
@@ -2787,7 +2796,8 @@ bool RichTextLabel::_validate_line_caches() {
if (threaded) {
updating.store(true);
loaded.store(true);
- thread.start(RichTextLabel::_thread_function, reinterpret_cast<void *>(this));
+ task = WorkerThreadPool::get_singleton()->add_template_task(this, &RichTextLabel::_thread_function, nullptr, true, vformat("RichTextLabelShape:%x", (int64_t)get_instance_id()));
+ set_physics_process_internal(true);
loading_started = OS::get_singleton()->get_ticks_msec();
return false;
} else {
@@ -2808,7 +2818,7 @@ void RichTextLabel::_process_line_caches() {
int ctrl_height = get_size().height;
int fi = main->first_invalid_line.load();
- int total_chars = (fi == 0) ? 0 : (main->lines[fi].char_offset + main->lines[fi].char_count);
+ int total_chars = main->lines[fi].char_offset;
float total_height = (fi == 0) ? 0 : _calculate_line_vertical_offset(main->lines[fi - 1]);
for (int i = fi; i < (int)main->lines.size(); i++) {
@@ -2862,7 +2872,7 @@ void RichTextLabel::_process_line_caches() {
main->first_resized_line.store(main->lines.size());
main->first_invalid_font_line.store(main->lines.size());
- if (fit_content_height) {
+ if (fit_content) {
update_minimum_size();
}
emit_signal(SNAME("finished"));
@@ -2963,7 +2973,7 @@ void RichTextLabel::_add_item(Item *p_item, bool p_enter, bool p_ensure_newline)
_invalidate_current_line(current_frame);
- if (fixed_width != -1) {
+ if (fit_content) {
update_minimum_size();
}
queue_redraw();
@@ -3435,6 +3445,8 @@ void RichTextLabel::push_customfx(Ref<RichTextEffect> p_custom_effect, Dictionar
item->custom_effect = p_custom_effect;
item->char_fx_transform->environment = p_environment;
_add_item(item, true);
+
+ set_process_internal(true);
}
void RichTextLabel::set_table_column_expand(int p_column, bool p_expand, int p_ratio) {
@@ -3551,7 +3563,7 @@ void RichTextLabel::clear() {
scroll_following = true;
}
- if (fixed_width != -1) {
+ if (fit_content) {
update_minimum_size();
}
}
@@ -3572,15 +3584,17 @@ int RichTextLabel::get_tab_size() const {
return tab_size;
}
-void RichTextLabel::set_fit_content_height(bool p_enabled) {
- if (p_enabled != fit_content_height) {
- fit_content_height = p_enabled;
- update_minimum_size();
+void RichTextLabel::set_fit_content(bool p_enabled) {
+ if (p_enabled == fit_content) {
+ return;
}
+
+ fit_content = p_enabled;
+ update_minimum_size();
}
-bool RichTextLabel::is_fit_content_height_enabled() const {
- return fit_content_height;
+bool RichTextLabel::is_fit_content_enabled() const {
+ return fit_content;
}
void RichTextLabel::set_meta_underline(bool p_underline) {
@@ -4074,8 +4088,8 @@ void RichTextLabel::append_text(const String &p_bbcode) {
st_parser_type = TextServer::STRUCTURED_TEXT_EMAIL;
} else if (subtag_a[1] == "l" || subtag_a[1] == "list") {
st_parser_type = TextServer::STRUCTURED_TEXT_LIST;
- } else if (subtag_a[1] == "n" || subtag_a[1] == "none") {
- st_parser_type = TextServer::STRUCTURED_TEXT_NONE;
+ } else if (subtag_a[1] == "n" || subtag_a[1] == "gdscript") {
+ st_parser_type = TextServer::STRUCTURED_TEXT_GDSCRIPT;
} else if (subtag_a[1] == "c" || subtag_a[1] == "custom") {
st_parser_type = TextServer::STRUCTURED_TEXT_CUSTOM;
}
@@ -4550,7 +4564,6 @@ void RichTextLabel::append_text(const String &p_bbcode) {
push_customfx(effect, properties);
pos = brk_end + 1;
tag_stack.push_front(identifier);
- set_process_internal(true);
} else {
add_text("["); //ignore
pos = brk_pos + 1;
@@ -5344,6 +5357,7 @@ void RichTextLabel::_bind_methods() {
ClassDB::bind_method(D_METHOD("push_cell"), &RichTextLabel::push_cell);
ClassDB::bind_method(D_METHOD("push_fgcolor", "fgcolor"), &RichTextLabel::push_fgcolor);
ClassDB::bind_method(D_METHOD("push_bgcolor", "bgcolor"), &RichTextLabel::push_bgcolor);
+ ClassDB::bind_method(D_METHOD("push_customfx", "effect", "env"), &RichTextLabel::push_customfx);
ClassDB::bind_method(D_METHOD("pop"), &RichTextLabel::pop);
ClassDB::bind_method(D_METHOD("clear"), &RichTextLabel::clear);
@@ -5381,8 +5395,8 @@ void RichTextLabel::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_tab_size", "spaces"), &RichTextLabel::set_tab_size);
ClassDB::bind_method(D_METHOD("get_tab_size"), &RichTextLabel::get_tab_size);
- ClassDB::bind_method(D_METHOD("set_fit_content_height", "enabled"), &RichTextLabel::set_fit_content_height);
- ClassDB::bind_method(D_METHOD("is_fit_content_height_enabled"), &RichTextLabel::is_fit_content_height_enabled);
+ ClassDB::bind_method(D_METHOD("set_fit_content", "enabled"), &RichTextLabel::set_fit_content);
+ ClassDB::bind_method(D_METHOD("is_fit_content_enabled"), &RichTextLabel::is_fit_content_enabled);
ClassDB::bind_method(D_METHOD("set_selection_enabled", "enabled"), &RichTextLabel::set_selection_enabled);
ClassDB::bind_method(D_METHOD("is_selection_enabled"), &RichTextLabel::is_selection_enabled);
@@ -5453,11 +5467,13 @@ void RichTextLabel::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_menu"), &RichTextLabel::get_menu);
ClassDB::bind_method(D_METHOD("is_menu_visible"), &RichTextLabel::is_menu_visible);
+ ClassDB::bind_method(D_METHOD("_thread_end"), &RichTextLabel::_thread_end);
+
// Note: set "bbcode_enabled" first, to avoid unnecessary "text" resets.
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bbcode_enabled"), "set_use_bbcode", "is_using_bbcode");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text", PROPERTY_HINT_MULTILINE_TEXT), "set_text", "get_text");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fit_content_height"), "set_fit_content_height", "is_fit_content_height_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fit_content"), "set_fit_content", "is_fit_content_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_active"), "set_scroll_active", "is_scroll_active");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_following"), "set_scroll_follow", "is_scroll_following");
ADD_PROPERTY(PropertyInfo(Variant::INT, "autowrap_mode", PROPERTY_HINT_ENUM, "Off,Arbitrary,Word,Word (Smart)"), "set_autowrap_mode", "get_autowrap_mode");
@@ -5644,27 +5660,17 @@ int RichTextLabel::get_total_glyph_count() const {
return tg;
}
-void RichTextLabel::set_fixed_size_to_width(int p_width) {
- if (fixed_width == p_width) {
- return;
- }
-
- fixed_width = p_width;
- update_minimum_size();
-}
-
Size2 RichTextLabel::get_minimum_size() const {
- Size2 size = theme_cache.normal_style->get_minimum_size();
-
- if (fixed_width != -1) {
- size.x += fixed_width;
- }
+ Size2 sb_min_size = theme_cache.normal_style->get_minimum_size();
+ Size2 min_size;
- if (fit_content_height) {
- size.y += get_content_height();
+ if (fit_content) {
+ min_size.x = get_content_width();
+ min_size.y = get_content_height();
}
- return size;
+ return sb_min_size +
+ ((autowrap_mode != TextServer::AUTOWRAP_OFF) ? Size2(1, min_size.height) : min_size);
}
// Context menu.
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index 8ac77d5b47..fcbb91f67e 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -31,6 +31,7 @@
#ifndef RICH_TEXT_LABEL_H
#define RICH_TEXT_LABEL_H
+#include "core/object/worker_thread_pool.h"
#include "rich_text_effect.h"
#include "scene/gui/popup_menu.h"
#include "scene/gui/scroll_bar.h"
@@ -369,7 +370,7 @@ private:
Item *current = nullptr;
ItemFrame *current_frame = nullptr;
- Thread thread;
+ WorkerThreadPool::TaskID task = WorkerThreadPool::INVALID_TASK_ID;
Mutex data_mutex;
bool threaded = false;
std::atomic<bool> stop_thread;
@@ -409,7 +410,8 @@ private:
void _invalidate_current_line(ItemFrame *p_frame);
- static void _thread_function(void *self);
+ void _thread_function(void *p_userdata);
+ void _thread_end();
void _stop_thread();
bool _validate_line_caches();
void _process_line_caches();
@@ -524,9 +526,7 @@ private:
bool use_bbcode = false;
String text;
- int fixed_width = -1;
-
- bool fit_content_height = false;
+ bool fit_content = false;
struct ThemeCache {
Ref<StyleBox> normal_style;
@@ -640,8 +640,8 @@ public:
void set_shortcut_keys_enabled(bool p_enabled);
bool is_shortcut_keys_enabled() const;
- void set_fit_content_height(bool p_enabled);
- bool is_fit_content_height_enabled() const;
+ void set_fit_content(bool p_enabled);
+ bool is_fit_content_enabled() const;
bool search(const String &p_string, bool p_from_selection = false, bool p_search_previous = false);
@@ -731,7 +731,6 @@ public:
void install_effect(const Variant effect);
- void set_fixed_size_to_width(int p_width);
virtual Size2 get_minimum_size() const override;
RichTextLabel(const String &p_text = String());
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index e617b2ca77..b8faf22a59 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -433,7 +433,7 @@ void ScrollBar::_notification(int p_what) {
double ScrollBar::get_grabber_min_size() const {
Ref<StyleBox> grabber = theme_cache.grabber_style;
- Size2 gminsize = grabber->get_minimum_size() + grabber->get_center_size();
+ Size2 gminsize = grabber->get_minimum_size();
return (orientation == VERTICAL) ? gminsize.height : gminsize.width;
}
@@ -500,7 +500,7 @@ Size2 ScrollBar::get_minimum_size() const {
Size2 minsize;
if (orientation == VERTICAL) {
- minsize.width = MAX(incr->get_size().width, (bg->get_minimum_size() + bg->get_center_size()).width);
+ minsize.width = MAX(incr->get_size().width, bg->get_minimum_size().width);
minsize.height += incr->get_size().height;
minsize.height += decr->get_size().height;
minsize.height += bg->get_minimum_size().height;
@@ -508,7 +508,7 @@ Size2 ScrollBar::get_minimum_size() const {
}
if (orientation == HORIZONTAL) {
- minsize.height = MAX(incr->get_size().height, (bg->get_center_size() + bg->get_minimum_size()).height);
+ minsize.height = MAX(incr->get_size().height, bg->get_minimum_size().height);
minsize.width += incr->get_size().width;
minsize.width += decr->get_size().width;
minsize.width += bg->get_minimum_size().width;
diff --git a/scene/gui/separator.cpp b/scene/gui/separator.cpp
index 45185de698..b0879c1931 100644
--- a/scene/gui/separator.cpp
+++ b/scene/gui/separator.cpp
@@ -51,7 +51,7 @@ void Separator::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_DRAW: {
Size2i size = get_size();
- Size2i ssize = theme_cache.separator_style->get_minimum_size() + theme_cache.separator_style->get_center_size();
+ Size2i ssize = theme_cache.separator_style->get_minimum_size();
if (orientation == VERTICAL) {
theme_cache.separator_style->draw(get_canvas_item(), Rect2((size.x - ssize.x) / 2, 0, ssize.x, size.y));
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index 040559dab8..292a4cfea2 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -33,7 +33,7 @@
#include "core/os/keyboard.h"
Size2 Slider::get_minimum_size() const {
- Size2i ss = theme_cache.slider_style->get_minimum_size() + theme_cache.slider_style->get_center_size();
+ Size2i ss = theme_cache.slider_style->get_minimum_size();
Size2i rs = theme_cache.grabber_icon->get_size();
if (orientation == HORIZONTAL) {
@@ -212,7 +212,7 @@ void Slider::_notification(int p_what) {
}
if (orientation == VERTICAL) {
- int widget_width = style->get_minimum_size().width + style->get_center_size().width;
+ int widget_width = style->get_minimum_size().width;
double areasize = size.height - grabber->get_size().height;
style->draw(ci, Rect2i(Point2i(size.width / 2 - widget_width / 2, 0), Size2i(widget_width, size.height)));
grabber_area->draw(ci, Rect2i(Point2i((size.width - widget_width) / 2, size.height - areasize * ratio - grabber->get_size().height / 2), Size2i(widget_width, areasize * ratio + grabber->get_size().height / 2)));
@@ -229,7 +229,7 @@ void Slider::_notification(int p_what) {
}
grabber->draw(ci, Point2i(size.width / 2 - grabber->get_size().width / 2 + get_theme_constant(SNAME("grabber_offset")), size.height - ratio * areasize - grabber->get_size().height));
} else {
- int widget_height = style->get_minimum_size().height + style->get_center_size().height;
+ int widget_height = style->get_minimum_size().height;
double areasize = size.width - grabber->get_size().width;
style->draw(ci, Rect2i(Point2i(0, (size.height - widget_height) / 2), Size2i(size.width, widget_height)));
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index dfc03c666b..f99b2edd54 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -368,7 +368,7 @@ void SpinBox::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "update_on_text_changed"), "set_update_on_text_changed", "get_update_on_text_changed");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "prefix"), "set_prefix", "get_prefix");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "suffix"), "set_suffix", "get_suffix");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "custom_arrow_step"), "set_custom_arrow_step", "get_custom_arrow_step");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "custom_arrow_step", PROPERTY_HINT_RANGE, "0,10000,0.0001,or_greater"), "set_custom_arrow_step", "get_custom_arrow_step");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "select_all_on_focus"), "set_select_all_on_focus", "is_select_all_on_focus");
}
diff --git a/scene/gui/subviewport_container.cpp b/scene/gui/subviewport_container.cpp
index 440597c24a..7c1d2f95a9 100644
--- a/scene/gui/subviewport_container.cpp
+++ b/scene/gui/subviewport_container.cpp
@@ -180,24 +180,51 @@ void SubViewportContainer::input(const Ref<InputEvent> &p_event) {
return;
}
- Transform2D xform = get_global_transform_with_canvas();
+ if (_is_propagated_in_gui_input(p_event)) {
+ return;
+ }
- if (stretch) {
- Transform2D scale_xf;
- scale_xf.scale(Vector2(shrink, shrink));
- xform *= scale_xf;
+ _send_event_to_viewports(p_event);
+}
+
+void SubViewportContainer::gui_input(const Ref<InputEvent> &p_event) {
+ ERR_FAIL_COND(p_event.is_null());
+
+ if (Engine::get_singleton()->is_editor_hint()) {
+ return;
}
- Ref<InputEvent> ev = p_event->xformed_by(xform.affine_inverse());
+ if (!_is_propagated_in_gui_input(p_event)) {
+ return;
+ }
+ if (stretch && shrink > 1) {
+ Transform2D xform;
+ xform.scale(Vector2(1, 1) / shrink);
+ _send_event_to_viewports(p_event->xformed_by(xform));
+ } else {
+ _send_event_to_viewports(p_event);
+ }
+}
+
+void SubViewportContainer::_send_event_to_viewports(const Ref<InputEvent> &p_event) {
for (int i = 0; i < get_child_count(); i++) {
SubViewport *c = Object::cast_to<SubViewport>(get_child(i));
if (!c || c->is_input_disabled()) {
continue;
}
- c->push_input(ev);
+ c->push_input(p_event);
+ }
+}
+
+bool SubViewportContainer::_is_propagated_in_gui_input(const Ref<InputEvent> &p_event) {
+ // Propagation of events with a position property happen in gui_input
+ // Propagation of other events happen in input
+ if (Object::cast_to<InputEventMouse>(*p_event) || Object::cast_to<InputEventScreenDrag>(*p_event) || Object::cast_to<InputEventScreenTouch>(*p_event) || Object::cast_to<InputEventGesture>(*p_event)) {
+ return true;
}
+ return false;
}
void SubViewportContainer::unhandled_input(const Ref<InputEvent> &p_event) {
diff --git a/scene/gui/subviewport_container.h b/scene/gui/subviewport_container.h
index d918c4a615..d3236b0c4e 100644
--- a/scene/gui/subviewport_container.h
+++ b/scene/gui/subviewport_container.h
@@ -39,6 +39,8 @@ class SubViewportContainer : public Container {
bool stretch = false;
int shrink = 1;
void _notify_viewports(int p_notification);
+ bool _is_propagated_in_gui_input(const Ref<InputEvent> &p_event);
+ void _send_event_to_viewports(const Ref<InputEvent> &p_event);
protected:
void _notification(int p_what);
@@ -52,6 +54,7 @@ public:
bool is_stretch_enabled() const;
virtual void input(const Ref<InputEvent> &p_event) override;
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
virtual void unhandled_input(const Ref<InputEvent> &p_event) override;
void set_stretch_shrink(int p_shrink);
int get_stretch_shrink() const;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 108a533a74..d785280701 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1208,7 +1208,15 @@ void TextEdit::_notification(int p_what) {
char_ofs = 0;
}
for (int j = 0; j < gl_size; j++) {
- const Variant *color_data = color_map.getptr(glyphs[j].start);
+ int64_t color_start = -1;
+ for (const Variant *key = color_map.next(nullptr); key; key = color_map.next(key)) {
+ if (int64_t(*key) <= glyphs[j].start) {
+ color_start = *key;
+ } else {
+ break;
+ }
+ }
+ const Variant *color_data = (color_start >= 0) ? color_map.getptr(color_start) : nullptr;
if (color_data != nullptr) {
current_color = (color_data->operator Dictionary()).get("color", font_color);
if (!editable && current_color.a > font_readonly_color.a) {
@@ -1311,11 +1319,12 @@ void TextEdit::_notification(int p_what) {
if (!clipped && get_caret_line(c) == line && carets_wrap_index[c] == line_wrap_index) {
carets.write[c].draw_pos.y = ofs_y + ldata->get_line_descent(line_wrap_index);
- if (ime_text.length() == 0) {
+ if (ime_text.is_empty() || ime_selection.y == 0) {
+ // Normal caret.
CaretInfo ts_caret;
- if (str.length() != 0) {
+ if (!str.is_empty() || !ime_text.is_empty()) {
// Get carets.
- ts_caret = TS->shaped_text_get_carets(rid, get_caret_column(c));
+ ts_caret = TS->shaped_text_get_carets(rid, ime_text.is_empty() ? get_caret_column(c) : get_caret_column(c) + ime_selection.x);
} else {
// No carets, add one at the start.
int h = font->get_height(font_size);
@@ -1418,7 +1427,8 @@ void TextEdit::_notification(int p_what) {
}
}
}
- } else {
+ }
+ if (!ime_text.is_empty()) {
{
// IME Intermediate text range.
Vector<Vector2> sel = TS->shaped_text_get_selection(rid, get_caret_column(c), get_caret_column(c) + ime_text.length());
@@ -1538,6 +1548,10 @@ void TextEdit::_notification(int p_what) {
ime_text = DisplayServer::get_singleton()->ime_get_text();
ime_selection = DisplayServer::get_singleton()->ime_get_selection();
+ if (!ime_text.is_empty()) {
+ delete_selection();
+ }
+
for (int i = 0; i < carets.size(); i++) {
String t;
if (get_caret_column(i) >= 0) {
@@ -1847,7 +1861,7 @@ void TextEdit::gui_input(const Ref<InputEvent> &p_gui_input) {
}
if (context_menu_enabled) {
- _generate_context_menu();
+ _update_context_menu();
menu->set_position(get_screen_position() + mpos);
menu->reset_size();
menu->popup();
@@ -2127,7 +2141,7 @@ void TextEdit::gui_input(const Ref<InputEvent> &p_gui_input) {
// MISC.
if (k->is_action("ui_menu", true)) {
if (context_menu_enabled) {
- _generate_context_menu();
+ _update_context_menu();
adjust_viewport_to_caret();
menu->set_position(get_screen_position() + get_caret_draw_pos());
menu->reset_size();
@@ -3530,6 +3544,19 @@ void TextEdit::insert_text_at_caret(const String &p_text, int p_caret) {
adjust_carets_after_edit(i, new_line, new_column, from_line, from_col);
}
+
+ if (!ime_text.is_empty()) {
+ for (int i = 0; i < carets.size(); i++) {
+ String t;
+ if (get_caret_column(i) >= 0) {
+ t = text[get_caret_line(i)].substr(0, get_caret_column(i)) + ime_text + text[get_caret_line(i)].substr(get_caret_column(i), text[get_caret_line(i)].length());
+ } else {
+ t = ime_text;
+ }
+ text.invalidate_cache(get_caret_line(i), get_caret_column(i), true, t, structured_text_parser(st_parser, st_args, t));
+ }
+ }
+
end_complex_operation();
queue_redraw();
}
@@ -3699,7 +3726,9 @@ void TextEdit::paste_primary_clipboard(int p_caret) {
// Context menu.
PopupMenu *TextEdit::get_menu() const {
- const_cast<TextEdit *>(this)->_generate_context_menu();
+ if (!menu) {
+ const_cast<TextEdit *>(this)->_generate_context_menu();
+ }
return menu;
}
@@ -6048,11 +6077,13 @@ void TextEdit::_bind_methods() {
BIND_ENUM_CONSTANT(MENU_SELECT_ALL);
BIND_ENUM_CONSTANT(MENU_UNDO);
BIND_ENUM_CONSTANT(MENU_REDO);
+ BIND_ENUM_CONSTANT(MENU_SUBMENU_TEXT_DIR);
BIND_ENUM_CONSTANT(MENU_DIR_INHERITED);
BIND_ENUM_CONSTANT(MENU_DIR_AUTO);
BIND_ENUM_CONSTANT(MENU_DIR_LTR);
BIND_ENUM_CONSTANT(MENU_DIR_RTL);
BIND_ENUM_CONSTANT(MENU_DISPLAY_UCC);
+ BIND_ENUM_CONSTANT(MENU_SUBMENU_INSERT_UCC);
BIND_ENUM_CONSTANT(MENU_INSERT_LRM);
BIND_ENUM_CONSTANT(MENU_INSERT_RLM);
BIND_ENUM_CONSTANT(MENU_INSERT_LRE);
@@ -6360,7 +6391,7 @@ void TextEdit::_bind_methods() {
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::OBJECT, "syntax_highlighter", PROPERTY_HINT_RESOURCE_TYPE, "SyntaxHighlighter", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE), "set_syntax_highlighter", "get_syntax_highlighter");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "syntax_highlighter", PROPERTY_HINT_RESOURCE_TYPE, "SyntaxHighlighter", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_ALWAYS_DUPLICATE), "set_syntax_highlighter", "get_syntax_highlighter");
ADD_GROUP("Scroll", "scroll_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_smooth"), "set_smooth_scroll_enabled", "is_smooth_scroll_enabled");
@@ -6703,87 +6734,7 @@ void TextEdit::_paste_primary_clipboard_internal(int p_caret) {
grab_focus();
}
-/* Text. */
// Context menu.
-void TextEdit::_generate_context_menu() {
- if (!menu) {
- menu = memnew(PopupMenu);
- add_child(menu, false, INTERNAL_MODE_FRONT);
-
- menu_dir = memnew(PopupMenu);
- menu_dir->set_name("DirMenu");
- menu_dir->add_radio_check_item(RTR("Same as Layout Direction"), MENU_DIR_INHERITED);
- menu_dir->add_radio_check_item(RTR("Auto-Detect Direction"), MENU_DIR_AUTO);
- menu_dir->add_radio_check_item(RTR("Left-to-Right"), MENU_DIR_LTR);
- menu_dir->add_radio_check_item(RTR("Right-to-Left"), MENU_DIR_RTL);
- menu->add_child(menu_dir, false, INTERNAL_MODE_FRONT);
-
- menu_ctl = memnew(PopupMenu);
- menu_ctl->set_name("CTLMenu");
- menu_ctl->add_item(RTR("Left-to-Right Mark (LRM)"), MENU_INSERT_LRM);
- menu_ctl->add_item(RTR("Right-to-Left Mark (RLM)"), MENU_INSERT_RLM);
- menu_ctl->add_item(RTR("Start of Left-to-Right Embedding (LRE)"), MENU_INSERT_LRE);
- menu_ctl->add_item(RTR("Start of Right-to-Left Embedding (RLE)"), MENU_INSERT_RLE);
- menu_ctl->add_item(RTR("Start of Left-to-Right Override (LRO)"), MENU_INSERT_LRO);
- menu_ctl->add_item(RTR("Start of Right-to-Left Override (RLO)"), MENU_INSERT_RLO);
- menu_ctl->add_item(RTR("Pop Direction Formatting (PDF)"), MENU_INSERT_PDF);
- menu_ctl->add_separator();
- menu_ctl->add_item(RTR("Arabic Letter Mark (ALM)"), MENU_INSERT_ALM);
- menu_ctl->add_item(RTR("Left-to-Right Isolate (LRI)"), MENU_INSERT_LRI);
- menu_ctl->add_item(RTR("Right-to-Left Isolate (RLI)"), MENU_INSERT_RLI);
- menu_ctl->add_item(RTR("First Strong Isolate (FSI)"), MENU_INSERT_FSI);
- menu_ctl->add_item(RTR("Pop Direction Isolate (PDI)"), MENU_INSERT_PDI);
- menu_ctl->add_separator();
- menu_ctl->add_item(RTR("Zero-Width Joiner (ZWJ)"), MENU_INSERT_ZWJ);
- menu_ctl->add_item(RTR("Zero-Width Non-Joiner (ZWNJ)"), MENU_INSERT_ZWNJ);
- menu_ctl->add_item(RTR("Word Joiner (WJ)"), MENU_INSERT_WJ);
- menu_ctl->add_item(RTR("Soft Hyphen (SHY)"), MENU_INSERT_SHY);
- menu->add_child(menu_ctl, false, INTERNAL_MODE_FRONT);
-
- menu->connect("id_pressed", callable_mp(this, &TextEdit::menu_option));
- menu_dir->connect("id_pressed", callable_mp(this, &TextEdit::menu_option));
- menu_ctl->connect("id_pressed", callable_mp(this, &TextEdit::menu_option));
- }
-
- // Reorganize context menu.
- menu->clear();
- if (editable) {
- menu->add_item(RTR("Cut"), MENU_CUT, is_shortcut_keys_enabled() ? _get_menu_action_accelerator("ui_cut") : Key::NONE);
- }
- menu->add_item(RTR("Copy"), MENU_COPY, is_shortcut_keys_enabled() ? _get_menu_action_accelerator("ui_copy") : Key::NONE);
- if (editable) {
- menu->add_item(RTR("Paste"), MENU_PASTE, is_shortcut_keys_enabled() ? _get_menu_action_accelerator("ui_paste") : Key::NONE);
- }
- if (selecting_enabled || editable) {
- menu->add_separator();
- }
- if (selecting_enabled) {
- menu->add_item(RTR("Select All"), MENU_SELECT_ALL, is_shortcut_keys_enabled() ? _get_menu_action_accelerator("ui_text_select_all") : Key::NONE);
- }
- if (editable) {
- menu->add_item(RTR("Clear"), MENU_CLEAR);
- menu->add_separator();
- menu->add_item(RTR("Undo"), MENU_UNDO, is_shortcut_keys_enabled() ? _get_menu_action_accelerator("ui_undo") : Key::NONE);
- menu->add_item(RTR("Redo"), MENU_REDO, is_shortcut_keys_enabled() ? _get_menu_action_accelerator("ui_redo") : Key::NONE);
- }
- menu->add_separator();
- menu->add_submenu_item(RTR("Text Writing Direction"), "DirMenu");
- menu->add_separator();
- menu->add_check_item(RTR("Display Control Characters"), MENU_DISPLAY_UCC);
- menu->set_item_checked(menu->get_item_index(MENU_DISPLAY_UCC), draw_control_chars);
- if (editable) {
- menu->add_submenu_item(RTR("Insert Control Character"), "CTLMenu");
- }
- menu_dir->set_item_checked(menu_dir->get_item_index(MENU_DIR_INHERITED), text_direction == TEXT_DIRECTION_INHERITED);
- menu_dir->set_item_checked(menu_dir->get_item_index(MENU_DIR_AUTO), text_direction == TEXT_DIRECTION_AUTO);
- menu_dir->set_item_checked(menu_dir->get_item_index(MENU_DIR_LTR), text_direction == TEXT_DIRECTION_LTR);
- menu_dir->set_item_checked(menu_dir->get_item_index(MENU_DIR_RTL), text_direction == TEXT_DIRECTION_RTL);
-
- if (editable) {
- menu->set_item_disabled(menu->get_item_index(MENU_UNDO), !has_undo());
- menu->set_item_disabled(menu->get_item_index(MENU_REDO), !has_redo());
- }
-}
Key TextEdit::_get_menu_action_accelerator(const String &p_action) {
const List<Ref<InputEvent>> *events = InputMap::get_singleton()->action_get_events(p_action);
@@ -6810,6 +6761,112 @@ Key TextEdit::_get_menu_action_accelerator(const String &p_action) {
}
}
+void TextEdit::_generate_context_menu() {
+ menu = memnew(PopupMenu);
+ add_child(menu, false, INTERNAL_MODE_FRONT);
+
+ menu_dir = memnew(PopupMenu);
+ menu_dir->set_name("DirMenu");
+ menu_dir->add_radio_check_item(RTR("Same as Layout Direction"), MENU_DIR_INHERITED);
+ menu_dir->add_radio_check_item(RTR("Auto-Detect Direction"), MENU_DIR_AUTO);
+ menu_dir->add_radio_check_item(RTR("Left-to-Right"), MENU_DIR_LTR);
+ menu_dir->add_radio_check_item(RTR("Right-to-Left"), MENU_DIR_RTL);
+ menu->add_child(menu_dir, false, INTERNAL_MODE_FRONT);
+
+ menu_ctl = memnew(PopupMenu);
+ menu_ctl->set_name("CTLMenu");
+ menu_ctl->add_item(RTR("Left-to-Right Mark (LRM)"), MENU_INSERT_LRM);
+ menu_ctl->add_item(RTR("Right-to-Left Mark (RLM)"), MENU_INSERT_RLM);
+ menu_ctl->add_item(RTR("Start of Left-to-Right Embedding (LRE)"), MENU_INSERT_LRE);
+ menu_ctl->add_item(RTR("Start of Right-to-Left Embedding (RLE)"), MENU_INSERT_RLE);
+ menu_ctl->add_item(RTR("Start of Left-to-Right Override (LRO)"), MENU_INSERT_LRO);
+ menu_ctl->add_item(RTR("Start of Right-to-Left Override (RLO)"), MENU_INSERT_RLO);
+ menu_ctl->add_item(RTR("Pop Direction Formatting (PDF)"), MENU_INSERT_PDF);
+ menu_ctl->add_separator();
+ menu_ctl->add_item(RTR("Arabic Letter Mark (ALM)"), MENU_INSERT_ALM);
+ menu_ctl->add_item(RTR("Left-to-Right Isolate (LRI)"), MENU_INSERT_LRI);
+ menu_ctl->add_item(RTR("Right-to-Left Isolate (RLI)"), MENU_INSERT_RLI);
+ menu_ctl->add_item(RTR("First Strong Isolate (FSI)"), MENU_INSERT_FSI);
+ menu_ctl->add_item(RTR("Pop Direction Isolate (PDI)"), MENU_INSERT_PDI);
+ menu_ctl->add_separator();
+ menu_ctl->add_item(RTR("Zero-Width Joiner (ZWJ)"), MENU_INSERT_ZWJ);
+ menu_ctl->add_item(RTR("Zero-Width Non-Joiner (ZWNJ)"), MENU_INSERT_ZWNJ);
+ menu_ctl->add_item(RTR("Word Joiner (WJ)"), MENU_INSERT_WJ);
+ menu_ctl->add_item(RTR("Soft Hyphen (SHY)"), MENU_INSERT_SHY);
+ menu->add_child(menu_ctl, false, INTERNAL_MODE_FRONT);
+
+ menu->add_item(RTR("Cut"), MENU_CUT);
+ menu->add_item(RTR("Copy"), MENU_COPY);
+ menu->add_item(RTR("Paste"), MENU_PASTE);
+ menu->add_separator();
+ menu->add_item(RTR("Select All"), MENU_SELECT_ALL);
+ menu->add_item(RTR("Clear"), MENU_CLEAR);
+ menu->add_separator();
+ menu->add_item(RTR("Undo"), MENU_UNDO);
+ menu->add_item(RTR("Redo"), MENU_REDO);
+ menu->add_separator();
+ menu->add_submenu_item(RTR("Text Writing Direction"), "DirMenu", MENU_SUBMENU_TEXT_DIR);
+ menu->add_separator();
+ menu->add_check_item(RTR("Display Control Characters"), MENU_DISPLAY_UCC);
+ menu->add_submenu_item(RTR("Insert Control Character"), "CTLMenu", MENU_SUBMENU_INSERT_UCC);
+
+ menu->connect("id_pressed", callable_mp(this, &TextEdit::menu_option));
+ menu_dir->connect("id_pressed", callable_mp(this, &TextEdit::menu_option));
+ menu_ctl->connect("id_pressed", callable_mp(this, &TextEdit::menu_option));
+}
+
+void TextEdit::_update_context_menu() {
+ if (!menu) {
+ _generate_context_menu();
+ }
+
+ int idx = -1;
+
+#define MENU_ITEM_ACTION_DISABLED(m_menu, m_id, m_action, m_disabled) \
+ idx = m_menu->get_item_index(m_id); \
+ if (idx >= 0) { \
+ m_menu->set_item_accelerator(idx, shortcut_keys_enabled ? _get_menu_action_accelerator(m_action) : Key::NONE); \
+ m_menu->set_item_disabled(idx, m_disabled); \
+ }
+
+#define MENU_ITEM_ACTION(m_menu, m_id, m_action) \
+ idx = m_menu->get_item_index(m_id); \
+ if (idx >= 0) { \
+ m_menu->set_item_accelerator(idx, shortcut_keys_enabled ? _get_menu_action_accelerator(m_action) : Key::NONE); \
+ }
+
+#define MENU_ITEM_DISABLED(m_menu, m_id, m_disabled) \
+ idx = m_menu->get_item_index(m_id); \
+ if (idx >= 0) { \
+ m_menu->set_item_disabled(idx, m_disabled); \
+ }
+
+#define MENU_ITEM_CHECKED(m_menu, m_id, m_checked) \
+ idx = m_menu->get_item_index(m_id); \
+ if (idx >= 0) { \
+ m_menu->set_item_checked(idx, m_checked); \
+ }
+
+ MENU_ITEM_ACTION_DISABLED(menu, MENU_CUT, "ui_cut", !editable)
+ MENU_ITEM_ACTION(menu, MENU_COPY, "ui_copy")
+ MENU_ITEM_ACTION_DISABLED(menu, MENU_PASTE, "ui_paste", !editable)
+ MENU_ITEM_ACTION_DISABLED(menu, MENU_SELECT_ALL, "ui_text_select_all", !selecting_enabled)
+ MENU_ITEM_DISABLED(menu, MENU_CLEAR, !editable)
+ MENU_ITEM_ACTION_DISABLED(menu, MENU_UNDO, "ui_undo", !editable || !has_undo())
+ MENU_ITEM_ACTION_DISABLED(menu, MENU_REDO, "ui_redo", !editable || !has_redo())
+ MENU_ITEM_CHECKED(menu_dir, MENU_DIR_INHERITED, text_direction == TEXT_DIRECTION_INHERITED)
+ MENU_ITEM_CHECKED(menu_dir, MENU_DIR_AUTO, text_direction == TEXT_DIRECTION_AUTO)
+ MENU_ITEM_CHECKED(menu_dir, MENU_DIR_LTR, text_direction == TEXT_DIRECTION_LTR)
+ MENU_ITEM_CHECKED(menu_dir, MENU_DIR_RTL, text_direction == TEXT_DIRECTION_RTL)
+ MENU_ITEM_CHECKED(menu, MENU_DISPLAY_UCC, draw_control_chars)
+ MENU_ITEM_DISABLED(menu, MENU_SUBMENU_INSERT_UCC, !editable)
+
+#undef MENU_ITEM_ACTION_DISABLED
+#undef MENU_ITEM_ACTION
+#undef MENU_ITEM_DISABLED
+#undef MENU_ITEM_CHECKED
+}
+
/* Versioning */
void TextEdit::_push_current_op() {
if (pending_action_end) {
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 426acc4996..a084fa3833 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -87,11 +87,13 @@ public:
MENU_SELECT_ALL,
MENU_UNDO,
MENU_REDO,
+ MENU_SUBMENU_TEXT_DIR,
MENU_DIR_INHERITED,
MENU_DIR_AUTO,
MENU_DIR_LTR,
MENU_DIR_RTL,
MENU_DISPLAY_UCC,
+ MENU_SUBMENU_INSERT_UCC,
MENU_INSERT_LRM,
MENU_INSERT_RLM,
MENU_INSERT_LRE,
@@ -274,7 +276,7 @@ private:
void _update_placeholder();
- /* Initialise to opposite first, so we get past the early-out in set_editable. */
+ /* Initialize to opposite first, so we get past the early-out in set_editable. */
bool editable = false;
TextDirection text_direction = TEXT_DIRECTION_AUTO;
@@ -303,8 +305,9 @@ private:
PopupMenu *menu_dir = nullptr;
PopupMenu *menu_ctl = nullptr;
- void _generate_context_menu();
Key _get_menu_action_accelerator(const String &p_action);
+ void _generate_context_menu();
+ void _update_context_menu();
/* Versioning */
struct Caret;
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 2138f10ad0..d9e6157489 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -332,7 +332,7 @@ void TreeItem::set_structured_text_bidi_override(int p_column, TextServer::Struc
}
TextServer::StructuredTextParser TreeItem::get_structured_text_bidi_override(int p_column) const {
- ERR_FAIL_INDEX_V(p_column, cells.size(), TextServer::STRUCTURED_TEXT_NONE);
+ ERR_FAIL_INDEX_V(p_column, cells.size(), TextServer::STRUCTURED_TEXT_DEFAULT);
return cells[p_column].st_parser;
}
@@ -3554,7 +3554,7 @@ void Tree::gui_input(const Ref<InputEvent> &p_event) {
icon_size_x = icon_region.size.width;
}
}
- // Icon is treated as if it is outside of the rect so that double clicking on it will emit the item_double_clicked signal.
+ // Icon is treated as if it is outside of the rect so that double clicking on it will emit the item_icon_double_clicked signal.
if (rtl) {
mpos.x = get_size().width - (mpos.x + icon_size_x);
} else {
@@ -3562,10 +3562,10 @@ void Tree::gui_input(const Ref<InputEvent> &p_event) {
}
if (rect.has_point(mpos)) {
if (!edit_selected()) {
- emit_signal(SNAME("item_double_clicked"));
+ emit_signal(SNAME("item_icon_double_clicked"));
}
} else {
- emit_signal(SNAME("item_double_clicked"));
+ emit_signal(SNAME("item_icon_double_clicked"));
}
}
pressing_for_editor = false;
@@ -5257,7 +5257,7 @@ void Tree::_bind_methods() {
ADD_SIGNAL(MethodInfo("item_edited"));
ADD_SIGNAL(MethodInfo("custom_item_clicked", PropertyInfo(Variant::INT, "mouse_button_index")));
ADD_SIGNAL(MethodInfo("item_custom_button_pressed"));
- ADD_SIGNAL(MethodInfo("item_double_clicked"));
+ ADD_SIGNAL(MethodInfo("item_icon_double_clicked"));
ADD_SIGNAL(MethodInfo("item_collapsed", PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "TreeItem")));
ADD_SIGNAL(MethodInfo("check_propagated_to_item", PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "TreeItem"), PropertyInfo(Variant::INT, "column")));
ADD_SIGNAL(MethodInfo("button_clicked", PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "TreeItem"), PropertyInfo(Variant::INT, "column"), PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::INT, "mouse_button_index")));
diff --git a/scene/gui/video_stream_player.cpp b/scene/gui/video_stream_player.cpp
index 6eb25bf852..1f3bbff779 100644
--- a/scene/gui/video_stream_player.cpp
+++ b/scene/gui/video_stream_player.cpp
@@ -236,7 +236,6 @@ void VideoStreamPlayer::set_stream(const Ref<VideoStream> &p_stream) {
AudioServer::get_singleton()->unlock();
if (!playback.is_null()) {
- playback->set_loop(loops);
playback->set_paused(paused);
texture = playback->get_texture();
@@ -344,6 +343,12 @@ int VideoStreamPlayer::get_buffering_msec() const {
void VideoStreamPlayer::set_audio_track(int p_track) {
audio_track = p_track;
+ if (stream.is_valid()) {
+ stream->set_audio_track(audio_track);
+ }
+ if (playback.is_valid()) {
+ playback->set_audio_track(audio_track);
+ }
}
int VideoStreamPlayer::get_audio_track() const {
diff --git a/scene/gui/video_stream_player.h b/scene/gui/video_stream_player.h
index 09ef272a9a..1fd599a9e1 100644
--- a/scene/gui/video_stream_player.h
+++ b/scene/gui/video_stream_player.h
@@ -65,7 +65,6 @@ class VideoStreamPlayer : public Control {
float volume = 1.0;
double last_audio_time = 0.0;
bool expand = false;
- bool loops = false;
int buffering_ms = 500;
int audio_track = 0;
int bus_index = 0;
diff --git a/scene/gui/view_panner.cpp b/scene/gui/view_panner.cpp
index e8d54e6937..145497fa61 100644
--- a/scene/gui/view_panner.cpp
+++ b/scene/gui/view_panner.cpp
@@ -43,36 +43,42 @@ bool ViewPanner::gui_input(const Ref<InputEvent> &p_event, Rect2 p_canvas_rect)
if (scroll_vec != Vector2() && mb->is_pressed()) {
if (control_scheme == SCROLL_PANS) {
if (mb->is_ctrl_pressed()) {
- scroll_vec.y *= mb->get_factor();
- callback_helper(zoom_callback, varray(scroll_vec, mb->get_position(), mb->is_alt_pressed()));
+ // Compute the zoom factor.
+ float zoom_factor = mb->get_factor() <= 0 ? 1.0 : mb->get_factor();
+ zoom_factor = ((scroll_zoom_factor - 1.0) * zoom_factor) + 1.0;
+ float zoom = (scroll_vec.x + scroll_vec.y) > 0 ? 1.0 / scroll_zoom_factor : scroll_zoom_factor;
+ callback_helper(zoom_callback, varray(zoom, mb->get_position(), p_event));
return true;
} else {
- Vector2 panning;
- if (mb->is_shift_pressed()) {
- panning.x += mb->get_factor() * scroll_vec.y;
- panning.y += mb->get_factor() * scroll_vec.x;
- } else {
- panning.y += mb->get_factor() * scroll_vec.y;
- panning.x += mb->get_factor() * scroll_vec.x;
+ Vector2 panning = scroll_vec * mb->get_factor();
+ if (pan_axis == PAN_AXIS_HORIZONTAL) {
+ panning = Vector2(panning.x + panning.y, 0);
+ } else if (pan_axis == PAN_AXIS_VERTICAL) {
+ panning = Vector2(0, panning.x + panning.y);
+ } else if (mb->is_shift_pressed()) {
+ panning = Vector2(panning.y, panning.x);
}
- callback_helper(scroll_callback, varray(panning, mb->is_alt_pressed()));
+ callback_helper(pan_callback, varray(-panning * scroll_speed, p_event));
return true;
}
} else {
if (mb->is_ctrl_pressed()) {
- Vector2 panning;
- if (mb->is_shift_pressed()) {
- panning.x += mb->get_factor() * scroll_vec.y;
- panning.y += mb->get_factor() * scroll_vec.x;
- } else {
- panning.y += mb->get_factor() * scroll_vec.y;
- panning.x += mb->get_factor() * scroll_vec.x;
+ Vector2 panning = scroll_vec * mb->get_factor();
+ if (pan_axis == PAN_AXIS_HORIZONTAL) {
+ panning = Vector2(panning.x + panning.y, 0);
+ } else if (pan_axis == PAN_AXIS_VERTICAL) {
+ panning = Vector2(0, panning.x + panning.y);
+ } else if (mb->is_shift_pressed()) {
+ panning = Vector2(panning.y, panning.x);
}
- callback_helper(scroll_callback, varray(panning, mb->is_alt_pressed()));
+ callback_helper(pan_callback, varray(-panning * scroll_speed, p_event));
return true;
} else if (!mb->is_shift_pressed()) {
- scroll_vec.y *= mb->get_factor();
- callback_helper(zoom_callback, varray(scroll_vec, mb->get_position(), mb->is_alt_pressed()));
+ // Compute the zoom factor.
+ float zoom_factor = mb->get_factor() <= 0 ? 1.0 : mb->get_factor();
+ zoom_factor = ((scroll_zoom_factor - 1.0) * zoom_factor) + 1.0;
+ float zoom = (scroll_vec.x + scroll_vec.y) > 0 ? 1.0 / scroll_zoom_factor : scroll_zoom_factor;
+ callback_helper(zoom_callback, varray(zoom, mb->get_position(), p_event));
return true;
}
}
@@ -102,14 +108,31 @@ bool ViewPanner::gui_input(const Ref<InputEvent> &p_event, Rect2 p_canvas_rect)
if (mm.is_valid()) {
if (is_dragging) {
if (p_canvas_rect != Rect2()) {
- callback_helper(pan_callback, varray(Input::get_singleton()->warp_mouse_motion(mm, p_canvas_rect)));
+ callback_helper(pan_callback, varray(Input::get_singleton()->warp_mouse_motion(mm, p_canvas_rect), p_event));
} else {
- callback_helper(pan_callback, varray(mm->get_relative()));
+ callback_helper(pan_callback, varray(mm->get_relative(), p_event));
}
return true;
}
}
+ Ref<InputEventMagnifyGesture> magnify_gesture = p_event;
+ if (magnify_gesture.is_valid()) {
+ // Zoom gesture
+ callback_helper(zoom_callback, varray(magnify_gesture->get_factor(), magnify_gesture->get_position(), p_event));
+ return true;
+ }
+
+ Ref<InputEventPanGesture> pan_gesture = p_event;
+ if (pan_gesture.is_valid()) {
+ callback_helper(pan_callback, varray(-pan_gesture->get_delta(), p_event));
+ }
+
+ Ref<InputEventScreenDrag> screen_drag = p_event;
+ if (screen_drag.is_valid()) {
+ callback_helper(pan_callback, varray(screen_drag->get_relative(), p_event));
+ }
+
Ref<InputEventKey> k = p_event;
if (k.is_valid()) {
if (pan_view_shortcut.is_valid() && pan_view_shortcut->matches_event(k)) {
@@ -140,8 +163,7 @@ void ViewPanner::callback_helper(Callable p_callback, Vector<Variant> p_args) {
p_callback.callp(argptr, p_args.size(), result, ce);
}
-void ViewPanner::set_callbacks(Callable p_scroll_callback, Callable p_pan_callback, Callable p_zoom_callback) {
- scroll_callback = p_scroll_callback;
+void ViewPanner::set_callbacks(Callable p_pan_callback, Callable p_zoom_callback) {
pan_callback = p_pan_callback;
zoom_callback = p_zoom_callback;
}
@@ -163,6 +185,20 @@ void ViewPanner::set_simple_panning_enabled(bool p_enabled) {
simple_panning_enabled = p_enabled;
}
+void ViewPanner::set_scroll_speed(int p_scroll_speed) {
+ ERR_FAIL_COND(p_scroll_speed <= 0);
+ scroll_speed = p_scroll_speed;
+}
+
+void ViewPanner::set_scroll_zoom_factor(float p_scroll_zoom_factor) {
+ ERR_FAIL_COND(p_scroll_zoom_factor <= 1.0);
+ scroll_zoom_factor = p_scroll_zoom_factor;
+}
+
+void ViewPanner::set_pan_axis(PanAxis p_pan_axis) {
+ pan_axis = p_pan_axis;
+}
+
void ViewPanner::setup(ControlScheme p_scheme, Ref<Shortcut> p_shortcut, bool p_simple_panning) {
set_control_scheme(p_scheme);
set_pan_shortcut(p_shortcut);
diff --git a/scene/gui/view_panner.h b/scene/gui/view_panner.h
index 861574a80c..60d36ca04c 100644
--- a/scene/gui/view_panner.h
+++ b/scene/gui/view_panner.h
@@ -45,7 +45,17 @@ public:
SCROLL_PANS,
};
+ enum PanAxis {
+ PAN_AXIS_BOTH,
+ PAN_AXIS_HORIZONTAL,
+ PAN_AXIS_VERTICAL,
+ };
+
private:
+ int scroll_speed = 32;
+ float scroll_zoom_factor = 1.1;
+ PanAxis pan_axis = PAN_AXIS_BOTH;
+
bool is_dragging = false;
bool pan_key_pressed = false;
bool force_drag = false;
@@ -55,7 +65,6 @@ private:
Ref<Shortcut> pan_view_shortcut;
- Callable scroll_callback;
Callable pan_callback;
Callable zoom_callback;
@@ -63,11 +72,14 @@ private:
ControlScheme control_scheme = SCROLL_ZOOMS;
public:
- void set_callbacks(Callable p_scroll_callback, Callable p_pan_callback, Callable p_zoom_callback);
+ void set_callbacks(Callable p_pan_callback, Callable p_zoom_callback);
void set_control_scheme(ControlScheme p_scheme);
void set_enable_rmb(bool p_enable);
void set_pan_shortcut(Ref<Shortcut> p_shortcut);
void set_simple_panning_enabled(bool p_enabled);
+ void set_scroll_speed(int p_scroll_speed);
+ void set_scroll_zoom_factor(float p_scroll_zoom_factor);
+ void set_pan_axis(PanAxis p_pan_axis);
void setup(ControlScheme p_scheme, Ref<Shortcut> p_shortcut, bool p_simple_panning);
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index a4af7988c6..cde3503bdf 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -154,17 +154,7 @@ Transform2D CanvasItem::get_global_transform_with_canvas() const {
Transform2D CanvasItem::get_screen_transform() const {
ERR_FAIL_COND_V(!is_inside_tree(), Transform2D());
- Transform2D xform = get_global_transform_with_canvas();
-
- Window *w = Object::cast_to<Window>(get_viewport());
- if (w && !w->is_embedding_subwindows()) {
- Transform2D s;
- s.set_origin(w->get_position());
-
- xform = s * xform;
- }
-
- return xform;
+ return get_viewport()->get_popup_base_transform() * get_global_transform_with_canvas();
}
Transform2D CanvasItem::get_global_transform() const {
@@ -388,6 +378,16 @@ Color CanvasItem::get_modulate() const {
return modulate;
}
+Color CanvasItem::get_modulate_in_tree() const {
+ Color final_modulate = modulate;
+ CanvasItem *parent_item = get_parent_item();
+ while (parent_item) {
+ final_modulate *= parent_item->get_modulate();
+ parent_item = parent_item->get_parent_item();
+ }
+ return final_modulate;
+}
+
void CanvasItem::set_as_top_level(bool p_top_level) {
if (top_level == p_top_level) {
return;
@@ -400,11 +400,28 @@ void CanvasItem::set_as_top_level(bool p_top_level) {
_exit_canvas();
top_level = p_top_level;
+ _toplevel_changed();
_enter_canvas();
_notify_transform();
}
+void CanvasItem::_toplevel_changed() {
+ // Inform children that toplevel status has changed on a parent.
+ int childs = get_child_count();
+ for (int i = 0; i < childs; i++) {
+ CanvasItem *child = Object::cast_to<CanvasItem>(get_child(i));
+ if (child) {
+ child->_toplevel_changed_on_parent();
+ }
+ }
+}
+
+void CanvasItem::_toplevel_changed_on_parent() {
+ // Inform children that toplevel status has changed on a parent.
+ _toplevel_changed();
+}
+
bool CanvasItem::is_set_as_top_level() const {
return top_level;
}
@@ -560,44 +577,47 @@ void CanvasItem::draw_multiline_colors(const Vector<Point2> &p_points, const Vec
void CanvasItem::draw_rect(const Rect2 &p_rect, const Color &p_color, bool p_filled, real_t p_width) {
ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
+ Rect2 rect = p_rect.abs();
+
if (p_filled) {
if (p_width != -1.0) {
WARN_PRINT("The draw_rect() \"width\" argument has no effect when \"filled\" is \"true\".");
}
- RenderingServer::get_singleton()->canvas_item_add_rect(canvas_item, p_rect, p_color);
+ RenderingServer::get_singleton()->canvas_item_add_rect(canvas_item, rect, p_color);
+ } else if (p_width >= rect.size.width || p_width >= rect.size.height) {
+ RenderingServer::get_singleton()->canvas_item_add_rect(canvas_item, rect.grow(0.5f * p_width), p_color);
} else {
// Thick lines are offset depending on their width to avoid partial overlapping.
- // Thin lines don't require an offset, so don't apply one in this case
- real_t offset;
- if (p_width >= 0) {
- offset = p_width / 2.0;
- } else {
- offset = 0.0;
- }
+ // Thin lines are drawn without offset. The result may not be perfect.
+ real_t offset = (p_width >= 0) ? 0.5f * p_width : 0.0f;
+ // Top line.
RenderingServer::get_singleton()->canvas_item_add_line(
canvas_item,
- p_rect.position + Size2(-offset, 0),
- p_rect.position + Size2(p_rect.size.width + offset, 0),
+ rect.position + Size2(-offset, 0),
+ rect.position + Size2(-offset + rect.size.width, 0),
p_color,
p_width);
+ // Right line.
RenderingServer::get_singleton()->canvas_item_add_line(
canvas_item,
- p_rect.position + Size2(p_rect.size.width, offset),
- p_rect.position + Size2(p_rect.size.width, p_rect.size.height - offset),
+ rect.position + Size2(rect.size.width, -offset),
+ rect.position + Size2(rect.size.width, -offset + rect.size.height),
p_color,
p_width);
+ // Bottom line.
RenderingServer::get_singleton()->canvas_item_add_line(
canvas_item,
- p_rect.position + Size2(p_rect.size.width + offset, p_rect.size.height),
- p_rect.position + Size2(-offset, p_rect.size.height),
+ rect.position + Size2(offset + rect.size.width, rect.size.height),
+ rect.position + Size2(offset, rect.size.height),
p_color,
p_width);
+ // Left line.
RenderingServer::get_singleton()->canvas_item_add_line(
canvas_item,
- p_rect.position + Size2(0, p_rect.size.height - offset),
- p_rect.position + Size2(0, offset),
+ rect.position + Size2(0, offset + rect.size.height),
+ rect.position + Size2(0, offset),
p_color,
p_width);
}
@@ -914,6 +934,12 @@ void CanvasItem::force_update_transform() {
notification(NOTIFICATION_TRANSFORM_CHANGED);
}
+void CanvasItem::_validate_property(PropertyInfo &p_property) const {
+ if (hide_clip_children && p_property.name == "clip_children") {
+ p_property.usage = PROPERTY_USAGE_NONE;
+ }
+}
+
void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("_top_level_raise_self"), &CanvasItem::_top_level_raise_self);
@@ -973,9 +999,9 @@ void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("draw_line", "from", "to", "color", "width", "antialiased"), &CanvasItem::draw_line, DEFVAL(-1.0), DEFVAL(false));
ClassDB::bind_method(D_METHOD("draw_dashed_line", "from", "to", "color", "width", "dash", "aligned"), &CanvasItem::draw_dashed_line, DEFVAL(-1.0), DEFVAL(2.0), DEFVAL(true));
- ClassDB::bind_method(D_METHOD("draw_polyline", "points", "color", "width", "antialiased"), &CanvasItem::draw_polyline, DEFVAL(1.0), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("draw_polyline_colors", "points", "colors", "width", "antialiased"), &CanvasItem::draw_polyline_colors, DEFVAL(1.0), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("draw_arc", "center", "radius", "start_angle", "end_angle", "point_count", "color", "width", "antialiased"), &CanvasItem::draw_arc, DEFVAL(1.0), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("draw_polyline", "points", "color", "width", "antialiased"), &CanvasItem::draw_polyline, DEFVAL(-1.0), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("draw_polyline_colors", "points", "colors", "width", "antialiased"), &CanvasItem::draw_polyline_colors, DEFVAL(-1.0), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("draw_arc", "center", "radius", "start_angle", "end_angle", "point_count", "color", "width", "antialiased"), &CanvasItem::draw_arc, DEFVAL(-1.0), DEFVAL(false));
ClassDB::bind_method(D_METHOD("draw_multiline", "points", "color", "width"), &CanvasItem::draw_multiline, DEFVAL(-1.0));
ClassDB::bind_method(D_METHOD("draw_multiline_colors", "points", "colors", "width"), &CanvasItem::draw_multiline_colors, DEFVAL(-1.0));
ClassDB::bind_method(D_METHOD("draw_rect", "rect", "color", "filled", "width"), &CanvasItem::draw_rect, DEFVAL(true), DEFVAL(-1.0));
diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h
index b2c12b2ea2..1ddfaa288c 100644
--- a/scene/main/canvas_item.h
+++ b/scene/main/canvas_item.h
@@ -106,6 +106,7 @@ private:
bool use_parent_material = false;
bool notify_local_transform = false;
bool notify_transform = false;
+ bool hide_clip_children = false;
ClipChildrenMode clip_children_mode = CLIP_CHILDREN_DISABLED;
@@ -124,6 +125,9 @@ private:
void _propagate_visibility_changed(bool p_parent_visible_in_tree);
void _handle_visibility_change(bool p_visible);
+ virtual void _toplevel_changed();
+ virtual void _toplevel_changed_on_parent();
+
void _redraw_callback();
void _enter_canvas();
@@ -155,6 +159,9 @@ protected:
void _notification(int p_what);
static void _bind_methods();
+ void _validate_property(PropertyInfo &p_property) const;
+
+ _FORCE_INLINE_ void set_hide_clip_children(bool p_value) { hide_clip_children = p_value; }
GDVIRTUAL0(_draw)
public:
@@ -224,6 +231,7 @@ public:
void set_modulate(const Color &p_modulate);
Color get_modulate() const;
+ Color get_modulate_in_tree() const;
void set_self_modulate(const Color &p_self_modulate);
Color get_self_modulate() const;
@@ -249,9 +257,9 @@ public:
void draw_dashed_line(const Point2 &p_from, const Point2 &p_to, const Color &p_color, real_t p_width = -1.0, real_t p_dash = 2.0, bool p_aligned = true);
void draw_line(const Point2 &p_from, const Point2 &p_to, const Color &p_color, real_t p_width = -1.0, bool p_antialiased = false);
- void draw_polyline(const Vector<Point2> &p_points, const Color &p_color, real_t p_width = 1.0, bool p_antialiased = false);
- void draw_polyline_colors(const Vector<Point2> &p_points, const Vector<Color> &p_colors, real_t p_width = 1.0, bool p_antialiased = false);
- void draw_arc(const Vector2 &p_center, real_t p_radius, real_t p_start_angle, real_t p_end_angle, int p_point_count, const Color &p_color, real_t p_width = 1.0, bool p_antialiased = false);
+ void draw_polyline(const Vector<Point2> &p_points, const Color &p_color, real_t p_width = -1.0, bool p_antialiased = false);
+ void draw_polyline_colors(const Vector<Point2> &p_points, const Vector<Color> &p_colors, real_t p_width = -1.0, bool p_antialiased = false);
+ void draw_arc(const Vector2 &p_center, real_t p_radius, real_t p_start_angle, real_t p_end_angle, int p_point_count, const Color &p_color, real_t p_width = -1.0, bool p_antialiased = false);
void draw_multiline(const Vector<Point2> &p_points, const Color &p_color, real_t p_width = -1.0);
void draw_multiline_colors(const Vector<Point2> &p_points, const Vector<Color> &p_colors, real_t p_width = -1.0);
void draw_rect(const Rect2 &p_rect, const Color &p_color, bool p_filled = true, real_t p_width = -1.0);
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index 46ba7e67eb..0d53f740db 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -33,7 +33,7 @@
#include "scene/main/timer.h"
Error HTTPRequest::_request() {
- return client->connect_to_host(url, port, use_tls, validate_tls);
+ return client->connect_to_host(url, port, use_tls ? tls_options : nullptr);
}
Error HTTPRequest::_parse_url(const String &p_url) {
@@ -96,7 +96,7 @@ String HTTPRequest::get_header_value(const PackedStringArray &p_headers, const S
return value;
}
-Error HTTPRequest::request(const String &p_url, const Vector<String> &p_custom_headers, bool p_tls_validate_domain, HTTPClient::Method p_method, const String &p_request_data) {
+Error HTTPRequest::request(const String &p_url, const Vector<String> &p_custom_headers, HTTPClient::Method p_method, const String &p_request_data) {
// Copy the string into a raw buffer.
Vector<uint8_t> raw_data;
@@ -108,10 +108,10 @@ Error HTTPRequest::request(const String &p_url, const Vector<String> &p_custom_h
memcpy(w, charstr.ptr(), len);
}
- return request_raw(p_url, p_custom_headers, p_tls_validate_domain, p_method, raw_data);
+ return request_raw(p_url, p_custom_headers, p_method, raw_data);
}
-Error HTTPRequest::request_raw(const String &p_url, const Vector<String> &p_custom_headers, bool p_tls_validate_domain, HTTPClient::Method p_method, const Vector<uint8_t> &p_request_data_raw) {
+Error HTTPRequest::request_raw(const String &p_url, const Vector<String> &p_custom_headers, HTTPClient::Method p_method, const Vector<uint8_t> &p_request_data_raw) {
ERR_FAIL_COND_V(!is_inside_tree(), ERR_UNCONFIGURED);
ERR_FAIL_COND_V_MSG(requesting, ERR_BUSY, "HTTPRequest is processing a request. Wait for completion or cancel it before attempting a new one.");
@@ -127,8 +127,6 @@ Error HTTPRequest::request_raw(const String &p_url, const Vector<String> &p_cust
return err;
}
- validate_tls = p_tls_validate_domain;
-
headers = p_custom_headers;
if (accept_gzip) {
@@ -590,10 +588,16 @@ void HTTPRequest::_timeout() {
_defer_done(RESULT_TIMEOUT, 0, PackedStringArray(), PackedByteArray());
}
+void HTTPRequest::set_tls_options(const Ref<TLSOptions> &p_options) {
+ ERR_FAIL_COND(p_options.is_null() || p_options->is_server());
+ tls_options = p_options;
+}
+
void HTTPRequest::_bind_methods() {
- ClassDB::bind_method(D_METHOD("request", "url", "custom_headers", "tls_validate_domain", "method", "request_data"), &HTTPRequest::request, DEFVAL(PackedStringArray()), DEFVAL(true), DEFVAL(HTTPClient::METHOD_GET), DEFVAL(String()));
- ClassDB::bind_method(D_METHOD("request_raw", "url", "custom_headers", "tls_validate_domain", "method", "request_data_raw"), &HTTPRequest::request_raw, DEFVAL(PackedStringArray()), DEFVAL(true), DEFVAL(HTTPClient::METHOD_GET), DEFVAL(PackedByteArray()));
+ ClassDB::bind_method(D_METHOD("request", "url", "custom_headers", "method", "request_data"), &HTTPRequest::request, DEFVAL(PackedStringArray()), DEFVAL(HTTPClient::METHOD_GET), DEFVAL(String()));
+ ClassDB::bind_method(D_METHOD("request_raw", "url", "custom_headers", "method", "request_data_raw"), &HTTPRequest::request_raw, DEFVAL(PackedStringArray()), DEFVAL(HTTPClient::METHOD_GET), DEFVAL(PackedByteArray()));
ClassDB::bind_method(D_METHOD("cancel_request"), &HTTPRequest::cancel_request);
+ ClassDB::bind_method(D_METHOD("set_tls_options", "client_options"), &HTTPRequest::set_tls_options);
ClassDB::bind_method(D_METHOD("get_http_client_status"), &HTTPRequest::get_http_client_status);
@@ -654,6 +658,7 @@ void HTTPRequest::_bind_methods() {
HTTPRequest::HTTPRequest() {
client = Ref<HTTPClient>(HTTPClient::create());
+ tls_options = TLSOptions::client();
timer = memnew(Timer);
timer->set_one_shot(true);
timer->connect("timeout", callable_mp(this, &HTTPRequest::_timeout));
diff --git a/scene/main/http_request.h b/scene/main/http_request.h
index add4e9538d..9a91171eaf 100644
--- a/scene/main/http_request.h
+++ b/scene/main/http_request.h
@@ -68,8 +68,8 @@ private:
String url;
int port = 80;
Vector<String> headers;
- bool validate_tls = false;
bool use_tls = false;
+ Ref<TLSOptions> tls_options;
HTTPClient::Method method;
Vector<uint8_t> request_data;
@@ -125,8 +125,8 @@ protected:
static void _bind_methods();
public:
- Error request(const String &p_url, const Vector<String> &p_custom_headers = Vector<String>(), bool p_tls_validate_domain = true, HTTPClient::Method p_method = HTTPClient::METHOD_GET, const String &p_request_data = ""); //connects to a full url and perform request
- Error request_raw(const String &p_url, const Vector<String> &p_custom_headers = Vector<String>(), bool p_tls_validate_domain = true, HTTPClient::Method p_method = HTTPClient::METHOD_GET, const Vector<uint8_t> &p_request_data_raw = Vector<uint8_t>()); //connects to a full url and perform request
+ Error request(const String &p_url, const Vector<String> &p_custom_headers = Vector<String>(), HTTPClient::Method p_method = HTTPClient::METHOD_GET, const String &p_request_data = ""); //connects to a full url and perform request
+ Error request_raw(const String &p_url, const Vector<String> &p_custom_headers = Vector<String>(), HTTPClient::Method p_method = HTTPClient::METHOD_GET, const Vector<uint8_t> &p_request_data_raw = Vector<uint8_t>()); //connects to a full url and perform request
void cancel_request();
HTTPClient::Status get_http_client_status() const;
@@ -161,6 +161,8 @@ public:
void set_http_proxy(const String &p_host, int p_port);
void set_https_proxy(const String &p_host, int p_port);
+ void set_tls_options(const Ref<TLSOptions> &p_options);
+
HTTPRequest();
};
diff --git a/scene/main/multiplayer_api.cpp b/scene/main/multiplayer_api.cpp
index e36cbc4414..c54e61580f 100644
--- a/scene/main/multiplayer_api.cpp
+++ b/scene/main/multiplayer_api.cpp
@@ -135,7 +135,7 @@ Error MultiplayerAPI::encode_and_compress_variant(const Variant &p_variant, uint
return err;
}
if (r_buffer) {
- // The first byte is not used by the marshalling, so store the type
+ // The first byte is not used by the marshaling, so store the type
// so we know how to decompress and decode this variant.
r_buffer[0] = p_variant.get_type();
}
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index eb57ccfef1..ba75c92c85 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -279,7 +279,10 @@ void Node::_propagate_exit_tree() {
//block while removing children
#ifdef DEBUG_ENABLED
- SceneDebugger::remove_from_cache(data.scene_file_path, this);
+ if (!data.scene_file_path.is_empty()) {
+ // Only remove if file path is set (optimization).
+ SceneDebugger::remove_from_cache(data.scene_file_path, this);
+ }
#endif
data.blocked++;
@@ -305,7 +308,6 @@ void Node::_propagate_exit_tree() {
}
// exit groups
-
for (KeyValue<StringName, GroupData> &E : data.grouped) {
data.tree->remove_from_group(E.key, this);
E.value.group = nullptr;
@@ -944,7 +946,7 @@ String Node::validate_child_name(Node *p_child) {
#endif
String Node::adjust_name_casing(const String &p_name) {
- switch (GLOBAL_GET("editor/node_naming/name_casing").operator int()) {
+ switch (GLOBAL_GET("editor/naming/node_name_casing").operator int()) {
case NAME_CASING_PASCAL_CASE:
return p_name.to_pascal_case();
case NAME_CASING_CAMEL_CASE:
@@ -1166,7 +1168,7 @@ void Node::add_sibling(Node *p_sibling, bool p_force_readable_name) {
void Node::remove_child(Node *p_child) {
ERR_FAIL_NULL(p_child);
- ERR_FAIL_COND_MSG(data.blocked > 0, "Parent node is busy setting up children, `remove_child()` failed. Consider using `remove_child.call_deferred(child)` instead.");
+ ERR_FAIL_COND_MSG(data.blocked > 0, "Parent node is busy adding/removing children, `remove_child()` can't be called at this time. Consider using `remove_child.call_deferred(child)` instead.");
int child_count = data.children.size();
Node **children = data.children.ptrw();
@@ -1197,11 +1199,13 @@ void Node::remove_child(Node *p_child) {
data.internal_children_back--;
}
+ data.blocked++;
p_child->_set_tree(nullptr);
//}
remove_child_notify(p_child);
p_child->notification(NOTIFICATION_UNPARENTED);
+ data.blocked--;
data.children.remove_at(idx);
@@ -1983,7 +1987,16 @@ String Node::get_scene_file_path() const {
}
void Node::set_editor_description(const String &p_editor_description) {
+ if (data.editor_description == p_editor_description) {
+ return;
+ }
+
data.editor_description = p_editor_description;
+
+ if (Engine::get_singleton()->is_editor_hint() && is_inside_tree()) {
+ // Update tree so the tooltip in the Scene tree dock is also updated in the editor.
+ get_tree()->tree_changed();
+ }
}
String Node::get_editor_description() const {
@@ -2209,7 +2222,7 @@ Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) c
Variant value = N->get()->get(name).duplicate(true);
- if (E.usage & PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE) {
+ if (E.usage & PROPERTY_USAGE_ALWAYS_DUPLICATE) {
Resource *res = Object::cast_to<Resource>(value);
if (res) { // Duplicate only if it's a resource
current_node->set(name, res->duplicate());
@@ -2795,8 +2808,8 @@ void Node::unhandled_key_input(const Ref<InputEvent> &p_key_event) {
}
void Node::_bind_methods() {
- GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/node_naming/name_num_separator", PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash"), 0);
- GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/node_naming/name_casing", PROPERTY_HINT_ENUM, "PascalCase,camelCase,snake_case"), NAME_CASING_PASCAL_CASE);
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/naming/node_name_num_separator", PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash"), 0);
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/naming/node_name_casing", PROPERTY_HINT_ENUM, "PascalCase,camelCase,snake_case"), NAME_CASING_PASCAL_CASE);
ClassDB::bind_static_method("Node", D_METHOD("print_orphan_nodes"), &Node::print_orphan_nodes);
ClassDB::bind_method(D_METHOD("add_sibling", "sibling", "force_readable_name"), &Node::add_sibling, DEFVAL(false));
@@ -2943,6 +2956,7 @@ void Node::_bind_methods() {
BIND_CONSTANT(NOTIFICATION_POST_ENTER_TREE);
BIND_CONSTANT(NOTIFICATION_DISABLED);
BIND_CONSTANT(NOTIFICATION_ENABLED);
+ BIND_CONSTANT(NOTIFICATION_NODE_RECACHE_REQUESTED);
BIND_CONSTANT(NOTIFICATION_EDITOR_PRE_SAVE);
BIND_CONSTANT(NOTIFICATION_EDITOR_POST_SAVE);
@@ -3017,7 +3031,7 @@ void Node::_bind_methods() {
}
String Node::_get_name_num_separator() {
- switch (GLOBAL_GET("editor/node_naming/name_num_separator").operator int()) {
+ switch (GLOBAL_GET("editor/naming/node_name_num_separator").operator int()) {
case 0:
return "";
case 1:
diff --git a/scene/main/node.h b/scene/main/node.h
index dbdcca6170..493578bc5b 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -270,6 +270,7 @@ public:
NOTIFICATION_POST_ENTER_TREE = 27,
NOTIFICATION_DISABLED = 28,
NOTIFICATION_ENABLED = 29,
+ NOTIFICATION_NODE_RECACHE_REQUESTED = 30,
//keep these linked to node
NOTIFICATION_WM_MOUSE_ENTER = 1002,
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 9efe649e6f..48cff5aa8e 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -704,25 +704,15 @@ void Viewport::_process_picking() {
}
#ifndef _3D_DISABLED
- bool captured = false;
-
+ CollisionObject3D *capture_object = nullptr;
if (physics_object_capture.is_valid()) {
- CollisionObject3D *co = Object::cast_to<CollisionObject3D>(ObjectDB::get_instance(physics_object_capture));
- if (co && camera_3d) {
- _collision_object_3d_input_event(co, camera_3d, ev, Vector3(), Vector3(), 0);
- captured = true;
- if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && !mb->is_pressed()) {
- physics_object_capture = ObjectID();
- }
-
- } else {
+ capture_object = Object::cast_to<CollisionObject3D>(ObjectDB::get_instance(physics_object_capture));
+ if (!capture_object || !camera_3d || (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && !mb->is_pressed())) {
physics_object_capture = ObjectID();
}
}
- if (captured) {
- // None.
- } else if (pos == last_pos) {
+ if (pos == last_pos) {
if (last_id.is_valid()) {
if (ObjectDB::get_instance(last_id) && last_object) {
// Good, exists.
@@ -748,13 +738,12 @@ void Viewport::_process_picking() {
bool col = space->intersect_ray(ray_params, result);
ObjectID new_collider;
- if (col) {
- CollisionObject3D *co = Object::cast_to<CollisionObject3D>(result.collider);
- if (co && co->can_process()) {
- _collision_object_3d_input_event(co, camera_3d, ev, result.position, result.normal, result.shape);
+ CollisionObject3D *co = col ? Object::cast_to<CollisionObject3D>(result.collider) : nullptr;
+ if (co && co->can_process()) {
+ new_collider = result.collider_id;
+ if (!capture_object) {
last_object = co;
last_id = result.collider_id;
- new_collider = last_id;
if (co->get_capture_input_on_drag() && mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && mb->is_pressed()) {
physics_object_capture = last_id;
}
@@ -763,21 +752,24 @@ void Viewport::_process_picking() {
if (is_mouse && new_collider != physics_object_over) {
if (physics_object_over.is_valid()) {
- CollisionObject3D *co = Object::cast_to<CollisionObject3D>(ObjectDB::get_instance(physics_object_over));
- if (co) {
- co->_mouse_exit();
+ CollisionObject3D *previous_co = Object::cast_to<CollisionObject3D>(ObjectDB::get_instance(physics_object_over));
+ if (previous_co) {
+ previous_co->_mouse_exit();
}
}
if (new_collider.is_valid()) {
- CollisionObject3D *co = Object::cast_to<CollisionObject3D>(ObjectDB::get_instance(new_collider));
- if (co) {
- co->_mouse_enter();
- }
+ DEV_ASSERT(co);
+ co->_mouse_enter();
}
physics_object_over = new_collider;
}
+ if (capture_object) {
+ _collision_object_3d_input_event(capture_object, camera_3d, ev, result.position, result.normal, result.shape);
+ } else if (new_collider.is_valid()) {
+ _collision_object_3d_input_event(co, camera_3d, ev, result.position, result.normal, result.shape);
+ }
}
last_pos = pos;
@@ -1050,7 +1042,7 @@ Camera2D *Viewport::get_camera_2d() const {
}
Transform2D Viewport::get_final_transform() const {
- return stretch_transform * global_canvas_transform;
+ return _get_input_pre_xform().affine_inverse() * stretch_transform * global_canvas_transform;
}
void Viewport::_update_canvas_items(Node *p_node) {
@@ -1133,7 +1125,7 @@ Ref<InputEvent> Viewport::_make_input_local(const Ref<InputEvent> &ev) {
return ev; // No transformation defined for null event
}
- Transform2D ai = get_final_transform().affine_inverse() * _get_input_pre_xform();
+ Transform2D ai = get_final_transform().affine_inverse();
return ev->xformed_by(ai);
}
@@ -1795,9 +1787,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
if (w->is_embedded()) {
embedder = w->_get_embedder();
- Transform2D ai = (get_final_transform().affine_inverse() * _get_input_pre_xform()).affine_inverse();
-
- viewport_pos = ai.xform(mpos) + w->get_position(); // To parent coords.
+ viewport_pos = get_final_transform().xform(mpos) + w->get_position(); // To parent coords.
}
}
}
@@ -1847,7 +1837,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
if (viewport_under) {
if (viewport_under != this) {
- Transform2D ai = (viewport_under->get_final_transform().affine_inverse() * viewport_under->_get_input_pre_xform());
+ Transform2D ai = viewport_under->get_final_transform().affine_inverse();
viewport_pos = ai.xform(viewport_pos);
}
// Find control under at position.
@@ -2853,7 +2843,7 @@ bool Viewport::get_physics_object_picking() {
}
Vector2 Viewport::get_camera_coords(const Vector2 &p_viewport_coords) const {
- Transform2D xf = get_final_transform();
+ Transform2D xf = stretch_transform * global_canvas_transform;
return xf.xform(p_viewport_coords);
}
@@ -3245,7 +3235,7 @@ Viewport::SDFScale Viewport::get_sdf_scale() const {
}
Transform2D Viewport::get_screen_transform() const {
- return _get_input_pre_xform().affine_inverse() * get_final_transform();
+ return get_final_transform();
}
void Viewport::set_canvas_cull_mask(uint32_t p_canvas_cull_mask) {
@@ -3916,7 +3906,7 @@ void Viewport::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_debanding"), "set_use_debanding", "is_using_debanding");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_occlusion_culling"), "set_use_occlusion_culling", "is_using_occlusion_culling");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mesh_lod_threshold", PROPERTY_HINT_RANGE, "0,1024,0.1"), "set_mesh_lod_threshold", "get_mesh_lod_threshold");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "debug_draw", PROPERTY_HINT_ENUM, "Disabled,Unshaded,Overdraw,Wireframe"), "set_debug_draw", "get_debug_draw");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "debug_draw", PROPERTY_HINT_ENUM, "Disabled,Unshaded,Lighting,Overdraw,Wireframe"), "set_debug_draw", "get_debug_draw");
#ifndef _3D_DISABLED
ADD_GROUP("Scaling 3D", "");
ADD_PROPERTY(PropertyInfo(Variant::INT, "scaling_3d_mode", PROPERTY_HINT_ENUM, "Bilinear (Fastest),FSR 1.0 (Fast)"), "set_scaling_3d_mode", "get_scaling_3d_mode");
@@ -4188,6 +4178,21 @@ Transform2D SubViewport::get_screen_transform() const {
return container_transform * Viewport::get_screen_transform();
}
+Transform2D SubViewport::get_popup_base_transform() const {
+ if (is_embedding_subwindows()) {
+ return Transform2D();
+ }
+ SubViewportContainer *c = Object::cast_to<SubViewportContainer>(get_parent());
+ if (!c) {
+ return Viewport::get_screen_transform();
+ }
+ Transform2D container_transform;
+ if (c->is_stretch_enabled()) {
+ container_transform.scale(Vector2(c->get_stretch_shrink(), c->get_stretch_shrink()));
+ }
+ return c->get_screen_transform() * container_transform * Viewport::get_screen_transform();
+}
+
void SubViewport::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 603e92b071..d5d5201e9a 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -649,6 +649,7 @@ public:
bool get_canvas_cull_mask_bit(uint32_t p_layer) const;
virtual Transform2D get_screen_transform() const;
+ virtual Transform2D get_popup_base_transform() const { return Transform2D(); }
#ifndef _3D_DISABLED
bool use_xr = false;
@@ -775,6 +776,7 @@ public:
ClearMode get_clear_mode() const;
virtual Transform2D get_screen_transform() const override;
+ virtual Transform2D get_popup_base_transform() const override;
SubViewport();
~SubViewport();
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index 4baedc8c14..869d12b4df 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -227,7 +227,7 @@ void Window::_validate_property(PropertyInfo &p_property) const {
p_property.usage = PROPERTY_USAGE_NONE;
}
- if (p_property.name == "current_screen" && initial_position != WINDOW_INITIAL_POSITION_CENTER_SCREEN) {
+ if (p_property.name == "current_screen" && initial_position != WINDOW_INITIAL_POSITION_CENTER_OTHER_SCREEN) {
p_property.usage = PROPERTY_USAGE_NONE;
}
@@ -482,7 +482,11 @@ void Window::_make_window() {
Rect2i window_rect;
if (initial_position == WINDOW_INITIAL_POSITION_ABSOLUTE) {
window_rect = Rect2i(position, size);
- } else if (initial_position == WINDOW_INITIAL_POSITION_CENTER_SCREEN) {
+ } else if (initial_position == WINDOW_INITIAL_POSITION_CENTER_PRIMARY_SCREEN) {
+ window_rect = Rect2i(DisplayServer::get_singleton()->screen_get_position(DisplayServer::SCREEN_PRIMARY) + (DisplayServer::get_singleton()->screen_get_size(DisplayServer::SCREEN_PRIMARY) - size) / 2, size);
+ } else if (initial_position == WINDOW_INITIAL_POSITION_CENTER_MAIN_WINDOW_SCREEN) {
+ window_rect = Rect2i(DisplayServer::get_singleton()->screen_get_position(DisplayServer::SCREEN_OF_MAIN_WINDOW) + (DisplayServer::get_singleton()->screen_get_size(DisplayServer::SCREEN_OF_MAIN_WINDOW) - size) / 2, size);
+ } else if (initial_position == WINDOW_INITIAL_POSITION_CENTER_OTHER_SCREEN) {
window_rect = Rect2i(DisplayServer::get_singleton()->screen_get_position(current_screen) + (DisplayServer::get_singleton()->screen_get_size(current_screen) - size) / 2, size);
}
window_id = DisplayServer::get_singleton()->create_sub_window(DisplayServer::WindowMode(mode), vsync_mode, f, window_rect);
@@ -659,18 +663,18 @@ void Window::set_visible(bool p_visible) {
return;
}
- visible = p_visible;
-
if (!is_inside_tree()) {
+ visible = p_visible;
return;
}
- if (updating_child_controls) {
- _update_child_controls();
- }
-
ERR_FAIL_COND_MSG(get_parent() == nullptr, "Can't change visibility of main window.");
+ visible = p_visible;
+
+ // Stop any queued resizing, as the window will be resized right now.
+ updating_child_controls = false;
+
Viewport *embedder_vp = _get_embedder();
if (!embedder_vp) {
@@ -829,7 +833,7 @@ bool Window::is_visible() const {
}
void Window::_update_window_size() {
- // Force window to respect size limitations of rendering server
+ // Force window to respect size limitations of rendering server.
RenderingServer *rendering_server = RenderingServer::get_singleton();
if (rendering_server) {
Size2i max_window_size = rendering_server->get_maximum_viewport_size();
@@ -1126,6 +1130,7 @@ void Window::_notification(int p_what) {
case NOTIFICATION_READY: {
if (wrap_controls) {
+ // Finish any resizing immediately so it doesn't interfere on stuff overriding _ready().
_update_child_controls();
}
} break;
@@ -1134,9 +1139,7 @@ void Window::_notification(int p_what) {
_invalidate_theme_cache();
_update_theme_item_cache();
- if (embedder) {
- embedder->_sub_window_update(this);
- } else if (window_id != DisplayServer::INVALID_WINDOW_ID) {
+ if (!embedder && window_id != DisplayServer::INVALID_WINDOW_ID) {
String tr_title = atr(title);
#ifdef DEBUG_ENABLED
if (window_id == DisplayServer::MAIN_WINDOW_ID) {
@@ -1148,8 +1151,6 @@ void Window::_notification(int p_what) {
#endif
DisplayServer::get_singleton()->window_set_title(tr_title, window_id);
}
-
- child_controls_changed();
} break;
case NOTIFICATION_EXIT_TREE: {
@@ -1250,8 +1251,13 @@ Vector<Vector2> Window::get_mouse_passthrough_polygon() const {
void Window::set_wrap_controls(bool p_enable) {
wrap_controls = p_enable;
- if (wrap_controls) {
- child_controls_changed();
+
+ if (!is_inside_tree()) {
+ return;
+ }
+
+ if (updating_child_controls) {
+ _update_child_controls();
} else {
_update_window_size();
}
@@ -1278,23 +1284,23 @@ Size2 Window::_get_contents_minimum_size() const {
return max;
}
-void Window::_update_child_controls() {
- if (!updating_child_controls) {
+void Window::child_controls_changed() {
+ if (!is_inside_tree() || !visible || updating_child_controls) {
return;
}
- _update_window_size();
-
- updating_child_controls = false;
+ updating_child_controls = true;
+ call_deferred(SNAME("_update_child_controls"));
}
-void Window::child_controls_changed() {
- if (!is_inside_tree() || !visible || updating_child_controls) {
+void Window::_update_child_controls() {
+ if (!updating_child_controls) {
return;
}
- updating_child_controls = true;
- call_deferred(SNAME("_update_child_controls"));
+ _update_window_size();
+
+ updating_child_controls = false;
}
bool Window::_can_consume_input_events() const {
@@ -1643,7 +1649,24 @@ void Window::_invalidate_theme_cache() {
void Window::_update_theme_item_cache() {
// Request an update on the next frame to reflect theme changes.
// Updating without a delay can cause a lot of lag.
- child_controls_changed();
+ if (!wrap_controls) {
+ updating_embedded_window = true;
+ call_deferred(SNAME("_update_embedded_window"));
+ } else {
+ child_controls_changed();
+ }
+}
+
+void Window::_update_embedded_window() {
+ if (!updating_embedded_window) {
+ return;
+ }
+
+ if (embedder) {
+ embedder->_sub_window_update(this);
+ };
+
+ updating_embedded_window = false;
}
void Window::set_theme_type_variation(const StringName &p_theme_type) {
@@ -2100,6 +2123,19 @@ Transform2D Window::get_screen_transform() const {
return embedder_transform * Viewport::get_screen_transform();
}
+Transform2D Window::get_popup_base_transform() const {
+ if (is_embedding_subwindows()) {
+ return Transform2D();
+ }
+ Transform2D window_transform;
+ window_transform.set_origin(get_position());
+ window_transform *= Viewport::get_screen_transform();
+ if (_get_embedder()) {
+ return _get_embedder()->get_popup_base_transform() * window_transform;
+ }
+ return window_transform;
+}
+
void Window::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_title", "title"), &Window::set_title);
ClassDB::bind_method(D_METHOD("get_title"), &Window::get_title);
@@ -2184,6 +2220,7 @@ void Window::_bind_methods() {
ClassDB::bind_method(D_METHOD("child_controls_changed"), &Window::child_controls_changed);
ClassDB::bind_method(D_METHOD("_update_child_controls"), &Window::_update_child_controls);
+ ClassDB::bind_method(D_METHOD("_update_embedded_window"), &Window::_update_embedded_window);
ClassDB::bind_method(D_METHOD("set_theme", "theme"), &Window::set_theme);
ClassDB::bind_method(D_METHOD("get_theme"), &Window::get_theme);
@@ -2246,18 +2283,14 @@ void Window::_bind_methods() {
ClassDB::bind_method(D_METHOD("popup_centered", "minsize"), &Window::popup_centered, DEFVAL(Size2i()));
ClassDB::bind_method(D_METHOD("popup_centered_clamped", "minsize", "fallback_ratio"), &Window::popup_centered_clamped, DEFVAL(Size2i()), DEFVAL(0.75));
- ADD_PROPERTY(PropertyInfo(Variant::INT, "initial_position", PROPERTY_HINT_ENUM, "Absolute,Screen Center"), "set_initial_position", "get_initial_position");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "initial_position", PROPERTY_HINT_ENUM, "Absolute,Primary Screen Center,Main Window Screen Center,Other Screen Center"), "set_initial_position", "get_initial_position");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "title"), "set_title", "get_title");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "position", PROPERTY_HINT_NONE, "suffix:px"), "set_position", "get_position");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "size", PROPERTY_HINT_NONE, "suffix:px"), "set_size", "get_size");
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Windowed,Minimized,Maximized,Fullscreen"), "set_mode", "get_mode");
// Keep the enum values in sync with the `DisplayServer::SCREEN_` enum.
- String screen_hints = "Primary Monitor:-2,Main Window Monitor:-1";
- for (int i = 0; i < 64; i++) {
- screen_hints += ",Monitor " + itos(i + 1) + ":" + itos(i);
- }
- ADD_PROPERTY(PropertyInfo(Variant::INT, "current_screen", PROPERTY_HINT_ENUM, screen_hints), "set_current_screen", "get_current_screen");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "current_screen", PROPERTY_HINT_RANGE, "0,64,1,or_greater"), "set_current_screen", "get_current_screen");
ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "mouse_passthrough_polygon"), "set_mouse_passthrough_polygon", "get_mouse_passthrough_polygon");
@@ -2340,7 +2373,9 @@ void Window::_bind_methods() {
BIND_ENUM_CONSTANT(LAYOUT_DIRECTION_RTL);
BIND_ENUM_CONSTANT(WINDOW_INITIAL_POSITION_ABSOLUTE);
- BIND_ENUM_CONSTANT(WINDOW_INITIAL_POSITION_CENTER_SCREEN);
+ BIND_ENUM_CONSTANT(WINDOW_INITIAL_POSITION_CENTER_PRIMARY_SCREEN);
+ BIND_ENUM_CONSTANT(WINDOW_INITIAL_POSITION_CENTER_MAIN_WINDOW_SCREEN);
+ BIND_ENUM_CONSTANT(WINDOW_INITIAL_POSITION_CENTER_OTHER_SCREEN);
}
Window::Window() {
diff --git a/scene/main/window.h b/scene/main/window.h
index d819ca7c60..182caf5f0c 100644
--- a/scene/main/window.h
+++ b/scene/main/window.h
@@ -90,14 +90,16 @@ public:
enum WindowInitialPosition {
WINDOW_INITIAL_POSITION_ABSOLUTE,
- WINDOW_INITIAL_POSITION_CENTER_SCREEN,
+ WINDOW_INITIAL_POSITION_CENTER_PRIMARY_SCREEN,
+ WINDOW_INITIAL_POSITION_CENTER_MAIN_WINDOW_SCREEN,
+ WINDOW_INITIAL_POSITION_CENTER_OTHER_SCREEN,
};
private:
DisplayServer::WindowID window_id = DisplayServer::INVALID_WINDOW_ID;
String title;
- mutable int current_screen = DisplayServer::SCREEN_PRIMARY;
+ mutable int current_screen = 0;
mutable Vector2i position;
mutable Size2i size = Size2i(DEFAULT_WINDOW_SIZE, DEFAULT_WINDOW_SIZE);
mutable Size2i min_size;
@@ -114,6 +116,7 @@ private:
bool exclusive = false;
bool wrap_controls = false;
bool updating_child_controls = false;
+ bool updating_embedded_window = false;
bool clamp_to_embedder = false;
LayoutDirection layout_dir = LAYOUT_DIRECTION_INHERITED;
@@ -121,6 +124,7 @@ private:
bool auto_translate = true;
void _update_child_controls();
+ void _update_embedded_window();
Size2i content_scale_size;
ContentScaleMode content_scale_mode = CONTENT_SCALE_MODE_DISABLED;
@@ -371,6 +375,7 @@ public:
//
virtual Transform2D get_screen_transform() const override;
+ virtual Transform2D get_popup_base_transform() const override;
Rect2i get_parent_rect() const;
virtual DisplayServer::WindowID get_window_id() const override;
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index d56b94b6fe..39fc03f9f1 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -140,6 +140,7 @@
#include "scene/main/viewport.h"
#include "scene/main/window.h"
#include "scene/resources/animation_library.h"
+#include "scene/resources/audio_stream_polyphonic.h"
#include "scene/resources/audio_stream_wav.h"
#include "scene/resources/bit_map.h"
#include "scene/resources/bone_map.h"
@@ -392,6 +393,8 @@ void register_scene_types() {
GDREGISTER_CLASS(LineEdit);
GDREGISTER_CLASS(VideoStreamPlayer);
+ GDREGISTER_VIRTUAL_CLASS(VideoStreamPlayback);
+ GDREGISTER_VIRTUAL_CLASS(VideoStream);
#ifndef ADVANCED_GUI_DISABLED
GDREGISTER_CLASS(FileDialog);
@@ -905,8 +908,9 @@ void register_scene_types() {
#ifndef _3D_DISABLED
GDREGISTER_CLASS(AudioStreamPlayer3D);
#endif
- GDREGISTER_ABSTRACT_CLASS(VideoStream);
GDREGISTER_CLASS(AudioStreamWAV);
+ GDREGISTER_CLASS(AudioStreamPolyphonic);
+ GDREGISTER_ABSTRACT_CLASS(AudioStreamPlaybackPolyphonic);
OS::get_singleton()->yield(); // may take time to init
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index b371266c83..bfbc92a8d4 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -127,6 +127,10 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
}
}
return true;
+ } else if (what == "use_blend") {
+ if (track_get_type(track) == TYPE_AUDIO) {
+ audio_track_set_use_blend(track, p_value);
+ }
} else if (what == "interp") {
track_set_interpolation_type(track, InterpolationType(p_value.operator int()));
} else if (what == "loop_wrap") {
@@ -528,7 +532,10 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
}
return true;
-
+ } else if (what == "use_blend") {
+ if (track_get_type(track) == TYPE_AUDIO) {
+ r_ret = audio_track_is_use_blend(track);
+ }
} else if (what == "interp") {
r_ret = track_get_interpolation_type(track);
} else if (what == "loop_wrap") {
@@ -834,6 +841,9 @@ void Animation::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::BOOL, "tracks/" + itos(i) + "/loop_wrap", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL));
p_list->push_back(PropertyInfo(Variant::ARRAY, "tracks/" + itos(i) + "/keys", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL));
}
+ if (track_get_type(i) == TYPE_AUDIO) {
+ p_list->push_back(PropertyInfo(Variant::BOOL, "tracks/" + itos(i) + "/use_blend", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL));
+ }
}
}
@@ -3581,6 +3591,27 @@ real_t Animation::audio_track_get_key_end_offset(int p_track, int p_key) const {
return at->values[p_key].value.end_offset;
}
+void Animation::audio_track_set_use_blend(int p_track, bool p_enable) {
+ ERR_FAIL_INDEX(p_track, tracks.size());
+ Track *t = tracks[p_track];
+ ERR_FAIL_COND(t->type != TYPE_AUDIO);
+
+ AudioTrack *at = static_cast<AudioTrack *>(t);
+
+ at->use_blend = p_enable;
+ emit_changed();
+}
+
+bool Animation::audio_track_is_use_blend(int p_track) const {
+ ERR_FAIL_INDEX_V(p_track, tracks.size(), false);
+ Track *t = tracks[p_track];
+ ERR_FAIL_COND_V(t->type != TYPE_AUDIO, false);
+
+ AudioTrack *at = static_cast<AudioTrack *>(t);
+
+ return at->use_blend;
+}
+
//
int Animation::animation_track_insert_key(int p_track, double p_time, const StringName &p_animation) {
@@ -3813,6 +3844,8 @@ void Animation::_bind_methods() {
ClassDB::bind_method(D_METHOD("audio_track_get_key_stream", "track_idx", "key_idx"), &Animation::audio_track_get_key_stream);
ClassDB::bind_method(D_METHOD("audio_track_get_key_start_offset", "track_idx", "key_idx"), &Animation::audio_track_get_key_start_offset);
ClassDB::bind_method(D_METHOD("audio_track_get_key_end_offset", "track_idx", "key_idx"), &Animation::audio_track_get_key_end_offset);
+ ClassDB::bind_method(D_METHOD("audio_track_set_use_blend", "track_idx", "enable"), &Animation::audio_track_set_use_blend);
+ ClassDB::bind_method(D_METHOD("audio_track_is_use_blend", "track_idx"), &Animation::audio_track_is_use_blend);
ClassDB::bind_method(D_METHOD("animation_track_insert_key", "track_idx", "time", "animation"), &Animation::animation_track_insert_key);
ClassDB::bind_method(D_METHOD("animation_track_set_key_animation", "track_idx", "key_idx", "animation"), &Animation::animation_track_set_key_animation);
@@ -4691,6 +4724,7 @@ void Animation::compress(uint32_t p_page_size, uint32_t p_fps, float p_split_tol
data_tracks.resize(tracks_to_compress.size());
time_tracks.resize(tracks_to_compress.size());
+ uint32_t needed_min_page_size = base_page_size;
for (uint32_t i = 0; i < data_tracks.size(); i++) {
data_tracks[i].split_tolerance = p_split_tolerance;
if (track_get_type(tracks_to_compress[i]) == TYPE_BLEND_SHAPE) {
@@ -4698,7 +4732,12 @@ void Animation::compress(uint32_t p_page_size, uint32_t p_fps, float p_split_tol
} else {
data_tracks[i].components = 3;
}
+ needed_min_page_size += data_tracks[i].data.size() + data_tracks[i].get_temp_packet_size();
}
+ for (uint32_t i = 0; i < time_tracks.size(); i++) {
+ needed_min_page_size += time_tracks[i].packets.size() * 4; // time packet is 32 bits
+ }
+ ERR_FAIL_COND_MSG(p_page_size < needed_min_page_size, "Cannot compress with the given page size");
while (true) {
// Begin by finding the keyframe in all tracks with the time closest to the current time
@@ -4754,17 +4793,17 @@ void Animation::compress(uint32_t p_page_size, uint32_t p_fps, float p_split_tol
// The frame has advanced, time to validate the previous frame
uint32_t current_page_size = base_page_size;
- for (uint32_t i = 0; i < data_tracks.size(); i++) {
- uint32_t track_size = data_tracks[i].data.size(); // track size
- track_size += data_tracks[i].get_temp_packet_size(); // Add the temporary data
+ for (const AnimationCompressionDataState &state : data_tracks) {
+ uint32_t track_size = state.data.size(); // track size
+ track_size += state.get_temp_packet_size(); // Add the temporary data
if (track_size > Compression::MAX_DATA_TRACK_SIZE) {
rollback = true; //track to large, time track can't point to keys any longer, because key offset is 12 bits
break;
}
current_page_size += track_size;
}
- for (uint32_t i = 0; i < time_tracks.size(); i++) {
- current_page_size += time_tracks[i].packets.size() * 4; // time packet is 32 bits
+ for (const AnimationCompressionTimeState &state : time_tracks) {
+ current_page_size += state.packets.size() * 4; // time packet is 32 bits
}
if (!rollback && current_page_size > p_page_size) {
@@ -4776,22 +4815,22 @@ void Animation::compress(uint32_t p_page_size, uint32_t p_fps, float p_split_tol
if (rollback) {
// Not valid any longer, so rollback and commit page
- for (uint32_t i = 0; i < data_tracks.size(); i++) {
- data_tracks[i].temp_packets.resize(data_tracks[i].validated_packet_count);
+ for (AnimationCompressionDataState &state : data_tracks) {
+ state.temp_packets.resize(state.validated_packet_count);
}
- for (uint32_t i = 0; i < time_tracks.size(); i++) {
- time_tracks[i].key_index = time_tracks[i].validated_key_index; //rollback key
- time_tracks[i].packets.resize(time_tracks[i].validated_packet_count);
+ for (AnimationCompressionTimeState &state : time_tracks) {
+ state.key_index = state.validated_key_index; //rollback key
+ state.packets.resize(state.validated_packet_count);
}
} else {
// All valid, so save rollback information
- for (uint32_t i = 0; i < data_tracks.size(); i++) {
- data_tracks[i].validated_packet_count = data_tracks[i].temp_packets.size();
+ for (AnimationCompressionDataState &state : data_tracks) {
+ state.validated_packet_count = state.temp_packets.size();
}
- for (uint32_t i = 0; i < time_tracks.size(); i++) {
- time_tracks[i].validated_key_index = time_tracks[i].key_index;
- time_tracks[i].validated_packet_count = time_tracks[i].packets.size();
+ for (AnimationCompressionTimeState &state : time_tracks) {
+ state.validated_key_index = state.key_index;
+ state.validated_packet_count = state.packets.size();
}
// Accept this frame as the frame being processed (as long as it exists)
@@ -4976,8 +5015,8 @@ void Animation::compress(uint32_t p_page_size, uint32_t p_fps, float p_split_tol
}
uint32_t new_size = 0;
- for (uint32_t i = 0; i < compression.pages.size(); i++) {
- new_size += compression.pages[i].data.size();
+ for (const Compression::Page &page : compression.pages) {
+ new_size += page.data.size();
}
print_line("Original size: " + itos(orig_size) + " - Compressed size: " + itos(new_size) + " " + String::num(float(new_size) / float(orig_size) * 100, 2) + "% pages: " + itos(compression.pages.size()));
@@ -5289,8 +5328,8 @@ int Animation::_get_compressed_key_count(uint32_t p_compressed_track) const {
int key_count = 0;
- for (uint32_t i = 0; i < compression.pages.size(); i++) {
- const uint8_t *page_data = compression.pages[i].data.ptr();
+ for (const Compression::Page &page : compression.pages) {
+ const uint8_t *page_data = page.data.ptr();
// Little endian assumed. No major big endian hardware exists any longer, but in case it does it will need to be supported.
const uint32_t *indices = (const uint32_t *)page_data;
const uint16_t *time_keys = (const uint16_t *)&page_data[indices[p_compressed_track * 3 + 0]];
@@ -5323,8 +5362,8 @@ bool Animation::_fetch_compressed_by_index(uint32_t p_compressed_track, int p_in
ERR_FAIL_COND_V(!compression.enabled, false);
ERR_FAIL_UNSIGNED_INDEX_V(p_compressed_track, compression.bounds.size(), false);
- for (uint32_t i = 0; i < compression.pages.size(); i++) {
- const uint8_t *page_data = compression.pages[i].data.ptr();
+ for (const Compression::Page &page : compression.pages) {
+ const uint8_t *page_data = page.data.ptr();
// Little endian assumed. No major big endian hardware exists any longer, but in case it does it will need to be supported.
const uint32_t *indices = (const uint32_t *)page_data;
const uint16_t *time_keys = (const uint16_t *)&page_data[indices[p_compressed_track * 3 + 0]];
@@ -5374,7 +5413,7 @@ bool Animation::_fetch_compressed_by_index(uint32_t p_compressed_track, int p_in
}
}
- r_time = compression.pages[i].time_offset + double(frame) / double(compression.fps);
+ r_time = page.time_offset + double(frame) / double(compression.fps);
for (uint32_t l = 0; l < COMPONENTS; l++) {
r_value[l] = decode[l];
}
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index 00a0761e0a..2c2ddb7095 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -213,6 +213,7 @@ private:
struct AudioTrack : public Track {
Vector<TKey<AudioKey>> values;
+ bool use_blend = true;
AudioTrack() {
type = TYPE_AUDIO;
@@ -447,6 +448,8 @@ public:
Ref<Resource> audio_track_get_key_stream(int p_track, int p_key) const;
real_t audio_track_get_key_start_offset(int p_track, int p_key) const;
real_t audio_track_get_key_end_offset(int p_track, int p_key) const;
+ void audio_track_set_use_blend(int p_track, bool p_enable);
+ bool audio_track_is_use_blend(int p_track) const;
int animation_track_insert_key(int p_track, double p_time, const StringName &p_animation);
void animation_track_set_key_animation(int p_track, int p_key, const StringName &p_animation);
diff --git a/scene/resources/audio_stream_polyphonic.cpp b/scene/resources/audio_stream_polyphonic.cpp
new file mode 100644
index 0000000000..f7299b0789
--- /dev/null
+++ b/scene/resources/audio_stream_polyphonic.cpp
@@ -0,0 +1,274 @@
+/**************************************************************************/
+/* audio_stream_polyphonic.cpp */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 "audio_stream_polyphonic.h"
+#include "scene/main/scene_tree.h"
+
+Ref<AudioStreamPlayback> AudioStreamPolyphonic::instantiate_playback() {
+ Ref<AudioStreamPlaybackPolyphonic> playback;
+ playback.instantiate();
+ playback->streams.resize(polyphony);
+ return playback;
+}
+
+String AudioStreamPolyphonic::get_stream_name() const {
+ return "AudioStreamPolyphonic";
+}
+
+bool AudioStreamPolyphonic::is_monophonic() const {
+ return true; // This avoids stream players to instantiate more than one of these.
+}
+
+void AudioStreamPolyphonic::set_polyphony(int p_voices) {
+ ERR_FAIL_COND(p_voices < 0 || p_voices > 128);
+ polyphony = p_voices;
+}
+int AudioStreamPolyphonic::get_polyphony() const {
+ return polyphony;
+}
+
+void AudioStreamPolyphonic::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_polyphony", "voices"), &AudioStreamPolyphonic::set_polyphony);
+ ClassDB::bind_method(D_METHOD("get_polyphony"), &AudioStreamPolyphonic::get_polyphony);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "polyphony", PROPERTY_HINT_RANGE, "1,128,1"), "set_polyphony", "get_polyphony");
+}
+
+AudioStreamPolyphonic::AudioStreamPolyphonic() {
+}
+
+////////////////////////
+
+void AudioStreamPlaybackPolyphonic::start(double p_from_pos) {
+ if (active) {
+ stop();
+ }
+
+ active = true;
+}
+
+void AudioStreamPlaybackPolyphonic::stop() {
+ if (!active) {
+ return;
+ }
+
+ bool locked = false;
+ for (Stream &s : streams) {
+ if (s.active.is_set()) {
+ // Need locking because something may still be mixing.
+ locked = true;
+ AudioServer::get_singleton()->lock();
+ }
+ s.active.clear();
+ s.finish_request.clear();
+ s.stream_playback.unref();
+ s.stream.unref();
+ }
+ if (locked) {
+ AudioServer::get_singleton()->unlock();
+ }
+
+ active = false;
+}
+
+bool AudioStreamPlaybackPolyphonic::is_playing() const {
+ return active;
+}
+
+int AudioStreamPlaybackPolyphonic::get_loop_count() const {
+ return 0;
+}
+
+double AudioStreamPlaybackPolyphonic::get_playback_position() const {
+ return 0;
+}
+void AudioStreamPlaybackPolyphonic::seek(double p_time) {
+ // Ignored.
+}
+
+void AudioStreamPlaybackPolyphonic::tag_used_streams() {
+ for (Stream &s : streams) {
+ if (s.active.is_set()) {
+ s.stream_playback->tag_used_streams();
+ }
+ }
+}
+
+int AudioStreamPlaybackPolyphonic::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) {
+ if (!active) {
+ return 0;
+ }
+
+ // Pre-clear buffer.
+ for (int i = 0; i < p_frames; i++) {
+ p_buffer[i] = AudioFrame(0, 0);
+ }
+
+ for (Stream &s : streams) {
+ if (!s.active.is_set()) {
+ continue;
+ }
+
+ float volume_db = s.volume_db; // Copy because it can be overridden at any time.
+ float next_volume = Math::db_to_linear(volume_db);
+ s.prev_volume_db = volume_db;
+
+ if (s.finish_request.is_set()) {
+ if (s.pending_play.is_set()) {
+ // Did not get the chance to play, was finalized too soon.
+ s.active.clear();
+ continue;
+ }
+ next_volume = 0;
+ }
+
+ if (s.pending_play.is_set()) {
+ s.stream_playback->start(s.play_offset);
+ s.pending_play.clear();
+ }
+ float prev_volume = Math::db_to_linear(s.prev_volume_db);
+
+ float volume_inc = (next_volume - prev_volume) / float(p_frames);
+
+ int todo = p_frames;
+ int offset = 0;
+ float volume = prev_volume;
+
+ bool stream_done = false;
+
+ while (todo) {
+ int to_mix = MIN(todo, int(INTERNAL_BUFFER_LEN));
+ int mixed = s.stream_playback->mix(internal_buffer, s.pitch_scale, to_mix);
+
+ for (int i = 0; i < to_mix; i++) {
+ p_buffer[offset + i] += internal_buffer[i] * volume;
+ volume += volume_inc;
+ }
+
+ if (mixed < to_mix) {
+ // Stream is done.
+ s.active.clear();
+ stream_done = true;
+ break;
+ }
+
+ todo -= to_mix;
+ offset += to_mix;
+ }
+
+ if (stream_done) {
+ continue;
+ }
+
+ if (s.finish_request.is_set()) {
+ s.active.clear();
+ }
+ }
+
+ return p_frames;
+}
+
+AudioStreamPlaybackPolyphonic::ID AudioStreamPlaybackPolyphonic::play_stream(const Ref<AudioStream> &p_stream, float p_from_offset, float p_volume_db, float p_pitch_scale) {
+ ERR_FAIL_COND_V(p_stream.is_null(), INVALID_ID);
+ for (uint32_t i = 0; i < streams.size(); i++) {
+ if (!streams[i].active.is_set()) {
+ // Can use this stream, as it's not active.
+ streams[i].stream = p_stream;
+ streams[i].stream_playback = streams[i].stream->instantiate_playback();
+ streams[i].play_offset = p_from_offset;
+ streams[i].volume_db = p_volume_db;
+ streams[i].prev_volume_db = p_volume_db;
+ streams[i].pitch_scale = p_pitch_scale;
+ streams[i].id = id_counter++;
+ streams[i].finish_request.clear();
+ streams[i].pending_play.set();
+ streams[i].active.set();
+ return (ID(i) << INDEX_SHIFT) | ID(streams[i].id);
+ }
+ }
+
+ return INVALID_ID;
+}
+
+AudioStreamPlaybackPolyphonic::Stream *AudioStreamPlaybackPolyphonic::_find_stream(int64_t p_id) {
+ uint32_t index = p_id >> INDEX_SHIFT;
+ if (index >= streams.size()) {
+ return nullptr;
+ }
+ if (!streams[index].active.is_set()) {
+ return nullptr; // Not active, no longer exists.
+ }
+ int64_t id = p_id & ID_MASK;
+ if (streams[index].id != id) {
+ return nullptr;
+ }
+ return &streams[index];
+}
+
+void AudioStreamPlaybackPolyphonic::set_stream_volume(ID p_stream_id, float p_volume_db) {
+ Stream *s = _find_stream(p_stream_id);
+ if (!s) {
+ return;
+ }
+ s->volume_db = p_volume_db;
+}
+
+void AudioStreamPlaybackPolyphonic::set_stream_pitch_scale(ID p_stream_id, float p_pitch_scale) {
+ Stream *s = _find_stream(p_stream_id);
+ if (!s) {
+ return;
+ }
+ s->pitch_scale = p_pitch_scale;
+}
+
+bool AudioStreamPlaybackPolyphonic::is_stream_playing(ID p_stream_id) const {
+ return const_cast<AudioStreamPlaybackPolyphonic *>(this)->_find_stream(p_stream_id) != nullptr;
+}
+
+void AudioStreamPlaybackPolyphonic::stop_stream(ID p_stream_id) {
+ Stream *s = _find_stream(p_stream_id);
+ if (!s) {
+ return;
+ }
+ s->finish_request.set();
+}
+
+void AudioStreamPlaybackPolyphonic::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("play_stream", "stream", "from_offset", "volume_db", "pitch_scale"), &AudioStreamPlaybackPolyphonic::play_stream, DEFVAL(0), DEFVAL(0), DEFVAL(1.0));
+ ClassDB::bind_method(D_METHOD("set_stream_volume", "stream", "volume_db"), &AudioStreamPlaybackPolyphonic::set_stream_volume);
+ ClassDB::bind_method(D_METHOD("set_stream_pitch_scale", "stream", "pitch_scale"), &AudioStreamPlaybackPolyphonic::set_stream_pitch_scale);
+ ClassDB::bind_method(D_METHOD("is_stream_playing", "stream"), &AudioStreamPlaybackPolyphonic::is_stream_playing);
+ ClassDB::bind_method(D_METHOD("stop_stream", "stream"), &AudioStreamPlaybackPolyphonic::stop_stream);
+
+ BIND_CONSTANT(INVALID_ID);
+}
+
+AudioStreamPlaybackPolyphonic::AudioStreamPlaybackPolyphonic() {
+}
diff --git a/scene/resources/audio_stream_polyphonic.h b/scene/resources/audio_stream_polyphonic.h
new file mode 100644
index 0000000000..e414401b6f
--- /dev/null
+++ b/scene/resources/audio_stream_polyphonic.h
@@ -0,0 +1,119 @@
+/**************************************************************************/
+/* audio_stream_polyphonic.h */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 AUDIO_STREAM_POLYPHONIC_H
+#define AUDIO_STREAM_POLYPHONIC_H
+
+#include "core/templates/local_vector.h"
+#include "servers/audio/audio_stream.h"
+
+class AudioStreamPolyphonic : public AudioStream {
+ GDCLASS(AudioStreamPolyphonic, AudioStream)
+ int polyphony = 32;
+
+ static void _bind_methods();
+
+public:
+ virtual Ref<AudioStreamPlayback> instantiate_playback() override;
+ virtual String get_stream_name() const override;
+ virtual bool is_monophonic() const override;
+
+ void set_polyphony(int p_voices);
+ int get_polyphony() const;
+
+ AudioStreamPolyphonic();
+};
+
+class AudioStreamPlaybackPolyphonic : public AudioStreamPlayback {
+ GDCLASS(AudioStreamPlaybackPolyphonic, AudioStreamPlayback)
+
+ enum {
+ INTERNAL_BUFFER_LEN = 128,
+ ID_MASK = 0xFFFFFFFF,
+ INDEX_SHIFT = 32
+ };
+ struct Stream {
+ SafeFlag active;
+ SafeFlag pending_play;
+ SafeFlag finish_request;
+ float play_offset = 0;
+ float pitch_scale = 1.0;
+ Ref<AudioStream> stream;
+ Ref<AudioStreamPlayback> stream_playback;
+ float prev_volume_db = 0;
+ float volume_db = 0;
+ uint32_t id = 0;
+
+ Stream() :
+ active(false), pending_play(false), finish_request(false) {}
+ };
+
+ LocalVector<Stream> streams;
+ AudioFrame internal_buffer[INTERNAL_BUFFER_LEN];
+
+ bool active = false;
+ uint32_t id_counter = 1;
+
+ _FORCE_INLINE_ Stream *_find_stream(int64_t p_id);
+
+ friend class AudioStreamPolyphonic;
+
+protected:
+ static void _bind_methods();
+
+public:
+ typedef int64_t ID;
+ enum {
+ INVALID_ID = -1
+ };
+
+ virtual void start(double p_from_pos = 0.0) override;
+ virtual void stop() override;
+ virtual bool is_playing() const override;
+
+ virtual int get_loop_count() const override; //times it looped
+
+ virtual double get_playback_position() const override;
+ virtual void seek(double p_time) override;
+
+ virtual void tag_used_streams() override;
+
+ virtual int mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) override;
+
+ ID play_stream(const Ref<AudioStream> &p_stream, float p_from_offset = 0, float p_volume_db = 0, float p_pitch_scale = 1.0);
+ void set_stream_volume(ID p_stream_id, float p_volume_db);
+ void set_stream_pitch_scale(ID p_stream_id, float p_pitch_scale);
+ bool is_stream_playing(ID p_stream_id) const;
+ void stop_stream(ID p_stream_id);
+
+ AudioStreamPlaybackPolyphonic();
+};
+
+#endif // AUDIO_STREAM_POLYPHONIC_H
diff --git a/scene/resources/camera_attributes.cpp b/scene/resources/camera_attributes.cpp
index b5e302cce5..61df56523d 100644
--- a/scene/resources/camera_attributes.cpp
+++ b/scene/resources/camera_attributes.cpp
@@ -286,10 +286,10 @@ void CameraAttributesPractical::_bind_methods() {
ADD_GROUP("DOF Blur", "dof_blur_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "dof_blur_far_enabled"), "set_dof_blur_far_enabled", "is_dof_blur_far_enabled");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "dof_blur_far_distance", PROPERTY_HINT_RANGE, "0.01,8192,0.01,exp,suffix:m"), "set_dof_blur_far_distance", "get_dof_blur_far_distance");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "dof_blur_far_transition", PROPERTY_HINT_RANGE, "0.01,8192,0.01,exp"), "set_dof_blur_far_transition", "get_dof_blur_far_transition");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "dof_blur_far_transition", PROPERTY_HINT_RANGE, "-1,8192,0.01,exp"), "set_dof_blur_far_transition", "get_dof_blur_far_transition");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "dof_blur_near_enabled"), "set_dof_blur_near_enabled", "is_dof_blur_near_enabled");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "dof_blur_near_distance", PROPERTY_HINT_RANGE, "0.01,8192,0.01,exp,suffix:m"), "set_dof_blur_near_distance", "get_dof_blur_near_distance");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "dof_blur_near_transition", PROPERTY_HINT_RANGE, "0.01,8192,0.01,exp"), "set_dof_blur_near_transition", "get_dof_blur_near_transition");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "dof_blur_near_transition", PROPERTY_HINT_RANGE, "-1,8192,0.01,exp"), "set_dof_blur_near_transition", "get_dof_blur_near_transition");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "dof_blur_amount", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_dof_blur_amount", "get_dof_blur_amount");
ADD_GROUP("Auto Exposure", "auto_exposure_");
diff --git a/scene/resources/capsule_shape_2d.cpp b/scene/resources/capsule_shape_2d.cpp
index 5dc4e64c2e..5309e54846 100644
--- a/scene/resources/capsule_shape_2d.cpp
+++ b/scene/resources/capsule_shape_2d.cpp
@@ -88,8 +88,10 @@ void CapsuleShape2D::draw(const RID &p_to_rid, const Color &p_color) {
Vector<Vector2> points = _get_points();
Vector<Color> col = { p_color };
RenderingServer::get_singleton()->canvas_item_add_polygon(p_to_rid, points, col);
+
if (is_collision_outline_enabled()) {
points.push_back(points[0]);
+ col = { Color(p_color, 1.0) };
RenderingServer::get_singleton()->canvas_item_add_polyline(p_to_rid, points, col);
}
}
diff --git a/scene/resources/circle_shape_2d.cpp b/scene/resources/circle_shape_2d.cpp
index a15dfc0a54..0b207c33ca 100644
--- a/scene/resources/circle_shape_2d.cpp
+++ b/scene/resources/circle_shape_2d.cpp
@@ -84,6 +84,7 @@ void CircleShape2D::draw(const RID &p_to_rid, const Color &p_color) {
if (is_collision_outline_enabled()) {
points.push_back(points[0]);
+ col = { Color(p_color, 1.0) };
RenderingServer::get_singleton()->canvas_item_add_polyline(p_to_rid, points, col);
}
}
diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp
index e51b48a4b1..7f19dd63e6 100644
--- a/scene/resources/convex_polygon_shape_2d.cpp
+++ b/scene/resources/convex_polygon_shape_2d.cpp
@@ -76,13 +76,14 @@ void ConvexPolygonShape2D::draw(const RID &p_to_rid, const Color &p_color) {
return;
}
- Vector<Color> col;
- col.push_back(p_color);
+ Vector<Color> col = { p_color };
RenderingServer::get_singleton()->canvas_item_add_polygon(p_to_rid, points, col);
+
if (is_collision_outline_enabled()) {
+ col = { Color(p_color, 1.0) };
RenderingServer::get_singleton()->canvas_item_add_polyline(p_to_rid, points, col);
- // Draw the last segment as it's not drawn by `canvas_item_add_polyline()`.
- RenderingServer::get_singleton()->canvas_item_add_line(p_to_rid, points[points.size() - 1], points[0], p_color, 1.0);
+ // Draw the last segment.
+ RenderingServer::get_singleton()->canvas_item_add_line(p_to_rid, points[points.size() - 1], points[0], Color(p_color, 1.0));
}
}
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 4d3eec6333..7a865691d9 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -53,7 +53,7 @@ static const int default_corner_radius = 3;
static Ref<StyleBoxFlat> make_flat_stylebox(Color p_color, float p_margin_left = default_margin, float p_margin_top = default_margin, float p_margin_right = default_margin, float p_margin_bottom = default_margin, int p_corner_radius = default_corner_radius, bool p_draw_center = true, int p_border_width = 0) {
Ref<StyleBoxFlat> style(memnew(StyleBoxFlat));
style->set_bg_color(p_color);
- style->set_default_margin_individual(p_margin_left * scale, p_margin_top * scale, p_margin_right * scale, p_margin_bottom * scale);
+ style->set_content_margin_individual(p_margin_left * scale, p_margin_top * scale, p_margin_right * scale, p_margin_bottom * scale);
style->set_corner_radius_all(p_corner_radius);
style->set_anti_aliased(true);
@@ -67,10 +67,10 @@ static Ref<StyleBoxFlat> make_flat_stylebox(Color p_color, float p_margin_left =
}
static Ref<StyleBoxFlat> sb_expand(Ref<StyleBoxFlat> p_sbox, float p_left, float p_top, float p_right, float p_bottom) {
- p_sbox->set_expand_margin_size(SIDE_LEFT, p_left * scale);
- p_sbox->set_expand_margin_size(SIDE_TOP, p_top * scale);
- p_sbox->set_expand_margin_size(SIDE_RIGHT, p_right * scale);
- p_sbox->set_expand_margin_size(SIDE_BOTTOM, p_bottom * scale);
+ p_sbox->set_expand_margin(SIDE_LEFT, p_left * scale);
+ p_sbox->set_expand_margin(SIDE_TOP, p_top * scale);
+ p_sbox->set_expand_margin(SIDE_RIGHT, p_right * scale);
+ p_sbox->set_expand_margin(SIDE_BOTTOM, p_bottom * scale);
return p_sbox;
}
@@ -93,7 +93,7 @@ static Ref<ImageTexture> generate_icon(int p_index) {
static Ref<StyleBox> make_empty_stylebox(float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1) {
Ref<StyleBox> style(memnew(StyleBoxEmpty));
- style->set_default_margin_individual(p_margin_left * scale, p_margin_top * scale, p_margin_right * scale, p_margin_bottom * scale);
+ style->set_content_margin_individual(p_margin_left * scale, p_margin_top * scale, p_margin_right * scale, p_margin_bottom * scale);
return style;
}
@@ -148,7 +148,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
const Ref<StyleBoxFlat> button_disabled = make_flat_stylebox(style_disabled_color);
Ref<StyleBoxFlat> focus = make_flat_stylebox(style_focus_color, default_margin, default_margin, default_margin, default_margin, default_corner_radius, false, 2);
// Make the focus outline appear to be flush with the buttons it's focusing.
- focus->set_expand_margin_size_all(2 * scale);
+ focus->set_expand_margin_all(2 * scale);
theme->set_stylebox("normal", "Button", button_normal);
theme->set_stylebox("hover", "Button", button_hover);
@@ -279,9 +279,9 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
// CheckBox
Ref<StyleBox> cbx_empty = memnew(StyleBoxEmpty);
- cbx_empty->set_default_margin_all(4 * scale);
+ cbx_empty->set_content_margin_all(4 * scale);
Ref<StyleBox> cbx_focus = focus;
- cbx_focus->set_default_margin_all(4 * scale);
+ cbx_focus->set_content_margin_all(4 * scale);
theme->set_stylebox("normal", "CheckBox", cbx_empty);
theme->set_stylebox("pressed", "CheckBox", cbx_empty);
@@ -317,7 +317,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
// CheckButton
Ref<StyleBox> cb_empty = memnew(StyleBoxEmpty);
- cb_empty->set_default_margin_individual(6 * scale, 4 * scale, 6 * scale, 4 * scale);
+ cb_empty->set_content_margin_individual(6 * scale, 4 * scale, 6 * scale, 4 * scale);
theme->set_stylebox("normal", "CheckButton", cb_empty);
theme->set_stylebox("pressed", "CheckButton", cb_empty);
@@ -634,10 +634,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
Ref<StyleBoxLine> separator_horizontal = memnew(StyleBoxLine);
separator_horizontal->set_thickness(Math::round(scale));
separator_horizontal->set_color(style_separator_color);
- separator_horizontal->set_default_margin_individual(default_margin, 0, default_margin, 0);
+ separator_horizontal->set_content_margin_individual(default_margin, 0, default_margin, 0);
Ref<StyleBoxLine> separator_vertical = separator_horizontal->duplicate();
separator_vertical->set_vertical(true);
- separator_vertical->set_default_margin_individual(0, default_margin, 0, default_margin);
+ separator_vertical->set_content_margin_individual(0, default_margin, 0, default_margin);
// Always display a border for PopupMenus so they can be distinguished from their background.
Ref<StyleBoxFlat> style_popup_panel = make_flat_stylebox(style_popup_color);
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index 746f2f8f9b..8b4656414d 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -1043,6 +1043,18 @@ void Environment::_validate_property(PropertyInfo &p_property) const {
}
}
+ if (p_property.name == "ambient_light_color" || p_property.name == "ambient_light_energy") {
+ if (ambient_source == AMBIENT_SOURCE_DISABLED) {
+ p_property.usage = PROPERTY_USAGE_NO_EDITOR;
+ }
+ }
+
+ if (p_property.name == "ambient_light_sky_contribution") {
+ if (ambient_source == AMBIENT_SOURCE_DISABLED || ambient_source == AMBIENT_SOURCE_COLOR) {
+ p_property.usage = PROPERTY_USAGE_NO_EDITOR;
+ }
+ }
+
if (p_property.name == "fog_aerial_perspective") {
if (bg_mode != BG_SKY) {
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index deee187e8e..e5a1adff20 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -2868,6 +2868,12 @@ void SystemFont::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_multichannel_signed_distance_field", "msdf"), &SystemFont::set_multichannel_signed_distance_field);
ClassDB::bind_method(D_METHOD("is_multichannel_signed_distance_field"), &SystemFont::is_multichannel_signed_distance_field);
+ ClassDB::bind_method(D_METHOD("set_msdf_pixel_range", "msdf_pixel_range"), &SystemFont::set_msdf_pixel_range);
+ ClassDB::bind_method(D_METHOD("get_msdf_pixel_range"), &SystemFont::get_msdf_pixel_range);
+
+ ClassDB::bind_method(D_METHOD("set_msdf_size", "msdf_size"), &SystemFont::set_msdf_size);
+ ClassDB::bind_method(D_METHOD("get_msdf_size"), &SystemFont::get_msdf_size);
+
ClassDB::bind_method(D_METHOD("set_oversampling", "oversampling"), &SystemFont::set_oversampling);
ClassDB::bind_method(D_METHOD("get_oversampling"), &SystemFont::get_oversampling);
@@ -2890,6 +2896,8 @@ void SystemFont::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "hinting", PROPERTY_HINT_ENUM, "None,Light,Normal"), "set_hinting", "get_hinting");
ADD_PROPERTY(PropertyInfo(Variant::INT, "subpixel_positioning", PROPERTY_HINT_ENUM, "Disabled,Auto,One Half of a Pixel,One Quarter of a Pixel"), "set_subpixel_positioning", "get_subpixel_positioning");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "multichannel_signed_distance_field"), "set_multichannel_signed_distance_field", "is_multichannel_signed_distance_field");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "msdf_pixel_range"), "set_msdf_pixel_range", "get_msdf_pixel_range");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "msdf_size"), "set_msdf_size", "get_msdf_size");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "oversampling", PROPERTY_HINT_RANGE, "0,10,0.1"), "set_oversampling", "get_oversampling");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "fallbacks", PROPERTY_HINT_ARRAY_TYPE, MAKE_RESOURCE_TYPE_HINT("Font")), "set_fallbacks", "get_fallbacks");
}
@@ -2987,6 +2995,8 @@ void SystemFont::_update_base_font() {
file->set_hinting(hinting);
file->set_subpixel_positioning(subpixel_positioning);
file->set_multichannel_signed_distance_field(msdf);
+ file->set_msdf_pixel_range(msdf_pixel_range);
+ file->set_msdf_size(msdf_size);
file->set_oversampling(oversampling);
base_font = file;
@@ -3186,6 +3196,34 @@ bool SystemFont::is_multichannel_signed_distance_field() const {
return msdf;
}
+void SystemFont::set_msdf_pixel_range(int p_msdf_pixel_range) {
+ if (msdf_pixel_range != p_msdf_pixel_range) {
+ msdf_pixel_range = p_msdf_pixel_range;
+ if (base_font.is_valid()) {
+ base_font->set_msdf_pixel_range(msdf_pixel_range);
+ }
+ emit_changed();
+ }
+}
+
+int SystemFont::get_msdf_pixel_range() const {
+ return msdf_pixel_range;
+}
+
+void SystemFont::set_msdf_size(int p_msdf_size) {
+ if (msdf_size != p_msdf_size) {
+ msdf_size = p_msdf_size;
+ if (base_font.is_valid()) {
+ base_font->set_msdf_size(msdf_size);
+ }
+ emit_changed();
+ }
+}
+
+int SystemFont::get_msdf_size() const {
+ return msdf_size;
+}
+
void SystemFont::set_oversampling(real_t p_oversampling) {
if (oversampling != p_oversampling) {
oversampling = p_oversampling;
diff --git a/scene/resources/font.h b/scene/resources/font.h
index 4d468a8841..ef79f8bd02 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -452,6 +452,8 @@ class SystemFont : public Font {
TextServer::SubpixelPositioning subpixel_positioning = TextServer::SUBPIXEL_POSITIONING_AUTO;
real_t oversampling = 0.f;
bool msdf = false;
+ int msdf_pixel_range = 16;
+ int msdf_size = 48;
protected:
static void _bind_methods();
@@ -488,6 +490,12 @@ public:
virtual void set_multichannel_signed_distance_field(bool p_msdf);
virtual bool is_multichannel_signed_distance_field() const;
+ virtual void set_msdf_pixel_range(int p_msdf_pixel_range);
+ virtual int get_msdf_pixel_range() const;
+
+ virtual void set_msdf_size(int p_msdf_size);
+ virtual int get_msdf_size() const;
+
virtual void set_font_names(const PackedStringArray &p_names);
virtual PackedStringArray get_font_names() const;
diff --git a/scene/resources/immediate_mesh.cpp b/scene/resources/immediate_mesh.cpp
index f4a0db3930..48d609da97 100644
--- a/scene/resources/immediate_mesh.cpp
+++ b/scene/resources/immediate_mesh.cpp
@@ -41,8 +41,8 @@ void ImmediateMesh::surface_set_color(const Color &p_color) {
if (!uses_colors) {
colors.resize(vertices.size());
- for (uint32_t i = 0; i < colors.size(); i++) {
- colors[i] = p_color;
+ for (Color &color : colors) {
+ color = p_color;
}
uses_colors = true;
}
@@ -54,8 +54,8 @@ void ImmediateMesh::surface_set_normal(const Vector3 &p_normal) {
if (!uses_normals) {
normals.resize(vertices.size());
- for (uint32_t i = 0; i < normals.size(); i++) {
- normals[i] = p_normal;
+ for (Vector3 &normal : normals) {
+ normal = p_normal;
}
uses_normals = true;
}
@@ -66,8 +66,8 @@ void ImmediateMesh::surface_set_tangent(const Plane &p_tangent) {
ERR_FAIL_COND_MSG(!surface_active, "Not creating any surface. Use surface_begin() to do it.");
if (!uses_tangents) {
tangents.resize(vertices.size());
- for (uint32_t i = 0; i < tangents.size(); i++) {
- tangents[i] = p_tangent;
+ for (Plane &tangent : tangents) {
+ tangent = p_tangent;
}
uses_tangents = true;
}
@@ -78,8 +78,8 @@ void ImmediateMesh::surface_set_uv(const Vector2 &p_uv) {
ERR_FAIL_COND_MSG(!surface_active, "Not creating any surface. Use surface_begin() to do it.");
if (!uses_uvs) {
uvs.resize(vertices.size());
- for (uint32_t i = 0; i < uvs.size(); i++) {
- uvs[i] = p_uv;
+ for (Vector2 &uv : uvs) {
+ uv = p_uv;
}
uses_uvs = true;
}
@@ -90,8 +90,8 @@ void ImmediateMesh::surface_set_uv2(const Vector2 &p_uv2) {
ERR_FAIL_COND_MSG(!surface_active, "Not creating any surface. Use surface_begin() to do it.");
if (!uses_uv2s) {
uv2s.resize(vertices.size());
- for (uint32_t i = 0; i < uv2s.size(); i++) {
- uv2s[i] = p_uv2;
+ for (Vector2 &uv : uv2s) {
+ uv = p_uv2;
}
uses_uv2s = true;
}
diff --git a/scene/resources/importer_mesh.cpp b/scene/resources/importer_mesh.cpp
index eefa5aa14a..742ac2bbd9 100644
--- a/scene/resources/importer_mesh.cpp
+++ b/scene/resources/importer_mesh.cpp
@@ -364,9 +364,7 @@ void ImporterMesh::generate_lods(float p_normal_merge_angle, float p_normal_spli
const LocalVector<Pair<int, int>> &close_verts = E->value;
bool found = false;
- for (unsigned int k = 0; k < close_verts.size(); k++) {
- const Pair<int, int> &idx = close_verts[k];
-
+ for (const Pair<int, int> &idx : close_verts) {
bool is_uvs_close = (!uvs_ptr || uvs_ptr[j].distance_squared_to(uvs_ptr[idx.second]) < CMP_EPSILON2);
bool is_uv2s_close = (!uv2s_ptr || uv2s_ptr[j].distance_squared_to(uv2s_ptr[idx.second]) < CMP_EPSILON2);
ERR_FAIL_INDEX(idx.second, normals.size());
@@ -599,8 +597,7 @@ void ImporterMesh::generate_lods(float p_normal_merge_angle, float p_normal_spli
const LocalVector<int> &corners = vertex_corners[j];
const Vector3 &vertex_normal = normals_ptr[j];
- for (unsigned int k = 0; k < corners.size(); k++) {
- const int &corner_idx = corners[k];
+ for (const int &corner_idx : corners) {
const Vector3 &ray_normal = ray_normals[corner_idx];
if (ray_normal.length_squared() < CMP_EPSILON2) {
@@ -635,8 +632,8 @@ void ImporterMesh::generate_lods(float p_normal_merge_angle, float p_normal_spli
split_vertex_indices.push_back(j);
split_vertex_normals.push_back(n);
int new_idx = split_vertex_count++;
- for (unsigned int l = 0; l < group_indices.size(); l++) {
- new_indices_ptr[group_indices[l]] = new_idx;
+ for (const int &index : group_indices) {
+ new_indices_ptr[index] = new_idx;
}
}
}
@@ -1061,6 +1058,8 @@ struct EditorSceneFormatImporterMeshLightmapSurface {
String name;
};
+static const uint32_t custom_shift[RS::ARRAY_CUSTOM_COUNT] = { Mesh::ARRAY_FORMAT_CUSTOM0_SHIFT, Mesh::ARRAY_FORMAT_CUSTOM1_SHIFT, Mesh::ARRAY_FORMAT_CUSTOM2_SHIFT, Mesh::ARRAY_FORMAT_CUSTOM3_SHIFT };
+
Error ImporterMesh::lightmap_unwrap_cached(const Transform3D &p_base_transform, float p_texel_size, const Vector<uint8_t> &p_src_cache, Vector<uint8_t> &r_dst_cache) {
ERR_FAIL_COND_V(!array_mesh_lightmap_unwrap_callback, ERR_UNCONFIGURED);
ERR_FAIL_COND_V_MSG(blend_shapes.size() != 0, ERR_UNAVAILABLE, "Can't unwrap mesh with blend shapes.");
@@ -1181,9 +1180,6 @@ Error ImporterMesh::lightmap_unwrap_cached(const Transform3D &p_base_transform,
return ERR_CANT_CREATE;
}
- //remove surfaces
- clear();
-
//create surfacetools for each surface..
LocalVector<Ref<SurfaceTool>> surfaces_tools;
@@ -1193,9 +1189,16 @@ Error ImporterMesh::lightmap_unwrap_cached(const Transform3D &p_base_transform,
st->begin(Mesh::PRIMITIVE_TRIANGLES);
st->set_material(lightmap_surfaces[i].material);
st->set_meta("name", lightmap_surfaces[i].name);
+
+ for (int custom_i = 0; custom_i < RS::ARRAY_CUSTOM_COUNT; custom_i++) {
+ st->set_custom_format(custom_i, (SurfaceTool::CustomFormat)((lightmap_surfaces[i].format >> custom_shift[custom_i]) & RS::ARRAY_FORMAT_CUSTOM_MASK));
+ }
surfaces_tools.push_back(st); //stay there
}
+ //remove surfaces
+ clear();
+
print_verbose("Mesh: Gen indices: " + itos(gen_index_count));
//go through all indices
@@ -1232,6 +1235,11 @@ Error ImporterMesh::lightmap_unwrap_cached(const Transform3D &p_base_transform,
if (lightmap_surfaces[surface].format & Mesh::ARRAY_FORMAT_WEIGHTS) {
surfaces_tools[surface]->set_weights(v.weights);
}
+ for (int custom_i = 0; custom_i < RS::ARRAY_CUSTOM_COUNT; custom_i++) {
+ if ((lightmap_surfaces[surface].format >> custom_shift[custom_i]) & RS::ARRAY_FORMAT_CUSTOM_MASK) {
+ surfaces_tools[surface]->set_custom(custom_i, v.custom[custom_i]);
+ }
+ }
Vector2 uv2(gen_uvs[gen_indices[i + j] * 2 + 0], gen_uvs[gen_indices[i + j] * 2 + 1]);
surfaces_tools[surface]->set_uv2(uv2);
@@ -1241,10 +1249,11 @@ Error ImporterMesh::lightmap_unwrap_cached(const Transform3D &p_base_transform,
}
//generate surfaces
- for (unsigned int i = 0; i < surfaces_tools.size(); i++) {
- surfaces_tools[i]->index();
- Array arrays = surfaces_tools[i]->commit_to_arrays();
- add_surface(surfaces_tools[i]->get_primitive_type(), arrays, Array(), Dictionary(), surfaces_tools[i]->get_material(), surfaces_tools[i]->get_meta("name"));
+ for (int i = 0; i < lightmap_surfaces.size(); i++) {
+ Ref<SurfaceTool> &tool = surfaces_tools[i];
+ tool->index();
+ Array arrays = tool->commit_to_arrays();
+ add_surface(tool->get_primitive_type(), arrays, Array(), Dictionary(), tool->get_material(), tool->get_meta("name"), lightmap_surfaces[i].format);
}
set_lightmap_size_hint(Size2(size_x, size_y));
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 3e2a952ea7..7e84814ab3 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -113,6 +113,12 @@ bool Material::_can_use_render_priority() const {
return ret;
}
+Ref<Resource> Material::create_placeholder() const {
+ Ref<PlaceholderMaterial> placeholder;
+ placeholder.instantiate();
+ return placeholder;
+}
+
void Material::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_next_pass", "next_pass"), &Material::set_next_pass);
ClassDB::bind_method(D_METHOD("get_next_pass"), &Material::get_next_pass);
@@ -123,6 +129,8 @@ void Material::_bind_methods() {
ClassDB::bind_method(D_METHOD("inspect_native_shader_code"), &Material::inspect_native_shader_code);
ClassDB::set_method_flags(get_class_static(), _scs_create("inspect_native_shader_code"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
+ ClassDB::bind_method(D_METHOD("create_placeholder"), &Material::create_placeholder);
+
ADD_PROPERTY(PropertyInfo(Variant::INT, "render_priority", PROPERTY_HINT_RANGE, itos(RENDER_PRIORITY_MIN) + "," + itos(RENDER_PRIORITY_MAX) + ",1"), "set_render_priority", "get_render_priority");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "next_pass", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_next_pass", "get_next_pass");
@@ -149,11 +157,36 @@ Material::~Material() {
bool ShaderMaterial::_set(const StringName &p_name, const Variant &p_value) {
if (shader.is_valid()) {
- StringName pr = shader->remap_parameter(p_name);
- if (pr) {
- set_shader_parameter(pr, p_value);
+ const StringName *sn = remap_cache.getptr(p_name);
+ if (sn) {
+ set_shader_parameter(*sn, p_value);
return true;
}
+ String s = p_name;
+ if (s.begins_with("shader_parameter/")) {
+ String param = s.replace_first("shader_parameter/", "");
+ remap_cache[s] = param;
+ set_shader_parameter(param, p_value);
+ return true;
+ }
+#ifndef DISABLE_DEPRECATED
+ // Compatibility remaps are only needed here.
+ if (s.begins_with("param/")) {
+ s = s.replace_first("param/", "shader_parameter/");
+ } else if (s.begins_with("shader_param/")) {
+ s = s.replace_first("shader_param/", "shader_parameter/");
+ } else if (s.begins_with("shader_uniform/")) {
+ s = s.replace_first("shader_uniform/", "shader_parameter/");
+ } else {
+ return false; // Not a shader parameter.
+ }
+
+ WARN_PRINT("This material (containing shader with path: '" + shader->get_path() + "') uses an old deprecated parameter names. Consider re-saving this resource (or scene which contains it) in order for it to continue working in future versions.");
+ String param = s.replace_first("shader_parameter/", "");
+ remap_cache[s] = param;
+ set_shader_parameter(param, p_value);
+ return true;
+#endif
}
return false;
@@ -161,9 +194,10 @@ bool ShaderMaterial::_set(const StringName &p_name, const Variant &p_value) {
bool ShaderMaterial::_get(const StringName &p_name, Variant &r_ret) const {
if (shader.is_valid()) {
- StringName pr = shader->remap_parameter(p_name);
- if (pr) {
- r_ret = get_shader_parameter(pr);
+ const StringName *sn = remap_cache.getptr(p_name);
+ if (sn) {
+ // Only return a parameter if it was previously set.
+ r_ret = get_shader_parameter(*sn);
return true;
}
}
@@ -247,6 +281,12 @@ void ShaderMaterial::_get_property_list(List<PropertyInfo> *p_list) const {
PropertyInfo info = E->get();
info.name = "shader_parameter/" + info.name;
+ if (!param_cache.has(E->get().name)) {
+ // Property has never been edited, retrieve with default value.
+ Variant default_value = RenderingServer::get_singleton()->shader_get_parameter_default(shader->get_rid(), E->get().name);
+ param_cache.insert(E->get().name, default_value);
+ remap_cache.insert(info.name, E->get().name);
+ }
groups[last_group][last_subgroup].push_back(info);
}
@@ -275,11 +315,10 @@ void ShaderMaterial::_get_property_list(List<PropertyInfo> *p_list) const {
bool ShaderMaterial::_property_can_revert(const StringName &p_name) const {
if (shader.is_valid()) {
- StringName pr = shader->remap_parameter(p_name);
+ const StringName *pr = remap_cache.getptr(p_name);
if (pr) {
- Variant default_value = RenderingServer::get_singleton()->shader_get_parameter_default(shader->get_rid(), pr);
- Variant current_value;
- _get(p_name, current_value);
+ Variant default_value = RenderingServer::get_singleton()->shader_get_parameter_default(shader->get_rid(), *pr);
+ Variant current_value = get_shader_parameter(*pr);
return default_value.get_type() != Variant::NIL && default_value != current_value;
}
}
@@ -288,9 +327,9 @@ bool ShaderMaterial::_property_can_revert(const StringName &p_name) const {
bool ShaderMaterial::_property_get_revert(const StringName &p_name, Variant &r_property) const {
if (shader.is_valid()) {
- StringName pr = shader->remap_parameter(p_name);
- if (pr) {
- r_property = RenderingServer::get_singleton()->shader_get_parameter_default(shader->get_rid(), pr);
+ const StringName *pr = remap_cache.getptr(p_name);
+ if (*pr) {
+ r_property = RenderingServer::get_singleton()->shader_get_parameter_default(shader->get_rid(), *pr);
return true;
}
}
@@ -2277,71 +2316,51 @@ BaseMaterial3D::TextureChannel BaseMaterial3D::get_refraction_texture_channel()
return refraction_texture_channel;
}
-Ref<Material> BaseMaterial3D::get_material_for_2d(bool p_shaded, bool p_transparent, bool p_double_sided, bool p_cut_alpha, bool p_opaque_prepass, bool p_billboard, bool p_billboard_y, bool p_msdf, bool p_no_depth, bool p_fixed_size, TextureFilter p_filter, RID *r_shader_rid) {
- int64_t hash = 0;
- if (p_shaded) {
- hash |= 1 << 0;
- }
- if (p_transparent) {
- hash |= 1 << 1;
- }
- if (p_cut_alpha) {
- hash |= 1 << 2;
- }
- if (p_opaque_prepass) {
- hash |= 1 << 3;
- }
- if (p_double_sided) {
- hash |= 1 << 4;
- }
- if (p_billboard) {
- hash |= 1 << 5;
- }
- if (p_billboard_y) {
- hash |= 1 << 6;
- }
- if (p_msdf) {
- hash |= 1 << 7;
- }
- if (p_no_depth) {
- hash |= 1 << 8;
- }
- if (p_fixed_size) {
- hash |= 1 << 9;
- }
- hash = hash_murmur3_one_64(p_filter, hash);
-
- if (materials_for_2d.has(hash)) {
+Ref<Material> BaseMaterial3D::get_material_for_2d(bool p_shaded, Transparency p_transparency, bool p_double_sided, bool p_billboard, bool p_billboard_y, bool p_msdf, bool p_no_depth, bool p_fixed_size, TextureFilter p_filter, AlphaAntiAliasing p_alpha_antialiasing_mode, RID *r_shader_rid) {
+ uint64_t key = 0;
+ key |= ((int8_t)p_shaded & 0x01) << 0;
+ key |= ((int8_t)p_transparency & 0x07) << 1; // Bits 1-3.
+ key |= ((int8_t)p_double_sided & 0x01) << 4;
+ key |= ((int8_t)p_billboard & 0x01) << 5;
+ key |= ((int8_t)p_billboard_y & 0x01) << 6;
+ key |= ((int8_t)p_msdf & 0x01) << 7;
+ key |= ((int8_t)p_no_depth & 0x01) << 8;
+ key |= ((int8_t)p_fixed_size & 0x01) << 9;
+ key |= ((int8_t)p_filter & 0x07) << 10; // Bits 10-12.
+ key |= ((int8_t)p_alpha_antialiasing_mode & 0x07) << 13; // Bits 13-15.
+
+ if (materials_for_2d.has(key)) {
if (r_shader_rid) {
- *r_shader_rid = materials_for_2d[hash]->get_shader_rid();
+ *r_shader_rid = materials_for_2d[key]->get_shader_rid();
}
- return materials_for_2d[hash];
+ return materials_for_2d[key];
}
Ref<StandardMaterial3D> material;
material.instantiate();
material->set_shading_mode(p_shaded ? SHADING_MODE_PER_PIXEL : SHADING_MODE_UNSHADED);
- material->set_transparency(p_transparent ? (p_opaque_prepass ? TRANSPARENCY_ALPHA_DEPTH_PRE_PASS : (p_cut_alpha ? TRANSPARENCY_ALPHA_SCISSOR : TRANSPARENCY_ALPHA)) : TRANSPARENCY_DISABLED);
+ material->set_transparency(p_transparency);
material->set_cull_mode(p_double_sided ? CULL_DISABLED : CULL_BACK);
material->set_flag(FLAG_SRGB_VERTEX_COLOR, true);
material->set_flag(FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
material->set_flag(FLAG_ALBEDO_TEXTURE_MSDF, p_msdf);
material->set_flag(FLAG_DISABLE_DEPTH_TEST, p_no_depth);
material->set_flag(FLAG_FIXED_SIZE, p_fixed_size);
+ material->set_alpha_antialiasing(p_alpha_antialiasing_mode);
material->set_texture_filter(p_filter);
if (p_billboard || p_billboard_y) {
material->set_flag(FLAG_BILLBOARD_KEEP_SCALE, true);
material->set_billboard_mode(p_billboard_y ? BILLBOARD_FIXED_Y : BILLBOARD_ENABLED);
}
- materials_for_2d[hash] = material;
+ materials_for_2d[key] = material;
if (r_shader_rid) {
- *r_shader_rid = materials_for_2d[hash]->get_shader_rid();
+ *r_shader_rid = materials_for_2d[key]->get_shader_rid();
}
- return materials_for_2d[hash];
+ return materials_for_2d[key];
}
void BaseMaterial3D::set_on_top_of_alpha() {
diff --git a/scene/resources/material.h b/scene/resources/material.h
index f1777d31f4..5ea9a807d4 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -74,6 +74,9 @@ public:
virtual RID get_rid() const override;
virtual RID get_shader_rid() const;
virtual Shader::Mode get_shader_mode() const;
+
+ virtual Ref<Resource> create_placeholder() const;
+
Material();
virtual ~Material();
};
@@ -82,7 +85,8 @@ class ShaderMaterial : public Material {
GDCLASS(ShaderMaterial, Material);
Ref<Shader> shader;
- HashMap<StringName, Variant> param_cache;
+ mutable HashMap<StringName, StringName> remap_cache;
+ mutable HashMap<StringName, Variant> param_cache;
protected:
bool _set(const StringName &p_name, const Variant &p_value);
@@ -756,7 +760,7 @@ public:
static void finish_shaders();
static void flush_changes();
- static Ref<Material> get_material_for_2d(bool p_shaded, bool p_transparent, bool p_double_sided, bool p_cut_alpha, bool p_opaque_prepass, bool p_billboard = false, bool p_billboard_y = false, bool p_msdf = false, bool p_no_depth = false, bool p_fixed_size = false, TextureFilter p_filter = TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RID *r_shader_rid = nullptr);
+ static Ref<Material> get_material_for_2d(bool p_shaded, Transparency p_transparency, bool p_double_sided, bool p_billboard = false, bool p_billboard_y = false, bool p_msdf = false, bool p_no_depth = false, bool p_fixed_size = false, TextureFilter p_filter = TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, AlphaAntiAliasing p_alpha_antialiasing_mode = ALPHA_ANTIALIASING_OFF, RID *r_shader_rid = nullptr);
virtual RID get_shader_rid() const override;
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 5e18b5df37..cf9baa2907 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -189,6 +189,7 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const {
if (primitive == PRIMITIVE_TRIANGLES) {
for (int j = 0; j < ic; j++) {
int index = ir[j];
+ ERR_FAIL_COND_V(index >= vc, Ref<TriangleMesh>());
facesw[widx++] = vr[index];
}
} else { // PRIMITIVE_TRIANGLE_STRIP
@@ -614,6 +615,13 @@ Size2i Mesh::get_lightmap_size_hint() const {
return lightmap_size_hint;
}
+Ref<Resource> Mesh::create_placeholder() const {
+ Ref<PlaceholderMesh> placeholder;
+ placeholder.instantiate();
+ placeholder->set_aabb(get_aabb());
+ return placeholder;
+}
+
void Mesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_lightmap_size_hint", "size"), &Mesh::set_lightmap_size_hint);
ClassDB::bind_method(D_METHOD("get_lightmap_size_hint"), &Mesh::get_lightmap_size_hint);
@@ -626,6 +634,7 @@ void Mesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("surface_get_blend_shape_arrays", "surf_idx"), &Mesh::surface_get_blend_shape_arrays);
ClassDB::bind_method(D_METHOD("surface_set_material", "surf_idx", "material"), &Mesh::surface_set_material);
ClassDB::bind_method(D_METHOD("surface_get_material", "surf_idx"), &Mesh::surface_get_material);
+ ClassDB::bind_method(D_METHOD("create_placeholder"), &Mesh::create_placeholder);
BIND_ENUM_CONSTANT(PRIMITIVE_POINTS);
BIND_ENUM_CONSTANT(PRIMITIVE_LINES);
@@ -687,6 +696,7 @@ void Mesh::_bind_methods() {
BIND_BITFIELD_FLAG(ARRAY_FLAG_USE_2D_VERTICES);
BIND_BITFIELD_FLAG(ARRAY_FLAG_USE_DYNAMIC_UPDATE);
BIND_BITFIELD_FLAG(ARRAY_FLAG_USE_8_BONE_WEIGHTS);
+ BIND_BITFIELD_FLAG(ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY);
BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_NORMALIZED);
BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_RELATIVE);
@@ -1120,17 +1130,6 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) {
}
int idx = sname.substr(8, sl - 8).to_int();
- // This is a bit of a hack to ensure compatibility with older material
- // overrides that start indexing at 1.
- // We assume that idx 0 is always read first, if its not, this won't work.
- if (idx == 0) {
- surface_index_0 = true;
- }
- if (!surface_index_0) {
- // This means the file was created when the indexing started at 1, so decrease by one.
- idx--;
- }
-
String what = sname.get_slicec('/', 1);
if (what == "material") {
surface_set_material(idx, p_value);
@@ -1555,6 +1554,7 @@ void ArrayMesh::_recompute_aabb() {
// TODO: Need to add binding to add_surface using future MeshSurfaceData object.
void ArrayMesh::add_surface(BitField<ArrayFormat> p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, const Vector<uint8_t> &p_attribute_array, const Vector<uint8_t> &p_skin_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<uint8_t> &p_blend_shape_data, const Vector<AABB> &p_bone_aabbs, const Vector<RS::SurfaceData::LOD> &p_lods) {
+ ERR_FAIL_COND(surfaces.size() == RS::MAX_MESH_SURFACES);
_create_if_empty();
Surface s;
@@ -1590,6 +1590,7 @@ void ArrayMesh::add_surface(BitField<ArrayFormat> p_format, PrimitiveType p_prim
}
void ArrayMesh::add_surface_from_arrays(PrimitiveType p_primitive, const Array &p_arrays, const TypedArray<Array> &p_blend_shapes, const Dictionary &p_lods, BitField<ArrayFormat> p_flags) {
+ ERR_FAIL_COND(p_blend_shapes.size() != blend_shapes.size());
ERR_FAIL_COND(p_arrays.size() != ARRAY_MAX);
RS::SurfaceData surface;
@@ -2058,7 +2059,7 @@ void ArrayMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_blend_shape_mode", "mode"), &ArrayMesh::set_blend_shape_mode);
ClassDB::bind_method(D_METHOD("get_blend_shape_mode"), &ArrayMesh::get_blend_shape_mode);
- ClassDB::bind_method(D_METHOD("add_surface_from_arrays", "primitive", "arrays", "blend_shapes", "lods", "compress_flags"), &ArrayMesh::add_surface_from_arrays, DEFVAL(Array()), DEFVAL(Dictionary()), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("add_surface_from_arrays", "primitive", "arrays", "blend_shapes", "lods", "flags"), &ArrayMesh::add_surface_from_arrays, DEFVAL(Array()), DEFVAL(Dictionary()), DEFVAL(0));
ClassDB::bind_method(D_METHOD("clear_surfaces"), &ArrayMesh::clear_surfaces);
ClassDB::bind_method(D_METHOD("surface_update_vertex_region", "surf_idx", "offset", "data"), &ArrayMesh::surface_update_vertex_region);
ClassDB::bind_method(D_METHOD("surface_update_attribute_region", "surf_idx", "offset", "data"), &ArrayMesh::surface_update_attribute_region);
diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h
index 1baa466312..1b870d996a 100644
--- a/scene/resources/mesh.h
+++ b/scene/resources/mesh.h
@@ -220,6 +220,8 @@ public:
virtual int get_builtin_bind_pose_count() const;
virtual Transform3D get_builtin_bind_pose(int p_index) const;
+ virtual Ref<Resource> create_placeholder() const;
+
Mesh();
};
diff --git a/scene/resources/mesh_library.cpp b/scene/resources/mesh_library.cpp
index d45b8a9295..015eb0fa45 100644
--- a/scene/resources/mesh_library.cpp
+++ b/scene/resources/mesh_library.cpp
@@ -139,7 +139,6 @@ void MeshLibrary::set_item_name(int p_item, const String &p_name) {
ERR_FAIL_COND_MSG(!item_map.has(p_item), "Requested for nonexistent MeshLibrary item '" + itos(p_item) + "'.");
item_map[p_item].name = p_name;
emit_changed();
- notify_property_list_changed();
}
void MeshLibrary::set_item_mesh(int p_item, const Ref<Mesh> &p_mesh) {
@@ -155,7 +154,6 @@ void MeshLibrary::set_item_mesh_transform(int p_item, const Transform3D &p_trans
item_map[p_item].mesh_transform = p_transform;
notify_change_to_owners();
emit_changed();
- notify_property_list_changed();
}
void MeshLibrary::set_item_shapes(int p_item, const Vector<ShapeData> &p_shapes) {
@@ -190,7 +188,6 @@ void MeshLibrary::set_item_navigation_layers(int p_item, uint32_t p_navigation_l
notify_property_list_changed();
notify_change_to_owners();
emit_changed();
- notify_property_list_changed();
}
void MeshLibrary::set_item_preview(int p_item, const Ref<Texture2D> &p_preview) {
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 514e7eb260..7984ec735e 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -314,7 +314,19 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
//must make a copy, because this res is local to scene
}
}
- } else if (p_edit_state == GEN_EDIT_STATE_INSTANCE) {
+ }
+ if (value.get_type() == Variant::ARRAY) {
+ Array set_array = value;
+ bool is_get_valid = false;
+ Variant get_value = node->get(snames[nprops[j].name], &is_get_valid);
+ if (is_get_valid && get_value.get_type() == Variant::ARRAY) {
+ Array get_array = get_value;
+ if (!set_array.is_same_typed(get_array)) {
+ value = Array(set_array, get_array.get_typed_builtin(), get_array.get_typed_class_name(), get_array.get_typed_script());
+ }
+ }
+ }
+ if (p_edit_state == GEN_EDIT_STATE_INSTANCE && value.get_type() != Variant::OBJECT) {
value = value.duplicate(true); // Duplicate arrays and dictionaries for the editor
}
@@ -402,8 +414,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
}
}
- for (uint32_t i = 0; i < deferred_node_paths.size(); i++) {
- const DeferredNodePathProperties &dnp = deferred_node_paths[i];
+ for (const DeferredNodePathProperties &dnp : deferred_node_paths) {
Node *other = dnp.base->get_node_or_null(dnp.path);
dnp.base->set(dnp.property, other);
}
@@ -1047,6 +1058,25 @@ Ref<SceneState> SceneState::get_base_scene_state() const {
return Ref<SceneState>();
}
+void SceneState::update_instance_resource(String p_path, Ref<PackedScene> p_packed_scene) {
+ ERR_FAIL_COND(p_packed_scene.is_null());
+
+ for (const NodeData &nd : nodes) {
+ if (nd.instance >= 0) {
+ if (!(nd.instance & FLAG_INSTANCE_IS_PLACEHOLDER)) {
+ int instance_id = nd.instance & FLAG_MASK;
+ Ref<PackedScene> original_packed_scene = variants[instance_id];
+ if (original_packed_scene.is_valid()) {
+ if (original_packed_scene->get_path() == p_path) {
+ variants.remove_at(instance_id);
+ variants.insert(instance_id, p_packed_scene);
+ }
+ }
+ }
+ }
+ }
+}
+
int SceneState::find_node_by_path(const NodePath &p_node) const {
ERR_FAIL_COND_V_MSG(node_path_cache.size() == 0, -1, "This operation requires the node cache to have been built.");
diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h
index ef7363dd44..5c53ffdb45 100644
--- a/scene/resources/packed_scene.h
+++ b/scene/resources/packed_scene.h
@@ -150,6 +150,8 @@ public:
Ref<SceneState> get_base_scene_state() const;
+ void update_instance_resource(String p_path, Ref<PackedScene> p_packed_scene);
+
//unbuild API
int get_node_count() const;
diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp
index 85106883f9..3bbd0a0b5e 100644
--- a/scene/resources/polygon_path_finder.cpp
+++ b/scene/resources/polygon_path_finder.cpp
@@ -325,7 +325,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
}
const Point &np = points[least_cost_point];
- //open the neighbours for search
+ //open the neighbors for search
for (const int &E : np.connections) {
Point &p = points.write[E];
@@ -339,7 +339,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
p.distance = distance;
}
} else {
- //add to open neighbours
+ //add to open neighbors
p.prev = least_cost_point;
p.distance = distance;
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index 5ef66a22b6..86ed0001dd 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -2901,7 +2901,7 @@ void TextMesh::_create_mesh_array(Array &p_arr) const {
TS->shaped_text_set_spacing(text_rid, TextServer::SpacingType(i), font->get_spacing(TextServer::SpacingType(i)));
}
- Array stt;
+ TypedArray<Vector3i> stt;
if (st_parser == TextServer::STRUCTURED_TEXT_CUSTOM) {
GDVIRTUAL_CALL(_structured_text_parser, st_args, txt, stt);
} else {
diff --git a/scene/resources/primitive_meshes.h b/scene/resources/primitive_meshes.h
index 22cd12b004..e62f26b17c 100644
--- a/scene/resources/primitive_meshes.h
+++ b/scene/resources/primitive_meshes.h
@@ -622,7 +622,7 @@ protected:
virtual void _create_mesh_array(Array &p_arr) const override;
public:
- GDVIRTUAL2RC(Array, _structured_text_parser, Array, String)
+ GDVIRTUAL2RC(TypedArray<Vector3i>, _structured_text_parser, Array, String)
TextMesh();
~TextMesh();
diff --git a/scene/resources/rectangle_shape_2d.cpp b/scene/resources/rectangle_shape_2d.cpp
index 84c147b4b4..65b1653293 100644
--- a/scene/resources/rectangle_shape_2d.cpp
+++ b/scene/resources/rectangle_shape_2d.cpp
@@ -79,11 +79,7 @@ void RectangleShape2D::draw(const RID &p_to_rid, const Color &p_color) {
stroke_points.write[3] = Vector2(-size.x, size.y) * 0.5;
stroke_points.write[4] = -size * 0.5;
- Vector<Color> stroke_colors;
- stroke_colors.resize(5);
- for (int i = 0; i < 5; i++) {
- stroke_colors.write[i] = (p_color);
- }
+ Vector<Color> stroke_colors = { Color(p_color, 1.0) };
RenderingServer::get_singleton()->canvas_item_add_polyline(p_to_rid, stroke_points, stroke_colors);
}
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index c85c213c5d..608d15019e 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -49,10 +49,6 @@
///
-void ResourceLoaderText::set_local_path(const String &p_local_path) {
- res_path = p_local_path;
-}
-
Ref<Resource> ResourceLoaderText::get_resource() {
return resource;
}
@@ -640,6 +636,18 @@ Error ResourceLoaderText::load() {
}
}
+ if (value.get_type() == Variant::ARRAY) {
+ Array set_array = value;
+ bool is_get_valid = false;
+ Variant get_value = res->get(assign, &is_get_valid);
+ if (is_get_valid && get_value.get_type() == Variant::ARRAY) {
+ Array get_array = get_value;
+ if (!set_array.is_same_typed(get_array)) {
+ value = Array(set_array, get_array.get_typed_builtin(), get_array.get_typed_class_name(), get_array.get_typed_script());
+ }
+ }
+ }
+
if (set_valid) {
res->set(assign, value);
}
@@ -750,6 +758,18 @@ Error ResourceLoaderText::load() {
}
}
+ if (value.get_type() == Variant::ARRAY) {
+ Array set_array = value;
+ bool is_get_valid = false;
+ Variant get_value = resource->get(assign, &is_get_valid);
+ if (is_get_valid && get_value.get_type() == Variant::ARRAY) {
+ Array get_array = get_value;
+ if (!set_array.is_same_typed(get_array)) {
+ value = Array(set_array, get_array.get_typed_builtin(), get_array.get_typed_class_name(), get_array.get_typed_script());
+ }
+ }
+ }
+
if (set_valid) {
resource->set(assign, value);
}
@@ -927,7 +947,11 @@ Error ResourceLoaderText::rename_dependencies(Ref<FileAccess> p_f, const String
if (is_scene) {
fw->store_line("[gd_scene load_steps=" + itos(resources_total) + " format=" + itos(FORMAT_VERSION) + "]\n");
} else {
- fw->store_line("[gd_resource type=\"" + res_type + "\" load_steps=" + itos(resources_total) + " format=" + itos(FORMAT_VERSION) + "]\n");
+ String script_res_text;
+ if (!script_class.is_empty()) {
+ script_res_text = "script_class=\"" + script_class + "\" ";
+ }
+ fw->store_line("[gd_resource type=\"" + res_type + "\" " + script_res_text + "load_steps=" + itos(resources_total) + " format=" + itos(FORMAT_VERSION) + "]\n");
}
}
@@ -1051,6 +1075,10 @@ void ResourceLoaderText::open(Ref<FileAccess> p_f, bool p_skip_first_tag) {
return;
}
+ if (tag.fields.has("script_class")) {
+ script_class = tag.fields["script_class"];
+ }
+
res_type = tag.fields["type"];
} else {
@@ -1497,6 +1525,44 @@ Error ResourceLoaderText::get_classes_used(HashSet<StringName> *r_classes) {
return OK;
}
+String ResourceLoaderText::recognize_script_class(Ref<FileAccess> p_f) {
+ error = OK;
+
+ lines = 1;
+ f = p_f;
+
+ stream.f = f;
+
+ ignore_resource_parsing = true;
+
+ VariantParser::Tag tag;
+ Error err = VariantParser::parse_tag(&stream, lines, error_text, tag);
+
+ if (err) {
+ _printerr();
+ return "";
+ }
+
+ if (tag.fields.has("format")) {
+ int fmt = tag.fields["format"];
+ if (fmt > FORMAT_VERSION) {
+ error_text = "Saved with newer format version";
+ _printerr();
+ return "";
+ }
+ }
+
+ if (tag.name != "gd_resource") {
+ return "";
+ }
+
+ if (tag.fields.has("script_class")) {
+ return tag.fields["script_class"];
+ }
+
+ return "";
+}
+
String ResourceLoaderText::recognize(Ref<FileAccess> p_f) {
error = OK;
@@ -1666,6 +1732,25 @@ String ResourceFormatLoaderText::get_resource_type(const String &p_path) const {
return ClassDB::get_compatibility_remapped_class(r);
}
+String ResourceFormatLoaderText::get_resource_script_class(const String &p_path) const {
+ String ext = p_path.get_extension().to_lower();
+ if (ext != "tres") {
+ return String();
+ }
+
+ // ...for anything else must test...
+
+ Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
+ if (f.is_null()) {
+ return ""; //could not read
+ }
+
+ ResourceLoaderText loader;
+ loader.local_path = ProjectSettings::get_singleton()->localize_path(p_path);
+ loader.res_path = loader.local_path;
+ return loader.recognize_script_class(f);
+}
+
ResourceUID::ID ResourceFormatLoaderText::get_resource_uid(const String &p_path) const {
String ext = p_path.get_extension().to_lower();
@@ -1909,7 +1994,12 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Ref<Reso
String title = packed_scene.is_valid() ? "[gd_scene " : "[gd_resource ";
if (packed_scene.is_null()) {
title += "type=\"" + _resource_get_class(p_resource) + "\" ";
+ Ref<Script> script = p_resource->get_script();
+ if (script.is_valid() && script->get_global_name()) {
+ title += "script_class=\"" + String(script->get_global_name()) + "\" ";
+ }
}
+
int load_steps = saved_resources.size() + external_resources.size();
if (load_steps > 1) {
@@ -2248,7 +2338,12 @@ Error ResourceLoaderText::set_uid(Ref<FileAccess> p_f, ResourceUID::ID p_uid) {
if (is_scene) {
fw->store_string("[gd_scene load_steps=" + itos(resources_total) + " format=" + itos(FORMAT_VERSION) + " uid=\"" + ResourceUID::get_singleton()->id_to_text(p_uid) + "\"]");
} else {
- fw->store_string("[gd_resource type=\"" + res_type + "\" load_steps=" + itos(resources_total) + " format=" + itos(FORMAT_VERSION) + " uid=\"" + ResourceUID::get_singleton()->id_to_text(p_uid) + "\"]");
+ String script_res_text;
+ if (!script_class.is_empty()) {
+ script_res_text = "script_class=\"" + script_class + "\" ";
+ }
+
+ fw->store_string("[gd_resource type=\"" + res_type + "\" " + script_res_text + "load_steps=" + itos(resources_total) + " format=" + itos(FORMAT_VERSION) + " uid=\"" + ResourceUID::get_singleton()->id_to_text(p_uid) + "\"]");
}
uint8_t c = f->get_8();
diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h
index 0f95e2fbfd..25001d8023 100644
--- a/scene/resources/resource_format_text.h
+++ b/scene/resources/resource_format_text.h
@@ -64,6 +64,7 @@ class ResourceLoaderText {
int resources_total = 0;
int resource_current = 0;
String resource_type;
+ String script_class;
VariantParser::Tag next_tag;
@@ -115,7 +116,6 @@ class ResourceLoaderText {
Ref<PackedScene> _parse_node_tag(VariantParser::ResourceParser &parser);
public:
- void set_local_path(const String &p_local_path);
Ref<Resource> get_resource();
Error load();
Error set_uid(Ref<FileAccess> p_f, ResourceUID::ID p_uid);
@@ -125,6 +125,7 @@ public:
void open(Ref<FileAccess> p_f, bool p_skip_first_tag = false);
String recognize(Ref<FileAccess> p_f);
+ String recognize_script_class(Ref<FileAccess> p_f);
ResourceUID::ID get_uid(Ref<FileAccess> p_f);
void get_dependencies(Ref<FileAccess> p_f, List<String> *p_dependencies, bool p_add_types);
Error rename_dependencies(Ref<FileAccess> p_f, const String &p_path, const HashMap<String, String> &p_map);
@@ -144,6 +145,7 @@ public:
virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes);
virtual String get_resource_type(const String &p_path) const;
+ virtual String get_resource_script_class(const String &p_path) const;
virtual ResourceUID::ID get_resource_uid(const String &p_path) const;
virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
virtual Error rename_dependencies(const String &p_path, const HashMap<String, String> &p_map);
diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp
index 9bb2db17ab..fd2be9ba22 100644
--- a/scene/resources/shader.cpp
+++ b/scene/resources/shader.cpp
@@ -42,10 +42,12 @@ Shader::Mode Shader::get_mode() const {
}
void Shader::_dependency_changed() {
- RenderingServer::get_singleton()->shader_set_code(shader, RenderingServer::get_singleton()->shader_get_code(shader));
- params_cache_dirty = true;
+ // Preprocess and compile the code again because a dependency has changed. It also calls emit_changed() for us.
+ _recompile();
+}
- emit_changed();
+void Shader::_recompile() {
+ set_code(get_code());
}
void Shader::set_path(const String &p_path, bool p_take_over) {
@@ -53,6 +55,12 @@ void Shader::set_path(const String &p_path, bool p_take_over) {
RS::get_singleton()->shader_set_path_hint(shader, p_path);
}
+void Shader::set_include_path(const String &p_path) {
+ // Used only if the shader does not have a resource path set,
+ // for example during loading stage or when created by code.
+ include_path = p_path;
+}
+
void Shader::set_code(const String &p_code) {
for (Ref<ShaderInclude> E : include_dependencies) {
E->disconnect(SNAME("changed"), callable_mp(this, &Shader::_dependency_changed));
@@ -78,11 +86,15 @@ void Shader::set_code(const String &p_code) {
HashSet<Ref<ShaderInclude>> new_include_dependencies;
{
+ String path = get_path();
+ if (path.is_empty()) {
+ path = include_path;
+ }
// Preprocessor must run here and not in the server because:
// 1) Need to keep track of include dependencies at resource level
// 2) Server does not do interaction with Resource filetypes, this is a scene level feature.
ShaderPreprocessor preprocessor;
- preprocessor.preprocess(p_code, "", pp_code, nullptr, nullptr, nullptr, &new_include_dependencies);
+ preprocessor.preprocess(p_code, path, pp_code, nullptr, nullptr, nullptr, &new_include_dependencies);
}
// This ensures previous include resources are not freed and then re-loaded during parse (which would make compiling slower)
@@ -93,7 +105,6 @@ void Shader::set_code(const String &p_code) {
}
RenderingServer::get_singleton()->shader_set_code(shader, pp_code);
- params_cache_dirty = true;
emit_changed();
}
@@ -108,8 +119,6 @@ void Shader::get_shader_uniform_list(List<PropertyInfo> *p_params, bool p_get_gr
List<PropertyInfo> local;
RenderingServer::get_singleton()->get_shader_parameter_list(shader, &local);
- params_cache.clear();
- params_cache_dirty = false;
for (PropertyInfo &pi : local) {
bool is_group = pi.usage == PROPERTY_USAGE_GROUP || pi.usage == PROPERTY_USAGE_SUBGROUP;
@@ -120,7 +129,6 @@ void Shader::get_shader_uniform_list(List<PropertyInfo> *p_params, bool p_get_gr
if (default_textures.has(pi.name)) { //do not show default textures
continue;
}
- params_cache[pi.name] = pi.name;
}
if (p_params) {
//small little hack
@@ -176,11 +184,17 @@ bool Shader::is_text_shader() const {
return true;
}
-bool Shader::has_parameter(const StringName &p_name) const {
- return params_cache.has(p_name);
+void Shader::_update_shader() const {
}
-void Shader::_update_shader() const {
+Array Shader::_get_shader_uniform_list(bool p_get_groups) {
+ List<PropertyInfo> uniform_list;
+ get_shader_uniform_list(&uniform_list, p_get_groups);
+ Array ret;
+ for (const PropertyInfo &pi : uniform_list) {
+ ret.push_back(pi.operator Dictionary());
+ }
+ return ret;
}
void Shader::_bind_methods() {
@@ -192,7 +206,7 @@ void Shader::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_default_texture_parameter", "name", "texture", "index"), &Shader::set_default_texture_parameter, DEFVAL(0));
ClassDB::bind_method(D_METHOD("get_default_texture_parameter", "name", "index"), &Shader::get_default_texture_parameter, DEFVAL(0));
- ClassDB::bind_method(D_METHOD("has_parameter", "name"), &Shader::has_parameter);
+ ClassDB::bind_method(D_METHOD("get_shader_uniform_list", "get_groups"), &Shader::_get_shader_uniform_list, DEFVAL(false));
ADD_PROPERTY(PropertyInfo(Variant::STRING, "code", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_code", "get_code");
@@ -227,6 +241,7 @@ Ref<Resource> ResourceFormatLoaderShader::load(const String &p_path, const Strin
String str;
str.parse_utf8((const char *)buffer.ptr(), buffer.size());
+ shader->set_include_path(p_path);
shader->set_code(str);
if (r_error) {
diff --git a/scene/resources/shader.h b/scene/resources/shader.h
index e579c2fca1..ca889940ef 100644
--- a/scene/resources/shader.h
+++ b/scene/resources/shader.h
@@ -56,16 +56,15 @@ private:
Mode mode = MODE_SPATIAL;
HashSet<Ref<ShaderInclude>> include_dependencies;
String code;
+ String include_path;
- // hack the name of performance
- // shaders keep a list of ShaderMaterial -> RenderingServer name translations, to make
- // conversion fast and save memory.
- mutable bool params_cache_dirty = true;
- mutable HashMap<StringName, StringName> params_cache; //map a shader param to a material param..
HashMap<StringName, HashMap<int, Ref<Texture2D>>> default_textures;
void _dependency_changed();
+ void _recompile();
virtual void _update_shader() const; //used for visual shader
+ Array _get_shader_uniform_list(bool p_get_groups = false);
+
protected:
static void _bind_methods();
@@ -74,12 +73,12 @@ public:
virtual Mode get_mode() const;
virtual void set_path(const String &p_path, bool p_take_over = false) override;
+ void set_include_path(const String &p_path);
void set_code(const String &p_code);
String get_code() const;
void get_shader_uniform_list(List<PropertyInfo> *p_params, bool p_get_groups = false) const;
- bool has_parameter(const StringName &p_name) const;
void set_default_texture_parameter(const StringName &p_name, const Ref<Texture2D> &p_texture, int p_index = 0);
Ref<Texture2D> get_default_texture_parameter(const StringName &p_name, int p_index = 0) const;
@@ -87,47 +86,6 @@ public:
virtual bool is_text_shader() const;
- // Finds the shader parameter name for the given property name, which should start with "shader_parameter/".
- _FORCE_INLINE_ StringName remap_parameter(const StringName &p_property) const {
- if (params_cache_dirty) {
- get_shader_uniform_list(nullptr);
- }
-
- String n = p_property;
-
- // Backwards compatibility with old shader parameter names.
- // Note: The if statements are important to make sure we are only replacing text exactly at index 0.
- if (n.find("param/") == 0) {
- n = n.replace_first("param/", "shader_parameter/");
- }
- if (n.find("shader_param/") == 0) {
- n = n.replace_first("shader_param/", "shader_parameter/");
- }
- if (n.find("shader_uniform/") == 0) {
- n = n.replace_first("shader_uniform/", "shader_parameter/");
- }
-
- {
- // Additional backwards compatibility for projects between #62972 and #64092 (about a month of v4.0 development).
- // These projects did not have any prefix for shader uniforms due to a bug.
- // This code should be removed during beta or rc of 4.0.
- const HashMap<StringName, StringName>::Iterator E = params_cache.find(n);
- if (E) {
- return E->value;
- }
- }
-
- if (n.begins_with("shader_parameter/")) {
- n = n.replace_first("shader_parameter/", "");
- const HashMap<StringName, StringName>::Iterator E = params_cache.find(n);
- if (E) {
- return E->value;
- }
- }
-
- return StringName();
- }
-
virtual RID get_rid() const override;
Shader();
diff --git a/scene/resources/shader_include.cpp b/scene/resources/shader_include.cpp
index cd5e9861f7..68137cbec0 100644
--- a/scene/resources/shader_include.cpp
+++ b/scene/resources/shader_include.cpp
@@ -45,9 +45,14 @@ void ShaderInclude::set_code(const String &p_code) {
}
{
+ String path = get_path();
+ if (path.is_empty()) {
+ path = include_path;
+ }
+
String pp_code;
ShaderPreprocessor preprocessor;
- preprocessor.preprocess(p_code, "", pp_code, nullptr, nullptr, nullptr, &new_dependencies);
+ preprocessor.preprocess(p_code, path, pp_code, nullptr, nullptr, nullptr, &new_dependencies);
}
// This ensures previous include resources are not freed and then re-loaded during parse (which would make compiling slower)
@@ -64,6 +69,10 @@ String ShaderInclude::get_code() const {
return code;
}
+void ShaderInclude::set_include_path(const String &p_path) {
+ include_path = p_path;
+}
+
void ShaderInclude::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_code", "code"), &ShaderInclude::set_code);
ClassDB::bind_method(D_METHOD("get_code"), &ShaderInclude::get_code);
@@ -86,6 +95,7 @@ Ref<Resource> ResourceFormatLoaderShaderInclude::load(const String &p_path, cons
String str;
str.parse_utf8((const char *)buffer.ptr(), buffer.size());
+ shader_inc->set_include_path(p_path);
shader_inc->set_code(str);
if (r_error) {
diff --git a/scene/resources/shader_include.h b/scene/resources/shader_include.h
index 04f4f5cf84..a8949b327e 100644
--- a/scene/resources/shader_include.h
+++ b/scene/resources/shader_include.h
@@ -42,6 +42,7 @@ class ShaderInclude : public Resource {
private:
String code;
+ String include_path;
HashSet<Ref<ShaderInclude>> dependencies;
void _dependency_changed();
@@ -51,6 +52,8 @@ protected:
public:
void set_code(const String &p_text);
String get_code() const;
+
+ void set_include_path(const String &p_path);
};
class ResourceFormatLoaderShaderInclude : public ResourceFormatLoader {
diff --git a/scene/resources/skeleton_modification_2d_stackholder.cpp b/scene/resources/skeleton_modification_2d_stackholder.cpp
index 121108965b..34d31bac8a 100644
--- a/scene/resources/skeleton_modification_2d_stackholder.cpp
+++ b/scene/resources/skeleton_modification_2d_stackholder.cpp
@@ -64,7 +64,7 @@ bool SkeletonModification2DStackHolder::_get(const StringName &p_path, Variant &
}
void SkeletonModification2DStackHolder::_get_property_list(List<PropertyInfo> *p_list) const {
- p_list->push_back(PropertyInfo(Variant::OBJECT, "held_modification_stack", PROPERTY_HINT_RESOURCE_TYPE, "SkeletonModificationStack2D", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE));
+ p_list->push_back(PropertyInfo(Variant::OBJECT, "held_modification_stack", PROPERTY_HINT_RESOURCE_TYPE, "SkeletonModificationStack2D", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_ALWAYS_DUPLICATE));
#ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint()) {
diff --git a/scene/resources/skeleton_modification_stack_2d.cpp b/scene/resources/skeleton_modification_stack_2d.cpp
index 4fa287e7b6..71ddbc0898 100644
--- a/scene/resources/skeleton_modification_stack_2d.cpp
+++ b/scene/resources/skeleton_modification_stack_2d.cpp
@@ -37,7 +37,7 @@ void SkeletonModificationStack2D::_get_property_list(List<PropertyInfo> *p_list)
PropertyInfo(Variant::OBJECT, "modifications/" + itos(i),
PROPERTY_HINT_RESOURCE_TYPE,
"SkeletonModification2D",
- PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DEFERRED_SET_RESOURCE | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE));
+ PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DEFERRED_SET_RESOURCE | PROPERTY_USAGE_ALWAYS_DUPLICATE));
}
}
diff --git a/scene/resources/sprite_frames.cpp b/scene/resources/sprite_frames.cpp
index c101974248..818be38681 100644
--- a/scene/resources/sprite_frames.cpp
+++ b/scene/resources/sprite_frames.cpp
@@ -36,7 +36,7 @@ void SpriteFrames::add_frame(const StringName &p_anim, const Ref<Texture2D> &p_t
HashMap<StringName, Anim>::Iterator E = animations.find(p_anim);
ERR_FAIL_COND_MSG(!E, "Animation '" + String(p_anim) + "' doesn't exist.");
- p_duration = MAX(0.0, p_duration);
+ p_duration = MAX(SPRITE_FRAME_MINIMUM_DURATION, p_duration);
Frame frame = { p_texture, p_duration };
@@ -57,7 +57,7 @@ void SpriteFrames::set_frame(const StringName &p_anim, int p_idx, const Ref<Text
return;
}
- p_duration = MAX(0.0, p_duration);
+ p_duration = MAX(SPRITE_FRAME_MINIMUM_DURATION, p_duration);
Frame frame = { p_texture, p_duration };
@@ -214,7 +214,7 @@ void SpriteFrames::_set_animations(const Array &p_animations) {
ERR_CONTINUE(!f.has("texture"));
ERR_CONTINUE(!f.has("duration"));
- Frame frame = { f["texture"], f["duration"] };
+ Frame frame = { f["texture"], MAX(SPRITE_FRAME_MINIMUM_DURATION, (float)f["duration"]) };
anim.frames.push_back(frame);
}
diff --git a/scene/resources/sprite_frames.h b/scene/resources/sprite_frames.h
index 61bead6948..6de2b4a37b 100644
--- a/scene/resources/sprite_frames.h
+++ b/scene/resources/sprite_frames.h
@@ -33,6 +33,8 @@
#include "scene/resources/texture.h"
+static const float SPRITE_FRAME_MINIMUM_DURATION = 0.01;
+
class SpriteFrames : public Resource {
GDCLASS(SpriteFrames, Resource);
@@ -89,10 +91,10 @@ public:
_FORCE_INLINE_ float get_frame_duration(const StringName &p_anim, int p_idx) const {
HashMap<StringName, Anim>::ConstIterator E = animations.find(p_anim);
- ERR_FAIL_COND_V_MSG(!E, 0.0, "Animation '" + String(p_anim) + "' doesn't exist.");
- ERR_FAIL_COND_V(p_idx < 0, 0.0);
+ ERR_FAIL_COND_V_MSG(!E, 1.0, "Animation '" + String(p_anim) + "' doesn't exist.");
+ ERR_FAIL_COND_V(p_idx < 0, 1.0);
if (p_idx >= E->value.frames.size()) {
- return 0.0;
+ return 1.0;
}
return E->value.frames[p_idx].duration;
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index 6390850b24..9e0b856ecd 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -34,76 +34,65 @@
#include <limits.h>
-float StyleBox::get_style_margin(Side p_side) const {
- float ret = 0;
- GDVIRTUAL_REQUIRED_CALL(_get_style_margin, p_side, ret);
- return ret;
-}
+Size2 StyleBox::get_minimum_size() const {
+ Size2 min_size = Size2(get_margin(SIDE_LEFT) + get_margin(SIDE_RIGHT), get_margin(SIDE_TOP) + get_margin(SIDE_BOTTOM));
+ Size2 custom_size;
+ GDVIRTUAL_CALL(_get_minimum_size, custom_size);
-bool StyleBox::test_mask(const Point2 &p_point, const Rect2 &p_rect) const {
- bool ret = true;
- GDVIRTUAL_CALL(_test_mask, p_point, p_rect, ret);
- return ret;
-}
+ if (min_size.x < custom_size.x) {
+ min_size.x = custom_size.x;
+ }
+ if (min_size.y < custom_size.y) {
+ min_size.y = custom_size.y;
+ }
-void StyleBox::draw(RID p_canvas_item, const Rect2 &p_rect) const {
- GDVIRTUAL_REQUIRED_CALL(_draw, p_canvas_item, p_rect);
+ return min_size;
}
-void StyleBox::set_default_margin(Side p_side, float p_value) {
+void StyleBox::set_content_margin(Side p_side, float p_value) {
ERR_FAIL_INDEX((int)p_side, 4);
- margin[p_side] = p_value;
+ content_margin[p_side] = p_value;
emit_changed();
}
-void StyleBox::set_default_margin_all(float p_value) {
+void StyleBox::set_content_margin_all(float p_value) {
for (int i = 0; i < 4; i++) {
- margin[i] = p_value;
+ content_margin[i] = p_value;
}
emit_changed();
}
-void StyleBox::set_default_margin_individual(float p_left, float p_top, float p_right, float p_bottom) {
- margin[SIDE_LEFT] = p_left;
- margin[SIDE_TOP] = p_top;
- margin[SIDE_RIGHT] = p_right;
- margin[SIDE_BOTTOM] = p_bottom;
+void StyleBox::set_content_margin_individual(float p_left, float p_top, float p_right, float p_bottom) {
+ content_margin[SIDE_LEFT] = p_left;
+ content_margin[SIDE_TOP] = p_top;
+ content_margin[SIDE_RIGHT] = p_right;
+ content_margin[SIDE_BOTTOM] = p_bottom;
emit_changed();
}
-float StyleBox::get_default_margin(Side p_side) const {
+float StyleBox::get_content_margin(Side p_side) const {
ERR_FAIL_INDEX_V((int)p_side, 4, 0.0);
- return margin[p_side];
+ return content_margin[p_side];
}
float StyleBox::get_margin(Side p_side) const {
ERR_FAIL_INDEX_V((int)p_side, 4, 0.0);
- if (margin[p_side] < 0) {
+ if (content_margin[p_side] < 0) {
return get_style_margin(p_side);
} else {
- return margin[p_side];
+ return content_margin[p_side];
}
}
-CanvasItem *StyleBox::get_current_item_drawn() const {
- return CanvasItem::get_current_item_drawn();
-}
-
-Size2 StyleBox::get_minimum_size() const {
- return Size2(get_margin(SIDE_LEFT) + get_margin(SIDE_RIGHT), get_margin(SIDE_TOP) + get_margin(SIDE_BOTTOM));
-}
-
Point2 StyleBox::get_offset() const {
return Point2(get_margin(SIDE_LEFT), get_margin(SIDE_TOP));
}
-Size2 StyleBox::get_center_size() const {
- Size2 ret;
- GDVIRTUAL_CALL(_get_center_size, ret);
- return ret;
+void StyleBox::draw(RID p_canvas_item, const Rect2 &p_rect) const {
+ GDVIRTUAL_REQUIRED_CALL(_draw, p_canvas_item, p_rect);
}
Rect2 StyleBox::get_draw_rect(const Rect2 &p_rect) const {
@@ -114,37 +103,46 @@ Rect2 StyleBox::get_draw_rect(const Rect2 &p_rect) const {
return p_rect;
}
+CanvasItem *StyleBox::get_current_item_drawn() const {
+ return CanvasItem::get_current_item_drawn();
+}
+
+bool StyleBox::test_mask(const Point2 &p_point, const Rect2 &p_rect) const {
+ bool ret = true;
+ GDVIRTUAL_CALL(_test_mask, p_point, p_rect, ret);
+ return ret;
+}
+
void StyleBox::_bind_methods() {
- ClassDB::bind_method(D_METHOD("test_mask", "point", "rect"), &StyleBox::test_mask);
+ ClassDB::bind_method(D_METHOD("get_minimum_size"), &StyleBox::get_minimum_size);
- ClassDB::bind_method(D_METHOD("set_default_margin", "margin", "offset"), &StyleBox::set_default_margin);
- ClassDB::bind_method(D_METHOD("set_default_margin_all", "offset"), &StyleBox::set_default_margin_all);
- ClassDB::bind_method(D_METHOD("get_default_margin", "margin"), &StyleBox::get_default_margin);
+ ClassDB::bind_method(D_METHOD("set_content_margin", "margin", "offset"), &StyleBox::set_content_margin);
+ ClassDB::bind_method(D_METHOD("set_content_margin_all", "offset"), &StyleBox::set_content_margin_all);
+ ClassDB::bind_method(D_METHOD("get_content_margin", "margin"), &StyleBox::get_content_margin);
ClassDB::bind_method(D_METHOD("get_margin", "margin"), &StyleBox::get_margin);
- ClassDB::bind_method(D_METHOD("get_minimum_size"), &StyleBox::get_minimum_size);
- ClassDB::bind_method(D_METHOD("get_center_size"), &StyleBox::get_center_size);
ClassDB::bind_method(D_METHOD("get_offset"), &StyleBox::get_offset);
- ClassDB::bind_method(D_METHOD("get_current_item_drawn"), &StyleBox::get_current_item_drawn);
ClassDB::bind_method(D_METHOD("draw", "canvas_item", "rect"), &StyleBox::draw);
+ ClassDB::bind_method(D_METHOD("get_current_item_drawn"), &StyleBox::get_current_item_drawn);
+
+ ClassDB::bind_method(D_METHOD("test_mask", "point", "rect"), &StyleBox::test_mask);
ADD_GROUP("Content Margins", "content_margin_");
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "content_margin_left", PROPERTY_HINT_RANGE, "-1,2048,1,suffix:px"), "set_default_margin", "get_default_margin", SIDE_LEFT);
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "content_margin_top", PROPERTY_HINT_RANGE, "-1,2048,1,suffix:px"), "set_default_margin", "get_default_margin", SIDE_TOP);
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "content_margin_right", PROPERTY_HINT_RANGE, "-1,2048,1,suffix:px"), "set_default_margin", "get_default_margin", SIDE_RIGHT);
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "content_margin_bottom", PROPERTY_HINT_RANGE, "-1,2048,1,suffix:px"), "set_default_margin", "get_default_margin", SIDE_BOTTOM);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "content_margin_left", PROPERTY_HINT_RANGE, "-1,2048,1,suffix:px"), "set_content_margin", "get_content_margin", SIDE_LEFT);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "content_margin_top", PROPERTY_HINT_RANGE, "-1,2048,1,suffix:px"), "set_content_margin", "get_content_margin", SIDE_TOP);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "content_margin_right", PROPERTY_HINT_RANGE, "-1,2048,1,suffix:px"), "set_content_margin", "get_content_margin", SIDE_RIGHT);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "content_margin_bottom", PROPERTY_HINT_RANGE, "-1,2048,1,suffix:px"), "set_content_margin", "get_content_margin", SIDE_BOTTOM);
- GDVIRTUAL_BIND(_get_style_margin, "side")
- GDVIRTUAL_BIND(_test_mask, "point", "rect")
- GDVIRTUAL_BIND(_get_center_size)
- GDVIRTUAL_BIND(_get_draw_rect, "rect")
GDVIRTUAL_BIND(_draw, "to_canvas_item", "rect")
+ GDVIRTUAL_BIND(_get_draw_rect, "rect")
+ GDVIRTUAL_BIND(_get_minimum_size)
+ GDVIRTUAL_BIND(_test_mask, "point", "rect")
}
StyleBox::StyleBox() {
for (int i = 0; i < 4; i++) {
- margin[i] = -1;
+ content_margin[i] = -1;
}
}
@@ -153,11 +151,6 @@ void StyleBoxTexture::set_texture(Ref<Texture2D> p_texture) {
return;
}
texture = p_texture;
- if (p_texture.is_null()) {
- region_rect = Rect2(0, 0, 0, 0);
- } else {
- region_rect = Rect2(Point2(), texture->get_size());
- }
emit_changed();
}
@@ -165,38 +158,38 @@ Ref<Texture2D> StyleBoxTexture::get_texture() const {
return texture;
}
-void StyleBoxTexture::set_margin_size(Side p_side, float p_size) {
+void StyleBoxTexture::set_texture_margin(Side p_side, float p_size) {
ERR_FAIL_INDEX((int)p_side, 4);
- margin[p_side] = p_size;
+ texture_margin[p_side] = p_size;
emit_changed();
}
-void StyleBoxTexture::set_margin_size_all(float p_size) {
+void StyleBoxTexture::set_texture_margin_all(float p_size) {
for (int i = 0; i < 4; i++) {
- margin[i] = p_size;
+ texture_margin[i] = p_size;
}
emit_changed();
}
-void StyleBoxTexture::set_margin_size_individual(float p_left, float p_top, float p_right, float p_bottom) {
- margin[SIDE_LEFT] = p_left;
- margin[SIDE_TOP] = p_top;
- margin[SIDE_RIGHT] = p_right;
- margin[SIDE_BOTTOM] = p_bottom;
+void StyleBoxTexture::set_texture_margin_individual(float p_left, float p_top, float p_right, float p_bottom) {
+ texture_margin[SIDE_LEFT] = p_left;
+ texture_margin[SIDE_TOP] = p_top;
+ texture_margin[SIDE_RIGHT] = p_right;
+ texture_margin[SIDE_BOTTOM] = p_bottom;
emit_changed();
}
-float StyleBoxTexture::get_margin_size(Side p_side) const {
+float StyleBoxTexture::get_texture_margin(Side p_side) const {
ERR_FAIL_INDEX_V((int)p_side, 4, 0.0);
- return margin[p_side];
+ return texture_margin[p_side];
}
float StyleBoxTexture::get_style_margin(Side p_side) const {
ERR_FAIL_INDEX_V((int)p_side, 4, 0.0);
- return margin[p_side];
+ return texture_margin[p_side];
}
Rect2 StyleBoxTexture::get_draw_rect(const Rect2 &p_rect) const {
@@ -218,7 +211,10 @@ void StyleBoxTexture::draw(RID p_canvas_item, const Rect2 &p_rect) const {
rect.size.x += expand_margin[SIDE_LEFT] + expand_margin[SIDE_RIGHT];
rect.size.y += expand_margin[SIDE_TOP] + expand_margin[SIDE_BOTTOM];
- RenderingServer::get_singleton()->canvas_item_add_nine_patch(p_canvas_item, rect, src_rect, texture->get_rid(), Vector2(margin[SIDE_LEFT], margin[SIDE_TOP]), Vector2(margin[SIDE_RIGHT], margin[SIDE_BOTTOM]), RS::NinePatchAxisMode(axis_h), RS::NinePatchAxisMode(axis_v), draw_center, modulate);
+ Vector2 start_offset = Vector2(texture_margin[SIDE_LEFT], texture_margin[SIDE_TOP]);
+ Vector2 end_offset = Vector2(texture_margin[SIDE_RIGHT], texture_margin[SIDE_BOTTOM]);
+
+ RenderingServer::get_singleton()->canvas_item_add_nine_patch(p_canvas_item, rect, src_rect, texture->get_rid(), start_offset, end_offset, RS::NinePatchAxisMode(axis_h), RS::NinePatchAxisMode(axis_v), draw_center, modulate);
}
void StyleBoxTexture::set_draw_center(bool p_enabled) {
@@ -230,21 +226,13 @@ bool StyleBoxTexture::is_draw_center_enabled() const {
return draw_center;
}
-Size2 StyleBoxTexture::get_center_size() const {
- if (texture.is_null()) {
- return Size2();
- }
-
- return region_rect.size - get_minimum_size();
-}
-
-void StyleBoxTexture::set_expand_margin_size(Side p_side, float p_size) {
+void StyleBoxTexture::set_expand_margin(Side p_side, float p_size) {
ERR_FAIL_INDEX((int)p_side, 4);
expand_margin[p_side] = p_size;
emit_changed();
}
-void StyleBoxTexture::set_expand_margin_size_individual(float p_left, float p_top, float p_right, float p_bottom) {
+void StyleBoxTexture::set_expand_margin_individual(float p_left, float p_top, float p_right, float p_bottom) {
expand_margin[SIDE_LEFT] = p_left;
expand_margin[SIDE_TOP] = p_top;
expand_margin[SIDE_RIGHT] = p_right;
@@ -252,14 +240,14 @@ void StyleBoxTexture::set_expand_margin_size_individual(float p_left, float p_to
emit_changed();
}
-void StyleBoxTexture::set_expand_margin_size_all(float p_expand_margin_size) {
+void StyleBoxTexture::set_expand_margin_all(float p_expand_margin_size) {
for (int i = 0; i < 4; i++) {
expand_margin[i] = p_expand_margin_size;
}
emit_changed();
}
-float StyleBoxTexture::get_expand_margin_size(Side p_side) const {
+float StyleBoxTexture::get_expand_margin(Side p_side) const {
ERR_FAIL_INDEX_V((int)p_side, 4, 0);
return expand_margin[p_side];
}
@@ -313,13 +301,13 @@ void StyleBoxTexture::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_texture", "texture"), &StyleBoxTexture::set_texture);
ClassDB::bind_method(D_METHOD("get_texture"), &StyleBoxTexture::get_texture);
- ClassDB::bind_method(D_METHOD("set_margin_size", "margin", "size"), &StyleBoxTexture::set_margin_size);
- ClassDB::bind_method(D_METHOD("set_margin_size_all", "size"), &StyleBoxTexture::set_margin_size_all);
- ClassDB::bind_method(D_METHOD("get_margin_size", "margin"), &StyleBoxTexture::get_margin_size);
+ ClassDB::bind_method(D_METHOD("set_texture_margin", "margin", "size"), &StyleBoxTexture::set_texture_margin);
+ ClassDB::bind_method(D_METHOD("set_texture_margin_all", "size"), &StyleBoxTexture::set_texture_margin_all);
+ ClassDB::bind_method(D_METHOD("get_texture_margin", "margin"), &StyleBoxTexture::get_texture_margin);
- ClassDB::bind_method(D_METHOD("set_expand_margin_size", "margin", "size"), &StyleBoxTexture::set_expand_margin_size);
- ClassDB::bind_method(D_METHOD("set_expand_margin_all", "size"), &StyleBoxTexture::set_expand_margin_size_all);
- ClassDB::bind_method(D_METHOD("get_expand_margin_size", "margin"), &StyleBoxTexture::get_expand_margin_size);
+ ClassDB::bind_method(D_METHOD("set_expand_margin", "margin", "size"), &StyleBoxTexture::set_expand_margin);
+ ClassDB::bind_method(D_METHOD("set_expand_margin_all", "size"), &StyleBoxTexture::set_expand_margin_all);
+ ClassDB::bind_method(D_METHOD("get_expand_margin", "margin"), &StyleBoxTexture::get_expand_margin);
ClassDB::bind_method(D_METHOD("set_region_rect", "region"), &StyleBoxTexture::set_region_rect);
ClassDB::bind_method(D_METHOD("get_region_rect"), &StyleBoxTexture::get_region_rect);
@@ -338,17 +326,17 @@ void StyleBoxTexture::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture");
- ADD_GROUP("Margins", "margin_");
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "margin_left", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_margin_size", "get_margin_size", SIDE_LEFT);
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "margin_top", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_margin_size", "get_margin_size", SIDE_TOP);
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "margin_right", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_margin_size", "get_margin_size", SIDE_RIGHT);
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "margin_bottom", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_margin_size", "get_margin_size", SIDE_BOTTOM);
+ ADD_GROUP("Texture Margins", "texture_margin_");
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "texture_margin_left", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_texture_margin", "get_texture_margin", SIDE_LEFT);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "texture_margin_top", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_texture_margin", "get_texture_margin", SIDE_TOP);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "texture_margin_right", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_texture_margin", "get_texture_margin", SIDE_RIGHT);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "texture_margin_bottom", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_texture_margin", "get_texture_margin", SIDE_BOTTOM);
ADD_GROUP("Expand Margins", "expand_margin_");
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_left", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_expand_margin_size", "get_expand_margin_size", SIDE_LEFT);
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_top", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_expand_margin_size", "get_expand_margin_size", SIDE_TOP);
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_right", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_expand_margin_size", "get_expand_margin_size", SIDE_RIGHT);
- ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_bottom", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_expand_margin_size", "get_expand_margin_size", SIDE_BOTTOM);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_left", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_expand_margin", "get_expand_margin", SIDE_LEFT);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_top", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_expand_margin", "get_expand_margin", SIDE_TOP);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_right", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_expand_margin", "get_expand_margin", SIDE_RIGHT);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_bottom", PROPERTY_HINT_RANGE, "0,2048,1,suffix:px"), "set_expand_margin", "get_expand_margin", SIDE_BOTTOM);
ADD_GROUP("Axis Stretch", "axis_stretch_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "axis_stretch_horizontal", PROPERTY_HINT_ENUM, "Stretch,Tile,Tile Fit"), "set_h_axis_stretch_mode", "get_h_axis_stretch_mode");
@@ -450,13 +438,13 @@ int StyleBoxFlat::get_corner_radius(const Corner p_corner) const {
return corner_radius[p_corner];
}
-void StyleBoxFlat::set_expand_margin_size(Side p_side, float p_size) {
+void StyleBoxFlat::set_expand_margin(Side p_side, float p_size) {
ERR_FAIL_INDEX((int)p_side, 4);
expand_margin[p_side] = p_size;
emit_changed();
}
-void StyleBoxFlat::set_expand_margin_size_individual(float p_left, float p_top, float p_right, float p_bottom) {
+void StyleBoxFlat::set_expand_margin_individual(float p_left, float p_top, float p_right, float p_bottom) {
expand_margin[SIDE_LEFT] = p_left;
expand_margin[SIDE_TOP] = p_top;
expand_margin[SIDE_RIGHT] = p_right;
@@ -464,14 +452,14 @@ void StyleBoxFlat::set_expand_margin_size_individual(float p_left, float p_top,
emit_changed();
}
-void StyleBoxFlat::set_expand_margin_size_all(float p_expand_margin_size) {
+void StyleBoxFlat::set_expand_margin_all(float p_expand_margin_size) {
for (int i = 0; i < 4; i++) {
expand_margin[i] = p_expand_margin_size;
}
emit_changed();
}
-float StyleBoxFlat::get_expand_margin_size(Side p_side) const {
+float StyleBoxFlat::get_expand_margin(Side p_side) const {
ERR_FAIL_INDEX_V((int)p_side, 4, 0.0);
return expand_margin[p_side];
}
@@ -549,10 +537,6 @@ int StyleBoxFlat::get_corner_detail() const {
return corner_detail;
}
-Size2 StyleBoxFlat::get_center_size() const {
- return Size2();
-}
-
inline void set_inner_corner_radius(const Rect2 style_rect, const Rect2 inner_rect, const real_t corner_radius[4], real_t *inner_corner_radius) {
real_t border_left = inner_rect.position.x - style_rect.position.x;
real_t border_top = inner_rect.position.y - style_rect.position.y;
@@ -891,9 +875,9 @@ void StyleBoxFlat::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_corner_radius", "corner", "radius"), &StyleBoxFlat::set_corner_radius);
ClassDB::bind_method(D_METHOD("get_corner_radius", "corner"), &StyleBoxFlat::get_corner_radius);
- ClassDB::bind_method(D_METHOD("set_expand_margin", "margin", "size"), &StyleBoxFlat::set_expand_margin_size);
- ClassDB::bind_method(D_METHOD("set_expand_margin_all", "size"), &StyleBoxFlat::set_expand_margin_size_all);
- ClassDB::bind_method(D_METHOD("get_expand_margin", "margin"), &StyleBoxFlat::get_expand_margin_size);
+ ClassDB::bind_method(D_METHOD("set_expand_margin", "margin", "size"), &StyleBoxFlat::set_expand_margin);
+ ClassDB::bind_method(D_METHOD("set_expand_margin_all", "size"), &StyleBoxFlat::set_expand_margin_all);
+ ClassDB::bind_method(D_METHOD("get_expand_margin", "margin"), &StyleBoxFlat::get_expand_margin);
ClassDB::bind_method(D_METHOD("set_draw_center", "draw_center"), &StyleBoxFlat::set_draw_center);
ClassDB::bind_method(D_METHOD("is_draw_center_enabled"), &StyleBoxFlat::is_draw_center_enabled);
@@ -1023,7 +1007,7 @@ void StyleBoxLine::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "grow_begin", PROPERTY_HINT_RANGE, "-300,300,1,suffix:px"), "set_grow_begin", "get_grow_begin");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "grow_end", PROPERTY_HINT_RANGE, "-300,300,1,suffix:px"), "set_grow_end", "get_grow_end");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "thickness", PROPERTY_HINT_RANGE, "0,10,suffix:px"), "set_thickness", "get_thickness");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "thickness", PROPERTY_HINT_RANGE, "0,100,suffix:px"), "set_thickness", "get_thickness");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vertical"), "set_vertical", "is_vertical");
}
@@ -1041,10 +1025,6 @@ float StyleBoxLine::get_style_margin(Side p_side) const {
return 0;
}
-Size2 StyleBoxLine::get_center_size() const {
- return Size2();
-}
-
void StyleBoxLine::draw(RID p_canvas_item, const Rect2 &p_rect) const {
RenderingServer *vs = RenderingServer::get_singleton();
Rect2i r = p_rect;
diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h
index 5a80b4d4e2..17acfd773e 100644
--- a/scene/resources/style_box.h
+++ b/scene/resources/style_box.h
@@ -41,36 +41,34 @@ class StyleBox : public Resource {
GDCLASS(StyleBox, Resource);
RES_BASE_EXTENSION("stylebox");
OBJ_SAVE_TYPE(StyleBox);
- float margin[4];
+ float content_margin[4];
protected:
- virtual float get_style_margin(Side p_side) const;
+ virtual float get_style_margin(Side p_side) const { return 0; }
static void _bind_methods();
- GDVIRTUAL1RC(float, _get_style_margin, Side)
- GDVIRTUAL2RC(bool, _test_mask, Point2, Rect2)
- GDVIRTUAL0RC(Size2, _get_center_size)
- GDVIRTUAL1RC(Rect2, _get_draw_rect, Rect2)
GDVIRTUAL2C(_draw, RID, Rect2)
+ GDVIRTUAL1RC(Rect2, _get_draw_rect, Rect2)
+ GDVIRTUAL0RC(Size2, _get_minimum_size)
+ GDVIRTUAL2RC(bool, _test_mask, Point2, Rect2)
public:
- virtual bool test_mask(const Point2 &p_point, const Rect2 &p_rect) const;
+ virtual Size2 get_minimum_size() const;
- void set_default_margin(Side p_side, float p_value);
- void set_default_margin_all(float p_value);
- void set_default_margin_individual(float p_left, float p_top, float p_right, float p_bottom);
- float get_default_margin(Side p_side) const;
+ void set_content_margin(Side p_side, float p_value);
+ void set_content_margin_all(float p_value);
+ void set_content_margin_individual(float p_left, float p_top, float p_right, float p_bottom);
+ float get_content_margin(Side p_side) const;
float get_margin(Side p_side) const;
- virtual Size2 get_center_size() const;
+ Point2 get_offset() const;
- virtual Rect2 get_draw_rect(const Rect2 &p_rect) const;
virtual void draw(RID p_canvas_item, const Rect2 &p_rect) const;
+ virtual Rect2 get_draw_rect(const Rect2 &p_rect) const;
CanvasItem *get_current_item_drawn() const;
- Size2 get_minimum_size() const;
- Point2 get_offset() const;
+ virtual bool test_mask(const Point2 &p_point, const Rect2 &p_rect) const;
StyleBox();
};
@@ -96,7 +94,7 @@ public:
private:
float expand_margin[4] = {};
- float margin[4] = {};
+ float texture_margin[4] = {};
Rect2 region_rect;
Ref<Texture2D> texture;
bool draw_center = true;
@@ -109,15 +107,15 @@ protected:
static void _bind_methods();
public:
- void set_expand_margin_size(Side p_expand_side, float p_size);
- void set_expand_margin_size_all(float p_expand_margin_size);
- void set_expand_margin_size_individual(float p_left, float p_top, float p_right, float p_bottom);
- float get_expand_margin_size(Side p_expand_side) const;
+ void set_expand_margin(Side p_expand_side, float p_size);
+ void set_expand_margin_all(float p_expand_margin_size);
+ void set_expand_margin_individual(float p_left, float p_top, float p_right, float p_bottom);
+ float get_expand_margin(Side p_expand_side) const;
- void set_margin_size(Side p_side, float p_size);
- void set_margin_size_all(float p_size);
- void set_margin_size_individual(float p_left, float p_top, float p_right, float p_bottom);
- float get_margin_size(Side p_side) const;
+ void set_texture_margin(Side p_side, float p_size);
+ void set_texture_margin_all(float p_size);
+ void set_texture_margin_individual(float p_left, float p_top, float p_right, float p_bottom);
+ float get_texture_margin(Side p_side) const;
void set_region_rect(const Rect2 &p_region_rect);
Rect2 get_region_rect() const;
@@ -127,7 +125,6 @@ public:
void set_draw_center(bool p_enabled);
bool is_draw_center_enabled() const;
- virtual Size2 get_center_size() const override;
void set_h_axis_stretch_mode(AxisStretchMode p_mode);
AxisStretchMode get_h_axis_stretch_mode() const;
@@ -198,10 +195,10 @@ public:
void set_corner_detail(const int &p_corner_detail);
int get_corner_detail() const;
- void set_expand_margin_size(Side p_expand_side, float p_size);
- void set_expand_margin_size_all(float p_expand_margin_size);
- void set_expand_margin_size_individual(float p_left, float p_top, float p_right, float p_bottom);
- float get_expand_margin_size(Side p_expand_side) const;
+ void set_expand_margin(Side p_expand_side, float p_size);
+ void set_expand_margin_all(float p_expand_margin_size);
+ void set_expand_margin_individual(float p_left, float p_top, float p_right, float p_bottom);
+ float get_expand_margin(Side p_expand_side) const;
void set_draw_center(bool p_enabled);
bool is_draw_center_enabled() const;
@@ -223,8 +220,6 @@ public:
void set_aa_size(const real_t p_aa_size);
real_t get_aa_size() const;
- virtual Size2 get_center_size() const override;
-
virtual Rect2 get_draw_rect(const Rect2 &p_rect) const override;
virtual void draw(RID p_canvas_item, const Rect2 &p_rect) const override;
@@ -261,8 +256,6 @@ public:
void set_grow_end(float p_grow);
float get_grow_end() const;
- virtual Size2 get_center_size() const override;
-
virtual void draw(RID p_canvas_item, const Rect2 &p_rect) const override;
StyleBoxLine();
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index e802e1c2d9..5a2b917b9a 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -146,6 +146,25 @@ uint32_t SurfaceTool::VertexHasher::hash(const Vertex &p_vtx) {
return h;
}
+bool SurfaceTool::SmoothGroupVertex::operator==(const SmoothGroupVertex &p_vertex) const {
+ if (vertex != p_vertex.vertex) {
+ return false;
+ }
+
+ if (smooth_group != p_vertex.smooth_group) {
+ return false;
+ }
+
+ return true;
+}
+
+uint32_t SurfaceTool::SmoothGroupVertexHasher::hash(const SmoothGroupVertex &p_vtx) {
+ uint32_t h = hash_djb2_buffer((const uint8_t *)&p_vtx.vertex, sizeof(real_t) * 3);
+ h = hash_murmur3_one_32(p_vtx.smooth_group, h);
+ h = hash_fmix32(h);
+ return h;
+}
+
uint32_t SurfaceTool::TriangleHasher::hash(const int *p_triangle) {
int t0 = p_triangle[0];
int t1 = p_triangle[1];
@@ -732,13 +751,13 @@ void SurfaceTool::index() {
LocalVector<Vertex> old_vertex_array = vertex_array;
vertex_array.clear();
- for (uint32_t i = 0; i < old_vertex_array.size(); i++) {
- int *idxptr = indices.getptr(old_vertex_array[i]);
+ for (const Vertex &vertex : old_vertex_array) {
+ int *idxptr = indices.getptr(vertex);
int idx;
if (!idxptr) {
idx = indices.size();
- vertex_array.push_back(old_vertex_array[i]);
- indices[old_vertex_array[i]] = idx;
+ vertex_array.push_back(vertex);
+ indices[vertex] = idx;
} else {
idx = *idxptr;
}
@@ -756,9 +775,8 @@ void SurfaceTool::deindex() {
LocalVector<Vertex> old_vertex_array = vertex_array;
vertex_array.clear();
- for (uint32_t i = 0; i < index_array.size(); i++) {
- uint32_t index = index_array[i];
- ERR_FAIL_COND(index >= old_vertex_array.size());
+ for (const int &index : index_array) {
+ ERR_FAIL_COND(uint32_t(index) >= old_vertex_array.size());
vertex_array.push_back(old_vertex_array[index]);
}
format &= ~Mesh::ARRAY_FORMAT_INDEX;
@@ -1000,8 +1018,7 @@ void SurfaceTool::append_from(const Ref<Mesh> &p_existing, int p_surface, const
}
int vfrom = vertex_array.size();
- for (uint32_t vi = 0; vi < nvertices.size(); vi++) {
- Vertex v = nvertices[vi];
+ for (Vertex &v : nvertices) {
v.vertex = p_xform.xform(v.vertex);
if (nformat & RS::ARRAY_FORMAT_NORMAL) {
v.normal = p_xform.basis.xform(v.normal);
@@ -1014,8 +1031,8 @@ void SurfaceTool::append_from(const Ref<Mesh> &p_existing, int p_surface, const
vertex_array.push_back(v);
}
- for (uint32_t i = 0; i < nindices.size(); i++) {
- int dst_index = nindices[i] + vfrom;
+ for (const int &index : nindices) {
+ int dst_index = index + vfrom;
index_array.push_back(dst_index);
}
if (index_array.size() % 3) {
@@ -1132,9 +1149,9 @@ void SurfaceTool::generate_tangents() {
TangentGenerationContextUserData triangle_data;
triangle_data.vertices = &vertex_array;
- for (uint32_t i = 0; i < vertex_array.size(); i++) {
- vertex_array[i].binormal = Vector3();
- vertex_array[i].tangent = Vector3();
+ for (Vertex &vertex : vertex_array) {
+ vertex.binormal = Vector3();
+ vertex.tangent = Vector3();
}
triangle_data.indices = &index_array;
msc.m_pUserData = &triangle_data;
@@ -1154,7 +1171,7 @@ void SurfaceTool::generate_normals(bool p_flip) {
ERR_FAIL_COND((vertex_array.size() % 3) != 0);
- HashMap<Vertex, Vector3, VertexHasher> vertex_hash;
+ HashMap<SmoothGroupVertex, Vector3, SmoothGroupVertexHasher> smooth_hash;
for (uint32_t vi = 0; vi < vertex_array.size(); vi += 3) {
Vertex *v = &vertex_array[vi];
@@ -1167,21 +1184,28 @@ void SurfaceTool::generate_normals(bool p_flip) {
}
for (int i = 0; i < 3; i++) {
- Vector3 *lv = vertex_hash.getptr(v[i]);
- if (!lv) {
- vertex_hash.insert(v[i], normal);
+ // Add face normal to smooth vertex influence if vertex is member of a smoothing group
+ if (v[i].smooth_group != UINT32_MAX) {
+ Vector3 *lv = smooth_hash.getptr(v[i]);
+ if (!lv) {
+ smooth_hash.insert(v[i], normal);
+ } else {
+ (*lv) += normal;
+ }
} else {
- (*lv) += normal;
+ v[i].normal = normal;
}
}
}
- for (uint32_t vi = 0; vi < vertex_array.size(); vi++) {
- Vector3 *lv = vertex_hash.getptr(vertex_array[vi]);
- if (!lv) {
- vertex_array[vi].normal = Vector3();
- } else {
- vertex_array[vi].normal = lv->normalized();
+ for (Vertex &vertex : vertex_array) {
+ if (vertex.smooth_group != UINT32_MAX) {
+ Vector3 *lv = smooth_hash.getptr(vertex);
+ if (!lv) {
+ vertex.normal = Vector3();
+ } else {
+ vertex.normal = lv->normalized();
+ }
}
}
diff --git a/scene/resources/surface_tool.h b/scene/resources/surface_tool.h
index 25e078d2ff..00438c4a53 100644
--- a/scene/resources/surface_tool.h
+++ b/scene/resources/surface_tool.h
@@ -97,6 +97,21 @@ private:
static _FORCE_INLINE_ uint32_t hash(const Vertex &p_vtx);
};
+ struct SmoothGroupVertex {
+ Vector3 vertex;
+ uint32_t smooth_group = 0;
+ bool operator==(const SmoothGroupVertex &p_vertex) const;
+
+ SmoothGroupVertex(const Vertex &p_vertex) {
+ vertex = p_vertex.vertex;
+ smooth_group = p_vertex.smooth_group;
+ };
+ };
+
+ struct SmoothGroupVertexHasher {
+ static _FORCE_INLINE_ uint32_t hash(const SmoothGroupVertex &p_vtx);
+ };
+
struct TriangleHasher {
static _FORCE_INLINE_ uint32_t hash(const int *p_triangle);
static _FORCE_INLINE_ bool compare(const int *p_lhs, const int *p_rhs);
diff --git a/scene/resources/text_paragraph.cpp b/scene/resources/text_paragraph.cpp
index 6d66c48b78..dfafc7d2bc 100644
--- a/scene/resources/text_paragraph.cpp
+++ b/scene/resources/text_paragraph.cpp
@@ -135,8 +135,8 @@ void TextParagraph::_bind_methods() {
void TextParagraph::_shape_lines() {
if (lines_dirty) {
- for (int i = 0; i < (int)lines_rid.size(); i++) {
- TS->free_rid(lines_rid[i]);
+ for (const RID &line_rid : lines_rid) {
+ TS->free_rid(line_rid);
}
lines_rid.clear();
@@ -234,14 +234,14 @@ void TextParagraph::_shape_lines() {
} else {
// Autowrap disabled.
- for (int i = 0; i < (int)lines_rid.size(); i++) {
+ for (const RID &line_rid : lines_rid) {
if (alignment == HORIZONTAL_ALIGNMENT_FILL) {
- TS->shaped_text_fit_to_width(lines_rid[i], width, jst_flags);
+ TS->shaped_text_fit_to_width(line_rid, width, jst_flags);
overrun_flags.set_flag(TextServer::OVERRUN_JUSTIFICATION_AWARE);
- TS->shaped_text_overrun_trim_to_width(lines_rid[i], width, overrun_flags);
- TS->shaped_text_fit_to_width(lines_rid[i], width, jst_flags | TextServer::JUSTIFICATION_CONSTRAIN_ELLIPSIS);
+ TS->shaped_text_overrun_trim_to_width(line_rid, width, overrun_flags);
+ TS->shaped_text_fit_to_width(line_rid, width, jst_flags | TextServer::JUSTIFICATION_CONSTRAIN_ELLIPSIS);
} else {
- TS->shaped_text_overrun_trim_to_width(lines_rid[i], width, overrun_flags);
+ TS->shaped_text_overrun_trim_to_width(line_rid, width, overrun_flags);
}
}
}
@@ -268,8 +268,8 @@ RID TextParagraph::get_dropcap_rid() const {
void TextParagraph::clear() {
_THREAD_SAFE_METHOD_
- for (int i = 0; i < (int)lines_rid.size(); i++) {
- TS->free_rid(lines_rid[i]);
+ for (const RID &line_rid : lines_rid) {
+ TS->free_rid(line_rid);
}
lines_rid.clear();
TS->shaped_text_clear(rid);
@@ -915,17 +915,17 @@ int TextParagraph::hit_test(const Point2 &p_coords) const {
return 0;
}
}
- for (int i = 0; i < (int)lines_rid.size(); i++) {
- if (TS->shaped_text_get_orientation(lines_rid[i]) == TextServer::ORIENTATION_HORIZONTAL) {
- if ((p_coords.y >= ofs.y) && (p_coords.y <= ofs.y + TS->shaped_text_get_size(lines_rid[i]).y)) {
- return TS->shaped_text_hit_test_position(lines_rid[i], p_coords.x);
+ for (const RID &line_rid : lines_rid) {
+ if (TS->shaped_text_get_orientation(line_rid) == TextServer::ORIENTATION_HORIZONTAL) {
+ if ((p_coords.y >= ofs.y) && (p_coords.y <= ofs.y + TS->shaped_text_get_size(line_rid).y)) {
+ return TS->shaped_text_hit_test_position(line_rid, p_coords.x);
}
- ofs.y += TS->shaped_text_get_size(lines_rid[i]).y;
+ ofs.y += TS->shaped_text_get_size(line_rid).y;
} else {
- if ((p_coords.x >= ofs.x) && (p_coords.x <= ofs.x + TS->shaped_text_get_size(lines_rid[i]).x)) {
- return TS->shaped_text_hit_test_position(lines_rid[i], p_coords.y);
+ if ((p_coords.x >= ofs.x) && (p_coords.x <= ofs.x + TS->shaped_text_get_size(line_rid).x)) {
+ return TS->shaped_text_hit_test_position(line_rid, p_coords.y);
}
- ofs.y += TS->shaped_text_get_size(lines_rid[i]).x;
+ ofs.y += TS->shaped_text_get_size(line_rid).x;
}
}
return TS->shaped_text_get_range(rid).y;
@@ -1027,8 +1027,8 @@ TextParagraph::TextParagraph() {
}
TextParagraph::~TextParagraph() {
- for (int i = 0; i < (int)lines_rid.size(); i++) {
- TS->free_rid(lines_rid[i]);
+ for (const RID &line_rid : lines_rid) {
+ TS->free_rid(line_rid);
}
lines_rid.clear();
TS->free_rid(rid);
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index f106eebff5..7e3156d2ff 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -94,6 +94,13 @@ bool Texture2D::get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Re
return true;
}
+Ref<Resource> Texture2D::create_placeholder() const {
+ Ref<PlaceholderTexture2D> placeholder;
+ placeholder.instantiate();
+ placeholder->set_size(get_size());
+ return placeholder;
+}
+
void Texture2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_width"), &Texture2D::get_width);
ClassDB::bind_method(D_METHOD("get_height"), &Texture2D::get_height);
@@ -103,6 +110,7 @@ void Texture2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("draw_rect", "canvas_item", "rect", "tile", "modulate", "transpose"), &Texture2D::draw_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false));
ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "clip_uv"), &Texture2D::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(true));
ClassDB::bind_method(D_METHOD("get_image"), &Texture2D::get_image);
+ ClassDB::bind_method(D_METHOD("create_placeholder"), &Texture2D::create_placeholder);
ADD_GROUP("", "");
@@ -645,7 +653,7 @@ Ref<Image> CompressedTexture2D::load_image_from_file(Ref<FileAccess> f, int p_si
uint32_t mipmaps = f->get_32();
Image::Format format = Image::Format(f->get_32());
- if (data_format == DATA_FORMAT_PNG || data_format == DATA_FORMAT_WEBP || data_format == DATA_FORMAT_BASIS_UNIVERSAL) {
+ if (data_format == DATA_FORMAT_PNG || data_format == DATA_FORMAT_WEBP) {
//look for a PNG or WebP file inside
int sw = w;
@@ -676,9 +684,7 @@ Ref<Image> CompressedTexture2D::load_image_from_file(Ref<FileAccess> f, int p_si
}
Ref<Image> img;
- if (data_format == DATA_FORMAT_BASIS_UNIVERSAL && Image::basis_universal_unpacker) {
- img = Image::basis_universal_unpacker(pv);
- } else if (data_format == DATA_FORMAT_PNG && Image::png_unpacker) {
+ if (data_format == DATA_FORMAT_PNG && Image::png_unpacker) {
img = Image::png_unpacker(pv);
} else if (data_format == DATA_FORMAT_WEBP && Image::webp_unpacker) {
img = Image::webp_unpacker(pv);
@@ -737,6 +743,32 @@ Ref<Image> CompressedTexture2D::load_image_from_file(Ref<FileAccess> f, int p_si
return image;
}
+ } else if (data_format == DATA_FORMAT_BASIS_UNIVERSAL) {
+ int sw = w;
+ int sh = h;
+ uint32_t size = f->get_32();
+ if (p_size_limit > 0 && (sw > p_size_limit || sh > p_size_limit)) {
+ //can't load this due to size limit
+ sw = MAX(sw >> 1, 1);
+ sh = MAX(sh >> 1, 1);
+ f->seek(f->get_position() + size);
+ return Ref<Image>();
+ }
+ Vector<uint8_t> pv;
+ pv.resize(size);
+ {
+ uint8_t *wr = pv.ptrw();
+ f->get_buffer(wr, size);
+ }
+ Ref<Image> img;
+ img = Image::basis_universal_unpacker(pv);
+ if (img.is_null() || img->is_empty()) {
+ ERR_FAIL_COND_V(img.is_null() || img->is_empty(), Ref<Image>());
+ }
+ format = img->get_format();
+ sw = MAX(sw >> 1, 1);
+ sh = MAX(sh >> 1, 1);
+ return img;
} else if (data_format == DATA_FORMAT_IMAGE) {
int size = Image::get_image_data_size(w, h, format, mipmaps ? true : false);
@@ -1137,6 +1169,7 @@ void Texture3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_depth"), &Texture3D::get_depth);
ClassDB::bind_method(D_METHOD("has_mipmaps"), &Texture3D::has_mipmaps);
ClassDB::bind_method(D_METHOD("get_data"), &Texture3D::_get_datai);
+ ClassDB::bind_method(D_METHOD("create_placeholder"), &Texture3D::create_placeholder);
GDVIRTUAL_BIND(_get_format);
GDVIRTUAL_BIND(_get_width);
@@ -1145,6 +1178,14 @@ void Texture3D::_bind_methods() {
GDVIRTUAL_BIND(_has_mipmaps);
GDVIRTUAL_BIND(_get_data);
}
+
+Ref<Resource> Texture3D::create_placeholder() const {
+ Ref<PlaceholderTexture3D> placeholder;
+ placeholder.instantiate();
+ placeholder->set_size(Vector3i(get_width(), get_height(), get_depth()));
+ return placeholder;
+}
+
//////////////////////////////////////////
Image::Format ImageTexture3D::get_format() const {
@@ -3048,6 +3089,42 @@ ImageTextureLayered::~ImageTextureLayered() {
}
}
+void Texture2DArray::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("create_placeholder"), &Texture2DArray::create_placeholder);
+}
+
+Ref<Resource> Texture2DArray::create_placeholder() const {
+ Ref<PlaceholderTexture2DArray> placeholder;
+ placeholder.instantiate();
+ placeholder->set_size(Size2i(get_width(), get_height()));
+ placeholder->set_layers(get_layers());
+ return placeholder;
+}
+
+void Cubemap::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("create_placeholder"), &Cubemap::create_placeholder);
+}
+
+Ref<Resource> Cubemap::create_placeholder() const {
+ Ref<PlaceholderCubemap> placeholder;
+ placeholder.instantiate();
+ placeholder->set_size(Size2i(get_width(), get_height()));
+ placeholder->set_layers(get_layers());
+ return placeholder;
+}
+
+void CubemapArray::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("create_placeholder"), &CubemapArray::create_placeholder);
+}
+
+Ref<Resource> CubemapArray::create_placeholder() const {
+ Ref<PlaceholderCubemapArray> placeholder;
+ placeholder.instantiate();
+ placeholder->set_size(Size2i(get_width(), get_height()));
+ placeholder->set_layers(get_layers());
+ return placeholder;
+}
+
///////////////////////////////////////////
void CompressedTextureLayered::set_path(const String &p_path, bool p_take_over) {
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index bb86910c0c..7f74ae6941 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -82,6 +82,8 @@ public:
virtual Ref<Image> get_image() const { return Ref<Image>(); }
+ virtual Ref<Resource> create_placeholder() const;
+
Texture2D();
};
@@ -450,25 +452,41 @@ public:
class Texture2DArray : public ImageTextureLayered {
GDCLASS(Texture2DArray, ImageTextureLayered)
+
+protected:
+ static void _bind_methods();
+
public:
Texture2DArray() :
ImageTextureLayered(LAYERED_TYPE_2D_ARRAY) {}
+
+ virtual Ref<Resource> create_placeholder() const;
};
class Cubemap : public ImageTextureLayered {
GDCLASS(Cubemap, ImageTextureLayered);
+protected:
+ static void _bind_methods();
+
public:
Cubemap() :
ImageTextureLayered(LAYERED_TYPE_CUBEMAP) {}
+
+ virtual Ref<Resource> create_placeholder() const;
};
class CubemapArray : public ImageTextureLayered {
GDCLASS(CubemapArray, ImageTextureLayered);
+protected:
+ static void _bind_methods();
+
public:
CubemapArray() :
ImageTextureLayered(LAYERED_TYPE_CUBEMAP_ARRAY) {}
+
+ virtual Ref<Resource> create_placeholder() const;
};
class CompressedTextureLayered : public TextureLayered {
@@ -580,6 +598,7 @@ public:
virtual int get_depth() const;
virtual bool has_mipmaps() const;
virtual Vector<Ref<Image>> get_data() const;
+ virtual Ref<Resource> create_placeholder() const;
};
class ImageTexture3D : public Texture3D {
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 94e78fc3aa..58a638804d 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -404,8 +404,8 @@ void TileSet::_update_terrains_cache() {
if (terrains_cache_dirty) {
// Organizes tiles into structures.
per_terrain_pattern_tiles.resize(terrain_sets.size());
- for (int i = 0; i < (int)per_terrain_pattern_tiles.size(); i++) {
- per_terrain_pattern_tiles[i].clear();
+ for (RBMap<TileSet::TerrainsPattern, RBSet<TileMapCell>> &tiles : per_terrain_pattern_tiles) {
+ tiles.clear();
}
for (const KeyValue<int, Ref<TileSetSource>> &kv : sources) {
@@ -991,6 +991,28 @@ uint32_t TileSet::get_navigation_layer_layers(int p_layer_index) const {
return navigation_layers[p_layer_index].layers;
}
+void TileSet::set_navigation_layer_layer_value(int p_layer_index, int p_layer_number, bool p_value) {
+ ERR_FAIL_COND_MSG(p_layer_number < 1, "Navigation layer number must be between 1 and 32 inclusive.");
+ ERR_FAIL_COND_MSG(p_layer_number > 32, "Navigation layer number must be between 1 and 32 inclusive.");
+
+ uint32_t _navigation_layers = get_navigation_layer_layers(p_layer_index);
+
+ if (p_value) {
+ _navigation_layers |= 1 << (p_layer_number - 1);
+ } else {
+ _navigation_layers &= ~(1 << (p_layer_number - 1));
+ }
+
+ set_navigation_layer_layers(p_layer_index, _navigation_layers);
+}
+
+bool TileSet::get_navigation_layer_layer_value(int p_layer_index, int p_layer_number) const {
+ ERR_FAIL_COND_V_MSG(p_layer_number < 1, false, "Navigation layer number must be between 1 and 32 inclusive.");
+ ERR_FAIL_COND_V_MSG(p_layer_number > 32, false, "Navigation layer number must be between 1 and 32 inclusive.");
+
+ return get_navigation_layer_layers(p_layer_index) & (1 << (p_layer_number - 1));
+}
+
// Custom data.
int TileSet::get_custom_data_layers_count() const {
return custom_data_layers.size();
@@ -1342,8 +1364,8 @@ void TileSet::clear_tile_proxies() {
int TileSet::add_pattern(Ref<TileMapPattern> p_pattern, int p_index) {
ERR_FAIL_COND_V(!p_pattern.is_valid(), -1);
ERR_FAIL_COND_V_MSG(p_pattern->is_empty(), -1, "Cannot add an empty pattern to the TileSet.");
- for (unsigned int i = 0; i < patterns.size(); i++) {
- ERR_FAIL_COND_V_MSG(patterns[i] == p_pattern, -1, "TileSet has already this pattern.");
+ for (const Ref<TileMapPattern> &pattern : patterns) {
+ ERR_FAIL_COND_V_MSG(pattern == p_pattern, -1, "TileSet has already this pattern.");
}
ERR_FAIL_COND_V(p_index > (int)patterns.size(), -1);
if (p_index < 0) {
@@ -2533,6 +2555,11 @@ void TileSet::_compatibility_conversion() {
bool flip_v = flags & 2;
bool transpose = flags & 4;
+ Transform2D xform;
+ xform = flip_h ? xform.scaled(Size2(-1, 1)) : xform;
+ xform = flip_v ? xform.scaled(Size2(1, -1)) : xform;
+ xform = transpose ? xform.rotated(Math_PI).scaled(Size2(-1, -1)) : xform;
+
int alternative_tile = 0;
if (!atlas_source->has_tile(coords)) {
atlas_source->create_tile(coords);
@@ -2569,14 +2596,26 @@ void TileSet::_compatibility_conversion() {
if (ctd->occluder.is_valid()) {
if (get_occlusion_layers_count() < 1) {
add_occlusion_layer();
+ };
+ Ref<OccluderPolygon2D> occluder = ctd->occluder->duplicate();
+ Vector<Vector2> polygon = ctd->occluder->get_polygon();
+ for (int index = 0; index < polygon.size(); index++) {
+ polygon.write[index] = xform.xform(polygon[index] - ctd->region.get_size() / 2.0);
}
- tile_data->set_occluder(0, ctd->occluder);
+ occluder->set_polygon(polygon);
+ tile_data->set_occluder(0, occluder);
}
if (ctd->navigation.is_valid()) {
if (get_navigation_layers_count() < 1) {
add_navigation_layer();
}
- tile_data->set_navigation_polygon(0, ctd->autotile_navpoly_map[coords]);
+ Ref<NavigationPolygon> navigation = ctd->navigation->duplicate();
+ Vector<Vector2> vertices = navigation->get_vertices();
+ for (int index = 0; index < vertices.size(); index++) {
+ vertices.write[index] = xform.xform(vertices[index] - ctd->region.get_size() / 2.0);
+ }
+ navigation->set_vertices(vertices);
+ tile_data->set_navigation_polygon(0, navigation);
}
tile_data->set_z_index(ctd->z_index);
@@ -2594,7 +2633,7 @@ void TileSet::_compatibility_conversion() {
if (convex_shape.is_valid()) {
Vector<Vector2> polygon = convex_shape->get_points();
for (int point_index = 0; point_index < polygon.size(); point_index++) {
- polygon.write[point_index] = csd.transform.xform(polygon[point_index]);
+ polygon.write[point_index] = xform.xform(csd.transform.xform(polygon[point_index]) - ctd->region.get_size() / 2.0);
}
tile_data->set_collision_polygons_count(0, tile_data->get_collision_polygons_count(0) + 1);
int index = tile_data->get_collision_polygons_count(0) - 1;
@@ -2605,9 +2644,15 @@ void TileSet::_compatibility_conversion() {
}
}
}
+ // Update the size count.
+ if (!compatibility_size_count.has(ctd->region.get_size())) {
+ compatibility_size_count[ctd->region.get_size()] = 0;
+ }
+ compatibility_size_count[ctd->region.get_size()]++;
} break;
case COMPATIBILITY_TILE_MODE_AUTO_TILE: {
// Not supported. It would need manual conversion.
+ WARN_PRINT_ONCE("Could not convert 3.x autotiles to 4.x. This operation cannot be done automatically, autotiles must be re-created using the terrain system.");
} break;
case COMPATIBILITY_TILE_MODE_ATLAS_TILE: {
atlas_source->set_margins(ctd->region.get_position());
@@ -2624,6 +2669,11 @@ void TileSet::_compatibility_conversion() {
bool flip_v = flags & 2;
bool transpose = flags & 4;
+ Transform2D xform;
+ xform = flip_h ? xform.scaled(Size2(-1, 1)) : xform;
+ xform = flip_v ? xform.scaled(Size2(1, -1)) : xform;
+ xform = transpose ? xform.rotated(Math_PI).scaled(Size2(-1, -1)) : xform;
+
int alternative_tile = 0;
if (!atlas_source->has_tile(coords)) {
atlas_source->create_tile(coords);
@@ -2661,13 +2711,25 @@ void TileSet::_compatibility_conversion() {
if (get_occlusion_layers_count() < 1) {
add_occlusion_layer();
}
- tile_data->set_occluder(0, ctd->autotile_occluder_map[coords]);
+ Ref<OccluderPolygon2D> occluder = ctd->autotile_occluder_map[coords]->duplicate();
+ Vector<Vector2> polygon = ctd->occluder->get_polygon();
+ for (int index = 0; index < polygon.size(); index++) {
+ polygon.write[index] = xform.xform(polygon[index] - ctd->region.get_size() / 2.0);
+ }
+ occluder->set_polygon(polygon);
+ tile_data->set_occluder(0, occluder);
}
if (ctd->autotile_navpoly_map.has(coords)) {
if (get_navigation_layers_count() < 1) {
add_navigation_layer();
}
- tile_data->set_navigation_polygon(0, ctd->autotile_navpoly_map[coords]);
+ Ref<NavigationPolygon> navigation = ctd->autotile_navpoly_map[coords]->duplicate();
+ Vector<Vector2> vertices = navigation->get_vertices();
+ for (int index = 0; index < vertices.size(); index++) {
+ vertices.write[index] = xform.xform(vertices[index] - ctd->region.get_size() / 2.0);
+ }
+ navigation->set_vertices(vertices);
+ tile_data->set_navigation_polygon(0, navigation);
}
if (ctd->autotile_priority_map.has(coords)) {
tile_data->set_probability(ctd->autotile_priority_map[coords]);
@@ -2689,7 +2751,7 @@ void TileSet::_compatibility_conversion() {
if (convex_shape.is_valid()) {
Vector<Vector2> polygon = convex_shape->get_points();
for (int point_index = 0; point_index < polygon.size(); point_index++) {
- polygon.write[point_index] = csd.transform.xform(polygon[point_index]);
+ polygon.write[point_index] = xform.xform(csd.transform.xform(polygon[point_index]) - ctd->autotile_tile_size / 2.0);
}
tile_data->set_collision_polygons_count(0, tile_data->get_collision_polygons_count(0) + 1);
int index = tile_data->get_collision_polygons_count(0) - 1;
@@ -2712,6 +2774,12 @@ void TileSet::_compatibility_conversion() {
}
}
}
+
+ // Update the size count.
+ if (!compatibility_size_count.has(ctd->region.get_size())) {
+ compatibility_size_count[ctd->autotile_tile_size] = 0;
+ }
+ compatibility_size_count[ctd->autotile_tile_size] += atlas_size.x * atlas_size.y;
} break;
}
@@ -2728,7 +2796,18 @@ void TileSet::_compatibility_conversion() {
}
}
- // Reset compatibility data
+ // Update the TileSet tile_size according to the most common size found.
+ Vector2i max_size = get_tile_size();
+ int max_count = 0;
+ for (KeyValue<Vector2i, int> kv : compatibility_size_count) {
+ if (kv.value > max_count) {
+ max_size = kv.key;
+ max_count = kv.value;
+ }
+ }
+ set_tile_size(max_size);
+
+ // Reset compatibility data (besides the histogram counts)
for (const KeyValue<int, CompatibilityTileData *> &E : compatibility_data) {
memdelete(E.value);
}
@@ -2909,6 +2988,10 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) {
}
ctd->shapes.push_back(csd);
}
+ } else if (what == "occluder") {
+ ctd->occluder = p_value;
+ } else if (what == "navigation") {
+ ctd->navigation = p_value;
/*
// IGNORED FOR NOW, they seem duplicated data compared to the shapes array
@@ -3387,6 +3470,8 @@ void TileSet::_bind_methods() {
ClassDB::bind_method(D_METHOD("remove_navigation_layer", "layer_index"), &TileSet::remove_navigation_layer);
ClassDB::bind_method(D_METHOD("set_navigation_layer_layers", "layer_index", "layers"), &TileSet::set_navigation_layer_layers);
ClassDB::bind_method(D_METHOD("get_navigation_layer_layers", "layer_index"), &TileSet::get_navigation_layer_layers);
+ ClassDB::bind_method(D_METHOD("set_navigation_layer_layer_value", "layer_index", "layer_number", "value"), &TileSet::set_navigation_layer_layer_value);
+ ClassDB::bind_method(D_METHOD("get_navigation_layer_layer_value", "layer_index", "layer_number"), &TileSet::get_navigation_layer_layer_value);
// Custom data
ClassDB::bind_method(D_METHOD("get_custom_data_layers_count"), &TileSet::get_custom_data_layers_count);
@@ -4190,8 +4275,8 @@ real_t TileSetAtlasSource::get_tile_animation_total_duration(const Vector2i p_at
ERR_FAIL_COND_V_MSG(!tiles.has(p_atlas_coords), 1, vformat("TileSetAtlasSource has no tile at %s.", Vector2i(p_atlas_coords)));
real_t sum = 0.0;
- for (int frame = 0; frame < (int)tiles[p_atlas_coords].animation_frames_durations.size(); frame++) {
- sum += tiles[p_atlas_coords].animation_frames_durations[frame];
+ for (const real_t &duration : tiles[p_atlas_coords].animation_frames_durations) {
+ sum += duration;
}
return sum;
}
@@ -4282,19 +4367,11 @@ Rect2i TileSetAtlasSource::get_tile_texture_region(Vector2i p_atlas_coords, int
return Rect2(origin, region_size);
}
-Vector2i TileSetAtlasSource::get_tile_effective_texture_offset(Vector2i p_atlas_coords, int p_alternative_tile) const {
- ERR_FAIL_COND_V_MSG(!tiles.has(p_atlas_coords), Vector2i(), vformat("TileSetAtlasSource has no tile at %s.", Vector2i(p_atlas_coords)));
- ERR_FAIL_COND_V_MSG(!has_alternative_tile(p_atlas_coords, p_alternative_tile), Vector2i(), vformat("TileSetAtlasSource has no alternative tile with id %d at %s.", p_alternative_tile, String(p_atlas_coords)));
- ERR_FAIL_COND_V(!tile_set, Vector2i());
+bool TileSetAtlasSource::is_position_in_tile_texture_region(const Vector2i p_atlas_coords, int p_alternative_tile, Vector2 p_position) const {
+ Size2 size = get_tile_texture_region(p_atlas_coords).size;
+ Rect2 rect = Rect2(-size / 2 - get_tile_data(p_atlas_coords, p_alternative_tile)->get_texture_origin(), size);
- Vector2 margin = (get_tile_texture_region(p_atlas_coords).size - tile_set->get_tile_size()) / 2;
- margin = Vector2i(MAX(0, margin.x), MAX(0, margin.y));
- Vector2i effective_texture_offset = get_tile_data(p_atlas_coords, p_alternative_tile)->get_texture_offset();
- if (ABS(effective_texture_offset.x) > margin.x || ABS(effective_texture_offset.y) > margin.y) {
- effective_texture_offset = effective_texture_offset.clamp(-margin, margin);
- }
-
- return effective_texture_offset;
+ return rect.has_point(p_position);
}
// Getters for texture and tile region (padded or not)
@@ -4573,8 +4650,8 @@ void TileSetAtlasSource::_clear_tiles_outside_texture() {
}
}
- for (unsigned int i = 0; i < to_remove.size(); i++) {
- remove_tile(to_remove[i]);
+ for (const Vector2i &v : to_remove) {
+ remove_tile(v);
}
}
@@ -5046,7 +5123,7 @@ TileData *TileData::duplicate() {
output->flip_h = flip_h;
output->flip_v = flip_v;
output->transpose = transpose;
- output->tex_offset = tex_offset;
+ output->texture_origin = texture_origin;
output->material = material;
output->modulate = modulate;
output->z_index = z_index;
@@ -5096,13 +5173,13 @@ bool TileData::get_transpose() const {
return transpose;
}
-void TileData::set_texture_offset(Vector2i p_texture_offset) {
- tex_offset = p_texture_offset;
+void TileData::set_texture_origin(Vector2i p_texture_origin) {
+ texture_origin = p_texture_origin;
emit_signal(SNAME("changed"));
}
-Vector2i TileData::get_texture_offset() const {
- return tex_offset;
+Vector2i TileData::get_texture_origin() const {
+ return texture_origin;
}
void TileData::set_material(Ref<Material> p_material) {
@@ -5390,6 +5467,13 @@ Variant TileData::get_custom_data_by_layer_id(int p_layer_id) const {
}
bool TileData::_set(const StringName &p_name, const Variant &p_value) {
+#ifndef DISABLE_DEPRECATED
+ if (p_name == "texture_offset") {
+ texture_origin = p_value;
+ return true;
+ }
+#endif
+
Vector<String> components = String(p_name).split("/", true, 2);
if (components.size() == 2 && components[0].begins_with("occlusion_layer_") && components[0].trim_prefix("occlusion_layer_").is_valid_int()) {
@@ -5511,6 +5595,13 @@ bool TileData::_set(const StringName &p_name, const Variant &p_value) {
}
bool TileData::_get(const StringName &p_name, Variant &r_ret) const {
+#ifndef DISABLE_DEPRECATED
+ if (p_name == "texture_offset") {
+ r_ret = texture_origin;
+ return true;
+ }
+#endif
+
Vector<String> components = String(p_name).split("/", true, 2);
if (tile_set) {
@@ -5692,8 +5783,8 @@ void TileData::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_transpose"), &TileData::get_transpose);
ClassDB::bind_method(D_METHOD("set_material", "material"), &TileData::set_material);
ClassDB::bind_method(D_METHOD("get_material"), &TileData::get_material);
- ClassDB::bind_method(D_METHOD("set_texture_offset", "texture_offset"), &TileData::set_texture_offset);
- ClassDB::bind_method(D_METHOD("get_texture_offset"), &TileData::get_texture_offset);
+ ClassDB::bind_method(D_METHOD("set_texture_origin", "texture_origin"), &TileData::set_texture_origin);
+ ClassDB::bind_method(D_METHOD("get_texture_origin"), &TileData::get_texture_origin);
ClassDB::bind_method(D_METHOD("set_modulate", "modulate"), &TileData::set_modulate);
ClassDB::bind_method(D_METHOD("get_modulate"), &TileData::get_modulate);
ClassDB::bind_method(D_METHOD("set_z_index", "z_index"), &TileData::set_z_index);
@@ -5746,7 +5837,7 @@ void TileData::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flip_h"), "set_flip_h", "get_flip_h");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flip_v"), "set_flip_v", "get_flip_v");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transpose"), "set_transpose", "get_transpose");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "texture_offset", PROPERTY_HINT_NONE, "suffix:px"), "set_texture_offset", "get_texture_offset");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "texture_origin", PROPERTY_HINT_NONE, "suffix:px"), "set_texture_origin", "get_texture_origin");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "modulate"), "set_modulate", "get_modulate");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "CanvasItemMaterial,ShaderMaterial"), "set_material", "get_material");
ADD_PROPERTY(PropertyInfo(Variant::INT, "z_index"), "set_z_index", "get_z_index");
diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h
index c2ed798f2b..ad25629a1c 100644
--- a/scene/resources/tile_set.h
+++ b/scene/resources/tile_set.h
@@ -198,6 +198,7 @@ private:
HashMap<int, CompatibilityTileData *> compatibility_data;
HashMap<int, int> compatibility_tilemap_mapping_tile_modes;
HashMap<int, RBMap<Array, Array>> compatibility_tilemap_mapping;
+ HashMap<Vector2i, int> compatibility_size_count;
void _compatibility_conversion();
@@ -475,6 +476,8 @@ public:
void remove_navigation_layer(int p_index);
void set_navigation_layer_layers(int p_layer_index, uint32_t p_layers);
uint32_t get_navigation_layer_layers(int p_layer_index) const;
+ void set_navigation_layer_layer_value(int p_layer_index, int p_layer_number, bool p_value);
+ bool get_navigation_layer_layer_value(int p_layer_index, int p_layer_number) const;
// Custom data
int get_custom_data_layers_count() const;
@@ -719,7 +722,7 @@ public:
// Helpers.
Vector2i get_atlas_grid_size() const;
Rect2i get_tile_texture_region(Vector2i p_atlas_coords, int p_frame = 0) const;
- Vector2i get_tile_effective_texture_offset(Vector2i p_atlas_coords, int p_alternative_tile) const;
+ bool is_position_in_tile_texture_region(const Vector2i p_atlas_coords, int p_alternative_tile, Vector2 p_position) const;
// Getters for texture and tile region (padded or not)
Ref<Texture2D> get_runtime_texture() const;
@@ -785,7 +788,7 @@ private:
bool flip_h = false;
bool flip_v = false;
bool transpose = false;
- Vector2i tex_offset;
+ Vector2i texture_origin;
Ref<Material> material = Ref<Material>();
Color modulate = Color(1.0, 1.0, 1.0, 1.0);
int z_index = 0;
@@ -864,8 +867,8 @@ public:
void set_transpose(bool p_transpose);
bool get_transpose() const;
- void set_texture_offset(Vector2i p_texture_offset);
- Vector2i get_texture_offset() const;
+ void set_texture_origin(Vector2i p_texture_origin);
+ Vector2i get_texture_origin() const;
void set_material(Ref<Material> p_material);
Ref<Material> get_material() const;
void set_modulate(Color p_modulate);
diff --git a/scene/resources/video_stream.cpp b/scene/resources/video_stream.cpp
new file mode 100644
index 0000000000..ee1a47c338
--- /dev/null
+++ b/scene/resources/video_stream.cpp
@@ -0,0 +1,198 @@
+/**************************************************************************/
+/* video_stream.cpp */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 "video_stream.h"
+
+#include "core/config/project_settings.h"
+#include "servers/audio_server.h"
+
+// VideoStreamPlayback starts here.
+
+void VideoStreamPlayback::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("mix_audio", "num_frames", "buffer", "offset"), &VideoStreamPlayback::mix_audio, DEFVAL(PackedFloat32Array()), DEFVAL(0));
+ GDVIRTUAL_BIND(_stop);
+ GDVIRTUAL_BIND(_play);
+ GDVIRTUAL_BIND(_is_playing);
+ GDVIRTUAL_BIND(_set_paused, "paused");
+ GDVIRTUAL_BIND(_is_paused);
+ GDVIRTUAL_BIND(_get_length);
+ GDVIRTUAL_BIND(_get_playback_position);
+ GDVIRTUAL_BIND(_seek, "time");
+ GDVIRTUAL_BIND(_set_audio_track, "idx");
+ GDVIRTUAL_BIND(_get_texture);
+ GDVIRTUAL_BIND(_update, "delta");
+ GDVIRTUAL_BIND(_get_channels);
+ GDVIRTUAL_BIND(_get_mix_rate);
+}
+
+VideoStreamPlayback::VideoStreamPlayback() {
+}
+
+VideoStreamPlayback::~VideoStreamPlayback() {
+}
+
+void VideoStreamPlayback::stop() {
+ GDVIRTUAL_CALL(_stop);
+}
+
+void VideoStreamPlayback::play() {
+ GDVIRTUAL_CALL(_play);
+}
+
+bool VideoStreamPlayback::is_playing() const {
+ bool ret;
+ if (GDVIRTUAL_CALL(_is_playing, ret)) {
+ return ret;
+ }
+ return false;
+}
+
+void VideoStreamPlayback::set_paused(bool p_paused) {
+ GDVIRTUAL_CALL(_is_playing, p_paused);
+}
+
+bool VideoStreamPlayback::is_paused() const {
+ bool ret;
+ if (GDVIRTUAL_CALL(_is_paused, ret)) {
+ return ret;
+ }
+ return false;
+}
+
+double VideoStreamPlayback::get_length() const {
+ double ret;
+ if (GDVIRTUAL_CALL(_get_length, ret)) {
+ return ret;
+ }
+ return 0;
+}
+
+double VideoStreamPlayback::get_playback_position() const {
+ double ret;
+ if (GDVIRTUAL_CALL(_get_playback_position, ret)) {
+ return ret;
+ }
+ return 0;
+}
+
+void VideoStreamPlayback::seek(double p_time) {
+ GDVIRTUAL_CALL(_seek, p_time);
+}
+
+void VideoStreamPlayback::set_audio_track(int p_idx) {
+ GDVIRTUAL_CALL(_set_audio_track, p_idx);
+}
+
+Ref<Texture2D> VideoStreamPlayback::get_texture() const {
+ Ref<Texture2D> ret;
+ if (GDVIRTUAL_CALL(_get_texture, ret)) {
+ return ret;
+ }
+ return nullptr;
+}
+
+void VideoStreamPlayback::update(double p_delta) {
+ if (!GDVIRTUAL_CALL(_update, p_delta)) {
+ ERR_FAIL_MSG("VideoStreamPlayback::update unimplemented");
+ }
+}
+
+void VideoStreamPlayback::set_mix_callback(AudioMixCallback p_callback, void *p_userdata) {
+ mix_callback = p_callback;
+ mix_udata = p_userdata;
+}
+
+int VideoStreamPlayback::get_channels() const {
+ int ret;
+ if (GDVIRTUAL_CALL(_get_channels, ret)) {
+ _channel_count = ret;
+ return ret;
+ }
+ return 0;
+}
+
+int VideoStreamPlayback::get_mix_rate() const {
+ int ret;
+ if (GDVIRTUAL_CALL(_get_mix_rate, ret)) {
+ return ret;
+ }
+ return 0;
+}
+
+int VideoStreamPlayback::mix_audio(int num_frames, PackedFloat32Array buffer, int offset) {
+ if (num_frames <= 0) {
+ return 0;
+ }
+ if (!mix_callback) {
+ return -1;
+ }
+ ERR_FAIL_INDEX_V(offset, buffer.size(), -1);
+ ERR_FAIL_INDEX_V((_channel_count < 1 ? 1 : _channel_count) * num_frames - 1, buffer.size() - offset, -1);
+ return mix_callback(mix_udata, buffer.ptr() + offset, num_frames);
+}
+
+/* --- NOTE VideoStream starts here. ----- */
+
+Ref<VideoStreamPlayback> VideoStream::instantiate_playback() {
+ Ref<VideoStreamPlayback> ret;
+ if (GDVIRTUAL_CALL(_instantiate_playback, ret)) {
+ ERR_FAIL_COND_V_MSG(ret.is_null(), nullptr, "Plugin returned null playback");
+ ret->set_audio_track(audio_track);
+ return ret;
+ }
+ return nullptr;
+}
+
+void VideoStream::set_file(const String &p_file) {
+ file = p_file;
+}
+
+String VideoStream::get_file() {
+ return file;
+}
+
+void VideoStream::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_file", "file"), &VideoStream::set_file);
+ ClassDB::bind_method(D_METHOD("get_file"), &VideoStream::get_file);
+
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "file"), "set_file", "get_file");
+
+ GDVIRTUAL_BIND(_instantiate_playback);
+}
+
+VideoStream::VideoStream() {
+}
+
+VideoStream::~VideoStream() {
+}
+
+void VideoStream::set_audio_track(int p_track) {
+ audio_track = p_track;
+}
diff --git a/scene/resources/video_stream.h b/scene/resources/video_stream.h
index f83c621d0a..b91a7acf35 100644
--- a/scene/resources/video_stream.h
+++ b/scene/resources/video_stream.h
@@ -31,6 +31,7 @@
#ifndef VIDEO_STREAM_H
#define VIDEO_STREAM_H
+#include "core/io/file_access.h"
#include "scene/resources/texture.h"
class VideoStreamPlayback : public Resource {
@@ -39,40 +40,77 @@ class VideoStreamPlayback : public Resource {
public:
typedef int (*AudioMixCallback)(void *p_udata, const float *p_data, int p_frames);
- virtual void stop() = 0;
- virtual void play() = 0;
+protected:
+ AudioMixCallback mix_callback = nullptr;
+ void *mix_udata = nullptr;
+ mutable int _channel_count = 0; // Used only to assist with bounds checking in mix_audio.
+
+ static void _bind_methods();
+ GDVIRTUAL0(_stop);
+ GDVIRTUAL0(_play);
+ GDVIRTUAL0RC(bool, _is_playing);
+ GDVIRTUAL1(_set_paused, bool);
+ GDVIRTUAL0RC(bool, _is_paused);
+ GDVIRTUAL0RC(double, _get_length);
+ GDVIRTUAL0RC(double, _get_playback_position);
+ GDVIRTUAL1(_seek, double);
+ GDVIRTUAL1(_set_audio_track, int);
+ GDVIRTUAL0RC(Ref<Texture2D>, _get_texture);
+ GDVIRTUAL1(_update, double);
+ GDVIRTUAL0RC(int, _get_channels);
+ GDVIRTUAL0RC(int, _get_mix_rate);
+
+ int mix_audio(int num_frames, PackedFloat32Array buffer = {}, int offset = 0);
- virtual bool is_playing() const = 0;
+public:
+ VideoStreamPlayback();
+ virtual ~VideoStreamPlayback();
- virtual void set_paused(bool p_paused) = 0;
- virtual bool is_paused() const = 0;
+ virtual void stop();
+ virtual void play();
- virtual void set_loop(bool p_enable) = 0;
- virtual bool has_loop() const = 0;
+ virtual bool is_playing() const;
- virtual double get_length() const = 0;
+ virtual void set_paused(bool p_paused);
+ virtual bool is_paused() const;
- virtual double get_playback_position() const = 0;
- virtual void seek(double p_time) = 0;
+ virtual double get_length() const;
- virtual void set_audio_track(int p_idx) = 0;
+ virtual double get_playback_position() const;
+ virtual void seek(double p_time);
- virtual Ref<Texture2D> get_texture() const = 0;
+ virtual void set_audio_track(int p_idx);
- virtual void update(double p_delta) = 0;
+ virtual Ref<Texture2D> get_texture() const;
+ virtual void update(double p_delta);
- virtual void set_mix_callback(AudioMixCallback p_callback, void *p_userdata) = 0;
- virtual int get_channels() const = 0;
- virtual int get_mix_rate() const = 0;
+ virtual void set_mix_callback(AudioMixCallback p_callback, void *p_userdata);
+ virtual int get_channels() const;
+ virtual int get_mix_rate() const;
};
class VideoStream : public Resource {
GDCLASS(VideoStream, Resource);
- OBJ_SAVE_TYPE(VideoStream); // Saves derived classes with common type so they can be interchanged.
+ OBJ_SAVE_TYPE(VideoStream);
+
+protected:
+ static void
+ _bind_methods();
+
+ GDVIRTUAL0R(Ref<VideoStreamPlayback>, _instantiate_playback);
+
+ String file;
+ int audio_track = 0;
public:
- virtual void set_audio_track(int p_track) = 0;
- virtual Ref<VideoStreamPlayback> instantiate_playback() = 0;
+ void set_file(const String &p_file);
+ String get_file();
+
+ virtual void set_audio_track(int p_track);
+ virtual Ref<VideoStreamPlayback> instantiate_playback();
+
+ VideoStream();
+ ~VideoStream();
};
#endif // VIDEO_STREAM_H
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 76fb2d1367..bfcf5cb137 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -399,7 +399,6 @@ void VisualShaderNode::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "output_port_for_preview"), "set_output_port_for_preview", "get_output_port_for_preview");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "default_input_values", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL), "set_default_input_values", "get_default_input_values");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "expanded_output_ports", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL), "_set_output_ports_expanded", "_get_output_ports_expanded");
- ADD_SIGNAL(MethodInfo("editor_refresh_request"));
BIND_ENUM_CONSTANT(PORT_TYPE_SCALAR);
BIND_ENUM_CONSTANT(PORT_TYPE_SCALAR_INT);
@@ -1562,7 +1561,7 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const {
prop_name += "/" + itos(E.key);
if (E.key != NODE_ID_OUTPUT) {
- p_list->push_back(PropertyInfo(Variant::OBJECT, prop_name + "/node", PROPERTY_HINT_RESOURCE_TYPE, "VisualShaderNode", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE));
+ p_list->push_back(PropertyInfo(Variant::OBJECT, prop_name + "/node", PROPERTY_HINT_RESOURCE_TYPE, "VisualShaderNode", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_ALWAYS_DUPLICATE));
}
p_list->push_back(PropertyInfo(Variant::VECTOR2, prop_name + "/position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR));
diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp
index ec89c87bd2..12be0f46a6 100644
--- a/scene/resources/visual_shader_nodes.cpp
+++ b/scene/resources/visual_shader_nodes.cpp
@@ -756,194 +756,157 @@ Vector<VisualShader::DefaultTextureParam> VisualShaderNodeTexture::get_default_t
}
String VisualShaderNodeTexture::generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const {
- if (source == SOURCE_TEXTURE) {
- String u = "uniform sampler2D " + make_unique_id(p_type, p_id, "tex");
- switch (texture_type) {
- case TYPE_DATA:
- break;
- case TYPE_COLOR:
- u += " : source_color";
- break;
- case TYPE_NORMAL_MAP:
- u += " : hint_normal";
- break;
- default:
- break;
- }
- return u + ";\n";
- } else if (source == SOURCE_SCREEN && (p_mode == Shader::MODE_SPATIAL || p_mode == Shader::MODE_CANVAS_ITEM) && p_type == VisualShader::TYPE_FRAGMENT) {
- String u = "uniform sampler2D " + make_unique_id(p_type, p_id, "screen_tex");
- return u + " : hint_screen_texture;\n";
- } else if (source == SOURCE_DEPTH || source == SOURCE_3D_NORMAL || source == SOURCE_ROUGHNESS) {
- String sampler_name = "";
- String hint = " : ";
- if (source == SOURCE_DEPTH) {
- sampler_name = "depth_tex";
- hint += "hint_depth_texture;\n";
- } else if (source == SOURCE_3D_NORMAL) {
- sampler_name = "screen_normal_tex";
- hint += "hint_normal_roughness_texture;\n";
- } else if (source == SOURCE_ROUGHNESS) {
- sampler_name = "screen_roughness_tex";
- hint += "hint_normal_roughness_texture;\n";
- }
- return "uniform sampler2D " + make_unique_id(p_type, p_id, sampler_name) + hint;
+ String code;
+
+ switch (source) {
+ case SOURCE_TEXTURE: {
+ code += "uniform sampler2D " + make_unique_id(p_type, p_id, "tex");
+ switch (texture_type) {
+ case TYPE_DATA: {
+ } break;
+ case TYPE_COLOR: {
+ code += " : source_color";
+ } break;
+ case TYPE_NORMAL_MAP: {
+ code += " : hint_normal";
+ } break;
+ default: {
+ } break;
+ }
+ code += ";\n";
+ } break;
+ case SOURCE_SCREEN: {
+ if ((p_mode == Shader::MODE_SPATIAL || p_mode == Shader::MODE_CANVAS_ITEM) && p_type == VisualShader::TYPE_FRAGMENT) {
+ code += "uniform sampler2D " + make_unique_id(p_type, p_id, "screen_tex") + " : hint_screen_texture;\n";
+ }
+ } break;
+ case SOURCE_DEPTH:
+ case SOURCE_3D_NORMAL:
+ case SOURCE_ROUGHNESS: {
+ if (p_mode == Shader::MODE_SPATIAL && p_type == VisualShader::TYPE_FRAGMENT) {
+ String sampler_name = "";
+ String hint = " : ";
+ if (source == SOURCE_DEPTH) {
+ sampler_name = "depth_tex";
+ hint += "hint_depth_texture;\n";
+ } else {
+ sampler_name = source == SOURCE_ROUGHNESS ? "roughness_tex" : "normal_roughness_tex";
+ hint += "hint_normal_roughness_texture;\n";
+ }
+ code += "uniform sampler2D " + make_unique_id(p_type, p_id, sampler_name) + hint;
+ }
+ } break;
+ default: {
+ } break;
}
- return String();
+ return code;
}
String VisualShaderNodeTexture::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 default_uv;
if (p_mode == Shader::MODE_CANVAS_ITEM || p_mode == Shader::MODE_SPATIAL) {
- default_uv = "UV";
+ if (source == SOURCE_SCREEN) {
+ default_uv = "SCREEN_UV";
+ } else {
+ default_uv = "UV";
+ }
} else {
default_uv = "vec2(0.0)";
}
String code;
- if (source == SOURCE_TEXTURE) {
- String id = make_unique_id(p_type, p_id, "tex");
- if (p_input_vars[0].is_empty()) { // Use UV by default.
- if (p_input_vars[1].is_empty()) {
- code += " " + p_output_vars[0] + " = texture(" + id + ", " + default_uv + ");\n";
- } else {
- code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + default_uv + ", " + p_input_vars[1] + ");\n";
- }
- } else if (p_input_vars[1].is_empty()) {
- //no lod
- code += " " + p_output_vars[0] + " = texture(" + id + ", " + p_input_vars[0] + ");\n";
- } else {
- code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
- }
- return code;
- }
+ String uv = p_input_vars[0].is_empty() ? default_uv : p_input_vars[0];
- if (source == SOURCE_PORT) {
- String id = p_input_vars[2];
- if (id.is_empty()) {
- code += " " + p_output_vars[0] + " = vec4(0.0);\n";
- } else {
- if (p_input_vars[0].is_empty()) { // Use UV by default.
- if (p_input_vars[1].is_empty()) {
- code += " " + p_output_vars[0] + " = texture(" + id + ", " + default_uv + ");\n";
- } else {
- code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + default_uv + ", " + p_input_vars[1] + ");\n";
+ switch (source) {
+ case SOURCE_PORT:
+ case SOURCE_TEXTURE: {
+ String id;
+ if (source == SOURCE_PORT) {
+ id = p_input_vars[2];
+ if (id.is_empty()) {
+ break;
}
- } else if (p_input_vars[1].is_empty()) {
- //no lod
- code += " " + p_output_vars[0] + " = texture(" + id + ", " + p_input_vars[0] + ");\n";
- } else {
- code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ } else { // SOURCE_TEXTURE
+ id = make_unique_id(p_type, p_id, "tex");
}
- }
- return code;
- }
-
- if (source == SOURCE_SCREEN && (p_mode == Shader::MODE_SPATIAL || p_mode == Shader::MODE_CANVAS_ITEM) && p_type == VisualShader::TYPE_FRAGMENT) {
- String id = make_unique_id(p_type, p_id, "screen_tex");
- if (p_input_vars[0].is_empty() || p_for_preview) { // Use UV by default.
if (p_input_vars[1].is_empty()) {
- code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + default_uv + ", 0.0);\n";
+ code += " " + p_output_vars[0] + " = texture(" + id + ", " + uv + ");\n";
} else {
- code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + default_uv + ", " + p_input_vars[1] + ");\n";
+ code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + uv + ", " + p_input_vars[1] + ");\n";
}
- } else if (p_input_vars[1].is_empty()) {
- //no lod
- code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + p_input_vars[0] + ", 0.0);\n";
- } else {
- code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
- }
- return code;
- }
-
- if (source == SOURCE_2D_TEXTURE && p_mode == Shader::MODE_CANVAS_ITEM && p_type == VisualShader::TYPE_FRAGMENT) {
- if (p_input_vars[0].is_empty()) { // Use UV by default.
- if (p_input_vars[1].is_empty()) {
- code += " " + p_output_vars[0] + " = texture(TEXTURE, " + default_uv + ");\n";
- } else {
- code += " " + p_output_vars[0] + " = textureLod(TEXTURE, " + default_uv + ", " + p_input_vars[1] + ");\n";
- }
- } else if (p_input_vars[1].is_empty()) {
- //no lod
- code += " " + p_output_vars[0] + " = texture(TEXTURE, " + p_input_vars[0] + ");\n";
- } else {
- code += " " + p_output_vars[0] + " = textureLod(TEXTURE, " + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
- }
- return code;
- }
-
- if (source == SOURCE_2D_NORMAL && p_mode == Shader::MODE_CANVAS_ITEM && p_type == VisualShader::TYPE_FRAGMENT) {
- if (p_input_vars[0].is_empty()) { // Use UV by default.
- if (p_input_vars[1].is_empty()) {
- code += " " + p_output_vars[0] + " = texture(NORMAL_TEXTURE, " + default_uv + ");\n";
- } else {
- code += " " + p_output_vars[0] + " = textureLod(NORMAL_TEXTURE, " + default_uv + ", " + p_input_vars[1] + ");\n";
- }
- } else if (p_input_vars[1].is_empty()) {
- //no lod
- code += " " + p_output_vars[0] + " = texture(NORMAL_TEXTURE, " + p_input_vars[0] + ".xy);\n";
- } else {
- code += " " + p_output_vars[0] + " = textureLod(NORMAL_TEXTURE, " + p_input_vars[0] + ".xy, " + p_input_vars[1] + ");\n";
- }
- return code;
- }
-
- if (source == SOURCE_DEPTH || source == SOURCE_ROUGHNESS) {
- if (!p_for_preview && p_mode == Shader::MODE_SPATIAL && p_type == VisualShader::TYPE_FRAGMENT) {
- String var_name = "";
- String sampler_name = "";
-
- if (source == SOURCE_DEPTH) {
- var_name = "_depth";
- sampler_name = "depth_tex";
- } else if (source == SOURCE_ROUGHNESS) {
- var_name = "_screen_roughness";
- sampler_name = "screen_roughness_tex";
+ return code;
+ } break;
+ case SOURCE_SCREEN: {
+ if ((p_mode == Shader::MODE_SPATIAL || p_mode == Shader::MODE_CANVAS_ITEM) && p_type == VisualShader::TYPE_FRAGMENT) {
+ String id = make_unique_id(p_type, p_id, "screen_tex");
+ if (p_input_vars[1].is_empty()) {
+ code += " " + p_output_vars[0] + " = texture(" + id + ", " + uv + ");\n";
+ } else {
+ code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + uv + ", " + p_input_vars[1] + ");\n";
+ }
+ return code;
}
+ } break;
+ case SOURCE_2D_NORMAL:
+ case SOURCE_2D_TEXTURE: {
+ if (p_mode == Shader::MODE_CANVAS_ITEM && p_type == VisualShader::TYPE_FRAGMENT) {
+ String id = source == SOURCE_2D_TEXTURE ? "TEXTURE" : "NORMAL_TEXTURE";
- String id = make_unique_id(p_type, p_id, sampler_name);
- code += " {\n";
- if (p_input_vars[0].is_empty()) { // Use UV by default.
if (p_input_vars[1].is_empty()) {
- code += " float " + var_name + " = texture(" + id + ", " + default_uv + ").r;\n";
+ code += " " + p_output_vars[0] + " = texture(" + id + ", " + uv + ");\n";
} else {
- code += " float " + var_name + " = textureLod(" + id + ", " + default_uv + ", " + p_input_vars[1] + ").r;\n";
+ code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + uv + ", " + p_input_vars[1] + ");\n";
}
- } else if (p_input_vars[1].is_empty()) {
- //no lod
- code += " float " + var_name + " = texture(" + id + ", " + p_input_vars[0] + ".xy).r;\n";
- } else {
- code += " float " + var_name + " = textureLod(" + id + ", " + p_input_vars[0] + ".xy, " + p_input_vars[1] + ").r;\n";
+ return code;
}
+ } break;
+ case SOURCE_3D_NORMAL:
+ case SOURCE_ROUGHNESS:
+ case SOURCE_DEPTH: {
+ if (!p_for_preview && p_mode == Shader::MODE_SPATIAL && p_type == VisualShader::TYPE_FRAGMENT) {
+ String var_name = "";
+ String sampler_name = "";
+
+ switch (source) {
+ case SOURCE_DEPTH: {
+ var_name = "_depth";
+ sampler_name = "depth_tex";
+ } break;
+ case SOURCE_ROUGHNESS: {
+ var_name = "_roughness";
+ sampler_name = "roughness_tex";
+ } break;
+ case SOURCE_3D_NORMAL: {
+ var_name = "_normal";
+ sampler_name = "normal_roughness_tex";
+ } break;
+ default: {
+ } break;
+ }
- code += " " + p_output_vars[0] + " = vec4(" + var_name + ", " + var_name + ", " + var_name + ", 1.0);\n";
- code += " }\n";
- return code;
- }
- }
+ String id = make_unique_id(p_type, p_id, sampler_name);
+ String type = source == SOURCE_3D_NORMAL ? "vec3" : "float";
+ String components = source == SOURCE_3D_NORMAL ? "rgb" : "r";
- if (source == SOURCE_3D_NORMAL) {
- if (!p_for_preview && p_mode == Shader::MODE_SPATIAL && p_type == VisualShader::TYPE_FRAGMENT) {
- String id = make_unique_id(p_type, p_id, "screen_normal_tex");
- code += " {\n";
- if (p_input_vars[0].is_empty()) { // Use UV by default.
+ code += " {\n";
if (p_input_vars[1].is_empty()) {
- code += " vec3 _screen_normal = texture(" + id + ", " + default_uv + ").xyz;\n";
+ code += " " + type + " " + var_name + " = texture(" + id + ", " + uv + ")." + components + ";\n";
} else {
- code += " vec3 _screen_normal = textureLod(" + id + ", " + default_uv + ", " + p_input_vars[1] + ").xyz;\n";
+ code += " " + type + " " + var_name + " = textureLod(" + id + ", " + uv + ", " + p_input_vars[1] + ")." + components + ";\n";
}
- } else if (p_input_vars[1].is_empty()) {
- //no lod
- code += " vec3 _screen_normal = texture(" + id + ", " + p_input_vars[0] + ".xy).xyz;\n";
- } else {
- code += " vec3 _screen_normal = textureLod(" + id + ", " + p_input_vars[0] + ".xy, " + p_input_vars[1] + ").xyz;\n";
- }
+ if (source == SOURCE_3D_NORMAL) {
+ code += " " + p_output_vars[0] + " = vec4(" + var_name + ", 1.0);\n";
+ } else {
+ code += " " + p_output_vars[0] + " = vec4(" + var_name + ", " + var_name + ", " + var_name + ", 1.0);\n";
+ }
+ code += " }\n";
- code += " " + p_output_vars[0] + " = vec4(_screen_normal, 1.0);\n";
- code += " }\n";
- return code;
- }
+ return code;
+ }
+ } break;
+ default: {
+ } break;
}
code += " " + p_output_vars[0] + " = vec4(0.0);\n";
@@ -985,7 +948,6 @@ void VisualShaderNodeTexture::set_source(Source p_source) {
}
source = p_source;
emit_changed();
- emit_signal(SNAME("editor_refresh_request"));
}
VisualShaderNodeTexture::Source VisualShaderNodeTexture::get_source() const {
@@ -1029,31 +991,34 @@ String VisualShaderNodeTexture::get_warning(Shader::Mode p_mode, VisualShader::T
return RTR("The sampler port is connected but not used. Consider changing the source to 'SamplerPort'.");
}
- if (source == SOURCE_TEXTURE) {
- return String(); // all good
- }
-
- if (source == SOURCE_PORT) {
- return String(); // all good
- }
-
- if (source == SOURCE_SCREEN && (p_mode == Shader::MODE_SPATIAL || p_mode == Shader::MODE_CANVAS_ITEM) && p_type == VisualShader::TYPE_FRAGMENT) {
- return String(); // all good
- }
-
- if (source == SOURCE_2D_TEXTURE && p_mode == Shader::MODE_CANVAS_ITEM && p_type == VisualShader::TYPE_FRAGMENT) {
- return String(); // all good
- }
-
- if (source == SOURCE_2D_NORMAL && p_mode == Shader::MODE_CANVAS_ITEM) {
- return String(); // all good
- }
-
- if ((source == SOURCE_DEPTH || source == SOURCE_3D_NORMAL || source == SOURCE_ROUGHNESS) && p_mode == Shader::MODE_SPATIAL && p_type == VisualShader::TYPE_FRAGMENT) {
- if (get_output_port_for_preview() == 0) { // DEPTH_TEXTURE and NORMAL_ROUGHNESS_TEXTURE are not supported in preview(canvas_item) shader
- return RTR("Invalid source for preview.");
- }
- return String(); // all good
+ switch (source) {
+ case SOURCE_TEXTURE:
+ case SOURCE_PORT: {
+ return String(); // All good.
+ } break;
+ case SOURCE_SCREEN: {
+ if ((p_mode == Shader::MODE_SPATIAL || p_mode == Shader::MODE_CANVAS_ITEM) && p_type == VisualShader::TYPE_FRAGMENT) {
+ return String(); // All good.
+ }
+ } break;
+ case SOURCE_2D_NORMAL:
+ case SOURCE_2D_TEXTURE: {
+ if (p_mode == Shader::MODE_CANVAS_ITEM && p_type == VisualShader::TYPE_FRAGMENT) {
+ return String(); // All good.
+ }
+ } break;
+ case SOURCE_3D_NORMAL:
+ case SOURCE_ROUGHNESS:
+ case SOURCE_DEPTH: {
+ if (p_mode == Shader::MODE_SPATIAL && p_type == VisualShader::TYPE_FRAGMENT) {
+ if (get_output_port_for_preview() == 0) { // Not supported in preview(canvas_item) shader.
+ return RTR("Invalid source for preview.");
+ }
+ return String(); // All good.
+ }
+ } break;
+ default: {
+ } break;
}
return RTR("Invalid source for shader.");
@@ -1069,7 +1034,7 @@ void VisualShaderNodeTexture::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_texture_type", "value"), &VisualShaderNodeTexture::set_texture_type);
ClassDB::bind_method(D_METHOD("get_texture_type"), &VisualShaderNodeTexture::get_texture_type);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "source", PROPERTY_HINT_ENUM, "Texture,Screen,Texture2D,NormalMap2D,Depth,SamplerPort,ScreenNormal,Roughness"), "set_source", "get_source");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "source", PROPERTY_HINT_ENUM, "Texture,Screen,Texture2D,NormalMap2D,Depth,SamplerPort,Normal3D,Roughness"), "set_source", "get_source");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture");
ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_type", PROPERTY_HINT_ENUM, "Data,Color,Normal Map"), "set_texture_type", "get_texture_type");
@@ -1321,6 +1286,17 @@ bool VisualShaderNodeSample3D::is_input_port_default(int p_port, Shader::Mode p_
}
String VisualShaderNodeSample3D::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 code;
+ String id;
+ if (source == SOURCE_TEXTURE) {
+ id = make_unique_id(p_type, p_id, "tex3d");
+ } else { // SOURCE_PORT
+ id = p_input_vars[2];
+ if (id.is_empty()) {
+ code += " " + p_output_vars[0] + " = vec4(0.0);\n";
+ return code;
+ }
+ }
String default_uv;
if (p_mode == Shader::MODE_CANVAS_ITEM || p_mode == Shader::MODE_SPATIAL) {
default_uv = "vec3(UV, 0.0)";
@@ -1328,33 +1304,12 @@ String VisualShaderNodeSample3D::generate_code(Shader::Mode p_mode, VisualShader
default_uv = "vec3(0.0)";
}
- String code;
- if (source == SOURCE_TEXTURE || source == SOURCE_PORT) {
- String id;
- if (source == SOURCE_TEXTURE) {
- id = make_unique_id(p_type, p_id, "tex3d");
- } else {
- id = p_input_vars[2];
- }
- if (!id.is_empty()) {
- if (p_input_vars[0].is_empty()) { // Use UV by default.
- if (p_input_vars[1].is_empty()) {
- code += " " + p_output_vars[0] + " = texture(" + id + ", " + default_uv + ");\n";
- } else {
- code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + default_uv + ", " + p_input_vars[1] + ");\n";
- }
- } else if (p_input_vars[1].is_empty()) {
- //no lod
- code += " " + p_output_vars[0] + " = texture(" + id + ", " + p_input_vars[0] + ");\n";
- } else {
- code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
- }
- } else {
- code += " " + p_output_vars[0] + " = vec4(0.0);\n";
- }
- return code;
+ String uv = p_input_vars[0].is_empty() ? default_uv : p_input_vars[0];
+ if (p_input_vars[1].is_empty()) {
+ code += " " + p_output_vars[0] + " = texture(" + id + ", " + uv + ");\n";
+ } else {
+ code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + uv + ", " + p_input_vars[1] + ");\n";
}
- code += " " + p_output_vars[0] + " = vec4(0.0);\n";
return code;
}
@@ -1365,7 +1320,6 @@ void VisualShaderNodeSample3D::set_source(Source p_source) {
}
source = p_source;
emit_changed();
- emit_signal(SNAME("editor_refresh_request"));
}
VisualShaderNodeSample3D::Source VisualShaderNodeSample3D::get_source() const {
@@ -1387,14 +1341,7 @@ String VisualShaderNodeSample3D::get_warning(Shader::Mode p_mode, VisualShader::
if (is_input_port_connected(2) && source != SOURCE_PORT) {
return RTR("The sampler port is connected but not used. Consider changing the source to 'SamplerPort'.");
}
-
- if (source == SOURCE_TEXTURE) {
- return String(); // all good
- }
- if (source == SOURCE_PORT) {
- return String(); // all good
- }
- return RTR("Invalid source for shader.");
+ return String();
}
VisualShaderNodeSample3D::VisualShaderNodeSample3D() {
@@ -1600,42 +1547,33 @@ String VisualShaderNodeCubemap::generate_global(Shader::Mode p_mode, VisualShade
}
String VisualShaderNodeCubemap::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 default_uv;
- if (p_mode == Shader::MODE_CANVAS_ITEM || p_mode == Shader::MODE_SPATIAL) {
- default_uv = "vec3(UV, 0.0)";
- } else {
- default_uv = "vec3(0.0)";
- }
-
String code;
String id;
+
if (source == SOURCE_TEXTURE) {
id = make_unique_id(p_type, p_id, "cube");
- } else if (source == SOURCE_PORT) {
+ } else { // SOURCE_PORT
id = p_input_vars[2];
- } else {
- return code;
+ if (id.is_empty()) {
+ code += " " + p_output_vars[0] + " = vec4(0.0);\n";
+ return code;
+ }
}
- if (id.is_empty()) {
- code += " " + p_output_vars[0] + " = vec4(0.0);\n";
- return code;
+ String default_uv;
+ if (p_mode == Shader::MODE_CANVAS_ITEM || p_mode == Shader::MODE_SPATIAL) {
+ default_uv = "vec3(UV, 0.0)";
+ } else {
+ default_uv = "vec3(0.0)";
}
- if (p_input_vars[0].is_empty()) { // Use UV by default.
-
- if (p_input_vars[1].is_empty()) {
- code += " " + p_output_vars[0] + " = texture(" + id + ", " + default_uv + ");\n";
- } else {
- code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + default_uv + ", " + p_input_vars[1] + ");\n";
- }
-
- } else if (p_input_vars[1].is_empty()) {
- //no lod
- code += " " + p_output_vars[0] + " = texture(" + id + ", " + p_input_vars[0] + ");\n";
+ String uv = p_input_vars[0].is_empty() ? default_uv : p_input_vars[0];
+ if (p_input_vars[1].is_empty()) {
+ code += " " + p_output_vars[0] + " = texture(" + id + ", " + uv + ");\n";
} else {
- code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
+ code += " " + p_output_vars[0] + " = textureLod(" + id + ", " + uv + ", " + p_input_vars[1] + ");\n";
}
+
return code;
}
@@ -1655,7 +1593,6 @@ void VisualShaderNodeCubemap::set_source(Source p_source) {
}
source = p_source;
emit_changed();
- emit_signal(SNAME("editor_refresh_request"));
}
VisualShaderNodeCubemap::Source VisualShaderNodeCubemap::get_source() const {
@@ -3753,16 +3690,47 @@ String VisualShaderNodeDerivativeFunc::get_output_port_name(int p_port) const {
String VisualShaderNodeDerivativeFunc::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 *functions[FUNC_MAX] = {
- "fwidth($)",
- "dFdx($)",
- "dFdy($)"
+ "fwidth$($)",
+ "dFdx$($)",
+ "dFdy$($)"
+ };
+
+ static const char *precisions[PRECISION_MAX] = {
+ "",
+ "Coarse",
+ "Fine"
};
String code;
- code += " " + p_output_vars[0] + " = " + String(functions[func]).replace("$", p_input_vars[0]) + ";\n";
+ if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") {
+ code += " " + p_output_vars[0] + " = " + String(functions[func]).replace_first("$", "").replace_first("$", p_input_vars[0]) + ";\n";
+ return code;
+ }
+
+ code += " " + p_output_vars[0] + " = " + String(functions[func]).replace_first("$", String(precisions[precision])).replace_first("$", p_input_vars[0]) + ";\n";
return code;
}
+String VisualShaderNodeDerivativeFunc::get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const {
+ if (precision != PRECISION_NONE && OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") {
+ String precision_str;
+ switch (precision) {
+ case PRECISION_COARSE: {
+ precision_str = "Coarse";
+ } break;
+ case PRECISION_FINE: {
+ precision_str = "Fine";
+ } break;
+ default: {
+ } break;
+ }
+
+ return vformat(RTR("`%s` precision mode is not available for `gl_compatibility` profile.\nReverted to `None` precision."), precision_str);
+ }
+
+ return String();
+}
+
void VisualShaderNodeDerivativeFunc::set_op_type(OpType p_op_type) {
ERR_FAIL_INDEX((int)p_op_type, int(OP_TYPE_MAX));
if (op_type == p_op_type) {
@@ -3805,10 +3773,24 @@ VisualShaderNodeDerivativeFunc::Function VisualShaderNodeDerivativeFunc::get_fun
return func;
}
+void VisualShaderNodeDerivativeFunc::set_precision(Precision p_precision) {
+ ERR_FAIL_INDEX(int(p_precision), int(PRECISION_MAX));
+ if (precision == p_precision) {
+ return;
+ }
+ precision = p_precision;
+ emit_changed();
+}
+
+VisualShaderNodeDerivativeFunc::Precision VisualShaderNodeDerivativeFunc::get_precision() const {
+ return precision;
+}
+
Vector<StringName> VisualShaderNodeDerivativeFunc::get_editable_properties() const {
Vector<StringName> props;
props.push_back("op_type");
props.push_back("function");
+ props.push_back("precision");
return props;
}
@@ -3819,8 +3801,12 @@ void VisualShaderNodeDerivativeFunc::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_function", "func"), &VisualShaderNodeDerivativeFunc::set_function);
ClassDB::bind_method(D_METHOD("get_function"), &VisualShaderNodeDerivativeFunc::get_function);
+ ClassDB::bind_method(D_METHOD("set_precision", "precision"), &VisualShaderNodeDerivativeFunc::set_precision);
+ ClassDB::bind_method(D_METHOD("get_precision"), &VisualShaderNodeDerivativeFunc::get_precision);
+
ADD_PROPERTY(PropertyInfo(Variant::INT, "op_type", PROPERTY_HINT_ENUM, "Scalar,Vector2,Vector3,Vector4"), "set_op_type", "get_op_type");
ADD_PROPERTY(PropertyInfo(Variant::INT, "function", PROPERTY_HINT_ENUM, "Sum,X,Y"), "set_function", "get_function");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "precision", PROPERTY_HINT_ENUM, "None,Coarse,Fine"), "set_precision", "get_precision");
BIND_ENUM_CONSTANT(OP_TYPE_SCALAR);
BIND_ENUM_CONSTANT(OP_TYPE_VECTOR_2D);
@@ -3832,6 +3818,11 @@ void VisualShaderNodeDerivativeFunc::_bind_methods() {
BIND_ENUM_CONSTANT(FUNC_X);
BIND_ENUM_CONSTANT(FUNC_Y);
BIND_ENUM_CONSTANT(FUNC_MAX);
+
+ BIND_ENUM_CONSTANT(PRECISION_NONE);
+ BIND_ENUM_CONSTANT(PRECISION_COARSE);
+ BIND_ENUM_CONSTANT(PRECISION_FINE);
+ BIND_ENUM_CONSTANT(PRECISION_MAX);
}
VisualShaderNodeDerivativeFunc::VisualShaderNodeDerivativeFunc() {
@@ -7757,12 +7748,15 @@ bool VisualShaderNodeProximityFade::has_output_port_preview(int p_port) const {
return false;
}
+String VisualShaderNodeProximityFade::generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const {
+ return "uniform sampler2D " + make_unique_id(p_type, p_id, "depth_tex") + " : hint_depth_texture;\n";
+}
+
String VisualShaderNodeProximityFade::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 code;
code += " {\n";
- String proximity_fade_distance = vformat("%s", p_input_vars[0]);
- code += " float __depth_tex = textureLod(DEPTH_TEXTURE, SCREEN_UV, 0.0).r;\n";
+ code += " float __depth_tex = texture(" + make_unique_id(p_type, p_id, "depth_tex") + ", SCREEN_UV).r;\n";
if (!RenderingServer::get_singleton()->is_low_end()) {
code += " vec4 __depth_world_pos = INV_PROJECTION_MATRIX * vec4(SCREEN_UV * 2.0 - 1.0, __depth_tex, 1.0);\n";
} else {
diff --git a/scene/resources/visual_shader_nodes.h b/scene/resources/visual_shader_nodes.h
index 8d0f88d83a..fa6b134526 100644
--- a/scene/resources/visual_shader_nodes.h
+++ b/scene/resources/visual_shader_nodes.h
@@ -1536,9 +1536,17 @@ public:
FUNC_MAX,
};
+ enum Precision {
+ PRECISION_NONE,
+ PRECISION_COARSE,
+ PRECISION_FINE,
+ PRECISION_MAX,
+ };
+
protected:
OpType op_type = OP_TYPE_SCALAR;
Function func = FUNC_SUM;
+ Precision precision = PRECISION_NONE;
protected:
static void _bind_methods();
@@ -1555,6 +1563,7 @@ public:
virtual String get_output_port_name(int p_port) const override;
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 override;
+ virtual String get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const override;
void set_op_type(OpType p_op_type);
OpType get_op_type() const;
@@ -1562,6 +1571,9 @@ public:
void set_function(Function p_func);
Function get_function() const;
+ void set_precision(Precision p_precision);
+ Precision get_precision() const;
+
virtual Vector<StringName> get_editable_properties() const override;
VisualShaderNodeDerivativeFunc();
@@ -1569,6 +1581,7 @@ public:
VARIANT_ENUM_CAST(VisualShaderNodeDerivativeFunc::OpType)
VARIANT_ENUM_CAST(VisualShaderNodeDerivativeFunc::Function)
+VARIANT_ENUM_CAST(VisualShaderNodeDerivativeFunc::Precision)
///////////////////////////////////////
/// FACEFORWARD
@@ -2849,6 +2862,7 @@ public:
virtual String get_output_port_name(int p_port) const override;
virtual bool has_output_port_preview(int p_port) const override;
+ virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override;
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 override;
VisualShaderNodeProximityFade();
diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp
index c35f7360b5..2a70139bcb 100644
--- a/scene/resources/world_2d.cpp
+++ b/scene/resources/world_2d.cpp
@@ -47,6 +47,13 @@ RID World2D::get_space() const {
}
RID World2D::get_navigation_map() const {
+ if (navigation_map.is_null()) {
+ navigation_map = NavigationServer2D::get_singleton()->map_create();
+ NavigationServer2D::get_singleton()->map_set_active(navigation_map, true);
+ NavigationServer2D::get_singleton()->map_set_cell_size(navigation_map, GLOBAL_GET("navigation/2d/default_cell_size"));
+ NavigationServer2D::get_singleton()->map_set_edge_connection_margin(navigation_map, GLOBAL_GET("navigation/2d/default_edge_connection_margin"));
+ NavigationServer2D::get_singleton()->map_set_link_connection_radius(navigation_map, GLOBAL_GET("navigation/2d/default_link_connection_radius"));
+ }
return navigation_map;
}
@@ -77,13 +84,6 @@ World2D::World2D() {
PhysicsServer2D::get_singleton()->area_set_param(space, PhysicsServer2D::AREA_PARAM_GRAVITY_VECTOR, GLOBAL_DEF_BASIC("physics/2d/default_gravity_vector", Vector2(0, 1)));
PhysicsServer2D::get_singleton()->area_set_param(space, PhysicsServer2D::AREA_PARAM_LINEAR_DAMP, GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/default_linear_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"), 0.1));
PhysicsServer2D::get_singleton()->area_set_param(space, PhysicsServer2D::AREA_PARAM_ANGULAR_DAMP, GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/default_angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"), 1.0));
-
- // Create and configure the navigation_map to be more friendly with pixels than meters.
- navigation_map = NavigationServer2D::get_singleton()->map_create();
- NavigationServer2D::get_singleton()->map_set_active(navigation_map, true);
- NavigationServer2D::get_singleton()->map_set_cell_size(navigation_map, GLOBAL_DEF("navigation/2d/default_cell_size", 1));
- NavigationServer2D::get_singleton()->map_set_edge_connection_margin(navigation_map, GLOBAL_DEF("navigation/2d/default_edge_connection_margin", 1));
- NavigationServer2D::get_singleton()->map_set_link_connection_radius(navigation_map, GLOBAL_DEF("navigation/2d/default_link_connection_radius", 4));
}
World2D::~World2D() {
@@ -92,5 +92,7 @@ World2D::~World2D() {
ERR_FAIL_NULL(NavigationServer2D::get_singleton());
RenderingServer::get_singleton()->free(canvas);
PhysicsServer2D::get_singleton()->free(space);
- NavigationServer2D::get_singleton()->free(navigation_map);
+ if (navigation_map.is_valid()) {
+ NavigationServer2D::get_singleton()->free(navigation_map);
+ }
}
diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h
index 92239ed167..f02dddd2fe 100644
--- a/scene/resources/world_2d.h
+++ b/scene/resources/world_2d.h
@@ -44,7 +44,7 @@ class World2D : public Resource {
RID canvas;
RID space;
- RID navigation_map;
+ mutable RID navigation_map;
HashSet<Viewport *> viewports;
diff --git a/scene/resources/world_3d.cpp b/scene/resources/world_3d.cpp
index 536edd334b..cc4d261c0d 100644
--- a/scene/resources/world_3d.cpp
+++ b/scene/resources/world_3d.cpp
@@ -55,6 +55,13 @@ RID World3D::get_space() const {
}
RID World3D::get_navigation_map() const {
+ if (navigation_map.is_null()) {
+ navigation_map = NavigationServer3D::get_singleton()->map_create();
+ NavigationServer3D::get_singleton()->map_set_active(navigation_map, true);
+ NavigationServer3D::get_singleton()->map_set_cell_size(navigation_map, GLOBAL_GET("navigation/3d/default_cell_size"));
+ NavigationServer3D::get_singleton()->map_set_edge_connection_margin(navigation_map, GLOBAL_GET("navigation/3d/default_edge_connection_margin"));
+ NavigationServer3D::get_singleton()->map_set_link_connection_radius(navigation_map, GLOBAL_GET("navigation/3d/default_link_connection_radius"));
+ }
return navigation_map;
}
@@ -146,12 +153,6 @@ World3D::World3D() {
PhysicsServer3D::get_singleton()->area_set_param(space, PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR, GLOBAL_DEF_BASIC("physics/3d/default_gravity_vector", Vector3(0, -1, 0)));
PhysicsServer3D::get_singleton()->area_set_param(space, PhysicsServer3D::AREA_PARAM_LINEAR_DAMP, GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/3d/default_linear_damp", PROPERTY_HINT_RANGE, "0,100,0.001,or_greater"), 0.1));
PhysicsServer3D::get_singleton()->area_set_param(space, PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP, GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/3d/default_angular_damp", PROPERTY_HINT_RANGE, "0,100,0.001,or_greater"), 0.1));
-
- navigation_map = NavigationServer3D::get_singleton()->map_create();
- NavigationServer3D::get_singleton()->map_set_active(navigation_map, true);
- NavigationServer3D::get_singleton()->map_set_cell_size(navigation_map, GLOBAL_DEF("navigation/3d/default_cell_size", 0.25));
- NavigationServer3D::get_singleton()->map_set_edge_connection_margin(navigation_map, GLOBAL_DEF("navigation/3d/default_edge_connection_margin", 0.25));
- NavigationServer3D::get_singleton()->map_set_link_connection_radius(navigation_map, GLOBAL_DEF("navigation/3d/default_link_connection_radius", 1.0));
}
World3D::~World3D() {
@@ -160,5 +161,7 @@ World3D::~World3D() {
ERR_FAIL_NULL(NavigationServer3D::get_singleton());
PhysicsServer3D::get_singleton()->free(space);
RenderingServer::get_singleton()->free(scenario);
- NavigationServer3D::get_singleton()->free(navigation_map);
+ if (navigation_map.is_valid()) {
+ NavigationServer3D::get_singleton()->free(navigation_map);
+ }
}
diff --git a/scene/resources/world_3d.h b/scene/resources/world_3d.h
index 7cbc9f08c9..ad17daf466 100644
--- a/scene/resources/world_3d.h
+++ b/scene/resources/world_3d.h
@@ -46,8 +46,8 @@ class World3D : public Resource {
private:
RID space;
- RID navigation_map;
RID scenario;
+ mutable RID navigation_map;
Ref<Environment> environment;
Ref<Environment> fallback_environment;
diff --git a/scene/resources/world_boundary_shape_2d.cpp b/scene/resources/world_boundary_shape_2d.cpp
index 49f0873a3e..35cb8ef13d 100644
--- a/scene/resources/world_boundary_shape_2d.cpp
+++ b/scene/resources/world_boundary_shape_2d.cpp
@@ -76,11 +76,12 @@ real_t WorldBoundaryShape2D::get_distance() const {
void WorldBoundaryShape2D::draw(const RID &p_to_rid, const Color &p_color) {
Vector2 point = get_distance() * get_normal();
+ real_t line_width = 3.0;
Vector2 l1[2] = { point - get_normal().orthogonal() * 100, point + get_normal().orthogonal() * 100 };
- RS::get_singleton()->canvas_item_add_line(p_to_rid, l1[0], l1[1], p_color, 3);
- Vector2 l2[2] = { point, point + get_normal() * 30 };
- RS::get_singleton()->canvas_item_add_line(p_to_rid, l2[0], l2[1], p_color, 3);
+ RS::get_singleton()->canvas_item_add_line(p_to_rid, l1[0], l1[1], p_color, line_width);
+ Vector2 l2[2] = { point + get_normal().normalized() * (0.5 * line_width), point + get_normal() * 30 };
+ RS::get_singleton()->canvas_item_add_line(p_to_rid, l2[0], l2[1], p_color, line_width);
}
Rect2 WorldBoundaryShape2D::get_rect() const {
diff --git a/servers/display_server.cpp b/servers/display_server.cpp
index 39f14439f4..2d65cea432 100644
--- a/servers/display_server.cpp
+++ b/servers/display_server.cpp
@@ -344,7 +344,6 @@ DisplayServer::MouseMode DisplayServer::mouse_get_mode() const {
}
void DisplayServer::warp_mouse(const Point2i &p_position) {
- WARN_PRINT("Mouse warping is not supported by this display server.");
}
Point2i DisplayServer::mouse_get_position() const {
@@ -572,7 +571,7 @@ void DisplayServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("global_menu_add_icon_check_item", "menu_root", "icon", "label", "callback", "key_callback", "tag", "accelerator", "index"), &DisplayServer::global_menu_add_icon_check_item, DEFVAL(Callable()), DEFVAL(Callable()), DEFVAL(Variant()), DEFVAL(Key::NONE), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("global_menu_add_radio_check_item", "menu_root", "label", "callback", "key_callback", "tag", "accelerator", "index"), &DisplayServer::global_menu_add_radio_check_item, DEFVAL(Callable()), DEFVAL(Callable()), DEFVAL(Variant()), DEFVAL(Key::NONE), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("global_menu_add_icon_radio_check_item", "menu_root", "icon", "label", "callback", "key_callback", "tag", "accelerator", "index"), &DisplayServer::global_menu_add_icon_radio_check_item, DEFVAL(Callable()), DEFVAL(Callable()), DEFVAL(Variant()), DEFVAL(Key::NONE), DEFVAL(-1));
- ClassDB::bind_method(D_METHOD("global_menu_add_multistate_item", "menu_root", "labe", "max_states", "default_state", "callback", "key_callback", "tag", "accelerator", "index"), &DisplayServer::global_menu_add_multistate_item, DEFVAL(Callable()), DEFVAL(Callable()), DEFVAL(Variant()), DEFVAL(Key::NONE), DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("global_menu_add_multistate_item", "menu_root", "label", "max_states", "default_state", "callback", "key_callback", "tag", "accelerator", "index"), &DisplayServer::global_menu_add_multistate_item, DEFVAL(Callable()), DEFVAL(Callable()), DEFVAL(Variant()), DEFVAL(Key::NONE), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("global_menu_add_separator", "menu_root", "index"), &DisplayServer::global_menu_add_separator, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("global_menu_get_item_index_from_text", "menu_root", "text"), &DisplayServer::global_menu_get_item_index_from_text);
diff --git a/servers/navigation_server_2d.cpp b/servers/navigation_server_2d.cpp
index 943b2ae467..2e4087c1de 100644
--- a/servers/navigation_server_2d.cpp
+++ b/servers/navigation_server_2d.cpp
@@ -81,35 +81,12 @@ NavigationServer2D *NavigationServer2D::singleton = nullptr;
return CONV_R(NavigationServer3D::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1))); \
}
-#define FORWARD_4(FUNC_NAME, T_0, D_0, T_1, D_1, T_2, D_2, T_3, D_3, CONV_0, CONV_1, CONV_2, CONV_3) \
- NavigationServer2D::FUNC_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3) { \
- return NavigationServer3D::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1), CONV_2(D_2), CONV_3(D_3)); \
- }
-
-#define FORWARD_4_R_C(CONV_R, FUNC_NAME, T_0, D_0, T_1, D_1, T_2, D_2, T_3, D_3, CONV_0, CONV_1, CONV_2, CONV_3) \
- NavigationServer2D::FUNC_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3) \
- const { \
- return CONV_R(NavigationServer3D::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1), CONV_2(D_2), CONV_3(D_3))); \
- }
-
-#define FORWARD_4_C(FUNC_NAME, T_0, D_0, T_1, D_1, T_2, D_2, T_3, D_3, CONV_0, CONV_1, CONV_2, CONV_3) \
- NavigationServer2D::FUNC_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3) \
- const { \
- return NavigationServer3D::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1), CONV_2(D_2), CONV_3(D_3)); \
- }
-
#define FORWARD_5_R_C(CONV_R, FUNC_NAME, T_0, D_0, T_1, D_1, T_2, D_2, T_3, D_3, T_4, D_4, CONV_0, CONV_1, CONV_2, CONV_3, CONV_4) \
NavigationServer2D::FUNC_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3, T_4 D_4) \
const { \
return CONV_R(NavigationServer3D::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1), CONV_2(D_2), CONV_3(D_3), CONV_4(D_4))); \
}
-#define FORWARD_5_C(FUNC_NAME, T_0, D_0, T_1, D_1, T_2, D_2, T_3, D_3, T_4, D_4, CONV_0, CONV_1, CONV_2, CONV_3, CONV_4) \
- NavigationServer2D::FUNC_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3, T_4 D_4) \
- const { \
- return NavigationServer3D::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1), CONV_2(D_2), CONV_3(D_3), CONV_4(D_4)); \
- }
-
static RID rid_to_rid(const RID d) {
return d;
}
@@ -155,18 +132,14 @@ static Transform3D trf2_to_trf3(const Transform2D &d) {
return Transform3D(b, o);
}
-static StringName sn_to_sn(const StringName &d) {
- return d;
-}
-
-static Variant var_to_var(const Variant &d) {
- return d;
-}
-
static ObjectID id_to_id(const ObjectID &id) {
return id;
}
+static Callable callable_to_callable(const Callable &c) {
+ return c;
+}
+
static Ref<NavigationMesh> poly_to_mesh(Ref<NavigationPolygon> d) {
if (d.is_valid()) {
return d->get_navigation_mesh();
@@ -285,10 +258,10 @@ void NavigationServer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("link_is_bidirectional", "link"), &NavigationServer2D::link_is_bidirectional);
ClassDB::bind_method(D_METHOD("link_set_navigation_layers", "link", "navigation_layers"), &NavigationServer2D::link_set_navigation_layers);
ClassDB::bind_method(D_METHOD("link_get_navigation_layers", "link"), &NavigationServer2D::link_get_navigation_layers);
- ClassDB::bind_method(D_METHOD("link_set_start_location", "link", "location"), &NavigationServer2D::link_set_start_location);
- ClassDB::bind_method(D_METHOD("link_get_start_location", "link"), &NavigationServer2D::link_get_start_location);
- ClassDB::bind_method(D_METHOD("link_set_end_location", "link", "location"), &NavigationServer2D::link_set_end_location);
- ClassDB::bind_method(D_METHOD("link_get_end_location", "link"), &NavigationServer2D::link_get_end_location);
+ ClassDB::bind_method(D_METHOD("link_set_start_position", "link", "position"), &NavigationServer2D::link_set_start_position);
+ ClassDB::bind_method(D_METHOD("link_get_start_position", "link"), &NavigationServer2D::link_get_start_position);
+ ClassDB::bind_method(D_METHOD("link_set_end_position", "link", "position"), &NavigationServer2D::link_set_end_position);
+ ClassDB::bind_method(D_METHOD("link_get_end_position", "link"), &NavigationServer2D::link_get_end_position);
ClassDB::bind_method(D_METHOD("link_set_enter_cost", "link", "enter_cost"), &NavigationServer2D::link_set_enter_cost);
ClassDB::bind_method(D_METHOD("link_get_enter_cost", "link"), &NavigationServer2D::link_get_enter_cost);
ClassDB::bind_method(D_METHOD("link_set_travel_cost", "link", "travel_cost"), &NavigationServer2D::link_set_travel_cost);
@@ -308,7 +281,7 @@ void NavigationServer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("agent_set_target_velocity", "agent", "target_velocity"), &NavigationServer2D::agent_set_target_velocity);
ClassDB::bind_method(D_METHOD("agent_set_position", "agent", "position"), &NavigationServer2D::agent_set_position);
ClassDB::bind_method(D_METHOD("agent_is_map_changed", "agent"), &NavigationServer2D::agent_is_map_changed);
- ClassDB::bind_method(D_METHOD("agent_set_callback", "agent", "object_id", "method", "userdata"), &NavigationServer2D::agent_set_callback, DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("agent_set_callback", "agent", "callback"), &NavigationServer2D::agent_set_callback);
ClassDB::bind_method(D_METHOD("free_rid", "rid"), &NavigationServer2D::free);
@@ -392,10 +365,10 @@ void FORWARD_2(link_set_bidirectional, RID, p_link, bool, p_bidirectional, rid_t
bool FORWARD_1_C(link_is_bidirectional, RID, p_link, rid_to_rid);
void FORWARD_2(link_set_navigation_layers, RID, p_link, uint32_t, p_navigation_layers, rid_to_rid, uint32_to_uint32);
uint32_t FORWARD_1_C(link_get_navigation_layers, RID, p_link, rid_to_rid);
-void FORWARD_2(link_set_start_location, RID, p_link, Vector2, p_location, rid_to_rid, v2_to_v3);
-Vector2 FORWARD_1_R_C(v3_to_v2, link_get_start_location, RID, p_link, rid_to_rid);
-void FORWARD_2(link_set_end_location, RID, p_link, Vector2, p_location, rid_to_rid, v2_to_v3);
-Vector2 FORWARD_1_R_C(v3_to_v2, link_get_end_location, RID, p_link, rid_to_rid);
+void FORWARD_2(link_set_start_position, RID, p_link, Vector2, p_position, rid_to_rid, v2_to_v3);
+Vector2 FORWARD_1_R_C(v3_to_v2, link_get_start_position, RID, p_link, rid_to_rid);
+void FORWARD_2(link_set_end_position, RID, p_link, Vector2, p_position, rid_to_rid, v2_to_v3);
+Vector2 FORWARD_1_R_C(v3_to_v2, link_get_end_position, RID, p_link, rid_to_rid);
void FORWARD_2(link_set_enter_cost, RID, p_link, real_t, p_enter_cost, rid_to_rid, real_to_real);
real_t FORWARD_1_C(link_get_enter_cost, RID, p_link, rid_to_rid);
void FORWARD_2(link_set_travel_cost, RID, p_link, real_t, p_travel_cost, rid_to_rid, real_to_real);
@@ -420,7 +393,7 @@ void FORWARD_2(agent_set_target_velocity, RID, p_agent, Vector2, p_velocity, rid
void FORWARD_2(agent_set_position, RID, p_agent, Vector2, p_position, rid_to_rid, v2_to_v3);
void FORWARD_2(agent_set_ignore_y, RID, p_agent, bool, p_ignore, rid_to_rid, bool_to_bool);
bool FORWARD_1_C(agent_is_map_changed, RID, p_agent, rid_to_rid);
-void FORWARD_4(agent_set_callback, RID, p_agent, ObjectID, p_object_id, StringName, p_method, Variant, p_udata, rid_to_rid, id_to_id, sn_to_sn, var_to_var);
+void FORWARD_2(agent_set_callback, RID, p_agent, Callable, p_callback, rid_to_rid, callable_to_callable);
void FORWARD_1(free, RID, p_object, rid_to_rid);
diff --git a/servers/navigation_server_2d.h b/servers/navigation_server_2d.h
index 0adf736b2a..cd18476182 100644
--- a/servers/navigation_server_2d.h
+++ b/servers/navigation_server_2d.h
@@ -130,7 +130,7 @@ public:
virtual Vector2 region_get_connection_pathway_start(RID p_region, int p_connection_id) const;
virtual Vector2 region_get_connection_pathway_end(RID p_region, int p_connection_id) const;
- /// Creates a new link between locations in the nav map.
+ /// Creates a new link between positions in the nav map.
virtual RID link_create();
/// Set the map of this link.
@@ -145,13 +145,13 @@ public:
virtual void link_set_navigation_layers(RID p_link, uint32_t p_navigation_layers);
virtual uint32_t link_get_navigation_layers(RID p_link) const;
- /// Set the start location of the link.
- virtual void link_set_start_location(RID p_link, Vector2 p_location);
- virtual Vector2 link_get_start_location(RID p_link) const;
+ /// Set the start position of the link.
+ virtual void link_set_start_position(RID p_link, Vector2 p_position);
+ virtual Vector2 link_get_start_position(RID p_link) const;
- /// Set the end location of the link.
- virtual void link_set_end_location(RID p_link, Vector2 p_location);
- virtual Vector2 link_get_end_location(RID p_link) const;
+ /// Set the end position of the link.
+ virtual void link_set_end_position(RID p_link, Vector2 p_position);
+ virtual Vector2 link_get_end_position(RID p_link) const;
/// Set the enter cost of the link.
virtual void link_set_enter_cost(RID p_link, real_t p_enter_cost);
@@ -223,7 +223,7 @@ public:
virtual bool agent_is_map_changed(RID p_agent) const;
/// Callback called at the end of the RVO process
- virtual void agent_set_callback(RID p_agent, ObjectID p_object_id, StringName p_method, Variant p_udata = Variant());
+ virtual void agent_set_callback(RID p_agent, Callable p_callback);
virtual void query_path(const Ref<NavigationPathQueryParameters2D> &p_query_parameters, Ref<NavigationPathQueryResult2D> p_query_result) const;
diff --git a/servers/navigation_server_3d.cpp b/servers/navigation_server_3d.cpp
index 253b28a623..8f2cff0e04 100644
--- a/servers/navigation_server_3d.cpp
+++ b/servers/navigation_server_3d.cpp
@@ -30,9 +30,7 @@
#include "navigation_server_3d.h"
-#ifdef DEBUG_ENABLED
#include "core/config/project_settings.h"
-#endif // DEBUG_ENABLED
NavigationServer3D *NavigationServer3D::singleton = nullptr;
@@ -90,10 +88,10 @@ void NavigationServer3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("link_is_bidirectional", "link"), &NavigationServer3D::link_is_bidirectional);
ClassDB::bind_method(D_METHOD("link_set_navigation_layers", "link", "navigation_layers"), &NavigationServer3D::link_set_navigation_layers);
ClassDB::bind_method(D_METHOD("link_get_navigation_layers", "link"), &NavigationServer3D::link_get_navigation_layers);
- ClassDB::bind_method(D_METHOD("link_set_start_location", "link", "location"), &NavigationServer3D::link_set_start_location);
- ClassDB::bind_method(D_METHOD("link_get_start_location", "link"), &NavigationServer3D::link_get_start_location);
- ClassDB::bind_method(D_METHOD("link_set_end_location", "link", "location"), &NavigationServer3D::link_set_end_location);
- ClassDB::bind_method(D_METHOD("link_get_end_location", "link"), &NavigationServer3D::link_get_end_location);
+ ClassDB::bind_method(D_METHOD("link_set_start_position", "link", "position"), &NavigationServer3D::link_set_start_position);
+ ClassDB::bind_method(D_METHOD("link_get_start_position", "link"), &NavigationServer3D::link_get_start_position);
+ ClassDB::bind_method(D_METHOD("link_set_end_position", "link", "position"), &NavigationServer3D::link_set_end_position);
+ ClassDB::bind_method(D_METHOD("link_get_end_position", "link"), &NavigationServer3D::link_get_end_position);
ClassDB::bind_method(D_METHOD("link_set_enter_cost", "link", "enter_cost"), &NavigationServer3D::link_set_enter_cost);
ClassDB::bind_method(D_METHOD("link_get_enter_cost", "link"), &NavigationServer3D::link_get_enter_cost);
ClassDB::bind_method(D_METHOD("link_set_travel_cost", "link", "travel_cost"), &NavigationServer3D::link_set_travel_cost);
@@ -113,7 +111,7 @@ void NavigationServer3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("agent_set_target_velocity", "agent", "target_velocity"), &NavigationServer3D::agent_set_target_velocity);
ClassDB::bind_method(D_METHOD("agent_set_position", "agent", "position"), &NavigationServer3D::agent_set_position);
ClassDB::bind_method(D_METHOD("agent_is_map_changed", "agent"), &NavigationServer3D::agent_is_map_changed);
- ClassDB::bind_method(D_METHOD("agent_set_callback", "agent", "object_id", "method", "userdata"), &NavigationServer3D::agent_set_callback, DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("agent_set_callback", "agent", "callback"), &NavigationServer3D::agent_set_callback);
ClassDB::bind_method(D_METHOD("free_rid", "rid"), &NavigationServer3D::free);
@@ -145,6 +143,14 @@ NavigationServer3D::NavigationServer3D() {
ERR_FAIL_COND(singleton != nullptr);
singleton = this;
+ GLOBAL_DEF("navigation/2d/default_cell_size", 1);
+ GLOBAL_DEF("navigation/2d/default_edge_connection_margin", 1);
+ GLOBAL_DEF("navigation/2d/default_link_connection_radius", 4);
+
+ GLOBAL_DEF("navigation/3d/default_cell_size", 0.25);
+ GLOBAL_DEF("navigation/3d/default_edge_connection_margin", 0.25);
+ GLOBAL_DEF("navigation/3d/default_link_connection_radius", 1.0);
+
#ifdef DEBUG_ENABLED
debug_navigation_edge_connection_color = GLOBAL_DEF("debug/shapes/navigation/edge_connection_color", Color(1.0, 0.0, 1.0, 1.0));
debug_navigation_geometry_edge_color = GLOBAL_DEF("debug/shapes/navigation/geometry_edge_color", Color(0.5, 1.0, 1.0, 1.0));
diff --git a/servers/navigation_server_3d.h b/servers/navigation_server_3d.h
index 6c4bd2e151..9c468d1b10 100644
--- a/servers/navigation_server_3d.h
+++ b/servers/navigation_server_3d.h
@@ -145,7 +145,7 @@ public:
virtual Vector3 region_get_connection_pathway_start(RID p_region, int p_connection_id) const = 0;
virtual Vector3 region_get_connection_pathway_end(RID p_region, int p_connection_id) const = 0;
- /// Creates a new link between locations in the nav map.
+ /// Creates a new link between positions in the nav map.
virtual RID link_create() = 0;
/// Set the map of this link.
@@ -160,13 +160,13 @@ public:
virtual void link_set_navigation_layers(RID p_link, uint32_t p_navigation_layers) = 0;
virtual uint32_t link_get_navigation_layers(RID p_link) const = 0;
- /// Set the start location of the link.
- virtual void link_set_start_location(RID p_link, Vector3 p_location) = 0;
- virtual Vector3 link_get_start_location(RID p_link) const = 0;
+ /// Set the start position of the link.
+ virtual void link_set_start_position(RID p_link, Vector3 p_position) = 0;
+ virtual Vector3 link_get_start_position(RID p_link) const = 0;
- /// Set the end location of the link.
- virtual void link_set_end_location(RID p_link, Vector3 p_location) = 0;
- virtual Vector3 link_get_end_location(RID p_link) const = 0;
+ /// Set the end position of the link.
+ virtual void link_set_end_position(RID p_link, Vector3 p_position) = 0;
+ virtual Vector3 link_get_end_position(RID p_link) const = 0;
/// Set the enter cost of the link.
virtual void link_set_enter_cost(RID p_link, real_t p_enter_cost) = 0;
@@ -238,7 +238,7 @@ public:
virtual bool agent_is_map_changed(RID p_agent) const = 0;
/// Callback called at the end of the RVO process
- virtual void agent_set_callback(RID p_agent, ObjectID p_object_id, StringName p_method, Variant p_udata = Variant()) = 0;
+ virtual void agent_set_callback(RID p_agent, Callable p_callback) = 0;
/// Destroy the `RID`
virtual void free(RID p_object) = 0;
diff --git a/servers/physics_2d/godot_area_2d.cpp b/servers/physics_2d/godot_area_2d.cpp
index 4d93bbfa61..4d2148aa07 100644
--- a/servers/physics_2d/godot_area_2d.cpp
+++ b/servers/physics_2d/godot_area_2d.cpp
@@ -145,11 +145,8 @@ void GodotArea2D::set_param(PhysicsServer2D::AreaParameter p_param, const Varian
case PhysicsServer2D::AREA_PARAM_GRAVITY_IS_POINT:
gravity_is_point = p_value;
break;
- case PhysicsServer2D::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
- gravity_distance_scale = p_value;
- break;
- case PhysicsServer2D::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
- point_attenuation = p_value;
+ case PhysicsServer2D::AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE:
+ gravity_point_unit_distance = p_value;
break;
case PhysicsServer2D::AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE:
_set_space_override_mode(linear_damping_override_mode, (PhysicsServer2D::AreaSpaceOverrideMode)(int)p_value);
@@ -179,10 +176,8 @@ Variant GodotArea2D::get_param(PhysicsServer2D::AreaParameter p_param) const {
return gravity_vector;
case PhysicsServer2D::AREA_PARAM_GRAVITY_IS_POINT:
return gravity_is_point;
- case PhysicsServer2D::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
- return gravity_distance_scale;
- case PhysicsServer2D::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
- return point_attenuation;
+ case PhysicsServer2D::AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE:
+ return gravity_point_unit_distance;
case PhysicsServer2D::AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE:
return linear_damping_override_mode;
case PhysicsServer2D::AREA_PARAM_LINEAR_DAMP:
@@ -304,13 +299,13 @@ void GodotArea2D::call_queries() {
void GodotArea2D::compute_gravity(const Vector2 &p_position, Vector2 &r_gravity) const {
if (is_gravity_point()) {
- const real_t gr_distance_scale = get_gravity_distance_scale();
+ const real_t gr_unit_dist = get_gravity_point_unit_distance();
Vector2 v = get_transform().xform(get_gravity_vector()) - p_position;
- if (gr_distance_scale > 0) {
- const real_t v_length = v.length();
- if (v_length > 0) {
- const real_t v_scaled = v_length * gr_distance_scale;
- r_gravity = (v.normalized() * (get_gravity() / (v_scaled * v_scaled)));
+ if (gr_unit_dist > 0) {
+ const real_t v_length_sq = v.length_squared();
+ if (v_length_sq > 0) {
+ const real_t gravity_strength = get_gravity() * gr_unit_dist * gr_unit_dist / v_length_sq;
+ r_gravity = v.normalized() * gravity_strength;
} else {
r_gravity = Vector2();
}
diff --git a/servers/physics_2d/godot_area_2d.h b/servers/physics_2d/godot_area_2d.h
index 07c89ecb88..234e4eb9a9 100644
--- a/servers/physics_2d/godot_area_2d.h
+++ b/servers/physics_2d/godot_area_2d.h
@@ -48,8 +48,7 @@ class GodotArea2D : public GodotCollisionObject2D {
real_t gravity = 9.80665;
Vector2 gravity_vector = Vector2(0, -1);
bool gravity_is_point = false;
- real_t gravity_distance_scale = 0.0;
- real_t point_attenuation = 1.0;
+ real_t gravity_point_unit_distance = 0.0;
real_t linear_damp = 0.1;
real_t angular_damp = 1.0;
int priority = 0;
@@ -125,11 +124,8 @@ public:
_FORCE_INLINE_ void set_gravity_as_point(bool p_enable) { gravity_is_point = p_enable; }
_FORCE_INLINE_ bool is_gravity_point() const { return gravity_is_point; }
- _FORCE_INLINE_ void set_gravity_distance_scale(real_t scale) { gravity_distance_scale = scale; }
- _FORCE_INLINE_ real_t get_gravity_distance_scale() const { return gravity_distance_scale; }
-
- _FORCE_INLINE_ void set_point_attenuation(real_t p_point_attenuation) { point_attenuation = p_point_attenuation; }
- _FORCE_INLINE_ real_t get_point_attenuation() const { return point_attenuation; }
+ _FORCE_INLINE_ void set_gravity_point_unit_distance(real_t scale) { gravity_point_unit_distance = scale; }
+ _FORCE_INLINE_ real_t get_gravity_point_unit_distance() const { return gravity_point_unit_distance; }
_FORCE_INLINE_ void set_linear_damp(real_t p_linear_damp) { linear_damp = p_linear_damp; }
_FORCE_INLINE_ real_t get_linear_damp() const { return linear_damp; }
diff --git a/servers/physics_3d/gjk_epa.cpp b/servers/physics_3d/gjk_epa.cpp
index 88f2040d17..e5678914fe 100644
--- a/servers/physics_3d/gjk_epa.cpp
+++ b/servers/physics_3d/gjk_epa.cpp
@@ -1011,9 +1011,11 @@ bool gjk_epa_calculate_penetration(const GodotShape3D *p_shape_A, const Transfor
if (GjkEpa2::Penetration(p_shape_A, p_transform_A, p_margin_A, p_shape_B, p_transform_B, p_margin_B, p_transform_B.origin - p_transform_A.origin, res)) {
if (p_result_callback) {
if (p_swap) {
- p_result_callback(res.witnesses[1], 0, res.witnesses[0], 0, p_userdata);
+ Vector3 normal = (res.witnesses[1] - res.witnesses[0]).normalized();
+ p_result_callback(res.witnesses[1], 0, res.witnesses[0], 0, normal, p_userdata);
} else {
- p_result_callback(res.witnesses[0], 0, res.witnesses[1], 0, p_userdata);
+ Vector3 normal = (res.witnesses[0] - res.witnesses[1]).normalized();
+ p_result_callback(res.witnesses[0], 0, res.witnesses[1], 0, normal, p_userdata);
}
}
return true;
diff --git a/servers/physics_3d/godot_area_3d.cpp b/servers/physics_3d/godot_area_3d.cpp
index cd1f3b52b9..5bf16aa688 100644
--- a/servers/physics_3d/godot_area_3d.cpp
+++ b/servers/physics_3d/godot_area_3d.cpp
@@ -152,11 +152,8 @@ void GodotArea3D::set_param(PhysicsServer3D::AreaParameter p_param, const Varian
case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT:
gravity_is_point = p_value;
break;
- case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
- gravity_distance_scale = p_value;
- break;
- case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
- point_attenuation = p_value;
+ case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE:
+ gravity_point_unit_distance = p_value;
break;
case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE:
_set_space_override_mode(linear_damping_override_mode, (PhysicsServer3D::AreaSpaceOverrideMode)(int)p_value);
@@ -200,10 +197,8 @@ Variant GodotArea3D::get_param(PhysicsServer3D::AreaParameter p_param) const {
return gravity_vector;
case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT:
return gravity_is_point;
- case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
- return gravity_distance_scale;
- case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
- return point_attenuation;
+ case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE:
+ return gravity_point_unit_distance;
case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE:
return linear_damping_override_mode;
case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP:
@@ -333,13 +328,13 @@ void GodotArea3D::call_queries() {
void GodotArea3D::compute_gravity(const Vector3 &p_position, Vector3 &r_gravity) const {
if (is_gravity_point()) {
- const real_t gr_distance_scale = get_gravity_distance_scale();
+ const real_t gr_unit_dist = get_gravity_point_unit_distance();
Vector3 v = get_transform().xform(get_gravity_vector()) - p_position;
- if (gr_distance_scale > 0) {
- const real_t v_length = v.length();
- if (v_length > 0) {
- const real_t v_scaled = v_length * gr_distance_scale;
- r_gravity = (v.normalized() * (get_gravity() / (v_scaled * v_scaled)));
+ if (gr_unit_dist > 0) {
+ const real_t v_length_sq = v.length_squared();
+ if (v_length_sq > 0) {
+ const real_t gravity_strength = get_gravity() * gr_unit_dist * gr_unit_dist / v_length_sq;
+ r_gravity = v.normalized() * gravity_strength;
} else {
r_gravity = Vector3();
}
diff --git a/servers/physics_3d/godot_area_3d.h b/servers/physics_3d/godot_area_3d.h
index 0961da5b7d..f05d0f9019 100644
--- a/servers/physics_3d/godot_area_3d.h
+++ b/servers/physics_3d/godot_area_3d.h
@@ -49,8 +49,7 @@ class GodotArea3D : public GodotCollisionObject3D {
real_t gravity = 9.80665;
Vector3 gravity_vector = Vector3(0, -1, 0);
bool gravity_is_point = false;
- real_t gravity_distance_scale = 0.0;
- real_t point_attenuation = 1.0;
+ real_t gravity_point_unit_distance = 0.0;
real_t linear_damp = 0.1;
real_t angular_damp = 0.1;
real_t wind_force_magnitude = 0.0;
@@ -134,11 +133,8 @@ public:
_FORCE_INLINE_ void set_gravity_as_point(bool p_enable) { gravity_is_point = p_enable; }
_FORCE_INLINE_ bool is_gravity_point() const { return gravity_is_point; }
- _FORCE_INLINE_ void set_gravity_distance_scale(real_t scale) { gravity_distance_scale = scale; }
- _FORCE_INLINE_ real_t get_gravity_distance_scale() const { return gravity_distance_scale; }
-
- _FORCE_INLINE_ void set_point_attenuation(real_t p_point_attenuation) { point_attenuation = p_point_attenuation; }
- _FORCE_INLINE_ real_t get_point_attenuation() const { return point_attenuation; }
+ _FORCE_INLINE_ void set_gravity_point_unit_distance(real_t scale) { gravity_point_unit_distance = scale; }
+ _FORCE_INLINE_ real_t get_gravity_point_unit_distance() const { return gravity_point_unit_distance; }
_FORCE_INLINE_ void set_linear_damp(real_t p_linear_damp) { linear_damp = p_linear_damp; }
_FORCE_INLINE_ real_t get_linear_damp() const { return linear_damp; }
diff --git a/servers/physics_3d/godot_body_pair_3d.cpp b/servers/physics_3d/godot_body_pair_3d.cpp
index ce3da390cb..619e6c00be 100644
--- a/servers/physics_3d/godot_body_pair_3d.cpp
+++ b/servers/physics_3d/godot_body_pair_3d.cpp
@@ -38,12 +38,12 @@
#define MIN_VELOCITY 0.0001
#define MAX_BIAS_ROTATION (Math_PI / 8)
-void GodotBodyPair3D::_contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, void *p_userdata) {
+void GodotBodyPair3D::_contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal, void *p_userdata) {
GodotBodyPair3D *pair = static_cast<GodotBodyPair3D *>(p_userdata);
- pair->contact_added_callback(p_point_A, p_index_A, p_point_B, p_index_B);
+ pair->contact_added_callback(p_point_A, p_index_A, p_point_B, p_index_B, normal);
}
-void GodotBodyPair3D::contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B) {
+void GodotBodyPair3D::contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal) {
Vector3 local_A = A->get_inv_transform().basis.xform(p_point_A);
Vector3 local_B = B->get_inv_transform().basis.xform(p_point_B - offset_B);
@@ -577,12 +577,12 @@ GodotBodyPair3D::~GodotBodyPair3D() {
B->remove_constraint(this);
}
-void GodotBodySoftBodyPair3D::_contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, void *p_userdata) {
+void GodotBodySoftBodyPair3D::_contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal, void *p_userdata) {
GodotBodySoftBodyPair3D *pair = static_cast<GodotBodySoftBodyPair3D *>(p_userdata);
- pair->contact_added_callback(p_point_A, p_index_A, p_point_B, p_index_B);
+ pair->contact_added_callback(p_point_A, p_index_A, p_point_B, p_index_B, normal);
}
-void GodotBodySoftBodyPair3D::contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B) {
+void GodotBodySoftBodyPair3D::contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal) {
Vector3 local_A = body->get_inv_transform().xform(p_point_A);
Vector3 local_B = p_point_B - soft_body->get_node_position(p_index_B);
@@ -591,7 +591,7 @@ void GodotBodySoftBodyPair3D::contact_added_callback(const Vector3 &p_point_A, i
contact.index_B = p_index_B;
contact.local_A = local_A;
contact.local_B = local_B;
- contact.normal = (p_point_A - p_point_B).normalized();
+ contact.normal = (normal.dot((p_point_A - p_point_B)) < 0 ? -normal : normal);
contact.used = true;
// Attempt to determine if the contact will be reused.
diff --git a/servers/physics_3d/godot_body_pair_3d.h b/servers/physics_3d/godot_body_pair_3d.h
index c3165c7fcf..a8f5180dd5 100644
--- a/servers/physics_3d/godot_body_pair_3d.h
+++ b/servers/physics_3d/godot_body_pair_3d.h
@@ -97,9 +97,9 @@ class GodotBodyPair3D : public GodotBodyContact3D {
Contact contacts[MAX_CONTACTS];
int contact_count = 0;
- static void _contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, void *p_userdata);
+ static void _contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal, void *p_userdata);
- void contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B);
+ void contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal);
void validate_contacts();
bool _test_ccd(real_t p_step, GodotBody3D *p_A, int p_shape_A, const Transform3D &p_xform_A, GodotBody3D *p_B, int p_shape_B, const Transform3D &p_xform_B);
@@ -126,9 +126,9 @@ class GodotBodySoftBodyPair3D : public GodotBodyContact3D {
LocalVector<Contact> contacts;
- static void _contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, void *p_userdata);
+ static void _contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal, void *p_userdata);
- void contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B);
+ void contact_added_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal);
void validate_contacts();
diff --git a/servers/physics_3d/godot_collision_solver_3d.cpp b/servers/physics_3d/godot_collision_solver_3d.cpp
index 0b92b745fe..2de1d86de1 100644
--- a/servers/physics_3d/godot_collision_solver_3d.cpp
+++ b/servers/physics_3d/godot_collision_solver_3d.cpp
@@ -81,9 +81,11 @@ bool GodotCollisionSolver3D::solve_static_world_boundary(const GodotShape3D *p_s
if (p_result_callback) {
if (p_swap_result) {
- p_result_callback(supports[i], 0, support_A, 0, p_userdata);
+ Vector3 normal = (support_A - supports[i]).normalized();
+ p_result_callback(supports[i], 0, support_A, 0, normal, p_userdata);
} else {
- p_result_callback(support_A, 0, supports[i], 0, p_userdata);
+ Vector3 normal = (supports[i] - support_A).normalized();
+ p_result_callback(support_A, 0, supports[i], 0, normal, p_userdata);
}
}
}
@@ -125,10 +127,11 @@ bool GodotCollisionSolver3D::solve_separation_ray(const GodotShape3D *p_shape_A,
}
if (p_result_callback) {
+ Vector3 normal = (support_B - support_A).normalized();
if (p_swap_result) {
- p_result_callback(support_B, 0, support_A, 0, p_userdata);
+ p_result_callback(support_B, 0, support_A, 0, -normal, p_userdata);
} else {
- p_result_callback(support_A, 0, support_B, 0, p_userdata);
+ p_result_callback(support_A, 0, support_B, 0, normal, p_userdata);
}
}
return true;
@@ -142,7 +145,7 @@ struct _SoftBodyContactCollisionInfo {
int contact_count = 0;
};
-void GodotCollisionSolver3D::soft_body_contact_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, void *p_userdata) {
+void GodotCollisionSolver3D::soft_body_contact_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal, void *p_userdata) {
_SoftBodyContactCollisionInfo &cinfo = *(static_cast<_SoftBodyContactCollisionInfo *>(p_userdata));
++cinfo.contact_count;
@@ -152,9 +155,9 @@ void GodotCollisionSolver3D::soft_body_contact_callback(const Vector3 &p_point_A
}
if (cinfo.swap_result) {
- cinfo.result_callback(p_point_B, cinfo.node_index, p_point_A, p_index_A, cinfo.userdata);
+ cinfo.result_callback(p_point_B, cinfo.node_index, p_point_A, p_index_A, -normal, cinfo.userdata);
} else {
- cinfo.result_callback(p_point_A, p_index_A, p_point_B, cinfo.node_index, cinfo.userdata);
+ cinfo.result_callback(p_point_A, p_index_A, p_point_B, cinfo.node_index, normal, cinfo.userdata);
}
}
diff --git a/servers/physics_3d/godot_collision_solver_3d.h b/servers/physics_3d/godot_collision_solver_3d.h
index 7ef0dc97ac..36ea79576e 100644
--- a/servers/physics_3d/godot_collision_solver_3d.h
+++ b/servers/physics_3d/godot_collision_solver_3d.h
@@ -35,11 +35,11 @@
class GodotCollisionSolver3D {
public:
- typedef void (*CallbackResult)(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, void *p_userdata);
+ typedef void (*CallbackResult)(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal, void *p_userdata);
private:
static bool soft_body_query_callback(uint32_t p_node_index, void *p_userdata);
- static void soft_body_contact_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, void *p_userdata);
+ static void soft_body_contact_callback(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal, void *p_userdata);
static bool soft_body_concave_callback(void *p_userdata, GodotShape3D *p_convex);
static bool concave_callback(void *p_userdata, GodotShape3D *p_convex);
static bool solve_static_world_boundary(const GodotShape3D *p_shape_A, const Transform3D &p_transform_A, const GodotShape3D *p_shape_B, const Transform3D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, real_t p_margin = 0);
diff --git a/servers/physics_3d/godot_collision_solver_3d_sat.cpp b/servers/physics_3d/godot_collision_solver_3d_sat.cpp
index d13f4ee801..2cb29b3dd0 100644
--- a/servers/physics_3d/godot_collision_solver_3d_sat.cpp
+++ b/servers/physics_3d/godot_collision_solver_3d_sat.cpp
@@ -75,11 +75,13 @@ struct _CollectorCallback {
Vector3 normal;
Vector3 *prev_axis = nullptr;
- _FORCE_INLINE_ void call(const Vector3 &p_point_A, const Vector3 &p_point_B) {
+ _FORCE_INLINE_ void call(const Vector3 &p_point_A, const Vector3 &p_point_B, Vector3 p_normal) {
+ if (p_normal.dot(p_point_B - p_point_A) < 0)
+ p_normal = -p_normal;
if (swap) {
- callback(p_point_B, 0, p_point_A, 0, userdata);
+ callback(p_point_B, 0, p_point_A, 0, -p_normal, userdata);
} else {
- callback(p_point_A, 0, p_point_B, 0, userdata);
+ callback(p_point_A, 0, p_point_B, 0, p_normal, userdata);
}
}
};
@@ -92,7 +94,7 @@ static void _generate_contacts_point_point(const Vector3 *p_points_A, int p_poin
ERR_FAIL_COND(p_point_count_B != 1);
#endif
- p_callback->call(*p_points_A, *p_points_B);
+ p_callback->call(*p_points_A, *p_points_B, p_callback->normal);
}
static void _generate_contacts_point_edge(const Vector3 *p_points_A, int p_point_count_A, const Vector3 *p_points_B, int p_point_count_B, _CollectorCallback *p_callback) {
@@ -102,7 +104,7 @@ static void _generate_contacts_point_edge(const Vector3 *p_points_A, int p_point
#endif
Vector3 closest_B = Geometry3D::get_closest_point_to_segment_uncapped(*p_points_A, p_points_B);
- p_callback->call(*p_points_A, closest_B);
+ p_callback->call(*p_points_A, closest_B, p_callback->normal);
}
static void _generate_contacts_point_face(const Vector3 *p_points_A, int p_point_count_A, const Vector3 *p_points_B, int p_point_count_B, _CollectorCallback *p_callback) {
@@ -111,9 +113,9 @@ static void _generate_contacts_point_face(const Vector3 *p_points_A, int p_point
ERR_FAIL_COND(p_point_count_B < 3);
#endif
- Vector3 closest_B = Plane(p_points_B[0], p_points_B[1], p_points_B[2]).project(*p_points_A);
-
- p_callback->call(*p_points_A, closest_B);
+ Plane plane(p_points_B[0], p_points_B[1], p_points_B[2]);
+ Vector3 closest_B = plane.project(*p_points_A);
+ p_callback->call(*p_points_A, closest_B, plane.get_normal());
}
static void _generate_contacts_point_circle(const Vector3 *p_points_A, int p_point_count_A, const Vector3 *p_points_B, int p_point_count_B, _CollectorCallback *p_callback) {
@@ -122,9 +124,9 @@ static void _generate_contacts_point_circle(const Vector3 *p_points_A, int p_poi
ERR_FAIL_COND(p_point_count_B != 3);
#endif
- Vector3 closest_B = Plane(p_points_B[0], p_points_B[1], p_points_B[2]).project(*p_points_A);
-
- p_callback->call(*p_points_A, closest_B);
+ Plane plane(p_points_B[0], p_points_B[1], p_points_B[2]);
+ Vector3 closest_B = plane.project(*p_points_A);
+ p_callback->call(*p_points_A, closest_B, plane.get_normal());
}
static void _generate_contacts_edge_edge(const Vector3 *p_points_A, int p_point_count_A, const Vector3 *p_points_B, int p_point_count_B, _CollectorCallback *p_callback) {
@@ -154,8 +156,8 @@ static void _generate_contacts_edge_edge(const Vector3 *p_points_A, int p_point_
sa.sort(dvec, 4);
//use the middle ones as contacts
- p_callback->call(base_A + axis * dvec[1], base_B + axis * dvec[1]);
- p_callback->call(base_A + axis * dvec[2], base_B + axis * dvec[2]);
+ p_callback->call(base_A + axis * dvec[1], base_B + axis * dvec[1], p_callback->normal);
+ p_callback->call(base_A + axis * dvec[2], base_B + axis * dvec[2], p_callback->normal);
return;
}
@@ -170,7 +172,14 @@ static void _generate_contacts_edge_edge(const Vector3 *p_points_A, int p_point_
Vector3 closest_A = p_points_A[0] + rel_A * d;
Vector3 closest_B = Geometry3D::get_closest_point_to_segment_uncapped(closest_A, p_points_B);
- p_callback->call(closest_A, closest_B);
+ // The normal should be perpendicular to both edges.
+ Vector3 normal = rel_A.cross(rel_B);
+ real_t normal_len = normal.length();
+ if (normal_len > 1e-3)
+ normal /= normal_len;
+ else
+ normal = p_callback->normal;
+ p_callback->call(closest_A, closest_B, normal);
}
static void _generate_contacts_edge_circle(const Vector3 *p_points_A, int p_point_count_A, const Vector3 *p_points_B, int p_point_count_B, _CollectorCallback *p_callback) {
@@ -267,7 +276,7 @@ static void _generate_contacts_edge_circle(const Vector3 *p_points_A, int p_poin
continue;
}
- p_callback->call(contact_point_A, closest_B);
+ p_callback->call(contact_point_A, closest_B, circle_plane.get_normal());
}
}
@@ -352,7 +361,7 @@ static void _generate_contacts_face_face(const Vector3 *p_points_A, int p_point_
continue;
}
- p_callback->call(clipbuf_src[i], closest_B);
+ p_callback->call(clipbuf_src[i], closest_B, plane_B.get_normal());
}
}
@@ -431,7 +440,7 @@ static void _generate_contacts_face_circle(const Vector3 *p_points_A, int p_poin
continue;
}
- p_callback->call(contact_point_A, closest_B);
+ p_callback->call(contact_point_A, closest_B, circle_plane.get_normal());
}
}
@@ -534,7 +543,7 @@ static void _generate_contacts_circle_circle(const Vector3 *p_points_A, int p_po
continue;
}
- p_callback->call(contact_point_A, closest_B);
+ p_callback->call(contact_point_A, closest_B, circle_B_plane.get_normal());
}
}
@@ -678,7 +687,7 @@ public:
return true;
}
- static _FORCE_INLINE_ void test_contact_points(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, void *p_userdata) {
+ static _FORCE_INLINE_ void test_contact_points(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal, void *p_userdata) {
SeparatorAxisTest<ShapeA, ShapeB, withMargin> *separator = (SeparatorAxisTest<ShapeA, ShapeB, withMargin> *)p_userdata;
Vector3 axis = (p_point_B - p_point_A);
real_t depth = axis.length();
@@ -802,11 +811,11 @@ static void analytic_sphere_collision(const Vector3 &p_origin_a, real_t p_radius
if (p_radius_a < p_radius_b) {
Vector3 point_a = p_origin_a - b_to_a * p_radius_a;
Vector3 point_b = point_a + b_to_a * overlap;
- p_collector->call(point_a, point_b); // Consider adding b_to_a vector
+ p_collector->call(point_a, point_b, b_to_a); // Consider adding b_to_a vector
} else {
Vector3 point_b = p_origin_b + b_to_a * p_radius_b;
Vector3 point_a = point_b - b_to_a * overlap;
- p_collector->call(point_a, point_b); // Consider adding b_to_a vector
+ p_collector->call(point_a, point_b, b_to_a); // Consider adding b_to_a vector
}
}
@@ -818,9 +827,9 @@ static void _collision_sphere_sphere(const GodotShape3D *p_a, const Transform3D
// Perform an analytic sphere collision between the two spheres
analytic_sphere_collision<withMargin>(
p_transform_a.origin,
- sphere_A->get_radius(),
+ sphere_A->get_radius() * p_transform_a.basis[0].length(),
p_transform_b.origin,
- sphere_B->get_radius(),
+ sphere_B->get_radius() * p_transform_b.basis[0].length(),
p_collector,
p_margin_a,
p_margin_b);
@@ -833,7 +842,7 @@ static void _collision_sphere_box(const GodotShape3D *p_a, const Transform3D &p_
// Find the point on the box nearest to the center of the sphere.
- Vector3 center = p_transform_b.xform_inv(p_transform_a.origin);
+ Vector3 center = p_transform_b.affine_inverse().xform(p_transform_a.origin);
Vector3 extents = box_B->get_half_extents();
Vector3 nearest(MIN(MAX(center.x, -extents.x), extents.x),
MIN(MAX(center.y, -extents.y), extents.y),
@@ -844,7 +853,8 @@ static void _collision_sphere_box(const GodotShape3D *p_a, const Transform3D &p_
Vector3 delta = nearest - p_transform_a.origin;
real_t length = delta.length();
- if (length > sphere_A->get_radius() + p_margin_a + p_margin_b) {
+ real_t radius = sphere_A->get_radius() * p_transform_a.basis[0].length();
+ if (length > radius + p_margin_a + p_margin_b) {
return;
}
p_collector->collided = true;
@@ -858,9 +868,9 @@ static void _collision_sphere_box(const GodotShape3D *p_a, const Transform3D &p_
} else {
axis = delta / length;
}
- Vector3 point_a = p_transform_a.origin + (sphere_A->get_radius() + p_margin_a) * axis;
- Vector3 point_b = (withMargin ? nearest + p_margin_b * axis : nearest);
- p_collector->call(point_a, point_b);
+ Vector3 point_a = p_transform_a.origin + (radius + p_margin_a) * axis;
+ Vector3 point_b = (withMargin ? nearest - p_margin_b * axis : nearest);
+ p_collector->call(point_a, point_b, axis);
}
template <bool withMargin>
@@ -868,11 +878,12 @@ static void _collision_sphere_capsule(const GodotShape3D *p_a, const Transform3D
const GodotSphereShape3D *sphere_A = static_cast<const GodotSphereShape3D *>(p_a);
const GodotCapsuleShape3D *capsule_B = static_cast<const GodotCapsuleShape3D *>(p_b);
- real_t capsule_B_radius = capsule_B->get_radius();
+ real_t scale_A = p_transform_a.basis[0].length();
+ real_t scale_B = p_transform_b.basis[0].length();
// Construct the capsule segment (ball-center to ball-center)
Vector3 capsule_segment[2];
- Vector3 capsule_axis = p_transform_b.basis.get_column(1) * (capsule_B->get_height() * 0.5 - capsule_B_radius);
+ Vector3 capsule_axis = p_transform_b.basis.get_column(1) * (capsule_B->get_height() * 0.5 - capsule_B->get_radius());
capsule_segment[0] = p_transform_b.origin + capsule_axis;
capsule_segment[1] = p_transform_b.origin - capsule_axis;
@@ -882,9 +893,9 @@ static void _collision_sphere_capsule(const GodotShape3D *p_a, const Transform3D
// Perform an analytic sphere collision between the sphere and the sphere-collider in the capsule
analytic_sphere_collision<withMargin>(
p_transform_a.origin,
- sphere_A->get_radius(),
+ sphere_A->get_radius() * scale_A,
capsule_closest,
- capsule_B_radius,
+ capsule_B->get_radius() * scale_B,
p_collector,
p_margin_a,
p_margin_b);
@@ -894,12 +905,12 @@ template <bool withMargin>
static void analytic_sphere_cylinder_collision(real_t p_radius_a, real_t p_radius_b, real_t p_height_b, const Transform3D &p_transform_a, const Transform3D &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
// Find the point on the cylinder nearest to the center of the sphere.
- Vector3 center = p_transform_b.xform_inv(p_transform_a.origin);
+ Vector3 center = p_transform_b.affine_inverse().xform(p_transform_a.origin);
Vector3 nearest = center;
- real_t radius = p_radius_b;
+ real_t scale_A = p_transform_a.basis[0].length();
real_t r = Math::sqrt(center.x * center.x + center.z * center.z);
- if (r > radius) {
- real_t scale = radius / r;
+ if (r > p_radius_b) {
+ real_t scale = p_radius_b / r;
nearest.x *= scale;
nearest.z *= scale;
}
@@ -911,7 +922,7 @@ static void analytic_sphere_cylinder_collision(real_t p_radius_a, real_t p_radiu
Vector3 delta = nearest - p_transform_a.origin;
real_t length = delta.length();
- if (length > p_radius_a + p_margin_a + p_margin_b) {
+ if (length > p_radius_a * scale_A + p_margin_a + p_margin_b) {
return;
}
p_collector->collided = true;
@@ -925,9 +936,9 @@ static void analytic_sphere_cylinder_collision(real_t p_radius_a, real_t p_radiu
} else {
axis = delta / length;
}
- Vector3 point_a = p_transform_a.origin + (p_radius_a + p_margin_a) * axis;
- Vector3 point_b = (withMargin ? nearest + p_margin_b * axis : nearest);
- p_collector->call(point_a, point_b);
+ Vector3 point_a = p_transform_a.origin + (p_radius_a * scale_A + p_margin_a) * axis;
+ Vector3 point_b = (withMargin ? nearest - p_margin_b * axis : nearest);
+ p_collector->call(point_a, point_b, axis);
}
template <bool withMargin>
@@ -1623,14 +1634,14 @@ static void _collision_capsule_capsule(const GodotShape3D *p_a, const Transform3
const GodotCapsuleShape3D *capsule_A = static_cast<const GodotCapsuleShape3D *>(p_a);
const GodotCapsuleShape3D *capsule_B = static_cast<const GodotCapsuleShape3D *>(p_b);
- real_t capsule_A_radius = capsule_A->get_radius();
- real_t capsule_B_radius = capsule_B->get_radius();
+ real_t scale_A = p_transform_a.basis[0].length();
+ real_t scale_B = p_transform_b.basis[0].length();
// Get the closest points between the capsule segments
Vector3 capsule_A_closest;
Vector3 capsule_B_closest;
- Vector3 capsule_A_axis = p_transform_a.basis.get_column(1) * (capsule_A->get_height() * 0.5 - capsule_A_radius);
- Vector3 capsule_B_axis = p_transform_b.basis.get_column(1) * (capsule_B->get_height() * 0.5 - capsule_B_radius);
+ Vector3 capsule_A_axis = p_transform_a.basis.get_column(1) * (capsule_A->get_height() * 0.5 - capsule_A->get_radius());
+ Vector3 capsule_B_axis = p_transform_b.basis.get_column(1) * (capsule_B->get_height() * 0.5 - capsule_B->get_radius());
Geometry3D::get_closest_points_between_segments(
p_transform_a.origin + capsule_A_axis,
p_transform_a.origin - capsule_A_axis,
@@ -1642,9 +1653,9 @@ static void _collision_capsule_capsule(const GodotShape3D *p_a, const Transform3
// Perform the analytic collision between the two closest capsule spheres
analytic_sphere_collision<withMargin>(
capsule_A_closest,
- capsule_A_radius,
+ capsule_A->get_radius() * scale_A,
capsule_B_closest,
- capsule_B_radius,
+ capsule_B->get_radius() * scale_B,
p_collector,
p_margin_a,
p_margin_b);
diff --git a/servers/physics_3d/godot_physics_server_3d.cpp b/servers/physics_3d/godot_physics_server_3d.cpp
index e8250acb45..b6d8acfbf3 100644
--- a/servers/physics_3d/godot_physics_server_3d.cpp
+++ b/servers/physics_3d/godot_physics_server_3d.cpp
@@ -1737,7 +1737,7 @@ void GodotPhysicsServer3D::_update_shapes() {
}
}
-void GodotPhysicsServer3D::_shape_col_cbk(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, void *p_userdata) {
+void GodotPhysicsServer3D::_shape_col_cbk(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal, void *p_userdata) {
CollCbkData *cbk = static_cast<CollCbkData *>(p_userdata);
if (cbk->max == 0) {
diff --git a/servers/physics_3d/godot_physics_server_3d.h b/servers/physics_3d/godot_physics_server_3d.h
index 3da0c6debe..040e673dcd 100644
--- a/servers/physics_3d/godot_physics_server_3d.h
+++ b/servers/physics_3d/godot_physics_server_3d.h
@@ -77,7 +77,7 @@ public:
Vector3 *ptr = nullptr;
};
- static void _shape_col_cbk(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, void *p_userdata);
+ static void _shape_col_cbk(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal, void *p_userdata);
virtual RID world_boundary_shape_create() override;
virtual RID separation_ray_shape_create() override;
diff --git a/servers/physics_3d/godot_shape_3d.cpp b/servers/physics_3d/godot_shape_3d.cpp
index 8aacfa929f..300dca4e08 100644
--- a/servers/physics_3d/godot_shape_3d.cpp
+++ b/servers/physics_3d/godot_shape_3d.cpp
@@ -852,17 +852,12 @@ Vector3 GodotConvexPolygonShape3D::get_support(const Vector3 &p_normal) const {
// Get the array of vertices
const Vector3 *const vertices_array = mesh.vertices.ptr();
- // Get the array of extreme vertices
- const int *const extreme_array = extreme_vertices.ptr();
- const uint32_t extreme_size = extreme_vertices.size();
-
- // Start with an initial assumption of the first extreme vertex
- int best_vertex = extreme_array[0];
+ // Start with an initial assumption of the first extreme vertex.
+ int best_vertex = extreme_vertices[0];
real_t max_support = p_normal.dot(vertices_array[best_vertex]);
- // Check the remaining extreme vertices for a better vertex
- for (uint32_t i = 0; i < extreme_size; ++i) {
- int vert = extreme_array[i];
+ // Check the remaining extreme vertices for a better vertex.
+ for (const int &vert : extreme_vertices) {
real_t s = p_normal.dot(vertices_array[vert]);
if (s > max_support) {
best_vertex = vert;
@@ -870,27 +865,18 @@ Vector3 GodotConvexPolygonShape3D::get_support(const Vector3 &p_normal) const {
}
}
- // If we checked all vertices in the mesh then we're done
- if (extreme_size == mesh.vertices.size()) {
+ // If we checked all vertices in the mesh then we're done.
+ if (extreme_vertices.size() == mesh.vertices.size()) {
return vertices_array[best_vertex];
}
- // Get the array of neighbor arrays for each vertex
- const LocalVector<int> *const vertex_neighbors_array = vertex_neighbors.ptr();
-
// Move along the surface until we reach the true support vertex.
int last_vertex = -1;
while (true) {
int next_vertex = -1;
- // Get the array of neighbors around the best vertex
- const LocalVector<int> &neighbors = vertex_neighbors_array[best_vertex];
- const int *const neighbors_array = neighbors.ptr();
- const uint32_t neighbors_size = neighbors.size();
-
- // Iterate over all the neighbors checking for a better vertex
- for (uint32_t i = 0; i < neighbors_size; ++i) {
- int vert = neighbors_array[i];
+ // Iterate over all the neighbors checking for a better vertex.
+ for (const int &vert : vertex_neighbors[best_vertex]) {
if (vert != last_vertex) {
real_t s = p_normal.dot(vertices_array[vert]);
if (s > max_support) {
@@ -1149,8 +1135,7 @@ void GodotConvexPolygonShape3D::_setup(const Vector<Vector3> &p_vertices) {
if (extreme_vertices.size() < mesh.vertices.size()) {
vertex_neighbors.resize(mesh.vertices.size());
- for (uint32_t i = 0; i < mesh.edges.size(); i++) {
- Geometry3D::MeshData::Edge &edge = mesh.edges[i];
+ for (Geometry3D::MeshData::Edge &edge : mesh.edges) {
vertex_neighbors[edge.vertex_a].push_back(edge.vertex_b);
vertex_neighbors[edge.vertex_b].push_back(edge.vertex_a);
}
diff --git a/servers/physics_3d/godot_soft_body_3d.cpp b/servers/physics_3d/godot_soft_body_3d.cpp
index 871017a5e7..1820a29553 100644
--- a/servers/physics_3d/godot_soft_body_3d.cpp
+++ b/servers/physics_3d/godot_soft_body_3d.cpp
@@ -167,14 +167,11 @@ void GodotSoftBody3D::update_rendering_server(PhysicsServer3DRenderingServerHand
}
void GodotSoftBody3D::update_normals_and_centroids() {
- uint32_t i, ni;
-
- for (i = 0, ni = nodes.size(); i < ni; ++i) {
- nodes[i].n = Vector3();
+ for (Node &node : nodes) {
+ node.n = Vector3();
}
- for (i = 0, ni = faces.size(); i < ni; ++i) {
- Face &face = faces[i];
+ for (Face &face : faces) {
const Vector3 n = vec3_cross(face.n[0]->x - face.n[2]->x, face.n[0]->x - face.n[1]->x);
face.n[0]->n += n;
face.n[1]->n += n;
@@ -184,8 +181,7 @@ void GodotSoftBody3D::update_normals_and_centroids() {
face.centroid = 0.33333333333 * (face.n[0]->x + face.n[1]->x + face.n[2]->x);
}
- for (i = 0, ni = nodes.size(); i < ni; ++i) {
- Node &node = nodes[i];
+ for (Node &node : nodes) {
real_t len = node.n.length();
if (len > CMP_EPSILON) {
node.n /= len;
@@ -235,9 +231,7 @@ void GodotSoftBody3D::update_area() {
int i, ni;
// Face area.
- for (i = 0, ni = faces.size(); i < ni; ++i) {
- Face &face = faces[i];
-
+ for (Face &face : faces) {
const Vector3 &x0 = face.n[0]->x;
const Vector3 &x1 = face.n[1]->x;
const Vector3 &x2 = face.n[2]->x;
@@ -255,12 +249,11 @@ void GodotSoftBody3D::update_area() {
memset(counts.ptr(), 0, counts.size() * sizeof(int));
}
- for (i = 0, ni = nodes.size(); i < ni; ++i) {
- nodes[i].area = 0.0;
+ for (Node &node : nodes) {
+ node.area = 0.0;
}
- for (i = 0, ni = faces.size(); i < ni; ++i) {
- const Face &face = faces[i];
+ for (const Face &face : faces) {
for (int j = 0; j < 3; ++j) {
const int index = (int)(face.n[j] - &nodes[0]);
counts[index]++;
@@ -278,8 +271,7 @@ void GodotSoftBody3D::update_area() {
}
void GodotSoftBody3D::reset_link_rest_lengths() {
- for (uint32_t i = 0, ni = links.size(); i < ni; ++i) {
- Link &link = links[i];
+ for (Link &link : links) {
link.rl = (link.n[0]->x - link.n[1]->x).length();
link.c1 = link.rl * link.rl;
}
@@ -287,8 +279,7 @@ void GodotSoftBody3D::reset_link_rest_lengths() {
void GodotSoftBody3D::update_link_constants() {
real_t inv_linear_stiffness = 1.0 / linear_stiffness;
- for (uint32_t i = 0, ni = links.size(); i < ni; ++i) {
- Link &link = links[i];
+ for (Link &link : links) {
link.c0 = (link.n[0]->im + link.n[1]->im) * inv_linear_stiffness;
}
}
@@ -619,9 +610,9 @@ void GodotSoftBody3D::generate_bending_constraints(int p_distance) {
}
}
}
- for (i = 0; i < links.size(); ++i) {
- const int ia = (int)(links[i].n[0] - &nodes[0]);
- const int ib = (int)(links[i].n[1] - &nodes[0]);
+ for (Link &link : links) {
+ const int ia = (int)(link.n[0] - &nodes[0]);
+ const int ib = (int)(link.n[1] - &nodes[0]);
int idx = ib * n + ia;
int idx_inv = ia * n + ib;
adj[idx] = 1;
@@ -635,9 +626,9 @@ void GodotSoftBody3D::generate_bending_constraints(int p_distance) {
// Build node links.
node_links.resize(nodes.size());
- for (i = 0; i < links.size(); ++i) {
- const int ia = (int)(links[i].n[0] - &nodes[0]);
- const int ib = (int)(links[i].n[1] - &nodes[0]);
+ for (Link &link : links) {
+ const int ia = (int)(link.n[0] - &nodes[0]);
+ const int ib = (int)(link.n[1] - &nodes[0]);
if (node_links[ia].find(ib) == -1) {
node_links[ia].push_back(ib);
}
@@ -649,8 +640,7 @@ void GodotSoftBody3D::generate_bending_constraints(int p_distance) {
for (uint32_t ii = 0; ii < node_links.size(); ii++) {
for (uint32_t jj = 0; jj < node_links[ii].size(); jj++) {
int k = node_links[ii][jj];
- for (uint32_t kk = 0; kk < node_links[k].size(); kk++) {
- int l = node_links[k][kk];
+ for (const int &l : node_links[k]) {
if ((int)ii != l) {
int idx_ik = k * n + ii;
int idx_kj = l * n + k;
@@ -916,8 +906,7 @@ void GodotSoftBody3D::set_drag_coefficient(real_t p_val) {
}
void GodotSoftBody3D::add_velocity(const Vector3 &p_velocity) {
- for (uint32_t i = 0, ni = nodes.size(); i < ni; ++i) {
- Node &node = nodes[i];
+ for (Node &node : nodes) {
if (node.im > 0) {
node.v += p_velocity;
}
@@ -929,26 +918,22 @@ void GodotSoftBody3D::apply_forces(const LocalVector<GodotArea3D *> &p_wind_area
return;
}
- uint32_t i, ni;
int32_t j;
real_t volume = 0.0;
const Vector3 &org = nodes[0].x;
// Iterate over faces (try not to iterate elsewhere if possible).
- for (i = 0, ni = faces.size(); i < ni; ++i) {
- const Face &face = faces[i];
-
+ for (const Face &face : faces) {
Vector3 wind_force(0, 0, 0);
// Compute volume.
volume += vec3_dot(face.n[0]->x - org, vec3_cross(face.n[1]->x - org, face.n[2]->x - org));
// Compute nodal forces from area winds.
- int wind_area_count = p_wind_areas.size();
- if (wind_area_count > 0) {
- for (j = 0; j < wind_area_count; j++) {
- wind_force += _compute_area_windforce(p_wind_areas[j], &face);
+ if (!p_wind_areas.is_empty()) {
+ for (const GodotArea3D *area : p_wind_areas) {
+ wind_force += _compute_area_windforce(area, &face);
}
for (j = 0; j < 3; j++) {
@@ -962,8 +947,7 @@ void GodotSoftBody3D::apply_forces(const LocalVector<GodotArea3D *> &p_wind_area
// Apply nodal pressure forces.
if (pressure_coefficient > CMP_EPSILON) {
real_t ivolumetp = 1.0 / Math::abs(volume) * pressure_coefficient;
- for (i = 0, ni = nodes.size(); i < ni; ++i) {
- Node &node = nodes[i];
+ for (Node &node : nodes) {
if (node.im > 0) {
node.f += node.n * (node.area * ivolumetp);
}
@@ -1048,9 +1032,7 @@ void GodotSoftBody3D::predict_motion(real_t p_delta) {
real_t clamp_delta_v = max_displacement * inv_delta;
// Integrate.
- uint32_t i, ni;
- for (i = 0, ni = nodes.size(); i < ni; ++i) {
- Node &node = nodes[i];
+ for (Node &node : nodes) {
node.q = node.x;
Vector3 delta_v = node.f * node.im * p_delta;
for (int c = 0; c < 3; c++) {
@@ -1065,9 +1047,7 @@ void GodotSoftBody3D::predict_motion(real_t p_delta) {
update_bounds();
// Node tree update.
- for (i = 0, ni = nodes.size(); i < ni; ++i) {
- const Node &node = nodes[i];
-
+ for (const Node &node : nodes) {
AABB node_aabb(node.x, Vector3());
node_aabb.expand_to(node.x + node.v * p_delta);
node_aabb.grow_by(collision_margin);
@@ -1088,17 +1068,13 @@ void GodotSoftBody3D::predict_motion(real_t p_delta) {
void GodotSoftBody3D::solve_constraints(real_t p_delta) {
const real_t inv_delta = 1.0 / p_delta;
- uint32_t i, ni;
-
- for (i = 0, ni = links.size(); i < ni; ++i) {
- Link &link = links[i];
+ for (Link &link : links) {
link.c3 = link.n[1]->q - link.n[0]->q;
link.c2 = 1 / (link.c3.length_squared() * link.c0);
}
// Solve velocities.
- for (i = 0, ni = nodes.size(); i < ni; ++i) {
- Node &node = nodes[i];
+ for (Node &node : nodes) {
node.x = node.q + node.v * p_delta;
}
@@ -1108,9 +1084,7 @@ void GodotSoftBody3D::solve_constraints(real_t p_delta) {
solve_links(1.0, ti);
}
const real_t vc = (1.0 - damping_coefficient) * inv_delta;
- for (i = 0, ni = nodes.size(); i < ni; ++i) {
- Node &node = nodes[i];
-
+ for (Node &node : nodes) {
node.x += node.bv * p_delta;
node.bv = Vector3();
@@ -1123,8 +1097,7 @@ void GodotSoftBody3D::solve_constraints(real_t p_delta) {
}
void GodotSoftBody3D::solve_links(real_t kst, real_t ti) {
- for (uint32_t i = 0, ni = links.size(); i < ni; ++i) {
- Link &link = links[i];
+ for (Link &link : links) {
if (link.c0 > 0) {
Node &node_a = *link.n[0];
Node &node_b = *link.n[1];
@@ -1183,9 +1156,7 @@ void GodotSoftBody3D::query_ray(const Vector3 &p_from, const Vector3 &p_to, Godo
void GodotSoftBody3D::initialize_face_tree() {
face_tree.clear();
- for (uint32_t i = 0; i < faces.size(); ++i) {
- Face &face = faces[i];
-
+ for (Face &face : faces) {
AABB face_aabb;
face_aabb.position = face.n[0]->x;
@@ -1199,9 +1170,7 @@ void GodotSoftBody3D::initialize_face_tree() {
}
void GodotSoftBody3D::update_face_tree(real_t p_delta) {
- for (uint32_t i = 0; i < faces.size(); ++i) {
- const Face &face = faces[i];
-
+ for (const Face &face : faces) {
AABB face_aabb;
const Node *node0 = face.n[0];
diff --git a/servers/physics_3d/godot_space_3d.cpp b/servers/physics_3d/godot_space_3d.cpp
index c3aad22932..93572965d2 100644
--- a/servers/physics_3d/godot_space_3d.cpp
+++ b/servers/physics_3d/godot_space_3d.cpp
@@ -445,7 +445,7 @@ struct _RestCallbackData {
_RestResultData *other_results = nullptr;
};
-static void _rest_cbk_result(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, void *p_userdata) {
+static void _rest_cbk_result(const Vector3 &p_point_A, int p_index_A, const Vector3 &p_point_B, int p_index_B, const Vector3 &normal, void *p_userdata) {
_RestCallbackData *rd = static_cast<_RestCallbackData *>(p_userdata);
Vector3 contact_rel = p_point_B - p_point_A;
@@ -480,7 +480,7 @@ static void _rest_cbk_result(const Vector3 &p_point_A, int p_index_A, const Vect
// Keep this result as separate result.
result.len = len;
result.contact = p_point_B;
- result.normal = contact_rel / len;
+ result.normal = normal;
result.object = rd->object;
result.shape = rd->shape;
result.local_shape = rd->local_shape;
@@ -499,7 +499,7 @@ static void _rest_cbk_result(const Vector3 &p_point_A, int p_index_A, const Vect
rd->best_result.len = len;
rd->best_result.contact = p_point_B;
- rd->best_result.normal = contact_rel / len;
+ rd->best_result.normal = normal;
rd->best_result.object = rd->object;
rd->best_result.shape = rd->shape;
rd->best_result.local_shape = rd->local_shape;
diff --git a/servers/physics_server_2d.cpp b/servers/physics_server_2d.cpp
index 214de27b35..15c2749484 100644
--- a/servers/physics_server_2d.cpp
+++ b/servers/physics_server_2d.cpp
@@ -811,8 +811,7 @@ void PhysicsServer2D::_bind_methods() {
BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY);
BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_VECTOR);
BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_IS_POINT);
- BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_DISTANCE_SCALE);
- BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_POINT_ATTENUATION);
+ BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE);
BIND_ENUM_CONSTANT(AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE);
BIND_ENUM_CONSTANT(AREA_PARAM_LINEAR_DAMP);
BIND_ENUM_CONSTANT(AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE);
diff --git a/servers/physics_server_2d.h b/servers/physics_server_2d.h
index 836ab5bd76..3e254e610e 100644
--- a/servers/physics_server_2d.h
+++ b/servers/physics_server_2d.h
@@ -286,8 +286,7 @@ public:
AREA_PARAM_GRAVITY,
AREA_PARAM_GRAVITY_VECTOR,
AREA_PARAM_GRAVITY_IS_POINT,
- AREA_PARAM_GRAVITY_DISTANCE_SCALE,
- AREA_PARAM_GRAVITY_POINT_ATTENUATION,
+ AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE,
AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE,
AREA_PARAM_LINEAR_DAMP,
AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE,
diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp
index f1272a985d..864774374b 100644
--- a/servers/physics_server_3d.cpp
+++ b/servers/physics_server_3d.cpp
@@ -976,8 +976,7 @@ void PhysicsServer3D::_bind_methods() {
BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY);
BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_VECTOR);
BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_IS_POINT);
- BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_DISTANCE_SCALE);
- BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_POINT_ATTENUATION);
+ BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE);
BIND_ENUM_CONSTANT(AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE);
BIND_ENUM_CONSTANT(AREA_PARAM_LINEAR_DAMP);
BIND_ENUM_CONSTANT(AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE);
diff --git a/servers/physics_server_3d.h b/servers/physics_server_3d.h
index d1c644d51a..abf22e68a4 100644
--- a/servers/physics_server_3d.h
+++ b/servers/physics_server_3d.h
@@ -316,8 +316,7 @@ public:
AREA_PARAM_GRAVITY,
AREA_PARAM_GRAVITY_VECTOR,
AREA_PARAM_GRAVITY_IS_POINT,
- AREA_PARAM_GRAVITY_DISTANCE_SCALE,
- AREA_PARAM_GRAVITY_POINT_ATTENUATION,
+ AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE,
AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE,
AREA_PARAM_LINEAR_DAMP,
AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE,
diff --git a/servers/rendering/dummy/storage/mesh_storage.h b/servers/rendering/dummy/storage/mesh_storage.h
index 2d66c225e8..aba362c956 100644
--- a/servers/rendering/dummy/storage/mesh_storage.h
+++ b/servers/rendering/dummy/storage/mesh_storage.h
@@ -126,6 +126,7 @@ public:
virtual void mesh_instance_set_skeleton(RID p_mesh_instance, RID p_skeleton) override {}
virtual void mesh_instance_set_blend_shape_weight(RID p_mesh_instance, int p_shape, float p_weight) override {}
virtual void mesh_instance_check_for_update(RID p_mesh_instance) override {}
+ virtual void mesh_instance_set_canvas_item_transform(RID p_mesh_instance, const Transform2D &p_transform) override {}
virtual void update_mesh_instances() override {}
/* MULTIMESH API */
diff --git a/servers/rendering/dummy/storage/texture_storage.h b/servers/rendering/dummy/storage/texture_storage.h
index 62e1eb326d..fd36e7ac10 100644
--- a/servers/rendering/dummy/storage/texture_storage.h
+++ b/servers/rendering/dummy/storage/texture_storage.h
@@ -154,6 +154,7 @@ public:
virtual RID decal_instance_create(RID p_decal) override { return RID(); }
virtual void decal_instance_free(RID p_decal_instance) override {}
virtual void decal_instance_set_transform(RID p_decal, const Transform3D &p_transform) override {}
+ virtual void decal_instance_set_sorting_offset(RID p_decal_instance, float p_sorting_offset) override {}
/* RENDER TARGET */
diff --git a/servers/rendering/renderer_canvas_cull.cpp b/servers/rendering/renderer_canvas_cull.cpp
index 4265ee5518..b9e3c4f303 100644
--- a/servers/rendering/renderer_canvas_cull.cpp
+++ b/servers/rendering/renderer_canvas_cull.cpp
@@ -821,6 +821,38 @@ void RendererCanvasCull::canvas_item_add_polyline(RID p_item, const Vector<Point
Vector<int> indices;
int point_count = p_points.size();
+
+ Item::CommandPolygon *pline = canvas_item->alloc_command<Item::CommandPolygon>();
+ ERR_FAIL_COND(!pline);
+
+ if (p_width < 0) {
+ if (p_antialiased) {
+ WARN_PRINT("Antialiasing is not supported for thin polylines drawn using line strips (`p_width < 0`).");
+ }
+
+ pline->primitive = RS::PRIMITIVE_LINE_STRIP;
+
+ if (p_colors.size() == 1 || p_colors.size() == point_count) {
+ pline->polygon.create(indices, p_points, p_colors);
+ } else {
+ Vector<Color> colors;
+ if (p_colors.is_empty()) {
+ colors.push_back(color);
+ } else {
+ colors.resize(point_count);
+ Color *colors_ptr = colors.ptrw();
+ for (int i = 0; i < point_count; i++) {
+ if (i < p_colors.size()) {
+ color = p_colors[i];
+ }
+ colors_ptr[i] = color;
+ }
+ }
+ pline->polygon.create(indices, p_points, colors);
+ }
+ return;
+ }
+
int polyline_point_count = point_count * 2;
bool loop = p_points[0].is_equal_approx(p_points[point_count - 1]);
@@ -845,9 +877,6 @@ void RendererCanvasCull::canvas_item_add_polyline(RID p_item, const Vector<Point
}
}
- Item::CommandPolygon *pline = canvas_item->alloc_command<Item::CommandPolygon>();
- ERR_FAIL_COND(!pline);
-
PackedColorArray colors;
PackedVector2Array points;
diff --git a/servers/rendering/renderer_canvas_cull.h b/servers/rendering/renderer_canvas_cull.h
index 2494ddf631..1106fc4f1e 100644
--- a/servers/rendering/renderer_canvas_cull.h
+++ b/servers/rendering/renderer_canvas_cull.h
@@ -222,7 +222,7 @@ public:
void canvas_item_set_update_when_visible(RID p_item, bool p_update);
void canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width = -1.0, bool p_antialiased = false);
- void canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0, bool p_antialiased = false);
+ void canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = -1.0, bool p_antialiased = false);
void canvas_item_add_multiline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = -1.0);
void canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color);
void canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color);
diff --git a/servers/rendering/renderer_rd/cluster_builder_rd.cpp b/servers/rendering/renderer_rd/cluster_builder_rd.cpp
index 73a0c652a4..959a752fba 100644
--- a/servers/rendering/renderer_rd/cluster_builder_rd.cpp
+++ b/servers/rendering/renderer_rd/cluster_builder_rd.cpp
@@ -74,7 +74,7 @@ ClusterBuilderSharedDataRD::ClusterBuilderSharedDataRD() {
cluster_debug.shader_pipeline = RD::get_singleton()->compute_pipeline_create(cluster_debug.shader);
}
- { // SPHERE
+ { // Sphere mesh data.
static const uint32_t icosphere_vertex_count = 42;
static const float icosphere_vertices[icosphere_vertex_count * 3] = {
0, 0, -1, 0.7236073, -0.5257253, -0.4472195, -0.276388, -0.8506492, -0.4472199, -0.8944262, 0, -0.4472156, -0.276388, 0.8506492, -0.4472199, 0.7236073, 0.5257253, -0.4472195, 0.276388, -0.8506492, 0.4472199, -0.7236073, -0.5257253, 0.4472195, -0.7236073, 0.5257253, 0.4472195, 0.276388, 0.8506492, 0.4472199, 0.8944262, 0, 0.4472156, 0, 0, 1, -0.1624555, -0.4999952, -0.8506544, 0.4253227, -0.3090114, -0.8506542, 0.2628688, -0.8090116, -0.5257377, 0.8506479, 0, -0.5257359, 0.4253227, 0.3090114, -0.8506542, -0.5257298, 0, -0.8506517, -0.6881894, -0.4999969, -0.5257362, -0.1624555, 0.4999952, -0.8506544, -0.6881894, 0.4999969, -0.5257362, 0.2628688, 0.8090116, -0.5257377, 0.9510579, -0.3090126, 0, 0.9510579, 0.3090126, 0, 0, -1, 0, 0.5877856, -0.8090167, 0, -0.9510579, -0.3090126, 0, -0.5877856, -0.8090167, 0, -0.5877856, 0.8090167, 0, -0.9510579, 0.3090126, 0, 0.5877856, 0.8090167, 0, 0, 1, 0, 0.6881894, -0.4999969, 0.5257362, -0.2628688, -0.8090116, 0.5257377, -0.8506479, 0, 0.5257359, -0.2628688, 0.8090116, 0.5257377, 0.6881894, 0.4999969, 0.5257362, 0.1624555, -0.4999952, 0.8506544, 0.5257298, 0, 0.8506517, -0.4253227, -0.3090114, 0.8506542, -0.4253227, 0.3090114, 0.8506542, 0.1624555, 0.4999952, 0.8506544
@@ -118,7 +118,7 @@ ClusterBuilderSharedDataRD::ClusterBuilderSharedDataRD() {
sphere_overfit = 1.0 / min_d;
}
- { // CONE
+ { // Cone mesh data.
static const uint32_t cone_vertex_count = 99;
static const float cone_vertices[cone_vertex_count * 3] = {
0, 1, -1, 0.1950903, 0.9807853, -1, 0.3826835, 0.9238795, -1, 0.5555703, 0.8314696, -1, 0.7071068, 0.7071068, -1, 0.8314697, 0.5555702, -1, 0.9238795, 0.3826834, -1, 0.9807853, 0.1950903, -1, 1, 0, -1, 0.9807853, -0.1950902, -1, 0.9238796, -0.3826833, -1, 0.8314697, -0.5555702, -1, 0.7071068, -0.7071068, -1, 0.5555702, -0.8314697, -1, 0.3826833, -0.9238796, -1, 0.1950901, -0.9807853, -1, -3.25841e-7, -1, -1, -0.1950907, -0.9807852, -1, -0.3826839, -0.9238793, -1, -0.5555707, -0.8314693, -1, -0.7071073, -0.7071063, -1, -0.83147, -0.5555697, -1, -0.9238799, -0.3826827, -1, 0, 0, 0, -0.9807854, -0.1950894, -1, -1, 9.65599e-7, -1, -0.9807851, 0.1950913, -1, -0.9238791, 0.3826845, -1, -0.8314689, 0.5555713, -1, -0.7071059, 0.7071077, -1, -0.5555691, 0.8314704, -1, -0.3826821, 0.9238801, -1, -0.1950888, 0.9807856, -1
@@ -172,7 +172,7 @@ ClusterBuilderSharedDataRD::ClusterBuilderSharedDataRD() {
cone_overfit = 1.0 / min_d;
}
- { // BOX
+ { // Box mesh data.
static const uint32_t box_vertex_count = 8;
static const float box_vertices[box_vertex_count * 3] = {
-1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1
@@ -219,8 +219,9 @@ ClusterBuilderSharedDataRD::~ClusterBuilderSharedDataRD() {
void ClusterBuilderRD::_clear() {
if (cluster_buffer.is_null()) {
- return; //nothing to clear
+ return;
}
+
RD::get_singleton()->free(cluster_buffer);
RD::get_singleton()->free(cluster_render_buffer);
RD::get_singleton()->free(element_buffer);
@@ -254,7 +255,7 @@ void ClusterBuilderRD::setup(Size2i p_screen_size, uint32_t p_max_elements, RID
cluster_screen_size.height = (p_screen_size.height - 1) / cluster_size + 1;
max_elements_by_type = p_max_elements;
- if (max_elements_by_type % 32) { //need to be 32 aligned
+ if (max_elements_by_type % 32) { // Needs to be aligned to 32.
max_elements_by_type += 32 - (max_elements_by_type % 32);
}
@@ -264,7 +265,8 @@ void ClusterBuilderRD::setup(Size2i p_screen_size, uint32_t p_max_elements, RID
uint32_t element_tag_bits_size = render_element_max / 32;
uint32_t element_tag_depth_bits_size = render_element_max;
- cluster_render_buffer_size = cluster_screen_size.x * cluster_screen_size.y * (element_tag_bits_size + element_tag_depth_bits_size) * 4; // tag bits (element was used) and tag depth (depth range in which it was used)
+
+ cluster_render_buffer_size = cluster_screen_size.x * cluster_screen_size.y * (element_tag_bits_size + element_tag_depth_bits_size) * 4; // Tag bits (element was used) and tag depth (depth range in which it was used).
cluster_render_buffer = RD::get_singleton()->storage_buffer_create(cluster_render_buffer_size);
cluster_buffer = RD::get_singleton()->storage_buffer_create(cluster_buffer_size);
@@ -379,9 +381,9 @@ void ClusterBuilderRD::begin(const Transform3D &p_view_transform, const Projecti
projection = p_cam_projection;
z_near = projection.get_z_near();
z_far = projection.get_z_far();
- orthogonal = p_cam_projection.is_orthogonal();
+ camera_orthogonal = p_cam_projection.is_orthogonal();
adjusted_projection = projection;
- if (!orthogonal) {
+ if (!camera_orthogonal) {
adjusted_projection.adjust_perspective_znear(0.0001);
}
@@ -390,7 +392,7 @@ void ClusterBuilderRD::begin(const Transform3D &p_view_transform, const Projecti
projection = correction * projection;
adjusted_projection = correction * adjusted_projection;
- //reset counts
+ // Reset counts.
render_element_count = 0;
for (uint32_t i = 0; i < ELEMENT_TYPE_MAX; i++) {
cluster_count_by_type[i] = 0;
@@ -402,14 +404,14 @@ void ClusterBuilderRD::bake_cluster() {
RD::get_singleton()->draw_command_begin_label("Bake Light Cluster");
- //clear cluster buffer
+ // Clear cluster buffer.
RD::get_singleton()->buffer_clear(cluster_buffer, 0, cluster_buffer_size, RD::BARRIER_MASK_RASTER | RD::BARRIER_MASK_COMPUTE);
if (render_element_count > 0) {
- //clear render buffer
+ // Clear render buffer.
RD::get_singleton()->buffer_clear(cluster_render_buffer, 0, cluster_render_buffer_size, RD::BARRIER_MASK_RASTER);
- { //fill state uniform
+ { // Fill state uniform.
StateUniform state;
@@ -425,13 +427,13 @@ void ClusterBuilderRD::bake_cluster() {
RD::get_singleton()->buffer_update(state_uniform, 0, sizeof(StateUniform), &state, RD::BARRIER_MASK_RASTER | RD::BARRIER_MASK_COMPUTE);
}
- //update instances
+ // Update instances.
RD::get_singleton()->buffer_update(element_buffer, 0, sizeof(RenderElementData) * render_element_count, render_elements, RD::BARRIER_MASK_RASTER | RD::BARRIER_MASK_COMPUTE);
RENDER_TIMESTAMP("Render 3D Cluster Elements");
- //render elements
+ // Render elements.
{
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(framebuffer, RD::INITIAL_ACTION_DROP, RD::FINAL_ACTION_DISCARD, RD::INITIAL_ACTION_DROP, RD::FINAL_ACTION_DISCARD);
ClusterBuilderSharedDataRD::ClusterRender::PushConstant push_constant = {};
@@ -447,8 +449,16 @@ void ClusterBuilderRD::bake_cluster() {
RD::get_singleton()->draw_list_bind_index_array(draw_list, shared->sphere_index_array);
} break;
case ELEMENT_TYPE_SPOT_LIGHT: {
- RD::get_singleton()->draw_list_bind_vertex_array(draw_list, shared->cone_vertex_array);
- RD::get_singleton()->draw_list_bind_index_array(draw_list, shared->cone_index_array);
+ // If the spot angle is above a certain threshold, use a sphere instead of a cone for building the clusters
+ // since the cone gets too flat/large (spot angle close to 90 degrees) or
+ // can't even cover the affected area of the light (spot angle above 90 degrees).
+ if (render_elements[i].has_wide_spot_angle) {
+ RD::get_singleton()->draw_list_bind_vertex_array(draw_list, shared->sphere_vertex_array);
+ RD::get_singleton()->draw_list_bind_index_array(draw_list, shared->sphere_index_array);
+ } else {
+ RD::get_singleton()->draw_list_bind_vertex_array(draw_list, shared->cone_vertex_array);
+ RD::get_singleton()->draw_list_bind_index_array(draw_list, shared->cone_index_array);
+ }
} break;
case ELEMENT_TYPE_DECAL:
case ELEMENT_TYPE_REFLECTION_PROBE: {
@@ -465,7 +475,7 @@ void ClusterBuilderRD::bake_cluster() {
}
RD::get_singleton()->draw_list_end(RD::BARRIER_MASK_COMPUTE);
}
- //store elements
+ // Store elements.
RENDER_TIMESTAMP("Pack 3D Cluster Elements");
{
@@ -509,7 +519,7 @@ void ClusterBuilderRD::debug(ElementType p_element) {
push_constant.cluster_screen_size[1] = cluster_screen_size.y;
push_constant.cluster_shift = get_shift_from_power_of_2(cluster_size);
push_constant.cluster_type = p_element;
- push_constant.orthogonal = orthogonal;
+ push_constant.orthogonal = camera_orthogonal;
push_constant.z_far = z_far;
push_constant.z_near = z_near;
push_constant.max_cluster_element_count_div_32 = max_elements_by_type / 32;
diff --git a/servers/rendering/renderer_rd/cluster_builder_rd.h b/servers/rendering/renderer_rd/cluster_builder_rd.h
index 0b20a5d7ee..a13e6c8172 100644
--- a/servers/rendering/renderer_rd/cluster_builder_rd.h
+++ b/servers/rendering/renderer_rd/cluster_builder_rd.h
@@ -43,13 +43,13 @@ class ClusterBuilderSharedDataRD {
RID sphere_vertex_array;
RID sphere_index_buffer;
RID sphere_index_array;
- float sphere_overfit = 0.0; //because an icosphere is not a perfect sphere, we need to enlarge it to cover the sphere area
+ float sphere_overfit = 0.0; // Because an icosphere is not a perfect sphere, we need to enlarge it to cover the sphere area.
RID cone_vertex_buffer;
RID cone_vertex_array;
RID cone_index_buffer;
RID cone_index_array;
- float cone_overfit = 0.0; //because an cone mesh is not a perfect sphere, we need to enlarge it to cover the actual cone area
+ float cone_overfit = 0.0; // Because an cone mesh is not a perfect cone, we need to enlarge it to cover the actual cone area.
RID box_vertex_buffer;
RID box_vertex_array;
@@ -73,6 +73,7 @@ class ClusterBuilderSharedDataRD {
ClusterRenderShaderRD cluster_render_shader;
RID shader_version;
RID shader;
+
enum PipelineVersion {
PIPELINE_NORMAL,
PIPELINE_MSAA,
@@ -85,10 +86,11 @@ class ClusterBuilderSharedDataRD {
struct ClusterStore {
struct PushConstant {
uint32_t cluster_render_data_size; // how much data for a single cluster takes
- uint32_t max_render_element_count_div_32; //divided by 32
+ uint32_t max_render_element_count_div_32; // divided by 32
uint32_t cluster_screen_size[2];
- uint32_t render_element_count_div_32; //divided by 32
- uint32_t max_cluster_element_count_div_32; //divided by 32
+ uint32_t render_element_count_div_32; // divided by 32
+ uint32_t max_cluster_element_count_div_32; // divided by 32
+
uint32_t pad1;
uint32_t pad2;
};
@@ -111,6 +113,7 @@ class ClusterBuilderSharedDataRD {
uint32_t orthogonal;
uint32_t max_cluster_element_count_div_32;
+
uint32_t pad1;
uint32_t pad2;
};
@@ -128,6 +131,8 @@ public:
class ClusterBuilderRD {
public:
+ static constexpr float WIDE_SPOT_ANGLE_THRESHOLD_DEG = 60.0f;
+
enum LightType {
LIGHT_TYPE_OMNI,
LIGHT_TYPE_SPOT
@@ -144,21 +149,20 @@ public:
ELEMENT_TYPE_DECAL,
ELEMENT_TYPE_REFLECTION_PROBE,
ELEMENT_TYPE_MAX,
-
};
private:
ClusterBuilderSharedDataRD *shared = nullptr;
struct RenderElementData {
- uint32_t type; //0-4
+ uint32_t type; // 0-4
uint32_t touches_near;
uint32_t touches_far;
uint32_t original_index;
- float transform_inv[12]; //transposed transform for less space
+ float transform_inv[12]; // Transposed transform for less space.
float scale[3];
- uint32_t pad;
- };
+ uint32_t has_wide_spot_angle;
+ }; // Keep aligned to 32 bytes.
uint32_t cluster_count_by_type[ELEMENT_TYPE_MAX] = {};
uint32_t max_elements_by_type = 0;
@@ -172,7 +176,7 @@ private:
Projection projection;
float z_far = 0;
float z_near = 0;
- bool orthogonal = false;
+ bool camera_orthogonal = false;
enum Divisor {
DIVISOR_1,
@@ -188,26 +192,27 @@ private:
Size2i cluster_screen_size;
RID framebuffer;
- RID cluster_render_buffer; //used for creating
- RID cluster_buffer; //used for rendering
- RID element_buffer; //used for storing, to hint element touches far plane or near plane
+ RID cluster_render_buffer; // Used for creating.
+ RID cluster_buffer; // Used for rendering.
+ RID element_buffer; // Used for storing, to hint element touches far plane or near plane.
uint32_t cluster_render_buffer_size = 0;
uint32_t cluster_buffer_size = 0;
RID cluster_render_uniform_set;
RID cluster_store_uniform_set;
- //persistent data
+ // Persistent data.
void _clear();
struct StateUniform {
float projection[16];
float inv_z_far;
- uint32_t screen_to_clusters_shift; // shift to obtain coordinates in block indices
- uint32_t cluster_screen_width; //
- uint32_t cluster_data_size; // how much data for a single cluster takes
+ uint32_t screen_to_clusters_shift; // Shift to obtain coordinates in block indices.
+ uint32_t cluster_screen_width;
+ uint32_t cluster_data_size; // How much data is needed for a single cluster.
uint32_t cluster_depth_offset;
+
uint32_t pad0;
uint32_t pad1;
uint32_t pad2;
@@ -224,10 +229,10 @@ public:
_FORCE_INLINE_ void add_light(LightType p_type, const Transform3D &p_transform, float p_radius, float p_spot_aperture) {
if (p_type == LIGHT_TYPE_OMNI && cluster_count_by_type[ELEMENT_TYPE_OMNI_LIGHT] == max_elements_by_type) {
- return; //max number elements reached
+ return; // Max number elements reached.
}
if (p_type == LIGHT_TYPE_SPOT && cluster_count_by_type[ELEMENT_TYPE_SPOT_LIGHT] == max_elements_by_type) {
- return; //max number elements reached
+ return; // Max number elements reached.
}
RenderElementData &e = render_elements[render_element_count];
@@ -242,15 +247,14 @@ public:
radius *= p_radius;
if (p_type == LIGHT_TYPE_OMNI) {
- radius *= shared->sphere_overfit; // overfit icosphere
+ radius *= shared->sphere_overfit; // Overfit icosphere.
- //omni
float depth = -xform.origin.z;
- if (orthogonal) {
+ if (camera_orthogonal) {
e.touches_near = (depth - radius) < z_near;
} else {
- //contains camera inside light
- float radius2 = radius * shared->sphere_overfit; // overfit again for outer size (camera may be outside actual sphere but behind an icosphere vertex)
+ // Contains camera inside light.
+ float radius2 = radius * shared->sphere_overfit; // Overfit again for outer size (camera may be outside actual sphere but behind an icosphere vertex)
e.touches_near = xform.origin.length_squared() < radius2 * radius2;
}
@@ -265,12 +269,11 @@ public:
cluster_count_by_type[ELEMENT_TYPE_OMNI_LIGHT]++;
- } else {
- //spot
- radius *= shared->cone_overfit; // overfit icosphere
+ } else /*LIGHT_TYPE_SPOT */ {
+ radius *= shared->cone_overfit; // Overfit icosphere
real_t len = Math::tan(Math::deg_to_rad(p_spot_aperture)) * radius;
- //approximate, probably better to use a cone support function
+ // Approximate, probably better to use a cone support function.
float max_d = -1e20;
float min_d = 1e20;
#define CONE_MINMAX(m_x, m_y) \
@@ -285,14 +288,13 @@ public:
CONE_MINMAX(-1, -1);
CONE_MINMAX(1, -1);
- if (orthogonal) {
+ if (camera_orthogonal) {
e.touches_near = min_d < z_near;
} else {
- //contains camera inside light
Plane base_plane(-xform.basis.get_column(Vector3::AXIS_Z), xform.origin);
float dist = base_plane.distance_to(Vector3());
if (dist >= 0 && dist < radius) {
- //inside, check angle
+ // Contains camera inside light, check angle.
float angle = Math::rad_to_deg(Math::acos((-xform.origin.normalized()).dot(-xform.basis.get_column(Vector3::AXIS_Z))));
e.touches_near = angle < p_spot_aperture * 1.05; //overfit aperture a little due to cone overfit
} else {
@@ -302,12 +304,23 @@ public:
e.touches_far = max_d > z_far;
- e.scale[0] = len * shared->cone_overfit;
- e.scale[1] = len * shared->cone_overfit;
- e.scale[2] = radius;
+ // If the spot angle is above the threshold, use a sphere instead of a cone for building the clusters
+ // since the cone gets too flat/large (spot angle close to 90 degrees) or
+ // can't even cover the affected area of the light (spot angle above 90 degrees).
+ if (p_spot_aperture > WIDE_SPOT_ANGLE_THRESHOLD_DEG) {
+ e.scale[0] = radius;
+ e.scale[1] = radius;
+ e.scale[2] = radius;
+ e.has_wide_spot_angle = true;
+ } else {
+ e.scale[0] = len * shared->cone_overfit;
+ e.scale[1] = len * shared->cone_overfit;
+ e.scale[2] = radius;
+ e.has_wide_spot_angle = false;
+ }
e.type = ELEMENT_TYPE_SPOT_LIGHT;
- e.original_index = cluster_count_by_type[ELEMENT_TYPE_SPOT_LIGHT]; //use omni since they share index
+ e.original_index = cluster_count_by_type[ELEMENT_TYPE_SPOT_LIGHT]; // Use omni light since they share index.
RendererRD::MaterialStorage::store_transform_transposed_3x4(xform, e.transform_inv);
@@ -319,16 +332,16 @@ public:
_FORCE_INLINE_ void add_box(BoxType p_box_type, const Transform3D &p_transform, const Vector3 &p_half_extents) {
if (p_box_type == BOX_TYPE_DECAL && cluster_count_by_type[ELEMENT_TYPE_DECAL] == max_elements_by_type) {
- return; //max number elements reached
+ return; // Max number elements reached.
}
if (p_box_type == BOX_TYPE_REFLECTION_PROBE && cluster_count_by_type[ELEMENT_TYPE_REFLECTION_PROBE] == max_elements_by_type) {
- return; //max number elements reached
+ return; // Max number elements reached.
}
RenderElementData &e = render_elements[render_element_count];
Transform3D xform = view_xform * p_transform;
- //extract scale and scale the matrix by it, makes things simpler
+ // Extract scale and scale the matrix by it, makes things simpler.
Vector3 scale = p_half_extents;
for (uint32_t i = 0; i < 3; i++) {
float s = xform.basis.rows[i].length();
@@ -339,10 +352,10 @@ public:
float box_depth = Math::abs(xform.basis.xform_inv(Vector3(0, 0, -1)).dot(scale));
float depth = -xform.origin.z;
- if (orthogonal) {
+ if (camera_orthogonal) {
e.touches_near = depth - box_depth < z_near;
} else {
- //contains camera inside box
+ // Contains camera inside box.
Vector3 inside = xform.xform_inv(Vector3(0, 0, 0)).abs();
e.touches_near = inside.x < scale.x && inside.y < scale.y && inside.z < scale.z;
}
diff --git a/servers/rendering/renderer_rd/environment/gi.cpp b/servers/rendering/renderer_rd/environment/gi.cpp
index a52716cd78..08133bf8d6 100644
--- a/servers/rendering/renderer_rd/environment/gi.cpp
+++ b/servers/rendering/renderer_rd/environment/gi.cpp
@@ -540,9 +540,7 @@ void GI::SDFGI::create(RID p_env, const Vector3 &p_world_position, uint32_t p_re
occlusion_texture = RD::get_singleton()->texture_create_shared(tv, occlusion_data);
}
- for (uint32_t i = 0; i < cascades.size(); i++) {
- SDFGI::Cascade &cascade = cascades[i];
-
+ for (SDFGI::Cascade &cascade : cascades) {
/* 3D Textures */
cascade.sdf_tex = RD::get_singleton()->texture_create(tf_sdf, RD::TextureView());
@@ -743,9 +741,7 @@ void GI::SDFGI::create(RID p_env, const Vector3 &p_world_position, uint32_t p_re
}
//direct light
- for (uint32_t i = 0; i < cascades.size(); i++) {
- SDFGI::Cascade &cascade = cascades[i];
-
+ for (SDFGI::Cascade &cascade : cascades) {
Vector<RD::Uniform> uniforms;
{
RD::Uniform u;
@@ -1134,8 +1130,7 @@ void GI::SDFGI::free_data() {
}
GI::SDFGI::~SDFGI() {
- for (uint32_t i = 0; i < cascades.size(); i++) {
- const SDFGI::Cascade &c = cascades[i];
+ for (const SDFGI::Cascade &c : cascades) {
RD::get_singleton()->free(c.light_data);
RD::get_singleton()->free(c.light_aniso_0_tex);
RD::get_singleton()->free(c.light_aniso_1_tex);
@@ -1198,8 +1193,7 @@ void GI::SDFGI::update(RID p_env, const Vector3 &p_world_position) {
int32_t drag_margin = (cascade_size / SDFGI::PROBE_DIVISOR) / 2;
- for (uint32_t i = 0; i < cascades.size(); i++) {
- SDFGI::Cascade &cascade = cascades[i];
+ for (SDFGI::Cascade &cascade : cascades) {
cascade.dirty_regions = Vector3i();
Vector3 probe_half_size = Vector3(1, 1, 1) * cascade.cell_size * float(cascade_size / SDFGI::PROBE_DIVISOR) * 0.5;
diff --git a/servers/rendering/renderer_rd/environment/sky.cpp b/servers/rendering/renderer_rd/environment/sky.cpp
index 7e02f98ce9..7fff349b3c 100644
--- a/servers/rendering/renderer_rd/environment/sky.cpp
+++ b/servers/rendering/renderer_rd/environment/sky.cpp
@@ -347,7 +347,10 @@ void SkyRD::ReflectionData::update_reflection_data(int p_size, int p_mipmaps, bo
tf.texture_type = RD::TEXTURE_TYPE_CUBE;
tf.array_layers = 6;
tf.mipmaps = p_low_quality ? 7 : mipmaps - 1;
- tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT | RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT;
+ tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT;
+ if (RendererSceneRenderRD::get_singleton()->_render_buffers_can_be_storage()) {
+ tf.usage_bits |= RD::TEXTURE_USAGE_STORAGE_BIT;
+ }
downsampled_radiance_cubemap = RD::get_singleton()->texture_create(tf, RD::TextureView());
RD::get_singleton()->set_resource_name(downsampled_radiance_cubemap, "downsampled radiance cubemap");
@@ -571,7 +574,7 @@ RID SkyRD::Sky::get_textures(SkyTextureSetVersion p_version, RID p_default_shade
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 1; // half res
if (p_version >= SKY_TEXTURE_SET_CUBEMAP) {
- if (reflection.layers[0].views[1].is_valid() && p_version != SKY_TEXTURE_SET_CUBEMAP_HALF_RES) {
+ if (reflection.layers.size() && reflection.layers[0].views.size() >= 2 && reflection.layers[0].views[1].is_valid() && p_version != SKY_TEXTURE_SET_CUBEMAP_HALF_RES) {
u.append_id(reflection.layers[0].views[1]);
} else {
u.append_id(texture_storage->texture_rd_get_default(RendererRD::TextureStorage::DEFAULT_RD_TEXTURE_CUBEMAP_BLACK));
@@ -591,7 +594,7 @@ RID SkyRD::Sky::get_textures(SkyTextureSetVersion p_version, RID p_default_shade
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 2; // quarter res
if (p_version >= SKY_TEXTURE_SET_CUBEMAP) {
- if (reflection.layers[0].views[2].is_valid() && p_version != SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES) {
+ if (reflection.layers.size() && reflection.layers[0].views.size() >= 3 && reflection.layers[0].views[2].is_valid() && p_version != SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES) {
u.append_id(reflection.layers[0].views[2]);
} else {
u.append_id(texture_storage->texture_rd_get_default(RendererRD::TextureStorage::DEFAULT_RD_TEXTURE_CUBEMAP_BLACK));
@@ -1320,7 +1323,7 @@ void SkyRD::update_radiance_buffers(Ref<RenderSceneBuffersRD> p_render_buffers,
// Note, we ignore environment_get_sky_orientation here as this is applied when we do our lookup in our scene shader.
- if (shader_data->uses_quarter_res) {
+ if (shader_data->uses_quarter_res && roughness_layers >= 3) {
RD::get_singleton()->draw_command_begin_label("Render Sky to Quarter Res Cubemap");
PipelineCacheRD *pipeline = &shader_data->pipelines[SKY_VERSION_CUBEMAP_QUARTER_RES];
@@ -1337,9 +1340,11 @@ void SkyRD::update_radiance_buffers(Ref<RenderSceneBuffersRD> p_render_buffers,
RD::get_singleton()->draw_list_end();
}
RD::get_singleton()->draw_command_end_label();
+ } else if (shader_data->uses_quarter_res && roughness_layers < 3) {
+ ERR_PRINT_ED("Cannot use quarter res buffer in sky shader when roughness layers is less than 3. Please increase rendering/reflections/sky_reflections/roughness_layers.");
}
- if (shader_data->uses_half_res) {
+ if (shader_data->uses_half_res && roughness_layers >= 2) {
RD::get_singleton()->draw_command_begin_label("Render Sky to Half Res Cubemap");
PipelineCacheRD *pipeline = &shader_data->pipelines[SKY_VERSION_CUBEMAP_HALF_RES];
@@ -1356,6 +1361,8 @@ void SkyRD::update_radiance_buffers(Ref<RenderSceneBuffersRD> p_render_buffers,
RD::get_singleton()->draw_list_end();
}
RD::get_singleton()->draw_command_end_label();
+ } else if (shader_data->uses_half_res && roughness_layers < 2) {
+ ERR_PRINT_ED("Cannot use half res buffer in sky shader when roughness layers is less than 2. Please increase rendering/reflections/sky_reflections/roughness_layers.");
}
RD::DrawListID cubemap_draw_list;
@@ -1627,7 +1634,10 @@ void SkyRD::update_dirty_skys() {
tf.mipmaps = mipmaps;
tf.width = w;
tf.height = h;
- tf.usage_bits = RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
+ tf.usage_bits = RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT;
+ if (RendererSceneRenderRD::get_singleton()->_render_buffers_can_be_storage()) {
+ tf.usage_bits |= RD::TEXTURE_USAGE_STORAGE_BIT;
+ }
sky->radiance = RD::get_singleton()->texture_create(tf, RD::TextureView());
@@ -1642,7 +1652,10 @@ void SkyRD::update_dirty_skys() {
tf.mipmaps = MIN(mipmaps, layers);
tf.width = w;
tf.height = h;
- tf.usage_bits = RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
+ tf.usage_bits = RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT;
+ if (RendererSceneRenderRD::get_singleton()->_render_buffers_can_be_storage()) {
+ tf.usage_bits |= RD::TEXTURE_USAGE_STORAGE_BIT;
+ }
sky->radiance = RD::get_singleton()->texture_create(tf, RD::TextureView());
diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
index 93c741fd34..2e844269e3 100644
--- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
@@ -667,7 +667,7 @@ void RenderForwardClustered::_setup_environment(const RenderDataRD *p_render_dat
if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_UNSHADED) {
scene_state.ubo.ss_effects_flags = 0;
- } else if (is_environment(p_render_data->environment)) {
+ } else if (p_render_data->reflection_probe.is_null() && is_environment(p_render_data->environment)) {
scene_state.ubo.ssao_ao_affect = environment_get_ssao_ao_channel_affect(p_render_data->environment);
scene_state.ubo.ssao_light_affect = environment_get_ssao_direct_light_affect(p_render_data->environment);
uint32_t ss_flags = 0;
@@ -1365,8 +1365,8 @@ void RenderForwardClustered::_pre_opaque_render(RenderDataRD *p_render_data, boo
}
//cube shadows are rendered in their own way
- for (uint32_t i = 0; i < p_render_data->cube_shadows.size(); i++) {
- _render_shadow_pass(p_render_data->render_shadows[p_render_data->cube_shadows[i]].light, p_render_data->shadow_atlas, p_render_data->render_shadows[p_render_data->cube_shadows[i]].pass, p_render_data->render_shadows[p_render_data->cube_shadows[i]].instances, camera_plane, lod_distance_multiplier, p_render_data->scene_data->screen_mesh_lod_threshold, true, true, true, p_render_data->render_info);
+ for (const int &index : p_render_data->cube_shadows) {
+ _render_shadow_pass(p_render_data->render_shadows[index].light, p_render_data->shadow_atlas, p_render_data->render_shadows[index].pass, p_render_data->render_shadows[index].instances, camera_plane, lod_distance_multiplier, p_render_data->scene_data->screen_mesh_lod_threshold, true, true, true, p_render_data->render_info);
}
if (p_render_data->directional_shadows.size()) {
@@ -1480,7 +1480,7 @@ void RenderForwardClustered::_pre_opaque_render(RenderDataRD *p_render_data, boo
uint32_t directional_light_count = 0;
uint32_t positional_light_count = 0;
light_storage->update_light_buffers(p_render_data, *p_render_data->lights, p_render_data->scene_data->cam_transform, p_render_data->shadow_atlas, using_shadows, directional_light_count, positional_light_count, p_render_data->directional_light_soft_shadows);
- texture_storage->update_decal_buffer(*p_render_data->decals, p_render_data->scene_data->cam_transform.affine_inverse());
+ texture_storage->update_decal_buffer(*p_render_data->decals, p_render_data->scene_data->cam_transform);
p_render_data->directional_light_count = directional_light_count;
@@ -1550,16 +1550,18 @@ void RenderForwardClustered::_process_sss(Ref<RenderSceneBuffersRD> p_render_buf
void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Color &p_default_bg_color) {
RendererRD::LightStorage *light_storage = RendererRD::LightStorage::get_singleton();
- Ref<RenderSceneBuffersRD> rb;
+ ERR_FAIL_NULL(p_render_data);
+
+ Ref<RenderSceneBuffersRD> rb = p_render_data->render_buffers;
+ ERR_FAIL_COND(rb.is_null());
Ref<RenderBufferDataForwardClustered> rb_data;
- if (p_render_data && p_render_data->render_buffers.is_valid()) {
- rb = p_render_data->render_buffers;
- if (rb->has_custom_data(RB_SCOPE_FORWARD_CLUSTERED)) {
- // Our forward clustered custom data buffer will only be available when we're rendering our normal view.
- // This will not be available when rendering reflection probes.
- rb_data = rb->get_custom_data(RB_SCOPE_FORWARD_CLUSTERED);
- }
+ if (rb->has_custom_data(RB_SCOPE_FORWARD_CLUSTERED)) {
+ // Our forward clustered custom data buffer will only be available when we're rendering our normal view.
+ // This will not be available when rendering reflection probes.
+ rb_data = rb->get_custom_data(RB_SCOPE_FORWARD_CLUSTERED);
}
+ bool is_reflection_probe = p_render_data->reflection_probe.is_valid();
+
static const int texture_multisamples[RS::VIEWPORT_MSAA_MAX] = { 1, 2, 4, 8 };
//first of all, make a new render pass
@@ -1588,18 +1590,16 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
p_render_data->voxel_gi_count = 0;
- if (rb.is_valid()) {
- if (rb->has_custom_data(RB_SCOPE_SDFGI)) {
- Ref<RendererRD::GI::SDFGI> sdfgi = rb->get_custom_data(RB_SCOPE_SDFGI);
- if (sdfgi.is_valid()) {
- sdfgi->update_cascades();
- sdfgi->pre_process_gi(p_render_data->scene_data->cam_transform, p_render_data);
- sdfgi->update_light();
- }
+ if (rb->has_custom_data(RB_SCOPE_SDFGI)) {
+ Ref<RendererRD::GI::SDFGI> sdfgi = rb->get_custom_data(RB_SCOPE_SDFGI);
+ if (sdfgi.is_valid()) {
+ sdfgi->update_cascades();
+ sdfgi->pre_process_gi(p_render_data->scene_data->cam_transform, p_render_data);
+ sdfgi->update_light();
}
-
- gi.setup_voxel_gi_instances(p_render_data, p_render_data->render_buffers, p_render_data->scene_data->cam_transform, *p_render_data->voxel_gi_instances, p_render_data->voxel_gi_count);
}
+
+ gi.setup_voxel_gi_instances(p_render_data, p_render_data->render_buffers, p_render_data->scene_data->cam_transform, *p_render_data->voxel_gi_instances, p_render_data->voxel_gi_count);
} else {
ERR_PRINT("No render buffer nor reflection atlas, bug"); //should never happen, will crash
current_cluster_builder = nullptr;
@@ -1618,7 +1618,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
// check if we need motion vectors
if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_MOTION_VECTORS) {
p_render_data->scene_data->calculate_motion_vectors = true;
- } else if (rb.is_valid() && rb->get_use_taa()) {
+ } else if (!is_reflection_probe && rb->get_use_taa()) {
p_render_data->scene_data->calculate_motion_vectors = true;
} else {
p_render_data->scene_data->calculate_motion_vectors = false;
@@ -1641,9 +1641,9 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
bool using_sdfgi = false;
bool using_voxelgi = false;
bool reverse_cull = p_render_data->scene_data->cam_transform.basis.determinant() < 0;
- bool using_ssil = p_render_data->environment.is_valid() && environment_get_ssil_enabled(p_render_data->environment);
+ bool using_ssil = !is_reflection_probe && p_render_data->environment.is_valid() && environment_get_ssil_enabled(p_render_data->environment);
- if (p_render_data->reflection_probe.is_valid()) {
+ if (is_reflection_probe) {
uint32_t resolution = light_storage->reflection_probe_instance_get_resolution(p_render_data->reflection_probe);
screen_size.x = resolution;
screen_size.y = resolution;
@@ -1657,7 +1657,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
}
reverse_cull = true; // for some reason our views are inverted
- } else if (rb.is_valid()) {
+ } else {
screen_size = rb->get_internal_size();
if (rb->get_use_taa() || get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_MOTION_VECTORS) {
@@ -1685,8 +1685,6 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
color_framebuffer = rb_data->get_color_pass_fb(color_pass_flags);
color_only_framebuffer = rb_data->get_color_only_fb();
- } else {
- ERR_FAIL(); //bug?
}
p_render_data->scene_data->emissive_exposure_normalization = -1.0;
@@ -1695,7 +1693,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
_setup_lightmaps(p_render_data, *p_render_data->lightmaps, p_render_data->scene_data->cam_transform);
_setup_voxelgis(*p_render_data->voxel_gi_instances);
- _setup_environment(p_render_data, p_render_data->reflection_probe.is_valid(), screen_size, !p_render_data->reflection_probe.is_valid(), p_default_bg_color, false);
+ _setup_environment(p_render_data, is_reflection_probe, screen_size, !is_reflection_probe, p_default_bg_color, false);
_update_render_base_uniform_set(); //may have changed due to the above (light buffer enlarged, as an example)
@@ -1707,7 +1705,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
RD::get_singleton()->draw_command_end_label();
- if (rb.is_valid() && !p_render_data->reflection_probe.is_valid()) {
+ if (!is_reflection_probe) {
if (using_voxelgi) {
depth_pass_mode = PASS_MODE_DEPTH_NORMAL_ROUGHNESS_VOXEL_GI;
} else if (p_render_data->environment.is_valid()) {
@@ -1739,7 +1737,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
}
}
- bool using_sss = rb_data.is_valid() && scene_state.used_sss && ss_effects->sss_get_quality() != RS::SUB_SURFACE_SCATTERING_QUALITY_DISABLED;
+ bool using_sss = rb_data.is_valid() && !is_reflection_probe && scene_state.used_sss && ss_effects->sss_get_quality() != RS::SUB_SURFACE_SCATTERING_QUALITY_DISABLED;
if (using_sss && !using_separate_specular) {
using_separate_specular = true;
@@ -1772,7 +1770,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
clear_color.r *= bg_energy_multiplier;
clear_color.g *= bg_energy_multiplier;
clear_color.b *= bg_energy_multiplier;
- if ((rb.is_valid() && rb->has_custom_data(RB_SCOPE_FOG)) || environment_get_fog_enabled(p_render_data->environment)) {
+ if ((rb->has_custom_data(RB_SCOPE_FOG)) || environment_get_fog_enabled(p_render_data->environment)) {
draw_sky_fog_only = true;
RendererRD::MaterialStorage::get_singleton()->material_set_param(sky.sky_scene_state.fog_material, "clear_color", Variant(clear_color.srgb_to_linear()));
}
@@ -1782,7 +1780,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
clear_color.r *= bg_energy_multiplier;
clear_color.g *= bg_energy_multiplier;
clear_color.b *= bg_energy_multiplier;
- if ((rb.is_valid() && rb->has_custom_data(RB_SCOPE_FOG)) || environment_get_fog_enabled(p_render_data->environment)) {
+ if ((rb->has_custom_data(RB_SCOPE_FOG)) || environment_get_fog_enabled(p_render_data->environment)) {
draw_sky_fog_only = true;
RendererRD::MaterialStorage::get_singleton()->material_set_param(sky.sky_scene_state.fog_material, "clear_color", Variant(clear_color.srgb_to_linear()));
}
@@ -1791,7 +1789,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
draw_sky = true;
} break;
case RS::ENV_BG_CANVAS: {
- if (rb.is_valid()) {
+ if (!is_reflection_probe) {
RID texture = RendererRD::TextureStorage::get_singleton()->render_target_get_rd_texture(rb->get_render_target());
copy_effects->copy_to_fb_rect(texture, color_only_framebuffer, Rect2i(), false, false, false, false, RID(), false, false, true);
}
@@ -1812,7 +1810,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
RD::get_singleton()->draw_command_begin_label("Setup Sky");
// Setup our sky render information for this frame/viewport
- if (p_render_data->reflection_probe.is_valid()) {
+ if (is_reflection_probe) {
Vector3 eye_offset;
Projection correction;
correction.set_depth_correction(true);
@@ -1849,7 +1847,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
bool debug_sdfgi_probes = get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_SDFGI_PROBES;
bool depth_pre_pass = bool(GLOBAL_GET("rendering/driver/depth_prepass/enable")) && depth_framebuffer.is_valid();
- bool using_ssao = depth_pre_pass && rb.is_valid() && p_render_data->environment.is_valid() && environment_get_ssao_enabled(p_render_data->environment);
+ bool using_ssao = depth_pre_pass && !is_reflection_probe && p_render_data->environment.is_valid() && environment_get_ssao_enabled(p_render_data->environment);
bool continue_depth = false;
if (depth_pre_pass) { //depth pre pass
@@ -1881,7 +1879,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
_pre_resolve_render(p_render_data, using_sdfgi || using_voxelgi);
}
- if (rb.is_valid() && rb->get_msaa_3d() != RS::VIEWPORT_MSAA_DISABLED) {
+ if (rb->get_msaa_3d() != RS::VIEWPORT_MSAA_DISABLED) {
RENDER_TIMESTAMP("Resolve Depth Pre-Pass (MSAA)");
RD::get_singleton()->draw_command_begin_label("Resolve Depth Pre-Pass (MSAA)");
if (depth_pass_mode == PASS_MODE_DEPTH_NORMAL_ROUGHNESS || depth_pass_mode == PASS_MODE_DEPTH_NORMAL_ROUGHNESS_VOXEL_GI) {
@@ -1915,7 +1913,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
p_render_data->scene_data->directional_light_count = p_render_data->directional_light_count;
p_render_data->scene_data->opaque_prepass_threshold = 0.0f;
- _setup_environment(p_render_data, p_render_data->reflection_probe.is_valid(), screen_size, !p_render_data->reflection_probe.is_valid(), p_default_bg_color, rb.is_valid());
+ _setup_environment(p_render_data, is_reflection_probe, screen_size, !is_reflection_probe, p_default_bg_color, true);
RENDER_TIMESTAMP("Render Opaque Pass");
@@ -1996,7 +1994,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
RD::get_singleton()->draw_command_end_label();
}
- if (rb.is_valid() && !can_continue_color && rb->get_msaa_3d() != RS::VIEWPORT_MSAA_DISABLED) {
+ if (!can_continue_color && rb->get_msaa_3d() != RS::VIEWPORT_MSAA_DISABLED) {
// Handle views individual, might want to look at rewriting our resolve to do both layers in one pass.
for (uint32_t v = 0; v < rb->get_view_count(); v++) {
RD::get_singleton()->texture_resolve_multisample(rb_data->get_color_msaa(v), rb->get_internal_texture(v));
@@ -2008,7 +2006,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
}
}
- if (rb.is_valid() && !can_continue_depth && rb->get_msaa_3d() != RS::VIEWPORT_MSAA_DISABLED) {
+ if (!can_continue_depth && rb->get_msaa_3d() != RS::VIEWPORT_MSAA_DISABLED) {
for (uint32_t v = 0; v < rb->get_view_count(); v++) {
resolve_effects->resolve_depth(rb_data->get_depth_msaa(v), rb->get_depth_texture(v), rb->get_internal_size(), texture_multisamples[rb->get_msaa_3d()]);
}
@@ -2054,7 +2052,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
rp_uniform_set = _setup_render_pass_uniform_set(RENDER_LIST_ALPHA, p_render_data, radiance_texture, true);
- _setup_environment(p_render_data, p_render_data->reflection_probe.is_valid(), screen_size, !p_render_data->reflection_probe.is_valid(), p_default_bg_color, false);
+ _setup_environment(p_render_data, is_reflection_probe, screen_size, !is_reflection_probe, p_default_bg_color, false);
{
uint32_t transparent_color_pass_flags = (color_pass_flags | COLOR_PASS_FLAG_TRANSPARENT) & ~(COLOR_PASS_FLAG_SEPARATE_SPECULAR);
@@ -2415,8 +2413,7 @@ void RenderForwardClustered::_render_shadow_process() {
void RenderForwardClustered::_render_shadow_end(uint32_t p_barrier) {
RD::get_singleton()->draw_command_begin_label("Shadow Render");
- for (uint32_t i = 0; i < scene_state.shadow_passes.size(); i++) {
- SceneState::ShadowPass &shadow_pass = scene_state.shadow_passes[i];
+ for (SceneState::ShadowPass &shadow_pass : scene_state.shadow_passes) {
RenderListParameters render_list_parameters(render_list[RENDER_LIST_SECONDARY].elements.ptr() + shadow_pass.element_from, render_list[RENDER_LIST_SECONDARY].element_info.ptr() + shadow_pass.element_from, shadow_pass.element_count, shadow_pass.flip_cull, shadow_pass.pass_mode, 0, true, false, shadow_pass.rp_uniform_set, false, Vector2(), shadow_pass.lod_distance_multiplier, shadow_pass.screen_mesh_lod_threshold, 1, shadow_pass.element_from, RD::BARRIER_MASK_NO_BARRIER);
_render_list_with_threads(&render_list_parameters, shadow_pass.framebuffer, RD::INITIAL_ACTION_DROP, RD::FINAL_ACTION_DISCARD, shadow_pass.initial_depth_action, shadow_pass.final_depth_action, Vector<Color>(), 1.0, 0, shadow_pass.rect);
}
@@ -3376,9 +3373,7 @@ int RenderForwardClustered::sdfgi_get_pending_region_count(const Ref<RenderScene
Ref<RendererRD::GI::SDFGI> sdfgi = rb->get_custom_data(RB_SCOPE_SDFGI);
int dirty_count = 0;
- for (uint32_t i = 0; i < sdfgi->cascades.size(); i++) {
- const RendererRD::GI::SDFGI::Cascade &c = sdfgi->cascades[i];
-
+ for (const RendererRD::GI::SDFGI::Cascade &c : sdfgi->cascades) {
if (c.dirty_regions == RendererRD::GI::SDFGI::Cascade::DIRTY_ALL) {
dirty_count++;
} else {
@@ -3771,6 +3766,7 @@ void RenderForwardClustered::_geometry_instance_dependency_changed(Dependency::D
case Dependency::DEPENDENCY_CHANGED_MULTIMESH:
case Dependency::DEPENDENCY_CHANGED_SKELETON_DATA: {
static_cast<RenderGeometryInstance *>(p_tracker->userdata)->_mark_dirty();
+ static_cast<GeometryInstanceForwardClustered *>(p_tracker->userdata)->data->dirty_dependencies = true;
} break;
case Dependency::DEPENDENCY_CHANGED_MULTIMESH_VISIBLE_INSTANCES: {
GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_tracker->userdata);
@@ -3785,6 +3781,7 @@ void RenderForwardClustered::_geometry_instance_dependency_changed(Dependency::D
}
void RenderForwardClustered::_geometry_instance_dependency_deleted(const RID &p_dependency, DependencyTracker *p_tracker) {
static_cast<RenderGeometryInstance *>(p_tracker->userdata)->_mark_dirty();
+ static_cast<GeometryInstanceForwardClustered *>(p_tracker->userdata)->data->dirty_dependencies = true;
}
RenderGeometryInstance *RenderForwardClustered::geometry_instance_create(RID p_base) {
@@ -4007,11 +4004,11 @@ RenderForwardClustered::~RenderForwardClustered() {
RSG::light_storage->directional_shadow_atlas_set_size(0);
{
- for (uint32_t i = 0; i < scene_state.uniform_buffers.size(); i++) {
- RD::get_singleton()->free(scene_state.uniform_buffers[i]);
+ for (const RID &rid : scene_state.uniform_buffers) {
+ RD::get_singleton()->free(rid);
}
- for (uint32_t i = 0; i < scene_state.implementation_uniform_buffers.size(); i++) {
- RD::get_singleton()->free(scene_state.implementation_uniform_buffers[i]);
+ for (const RID &rid : scene_state.implementation_uniform_buffers) {
+ RD::get_singleton()->free(rid);
}
RD::get_singleton()->free(scene_state.lightmap_buffer);
RD::get_singleton()->free(scene_state.lightmap_capture_buffer);
diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
index 412406c0b4..2aaea4288b 100644
--- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
@@ -717,6 +717,8 @@ void SceneShaderForwardClustered::init(const String p_defines) {
actions.global_buffer_array_variable = "global_shader_uniforms.data";
actions.instance_uniform_index_variable = "instances.data[instance_index_interp].instance_uniforms_ofs";
+ actions.check_multiview_samplers = true; // make sure we check sampling multiview textures
+
compiler.initialize(actions);
}
diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp
index 816248567b..7d9ca070b0 100644
--- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp
+++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp
@@ -579,8 +579,8 @@ void RenderForwardMobile::_pre_opaque_render(RenderDataRD *p_render_data) {
}
//cube shadows are rendered in their own way
- for (uint32_t i = 0; i < p_render_data->cube_shadows.size(); i++) {
- _render_shadow_pass(p_render_data->render_shadows[p_render_data->cube_shadows[i]].light, p_render_data->shadow_atlas, p_render_data->render_shadows[p_render_data->cube_shadows[i]].pass, p_render_data->render_shadows[p_render_data->cube_shadows[i]].instances, camera_plane, lod_distance_multiplier, p_render_data->scene_data->screen_mesh_lod_threshold, true, true, true, p_render_data->render_info);
+ for (const int &index : p_render_data->cube_shadows) {
+ _render_shadow_pass(p_render_data->render_shadows[index].light, p_render_data->shadow_atlas, p_render_data->render_shadows[index].pass, p_render_data->render_shadows[index].instances, camera_plane, lod_distance_multiplier, p_render_data->scene_data->screen_mesh_lod_threshold, true, true, true, p_render_data->render_info);
}
if (p_render_data->directional_shadows.size()) {
@@ -632,7 +632,7 @@ void RenderForwardMobile::_pre_opaque_render(RenderDataRD *p_render_data) {
uint32_t directional_light_count = 0;
uint32_t positional_light_count = 0;
light_storage->update_light_buffers(p_render_data, *p_render_data->lights, p_render_data->scene_data->cam_transform, p_render_data->shadow_atlas, using_shadows, directional_light_count, positional_light_count, p_render_data->directional_light_soft_shadows);
- texture_storage->update_decal_buffer(*p_render_data->decals, p_render_data->scene_data->cam_transform.affine_inverse());
+ texture_storage->update_decal_buffer(*p_render_data->decals, p_render_data->scene_data->cam_transform);
p_render_data->directional_light_count = directional_light_count;
}
@@ -640,16 +640,18 @@ void RenderForwardMobile::_pre_opaque_render(RenderDataRD *p_render_data) {
void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color &p_default_bg_color) {
RendererRD::LightStorage *light_storage = RendererRD::LightStorage::get_singleton();
- Ref<RenderSceneBuffersRD> rb;
+ ERR_FAIL_NULL(p_render_data);
+
+ Ref<RenderSceneBuffersRD> rb = p_render_data->render_buffers;
+ ERR_FAIL_COND(rb.is_null());
+
Ref<RenderBufferDataForwardMobile> rb_data;
- if (p_render_data->render_buffers.is_valid()) {
- rb = p_render_data->render_buffers;
- if (rb->has_custom_data(RB_SCOPE_MOBILE)) {
- // Our forward mobile custom data buffer will only be available when we're rendering our normal view.
- // This will not be available when rendering reflection probes.
- rb_data = rb->get_custom_data(RB_SCOPE_MOBILE);
- }
+ if (rb->has_custom_data(RB_SCOPE_MOBILE)) {
+ // Our forward mobile custom data buffer will only be available when we're rendering our normal view.
+ // This will not be available when rendering reflection probes.
+ rb_data = rb->get_custom_data(RB_SCOPE_MOBILE);
}
+ bool is_reflection_probe = p_render_data->reflection_probe.is_valid();
RENDER_TIMESTAMP("Prepare 3D Scene");
@@ -697,7 +699,7 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
p_render_data->render_info->info[RS::VIEWPORT_RENDER_INFO_TYPE_VISIBLE][RS::VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME] = p_render_data->instances->size();
}
- if (p_render_data->reflection_probe.is_valid()) {
+ if (is_reflection_probe) {
uint32_t resolution = light_storage->reflection_probe_instance_get_resolution(p_render_data->reflection_probe);
screen_size.x = resolution;
screen_size.y = resolution;
@@ -754,7 +756,7 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
RD::get_singleton()->draw_command_begin_label("Render Setup");
_setup_lightmaps(p_render_data, *p_render_data->lightmaps, p_render_data->scene_data->cam_transform);
- _setup_environment(p_render_data, p_render_data->reflection_probe.is_valid(), screen_size, !p_render_data->reflection_probe.is_valid(), p_default_bg_color, false);
+ _setup_environment(p_render_data, is_reflection_probe, screen_size, !is_reflection_probe, p_default_bg_color, false);
_update_render_base_uniform_set(); //may have changed due to the above (light buffer enlarged, as an example)
@@ -832,7 +834,7 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
RD::get_singleton()->draw_command_begin_label("Setup Sky");
// Setup our sky render information for this frame/viewport
- if (p_render_data->reflection_probe.is_valid()) {
+ if (is_reflection_probe) {
Vector3 eye_offset;
Projection correction;
correction.set_depth_correction(true);
@@ -896,7 +898,7 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
p_render_data->scene_data->directional_light_count = p_render_data->directional_light_count;
- _setup_environment(p_render_data, p_render_data->reflection_probe.is_valid(), screen_size, !p_render_data->reflection_probe.is_valid(), p_default_bg_color, p_render_data->render_buffers.is_valid());
+ _setup_environment(p_render_data, is_reflection_probe, screen_size, !is_reflection_probe, p_default_bg_color, p_render_data->render_buffers.is_valid());
if (using_subpass_transparent && using_subpass_post_process) {
RENDER_TIMESTAMP("Render Opaque + Transparent + Tonemap");
@@ -1025,7 +1027,7 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
}
// this may be needed if we re-introduced steps that change info, not sure which do so in the previous implementation
- // _setup_environment(p_render_data, p_render_data->reflection_probe.is_valid(), screen_size, !p_render_data->reflection_probe.is_valid(), p_default_bg_color, false);
+ // _setup_environment(p_render_data, is_reflection_probe, screen_size, !is_reflection_probe, p_default_bg_color, false);
RD::FramebufferFormatID fb_format = RD::get_singleton()->framebuffer_get_format(framebuffer);
RenderListParameters render_list_params(render_list[RENDER_LIST_ALPHA].elements.ptr(), render_list[RENDER_LIST_ALPHA].element_info.ptr(), render_list[RENDER_LIST_ALPHA].elements.size(), reverse_cull, PASS_MODE_COLOR, rp_uniform_set, spec_constant_base_flags, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->scene_data->lod_distance_multiplier, p_render_data->scene_data->screen_mesh_lod_threshold, p_render_data->scene_data->view_count);
@@ -1065,9 +1067,7 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
_disable_clear_request(p_render_data);
}
- if (rb.is_valid()) {
- _render_buffers_debug_draw(rb, p_render_data->shadow_atlas, p_render_data->occluder_debug_tex);
- }
+ _render_buffers_debug_draw(rb, p_render_data->shadow_atlas, p_render_data->occluder_debug_tex);
}
/* these are being called from RendererSceneRenderRD::_pre_opaque_render */
@@ -1340,8 +1340,7 @@ void RenderForwardMobile::_render_shadow_process() {
void RenderForwardMobile::_render_shadow_end(uint32_t p_barrier) {
RD::get_singleton()->draw_command_begin_label("Shadow Render");
- for (uint32_t i = 0; i < scene_state.shadow_passes.size(); i++) {
- SceneState::ShadowPass &shadow_pass = scene_state.shadow_passes[i];
+ for (SceneState::ShadowPass &shadow_pass : scene_state.shadow_passes) {
RenderListParameters render_list_parameters(render_list[RENDER_LIST_SECONDARY].elements.ptr() + shadow_pass.element_from, render_list[RENDER_LIST_SECONDARY].element_info.ptr() + shadow_pass.element_from, shadow_pass.element_count, shadow_pass.flip_cull, shadow_pass.pass_mode, shadow_pass.rp_uniform_set, 0, false, Vector2(), shadow_pass.lod_distance_multiplier, shadow_pass.screen_mesh_lod_threshold, 1, shadow_pass.element_from, RD::BARRIER_MASK_NO_BARRIER);
_render_list_with_threads(&render_list_parameters, shadow_pass.framebuffer, RD::INITIAL_ACTION_DROP, RD::FINAL_ACTION_DISCARD, shadow_pass.initial_depth_action, shadow_pass.final_depth_action, Vector<Color>(), 1.0, 0, shadow_pass.rect);
}
@@ -1925,7 +1924,6 @@ void RenderForwardMobile::_fill_render_list(RenderListType p_render_list, const
}
void RenderForwardMobile::_setup_environment(const RenderDataRD *p_render_data, bool p_no_fog, const Size2i &p_screen_size, bool p_flip_y, const Color &p_default_bg_color, bool p_opaque_render_buffers, bool p_pancake_shadows, int p_index) {
- Ref<RenderSceneBuffersRD> rd = p_render_data->render_buffers;
RID env = is_environment(p_render_data->environment) ? p_render_data->environment : RID();
RID reflection_probe_instance = p_render_data->reflection_probe.is_valid() ? RendererRD::LightStorage::get_singleton()->reflection_probe_instance_get_probe(p_render_data->reflection_probe) : RID();
@@ -2238,6 +2236,9 @@ RenderGeometryInstance *RenderForwardMobile::geometry_instance_create(RID p_base
ginstance->data->base = p_base;
ginstance->data->base_type = type;
+ ginstance->data->dependency_tracker.userdata = ginstance;
+ ginstance->data->dependency_tracker.changed_callback = _geometry_instance_dependency_changed;
+ ginstance->data->dependency_tracker.deleted_callback = _geometry_instance_dependency_deleted;
ginstance->_mark_dirty();
@@ -2674,6 +2675,7 @@ void RenderForwardMobile::_geometry_instance_dependency_changed(Dependency::Depe
case Dependency::DEPENDENCY_CHANGED_MULTIMESH:
case Dependency::DEPENDENCY_CHANGED_SKELETON_DATA: {
static_cast<RenderGeometryInstance *>(p_tracker->userdata)->_mark_dirty();
+ static_cast<GeometryInstanceForwardMobile *>(p_tracker->userdata)->data->dirty_dependencies = true;
} break;
case Dependency::DEPENDENCY_CHANGED_MULTIMESH_VISIBLE_INSTANCES: {
GeometryInstanceForwardMobile *ginstance = static_cast<GeometryInstanceForwardMobile *>(p_tracker->userdata);
@@ -2688,6 +2690,7 @@ void RenderForwardMobile::_geometry_instance_dependency_changed(Dependency::Depe
}
void RenderForwardMobile::_geometry_instance_dependency_deleted(const RID &p_dependency, DependencyTracker *p_tracker) {
static_cast<RenderGeometryInstance *>(p_tracker->userdata)->_mark_dirty();
+ static_cast<GeometryInstanceForwardMobile *>(p_tracker->userdata)->data->dirty_dependencies = true;
}
/* misc */
@@ -2810,8 +2813,8 @@ RenderForwardMobile::~RenderForwardMobile() {
}
{
- for (uint32_t i = 0; i < scene_state.uniform_buffers.size(); i++) {
- RD::get_singleton()->free(scene_state.uniform_buffers[i]);
+ for (const RID &rid : scene_state.uniform_buffers) {
+ RD::get_singleton()->free(rid);
}
RD::get_singleton()->free(scene_state.lightmap_buffer);
RD::get_singleton()->free(scene_state.lightmap_capture_buffer);
diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
index 3d1d78c63d..f9eecf4dc7 100644
--- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
+++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
@@ -609,6 +609,7 @@ void SceneShaderForwardMobile::init(const String p_defines) {
actions.instance_uniform_index_variable = "draw_call.instance_uniforms_ofs";
actions.apply_luminance_multiplier = true; // apply luminance multiplier to screen texture
+ actions.check_multiview_samplers = true; // make sure we check sampling multiview textures
compiler.initialize(actions);
}
diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
index 462b925134..bd8c11186e 100644
--- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
@@ -455,7 +455,7 @@ void RendererCanvasRenderRD::_render_item(RD::DrawListID p_draw_list, RID p_rend
light_count++;
- if (light_count == MAX_LIGHTS_PER_ITEM) {
+ if (light_count == MAX_LIGHTS_PER_ITEM - 1) {
break;
}
}
@@ -1431,6 +1431,7 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p
const Item::CommandMesh *cm = static_cast<const Item::CommandMesh *>(c);
if (cm->mesh_instance.is_valid()) {
mesh_storage->mesh_instance_check_for_update(cm->mesh_instance);
+ mesh_storage->mesh_instance_set_canvas_item_transform(cm->mesh_instance, canvas_transform_inverse * ci->final_transform);
update_skeletons = true;
}
}
@@ -1549,6 +1550,9 @@ void RendererCanvasRenderRD::light_set_texture(RID p_rid, RID p_texture) {
if (cl->texture == p_texture) {
return;
}
+
+ ERR_FAIL_COND(p_texture.is_valid() && !texture_storage->owns_texture(p_texture));
+
if (cl->texture.is_valid()) {
texture_storage->texture_remove_from_decal_atlas(cl->texture);
}
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
index 2a87c4fa8d..885ea18151 100644
--- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
@@ -253,6 +253,11 @@ void RendererSceneRenderRD::_render_buffers_copy_screen_texture(const RenderData
Ref<RenderSceneBuffersRD> rb = p_render_data->render_buffers;
ERR_FAIL_COND(rb.is_null());
+ if (!rb->has_internal_texture()) {
+ // We're likely rendering reflection probes where we can't use our backbuffers.
+ return;
+ }
+
RD::get_singleton()->draw_command_begin_label("Copy screen texture");
rb->allocate_blur_textures();
@@ -292,6 +297,11 @@ void RendererSceneRenderRD::_render_buffers_copy_depth_texture(const RenderDataR
Ref<RenderSceneBuffersRD> rb = p_render_data->render_buffers;
ERR_FAIL_COND(rb.is_null());
+ if (!rb->has_depth_texture()) {
+ // We're likely rendering reflection probes where we can't use our backbuffers.
+ return;
+ }
+
RD::get_singleton()->draw_command_begin_label("Copy depth texture");
// note, this only creates our back depth texture if we haven't already created it.
@@ -321,9 +331,13 @@ void RendererSceneRenderRD::_render_buffers_copy_depth_texture(const RenderDataR
void RendererSceneRenderRD::_render_buffers_post_process_and_tonemap(const RenderDataRD *p_render_data) {
RendererRD::TextureStorage *texture_storage = RendererRD::TextureStorage::get_singleton();
+ ERR_FAIL_NULL(p_render_data);
+
Ref<RenderSceneBuffersRD> rb = p_render_data->render_buffers;
ERR_FAIL_COND(rb.is_null());
+ ERR_FAIL_COND_MSG(p_render_data->reflection_probe.is_valid(), "Post processes should not be applied on reflection probes.");
+
// Glow, auto exposure and DoF (if enabled).
Size2i internal_size = rb->get_internal_size();
@@ -918,11 +932,9 @@ void RendererSceneRenderRD::render_scene(const Ref<RenderSceneBuffers> &p_render
RendererRD::TextureStorage *texture_storage = RendererRD::TextureStorage::get_singleton();
// getting this here now so we can direct call a bunch of things more easily
- Ref<RenderSceneBuffersRD> rb;
- if (p_render_buffers.is_valid()) {
- rb = p_render_buffers; // cast it...
- ERR_FAIL_COND(rb.is_null());
- }
+ ERR_FAIL_COND(p_render_buffers.is_null());
+ Ref<RenderSceneBuffersRD> rb = p_render_buffers;
+ ERR_FAIL_COND(rb.is_null());
// setup scene data
RenderSceneDataRD scene_data;
diff --git a/servers/rendering/renderer_rd/shader_rd.cpp b/servers/rendering/renderer_rd/shader_rd.cpp
index 2d5263a3e2..533a912a34 100644
--- a/servers/rendering/renderer_rd/shader_rd.cpp
+++ b/servers/rendering/renderer_rd/shader_rd.cpp
@@ -165,8 +165,7 @@ void ShaderRD::_clear_version(Version *p_version) {
}
void ShaderRD::_build_variant_code(StringBuilder &builder, uint32_t p_variant, const Version *p_version, const StageTemplate &p_template) {
- for (uint32_t i = 0; i < p_template.chunks.size(); i++) {
- const StageTemplate::Chunk &chunk = p_template.chunks[i];
+ for (const StageTemplate::Chunk &chunk : p_template.chunks) {
switch (chunk.type) {
case StageTemplate::Chunk::TYPE_VERSION_DEFINES: {
builder.append("\n"); //make sure defines begin at newline
diff --git a/servers/rendering/renderer_rd/shaders/effects/ss_effects_downsample.glsl b/servers/rendering/renderer_rd/shaders/effects/ss_effects_downsample.glsl
index 134aae5ce7..b1ff46dd3b 100644
--- a/servers/rendering/renderer_rd/shaders/effects/ss_effects_downsample.glsl
+++ b/servers/rendering/renderer_rd/shaders/effects/ss_effects_downsample.glsl
@@ -56,7 +56,7 @@ vec4 screen_space_to_view_space_depth(vec4 p_depth) {
float depth_linearize_mul = params.z_near;
float depth_linearize_add = params.z_far;
- // Optimised version of "-cameraClipNear / (cameraClipFar - projDepth * (cameraClipFar - cameraClipNear)) * cameraClipFar"
+ // Optimized version of "-cameraClipNear / (cameraClipFar - projDepth * (cameraClipFar - cameraClipNear)) * cameraClipFar"
// Set your depth_linearize_mul and depth_linearize_add to:
// depth_linearize_mul = ( cameraClipFar * cameraClipNear) / ( cameraClipFar - cameraClipNear );
diff --git a/servers/rendering/renderer_rd/shaders/effects/ssao.glsl b/servers/rendering/renderer_rd/shaders/effects/ssao.glsl
index 2a87e273bc..ffaa6872c9 100644
--- a/servers/rendering/renderer_rd/shaders/effects/ssao.glsl
+++ b/servers/rendering/renderer_rd/shaders/effects/ssao.glsl
@@ -221,7 +221,7 @@ void SSAOTap(const int p_quality_level, inout float r_obscurance_sum, inout floa
// snap to pixel center (more correct obscurance math, avoids artifacts)
sample_offset = round(sample_offset);
- // calculate MIP based on the sample distance from the centre, similar to as described
+ // calculate MIP based on the sample distance from the center, similar to as described
// in http://graphics.cs.williams.edu/papers/SAOHPG12/.
float mip_level = (p_quality_level < SSAO_DEPTH_MIPS_ENABLE_AT_QUALITY_PRESET) ? (0) : (sample_pow_2_len + p_mip_offset);
@@ -259,7 +259,7 @@ void generate_SSAO_shadows_internal(out float r_shadow_term, out vec4 r_edges, o
// get this pixel's viewspace depth
pix_z = valuesUL.y;
- // get left right top bottom neighbouring pixels for edge detection (gets compiled out on quality_level == 0)
+ // get left right top bottom neighboring pixels for edge detection (gets compiled out on quality_level == 0)
pix_left_z = valuesUL.x;
pix_top_z = valuesUL.z;
pix_right_z = valuesBR.z;
@@ -304,7 +304,7 @@ void generate_SSAO_shadows_internal(out float r_shadow_term, out vec4 r_edges, o
float obscurance_sum = 0.0;
float weight_sum = 0.0;
- // edge mask for between this and left/right/top/bottom neighbour pixels - not used in quality level 0 so initialize to "no edge" (1 is no edge, 0 is edge)
+ // edge mask for between this and left/right/top/bottom neighbor pixels - not used in quality level 0 so initialize to "no edge" (1 is no edge, 0 is edge)
vec4 edgesLRTB = vec4(1.0, 1.0, 1.0, 1.0);
// Move center pixel slightly towards camera to avoid imprecision artifacts due to using of 16bit depth buffer; a lot smaller offsets needed when using 32bit floats
@@ -318,7 +318,7 @@ void generate_SSAO_shadows_internal(out float r_shadow_term, out vec4 r_edges, o
if (!p_adaptive_base && (p_quality_level >= SSAO_DETAIL_AO_ENABLE_AT_QUALITY_PRESET)) {
// disable in case of quality level 4 (reference)
if (p_quality_level != 4) {
- //approximate neighbouring pixels positions (actually just deltas or "positions - pix_center_pos" )
+ //approximate neighboring pixels positions (actually just deltas or "positions - pix_center_pos" )
vec3 normalized_viewspace_dir = vec3(pix_center_pos.xy / pix_center_pos.zz, 1.0);
vec3 pixel_left_delta = vec3(-pixel_size_at_center.x, 0.0, 0.0) + normalized_viewspace_dir * (pix_left_z - pix_center_pos.z);
vec3 pixel_right_delta = vec3(+pixel_size_at_center.x, 0.0, 0.0) + normalized_viewspace_dir * (pix_right_z - pix_center_pos.z);
diff --git a/servers/rendering/renderer_rd/shaders/effects/ssao_importance_map.glsl b/servers/rendering/renderer_rd/shaders/effects/ssao_importance_map.glsl
index 04f98964e8..d234ab4417 100644
--- a/servers/rendering/renderer_rd/shaders/effects/ssao_importance_map.glsl
+++ b/servers/rendering/renderer_rd/shaders/effects/ssao_importance_map.glsl
@@ -80,7 +80,7 @@ void main() {
#ifdef PROCESS_MAPA
vec2 uv = (vec2(ssC) + 0.5f) * params.half_screen_pixel_size * 2.0;
- float centre = textureLod(source_importance, uv, 0.0).x;
+ float center = textureLod(source_importance, uv, 0.0).x;
vec2 half_pixel = params.half_screen_pixel_size;
@@ -98,7 +98,7 @@ void main() {
#ifdef PROCESS_MAPB
vec2 uv = (vec2(ssC) + 0.5f) * params.half_screen_pixel_size * 2.0;
- float centre = textureLod(source_importance, uv, 0.0).x;
+ float center = textureLod(source_importance, uv, 0.0).x;
vec2 half_pixel = params.half_screen_pixel_size;
diff --git a/servers/rendering/renderer_rd/shaders/effects/ssao_interleave.glsl b/servers/rendering/renderer_rd/shaders/effects/ssao_interleave.glsl
index f6a9a92fac..45cc62d361 100644
--- a/servers/rendering/renderer_rd/shaders/effects/ssao_interleave.glsl
+++ b/servers/rendering/renderer_rd/shaders/effects/ssao_interleave.glsl
@@ -60,8 +60,8 @@ void main() {
int mx = int(pix_pos.x % 2);
int my = int(pix_pos.y % 2);
int index_center = mx + my * 2; // center index
- int index_horizontal = (1 - mx) + my * 2; // neighbouring, horizontal
- int index_vertical = mx + (1 - my) * 2; // neighbouring, vertical
+ int index_horizontal = (1 - mx) + my * 2; // neighboring, horizontal
+ int index_vertical = mx + (1 - my) * 2; // neighboring, vertical
int index_diagonal = (1 - mx) + (1 - my) * 2; // diagonal
vec2 center_val = texelFetch(source_texture, ivec3(pix_pos / uvec2(params.size_modifier), index_center), 0).xy;
diff --git a/servers/rendering/renderer_rd/shaders/effects/ssil.glsl b/servers/rendering/renderer_rd/shaders/effects/ssil.glsl
index 513791dfbf..de7b97953f 100644
--- a/servers/rendering/renderer_rd/shaders/effects/ssil.glsl
+++ b/servers/rendering/renderer_rd/shaders/effects/ssil.glsl
@@ -234,7 +234,7 @@ void SSILTap(const int p_quality_level, inout vec3 r_color_sum, inout float r_ob
// snap to pixel center (more correct obscurance math, avoids artifacts)
sample_offset = round(sample_offset);
- // calculate MIP based on the sample distance from the centre, similar to as described
+ // calculate MIP based on the sample distance from the center, similar to as described
// in http://graphics.cs.williams.edu/papers/SAOHPG12/.
float mip_level = (p_quality_level < SSIL_DEPTH_MIPS_ENABLE_AT_QUALITY_PRESET) ? (0) : (sample_pow_2_len + p_mip_offset);
@@ -272,7 +272,7 @@ void generate_SSIL(out vec3 r_color, out vec4 r_edges, out float r_obscurance, o
// get this pixel's viewspace depth
pix_z = valuesUL.y;
- // get left right top bottom neighbouring pixels for edge detection (gets compiled out on quality_level == 0)
+ // get left right top bottom neighboring pixels for edge detection (gets compiled out on quality_level == 0)
pix_left_z = valuesUL.x;
pix_top_z = valuesUL.z;
pix_right_z = valuesBR.z;
@@ -318,7 +318,7 @@ void generate_SSIL(out vec3 r_color, out vec4 r_edges, out float r_obscurance, o
float obscurance_sum = 0.0;
float weight_sum = 0.0;
- // edge mask for between this and left/right/top/bottom neighbour pixels - not used in quality level 0 so initialize to "no edge" (1 is no edge, 0 is edge)
+ // edge mask for between this and left/right/top/bottom neighbor pixels - not used in quality level 0 so initialize to "no edge" (1 is no edge, 0 is edge)
vec4 edgesLRTB = vec4(1.0, 1.0, 1.0, 1.0);
// Move center pixel slightly towards camera to avoid imprecision artifacts due to using of 16bit depth buffer; a lot smaller offsets needed when using 32bit floats
diff --git a/servers/rendering/renderer_rd/shaders/effects/ssil_blur.glsl b/servers/rendering/renderer_rd/shaders/effects/ssil_blur.glsl
index 47c56571f6..f48e6c4341 100644
--- a/servers/rendering/renderer_rd/shaders/effects/ssil_blur.glsl
+++ b/servers/rendering/renderer_rd/shaders/effects/ssil_blur.glsl
@@ -124,14 +124,14 @@ void main() {
vec2 uv = (vec2(gl_GlobalInvocationID.xy) + vec2(0.5, 0.5)) * params.half_screen_pixel_size;
- vec4 centre = textureLod(source_ssil, uv, 0.0);
+ vec4 center = textureLod(source_ssil, uv, 0.0);
vec4 value = textureLod(source_ssil, vec2(uv + vec2(-half_pixel.x * 3, -half_pixel.y)), 0.0) * 0.2;
value += textureLod(source_ssil, vec2(uv + vec2(+half_pixel.x, -half_pixel.y * 3)), 0.0) * 0.2;
value += textureLod(source_ssil, vec2(uv + vec2(-half_pixel.x, +half_pixel.y * 3)), 0.0) * 0.2;
value += textureLod(source_ssil, vec2(uv + vec2(+half_pixel.x * 3, +half_pixel.y)), 0.0) * 0.2;
- vec4 sampled = value + centre * 0.2;
+ vec4 sampled = value + center * 0.2;
#else
#ifdef MODE_SMART
diff --git a/servers/rendering/renderer_rd/shaders/effects/ssil_importance_map.glsl b/servers/rendering/renderer_rd/shaders/effects/ssil_importance_map.glsl
index 6b6b02739d..193e3458ab 100644
--- a/servers/rendering/renderer_rd/shaders/effects/ssil_importance_map.glsl
+++ b/servers/rendering/renderer_rd/shaders/effects/ssil_importance_map.glsl
@@ -82,7 +82,7 @@ void main() {
#ifdef PROCESS_MAPA
vec2 uv = (vec2(ssC) + 0.5) * params.half_screen_pixel_size * 2.0;
- float centre = textureLod(source_importance, uv, 0.0).x;
+ float center = textureLod(source_importance, uv, 0.0).x;
vec2 half_pixel = params.half_screen_pixel_size;
@@ -100,7 +100,7 @@ void main() {
#ifdef PROCESS_MAPB
vec2 uv = (vec2(ssC) + 0.5f) * params.half_screen_pixel_size * 2.0;
- float centre = textureLod(source_importance, uv, 0.0).x;
+ float center = textureLod(source_importance, uv, 0.0).x;
vec2 half_pixel = params.half_screen_pixel_size;
diff --git a/servers/rendering/renderer_rd/shaders/effects/ssil_interleave.glsl b/servers/rendering/renderer_rd/shaders/effects/ssil_interleave.glsl
index 9e86ac0cf0..ed85b8ee4c 100644
--- a/servers/rendering/renderer_rd/shaders/effects/ssil_interleave.glsl
+++ b/servers/rendering/renderer_rd/shaders/effects/ssil_interleave.glsl
@@ -62,8 +62,8 @@ void main() {
int mx = int(pix_pos.x % 2);
int my = int(pix_pos.y % 2);
int index_center = mx + my * 2; // center index
- int index_horizontal = (1 - mx) + my * 2; // neighbouring, horizontal
- int index_vertical = mx + (1 - my) * 2; // neighbouring, vertical
+ int index_horizontal = (1 - mx) + my * 2; // neighboring, horizontal
+ int index_vertical = mx + (1 - my) * 2; // neighboring, vertical
int index_diagonal = (1 - mx) + (1 - my) * 2; // diagonal
vec4 color = texelFetch(source_texture, ivec3(pix_pos / uvec2(params.size_modifier), index_center), 0);
diff --git a/servers/rendering/renderer_rd/shaders/environment/sdfgi_direct_light.glsl b/servers/rendering/renderer_rd/shaders/environment/sdfgi_direct_light.glsl
index 9f7449b8aa..06709f65d3 100644
--- a/servers/rendering/renderer_rd/shaders/environment/sdfgi_direct_light.glsl
+++ b/servers/rendering/renderer_rd/shaders/environment/sdfgi_direct_light.glsl
@@ -24,7 +24,7 @@ struct ProcessVoxel {
uint albedo; // rgb bits 0-15 albedo, bits 16-21 are normal bits (set if geometry exists toward that side), extra 11 bits for neighbors.
uint light; // rgbe8985 encoded total saved light, extra 2 bits for neighbors.
uint light_aniso; // 55555 light anisotropy, extra 2 bits for neighbors.
- //total neighbours: 26
+ //total neighbors: 26
};
#ifdef MODE_PROCESS_STATIC
@@ -443,10 +443,10 @@ void main() {
imageStore(dst_aniso1, positioni, vec4(aniso1, 0.0, 0.0));
imageStore(dst_light, positioni, uvec4(light_total_rgbe));
- //also fill neighbours, so light interpolation during the indirect pass works
+ //also fill neighbors, so light interpolation during the indirect pass works
- //recover the neighbour list from the leftover bits
- uint neighbours = (voxel_albedo >> 21) | ((voxel_position >> 21) << 11) | ((process_voxels.data[voxel_index].light >> 30) << 22) | ((process_voxels.data[voxel_index].light_aniso >> 30) << 24);
+ //recover the neighbor list from the leftover bits
+ uint neighbors = (voxel_albedo >> 21) | ((voxel_position >> 21) << 11) | ((process_voxels.data[voxel_index].light >> 30) << 22) | ((process_voxels.data[voxel_index].light_aniso >> 30) << 24);
const uint max_neighbours = 26;
const ivec3 neighbour_positions[max_neighbours] = ivec3[](
@@ -478,7 +478,7 @@ void main() {
ivec3(1, 1, 1));
for (uint i = 0; i < max_neighbours; i++) {
- if (bool(neighbours & (1 << i))) {
+ if (bool(neighbors & (1 << i))) {
ivec3 neighbour_pos = positioni + neighbour_positions[i];
imageStore(dst_light, neighbour_pos, uvec4(light_total_rgbe));
imageStore(dst_aniso0, neighbour_pos, aniso0);
diff --git a/servers/rendering/renderer_rd/shaders/environment/sdfgi_preprocess.glsl b/servers/rendering/renderer_rd/shaders/environment/sdfgi_preprocess.glsl
index bce98f4054..dd35ae3b73 100644
--- a/servers/rendering/renderer_rd/shaders/environment/sdfgi_preprocess.glsl
+++ b/servers/rendering/renderer_rd/shaders/environment/sdfgi_preprocess.glsl
@@ -102,10 +102,10 @@ dispatch_data;
struct ProcessVoxel {
uint position; // xyz 7 bit packed, extra 11 bits for neighbors.
- uint albedo; //rgb bits 0-15 albedo, bits 16-21 are normal bits (set if geometry exists toward that side), extra 11 bits for neighbours
- uint light; //rgbe8985 encoded total saved light, extra 2 bits for neighbours
- uint light_aniso; //55555 light anisotropy, extra 2 bits for neighbours
- //total neighbours: 26
+ uint albedo; //rgb bits 0-15 albedo, bits 16-21 are normal bits (set if geometry exists toward that side), extra 11 bits for neighbors
+ uint light; //rgbe8985 encoded total saved light, extra 2 bits for neighbors
+ uint light_aniso; //55555 light anisotropy, extra 2 bits for neighbors
+ //total neighbors: 26
};
layout(set = 0, binding = 11, std430) restrict buffer writeonly ProcessVoxels {
@@ -135,10 +135,10 @@ dispatch_data;
struct ProcessVoxel {
uint position; // xyz 7 bit packed, extra 11 bits for neighbors.
- uint albedo; //rgb bits 0-15 albedo, bits 16-21 are normal bits (set if geometry exists toward that side), extra 11 bits for neighbours
- uint light; //rgbe8985 encoded total saved light, extra 2 bits for neighbours
- uint light_aniso; //55555 light anisotropy, extra 2 bits for neighbours
- //total neighbours: 26
+ uint albedo; //rgb bits 0-15 albedo, bits 16-21 are normal bits (set if geometry exists toward that side), extra 11 bits for neighbors
+ uint light; //rgbe8985 encoded total saved light, extra 2 bits for neighbors
+ uint light_aniso; //55555 light anisotropy, extra 2 bits for neighbors
+ //total neighbors: 26
};
layout(set = 0, binding = 6, std430) restrict buffer readonly ProcessVoxels {
@@ -1016,14 +1016,14 @@ void main() {
store_positions[index].albedo = rgb >> 1; //store as it comes (555) to avoid precision loss (and move away the alpha bit)
store_positions[index].albedo |= (facing & 0x3F) << 15; // store facing in bits 15-21
- store_positions[index].albedo |= neighbour_bits << 21; //store lower 11 bits of neighbours with remaining albedo
- store_positions[index].position |= (neighbour_bits >> 11) << 21; //store 11 bits more of neighbours with position
+ store_positions[index].albedo |= neighbour_bits << 21; //store lower 11 bits of neighbors with remaining albedo
+ store_positions[index].position |= (neighbour_bits >> 11) << 21; //store 11 bits more of neighbors with position
store_positions[index].light = imageLoad(src_light, pos).r;
store_positions[index].light_aniso = imageLoad(src_light_aniso, pos).r;
- //add neighbours
- store_positions[index].light |= (neighbour_bits >> 22) << 30; //store 2 bits more of neighbours with light
- store_positions[index].light_aniso |= (neighbour_bits >> 24) << 30; //store 2 bits more of neighbours with aniso
+ //add neighbors
+ store_positions[index].light |= (neighbour_bits >> 22) << 30; //store 2 bits more of neighbors with light
+ store_positions[index].light_aniso |= (neighbour_bits >> 24) << 30; //store 2 bits more of neighbors with aniso
}
groupMemoryBarrier();
diff --git a/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl
index d32e6d717f..c6a3c42e57 100644
--- a/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl
+++ b/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl
@@ -118,13 +118,13 @@ layout(location = 10) out flat uint instance_index_interp;
// !BAS! This needs to become an input once we implement our fallback!
#define ViewIndex 0
#endif // has_VK_KHR_multiview
-vec3 normal_roughness_uv(vec2 uv) {
+vec3 multiview_uv(vec2 uv) {
return vec3(uv, ViewIndex);
}
#else // USE_MULTIVIEW
// Set to zero, not supported in non stereo
#define ViewIndex 0
-vec2 normal_roughness_uv(vec2 uv) {
+vec2 multiview_uv(vec2 uv) {
return uv;
}
#endif //USE_MULTIVIEW
@@ -550,13 +550,13 @@ layout(location = 10) in flat uint instance_index_interp;
// !BAS! This needs to become an input once we implement our fallback!
#define ViewIndex 0
#endif // has_VK_KHR_multiview
-vec3 normal_roughness_uv(vec2 uv) {
+vec3 multiview_uv(vec2 uv) {
return vec3(uv, ViewIndex);
}
#else // USE_MULTIVIEW
// Set to zero, not supported in non stereo
#define ViewIndex 0
-vec2 normal_roughness_uv(vec2 uv) {
+vec2 multiview_uv(vec2 uv) {
return uv;
}
#endif //USE_MULTIVIEW
@@ -1305,24 +1305,26 @@ void fragment_shader(in SceneData scene_data) {
}
if (sc_use_forward_gi && bool(instances.data[instance_index].flags & INSTANCE_FLAGS_USE_VOXEL_GI)) { // process voxel_gi_instances
-
uint index1 = instances.data[instance_index].gi_offset & 0xFFFF;
- vec3 ref_vec = normalize(reflect(-view, normal));
- ref_vec = mix(ref_vec, normal, roughness * roughness);
+ // Make vertex orientation the world one, but still align to camera.
+ vec3 cam_pos = mat3(scene_data.inv_view_matrix) * vertex;
+ vec3 cam_normal = mat3(scene_data.inv_view_matrix) * normal;
+ vec3 ref_vec = mat3(scene_data.inv_view_matrix) * normalize(reflect(-view, normal));
+
//find arbitrary tangent and bitangent, then build a matrix
- vec3 v0 = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(0.0, 1.0, 0.0);
- vec3 tangent = normalize(cross(v0, normal));
- vec3 bitangent = normalize(cross(tangent, normal));
- mat3 normal_mat = mat3(tangent, bitangent, normal);
+ vec3 v0 = abs(cam_normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(0.0, 1.0, 0.0);
+ vec3 tangent = normalize(cross(v0, cam_normal));
+ vec3 bitangent = normalize(cross(tangent, cam_normal));
+ mat3 normal_mat = mat3(tangent, bitangent, cam_normal);
vec4 amb_accum = vec4(0.0);
vec4 spec_accum = vec4(0.0);
- voxel_gi_compute(index1, vertex, normal, ref_vec, normal_mat, roughness * roughness, ambient_light, specular_light, spec_accum, amb_accum);
+ voxel_gi_compute(index1, cam_pos, cam_normal, ref_vec, normal_mat, roughness * roughness, ambient_light, specular_light, spec_accum, amb_accum);
uint index2 = instances.data[instance_index].gi_offset >> 16;
if (index2 != 0xFFFF) {
- voxel_gi_compute(index2, vertex, normal, ref_vec, normal_mat, roughness * roughness, ambient_light, specular_light, spec_accum, amb_accum);
+ voxel_gi_compute(index2, cam_pos, cam_normal, ref_vec, normal_mat, roughness * roughness, ambient_light, specular_light, spec_accum, amb_accum);
}
if (amb_accum.a > 0.0) {
@@ -1351,8 +1353,8 @@ void fragment_shader(in SceneData scene_data) {
#endif // USE_MULTIVIEW
for (int i = 0; i < 4; i++) {
- const vec2 neighbours[4] = vec2[](vec2(-1, 0), vec2(1, 0), vec2(0, -1), vec2(0, 1));
- vec2 neighbour_coord = base_coord + neighbours[i] * scene_data.screen_pixel_size;
+ const vec2 neighbors[4] = vec2[](vec2(-1, 0), vec2(1, 0), vec2(0, -1), vec2(0, 1));
+ vec2 neighbour_coord = base_coord + neighbors[i] * scene_data.screen_pixel_size;
#ifdef USE_MULTIVIEW
float neighbour_ang = dot(normal, textureLod(sampler2DArray(normal_roughness_buffer, material_samplers[SAMPLER_LINEAR_CLAMP]), vec3(neighbour_coord, ViewIndex), 0.0).xyz * 2.0 - 1.0);
#else // USE_MULTIVIEW
@@ -1798,7 +1800,7 @@ void fragment_shader(in SceneData scene_data) {
shadow = float(shadow1 >> ((i - 4u) * 8u) & 0xFFu) / 255.0;
}
- shadow = shadow * directional_lights.data[i].shadow_opacity + 1.0 - directional_lights.data[i].shadow_opacity;
+ shadow = mix(1.0, shadow, directional_lights.data[i].shadow_opacity);
#endif
blur_shadow(shadow);
@@ -2082,7 +2084,7 @@ void fragment_shader(in SceneData scene_data) {
float sRed = floor((cRed / pow(2.0f, exps - B - N)) + 0.5f);
float sGreen = floor((cGreen / pow(2.0f, exps - B - N)) + 0.5f);
float sBlue = floor((cBlue / pow(2.0f, exps - B - N)) + 0.5f);
- //store as 8985 to have 2 extra neighbour bits
+ //store as 8985 to have 2 extra neighbor bits
uint light_rgbe = ((uint(sRed) & 0x1FFu) >> 1) | ((uint(sGreen) & 0x1FFu) << 8) | (((uint(sBlue) & 0x1FFu) >> 1) << 17) | ((uint(exps) & 0x1Fu) << 25);
imageStore(emission_grid, grid_pos, uvec4(light_rgbe));
diff --git a/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered_inc.glsl b/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered_inc.glsl
index 1f524313f2..8ff7a784dc 100644
--- a/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered_inc.glsl
+++ b/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered_inc.glsl
@@ -271,15 +271,16 @@ layout(r32ui, set = 1, binding = 13) uniform restrict uimage3D geom_facing_grid;
#define multiviewSampler sampler2D
#else
-layout(set = 1, binding = 10) uniform texture2D depth_buffer;
-layout(set = 1, binding = 11) uniform texture2D color_buffer;
-
#ifdef USE_MULTIVIEW
+layout(set = 1, binding = 10) uniform texture2DArray depth_buffer;
+layout(set = 1, binding = 11) uniform texture2DArray color_buffer;
layout(set = 1, binding = 12) uniform texture2DArray normal_roughness_buffer;
layout(set = 1, binding = 14) uniform texture2DArray ambient_buffer;
layout(set = 1, binding = 15) uniform texture2DArray reflection_buffer;
#define multiviewSampler sampler2DArray
#else // USE_MULTIVIEW
+layout(set = 1, binding = 10) uniform texture2D depth_buffer;
+layout(set = 1, binding = 11) uniform texture2D color_buffer;
layout(set = 1, binding = 12) uniform texture2D normal_roughness_buffer;
layout(set = 1, binding = 14) uniform texture2D ambient_buffer;
layout(set = 1, binding = 15) uniform texture2D reflection_buffer;
diff --git a/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl b/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl
index 5e64d4e651..90e902ca33 100644
--- a/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl
+++ b/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl
@@ -112,9 +112,15 @@ layout(location = 9) out highp float dp_clip;
// !BAS! This needs to become an input once we implement our fallback!
#define ViewIndex 0
#endif
+vec3 multiview_uv(vec2 uv) {
+ return vec3(uv, ViewIndex);
+}
#else
// Set to zero, not supported in non stereo
#define ViewIndex 0
+vec2 multiview_uv(vec2 uv) {
+ return uv;
+}
#endif //USE_MULTIVIEW
invariant gl_Position;
@@ -523,9 +529,15 @@ layout(location = 9) highp in float dp_clip;
// !BAS! This needs to become an input once we implement our fallback!
#define ViewIndex 0
#endif
+vec3 multiview_uv(vec2 uv) {
+ return vec3(uv, ViewIndex);
+}
#else
// Set to zero, not supported in non stereo
#define ViewIndex 0
+vec2 multiview_uv(vec2 uv) {
+ return uv;
+}
#endif //USE_MULTIVIEW
//defines to keep compatibility with vertex
@@ -1515,6 +1527,8 @@ void main() {
} else {
shadow = float(shadow1 >> ((i - 4) * 8) & 0xFF) / 255.0;
}
+
+ shadow = mix(1.0, shadow, directional_lights.data[i].shadow_opacity);
#endif
blur_shadow(shadow);
diff --git a/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile_inc.glsl b/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile_inc.glsl
index 631ff0575b..78b39a356d 100644
--- a/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile_inc.glsl
+++ b/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile_inc.glsl
@@ -154,8 +154,15 @@ layout(set = 1, binding = 5) uniform highp texture2D directional_shadow_atlas;
// this needs to change to providing just the lightmap we're using..
layout(set = 1, binding = 6) uniform texture2DArray lightmap_textures[MAX_LIGHTMAP_TEXTURES];
+#ifdef USE_MULTIVIEW
+layout(set = 1, binding = 9) uniform highp texture2DArray depth_buffer;
+layout(set = 1, binding = 10) uniform mediump texture2DArray color_buffer;
+#define multiviewSampler sampler2DArray
+#else
layout(set = 1, binding = 9) uniform highp texture2D depth_buffer;
layout(set = 1, binding = 10) uniform mediump texture2D color_buffer;
+#define multiviewSampler sampler2D
+#endif // USE_MULTIVIEW
/* Set 2 Skeleton & Instancing (can change per item) */
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl
index b30b0c8169..9dda62c28d 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl
@@ -794,8 +794,13 @@ void light_process_spot(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v
float light_length = length(light_rel_vec);
float spot_attenuation = get_omni_attenuation(light_length, spot_lights.data[idx].inv_radius, spot_lights.data[idx].attenuation);
vec3 spot_dir = spot_lights.data[idx].direction;
- float scos = max(dot(-normalize(light_rel_vec), spot_dir), spot_lights.data[idx].cone_angle);
- float spot_rim = max(0.0001, (1.0 - scos) / (1.0 - spot_lights.data[idx].cone_angle));
+
+ // This conversion to a highp float is crucial to prevent light leaking
+ // due to precision errors in the following calculations (cone angle is mediump).
+ highp float cone_angle = spot_lights.data[idx].cone_angle;
+ float scos = max(dot(-normalize(light_rel_vec), spot_dir), cone_angle);
+ float spot_rim = max(0.0001, (1.0 - scos) / (1.0 - cone_angle));
+
spot_attenuation *= 1.0 - pow(spot_rim, spot_lights.data[idx].cone_attenuation);
float light_attenuation = spot_attenuation;
vec3 color = spot_lights.data[idx].color;
diff --git a/servers/rendering/renderer_rd/shaders/skeleton.glsl b/servers/rendering/renderer_rd/shaders/skeleton.glsl
index f5b233cca0..59c161548c 100644
--- a/servers/rendering/renderer_rd/shaders/skeleton.glsl
+++ b/servers/rendering/renderer_rd/shaders/skeleton.glsl
@@ -51,6 +51,15 @@ layout(push_constant, std430) uniform Params {
bool normalized_blend_shapes;
uint pad0;
uint pad1;
+
+ vec2 skeleton_transform_x;
+ vec2 skeleton_transform_y;
+
+ vec2 skeleton_transform_offset;
+ vec2 inverse_transform_x;
+
+ vec2 inverse_transform_y;
+ vec2 inverse_transform_offset;
}
params;
@@ -158,8 +167,12 @@ void main() {
m += mat4(bone_transforms.data[bones_23.x], bone_transforms.data[bones_23.x + 1], vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0)) * weights_23.x;
m += mat4(bone_transforms.data[bones_23.y], bone_transforms.data[bones_23.y + 1], vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0)) * weights_23.y;
- //reverse order because its transposed
- vertex = (vec4(vertex, 0.0, 1.0) * m).xy;
+ mat4 skeleton_matrix = mat4(vec4(params.skeleton_transform_x, 0.0, 0.0), vec4(params.skeleton_transform_y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(params.skeleton_transform_offset, 0.0, 1.0));
+ mat4 inverse_matrix = mat4(vec4(params.inverse_transform_x, 0.0, 0.0), vec4(params.inverse_transform_y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(params.inverse_transform_offset, 0.0, 1.0));
+
+ m = skeleton_matrix * transpose(m) * inverse_matrix;
+
+ vertex = (m * vec4(vertex, 0.0, 1.0)).xy;
}
uint dst_offset = index * params.vertex_stride;
diff --git a/servers/rendering/renderer_rd/storage_rd/light_storage.cpp b/servers/rendering/renderer_rd/storage_rd/light_storage.cpp
index 673fc25595..f56cee9e12 100644
--- a/servers/rendering/renderer_rd/storage_rd/light_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/light_storage.cpp
@@ -232,6 +232,8 @@ void LightStorage::light_set_projector(RID p_light, RID p_texture) {
return;
}
+ ERR_FAIL_COND(p_texture.is_valid() && !texture_storage->owns_texture(p_texture));
+
if (light->type != RS::LIGHT_DIRECTIONAL && light->projector.is_valid()) {
texture_storage->texture_remove_from_decal_atlas(light->projector, light->type == RS::LIGHT_OMNI);
}
@@ -568,8 +570,6 @@ void LightStorage::update_light_buffers(RenderDataRD *p_render_data, const Paged
r_directional_light_count = 0;
r_positional_light_count = 0;
- Plane camera_plane(-p_camera_transform.basis.get_column(Vector3::AXIS_Z).normalized(), p_camera_transform.origin);
-
omni_light_count = 0;
spot_light_count = 0;
@@ -720,7 +720,7 @@ void LightStorage::update_light_buffers(RenderDataRD *p_render_data, const Paged
}
Transform3D light_transform = light_instance->transform;
- const real_t distance = camera_plane.distance_to(light_transform.origin);
+ const real_t distance = p_camera_transform.origin.distance_to(light_transform.origin);
if (light->distance_fade) {
const float fade_begin = light->distance_fade_begin;
@@ -745,7 +745,7 @@ void LightStorage::update_light_buffers(RenderDataRD *p_render_data, const Paged
}
Transform3D light_transform = light_instance->transform;
- const real_t distance = camera_plane.distance_to(light_transform.origin);
+ const real_t distance = p_camera_transform.origin.distance_to(light_transform.origin);
if (light->distance_fade) {
const float fade_begin = light->distance_fade_begin;
@@ -787,6 +787,7 @@ void LightStorage::update_light_buffers(RenderDataRD *p_render_data, const Paged
RS::LightType type = (i < omni_light_count) ? RS::LIGHT_OMNI : RS::LIGHT_SPOT;
LightInstance *light_instance = (i < omni_light_count) ? omni_light_sort[index].light_instance : spot_light_sort[index].light_instance;
Light *light = (i < omni_light_count) ? omni_light_sort[index].light : spot_light_sort[index].light;
+ real_t distance = (i < omni_light_count) ? omni_light_sort[index].depth : spot_light_sort[index].depth;
if (using_forward_ids) {
forward_id_storage->map_forward_id(type == RS::LIGHT_OMNI ? RendererRD::FORWARD_ID_TYPE_OMNI_LIGHT : RendererRD::FORWARD_ID_TYPE_SPOT_LIGHT, light_instance->forward_id, index);
@@ -803,7 +804,6 @@ void LightStorage::update_light_buffers(RenderDataRD *p_render_data, const Paged
float fade_begin = 0.0;
float fade_shadow = 0.0;
float fade_length = 0.0;
- real_t distance = 0.0;
float fade = 1.0;
float shadow_opacity_fade = 1.0;
@@ -811,7 +811,6 @@ void LightStorage::update_light_buffers(RenderDataRD *p_render_data, const Paged
fade_begin = light->distance_fade_begin;
fade_shadow = light->distance_fade_shadow;
fade_length = light->distance_fade_length;
- distance = camera_plane.distance_to(light_transform.origin);
// Use `smoothstep()` to make opacity changes more gradual and less noticeable to the player.
if (distance > fade_begin) {
@@ -1467,7 +1466,6 @@ bool LightStorage::reflection_probe_instance_begin_render(RID p_instance, RID p_
fb.push_back(atlas->depth_buffer);
atlas->depth_fb = RD::get_singleton()->framebuffer_create(fb);
- atlas->render_buffers->cleanup();
atlas->render_buffers->configure_for_reflections(Size2i(atlas->size, atlas->size));
}
@@ -1556,6 +1554,11 @@ bool LightStorage::reflection_probe_instance_postprocess_step(RID p_instance) {
if (rpi->processing_side == 6) {
rpi->processing_side = 0;
rpi->processing_layer++;
+ if (rpi->processing_layer == atlas->reflections[rpi->atlas_index].data.layers[0].mipmaps.size()) {
+ rpi->rendering = false;
+ rpi->processing_layer = 1;
+ return true;
+ }
}
return false;
diff --git a/servers/rendering/renderer_rd/storage_rd/light_storage.h b/servers/rendering/renderer_rd/storage_rd/light_storage.h
index f7c8b8833b..d359219128 100644
--- a/servers/rendering/renderer_rd/storage_rd/light_storage.h
+++ b/servers/rendering/renderer_rd/storage_rd/light_storage.h
@@ -226,7 +226,7 @@ private:
Color ambient_color;
float ambient_color_energy = 1.0;
float max_distance = 0;
- Vector3 extents = Vector3(1, 1, 1);
+ Vector3 extents = Vector3(10, 10, 10);
Vector3 origin_offset;
bool interior = false;
bool box_projection = false;
diff --git a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
index 62da62403f..9124886764 100644
--- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
@@ -842,15 +842,15 @@ void MeshStorage::mesh_instance_set_blend_shape_weight(RID p_mesh_instance, int
}
void MeshStorage::_mesh_instance_clear(MeshInstance *mi) {
- for (uint32_t i = 0; i < mi->surfaces.size(); i++) {
- if (mi->surfaces[i].versions) {
- for (uint32_t j = 0; j < mi->surfaces[i].version_count; j++) {
- RD::get_singleton()->free(mi->surfaces[i].versions[j].vertex_array);
+ for (const RendererRD::MeshStorage::MeshInstance::Surface &surface : mi->surfaces) {
+ if (surface.versions) {
+ for (uint32_t j = 0; j < surface.version_count; j++) {
+ RD::get_singleton()->free(surface.versions[j].vertex_array);
}
- memfree(mi->surfaces[i].versions);
+ memfree(surface.versions);
}
- if (mi->surfaces[i].vertex_buffer.is_valid()) {
- RD::get_singleton()->free(mi->surfaces[i].vertex_buffer);
+ if (surface.vertex_buffer.is_valid()) {
+ RD::get_singleton()->free(surface.vertex_buffer);
}
}
mi->surfaces.clear();
@@ -866,8 +866,8 @@ void MeshStorage::_mesh_instance_clear(MeshInstance *mi) {
void MeshStorage::_mesh_instance_add_surface(MeshInstance *mi, Mesh *mesh, uint32_t p_surface) {
if (mesh->blend_shape_count > 0 && mi->blend_weights_buffer.is_null()) {
mi->blend_weights.resize(mesh->blend_shape_count);
- for (uint32_t i = 0; i < mi->blend_weights.size(); i++) {
- mi->blend_weights[i] = 0;
+ for (float &weight : mi->blend_weights) {
+ weight = 0;
}
mi->blend_weights_buffer = RD::get_singleton()->storage_buffer_create(sizeof(float) * mi->blend_weights.size(), mi->blend_weights.to_byte_array());
mi->weights_dirty = true;
@@ -930,6 +930,11 @@ void MeshStorage::mesh_instance_check_for_update(RID p_mesh_instance) {
}
}
+void MeshStorage::mesh_instance_set_canvas_item_transform(RID p_mesh_instance, const Transform2D &p_transform) {
+ MeshInstance *mi = mesh_instance_owner.get_or_null(p_mesh_instance);
+ mi->canvas_item_transform_2d = p_transform;
+}
+
void MeshStorage::update_mesh_instances() {
while (dirty_mesh_instance_weights.first()) {
MeshInstance *mi = dirty_mesh_instance_weights.first()->self();
@@ -981,6 +986,22 @@ void MeshStorage::update_mesh_instances() {
push_constant.skin_stride = (mi->mesh->surfaces[i]->skin_buffer_size / mi->mesh->surfaces[i]->vertex_count) / 4;
push_constant.skin_weight_offset = (mi->mesh->surfaces[i]->format & RS::ARRAY_FLAG_USE_8_BONE_WEIGHTS) ? 4 : 2;
+ Transform2D transform = mi->canvas_item_transform_2d.affine_inverse() * sk->base_transform_2d;
+ push_constant.skeleton_transform_x[0] = transform.columns[0][0];
+ push_constant.skeleton_transform_x[1] = transform.columns[0][1];
+ push_constant.skeleton_transform_y[0] = transform.columns[1][0];
+ push_constant.skeleton_transform_y[1] = transform.columns[1][1];
+ push_constant.skeleton_transform_offset[0] = transform.columns[2][0];
+ push_constant.skeleton_transform_offset[1] = transform.columns[2][1];
+
+ Transform2D inverse_transform = transform.affine_inverse();
+ push_constant.inverse_transform_x[0] = inverse_transform.columns[0][0];
+ push_constant.inverse_transform_x[1] = inverse_transform.columns[0][1];
+ push_constant.inverse_transform_y[0] = inverse_transform.columns[1][0];
+ push_constant.inverse_transform_y[1] = inverse_transform.columns[1][1];
+ push_constant.inverse_transform_offset[0] = inverse_transform.columns[2][0];
+ push_constant.inverse_transform_offset[1] = inverse_transform.columns[2][1];
+
push_constant.blend_shape_count = mi->mesh->blend_shape_count;
push_constant.normalized_blend_shapes = mi->mesh->blend_shape_mode == RS::BLEND_SHAPE_MODE_NORMALIZED;
push_constant.pad0 = 0;
diff --git a/servers/rendering/renderer_rd/storage_rd/mesh_storage.h b/servers/rendering/renderer_rd/storage_rd/mesh_storage.h
index b62da5fd7b..c921523941 100644
--- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.h
+++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.h
@@ -178,6 +178,7 @@ private:
bool weights_dirty = false;
SelfList<MeshInstance> weight_update_list;
SelfList<MeshInstance> array_update_list;
+ Transform2D canvas_item_transform_2d;
MeshInstance() :
weight_update_list(this), array_update_list(this) {}
};
@@ -256,6 +257,14 @@ private:
uint32_t normalized_blend_shapes;
uint32_t pad0;
uint32_t pad1;
+ float skeleton_transform_x[2];
+ float skeleton_transform_y[2];
+
+ float skeleton_transform_offset[2];
+ float inverse_transform_x[2];
+
+ float inverse_transform_y[2];
+ float inverse_transform_offset[2];
};
enum {
@@ -548,6 +557,7 @@ public:
virtual void mesh_instance_set_skeleton(RID p_mesh_instance, RID p_skeleton) override;
virtual void mesh_instance_set_blend_shape_weight(RID p_mesh_instance, int p_shape, float p_weight) override;
virtual void mesh_instance_check_for_update(RID p_mesh_instance) override;
+ virtual void mesh_instance_set_canvas_item_transform(RID p_mesh_instance, const Transform2D &p_transform) override;
virtual void update_mesh_instances() override;
/* MULTIMESH API */
diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
index e4149f6bbd..00fb8acca8 100644
--- a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
@@ -851,9 +851,9 @@ void ParticlesStorage::_particles_process(Particles *p_particles, double p_delta
collision_heightmap_texture = p_particles->sdf_collision_texture;
//replace in all other history frames where used because parameters are no longer valid if screen moves
- for (uint32_t i = 1; i < p_particles->frame_history.size(); i++) {
- if (p_particles->frame_history[i].collider_count > 0 && p_particles->frame_history[i].colliders[0].type == ParticlesFrameParams::COLLISION_TYPE_2D_SDF) {
- p_particles->frame_history[i].colliders[0] = frame_params.colliders[0];
+ for (ParticlesFrameParams &params : p_particles->frame_history) {
+ if (params.collider_count > 0 && params.colliders[0].type == ParticlesFrameParams::COLLISION_TYPE_2D_SDF) {
+ params.colliders[0] = frame_params.colliders[0];
}
}
}
@@ -1145,7 +1145,7 @@ void ParticlesStorage::particles_set_view_axis(RID p_particles, const Vector3 &p
return;
}
- if (particles->particle_buffer.is_null()) {
+ if (particles->particle_buffer.is_null() || particles->trail_bind_pose_uniform_set.is_null()) {
return; //particles have not processed yet
}
diff --git a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp
index 31377a10a0..255719183f 100644
--- a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp
@@ -251,7 +251,7 @@ RID RenderSceneBuffersRD::create_texture(const StringName &p_context, const Stri
}
RID RenderSceneBuffersRD::create_texture_from_format(const StringName &p_context, const StringName &p_texture_name, const RD::TextureFormat &p_texture_format, RD::TextureView p_view, bool p_unique) {
- // TODO p_unique, if p_unique is true, this is a texture that can be shared. This will be implemented later as an optimisation.
+ // TODO p_unique, if p_unique is true, this is a texture that can be shared. This will be implemented later as an optimization.
NTKey key(p_context, p_texture_name);
@@ -490,6 +490,16 @@ Ref<RenderBufferCustomDataRD> RenderSceneBuffersRD::get_custom_data(const String
// Depth texture
+bool RenderSceneBuffersRD::has_depth_texture() {
+ RendererRD::TextureStorage *texture_storage = RendererRD::TextureStorage::get_singleton();
+ RID depth = texture_storage->render_target_get_override_depth(render_target);
+ if (depth.is_valid()) {
+ return true;
+ } else {
+ return has_texture(RB_SCOPE_BUFFERS, RB_TEX_DEPTH);
+ }
+}
+
RID RenderSceneBuffersRD::get_depth_texture() {
RendererRD::TextureStorage *texture_storage = RendererRD::TextureStorage::get_singleton();
RID depth = texture_storage->render_target_get_override_depth(render_target);
diff --git a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.h b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.h
index dc849fd56a..50fb06c0d9 100644
--- a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.h
+++ b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.h
@@ -185,6 +185,9 @@ public:
// For our internal textures we provide some easy access methods.
+ _FORCE_INLINE_ bool has_internal_texture() const {
+ return has_texture(RB_SCOPE_BUFFERS, RB_TEX_COLOR);
+ }
_FORCE_INLINE_ RID get_internal_texture() const {
return get_texture(RB_SCOPE_BUFFERS, RB_TEX_COLOR);
}
@@ -192,6 +195,7 @@ public:
return get_texture_slice(RB_SCOPE_BUFFERS, RB_TEX_COLOR, p_layer, 0);
}
+ bool has_depth_texture();
RID get_depth_texture();
RID get_depth_texture(const uint32_t p_layer);
diff --git a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp
index 06fda8fa9e..2eaa7824fb 100644
--- a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp
@@ -422,8 +422,7 @@ TextureStorage::TextureStorage() {
tformat.usage_bits = RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT | RD::TEXTURE_USAGE_VRS_ATTACHMENT_BIT;
tformat.texture_type = RD::TEXTURE_TYPE_2D;
if (!RD::get_singleton()->has_feature(RD::SUPPORTS_ATTACHMENT_VRS)) {
- tformat.usage_bits = RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT;
- tformat.format = RD::DATA_FORMAT_R8_UNORM;
+ tformat.usage_bits = RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT;
}
Vector<uint8_t> pv;
@@ -2206,6 +2205,12 @@ void TextureStorage::decal_instance_set_transform(RID p_decal_instance, const Tr
di->transform = p_transform;
}
+void TextureStorage::decal_instance_set_sorting_offset(RID p_decal_instance, float p_sorting_offset) {
+ DecalInstance *di = decal_instance_owner.get_or_null(p_decal_instance);
+ ERR_FAIL_COND(!di);
+ di->sorting_offset = p_sorting_offset;
+}
+
/* DECAL DATA API */
void TextureStorage::free_decal_data() {
@@ -2233,7 +2238,7 @@ void TextureStorage::set_max_decals(const uint32_t p_max_decals) {
decal_buffer = RD::get_singleton()->storage_buffer_create(decal_buffer_size);
}
-void TextureStorage::update_decal_buffer(const PagedArray<RID> &p_decals, const Transform3D &p_camera_inverse_xform) {
+void TextureStorage::update_decal_buffer(const PagedArray<RID> &p_decals, const Transform3D &p_camera_xform) {
ForwardIDStorage *forward_id_storage = ForwardIDStorage::get_singleton();
Transform3D uv_xform;
@@ -2257,7 +2262,7 @@ void TextureStorage::update_decal_buffer(const PagedArray<RID> &p_decals, const
Transform3D xform = decal_instance->transform;
- real_t distance = -p_camera_inverse_xform.xform(xform.origin).z;
+ real_t distance = p_camera_xform.origin.distance_to(xform.origin);
if (decal->distance_fade) {
float fade_begin = decal->distance_fade_begin;
@@ -2272,7 +2277,7 @@ void TextureStorage::update_decal_buffer(const PagedArray<RID> &p_decals, const
decal_sort[decal_count].decal_instance = decal_instance;
decal_sort[decal_count].decal = decal;
- decal_sort[decal_count].depth = distance;
+ decal_sort[decal_count].depth = distance - decal_instance->sorting_offset;
decal_count++;
}
@@ -2292,11 +2297,10 @@ void TextureStorage::update_decal_buffer(const PagedArray<RID> &p_decals, const
decal_instance->cull_mask = decal->cull_mask;
- Transform3D xform = decal_instance->transform;
float fade = 1.0;
if (decal->distance_fade) {
- const real_t distance = -p_camera_inverse_xform.xform(xform.origin).z;
+ const real_t distance = decal_sort[i].depth + decal_instance->sorting_offset;
const float fade_begin = decal->distance_fade_begin;
const float fade_length = decal->distance_fade_length;
@@ -2312,11 +2316,16 @@ void TextureStorage::update_decal_buffer(const PagedArray<RID> &p_decals, const
Transform3D scale_xform;
scale_xform.basis.scale(decal_extents);
- Transform3D to_decal_xform = (p_camera_inverse_xform * xform * scale_xform * uv_xform).affine_inverse();
+
+ Transform3D xform = decal_instance->transform;
+
+ Transform3D camera_inverse_xform = p_camera_xform.affine_inverse();
+
+ Transform3D to_decal_xform = (camera_inverse_xform * xform * scale_xform * uv_xform).affine_inverse();
MaterialStorage::store_transform(to_decal_xform, dd.xform);
Vector3 normal = xform.basis.get_column(Vector3::AXIS_Y).normalized();
- normal = p_camera_inverse_xform.basis.xform(normal); //camera is normalized, so fine
+ normal = camera_inverse_xform.basis.xform(normal); //camera is normalized, so fine
dd.normal[0] = normal.x;
dd.normal[1] = normal.y;
@@ -2350,7 +2359,7 @@ void TextureStorage::update_decal_buffer(const PagedArray<RID> &p_decals, const
dd.normal_rect[2] = rect.size.x;
dd.normal_rect[3] = rect.size.y;
- Basis normal_xform = p_camera_inverse_xform.basis * xform.basis.orthonormalized();
+ Basis normal_xform = camera_inverse_xform.basis * xform.basis.orthonormalized();
MaterialStorage::store_basis_3x4(normal_xform, dd.normal_xform);
} else {
dd.normal_rect[0] = 0;
diff --git a/servers/rendering/renderer_rd/storage_rd/texture_storage.h b/servers/rendering/renderer_rd/storage_rd/texture_storage.h
index 1558342c3b..ea0df0b459 100644
--- a/servers/rendering/renderer_rd/storage_rd/texture_storage.h
+++ b/servers/rendering/renderer_rd/storage_rd/texture_storage.h
@@ -258,6 +258,7 @@ private:
struct DecalInstance {
RID decal;
Transform3D transform;
+ float sorting_offset = 0.0;
uint32_t cull_mask = 0;
RendererRD::ForwardID forward_id = -1;
};
@@ -646,6 +647,7 @@ public:
virtual RID decal_instance_create(RID p_decal) override;
virtual void decal_instance_free(RID p_decal_instance) override;
virtual void decal_instance_set_transform(RID p_decal_instance, const Transform3D &p_transform) override;
+ virtual void decal_instance_set_sorting_offset(RID p_decal_instance, float p_sorting_offset) override;
_FORCE_INLINE_ RID decal_instance_get_base(RID p_decal_instance) const {
DecalInstance *di = decal_instance_owner.get_or_null(p_decal_instance);
@@ -677,7 +679,7 @@ public:
void free_decal_data();
void set_max_decals(const uint32_t p_max_decals);
RID get_decal_buffer() { return decal_buffer; }
- void update_decal_buffer(const PagedArray<RID> &p_decals, const Transform3D &p_camera_inverse_xform);
+ void update_decal_buffer(const PagedArray<RID> &p_decals, const Transform3D &p_camera_xform);
/* RENDER TARGET API */
diff --git a/servers/rendering/renderer_rd/storage_rd/utilities.cpp b/servers/rendering/renderer_rd/storage_rd/utilities.cpp
index d2f5e6f224..cabac4e9ee 100644
--- a/servers/rendering/renderer_rd/storage_rd/utilities.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/utilities.cpp
@@ -286,6 +286,10 @@ bool Utilities::has_os_feature(const String &p_feature) const {
return true;
}
+ if (p_feature == "astc" && RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_ASTC_4x4_UNORM_BLOCK, RD::TEXTURE_USAGE_SAMPLING_BIT)) {
+ return true;
+ }
+
return false;
}
diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp
index 218bb7b736..6f4bb115fc 100644
--- a/servers/rendering/renderer_scene_cull.cpp
+++ b/servers/rendering/renderer_scene_cull.cpp
@@ -694,6 +694,7 @@ void RendererSceneCull::instance_set_base(RID p_instance, RID p_base) {
instance->base_data = decal;
decal->instance = RSG::texture_storage->decal_instance_create(p_base);
+ RSG::texture_storage->decal_instance_set_sorting_offset(decal->instance, instance->sorting_offset);
} break;
case RS::INSTANCE_LIGHTMAP: {
InstanceLightmapData *lightmap_data = memnew(InstanceLightmapData);
@@ -871,6 +872,9 @@ void RendererSceneCull::instance_set_pivot_data(RID p_instance, float p_sorting_
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(instance->base_data);
ERR_FAIL_NULL(geom->geometry_instance);
geom->geometry_instance->set_pivot_data(p_sorting_offset, p_use_aabb_center);
+ } else if (instance->base_type == RS::INSTANCE_DECAL && instance->base_data) {
+ InstanceDecalData *decal = static_cast<InstanceDecalData *>(instance->base_data);
+ RSG::texture_storage->decal_instance_set_sorting_offset(decal->instance, instance->sorting_offset);
}
}
@@ -2824,7 +2828,9 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
ERR_FAIL_NULL(geom->geometry_instance);
+ cull_data.cull->lock.lock();
geom->geometry_instance->set_softshadow_projector_pairing(geom->softshadow_count > 0, geom->projector_count > 0);
+ cull_data.cull->lock.unlock();
idata.flags &= ~uint32_t(InstanceData::FLAG_GEOM_PROJECTOR_SOFTSHADOW_DIRTY);
}
@@ -2891,7 +2897,9 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
sh[j] = sh[j].lerp(target_sh[j], MIN(1.0, lightmap_probe_update_speed));
}
ERR_FAIL_NULL(geom->geometry_instance);
+ cull_data.cull->lock.lock();
geom->geometry_instance->set_lightmap_capture(sh);
+ cull_data.cull->lock.unlock();
idata.instance->last_frame_pass = frame_number;
}
@@ -2956,11 +2964,13 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c
Scenario *scenario = scenario_owner.get_or_null(p_scenario);
+ ERR_FAIL_COND(p_render_buffers.is_null());
+
render_pass++;
scene_render->set_scene_pass(render_pass);
- if (p_render_buffers.is_valid() && p_reflection_probe.is_null()) {
+ if (p_reflection_probe.is_null()) {
//no rendering code here, this is only to set up what needs to be done, request regions, etc.
scene_render->sdfgi_update(p_render_buffers, p_environment, p_camera_data->main_transform.origin); //update conditions for SDFGI (whether its used or not)
}
@@ -3042,7 +3052,7 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c
{ //sdfgi
cull.sdfgi.region_count = 0;
- if (p_render_buffers.is_valid() && p_reflection_probe.is_null()) {
+ if (p_reflection_probe.is_null()) {
cull.sdfgi.cascade_light_count = 0;
uint32_t prev_cascade = 0xFFFFFFFF;
@@ -3088,15 +3098,15 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c
#endif
if (cull_to > thread_cull_threshold) {
//multiple threads
- for (uint32_t i = 0; i < scene_cull_result_threads.size(); i++) {
- scene_cull_result_threads[i].clear();
+ for (InstanceCullResult &thread : scene_cull_result_threads) {
+ thread.clear();
}
WorkerThreadPool::GroupID group_task = WorkerThreadPool::get_singleton()->add_template_group_task(this, &RendererSceneCull::_scene_cull_threaded, &cull_data, scene_cull_result_threads.size(), -1, true, SNAME("RenderCullInstances"));
WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_task);
- for (uint32_t i = 0; i < scene_cull_result_threads.size(); i++) {
- scene_cull_result.append_from(scene_cull_result_threads[i]);
+ for (InstanceCullResult &thread : scene_cull_result_threads) {
+ scene_cull_result.append_from(thread);
}
} else {
@@ -3271,7 +3281,7 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c
}
}
- if (p_render_buffers.is_valid() && p_reflection_probe.is_null()) {
+ if (p_reflection_probe.is_null()) {
sdfgi_update_data.directional_lights = &directional_lights;
sdfgi_update_data.positional_light_instances = scenario->dynamic_lights.ptr();
sdfgi_update_data.positional_light_count = scenario->dynamic_lights.size();
@@ -4126,8 +4136,8 @@ RendererSceneCull::RendererSceneCull() {
scene_cull_result.init(&rid_cull_page_pool, &geometry_instance_cull_page_pool, &instance_cull_page_pool);
scene_cull_result_threads.resize(WorkerThreadPool::get_singleton()->get_thread_count());
- for (uint32_t i = 0; i < scene_cull_result_threads.size(); i++) {
- scene_cull_result_threads[i].init(&rid_cull_page_pool, &geometry_instance_cull_page_pool, &instance_cull_page_pool);
+ for (InstanceCullResult &thread : scene_cull_result_threads) {
+ thread.init(&rid_cull_page_pool, &geometry_instance_cull_page_pool, &instance_cull_page_pool);
}
indexer_update_iterations = GLOBAL_GET("rendering/limits/spatial_indexer/update_iterations_per_frame");
@@ -4155,8 +4165,8 @@ RendererSceneCull::~RendererSceneCull() {
}
scene_cull_result.reset();
- for (uint32_t i = 0; i < scene_cull_result_threads.size(); i++) {
- scene_cull_result_threads[i].reset();
+ for (InstanceCullResult &thread : scene_cull_result_threads) {
+ thread.reset();
}
scene_cull_result_threads.clear();
diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp
index 3886f5b379..aecd0593bc 100644
--- a/servers/rendering/renderer_viewport.cpp
+++ b/servers/rendering/renderer_viewport.cpp
@@ -236,7 +236,7 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
}
}
- if (!p_viewport->disable_2d && !p_viewport->disable_environment && RSG::scene->is_scenario(p_viewport->scenario)) {
+ if (!p_viewport->disable_2d && !viewport_is_environment_disabled(p_viewport) && RSG::scene->is_scenario(p_viewport->scenario)) {
RID environment = RSG::scene->scenario_get_environment(p_viewport->scenario);
if (RSG::scene->is_environment(environment)) {
scenario_draw_canvas_bg = RSG::scene->environment_get_background(environment) == RS::ENV_BG_CANVAS;
@@ -992,11 +992,21 @@ void RendererViewport::viewport_set_disable_2d(RID p_viewport, bool p_disable) {
viewport->disable_2d = p_disable;
}
-void RendererViewport::viewport_set_disable_environment(RID p_viewport, bool p_disable) {
+void RendererViewport::viewport_set_environment_mode(RID p_viewport, RS::ViewportEnvironmentMode p_mode) {
Viewport *viewport = viewport_owner.get_or_null(p_viewport);
ERR_FAIL_COND(!viewport);
- viewport->disable_environment = p_disable;
+ viewport->disable_environment = p_mode;
+}
+
+bool RendererViewport::viewport_is_environment_disabled(Viewport *viewport) {
+ ERR_FAIL_COND_V(!viewport, false);
+
+ if (viewport->parent.is_valid() && viewport->disable_environment == RS::VIEWPORT_ENVIRONMENT_INHERIT) {
+ Viewport *parent = viewport_owner.get_or_null(viewport->parent);
+ return viewport_is_environment_disabled(parent);
+ }
+ return viewport->disable_environment == RS::VIEWPORT_ENVIRONMENT_DISABLED;
}
void RendererViewport::viewport_set_disable_3d(RID p_viewport, bool p_disable) {
diff --git a/servers/rendering/renderer_viewport.h b/servers/rendering/renderer_viewport.h
index 9b32cc3774..c24275de6e 100644
--- a/servers/rendering/renderer_viewport.h
+++ b/servers/rendering/renderer_viewport.h
@@ -85,7 +85,7 @@ public:
bool viewport_render_direct_to_screen;
bool disable_2d = false;
- bool disable_environment = false;
+ RS::ViewportEnvironmentMode disable_environment = RS::VIEWPORT_ENVIRONMENT_INHERIT;
bool disable_3d = false;
bool measure_render_time = false;
@@ -238,9 +238,11 @@ public:
const RendererSceneRender::CameraData *viewport_get_prev_camera_data(RID p_viewport);
void viewport_set_disable_2d(RID p_viewport, bool p_disable);
- void viewport_set_disable_environment(RID p_viewport, bool p_disable);
+ void viewport_set_environment_mode(RID p_viewport, RS::ViewportEnvironmentMode p_mode);
void viewport_set_disable_3d(RID p_viewport, bool p_disable);
+ bool viewport_is_environment_disabled(Viewport *viewport);
+
void viewport_attach_camera(RID p_viewport, RID p_camera);
void viewport_set_scenario(RID p_viewport, RID p_scenario);
void viewport_attach_canvas(RID p_viewport, RID p_canvas);
diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h
index 8ac522bafe..bcaaba8d65 100644
--- a/servers/rendering/rendering_server_default.h
+++ b/servers/rendering/rendering_server_default.h
@@ -608,7 +608,7 @@ public:
FUNC1RC(RID, viewport_get_texture, RID)
FUNC2(viewport_set_disable_2d, RID, bool)
- FUNC2(viewport_set_disable_environment, RID, bool)
+ FUNC2(viewport_set_environment_mode, RID, ViewportEnvironmentMode)
FUNC2(viewport_set_disable_3d, RID, bool)
FUNC2(viewport_set_canvas_cull_mask, RID, uint32_t)
diff --git a/servers/rendering/shader_compiler.cpp b/servers/rendering/shader_compiler.cpp
index 68542f32af..2710724066 100644
--- a/servers/rendering/shader_compiler.cpp
+++ b/servers/rendering/shader_compiler.cpp
@@ -1173,9 +1173,10 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
code += "(";
- // if normal roughness texture is used, we will add logic to automatically switch between
+ // if color backbuffer, depth backbuffer or normal roughness texture is used,
+ // we will add logic to automatically switch between
// sampler2D and sampler2D array and vec2 UV and vec3 UV.
- bool normal_roughness_texture_used = false;
+ bool multiview_uv_needed = false;
for (int i = 1; i < onode->arguments.size(); i++) {
if (i > 1) {
@@ -1220,8 +1221,8 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
}
String node_code = _dump_node_code(onode->arguments[i], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
- if (!RS::get_singleton()->is_low_end() && is_texture_func && i == 1) {
- //need to map from texture to sampler in order to sample when using Vulkan GLSL
+ if (is_texture_func && i == 1) {
+ // If we're doing a texture lookup we need to check our texture argument
StringName texture_uniform;
bool correct_texture_uniform = false;
@@ -1240,8 +1241,10 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
break;
}
- if (correct_texture_uniform) {
+ if (correct_texture_uniform && !RS::get_singleton()->is_low_end()) {
+ // Need to map from texture to sampler in order to sample when using Vulkan GLSL.
String sampler_name;
+ bool is_depth_texture = false;
bool is_normal_roughness_texture = false;
if (actions.custom_samplers.has(texture_uniform)) {
@@ -1251,6 +1254,8 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
const ShaderLanguage::ShaderNode::Uniform &u = shader->uniforms[texture_uniform];
if (u.hint == ShaderLanguage::ShaderNode::Uniform::HINT_SCREEN_TEXTURE) {
is_screen_texture = true;
+ } else if (u.hint == ShaderLanguage::ShaderNode::Uniform::HINT_DEPTH_TEXTURE) {
+ is_depth_texture = true;
} else if (u.hint == ShaderLanguage::ShaderNode::Uniform::HINT_NORMAL_ROUGHNESS_TEXTURE) {
is_normal_roughness_texture = true;
}
@@ -1281,24 +1286,40 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
}
String data_type_name = "";
- if (is_normal_roughness_texture) {
+ if (actions.check_multiview_samplers && (is_screen_texture || is_depth_texture || is_normal_roughness_texture)) {
data_type_name = "multiviewSampler";
- normal_roughness_texture_used = true;
+ multiview_uv_needed = true;
} else {
data_type_name = ShaderLanguage::get_datatype_name(onode->arguments[i]->get_datatype());
}
code += data_type_name + "(" + node_code + ", " + sampler_name + ")";
+ } else if (actions.check_multiview_samplers && correct_texture_uniform && RS::get_singleton()->is_low_end()) {
+ // Texture function on low end hardware (i.e. OpenGL).
+ // We just need to know if the texture supports multiview.
+
+ if (shader->uniforms.has(texture_uniform)) {
+ const ShaderLanguage::ShaderNode::Uniform &u = shader->uniforms[texture_uniform];
+ if (u.hint == ShaderLanguage::ShaderNode::Uniform::HINT_SCREEN_TEXTURE) {
+ multiview_uv_needed = true;
+ } else if (u.hint == ShaderLanguage::ShaderNode::Uniform::HINT_DEPTH_TEXTURE) {
+ multiview_uv_needed = true;
+ } else if (u.hint == ShaderLanguage::ShaderNode::Uniform::HINT_NORMAL_ROUGHNESS_TEXTURE) {
+ multiview_uv_needed = true;
+ }
+ }
+
+ code += node_code;
} else {
code += node_code;
}
- } else {
- if (normal_roughness_texture_used && i == 2) {
- // UV coordinate after using normal roughness texture.
- node_code = "normal_roughness_uv(" + node_code + ".xy)";
- }
+ } else if (multiview_uv_needed && i == 2) {
+ // UV coordinate after using color, depth or normal roughness texture.
+ node_code = "multiview_uv(" + node_code + ".xy)";
code += node_code;
+ } else {
+ code += node_code;
}
}
code += ")";
diff --git a/servers/rendering/shader_compiler.h b/servers/rendering/shader_compiler.h
index 43bea213da..3bb29a545b 100644
--- a/servers/rendering/shader_compiler.h
+++ b/servers/rendering/shader_compiler.h
@@ -101,6 +101,7 @@ public:
String instance_uniform_index_variable;
uint32_t base_varying_index = 0;
bool apply_luminance_multiplier = false;
+ bool check_multiview_samplers = false;
};
private:
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 5ecc38a63b..11a9303f11 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -90,8 +90,9 @@ const char *ShaderLanguage::token_names[TK_MAX] = {
"IDENTIFIER",
"TRUE",
"FALSE",
- "REAL_CONSTANT",
+ "FLOAT_CONSTANT",
"INT_CONSTANT",
+ "UINT_CONSTANT",
"TYPE_VOID",
"TYPE_BOOL",
"TYPE_BVEC2",
@@ -126,6 +127,7 @@ const char *ShaderLanguage::token_names[TK_MAX] = {
"INTERPOLATION_FLAT",
"INTERPOLATION_SMOOTH",
"CONST",
+ "STRUCT",
"PRECISION_LOW",
"PRECISION_MID",
"PRECISION_HIGH",
@@ -169,6 +171,7 @@ const char *ShaderLanguage::token_names[TK_MAX] = {
"CF_DO",
"CF_SWITCH",
"CF_CASE",
+ "CF_DEFAULT",
"CF_BREAK",
"CF_CONTINUE",
"CF_RETURN",
@@ -185,19 +188,26 @@ const char *ShaderLanguage::token_names[TK_MAX] = {
"SEMICOLON",
"PERIOD",
"UNIFORM",
+ "UNIFORM_GROUP",
"INSTANCE",
"GLOBAL",
"VARYING",
- "IN",
- "OUT",
- "INOUT",
+ "ARG_IN",
+ "ARG_OUT",
+ "ARG_INOUT",
"RENDER_MODE",
- "SOURCE_COLOR",
"HINT_DEFAULT_WHITE_TEXTURE",
"HINT_DEFAULT_BLACK_TEXTURE",
"HINT_DEFAULT_TRANSPARENT_TEXTURE",
"HINT_NORMAL_TEXTURE",
+ "HINT_ROUGHNESS_NORMAL_TEXTURE",
+ "HINT_ROUGHNESS_R",
+ "HINT_ROUGHNESS_G",
+ "HINT_ROUGHNESS_B",
+ "HINT_ROUGHNESS_A",
+ "HINT_ROUGHNESS_GRAY",
"HINT_ANISOTROPY_TEXTURE",
+ "HINT_SOURCE_COLOR",
"HINT_RANGE",
"HINT_INSTANCE_INDEX",
"HINT_SCREEN_TEXTURE",
@@ -612,7 +622,7 @@ ShaderLanguage::Token ShaderLanguage::_get_token() {
char_idx += 2;
include_positions.resize(include_positions.size() - 1); // Pop back.
- tk_line = include_positions[include_positions.size() - 1].line; // Restore line.
+ tk_line = include_positions[include_positions.size() - 1].line - 1; // Restore line.
} else {
return _make_token(TK_ERROR, "Invalid include enter/exit hint token (@@> and @@<)");
@@ -2827,6 +2837,20 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
{ "dFdx", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID }, { "p" }, TAG_GLOBAL, false },
{ "dFdx", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID }, { "p" }, TAG_GLOBAL, false },
+ // dFdxCoarse
+
+ { "dFdxCoarse", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "dFdxCoarse", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "dFdxCoarse", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "dFdxCoarse", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+
+ // dFdxFine
+
+ { "dFdxFine", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "dFdxFine", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "dFdxFine", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "dFdxFine", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+
// dFdy
{ "dFdy", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID }, { "p" }, TAG_GLOBAL, false },
@@ -2834,6 +2858,20 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
{ "dFdy", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID }, { "p" }, TAG_GLOBAL, false },
{ "dFdy", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID }, { "p" }, TAG_GLOBAL, false },
+ // dFdyCoarse
+
+ { "dFdyCoarse", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "dFdyCoarse", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "dFdyCoarse", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "dFdyCoarse", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+
+ // dFdyFine
+
+ { "dFdyFine", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "dFdyFine", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "dFdyFine", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "dFdyFine", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+
// fwidth
{ "fwidth", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID }, { "p" }, TAG_GLOBAL, false },
@@ -2841,6 +2879,20 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
{ "fwidth", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID }, { "p" }, TAG_GLOBAL, false },
{ "fwidth", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID }, { "p" }, TAG_GLOBAL, false },
+ // fwidthCoarse
+
+ { "fwidthCoarse", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "fwidthCoarse", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "fwidthCoarse", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "fwidthCoarse", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+
+ // fwidthFine
+
+ { "fwidthFine", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "fwidthFine", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "fwidthFine", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+ { "fwidthFine", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID }, { "p" }, TAG_GLOBAL, true },
+
// Sub-functions.
// array
@@ -5402,7 +5454,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
if (identifier == "SCREEN_TEXTURE" || identifier == "DEPTH_TEXTURE" || identifier == "NORMAL_ROUGHNESS_TEXTURE") {
String name = String(identifier);
String name_lower = name.to_lower();
- _set_error(vformat(RTR("%s has been removed in favor of using hint_%s with a uniform.\nTo continue with minimal code changes add 'uniform sampler2D %s : hint_%s, filter_linear_mipmaps;' near the top of your shader."), name, name_lower, name, name_lower));
+ _set_error(vformat(RTR("%s has been removed in favor of using hint_%s with a uniform.\nTo continue with minimal code changes add 'uniform sampler2D %s : hint_%s, filter_linear_mipmap;' near the top of your shader."), name, name_lower, name, name_lower));
return nullptr;
}
_set_error(vformat(RTR("Unknown identifier in expression: '%s'."), String(identifier)));
@@ -8233,6 +8285,10 @@ Error ShaderLanguage::_parse_shader(const HashMap<StringName, FunctionInfo> &p_f
_set_error(vformat(RTR("Uniform instances are not yet implemented for '%s' shaders."), shader_type_identifier));
return ERR_PARSE_ERROR;
}
+ if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") {
+ _set_error(RTR("Uniform instances are not supported in gl_compatibility shaders."));
+ return ERR_PARSE_ERROR;
+ }
if (uniform_scope == ShaderNode::Uniform::SCOPE_LOCAL) {
tk = _get_token();
if (tk.type != TK_UNIFORM) {
@@ -8697,14 +8753,21 @@ Error ShaderLanguage::_parse_shader(const HashMap<StringName, FunctionInfo> &p_f
case TK_HINT_SCREEN_TEXTURE: {
new_hint = ShaderNode::Uniform::HINT_SCREEN_TEXTURE;
--texture_uniforms;
+ --texture_binding;
} break;
case TK_HINT_NORMAL_ROUGHNESS_TEXTURE: {
new_hint = ShaderNode::Uniform::HINT_NORMAL_ROUGHNESS_TEXTURE;
--texture_uniforms;
+ --texture_binding;
+ if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") {
+ _set_error(RTR("'hint_normal_roughness_texture is not supported in gl_compatibility shaders."));
+ return ERR_PARSE_ERROR;
+ }
} break;
case TK_HINT_DEPTH_TEXTURE: {
new_hint = ShaderNode::Uniform::HINT_DEPTH_TEXTURE;
--texture_uniforms;
+ --texture_binding;
} break;
case TK_FILTER_NEAREST: {
new_filter = FILTER_NEAREST;
diff --git a/servers/rendering/shader_preprocessor.cpp b/servers/rendering/shader_preprocessor.cpp
index 40c8acffe5..b45a7c0db3 100644
--- a/servers/rendering/shader_preprocessor.cpp
+++ b/servers/rendering/shader_preprocessor.cpp
@@ -78,19 +78,46 @@ char32_t ShaderPreprocessor::Tokenizer::peek() {
return 0;
}
+int ShaderPreprocessor::Tokenizer::consume_line_continuations(int p_offset) {
+ int skips = 0;
+
+ for (int i = index + p_offset; i < size; i++) {
+ char32_t c = code[i];
+ if (c == '\\') {
+ if (i + 1 < size && code[i + 1] == '\n') {
+ // This line ends with "\" and "\n" continuation.
+ add_generated(Token('\n', line));
+ line++;
+ skips++;
+
+ i = i + 2;
+ index = i;
+ } else {
+ break;
+ }
+ } else if (!is_whitespace(c)) {
+ break;
+ }
+ }
+ return skips;
+}
+
LocalVector<ShaderPreprocessor::Token> ShaderPreprocessor::Tokenizer::advance(char32_t p_what) {
LocalVector<ShaderPreprocessor::Token> tokens;
while (index < size) {
char32_t c = code[index++];
-
- tokens.push_back(ShaderPreprocessor::Token(c, line));
+ if (c == '\\' && consume_line_continuations(-1) > 0) {
+ continue;
+ }
if (c == '\n') {
add_generated(ShaderPreprocessor::Token('\n', line));
line++;
}
+ tokens.push_back(ShaderPreprocessor::Token(c, line));
+
if (c == p_what || c == 0) {
return tokens;
}
@@ -104,6 +131,11 @@ void ShaderPreprocessor::Tokenizer::skip_whitespace() {
}
}
+bool ShaderPreprocessor::Tokenizer::consume_empty_line() {
+ // Read until newline and return true if the content was all whitespace/empty.
+ return tokens_to_string(advance('\n')).strip_edges().size() == 0;
+}
+
String ShaderPreprocessor::Tokenizer::get_identifier(bool *r_is_cursor, bool p_started) {
if (r_is_cursor != nullptr) {
*r_is_cursor = false;
@@ -113,6 +145,10 @@ String ShaderPreprocessor::Tokenizer::get_identifier(bool *r_is_cursor, bool p_s
while (true) {
char32_t c = peek();
+ if (c == '\\' && consume_line_continuations(0) > 0) {
+ continue;
+ }
+
if (is_char_end(c) || c == '(' || c == ')' || c == ',' || c == ';') {
break;
}
@@ -146,8 +182,10 @@ String ShaderPreprocessor::Tokenizer::get_identifier(bool *r_is_cursor, bool p_s
String ShaderPreprocessor::Tokenizer::peek_identifier() {
const int original = index;
+ const int original_line = line;
String id = get_identifier();
index = original;
+ line = original_line;
return id;
}
@@ -330,8 +368,8 @@ String ShaderPreprocessor::vector_to_string(const LocalVector<char32_t> &p_v, in
String ShaderPreprocessor::tokens_to_string(const LocalVector<Token> &p_tokens) {
LocalVector<char32_t> result;
- for (uint32_t i = 0; i < p_tokens.size(); i++) {
- result.push_back(p_tokens[i].text);
+ for (const Token &token : p_tokens) {
+ result.push_back(token.text);
}
return vector_to_string(result);
}
@@ -485,7 +523,9 @@ void ShaderPreprocessor::process_else(Tokenizer *p_tokenizer) {
state->previous_region->to_line = line - 1;
}
- p_tokenizer->advance('\n');
+ if (!p_tokenizer->consume_empty_line()) {
+ set_error(RTR("Invalid else."), p_tokenizer->get_line());
+ }
bool skip = false;
for (int i = 0; i < state->current_branch->conditions.size(); i++) {
@@ -508,17 +548,21 @@ void ShaderPreprocessor::process_else(Tokenizer *p_tokenizer) {
}
void ShaderPreprocessor::process_endif(Tokenizer *p_tokenizer) {
+ const int line = p_tokenizer->get_line();
+
state->condition_depth--;
if (state->condition_depth < 0) {
- set_error(RTR("Unmatched endif."), p_tokenizer->get_line());
+ set_error(RTR("Unmatched endif."), line);
return;
}
if (state->previous_region != nullptr) {
- state->previous_region->to_line = p_tokenizer->get_line() - 1;
+ state->previous_region->to_line = line - 1;
state->previous_region = state->previous_region->parent;
}
- p_tokenizer->advance('\n');
+ if (!p_tokenizer->consume_empty_line()) {
+ set_error(RTR("Invalid endif."), line);
+ }
state->current_branch = state->current_branch->parent;
state->branches.pop_back();
@@ -574,12 +618,10 @@ void ShaderPreprocessor::process_ifdef(Tokenizer *p_tokenizer) {
return;
}
- p_tokenizer->skip_whitespace();
- if (!is_char_end(p_tokenizer->peek())) {
+ if (!p_tokenizer->consume_empty_line()) {
set_error(RTR("Invalid ifdef."), line);
return;
}
- p_tokenizer->advance('\n');
bool success = state->defines.has(label);
start_branch_condition(p_tokenizer, success);
@@ -598,12 +640,10 @@ void ShaderPreprocessor::process_ifndef(Tokenizer *p_tokenizer) {
return;
}
- p_tokenizer->skip_whitespace();
- if (!is_char_end(p_tokenizer->peek())) {
+ if (!p_tokenizer->consume_empty_line()) {
set_error(RTR("Invalid ifndef."), line);
return;
}
- p_tokenizer->advance('\n');
bool success = !state->defines.has(label);
start_branch_condition(p_tokenizer, success);
@@ -628,13 +668,17 @@ void ShaderPreprocessor::process_include(Tokenizer *p_tokenizer) {
}
}
path = path.substr(0, path.length() - 1);
- p_tokenizer->skip_whitespace();
- if (path.is_empty() || !is_char_end(p_tokenizer->peek())) {
+ if (path.is_empty() || !p_tokenizer->consume_empty_line()) {
set_error(RTR("Invalid path."), line);
return;
}
+ path = path.simplify_path();
+ if (path.is_relative_path()) {
+ path = state->current_filename.get_base_dir().path_join(path);
+ }
+
Ref<Resource> res = ResourceLoader::load(path);
if (res.is_null()) {
set_error(RTR("Shader include load failed. Does the shader include exist? Is there a cyclic dependency?"), line);
@@ -728,25 +772,24 @@ void ShaderPreprocessor::process_pragma(Tokenizer *p_tokenizer) {
return;
}
- p_tokenizer->advance('\n');
+ if (!p_tokenizer->consume_empty_line()) {
+ set_error(RTR("Invalid pragma directive."), line);
+ return;
+ }
}
void ShaderPreprocessor::process_undef(Tokenizer *p_tokenizer) {
const int line = p_tokenizer->get_line();
const String label = p_tokenizer->get_identifier();
- if (label.is_empty() || !state->defines.has(label)) {
- set_error(RTR("Invalid name."), line);
- return;
- }
-
- p_tokenizer->skip_whitespace();
- if (!is_char_end(p_tokenizer->peek())) {
+ if (label.is_empty() || !p_tokenizer->consume_empty_line()) {
set_error(RTR("Invalid undef."), line);
return;
}
- memdelete(state->defines[label]);
- state->defines.erase(label);
+ if (state->defines.has(label)) {
+ memdelete(state->defines[label]);
+ state->defines.erase(label);
+ }
}
void ShaderPreprocessor::add_region(int p_line, bool p_enabled, Region *p_parent_region) {
@@ -957,15 +1000,57 @@ bool ShaderPreprocessor::expand_macros_once(const String &p_line, int p_line_num
String body = define->body;
if (define->arguments.size() > 0) {
// Complex macro with arguments.
- int args_start = index + key.length();
- int args_end = p_line.find(")", args_start);
- if (args_start == -1 || args_end == -1) {
- set_error(RTR("Missing macro argument parenthesis."), p_line_number);
- return false;
+
+ int args_start = -1;
+ int args_end = -1;
+ int brackets_open = 0;
+ Vector<String> args;
+ for (int i = index_start - 1; i < p_line.length(); i++) {
+ bool add_argument = false;
+ bool reached_end = false;
+ char32_t c = p_line[i];
+
+ if (c == '(') {
+ brackets_open++;
+ if (brackets_open == 1) {
+ args_start = i + 1;
+ args_end = -1;
+ }
+ } else if (c == ')') {
+ brackets_open--;
+ if (brackets_open == 0) {
+ args_end = i;
+ add_argument = true;
+ reached_end = true;
+ }
+ } else if (c == ',') {
+ if (brackets_open == 1) {
+ args_end = i;
+ add_argument = true;
+ }
+ }
+
+ if (add_argument) {
+ if (args_start == -1 || args_end == -1) {
+ set_error(RTR("Invalid macro argument list."), p_line_number);
+ return false;
+ }
+
+ String arg = p_line.substr(args_start, args_end - args_start).strip_edges();
+ if (arg.is_empty()) {
+ set_error(RTR("Invalid macro argument."), p_line_number);
+ return false;
+ }
+ args.append(arg);
+
+ args_start = args_end + 1;
+ }
+
+ if (reached_end) {
+ break;
+ }
}
- String values = result.substr(args_start + 1, args_end - (args_start + 1));
- Vector<String> args = values.split(",");
if (args.size() != define->arguments.size()) {
set_error(RTR("Invalid macro argument count."), p_line_number);
return false;
@@ -987,9 +1072,6 @@ bool ShaderPreprocessor::expand_macros_once(const String &p_line, int p_line_num
result = result.substr(0, index) + " " + body + " " + result.substr(args_end + 1, result.length());
} else {
result = result.substr(0, index) + body + result.substr(index + key.length(), result.length() - (index + key.length()));
- // Manually reset index_start to where the body value of the define finishes.
- // This ensures we don't skip another instance of this macro in the string.
- index_start = index + body.length() + 1;
}
r_expanded = result;
@@ -1081,21 +1163,17 @@ ShaderPreprocessor::Define *ShaderPreprocessor::create_define(const String &p_bo
return define;
}
-void ShaderPreprocessor::clear() {
- if (state_owner && state != nullptr) {
+void ShaderPreprocessor::clear_state() {
+ if (state != nullptr) {
for (const RBMap<String, Define *>::Element *E = state->defines.front(); E; E = E->next()) {
memdelete(E->get());
}
-
- memdelete(state);
+ state->defines.clear();
}
- state_owner = false;
state = nullptr;
}
Error ShaderPreprocessor::preprocess(State *p_state, const String &p_code, String &r_result) {
- clear();
-
output.clear();
state = p_state;
@@ -1242,6 +1320,9 @@ Error ShaderPreprocessor::preprocess(const String &p_code, const String &p_filen
}
}
}
+
+ clear_state();
+
return err;
}
@@ -1273,5 +1354,4 @@ ShaderPreprocessor::ShaderPreprocessor() {
}
ShaderPreprocessor::~ShaderPreprocessor() {
- clear();
}
diff --git a/servers/rendering/shader_preprocessor.h b/servers/rendering/shader_preprocessor.h
index f5902c64ca..2b7d2c274e 100644
--- a/servers/rendering/shader_preprocessor.h
+++ b/servers/rendering/shader_preprocessor.h
@@ -93,11 +93,13 @@ private:
int get_line() const;
int get_index() const;
char32_t peek();
+ int consume_line_continuations(int p_offset);
void get_and_clear_generated(Vector<Token> *r_out);
void backtrack(char32_t p_what);
LocalVector<Token> advance(char32_t p_what);
void skip_whitespace();
+ bool consume_empty_line();
String get_identifier(bool *r_is_cursor = nullptr, bool p_started = false);
String peek_identifier();
Token get_token();
@@ -167,7 +169,6 @@ private:
private:
LocalVector<char32_t> output;
State *state = nullptr;
- bool state_owner = false;
private:
static bool is_char_word(char32_t p_char);
@@ -211,7 +212,7 @@ private:
static Define *create_define(const String &p_body);
- void clear();
+ void clear_state();
Error preprocess(State *p_state, const String &p_code, String &r_result);
diff --git a/servers/rendering/storage/mesh_storage.h b/servers/rendering/storage/mesh_storage.h
index 704c2e015c..76e46a696a 100644
--- a/servers/rendering/storage/mesh_storage.h
+++ b/servers/rendering/storage/mesh_storage.h
@@ -83,6 +83,7 @@ public:
virtual void mesh_instance_set_skeleton(RID p_mesh_instance, RID p_skeleton) = 0;
virtual void mesh_instance_set_blend_shape_weight(RID p_mesh_instance, int p_shape, float p_weight) = 0;
virtual void mesh_instance_check_for_update(RID p_mesh_instance) = 0;
+ virtual void mesh_instance_set_canvas_item_transform(RID p_mesh_instance, const Transform2D &p_transform) = 0;
virtual void update_mesh_instances() = 0;
/* MULTIMESH API */
diff --git a/servers/rendering/storage/texture_storage.h b/servers/rendering/storage/texture_storage.h
index 92149b0064..4c4a84d04e 100644
--- a/servers/rendering/storage/texture_storage.h
+++ b/servers/rendering/storage/texture_storage.h
@@ -127,6 +127,7 @@ public:
virtual RID decal_instance_create(RID p_decal) = 0;
virtual void decal_instance_free(RID p_decal_instance) = 0;
virtual void decal_instance_set_transform(RID p_decal_instance, const Transform3D &p_transform) = 0;
+ virtual void decal_instance_set_sorting_offset(RID p_decal_instance, float p_sorting_offset) = 0;
/* RENDER TARGET */
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index e24b2af976..cea7912574 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -996,6 +996,7 @@ Error RenderingServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surfa
if (index_array_len) {
List<Variant> keys;
p_lods.get_key_list(&keys);
+ keys.sort(); // otherwise lod levels may get skipped
for (const Variant &E : keys) {
float distance = E;
ERR_CONTINUE(distance <= 0.0);
@@ -1826,6 +1827,7 @@ void RenderingServer::_bind_methods() {
BIND_BITFIELD_FLAG(ARRAY_FLAG_USE_2D_VERTICES);
BIND_BITFIELD_FLAG(ARRAY_FLAG_USE_DYNAMIC_UPDATE);
BIND_BITFIELD_FLAG(ARRAY_FLAG_USE_8_BONE_WEIGHTS);
+ BIND_BITFIELD_FLAG(ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY);
BIND_ENUM_CONSTANT(PRIMITIVE_POINTS);
BIND_ENUM_CONSTANT(PRIMITIVE_LINES);
@@ -2198,7 +2200,7 @@ void RenderingServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("viewport_get_texture", "viewport"), &RenderingServer::viewport_get_texture);
ClassDB::bind_method(D_METHOD("viewport_set_disable_3d", "viewport", "disable"), &RenderingServer::viewport_set_disable_3d);
ClassDB::bind_method(D_METHOD("viewport_set_disable_2d", "viewport", "disable"), &RenderingServer::viewport_set_disable_2d);
- ClassDB::bind_method(D_METHOD("viewport_set_disable_environment", "viewport", "disabled"), &RenderingServer::viewport_set_disable_environment);
+ ClassDB::bind_method(D_METHOD("viewport_set_environment_mode", "viewport", "mode"), &RenderingServer::viewport_set_environment_mode);
ClassDB::bind_method(D_METHOD("viewport_attach_camera", "viewport", "camera"), &RenderingServer::viewport_attach_camera);
ClassDB::bind_method(D_METHOD("viewport_set_scenario", "viewport", "scenario"), &RenderingServer::viewport_set_scenario);
ClassDB::bind_method(D_METHOD("viewport_attach_canvas", "viewport", "canvas"), &RenderingServer::viewport_attach_canvas);
@@ -2253,6 +2255,11 @@ void RenderingServer::_bind_methods() {
BIND_ENUM_CONSTANT(VIEWPORT_CLEAR_NEVER);
BIND_ENUM_CONSTANT(VIEWPORT_CLEAR_ONLY_NEXT_FRAME);
+ BIND_ENUM_CONSTANT(VIEWPORT_ENVIRONMENT_DISABLED);
+ BIND_ENUM_CONSTANT(VIEWPORT_ENVIRONMENT_ENABLED);
+ BIND_ENUM_CONSTANT(VIEWPORT_ENVIRONMENT_INHERIT);
+ BIND_ENUM_CONSTANT(VIEWPORT_ENVIRONMENT_MAX);
+
BIND_ENUM_CONSTANT(VIEWPORT_SDF_OVERSIZE_100_PERCENT);
BIND_ENUM_CONSTANT(VIEWPORT_SDF_OVERSIZE_120_PERCENT);
BIND_ENUM_CONSTANT(VIEWPORT_SDF_OVERSIZE_150_PERCENT);
@@ -2593,7 +2600,7 @@ void RenderingServer::_bind_methods() {
/* Primitives */
ClassDB::bind_method(D_METHOD("canvas_item_add_line", "item", "from", "to", "color", "width", "antialiased"), &RenderingServer::canvas_item_add_line, DEFVAL(-1.0), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("canvas_item_add_polyline", "item", "points", "colors", "width", "antialiased"), &RenderingServer::canvas_item_add_polyline, DEFVAL(1.0), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("canvas_item_add_polyline", "item", "points", "colors", "width", "antialiased"), &RenderingServer::canvas_item_add_polyline, DEFVAL(-1.0), DEFVAL(false));
ClassDB::bind_method(D_METHOD("canvas_item_add_rect", "item", "rect", "color"), &RenderingServer::canvas_item_add_rect);
ClassDB::bind_method(D_METHOD("canvas_item_add_circle", "item", "pos", "radius", "color"), &RenderingServer::canvas_item_add_circle);
ClassDB::bind_method(D_METHOD("canvas_item_add_texture_rect", "item", "rect", "texture", "tile", "modulate", "transpose"), &RenderingServer::canvas_item_add_texture_rect, DEFVAL(false), DEFVAL(Color(1, 1, 1)), DEFVAL(false));
@@ -2800,9 +2807,7 @@ void RenderingServer::mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry
Vector<Vector3> vertices;
Vector<Vector3> normals;
- for (uint32_t i = 0; i < p_mesh_data.faces.size(); i++) {
- const Geometry3D::MeshData::Face &f = p_mesh_data.faces[i];
-
+ for (const Geometry3D::MeshData::Face &f : p_mesh_data.faces) {
for (uint32_t j = 2; j < f.indices.size(); j++) {
vertices.push_back(p_mesh_data.vertices[f.indices[0]]);
normals.push_back(f.plane.normal);
@@ -2849,10 +2854,8 @@ RenderingServer::RenderingServer() {
}
void RenderingServer::init() {
- GLOBAL_DEF_RST("rendering/textures/vram_compression/import_bptc", false);
- GLOBAL_DEF_RST("rendering/textures/vram_compression/import_s3tc", true);
- GLOBAL_DEF_RST("rendering/textures/vram_compression/import_etc", false);
- GLOBAL_DEF_RST("rendering/textures/vram_compression/import_etc2", true);
+ GLOBAL_DEF_RST("rendering/textures/vram_compression/import_s3tc_bptc", OS::get_singleton()->get_preferred_texture_format() == OS::PREFERRED_TEXTURE_FORMAT_S3TC_BPTC);
+ GLOBAL_DEF_RST("rendering/textures/vram_compression/import_etc2_astc", OS::get_singleton()->get_preferred_texture_format() == OS::PREFERRED_TEXTURE_FORMAT_ETC2_ASTC);
GLOBAL_DEF("rendering/textures/lossless_compression/force_png", false);
@@ -2875,7 +2878,7 @@ void RenderingServer::init() {
GLOBAL_DEF("rendering/2d/shadow_atlas/size", 2048);
// Number of commands that can be drawn per frame.
- GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/gl_compatibility/item_buffer_size", PROPERTY_HINT_RANGE, "1024,1048576,1"), 16384);
+ GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/gl_compatibility/item_buffer_size", PROPERTY_HINT_RANGE, "128,1048576,1"), 16384);
GLOBAL_DEF("rendering/shader_compiler/shader_cache/enabled", true);
GLOBAL_DEF("rendering/shader_compiler/shader_cache/compress", true);
@@ -2961,9 +2964,9 @@ void RenderingServer::init() {
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/environment/volumetric_fog/volume_depth", PROPERTY_HINT_RANGE, "16,512,1"), 64);
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/environment/volumetric_fog/use_filter", PROPERTY_HINT_ENUM, "No (Faster),Yes (Higher Quality)"), 1);
- GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/limits/spatial_indexer/update_iterations_per_frame", PROPERTY_HINT_RANGE, "0,1024,1"), 10);
- GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/limits/spatial_indexer/threaded_cull_minimum_instances", PROPERTY_HINT_RANGE, "32,65536,1"), 1000);
- GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/limits/forward_renderer/threaded_render_minimum_instances", PROPERTY_HINT_RANGE, "32,65536,1"), 500);
+ GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/limits/spatial_indexer/update_iterations_per_frame", PROPERTY_HINT_RANGE, "0,1024,1"), 10);
+ GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/limits/spatial_indexer/threaded_cull_minimum_instances", PROPERTY_HINT_RANGE, "32,65536,1"), 1000);
+ GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/limits/forward_renderer/threaded_render_minimum_instances", PROPERTY_HINT_RANGE, "32,65536,1"), 500);
GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/limits/cluster_builder/max_clustered_elements", PROPERTY_HINT_RANGE, "32,8192,1"), 512);
diff --git a/servers/rendering_server.h b/servers/rendering_server.h
index 4b51099ef0..b416ed30e2 100644
--- a/servers/rendering_server.h
+++ b/servers/rendering_server.h
@@ -840,7 +840,14 @@ public:
virtual RID viewport_get_texture(RID p_viewport) const = 0;
- virtual void viewport_set_disable_environment(RID p_viewport, bool p_disable) = 0;
+ enum ViewportEnvironmentMode {
+ VIEWPORT_ENVIRONMENT_DISABLED,
+ VIEWPORT_ENVIRONMENT_ENABLED,
+ VIEWPORT_ENVIRONMENT_INHERIT,
+ VIEWPORT_ENVIRONMENT_MAX,
+ };
+
+ virtual void viewport_set_environment_mode(RID p_viewport, ViewportEnvironmentMode p_mode) = 0;
virtual void viewport_set_disable_3d(RID p_viewport, bool p_disable) = 0;
virtual void viewport_set_disable_2d(RID p_viewport, bool p_disable) = 0;
@@ -1335,7 +1342,7 @@ public:
};
virtual void canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width = -1.0, bool p_antialiased = false) = 0;
- virtual void canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0, bool p_antialiased = false) = 0;
+ virtual void canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = -1.0, bool p_antialiased = false) = 0;
virtual void canvas_item_add_multiline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = -1.0) = 0;
virtual void canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color) = 0;
virtual void canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color) = 0;
@@ -1639,6 +1646,7 @@ VARIANT_ENUM_CAST(RenderingServer::FogVolumeShape);
VARIANT_ENUM_CAST(RenderingServer::ViewportScaling3DMode);
VARIANT_ENUM_CAST(RenderingServer::ViewportUpdateMode);
VARIANT_ENUM_CAST(RenderingServer::ViewportClearMode);
+VARIANT_ENUM_CAST(RenderingServer::ViewportEnvironmentMode);
VARIANT_ENUM_CAST(RenderingServer::ViewportMSAA);
VARIANT_ENUM_CAST(RenderingServer::ViewportScreenSpaceAA);
VARIANT_ENUM_CAST(RenderingServer::ViewportRenderInfo);
diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp
index 997b83e32d..cbf37f25d6 100644
--- a/servers/text/text_server_extension.cpp
+++ b/servers/text/text_server_extension.cpp
@@ -1373,8 +1373,8 @@ String TextServerExtension::string_to_lower(const String &p_string, const String
return p_string;
}
-TypedArray<Vector2i> TextServerExtension::parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const {
- TypedArray<Vector2i> ret;
+TypedArray<Vector3i> TextServerExtension::parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const {
+ TypedArray<Vector3i> ret;
GDVIRTUAL_CALL(_parse_structured_text, p_parser_type, p_args, p_text, ret);
return ret;
}
diff --git a/servers/text/text_server_extension.h b/servers/text/text_server_extension.h
index fb784f5471..8536836983 100644
--- a/servers/text/text_server_extension.h
+++ b/servers/text/text_server_extension.h
@@ -521,8 +521,8 @@ public:
GDVIRTUAL2RC(String, _string_to_upper, const String &, const String &);
GDVIRTUAL2RC(String, _string_to_lower, const String &, const String &);
- TypedArray<Vector2i> parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const;
- GDVIRTUAL3RC(TypedArray<Vector2i>, _parse_structured_text, StructuredTextParser, const Array &, const String &);
+ TypedArray<Vector3i> parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const;
+ GDVIRTUAL3RC(TypedArray<Vector3i>, _parse_structured_text, StructuredTextParser, const Array &, const String &);
virtual int64_t is_confusable(const String &p_string, const PackedStringArray &p_dict) const override;
virtual bool spoof_check(const String &p_string) const override;
diff --git a/servers/text_server.cpp b/servers/text_server.cpp
index d339533688..027109b67d 100644
--- a/servers/text_server.cpp
+++ b/servers/text_server.cpp
@@ -483,6 +483,7 @@ void TextServer::_bind_methods() {
BIND_ENUM_CONSTANT(DIRECTION_AUTO);
BIND_ENUM_CONSTANT(DIRECTION_LTR);
BIND_ENUM_CONSTANT(DIRECTION_RTL);
+ BIND_ENUM_CONSTANT(DIRECTION_INHERITED);
/* Orientation */
BIND_ENUM_CONSTANT(ORIENTATION_HORIZONTAL);
@@ -599,7 +600,7 @@ void TextServer::_bind_methods() {
BIND_ENUM_CONSTANT(STRUCTURED_TEXT_FILE);
BIND_ENUM_CONSTANT(STRUCTURED_TEXT_EMAIL);
BIND_ENUM_CONSTANT(STRUCTURED_TEXT_LIST);
- BIND_ENUM_CONSTANT(STRUCTURED_TEXT_NONE);
+ BIND_ENUM_CONSTANT(STRUCTURED_TEXT_GDSCRIPT);
BIND_ENUM_CONSTANT(STRUCTURED_TEXT_CUSTOM);
}
@@ -1692,22 +1693,22 @@ String TextServer::strip_diacritics(const String &p_string) const {
return result;
}
-TypedArray<Vector2i> TextServer::parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const {
- TypedArray<Vector2i> ret;
+TypedArray<Vector3i> TextServer::parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const {
+ TypedArray<Vector3i> ret;
switch (p_parser_type) {
case STRUCTURED_TEXT_URI: {
int prev = 0;
for (int i = 0; i < p_text.length(); i++) {
if ((p_text[i] == '\\') || (p_text[i] == '/') || (p_text[i] == '.') || (p_text[i] == ':') || (p_text[i] == '&') || (p_text[i] == '=') || (p_text[i] == '@') || (p_text[i] == '?') || (p_text[i] == '#')) {
if (prev != i) {
- ret.push_back(Vector2i(prev, i));
+ ret.push_back(Vector3i(prev, i, TextServer::DIRECTION_AUTO));
}
- ret.push_back(Vector2i(i, i + 1));
+ ret.push_back(Vector3i(i, i + 1, TextServer::DIRECTION_LTR));
prev = i + 1;
}
}
if (prev != p_text.length()) {
- ret.push_back(Vector2i(prev, p_text.length()));
+ ret.push_back(Vector3i(prev, p_text.length(), TextServer::DIRECTION_AUTO));
}
} break;
case STRUCTURED_TEXT_FILE: {
@@ -1715,14 +1716,14 @@ TypedArray<Vector2i> TextServer::parse_structured_text(StructuredTextParser p_pa
for (int i = 0; i < p_text.length(); i++) {
if ((p_text[i] == '\\') || (p_text[i] == '/') || (p_text[i] == ':')) {
if (prev != i) {
- ret.push_back(Vector2i(prev, i));
+ ret.push_back(Vector3i(prev, i, TextServer::DIRECTION_AUTO));
}
- ret.push_back(Vector2i(i, i + 1));
+ ret.push_back(Vector3i(i, i + 1, TextServer::DIRECTION_LTR));
prev = i + 1;
}
}
if (prev != p_text.length()) {
- ret.push_back(Vector2i(prev, p_text.length()));
+ ret.push_back(Vector3i(prev, p_text.length(), TextServer::DIRECTION_AUTO));
}
} break;
case STRUCTURED_TEXT_EMAIL: {
@@ -1731,19 +1732,19 @@ TypedArray<Vector2i> TextServer::parse_structured_text(StructuredTextParser p_pa
for (int i = 0; i < p_text.length(); i++) {
if ((p_text[i] == '@') && local) { // Add full "local" as single context.
local = false;
- ret.push_back(Vector2i(prev, i));
- ret.push_back(Vector2i(i, i + 1));
+ ret.push_back(Vector3i(prev, i, TextServer::DIRECTION_AUTO));
+ ret.push_back(Vector3i(i, i + 1, TextServer::DIRECTION_LTR));
prev = i + 1;
} else if (!local && (p_text[i] == '.')) { // Add each dot separated "domain" part as context.
if (prev != i) {
- ret.push_back(Vector2i(prev, i));
+ ret.push_back(Vector3i(prev, i, TextServer::DIRECTION_AUTO));
}
- ret.push_back(Vector2i(i, i + 1));
+ ret.push_back(Vector3i(i, i + 1, TextServer::DIRECTION_LTR));
prev = i + 1;
}
}
if (prev != p_text.length()) {
- ret.push_back(Vector2i(prev, p_text.length()));
+ ret.push_back(Vector3i(prev, p_text.length(), TextServer::DIRECTION_AUTO));
}
} break;
case STRUCTURED_TEXT_LIST: {
@@ -1752,18 +1753,97 @@ TypedArray<Vector2i> TextServer::parse_structured_text(StructuredTextParser p_pa
int prev = 0;
for (int i = 0; i < tags.size(); i++) {
if (prev != i) {
- ret.push_back(Vector2i(prev, prev + tags[i].length()));
+ ret.push_back(Vector3i(prev, prev + tags[i].length(), TextServer::DIRECTION_INHERITED));
}
- ret.push_back(Vector2i(prev + tags[i].length(), prev + tags[i].length() + 1));
+ ret.push_back(Vector3i(prev + tags[i].length(), prev + tags[i].length() + 1, TextServer::DIRECTION_INHERITED));
prev = prev + tags[i].length() + 1;
}
}
} break;
+ case STRUCTURED_TEXT_GDSCRIPT: {
+ bool in_string_literal = false;
+ bool in_string_literal_single = false;
+ bool in_id = false;
+
+ int prev = 0;
+ for (int i = 0; i < p_text.length(); i++) {
+ char32_t c = p_text[i];
+ if (in_string_literal) {
+ if (c == '\\') {
+ i++;
+ continue; // Skip escaped chars.
+ } else if (c == '\"') {
+ // String literal end, push string and ".
+ if (prev != i) {
+ ret.push_back(Vector3i(prev, i, TextServer::DIRECTION_AUTO));
+ }
+ prev = i + 1;
+ ret.push_back(Vector3i(i, i + 1, TextServer::DIRECTION_LTR));
+ in_string_literal = false;
+ }
+ } else if (in_string_literal_single) {
+ if (c == '\\') {
+ i++;
+ continue; // Skip escaped chars.
+ } else if (c == '\'') {
+ // String literal end, push string and '.
+ if (prev != i) {
+ ret.push_back(Vector3i(prev, i, TextServer::DIRECTION_AUTO));
+ }
+ prev = i + 1;
+ ret.push_back(Vector3i(i, i + 1, TextServer::DIRECTION_LTR));
+ in_string_literal_single = false;
+ }
+ } else if (in_id) {
+ if (!is_unicode_identifier_continue(c)) {
+ // End of id, push id.
+ if (prev != i) {
+ ret.push_back(Vector3i(prev, i, TextServer::DIRECTION_AUTO));
+ }
+ prev = i;
+ in_id = false;
+ }
+ } else if (is_unicode_identifier_start(c)) {
+ // Start of new id, push prev element.
+ if (prev != i) {
+ ret.push_back(Vector3i(prev, i, TextServer::DIRECTION_AUTO));
+ }
+ prev = i;
+ in_id = true;
+ } else if (c == '\"') {
+ // String literal start, push prev element and ".
+ if (prev != i) {
+ ret.push_back(Vector3i(prev, i, TextServer::DIRECTION_AUTO));
+ }
+ prev = i + 1;
+ ret.push_back(Vector3i(i, i + 1, TextServer::DIRECTION_LTR));
+ in_string_literal = true;
+ } else if (c == '\'') {
+ // String literal start, push prev element and '.
+ if (prev != i) {
+ ret.push_back(Vector3i(prev, i, TextServer::DIRECTION_AUTO));
+ }
+ prev = i + 1;
+ ret.push_back(Vector3i(i, i + 1, TextServer::DIRECTION_LTR));
+ in_string_literal_single = true;
+ } else if (c == '#') {
+ // Start of comment, push prev element and #, skip the rest of the text.
+ if (prev != i) {
+ ret.push_back(Vector3i(prev, i, TextServer::DIRECTION_AUTO));
+ }
+ prev = i + 1;
+ ret.push_back(Vector3i(i, i + 1, TextServer::DIRECTION_LTR));
+ break;
+ }
+ }
+ if (prev < p_text.length()) {
+ ret.push_back(Vector3i(prev, p_text.length(), TextServer::DIRECTION_AUTO));
+ }
+ } break;
case STRUCTURED_TEXT_CUSTOM:
- case STRUCTURED_TEXT_NONE:
case STRUCTURED_TEXT_DEFAULT:
default: {
- ret.push_back(Vector2i(0, p_text.length()));
+ ret.push_back(Vector3i(0, p_text.length(), TextServer::DIRECTION_INHERITED));
}
}
return ret;
diff --git a/servers/text_server.h b/servers/text_server.h
index a56c7d8b23..a91d367e97 100644
--- a/servers/text_server.h
+++ b/servers/text_server.h
@@ -65,7 +65,8 @@ public:
enum Direction {
DIRECTION_AUTO,
DIRECTION_LTR,
- DIRECTION_RTL
+ DIRECTION_RTL,
+ DIRECTION_INHERITED,
};
enum Orientation {
@@ -198,7 +199,7 @@ public:
STRUCTURED_TEXT_FILE,
STRUCTURED_TEXT_EMAIL,
STRUCTURED_TEXT_LIST,
- STRUCTURED_TEXT_NONE,
+ STRUCTURED_TEXT_GDSCRIPT,
STRUCTURED_TEXT_CUSTOM
};
@@ -505,7 +506,7 @@ public:
virtual String string_to_upper(const String &p_string, const String &p_language = "") const = 0;
virtual String string_to_lower(const String &p_string, const String &p_language = "") const = 0;
- TypedArray<Vector2i> parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const;
+ TypedArray<Vector3i> parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const;
virtual void cleanup() {}
diff --git a/servers/xr/xr_positional_tracker.cpp b/servers/xr/xr_positional_tracker.cpp
index 87c1697a35..ffb89fc385 100644
--- a/servers/xr/xr_positional_tracker.cpp
+++ b/servers/xr/xr_positional_tracker.cpp
@@ -67,8 +67,8 @@ void XRPositionalTracker::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_input", "name", "value"), &XRPositionalTracker::set_input);
ADD_SIGNAL(MethodInfo("button_pressed", PropertyInfo(Variant::STRING, "name")));
ADD_SIGNAL(MethodInfo("button_released", PropertyInfo(Variant::STRING, "name")));
- ADD_SIGNAL(MethodInfo("input_value_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::FLOAT, "value")));
- ADD_SIGNAL(MethodInfo("input_axis_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::VECTOR2, "vector")));
+ ADD_SIGNAL(MethodInfo("input_float_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::FLOAT, "value")));
+ ADD_SIGNAL(MethodInfo("input_vector2_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::VECTOR2, "vector")));
ADD_SIGNAL(MethodInfo("profile_changed", PropertyInfo(Variant::STRING, "role")));
};
@@ -203,12 +203,12 @@ void XRPositionalTracker::set_input(const StringName &p_action_name, const Varia
// TODO discuss whether we also want to create and emit an InputEventXRButton event
} break;
case Variant::FLOAT: {
- emit_signal(SNAME("input_value_changed"), p_action_name, p_value);
+ emit_signal(SNAME("input_float_changed"), p_action_name, p_value);
// TODO discuss whether we also want to create and emit an InputEventXRValue event
} break;
case Variant::VECTOR2: {
- emit_signal(SNAME("input_axis_changed"), p_action_name, p_value);
+ emit_signal(SNAME("input_vector2_changed"), p_action_name, p_value);
// TODO discuss whether we also want to create and emit an InputEventXRAxis event
} break;
diff --git a/servers/xr_server.h b/servers/xr_server.h
index 086a18c111..04cf6c1d1e 100644
--- a/servers/xr_server.h
+++ b/servers/xr_server.h
@@ -111,7 +111,7 @@ public:
Most VR platforms, and our assumption, is that 1 unit in our virtual world equates to 1 meter in the real mode.
This scale basically effects the unit size relationship to real world size.
- I may remove access to this property in GDScript in favour of exposing it on the XROrigin3D node
+ I may remove access to this property in GDScript in favor of exposing it on the XROrigin3D node
*/
double get_world_scale() const;
void set_world_scale(double p_world_scale);
diff --git a/tests/core/input/test_input_event_key.h b/tests/core/input/test_input_event_key.h
index 697215bab7..3317941fad 100644
--- a/tests/core/input/test_input_event_key.h
+++ b/tests/core/input/test_input_event_key.h
@@ -106,11 +106,11 @@ TEST_CASE("[InputEventKey] Key correctly converts itself to text") {
// Key is None without a physical key.
none_key.set_keycode(Key::NONE);
- CHECK(none_key.as_text() == " (Physical)");
+ CHECK(none_key.as_text() == "(Unset)");
// Key is none and has modifiers.
none_key.set_ctrl_pressed(true);
- CHECK(none_key.as_text() == "Ctrl+ (Physical)");
+ CHECK(none_key.as_text() == "Ctrl+(Unset)");
// Key is None WITH a physical key AND modifiers.
none_key.set_physical_keycode(Key::ENTER);
@@ -144,8 +144,7 @@ TEST_CASE("[InputEventKey] Key correctly converts itself to text") {
TEST_CASE("[InputEventKey] Key correctly converts its state to a string representation") {
InputEventKey none_key;
- // Set physical to true.
- CHECK(none_key.to_string() == "InputEventKey: keycode=0 (), mods=none, physical=true, pressed=false, echo=false");
+ CHECK(none_key.to_string() == "InputEventKey: keycode=(Unset), mods=none, physical=false, pressed=false, echo=false");
// Set physical key to Escape.
none_key.set_physical_keycode(Key::ESCAPE);
CHECK(none_key.to_string() == "InputEventKey: keycode=4194305 (Escape), mods=none, physical=true, pressed=false, echo=false");
diff --git a/tests/core/input/test_input_event_mouse.h b/tests/core/input/test_input_event_mouse.h
new file mode 100644
index 0000000000..0da4f14160
--- /dev/null
+++ b/tests/core/input/test_input_event_mouse.h
@@ -0,0 +1,81 @@
+/**************************************************************************/
+/* test_input_event_mouse.h */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 TEST_INPUT_EVENT_MOUSE_H
+#define TEST_INPUT_EVENT_MOUSE_H
+
+#include "core/input/input_event.h"
+#include "tests/test_macros.h"
+
+namespace TestInputEventMouse {
+
+TEST_CASE("[InputEventMouse] Mouse button mask is set correctly") {
+ InputEventMouse mousekey;
+
+ mousekey.set_button_mask(MouseButtonMask::LEFT);
+ CHECK(mousekey.get_button_mask().has_flag(MouseButtonMask::LEFT));
+
+ mousekey.set_button_mask(MouseButtonMask::MB_XBUTTON1);
+ CHECK(mousekey.get_button_mask().has_flag(MouseButtonMask::MB_XBUTTON1));
+
+ mousekey.set_button_mask(MouseButtonMask::MB_XBUTTON2);
+ CHECK(mousekey.get_button_mask().has_flag(MouseButtonMask::MB_XBUTTON2));
+
+ mousekey.set_button_mask(MouseButtonMask::MIDDLE);
+ CHECK(mousekey.get_button_mask().has_flag(MouseButtonMask::MIDDLE));
+
+ mousekey.set_button_mask(MouseButtonMask::RIGHT);
+ CHECK(mousekey.get_button_mask().has_flag(MouseButtonMask::RIGHT));
+}
+
+TEST_CASE("[InputEventMouse] Setting the mouse position works correctly") {
+ InputEventMouse mousekey;
+
+ mousekey.set_position(Vector2{ 10, 10 });
+ CHECK(mousekey.get_position() == Vector2{ 10, 10 });
+
+ mousekey.set_position(Vector2{ -1, -1 });
+ CHECK(mousekey.get_position() == Vector2{ -1, -1 });
+}
+
+TEST_CASE("[InputEventMouse] Setting the global mouse position works correctly") {
+ InputEventMouse mousekey;
+
+ mousekey.set_global_position(Vector2{ 10, 10 });
+ CHECK(mousekey.get_global_position() == Vector2{ 10, 10 });
+ CHECK(mousekey.get_global_position() != Vector2{ 1, 1 });
+
+ mousekey.set_global_position(Vector2{ -1, -1 });
+ CHECK(mousekey.get_global_position() == Vector2{ -1, -1 });
+ CHECK(mousekey.get_global_position() != Vector2{ 1, 1 });
+}
+} // namespace TestInputEventMouse
+
+#endif // TEST_INPUT_EVENT_MOUSE_H
diff --git a/tests/core/io/test_file_access.h b/tests/core/io/test_file_access.h
index 7117cb137d..243b75626f 100644
--- a/tests/core/io/test_file_access.h
+++ b/tests/core/io/test_file_access.h
@@ -39,6 +39,7 @@ namespace TestFileAccess {
TEST_CASE("[FileAccess] CSV read") {
Ref<FileAccess> f = FileAccess::open(TestUtils::get_data_path("translations.csv"), FileAccess::READ);
+ REQUIRE(!f.is_null());
Vector<String> header = f->get_csv_line(); // Default delimiter: ",".
REQUIRE(header.size() == 3);
@@ -81,6 +82,7 @@ TEST_CASE("[FileAccess] CSV read") {
TEST_CASE("[FileAccess] Get as UTF-8 String") {
Ref<FileAccess> f_lf = FileAccess::open(TestUtils::get_data_path("line_endings_lf.test.txt"), FileAccess::READ);
+ REQUIRE(!f_lf.is_null());
String s_lf = f_lf->get_as_utf8_string();
f_lf->seek(0);
String s_lf_nocr = f_lf->get_as_utf8_string(true);
@@ -88,6 +90,7 @@ TEST_CASE("[FileAccess] Get as UTF-8 String") {
CHECK(s_lf_nocr == "Hello darkness\nMy old friend\nI've come to talk\nWith you again\n");
Ref<FileAccess> f_crlf = FileAccess::open(TestUtils::get_data_path("line_endings_crlf.test.txt"), FileAccess::READ);
+ REQUIRE(!f_crlf.is_null());
String s_crlf = f_crlf->get_as_utf8_string();
f_crlf->seek(0);
String s_crlf_nocr = f_crlf->get_as_utf8_string(true);
@@ -95,6 +98,7 @@ TEST_CASE("[FileAccess] Get as UTF-8 String") {
CHECK(s_crlf_nocr == "Hello darkness\nMy old friend\nI've come to talk\nWith you again\n");
Ref<FileAccess> f_cr = FileAccess::open(TestUtils::get_data_path("line_endings_cr.test.txt"), FileAccess::READ);
+ REQUIRE(!f_cr.is_null());
String s_cr = f_cr->get_as_utf8_string();
f_cr->seek(0);
String s_cr_nocr = f_cr->get_as_utf8_string(true);
diff --git a/tests/core/io/test_image.h b/tests/core/io/test_image.h
index 3d52bc96d1..763eaed2f8 100644
--- a/tests/core/io/test_image.h
+++ b/tests/core/io/test_image.h
@@ -107,6 +107,7 @@ TEST_CASE("[Image] Saving and loading") {
// Load BMP
Ref<Image> image_bmp = memnew(Image());
Ref<FileAccess> f_bmp = FileAccess::open(TestUtils::get_data_path("images/icon.bmp"), FileAccess::READ, &err);
+ REQUIRE(!f_bmp.is_null());
PackedByteArray data_bmp;
data_bmp.resize(f_bmp->get_length() + 1);
f_bmp->get_buffer(data_bmp.ptrw(), f_bmp->get_length());
@@ -117,6 +118,7 @@ TEST_CASE("[Image] Saving and loading") {
// Load JPG
Ref<Image> image_jpg = memnew(Image());
Ref<FileAccess> f_jpg = FileAccess::open(TestUtils::get_data_path("images/icon.jpg"), FileAccess::READ, &err);
+ REQUIRE(!f_jpg.is_null());
PackedByteArray data_jpg;
data_jpg.resize(f_jpg->get_length() + 1);
f_jpg->get_buffer(data_jpg.ptrw(), f_jpg->get_length());
@@ -127,6 +129,7 @@ TEST_CASE("[Image] Saving and loading") {
// Load WebP
Ref<Image> image_webp = memnew(Image());
Ref<FileAccess> f_webp = FileAccess::open(TestUtils::get_data_path("images/icon.webp"), FileAccess::READ, &err);
+ REQUIRE(!f_webp.is_null());
PackedByteArray data_webp;
data_webp.resize(f_webp->get_length() + 1);
f_webp->get_buffer(data_webp.ptrw(), f_webp->get_length());
@@ -137,6 +140,7 @@ TEST_CASE("[Image] Saving and loading") {
// Load PNG
Ref<Image> image_png = memnew(Image());
Ref<FileAccess> f_png = FileAccess::open(TestUtils::get_data_path("images/icon.png"), FileAccess::READ, &err);
+ REQUIRE(!f_png.is_null());
PackedByteArray data_png;
data_png.resize(f_png->get_length() + 1);
f_png->get_buffer(data_png.ptrw(), f_png->get_length());
@@ -147,6 +151,7 @@ TEST_CASE("[Image] Saving and loading") {
// Load TGA
Ref<Image> image_tga = memnew(Image());
Ref<FileAccess> f_tga = FileAccess::open(TestUtils::get_data_path("images/icon.tga"), FileAccess::READ, &err);
+ REQUIRE(!f_tga.is_null());
PackedByteArray data_tga;
data_tga.resize(f_tga->get_length() + 1);
f_tga->get_buffer(data_tga.ptrw(), f_tga->get_length());
diff --git a/tests/core/math/test_geometry_3d.h b/tests/core/math/test_geometry_3d.h
index 8d57bd5319..46a99aa4b6 100644
--- a/tests/core/math/test_geometry_3d.h
+++ b/tests/core/math/test_geometry_3d.h
@@ -388,13 +388,13 @@ TEST_CASE("[Geometry3D] Segment Intersects Triangle") {
TEST_CASE("[Geometry3D] Triangle and Box Overlap") {
struct Case {
- Vector3 box_centre;
+ Vector3 box_center;
Vector3 box_half_size;
Vector3 *tri_verts = nullptr;
bool want;
Case(){};
- Case(Vector3 p_centre, Vector3 p_half_size, Vector3 *p_verts, bool p_want) :
- box_centre(p_centre), box_half_size(p_half_size), tri_verts(p_verts), want(p_want){};
+ Case(Vector3 p_center, Vector3 p_half_size, Vector3 *p_verts, bool p_want) :
+ box_center(p_center), box_half_size(p_half_size), tri_verts(p_verts), want(p_want){};
};
Vector<Case> tt;
Vector3 GoodTriangle[3] = { Vector3(3, 2, 3), Vector3(2, 2, 1), Vector3(2, 1, 1) };
@@ -403,7 +403,7 @@ TEST_CASE("[Geometry3D] Triangle and Box Overlap") {
tt.push_back(Case(Vector3(1000, 1000, 1000), Vector3(1, 1, 1), BadTriangle, false));
for (int i = 0; i < tt.size(); ++i) {
Case current_case = tt[i];
- bool output = Geometry3D::triangle_box_overlap(current_case.box_centre, current_case.box_half_size, current_case.tri_verts);
+ bool output = Geometry3D::triangle_box_overlap(current_case.box_center, current_case.box_half_size, current_case.tri_verts);
CHECK(output == current_case.want);
}
}
diff --git a/tests/core/math/test_transform_2d.h b/tests/core/math/test_transform_2d.h
index dc2b6e2ba8..ca27776180 100644
--- a/tests/core/math/test_transform_2d.h
+++ b/tests/core/math/test_transform_2d.h
@@ -84,6 +84,19 @@ TEST_CASE("[Transform2D] rotation") {
CHECK(orig.rotated_local(phi) == orig * R);
}
+TEST_CASE("[Transform2D] Interpolation") {
+ Transform2D rotate_scale_skew_pos = Transform2D(Math::deg_to_rad(170.0), Vector2(3.6, 8.0), Math::deg_to_rad(20.0), Vector2(2.4, 6.8));
+ Transform2D rotate_scale_skew_pos_halfway = Transform2D(Math::deg_to_rad(85.0), Vector2(2.3, 4.5), Math::deg_to_rad(10.0), Vector2(1.2, 3.4));
+ Transform2D interpolated = Transform2D().interpolate_with(rotate_scale_skew_pos, 0.5);
+ CHECK(interpolated.get_origin().is_equal_approx(rotate_scale_skew_pos_halfway.get_origin()));
+ CHECK(interpolated.get_rotation() == doctest::Approx(rotate_scale_skew_pos_halfway.get_rotation()));
+ CHECK(interpolated.get_scale().is_equal_approx(rotate_scale_skew_pos_halfway.get_scale()));
+ CHECK(interpolated.get_skew() == doctest::Approx(rotate_scale_skew_pos_halfway.get_skew()));
+ CHECK(interpolated.is_equal_approx(rotate_scale_skew_pos_halfway));
+ interpolated = rotate_scale_skew_pos.interpolate_with(Transform2D(), 0.5);
+ CHECK(interpolated.is_equal_approx(rotate_scale_skew_pos_halfway));
+}
+
TEST_CASE("[Transform2D] Finite number checks") {
const Vector2 x(0, 1);
const Vector2 infinite(NAN, NAN);
diff --git a/tests/core/object/test_class_db.h b/tests/core/object/test_class_db.h
index eeb1648924..e68995e539 100644
--- a/tests/core/object/test_class_db.h
+++ b/tests/core/object/test_class_db.h
@@ -559,6 +559,8 @@ void add_exposed_classes(Context &r_context) {
MethodData method;
method.name = method_info.name;
+ TEST_FAIL_COND(!String(method.name).is_valid_identifier(),
+ "Method name is not a valid identifier: '", exposed_class.name, ".", method.name, "'.");
if (method_info.flags & METHOD_FLAG_VIRTUAL) {
method.is_virtual = true;
@@ -682,6 +684,8 @@ void add_exposed_classes(Context &r_context) {
const MethodInfo &method_info = signal_map.get(K.key);
signal.name = method_info.name;
+ TEST_FAIL_COND(!String(signal.name).is_valid_identifier(),
+ "Signal name is not a valid identifier: '", exposed_class.name, ".", signal.name, "'.");
int argc = method_info.arguments.size();
diff --git a/tests/core/variant/test_variant.h b/tests/core/variant/test_variant.h
index 85b53264f2..dfbaa36af8 100644
--- a/tests/core/variant/test_variant.h
+++ b/tests/core/variant/test_variant.h
@@ -868,6 +868,196 @@ TEST_CASE("[Variant] Basic comparison") {
CHECK_NE(Variant(Dictionary()), Variant());
}
+TEST_CASE("[Variant] Identity comparison") {
+ // Value types are compared by value
+ Variant aabb = AABB();
+ CHECK(aabb.identity_compare(aabb));
+ CHECK(aabb.identity_compare(AABB()));
+ CHECK_FALSE(aabb.identity_compare(AABB(Vector3(1, 2, 3), Vector3(1, 2, 3))));
+
+ Variant basis = Basis();
+ CHECK(basis.identity_compare(basis));
+ CHECK(basis.identity_compare(Basis()));
+ CHECK_FALSE(basis.identity_compare(Basis(Quaternion(Vector3(1, 2, 3).normalized(), 45))));
+
+ Variant bool_var = true;
+ CHECK(bool_var.identity_compare(bool_var));
+ CHECK(bool_var.identity_compare(true));
+ CHECK_FALSE(bool_var.identity_compare(false));
+
+ Variant callable = Callable();
+ CHECK(callable.identity_compare(callable));
+ CHECK(callable.identity_compare(Callable()));
+ CHECK_FALSE(callable.identity_compare(Callable(ObjectID(), StringName("lambda"))));
+
+ Variant color = Color();
+ CHECK(color.identity_compare(color));
+ CHECK(color.identity_compare(Color()));
+ CHECK_FALSE(color.identity_compare(Color(255, 0, 255)));
+
+ Variant float_var = 1.0;
+ CHECK(float_var.identity_compare(float_var));
+ CHECK(float_var.identity_compare(1.0));
+ CHECK_FALSE(float_var.identity_compare(2.0));
+
+ Variant int_var = 1;
+ CHECK(int_var.identity_compare(int_var));
+ CHECK(int_var.identity_compare(1));
+ CHECK_FALSE(int_var.identity_compare(2));
+
+ Variant nil = Variant();
+ CHECK(nil.identity_compare(nil));
+ CHECK(nil.identity_compare(Variant()));
+ CHECK_FALSE(nil.identity_compare(true));
+
+ Variant node_path = NodePath("godot");
+ CHECK(node_path.identity_compare(node_path));
+ CHECK(node_path.identity_compare(NodePath("godot")));
+ CHECK_FALSE(node_path.identity_compare(NodePath("waiting")));
+
+ Variant plane = Plane();
+ CHECK(plane.identity_compare(plane));
+ CHECK(plane.identity_compare(Plane()));
+ CHECK_FALSE(plane.identity_compare(Plane(Vector3(1, 2, 3), 42)));
+
+ Variant projection = Projection();
+ CHECK(projection.identity_compare(projection));
+ CHECK(projection.identity_compare(Projection()));
+ CHECK_FALSE(projection.identity_compare(Projection(Transform3D(Basis(Vector3(1, 2, 3).normalized(), 45), Vector3(1, 2, 3)))));
+
+ Variant quaternion = Quaternion();
+ CHECK(quaternion.identity_compare(quaternion));
+ CHECK(quaternion.identity_compare(Quaternion()));
+ CHECK_FALSE(quaternion.identity_compare(Quaternion(Vector3(1, 2, 3).normalized(), 45)));
+
+ Variant rect2 = Rect2();
+ CHECK(rect2.identity_compare(rect2));
+ CHECK(rect2.identity_compare(Rect2()));
+ CHECK_FALSE(rect2.identity_compare(Rect2(Point2(Vector2(1, 2)), Size2(Vector2(1, 2)))));
+
+ Variant rect2i = Rect2i();
+ CHECK(rect2i.identity_compare(rect2i));
+ CHECK(rect2i.identity_compare(Rect2i()));
+ CHECK_FALSE(rect2i.identity_compare(Rect2i(Point2i(Vector2i(1, 2)), Size2i(Vector2i(1, 2)))));
+
+ Variant rid = RID();
+ CHECK(rid.identity_compare(rid));
+ CHECK(rid.identity_compare(RID()));
+ CHECK_FALSE(rid.identity_compare(RID::from_uint64(123)));
+
+ Variant signal = Signal();
+ CHECK(signal.identity_compare(signal));
+ CHECK(signal.identity_compare(Signal()));
+ CHECK_FALSE(signal.identity_compare(Signal(ObjectID(), StringName("lambda"))));
+
+ Variant str = "godot";
+ CHECK(str.identity_compare(str));
+ CHECK(str.identity_compare("godot"));
+ CHECK_FALSE(str.identity_compare("waiting"));
+
+ Variant str_name = StringName("godot");
+ CHECK(str_name.identity_compare(str_name));
+ CHECK(str_name.identity_compare(StringName("godot")));
+ CHECK_FALSE(str_name.identity_compare(StringName("waiting")));
+
+ Variant transform2d = Transform2D();
+ CHECK(transform2d.identity_compare(transform2d));
+ CHECK(transform2d.identity_compare(Transform2D()));
+ CHECK_FALSE(transform2d.identity_compare(Transform2D(45, Vector2(1, 2))));
+
+ Variant transform3d = Transform3D();
+ CHECK(transform3d.identity_compare(transform3d));
+ CHECK(transform3d.identity_compare(Transform3D()));
+ CHECK_FALSE(transform3d.identity_compare(Transform3D(Basis(Quaternion(Vector3(1, 2, 3).normalized(), 45)), Vector3(1, 2, 3))));
+
+ Variant vect2 = Vector2();
+ CHECK(vect2.identity_compare(vect2));
+ CHECK(vect2.identity_compare(Vector2()));
+ CHECK_FALSE(vect2.identity_compare(Vector2(1, 2)));
+
+ Variant vect2i = Vector2i();
+ CHECK(vect2i.identity_compare(vect2i));
+ CHECK(vect2i.identity_compare(Vector2i()));
+ CHECK_FALSE(vect2i.identity_compare(Vector2i(1, 2)));
+
+ Variant vect3 = Vector3();
+ CHECK(vect3.identity_compare(vect3));
+ CHECK(vect3.identity_compare(Vector3()));
+ CHECK_FALSE(vect3.identity_compare(Vector3(1, 2, 3)));
+
+ Variant vect3i = Vector3i();
+ CHECK(vect3i.identity_compare(vect3i));
+ CHECK(vect3i.identity_compare(Vector3i()));
+ CHECK_FALSE(vect3i.identity_compare(Vector3i(1, 2, 3)));
+
+ Variant vect4 = Vector4();
+ CHECK(vect4.identity_compare(vect4));
+ CHECK(vect4.identity_compare(Vector4()));
+ CHECK_FALSE(vect4.identity_compare(Vector4(1, 2, 3, 4)));
+
+ Variant vect4i = Vector4i();
+ CHECK(vect4i.identity_compare(vect4i));
+ CHECK(vect4i.identity_compare(Vector4i()));
+ CHECK_FALSE(vect4i.identity_compare(Vector4i(1, 2, 3, 4)));
+
+ // Reference types are compared by reference
+ Variant array = Array();
+ CHECK(array.identity_compare(array));
+ CHECK_FALSE(array.identity_compare(Array()));
+
+ Variant dictionary = Dictionary();
+ CHECK(dictionary.identity_compare(dictionary));
+ CHECK_FALSE(dictionary.identity_compare(Dictionary()));
+
+ Variant packed_byte_array = PackedByteArray();
+ CHECK(packed_byte_array.identity_compare(packed_byte_array));
+ CHECK_FALSE(packed_byte_array.identity_compare(PackedByteArray()));
+
+ Variant packed_color_array = PackedColorArray();
+ CHECK(packed_color_array.identity_compare(packed_color_array));
+ CHECK_FALSE(packed_color_array.identity_compare(PackedColorArray()));
+
+ Variant packed_float32_array = PackedFloat32Array();
+ CHECK(packed_float32_array.identity_compare(packed_float32_array));
+ CHECK_FALSE(packed_float32_array.identity_compare(PackedFloat32Array()));
+
+ Variant packed_float64_array = PackedFloat64Array();
+ CHECK(packed_float64_array.identity_compare(packed_float64_array));
+ CHECK_FALSE(packed_float64_array.identity_compare(PackedFloat64Array()));
+
+ Variant packed_int32_array = PackedInt32Array();
+ CHECK(packed_int32_array.identity_compare(packed_int32_array));
+ CHECK_FALSE(packed_int32_array.identity_compare(PackedInt32Array()));
+
+ Variant packed_int64_array = PackedInt64Array();
+ CHECK(packed_int64_array.identity_compare(packed_int64_array));
+ CHECK_FALSE(packed_int64_array.identity_compare(PackedInt64Array()));
+
+ Variant packed_string_array = PackedStringArray();
+ CHECK(packed_string_array.identity_compare(packed_string_array));
+ CHECK_FALSE(packed_string_array.identity_compare(PackedStringArray()));
+
+ Variant packed_vector2_array = PackedVector2Array();
+ CHECK(packed_vector2_array.identity_compare(packed_vector2_array));
+ CHECK_FALSE(packed_vector2_array.identity_compare(PackedVector2Array()));
+
+ Variant packed_vector3_array = PackedVector3Array();
+ CHECK(packed_vector3_array.identity_compare(packed_vector3_array));
+ CHECK_FALSE(packed_vector3_array.identity_compare(PackedVector3Array()));
+
+ Object obj_one = Object();
+ Variant obj_one_var = &obj_one;
+ Object obj_two = Object();
+ Variant obj_two_var = &obj_two;
+ CHECK(obj_one_var.identity_compare(obj_one_var));
+ CHECK_FALSE(obj_one_var.identity_compare(obj_two_var));
+
+ Variant obj_null_one_var = Variant((Object *)nullptr);
+ Variant obj_null_two_var = Variant((Object *)nullptr);
+ CHECK(obj_null_one_var.identity_compare(obj_null_one_var));
+ CHECK(obj_null_one_var.identity_compare(obj_null_two_var));
+}
+
TEST_CASE("[Variant] Nested array comparison") {
Array a1 = build_array(1, build_array(2, 3));
Array a2 = build_array(1, build_array(2, 3));
diff --git a/tests/scene/test_arraymesh.h b/tests/scene/test_arraymesh.h
index 4d9feeb4fa..b2a2ecc3bf 100644
--- a/tests/scene/test_arraymesh.h
+++ b/tests/scene/test_arraymesh.h
@@ -114,6 +114,17 @@ TEST_CASE("[SceneTree][ArrayMesh] Adding and modifying blendshapes.") {
CHECK(mesh->get_blend_shape_count() == 0);
}
+ SUBCASE("Can't add surface with incorrect number of blend shapes.") {
+ mesh->add_blend_shape(name_a);
+ mesh->add_blend_shape(name_b);
+ Ref<CylinderMesh> cylinder = memnew(CylinderMesh);
+ Array cylinder_array{};
+ ERR_PRINT_OFF
+ mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, cylinder_array);
+ ERR_PRINT_ON
+ CHECK(mesh->get_surface_count() == 0);
+ }
+
SUBCASE("Can't clear blend shapes after surface had been added.") {
mesh->add_blend_shape(name_a);
mesh->add_blend_shape(name_b);
@@ -121,7 +132,15 @@ TEST_CASE("[SceneTree][ArrayMesh] Adding and modifying blendshapes.") {
Array cylinder_array{};
cylinder_array.resize(Mesh::ARRAY_MAX);
cylinder->create_mesh_array(cylinder_array, 3.f, 3.f, 5.f);
- mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, cylinder_array);
+ Array blend_shape{};
+ blend_shape.resize(Mesh::ARRAY_MAX);
+ blend_shape[Mesh::ARRAY_VERTEX] = cylinder_array[Mesh::ARRAY_VERTEX];
+ blend_shape[Mesh::ARRAY_NORMAL] = cylinder_array[Mesh::ARRAY_NORMAL];
+ blend_shape[Mesh::ARRAY_TANGENT] = cylinder_array[Mesh::ARRAY_TANGENT];
+ Array blend_shapes{};
+ blend_shapes.push_back(blend_shape);
+ blend_shapes.push_back(blend_shape);
+ mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, cylinder_array, blend_shapes);
ERR_PRINT_OFF
mesh->clear_blend_shapes();
diff --git a/tests/scene/test_code_edit.h b/tests/scene/test_code_edit.h
index e98aece305..828029dabe 100644
--- a/tests/scene/test_code_edit.h
+++ b/tests/scene/test_code_edit.h
@@ -2773,7 +2773,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") {
CHECK(code_edit->get_line(0) == "''");
CHECK(code_edit->get_caret_column() == 1);
- /* Move out from centre, Should match and insert larger key. */
+ /* Move out from center, Should match and insert larger key. */
SEND_GUI_ACTION(code_edit, "ui_text_caret_right");
SEND_GUI_KEY_EVENT(code_edit, Key::APOSTROPHE);
CHECK(code_edit->get_line(0) == "''''''");
diff --git a/tests/scene/test_primitives.h b/tests/scene/test_primitives.h
index 6cdb5fb0a5..9232a3020d 100644
--- a/tests/scene/test_primitives.h
+++ b/tests/scene/test_primitives.h
@@ -734,7 +734,7 @@ TEST_CASE("[SceneTree][Primitive][Text] Text Primitive") {
text->get_structured_text_bidi_override() == TextServer::STRUCTURED_TEXT_FILE ||
text->get_structured_text_bidi_override() == TextServer::STRUCTURED_TEXT_EMAIL ||
text->get_structured_text_bidi_override() == TextServer::STRUCTURED_TEXT_LIST ||
- text->get_structured_text_bidi_override() == TextServer::STRUCTURED_TEXT_NONE ||
+ text->get_structured_text_bidi_override() == TextServer::STRUCTURED_TEXT_GDSCRIPT ||
text->get_structured_text_bidi_override() == TextServer::STRUCTURED_TEXT_CUSTOM));
CHECK(text->get_structured_text_bidi_override_options().size() >= 0);
CHECK(text->get_width() > 0);
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 8c563f94ac..c7f2d4cbfb 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -32,6 +32,7 @@
#include "tests/core/config/test_project_settings.h"
#include "tests/core/input/test_input_event_key.h"
+#include "tests/core/input/test_input_event_mouse.h"
#include "tests/core/input/test_shortcut.h"
#include "tests/core/io/test_config_file.h"
#include "tests/core/io/test_file_access.h"
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 33f835cbcd..38001b8782 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -17,6 +17,18 @@ Files extracted from upstream source:
- `license.txt`
+## astcenc
+
+- Upstream: https://github.com/ARM-software/astc-encoder
+- Version: 4.3.0 (ec83dda79fcefe07f69cdae7ed980d169bf2c4d4, 2023)
+- License: Apache 2.0
+
+Files extracted from upstream source:
+
+- `astcenc_*` and `astcenc.h` files from `Source`
+- `LICENSE.txt`
+
+
## basis_universal
- Upstream: https://github.com/BinomialLLC/basis_universal
diff --git a/thirdparty/astcenc/LICENSE.txt b/thirdparty/astcenc/LICENSE.txt
new file mode 100644
index 0000000000..b82735a310
--- /dev/null
+++ b/thirdparty/astcenc/LICENSE.txt
@@ -0,0 +1,175 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/thirdparty/astcenc/astcenc.h b/thirdparty/astcenc/astcenc.h
new file mode 100644
index 0000000000..70ae783373
--- /dev/null
+++ b/thirdparty/astcenc/astcenc.h
@@ -0,0 +1,815 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2020-2023 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief The core astcenc codec library interface.
+ *
+ * This interface is the entry point to the core astcenc codec. It aims to be easy to use for
+ * non-experts, but also to allow experts to have fine control over the compressor heuristics if
+ * needed. The core codec only handles compression and decompression, transferring all inputs and
+ * outputs via memory buffers. To catch obvious input/output buffer sizing issues, which can cause
+ * security and stability problems, all transfer buffers are explicitly sized.
+ *
+ * While the aim is that we keep this interface mostly stable, it should be viewed as a mutable
+ * interface tied to a specific source version. We are not trying to maintain backwards
+ * compatibility across codec versions.
+ *
+ * The API state management is based around an explicit context object, which is the context for all
+ * allocated memory resources needed to compress and decompress a single image. A context can be
+ * used to sequentially compress multiple images using the same configuration, allowing setup
+ * overheads to be amortized over multiple images, which is particularly important when images are
+ * small.
+ *
+ * Multi-threading can be used two ways.
+ *
+ * * An application wishing to process multiple images in parallel can allocate multiple
+ * contexts and assign each context to a thread.
+ * * An application wishing to process a single image in using multiple threads can configure
+ * contexts for multi-threaded use, and invoke astcenc_compress/decompress() once per thread
+ * for faster processing. The caller is responsible for creating the worker threads, and
+ * synchronizing between images.
+ *
+ * Threading
+ * =========
+ *
+ * In pseudo-code, the usage for manual user threading looks like this:
+ *
+ * // Configure the compressor run
+ * astcenc_config my_config;
+ * astcenc_config_init(..., &my_config);
+ *
+ * // Power users can tweak <my_config> settings here ...
+ *
+ * // Allocate working state given config and thread_count
+ * astcenc_context* my_context;
+ * astcenc_context_alloc(&my_config, thread_count, &my_context);
+ *
+ * // Compress each image using these config settings
+ * foreach image:
+ * // For each thread in the thread pool
+ * for i in range(0, thread_count):
+ * astcenc_compress_image(my_context, &my_input, my_output, i);
+ *
+ * astcenc_compress_reset(my_context);
+ *
+ * // Clean up
+ * astcenc_context_free(my_context);
+ *
+ * Images
+ * ======
+ *
+ * The codec supports compressing single images, which can be either 2D images or volumetric 3D
+ * images. Calling code is responsible for any handling of aggregate types, such as mipmap chains,
+ * texture arrays, or sliced 3D textures.
+ *
+ * Images are passed in as an astcenc_image structure. Inputs can be either 8-bit unorm, 16-bit
+ * half-float, or 32-bit float, as indicated by the data_type field.
+ *
+ * Images can be any dimension; there is no requirement to be a multiple of the ASTC block size.
+ *
+ * Data is always passed in as 4 color components, and accessed as an array of 2D image slices. Data
+ * within an image slice is always tightly packed without padding. Addressing looks like this:
+ *
+ * data[z_coord][y_coord * x_dim * 4 + x_coord * 4 ] // Red
+ * data[z_coord][y_coord * x_dim * 4 + x_coord * 4 + 1] // Green
+ * data[z_coord][y_coord * x_dim * 4 + x_coord * 4 + 2] // Blue
+ * data[z_coord][y_coord * x_dim * 4 + x_coord * 4 + 3] // Alpha
+ *
+ * Common compressor usage
+ * =======================
+ *
+ * One of the most important things for coding image quality is to align the input data component
+ * count with the ASTC color endpoint mode. This avoids wasting bits encoding components you don't
+ * actually need in the endpoint colors.
+ *
+ * | Input data | Encoding swizzle | Sampling swizzle |
+ * | ------------ | ---------------- | ---------------- |
+ * | 1 component | RRR1 | .[rgb] |
+ * | 2 components | RRRG | .[rgb]a |
+ * | 3 components | RGB1 | .rgb |
+ * | 4 components | RGBA | .rgba |
+ *
+ * The 1 and 2 component modes recommend sampling from "g" to recover the luminance value as this
+ * provide best compatibility with other texture formats where the green component may be stored at
+ * higher precision than the others, such as RGB565. For ASTC any of the RGB components can be used;
+ * the luminance endpoint component will be returned for all three.
+ *
+ * When using the normal map compression mode ASTC will store normals as a two component X+Y map.
+ * Input images must contain unit-length normalized and should be passed in using a two component
+ * swizzle. The astcenc command line tool defaults to an RRRG swizzle, but some developers prefer
+ * to use GGGR for compatability with BC5n which will work just as well. The Z component can be
+ * recovered programmatically in shader code, using knowledge that the vector is unit length and
+ * that Z must be positive for a tangent-space normal map.
+ *
+ * Decompress-only usage
+ * =====================
+ *
+ * For some use cases it is useful to have a cut-down context and/or library which supports
+ * decompression but not compression.
+ *
+ * A context can be made decompress-only using the ASTCENC_FLG_DECOMPRESS_ONLY flag when the context
+ * is allocated. These contexts have lower dynamic memory footprint than a full context.
+ *
+ * The entire library can be made decompress-only by building the files with the define
+ * ASTCENC_DECOMPRESS_ONLY set. In this build the context will be smaller, and the library will
+ * exclude the functionality which is only needed for compression. This reduces the binary size by
+ * ~180KB. For these builds contexts must be created with the ASTCENC_FLG_DECOMPRESS_ONLY flag.
+ *
+ * Note that context structures returned by a library built as decompress-only are incompatible with
+ * a library built with compression included, and visa versa, as they have different sizes and
+ * memory layout.
+ *
+ * Self-decompress-only usage
+ * ==========================
+ *
+ * ASTC is a complex format with a large search space. The parts of this search space that are
+ * searched is determined by heuristics that are, in part, tied to the quality level used when
+ * creating the context.
+ *
+ * A normal context is capable of decompressing any ASTC texture, including those generated by other
+ * compressors with unknown heuristics. This is the most flexible implementation, but forces the
+ * data tables used by the codec to include entries that are not needed during compression. This
+ * can slow down context creation by a significant amount, especially for the faster compression
+ * modes where few data table entries are actually used. To optimize this use case the context can
+ * be created with the ASTCENC_FLG_SELF_DECOMPRESS_ONLY flag. This tells the compressor that it will
+ * only be asked to decompress images that it compressed itself, allowing the data tables to
+ * exclude entries that are not needed by the current compression configuration. This reduces the
+ * size of the context data tables in memory and improves context creation performance. Note that,
+ * as of the 3.6 release, this flag no longer affects compression performance.
+ *
+ * Using this flag while attempting to decompress an valid image which was created by another
+ * compressor, or even another astcenc compressor version or configuration, may result in blocks
+ * returning as solid magenta or NaN value error blocks.
+ */
+
+#ifndef ASTCENC_INCLUDED
+#define ASTCENC_INCLUDED
+
+#include <cstddef>
+#include <cstdint>
+
+#if defined(ASTCENC_DYNAMIC_LIBRARY)
+ #if defined(_MSC_VER)
+ #define ASTCENC_PUBLIC extern "C" __declspec(dllexport)
+ #else
+ #define ASTCENC_PUBLIC extern "C" __attribute__ ((visibility ("default")))
+ #endif
+#else
+ #define ASTCENC_PUBLIC
+#endif
+
+/* ============================================================================
+ Data declarations
+============================================================================ */
+
+/**
+ * @brief An opaque structure; see astcenc_internal.h for definition.
+ */
+struct astcenc_context;
+
+/**
+ * @brief A codec API error code.
+ */
+enum astcenc_error {
+ /** @brief The call was successful. */
+ ASTCENC_SUCCESS = 0,
+ /** @brief The call failed due to low memory, or undersized I/O buffers. */
+ ASTCENC_ERR_OUT_OF_MEM,
+ /** @brief The call failed due to the build using fast math. */
+ ASTCENC_ERR_BAD_CPU_FLOAT,
+ /** @brief The call failed due to the build using an unsupported ISA. */
+ ASTCENC_ERR_BAD_CPU_ISA,
+ /** @brief The call failed due to an out-of-spec parameter. */
+ ASTCENC_ERR_BAD_PARAM,
+ /** @brief The call failed due to an out-of-spec block size. */
+ ASTCENC_ERR_BAD_BLOCK_SIZE,
+ /** @brief The call failed due to an out-of-spec color profile. */
+ ASTCENC_ERR_BAD_PROFILE,
+ /** @brief The call failed due to an out-of-spec quality value. */
+ ASTCENC_ERR_BAD_QUALITY,
+ /** @brief The call failed due to an out-of-spec component swizzle. */
+ ASTCENC_ERR_BAD_SWIZZLE,
+ /** @brief The call failed due to an out-of-spec flag set. */
+ ASTCENC_ERR_BAD_FLAGS,
+ /** @brief The call failed due to the context not supporting the operation. */
+ ASTCENC_ERR_BAD_CONTEXT,
+ /** @brief The call failed due to unimplemented functionality. */
+ ASTCENC_ERR_NOT_IMPLEMENTED,
+#if defined(ASTCENC_DIAGNOSTICS)
+ /** @brief The call failed due to an issue with diagnostic tracing. */
+ ASTCENC_ERR_DTRACE_FAILURE,
+#endif
+};
+
+/**
+ * @brief A codec color profile.
+ */
+enum astcenc_profile {
+ /** @brief The LDR sRGB color profile. */
+ ASTCENC_PRF_LDR_SRGB = 0,
+ /** @brief The LDR linear color profile. */
+ ASTCENC_PRF_LDR,
+ /** @brief The HDR RGB with LDR alpha color profile. */
+ ASTCENC_PRF_HDR_RGB_LDR_A,
+ /** @brief The HDR RGBA color profile. */
+ ASTCENC_PRF_HDR
+};
+
+/** @brief The fastest, lowest quality, search preset. */
+static const float ASTCENC_PRE_FASTEST = 0.0f;
+
+/** @brief The fast search preset. */
+static const float ASTCENC_PRE_FAST = 10.0f;
+
+/** @brief The medium quality search preset. */
+static const float ASTCENC_PRE_MEDIUM = 60.0f;
+
+/** @brief The thorough quality search preset. */
+static const float ASTCENC_PRE_THOROUGH = 98.0f;
+
+/** @brief The thorough quality search preset. */
+static const float ASTCENC_PRE_VERYTHOROUGH = 99.0f;
+
+/** @brief The exhaustive, highest quality, search preset. */
+static const float ASTCENC_PRE_EXHAUSTIVE = 100.0f;
+
+/**
+ * @brief A codec component swizzle selector.
+ */
+enum astcenc_swz
+{
+ /** @brief Select the red component. */
+ ASTCENC_SWZ_R = 0,
+ /** @brief Select the green component. */
+ ASTCENC_SWZ_G = 1,
+ /** @brief Select the blue component. */
+ ASTCENC_SWZ_B = 2,
+ /** @brief Select the alpha component. */
+ ASTCENC_SWZ_A = 3,
+ /** @brief Use a constant zero component. */
+ ASTCENC_SWZ_0 = 4,
+ /** @brief Use a constant one component. */
+ ASTCENC_SWZ_1 = 5,
+ /** @brief Use a reconstructed normal vector Z component. */
+ ASTCENC_SWZ_Z = 6
+};
+
+/**
+ * @brief A texel component swizzle.
+ */
+struct astcenc_swizzle
+{
+ /** @brief The red component selector. */
+ astcenc_swz r;
+ /** @brief The green component selector. */
+ astcenc_swz g;
+ /** @brief The blue component selector. */
+ astcenc_swz b;
+ /** @brief The alpha component selector. */
+ astcenc_swz a;
+};
+
+/**
+ * @brief A texel component data format.
+ */
+enum astcenc_type
+{
+ /** @brief Unorm 8-bit data per component. */
+ ASTCENC_TYPE_U8 = 0,
+ /** @brief 16-bit float per component. */
+ ASTCENC_TYPE_F16 = 1,
+ /** @brief 32-bit float per component. */
+ ASTCENC_TYPE_F32 = 2
+};
+
+/**
+ * @brief Enable normal map compression.
+ *
+ * Input data will be treated a two component normal map, storing X and Y, and the codec will
+ * optimize for angular error rather than simple linear PSNR. In this mode the input swizzle should
+ * be e.g. rrrg (the default ordering for ASTC normals on the command line) or gggr (the ordering
+ * used by BC5n).
+ */
+static const unsigned int ASTCENC_FLG_MAP_NORMAL = 1 << 0;
+
+/**
+ * @brief Enable alpha weighting.
+ *
+ * The input alpha value is used for transparency, so errors in the RGB components are weighted by
+ * the transparency level. This allows the codec to more accurately encode the alpha value in areas
+ * where the color value is less significant.
+ */
+static const unsigned int ASTCENC_FLG_USE_ALPHA_WEIGHT = 1 << 2;
+
+/**
+ * @brief Enable perceptual error metrics.
+ *
+ * This mode enables perceptual compression mode, which will optimize for perceptual error rather
+ * than best PSNR. Only some input modes support perceptual error metrics.
+ */
+static const unsigned int ASTCENC_FLG_USE_PERCEPTUAL = 1 << 3;
+
+/**
+ * @brief Create a decompression-only context.
+ *
+ * This mode disables support for compression. This enables context allocation to skip some
+ * transient buffer allocation, resulting in lower memory usage.
+ */
+static const unsigned int ASTCENC_FLG_DECOMPRESS_ONLY = 1 << 4;
+
+/**
+ * @brief Create a self-decompression context.
+ *
+ * This mode configures the compressor so that it is only guaranteed to be able to decompress images
+ * that were actually created using the current context. This is the common case for compression use
+ * cases, and setting this flag enables additional optimizations, but does mean that the context
+ * cannot reliably decompress arbitrary ASTC images.
+ */
+static const unsigned int ASTCENC_FLG_SELF_DECOMPRESS_ONLY = 1 << 5;
+
+/**
+ * @brief Enable RGBM map compression.
+ *
+ * Input data will be treated as HDR data that has been stored in an LDR RGBM-encoded wrapper
+ * format. Data must be preprocessed by the user to be in LDR RGBM format before calling the
+ * compression function, this flag is only used to control the use of RGBM-specific heuristics and
+ * error metrics.
+ *
+ * IMPORTANT: The ASTC format is prone to bad failure modes with unconstrained RGBM data; very small
+ * M values can round to zero due to quantization and result in black or white pixels. It is highly
+ * recommended that the minimum value of M used in the encoding is kept above a lower threshold (try
+ * 16 or 32). Applying this threshold reduces the number of very dark colors that can be
+ * represented, but is still higher precision than 8-bit LDR.
+ *
+ * When this flag is set the value of @c rgbm_m_scale in the context must be set to the RGBM scale
+ * factor used during reconstruction. This defaults to 5 when in RGBM mode.
+ *
+ * It is recommended that the value of @c cw_a_weight is set to twice the value of the multiplier
+ * scale, ensuring that the M value is accurately encoded. This defaults to 10 when in RGBM mode,
+ * matching the default scale factor.
+ */
+static const unsigned int ASTCENC_FLG_MAP_RGBM = 1 << 6;
+
+/**
+ * @brief The bit mask of all valid flags.
+ */
+static const unsigned int ASTCENC_ALL_FLAGS =
+ ASTCENC_FLG_MAP_NORMAL |
+ ASTCENC_FLG_MAP_RGBM |
+ ASTCENC_FLG_USE_ALPHA_WEIGHT |
+ ASTCENC_FLG_USE_PERCEPTUAL |
+ ASTCENC_FLG_DECOMPRESS_ONLY |
+ ASTCENC_FLG_SELF_DECOMPRESS_ONLY;
+
+/**
+ * @brief The config structure.
+ *
+ * This structure will initially be populated by a call to astcenc_config_init, but power users may
+ * modify it before calling astcenc_context_alloc. See astcenccli_toplevel_help.cpp for full user
+ * documentation of the power-user settings.
+ *
+ * Note for any settings which are associated with a specific color component, the value in the
+ * config applies to the component that exists after any compression data swizzle is applied.
+ */
+struct astcenc_config
+{
+ /** @brief The color profile. */
+ astcenc_profile profile;
+
+ /** @brief The set of set flags. */
+ unsigned int flags;
+
+ /** @brief The ASTC block size X dimension. */
+ unsigned int block_x;
+
+ /** @brief The ASTC block size Y dimension. */
+ unsigned int block_y;
+
+ /** @brief The ASTC block size Z dimension. */
+ unsigned int block_z;
+
+ /** @brief The red component weight scale for error weighting (-cw). */
+ float cw_r_weight;
+
+ /** @brief The green component weight scale for error weighting (-cw). */
+ float cw_g_weight;
+
+ /** @brief The blue component weight scale for error weighting (-cw). */
+ float cw_b_weight;
+
+ /** @brief The alpha component weight scale for error weighting (-cw). */
+ float cw_a_weight;
+
+ /**
+ * @brief The radius for any alpha-weight scaling (-a).
+ *
+ * It is recommended that this is set to 1 when using FLG_USE_ALPHA_WEIGHT on a texture that
+ * will be sampled using linear texture filtering to minimize color bleed out of transparent
+ * texels that are adjacent to non-transparent texels.
+ */
+ unsigned int a_scale_radius;
+
+ /** @brief The RGBM scale factor for the shared multiplier (-rgbm). */
+ float rgbm_m_scale;
+
+ /**
+ * @brief The maximum number of partitions searched (-partitioncountlimit).
+ *
+ * Valid values are between 1 and 4.
+ */
+ unsigned int tune_partition_count_limit;
+
+ /**
+ * @brief The maximum number of partitions searched (-2partitionindexlimit).
+ *
+ * Valid values are between 1 and 1024.
+ */
+ unsigned int tune_2partition_index_limit;
+
+ /**
+ * @brief The maximum number of partitions searched (-3partitionindexlimit).
+ *
+ * Valid values are between 1 and 1024.
+ */
+ unsigned int tune_3partition_index_limit;
+
+ /**
+ * @brief The maximum number of partitions searched (-4partitionindexlimit).
+ *
+ * Valid values are between 1 and 1024.
+ */
+ unsigned int tune_4partition_index_limit;
+
+ /**
+ * @brief The maximum centile for block modes searched (-blockmodelimit).
+ *
+ * Valid values are between 1 and 100.
+ */
+ unsigned int tune_block_mode_limit;
+
+ /**
+ * @brief The maximum iterative refinements applied (-refinementlimit).
+ *
+ * Valid values are between 1 and N; there is no technical upper limit
+ * but little benefit is expected after N=4.
+ */
+ unsigned int tune_refinement_limit;
+
+ /**
+ * @brief The number of trial candidates per mode search (-candidatelimit).
+ *
+ * Valid values are between 1 and TUNE_MAX_TRIAL_CANDIDATES (default 4).
+ */
+ unsigned int tune_candidate_limit;
+
+ /**
+ * @brief The number of trial partitionings per search (-2partitioncandidatelimit).
+ *
+ * Valid values are between 1 and TUNE_MAX_PARTITIONING_CANDIDATES.
+ */
+ unsigned int tune_2partitioning_candidate_limit;
+
+ /**
+ * @brief The number of trial partitionings per search (-3partitioncandidatelimit).
+ *
+ * Valid values are between 1 and TUNE_MAX_PARTITIONING_CANDIDATES.
+ */
+ unsigned int tune_3partitioning_candidate_limit;
+
+ /**
+ * @brief The number of trial partitionings per search (-4partitioncandidatelimit).
+ *
+ * Valid values are between 1 and TUNE_MAX_PARTITIONING_CANDIDATES.
+ */
+ unsigned int tune_4partitioning_candidate_limit;
+
+ /**
+ * @brief The dB threshold for stopping block search (-dblimit).
+ *
+ * This option is ineffective for HDR textures.
+ */
+ float tune_db_limit;
+
+ /**
+ * @brief The amount of MSE overshoot needed to early-out trials.
+ *
+ * The first early-out is for 1 partition, 1 plane trials, where we try a minimal encode using
+ * the high probability block modes. This can short-cut compression for simple blocks.
+ *
+ * The second early-out is for refinement trials, where we can exit refinement once quality is
+ * reached.
+ */
+ float tune_mse_overshoot;
+
+ /**
+ * @brief The threshold for skipping 3.1/4.1 trials (-2partitionlimitfactor).
+ *
+ * This option is further scaled for normal maps, so it skips less often.
+ */
+ float tune_2_partition_early_out_limit_factor;
+
+ /**
+ * @brief The threshold for skipping 4.1 trials (-3partitionlimitfactor).
+ *
+ * This option is further scaled for normal maps, so it skips less often.
+ */
+ float tune_3_partition_early_out_limit_factor;
+
+ /**
+ * @brief The threshold for skipping two weight planes (-2planelimitcorrelation).
+ *
+ * This option is ineffective for normal maps.
+ */
+ float tune_2_plane_early_out_limit_correlation;
+
+#if defined(ASTCENC_DIAGNOSTICS)
+ /**
+ * @brief The path to save the diagnostic trace data to.
+ *
+ * This option is not part of the public API, and requires special builds
+ * of the library.
+ */
+ const char* trace_file_path;
+#endif
+};
+
+/**
+ * @brief An uncompressed 2D or 3D image.
+ *
+ * 3D image are passed in as an array of 2D slices. Each slice has identical
+ * size and color format.
+ */
+struct astcenc_image
+{
+ /** @brief The X dimension of the image, in texels. */
+ unsigned int dim_x;
+
+ /** @brief The Y dimension of the image, in texels. */
+ unsigned int dim_y;
+
+ /** @brief The Z dimension of the image, in texels. */
+ unsigned int dim_z;
+
+ /** @brief The data type per component. */
+ astcenc_type data_type;
+
+ /** @brief The array of 2D slices, of length @c dim_z. */
+ void** data;
+};
+
+/**
+ * @brief A block encoding metadata query result.
+ *
+ * If the block is an error block or a constant color block or an error block all fields other than
+ * the profile, block dimensions, and error/constant indicator will be zero.
+ */
+struct astcenc_block_info
+{
+ /** @brief The block encoding color profile. */
+ astcenc_profile profile;
+
+ /** @brief The number of texels in the X dimension. */
+ unsigned int block_x;
+
+ /** @brief The number of texels in the Y dimension. */
+ unsigned int block_y;
+
+ /** @brief The number of texel in the Z dimension. */
+ unsigned int block_z;
+
+ /** @brief The number of texels in the block. */
+ unsigned int texel_count;
+
+ /** @brief True if this block is an error block. */
+ bool is_error_block;
+
+ /** @brief True if this block is a constant color block. */
+ bool is_constant_block;
+
+ /** @brief True if this block is an HDR block. */
+ bool is_hdr_block;
+
+ /** @brief True if this block uses two weight planes. */
+ bool is_dual_plane_block;
+
+ /** @brief The number of partitions if not constant color. */
+ unsigned int partition_count;
+
+ /** @brief The partition index if 2 - 4 partitions used. */
+ unsigned int partition_index;
+
+ /** @brief The component index of the second plane if dual plane. */
+ unsigned int dual_plane_component;
+
+ /** @brief The color endpoint encoding mode for each partition. */
+ unsigned int color_endpoint_modes[4];
+
+ /** @brief The number of color endpoint quantization levels. */
+ unsigned int color_level_count;
+
+ /** @brief The number of weight quantization levels. */
+ unsigned int weight_level_count;
+
+ /** @brief The number of weights in the X dimension. */
+ unsigned int weight_x;
+
+ /** @brief The number of weights in the Y dimension. */
+ unsigned int weight_y;
+
+ /** @brief The number of weights in the Z dimension. */
+ unsigned int weight_z;
+
+ /** @brief The unpacked color endpoints for each partition. */
+ float color_endpoints[4][2][4];
+
+ /** @brief The per-texel interpolation weights for the block. */
+ float weight_values_plane1[216];
+
+ /** @brief The per-texel interpolation weights for the block. */
+ float weight_values_plane2[216];
+
+ /** @brief The per-texel partition assignments for the block. */
+ uint8_t partition_assignment[216];
+};
+
+/**
+ * Populate a codec config based on default settings.
+ *
+ * Power users can edit the returned config struct to fine tune before allocating the context.
+ *
+ * @param profile Color profile.
+ * @param block_x ASTC block size X dimension.
+ * @param block_y ASTC block size Y dimension.
+ * @param block_z ASTC block size Z dimension.
+ * @param quality Search quality preset / effort level. Either an
+ * @c ASTCENC_PRE_* value, or a effort level between 0
+ * and 100. Performance is not linear between 0 and 100.
+
+ * @param flags A valid set of @c ASTCENC_FLG_* flag bits.
+ * @param[out] config Output config struct to populate.
+ *
+ * @return @c ASTCENC_SUCCESS on success, or an error if the inputs are invalid
+ * either individually, or in combination.
+ */
+ASTCENC_PUBLIC astcenc_error astcenc_config_init(
+ astcenc_profile profile,
+ unsigned int block_x,
+ unsigned int block_y,
+ unsigned int block_z,
+ float quality,
+ unsigned int flags,
+ astcenc_config* config);
+
+/**
+ * @brief Allocate a new codec context based on a config.
+ *
+ * This function allocates all of the memory resources and threads needed by the codec. This can be
+ * slow, so it is recommended that contexts are reused to serially compress or decompress multiple
+ * images to amortize setup cost.
+ *
+ * Contexts can be allocated to support only decompression using the @c ASTCENC_FLG_DECOMPRESS_ONLY
+ * flag when creating the configuration. The compression functions will fail if invoked. For a
+ * decompress-only library build the @c ASTCENC_FLG_DECOMPRESS_ONLY flag must be set when creating
+ * any context.
+ *
+ * @param[in] config Codec config.
+ * @param thread_count Thread count to configure for.
+ * @param[out] context Location to store an opaque context pointer.
+ *
+ * @return @c ASTCENC_SUCCESS on success, or an error if context creation failed.
+ */
+ASTCENC_PUBLIC astcenc_error astcenc_context_alloc(
+ const astcenc_config* config,
+ unsigned int thread_count,
+ astcenc_context** context);
+
+/**
+ * @brief Compress an image.
+ *
+ * A single context can only compress or decompress a single image at a time.
+ *
+ * For a context configured for multi-threading, any set of the N threads can call this function.
+ * Work will be dynamically scheduled across the threads available. Each thread must have a unique
+ * @c thread_index.
+ *
+ * @param context Codec context.
+ * @param[in,out] image An input image, in 2D slices.
+ * @param swizzle Compression data swizzle, applied before compression.
+ * @param[out] data_out Pointer to output data array.
+ * @param data_len Length of the output data array.
+ * @param thread_index Thread index [0..N-1] of calling thread.
+ *
+ * @return @c ASTCENC_SUCCESS on success, or an error if compression failed.
+ */
+ASTCENC_PUBLIC astcenc_error astcenc_compress_image(
+ astcenc_context* context,
+ astcenc_image* image,
+ const astcenc_swizzle* swizzle,
+ uint8_t* data_out,
+ size_t data_len,
+ unsigned int thread_index);
+
+/**
+ * @brief Reset the codec state for a new compression.
+ *
+ * The caller is responsible for synchronizing threads in the worker thread pool. This function must
+ * only be called when all threads have exited the @c astcenc_compress_image() function for image N,
+ * but before any thread enters it for image N + 1.
+ *
+ * Calling this is not required (but won't hurt), if the context is created for single threaded use.
+ *
+ * @param context Codec context.
+ *
+ * @return @c ASTCENC_SUCCESS on success, or an error if reset failed.
+ */
+ASTCENC_PUBLIC astcenc_error astcenc_compress_reset(
+ astcenc_context* context);
+
+/**
+ * @brief Decompress an image.
+ *
+ * @param context Codec context.
+ * @param[in] data Pointer to compressed data.
+ * @param data_len Length of the compressed data, in bytes.
+ * @param[in,out] image_out Output image.
+ * @param swizzle Decompression data swizzle, applied after decompression.
+ * @param thread_index Thread index [0..N-1] of calling thread.
+ *
+ * @return @c ASTCENC_SUCCESS on success, or an error if decompression failed.
+ */
+ASTCENC_PUBLIC astcenc_error astcenc_decompress_image(
+ astcenc_context* context,
+ const uint8_t* data,
+ size_t data_len,
+ astcenc_image* image_out,
+ const astcenc_swizzle* swizzle,
+ unsigned int thread_index);
+
+/**
+ * @brief Reset the codec state for a new decompression.
+ *
+ * The caller is responsible for synchronizing threads in the worker thread pool. This function must
+ * only be called when all threads have exited the @c astcenc_decompress_image() function for image
+ * N, but before any thread enters it for image N + 1.
+ *
+ * Calling this is not required (but won't hurt), if the context is created for single threaded use.
+ *
+ * @param context Codec context.
+ *
+ * @return @c ASTCENC_SUCCESS on success, or an error if reset failed.
+ */
+ASTCENC_PUBLIC astcenc_error astcenc_decompress_reset(
+ astcenc_context* context);
+
+/**
+ * Free the compressor context.
+ *
+ * @param context The codec context.
+ */
+ASTCENC_PUBLIC void astcenc_context_free(
+ astcenc_context* context);
+
+/**
+ * @brief Provide a high level summary of a block's encoding.
+ *
+ * This feature is primarily useful for codec developers but may be useful for developers building
+ * advanced content packaging pipelines.
+ *
+ * @param context Codec context.
+ * @param data One block of compressed ASTC data.
+ * @param info The output info structure to populate.
+ *
+ * @return @c ASTCENC_SUCCESS if the block was decoded, or an error otherwise. Note that this
+ * function will return success even if the block itself was an error block encoding, as the
+ * decode was correctly handled.
+ */
+ASTCENC_PUBLIC astcenc_error astcenc_get_block_info(
+ astcenc_context* context,
+ const uint8_t data[16],
+ astcenc_block_info* info);
+
+/**
+ * @brief Get a printable string for specific status code.
+ *
+ * @param status The status value.
+ *
+ * @return A human readable nul-terminated string.
+ */
+ASTCENC_PUBLIC const char* astcenc_get_error_string(
+ astcenc_error status);
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_averages_and_directions.cpp b/thirdparty/astcenc/astcenc_averages_and_directions.cpp
new file mode 100644
index 0000000000..d1f003844a
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_averages_and_directions.cpp
@@ -0,0 +1,995 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2022 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Functions for finding dominant direction of a set of colors.
+ */
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+
+#include "astcenc_internal.h"
+
+#include <cassert>
+
+/**
+ * @brief Compute the average RGB color of each partition.
+ *
+ * The algorithm here uses a vectorized sequential scan and per-partition
+ * color accumulators, using select() to mask texel lanes in other partitions.
+ *
+ * We only accumulate sums for N-1 partitions during the scan; the value for
+ * the last partition can be computed given that we know the block-wide average
+ * already.
+ *
+ * Because of this we could reduce the loop iteration count so it "just" spans
+ * the max texel index needed for the N-1 partitions, which could need fewer
+ * iterations than the full block texel count. However, this makes the loop
+ * count erratic and causes more branch mispredictions so is a net loss.
+ *
+ * @param pi The partitioning to use.
+ * @param blk The block data to process.
+ * @param[out] averages The output averages. Unused partition indices will
+ * not be initialized, and lane<3> will be zero.
+ */
+static void compute_partition_averages_rgb(
+ const partition_info& pi,
+ const image_block& blk,
+ vfloat4 averages[BLOCK_MAX_PARTITIONS]
+) {
+ unsigned int partition_count = pi.partition_count;
+ unsigned int texel_count = blk.texel_count;
+ promise(texel_count > 0);
+
+ // For 1 partition just use the precomputed mean
+ if (partition_count == 1)
+ {
+ averages[0] = blk.data_mean.swz<0, 1, 2>();
+ }
+ // For 2 partitions scan results for partition 0, compute partition 1
+ else if (partition_count == 2)
+ {
+ vfloatacc pp_avg_rgb[3] {};
+
+ vint lane_id = vint::lane_id();
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vint texel_partition(pi.partition_of_texel + i);
+
+ vmask lane_mask = lane_id < vint(texel_count);
+ lane_id += vint(ASTCENC_SIMD_WIDTH);
+
+ vmask p0_mask = lane_mask & (texel_partition == vint(0));
+
+ vfloat data_r = loada(blk.data_r + i);
+ haccumulate(pp_avg_rgb[0], data_r, p0_mask);
+
+ vfloat data_g = loada(blk.data_g + i);
+ haccumulate(pp_avg_rgb[1], data_g, p0_mask);
+
+ vfloat data_b = loada(blk.data_b + i);
+ haccumulate(pp_avg_rgb[2], data_b, p0_mask);
+ }
+
+ vfloat4 block_total = blk.data_mean.swz<0, 1, 2>() * static_cast<float>(blk.texel_count);
+
+ vfloat4 p0_total = vfloat3(hadd_s(pp_avg_rgb[0]),
+ hadd_s(pp_avg_rgb[1]),
+ hadd_s(pp_avg_rgb[2]));
+
+ vfloat4 p1_total = block_total - p0_total;
+
+ averages[0] = p0_total / static_cast<float>(pi.partition_texel_count[0]);
+ averages[1] = p1_total / static_cast<float>(pi.partition_texel_count[1]);
+ }
+ // For 3 partitions scan results for partition 0/1, compute partition 2
+ else if (partition_count == 3)
+ {
+ vfloatacc pp_avg_rgb[2][3] {};
+
+ vint lane_id = vint::lane_id();
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vint texel_partition(pi.partition_of_texel + i);
+
+ vmask lane_mask = lane_id < vint(texel_count);
+ lane_id += vint(ASTCENC_SIMD_WIDTH);
+
+ vmask p0_mask = lane_mask & (texel_partition == vint(0));
+ vmask p1_mask = lane_mask & (texel_partition == vint(1));
+
+ vfloat data_r = loada(blk.data_r + i);
+ haccumulate(pp_avg_rgb[0][0], data_r, p0_mask);
+ haccumulate(pp_avg_rgb[1][0], data_r, p1_mask);
+
+ vfloat data_g = loada(blk.data_g + i);
+ haccumulate(pp_avg_rgb[0][1], data_g, p0_mask);
+ haccumulate(pp_avg_rgb[1][1], data_g, p1_mask);
+
+ vfloat data_b = loada(blk.data_b + i);
+ haccumulate(pp_avg_rgb[0][2], data_b, p0_mask);
+ haccumulate(pp_avg_rgb[1][2], data_b, p1_mask);
+ }
+
+ vfloat4 block_total = blk.data_mean.swz<0, 1, 2>() * static_cast<float>(blk.texel_count);
+
+ vfloat4 p0_total = vfloat3(hadd_s(pp_avg_rgb[0][0]),
+ hadd_s(pp_avg_rgb[0][1]),
+ hadd_s(pp_avg_rgb[0][2]));
+
+ vfloat4 p1_total = vfloat3(hadd_s(pp_avg_rgb[1][0]),
+ hadd_s(pp_avg_rgb[1][1]),
+ hadd_s(pp_avg_rgb[1][2]));
+
+ vfloat4 p2_total = block_total - p0_total - p1_total;
+
+ averages[0] = p0_total / static_cast<float>(pi.partition_texel_count[0]);
+ averages[1] = p1_total / static_cast<float>(pi.partition_texel_count[1]);
+ averages[2] = p2_total / static_cast<float>(pi.partition_texel_count[2]);
+ }
+ else
+ {
+ // For 4 partitions scan results for partition 0/1/2, compute partition 3
+ vfloatacc pp_avg_rgb[3][3] {};
+
+ vint lane_id = vint::lane_id();
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vint texel_partition(pi.partition_of_texel + i);
+
+ vmask lane_mask = lane_id < vint(texel_count);
+ lane_id += vint(ASTCENC_SIMD_WIDTH);
+
+ vmask p0_mask = lane_mask & (texel_partition == vint(0));
+ vmask p1_mask = lane_mask & (texel_partition == vint(1));
+ vmask p2_mask = lane_mask & (texel_partition == vint(2));
+
+ vfloat data_r = loada(blk.data_r + i);
+ haccumulate(pp_avg_rgb[0][0], data_r, p0_mask);
+ haccumulate(pp_avg_rgb[1][0], data_r, p1_mask);
+ haccumulate(pp_avg_rgb[2][0], data_r, p2_mask);
+
+ vfloat data_g = loada(blk.data_g + i);
+ haccumulate(pp_avg_rgb[0][1], data_g, p0_mask);
+ haccumulate(pp_avg_rgb[1][1], data_g, p1_mask);
+ haccumulate(pp_avg_rgb[2][1], data_g, p2_mask);
+
+ vfloat data_b = loada(blk.data_b + i);
+ haccumulate(pp_avg_rgb[0][2], data_b, p0_mask);
+ haccumulate(pp_avg_rgb[1][2], data_b, p1_mask);
+ haccumulate(pp_avg_rgb[2][2], data_b, p2_mask);
+ }
+
+ vfloat4 block_total = blk.data_mean.swz<0, 1, 2>() * static_cast<float>(blk.texel_count);
+
+ vfloat4 p0_total = vfloat3(hadd_s(pp_avg_rgb[0][0]),
+ hadd_s(pp_avg_rgb[0][1]),
+ hadd_s(pp_avg_rgb[0][2]));
+
+ vfloat4 p1_total = vfloat3(hadd_s(pp_avg_rgb[1][0]),
+ hadd_s(pp_avg_rgb[1][1]),
+ hadd_s(pp_avg_rgb[1][2]));
+
+ vfloat4 p2_total = vfloat3(hadd_s(pp_avg_rgb[2][0]),
+ hadd_s(pp_avg_rgb[2][1]),
+ hadd_s(pp_avg_rgb[2][2]));
+
+ vfloat4 p3_total = block_total - p0_total - p1_total- p2_total;
+
+ averages[0] = p0_total / static_cast<float>(pi.partition_texel_count[0]);
+ averages[1] = p1_total / static_cast<float>(pi.partition_texel_count[1]);
+ averages[2] = p2_total / static_cast<float>(pi.partition_texel_count[2]);
+ averages[3] = p3_total / static_cast<float>(pi.partition_texel_count[3]);
+ }
+}
+
+/**
+ * @brief Compute the average RGBA color of each partition.
+ *
+ * The algorithm here uses a vectorized sequential scan and per-partition
+ * color accumulators, using select() to mask texel lanes in other partitions.
+ *
+ * We only accumulate sums for N-1 partitions during the scan; the value for
+ * the last partition can be computed given that we know the block-wide average
+ * already.
+ *
+ * Because of this we could reduce the loop iteration count so it "just" spans
+ * the max texel index needed for the N-1 partitions, which could need fewer
+ * iterations than the full block texel count. However, this makes the loop
+ * count erratic and causes more branch mispredictions so is a net loss.
+ *
+ * @param pi The partitioning to use.
+ * @param blk The block data to process.
+ * @param[out] averages The output averages. Unused partition indices will
+ * not be initialized.
+ */
+static void compute_partition_averages_rgba(
+ const partition_info& pi,
+ const image_block& blk,
+ vfloat4 averages[BLOCK_MAX_PARTITIONS]
+) {
+ unsigned int partition_count = pi.partition_count;
+ unsigned int texel_count = blk.texel_count;
+ promise(texel_count > 0);
+
+ // For 1 partition just use the precomputed mean
+ if (partition_count == 1)
+ {
+ averages[0] = blk.data_mean;
+ }
+ // For 2 partitions scan results for partition 0, compute partition 1
+ else if (partition_count == 2)
+ {
+ vfloat4 pp_avg_rgba[4] {};
+
+ vint lane_id = vint::lane_id();
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vint texel_partition(pi.partition_of_texel + i);
+
+ vmask lane_mask = lane_id < vint(texel_count);
+ lane_id += vint(ASTCENC_SIMD_WIDTH);
+
+ vmask p0_mask = lane_mask & (texel_partition == vint(0));
+
+ vfloat data_r = loada(blk.data_r + i);
+ haccumulate(pp_avg_rgba[0], data_r, p0_mask);
+
+ vfloat data_g = loada(blk.data_g + i);
+ haccumulate(pp_avg_rgba[1], data_g, p0_mask);
+
+ vfloat data_b = loada(blk.data_b + i);
+ haccumulate(pp_avg_rgba[2], data_b, p0_mask);
+
+ vfloat data_a = loada(blk.data_a + i);
+ haccumulate(pp_avg_rgba[3], data_a, p0_mask);
+ }
+
+ vfloat4 block_total = blk.data_mean * static_cast<float>(blk.texel_count);
+
+ vfloat4 p0_total = vfloat4(hadd_s(pp_avg_rgba[0]),
+ hadd_s(pp_avg_rgba[1]),
+ hadd_s(pp_avg_rgba[2]),
+ hadd_s(pp_avg_rgba[3]));
+
+ vfloat4 p1_total = block_total - p0_total;
+
+ averages[0] = p0_total / static_cast<float>(pi.partition_texel_count[0]);
+ averages[1] = p1_total / static_cast<float>(pi.partition_texel_count[1]);
+ }
+ // For 3 partitions scan results for partition 0/1, compute partition 2
+ else if (partition_count == 3)
+ {
+ vfloat4 pp_avg_rgba[2][4] {};
+
+ vint lane_id = vint::lane_id();
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vint texel_partition(pi.partition_of_texel + i);
+
+ vmask lane_mask = lane_id < vint(texel_count);
+ lane_id += vint(ASTCENC_SIMD_WIDTH);
+
+ vmask p0_mask = lane_mask & (texel_partition == vint(0));
+ vmask p1_mask = lane_mask & (texel_partition == vint(1));
+
+ vfloat data_r = loada(blk.data_r + i);
+ haccumulate(pp_avg_rgba[0][0], data_r, p0_mask);
+ haccumulate(pp_avg_rgba[1][0], data_r, p1_mask);
+
+ vfloat data_g = loada(blk.data_g + i);
+ haccumulate(pp_avg_rgba[0][1], data_g, p0_mask);
+ haccumulate(pp_avg_rgba[1][1], data_g, p1_mask);
+
+ vfloat data_b = loada(blk.data_b + i);
+ haccumulate(pp_avg_rgba[0][2], data_b, p0_mask);
+ haccumulate(pp_avg_rgba[1][2], data_b, p1_mask);
+
+ vfloat data_a = loada(blk.data_a + i);
+ haccumulate(pp_avg_rgba[0][3], data_a, p0_mask);
+ haccumulate(pp_avg_rgba[1][3], data_a, p1_mask);
+ }
+
+ vfloat4 block_total = blk.data_mean * static_cast<float>(blk.texel_count);
+
+ vfloat4 p0_total = vfloat4(hadd_s(pp_avg_rgba[0][0]),
+ hadd_s(pp_avg_rgba[0][1]),
+ hadd_s(pp_avg_rgba[0][2]),
+ hadd_s(pp_avg_rgba[0][3]));
+
+ vfloat4 p1_total = vfloat4(hadd_s(pp_avg_rgba[1][0]),
+ hadd_s(pp_avg_rgba[1][1]),
+ hadd_s(pp_avg_rgba[1][2]),
+ hadd_s(pp_avg_rgba[1][3]));
+
+ vfloat4 p2_total = block_total - p0_total - p1_total;
+
+ averages[0] = p0_total / static_cast<float>(pi.partition_texel_count[0]);
+ averages[1] = p1_total / static_cast<float>(pi.partition_texel_count[1]);
+ averages[2] = p2_total / static_cast<float>(pi.partition_texel_count[2]);
+ }
+ else
+ {
+ // For 4 partitions scan results for partition 0/1/2, compute partition 3
+ vfloat4 pp_avg_rgba[3][4] {};
+
+ vint lane_id = vint::lane_id();
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vint texel_partition(pi.partition_of_texel + i);
+
+ vmask lane_mask = lane_id < vint(texel_count);
+ lane_id += vint(ASTCENC_SIMD_WIDTH);
+
+ vmask p0_mask = lane_mask & (texel_partition == vint(0));
+ vmask p1_mask = lane_mask & (texel_partition == vint(1));
+ vmask p2_mask = lane_mask & (texel_partition == vint(2));
+
+ vfloat data_r = loada(blk.data_r + i);
+ haccumulate(pp_avg_rgba[0][0], data_r, p0_mask);
+ haccumulate(pp_avg_rgba[1][0], data_r, p1_mask);
+ haccumulate(pp_avg_rgba[2][0], data_r, p2_mask);
+
+ vfloat data_g = loada(blk.data_g + i);
+ haccumulate(pp_avg_rgba[0][1], data_g, p0_mask);
+ haccumulate(pp_avg_rgba[1][1], data_g, p1_mask);
+ haccumulate(pp_avg_rgba[2][1], data_g, p2_mask);
+
+ vfloat data_b = loada(blk.data_b + i);
+ haccumulate(pp_avg_rgba[0][2], data_b, p0_mask);
+ haccumulate(pp_avg_rgba[1][2], data_b, p1_mask);
+ haccumulate(pp_avg_rgba[2][2], data_b, p2_mask);
+
+ vfloat data_a = loada(blk.data_a + i);
+ haccumulate(pp_avg_rgba[0][3], data_a, p0_mask);
+ haccumulate(pp_avg_rgba[1][3], data_a, p1_mask);
+ haccumulate(pp_avg_rgba[2][3], data_a, p2_mask);
+ }
+
+ vfloat4 block_total = blk.data_mean * static_cast<float>(blk.texel_count);
+
+ vfloat4 p0_total = vfloat4(hadd_s(pp_avg_rgba[0][0]),
+ hadd_s(pp_avg_rgba[0][1]),
+ hadd_s(pp_avg_rgba[0][2]),
+ hadd_s(pp_avg_rgba[0][3]));
+
+ vfloat4 p1_total = vfloat4(hadd_s(pp_avg_rgba[1][0]),
+ hadd_s(pp_avg_rgba[1][1]),
+ hadd_s(pp_avg_rgba[1][2]),
+ hadd_s(pp_avg_rgba[1][3]));
+
+ vfloat4 p2_total = vfloat4(hadd_s(pp_avg_rgba[2][0]),
+ hadd_s(pp_avg_rgba[2][1]),
+ hadd_s(pp_avg_rgba[2][2]),
+ hadd_s(pp_avg_rgba[2][3]));
+
+ vfloat4 p3_total = block_total - p0_total - p1_total- p2_total;
+
+ averages[0] = p0_total / static_cast<float>(pi.partition_texel_count[0]);
+ averages[1] = p1_total / static_cast<float>(pi.partition_texel_count[1]);
+ averages[2] = p2_total / static_cast<float>(pi.partition_texel_count[2]);
+ averages[3] = p3_total / static_cast<float>(pi.partition_texel_count[3]);
+ }
+}
+
+/* See header for documentation. */
+void compute_avgs_and_dirs_4_comp(
+ const partition_info& pi,
+ const image_block& blk,
+ partition_metrics pm[BLOCK_MAX_PARTITIONS]
+) {
+ int partition_count = pi.partition_count;
+ promise(partition_count > 0);
+
+ // Pre-compute partition_averages
+ vfloat4 partition_averages[BLOCK_MAX_PARTITIONS];
+ compute_partition_averages_rgba(pi, blk, partition_averages);
+
+ for (int partition = 0; partition < partition_count; partition++)
+ {
+ const uint8_t *texel_indexes = pi.texels_of_partition[partition];
+ unsigned int texel_count = pi.partition_texel_count[partition];
+ promise(texel_count > 0);
+
+ vfloat4 average = partition_averages[partition];
+ pm[partition].avg = average;
+
+ vfloat4 sum_xp = vfloat4::zero();
+ vfloat4 sum_yp = vfloat4::zero();
+ vfloat4 sum_zp = vfloat4::zero();
+ vfloat4 sum_wp = vfloat4::zero();
+
+ for (unsigned int i = 0; i < texel_count; i++)
+ {
+ unsigned int iwt = texel_indexes[i];
+ vfloat4 texel_datum = blk.texel(iwt);
+ texel_datum = texel_datum - average;
+
+ vfloat4 zero = vfloat4::zero();
+
+ vmask4 tdm0 = texel_datum.swz<0,0,0,0>() > zero;
+ sum_xp += select(zero, texel_datum, tdm0);
+
+ vmask4 tdm1 = texel_datum.swz<1,1,1,1>() > zero;
+ sum_yp += select(zero, texel_datum, tdm1);
+
+ vmask4 tdm2 = texel_datum.swz<2,2,2,2>() > zero;
+ sum_zp += select(zero, texel_datum, tdm2);
+
+ vmask4 tdm3 = texel_datum.swz<3,3,3,3>() > zero;
+ sum_wp += select(zero, texel_datum, tdm3);
+ }
+
+ vfloat4 prod_xp = dot(sum_xp, sum_xp);
+ vfloat4 prod_yp = dot(sum_yp, sum_yp);
+ vfloat4 prod_zp = dot(sum_zp, sum_zp);
+ vfloat4 prod_wp = dot(sum_wp, sum_wp);
+
+ vfloat4 best_vector = sum_xp;
+ vfloat4 best_sum = prod_xp;
+
+ vmask4 mask = prod_yp > best_sum;
+ best_vector = select(best_vector, sum_yp, mask);
+ best_sum = select(best_sum, prod_yp, mask);
+
+ mask = prod_zp > best_sum;
+ best_vector = select(best_vector, sum_zp, mask);
+ best_sum = select(best_sum, prod_zp, mask);
+
+ mask = prod_wp > best_sum;
+ best_vector = select(best_vector, sum_wp, mask);
+
+ pm[partition].dir = best_vector;
+ }
+}
+
+/* See header for documentation. */
+void compute_avgs_and_dirs_3_comp(
+ const partition_info& pi,
+ const image_block& blk,
+ unsigned int omitted_component,
+ partition_metrics pm[BLOCK_MAX_PARTITIONS]
+) {
+ // Pre-compute partition_averages
+ vfloat4 partition_averages[BLOCK_MAX_PARTITIONS];
+ compute_partition_averages_rgba(pi, blk, partition_averages);
+
+ const float* data_vr = blk.data_r;
+ const float* data_vg = blk.data_g;
+ const float* data_vb = blk.data_b;
+
+ // TODO: Data-driven permute would be useful to avoid this ...
+ if (omitted_component == 0)
+ {
+ partition_averages[0] = partition_averages[0].swz<1, 2, 3>();
+ partition_averages[1] = partition_averages[1].swz<1, 2, 3>();
+ partition_averages[2] = partition_averages[2].swz<1, 2, 3>();
+ partition_averages[3] = partition_averages[3].swz<1, 2, 3>();
+
+ data_vr = blk.data_g;
+ data_vg = blk.data_b;
+ data_vb = blk.data_a;
+ }
+ else if (omitted_component == 1)
+ {
+ partition_averages[0] = partition_averages[0].swz<0, 2, 3>();
+ partition_averages[1] = partition_averages[1].swz<0, 2, 3>();
+ partition_averages[2] = partition_averages[2].swz<0, 2, 3>();
+ partition_averages[3] = partition_averages[3].swz<0, 2, 3>();
+
+ data_vg = blk.data_b;
+ data_vb = blk.data_a;
+ }
+ else if (omitted_component == 2)
+ {
+ partition_averages[0] = partition_averages[0].swz<0, 1, 3>();
+ partition_averages[1] = partition_averages[1].swz<0, 1, 3>();
+ partition_averages[2] = partition_averages[2].swz<0, 1, 3>();
+ partition_averages[3] = partition_averages[3].swz<0, 1, 3>();
+
+ data_vb = blk.data_a;
+ }
+ else
+ {
+ partition_averages[0] = partition_averages[0].swz<0, 1, 2>();
+ partition_averages[1] = partition_averages[1].swz<0, 1, 2>();
+ partition_averages[2] = partition_averages[2].swz<0, 1, 2>();
+ partition_averages[3] = partition_averages[3].swz<0, 1, 2>();
+ }
+
+ unsigned int partition_count = pi.partition_count;
+ promise(partition_count > 0);
+
+ for (unsigned int partition = 0; partition < partition_count; partition++)
+ {
+ const uint8_t *texel_indexes = pi.texels_of_partition[partition];
+ unsigned int texel_count = pi.partition_texel_count[partition];
+ promise(texel_count > 0);
+
+ vfloat4 average = partition_averages[partition];
+ pm[partition].avg = average;
+
+ vfloat4 sum_xp = vfloat4::zero();
+ vfloat4 sum_yp = vfloat4::zero();
+ vfloat4 sum_zp = vfloat4::zero();
+
+ for (unsigned int i = 0; i < texel_count; i++)
+ {
+ unsigned int iwt = texel_indexes[i];
+
+ vfloat4 texel_datum = vfloat3(data_vr[iwt],
+ data_vg[iwt],
+ data_vb[iwt]);
+ texel_datum = texel_datum - average;
+
+ vfloat4 zero = vfloat4::zero();
+
+ vmask4 tdm0 = texel_datum.swz<0,0,0,0>() > zero;
+ sum_xp += select(zero, texel_datum, tdm0);
+
+ vmask4 tdm1 = texel_datum.swz<1,1,1,1>() > zero;
+ sum_yp += select(zero, texel_datum, tdm1);
+
+ vmask4 tdm2 = texel_datum.swz<2,2,2,2>() > zero;
+ sum_zp += select(zero, texel_datum, tdm2);
+ }
+
+ vfloat4 prod_xp = dot(sum_xp, sum_xp);
+ vfloat4 prod_yp = dot(sum_yp, sum_yp);
+ vfloat4 prod_zp = dot(sum_zp, sum_zp);
+
+ vfloat4 best_vector = sum_xp;
+ vfloat4 best_sum = prod_xp;
+
+ vmask4 mask = prod_yp > best_sum;
+ best_vector = select(best_vector, sum_yp, mask);
+ best_sum = select(best_sum, prod_yp, mask);
+
+ mask = prod_zp > best_sum;
+ best_vector = select(best_vector, sum_zp, mask);
+
+ pm[partition].dir = best_vector;
+ }
+}
+
+/* See header for documentation. */
+void compute_avgs_and_dirs_3_comp_rgb(
+ const partition_info& pi,
+ const image_block& blk,
+ partition_metrics pm[BLOCK_MAX_PARTITIONS]
+) {
+ unsigned int partition_count = pi.partition_count;
+ promise(partition_count > 0);
+
+ // Pre-compute partition_averages
+ vfloat4 partition_averages[BLOCK_MAX_PARTITIONS];
+ compute_partition_averages_rgb(pi, blk, partition_averages);
+
+ for (unsigned int partition = 0; partition < partition_count; partition++)
+ {
+ const uint8_t *texel_indexes = pi.texels_of_partition[partition];
+ unsigned int texel_count = pi.partition_texel_count[partition];
+ promise(texel_count > 0);
+
+ vfloat4 average = partition_averages[partition];
+ pm[partition].avg = average;
+
+ vfloat4 sum_xp = vfloat4::zero();
+ vfloat4 sum_yp = vfloat4::zero();
+ vfloat4 sum_zp = vfloat4::zero();
+
+ for (unsigned int i = 0; i < texel_count; i++)
+ {
+ unsigned int iwt = texel_indexes[i];
+
+ vfloat4 texel_datum = blk.texel3(iwt);
+ texel_datum = texel_datum - average;
+
+ vfloat4 zero = vfloat4::zero();
+
+ vmask4 tdm0 = texel_datum.swz<0,0,0,0>() > zero;
+ sum_xp += select(zero, texel_datum, tdm0);
+
+ vmask4 tdm1 = texel_datum.swz<1,1,1,1>() > zero;
+ sum_yp += select(zero, texel_datum, tdm1);
+
+ vmask4 tdm2 = texel_datum.swz<2,2,2,2>() > zero;
+ sum_zp += select(zero, texel_datum, tdm2);
+ }
+
+ vfloat4 prod_xp = dot(sum_xp, sum_xp);
+ vfloat4 prod_yp = dot(sum_yp, sum_yp);
+ vfloat4 prod_zp = dot(sum_zp, sum_zp);
+
+ vfloat4 best_vector = sum_xp;
+ vfloat4 best_sum = prod_xp;
+
+ vmask4 mask = prod_yp > best_sum;
+ best_vector = select(best_vector, sum_yp, mask);
+ best_sum = select(best_sum, prod_yp, mask);
+
+ mask = prod_zp > best_sum;
+ best_vector = select(best_vector, sum_zp, mask);
+
+ pm[partition].dir = best_vector;
+ }
+}
+
+/* See header for documentation. */
+void compute_avgs_and_dirs_2_comp(
+ const partition_info& pt,
+ const image_block& blk,
+ unsigned int component1,
+ unsigned int component2,
+ partition_metrics pm[BLOCK_MAX_PARTITIONS]
+) {
+ vfloat4 average;
+
+ const float* data_vr = nullptr;
+ const float* data_vg = nullptr;
+
+ if (component1 == 0 && component2 == 1)
+ {
+ average = blk.data_mean.swz<0, 1>();
+
+ data_vr = blk.data_r;
+ data_vg = blk.data_g;
+ }
+ else if (component1 == 0 && component2 == 2)
+ {
+ average = blk.data_mean.swz<0, 2>();
+
+ data_vr = blk.data_r;
+ data_vg = blk.data_b;
+ }
+ else // (component1 == 1 && component2 == 2)
+ {
+ assert(component1 == 1 && component2 == 2);
+
+ average = blk.data_mean.swz<1, 2>();
+
+ data_vr = blk.data_g;
+ data_vg = blk.data_b;
+ }
+
+ unsigned int partition_count = pt.partition_count;
+ promise(partition_count > 0);
+
+ for (unsigned int partition = 0; partition < partition_count; partition++)
+ {
+ const uint8_t *texel_indexes = pt.texels_of_partition[partition];
+ unsigned int texel_count = pt.partition_texel_count[partition];
+ promise(texel_count > 0);
+
+ // Only compute a partition mean if more than one partition
+ if (partition_count > 1)
+ {
+ average = vfloat4::zero();
+ for (unsigned int i = 0; i < texel_count; i++)
+ {
+ unsigned int iwt = texel_indexes[i];
+ average += vfloat2(data_vr[iwt], data_vg[iwt]);
+ }
+
+ average = average / static_cast<float>(texel_count);
+ }
+
+ pm[partition].avg = average;
+
+ vfloat4 sum_xp = vfloat4::zero();
+ vfloat4 sum_yp = vfloat4::zero();
+
+ for (unsigned int i = 0; i < texel_count; i++)
+ {
+ unsigned int iwt = texel_indexes[i];
+ vfloat4 texel_datum = vfloat2(data_vr[iwt], data_vg[iwt]);
+ texel_datum = texel_datum - average;
+
+ vfloat4 zero = vfloat4::zero();
+
+ vmask4 tdm0 = texel_datum.swz<0,0,0,0>() > zero;
+ sum_xp += select(zero, texel_datum, tdm0);
+
+ vmask4 tdm1 = texel_datum.swz<1,1,1,1>() > zero;
+ sum_yp += select(zero, texel_datum, tdm1);
+ }
+
+ vfloat4 prod_xp = dot(sum_xp, sum_xp);
+ vfloat4 prod_yp = dot(sum_yp, sum_yp);
+
+ vfloat4 best_vector = sum_xp;
+ vfloat4 best_sum = prod_xp;
+
+ vmask4 mask = prod_yp > best_sum;
+ best_vector = select(best_vector, sum_yp, mask);
+
+ pm[partition].dir = best_vector;
+ }
+}
+
+/* See header for documentation. */
+void compute_error_squared_rgba(
+ const partition_info& pi,
+ const image_block& blk,
+ const processed_line4 uncor_plines[BLOCK_MAX_PARTITIONS],
+ const processed_line4 samec_plines[BLOCK_MAX_PARTITIONS],
+ float uncor_lengths[BLOCK_MAX_PARTITIONS],
+ float samec_lengths[BLOCK_MAX_PARTITIONS],
+ float& uncor_error,
+ float& samec_error
+) {
+ unsigned int partition_count = pi.partition_count;
+ promise(partition_count > 0);
+
+ vfloatacc uncor_errorsumv = vfloatacc::zero();
+ vfloatacc samec_errorsumv = vfloatacc::zero();
+
+ for (unsigned int partition = 0; partition < partition_count; partition++)
+ {
+ const uint8_t *texel_indexes = pi.texels_of_partition[partition];
+
+ float uncor_loparam = 1e10f;
+ float uncor_hiparam = -1e10f;
+
+ float samec_loparam = 1e10f;
+ float samec_hiparam = -1e10f;
+
+ processed_line4 l_uncor = uncor_plines[partition];
+ processed_line4 l_samec = samec_plines[partition];
+
+ unsigned int texel_count = pi.partition_texel_count[partition];
+ promise(texel_count > 0);
+
+ // Vectorize some useful scalar inputs
+ vfloat l_uncor_bs0(l_uncor.bs.lane<0>());
+ vfloat l_uncor_bs1(l_uncor.bs.lane<1>());
+ vfloat l_uncor_bs2(l_uncor.bs.lane<2>());
+ vfloat l_uncor_bs3(l_uncor.bs.lane<3>());
+
+ vfloat l_uncor_amod0(l_uncor.amod.lane<0>());
+ vfloat l_uncor_amod1(l_uncor.amod.lane<1>());
+ vfloat l_uncor_amod2(l_uncor.amod.lane<2>());
+ vfloat l_uncor_amod3(l_uncor.amod.lane<3>());
+
+ vfloat l_samec_bs0(l_samec.bs.lane<0>());
+ vfloat l_samec_bs1(l_samec.bs.lane<1>());
+ vfloat l_samec_bs2(l_samec.bs.lane<2>());
+ vfloat l_samec_bs3(l_samec.bs.lane<3>());
+
+ assert(all(l_samec.amod == vfloat4(0.0f)));
+
+ vfloat uncor_loparamv(1e10f);
+ vfloat uncor_hiparamv(-1e10f);
+
+ vfloat samec_loparamv(1e10f);
+ vfloat samec_hiparamv(-1e10f);
+
+ vfloat ew_r(blk.channel_weight.lane<0>());
+ vfloat ew_g(blk.channel_weight.lane<1>());
+ vfloat ew_b(blk.channel_weight.lane<2>());
+ vfloat ew_a(blk.channel_weight.lane<3>());
+
+ // This implementation over-shoots, but this is safe as we initialize the texel_indexes
+ // array to extend the last value. This means min/max are not impacted, but we need to mask
+ // out the dummy values when we compute the line weighting.
+ vint lane_ids = vint::lane_id();
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vmask mask = lane_ids < vint(texel_count);
+ vint texel_idxs(texel_indexes + i);
+
+ vfloat data_r = gatherf(blk.data_r, texel_idxs);
+ vfloat data_g = gatherf(blk.data_g, texel_idxs);
+ vfloat data_b = gatherf(blk.data_b, texel_idxs);
+ vfloat data_a = gatherf(blk.data_a, texel_idxs);
+
+ vfloat uncor_param = (data_r * l_uncor_bs0)
+ + (data_g * l_uncor_bs1)
+ + (data_b * l_uncor_bs2)
+ + (data_a * l_uncor_bs3);
+
+ uncor_loparamv = min(uncor_param, uncor_loparamv);
+ uncor_hiparamv = max(uncor_param, uncor_hiparamv);
+
+ vfloat uncor_dist0 = (l_uncor_amod0 - data_r)
+ + (uncor_param * l_uncor_bs0);
+ vfloat uncor_dist1 = (l_uncor_amod1 - data_g)
+ + (uncor_param * l_uncor_bs1);
+ vfloat uncor_dist2 = (l_uncor_amod2 - data_b)
+ + (uncor_param * l_uncor_bs2);
+ vfloat uncor_dist3 = (l_uncor_amod3 - data_a)
+ + (uncor_param * l_uncor_bs3);
+
+ vfloat uncor_err = (ew_r * uncor_dist0 * uncor_dist0)
+ + (ew_g * uncor_dist1 * uncor_dist1)
+ + (ew_b * uncor_dist2 * uncor_dist2)
+ + (ew_a * uncor_dist3 * uncor_dist3);
+
+ haccumulate(uncor_errorsumv, uncor_err, mask);
+
+ // Process samechroma data
+ vfloat samec_param = (data_r * l_samec_bs0)
+ + (data_g * l_samec_bs1)
+ + (data_b * l_samec_bs2)
+ + (data_a * l_samec_bs3);
+
+ samec_loparamv = min(samec_param, samec_loparamv);
+ samec_hiparamv = max(samec_param, samec_hiparamv);
+
+ vfloat samec_dist0 = samec_param * l_samec_bs0 - data_r;
+ vfloat samec_dist1 = samec_param * l_samec_bs1 - data_g;
+ vfloat samec_dist2 = samec_param * l_samec_bs2 - data_b;
+ vfloat samec_dist3 = samec_param * l_samec_bs3 - data_a;
+
+ vfloat samec_err = (ew_r * samec_dist0 * samec_dist0)
+ + (ew_g * samec_dist1 * samec_dist1)
+ + (ew_b * samec_dist2 * samec_dist2)
+ + (ew_a * samec_dist3 * samec_dist3);
+
+ haccumulate(samec_errorsumv, samec_err, mask);
+
+ lane_ids += vint(ASTCENC_SIMD_WIDTH);
+ }
+
+ uncor_loparam = hmin_s(uncor_loparamv);
+ uncor_hiparam = hmax_s(uncor_hiparamv);
+
+ samec_loparam = hmin_s(samec_loparamv);
+ samec_hiparam = hmax_s(samec_hiparamv);
+
+ float uncor_linelen = uncor_hiparam - uncor_loparam;
+ float samec_linelen = samec_hiparam - samec_loparam;
+
+ // Turn very small numbers and NaNs into a small number
+ uncor_lengths[partition] = astc::max(uncor_linelen, 1e-7f);
+ samec_lengths[partition] = astc::max(samec_linelen, 1e-7f);
+ }
+
+ uncor_error = hadd_s(uncor_errorsumv);
+ samec_error = hadd_s(samec_errorsumv);
+}
+
+/* See header for documentation. */
+void compute_error_squared_rgb(
+ const partition_info& pi,
+ const image_block& blk,
+ partition_lines3 plines[BLOCK_MAX_PARTITIONS],
+ float& uncor_error,
+ float& samec_error
+) {
+ unsigned int partition_count = pi.partition_count;
+ promise(partition_count > 0);
+
+ vfloatacc uncor_errorsumv = vfloatacc::zero();
+ vfloatacc samec_errorsumv = vfloatacc::zero();
+
+ for (unsigned int partition = 0; partition < partition_count; partition++)
+ {
+ partition_lines3& pl = plines[partition];
+ const uint8_t *texel_indexes = pi.texels_of_partition[partition];
+ unsigned int texel_count = pi.partition_texel_count[partition];
+ promise(texel_count > 0);
+
+ float uncor_loparam = 1e10f;
+ float uncor_hiparam = -1e10f;
+
+ float samec_loparam = 1e10f;
+ float samec_hiparam = -1e10f;
+
+ processed_line3 l_uncor = pl.uncor_pline;
+ processed_line3 l_samec = pl.samec_pline;
+
+ // This implementation is an example vectorization of this function.
+ // It works for - the codec is a 2-4% faster than not vectorizing - but
+ // the benefit is limited by the use of gathers and register pressure
+
+ // Vectorize some useful scalar inputs
+ vfloat l_uncor_bs0(l_uncor.bs.lane<0>());
+ vfloat l_uncor_bs1(l_uncor.bs.lane<1>());
+ vfloat l_uncor_bs2(l_uncor.bs.lane<2>());
+
+ vfloat l_uncor_amod0(l_uncor.amod.lane<0>());
+ vfloat l_uncor_amod1(l_uncor.amod.lane<1>());
+ vfloat l_uncor_amod2(l_uncor.amod.lane<2>());
+
+ vfloat l_samec_bs0(l_samec.bs.lane<0>());
+ vfloat l_samec_bs1(l_samec.bs.lane<1>());
+ vfloat l_samec_bs2(l_samec.bs.lane<2>());
+
+ assert(all(l_samec.amod == vfloat4(0.0f)));
+
+ vfloat uncor_loparamv(1e10f);
+ vfloat uncor_hiparamv(-1e10f);
+
+ vfloat samec_loparamv(1e10f);
+ vfloat samec_hiparamv(-1e10f);
+
+ vfloat ew_r(blk.channel_weight.lane<0>());
+ vfloat ew_g(blk.channel_weight.lane<1>());
+ vfloat ew_b(blk.channel_weight.lane<2>());
+
+ // This implementation over-shoots, but this is safe as we initialize the weights array
+ // to extend the last value. This means min/max are not impacted, but we need to mask
+ // out the dummy values when we compute the line weighting.
+ vint lane_ids = vint::lane_id();
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vmask mask = lane_ids < vint(texel_count);
+ vint texel_idxs(texel_indexes + i);
+
+ vfloat data_r = gatherf(blk.data_r, texel_idxs);
+ vfloat data_g = gatherf(blk.data_g, texel_idxs);
+ vfloat data_b = gatherf(blk.data_b, texel_idxs);
+
+ vfloat uncor_param = (data_r * l_uncor_bs0)
+ + (data_g * l_uncor_bs1)
+ + (data_b * l_uncor_bs2);
+
+ uncor_loparamv = min(uncor_param, uncor_loparamv);
+ uncor_hiparamv = max(uncor_param, uncor_hiparamv);
+
+ vfloat uncor_dist0 = (l_uncor_amod0 - data_r)
+ + (uncor_param * l_uncor_bs0);
+ vfloat uncor_dist1 = (l_uncor_amod1 - data_g)
+ + (uncor_param * l_uncor_bs1);
+ vfloat uncor_dist2 = (l_uncor_amod2 - data_b)
+ + (uncor_param * l_uncor_bs2);
+
+ vfloat uncor_err = (ew_r * uncor_dist0 * uncor_dist0)
+ + (ew_g * uncor_dist1 * uncor_dist1)
+ + (ew_b * uncor_dist2 * uncor_dist2);
+
+ haccumulate(uncor_errorsumv, uncor_err, mask);
+
+ // Process samechroma data
+ vfloat samec_param = (data_r * l_samec_bs0)
+ + (data_g * l_samec_bs1)
+ + (data_b * l_samec_bs2);
+
+ samec_loparamv = min(samec_param, samec_loparamv);
+ samec_hiparamv = max(samec_param, samec_hiparamv);
+
+ vfloat samec_dist0 = samec_param * l_samec_bs0 - data_r;
+ vfloat samec_dist1 = samec_param * l_samec_bs1 - data_g;
+ vfloat samec_dist2 = samec_param * l_samec_bs2 - data_b;
+
+ vfloat samec_err = (ew_r * samec_dist0 * samec_dist0)
+ + (ew_g * samec_dist1 * samec_dist1)
+ + (ew_b * samec_dist2 * samec_dist2);
+
+ haccumulate(samec_errorsumv, samec_err, mask);
+
+ lane_ids += vint(ASTCENC_SIMD_WIDTH);
+ }
+
+ uncor_loparam = hmin_s(uncor_loparamv);
+ uncor_hiparam = hmax_s(uncor_hiparamv);
+
+ samec_loparam = hmin_s(samec_loparamv);
+ samec_hiparam = hmax_s(samec_hiparamv);
+
+ float uncor_linelen = uncor_hiparam - uncor_loparam;
+ float samec_linelen = samec_hiparam - samec_loparam;
+
+ // Turn very small numbers and NaNs into a small number
+ pl.uncor_line_len = astc::max(uncor_linelen, 1e-7f);
+ pl.samec_line_len = astc::max(samec_linelen, 1e-7f);
+ }
+
+ uncor_error = hadd_s(uncor_errorsumv);
+ samec_error = hadd_s(samec_errorsumv);
+}
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_block_sizes.cpp b/thirdparty/astcenc/astcenc_block_sizes.cpp
new file mode 100644
index 0000000000..1c22d06a5c
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_block_sizes.cpp
@@ -0,0 +1,1184 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2023 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Functions to generate block size descriptor and decimation tables.
+ */
+
+#include "astcenc_internal.h"
+
+/**
+ * @brief Decode the properties of an encoded 2D block mode.
+ *
+ * @param block_mode The encoded block mode.
+ * @param[out] x_weights The number of weights in the X dimension.
+ * @param[out] y_weights The number of weights in the Y dimension.
+ * @param[out] is_dual_plane True if this block mode has two weight planes.
+ * @param[out] quant_mode The quantization level for the weights.
+ * @param[out] weight_bits The storage bit count for the weights.
+ *
+ * @return Returns true if a valid mode, false otherwise.
+ */
+static bool decode_block_mode_2d(
+ unsigned int block_mode,
+ unsigned int& x_weights,
+ unsigned int& y_weights,
+ bool& is_dual_plane,
+ unsigned int& quant_mode,
+ unsigned int& weight_bits
+) {
+ unsigned int base_quant_mode = (block_mode >> 4) & 1;
+ unsigned int H = (block_mode >> 9) & 1;
+ unsigned int D = (block_mode >> 10) & 1;
+ unsigned int A = (block_mode >> 5) & 0x3;
+
+ x_weights = 0;
+ y_weights = 0;
+
+ if ((block_mode & 3) != 0)
+ {
+ base_quant_mode |= (block_mode & 3) << 1;
+ unsigned int B = (block_mode >> 7) & 3;
+ switch ((block_mode >> 2) & 3)
+ {
+ case 0:
+ x_weights = B + 4;
+ y_weights = A + 2;
+ break;
+ case 1:
+ x_weights = B + 8;
+ y_weights = A + 2;
+ break;
+ case 2:
+ x_weights = A + 2;
+ y_weights = B + 8;
+ break;
+ case 3:
+ B &= 1;
+ if (block_mode & 0x100)
+ {
+ x_weights = B + 2;
+ y_weights = A + 2;
+ }
+ else
+ {
+ x_weights = A + 2;
+ y_weights = B + 6;
+ }
+ break;
+ }
+ }
+ else
+ {
+ base_quant_mode |= ((block_mode >> 2) & 3) << 1;
+ if (((block_mode >> 2) & 3) == 0)
+ {
+ return false;
+ }
+
+ unsigned int B = (block_mode >> 9) & 3;
+ switch ((block_mode >> 7) & 3)
+ {
+ case 0:
+ x_weights = 12;
+ y_weights = A + 2;
+ break;
+ case 1:
+ x_weights = A + 2;
+ y_weights = 12;
+ break;
+ case 2:
+ x_weights = A + 6;
+ y_weights = B + 6;
+ D = 0;
+ H = 0;
+ break;
+ case 3:
+ switch ((block_mode >> 5) & 3)
+ {
+ case 0:
+ x_weights = 6;
+ y_weights = 10;
+ break;
+ case 1:
+ x_weights = 10;
+ y_weights = 6;
+ break;
+ case 2:
+ case 3:
+ return false;
+ }
+ break;
+ }
+ }
+
+ unsigned int weight_count = x_weights * y_weights * (D + 1);
+ quant_mode = (base_quant_mode - 2) + 6 * H;
+ is_dual_plane = D != 0;
+
+ weight_bits = get_ise_sequence_bitcount(weight_count, static_cast<quant_method>(quant_mode));
+ return (weight_count <= BLOCK_MAX_WEIGHTS &&
+ weight_bits >= BLOCK_MIN_WEIGHT_BITS &&
+ weight_bits <= BLOCK_MAX_WEIGHT_BITS);
+}
+
+/**
+ * @brief Decode the properties of an encoded 3D block mode.
+ *
+ * @param block_mode The encoded block mode.
+ * @param[out] x_weights The number of weights in the X dimension.
+ * @param[out] y_weights The number of weights in the Y dimension.
+ * @param[out] z_weights The number of weights in the Z dimension.
+ * @param[out] is_dual_plane True if this block mode has two weight planes.
+ * @param[out] quant_mode The quantization level for the weights.
+ * @param[out] weight_bits The storage bit count for the weights.
+ *
+ * @return Returns true if a valid mode, false otherwise.
+ */
+static bool decode_block_mode_3d(
+ unsigned int block_mode,
+ unsigned int& x_weights,
+ unsigned int& y_weights,
+ unsigned int& z_weights,
+ bool& is_dual_plane,
+ unsigned int& quant_mode,
+ unsigned int& weight_bits
+) {
+ unsigned int base_quant_mode = (block_mode >> 4) & 1;
+ unsigned int H = (block_mode >> 9) & 1;
+ unsigned int D = (block_mode >> 10) & 1;
+ unsigned int A = (block_mode >> 5) & 0x3;
+
+ x_weights = 0;
+ y_weights = 0;
+ z_weights = 0;
+
+ if ((block_mode & 3) != 0)
+ {
+ base_quant_mode |= (block_mode & 3) << 1;
+ unsigned int B = (block_mode >> 7) & 3;
+ unsigned int C = (block_mode >> 2) & 0x3;
+ x_weights = A + 2;
+ y_weights = B + 2;
+ z_weights = C + 2;
+ }
+ else
+ {
+ base_quant_mode |= ((block_mode >> 2) & 3) << 1;
+ if (((block_mode >> 2) & 3) == 0)
+ {
+ return false;
+ }
+
+ int B = (block_mode >> 9) & 3;
+ if (((block_mode >> 7) & 3) != 3)
+ {
+ D = 0;
+ H = 0;
+ }
+ switch ((block_mode >> 7) & 3)
+ {
+ case 0:
+ x_weights = 6;
+ y_weights = B + 2;
+ z_weights = A + 2;
+ break;
+ case 1:
+ x_weights = A + 2;
+ y_weights = 6;
+ z_weights = B + 2;
+ break;
+ case 2:
+ x_weights = A + 2;
+ y_weights = B + 2;
+ z_weights = 6;
+ break;
+ case 3:
+ x_weights = 2;
+ y_weights = 2;
+ z_weights = 2;
+ switch ((block_mode >> 5) & 3)
+ {
+ case 0:
+ x_weights = 6;
+ break;
+ case 1:
+ y_weights = 6;
+ break;
+ case 2:
+ z_weights = 6;
+ break;
+ case 3:
+ return false;
+ }
+ break;
+ }
+ }
+
+ unsigned int weight_count = x_weights * y_weights * z_weights * (D + 1);
+ quant_mode = (base_quant_mode - 2) + 6 * H;
+ is_dual_plane = D != 0;
+
+ weight_bits = get_ise_sequence_bitcount(weight_count, static_cast<quant_method>(quant_mode));
+ return (weight_count <= BLOCK_MAX_WEIGHTS &&
+ weight_bits >= BLOCK_MIN_WEIGHT_BITS &&
+ weight_bits <= BLOCK_MAX_WEIGHT_BITS);
+}
+
+/**
+ * @brief Create a 2D decimation entry for a block-size and weight-decimation pair.
+ *
+ * @param x_texels The number of texels in the X dimension.
+ * @param y_texels The number of texels in the Y dimension.
+ * @param x_weights The number of weights in the X dimension.
+ * @param y_weights The number of weights in the Y dimension.
+ * @param[out] di The decimation info structure to populate.
+ * @param[out] wb The decimation table init scratch working buffers.
+ */
+static void init_decimation_info_2d(
+ unsigned int x_texels,
+ unsigned int y_texels,
+ unsigned int x_weights,
+ unsigned int y_weights,
+ decimation_info& di,
+ dt_init_working_buffers& wb
+) {
+ unsigned int texels_per_block = x_texels * y_texels;
+ unsigned int weights_per_block = x_weights * y_weights;
+
+ uint8_t max_texel_count_of_weight = 0;
+
+ promise(weights_per_block > 0);
+ promise(texels_per_block > 0);
+ promise(x_texels > 0);
+ promise(y_texels > 0);
+
+ for (unsigned int i = 0; i < weights_per_block; i++)
+ {
+ wb.texel_count_of_weight[i] = 0;
+ }
+
+ for (unsigned int i = 0; i < texels_per_block; i++)
+ {
+ wb.weight_count_of_texel[i] = 0;
+ }
+
+ for (unsigned int y = 0; y < y_texels; y++)
+ {
+ for (unsigned int x = 0; x < x_texels; x++)
+ {
+ unsigned int texel = y * x_texels + x;
+
+ unsigned int x_weight = (((1024 + x_texels / 2) / (x_texels - 1)) * x * (x_weights - 1) + 32) >> 6;
+ unsigned int y_weight = (((1024 + y_texels / 2) / (y_texels - 1)) * y * (y_weights - 1) + 32) >> 6;
+
+ unsigned int x_weight_frac = x_weight & 0xF;
+ unsigned int y_weight_frac = y_weight & 0xF;
+ unsigned int x_weight_int = x_weight >> 4;
+ unsigned int y_weight_int = y_weight >> 4;
+
+ unsigned int qweight[4];
+ qweight[0] = x_weight_int + y_weight_int * x_weights;
+ qweight[1] = qweight[0] + 1;
+ qweight[2] = qweight[0] + x_weights;
+ qweight[3] = qweight[2] + 1;
+
+ // Truncated-precision bilinear interpolation
+ unsigned int prod = x_weight_frac * y_weight_frac;
+
+ unsigned int weight[4];
+ weight[3] = (prod + 8) >> 4;
+ weight[1] = x_weight_frac - weight[3];
+ weight[2] = y_weight_frac - weight[3];
+ weight[0] = 16 - x_weight_frac - y_weight_frac + weight[3];
+
+ for (unsigned int i = 0; i < 4; i++)
+ {
+ if (weight[i] != 0)
+ {
+ wb.grid_weights_of_texel[texel][wb.weight_count_of_texel[texel]] = static_cast<uint8_t>(qweight[i]);
+ wb.weights_of_texel[texel][wb.weight_count_of_texel[texel]] = static_cast<uint8_t>(weight[i]);
+ wb.weight_count_of_texel[texel]++;
+ wb.texels_of_weight[qweight[i]][wb.texel_count_of_weight[qweight[i]]] = static_cast<uint8_t>(texel);
+ wb.texel_weights_of_weight[qweight[i]][wb.texel_count_of_weight[qweight[i]]] = static_cast<uint8_t>(weight[i]);
+ wb.texel_count_of_weight[qweight[i]]++;
+ max_texel_count_of_weight = astc::max(max_texel_count_of_weight, wb.texel_count_of_weight[qweight[i]]);
+ }
+ }
+ }
+ }
+
+ uint8_t max_texel_weight_count = 0;
+ for (unsigned int i = 0; i < texels_per_block; i++)
+ {
+ di.texel_weight_count[i] = wb.weight_count_of_texel[i];
+ max_texel_weight_count = astc::max(max_texel_weight_count, di.texel_weight_count[i]);
+
+ for (unsigned int j = 0; j < wb.weight_count_of_texel[i]; j++)
+ {
+ di.texel_weight_contribs_int_tr[j][i] = wb.weights_of_texel[i][j];
+ di.texel_weight_contribs_float_tr[j][i] = static_cast<float>(wb.weights_of_texel[i][j]) * (1.0f / WEIGHTS_TEXEL_SUM);
+ di.texel_weights_tr[j][i] = wb.grid_weights_of_texel[i][j];
+ }
+
+ // Init all 4 entries so we can rely on zeros for vectorization
+ for (unsigned int j = wb.weight_count_of_texel[i]; j < 4; j++)
+ {
+ di.texel_weight_contribs_int_tr[j][i] = 0;
+ di.texel_weight_contribs_float_tr[j][i] = 0.0f;
+ di.texel_weights_tr[j][i] = 0;
+ }
+ }
+
+ di.max_texel_weight_count = max_texel_weight_count;
+
+ for (unsigned int i = 0; i < weights_per_block; i++)
+ {
+ unsigned int texel_count_wt = wb.texel_count_of_weight[i];
+ di.weight_texel_count[i] = static_cast<uint8_t>(texel_count_wt);
+
+ for (unsigned int j = 0; j < texel_count_wt; j++)
+ {
+ uint8_t texel = wb.texels_of_weight[i][j];
+
+ // Create transposed versions of these for better vectorization
+ di.weight_texels_tr[j][i] = texel;
+ di.weights_texel_contribs_tr[j][i] = static_cast<float>(wb.texel_weights_of_weight[i][j]);
+
+ // Store the per-texel contribution of this weight for each texel it contributes to
+ di.texel_contrib_for_weight[j][i] = 0.0f;
+ for (unsigned int k = 0; k < 4; k++)
+ {
+ uint8_t dttw = di.texel_weights_tr[k][texel];
+ float dttwf = di.texel_weight_contribs_float_tr[k][texel];
+ if (dttw == i && dttwf != 0.0f)
+ {
+ di.texel_contrib_for_weight[j][i] = di.texel_weight_contribs_float_tr[k][texel];
+ break;
+ }
+ }
+ }
+
+ // Initialize array tail so we can over-fetch with SIMD later to avoid loop tails
+ // Match last texel in active lane in SIMD group, for better gathers
+ uint8_t last_texel = di.weight_texels_tr[texel_count_wt - 1][i];
+ for (unsigned int j = texel_count_wt; j < max_texel_count_of_weight; j++)
+ {
+ di.weight_texels_tr[j][i] = last_texel;
+ di.weights_texel_contribs_tr[j][i] = 0.0f;
+ }
+ }
+
+ // Initialize array tail so we can over-fetch with SIMD later to avoid loop tails
+ unsigned int texels_per_block_simd = round_up_to_simd_multiple_vla(texels_per_block);
+ for (unsigned int i = texels_per_block; i < texels_per_block_simd; i++)
+ {
+ di.texel_weight_count[i] = 0;
+
+ for (unsigned int j = 0; j < 4; j++)
+ {
+ di.texel_weight_contribs_float_tr[j][i] = 0;
+ di.texel_weights_tr[j][i] = 0;
+ di.texel_weight_contribs_int_tr[j][i] = 0;
+ }
+ }
+
+ // Initialize array tail so we can over-fetch with SIMD later to avoid loop tails
+ // Match last texel in active lane in SIMD group, for better gathers
+ unsigned int last_texel_count_wt = wb.texel_count_of_weight[weights_per_block - 1];
+ uint8_t last_texel = di.weight_texels_tr[last_texel_count_wt - 1][weights_per_block - 1];
+
+ unsigned int weights_per_block_simd = round_up_to_simd_multiple_vla(weights_per_block);
+ for (unsigned int i = weights_per_block; i < weights_per_block_simd; i++)
+ {
+ di.weight_texel_count[i] = 0;
+
+ for (unsigned int j = 0; j < max_texel_count_of_weight; j++)
+ {
+ di.weight_texels_tr[j][i] = last_texel;
+ di.weights_texel_contribs_tr[j][i] = 0.0f;
+ }
+ }
+
+ di.texel_count = static_cast<uint8_t>(texels_per_block);
+ di.weight_count = static_cast<uint8_t>(weights_per_block);
+ di.weight_x = static_cast<uint8_t>(x_weights);
+ di.weight_y = static_cast<uint8_t>(y_weights);
+ di.weight_z = 1;
+}
+
+/**
+ * @brief Create a 3D decimation entry for a block-size and weight-decimation pair.
+ *
+ * @param x_texels The number of texels in the X dimension.
+ * @param y_texels The number of texels in the Y dimension.
+ * @param z_texels The number of texels in the Z dimension.
+ * @param x_weights The number of weights in the X dimension.
+ * @param y_weights The number of weights in the Y dimension.
+ * @param z_weights The number of weights in the Z dimension.
+ * @param[out] di The decimation info structure to populate.
+ @param[out] wb The decimation table init scratch working buffers.
+ */
+static void init_decimation_info_3d(
+ unsigned int x_texels,
+ unsigned int y_texels,
+ unsigned int z_texels,
+ unsigned int x_weights,
+ unsigned int y_weights,
+ unsigned int z_weights,
+ decimation_info& di,
+ dt_init_working_buffers& wb
+) {
+ unsigned int texels_per_block = x_texels * y_texels * z_texels;
+ unsigned int weights_per_block = x_weights * y_weights * z_weights;
+
+ uint8_t max_texel_count_of_weight = 0;
+
+ promise(weights_per_block > 0);
+ promise(texels_per_block > 0);
+
+ for (unsigned int i = 0; i < weights_per_block; i++)
+ {
+ wb.texel_count_of_weight[i] = 0;
+ }
+
+ for (unsigned int i = 0; i < texels_per_block; i++)
+ {
+ wb.weight_count_of_texel[i] = 0;
+ }
+
+ for (unsigned int z = 0; z < z_texels; z++)
+ {
+ for (unsigned int y = 0; y < y_texels; y++)
+ {
+ for (unsigned int x = 0; x < x_texels; x++)
+ {
+ int texel = (z * y_texels + y) * x_texels + x;
+
+ int x_weight = (((1024 + x_texels / 2) / (x_texels - 1)) * x * (x_weights - 1) + 32) >> 6;
+ int y_weight = (((1024 + y_texels / 2) / (y_texels - 1)) * y * (y_weights - 1) + 32) >> 6;
+ int z_weight = (((1024 + z_texels / 2) / (z_texels - 1)) * z * (z_weights - 1) + 32) >> 6;
+
+ int x_weight_frac = x_weight & 0xF;
+ int y_weight_frac = y_weight & 0xF;
+ int z_weight_frac = z_weight & 0xF;
+ int x_weight_int = x_weight >> 4;
+ int y_weight_int = y_weight >> 4;
+ int z_weight_int = z_weight >> 4;
+ int qweight[4];
+ int weight[4];
+ qweight[0] = (z_weight_int * y_weights + y_weight_int) * x_weights + x_weight_int;
+ qweight[3] = ((z_weight_int + 1) * y_weights + (y_weight_int + 1)) * x_weights + (x_weight_int + 1);
+
+ // simplex interpolation
+ int fs = x_weight_frac;
+ int ft = y_weight_frac;
+ int fp = z_weight_frac;
+
+ int cas = ((fs > ft) << 2) + ((ft > fp) << 1) + ((fs > fp));
+ int N = x_weights;
+ int NM = x_weights * y_weights;
+
+ int s1, s2, w0, w1, w2, w3;
+ switch (cas)
+ {
+ case 7:
+ s1 = 1;
+ s2 = N;
+ w0 = 16 - fs;
+ w1 = fs - ft;
+ w2 = ft - fp;
+ w3 = fp;
+ break;
+ case 3:
+ s1 = N;
+ s2 = 1;
+ w0 = 16 - ft;
+ w1 = ft - fs;
+ w2 = fs - fp;
+ w3 = fp;
+ break;
+ case 5:
+ s1 = 1;
+ s2 = NM;
+ w0 = 16 - fs;
+ w1 = fs - fp;
+ w2 = fp - ft;
+ w3 = ft;
+ break;
+ case 4:
+ s1 = NM;
+ s2 = 1;
+ w0 = 16 - fp;
+ w1 = fp - fs;
+ w2 = fs - ft;
+ w3 = ft;
+ break;
+ case 2:
+ s1 = N;
+ s2 = NM;
+ w0 = 16 - ft;
+ w1 = ft - fp;
+ w2 = fp - fs;
+ w3 = fs;
+ break;
+ case 0:
+ s1 = NM;
+ s2 = N;
+ w0 = 16 - fp;
+ w1 = fp - ft;
+ w2 = ft - fs;
+ w3 = fs;
+ break;
+ default:
+ s1 = NM;
+ s2 = N;
+ w0 = 16 - fp;
+ w1 = fp - ft;
+ w2 = ft - fs;
+ w3 = fs;
+ break;
+ }
+
+ qweight[1] = qweight[0] + s1;
+ qweight[2] = qweight[1] + s2;
+ weight[0] = w0;
+ weight[1] = w1;
+ weight[2] = w2;
+ weight[3] = w3;
+
+ for (unsigned int i = 0; i < 4; i++)
+ {
+ if (weight[i] != 0)
+ {
+ wb.grid_weights_of_texel[texel][wb.weight_count_of_texel[texel]] = static_cast<uint8_t>(qweight[i]);
+ wb.weights_of_texel[texel][wb.weight_count_of_texel[texel]] = static_cast<uint8_t>(weight[i]);
+ wb.weight_count_of_texel[texel]++;
+ wb.texels_of_weight[qweight[i]][wb.texel_count_of_weight[qweight[i]]] = static_cast<uint8_t>(texel);
+ wb.texel_weights_of_weight[qweight[i]][wb.texel_count_of_weight[qweight[i]]] = static_cast<uint8_t>(weight[i]);
+ wb.texel_count_of_weight[qweight[i]]++;
+ max_texel_count_of_weight = astc::max(max_texel_count_of_weight, wb.texel_count_of_weight[qweight[i]]);
+ }
+ }
+ }
+ }
+ }
+
+ uint8_t max_texel_weight_count = 0;
+ for (unsigned int i = 0; i < texels_per_block; i++)
+ {
+ di.texel_weight_count[i] = wb.weight_count_of_texel[i];
+ max_texel_weight_count = astc::max(max_texel_weight_count, di.texel_weight_count[i]);
+
+ // Init all 4 entries so we can rely on zeros for vectorization
+ for (unsigned int j = 0; j < 4; j++)
+ {
+ di.texel_weight_contribs_int_tr[j][i] = 0;
+ di.texel_weight_contribs_float_tr[j][i] = 0.0f;
+ di.texel_weights_tr[j][i] = 0;
+ }
+
+ for (unsigned int j = 0; j < wb.weight_count_of_texel[i]; j++)
+ {
+ di.texel_weight_contribs_int_tr[j][i] = wb.weights_of_texel[i][j];
+ di.texel_weight_contribs_float_tr[j][i] = static_cast<float>(wb.weights_of_texel[i][j]) * (1.0f / WEIGHTS_TEXEL_SUM);
+ di.texel_weights_tr[j][i] = wb.grid_weights_of_texel[i][j];
+ }
+ }
+
+ di.max_texel_weight_count = max_texel_weight_count;
+
+ for (unsigned int i = 0; i < weights_per_block; i++)
+ {
+ unsigned int texel_count_wt = wb.texel_count_of_weight[i];
+ di.weight_texel_count[i] = static_cast<uint8_t>(texel_count_wt);
+
+ for (unsigned int j = 0; j < texel_count_wt; j++)
+ {
+ unsigned int texel = wb.texels_of_weight[i][j];
+
+ // Create transposed versions of these for better vectorization
+ di.weight_texels_tr[j][i] = static_cast<uint8_t>(texel);
+ di.weights_texel_contribs_tr[j][i] = static_cast<float>(wb.texel_weights_of_weight[i][j]);
+
+ // Store the per-texel contribution of this weight for each texel it contributes to
+ di.texel_contrib_for_weight[j][i] = 0.0f;
+ for (unsigned int k = 0; k < 4; k++)
+ {
+ uint8_t dttw = di.texel_weights_tr[k][texel];
+ float dttwf = di.texel_weight_contribs_float_tr[k][texel];
+ if (dttw == i && dttwf != 0.0f)
+ {
+ di.texel_contrib_for_weight[j][i] = di.texel_weight_contribs_float_tr[k][texel];
+ break;
+ }
+ }
+ }
+
+ // Initialize array tail so we can over-fetch with SIMD later to avoid loop tails
+ // Match last texel in active lane in SIMD group, for better gathers
+ uint8_t last_texel = di.weight_texels_tr[texel_count_wt - 1][i];
+ for (unsigned int j = texel_count_wt; j < max_texel_count_of_weight; j++)
+ {
+ di.weight_texels_tr[j][i] = last_texel;
+ di.weights_texel_contribs_tr[j][i] = 0.0f;
+ }
+ }
+
+ // Initialize array tail so we can over-fetch with SIMD later to avoid loop tails
+ unsigned int texels_per_block_simd = round_up_to_simd_multiple_vla(texels_per_block);
+ for (unsigned int i = texels_per_block; i < texels_per_block_simd; i++)
+ {
+ di.texel_weight_count[i] = 0;
+
+ for (unsigned int j = 0; j < 4; j++)
+ {
+ di.texel_weight_contribs_float_tr[j][i] = 0;
+ di.texel_weights_tr[j][i] = 0;
+ di.texel_weight_contribs_int_tr[j][i] = 0;
+ }
+ }
+
+ // Initialize array tail so we can over-fetch with SIMD later to avoid loop tails
+ // Match last texel in active lane in SIMD group, for better gathers
+ int last_texel_count_wt = wb.texel_count_of_weight[weights_per_block - 1];
+ uint8_t last_texel = di.weight_texels_tr[last_texel_count_wt - 1][weights_per_block - 1];
+
+ unsigned int weights_per_block_simd = round_up_to_simd_multiple_vla(weights_per_block);
+ for (unsigned int i = weights_per_block; i < weights_per_block_simd; i++)
+ {
+ di.weight_texel_count[i] = 0;
+
+ for (int j = 0; j < max_texel_count_of_weight; j++)
+ {
+ di.weight_texels_tr[j][i] = last_texel;
+ di.weights_texel_contribs_tr[j][i] = 0.0f;
+ }
+ }
+
+ di.texel_count = static_cast<uint8_t>(texels_per_block);
+ di.weight_count = static_cast<uint8_t>(weights_per_block);
+ di.weight_x = static_cast<uint8_t>(x_weights);
+ di.weight_y = static_cast<uint8_t>(y_weights);
+ di.weight_z = static_cast<uint8_t>(z_weights);
+}
+
+/**
+ * @brief Assign the texels to use for kmeans clustering.
+ *
+ * The max limit is @c BLOCK_MAX_KMEANS_TEXELS; above this a random selection is used.
+ * The @c bsd.texel_count is an input and must be populated beforehand.
+ *
+ * @param[in,out] bsd The block size descriptor to populate.
+ */
+static void assign_kmeans_texels(
+ block_size_descriptor& bsd
+) {
+ // Use all texels for kmeans on a small block
+ if (bsd.texel_count <= BLOCK_MAX_KMEANS_TEXELS)
+ {
+ for (uint8_t i = 0; i < bsd.texel_count; i++)
+ {
+ bsd.kmeans_texels[i] = i;
+ }
+
+ return;
+ }
+
+ // Select a random subset of BLOCK_MAX_KMEANS_TEXELS for kmeans on a large block
+ uint64_t rng_state[2];
+ astc::rand_init(rng_state);
+
+ // Initialize array used for tracking used indices
+ bool seen[BLOCK_MAX_TEXELS];
+ for (uint8_t i = 0; i < bsd.texel_count; i++)
+ {
+ seen[i] = false;
+ }
+
+ // Assign 64 random indices, retrying if we see repeats
+ unsigned int arr_elements_set = 0;
+ while (arr_elements_set < BLOCK_MAX_KMEANS_TEXELS)
+ {
+ uint8_t texel = static_cast<uint8_t>(astc::rand(rng_state));
+ texel = texel % bsd.texel_count;
+ if (!seen[texel])
+ {
+ bsd.kmeans_texels[arr_elements_set++] = texel;
+ seen[texel] = true;
+ }
+ }
+}
+
+/**
+ * @brief Allocate a single 2D decimation table entry.
+ *
+ * @param x_texels The number of texels in the X dimension.
+ * @param y_texels The number of texels in the Y dimension.
+ * @param x_weights The number of weights in the X dimension.
+ * @param y_weights The number of weights in the Y dimension.
+ * @param bsd The block size descriptor we are populating.
+ * @param wb The decimation table init scratch working buffers.
+ * @param index The packed array index to populate.
+ */
+static void construct_dt_entry_2d(
+ unsigned int x_texels,
+ unsigned int y_texels,
+ unsigned int x_weights,
+ unsigned int y_weights,
+ block_size_descriptor& bsd,
+ dt_init_working_buffers& wb,
+ unsigned int index
+) {
+ unsigned int weight_count = x_weights * y_weights;
+ assert(weight_count <= BLOCK_MAX_WEIGHTS);
+
+ bool try_2planes = (2 * weight_count) <= BLOCK_MAX_WEIGHTS;
+
+ decimation_info& di = bsd.decimation_tables[index];
+ init_decimation_info_2d(x_texels, y_texels, x_weights, y_weights, di, wb);
+
+ int maxprec_1plane = -1;
+ int maxprec_2planes = -1;
+ for (int i = 0; i < 12; i++)
+ {
+ unsigned int bits_1plane = get_ise_sequence_bitcount(weight_count, static_cast<quant_method>(i));
+ if (bits_1plane >= BLOCK_MIN_WEIGHT_BITS && bits_1plane <= BLOCK_MAX_WEIGHT_BITS)
+ {
+ maxprec_1plane = i;
+ }
+
+ if (try_2planes)
+ {
+ unsigned int bits_2planes = get_ise_sequence_bitcount(2 * weight_count, static_cast<quant_method>(i));
+ if (bits_2planes >= BLOCK_MIN_WEIGHT_BITS && bits_2planes <= BLOCK_MAX_WEIGHT_BITS)
+ {
+ maxprec_2planes = i;
+ }
+ }
+ }
+
+ // At least one of the two should be valid ...
+ assert(maxprec_1plane >= 0 || maxprec_2planes >= 0);
+ bsd.decimation_modes[index].maxprec_1plane = static_cast<int8_t>(maxprec_1plane);
+ bsd.decimation_modes[index].maxprec_2planes = static_cast<int8_t>(maxprec_2planes);
+ bsd.decimation_modes[index].refprec_1_plane = 0;
+ bsd.decimation_modes[index].refprec_2_planes = 0;
+}
+
+/**
+ * @brief Allocate block modes and decimation tables for a single 2D block size.
+ *
+ * @param x_texels The number of texels in the X dimension.
+ * @param y_texels The number of texels in the Y dimension.
+ * @param can_omit_modes Can we discard modes that astcenc won't use, even if legal?
+ * @param mode_cutoff Percentile cutoff in range [0,1]. Low values more likely to be used.
+ * @param[out] bsd The block size descriptor to populate.
+ */
+static void construct_block_size_descriptor_2d(
+ unsigned int x_texels,
+ unsigned int y_texels,
+ bool can_omit_modes,
+ float mode_cutoff,
+ block_size_descriptor& bsd
+) {
+ // Store a remap table for storing packed decimation modes.
+ // Indexing uses [Y * 16 + X] and max size for each axis is 12.
+ static const unsigned int MAX_DMI = 12 * 16 + 12;
+ int decimation_mode_index[MAX_DMI];
+
+ dt_init_working_buffers* wb = new dt_init_working_buffers;
+
+ bsd.xdim = static_cast<uint8_t>(x_texels);
+ bsd.ydim = static_cast<uint8_t>(y_texels);
+ bsd.zdim = 1;
+ bsd.texel_count = static_cast<uint8_t>(x_texels * y_texels);
+
+ for (unsigned int i = 0; i < MAX_DMI; i++)
+ {
+ decimation_mode_index[i] = -1;
+ }
+
+ // Gather all the decimation grids that can be used with the current block
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+ const float *percentiles = get_2d_percentile_table(x_texels, y_texels);
+ float always_cutoff = 0.0f;
+#else
+ // Unused in decompress-only builds
+ (void)can_omit_modes;
+ (void)mode_cutoff;
+#endif
+
+ // Construct the list of block formats referencing the decimation tables
+ unsigned int packed_bm_idx = 0;
+ unsigned int packed_dm_idx = 0;
+
+ // Trackers
+ unsigned int bm_counts[4] { 0 };
+ unsigned int dm_counts[4] { 0 };
+
+ // Clear the list to a known-bad value
+ for (unsigned int i = 0; i < WEIGHTS_MAX_BLOCK_MODES; i++)
+ {
+ bsd.block_mode_packed_index[i] = BLOCK_BAD_BLOCK_MODE;
+ }
+
+ // Iterate four times to build a usefully ordered list:
+ // - Pass 0 - keep selected single plane "always" block modes
+ // - Pass 1 - keep selected single plane "non-always" block modes
+ // - Pass 2 - keep select dual plane block modes
+ // - Pass 3 - keep everything else that's legal
+ unsigned int limit = can_omit_modes ? 3 : 4;
+ for (unsigned int j = 0; j < limit; j ++)
+ {
+ for (unsigned int i = 0; i < WEIGHTS_MAX_BLOCK_MODES; i++)
+ {
+ // Skip modes we've already included in a previous pass
+ if (bsd.block_mode_packed_index[i] != BLOCK_BAD_BLOCK_MODE)
+ {
+ continue;
+ }
+
+ // Decode parameters
+ unsigned int x_weights;
+ unsigned int y_weights;
+ bool is_dual_plane;
+ unsigned int quant_mode;
+ unsigned int weight_bits;
+ bool valid = decode_block_mode_2d(i, x_weights, y_weights, is_dual_plane, quant_mode, weight_bits);
+
+ // Always skip invalid encodings for the current block size
+ if (!valid || (x_weights > x_texels) || (y_weights > y_texels))
+ {
+ continue;
+ }
+
+ // Selectively skip dual plane encodings
+ if (((j <= 1) && is_dual_plane) || (j == 2 && !is_dual_plane))
+ {
+ continue;
+ }
+
+ // Always skip encodings we can't physically encode based on
+ // generic encoding bit availability
+ if (is_dual_plane)
+ {
+ // This is the only check we need as only support 1 partition
+ if ((109 - weight_bits) <= 0)
+ {
+ continue;
+ }
+ }
+ else
+ {
+ // This is conservative - fewer bits may be available for > 1 partition
+ if ((111 - weight_bits) <= 0)
+ {
+ continue;
+ }
+ }
+
+ // Selectively skip encodings based on percentile
+ bool percentile_hit = false;
+ #if !defined(ASTCENC_DECOMPRESS_ONLY)
+ if (j == 0)
+ {
+ percentile_hit = percentiles[i] <= always_cutoff;
+ }
+ else
+ {
+ percentile_hit = percentiles[i] <= mode_cutoff;
+ }
+ #endif
+
+ if (j != 3 && !percentile_hit)
+ {
+ continue;
+ }
+
+ // Allocate and initialize the decimation table entry if we've not used it yet
+ int decimation_mode = decimation_mode_index[y_weights * 16 + x_weights];
+ if (decimation_mode < 0)
+ {
+ construct_dt_entry_2d(x_texels, y_texels, x_weights, y_weights, bsd, *wb, packed_dm_idx);
+ decimation_mode_index[y_weights * 16 + x_weights] = packed_dm_idx;
+ decimation_mode = packed_dm_idx;
+
+ dm_counts[j]++;
+ packed_dm_idx++;
+ }
+
+ auto& bm = bsd.block_modes[packed_bm_idx];
+
+ bm.decimation_mode = static_cast<uint8_t>(decimation_mode);
+ bm.quant_mode = static_cast<uint8_t>(quant_mode);
+ bm.is_dual_plane = static_cast<uint8_t>(is_dual_plane);
+ bm.weight_bits = static_cast<uint8_t>(weight_bits);
+ bm.mode_index = static_cast<uint16_t>(i);
+
+ auto& dm = bsd.decimation_modes[decimation_mode];
+
+ if (is_dual_plane)
+ {
+ dm.set_ref_2_plane(bm.get_weight_quant_mode());
+ }
+ else
+ {
+ dm.set_ref_1_plane(bm.get_weight_quant_mode());
+ }
+
+ bsd.block_mode_packed_index[i] = static_cast<uint16_t>(packed_bm_idx);
+
+ packed_bm_idx++;
+ bm_counts[j]++;
+ }
+ }
+
+ bsd.block_mode_count_1plane_always = bm_counts[0];
+ bsd.block_mode_count_1plane_selected = bm_counts[0] + bm_counts[1];
+ bsd.block_mode_count_1plane_2plane_selected = bm_counts[0] + bm_counts[1] + bm_counts[2];
+ bsd.block_mode_count_all = bm_counts[0] + bm_counts[1] + bm_counts[2] + bm_counts[3];
+
+ bsd.decimation_mode_count_always = dm_counts[0];
+ bsd.decimation_mode_count_selected = dm_counts[0] + dm_counts[1] + dm_counts[2];
+ bsd.decimation_mode_count_all = dm_counts[0] + dm_counts[1] + dm_counts[2] + dm_counts[3];
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+ assert(bsd.block_mode_count_1plane_always > 0);
+ assert(bsd.decimation_mode_count_always > 0);
+
+ delete[] percentiles;
+#endif
+
+ // Ensure the end of the array contains valid data (should never get read)
+ for (unsigned int i = bsd.decimation_mode_count_all; i < WEIGHTS_MAX_DECIMATION_MODES; i++)
+ {
+ bsd.decimation_modes[i].maxprec_1plane = -1;
+ bsd.decimation_modes[i].maxprec_2planes = -1;
+ bsd.decimation_modes[i].refprec_1_plane = 0;
+ bsd.decimation_modes[i].refprec_2_planes = 0;
+ }
+
+ // Determine the texels to use for kmeans clustering.
+ assign_kmeans_texels(bsd);
+
+ delete wb;
+}
+
+/**
+ * @brief Allocate block modes and decimation tables for a single 3D block size.
+ *
+ * TODO: This function doesn't include all of the heuristics that we use for 2D block sizes such as
+ * the percentile mode cutoffs. If 3D becomes more widely used we should look at this.
+ *
+ * @param x_texels The number of texels in the X dimension.
+ * @param y_texels The number of texels in the Y dimension.
+ * @param z_texels The number of texels in the Z dimension.
+ * @param[out] bsd The block size descriptor to populate.
+ */
+static void construct_block_size_descriptor_3d(
+ unsigned int x_texels,
+ unsigned int y_texels,
+ unsigned int z_texels,
+ block_size_descriptor& bsd
+) {
+ // Store a remap table for storing packed decimation modes.
+ // Indexing uses [Z * 64 + Y * 8 + X] and max size for each axis is 6.
+ static constexpr unsigned int MAX_DMI = 6 * 64 + 6 * 8 + 6;
+ int decimation_mode_index[MAX_DMI];
+ unsigned int decimation_mode_count = 0;
+
+ dt_init_working_buffers* wb = new dt_init_working_buffers;
+
+ bsd.xdim = static_cast<uint8_t>(x_texels);
+ bsd.ydim = static_cast<uint8_t>(y_texels);
+ bsd.zdim = static_cast<uint8_t>(z_texels);
+ bsd.texel_count = static_cast<uint8_t>(x_texels * y_texels * z_texels);
+
+ for (unsigned int i = 0; i < MAX_DMI; i++)
+ {
+ decimation_mode_index[i] = -1;
+ }
+
+ // gather all the infill-modes that can be used with the current block size
+ for (unsigned int x_weights = 2; x_weights <= x_texels; x_weights++)
+ {
+ for (unsigned int y_weights = 2; y_weights <= y_texels; y_weights++)
+ {
+ for (unsigned int z_weights = 2; z_weights <= z_texels; z_weights++)
+ {
+ unsigned int weight_count = x_weights * y_weights * z_weights;
+ if (weight_count > BLOCK_MAX_WEIGHTS)
+ {
+ continue;
+ }
+
+ decimation_info& di = bsd.decimation_tables[decimation_mode_count];
+ decimation_mode_index[z_weights * 64 + y_weights * 8 + x_weights] = decimation_mode_count;
+ init_decimation_info_3d(x_texels, y_texels, z_texels, x_weights, y_weights, z_weights, di, *wb);
+
+ int maxprec_1plane = -1;
+ int maxprec_2planes = -1;
+ for (unsigned int i = 0; i < 12; i++)
+ {
+ unsigned int bits_1plane = get_ise_sequence_bitcount(weight_count, static_cast<quant_method>(i));
+ if (bits_1plane >= BLOCK_MIN_WEIGHT_BITS && bits_1plane <= BLOCK_MAX_WEIGHT_BITS)
+ {
+ maxprec_1plane = i;
+ }
+
+ unsigned int bits_2planes = get_ise_sequence_bitcount(2 * weight_count, static_cast<quant_method>(i));
+ if (bits_2planes >= BLOCK_MIN_WEIGHT_BITS && bits_2planes <= BLOCK_MAX_WEIGHT_BITS)
+ {
+ maxprec_2planes = i;
+ }
+ }
+
+ if ((2 * weight_count) > BLOCK_MAX_WEIGHTS)
+ {
+ maxprec_2planes = -1;
+ }
+
+ bsd.decimation_modes[decimation_mode_count].maxprec_1plane = static_cast<int8_t>(maxprec_1plane);
+ bsd.decimation_modes[decimation_mode_count].maxprec_2planes = static_cast<int8_t>(maxprec_2planes);
+ bsd.decimation_modes[decimation_mode_count].refprec_1_plane = maxprec_1plane == -1 ? 0 : 0xFFFF;
+ bsd.decimation_modes[decimation_mode_count].refprec_2_planes = maxprec_2planes == -1 ? 0 : 0xFFFF;
+ decimation_mode_count++;
+ }
+ }
+ }
+
+ // Ensure the end of the array contains valid data (should never get read)
+ for (unsigned int i = decimation_mode_count; i < WEIGHTS_MAX_DECIMATION_MODES; i++)
+ {
+ bsd.decimation_modes[i].maxprec_1plane = -1;
+ bsd.decimation_modes[i].maxprec_2planes = -1;
+ bsd.decimation_modes[i].refprec_1_plane = 0;
+ bsd.decimation_modes[i].refprec_2_planes = 0;
+ }
+
+ bsd.decimation_mode_count_always = 0; // Skipped for 3D modes
+ bsd.decimation_mode_count_selected = decimation_mode_count;
+ bsd.decimation_mode_count_all = decimation_mode_count;
+
+ // Construct the list of block formats referencing the decimation tables
+
+ // Clear the list to a known-bad value
+ for (unsigned int i = 0; i < WEIGHTS_MAX_BLOCK_MODES; i++)
+ {
+ bsd.block_mode_packed_index[i] = BLOCK_BAD_BLOCK_MODE;
+ }
+
+ unsigned int packed_idx = 0;
+ unsigned int bm_counts[2] { 0 };
+
+ // Iterate two times to build a usefully ordered list:
+ // - Pass 0 - keep valid single plane block modes
+ // - Pass 1 - keep valid dual plane block modes
+ for (unsigned int j = 0; j < 2; j++)
+ {
+ for (unsigned int i = 0; i < WEIGHTS_MAX_BLOCK_MODES; i++)
+ {
+ // Skip modes we've already included in a previous pass
+ if (bsd.block_mode_packed_index[i] != BLOCK_BAD_BLOCK_MODE)
+ {
+ continue;
+ }
+
+ unsigned int x_weights;
+ unsigned int y_weights;
+ unsigned int z_weights;
+ bool is_dual_plane;
+ unsigned int quant_mode;
+ unsigned int weight_bits;
+
+ bool valid = decode_block_mode_3d(i, x_weights, y_weights, z_weights, is_dual_plane, quant_mode, weight_bits);
+ // Skip invalid encodings
+ if (!valid || x_weights > x_texels || y_weights > y_texels || z_weights > z_texels)
+ {
+ continue;
+ }
+
+ // Skip encodings in the wrong iteration
+ if ((j == 0 && is_dual_plane) || (j == 1 && !is_dual_plane))
+ {
+ continue;
+ }
+
+ // Always skip encodings we can't physically encode based on bit availability
+ if (is_dual_plane)
+ {
+ // This is the only check we need as only support 1 partition
+ if ((109 - weight_bits) <= 0)
+ {
+ continue;
+ }
+ }
+ else
+ {
+ // This is conservative - fewer bits may be available for > 1 partition
+ if ((111 - weight_bits) <= 0)
+ {
+ continue;
+ }
+ }
+
+ int decimation_mode = decimation_mode_index[z_weights * 64 + y_weights * 8 + x_weights];
+ bsd.block_modes[packed_idx].decimation_mode = static_cast<uint8_t>(decimation_mode);
+ bsd.block_modes[packed_idx].quant_mode = static_cast<uint8_t>(quant_mode);
+ bsd.block_modes[packed_idx].weight_bits = static_cast<uint8_t>(weight_bits);
+ bsd.block_modes[packed_idx].is_dual_plane = static_cast<uint8_t>(is_dual_plane);
+ bsd.block_modes[packed_idx].mode_index = static_cast<uint16_t>(i);
+
+ bsd.block_mode_packed_index[i] = static_cast<uint16_t>(packed_idx);
+ bm_counts[j]++;
+ packed_idx++;
+ }
+ }
+
+ bsd.block_mode_count_1plane_always = 0; // Skipped for 3D modes
+ bsd.block_mode_count_1plane_selected = bm_counts[0];
+ bsd.block_mode_count_1plane_2plane_selected = bm_counts[0] + bm_counts[1];
+ bsd.block_mode_count_all = bm_counts[0] + bm_counts[1];
+
+ // Determine the texels to use for kmeans clustering.
+ assign_kmeans_texels(bsd);
+
+ delete wb;
+}
+
+/* See header for documentation. */
+void init_block_size_descriptor(
+ unsigned int x_texels,
+ unsigned int y_texels,
+ unsigned int z_texels,
+ bool can_omit_modes,
+ unsigned int partition_count_cutoff,
+ float mode_cutoff,
+ block_size_descriptor& bsd
+) {
+ if (z_texels > 1)
+ {
+ construct_block_size_descriptor_3d(x_texels, y_texels, z_texels, bsd);
+ }
+ else
+ {
+ construct_block_size_descriptor_2d(x_texels, y_texels, can_omit_modes, mode_cutoff, bsd);
+ }
+
+ init_partition_tables(bsd, can_omit_modes, partition_count_cutoff);
+}
diff --git a/thirdparty/astcenc/astcenc_color_quantize.cpp b/thirdparty/astcenc/astcenc_color_quantize.cpp
new file mode 100644
index 0000000000..edcfe4f853
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_color_quantize.cpp
@@ -0,0 +1,2071 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2021 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+
+/**
+ * @brief Functions for color quantization.
+ *
+ * The design of the color quantization functionality requires the caller to use higher level error
+ * analysis to determine the base encoding that should be used. This earlier analysis will select
+ * the basic type of the endpoint that should be used:
+ *
+ * * Mode: LDR or HDR
+ * * Quantization level
+ * * Channel count: L, LA, RGB, or RGBA
+ * * Endpoint 2 type: Direct color endcode, or scaled from endpoint 1.
+ *
+ * However, this leaves a number of decisions about exactly how to pack the endpoints open. In
+ * particular we need to determine if blue contraction can be used, or/and if delta encoding can be
+ * used. If they can be applied these will allow us to maintain higher precision in the endpoints
+ * without needing additional storage.
+ */
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "astcenc_internal.h"
+
+/**
+ * @brief Determine the quantized value given a quantization level.
+ *
+ * @param quant_level The quantization level to use.
+ * @param value The value to convert. This may be outside of the 0-255 range and will be
+ * clamped before the value is looked up.
+ *
+ * @return The encoded quantized value. These are not necessarily in order; the compressor
+ * scrambles the values slightly to make hardware implementation easier.
+ */
+static inline uint8_t quant_color(
+ quant_method quant_level,
+ int value
+) {
+ return color_unquant_to_uquant_tables[quant_level - QUANT_6][value];
+}
+
+/**
+ * @brief Quantize an LDR RGB color.
+ *
+ * Since this is a fall-back encoding, we cannot actually fail but must produce a sensible result.
+ * For this encoding @c color0 cannot be larger than @c color1. If @c color0 is actually larger
+ * than @c color1, @c color0 is reduced and @c color1 is increased until the constraint is met.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as (r0, r1, g0, g1, b0, b1).
+ * @param quant_level The quantization level to use.
+ */
+static void quantize_rgb(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[6],
+ quant_method quant_level
+) {
+ float scale = 1.0f / 257.0f;
+
+ float r0 = astc::clamp255f(color0.lane<0>() * scale);
+ float g0 = astc::clamp255f(color0.lane<1>() * scale);
+ float b0 = astc::clamp255f(color0.lane<2>() * scale);
+
+ float r1 = astc::clamp255f(color1.lane<0>() * scale);
+ float g1 = astc::clamp255f(color1.lane<1>() * scale);
+ float b1 = astc::clamp255f(color1.lane<2>() * scale);
+
+ int ri0, gi0, bi0, ri1, gi1, bi1;
+ float rgb0_addon = 0.5f;
+ float rgb1_addon = 0.5f;
+ do
+ {
+ ri0 = quant_color(quant_level, astc::max(astc::flt2int_rd(r0 + rgb0_addon), 0));
+ gi0 = quant_color(quant_level, astc::max(astc::flt2int_rd(g0 + rgb0_addon), 0));
+ bi0 = quant_color(quant_level, astc::max(astc::flt2int_rd(b0 + rgb0_addon), 0));
+ ri1 = quant_color(quant_level, astc::min(astc::flt2int_rd(r1 + rgb1_addon), 255));
+ gi1 = quant_color(quant_level, astc::min(astc::flt2int_rd(g1 + rgb1_addon), 255));
+ bi1 = quant_color(quant_level, astc::min(astc::flt2int_rd(b1 + rgb1_addon), 255));
+
+ rgb0_addon -= 0.2f;
+ rgb1_addon += 0.2f;
+ } while (ri0 + gi0 + bi0 > ri1 + gi1 + bi1);
+
+ output[0] = static_cast<uint8_t>(ri0);
+ output[1] = static_cast<uint8_t>(ri1);
+ output[2] = static_cast<uint8_t>(gi0);
+ output[3] = static_cast<uint8_t>(gi1);
+ output[4] = static_cast<uint8_t>(bi0);
+ output[5] = static_cast<uint8_t>(bi1);
+}
+
+/**
+ * @brief Quantize an LDR RGBA color.
+ *
+ * Since this is a fall-back encoding, we cannot actually fail but must produce a sensible result.
+ * For this encoding @c color0.rgb cannot be larger than @c color1.rgb (this indicates blue
+ * contraction). If @c color0.rgb is actually larger than @c color1.rgb, @c color0.rgb is reduced
+ * and @c color1.rgb is increased until the constraint is met.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as (r0, r1, g0, g1, b0, b1, a0, a1).
+ * @param quant_level The quantization level to use.
+ */
+static void quantize_rgba(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[8],
+ quant_method quant_level
+) {
+ float scale = 1.0f / 257.0f;
+
+ float a0 = astc::clamp255f(color0.lane<3>() * scale);
+ float a1 = astc::clamp255f(color1.lane<3>() * scale);
+
+ output[6] = quant_color(quant_level, astc::flt2int_rtn(a0));
+ output[7] = quant_color(quant_level, astc::flt2int_rtn(a1));
+
+ quantize_rgb(color0, color1, output, quant_level);
+}
+
+/**
+ * @brief Try to quantize an LDR RGB color using blue-contraction.
+ *
+ * Blue-contraction is only usable if encoded color 1 is larger than color 0.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as (r1, r0, g1, g0, b1, b0).
+ * @param quant_level The quantization level to use.
+ *
+ * @return Returns @c false on failure, @c true on success.
+ */
+static bool try_quantize_rgb_blue_contract(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[6],
+ quant_method quant_level
+) {
+ float scale = 1.0f / 257.0f;
+
+ float r0 = color0.lane<0>() * scale;
+ float g0 = color0.lane<1>() * scale;
+ float b0 = color0.lane<2>() * scale;
+
+ float r1 = color1.lane<0>() * scale;
+ float g1 = color1.lane<1>() * scale;
+ float b1 = color1.lane<2>() * scale;
+
+ // Apply inverse blue-contraction. This can produce an overflow; which means BC cannot be used.
+ r0 += (r0 - b0);
+ g0 += (g0 - b0);
+ r1 += (r1 - b1);
+ g1 += (g1 - b1);
+
+ if (r0 < 0.0f || r0 > 255.0f || g0 < 0.0f || g0 > 255.0f || b0 < 0.0f || b0 > 255.0f ||
+ r1 < 0.0f || r1 > 255.0f || g1 < 0.0f || g1 > 255.0f || b1 < 0.0f || b1 > 255.0f)
+ {
+ return false;
+ }
+
+ // Quantize the inverse-blue-contracted color
+ int ri0 = quant_color(quant_level, astc::flt2int_rtn(r0));
+ int gi0 = quant_color(quant_level, astc::flt2int_rtn(g0));
+ int bi0 = quant_color(quant_level, astc::flt2int_rtn(b0));
+
+ int ri1 = quant_color(quant_level, astc::flt2int_rtn(r1));
+ int gi1 = quant_color(quant_level, astc::flt2int_rtn(g1));
+ int bi1 = quant_color(quant_level, astc::flt2int_rtn(b1));
+
+ // If color #1 is not larger than color #0 then blue-contraction cannot be used. Note that
+ // blue-contraction and quantization change this order, which is why we must test afterwards.
+ if (ri1 + gi1 + bi1 <= ri0 + gi0 + bi0)
+ {
+ return false;
+ }
+
+ output[0] = static_cast<uint8_t>(ri1);
+ output[1] = static_cast<uint8_t>(ri0);
+ output[2] = static_cast<uint8_t>(gi1);
+ output[3] = static_cast<uint8_t>(gi0);
+ output[4] = static_cast<uint8_t>(bi1);
+ output[5] = static_cast<uint8_t>(bi0);
+
+ return true;
+}
+
+/**
+ * @brief Try to quantize an LDR RGBA color using blue-contraction.
+ *
+ * Blue-contraction is only usable if encoded color 1 RGB is larger than color 0 RGB.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as (r1, r0, g1, g0, b1, b0, a1, a0).
+ * @param quant_level The quantization level to use.
+ *
+ * @return Returns @c false on failure, @c true on success.
+ */
+static int try_quantize_rgba_blue_contract(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[8],
+ quant_method quant_level
+) {
+ float scale = 1.0f / 257.0f;
+
+ float a0 = astc::clamp255f(color0.lane<3>() * scale);
+ float a1 = astc::clamp255f(color1.lane<3>() * scale);
+
+ output[6] = quant_color(quant_level, astc::flt2int_rtn(a1));
+ output[7] = quant_color(quant_level, astc::flt2int_rtn(a0));
+
+ return try_quantize_rgb_blue_contract(color0, color1, output, quant_level);
+}
+
+/**
+ * @brief Try to quantize an LDR RGB color using delta encoding.
+ *
+ * At decode time we move one bit from the offset to the base and seize another bit as a sign bit;
+ * we then unquantize both values as if they contain one extra bit. If the sum of the offsets is
+ * non-negative, then we encode a regular delta.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as (r0, r1, g0, g1, b0, b1).
+ * @param quant_level The quantization level to use.
+ *
+ * @return Returns @c false on failure, @c true on success.
+ */
+static bool try_quantize_rgb_delta(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[6],
+ quant_method quant_level
+) {
+ float scale = 1.0f / 257.0f;
+
+ float r0 = astc::clamp255f(color0.lane<0>() * scale);
+ float g0 = astc::clamp255f(color0.lane<1>() * scale);
+ float b0 = astc::clamp255f(color0.lane<2>() * scale);
+
+ float r1 = astc::clamp255f(color1.lane<0>() * scale);
+ float g1 = astc::clamp255f(color1.lane<1>() * scale);
+ float b1 = astc::clamp255f(color1.lane<2>() * scale);
+
+ // Transform r0 to unorm9
+ int r0a = astc::flt2int_rtn(r0);
+ int g0a = astc::flt2int_rtn(g0);
+ int b0a = astc::flt2int_rtn(b0);
+
+ r0a <<= 1;
+ g0a <<= 1;
+ b0a <<= 1;
+
+ // Mask off the top bit
+ int r0b = r0a & 0xFF;
+ int g0b = g0a & 0xFF;
+ int b0b = b0a & 0xFF;
+
+ // Quantize then unquantize in order to get a value that we take differences against
+ int r0be = quant_color(quant_level, r0b);
+ int g0be = quant_color(quant_level, g0b);
+ int b0be = quant_color(quant_level, b0b);
+
+ r0b = r0be | (r0a & 0x100);
+ g0b = g0be | (g0a & 0x100);
+ b0b = b0be | (b0a & 0x100);
+
+ // Get hold of the second value
+ int r1d = astc::flt2int_rtn(r1);
+ int g1d = astc::flt2int_rtn(g1);
+ int b1d = astc::flt2int_rtn(b1);
+
+ r1d <<= 1;
+ g1d <<= 1;
+ b1d <<= 1;
+
+ // ... and take differences
+ r1d -= r0b;
+ g1d -= g0b;
+ b1d -= b0b;
+
+ // Check if the difference is too large to be encodable
+ if (r1d > 63 || g1d > 63 || b1d > 63 || r1d < -64 || g1d < -64 || b1d < -64)
+ {
+ return false;
+ }
+
+ // Insert top bit of the base into the offset
+ r1d &= 0x7F;
+ g1d &= 0x7F;
+ b1d &= 0x7F;
+
+ r1d |= (r0b & 0x100) >> 1;
+ g1d |= (g0b & 0x100) >> 1;
+ b1d |= (b0b & 0x100) >> 1;
+
+ // Then quantize and unquantize; if this causes either top two bits to flip, then encoding fails
+ // since we have then corrupted either the top bit of the base or the sign bit of the offset
+ int r1de = quant_color(quant_level, r1d);
+ int g1de = quant_color(quant_level, g1d);
+ int b1de = quant_color(quant_level, b1d);
+
+ if (((r1d ^ r1de) | (g1d ^ g1de) | (b1d ^ b1de)) & 0xC0)
+ {
+ return false;
+ }
+
+ // If the sum of offsets triggers blue-contraction then encoding fails
+ vint4 ep0(r0be, g0be, b0be, 0);
+ vint4 ep1(r1de, g1de, b1de, 0);
+ bit_transfer_signed(ep1, ep0);
+ if (hadd_rgb_s(ep1) < 0)
+ {
+ return false;
+ }
+
+ // Check that the offsets produce legitimate sums as well
+ ep0 = ep0 + ep1;
+ if (any((ep0 < vint4(0)) | (ep0 > vint4(0xFF))))
+ {
+ return false;
+ }
+
+ output[0] = static_cast<uint8_t>(r0be);
+ output[1] = static_cast<uint8_t>(r1de);
+ output[2] = static_cast<uint8_t>(g0be);
+ output[3] = static_cast<uint8_t>(g1de);
+ output[4] = static_cast<uint8_t>(b0be);
+ output[5] = static_cast<uint8_t>(b1de);
+
+ return true;
+}
+
+static bool try_quantize_rgb_delta_blue_contract(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[6],
+ quant_method quant_level
+) {
+ // Note: Switch around endpoint colors already at start
+ float scale = 1.0f / 257.0f;
+
+ float r1 = color0.lane<0>() * scale;
+ float g1 = color0.lane<1>() * scale;
+ float b1 = color0.lane<2>() * scale;
+
+ float r0 = color1.lane<0>() * scale;
+ float g0 = color1.lane<1>() * scale;
+ float b0 = color1.lane<2>() * scale;
+
+ // Apply inverse blue-contraction. This can produce an overflow; which means BC cannot be used.
+ r0 += (r0 - b0);
+ g0 += (g0 - b0);
+ r1 += (r1 - b1);
+ g1 += (g1 - b1);
+
+ if (r0 < 0.0f || r0 > 255.0f || g0 < 0.0f || g0 > 255.0f || b0 < 0.0f || b0 > 255.0f ||
+ r1 < 0.0f || r1 > 255.0f || g1 < 0.0f || g1 > 255.0f || b1 < 0.0f || b1 > 255.0f)
+ {
+ return false;
+ }
+
+ // Transform r0 to unorm9
+ int r0a = astc::flt2int_rtn(r0);
+ int g0a = astc::flt2int_rtn(g0);
+ int b0a = astc::flt2int_rtn(b0);
+ r0a <<= 1;
+ g0a <<= 1;
+ b0a <<= 1;
+
+ // Mask off the top bit
+ int r0b = r0a & 0xFF;
+ int g0b = g0a & 0xFF;
+ int b0b = b0a & 0xFF;
+
+ // Quantize, then unquantize in order to get a value that we take differences against.
+ int r0be = quant_color(quant_level, r0b);
+ int g0be = quant_color(quant_level, g0b);
+ int b0be = quant_color(quant_level, b0b);
+
+ r0b = r0be | (r0a & 0x100);
+ g0b = g0be | (g0a & 0x100);
+ b0b = b0be | (b0a & 0x100);
+
+ // Get hold of the second value
+ int r1d = astc::flt2int_rtn(r1);
+ int g1d = astc::flt2int_rtn(g1);
+ int b1d = astc::flt2int_rtn(b1);
+
+ r1d <<= 1;
+ g1d <<= 1;
+ b1d <<= 1;
+
+ // .. and take differences!
+ r1d -= r0b;
+ g1d -= g0b;
+ b1d -= b0b;
+
+ // Check if the difference is too large to be encodable
+ if (r1d > 63 || g1d > 63 || b1d > 63 || r1d < -64 || g1d < -64 || b1d < -64)
+ {
+ return false;
+ }
+
+ // Insert top bit of the base into the offset
+ r1d &= 0x7F;
+ g1d &= 0x7F;
+ b1d &= 0x7F;
+
+ r1d |= (r0b & 0x100) >> 1;
+ g1d |= (g0b & 0x100) >> 1;
+ b1d |= (b0b & 0x100) >> 1;
+
+ // Then quantize and unquantize; if this causes any of the top two bits to flip,
+ // then encoding fails, since we have then corrupted either the top bit of the base
+ // or the sign bit of the offset.
+ int r1de = quant_color(quant_level, r1d);
+ int g1de = quant_color(quant_level, g1d);
+ int b1de = quant_color(quant_level, b1d);
+
+ if (((r1d ^ r1de) | (g1d ^ g1de) | (b1d ^ b1de)) & 0xC0)
+ {
+ return false;
+ }
+
+ // If the sum of offsets does not trigger blue-contraction then encoding fails
+ vint4 ep0(r0be, g0be, b0be, 0);
+ vint4 ep1(r1de, g1de, b1de, 0);
+ bit_transfer_signed(ep1, ep0);
+ if (hadd_rgb_s(ep1) >= 0)
+ {
+ return false;
+ }
+
+ // Check that the offsets produce legitimate sums as well
+ ep0 = ep0 + ep1;
+ if (any((ep0 < vint4(0)) | (ep0 > vint4(0xFF))))
+ {
+ return false;
+ }
+
+ output[0] = static_cast<uint8_t>(r0be);
+ output[1] = static_cast<uint8_t>(r1de);
+ output[2] = static_cast<uint8_t>(g0be);
+ output[3] = static_cast<uint8_t>(g1de);
+ output[4] = static_cast<uint8_t>(b0be);
+ output[5] = static_cast<uint8_t>(b1de);
+
+ return true;
+}
+
+/**
+ * @brief Try to quantize an LDR A color using delta encoding.
+ *
+ * At decode time we move one bit from the offset to the base and seize another bit as a sign bit;
+ * we then unquantize both values as if they contain one extra bit. If the sum of the offsets is
+ * non-negative, then we encode a regular delta.
+ *
+ * This function only compressed the alpha - the other elements in the output array are not touched.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as (x, x, x, x, x, x, a0, a1).
+ * @param quant_level The quantization level to use.
+ *
+ * @return Returns @c false on failure, @c true on success.
+ */
+static bool try_quantize_alpha_delta(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[8],
+ quant_method quant_level
+) {
+ float scale = 1.0f / 257.0f;
+
+ float a0 = astc::clamp255f(color0.lane<3>() * scale);
+ float a1 = astc::clamp255f(color1.lane<3>() * scale);
+
+ int a0a = astc::flt2int_rtn(a0);
+ a0a <<= 1;
+ int a0b = a0a & 0xFF;
+ int a0be = quant_color(quant_level, a0b);
+ a0b = a0be;
+ a0b |= a0a & 0x100;
+ int a1d = astc::flt2int_rtn(a1);
+ a1d <<= 1;
+ a1d -= a0b;
+
+ if (a1d > 63 || a1d < -64)
+ {
+ return false;
+ }
+
+ a1d &= 0x7F;
+ a1d |= (a0b & 0x100) >> 1;
+
+ int a1de = quant_color(quant_level, a1d);
+ int a1du = a1de;
+ if ((a1d ^ a1du) & 0xC0)
+ {
+ return false;
+ }
+
+ a1du &= 0x7F;
+ if (a1du & 0x40)
+ {
+ a1du -= 0x80;
+ }
+
+ a1du += a0b;
+ if (a1du < 0 || a1du > 0x1FF)
+ {
+ return false;
+ }
+
+ output[6] = static_cast<uint8_t>(a0be);
+ output[7] = static_cast<uint8_t>(a1de);
+
+ return true;
+}
+
+/**
+ * @brief Try to quantize an LDR LA color using delta encoding.
+ *
+ * At decode time we move one bit from the offset to the base and seize another bit as a sign bit;
+ * we then unquantize both values as if they contain one extra bit. If the sum of the offsets is
+ * non-negative, then we encode a regular delta.
+ *
+ * This function only compressed the alpha - the other elements in the output array are not touched.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as (l0, l1, a0, a1).
+ * @param quant_level The quantization level to use.
+ *
+ * @return Returns @c false on failure, @c true on success.
+ */
+static bool try_quantize_luminance_alpha_delta(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[4],
+ quant_method quant_level
+) {
+ float scale = 1.0f / 257.0f;
+
+ float l0 = astc::clamp255f(hadd_rgb_s(color0) * ((1.0f / 3.0f) * scale));
+ float l1 = astc::clamp255f(hadd_rgb_s(color1) * ((1.0f / 3.0f) * scale));
+
+ float a0 = astc::clamp255f(color0.lane<3>() * scale);
+ float a1 = astc::clamp255f(color1.lane<3>() * scale);
+
+ int l0a = astc::flt2int_rtn(l0);
+ int a0a = astc::flt2int_rtn(a0);
+ l0a <<= 1;
+ a0a <<= 1;
+
+ int l0b = l0a & 0xFF;
+ int a0b = a0a & 0xFF;
+ int l0be = quant_color(quant_level, l0b);
+ int a0be = quant_color(quant_level, a0b);
+ l0b = l0be;
+ a0b = a0be;
+ l0b |= l0a & 0x100;
+ a0b |= a0a & 0x100;
+
+ int l1d = astc::flt2int_rtn(l1);
+ int a1d = astc::flt2int_rtn(a1);
+ l1d <<= 1;
+ a1d <<= 1;
+ l1d -= l0b;
+ a1d -= a0b;
+
+ if (l1d > 63 || l1d < -64)
+ {
+ return false;
+ }
+
+ if (a1d > 63 || a1d < -64)
+ {
+ return false;
+ }
+
+ l1d &= 0x7F;
+ a1d &= 0x7F;
+ l1d |= (l0b & 0x100) >> 1;
+ a1d |= (a0b & 0x100) >> 1;
+
+ int l1de = quant_color(quant_level, l1d);
+ int a1de = quant_color(quant_level, a1d);
+ int l1du = l1de;
+ int a1du = a1de;
+
+ if ((l1d ^ l1du) & 0xC0)
+ {
+ return false;
+ }
+
+ if ((a1d ^ a1du) & 0xC0)
+ {
+ return false;
+ }
+
+ l1du &= 0x7F;
+ a1du &= 0x7F;
+
+ if (l1du & 0x40)
+ {
+ l1du -= 0x80;
+ }
+
+ if (a1du & 0x40)
+ {
+ a1du -= 0x80;
+ }
+
+ l1du += l0b;
+ a1du += a0b;
+
+ if (l1du < 0 || l1du > 0x1FF)
+ {
+ return false;
+ }
+
+ if (a1du < 0 || a1du > 0x1FF)
+ {
+ return false;
+ }
+
+ output[0] = static_cast<uint8_t>(l0be);
+ output[1] = static_cast<uint8_t>(l1de);
+ output[2] = static_cast<uint8_t>(a0be);
+ output[3] = static_cast<uint8_t>(a1de);
+
+ return true;
+}
+
+/**
+ * @brief Try to quantize an LDR RGBA color using delta encoding.
+ *
+ * At decode time we move one bit from the offset to the base and seize another bit as a sign bit;
+ * we then unquantize both values as if they contain one extra bit. If the sum of the offsets is
+ * non-negative, then we encode a regular delta.
+ *
+ * This function only compressed the alpha - the other elements in the output array are not touched.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as (r0, r1, b0, b1, g0, g1, a0, a1).
+ * @param quant_level The quantization level to use.
+ *
+ * @return Returns @c false on failure, @c true on success.
+ */
+static bool try_quantize_rgba_delta(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[8],
+ quant_method quant_level
+) {
+ return try_quantize_rgb_delta(color0, color1, output, quant_level) &&
+ try_quantize_alpha_delta(color0, color1, output, quant_level);
+}
+
+
+/**
+ * @brief Try to quantize an LDR RGBA color using delta and blue contract encoding.
+ *
+ * At decode time we move one bit from the offset to the base and seize another bit as a sign bit;
+ * we then unquantize both values as if they contain one extra bit. If the sum of the offsets is
+ * non-negative, then we encode a regular delta.
+ *
+ * This function only compressed the alpha - the other elements in the output array are not touched.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as (r0, r1, b0, b1, g0, g1, a0, a1).
+ * @param quant_level The quantization level to use.
+ *
+ * @return Returns @c false on failure, @c true on success.
+ */
+static bool try_quantize_rgba_delta_blue_contract(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[8],
+ quant_method quant_level
+) {
+ // Note that we swap the color0 and color1 ordering for alpha to match RGB blue-contract
+ return try_quantize_rgb_delta_blue_contract(color0, color1, output, quant_level) &&
+ try_quantize_alpha_delta(color1, color0, output, quant_level);
+}
+
+/**
+ * @brief Quantize an LDR RGB color using scale encoding.
+ *
+ * @param color The input unquantized color endpoint and scale factor.
+ * @param[out] output The output endpoints, returned as (r0, g0, b0, s).
+ * @param quant_level The quantization level to use.
+ */
+static void quantize_rgbs(
+ vfloat4 color,
+ uint8_t output[4],
+ quant_method quant_level
+) {
+ float scale = 1.0f / 257.0f;
+
+ float r = astc::clamp255f(color.lane<0>() * scale);
+ float g = astc::clamp255f(color.lane<1>() * scale);
+ float b = astc::clamp255f(color.lane<2>() * scale);
+
+ int ri = quant_color(quant_level, astc::flt2int_rtn(r));
+ int gi = quant_color(quant_level, astc::flt2int_rtn(g));
+ int bi = quant_color(quant_level, astc::flt2int_rtn(b));
+
+ float oldcolorsum = hadd_rgb_s(color) * scale;
+ float newcolorsum = static_cast<float>(ri + gi + bi);
+
+ float scalea = astc::clamp1f(color.lane<3>() * (oldcolorsum + 1e-10f) / (newcolorsum + 1e-10f));
+ int scale_idx = astc::flt2int_rtn(scalea * 256.0f);
+ scale_idx = astc::clamp(scale_idx, 0, 255);
+
+ output[0] = static_cast<uint8_t>(ri);
+ output[1] = static_cast<uint8_t>(gi);
+ output[2] = static_cast<uint8_t>(bi);
+ output[3] = quant_color(quant_level, scale_idx);
+}
+
+/**
+ * @brief Quantize an LDR RGBA color using scale encoding.
+ *
+ * @param color The input unquantized color endpoint and scale factor.
+ * @param[out] output The output endpoints, returned as (r0, g0, b0, s, a0, a1).
+ * @param quant_level The quantization level to use.
+ */
+static void quantize_rgbs_alpha(
+ vfloat4 color0,
+ vfloat4 color1,
+ vfloat4 color,
+ uint8_t output[6],
+ quant_method quant_level
+) {
+ float scale = 1.0f / 257.0f;
+
+ float a0 = astc::clamp255f(color0.lane<3>() * scale);
+ float a1 = astc::clamp255f(color1.lane<3>() * scale);
+
+ output[4] = quant_color(quant_level, astc::flt2int_rtn(a0));
+ output[5] = quant_color(quant_level, astc::flt2int_rtn(a1));
+
+ quantize_rgbs(color, output, quant_level);
+}
+
+/**
+ * @brief Quantize a LDR L color.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as (l0, l1).
+ * @param quant_level The quantization level to use.
+ */
+static void quantize_luminance(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[2],
+ quant_method quant_level
+) {
+ float scale = 1.0f / 257.0f;
+
+ color0 = color0 * scale;
+ color1 = color1 * scale;
+
+ float lum0 = astc::clamp255f(hadd_rgb_s(color0) * (1.0f / 3.0f));
+ float lum1 = astc::clamp255f(hadd_rgb_s(color1) * (1.0f / 3.0f));
+
+ if (lum0 > lum1)
+ {
+ float avg = (lum0 + lum1) * 0.5f;
+ lum0 = avg;
+ lum1 = avg;
+ }
+
+ output[0] = quant_color(quant_level, astc::flt2int_rtn(lum0));
+ output[1] = quant_color(quant_level, astc::flt2int_rtn(lum1));
+}
+
+/**
+ * @brief Quantize a LDR LA color.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as (l0, l1, a0, a1).
+ * @param quant_level The quantization level to use.
+ */
+static void quantize_luminance_alpha(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[4],
+ quant_method quant_level
+) {
+ float scale = 1.0f / 257.0f;
+
+ color0 = color0 * scale;
+ color1 = color1 * scale;
+
+ float lum0 = astc::clamp255f(hadd_rgb_s(color0) * (1.0f / 3.0f));
+ float lum1 = astc::clamp255f(hadd_rgb_s(color1) * (1.0f / 3.0f));
+
+ float a0 = astc::clamp255f(color0.lane<3>());
+ float a1 = astc::clamp255f(color1.lane<3>());
+
+ // If endpoints are close then pull apart slightly; this gives > 8 bit normal map precision.
+ if (quant_level > 18)
+ {
+ if (fabsf(lum0 - lum1) < 3.0f)
+ {
+ if (lum0 < lum1)
+ {
+ lum0 -= 0.5f;
+ lum1 += 0.5f;
+ }
+ else
+ {
+ lum0 += 0.5f;
+ lum1 -= 0.5f;
+ }
+
+ lum0 = astc::clamp255f(lum0);
+ lum1 = astc::clamp255f(lum1);
+ }
+
+ if (fabsf(a0 - a1) < 3.0f)
+ {
+ if (a0 < a1)
+ {
+ a0 -= 0.5f;
+ a1 += 0.5f;
+ }
+ else
+ {
+ a0 += 0.5f;
+ a1 -= 0.5f;
+ }
+
+ a0 = astc::clamp255f(a0);
+ a1 = astc::clamp255f(a1);
+ }
+ }
+
+ output[0] = quant_color(quant_level, astc::flt2int_rtn(lum0));
+ output[1] = quant_color(quant_level, astc::flt2int_rtn(lum1));
+ output[2] = quant_color(quant_level, astc::flt2int_rtn(a0));
+ output[3] = quant_color(quant_level, astc::flt2int_rtn(a1));
+}
+
+/**
+ * @brief Quantize and unquantize a value ensuring top two bits are the same.
+ *
+ * @param quant_level The quantization level to use.
+ * @param value The input unquantized value.
+ * @param[out] quant_value The quantized value.
+ */
+static inline void quantize_and_unquantize_retain_top_two_bits(
+ quant_method quant_level,
+ uint8_t value,
+ uint8_t& quant_value
+) {
+ int perform_loop;
+ uint8_t quantval;
+
+ do
+ {
+ quantval = quant_color(quant_level, value);
+
+ // Perform looping if the top two bits were modified by quant/unquant
+ perform_loop = (value & 0xC0) != (quantval & 0xC0);
+
+ if ((quantval & 0xC0) > (value & 0xC0))
+ {
+ // Quant/unquant rounded UP so that the top two bits changed;
+ // decrement the input in hopes that this will avoid rounding up.
+ value--;
+ }
+ else if ((quantval & 0xC0) < (value & 0xC0))
+ {
+ // Quant/unquant rounded DOWN so that the top two bits changed;
+ // decrement the input in hopes that this will avoid rounding down.
+ value--;
+ }
+ } while (perform_loop);
+
+ quant_value = quantval;
+}
+
+/**
+ * @brief Quantize and unquantize a value ensuring top four bits are the same.
+ *
+ * @param quant_level The quantization level to use.
+ * @param value The input unquantized value.
+ * @param[out] quant_value The quantized value in 0-255 range.
+ */
+static inline void quantize_and_unquantize_retain_top_four_bits(
+ quant_method quant_level,
+ uint8_t value,
+ uint8_t& quant_value
+) {
+ uint8_t perform_loop;
+ uint8_t quantval;
+
+ do
+ {
+ quantval = quant_color(quant_level, value);
+ // Perform looping if the top four bits were modified by quant/unquant
+ perform_loop = (value & 0xF0) != (quantval & 0xF0);
+
+ if ((quantval & 0xF0) > (value & 0xF0))
+ {
+ // Quant/unquant rounded UP so that the top four bits changed;
+ // decrement the input value in hopes that this will avoid rounding up.
+ value--;
+ }
+ else if ((quantval & 0xF0) < (value & 0xF0))
+ {
+ // Quant/unquant rounded DOWN so that the top four bits changed;
+ // decrement the input value in hopes that this will avoid rounding down.
+ value--;
+ }
+ } while (perform_loop);
+
+ quant_value = quantval;
+}
+
+/**
+ * @brief Quantize a HDR RGB color using RGB + offset.
+ *
+ * @param color The input unquantized color endpoint and offset.
+ * @param[out] output The output endpoints, returned as packed RGBS with some mode bits.
+ * @param quant_level The quantization level to use.
+ */
+static void quantize_hdr_rgbo(
+ vfloat4 color,
+ uint8_t output[4],
+ quant_method quant_level
+) {
+ color.set_lane<0>(color.lane<0>() + color.lane<3>());
+ color.set_lane<1>(color.lane<1>() + color.lane<3>());
+ color.set_lane<2>(color.lane<2>() + color.lane<3>());
+
+ color = clamp(0.0f, 65535.0f, color);
+
+ vfloat4 color_bak = color;
+
+ int majcomp;
+ if (color.lane<0>() > color.lane<1>() && color.lane<0>() > color.lane<2>())
+ {
+ majcomp = 0; // red is largest component
+ }
+ else if (color.lane<1>() > color.lane<2>())
+ {
+ majcomp = 1; // green is largest component
+ }
+ else
+ {
+ majcomp = 2; // blue is largest component
+ }
+
+ // swap around the red component and the largest component.
+ switch (majcomp)
+ {
+ case 1:
+ color = color.swz<1, 0, 2, 3>();
+ break;
+ case 2:
+ color = color.swz<2, 1, 0, 3>();
+ break;
+ default:
+ break;
+ }
+
+ static const int mode_bits[5][3] {
+ {11, 5, 7},
+ {11, 6, 5},
+ {10, 5, 8},
+ {9, 6, 7},
+ {8, 7, 6}
+ };
+
+ static const float mode_cutoffs[5][2] {
+ {1024, 4096},
+ {2048, 1024},
+ {2048, 16384},
+ {8192, 16384},
+ {32768, 16384}
+ };
+
+ static const float mode_rscales[5] {
+ 32.0f,
+ 32.0f,
+ 64.0f,
+ 128.0f,
+ 256.0f,
+ };
+
+ static const float mode_scales[5] {
+ 1.0f / 32.0f,
+ 1.0f / 32.0f,
+ 1.0f / 64.0f,
+ 1.0f / 128.0f,
+ 1.0f / 256.0f,
+ };
+
+ float r_base = color.lane<0>();
+ float g_base = color.lane<0>() - color.lane<1>() ;
+ float b_base = color.lane<0>() - color.lane<2>() ;
+ float s_base = color.lane<3>() ;
+
+ for (int mode = 0; mode < 5; mode++)
+ {
+ if (g_base > mode_cutoffs[mode][0] || b_base > mode_cutoffs[mode][0] || s_base > mode_cutoffs[mode][1])
+ {
+ continue;
+ }
+
+ // Encode the mode into a 4-bit vector
+ int mode_enc = mode < 4 ? (mode | (majcomp << 2)) : (majcomp | 0xC);
+
+ float mode_scale = mode_scales[mode];
+ float mode_rscale = mode_rscales[mode];
+
+ int gb_intcutoff = 1 << mode_bits[mode][1];
+ int s_intcutoff = 1 << mode_bits[mode][2];
+
+ // Quantize and unquantize R
+ int r_intval = astc::flt2int_rtn(r_base * mode_scale);
+
+ int r_lowbits = r_intval & 0x3f;
+
+ r_lowbits |= (mode_enc & 3) << 6;
+
+ uint8_t r_quantval;
+ quantize_and_unquantize_retain_top_two_bits(
+ quant_level, static_cast<uint8_t>(r_lowbits), r_quantval);
+
+ r_intval = (r_intval & ~0x3f) | (r_quantval & 0x3f);
+ float r_fval = static_cast<float>(r_intval) * mode_rscale;
+
+ // Recompute G and B, then quantize and unquantize them
+ float g_fval = r_fval - color.lane<1>() ;
+ float b_fval = r_fval - color.lane<2>() ;
+
+ g_fval = astc::clamp(g_fval, 0.0f, 65535.0f);
+ b_fval = astc::clamp(b_fval, 0.0f, 65535.0f);
+
+ int g_intval = astc::flt2int_rtn(g_fval * mode_scale);
+ int b_intval = astc::flt2int_rtn(b_fval * mode_scale);
+
+ if (g_intval >= gb_intcutoff || b_intval >= gb_intcutoff)
+ {
+ continue;
+ }
+
+ int g_lowbits = g_intval & 0x1f;
+ int b_lowbits = b_intval & 0x1f;
+
+ int bit0 = 0;
+ int bit1 = 0;
+ int bit2 = 0;
+ int bit3 = 0;
+
+ switch (mode)
+ {
+ case 0:
+ case 2:
+ bit0 = (r_intval >> 9) & 1;
+ break;
+ case 1:
+ case 3:
+ bit0 = (r_intval >> 8) & 1;
+ break;
+ case 4:
+ case 5:
+ bit0 = (g_intval >> 6) & 1;
+ break;
+ }
+
+ switch (mode)
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ bit2 = (r_intval >> 7) & 1;
+ break;
+ case 4:
+ case 5:
+ bit2 = (b_intval >> 6) & 1;
+ break;
+ }
+
+ switch (mode)
+ {
+ case 0:
+ case 2:
+ bit1 = (r_intval >> 8) & 1;
+ break;
+ case 1:
+ case 3:
+ case 4:
+ case 5:
+ bit1 = (g_intval >> 5) & 1;
+ break;
+ }
+
+ switch (mode)
+ {
+ case 0:
+ bit3 = (r_intval >> 10) & 1;
+ break;
+ case 2:
+ bit3 = (r_intval >> 6) & 1;
+ break;
+ case 1:
+ case 3:
+ case 4:
+ case 5:
+ bit3 = (b_intval >> 5) & 1;
+ break;
+ }
+
+ g_lowbits |= (mode_enc & 0x4) << 5;
+ b_lowbits |= (mode_enc & 0x8) << 4;
+
+ g_lowbits |= bit0 << 6;
+ g_lowbits |= bit1 << 5;
+ b_lowbits |= bit2 << 6;
+ b_lowbits |= bit3 << 5;
+
+ uint8_t g_quantval;
+ uint8_t b_quantval;
+
+ quantize_and_unquantize_retain_top_four_bits(
+ quant_level, static_cast<uint8_t>(g_lowbits), g_quantval);
+ quantize_and_unquantize_retain_top_four_bits(
+ quant_level, static_cast<uint8_t>(b_lowbits), b_quantval);
+
+ g_intval = (g_intval & ~0x1f) | (g_quantval & 0x1f);
+ b_intval = (b_intval & ~0x1f) | (b_quantval & 0x1f);
+
+ g_fval = static_cast<float>(g_intval) * mode_rscale;
+ b_fval = static_cast<float>(b_intval) * mode_rscale;
+
+ // Recompute the scale value, based on the errors introduced to red, green and blue
+
+ // If the error is positive, then the R,G,B errors combined have raised the color
+ // value overall; as such, the scale value needs to be increased.
+ float rgb_errorsum = (r_fval - color.lane<0>() ) + (r_fval - g_fval - color.lane<1>() ) + (r_fval - b_fval - color.lane<2>() );
+
+ float s_fval = s_base + rgb_errorsum * (1.0f / 3.0f);
+ s_fval = astc::clamp(s_fval, 0.0f, 1e9f);
+
+ int s_intval = astc::flt2int_rtn(s_fval * mode_scale);
+
+ if (s_intval >= s_intcutoff)
+ {
+ continue;
+ }
+
+ int s_lowbits = s_intval & 0x1f;
+
+ int bit4;
+ int bit5;
+ int bit6;
+ switch (mode)
+ {
+ case 1:
+ bit6 = (r_intval >> 9) & 1;
+ break;
+ default:
+ bit6 = (s_intval >> 5) & 1;
+ break;
+ }
+
+ switch (mode)
+ {
+ case 4:
+ bit5 = (r_intval >> 7) & 1;
+ break;
+ case 1:
+ bit5 = (r_intval >> 10) & 1;
+ break;
+ default:
+ bit5 = (s_intval >> 6) & 1;
+ break;
+ }
+
+ switch (mode)
+ {
+ case 2:
+ bit4 = (s_intval >> 7) & 1;
+ break;
+ default:
+ bit4 = (r_intval >> 6) & 1;
+ break;
+ }
+
+ s_lowbits |= bit6 << 5;
+ s_lowbits |= bit5 << 6;
+ s_lowbits |= bit4 << 7;
+
+ uint8_t s_quantval;
+
+ quantize_and_unquantize_retain_top_four_bits(
+ quant_level, static_cast<uint8_t>(s_lowbits), s_quantval);
+
+ output[0] = r_quantval;
+ output[1] = g_quantval;
+ output[2] = b_quantval;
+ output[3] = s_quantval;
+ return;
+ }
+
+ // Failed to encode any of the modes above? In that case encode using mode #5
+ float vals[4];
+ vals[0] = color_bak.lane<0>();
+ vals[1] = color_bak.lane<1>();
+ vals[2] = color_bak.lane<2>();
+ vals[3] = color_bak.lane<3>();
+
+ int ivals[4];
+ float cvals[3];
+
+ for (int i = 0; i < 3; i++)
+ {
+ vals[i] = astc::clamp(vals[i], 0.0f, 65020.0f);
+ ivals[i] = astc::flt2int_rtn(vals[i] * (1.0f / 512.0f));
+ cvals[i] = static_cast<float>(ivals[i]) * 512.0f;
+ }
+
+ float rgb_errorsum = (cvals[0] - vals[0]) + (cvals[1] - vals[1]) + (cvals[2] - vals[2]);
+ vals[3] += rgb_errorsum * (1.0f / 3.0f);
+
+ vals[3] = astc::clamp(vals[3], 0.0f, 65020.0f);
+ ivals[3] = astc::flt2int_rtn(vals[3] * (1.0f / 512.0f));
+
+ int encvals[4];
+ encvals[0] = (ivals[0] & 0x3f) | 0xC0;
+ encvals[1] = (ivals[1] & 0x7f) | 0x80;
+ encvals[2] = (ivals[2] & 0x7f) | 0x80;
+ encvals[3] = (ivals[3] & 0x7f) | ((ivals[0] & 0x40) << 1);
+
+ for (uint8_t i = 0; i < 4; i++)
+ {
+ quantize_and_unquantize_retain_top_four_bits(
+ quant_level, static_cast<uint8_t>(encvals[i]), output[i]);
+ }
+
+ return;
+}
+
+/**
+ * @brief Quantize a HDR RGB color using direct RGB encoding.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as packed RGB+RGB pairs with mode bits.
+ * @param quant_level The quantization level to use.
+ */
+static void quantize_hdr_rgb(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[6],
+ quant_method quant_level
+) {
+ // Note: color*.lane<3> is not used so we can ignore it
+ color0 = clamp(0.0f, 65535.0f, color0);
+ color1 = clamp(0.0f, 65535.0f, color1);
+
+ vfloat4 color0_bak = color0;
+ vfloat4 color1_bak = color1;
+
+ int majcomp;
+ if (color1.lane<0>() > color1.lane<1>() && color1.lane<0>() > color1.lane<2>())
+ {
+ majcomp = 0;
+ }
+ else if (color1.lane<1>() > color1.lane<2>())
+ {
+ majcomp = 1;
+ }
+ else
+ {
+ majcomp = 2;
+ }
+
+ // Swizzle the components
+ switch (majcomp)
+ {
+ case 1: // red-green swap
+ color0 = color0.swz<1, 0, 2, 3>();
+ color1 = color1.swz<1, 0, 2, 3>();
+ break;
+ case 2: // red-blue swap
+ color0 = color0.swz<2, 1, 0, 3>();
+ color1 = color1.swz<2, 1, 0, 3>();
+ break;
+ default:
+ break;
+ }
+
+ float a_base = color1.lane<0>();
+ a_base = astc::clamp(a_base, 0.0f, 65535.0f);
+
+ float b0_base = a_base - color1.lane<1>();
+ float b1_base = a_base - color1.lane<2>();
+ float c_base = a_base - color0.lane<0>();
+ float d0_base = a_base - b0_base - c_base - color0.lane<1>();
+ float d1_base = a_base - b1_base - c_base - color0.lane<2>();
+
+ // Number of bits in the various fields in the various modes
+ static const int mode_bits[8][4] {
+ {9, 7, 6, 7},
+ {9, 8, 6, 6},
+ {10, 6, 7, 7},
+ {10, 7, 7, 6},
+ {11, 8, 6, 5},
+ {11, 6, 8, 6},
+ {12, 7, 7, 5},
+ {12, 6, 7, 6}
+ };
+
+ // Cutoffs to use for the computed values of a,b,c,d, assuming the
+ // range 0..65535 are LNS values corresponding to fp16.
+ static const float mode_cutoffs[8][4] {
+ {16384, 8192, 8192, 8}, // mode 0: 9,7,6,7
+ {32768, 8192, 4096, 8}, // mode 1: 9,8,6,6
+ {4096, 8192, 4096, 4}, // mode 2: 10,6,7,7
+ {8192, 8192, 2048, 4}, // mode 3: 10,7,7,6
+ {8192, 2048, 512, 2}, // mode 4: 11,8,6,5
+ {2048, 8192, 1024, 2}, // mode 5: 11,6,8,6
+ {2048, 2048, 256, 1}, // mode 6: 12,7,7,5
+ {1024, 2048, 512, 1}, // mode 7: 12,6,7,6
+ };
+
+ static const float mode_scales[8] {
+ 1.0f / 128.0f,
+ 1.0f / 128.0f,
+ 1.0f / 64.0f,
+ 1.0f / 64.0f,
+ 1.0f / 32.0f,
+ 1.0f / 32.0f,
+ 1.0f / 16.0f,
+ 1.0f / 16.0f,
+ };
+
+ // Scaling factors when going from what was encoded in the mode to 16 bits.
+ static const float mode_rscales[8] {
+ 128.0f,
+ 128.0f,
+ 64.0f,
+ 64.0f,
+ 32.0f,
+ 32.0f,
+ 16.0f,
+ 16.0f
+ };
+
+ // Try modes one by one, with the highest-precision mode first.
+ for (int mode = 7; mode >= 0; mode--)
+ {
+ // For each mode, test if we can in fact accommodate the computed b, c, and d values.
+ // If we clearly can't, then we skip to the next mode.
+
+ float b_cutoff = mode_cutoffs[mode][0];
+ float c_cutoff = mode_cutoffs[mode][1];
+ float d_cutoff = mode_cutoffs[mode][2];
+
+ if (b0_base > b_cutoff || b1_base > b_cutoff || c_base > c_cutoff || fabsf(d0_base) > d_cutoff || fabsf(d1_base) > d_cutoff)
+ {
+ continue;
+ }
+
+ float mode_scale = mode_scales[mode];
+ float mode_rscale = mode_rscales[mode];
+
+ int b_intcutoff = 1 << mode_bits[mode][1];
+ int c_intcutoff = 1 << mode_bits[mode][2];
+ int d_intcutoff = 1 << (mode_bits[mode][3] - 1);
+
+ // Quantize and unquantize A, with the assumption that its high bits can be handled safely.
+ int a_intval = astc::flt2int_rtn(a_base * mode_scale);
+ int a_lowbits = a_intval & 0xFF;
+
+ int a_quantval = quant_color(quant_level, a_lowbits);
+ int a_uquantval = a_quantval;
+ a_intval = (a_intval & ~0xFF) | a_uquantval;
+ float a_fval = static_cast<float>(a_intval) * mode_rscale;
+
+ // Recompute C, then quantize and unquantize it
+ float c_fval = a_fval - color0.lane<0>();
+ c_fval = astc::clamp(c_fval, 0.0f, 65535.0f);
+
+ int c_intval = astc::flt2int_rtn(c_fval * mode_scale);
+
+ if (c_intval >= c_intcutoff)
+ {
+ continue;
+ }
+
+ int c_lowbits = c_intval & 0x3f;
+
+ c_lowbits |= (mode & 1) << 7;
+ c_lowbits |= (a_intval & 0x100) >> 2;
+
+ uint8_t c_quantval;
+
+ quantize_and_unquantize_retain_top_two_bits(
+ quant_level, static_cast<uint8_t>(c_lowbits), c_quantval);
+
+ c_intval = (c_intval & ~0x3F) | (c_quantval & 0x3F);
+ c_fval = static_cast<float>(c_intval) * mode_rscale;
+
+ // Recompute B0 and B1, then quantize and unquantize them
+ float b0_fval = a_fval - color1.lane<1>();
+ float b1_fval = a_fval - color1.lane<2>();
+
+ b0_fval = astc::clamp(b0_fval, 0.0f, 65535.0f);
+ b1_fval = astc::clamp(b1_fval, 0.0f, 65535.0f);
+ int b0_intval = astc::flt2int_rtn(b0_fval * mode_scale);
+ int b1_intval = astc::flt2int_rtn(b1_fval * mode_scale);
+
+ if (b0_intval >= b_intcutoff || b1_intval >= b_intcutoff)
+ {
+ continue;
+ }
+
+ int b0_lowbits = b0_intval & 0x3f;
+ int b1_lowbits = b1_intval & 0x3f;
+
+ int bit0 = 0;
+ int bit1 = 0;
+ switch (mode)
+ {
+ case 0:
+ case 1:
+ case 3:
+ case 4:
+ case 6:
+ bit0 = (b0_intval >> 6) & 1;
+ break;
+ case 2:
+ case 5:
+ case 7:
+ bit0 = (a_intval >> 9) & 1;
+ break;
+ }
+
+ switch (mode)
+ {
+ case 0:
+ case 1:
+ case 3:
+ case 4:
+ case 6:
+ bit1 = (b1_intval >> 6) & 1;
+ break;
+ case 2:
+ bit1 = (c_intval >> 6) & 1;
+ break;
+ case 5:
+ case 7:
+ bit1 = (a_intval >> 10) & 1;
+ break;
+ }
+
+ b0_lowbits |= bit0 << 6;
+ b1_lowbits |= bit1 << 6;
+
+ b0_lowbits |= ((mode >> 1) & 1) << 7;
+ b1_lowbits |= ((mode >> 2) & 1) << 7;
+
+ uint8_t b0_quantval;
+ uint8_t b1_quantval;
+
+ quantize_and_unquantize_retain_top_two_bits(
+ quant_level, static_cast<uint8_t>(b0_lowbits), b0_quantval);
+ quantize_and_unquantize_retain_top_two_bits(
+ quant_level, static_cast<uint8_t>(b1_lowbits), b1_quantval);
+
+ b0_intval = (b0_intval & ~0x3f) | (b0_quantval & 0x3f);
+ b1_intval = (b1_intval & ~0x3f) | (b1_quantval & 0x3f);
+ b0_fval = static_cast<float>(b0_intval) * mode_rscale;
+ b1_fval = static_cast<float>(b1_intval) * mode_rscale;
+
+ // Recompute D0 and D1, then quantize and unquantize them
+ float d0_fval = a_fval - b0_fval - c_fval - color0.lane<1>();
+ float d1_fval = a_fval - b1_fval - c_fval - color0.lane<2>();
+
+ d0_fval = astc::clamp(d0_fval, -65535.0f, 65535.0f);
+ d1_fval = astc::clamp(d1_fval, -65535.0f, 65535.0f);
+
+ int d0_intval = astc::flt2int_rtn(d0_fval * mode_scale);
+ int d1_intval = astc::flt2int_rtn(d1_fval * mode_scale);
+
+ if (abs(d0_intval) >= d_intcutoff || abs(d1_intval) >= d_intcutoff)
+ {
+ continue;
+ }
+
+ int d0_lowbits = d0_intval & 0x1f;
+ int d1_lowbits = d1_intval & 0x1f;
+
+ int bit2 = 0;
+ int bit3 = 0;
+ int bit4;
+ int bit5;
+ switch (mode)
+ {
+ case 0:
+ case 2:
+ bit2 = (d0_intval >> 6) & 1;
+ break;
+ case 1:
+ case 4:
+ bit2 = (b0_intval >> 7) & 1;
+ break;
+ case 3:
+ bit2 = (a_intval >> 9) & 1;
+ break;
+ case 5:
+ bit2 = (c_intval >> 7) & 1;
+ break;
+ case 6:
+ case 7:
+ bit2 = (a_intval >> 11) & 1;
+ break;
+ }
+ switch (mode)
+ {
+ case 0:
+ case 2:
+ bit3 = (d1_intval >> 6) & 1;
+ break;
+ case 1:
+ case 4:
+ bit3 = (b1_intval >> 7) & 1;
+ break;
+ case 3:
+ case 5:
+ case 6:
+ case 7:
+ bit3 = (c_intval >> 6) & 1;
+ break;
+ }
+
+ switch (mode)
+ {
+ case 4:
+ case 6:
+ bit4 = (a_intval >> 9) & 1;
+ bit5 = (a_intval >> 10) & 1;
+ break;
+ default:
+ bit4 = (d0_intval >> 5) & 1;
+ bit5 = (d1_intval >> 5) & 1;
+ break;
+ }
+
+ d0_lowbits |= bit2 << 6;
+ d1_lowbits |= bit3 << 6;
+ d0_lowbits |= bit4 << 5;
+ d1_lowbits |= bit5 << 5;
+
+ d0_lowbits |= (majcomp & 1) << 7;
+ d1_lowbits |= ((majcomp >> 1) & 1) << 7;
+
+ uint8_t d0_quantval;
+ uint8_t d1_quantval;
+
+ quantize_and_unquantize_retain_top_four_bits(
+ quant_level, static_cast<uint8_t>(d0_lowbits), d0_quantval);
+ quantize_and_unquantize_retain_top_four_bits(
+ quant_level, static_cast<uint8_t>(d1_lowbits), d1_quantval);
+
+ output[0] = static_cast<uint8_t>(a_quantval);
+ output[1] = c_quantval;
+ output[2] = b0_quantval;
+ output[3] = b1_quantval;
+ output[4] = d0_quantval;
+ output[5] = d1_quantval;
+ return;
+ }
+
+ // If neither of the modes fit we will use a flat representation for storing data, using 8 bits
+ // for red and green, and 7 bits for blue. This gives color accuracy roughly similar to LDR
+ // 4:4:3 which is not at all great but usable. This representation is used if the light color is
+ // more than 4x the color value of the dark color.
+ float vals[6];
+ vals[0] = color0_bak.lane<0>();
+ vals[1] = color1_bak.lane<0>();
+ vals[2] = color0_bak.lane<1>();
+ vals[3] = color1_bak.lane<1>();
+ vals[4] = color0_bak.lane<2>();
+ vals[5] = color1_bak.lane<2>();
+
+ for (int i = 0; i < 6; i++)
+ {
+ vals[i] = astc::clamp(vals[i], 0.0f, 65020.0f);
+ }
+
+ for (int i = 0; i < 4; i++)
+ {
+ int idx = astc::flt2int_rtn(vals[i] * 1.0f / 256.0f);
+ output[i] = quant_color(quant_level, idx);
+ }
+
+ for (int i = 4; i < 6; i++)
+ {
+ int idx = astc::flt2int_rtn(vals[i] * 1.0f / 512.0f) + 128;
+ quantize_and_unquantize_retain_top_two_bits(
+ quant_level, static_cast<uint8_t>(idx), output[i]);
+ }
+
+ return;
+}
+
+/**
+ * @brief Quantize a HDR RGB + LDR A color using direct RGBA encoding.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as packed RGBA+RGBA pairs with mode bits.
+ * @param quant_level The quantization level to use.
+ */
+static void quantize_hdr_rgb_ldr_alpha(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[8],
+ quant_method quant_level
+) {
+ float scale = 1.0f / 257.0f;
+
+ float a0 = astc::clamp255f(color0.lane<3>() * scale);
+ float a1 = astc::clamp255f(color1.lane<3>() * scale);
+
+ output[6] = quant_color(quant_level, astc::flt2int_rtn(a0));
+ output[7] = quant_color(quant_level, astc::flt2int_rtn(a1));
+
+ quantize_hdr_rgb(color0, color1, output, quant_level);
+}
+
+/**
+ * @brief Quantize a HDR L color using the large range encoding.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as packed (l0, l1).
+ * @param quant_level The quantization level to use.
+ */
+static void quantize_hdr_luminance_large_range(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[2],
+ quant_method quant_level
+) {
+ float lum0 = hadd_rgb_s(color0) * (1.0f / 3.0f);
+ float lum1 = hadd_rgb_s(color1) * (1.0f / 3.0f);
+
+ if (lum1 < lum0)
+ {
+ float avg = (lum0 + lum1) * 0.5f;
+ lum0 = avg;
+ lum1 = avg;
+ }
+
+ int ilum1 = astc::flt2int_rtn(lum1);
+ int ilum0 = astc::flt2int_rtn(lum0);
+
+ // Find the closest encodable point in the upper half of the code-point space
+ int upper_v0 = (ilum0 + 128) >> 8;
+ int upper_v1 = (ilum1 + 128) >> 8;
+
+ upper_v0 = astc::clamp(upper_v0, 0, 255);
+ upper_v1 = astc::clamp(upper_v1, 0, 255);
+
+ // Find the closest encodable point in the lower half of the code-point space
+ int lower_v0 = (ilum1 + 256) >> 8;
+ int lower_v1 = ilum0 >> 8;
+
+ lower_v0 = astc::clamp(lower_v0, 0, 255);
+ lower_v1 = astc::clamp(lower_v1, 0, 255);
+
+ // Determine the distance between the point in code-point space and the input value
+ int upper0_dec = upper_v0 << 8;
+ int upper1_dec = upper_v1 << 8;
+ int lower0_dec = (lower_v1 << 8) + 128;
+ int lower1_dec = (lower_v0 << 8) - 128;
+
+ int upper0_diff = upper0_dec - ilum0;
+ int upper1_diff = upper1_dec - ilum1;
+ int lower0_diff = lower0_dec - ilum0;
+ int lower1_diff = lower1_dec - ilum1;
+
+ int upper_error = (upper0_diff * upper0_diff) + (upper1_diff * upper1_diff);
+ int lower_error = (lower0_diff * lower0_diff) + (lower1_diff * lower1_diff);
+
+ int v0, v1;
+ if (upper_error < lower_error)
+ {
+ v0 = upper_v0;
+ v1 = upper_v1;
+ }
+ else
+ {
+ v0 = lower_v0;
+ v1 = lower_v1;
+ }
+
+ // OK; encode
+ output[0] = quant_color(quant_level, v0);
+ output[1] = quant_color(quant_level, v1);
+}
+
+/**
+ * @brief Quantize a HDR L color using the small range encoding.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as packed (l0, l1) with mode bits.
+ * @param quant_level The quantization level to use.
+ *
+ * @return Returns @c false on failure, @c true on success.
+ */
+static bool try_quantize_hdr_luminance_small_range(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[2],
+ quant_method quant_level
+) {
+ float lum0 = hadd_rgb_s(color0) * (1.0f / 3.0f);
+ float lum1 = hadd_rgb_s(color1) * (1.0f / 3.0f);
+
+ if (lum1 < lum0)
+ {
+ float avg = (lum0 + lum1) * 0.5f;
+ lum0 = avg;
+ lum1 = avg;
+ }
+
+ int ilum1 = astc::flt2int_rtn(lum1);
+ int ilum0 = astc::flt2int_rtn(lum0);
+
+ // Difference of more than a factor-of-2 results in immediate failure
+ if (ilum1 - ilum0 > 2048)
+ {
+ return false;
+ }
+
+ int lowval, highval, diffval;
+ int v0, v1;
+ int v0e, v1e;
+ int v0d, v1d;
+
+ // Try to encode the high-precision submode
+ lowval = (ilum0 + 16) >> 5;
+ highval = (ilum1 + 16) >> 5;
+
+ lowval = astc::clamp(lowval, 0, 2047);
+ highval = astc::clamp(highval, 0, 2047);
+
+ v0 = lowval & 0x7F;
+ v0e = quant_color(quant_level, v0);
+ v0d = v0e;
+
+ if (v0d < 0x80)
+ {
+ lowval = (lowval & ~0x7F) | v0d;
+ diffval = highval - lowval;
+ if (diffval >= 0 && diffval <= 15)
+ {
+ v1 = ((lowval >> 3) & 0xF0) | diffval;
+ v1e = quant_color(quant_level, v1);
+ v1d = v1e;
+ if ((v1d & 0xF0) == (v1 & 0xF0))
+ {
+ output[0] = static_cast<uint8_t>(v0e);
+ output[1] = static_cast<uint8_t>(v1e);
+ return true;
+ }
+ }
+ }
+
+ // Try to encode the low-precision submode
+ lowval = (ilum0 + 32) >> 6;
+ highval = (ilum1 + 32) >> 6;
+
+ lowval = astc::clamp(lowval, 0, 1023);
+ highval = astc::clamp(highval, 0, 1023);
+
+ v0 = (lowval & 0x7F) | 0x80;
+ v0e = quant_color(quant_level, v0);
+ v0d = v0e;
+ if ((v0d & 0x80) == 0)
+ {
+ return false;
+ }
+
+ lowval = (lowval & ~0x7F) | (v0d & 0x7F);
+ diffval = highval - lowval;
+ if (diffval < 0 || diffval > 31)
+ {
+ return false;
+ }
+
+ v1 = ((lowval >> 2) & 0xE0) | diffval;
+ v1e = quant_color(quant_level, v1);
+ v1d = v1e;
+ if ((v1d & 0xE0) != (v1 & 0xE0))
+ {
+ return false;
+ }
+
+ output[0] = static_cast<uint8_t>(v0e);
+ output[1] = static_cast<uint8_t>(v1e);
+ return true;
+}
+
+/**
+ * @brief Quantize a HDR A color using either delta or direct RGBA encoding.
+ *
+ * @param alpha0 The input unquantized color0 endpoint.
+ * @param alpha1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as packed RGBA+RGBA pairs with mode bits.
+ * @param quant_level The quantization level to use.
+ */
+static void quantize_hdr_alpha(
+ float alpha0,
+ float alpha1,
+ uint8_t output[2],
+ quant_method quant_level
+) {
+ alpha0 = astc::clamp(alpha0, 0.0f, 65280.0f);
+ alpha1 = astc::clamp(alpha1, 0.0f, 65280.0f);
+
+ int ialpha0 = astc::flt2int_rtn(alpha0);
+ int ialpha1 = astc::flt2int_rtn(alpha1);
+
+ int val0, val1, diffval;
+ int v6, v7;
+ int v6e, v7e;
+ int v6d, v7d;
+
+ // Try to encode one of the delta submodes, in decreasing-precision order
+ for (int i = 2; i >= 0; i--)
+ {
+ val0 = (ialpha0 + (128 >> i)) >> (8 - i);
+ val1 = (ialpha1 + (128 >> i)) >> (8 - i);
+
+ v6 = (val0 & 0x7F) | ((i & 1) << 7);
+ v6e = quant_color(quant_level, v6);
+ v6d = v6e;
+
+ if ((v6 ^ v6d) & 0x80)
+ {
+ continue;
+ }
+
+ val0 = (val0 & ~0x7f) | (v6d & 0x7f);
+ diffval = val1 - val0;
+ int cutoff = 32 >> i;
+ int mask = 2 * cutoff - 1;
+
+ if (diffval < -cutoff || diffval >= cutoff)
+ {
+ continue;
+ }
+
+ v7 = ((i & 2) << 6) | ((val0 >> 7) << (6 - i)) | (diffval & mask);
+ v7e = quant_color(quant_level, v7);
+ v7d = v7e;
+
+ static const int testbits[3] { 0xE0, 0xF0, 0xF8 };
+
+ if ((v7 ^ v7d) & testbits[i])
+ {
+ continue;
+ }
+
+ output[0] = static_cast<uint8_t>(v6e);
+ output[1] = static_cast<uint8_t>(v7e);
+ return;
+ }
+
+ // Could not encode any of the delta modes; instead encode a flat value
+ val0 = (ialpha0 + 256) >> 9;
+ val1 = (ialpha1 + 256) >> 9;
+ v6 = val0 | 0x80;
+ v7 = val1 | 0x80;
+
+ output[0] = quant_color(quant_level, v6);
+ output[1] = quant_color(quant_level, v7);
+
+ return;
+}
+
+/**
+ * @brief Quantize a HDR RGBA color using either delta or direct RGBA encoding.
+ *
+ * @param color0 The input unquantized color0 endpoint.
+ * @param color1 The input unquantized color1 endpoint.
+ * @param[out] output The output endpoints, returned as packed RGBA+RGBA pairs with mode bits.
+ * @param quant_level The quantization level to use.
+ */
+static void quantize_hdr_rgb_alpha(
+ vfloat4 color0,
+ vfloat4 color1,
+ uint8_t output[8],
+ quant_method quant_level
+) {
+ quantize_hdr_rgb(color0, color1, output, quant_level);
+ quantize_hdr_alpha(color0.lane<3>(), color1.lane<3>(), output + 6, quant_level);
+}
+
+/* See header for documentation. */
+uint8_t pack_color_endpoints(
+ vfloat4 color0,
+ vfloat4 color1,
+ vfloat4 rgbs_color,
+ vfloat4 rgbo_color,
+ int format,
+ uint8_t* output,
+ quant_method quant_level
+) {
+ assert(QUANT_6 <= quant_level && quant_level <= QUANT_256);
+
+ // We do not support negative colors
+ color0 = max(color0, 0.0f);
+ color1 = max(color1, 0.0f);
+
+ uint8_t retval = 0;
+
+ switch (format)
+ {
+ case FMT_RGB:
+ if (quant_level <= QUANT_160)
+ {
+ if (try_quantize_rgb_delta_blue_contract(color0, color1, output, quant_level))
+ {
+ retval = FMT_RGB_DELTA;
+ break;
+ }
+ if (try_quantize_rgb_delta(color0, color1, output, quant_level))
+ {
+ retval = FMT_RGB_DELTA;
+ break;
+ }
+ }
+ if (quant_level < QUANT_256 && try_quantize_rgb_blue_contract(color0, color1, output, quant_level))
+ {
+ retval = FMT_RGB;
+ break;
+ }
+ quantize_rgb(color0, color1, output, quant_level);
+ retval = FMT_RGB;
+ break;
+
+ case FMT_RGBA:
+ if (quant_level <= QUANT_160)
+ {
+ if (try_quantize_rgba_delta_blue_contract(color0, color1, output, quant_level))
+ {
+ retval = FMT_RGBA_DELTA;
+ break;
+ }
+ if (try_quantize_rgba_delta(color0, color1, output, quant_level))
+ {
+ retval = FMT_RGBA_DELTA;
+ break;
+ }
+ }
+ if (quant_level < QUANT_256 && try_quantize_rgba_blue_contract(color0, color1, output, quant_level))
+ {
+ retval = FMT_RGBA;
+ break;
+ }
+ quantize_rgba(color0, color1, output, quant_level);
+ retval = FMT_RGBA;
+ break;
+
+ case FMT_RGB_SCALE:
+ quantize_rgbs(rgbs_color, output, quant_level);
+ retval = FMT_RGB_SCALE;
+ break;
+
+ case FMT_HDR_RGB_SCALE:
+ quantize_hdr_rgbo(rgbo_color, output, quant_level);
+ retval = FMT_HDR_RGB_SCALE;
+ break;
+
+ case FMT_HDR_RGB:
+ quantize_hdr_rgb(color0, color1, output, quant_level);
+ retval = FMT_HDR_RGB;
+ break;
+
+ case FMT_RGB_SCALE_ALPHA:
+ quantize_rgbs_alpha(color0, color1, rgbs_color, output, quant_level);
+ retval = FMT_RGB_SCALE_ALPHA;
+ break;
+
+ case FMT_HDR_LUMINANCE_SMALL_RANGE:
+ case FMT_HDR_LUMINANCE_LARGE_RANGE:
+ if (try_quantize_hdr_luminance_small_range(color0, color1, output, quant_level))
+ {
+ retval = FMT_HDR_LUMINANCE_SMALL_RANGE;
+ break;
+ }
+ quantize_hdr_luminance_large_range(color0, color1, output, quant_level);
+ retval = FMT_HDR_LUMINANCE_LARGE_RANGE;
+ break;
+
+ case FMT_LUMINANCE:
+ quantize_luminance(color0, color1, output, quant_level);
+ retval = FMT_LUMINANCE;
+ break;
+
+ case FMT_LUMINANCE_ALPHA:
+ if (quant_level <= 18)
+ {
+ if (try_quantize_luminance_alpha_delta(color0, color1, output, quant_level))
+ {
+ retval = FMT_LUMINANCE_ALPHA_DELTA;
+ break;
+ }
+ }
+ quantize_luminance_alpha(color0, color1, output, quant_level);
+ retval = FMT_LUMINANCE_ALPHA;
+ break;
+
+ case FMT_HDR_RGB_LDR_ALPHA:
+ quantize_hdr_rgb_ldr_alpha(color0, color1, output, quant_level);
+ retval = FMT_HDR_RGB_LDR_ALPHA;
+ break;
+
+ case FMT_HDR_RGBA:
+ quantize_hdr_rgb_alpha(color0, color1, output, quant_level);
+ retval = FMT_HDR_RGBA;
+ break;
+ }
+
+ return retval;
+}
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_color_unquantize.cpp b/thirdparty/astcenc/astcenc_color_unquantize.cpp
new file mode 100644
index 0000000000..d31895a627
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_color_unquantize.cpp
@@ -0,0 +1,941 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2021 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+#include <utility>
+
+/**
+ * @brief Functions for color unquantization.
+ */
+
+#include "astcenc_internal.h"
+
+/**
+ * @brief Un-blue-contract a color.
+ *
+ * This function reverses any applied blue contraction.
+ *
+ * @param input The input color that has been blue-contracted.
+ *
+ * @return The uncontracted color.
+ */
+static ASTCENC_SIMD_INLINE vint4 uncontract_color(
+ vint4 input
+) {
+ vmask4 mask(true, true, false, false);
+ vint4 bc0 = asr<1>(input + input.lane<2>());
+ return select(input, bc0, mask);
+}
+
+/**
+ * @brief Unpack an LDR RGBA color that uses delta encoding.
+ *
+ * @param input0 The packed endpoint 0 color.
+ * @param input1 The packed endpoint 1 color deltas.
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void rgba_delta_unpack(
+ vint4 input0,
+ vint4 input1,
+ vint4& output0,
+ vint4& output1
+) {
+ // Apply bit transfer
+ bit_transfer_signed(input1, input0);
+
+ // Apply blue-uncontraction if needed
+ int rgb_sum = hadd_rgb_s(input1);
+ input1 = input1 + input0;
+ if (rgb_sum < 0)
+ {
+ input0 = uncontract_color(input0);
+ input1 = uncontract_color(input1);
+ std::swap(input0, input1);
+ }
+
+ output0 = clamp(0, 255, input0);
+ output1 = clamp(0, 255, input1);
+}
+
+/**
+ * @brief Unpack an LDR RGB color that uses delta encoding.
+ *
+ * Output alpha set to 255.
+ *
+ * @param input0 The packed endpoint 0 color.
+ * @param input1 The packed endpoint 1 color deltas.
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void rgb_delta_unpack(
+ vint4 input0,
+ vint4 input1,
+ vint4& output0,
+ vint4& output1
+) {
+ rgba_delta_unpack(input0, input1, output0, output1);
+ output0.set_lane<3>(255);
+ output1.set_lane<3>(255);
+}
+
+/**
+ * @brief Unpack an LDR RGBA color that uses direct encoding.
+ *
+ * @param input0 The packed endpoint 0 color.
+ * @param input1 The packed endpoint 1 color.
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void rgba_unpack(
+ vint4 input0,
+ vint4 input1,
+ vint4& output0,
+ vint4& output1
+) {
+ // Apply blue-uncontraction if needed
+ if (hadd_rgb_s(input0) > hadd_rgb_s(input1))
+ {
+ input0 = uncontract_color(input0);
+ input1 = uncontract_color(input1);
+ std::swap(input0, input1);
+ }
+
+ output0 = input0;
+ output1 = input1;
+}
+
+/**
+ * @brief Unpack an LDR RGB color that uses direct encoding.
+ *
+ * Output alpha set to 255.
+ *
+ * @param input0 The packed endpoint 0 color.
+ * @param input1 The packed endpoint 1 color.
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void rgb_unpack(
+ vint4 input0,
+ vint4 input1,
+ vint4& output0,
+ vint4& output1
+) {
+ rgba_unpack(input0, input1, output0, output1);
+ output0.set_lane<3>(255);
+ output1.set_lane<3>(255);
+}
+
+/**
+ * @brief Unpack an LDR RGBA color that uses scaled encoding.
+ *
+ * Note only the RGB channels use the scaled encoding, alpha uses direct.
+ *
+ * @param input0 The packed endpoint 0 color.
+ * @param alpha1 The packed endpoint 1 alpha value.
+ * @param scale The packed quantized scale.
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void rgb_scale_alpha_unpack(
+ vint4 input0,
+ uint8_t alpha1,
+ uint8_t scale,
+ vint4& output0,
+ vint4& output1
+) {
+ output1 = input0;
+ output1.set_lane<3>(alpha1);
+
+ output0 = asr<8>(input0 * scale);
+ output0.set_lane<3>(input0.lane<3>());
+}
+
+/**
+ * @brief Unpack an LDR RGB color that uses scaled encoding.
+ *
+ * Output alpha is 255.
+ *
+ * @param input0 The packed endpoint 0 color.
+ * @param scale The packed scale.
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void rgb_scale_unpack(
+ vint4 input0,
+ int scale,
+ vint4& output0,
+ vint4& output1
+) {
+ output1 = input0;
+ output1.set_lane<3>(255);
+
+ output0 = asr<8>(input0 * scale);
+ output0.set_lane<3>(255);
+}
+
+/**
+ * @brief Unpack an LDR L color that uses direct encoding.
+ *
+ * Output alpha is 255.
+ *
+ * @param input The packed endpoints.
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void luminance_unpack(
+ const uint8_t input[2],
+ vint4& output0,
+ vint4& output1
+) {
+ int lum0 = input[0];
+ int lum1 = input[1];
+ output0 = vint4(lum0, lum0, lum0, 255);
+ output1 = vint4(lum1, lum1, lum1, 255);
+}
+
+/**
+ * @brief Unpack an LDR L color that uses delta encoding.
+ *
+ * Output alpha is 255.
+ *
+ * @param input The packed endpoints (L0, L1).
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void luminance_delta_unpack(
+ const uint8_t input[2],
+ vint4& output0,
+ vint4& output1
+) {
+ int v0 = input[0];
+ int v1 = input[1];
+ int l0 = (v0 >> 2) | (v1 & 0xC0);
+ int l1 = l0 + (v1 & 0x3F);
+
+ l1 = astc::min(l1, 255);
+
+ output0 = vint4(l0, l0, l0, 255);
+ output1 = vint4(l1, l1, l1, 255);
+}
+
+/**
+ * @brief Unpack an LDR LA color that uses direct encoding.
+ *
+ * @param input The packed endpoints (L0, L1, A0, A1).
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void luminance_alpha_unpack(
+ const uint8_t input[4],
+ vint4& output0,
+ vint4& output1
+) {
+ int lum0 = input[0];
+ int lum1 = input[1];
+ int alpha0 = input[2];
+ int alpha1 = input[3];
+ output0 = vint4(lum0, lum0, lum0, alpha0);
+ output1 = vint4(lum1, lum1, lum1, alpha1);
+}
+
+/**
+ * @brief Unpack an LDR LA color that uses delta encoding.
+ *
+ * @param input The packed endpoints (L0, L1, A0, A1).
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void luminance_alpha_delta_unpack(
+ const uint8_t input[4],
+ vint4& output0,
+ vint4& output1
+) {
+ int lum0 = input[0];
+ int lum1 = input[1];
+ int alpha0 = input[2];
+ int alpha1 = input[3];
+
+ lum0 |= (lum1 & 0x80) << 1;
+ alpha0 |= (alpha1 & 0x80) << 1;
+ lum1 &= 0x7F;
+ alpha1 &= 0x7F;
+
+ if (lum1 & 0x40)
+ {
+ lum1 -= 0x80;
+ }
+
+ if (alpha1 & 0x40)
+ {
+ alpha1 -= 0x80;
+ }
+
+ lum0 >>= 1;
+ lum1 >>= 1;
+ alpha0 >>= 1;
+ alpha1 >>= 1;
+ lum1 += lum0;
+ alpha1 += alpha0;
+
+ lum1 = astc::clamp(lum1, 0, 255);
+ alpha1 = astc::clamp(alpha1, 0, 255);
+
+ output0 = vint4(lum0, lum0, lum0, alpha0);
+ output1 = vint4(lum1, lum1, lum1, alpha1);
+}
+
+/**
+ * @brief Unpack an HDR RGB + offset encoding.
+ *
+ * @param input The packed endpoints (packed and modal).
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void hdr_rgbo_unpack(
+ const uint8_t input[4],
+ vint4& output0,
+ vint4& output1
+) {
+ int v0 = input[0];
+ int v1 = input[1];
+ int v2 = input[2];
+ int v3 = input[3];
+
+ int modeval = ((v0 & 0xC0) >> 6) | (((v1 & 0x80) >> 7) << 2) | (((v2 & 0x80) >> 7) << 3);
+
+ int majcomp;
+ int mode;
+ if ((modeval & 0xC) != 0xC)
+ {
+ majcomp = modeval >> 2;
+ mode = modeval & 3;
+ }
+ else if (modeval != 0xF)
+ {
+ majcomp = modeval & 3;
+ mode = 4;
+ }
+ else
+ {
+ majcomp = 0;
+ mode = 5;
+ }
+
+ int red = v0 & 0x3F;
+ int green = v1 & 0x1F;
+ int blue = v2 & 0x1F;
+ int scale = v3 & 0x1F;
+
+ int bit0 = (v1 >> 6) & 1;
+ int bit1 = (v1 >> 5) & 1;
+ int bit2 = (v2 >> 6) & 1;
+ int bit3 = (v2 >> 5) & 1;
+ int bit4 = (v3 >> 7) & 1;
+ int bit5 = (v3 >> 6) & 1;
+ int bit6 = (v3 >> 5) & 1;
+
+ int ohcomp = 1 << mode;
+
+ if (ohcomp & 0x30)
+ green |= bit0 << 6;
+ if (ohcomp & 0x3A)
+ green |= bit1 << 5;
+ if (ohcomp & 0x30)
+ blue |= bit2 << 6;
+ if (ohcomp & 0x3A)
+ blue |= bit3 << 5;
+
+ if (ohcomp & 0x3D)
+ scale |= bit6 << 5;
+ if (ohcomp & 0x2D)
+ scale |= bit5 << 6;
+ if (ohcomp & 0x04)
+ scale |= bit4 << 7;
+
+ if (ohcomp & 0x3B)
+ red |= bit4 << 6;
+ if (ohcomp & 0x04)
+ red |= bit3 << 6;
+
+ if (ohcomp & 0x10)
+ red |= bit5 << 7;
+ if (ohcomp & 0x0F)
+ red |= bit2 << 7;
+
+ if (ohcomp & 0x05)
+ red |= bit1 << 8;
+ if (ohcomp & 0x0A)
+ red |= bit0 << 8;
+
+ if (ohcomp & 0x05)
+ red |= bit0 << 9;
+ if (ohcomp & 0x02)
+ red |= bit6 << 9;
+
+ if (ohcomp & 0x01)
+ red |= bit3 << 10;
+ if (ohcomp & 0x02)
+ red |= bit5 << 10;
+
+ // expand to 12 bits.
+ static const int shamts[6] { 1, 1, 2, 3, 4, 5 };
+ int shamt = shamts[mode];
+ red <<= shamt;
+ green <<= shamt;
+ blue <<= shamt;
+ scale <<= shamt;
+
+ // on modes 0 to 4, the values stored for "green" and "blue" are differentials,
+ // not absolute values.
+ if (mode != 5)
+ {
+ green = red - green;
+ blue = red - blue;
+ }
+
+ // switch around components.
+ int temp;
+ switch (majcomp)
+ {
+ case 1:
+ temp = red;
+ red = green;
+ green = temp;
+ break;
+ case 2:
+ temp = red;
+ red = blue;
+ blue = temp;
+ break;
+ default:
+ break;
+ }
+
+ int red0 = red - scale;
+ int green0 = green - scale;
+ int blue0 = blue - scale;
+
+ // clamp to [0,0xFFF].
+ if (red < 0)
+ red = 0;
+ if (green < 0)
+ green = 0;
+ if (blue < 0)
+ blue = 0;
+
+ if (red0 < 0)
+ red0 = 0;
+ if (green0 < 0)
+ green0 = 0;
+ if (blue0 < 0)
+ blue0 = 0;
+
+ output0 = vint4(red0 << 4, green0 << 4, blue0 << 4, 0x7800);
+ output1 = vint4(red << 4, green << 4, blue << 4, 0x7800);
+}
+
+/**
+ * @brief Unpack an HDR RGB direct encoding.
+ *
+ * @param input The packed endpoints (packed and modal).
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void hdr_rgb_unpack(
+ const uint8_t input[6],
+ vint4& output0,
+ vint4& output1
+) {
+
+ int v0 = input[0];
+ int v1 = input[1];
+ int v2 = input[2];
+ int v3 = input[3];
+ int v4 = input[4];
+ int v5 = input[5];
+
+ // extract all the fixed-placement bitfields
+ int modeval = ((v1 & 0x80) >> 7) | (((v2 & 0x80) >> 7) << 1) | (((v3 & 0x80) >> 7) << 2);
+
+ int majcomp = ((v4 & 0x80) >> 7) | (((v5 & 0x80) >> 7) << 1);
+
+ if (majcomp == 3)
+ {
+ output0 = vint4(v0 << 8, v2 << 8, (v4 & 0x7F) << 9, 0x7800);
+ output1 = vint4(v1 << 8, v3 << 8, (v5 & 0x7F) << 9, 0x7800);
+ return;
+ }
+
+ int a = v0 | ((v1 & 0x40) << 2);
+ int b0 = v2 & 0x3f;
+ int b1 = v3 & 0x3f;
+ int c = v1 & 0x3f;
+ int d0 = v4 & 0x7f;
+ int d1 = v5 & 0x7f;
+
+ // get hold of the number of bits in 'd0' and 'd1'
+ static const int dbits_tab[8] { 7, 6, 7, 6, 5, 6, 5, 6 };
+ int dbits = dbits_tab[modeval];
+
+ // extract six variable-placement bits
+ int bit0 = (v2 >> 6) & 1;
+ int bit1 = (v3 >> 6) & 1;
+ int bit2 = (v4 >> 6) & 1;
+ int bit3 = (v5 >> 6) & 1;
+ int bit4 = (v4 >> 5) & 1;
+ int bit5 = (v5 >> 5) & 1;
+
+ // and prepend the variable-placement bits depending on mode.
+ int ohmod = 1 << modeval; // one-hot-mode
+ if (ohmod & 0xA4)
+ a |= bit0 << 9;
+ if (ohmod & 0x8)
+ a |= bit2 << 9;
+ if (ohmod & 0x50)
+ a |= bit4 << 9;
+
+ if (ohmod & 0x50)
+ a |= bit5 << 10;
+ if (ohmod & 0xA0)
+ a |= bit1 << 10;
+
+ if (ohmod & 0xC0)
+ a |= bit2 << 11;
+
+ if (ohmod & 0x4)
+ c |= bit1 << 6;
+ if (ohmod & 0xE8)
+ c |= bit3 << 6;
+
+ if (ohmod & 0x20)
+ c |= bit2 << 7;
+
+ if (ohmod & 0x5B)
+ {
+ b0 |= bit0 << 6;
+ b1 |= bit1 << 6;
+ }
+
+ if (ohmod & 0x12)
+ {
+ b0 |= bit2 << 7;
+ b1 |= bit3 << 7;
+ }
+
+ if (ohmod & 0xAF)
+ {
+ d0 |= bit4 << 5;
+ d1 |= bit5 << 5;
+ }
+
+ if (ohmod & 0x5)
+ {
+ d0 |= bit2 << 6;
+ d1 |= bit3 << 6;
+ }
+
+ // sign-extend 'd0' and 'd1'
+ // note: this code assumes that signed right-shift actually sign-fills, not zero-fills.
+ int32_t d0x = d0;
+ int32_t d1x = d1;
+ int sx_shamt = 32 - dbits;
+ d0x <<= sx_shamt;
+ d0x >>= sx_shamt;
+ d1x <<= sx_shamt;
+ d1x >>= sx_shamt;
+ d0 = d0x;
+ d1 = d1x;
+
+ // expand all values to 12 bits, with left-shift as needed.
+ int val_shamt = (modeval >> 1) ^ 3;
+ a <<= val_shamt;
+ b0 <<= val_shamt;
+ b1 <<= val_shamt;
+ c <<= val_shamt;
+ d0 <<= val_shamt;
+ d1 <<= val_shamt;
+
+ // then compute the actual color values.
+ int red1 = a;
+ int green1 = a - b0;
+ int blue1 = a - b1;
+ int red0 = a - c;
+ int green0 = a - b0 - c - d0;
+ int blue0 = a - b1 - c - d1;
+
+ // clamp the color components to [0,2^12 - 1]
+ red0 = astc::clamp(red0, 0, 4095);
+ green0 = astc::clamp(green0, 0, 4095);
+ blue0 = astc::clamp(blue0, 0, 4095);
+
+ red1 = astc::clamp(red1, 0, 4095);
+ green1 = astc::clamp(green1, 0, 4095);
+ blue1 = astc::clamp(blue1, 0, 4095);
+
+ // switch around the color components
+ int temp0, temp1;
+ switch (majcomp)
+ {
+ case 1: // switch around red and green
+ temp0 = red0;
+ temp1 = red1;
+ red0 = green0;
+ red1 = green1;
+ green0 = temp0;
+ green1 = temp1;
+ break;
+ case 2: // switch around red and blue
+ temp0 = red0;
+ temp1 = red1;
+ red0 = blue0;
+ red1 = blue1;
+ blue0 = temp0;
+ blue1 = temp1;
+ break;
+ case 0: // no switch
+ break;
+ }
+
+ output0 = vint4(red0 << 4, green0 << 4, blue0 << 4, 0x7800);
+ output1 = vint4(red1 << 4, green1 << 4, blue1 << 4, 0x7800);
+}
+
+/**
+ * @brief Unpack an HDR RGB + LDR A direct encoding.
+ *
+ * @param input The packed endpoints (packed and modal).
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void hdr_rgb_ldr_alpha_unpack(
+ const uint8_t input[8],
+ vint4& output0,
+ vint4& output1
+) {
+ hdr_rgb_unpack(input, output0, output1);
+
+ int v6 = input[6];
+ int v7 = input[7];
+ output0.set_lane<3>(v6);
+ output1.set_lane<3>(v7);
+}
+
+/**
+ * @brief Unpack an HDR L (small range) direct encoding.
+ *
+ * @param input The packed endpoints (packed and modal).
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void hdr_luminance_small_range_unpack(
+ const uint8_t input[2],
+ vint4& output0,
+ vint4& output1
+) {
+ int v0 = input[0];
+ int v1 = input[1];
+
+ int y0, y1;
+ if (v0 & 0x80)
+ {
+ y0 = ((v1 & 0xE0) << 4) | ((v0 & 0x7F) << 2);
+ y1 = (v1 & 0x1F) << 2;
+ }
+ else
+ {
+ y0 = ((v1 & 0xF0) << 4) | ((v0 & 0x7F) << 1);
+ y1 = (v1 & 0xF) << 1;
+ }
+
+ y1 += y0;
+ if (y1 > 0xFFF)
+ {
+ y1 = 0xFFF;
+ }
+
+ output0 = vint4(y0 << 4, y0 << 4, y0 << 4, 0x7800);
+ output1 = vint4(y1 << 4, y1 << 4, y1 << 4, 0x7800);
+}
+
+/**
+ * @brief Unpack an HDR L (large range) direct encoding.
+ *
+ * @param input The packed endpoints (packed and modal).
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void hdr_luminance_large_range_unpack(
+ const uint8_t input[2],
+ vint4& output0,
+ vint4& output1
+) {
+ int v0 = input[0];
+ int v1 = input[1];
+
+ int y0, y1;
+ if (v1 >= v0)
+ {
+ y0 = v0 << 4;
+ y1 = v1 << 4;
+ }
+ else
+ {
+ y0 = (v1 << 4) + 8;
+ y1 = (v0 << 4) - 8;
+ }
+
+ output0 = vint4(y0 << 4, y0 << 4, y0 << 4, 0x7800);
+ output1 = vint4(y1 << 4, y1 << 4, y1 << 4, 0x7800);
+}
+
+/**
+ * @brief Unpack an HDR A direct encoding.
+ *
+ * @param input The packed endpoints (packed and modal).
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void hdr_alpha_unpack(
+ const uint8_t input[2],
+ int& output0,
+ int& output1
+) {
+
+ int v6 = input[0];
+ int v7 = input[1];
+
+ int selector = ((v6 >> 7) & 1) | ((v7 >> 6) & 2);
+ v6 &= 0x7F;
+ v7 &= 0x7F;
+ if (selector == 3)
+ {
+ output0 = v6 << 5;
+ output1 = v7 << 5;
+ }
+ else
+ {
+ v6 |= (v7 << (selector + 1)) & 0x780;
+ v7 &= (0x3f >> selector);
+ v7 ^= 32 >> selector;
+ v7 -= 32 >> selector;
+ v6 <<= (4 - selector);
+ v7 <<= (4 - selector);
+ v7 += v6;
+
+ if (v7 < 0)
+ {
+ v7 = 0;
+ }
+ else if (v7 > 0xFFF)
+ {
+ v7 = 0xFFF;
+ }
+
+ output0 = v6;
+ output1 = v7;
+ }
+
+ output0 <<= 4;
+ output1 <<= 4;
+}
+
+/**
+ * @brief Unpack an HDR RGBA direct encoding.
+ *
+ * @param input The packed endpoints (packed and modal).
+ * @param[out] output0 The unpacked endpoint 0 color.
+ * @param[out] output1 The unpacked endpoint 1 color.
+ */
+static void hdr_rgb_hdr_alpha_unpack(
+ const uint8_t input[8],
+ vint4& output0,
+ vint4& output1
+) {
+ hdr_rgb_unpack(input, output0, output1);
+
+ int alpha0, alpha1;
+ hdr_alpha_unpack(input + 6, alpha0, alpha1);
+
+ output0.set_lane<3>(alpha0);
+ output1.set_lane<3>(alpha1);
+}
+
+/* See header for documentation. */
+void unpack_color_endpoints(
+ astcenc_profile decode_mode,
+ int format,
+ const uint8_t* input,
+ bool& rgb_hdr,
+ bool& alpha_hdr,
+ vint4& output0,
+ vint4& output1
+) {
+ // Assume no NaNs and LDR endpoints unless set later
+ rgb_hdr = false;
+ alpha_hdr = false;
+
+ bool alpha_hdr_default = false;
+
+ switch (format)
+ {
+ case FMT_LUMINANCE:
+ luminance_unpack(input, output0, output1);
+ break;
+
+ case FMT_LUMINANCE_DELTA:
+ luminance_delta_unpack(input, output0, output1);
+ break;
+
+ case FMT_HDR_LUMINANCE_SMALL_RANGE:
+ rgb_hdr = true;
+ alpha_hdr_default = true;
+ hdr_luminance_small_range_unpack(input, output0, output1);
+ break;
+
+ case FMT_HDR_LUMINANCE_LARGE_RANGE:
+ rgb_hdr = true;
+ alpha_hdr_default = true;
+ hdr_luminance_large_range_unpack(input, output0, output1);
+ break;
+
+ case FMT_LUMINANCE_ALPHA:
+ luminance_alpha_unpack(input, output0, output1);
+ break;
+
+ case FMT_LUMINANCE_ALPHA_DELTA:
+ luminance_alpha_delta_unpack(input, output0, output1);
+ break;
+
+ case FMT_RGB_SCALE:
+ {
+ vint4 input0q(input[0], input[1], input[2], 0);
+ uint8_t scale = input[3];
+ rgb_scale_unpack(input0q, scale, output0, output1);
+ }
+ break;
+
+ case FMT_RGB_SCALE_ALPHA:
+ {
+ vint4 input0q(input[0], input[1], input[2], input[4]);
+ uint8_t alpha1q = input[5];
+ uint8_t scaleq = input[3];
+ rgb_scale_alpha_unpack(input0q, alpha1q, scaleq, output0, output1);
+ }
+ break;
+
+ case FMT_HDR_RGB_SCALE:
+ rgb_hdr = true;
+ alpha_hdr_default = true;
+ hdr_rgbo_unpack(input, output0, output1);
+ break;
+
+ case FMT_RGB:
+ {
+ vint4 input0q(input[0], input[2], input[4], 0);
+ vint4 input1q(input[1], input[3], input[5], 0);
+ rgb_unpack(input0q, input1q, output0, output1);
+ }
+ break;
+
+ case FMT_RGB_DELTA:
+ {
+ vint4 input0q(input[0], input[2], input[4], 0);
+ vint4 input1q(input[1], input[3], input[5], 0);
+ rgb_delta_unpack(input0q, input1q, output0, output1);
+ }
+ break;
+
+ case FMT_HDR_RGB:
+ rgb_hdr = true;
+ alpha_hdr_default = true;
+ hdr_rgb_unpack(input, output0, output1);
+ break;
+
+ case FMT_RGBA:
+ {
+ vint4 input0q(input[0], input[2], input[4], input[6]);
+ vint4 input1q(input[1], input[3], input[5], input[7]);
+ rgba_unpack(input0q, input1q, output0, output1);
+ }
+ break;
+
+ case FMT_RGBA_DELTA:
+ {
+ vint4 input0q(input[0], input[2], input[4], input[6]);
+ vint4 input1q(input[1], input[3], input[5], input[7]);
+ rgba_delta_unpack(input0q, input1q, output0, output1);
+ }
+ break;
+
+ case FMT_HDR_RGB_LDR_ALPHA:
+ rgb_hdr = true;
+ hdr_rgb_ldr_alpha_unpack(input, output0, output1);
+ break;
+
+ case FMT_HDR_RGBA:
+ rgb_hdr = true;
+ alpha_hdr = true;
+ hdr_rgb_hdr_alpha_unpack(input, output0, output1);
+ break;
+ }
+
+ // Assign a correct default alpha
+ if (alpha_hdr_default)
+ {
+ if (decode_mode == ASTCENC_PRF_HDR)
+ {
+ output0.set_lane<3>(0x7800);
+ output1.set_lane<3>(0x7800);
+ alpha_hdr = true;
+ }
+ else
+ {
+ output0.set_lane<3>(0x00FF);
+ output1.set_lane<3>(0x00FF);
+ alpha_hdr = false;
+ }
+ }
+
+ vint4 ldr_scale(257);
+ vint4 hdr_scale(1);
+ vint4 output_scale = ldr_scale;
+
+ // An LDR profile image
+ if ((decode_mode == ASTCENC_PRF_LDR) ||
+ (decode_mode == ASTCENC_PRF_LDR_SRGB))
+ {
+ // Also matches HDR alpha, as cannot have HDR alpha without HDR RGB
+ if (rgb_hdr == true)
+ {
+ output0 = vint4(0xFF00, 0x0000, 0xFF00, 0xFF00);
+ output1 = vint4(0xFF00, 0x0000, 0xFF00, 0xFF00);
+ output_scale = hdr_scale;
+
+ rgb_hdr = false;
+ alpha_hdr = false;
+ }
+ }
+ // An HDR profile image
+ else
+ {
+ vmask4 hdr_lanes(rgb_hdr, rgb_hdr, rgb_hdr, alpha_hdr);
+ output_scale = select(ldr_scale, hdr_scale, hdr_lanes);
+ }
+
+ output0 = output0 * output_scale;
+ output1 = output1 * output_scale;
+}
diff --git a/thirdparty/astcenc/astcenc_compress_symbolic.cpp b/thirdparty/astcenc/astcenc_compress_symbolic.cpp
new file mode 100644
index 0000000000..afb76246e7
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_compress_symbolic.cpp
@@ -0,0 +1,1455 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2023 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+
+/**
+ * @brief Functions to compress a symbolic block.
+ */
+
+#include "astcenc_internal.h"
+#include "astcenc_diagnostic_trace.h"
+
+#include <cassert>
+
+/**
+ * @brief Merge two planes of endpoints into a single vector.
+ *
+ * @param ep_plane1 The endpoints for plane 1.
+ * @param ep_plane2 The endpoints for plane 2.
+ * @param component_plane2 The color component for plane 2.
+ * @param[out] result The merged output.
+ */
+static void merge_endpoints(
+ const endpoints& ep_plane1,
+ const endpoints& ep_plane2,
+ unsigned int component_plane2,
+ endpoints& result
+) {
+ unsigned int partition_count = ep_plane1.partition_count;
+ assert(partition_count == 1);
+
+ vmask4 sep_mask = vint4::lane_id() == vint4(component_plane2);
+
+ result.partition_count = partition_count;
+ result.endpt0[0] = select(ep_plane1.endpt0[0], ep_plane2.endpt0[0], sep_mask);
+ result.endpt1[0] = select(ep_plane1.endpt1[0], ep_plane2.endpt1[0], sep_mask);
+}
+
+/**
+ * @brief Attempt to improve weights given a chosen configuration.
+ *
+ * Given a fixed weight grid decimation and weight value quantization, iterate over all weights (per
+ * partition and per plane) and attempt to improve image quality by moving each weight up by one or
+ * down by one quantization step.
+ *
+ * This is a specialized function which only supports operating on undecimated weight grids,
+ * therefore primarily improving the performance of 4x4 and 5x5 blocks where grid decimation
+ * is needed less often.
+ *
+ * @param decode_mode The decode mode (LDR, HDR).
+ * @param bsd The block size information.
+ * @param blk The image block color data to compress.
+ * @param[out] scb The symbolic compressed block output.
+ */
+static bool realign_weights_undecimated(
+ astcenc_profile decode_mode,
+ const block_size_descriptor& bsd,
+ const image_block& blk,
+ symbolic_compressed_block& scb
+) {
+ // Get the partition descriptor
+ unsigned int partition_count = scb.partition_count;
+ const auto& pi = bsd.get_partition_info(partition_count, scb.partition_index);
+
+ // Get the quantization table
+ const block_mode& bm = bsd.get_block_mode(scb.block_mode);
+ unsigned int weight_quant_level = bm.quant_mode;
+ const quant_and_transfer_table& qat = quant_and_xfer_tables[weight_quant_level];
+
+ unsigned int max_plane = bm.is_dual_plane;
+ int plane2_component = scb.plane2_component;
+ vmask4 plane_mask = vint4::lane_id() == vint4(plane2_component);
+
+ // Decode the color endpoints
+ bool rgb_hdr;
+ bool alpha_hdr;
+ vint4 endpnt0[BLOCK_MAX_PARTITIONS];
+ vint4 endpnt1[BLOCK_MAX_PARTITIONS];
+ vfloat4 endpnt0f[BLOCK_MAX_PARTITIONS];
+ vfloat4 offset[BLOCK_MAX_PARTITIONS];
+
+ promise(partition_count > 0);
+
+ for (unsigned int pa_idx = 0; pa_idx < partition_count; pa_idx++)
+ {
+ unpack_color_endpoints(decode_mode,
+ scb.color_formats[pa_idx],
+ scb.color_values[pa_idx],
+ rgb_hdr, alpha_hdr,
+ endpnt0[pa_idx],
+ endpnt1[pa_idx]);
+ }
+
+ uint8_t* dec_weights_uquant = scb.weights;
+ bool adjustments = false;
+
+ // For each plane and partition ...
+ for (unsigned int pl_idx = 0; pl_idx <= max_plane; pl_idx++)
+ {
+ for (unsigned int pa_idx = 0; pa_idx < partition_count; pa_idx++)
+ {
+ // Compute the endpoint delta for all components in current plane
+ vint4 epd = endpnt1[pa_idx] - endpnt0[pa_idx];
+ epd = select(epd, vint4::zero(), plane_mask);
+
+ endpnt0f[pa_idx] = int_to_float(endpnt0[pa_idx]);
+ offset[pa_idx] = int_to_float(epd) * (1.0f / 64.0f);
+ }
+
+ // For each weight compute previous, current, and next errors
+ promise(bsd.texel_count > 0);
+ for (unsigned int texel = 0; texel < bsd.texel_count; texel++)
+ {
+ int uqw = dec_weights_uquant[texel];
+
+ uint32_t prev_and_next = qat.prev_next_values[uqw];
+ int uqw_down = prev_and_next & 0xFF;
+ int uqw_up = (prev_and_next >> 8) & 0xFF;
+
+ // Interpolate the colors to create the diffs
+ float weight_base = static_cast<float>(uqw);
+ float weight_down = static_cast<float>(uqw_down - uqw);
+ float weight_up = static_cast<float>(uqw_up - uqw);
+
+ unsigned int partition = pi.partition_of_texel[texel];
+ vfloat4 color_offset = offset[partition];
+ vfloat4 color_base = endpnt0f[partition];
+
+ vfloat4 color = color_base + color_offset * weight_base;
+ vfloat4 orig_color = blk.texel(texel);
+ vfloat4 error_weight = blk.channel_weight;
+
+ vfloat4 color_diff = color - orig_color;
+ vfloat4 color_diff_down = color_diff + color_offset * weight_down;
+ vfloat4 color_diff_up = color_diff + color_offset * weight_up;
+
+ float error_base = dot_s(color_diff * color_diff, error_weight);
+ float error_down = dot_s(color_diff_down * color_diff_down, error_weight);
+ float error_up = dot_s(color_diff_up * color_diff_up, error_weight);
+
+ // Check if the prev or next error is better, and if so use it
+ if ((error_up < error_base) && (error_up < error_down) && (uqw < 64))
+ {
+ dec_weights_uquant[texel] = static_cast<uint8_t>(uqw_up);
+ adjustments = true;
+ }
+ else if ((error_down < error_base) && (uqw > 0))
+ {
+ dec_weights_uquant[texel] = static_cast<uint8_t>(uqw_down);
+ adjustments = true;
+ }
+ }
+
+ // Prepare iteration for plane 2
+ dec_weights_uquant += WEIGHTS_PLANE2_OFFSET;
+ plane_mask = ~plane_mask;
+ }
+
+ return adjustments;
+}
+
+/**
+ * @brief Attempt to improve weights given a chosen configuration.
+ *
+ * Given a fixed weight grid decimation and weight value quantization, iterate over all weights (per
+ * partition and per plane) and attempt to improve image quality by moving each weight up by one or
+ * down by one quantization step.
+ *
+ * @param decode_mode The decode mode (LDR, HDR).
+ * @param bsd The block size information.
+ * @param blk The image block color data to compress.
+ * @param[out] scb The symbolic compressed block output.
+ */
+static bool realign_weights_decimated(
+ astcenc_profile decode_mode,
+ const block_size_descriptor& bsd,
+ const image_block& blk,
+ symbolic_compressed_block& scb
+) {
+ // Get the partition descriptor
+ unsigned int partition_count = scb.partition_count;
+ const auto& pi = bsd.get_partition_info(partition_count, scb.partition_index);
+
+ // Get the quantization table
+ const block_mode& bm = bsd.get_block_mode(scb.block_mode);
+ unsigned int weight_quant_level = bm.quant_mode;
+ const quant_and_transfer_table& qat = quant_and_xfer_tables[weight_quant_level];
+
+ // Get the decimation table
+ const decimation_info& di = bsd.get_decimation_info(bm.decimation_mode);
+ unsigned int weight_count = di.weight_count;
+ assert(weight_count != bsd.texel_count);
+
+ unsigned int max_plane = bm.is_dual_plane;
+ int plane2_component = scb.plane2_component;
+ vmask4 plane_mask = vint4::lane_id() == vint4(plane2_component);
+
+ // Decode the color endpoints
+ bool rgb_hdr;
+ bool alpha_hdr;
+ vint4 endpnt0[BLOCK_MAX_PARTITIONS];
+ vint4 endpnt1[BLOCK_MAX_PARTITIONS];
+ vfloat4 endpnt0f[BLOCK_MAX_PARTITIONS];
+ vfloat4 offset[BLOCK_MAX_PARTITIONS];
+
+ promise(partition_count > 0);
+ promise(weight_count > 0);
+
+ for (unsigned int pa_idx = 0; pa_idx < partition_count; pa_idx++)
+ {
+ unpack_color_endpoints(decode_mode,
+ scb.color_formats[pa_idx],
+ scb.color_values[pa_idx],
+ rgb_hdr, alpha_hdr,
+ endpnt0[pa_idx],
+ endpnt1[pa_idx]);
+ }
+
+ uint8_t* dec_weights_uquant = scb.weights;
+ bool adjustments = false;
+
+ // For each plane and partition ...
+ for (unsigned int pl_idx = 0; pl_idx <= max_plane; pl_idx++)
+ {
+ for (unsigned int pa_idx = 0; pa_idx < partition_count; pa_idx++)
+ {
+ // Compute the endpoint delta for all components in current plane
+ vint4 epd = endpnt1[pa_idx] - endpnt0[pa_idx];
+ epd = select(epd, vint4::zero(), plane_mask);
+
+ endpnt0f[pa_idx] = int_to_float(endpnt0[pa_idx]);
+ offset[pa_idx] = int_to_float(epd) * (1.0f / 64.0f);
+ }
+
+ // Create an unquantized weight grid for this decimation level
+ alignas(ASTCENC_VECALIGN) float uq_weightsf[BLOCK_MAX_WEIGHTS];
+ for (unsigned int we_idx = 0; we_idx < weight_count; we_idx += ASTCENC_SIMD_WIDTH)
+ {
+ vint unquant_value(dec_weights_uquant + we_idx);
+ vfloat unquant_valuef = int_to_float(unquant_value);
+ storea(unquant_valuef, uq_weightsf + we_idx);
+ }
+
+ // For each weight compute previous, current, and next errors
+ for (unsigned int we_idx = 0; we_idx < weight_count; we_idx++)
+ {
+ int uqw = dec_weights_uquant[we_idx];
+ uint32_t prev_and_next = qat.prev_next_values[uqw];
+
+ float uqw_base = uq_weightsf[we_idx];
+ float uqw_down = static_cast<float>(prev_and_next & 0xFF);
+ float uqw_up = static_cast<float>((prev_and_next >> 8) & 0xFF);
+
+ float uqw_diff_down = uqw_down - uqw_base;
+ float uqw_diff_up = uqw_up - uqw_base;
+
+ vfloat4 error_basev = vfloat4::zero();
+ vfloat4 error_downv = vfloat4::zero();
+ vfloat4 error_upv = vfloat4::zero();
+
+ // Interpolate the colors to create the diffs
+ unsigned int texels_to_evaluate = di.weight_texel_count[we_idx];
+ promise(texels_to_evaluate > 0);
+ for (unsigned int te_idx = 0; te_idx < texels_to_evaluate; te_idx++)
+ {
+ unsigned int texel = di.weight_texels_tr[te_idx][we_idx];
+
+ float tw_base = di.texel_contrib_for_weight[te_idx][we_idx];
+
+ float weight_base = (uq_weightsf[di.texel_weights_tr[0][texel]] * di.texel_weight_contribs_float_tr[0][texel]
+ + uq_weightsf[di.texel_weights_tr[1][texel]] * di.texel_weight_contribs_float_tr[1][texel])
+ + (uq_weightsf[di.texel_weights_tr[2][texel]] * di.texel_weight_contribs_float_tr[2][texel]
+ + uq_weightsf[di.texel_weights_tr[3][texel]] * di.texel_weight_contribs_float_tr[3][texel]);
+
+ // Ideally this is integer rounded, but IQ gain it isn't worth the overhead
+ // float weight = astc::flt_rd(weight_base + 0.5f);
+ // float weight_down = astc::flt_rd(weight_base + 0.5f + uqw_diff_down * tw_base) - weight;
+ // float weight_up = astc::flt_rd(weight_base + 0.5f + uqw_diff_up * tw_base) - weight;
+ float weight_down = weight_base + uqw_diff_down * tw_base - weight_base;
+ float weight_up = weight_base + uqw_diff_up * tw_base - weight_base;
+
+ unsigned int partition = pi.partition_of_texel[texel];
+ vfloat4 color_offset = offset[partition];
+ vfloat4 color_base = endpnt0f[partition];
+
+ vfloat4 color = color_base + color_offset * weight_base;
+ vfloat4 orig_color = blk.texel(texel);
+
+ vfloat4 color_diff = color - orig_color;
+ vfloat4 color_down_diff = color_diff + color_offset * weight_down;
+ vfloat4 color_up_diff = color_diff + color_offset * weight_up;
+
+ error_basev += color_diff * color_diff;
+ error_downv += color_down_diff * color_down_diff;
+ error_upv += color_up_diff * color_up_diff;
+ }
+
+ vfloat4 error_weight = blk.channel_weight;
+ float error_base = hadd_s(error_basev * error_weight);
+ float error_down = hadd_s(error_downv * error_weight);
+ float error_up = hadd_s(error_upv * error_weight);
+
+ // Check if the prev or next error is better, and if so use it
+ if ((error_up < error_base) && (error_up < error_down) && (uqw < 64))
+ {
+ uq_weightsf[we_idx] = uqw_up;
+ dec_weights_uquant[we_idx] = static_cast<uint8_t>(uqw_up);
+ adjustments = true;
+ }
+ else if ((error_down < error_base) && (uqw > 0))
+ {
+ uq_weightsf[we_idx] = uqw_down;
+ dec_weights_uquant[we_idx] = static_cast<uint8_t>(uqw_down);
+ adjustments = true;
+ }
+ }
+
+ // Prepare iteration for plane 2
+ dec_weights_uquant += WEIGHTS_PLANE2_OFFSET;
+ plane_mask = ~plane_mask;
+ }
+
+ return adjustments;
+}
+
+/**
+ * @brief Compress a block using a chosen partitioning and 1 plane of weights.
+ *
+ * @param config The compressor configuration.
+ * @param bsd The block size information.
+ * @param blk The image block color data to compress.
+ * @param only_always True if we only use "always" percentile block modes.
+ * @param tune_errorval_threshold The error value threshold.
+ * @param partition_count The partition count.
+ * @param partition_index The partition index if @c partition_count is 2-4.
+ * @param[out] scb The symbolic compressed block output.
+ * @param[out] tmpbuf The quantized weights for plane 1.
+ */
+static float compress_symbolic_block_for_partition_1plane(
+ const astcenc_config& config,
+ const block_size_descriptor& bsd,
+ const image_block& blk,
+ bool only_always,
+ float tune_errorval_threshold,
+ unsigned int partition_count,
+ unsigned int partition_index,
+ symbolic_compressed_block& scb,
+ compression_working_buffers& tmpbuf,
+ int quant_limit
+) {
+ promise(partition_count > 0);
+ promise(config.tune_candidate_limit > 0);
+ promise(config.tune_refinement_limit > 0);
+
+ int max_weight_quant = astc::min(static_cast<int>(QUANT_32), quant_limit);
+
+ auto compute_difference = &compute_symbolic_block_difference_1plane;
+ if ((partition_count == 1) && !(config.flags & ASTCENC_FLG_MAP_RGBM))
+ {
+ compute_difference = &compute_symbolic_block_difference_1plane_1partition;
+ }
+
+ const auto& pi = bsd.get_partition_info(partition_count, partition_index);
+
+ // Compute ideal weights and endpoint colors, with no quantization or decimation
+ endpoints_and_weights& ei = tmpbuf.ei1;
+ compute_ideal_colors_and_weights_1plane(blk, pi, ei);
+
+ // Compute ideal weights and endpoint colors for every decimation
+ float* dec_weights_ideal = tmpbuf.dec_weights_ideal;
+ uint8_t* dec_weights_uquant = tmpbuf.dec_weights_uquant;
+
+ // For each decimation mode, compute an ideal set of weights with no quantization
+ unsigned int max_decimation_modes = only_always ? bsd.decimation_mode_count_always
+ : bsd.decimation_mode_count_selected;
+ promise(max_decimation_modes > 0);
+ for (unsigned int i = 0; i < max_decimation_modes; i++)
+ {
+ const auto& dm = bsd.get_decimation_mode(i);
+ if (!dm.is_ref_1_plane(static_cast<quant_method>(max_weight_quant)))
+ {
+ continue;
+ }
+
+ const auto& di = bsd.get_decimation_info(i);
+
+ compute_ideal_weights_for_decimation(
+ ei,
+ di,
+ dec_weights_ideal + i * BLOCK_MAX_WEIGHTS);
+ }
+
+ // Compute maximum colors for the endpoints and ideal weights, then for each endpoint and ideal
+ // weight pair, compute the smallest weight that will result in a color value greater than 1
+ vfloat4 min_ep(10.0f);
+ for (unsigned int i = 0; i < partition_count; i++)
+ {
+ vfloat4 ep = (vfloat4(1.0f) - ei.ep.endpt0[i]) / (ei.ep.endpt1[i] - ei.ep.endpt0[i]);
+
+ vmask4 use_ep = (ep > vfloat4(0.5f)) & (ep < min_ep);
+ min_ep = select(min_ep, ep, use_ep);
+ }
+
+ float min_wt_cutoff = hmin_s(min_ep);
+
+ // For each mode, use the angular method to compute a shift
+ compute_angular_endpoints_1plane(
+ only_always, bsd, dec_weights_ideal, max_weight_quant, tmpbuf);
+
+ float* weight_low_value = tmpbuf.weight_low_value1;
+ float* weight_high_value = tmpbuf.weight_high_value1;
+ int8_t* qwt_bitcounts = tmpbuf.qwt_bitcounts;
+ float* qwt_errors = tmpbuf.qwt_errors;
+
+ // For each mode (which specifies a decimation and a quantization):
+ // * Compute number of bits needed for the quantized weights
+ // * Generate an optimized set of quantized weights
+ // * Compute quantization errors for the mode
+
+
+ static const int8_t free_bits_for_partition_count[4] {
+ 115 - 4, 111 - 4 - PARTITION_INDEX_BITS, 108 - 4 - PARTITION_INDEX_BITS, 105 - 4 - PARTITION_INDEX_BITS
+ };
+
+ unsigned int max_block_modes = only_always ? bsd.block_mode_count_1plane_always
+ : bsd.block_mode_count_1plane_selected;
+ promise(max_block_modes > 0);
+ for (unsigned int i = 0; i < max_block_modes; i++)
+ {
+ const block_mode& bm = bsd.block_modes[i];
+
+ if (bm.quant_mode > max_weight_quant)
+ {
+ qwt_errors[i] = 1e38f;
+ continue;
+ }
+
+ assert(!bm.is_dual_plane);
+ int bitcount = free_bits_for_partition_count[partition_count - 1] - bm.weight_bits;
+ if (bitcount <= 0)
+ {
+ qwt_errors[i] = 1e38f;
+ continue;
+ }
+
+ if (weight_high_value[i] > 1.02f * min_wt_cutoff)
+ {
+ weight_high_value[i] = 1.0f;
+ }
+
+ int decimation_mode = bm.decimation_mode;
+ const auto& di = bsd.get_decimation_info(decimation_mode);
+
+ qwt_bitcounts[i] = static_cast<int8_t>(bitcount);
+
+ alignas(ASTCENC_VECALIGN) float dec_weights_uquantf[BLOCK_MAX_WEIGHTS];
+
+ // Generate the optimized set of weights for the weight mode
+ compute_quantized_weights_for_decimation(
+ di,
+ weight_low_value[i], weight_high_value[i],
+ dec_weights_ideal + BLOCK_MAX_WEIGHTS * decimation_mode,
+ dec_weights_uquantf,
+ dec_weights_uquant + BLOCK_MAX_WEIGHTS * i,
+ bm.get_weight_quant_mode());
+
+ // Compute weight quantization errors for the block mode
+ qwt_errors[i] = compute_error_of_weight_set_1plane(
+ ei,
+ di,
+ dec_weights_uquantf);
+ }
+
+ // Decide the optimal combination of color endpoint encodings and weight encodings
+ uint8_t partition_format_specifiers[TUNE_MAX_TRIAL_CANDIDATES][BLOCK_MAX_PARTITIONS];
+ int block_mode_index[TUNE_MAX_TRIAL_CANDIDATES];
+
+ quant_method color_quant_level[TUNE_MAX_TRIAL_CANDIDATES];
+ quant_method color_quant_level_mod[TUNE_MAX_TRIAL_CANDIDATES];
+
+ unsigned int candidate_count = compute_ideal_endpoint_formats(
+ pi, blk, ei.ep, qwt_bitcounts, qwt_errors,
+ config.tune_candidate_limit, 0, max_block_modes,
+ partition_format_specifiers, block_mode_index,
+ color_quant_level, color_quant_level_mod, tmpbuf);
+
+ // Iterate over the N believed-to-be-best modes to find out which one is actually best
+ float best_errorval_in_mode = ERROR_CALC_DEFAULT;
+ float best_errorval_in_scb = scb.errorval;
+
+ for (unsigned int i = 0; i < candidate_count; i++)
+ {
+ TRACE_NODE(node0, "candidate");
+
+ const int bm_packed_index = block_mode_index[i];
+ assert(bm_packed_index >= 0 && bm_packed_index < static_cast<int>(bsd.block_mode_count_1plane_selected));
+ const block_mode& qw_bm = bsd.block_modes[bm_packed_index];
+
+ int decimation_mode = qw_bm.decimation_mode;
+ const auto& di = bsd.get_decimation_info(decimation_mode);
+ promise(di.weight_count > 0);
+
+ trace_add_data("weight_x", di.weight_x);
+ trace_add_data("weight_y", di.weight_y);
+ trace_add_data("weight_z", di.weight_z);
+ trace_add_data("weight_quant", qw_bm.quant_mode);
+
+ // Recompute the ideal color endpoints before storing them
+ vfloat4 rgbs_colors[BLOCK_MAX_PARTITIONS];
+ vfloat4 rgbo_colors[BLOCK_MAX_PARTITIONS];
+
+ symbolic_compressed_block workscb;
+ endpoints workep = ei.ep;
+
+ uint8_t* u8_weight_src = dec_weights_uquant + BLOCK_MAX_WEIGHTS * bm_packed_index;
+
+ for (unsigned int j = 0; j < di.weight_count; j++)
+ {
+ workscb.weights[j] = u8_weight_src[j];
+ }
+
+ for (unsigned int l = 0; l < config.tune_refinement_limit; l++)
+ {
+ recompute_ideal_colors_1plane(
+ blk, pi, di, workscb.weights,
+ workep, rgbs_colors, rgbo_colors);
+
+ // Quantize the chosen color, tracking if worth trying the mod value
+ bool all_same = color_quant_level[i] != color_quant_level_mod[i];
+ for (unsigned int j = 0; j < partition_count; j++)
+ {
+ workscb.color_formats[j] = pack_color_endpoints(
+ workep.endpt0[j],
+ workep.endpt1[j],
+ rgbs_colors[j],
+ rgbo_colors[j],
+ partition_format_specifiers[i][j],
+ workscb.color_values[j],
+ color_quant_level[i]);
+
+ all_same = all_same && workscb.color_formats[j] == workscb.color_formats[0];
+ }
+
+ // If all the color endpoint modes are the same, we get a few more bits to store colors;
+ // let's see if we can take advantage of this: requantize all the colors and see if the
+ // endpoint modes remain the same.
+ workscb.color_formats_matched = 0;
+ if (partition_count >= 2 && all_same)
+ {
+ uint8_t colorvals[BLOCK_MAX_PARTITIONS][12];
+ uint8_t color_formats_mod[BLOCK_MAX_PARTITIONS] { 0 };
+ bool all_same_mod = true;
+ for (unsigned int j = 0; j < partition_count; j++)
+ {
+ color_formats_mod[j] = pack_color_endpoints(
+ workep.endpt0[j],
+ workep.endpt1[j],
+ rgbs_colors[j],
+ rgbo_colors[j],
+ partition_format_specifiers[i][j],
+ colorvals[j],
+ color_quant_level_mod[i]);
+
+ // Early out as soon as it's no longer possible to use mod
+ if (color_formats_mod[j] != color_formats_mod[0])
+ {
+ all_same_mod = false;
+ break;
+ }
+ }
+
+ if (all_same_mod)
+ {
+ workscb.color_formats_matched = 1;
+ for (unsigned int j = 0; j < BLOCK_MAX_PARTITIONS; j++)
+ {
+ for (unsigned int k = 0; k < 8; k++)
+ {
+ workscb.color_values[j][k] = colorvals[j][k];
+ }
+
+ workscb.color_formats[j] = color_formats_mod[j];
+ }
+ }
+ }
+
+ // Store header fields
+ workscb.partition_count = static_cast<uint8_t>(partition_count);
+ workscb.partition_index = static_cast<uint16_t>(partition_index);
+ workscb.plane2_component = -1;
+ workscb.quant_mode = workscb.color_formats_matched ? color_quant_level_mod[i] : color_quant_level[i];
+ workscb.block_mode = qw_bm.mode_index;
+ workscb.block_type = SYM_BTYPE_NONCONST;
+
+ // Pre-realign test
+ if (l == 0)
+ {
+ float errorval = compute_difference(config, bsd, workscb, blk);
+ if (errorval == -ERROR_CALC_DEFAULT)
+ {
+ errorval = -errorval;
+ workscb.block_type = SYM_BTYPE_ERROR;
+ }
+
+ trace_add_data("error_prerealign", errorval);
+ best_errorval_in_mode = astc::min(errorval, best_errorval_in_mode);
+
+ // Average refinement improvement is 3.5% per iteration (allow 4.5%), but the first
+ // iteration can help more so we give it a extra 8% leeway. Use this knowledge to
+ // drive a heuristic to skip blocks that are unlikely to catch up with the best
+ // block we have already.
+ unsigned int iters_remaining = config.tune_refinement_limit - l;
+ float threshold = (0.045f * static_cast<float>(iters_remaining)) + 1.08f;
+ if (errorval > (threshold * best_errorval_in_scb))
+ {
+ break;
+ }
+
+ if (errorval < best_errorval_in_scb)
+ {
+ best_errorval_in_scb = errorval;
+ workscb.errorval = errorval;
+ scb = workscb;
+
+ if (errorval < tune_errorval_threshold)
+ {
+ // Skip remaining candidates - this is "good enough"
+ i = candidate_count;
+ break;
+ }
+ }
+ }
+
+ bool adjustments;
+ if (di.weight_count != bsd.texel_count)
+ {
+ adjustments = realign_weights_decimated(
+ config.profile, bsd, blk, workscb);
+ }
+ else
+ {
+ adjustments = realign_weights_undecimated(
+ config.profile, bsd, blk, workscb);
+ }
+
+ // Post-realign test
+ float errorval = compute_difference(config, bsd, workscb, blk);
+ if (errorval == -ERROR_CALC_DEFAULT)
+ {
+ errorval = -errorval;
+ workscb.block_type = SYM_BTYPE_ERROR;
+ }
+
+ trace_add_data("error_postrealign", errorval);
+ best_errorval_in_mode = astc::min(errorval, best_errorval_in_mode);
+
+ // Average refinement improvement is 3.5% per iteration, so skip blocks that are
+ // unlikely to catch up with the best block we have already. Assume a 4.5% per step to
+ // give benefit of the doubt ...
+ unsigned int iters_remaining = config.tune_refinement_limit - 1 - l;
+ float threshold = (0.045f * static_cast<float>(iters_remaining)) + 1.0f;
+ if (errorval > (threshold * best_errorval_in_scb))
+ {
+ break;
+ }
+
+ if (errorval < best_errorval_in_scb)
+ {
+ best_errorval_in_scb = errorval;
+ workscb.errorval = errorval;
+ scb = workscb;
+
+ if (errorval < tune_errorval_threshold)
+ {
+ // Skip remaining candidates - this is "good enough"
+ i = candidate_count;
+ break;
+ }
+ }
+
+ if (!adjustments)
+ {
+ break;
+ }
+ }
+ }
+
+ return best_errorval_in_mode;
+}
+
+/**
+ * @brief Compress a block using a chosen partitioning and 2 planes of weights.
+ *
+ * @param config The compressor configuration.
+ * @param bsd The block size information.
+ * @param blk The image block color data to compress.
+ * @param tune_errorval_threshold The error value threshold.
+ * @param plane2_component The component index for the second plane of weights.
+ * @param[out] scb The symbolic compressed block output.
+ * @param[out] tmpbuf The quantized weights for plane 1.
+ */
+static float compress_symbolic_block_for_partition_2planes(
+ const astcenc_config& config,
+ const block_size_descriptor& bsd,
+ const image_block& blk,
+ float tune_errorval_threshold,
+ unsigned int plane2_component,
+ symbolic_compressed_block& scb,
+ compression_working_buffers& tmpbuf,
+ int quant_limit
+) {
+ promise(config.tune_candidate_limit > 0);
+ promise(config.tune_refinement_limit > 0);
+ promise(bsd.decimation_mode_count_selected > 0);
+
+ int max_weight_quant = astc::min(static_cast<int>(QUANT_32), quant_limit);
+
+ // Compute ideal weights and endpoint colors, with no quantization or decimation
+ endpoints_and_weights& ei1 = tmpbuf.ei1;
+ endpoints_and_weights& ei2 = tmpbuf.ei2;
+
+ compute_ideal_colors_and_weights_2planes(bsd, blk, plane2_component, ei1, ei2);
+
+ // Compute ideal weights and endpoint colors for every decimation
+ float* dec_weights_ideal = tmpbuf.dec_weights_ideal;
+ uint8_t* dec_weights_uquant = tmpbuf.dec_weights_uquant;
+
+ // For each decimation mode, compute an ideal set of weights with no quantization
+ for (unsigned int i = 0; i < bsd.decimation_mode_count_selected; i++)
+ {
+ const auto& dm = bsd.get_decimation_mode(i);
+ if (!dm.is_ref_2_plane(static_cast<quant_method>(max_weight_quant)))
+ {
+ continue;
+ }
+
+ const auto& di = bsd.get_decimation_info(i);
+
+ compute_ideal_weights_for_decimation(
+ ei1,
+ di,
+ dec_weights_ideal + i * BLOCK_MAX_WEIGHTS);
+
+ compute_ideal_weights_for_decimation(
+ ei2,
+ di,
+ dec_weights_ideal + i * BLOCK_MAX_WEIGHTS + WEIGHTS_PLANE2_OFFSET);
+ }
+
+ // Compute maximum colors for the endpoints and ideal weights, then for each endpoint and ideal
+ // weight pair, compute the smallest weight that will result in a color value greater than 1
+ vfloat4 min_ep1(10.0f);
+ vfloat4 min_ep2(10.0f);
+
+ vfloat4 ep1 = (vfloat4(1.0f) - ei1.ep.endpt0[0]) / (ei1.ep.endpt1[0] - ei1.ep.endpt0[0]);
+ vmask4 use_ep1 = (ep1 > vfloat4(0.5f)) & (ep1 < min_ep1);
+ min_ep1 = select(min_ep1, ep1, use_ep1);
+
+ vfloat4 ep2 = (vfloat4(1.0f) - ei2.ep.endpt0[0]) / (ei2.ep.endpt1[0] - ei2.ep.endpt0[0]);
+ vmask4 use_ep2 = (ep2 > vfloat4(0.5f)) & (ep2 < min_ep2);
+ min_ep2 = select(min_ep2, ep2, use_ep2);
+
+ vfloat4 err_max(ERROR_CALC_DEFAULT);
+ vmask4 err_mask = vint4::lane_id() == vint4(plane2_component);
+
+ // Set the plane2 component to max error in ep1
+ min_ep1 = select(min_ep1, err_max, err_mask);
+
+ float min_wt_cutoff1 = hmin_s(min_ep1);
+
+ // Set the minwt2 to the plane2 component min in ep2
+ float min_wt_cutoff2 = hmin_s(select(err_max, min_ep2, err_mask));
+
+ compute_angular_endpoints_2planes(
+ bsd, dec_weights_ideal, max_weight_quant, tmpbuf);
+
+ // For each mode (which specifies a decimation and a quantization):
+ // * Compute number of bits needed for the quantized weights
+ // * Generate an optimized set of quantized weights
+ // * Compute quantization errors for the mode
+
+ float* weight_low_value1 = tmpbuf.weight_low_value1;
+ float* weight_high_value1 = tmpbuf.weight_high_value1;
+ float* weight_low_value2 = tmpbuf.weight_low_value2;
+ float* weight_high_value2 = tmpbuf.weight_high_value2;
+
+ int8_t* qwt_bitcounts = tmpbuf.qwt_bitcounts;
+ float* qwt_errors = tmpbuf.qwt_errors;
+
+ unsigned int start_2plane = bsd.block_mode_count_1plane_selected;
+ unsigned int end_2plane = bsd.block_mode_count_1plane_2plane_selected;
+
+ for (unsigned int i = start_2plane; i < end_2plane; i++)
+ {
+ const block_mode& bm = bsd.block_modes[i];
+ assert(bm.is_dual_plane);
+
+ if (bm.quant_mode > max_weight_quant)
+ {
+ qwt_errors[i] = 1e38f;
+ continue;
+ }
+
+ qwt_bitcounts[i] = static_cast<int8_t>(109 - bm.weight_bits);
+
+ if (weight_high_value1[i] > 1.02f * min_wt_cutoff1)
+ {
+ weight_high_value1[i] = 1.0f;
+ }
+
+ if (weight_high_value2[i] > 1.02f * min_wt_cutoff2)
+ {
+ weight_high_value2[i] = 1.0f;
+ }
+
+ unsigned int decimation_mode = bm.decimation_mode;
+ const auto& di = bsd.get_decimation_info(decimation_mode);
+
+ alignas(ASTCENC_VECALIGN) float dec_weights_uquantf[BLOCK_MAX_WEIGHTS];
+
+ // Generate the optimized set of weights for the mode
+ compute_quantized_weights_for_decimation(
+ di,
+ weight_low_value1[i],
+ weight_high_value1[i],
+ dec_weights_ideal + BLOCK_MAX_WEIGHTS * decimation_mode,
+ dec_weights_uquantf,
+ dec_weights_uquant + BLOCK_MAX_WEIGHTS * i,
+ bm.get_weight_quant_mode());
+
+ compute_quantized_weights_for_decimation(
+ di,
+ weight_low_value2[i],
+ weight_high_value2[i],
+ dec_weights_ideal + BLOCK_MAX_WEIGHTS * decimation_mode + WEIGHTS_PLANE2_OFFSET,
+ dec_weights_uquantf + WEIGHTS_PLANE2_OFFSET,
+ dec_weights_uquant + BLOCK_MAX_WEIGHTS * i + WEIGHTS_PLANE2_OFFSET,
+ bm.get_weight_quant_mode());
+
+ // Compute weight quantization errors for the block mode
+ qwt_errors[i] = compute_error_of_weight_set_2planes(
+ ei1,
+ ei2,
+ di,
+ dec_weights_uquantf,
+ dec_weights_uquantf + WEIGHTS_PLANE2_OFFSET);
+ }
+
+ // Decide the optimal combination of color endpoint encodings and weight encodings
+ uint8_t partition_format_specifiers[TUNE_MAX_TRIAL_CANDIDATES][BLOCK_MAX_PARTITIONS];
+ int block_mode_index[TUNE_MAX_TRIAL_CANDIDATES];
+
+ quant_method color_quant_level[TUNE_MAX_TRIAL_CANDIDATES];
+ quant_method color_quant_level_mod[TUNE_MAX_TRIAL_CANDIDATES];
+
+ endpoints epm;
+ merge_endpoints(ei1.ep, ei2.ep, plane2_component, epm);
+
+ const auto& pi = bsd.get_partition_info(1, 0);
+ unsigned int candidate_count = compute_ideal_endpoint_formats(
+ pi, blk, epm, qwt_bitcounts, qwt_errors,
+ config.tune_candidate_limit,
+ bsd.block_mode_count_1plane_selected, bsd.block_mode_count_1plane_2plane_selected,
+ partition_format_specifiers, block_mode_index,
+ color_quant_level, color_quant_level_mod, tmpbuf);
+
+ // Iterate over the N believed-to-be-best modes to find out which one is actually best
+ float best_errorval_in_mode = ERROR_CALC_DEFAULT;
+ float best_errorval_in_scb = scb.errorval;
+
+ for (unsigned int i = 0; i < candidate_count; i++)
+ {
+ TRACE_NODE(node0, "candidate");
+
+ const int bm_packed_index = block_mode_index[i];
+ assert(bm_packed_index >= static_cast<int>(bsd.block_mode_count_1plane_selected) &&
+ bm_packed_index < static_cast<int>(bsd.block_mode_count_1plane_2plane_selected));
+ const block_mode& qw_bm = bsd.block_modes[bm_packed_index];
+
+ int decimation_mode = qw_bm.decimation_mode;
+ const auto& di = bsd.get_decimation_info(decimation_mode);
+ promise(di.weight_count > 0);
+
+ trace_add_data("weight_x", di.weight_x);
+ trace_add_data("weight_y", di.weight_y);
+ trace_add_data("weight_z", di.weight_z);
+ trace_add_data("weight_quant", qw_bm.quant_mode);
+
+ vfloat4 rgbs_color;
+ vfloat4 rgbo_color;
+
+ symbolic_compressed_block workscb;
+ endpoints workep = epm;
+
+ uint8_t* u8_weight1_src = dec_weights_uquant + BLOCK_MAX_WEIGHTS * bm_packed_index;
+ uint8_t* u8_weight2_src = dec_weights_uquant + BLOCK_MAX_WEIGHTS * bm_packed_index + WEIGHTS_PLANE2_OFFSET;
+
+ for (int j = 0; j < di.weight_count; j++)
+ {
+ workscb.weights[j] = u8_weight1_src[j];
+ workscb.weights[j + WEIGHTS_PLANE2_OFFSET] = u8_weight2_src[j];
+ }
+
+ for (unsigned int l = 0; l < config.tune_refinement_limit; l++)
+ {
+ recompute_ideal_colors_2planes(
+ blk, bsd, di,
+ workscb.weights, workscb.weights + WEIGHTS_PLANE2_OFFSET,
+ workep, rgbs_color, rgbo_color, plane2_component);
+
+ // Quantize the chosen color
+ workscb.color_formats[0] = pack_color_endpoints(
+ workep.endpt0[0],
+ workep.endpt1[0],
+ rgbs_color, rgbo_color,
+ partition_format_specifiers[i][0],
+ workscb.color_values[0],
+ color_quant_level[i]);
+
+ // Store header fields
+ workscb.partition_count = 1;
+ workscb.partition_index = 0;
+ workscb.quant_mode = color_quant_level[i];
+ workscb.color_formats_matched = 0;
+ workscb.block_mode = qw_bm.mode_index;
+ workscb.plane2_component = static_cast<int8_t>(plane2_component);
+ workscb.block_type = SYM_BTYPE_NONCONST;
+
+ // Pre-realign test
+ if (l == 0)
+ {
+ float errorval = compute_symbolic_block_difference_2plane(config, bsd, workscb, blk);
+ if (errorval == -ERROR_CALC_DEFAULT)
+ {
+ errorval = -errorval;
+ workscb.block_type = SYM_BTYPE_ERROR;
+ }
+
+ trace_add_data("error_prerealign", errorval);
+ best_errorval_in_mode = astc::min(errorval, best_errorval_in_mode);
+
+ // Average refinement improvement is 3.5% per iteration (allow 4.5%), but the first
+ // iteration can help more so we give it a extra 8% leeway. Use this knowledge to
+ // drive a heuristic to skip blocks that are unlikely to catch up with the best
+ // block we have already.
+ unsigned int iters_remaining = config.tune_refinement_limit - l;
+ float threshold = (0.045f * static_cast<float>(iters_remaining)) + 1.08f;
+ if (errorval > (threshold * best_errorval_in_scb))
+ {
+ break;
+ }
+
+ if (errorval < best_errorval_in_scb)
+ {
+ best_errorval_in_scb = errorval;
+ workscb.errorval = errorval;
+ scb = workscb;
+
+ if (errorval < tune_errorval_threshold)
+ {
+ // Skip remaining candidates - this is "good enough"
+ i = candidate_count;
+ break;
+ }
+ }
+ }
+
+ // Perform a final pass over the weights to try to improve them.
+ bool adjustments;
+ if (di.weight_count != bsd.texel_count)
+ {
+ adjustments = realign_weights_decimated(
+ config.profile, bsd, blk, workscb);
+ }
+ else
+ {
+ adjustments = realign_weights_undecimated(
+ config.profile, bsd, blk, workscb);
+ }
+
+ // Post-realign test
+ float errorval = compute_symbolic_block_difference_2plane(config, bsd, workscb, blk);
+ if (errorval == -ERROR_CALC_DEFAULT)
+ {
+ errorval = -errorval;
+ workscb.block_type = SYM_BTYPE_ERROR;
+ }
+
+ trace_add_data("error_postrealign", errorval);
+ best_errorval_in_mode = astc::min(errorval, best_errorval_in_mode);
+
+ // Average refinement improvement is 3.5% per iteration, so skip blocks that are
+ // unlikely to catch up with the best block we have already. Assume a 4.5% per step to
+ // give benefit of the doubt ...
+ unsigned int iters_remaining = config.tune_refinement_limit - 1 - l;
+ float threshold = (0.045f * static_cast<float>(iters_remaining)) + 1.0f;
+ if (errorval > (threshold * best_errorval_in_scb))
+ {
+ break;
+ }
+
+ if (errorval < best_errorval_in_scb)
+ {
+ best_errorval_in_scb = errorval;
+ workscb.errorval = errorval;
+ scb = workscb;
+
+ if (errorval < tune_errorval_threshold)
+ {
+ // Skip remaining candidates - this is "good enough"
+ i = candidate_count;
+ break;
+ }
+ }
+
+ if (!adjustments)
+ {
+ break;
+ }
+ }
+ }
+
+ return best_errorval_in_mode;
+}
+
+/**
+ * @brief Determine the lowest cross-channel correlation factor.
+ *
+ * @param texels_per_block The number of texels in a block.
+ * @param blk The image block color data to compress.
+ *
+ * @return Return the lowest correlation factor.
+ */
+static float prepare_block_statistics(
+ int texels_per_block,
+ const image_block& blk
+) {
+ // Compute covariance matrix, as a collection of 10 scalars that form the upper-triangular row
+ // of the matrix. The matrix is symmetric, so this is all we need for this use case.
+ float rs = 0.0f;
+ float gs = 0.0f;
+ float bs = 0.0f;
+ float as = 0.0f;
+ float rr_var = 0.0f;
+ float gg_var = 0.0f;
+ float bb_var = 0.0f;
+ float aa_var = 0.0f;
+ float rg_cov = 0.0f;
+ float rb_cov = 0.0f;
+ float ra_cov = 0.0f;
+ float gb_cov = 0.0f;
+ float ga_cov = 0.0f;
+ float ba_cov = 0.0f;
+
+ float weight_sum = 0.0f;
+
+ promise(texels_per_block > 0);
+ for (int i = 0; i < texels_per_block; i++)
+ {
+ float weight = hadd_s(blk.channel_weight) / 4.0f;
+ assert(weight >= 0.0f);
+ weight_sum += weight;
+
+ float r = blk.data_r[i];
+ float g = blk.data_g[i];
+ float b = blk.data_b[i];
+ float a = blk.data_a[i];
+
+ float rw = r * weight;
+ rs += rw;
+ rr_var += r * rw;
+ rg_cov += g * rw;
+ rb_cov += b * rw;
+ ra_cov += a * rw;
+
+ float gw = g * weight;
+ gs += gw;
+ gg_var += g * gw;
+ gb_cov += b * gw;
+ ga_cov += a * gw;
+
+ float bw = b * weight;
+ bs += bw;
+ bb_var += b * bw;
+ ba_cov += a * bw;
+
+ float aw = a * weight;
+ as += aw;
+ aa_var += a * aw;
+ }
+
+ float rpt = 1.0f / astc::max(weight_sum, 1e-7f);
+
+ rr_var -= rs * (rs * rpt);
+ rg_cov -= gs * (rs * rpt);
+ rb_cov -= bs * (rs * rpt);
+ ra_cov -= as * (rs * rpt);
+
+ gg_var -= gs * (gs * rpt);
+ gb_cov -= bs * (gs * rpt);
+ ga_cov -= as * (gs * rpt);
+
+ bb_var -= bs * (bs * rpt);
+ ba_cov -= as * (bs * rpt);
+
+ aa_var -= as * (as * rpt);
+
+ // These will give a NaN if a channel is constant - these are fixed up in the next step
+ rg_cov *= astc::rsqrt(rr_var * gg_var);
+ rb_cov *= astc::rsqrt(rr_var * bb_var);
+ ra_cov *= astc::rsqrt(rr_var * aa_var);
+ gb_cov *= astc::rsqrt(gg_var * bb_var);
+ ga_cov *= astc::rsqrt(gg_var * aa_var);
+ ba_cov *= astc::rsqrt(bb_var * aa_var);
+
+ if (astc::isnan(rg_cov)) rg_cov = 1.0f;
+ if (astc::isnan(rb_cov)) rb_cov = 1.0f;
+ if (astc::isnan(ra_cov)) ra_cov = 1.0f;
+ if (astc::isnan(gb_cov)) gb_cov = 1.0f;
+ if (astc::isnan(ga_cov)) ga_cov = 1.0f;
+ if (astc::isnan(ba_cov)) ba_cov = 1.0f;
+
+ float lowest_correlation = astc::min(fabsf(rg_cov), fabsf(rb_cov));
+ lowest_correlation = astc::min(lowest_correlation, fabsf(ra_cov));
+ lowest_correlation = astc::min(lowest_correlation, fabsf(gb_cov));
+ lowest_correlation = astc::min(lowest_correlation, fabsf(ga_cov));
+ lowest_correlation = astc::min(lowest_correlation, fabsf(ba_cov));
+
+ // Diagnostic trace points
+ trace_add_data("min_r", blk.data_min.lane<0>());
+ trace_add_data("max_r", blk.data_max.lane<0>());
+ trace_add_data("min_g", blk.data_min.lane<1>());
+ trace_add_data("max_g", blk.data_max.lane<1>());
+ trace_add_data("min_b", blk.data_min.lane<2>());
+ trace_add_data("max_b", blk.data_max.lane<2>());
+ trace_add_data("min_a", blk.data_min.lane<3>());
+ trace_add_data("max_a", blk.data_max.lane<3>());
+ trace_add_data("cov_rg", fabsf(rg_cov));
+ trace_add_data("cov_rb", fabsf(rb_cov));
+ trace_add_data("cov_ra", fabsf(ra_cov));
+ trace_add_data("cov_gb", fabsf(gb_cov));
+ trace_add_data("cov_ga", fabsf(ga_cov));
+ trace_add_data("cov_ba", fabsf(ba_cov));
+
+ return lowest_correlation;
+}
+
+/* See header for documentation. */
+void compress_block(
+ const astcenc_contexti& ctx,
+ const image_block& blk,
+ physical_compressed_block& pcb,
+ compression_working_buffers& tmpbuf)
+{
+ astcenc_profile decode_mode = ctx.config.profile;
+ symbolic_compressed_block scb;
+ const block_size_descriptor& bsd = *ctx.bsd;
+ float lowest_correl;
+
+ TRACE_NODE(node0, "block");
+ trace_add_data("pos_x", blk.xpos);
+ trace_add_data("pos_y", blk.ypos);
+ trace_add_data("pos_z", blk.zpos);
+
+ // Set stricter block targets for luminance data as we have more bits to play with
+ bool block_is_l = blk.is_luminance();
+ float block_is_l_scale = block_is_l ? 1.0f / 1.5f : 1.0f;
+
+ // Set slightly stricter block targets for lumalpha data as we have more bits to play with
+ bool block_is_la = blk.is_luminancealpha();
+ float block_is_la_scale = block_is_la ? 1.0f / 1.05f : 1.0f;
+
+ bool block_skip_two_plane = false;
+ int max_partitions = ctx.config.tune_partition_count_limit;
+
+ unsigned int requested_partition_indices[3] {
+ ctx.config.tune_2partition_index_limit,
+ ctx.config.tune_3partition_index_limit,
+ ctx.config.tune_4partition_index_limit
+ };
+
+ unsigned int requested_partition_trials[3] {
+ ctx.config.tune_2partitioning_candidate_limit,
+ ctx.config.tune_3partitioning_candidate_limit,
+ ctx.config.tune_4partitioning_candidate_limit
+ };
+
+#if defined(ASTCENC_DIAGNOSTICS)
+ // Do this early in diagnostic builds so we can dump uniform metrics
+ // for every block. Do it later in release builds to avoid redundant work!
+ float error_weight_sum = hadd_s(blk.channel_weight) * bsd.texel_count;
+ float error_threshold = ctx.config.tune_db_limit
+ * error_weight_sum
+ * block_is_l_scale
+ * block_is_la_scale;
+
+ lowest_correl = prepare_block_statistics(bsd.texel_count, blk);
+ trace_add_data("lowest_correl", lowest_correl);
+ trace_add_data("tune_error_threshold", error_threshold);
+#endif
+
+ // Detected a constant-color block
+ if (all(blk.data_min == blk.data_max))
+ {
+ TRACE_NODE(node1, "pass");
+ trace_add_data("partition_count", 0);
+ trace_add_data("plane_count", 1);
+
+ scb.partition_count = 0;
+
+ // Encode as FP16 if using HDR
+ if ((decode_mode == ASTCENC_PRF_HDR) ||
+ (decode_mode == ASTCENC_PRF_HDR_RGB_LDR_A))
+ {
+ scb.block_type = SYM_BTYPE_CONST_F16;
+ vint4 color_f16 = float_to_float16(blk.origin_texel);
+ store(color_f16, scb.constant_color);
+ }
+ // Encode as UNORM16 if NOT using HDR
+ else
+ {
+ scb.block_type = SYM_BTYPE_CONST_U16;
+ vfloat4 color_f32 = clamp(0.0f, 1.0f, blk.origin_texel) * 65535.0f;
+ vint4 color_u16 = float_to_int_rtn(color_f32);
+ store(color_u16, scb.constant_color);
+ }
+
+ trace_add_data("exit", "quality hit");
+
+ symbolic_to_physical(bsd, scb, pcb);
+ return;
+ }
+
+#if !defined(ASTCENC_DIAGNOSTICS)
+ float error_weight_sum = hadd_s(blk.channel_weight) * bsd.texel_count;
+ float error_threshold = ctx.config.tune_db_limit
+ * error_weight_sum
+ * block_is_l_scale
+ * block_is_la_scale;
+#endif
+
+ // Set SCB and mode errors to a very high error value
+ scb.errorval = ERROR_CALC_DEFAULT;
+ scb.block_type = SYM_BTYPE_ERROR;
+
+ float best_errorvals_for_pcount[BLOCK_MAX_PARTITIONS] {
+ ERROR_CALC_DEFAULT, ERROR_CALC_DEFAULT, ERROR_CALC_DEFAULT, ERROR_CALC_DEFAULT
+ };
+
+ float exit_thresholds_for_pcount[BLOCK_MAX_PARTITIONS] {
+ 0.0f,
+ ctx.config.tune_2_partition_early_out_limit_factor,
+ ctx.config.tune_3_partition_early_out_limit_factor,
+ 0.0f
+ };
+
+ // Trial using 1 plane of weights and 1 partition.
+
+ // Most of the time we test it twice, first with a mode cutoff of 0 and then with the specified
+ // mode cutoff. This causes an early-out that speeds up encoding of easy blocks. However, this
+ // optimization is disabled for 4x4 and 5x4 blocks where it nearly always slows down the
+ // compression and slightly reduces image quality.
+
+ float errorval_mult[2] {
+ 1.0f / ctx.config.tune_mse_overshoot,
+ 1.0f
+ };
+
+ static const float errorval_overshoot = 1.0f / ctx.config.tune_mse_overshoot;
+
+ // Only enable MODE0 fast path (trial 0) if 2D, and more than 25 texels
+ int start_trial = 1;
+ if ((bsd.texel_count >= TUNE_MIN_TEXELS_MODE0_FASTPATH) && (bsd.zdim == 1))
+ {
+ start_trial = 0;
+ }
+
+ int quant_limit = QUANT_32;
+ for (int i = start_trial; i < 2; i++)
+ {
+ TRACE_NODE(node1, "pass");
+ trace_add_data("partition_count", 1);
+ trace_add_data("plane_count", 1);
+ trace_add_data("search_mode", i);
+
+ float errorval = compress_symbolic_block_for_partition_1plane(
+ ctx.config, bsd, blk, i == 0,
+ error_threshold * errorval_mult[i] * errorval_overshoot,
+ 1, 0, scb, tmpbuf, QUANT_32);
+
+ // Record the quant level so we can use the filter later searches
+ const auto& bm = bsd.get_block_mode(scb.block_mode);
+ quant_limit = bm.get_weight_quant_mode();
+
+ best_errorvals_for_pcount[0] = astc::min(best_errorvals_for_pcount[0], errorval);
+ if (errorval < (error_threshold * errorval_mult[i]))
+ {
+ trace_add_data("exit", "quality hit");
+ goto END_OF_TESTS;
+ }
+ }
+
+#if !defined(ASTCENC_DIAGNOSTICS)
+ lowest_correl = prepare_block_statistics(bsd.texel_count, blk);
+#endif
+
+ block_skip_two_plane = lowest_correl > ctx.config.tune_2_plane_early_out_limit_correlation;
+
+ // Test the four possible 1-partition, 2-planes modes. Do this in reverse, as
+ // alpha is the most likely to be non-correlated if it is present in the data.
+ for (int i = BLOCK_MAX_COMPONENTS - 1; i >= 0; i--)
+ {
+ TRACE_NODE(node1, "pass");
+ trace_add_data("partition_count", 1);
+ trace_add_data("plane_count", 2);
+ trace_add_data("plane_component", i);
+
+ if (block_skip_two_plane)
+ {
+ trace_add_data("skip", "tune_2_plane_early_out_limit_correlation");
+ continue;
+ }
+
+ if (blk.grayscale && i != 3)
+ {
+ trace_add_data("skip", "grayscale block");
+ continue;
+ }
+
+ if (blk.is_constant_channel(i))
+ {
+ trace_add_data("skip", "constant component");
+ continue;
+ }
+
+ float errorval = compress_symbolic_block_for_partition_2planes(
+ ctx.config, bsd, blk, error_threshold * errorval_overshoot,
+ i, scb, tmpbuf, quant_limit);
+
+ // If attempting two planes is much worse than the best one plane result
+ // then further two plane searches are unlikely to help so move on ...
+ if (errorval > (best_errorvals_for_pcount[0] * 1.85f))
+ {
+ break;
+ }
+
+ if (errorval < error_threshold)
+ {
+ trace_add_data("exit", "quality hit");
+ goto END_OF_TESTS;
+ }
+ }
+
+ // Find best blocks for 2, 3 and 4 partitions
+ for (int partition_count = 2; partition_count <= max_partitions; partition_count++)
+ {
+ unsigned int partition_indices[TUNE_MAX_PARTITIONING_CANDIDATES];
+
+ unsigned int requested_indices = requested_partition_indices[partition_count - 2];
+
+ unsigned int requested_trials = requested_partition_trials[partition_count - 2];
+ requested_trials = astc::min(requested_trials, requested_indices);
+
+ unsigned int actual_trials = find_best_partition_candidates(
+ bsd, blk, partition_count, requested_indices, partition_indices, requested_trials);
+
+ float best_error_in_prev = best_errorvals_for_pcount[partition_count - 2];
+
+ for (unsigned int i = 0; i < actual_trials; i++)
+ {
+ TRACE_NODE(node1, "pass");
+ trace_add_data("partition_count", partition_count);
+ trace_add_data("partition_index", partition_indices[i]);
+ trace_add_data("plane_count", 1);
+ trace_add_data("search_mode", i);
+
+ float errorval = compress_symbolic_block_for_partition_1plane(
+ ctx.config, bsd, blk, false,
+ error_threshold * errorval_overshoot,
+ partition_count, partition_indices[i],
+ scb, tmpbuf, quant_limit);
+
+ best_errorvals_for_pcount[partition_count - 1] = astc::min(best_errorvals_for_pcount[partition_count - 1], errorval);
+
+ // If using N partitions doesn't improve much over using N-1 partitions then skip trying
+ // N+1. Error can dramatically improve if the data is correlated or non-correlated and
+ // aligns with a partitioning that suits that encoding, so for this inner loop check add
+ // a large error scale because the "other" trial could be a lot better.
+ float best_error = best_errorvals_for_pcount[partition_count - 1];
+ float best_error_scale = exit_thresholds_for_pcount[partition_count - 1] * 1.85f;
+ if (best_error > (best_error_in_prev * best_error_scale))
+ {
+ trace_add_data("skip", "tune_partition_early_out_limit_factor");
+ goto END_OF_TESTS;
+ }
+
+ if (errorval < error_threshold)
+ {
+ trace_add_data("exit", "quality hit");
+ goto END_OF_TESTS;
+ }
+ }
+
+ // If using N partitions doesn't improve much over using N-1 partitions then skip trying N+1
+ float best_error = best_errorvals_for_pcount[partition_count - 1];
+ float best_error_scale = exit_thresholds_for_pcount[partition_count - 1];
+ if (best_error > (best_error_in_prev * best_error_scale))
+ {
+ trace_add_data("skip", "tune_partition_early_out_limit_factor");
+ goto END_OF_TESTS;
+ }
+ }
+
+ trace_add_data("exit", "quality not hit");
+
+END_OF_TESTS:
+ // If we still have an error block then convert to something we can encode
+ // TODO: Do something more sensible here, such as average color block
+ if (scb.block_type == SYM_BTYPE_ERROR)
+ {
+#if defined(ASTCENC_DIAGNOSTICS)
+ static bool printed_once = false;
+ if (!printed_once)
+ {
+ printed_once = true;
+ printf("WARN: At least one block failed to find a valid encoding.\n"
+ " Try increasing compression quality settings.\n\n");
+ }
+#endif
+
+ scb.block_type = SYM_BTYPE_CONST_U16;
+ vfloat4 color_f32 = clamp(0.0f, 1.0f, blk.origin_texel) * 65535.0f;
+ vint4 color_u16 = float_to_int_rtn(color_f32);
+ store(color_u16, scb.constant_color);
+ }
+
+ // Compress to a physical block
+ symbolic_to_physical(bsd, scb, pcb);
+}
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_compute_variance.cpp b/thirdparty/astcenc/astcenc_compute_variance.cpp
new file mode 100644
index 0000000000..48a4af8cef
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_compute_variance.cpp
@@ -0,0 +1,472 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2022 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+
+/**
+ * @brief Functions to calculate variance per component in a NxN footprint.
+ *
+ * We need N to be parametric, so the routine below uses summed area tables in order to execute in
+ * O(1) time independent of how big N is.
+ *
+ * The addition uses a Brent-Kung-based parallel prefix adder. This uses the prefix tree to first
+ * perform a binary reduction, and then distributes the results. This method means that there is no
+ * serial dependency between a given element and the next one, and also significantly improves
+ * numerical stability allowing us to use floats rather than doubles.
+ */
+
+#include "astcenc_internal.h"
+
+#include <cassert>
+
+/**
+ * @brief Generate a prefix-sum array using the Brent-Kung algorithm.
+ *
+ * This will take an input array of the form:
+ * v0, v1, v2, ...
+ * ... and modify in-place to turn it into a prefix-sum array of the form:
+ * v0, v0+v1, v0+v1+v2, ...
+ *
+ * @param d The array to prefix-sum.
+ * @param items The number of items in the array.
+ * @param stride The item spacing in the array; i.e. dense arrays should use 1.
+ */
+static void brent_kung_prefix_sum(
+ vfloat4* d,
+ size_t items,
+ int stride
+) {
+ if (items < 2)
+ return;
+
+ size_t lc_stride = 2;
+ size_t log2_stride = 1;
+
+ // The reduction-tree loop
+ do {
+ size_t step = lc_stride >> 1;
+ size_t start = lc_stride - 1;
+ size_t iters = items >> log2_stride;
+
+ vfloat4 *da = d + (start * stride);
+ ptrdiff_t ofs = -static_cast<ptrdiff_t>(step * stride);
+ size_t ofs_stride = stride << log2_stride;
+
+ while (iters)
+ {
+ *da = *da + da[ofs];
+ da += ofs_stride;
+ iters--;
+ }
+
+ log2_stride += 1;
+ lc_stride <<= 1;
+ } while (lc_stride <= items);
+
+ // The expansion-tree loop
+ do {
+ log2_stride -= 1;
+ lc_stride >>= 1;
+
+ size_t step = lc_stride >> 1;
+ size_t start = step + lc_stride - 1;
+ size_t iters = (items - step) >> log2_stride;
+
+ vfloat4 *da = d + (start * stride);
+ ptrdiff_t ofs = -static_cast<ptrdiff_t>(step * stride);
+ size_t ofs_stride = stride << log2_stride;
+
+ while (iters)
+ {
+ *da = *da + da[ofs];
+ da += ofs_stride;
+ iters--;
+ }
+ } while (lc_stride > 2);
+}
+
+/* See header for documentation. */
+void compute_pixel_region_variance(
+ astcenc_contexti& ctx,
+ const pixel_region_args& arg
+) {
+ // Unpack the memory structure into local variables
+ const astcenc_image* img = arg.img;
+ astcenc_swizzle swz = arg.swz;
+ bool have_z = arg.have_z;
+
+ int size_x = arg.size_x;
+ int size_y = arg.size_y;
+ int size_z = arg.size_z;
+
+ int offset_x = arg.offset_x;
+ int offset_y = arg.offset_y;
+ int offset_z = arg.offset_z;
+
+ int alpha_kernel_radius = arg.alpha_kernel_radius;
+
+ float* input_alpha_averages = ctx.input_alpha_averages;
+ vfloat4* work_memory = arg.work_memory;
+
+ // Compute memory sizes and dimensions that we need
+ int kernel_radius = alpha_kernel_radius;
+ int kerneldim = 2 * kernel_radius + 1;
+ int kernel_radius_xy = kernel_radius;
+ int kernel_radius_z = have_z ? kernel_radius : 0;
+
+ int padsize_x = size_x + kerneldim;
+ int padsize_y = size_y + kerneldim;
+ int padsize_z = size_z + (have_z ? kerneldim : 0);
+ int sizeprod = padsize_x * padsize_y * padsize_z;
+
+ int zd_start = have_z ? 1 : 0;
+
+ vfloat4 *varbuf1 = work_memory;
+ vfloat4 *varbuf2 = work_memory + sizeprod;
+
+ // Scaling factors to apply to Y and Z for accesses into the work buffers
+ int yst = padsize_x;
+ int zst = padsize_x * padsize_y;
+
+ // Scaling factors to apply to Y and Z for accesses into result buffers
+ int ydt = img->dim_x;
+ int zdt = img->dim_x * img->dim_y;
+
+ // Macros to act as accessor functions for the work-memory
+ #define VARBUF1(z, y, x) varbuf1[z * zst + y * yst + x]
+ #define VARBUF2(z, y, x) varbuf2[z * zst + y * yst + x]
+
+ // Load N and N^2 values into the work buffers
+ if (img->data_type == ASTCENC_TYPE_U8)
+ {
+ // Swizzle data structure 4 = ZERO, 5 = ONE
+ uint8_t data[6];
+ data[ASTCENC_SWZ_0] = 0;
+ data[ASTCENC_SWZ_1] = 255;
+
+ for (int z = zd_start; z < padsize_z; z++)
+ {
+ int z_src = (z - zd_start) + offset_z - kernel_radius_z;
+ z_src = astc::clamp(z_src, 0, static_cast<int>(img->dim_z - 1));
+ uint8_t* data8 = static_cast<uint8_t*>(img->data[z_src]);
+
+ for (int y = 1; y < padsize_y; y++)
+ {
+ int y_src = (y - 1) + offset_y - kernel_radius_xy;
+ y_src = astc::clamp(y_src, 0, static_cast<int>(img->dim_y - 1));
+
+ for (int x = 1; x < padsize_x; x++)
+ {
+ int x_src = (x - 1) + offset_x - kernel_radius_xy;
+ x_src = astc::clamp(x_src, 0, static_cast<int>(img->dim_x - 1));
+
+ data[0] = data8[(4 * img->dim_x * y_src) + (4 * x_src )];
+ data[1] = data8[(4 * img->dim_x * y_src) + (4 * x_src + 1)];
+ data[2] = data8[(4 * img->dim_x * y_src) + (4 * x_src + 2)];
+ data[3] = data8[(4 * img->dim_x * y_src) + (4 * x_src + 3)];
+
+ uint8_t r = data[swz.r];
+ uint8_t g = data[swz.g];
+ uint8_t b = data[swz.b];
+ uint8_t a = data[swz.a];
+
+ vfloat4 d = vfloat4 (r * (1.0f / 255.0f),
+ g * (1.0f / 255.0f),
+ b * (1.0f / 255.0f),
+ a * (1.0f / 255.0f));
+
+ VARBUF1(z, y, x) = d;
+ VARBUF2(z, y, x) = d * d;
+ }
+ }
+ }
+ }
+ else if (img->data_type == ASTCENC_TYPE_F16)
+ {
+ // Swizzle data structure 4 = ZERO, 5 = ONE (in FP16)
+ uint16_t data[6];
+ data[ASTCENC_SWZ_0] = 0;
+ data[ASTCENC_SWZ_1] = 0x3C00;
+
+ for (int z = zd_start; z < padsize_z; z++)
+ {
+ int z_src = (z - zd_start) + offset_z - kernel_radius_z;
+ z_src = astc::clamp(z_src, 0, static_cast<int>(img->dim_z - 1));
+ uint16_t* data16 = static_cast<uint16_t*>(img->data[z_src]);
+
+ for (int y = 1; y < padsize_y; y++)
+ {
+ int y_src = (y - 1) + offset_y - kernel_radius_xy;
+ y_src = astc::clamp(y_src, 0, static_cast<int>(img->dim_y - 1));
+
+ for (int x = 1; x < padsize_x; x++)
+ {
+ int x_src = (x - 1) + offset_x - kernel_radius_xy;
+ x_src = astc::clamp(x_src, 0, static_cast<int>(img->dim_x - 1));
+
+ data[0] = data16[(4 * img->dim_x * y_src) + (4 * x_src )];
+ data[1] = data16[(4 * img->dim_x * y_src) + (4 * x_src + 1)];
+ data[2] = data16[(4 * img->dim_x * y_src) + (4 * x_src + 2)];
+ data[3] = data16[(4 * img->dim_x * y_src) + (4 * x_src + 3)];
+
+ vint4 di(data[swz.r], data[swz.g], data[swz.b], data[swz.a]);
+ vfloat4 d = float16_to_float(di);
+
+ VARBUF1(z, y, x) = d;
+ VARBUF2(z, y, x) = d * d;
+ }
+ }
+ }
+ }
+ else // if (img->data_type == ASTCENC_TYPE_F32)
+ {
+ assert(img->data_type == ASTCENC_TYPE_F32);
+
+ // Swizzle data structure 4 = ZERO, 5 = ONE (in FP16)
+ float data[6];
+ data[ASTCENC_SWZ_0] = 0.0f;
+ data[ASTCENC_SWZ_1] = 1.0f;
+
+ for (int z = zd_start; z < padsize_z; z++)
+ {
+ int z_src = (z - zd_start) + offset_z - kernel_radius_z;
+ z_src = astc::clamp(z_src, 0, static_cast<int>(img->dim_z - 1));
+ float* data32 = static_cast<float*>(img->data[z_src]);
+
+ for (int y = 1; y < padsize_y; y++)
+ {
+ int y_src = (y - 1) + offset_y - kernel_radius_xy;
+ y_src = astc::clamp(y_src, 0, static_cast<int>(img->dim_y - 1));
+
+ for (int x = 1; x < padsize_x; x++)
+ {
+ int x_src = (x - 1) + offset_x - kernel_radius_xy;
+ x_src = astc::clamp(x_src, 0, static_cast<int>(img->dim_x - 1));
+
+ data[0] = data32[(4 * img->dim_x * y_src) + (4 * x_src )];
+ data[1] = data32[(4 * img->dim_x * y_src) + (4 * x_src + 1)];
+ data[2] = data32[(4 * img->dim_x * y_src) + (4 * x_src + 2)];
+ data[3] = data32[(4 * img->dim_x * y_src) + (4 * x_src + 3)];
+
+ float r = data[swz.r];
+ float g = data[swz.g];
+ float b = data[swz.b];
+ float a = data[swz.a];
+
+ vfloat4 d(r, g, b, a);
+
+ VARBUF1(z, y, x) = d;
+ VARBUF2(z, y, x) = d * d;
+ }
+ }
+ }
+ }
+
+ // Pad with an extra layer of 0s; this forms the edge of the SAT tables
+ vfloat4 vbz = vfloat4::zero();
+ for (int z = 0; z < padsize_z; z++)
+ {
+ for (int y = 0; y < padsize_y; y++)
+ {
+ VARBUF1(z, y, 0) = vbz;
+ VARBUF2(z, y, 0) = vbz;
+ }
+
+ for (int x = 0; x < padsize_x; x++)
+ {
+ VARBUF1(z, 0, x) = vbz;
+ VARBUF2(z, 0, x) = vbz;
+ }
+ }
+
+ if (have_z)
+ {
+ for (int y = 0; y < padsize_y; y++)
+ {
+ for (int x = 0; x < padsize_x; x++)
+ {
+ VARBUF1(0, y, x) = vbz;
+ VARBUF2(0, y, x) = vbz;
+ }
+ }
+ }
+
+ // Generate summed-area tables for N and N^2; this is done in-place, using
+ // a Brent-Kung parallel-prefix based algorithm to minimize precision loss
+ for (int z = zd_start; z < padsize_z; z++)
+ {
+ for (int y = 1; y < padsize_y; y++)
+ {
+ brent_kung_prefix_sum(&(VARBUF1(z, y, 1)), padsize_x - 1, 1);
+ brent_kung_prefix_sum(&(VARBUF2(z, y, 1)), padsize_x - 1, 1);
+ }
+ }
+
+ for (int z = zd_start; z < padsize_z; z++)
+ {
+ for (int x = 1; x < padsize_x; x++)
+ {
+ brent_kung_prefix_sum(&(VARBUF1(z, 1, x)), padsize_y - 1, yst);
+ brent_kung_prefix_sum(&(VARBUF2(z, 1, x)), padsize_y - 1, yst);
+ }
+ }
+
+ if (have_z)
+ {
+ for (int y = 1; y < padsize_y; y++)
+ {
+ for (int x = 1; x < padsize_x; x++)
+ {
+ brent_kung_prefix_sum(&(VARBUF1(1, y, x)), padsize_z - 1, zst);
+ brent_kung_prefix_sum(&(VARBUF2(1, y, x)), padsize_z - 1, zst);
+ }
+ }
+ }
+
+ // Compute a few constants used in the variance-calculation.
+ float alpha_kdim = static_cast<float>(2 * alpha_kernel_radius + 1);
+ float alpha_rsamples;
+
+ if (have_z)
+ {
+ alpha_rsamples = 1.0f / (alpha_kdim * alpha_kdim * alpha_kdim);
+ }
+ else
+ {
+ alpha_rsamples = 1.0f / (alpha_kdim * alpha_kdim);
+ }
+
+ // Use the summed-area tables to compute variance for each neighborhood
+ if (have_z)
+ {
+ for (int z = 0; z < size_z; z++)
+ {
+ int z_src = z + kernel_radius_z;
+ int z_dst = z + offset_z;
+ int z_low = z_src - alpha_kernel_radius;
+ int z_high = z_src + alpha_kernel_radius + 1;
+
+ for (int y = 0; y < size_y; y++)
+ {
+ int y_src = y + kernel_radius_xy;
+ int y_dst = y + offset_y;
+ int y_low = y_src - alpha_kernel_radius;
+ int y_high = y_src + alpha_kernel_radius + 1;
+
+ for (int x = 0; x < size_x; x++)
+ {
+ int x_src = x + kernel_radius_xy;
+ int x_dst = x + offset_x;
+ int x_low = x_src - alpha_kernel_radius;
+ int x_high = x_src + alpha_kernel_radius + 1;
+
+ // Summed-area table lookups for alpha average
+ float vasum = ( VARBUF1(z_high, y_low, x_low).lane<3>()
+ - VARBUF1(z_high, y_low, x_high).lane<3>()
+ - VARBUF1(z_high, y_high, x_low).lane<3>()
+ + VARBUF1(z_high, y_high, x_high).lane<3>()) -
+ ( VARBUF1(z_low, y_low, x_low).lane<3>()
+ - VARBUF1(z_low, y_low, x_high).lane<3>()
+ - VARBUF1(z_low, y_high, x_low).lane<3>()
+ + VARBUF1(z_low, y_high, x_high).lane<3>());
+
+ int out_index = z_dst * zdt + y_dst * ydt + x_dst;
+ input_alpha_averages[out_index] = (vasum * alpha_rsamples);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (int y = 0; y < size_y; y++)
+ {
+ int y_src = y + kernel_radius_xy;
+ int y_dst = y + offset_y;
+ int y_low = y_src - alpha_kernel_radius;
+ int y_high = y_src + alpha_kernel_radius + 1;
+
+ for (int x = 0; x < size_x; x++)
+ {
+ int x_src = x + kernel_radius_xy;
+ int x_dst = x + offset_x;
+ int x_low = x_src - alpha_kernel_radius;
+ int x_high = x_src + alpha_kernel_radius + 1;
+
+ // Summed-area table lookups for alpha average
+ float vasum = VARBUF1(0, y_low, x_low).lane<3>()
+ - VARBUF1(0, y_low, x_high).lane<3>()
+ - VARBUF1(0, y_high, x_low).lane<3>()
+ + VARBUF1(0, y_high, x_high).lane<3>();
+
+ int out_index = y_dst * ydt + x_dst;
+ input_alpha_averages[out_index] = (vasum * alpha_rsamples);
+ }
+ }
+ }
+}
+
+/* See header for documentation. */
+unsigned int init_compute_averages(
+ const astcenc_image& img,
+ unsigned int alpha_kernel_radius,
+ const astcenc_swizzle& swz,
+ avg_args& ag
+) {
+ unsigned int size_x = img.dim_x;
+ unsigned int size_y = img.dim_y;
+ unsigned int size_z = img.dim_z;
+
+ // Compute maximum block size and from that the working memory buffer size
+ unsigned int kernel_radius = alpha_kernel_radius;
+ unsigned int kerneldim = 2 * kernel_radius + 1;
+
+ bool have_z = (size_z > 1);
+ unsigned int max_blk_size_xy = have_z ? 16 : 32;
+ unsigned int max_blk_size_z = astc::min(size_z, have_z ? 16u : 1u);
+
+ unsigned int max_padsize_xy = max_blk_size_xy + kerneldim;
+ unsigned int max_padsize_z = max_blk_size_z + (have_z ? kerneldim : 0);
+
+ // Perform block-wise averages calculations across the image
+ // Initialize fields which are not populated until later
+ ag.arg.size_x = 0;
+ ag.arg.size_y = 0;
+ ag.arg.size_z = 0;
+ ag.arg.offset_x = 0;
+ ag.arg.offset_y = 0;
+ ag.arg.offset_z = 0;
+ ag.arg.work_memory = nullptr;
+
+ ag.arg.img = &img;
+ ag.arg.swz = swz;
+ ag.arg.have_z = have_z;
+ ag.arg.alpha_kernel_radius = alpha_kernel_radius;
+
+ ag.img_size_x = size_x;
+ ag.img_size_y = size_y;
+ ag.img_size_z = size_z;
+ ag.blk_size_xy = max_blk_size_xy;
+ ag.blk_size_z = max_blk_size_z;
+ ag.work_memory_size = 2 * max_padsize_xy * max_padsize_xy * max_padsize_z;
+
+ // The parallel task count
+ unsigned int z_tasks = (size_z + max_blk_size_z - 1) / max_blk_size_z;
+ unsigned int y_tasks = (size_y + max_blk_size_xy - 1) / max_blk_size_xy;
+ return z_tasks * y_tasks;
+}
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_decompress_symbolic.cpp b/thirdparty/astcenc/astcenc_decompress_symbolic.cpp
new file mode 100644
index 0000000000..39e5525c3b
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_decompress_symbolic.cpp
@@ -0,0 +1,623 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2023 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Functions to decompress a symbolic block.
+ */
+
+#include "astcenc_internal.h"
+
+#include <stdio.h>
+#include <assert.h>
+
+/**
+ * @brief Compute the integer linear interpolation of two color endpoints.
+ *
+ * @param decode_mode The ASTC profile (linear or sRGB)
+ * @param color0 The endpoint0 color.
+ * @param color1 The endpoint1 color.
+ * @param weights The interpolation weight (between 0 and 64).
+ *
+ * @return The interpolated color.
+ */
+static vint4 lerp_color_int(
+ astcenc_profile decode_mode,
+ vint4 color0,
+ vint4 color1,
+ vint4 weights
+) {
+ vint4 weight1 = weights;
+ vint4 weight0 = vint4(64) - weight1;
+
+ if (decode_mode == ASTCENC_PRF_LDR_SRGB)
+ {
+ color0 = asr<8>(color0);
+ color1 = asr<8>(color1);
+ }
+
+ vint4 color = (color0 * weight0) + (color1 * weight1) + vint4(32);
+ color = asr<6>(color);
+
+ if (decode_mode == ASTCENC_PRF_LDR_SRGB)
+ {
+ color = color * vint4(257);
+ }
+
+ return color;
+}
+
+
+/**
+ * @brief Convert integer color value into a float value for the decoder.
+ *
+ * @param data The integer color value post-interpolation.
+ * @param lns_mask If set treat lane as HDR (LNS) else LDR (unorm16).
+ *
+ * @return The float color value.
+ */
+static inline vfloat4 decode_texel(
+ vint4 data,
+ vmask4 lns_mask
+) {
+ vint4 color_lns = vint4::zero();
+ vint4 color_unorm = vint4::zero();
+
+ if (any(lns_mask))
+ {
+ color_lns = lns_to_sf16(data);
+ }
+
+ if (!all(lns_mask))
+ {
+ color_unorm = unorm16_to_sf16(data);
+ }
+
+ // Pick components and then convert to FP16
+ vint4 datai = select(color_unorm, color_lns, lns_mask);
+ return float16_to_float(datai);
+}
+
+/* See header for documentation. */
+void unpack_weights(
+ const block_size_descriptor& bsd,
+ const symbolic_compressed_block& scb,
+ const decimation_info& di,
+ bool is_dual_plane,
+ int weights_plane1[BLOCK_MAX_TEXELS],
+ int weights_plane2[BLOCK_MAX_TEXELS]
+) {
+ // Safe to overshoot as all arrays are allocated to full size
+ if (!is_dual_plane)
+ {
+ // Build full 64-entry weight lookup table
+ vint4 tab0(reinterpret_cast<const int*>(scb.weights + 0));
+ vint4 tab1(reinterpret_cast<const int*>(scb.weights + 16));
+ vint4 tab2(reinterpret_cast<const int*>(scb.weights + 32));
+ vint4 tab3(reinterpret_cast<const int*>(scb.weights + 48));
+
+ vint tab0p, tab1p, tab2p, tab3p;
+ vtable_prepare(tab0, tab1, tab2, tab3, tab0p, tab1p, tab2p, tab3p);
+
+ for (unsigned int i = 0; i < bsd.texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vint summed_value(8);
+ vint weight_count(di.texel_weight_count + i);
+ int max_weight_count = hmax(weight_count).lane<0>();
+
+ promise(max_weight_count > 0);
+ for (int j = 0; j < max_weight_count; j++)
+ {
+ vint texel_weights(di.texel_weights_tr[j] + i);
+ vint texel_weights_int(di.texel_weight_contribs_int_tr[j] + i);
+
+ summed_value += vtable_8bt_32bi(tab0p, tab1p, tab2p, tab3p, texel_weights) * texel_weights_int;
+ }
+
+ store(lsr<4>(summed_value), weights_plane1 + i);
+ }
+ }
+ else
+ {
+ // Build a 32-entry weight lookup table per plane
+ // Plane 1
+ vint4 tab0_plane1(reinterpret_cast<const int*>(scb.weights + 0));
+ vint4 tab1_plane1(reinterpret_cast<const int*>(scb.weights + 16));
+ vint tab0_plane1p, tab1_plane1p;
+ vtable_prepare(tab0_plane1, tab1_plane1, tab0_plane1p, tab1_plane1p);
+
+ // Plane 2
+ vint4 tab0_plane2(reinterpret_cast<const int*>(scb.weights + 32));
+ vint4 tab1_plane2(reinterpret_cast<const int*>(scb.weights + 48));
+ vint tab0_plane2p, tab1_plane2p;
+ vtable_prepare(tab0_plane2, tab1_plane2, tab0_plane2p, tab1_plane2p);
+
+ for (unsigned int i = 0; i < bsd.texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vint sum_plane1(8);
+ vint sum_plane2(8);
+
+ vint weight_count(di.texel_weight_count + i);
+ int max_weight_count = hmax(weight_count).lane<0>();
+
+ promise(max_weight_count > 0);
+ for (int j = 0; j < max_weight_count; j++)
+ {
+ vint texel_weights(di.texel_weights_tr[j] + i);
+ vint texel_weights_int(di.texel_weight_contribs_int_tr[j] + i);
+
+ sum_plane1 += vtable_8bt_32bi(tab0_plane1p, tab1_plane1p, texel_weights) * texel_weights_int;
+ sum_plane2 += vtable_8bt_32bi(tab0_plane2p, tab1_plane2p, texel_weights) * texel_weights_int;
+ }
+
+ store(lsr<4>(sum_plane1), weights_plane1 + i);
+ store(lsr<4>(sum_plane2), weights_plane2 + i);
+ }
+ }
+}
+
+/**
+ * @brief Return an FP32 NaN value for use in error colors.
+ *
+ * This NaN encoding will turn into 0xFFFF when converted to an FP16 NaN.
+ *
+ * @return The float color value.
+ */
+static float error_color_nan()
+{
+ if32 v;
+ v.u = 0xFFFFE000U;
+ return v.f;
+}
+
+/* See header for documentation. */
+void decompress_symbolic_block(
+ astcenc_profile decode_mode,
+ const block_size_descriptor& bsd,
+ int xpos,
+ int ypos,
+ int zpos,
+ const symbolic_compressed_block& scb,
+ image_block& blk
+) {
+ blk.xpos = xpos;
+ blk.ypos = ypos;
+ blk.zpos = zpos;
+
+ blk.data_min = vfloat4::zero();
+ blk.data_mean = vfloat4::zero();
+ blk.data_max = vfloat4::zero();
+ blk.grayscale = false;
+
+ // If we detected an error-block, blow up immediately.
+ if (scb.block_type == SYM_BTYPE_ERROR)
+ {
+ for (unsigned int i = 0; i < bsd.texel_count; i++)
+ {
+ blk.data_r[i] = error_color_nan();
+ blk.data_g[i] = error_color_nan();
+ blk.data_b[i] = error_color_nan();
+ blk.data_a[i] = error_color_nan();
+ blk.rgb_lns[i] = 0;
+ blk.alpha_lns[i] = 0;
+ }
+
+ return;
+ }
+
+ if ((scb.block_type == SYM_BTYPE_CONST_F16) ||
+ (scb.block_type == SYM_BTYPE_CONST_U16))
+ {
+ vfloat4 color;
+ uint8_t use_lns = 0;
+
+ // UNORM16 constant color block
+ if (scb.block_type == SYM_BTYPE_CONST_U16)
+ {
+ vint4 colori(scb.constant_color);
+
+ // For sRGB decoding a real decoder would just use the top 8 bits for color conversion.
+ // We don't color convert, so rescale the top 8 bits into the full 16 bit dynamic range.
+ if (decode_mode == ASTCENC_PRF_LDR_SRGB)
+ {
+ colori = asr<8>(colori) * 257;
+ }
+
+ vint4 colorf16 = unorm16_to_sf16(colori);
+ color = float16_to_float(colorf16);
+ }
+ // FLOAT16 constant color block
+ else
+ {
+ switch (decode_mode)
+ {
+ case ASTCENC_PRF_LDR_SRGB:
+ case ASTCENC_PRF_LDR:
+ color = vfloat4(error_color_nan());
+ break;
+ case ASTCENC_PRF_HDR_RGB_LDR_A:
+ case ASTCENC_PRF_HDR:
+ // Constant-color block; unpack from FP16 to FP32.
+ color = float16_to_float(vint4(scb.constant_color));
+ use_lns = 1;
+ break;
+ }
+ }
+
+ for (unsigned int i = 0; i < bsd.texel_count; i++)
+ {
+ blk.data_r[i] = color.lane<0>();
+ blk.data_g[i] = color.lane<1>();
+ blk.data_b[i] = color.lane<2>();
+ blk.data_a[i] = color.lane<3>();
+ blk.rgb_lns[i] = use_lns;
+ blk.alpha_lns[i] = use_lns;
+ }
+
+ return;
+ }
+
+ // Get the appropriate partition-table entry
+ int partition_count = scb.partition_count;
+ const auto& pi = bsd.get_partition_info(partition_count, scb.partition_index);
+
+ // Get the appropriate block descriptors
+ const auto& bm = bsd.get_block_mode(scb.block_mode);
+ const auto& di = bsd.get_decimation_info(bm.decimation_mode);
+
+ bool is_dual_plane = static_cast<bool>(bm.is_dual_plane);
+
+ // Unquantize and undecimate the weights
+ int plane1_weights[BLOCK_MAX_TEXELS];
+ int plane2_weights[BLOCK_MAX_TEXELS];
+ unpack_weights(bsd, scb, di, is_dual_plane, plane1_weights, plane2_weights);
+
+ // Now that we have endpoint colors and weights, we can unpack texel colors
+ int plane2_component = scb.plane2_component;
+ vmask4 plane2_mask = vint4::lane_id() == vint4(plane2_component);
+
+ for (int i = 0; i < partition_count; i++)
+ {
+ // Decode the color endpoints for this partition
+ vint4 ep0;
+ vint4 ep1;
+ bool rgb_lns;
+ bool a_lns;
+
+ unpack_color_endpoints(decode_mode,
+ scb.color_formats[i],
+ scb.color_values[i],
+ rgb_lns, a_lns,
+ ep0, ep1);
+
+ vmask4 lns_mask(rgb_lns, rgb_lns, rgb_lns, a_lns);
+
+ int texel_count = pi.partition_texel_count[i];
+ for (int j = 0; j < texel_count; j++)
+ {
+ int tix = pi.texels_of_partition[i][j];
+ vint4 weight = select(vint4(plane1_weights[tix]), vint4(plane2_weights[tix]), plane2_mask);
+ vint4 color = lerp_color_int(decode_mode, ep0, ep1, weight);
+ vfloat4 colorf = decode_texel(color, lns_mask);
+
+ blk.data_r[tix] = colorf.lane<0>();
+ blk.data_g[tix] = colorf.lane<1>();
+ blk.data_b[tix] = colorf.lane<2>();
+ blk.data_a[tix] = colorf.lane<3>();
+ }
+ }
+}
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+
+/* See header for documentation. */
+float compute_symbolic_block_difference_2plane(
+ const astcenc_config& config,
+ const block_size_descriptor& bsd,
+ const symbolic_compressed_block& scb,
+ const image_block& blk
+) {
+ // If we detected an error-block, blow up immediately.
+ if (scb.block_type == SYM_BTYPE_ERROR)
+ {
+ return ERROR_CALC_DEFAULT;
+ }
+
+ assert(scb.block_mode >= 0);
+ assert(scb.partition_count == 1);
+ assert(bsd.get_block_mode(scb.block_mode).is_dual_plane == 1);
+
+ // Get the appropriate block descriptor
+ const block_mode& bm = bsd.get_block_mode(scb.block_mode);
+ const decimation_info& di = bsd.get_decimation_info(bm.decimation_mode);
+
+ // Unquantize and undecimate the weights
+ int plane1_weights[BLOCK_MAX_TEXELS];
+ int plane2_weights[BLOCK_MAX_TEXELS];
+ unpack_weights(bsd, scb, di, true, plane1_weights, plane2_weights);
+
+ vmask4 plane2_mask = vint4::lane_id() == vint4(scb.plane2_component);
+
+ vfloat4 summa = vfloat4::zero();
+
+ // Decode the color endpoints for this partition
+ vint4 ep0;
+ vint4 ep1;
+ bool rgb_lns;
+ bool a_lns;
+
+ unpack_color_endpoints(config.profile,
+ scb.color_formats[0],
+ scb.color_values[0],
+ rgb_lns, a_lns,
+ ep0, ep1);
+
+ // Unpack and compute error for each texel in the partition
+ unsigned int texel_count = bsd.texel_count;
+ for (unsigned int i = 0; i < texel_count; i++)
+ {
+ vint4 weight = select(vint4(plane1_weights[i]), vint4(plane2_weights[i]), plane2_mask);
+ vint4 colori = lerp_color_int(config.profile, ep0, ep1, weight);
+
+ vfloat4 color = int_to_float(colori);
+ vfloat4 oldColor = blk.texel(i);
+
+ // Compare error using a perceptual decode metric for RGBM textures
+ if (config.flags & ASTCENC_FLG_MAP_RGBM)
+ {
+ // Fail encodings that result in zero weight M pixels. Note that this can cause
+ // "interesting" artifacts if we reject all useful encodings - we typically get max
+ // brightness encodings instead which look just as bad. We recommend users apply a
+ // bias to their stored M value, limiting the lower value to 16 or 32 to avoid
+ // getting small M values post-quantization, but we can't prove it would never
+ // happen, especially at low bit rates ...
+ if (color.lane<3>() == 0.0f)
+ {
+ return -ERROR_CALC_DEFAULT;
+ }
+
+ // Compute error based on decoded RGBM color
+ color = vfloat4(
+ color.lane<0>() * color.lane<3>() * config.rgbm_m_scale,
+ color.lane<1>() * color.lane<3>() * config.rgbm_m_scale,
+ color.lane<2>() * color.lane<3>() * config.rgbm_m_scale,
+ 1.0f
+ );
+
+ oldColor = vfloat4(
+ oldColor.lane<0>() * oldColor.lane<3>() * config.rgbm_m_scale,
+ oldColor.lane<1>() * oldColor.lane<3>() * config.rgbm_m_scale,
+ oldColor.lane<2>() * oldColor.lane<3>() * config.rgbm_m_scale,
+ 1.0f
+ );
+ }
+
+ vfloat4 error = oldColor - color;
+ error = min(abs(error), 1e15f);
+ error = error * error;
+
+ summa += min(dot(error, blk.channel_weight), ERROR_CALC_DEFAULT);
+ }
+
+ return summa.lane<0>();
+}
+
+/* See header for documentation. */
+float compute_symbolic_block_difference_1plane(
+ const astcenc_config& config,
+ const block_size_descriptor& bsd,
+ const symbolic_compressed_block& scb,
+ const image_block& blk
+) {
+ assert(bsd.get_block_mode(scb.block_mode).is_dual_plane == 0);
+
+ // If we detected an error-block, blow up immediately.
+ if (scb.block_type == SYM_BTYPE_ERROR)
+ {
+ return ERROR_CALC_DEFAULT;
+ }
+
+ assert(scb.block_mode >= 0);
+
+ // Get the appropriate partition-table entry
+ unsigned int partition_count = scb.partition_count;
+ const auto& pi = bsd.get_partition_info(partition_count, scb.partition_index);
+
+ // Get the appropriate block descriptor
+ const block_mode& bm = bsd.get_block_mode(scb.block_mode);
+ const decimation_info& di = bsd.get_decimation_info(bm.decimation_mode);
+
+ // Unquantize and undecimate the weights
+ int plane1_weights[BLOCK_MAX_TEXELS];
+ unpack_weights(bsd, scb, di, false, plane1_weights, nullptr);
+
+ vfloat4 summa = vfloat4::zero();
+ for (unsigned int i = 0; i < partition_count; i++)
+ {
+ // Decode the color endpoints for this partition
+ vint4 ep0;
+ vint4 ep1;
+ bool rgb_lns;
+ bool a_lns;
+
+ unpack_color_endpoints(config.profile,
+ scb.color_formats[i],
+ scb.color_values[i],
+ rgb_lns, a_lns,
+ ep0, ep1);
+
+ // Unpack and compute error for each texel in the partition
+ unsigned int texel_count = pi.partition_texel_count[i];
+ for (unsigned int j = 0; j < texel_count; j++)
+ {
+ unsigned int tix = pi.texels_of_partition[i][j];
+ vint4 colori = lerp_color_int(config.profile, ep0, ep1,
+ vint4(plane1_weights[tix]));
+
+ vfloat4 color = int_to_float(colori);
+ vfloat4 oldColor = blk.texel(tix);
+
+ // Compare error using a perceptual decode metric for RGBM textures
+ if (config.flags & ASTCENC_FLG_MAP_RGBM)
+ {
+ // Fail encodings that result in zero weight M pixels. Note that this can cause
+ // "interesting" artifacts if we reject all useful encodings - we typically get max
+ // brightness encodings instead which look just as bad. We recommend users apply a
+ // bias to their stored M value, limiting the lower value to 16 or 32 to avoid
+ // getting small M values post-quantization, but we can't prove it would never
+ // happen, especially at low bit rates ...
+ if (color.lane<3>() == 0.0f)
+ {
+ return -ERROR_CALC_DEFAULT;
+ }
+
+ // Compute error based on decoded RGBM color
+ color = vfloat4(
+ color.lane<0>() * color.lane<3>() * config.rgbm_m_scale,
+ color.lane<1>() * color.lane<3>() * config.rgbm_m_scale,
+ color.lane<2>() * color.lane<3>() * config.rgbm_m_scale,
+ 1.0f
+ );
+
+ oldColor = vfloat4(
+ oldColor.lane<0>() * oldColor.lane<3>() * config.rgbm_m_scale,
+ oldColor.lane<1>() * oldColor.lane<3>() * config.rgbm_m_scale,
+ oldColor.lane<2>() * oldColor.lane<3>() * config.rgbm_m_scale,
+ 1.0f
+ );
+ }
+
+ vfloat4 error = oldColor - color;
+ error = min(abs(error), 1e15f);
+ error = error * error;
+
+ summa += min(dot(error, blk.channel_weight), ERROR_CALC_DEFAULT);
+ }
+ }
+
+ return summa.lane<0>();
+}
+
+/* See header for documentation. */
+float compute_symbolic_block_difference_1plane_1partition(
+ const astcenc_config& config,
+ const block_size_descriptor& bsd,
+ const symbolic_compressed_block& scb,
+ const image_block& blk
+) {
+ // If we detected an error-block, blow up immediately.
+ if (scb.block_type == SYM_BTYPE_ERROR)
+ {
+ return ERROR_CALC_DEFAULT;
+ }
+
+ assert(scb.block_mode >= 0);
+ assert(bsd.get_partition_info(scb.partition_count, scb.partition_index).partition_count == 1);
+
+ // Get the appropriate block descriptor
+ const block_mode& bm = bsd.get_block_mode(scb.block_mode);
+ const decimation_info& di = bsd.get_decimation_info(bm.decimation_mode);
+
+ // Unquantize and undecimate the weights
+ alignas(ASTCENC_VECALIGN) int plane1_weights[BLOCK_MAX_TEXELS];
+ unpack_weights(bsd, scb, di, false, plane1_weights, nullptr);
+
+ // Decode the color endpoints for this partition
+ vint4 ep0;
+ vint4 ep1;
+ bool rgb_lns;
+ bool a_lns;
+
+ unpack_color_endpoints(config.profile,
+ scb.color_formats[0],
+ scb.color_values[0],
+ rgb_lns, a_lns,
+ ep0, ep1);
+
+
+ // Pre-shift sRGB so things round correctly
+ if (config.profile == ASTCENC_PRF_LDR_SRGB)
+ {
+ ep0 = asr<8>(ep0);
+ ep1 = asr<8>(ep1);
+ }
+
+ // Unpack and compute error for each texel in the partition
+ vfloatacc summav = vfloatacc::zero();
+
+ vint lane_id = vint::lane_id();
+ vint srgb_scale(config.profile == ASTCENC_PRF_LDR_SRGB ? 257 : 1);
+
+ unsigned int texel_count = bsd.texel_count;
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ // Compute EP1 contribution
+ vint weight1 = vint::loada(plane1_weights + i);
+ vint ep1_r = vint(ep1.lane<0>()) * weight1;
+ vint ep1_g = vint(ep1.lane<1>()) * weight1;
+ vint ep1_b = vint(ep1.lane<2>()) * weight1;
+ vint ep1_a = vint(ep1.lane<3>()) * weight1;
+
+ // Compute EP0 contribution
+ vint weight0 = vint(64) - weight1;
+ vint ep0_r = vint(ep0.lane<0>()) * weight0;
+ vint ep0_g = vint(ep0.lane<1>()) * weight0;
+ vint ep0_b = vint(ep0.lane<2>()) * weight0;
+ vint ep0_a = vint(ep0.lane<3>()) * weight0;
+
+ // Shift so things round correctly
+ vint colori_r = asr<6>(ep0_r + ep1_r + vint(32)) * srgb_scale;
+ vint colori_g = asr<6>(ep0_g + ep1_g + vint(32)) * srgb_scale;
+ vint colori_b = asr<6>(ep0_b + ep1_b + vint(32)) * srgb_scale;
+ vint colori_a = asr<6>(ep0_a + ep1_a + vint(32)) * srgb_scale;
+
+ // Compute color diff
+ vfloat color_r = int_to_float(colori_r);
+ vfloat color_g = int_to_float(colori_g);
+ vfloat color_b = int_to_float(colori_b);
+ vfloat color_a = int_to_float(colori_a);
+
+ vfloat color_orig_r = loada(blk.data_r + i);
+ vfloat color_orig_g = loada(blk.data_g + i);
+ vfloat color_orig_b = loada(blk.data_b + i);
+ vfloat color_orig_a = loada(blk.data_a + i);
+
+ vfloat color_error_r = min(abs(color_orig_r - color_r), vfloat(1e15f));
+ vfloat color_error_g = min(abs(color_orig_g - color_g), vfloat(1e15f));
+ vfloat color_error_b = min(abs(color_orig_b - color_b), vfloat(1e15f));
+ vfloat color_error_a = min(abs(color_orig_a - color_a), vfloat(1e15f));
+
+ // Compute squared error metric
+ color_error_r = color_error_r * color_error_r;
+ color_error_g = color_error_g * color_error_g;
+ color_error_b = color_error_b * color_error_b;
+ color_error_a = color_error_a * color_error_a;
+
+ vfloat metric = color_error_r * blk.channel_weight.lane<0>()
+ + color_error_g * blk.channel_weight.lane<1>()
+ + color_error_b * blk.channel_weight.lane<2>()
+ + color_error_a * blk.channel_weight.lane<3>();
+
+ // Mask off bad lanes
+ vmask mask = lane_id < vint(texel_count);
+ lane_id += vint(ASTCENC_SIMD_WIDTH);
+ haccumulate(summav, metric, mask);
+ }
+
+ return hadd_s(summav);
+}
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_diagnostic_trace.cpp b/thirdparty/astcenc/astcenc_diagnostic_trace.cpp
new file mode 100644
index 0000000000..7fa7ab1a8b
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_diagnostic_trace.cpp
@@ -0,0 +1,230 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2021-2022 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Functions for the library entrypoint.
+ */
+
+#if defined(ASTCENC_DIAGNOSTICS)
+
+#include <cassert>
+#include <cstdarg>
+#include <cstdio>
+#include <string>
+
+#include "astcenc_diagnostic_trace.h"
+
+/** @brief The global trace logger. */
+static TraceLog* g_TraceLog = nullptr;
+
+/** @brief The JSON indentation level. */
+static const size_t g_trace_indent = 2;
+
+TraceLog::TraceLog(
+ const char* file_name):
+ m_file(file_name, std::ofstream::out | std::ofstream::binary)
+{
+ assert(!g_TraceLog);
+ g_TraceLog = this;
+ m_root = new TraceNode("root");
+}
+
+/* See header for documentation. */
+TraceNode* TraceLog::get_current_leaf()
+{
+ if (m_stack.size())
+ {
+ return m_stack.back();
+ }
+
+ return nullptr;
+}
+
+/* See header for documentation. */
+size_t TraceLog::get_depth()
+{
+ return m_stack.size();
+}
+
+/* See header for documentation. */
+TraceLog::~TraceLog()
+{
+ assert(g_TraceLog == this);
+ delete m_root;
+ g_TraceLog = nullptr;
+}
+
+/* See header for documentation. */
+TraceNode::TraceNode(
+ const char* format,
+ ...
+) {
+ // Format the name string
+ constexpr size_t bufsz = 256;
+ char buffer[bufsz];
+
+ va_list args;
+ va_start (args, format);
+ vsnprintf (buffer, bufsz, format, args);
+ va_end (args);
+
+ // Guarantee there is a nul terminator
+ buffer[bufsz - 1] = 0;
+
+ // Generate the node
+ TraceNode* parent = g_TraceLog->get_current_leaf();
+ size_t depth = g_TraceLog->get_depth();
+ g_TraceLog->m_stack.push_back(this);
+
+ bool comma = parent && parent->m_attrib_count;
+ auto& out = g_TraceLog->m_file;
+
+ if (parent)
+ {
+ parent->m_attrib_count++;
+ }
+
+ if (comma)
+ {
+ out << ',';
+ }
+
+ if (depth)
+ {
+ out << '\n';
+ }
+
+ size_t out_indent = (depth * 2) * g_trace_indent;
+ size_t in_indent = (depth * 2 + 1) * g_trace_indent;
+
+ std::string out_indents("");
+ if (out_indent)
+ {
+ out_indents = std::string(out_indent, ' ');
+ }
+
+ std::string in_indents(in_indent, ' ');
+
+ out << out_indents << "[ \"node\", \"" << buffer << "\",\n";
+ out << in_indents << "[";
+}
+
+/* See header for documentation. */
+void TraceNode::add_attrib(
+ std::string type,
+ std::string key,
+ std::string value
+) {
+ (void)type;
+
+ size_t depth = g_TraceLog->get_depth();
+ size_t indent = (depth * 2) * g_trace_indent;
+ auto& out = g_TraceLog->m_file;
+ bool comma = m_attrib_count;
+ m_attrib_count++;
+
+ if (comma)
+ {
+ out << ',';
+ }
+
+ out << '\n';
+ out << std::string(indent, ' ') << "[ "
+ << "\"" << key << "\", "
+ << value << " ]";
+}
+
+/* See header for documentation. */
+TraceNode::~TraceNode()
+{
+ g_TraceLog->m_stack.pop_back();
+
+ auto& out = g_TraceLog->m_file;
+ size_t depth = g_TraceLog->get_depth();
+ size_t out_indent = (depth * 2) * g_trace_indent;
+ size_t in_indent = (depth * 2 + 1) * g_trace_indent;
+
+ std::string out_indents("");
+ if (out_indent)
+ {
+ out_indents = std::string(out_indent, ' ');
+ }
+
+ std::string in_indents(in_indent, ' ');
+
+ if (m_attrib_count)
+ {
+ out << "\n" << in_indents;
+ }
+ out << "]\n";
+
+ out << out_indents << "]";
+}
+
+/* See header for documentation. */
+void trace_add_data(
+ const char* key,
+ const char* format,
+ ...
+) {
+ constexpr size_t bufsz = 256;
+ char buffer[bufsz];
+
+ va_list args;
+ va_start (args, format);
+ vsnprintf (buffer, bufsz, format, args);
+ va_end (args);
+
+ // Guarantee there is a nul terminator
+ buffer[bufsz - 1] = 0;
+
+ std::string value = "\"" + std::string(buffer) + "\"";
+
+ TraceNode* node = g_TraceLog->get_current_leaf();
+ node->add_attrib("str", key, value);
+}
+
+/* See header for documentation. */
+void trace_add_data(
+ const char* key,
+ float value
+) {
+ char buffer[256];
+ sprintf(buffer, "%.20g", (double)value);
+ TraceNode* node = g_TraceLog->get_current_leaf();
+ node->add_attrib("float", key, buffer);
+}
+
+/* See header for documentation. */
+void trace_add_data(
+ const char* key,
+ int value
+) {
+ TraceNode* node = g_TraceLog->get_current_leaf();
+ node->add_attrib("int", key, std::to_string(value));
+}
+
+/* See header for documentation. */
+void trace_add_data(
+ const char* key,
+ unsigned int value
+) {
+ TraceNode* node = g_TraceLog->get_current_leaf();
+ node->add_attrib("int", key, std::to_string(value));
+}
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_diagnostic_trace.h b/thirdparty/astcenc/astcenc_diagnostic_trace.h
new file mode 100644
index 0000000000..f5586b0ad5
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_diagnostic_trace.h
@@ -0,0 +1,219 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2021-2022 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief This module provides a set of diagnostic tracing utilities.
+ *
+ * Overview
+ * ========
+ *
+ * The built-in diagnostic trace tool generates a hierarchical JSON tree structure. The tree
+ * hierarchy contains three levels:
+ *
+ * - block
+ * - pass
+ * - candidate
+ *
+ * One block node exists for each compressed block in the image. One pass node exists for each major
+ * pass (N partition, M planes, O components) applied to a block. One candidate node exists for each
+ * encoding candidate trialed for a pass.
+ *
+ * Each node contains both the hierarchy but also a number of attributes which explain the behavior.
+ * For example, the block node contains the block coordinates in the image, the pass explains the
+ * pass configuration, and the candidate will explain the candidate encoding such as weight
+ * decimation, refinement error, etc.
+ *
+ * Trace Nodes are designed as scope-managed C++ objects with stack-like push/pop behavior.
+ * Constructing a trace node on the stack will automatically add it to the current node as a child,
+ * and then make it the current node. Destroying the current node will pop the stack and set the
+ * parent to the current node. This provides a robust mechanism for ensuring reliable nesting in the
+ * tree structure.
+ *
+ * A set of utility macros are provided to add attribute annotations to the current trace node.
+ *
+ * Usage
+ * =====
+ *
+ * Create Trace Nodes on the stack using the @c TRACE_NODE() macro. This will compile-out completely
+ * in builds with diagnostics disabled.
+ *
+ * Add annotations to the current trace node using the @c trace_add_data() macro. This will
+ * similarly compile out completely in builds with diagnostics disabled.
+ *
+ * If you need to add additional code to support diagnostics-only behavior wrap
+ * it in preprocessor guards:
+ *
+ * #if defined(ASTCENC_DIAGNOSTICS)
+ * #endif
+ */
+
+#ifndef ASTCENC_DIAGNOSTIC_TRACE_INCLUDED
+#define ASTCENC_DIAGNOSTIC_TRACE_INCLUDED
+
+#if defined(ASTCENC_DIAGNOSTICS)
+
+#include <iostream>
+#include <fstream>
+#include <vector>
+
+/**
+ * @brief Class representing a single node in the trace hierarchy.
+ */
+class TraceNode
+{
+public:
+ /**
+ * @brief Construct a new node.
+ *
+ * Constructing a node will push to the the top of the stack, automatically making it a child of
+ * the current node, and then setting it to become the current node.
+ *
+ * @param format The format template for the node name.
+ * @param ... The format parameters.
+ */
+ TraceNode(const char* format, ...);
+
+ /**
+ * @brief Add an attribute to this node.
+ *
+ * Note that no quoting is applied to the @c value, so if quoting is needed it must be done by
+ * the caller.
+ *
+ * @param type The type of the attribute.
+ * @param key The key of the attribute.
+ * @param value The value of the attribute.
+ */
+ void add_attrib(std::string type, std::string key, std::string value);
+
+ /**
+ * @brief Destroy this node.
+ *
+ * Destroying a node will pop it from the top of the stack, making its parent the current node.
+ * It is invalid behavior to destroy a node that is not the current node; usage must conform to
+ * stack push-pop semantics.
+ */
+ ~TraceNode();
+
+ /**
+ * @brief The number of attributes and child nodes in this node.
+ */
+ unsigned int m_attrib_count { 0 };
+};
+
+/**
+ * @brief Class representing the trace log file being written.
+ */
+class TraceLog
+{
+public:
+ /**
+ * @brief Create a new trace log.
+ *
+ * The trace log is global; there can be only one at a time.
+ *
+ * @param file_name The name of the file to write.
+ */
+ TraceLog(const char* file_name);
+
+ /**
+ * @brief Detroy the trace log.
+ *
+ * Trace logs MUST be cleanly destroyed to ensure the file gets written.
+ */
+ ~TraceLog();
+
+ /**
+ * @brief Get the current child node.
+ *
+ * @return The current leaf node.
+ */
+ TraceNode* get_current_leaf();
+
+ /**
+ * @brief Get the stack depth of the current child node.
+ *
+ * @return The current leaf node stack depth.
+ */
+ size_t get_depth();
+
+ /**
+ * @brief The file stream to write to.
+ */
+ std::ofstream m_file;
+
+ /**
+ * @brief The stack of nodes (newest at the back).
+ */
+ std::vector<TraceNode*> m_stack;
+
+private:
+ /**
+ * @brief The root node in the JSON file.
+ */
+ TraceNode* m_root;
+};
+
+/**
+ * @brief Utility macro to create a trace node on the stack.
+ *
+ * @param name The variable name to use.
+ * @param ... The name template and format parameters.
+ */
+#define TRACE_NODE(name, ...) TraceNode name(__VA_ARGS__);
+
+/**
+ * @brief Add a string annotation to the current node.
+ *
+ * @param key The name of the attribute.
+ * @param format The format template for the attribute value.
+ * @param ... The format parameters.
+ */
+void trace_add_data(const char* key, const char* format, ...);
+
+/**
+ * @brief Add a float annotation to the current node.
+ *
+ * @param key The name of the attribute.
+ * @param value The value of the attribute.
+ */
+void trace_add_data(const char* key, float value);
+
+/**
+ * @brief Add an integer annotation to the current node.
+ *
+ * @param key The name of the attribute.
+ * @param value The value of the attribute.
+ */
+void trace_add_data(const char* key, int value);
+
+/**
+ * @brief Add an unsigned integer annotation to the current node.
+ *
+ * @param key The name of the attribute.
+ * @param value The value of the attribute.
+ */
+void trace_add_data(const char* key, unsigned int value);
+
+#else
+
+#define TRACE_NODE(name, ...)
+
+#define trace_add_data(...)
+
+#endif
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_entry.cpp b/thirdparty/astcenc/astcenc_entry.cpp
new file mode 100644
index 0000000000..e59f1fe61a
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_entry.cpp
@@ -0,0 +1,1427 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2023 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Functions for the library entrypoint.
+ */
+
+#include <array>
+#include <cstring>
+#include <new>
+
+#include "astcenc.h"
+#include "astcenc_internal_entry.h"
+#include "astcenc_diagnostic_trace.h"
+
+/**
+ * @brief Record of the quality tuning parameter values.
+ *
+ * See the @c astcenc_config structure for detailed parameter documentation.
+ *
+ * Note that the mse_overshoot entries are scaling factors relative to the base MSE to hit db_limit.
+ * A 20% overshoot is harder to hit for a higher base db_limit, so we may actually use lower ratios
+ * for the more through search presets because the underlying db_limit is so much higher.
+ */
+struct astcenc_preset_config
+{
+ float quality;
+ unsigned int tune_partition_count_limit;
+ unsigned int tune_2partition_index_limit;
+ unsigned int tune_3partition_index_limit;
+ unsigned int tune_4partition_index_limit;
+ unsigned int tune_block_mode_limit;
+ unsigned int tune_refinement_limit;
+ unsigned int tune_candidate_limit;
+ unsigned int tune_2partitioning_candidate_limit;
+ unsigned int tune_3partitioning_candidate_limit;
+ unsigned int tune_4partitioning_candidate_limit;
+ float tune_db_limit_a_base;
+ float tune_db_limit_b_base;
+ float tune_mse_overshoot;
+ float tune_2_partition_early_out_limit_factor;
+ float tune_3_partition_early_out_limit_factor;
+ float tune_2_plane_early_out_limit_correlation;
+};
+
+/**
+ * @brief The static presets for high bandwidth encodings (x < 25 texels per block).
+ */
+static const std::array<astcenc_preset_config, 6> preset_configs_high {{
+ {
+ ASTCENC_PRE_FASTEST,
+ 2, 10, 6, 4, 43, 2, 2, 2, 2, 2, 85.2f, 63.2f, 3.5f, 1.0f, 1.0f, 0.85f
+ }, {
+ ASTCENC_PRE_FAST,
+ 3, 18, 10, 8, 55, 3, 3, 2, 2, 2, 85.2f, 63.2f, 3.5f, 1.0f, 1.0f, 0.90f
+ }, {
+ ASTCENC_PRE_MEDIUM,
+ 4, 34, 28, 16, 77, 3, 3, 2, 2, 2, 95.0f, 70.0f, 2.5f, 1.1f, 1.05f, 0.95f
+ }, {
+ ASTCENC_PRE_THOROUGH,
+ 4, 82, 60, 30, 94, 4, 4, 3, 2, 2, 105.0f, 77.0f, 10.0f, 1.35f, 1.15f, 0.97f
+ }, {
+ ASTCENC_PRE_VERYTHOROUGH,
+ 4, 256, 128, 64, 98, 4, 6, 20, 14, 8, 200.0f, 200.0f, 10.0f, 1.6f, 1.4f, 0.98f
+ }, {
+ ASTCENC_PRE_EXHAUSTIVE,
+ 4, 512, 512, 512, 100, 4, 8, 32, 32, 32, 200.0f, 200.0f, 10.0f, 2.0f, 2.0f, 0.99f
+ }
+}};
+
+/**
+ * @brief The static presets for medium bandwidth encodings (25 <= x < 64 texels per block).
+ */
+static const std::array<astcenc_preset_config, 6> preset_configs_mid {{
+ {
+ ASTCENC_PRE_FASTEST,
+ 2, 10, 6, 4, 43, 2, 2, 2, 2, 2, 85.2f, 63.2f, 3.5f, 1.0f, 1.0f, 0.80f
+ }, {
+ ASTCENC_PRE_FAST,
+ 3, 18, 12, 10, 55, 3, 3, 2, 2, 2, 85.2f, 63.2f, 3.5f, 1.0f, 1.0f, 0.85f
+ }, {
+ ASTCENC_PRE_MEDIUM,
+ 4, 34, 28, 16, 77, 3, 3, 2, 2, 2, 95.0f, 70.0f, 3.0f, 1.1f, 1.05f, 0.90f
+ }, {
+ ASTCENC_PRE_THOROUGH,
+ 4, 82, 60, 30, 94, 4, 4, 3, 2, 2, 105.0f, 77.0f, 10.0f, 1.4f, 1.2f, 0.95f
+ }, {
+ ASTCENC_PRE_VERYTHOROUGH,
+ 4, 256, 128, 64, 98, 4, 6, 12, 8, 3, 200.0f, 200.0f, 10.0f, 1.6f, 1.4f, 0.98f
+ }, {
+ ASTCENC_PRE_EXHAUSTIVE,
+ 4, 256, 256, 256, 100, 4, 8, 32, 32, 32, 200.0f, 200.0f, 10.0f, 2.0f, 2.0f, 0.99f
+ }
+}};
+
+/**
+ * @brief The static presets for low bandwidth encodings (64 <= x texels per block).
+ */
+static const std::array<astcenc_preset_config, 6> preset_configs_low {{
+ {
+ ASTCENC_PRE_FASTEST,
+ 2, 10, 6, 4, 40, 2, 2, 2, 2, 2, 85.0f, 63.0f, 3.5f, 1.0f, 1.0f, 0.80f
+ }, {
+ ASTCENC_PRE_FAST,
+ 2, 18, 12, 10, 55, 3, 3, 2, 2, 2, 85.0f, 63.0f, 3.5f, 1.0f, 1.0f, 0.85f
+ }, {
+ ASTCENC_PRE_MEDIUM,
+ 3, 34, 28, 16, 77, 3, 3, 2, 2, 2, 95.0f, 70.0f, 3.5f, 1.1f, 1.05f, 0.90f
+ }, {
+ ASTCENC_PRE_THOROUGH,
+ 4, 82, 60, 30, 93, 4, 4, 3, 2, 2, 105.0f, 77.0f, 10.0f, 1.3f, 1.2f, 0.97f
+ }, {
+ ASTCENC_PRE_VERYTHOROUGH,
+ 4, 256, 128, 64, 98, 4, 6, 9, 5, 2, 200.0f, 200.0f, 10.0f, 1.6f, 1.4f, 0.98f
+ }, {
+ ASTCENC_PRE_EXHAUSTIVE,
+ 4, 256, 256, 256, 100, 4, 8, 32, 32, 32, 200.0f, 200.0f, 10.0f, 2.0f, 2.0f, 0.99f
+ }
+}};
+
+/**
+ * @brief Validate CPU floating point meets assumptions made in the codec.
+ *
+ * The codec is written with the assumption that a float threaded through the @c if32 union will be
+ * stored and reloaded as a 32-bit IEEE-754 float with round-to-nearest rounding. This is always the
+ * case in an IEEE-754 compliant system, however not every system or compilation mode is actually
+ * IEEE-754 compliant. This normally fails if the code is compiled with fast math enabled.
+ *
+ * @return Return @c ASTCENC_SUCCESS if validated, otherwise an error on failure.
+ */
+static astcenc_error validate_cpu_float()
+{
+ if32 p;
+ volatile float xprec_testval = 2.51f;
+ p.f = xprec_testval + 12582912.0f;
+ float q = p.f - 12582912.0f;
+
+ if (q != 3.0f)
+ {
+ return ASTCENC_ERR_BAD_CPU_FLOAT;
+ }
+
+ return ASTCENC_SUCCESS;
+}
+
+/**
+ * @brief Validate CPU ISA support meets the requirements of this build of the library.
+ *
+ * Each library build is statically compiled for a particular set of CPU ISA features, such as the
+ * SIMD support or other ISA extensions such as POPCNT. This function checks that the host CPU
+ * actually supports everything this build needs.
+ *
+ * @return Return @c ASTCENC_SUCCESS if validated, otherwise an error on failure.
+ */
+static astcenc_error validate_cpu_isa()
+{
+ #if ASTCENC_SSE >= 41
+ if (!cpu_supports_sse41())
+ {
+ return ASTCENC_ERR_BAD_CPU_ISA;
+ }
+ #endif
+
+ #if ASTCENC_POPCNT >= 1
+ if (!cpu_supports_popcnt())
+ {
+ return ASTCENC_ERR_BAD_CPU_ISA;
+ }
+ #endif
+
+ #if ASTCENC_F16C >= 1
+ if (!cpu_supports_f16c())
+ {
+ return ASTCENC_ERR_BAD_CPU_ISA;
+ }
+ #endif
+
+ #if ASTCENC_AVX >= 2
+ if (!cpu_supports_avx2())
+ {
+ return ASTCENC_ERR_BAD_CPU_ISA;
+ }
+ #endif
+
+ return ASTCENC_SUCCESS;
+}
+
+/**
+ * @brief Validate config profile.
+ *
+ * @param profile The profile to check.
+ *
+ * @return Return @c ASTCENC_SUCCESS if validated, otherwise an error on failure.
+ */
+static astcenc_error validate_profile(
+ astcenc_profile profile
+) {
+ // Values in this enum are from an external user, so not guaranteed to be
+ // bounded to the enum values
+ switch (static_cast<int>(profile))
+ {
+ case ASTCENC_PRF_LDR_SRGB:
+ case ASTCENC_PRF_LDR:
+ case ASTCENC_PRF_HDR_RGB_LDR_A:
+ case ASTCENC_PRF_HDR:
+ return ASTCENC_SUCCESS;
+ default:
+ return ASTCENC_ERR_BAD_PROFILE;
+ }
+}
+
+/**
+ * @brief Validate block size.
+ *
+ * @param block_x The block x dimensions.
+ * @param block_y The block y dimensions.
+ * @param block_z The block z dimensions.
+ *
+ * @return Return @c ASTCENC_SUCCESS if validated, otherwise an error on failure.
+ */
+static astcenc_error validate_block_size(
+ unsigned int block_x,
+ unsigned int block_y,
+ unsigned int block_z
+) {
+ // Test if this is a legal block size at all
+ bool is_legal = (((block_z <= 1) && is_legal_2d_block_size(block_x, block_y)) ||
+ ((block_z >= 2) && is_legal_3d_block_size(block_x, block_y, block_z)));
+ if (!is_legal)
+ {
+ return ASTCENC_ERR_BAD_BLOCK_SIZE;
+ }
+
+ // Test if this build has sufficient capacity for this block size
+ bool have_capacity = (block_x * block_y * block_z) <= BLOCK_MAX_TEXELS;
+ if (!have_capacity)
+ {
+ return ASTCENC_ERR_NOT_IMPLEMENTED;
+ }
+
+ return ASTCENC_SUCCESS;
+}
+
+/**
+ * @brief Validate flags.
+ *
+ * @param flags The flags to check.
+ *
+ * @return Return @c ASTCENC_SUCCESS if validated, otherwise an error on failure.
+ */
+static astcenc_error validate_flags(
+ unsigned int flags
+) {
+ // Flags field must not contain any unknown flag bits
+ unsigned int exMask = ~ASTCENC_ALL_FLAGS;
+ if (popcount(flags & exMask) != 0)
+ {
+ return ASTCENC_ERR_BAD_FLAGS;
+ }
+
+ // Flags field must only contain at most a single map type
+ exMask = ASTCENC_FLG_MAP_NORMAL
+ | ASTCENC_FLG_MAP_RGBM;
+ if (popcount(flags & exMask) > 1)
+ {
+ return ASTCENC_ERR_BAD_FLAGS;
+ }
+
+ return ASTCENC_SUCCESS;
+}
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+
+/**
+ * @brief Validate single channel compression swizzle.
+ *
+ * @param swizzle The swizzle to check.
+ *
+ * @return Return @c ASTCENC_SUCCESS if validated, otherwise an error on failure.
+ */
+static astcenc_error validate_compression_swz(
+ astcenc_swz swizzle
+) {
+ // Not all enum values are handled; SWZ_Z is invalid for compression
+ switch (static_cast<int>(swizzle))
+ {
+ case ASTCENC_SWZ_R:
+ case ASTCENC_SWZ_G:
+ case ASTCENC_SWZ_B:
+ case ASTCENC_SWZ_A:
+ case ASTCENC_SWZ_0:
+ case ASTCENC_SWZ_1:
+ return ASTCENC_SUCCESS;
+ default:
+ return ASTCENC_ERR_BAD_SWIZZLE;
+ }
+}
+
+/**
+ * @brief Validate overall compression swizzle.
+ *
+ * @param swizzle The swizzle to check.
+ *
+ * @return Return @c ASTCENC_SUCCESS if validated, otherwise an error on failure.
+ */
+static astcenc_error validate_compression_swizzle(
+ const astcenc_swizzle& swizzle
+) {
+ if (validate_compression_swz(swizzle.r) ||
+ validate_compression_swz(swizzle.g) ||
+ validate_compression_swz(swizzle.b) ||
+ validate_compression_swz(swizzle.a))
+ {
+ return ASTCENC_ERR_BAD_SWIZZLE;
+ }
+
+ return ASTCENC_SUCCESS;
+}
+#endif
+
+/**
+ * @brief Validate single channel decompression swizzle.
+ *
+ * @param swizzle The swizzle to check.
+ *
+ * @return Return @c ASTCENC_SUCCESS if validated, otherwise an error on failure.
+ */
+static astcenc_error validate_decompression_swz(
+ astcenc_swz swizzle
+) {
+ // Values in this enum are from an external user, so not guaranteed to be
+ // bounded to the enum values
+ switch (static_cast<int>(swizzle))
+ {
+ case ASTCENC_SWZ_R:
+ case ASTCENC_SWZ_G:
+ case ASTCENC_SWZ_B:
+ case ASTCENC_SWZ_A:
+ case ASTCENC_SWZ_0:
+ case ASTCENC_SWZ_1:
+ case ASTCENC_SWZ_Z:
+ return ASTCENC_SUCCESS;
+ default:
+ return ASTCENC_ERR_BAD_SWIZZLE;
+ }
+}
+
+/**
+ * @brief Validate overall decompression swizzle.
+ *
+ * @param swizzle The swizzle to check.
+ *
+ * @return Return @c ASTCENC_SUCCESS if validated, otherwise an error on failure.
+ */
+static astcenc_error validate_decompression_swizzle(
+ const astcenc_swizzle& swizzle
+) {
+ if (validate_decompression_swz(swizzle.r) ||
+ validate_decompression_swz(swizzle.g) ||
+ validate_decompression_swz(swizzle.b) ||
+ validate_decompression_swz(swizzle.a))
+ {
+ return ASTCENC_ERR_BAD_SWIZZLE;
+ }
+
+ return ASTCENC_SUCCESS;
+}
+
+/**
+ * Validate that an incoming configuration is in-spec.
+ *
+ * This function can respond in two ways:
+ *
+ * * Numerical inputs that have valid ranges are clamped to those valid ranges. No error is thrown
+ * for out-of-range inputs in this case.
+ * * Numerical inputs and logic inputs are are logically invalid and which make no sense
+ * algorithmically will return an error.
+ *
+ * @param[in,out] config The input compressor configuration.
+ *
+ * @return Return @c ASTCENC_SUCCESS if validated, otherwise an error on failure.
+ */
+static astcenc_error validate_config(
+ astcenc_config &config
+) {
+ astcenc_error status;
+
+ status = validate_profile(config.profile);
+ if (status != ASTCENC_SUCCESS)
+ {
+ return status;
+ }
+
+ status = validate_flags(config.flags);
+ if (status != ASTCENC_SUCCESS)
+ {
+ return status;
+ }
+
+ status = validate_block_size(config.block_x, config.block_y, config.block_z);
+ if (status != ASTCENC_SUCCESS)
+ {
+ return status;
+ }
+
+#if defined(ASTCENC_DECOMPRESS_ONLY)
+ // Decompress-only builds only support decompress-only contexts
+ if (!(config.flags & ASTCENC_FLG_DECOMPRESS_ONLY))
+ {
+ return ASTCENC_ERR_BAD_PARAM;
+ }
+#endif
+
+ config.rgbm_m_scale = astc::max(config.rgbm_m_scale, 1.0f);
+
+ config.tune_partition_count_limit = astc::clamp(config.tune_partition_count_limit, 1u, 4u);
+ config.tune_2partition_index_limit = astc::clamp(config.tune_2partition_index_limit, 1u, BLOCK_MAX_PARTITIONINGS);
+ config.tune_3partition_index_limit = astc::clamp(config.tune_3partition_index_limit, 1u, BLOCK_MAX_PARTITIONINGS);
+ config.tune_4partition_index_limit = astc::clamp(config.tune_4partition_index_limit, 1u, BLOCK_MAX_PARTITIONINGS);
+ config.tune_block_mode_limit = astc::clamp(config.tune_block_mode_limit, 1u, 100u);
+ config.tune_refinement_limit = astc::max(config.tune_refinement_limit, 1u);
+ config.tune_candidate_limit = astc::clamp(config.tune_candidate_limit, 1u, TUNE_MAX_TRIAL_CANDIDATES);
+ config.tune_2partitioning_candidate_limit = astc::clamp(config.tune_2partitioning_candidate_limit, 1u, TUNE_MAX_PARTITIONING_CANDIDATES);
+ config.tune_3partitioning_candidate_limit = astc::clamp(config.tune_3partitioning_candidate_limit, 1u, TUNE_MAX_PARTITIONING_CANDIDATES);
+ config.tune_4partitioning_candidate_limit = astc::clamp(config.tune_4partitioning_candidate_limit, 1u, TUNE_MAX_PARTITIONING_CANDIDATES);
+ config.tune_db_limit = astc::max(config.tune_db_limit, 0.0f);
+ config.tune_mse_overshoot = astc::max(config.tune_mse_overshoot, 1.0f);
+ config.tune_2_partition_early_out_limit_factor = astc::max(config.tune_2_partition_early_out_limit_factor, 0.0f);
+ config.tune_3_partition_early_out_limit_factor = astc::max(config.tune_3_partition_early_out_limit_factor, 0.0f);
+ config.tune_2_plane_early_out_limit_correlation = astc::max(config.tune_2_plane_early_out_limit_correlation, 0.0f);
+
+ // Specifying a zero weight color component is not allowed; force to small value
+ float max_weight = astc::max(astc::max(config.cw_r_weight, config.cw_g_weight),
+ astc::max(config.cw_b_weight, config.cw_a_weight));
+ if (max_weight > 0.0f)
+ {
+ max_weight /= 1000.0f;
+ config.cw_r_weight = astc::max(config.cw_r_weight, max_weight);
+ config.cw_g_weight = astc::max(config.cw_g_weight, max_weight);
+ config.cw_b_weight = astc::max(config.cw_b_weight, max_weight);
+ config.cw_a_weight = astc::max(config.cw_a_weight, max_weight);
+ }
+ // If all color components error weights are zero then return an error
+ else
+ {
+ return ASTCENC_ERR_BAD_PARAM;
+ }
+
+ return ASTCENC_SUCCESS;
+}
+
+/* See header for documentation. */
+astcenc_error astcenc_config_init(
+ astcenc_profile profile,
+ unsigned int block_x,
+ unsigned int block_y,
+ unsigned int block_z,
+ float quality,
+ unsigned int flags,
+ astcenc_config* configp
+) {
+ astcenc_error status;
+
+ // Check basic library compatibility options here so they are checked early. Note, these checks
+ // are repeated in context_alloc for cases where callers use a manually defined config struct
+ status = validate_cpu_isa();
+ if (status != ASTCENC_SUCCESS)
+ {
+ return status;
+ }
+
+ status = validate_cpu_float();
+ if (status != ASTCENC_SUCCESS)
+ {
+ return status;
+ }
+
+ // Zero init all config fields; although most of will be over written
+ astcenc_config& config = *configp;
+ std::memset(&config, 0, sizeof(config));
+
+ // Process the block size
+ block_z = astc::max(block_z, 1u); // For 2D blocks Z==0 is accepted, but convert to 1
+ status = validate_block_size(block_x, block_y, block_z);
+ if (status != ASTCENC_SUCCESS)
+ {
+ return status;
+ }
+
+ config.block_x = block_x;
+ config.block_y = block_y;
+ config.block_z = block_z;
+
+ float texels = static_cast<float>(block_x * block_y * block_z);
+ float ltexels = logf(texels) / logf(10.0f);
+
+ // Process the performance quality level or preset; note that this must be done before we
+ // process any additional settings, such as color profile and flags, which may replace some of
+ // these settings with more use case tuned values
+ if (quality < ASTCENC_PRE_FASTEST ||
+ quality > ASTCENC_PRE_EXHAUSTIVE)
+ {
+ return ASTCENC_ERR_BAD_QUALITY;
+ }
+
+ static const std::array<astcenc_preset_config, 6>* preset_configs;
+ int texels_int = block_x * block_y * block_z;
+ if (texels_int < 25)
+ {
+ preset_configs = &preset_configs_high;
+ }
+ else if (texels_int < 64)
+ {
+ preset_configs = &preset_configs_mid;
+ }
+ else
+ {
+ preset_configs = &preset_configs_low;
+ }
+
+ // Determine which preset to use, or which pair to interpolate
+ size_t start;
+ size_t end;
+ for (end = 0; end < preset_configs->size(); end++)
+ {
+ if ((*preset_configs)[end].quality >= quality)
+ {
+ break;
+ }
+ }
+
+ start = end == 0 ? 0 : end - 1;
+
+ // Start and end node are the same - so just transfer the values.
+ if (start == end)
+ {
+ config.tune_partition_count_limit = (*preset_configs)[start].tune_partition_count_limit;
+ config.tune_2partition_index_limit = (*preset_configs)[start].tune_2partition_index_limit;
+ config.tune_3partition_index_limit = (*preset_configs)[start].tune_3partition_index_limit;
+ config.tune_4partition_index_limit = (*preset_configs)[start].tune_4partition_index_limit;
+ config.tune_block_mode_limit = (*preset_configs)[start].tune_block_mode_limit;
+ config.tune_refinement_limit = (*preset_configs)[start].tune_refinement_limit;
+ config.tune_candidate_limit = astc::min((*preset_configs)[start].tune_candidate_limit, TUNE_MAX_TRIAL_CANDIDATES);
+ config.tune_2partitioning_candidate_limit = astc::min((*preset_configs)[start].tune_2partitioning_candidate_limit, TUNE_MAX_PARTITIONING_CANDIDATES);
+ config.tune_3partitioning_candidate_limit = astc::min((*preset_configs)[start].tune_3partitioning_candidate_limit, TUNE_MAX_PARTITIONING_CANDIDATES);
+ config.tune_4partitioning_candidate_limit = astc::min((*preset_configs)[start].tune_4partitioning_candidate_limit, TUNE_MAX_PARTITIONING_CANDIDATES);
+ config.tune_db_limit = astc::max((*preset_configs)[start].tune_db_limit_a_base - 35 * ltexels,
+ (*preset_configs)[start].tune_db_limit_b_base - 19 * ltexels);
+
+ config.tune_mse_overshoot = (*preset_configs)[start].tune_mse_overshoot;
+
+ config.tune_2_partition_early_out_limit_factor = (*preset_configs)[start].tune_2_partition_early_out_limit_factor;
+ config.tune_3_partition_early_out_limit_factor =(*preset_configs)[start].tune_3_partition_early_out_limit_factor;
+ config.tune_2_plane_early_out_limit_correlation = (*preset_configs)[start].tune_2_plane_early_out_limit_correlation;
+ }
+ // Start and end node are not the same - so interpolate between them
+ else
+ {
+ auto& node_a = (*preset_configs)[start];
+ auto& node_b = (*preset_configs)[end];
+
+ float wt_range = node_b.quality - node_a.quality;
+ assert(wt_range > 0);
+
+ // Compute interpolation factors
+ float wt_node_a = (node_b.quality - quality) / wt_range;
+ float wt_node_b = (quality - node_a.quality) / wt_range;
+
+ #define LERP(param) ((node_a.param * wt_node_a) + (node_b.param * wt_node_b))
+ #define LERPI(param) astc::flt2int_rtn(\
+ (static_cast<float>(node_a.param) * wt_node_a) + \
+ (static_cast<float>(node_b.param) * wt_node_b))
+ #define LERPUI(param) static_cast<unsigned int>(LERPI(param))
+
+ config.tune_partition_count_limit = LERPI(tune_partition_count_limit);
+ config.tune_2partition_index_limit = LERPI(tune_2partition_index_limit);
+ config.tune_3partition_index_limit = LERPI(tune_3partition_index_limit);
+ config.tune_4partition_index_limit = LERPI(tune_4partition_index_limit);
+ config.tune_block_mode_limit = LERPI(tune_block_mode_limit);
+ config.tune_refinement_limit = LERPI(tune_refinement_limit);
+ config.tune_candidate_limit = astc::min(LERPUI(tune_candidate_limit),
+ TUNE_MAX_TRIAL_CANDIDATES);
+ config.tune_2partitioning_candidate_limit = astc::min(LERPUI(tune_2partitioning_candidate_limit),
+ BLOCK_MAX_PARTITIONINGS);
+ config.tune_3partitioning_candidate_limit = astc::min(LERPUI(tune_3partitioning_candidate_limit),
+ BLOCK_MAX_PARTITIONINGS);
+ config.tune_4partitioning_candidate_limit = astc::min(LERPUI(tune_4partitioning_candidate_limit),
+ BLOCK_MAX_PARTITIONINGS);
+ config.tune_db_limit = astc::max(LERP(tune_db_limit_a_base) - 35 * ltexels,
+ LERP(tune_db_limit_b_base) - 19 * ltexels);
+
+ config.tune_mse_overshoot = LERP(tune_mse_overshoot);
+
+ config.tune_2_partition_early_out_limit_factor = LERP(tune_2_partition_early_out_limit_factor);
+ config.tune_3_partition_early_out_limit_factor = LERP(tune_3_partition_early_out_limit_factor);
+ config.tune_2_plane_early_out_limit_correlation = LERP(tune_2_plane_early_out_limit_correlation);
+ #undef LERP
+ #undef LERPI
+ #undef LERPUI
+ }
+
+ // Set heuristics to the defaults for each color profile
+ config.cw_r_weight = 1.0f;
+ config.cw_g_weight = 1.0f;
+ config.cw_b_weight = 1.0f;
+ config.cw_a_weight = 1.0f;
+
+ config.a_scale_radius = 0;
+
+ config.rgbm_m_scale = 0.0f;
+
+ config.profile = profile;
+
+ // Values in this enum are from an external user, so not guaranteed to be
+ // bounded to the enum values
+ switch (static_cast<int>(profile))
+ {
+ case ASTCENC_PRF_LDR:
+ case ASTCENC_PRF_LDR_SRGB:
+ break;
+ case ASTCENC_PRF_HDR_RGB_LDR_A:
+ case ASTCENC_PRF_HDR:
+ config.tune_db_limit = 999.0f;
+ break;
+ default:
+ return ASTCENC_ERR_BAD_PROFILE;
+ }
+
+ // Flags field must not contain any unknown flag bits
+ status = validate_flags(flags);
+ if (status != ASTCENC_SUCCESS)
+ {
+ return status;
+ }
+
+ if (flags & ASTCENC_FLG_MAP_NORMAL)
+ {
+ // Normal map encoding uses L+A blocks, so allow one more partitioning
+ // than normal. We need need fewer bits for endpoints, so more likely
+ // to be able to use more partitions than an RGB/RGBA block
+ config.tune_partition_count_limit = astc::min(config.tune_partition_count_limit + 1u, 4u);
+
+ config.cw_g_weight = 0.0f;
+ config.cw_b_weight = 0.0f;
+ config.tune_2_partition_early_out_limit_factor *= 1.5f;
+ config.tune_3_partition_early_out_limit_factor *= 1.5f;
+ config.tune_2_plane_early_out_limit_correlation = 0.99f;
+
+ // Normals are prone to blocking artifacts on smooth curves
+ // so force compressor to try harder here ...
+ config.tune_db_limit *= 1.03f;
+ }
+ else if (flags & ASTCENC_FLG_MAP_RGBM)
+ {
+ config.rgbm_m_scale = 5.0f;
+ config.cw_a_weight = 2.0f * config.rgbm_m_scale;
+ }
+ else // (This is color data)
+ {
+ // This is a very basic perceptual metric for RGB color data, which weights error
+ // significance by the perceptual luminance contribution of each color channel. For
+ // luminance the usual weights to compute luminance from a linear RGB value are as
+ // follows:
+ //
+ // l = r * 0.3 + g * 0.59 + b * 0.11
+ //
+ // ... but we scale these up to keep a better balance between color and alpha. Note
+ // that if the content is using alpha we'd recommend using the -a option to weight
+ // the color contribution by the alpha transparency.
+ if (flags & ASTCENC_FLG_USE_PERCEPTUAL)
+ {
+ config.cw_r_weight = 0.30f * 2.25f;
+ config.cw_g_weight = 0.59f * 2.25f;
+ config.cw_b_weight = 0.11f * 2.25f;
+ }
+ }
+ config.flags = flags;
+
+ return ASTCENC_SUCCESS;
+}
+
+/* See header for documentation. */
+astcenc_error astcenc_context_alloc(
+ const astcenc_config* configp,
+ unsigned int thread_count,
+ astcenc_context** context
+) {
+ astcenc_error status;
+ const astcenc_config& config = *configp;
+
+ status = validate_cpu_isa();
+ if (status != ASTCENC_SUCCESS)
+ {
+ return status;
+ }
+
+ status = validate_cpu_float();
+ if (status != ASTCENC_SUCCESS)
+ {
+ return status;
+ }
+
+ if (thread_count == 0)
+ {
+ return ASTCENC_ERR_BAD_PARAM;
+ }
+
+#if defined(ASTCENC_DIAGNOSTICS)
+ // Force single threaded compressor use in diagnostic mode.
+ if (thread_count != 1)
+ {
+ return ASTCENC_ERR_BAD_PARAM;
+ }
+#endif
+
+ astcenc_context* ctxo = new astcenc_context;
+ astcenc_contexti* ctx = &ctxo->context;
+ ctx->thread_count = thread_count;
+ ctx->config = config;
+ ctx->working_buffers = nullptr;
+
+ // These are allocated per-compress, as they depend on image size
+ ctx->input_alpha_averages = nullptr;
+
+ // Copy the config first and validate the copy (we may modify it)
+ status = validate_config(ctx->config);
+ if (status != ASTCENC_SUCCESS)
+ {
+ delete ctxo;
+ return status;
+ }
+
+ ctx->bsd = aligned_malloc<block_size_descriptor>(sizeof(block_size_descriptor), ASTCENC_VECALIGN);
+ bool can_omit_modes = static_cast<bool>(config.flags & ASTCENC_FLG_SELF_DECOMPRESS_ONLY);
+ init_block_size_descriptor(config.block_x, config.block_y, config.block_z,
+ can_omit_modes,
+ config.tune_partition_count_limit,
+ static_cast<float>(config.tune_block_mode_limit) / 100.0f,
+ *ctx->bsd);
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+ // Do setup only needed by compression
+ if (!(status & ASTCENC_FLG_DECOMPRESS_ONLY))
+ {
+ // Turn a dB limit into a per-texel error for faster use later
+ if ((ctx->config.profile == ASTCENC_PRF_LDR) || (ctx->config.profile == ASTCENC_PRF_LDR_SRGB))
+ {
+ ctx->config.tune_db_limit = astc::pow(0.1f, ctx->config.tune_db_limit * 0.1f) * 65535.0f * 65535.0f;
+ }
+ else
+ {
+ ctx->config.tune_db_limit = 0.0f;
+ }
+
+ size_t worksize = sizeof(compression_working_buffers) * thread_count;
+ ctx->working_buffers = aligned_malloc<compression_working_buffers>(worksize, ASTCENC_VECALIGN);
+ static_assert((sizeof(compression_working_buffers) % ASTCENC_VECALIGN) == 0,
+ "compression_working_buffers size must be multiple of vector alignment");
+ if (!ctx->working_buffers)
+ {
+ aligned_free<block_size_descriptor>(ctx->bsd);
+ delete ctxo;
+ *context = nullptr;
+ return ASTCENC_ERR_OUT_OF_MEM;
+ }
+ }
+#endif
+
+#if defined(ASTCENC_DIAGNOSTICS)
+ ctx->trace_log = new TraceLog(ctx->config.trace_file_path);
+ if (!ctx->trace_log->m_file)
+ {
+ return ASTCENC_ERR_DTRACE_FAILURE;
+ }
+
+ trace_add_data("block_x", config.block_x);
+ trace_add_data("block_y", config.block_y);
+ trace_add_data("block_z", config.block_z);
+#endif
+
+ *context = ctxo;
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+ prepare_angular_tables();
+#endif
+
+ return ASTCENC_SUCCESS;
+}
+
+/* See header dor documentation. */
+void astcenc_context_free(
+ astcenc_context* ctxo
+) {
+ if (ctxo)
+ {
+ astcenc_contexti* ctx = &ctxo->context;
+ aligned_free<compression_working_buffers>(ctx->working_buffers);
+ aligned_free<block_size_descriptor>(ctx->bsd);
+#if defined(ASTCENC_DIAGNOSTICS)
+ delete ctx->trace_log;
+#endif
+ delete ctxo;
+ }
+}
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+
+/**
+ * @brief Compress an image, after any preflight has completed.
+ *
+ * @param[out] ctxo The compressor context.
+ * @param thread_index The thread index.
+ * @param image The intput image.
+ * @param swizzle The input swizzle.
+ * @param[out] buffer The output array for the compressed data.
+ */
+static void compress_image(
+ astcenc_context& ctxo,
+ unsigned int thread_index,
+ const astcenc_image& image,
+ const astcenc_swizzle& swizzle,
+ uint8_t* buffer
+) {
+ astcenc_contexti& ctx = ctxo.context;
+ const block_size_descriptor& bsd = *ctx.bsd;
+ astcenc_profile decode_mode = ctx.config.profile;
+
+ image_block blk;
+
+ int block_x = bsd.xdim;
+ int block_y = bsd.ydim;
+ int block_z = bsd.zdim;
+ blk.texel_count = static_cast<uint8_t>(block_x * block_y * block_z);
+
+ int dim_x = image.dim_x;
+ int dim_y = image.dim_y;
+ int dim_z = image.dim_z;
+
+ int xblocks = (dim_x + block_x - 1) / block_x;
+ int yblocks = (dim_y + block_y - 1) / block_y;
+ int zblocks = (dim_z + block_z - 1) / block_z;
+ int block_count = zblocks * yblocks * xblocks;
+
+ int row_blocks = xblocks;
+ int plane_blocks = xblocks * yblocks;
+
+ // Populate the block channel weights
+ blk.channel_weight = vfloat4(ctx.config.cw_r_weight,
+ ctx.config.cw_g_weight,
+ ctx.config.cw_b_weight,
+ ctx.config.cw_a_weight);
+
+ // Use preallocated scratch buffer
+ auto& temp_buffers = ctx.working_buffers[thread_index];
+
+ // Only the first thread actually runs the initializer
+ ctxo.manage_compress.init(block_count);
+
+ // Determine if we can use an optimized load function
+ bool needs_swz = (swizzle.r != ASTCENC_SWZ_R) || (swizzle.g != ASTCENC_SWZ_G) ||
+ (swizzle.b != ASTCENC_SWZ_B) || (swizzle.a != ASTCENC_SWZ_A);
+
+ bool needs_hdr = (decode_mode == ASTCENC_PRF_HDR) ||
+ (decode_mode == ASTCENC_PRF_HDR_RGB_LDR_A);
+
+ bool use_fast_load = !needs_swz && !needs_hdr &&
+ block_z == 1 && image.data_type == ASTCENC_TYPE_U8;
+
+ auto load_func = load_image_block;
+ if (use_fast_load)
+ {
+ load_func = load_image_block_fast_ldr;
+ }
+
+ // All threads run this processing loop until there is no work remaining
+ while (true)
+ {
+ unsigned int count;
+ unsigned int base = ctxo.manage_compress.get_task_assignment(16, count);
+ if (!count)
+ {
+ break;
+ }
+
+ for (unsigned int i = base; i < base + count; i++)
+ {
+ // Decode i into x, y, z block indices
+ int z = i / plane_blocks;
+ unsigned int rem = i - (z * plane_blocks);
+ int y = rem / row_blocks;
+ int x = rem - (y * row_blocks);
+
+ // Test if we can apply some basic alpha-scale RDO
+ bool use_full_block = true;
+ if (ctx.config.a_scale_radius != 0 && block_z == 1)
+ {
+ int start_x = x * block_x;
+ int end_x = astc::min(dim_x, start_x + block_x);
+
+ int start_y = y * block_y;
+ int end_y = astc::min(dim_y, start_y + block_y);
+
+ // SATs accumulate error, so don't test exactly zero. Test for
+ // less than 1 alpha in the expanded block footprint that
+ // includes the alpha radius.
+ int x_footprint = block_x + 2 * (ctx.config.a_scale_radius - 1);
+
+ int y_footprint = block_y + 2 * (ctx.config.a_scale_radius - 1);
+
+ float footprint = static_cast<float>(x_footprint * y_footprint);
+ float threshold = 0.9f / (255.0f * footprint);
+
+ // Do we have any alpha values?
+ use_full_block = false;
+ for (int ay = start_y; ay < end_y; ay++)
+ {
+ for (int ax = start_x; ax < end_x; ax++)
+ {
+ float a_avg = ctx.input_alpha_averages[ay * dim_x + ax];
+ if (a_avg > threshold)
+ {
+ use_full_block = true;
+ ax = end_x;
+ ay = end_y;
+ }
+ }
+ }
+ }
+
+ // Fetch the full block for compression
+ if (use_full_block)
+ {
+ load_func(decode_mode, image, blk, bsd, x * block_x, y * block_y, z * block_z, swizzle);
+
+ // Scale RGB error contribution by the maximum alpha in the block
+ // This encourages preserving alpha accuracy in regions with high
+ // transparency, and can buy up to 0.5 dB PSNR.
+ if (ctx.config.flags & ASTCENC_FLG_USE_ALPHA_WEIGHT)
+ {
+ float alpha_scale = blk.data_max.lane<3>() * (1.0f / 65535.0f);
+ blk.channel_weight = vfloat4(ctx.config.cw_r_weight * alpha_scale,
+ ctx.config.cw_g_weight * alpha_scale,
+ ctx.config.cw_b_weight * alpha_scale,
+ ctx.config.cw_a_weight);
+ }
+ }
+ // Apply alpha scale RDO - substitute constant color block
+ else
+ {
+ blk.origin_texel = vfloat4::zero();
+ blk.data_min = vfloat4::zero();
+ blk.data_mean = vfloat4::zero();
+ blk.data_max = vfloat4::zero();
+ blk.grayscale = true;
+ }
+
+ int offset = ((z * yblocks + y) * xblocks + x) * 16;
+ uint8_t *bp = buffer + offset;
+ physical_compressed_block* pcb = reinterpret_cast<physical_compressed_block*>(bp);
+ compress_block(ctx, blk, *pcb, temp_buffers);
+ }
+
+ ctxo.manage_compress.complete_task_assignment(count);
+ }
+}
+
+/**
+ * @brief Compute regional averages in an image.
+ *
+ * This function can be called by multiple threads, but only after a single
+ * thread calls the setup function @c init_compute_averages().
+ *
+ * Results are written back into @c img->input_alpha_averages.
+ *
+ * @param[out] ctx The context.
+ * @param ag The average and variance arguments created during setup.
+ */
+static void compute_averages(
+ astcenc_context& ctx,
+ const avg_args &ag
+) {
+ pixel_region_args arg = ag.arg;
+ arg.work_memory = new vfloat4[ag.work_memory_size];
+
+ int size_x = ag.img_size_x;
+ int size_y = ag.img_size_y;
+ int size_z = ag.img_size_z;
+
+ int step_xy = ag.blk_size_xy;
+ int step_z = ag.blk_size_z;
+
+ int y_tasks = (size_y + step_xy - 1) / step_xy;
+
+ // All threads run this processing loop until there is no work remaining
+ while (true)
+ {
+ unsigned int count;
+ unsigned int base = ctx.manage_avg.get_task_assignment(16, count);
+ if (!count)
+ {
+ break;
+ }
+
+ for (unsigned int i = base; i < base + count; i++)
+ {
+ int z = (i / (y_tasks)) * step_z;
+ int y = (i - (z * y_tasks)) * step_xy;
+
+ arg.size_z = astc::min(step_z, size_z - z);
+ arg.offset_z = z;
+
+ arg.size_y = astc::min(step_xy, size_y - y);
+ arg.offset_y = y;
+
+ for (int x = 0; x < size_x; x += step_xy)
+ {
+ arg.size_x = astc::min(step_xy, size_x - x);
+ arg.offset_x = x;
+ compute_pixel_region_variance(ctx.context, arg);
+ }
+ }
+
+ ctx.manage_avg.complete_task_assignment(count);
+ }
+
+ delete[] arg.work_memory;
+}
+
+#endif
+
+/* See header for documentation. */
+astcenc_error astcenc_compress_image(
+ astcenc_context* ctxo,
+ astcenc_image* imagep,
+ const astcenc_swizzle* swizzle,
+ uint8_t* data_out,
+ size_t data_len,
+ unsigned int thread_index
+) {
+#if defined(ASTCENC_DECOMPRESS_ONLY)
+ (void)ctxo;
+ (void)imagep;
+ (void)swizzle;
+ (void)data_out;
+ (void)data_len;
+ (void)thread_index;
+ return ASTCENC_ERR_BAD_CONTEXT;
+#else
+ astcenc_contexti* ctx = &ctxo->context;
+ astcenc_error status;
+ astcenc_image& image = *imagep;
+
+ if (ctx->config.flags & ASTCENC_FLG_DECOMPRESS_ONLY)
+ {
+ return ASTCENC_ERR_BAD_CONTEXT;
+ }
+
+ status = validate_compression_swizzle(*swizzle);
+ if (status != ASTCENC_SUCCESS)
+ {
+ return status;
+ }
+
+ if (thread_index >= ctx->thread_count)
+ {
+ return ASTCENC_ERR_BAD_PARAM;
+ }
+
+ unsigned int block_x = ctx->config.block_x;
+ unsigned int block_y = ctx->config.block_y;
+ unsigned int block_z = ctx->config.block_z;
+
+ unsigned int xblocks = (image.dim_x + block_x - 1) / block_x;
+ unsigned int yblocks = (image.dim_y + block_y - 1) / block_y;
+ unsigned int zblocks = (image.dim_z + block_z - 1) / block_z;
+
+ // Check we have enough output space (16 bytes per block)
+ size_t size_needed = xblocks * yblocks * zblocks * 16;
+ if (data_len < size_needed)
+ {
+ return ASTCENC_ERR_OUT_OF_MEM;
+ }
+
+ // If context thread count is one then implicitly reset
+ if (ctx->thread_count == 1)
+ {
+ astcenc_compress_reset(ctxo);
+ }
+
+ if (ctx->config.a_scale_radius != 0)
+ {
+ // First thread to enter will do setup, other threads will subsequently
+ // enter the critical section but simply skip over the initialization
+ auto init_avg = [ctx, &image, swizzle]() {
+ // Perform memory allocations for the destination buffers
+ size_t texel_count = image.dim_x * image.dim_y * image.dim_z;
+ ctx->input_alpha_averages = new float[texel_count];
+
+ return init_compute_averages(
+ image, ctx->config.a_scale_radius, *swizzle,
+ ctx->avg_preprocess_args);
+ };
+
+ // Only the first thread actually runs the initializer
+ ctxo->manage_avg.init(init_avg);
+
+ // All threads will enter this function and dynamically grab work
+ compute_averages(*ctxo, ctx->avg_preprocess_args);
+ }
+
+ // Wait for compute_averages to complete before compressing
+ ctxo->manage_avg.wait();
+
+ compress_image(*ctxo, thread_index, image, *swizzle, data_out);
+
+ // Wait for compress to complete before freeing memory
+ ctxo->manage_compress.wait();
+
+ auto term_compress = [ctx]() {
+ delete[] ctx->input_alpha_averages;
+ ctx->input_alpha_averages = nullptr;
+ };
+
+ // Only the first thread to arrive actually runs the term
+ ctxo->manage_compress.term(term_compress);
+
+ return ASTCENC_SUCCESS;
+#endif
+}
+
+/* See header for documentation. */
+astcenc_error astcenc_compress_reset(
+ astcenc_context* ctxo
+) {
+#if defined(ASTCENC_DECOMPRESS_ONLY)
+ (void)ctxo;
+ return ASTCENC_ERR_BAD_CONTEXT;
+#else
+ astcenc_contexti* ctx = &ctxo->context;
+ if (ctx->config.flags & ASTCENC_FLG_DECOMPRESS_ONLY)
+ {
+ return ASTCENC_ERR_BAD_CONTEXT;
+ }
+
+ ctxo->manage_avg.reset();
+ ctxo->manage_compress.reset();
+ return ASTCENC_SUCCESS;
+#endif
+}
+
+/* See header for documentation. */
+astcenc_error astcenc_decompress_image(
+ astcenc_context* ctxo,
+ const uint8_t* data,
+ size_t data_len,
+ astcenc_image* image_outp,
+ const astcenc_swizzle* swizzle,
+ unsigned int thread_index
+) {
+ astcenc_error status;
+ astcenc_image& image_out = *image_outp;
+ astcenc_contexti* ctx = &ctxo->context;
+
+ // Today this doesn't matter (working set on stack) but might in future ...
+ if (thread_index >= ctx->thread_count)
+ {
+ return ASTCENC_ERR_BAD_PARAM;
+ }
+
+ status = validate_decompression_swizzle(*swizzle);
+ if (status != ASTCENC_SUCCESS)
+ {
+ return status;
+ }
+
+ unsigned int block_x = ctx->config.block_x;
+ unsigned int block_y = ctx->config.block_y;
+ unsigned int block_z = ctx->config.block_z;
+
+ unsigned int xblocks = (image_out.dim_x + block_x - 1) / block_x;
+ unsigned int yblocks = (image_out.dim_y + block_y - 1) / block_y;
+ unsigned int zblocks = (image_out.dim_z + block_z - 1) / block_z;
+
+ int row_blocks = xblocks;
+ int plane_blocks = xblocks * yblocks;
+
+ // Check we have enough output space (16 bytes per block)
+ size_t size_needed = xblocks * yblocks * zblocks * 16;
+ if (data_len < size_needed)
+ {
+ return ASTCENC_ERR_OUT_OF_MEM;
+ }
+
+ image_block blk;
+ blk.texel_count = static_cast<uint8_t>(block_x * block_y * block_z);
+
+ // If context thread count is one then implicitly reset
+ if (ctx->thread_count == 1)
+ {
+ astcenc_decompress_reset(ctxo);
+ }
+
+ // Only the first thread actually runs the initializer
+ ctxo->manage_decompress.init(zblocks * yblocks * xblocks);
+
+ // All threads run this processing loop until there is no work remaining
+ while (true)
+ {
+ unsigned int count;
+ unsigned int base = ctxo->manage_decompress.get_task_assignment(128, count);
+ if (!count)
+ {
+ break;
+ }
+
+ for (unsigned int i = base; i < base + count; i++)
+ {
+ // Decode i into x, y, z block indices
+ int z = i / plane_blocks;
+ unsigned int rem = i - (z * plane_blocks);
+ int y = rem / row_blocks;
+ int x = rem - (y * row_blocks);
+
+ unsigned int offset = (((z * yblocks + y) * xblocks) + x) * 16;
+ const uint8_t* bp = data + offset;
+
+ const physical_compressed_block& pcb = *reinterpret_cast<const physical_compressed_block*>(bp);
+ symbolic_compressed_block scb;
+
+ physical_to_symbolic(*ctx->bsd, pcb, scb);
+
+ decompress_symbolic_block(ctx->config.profile, *ctx->bsd,
+ x * block_x, y * block_y, z * block_z,
+ scb, blk);
+
+ store_image_block(image_out, blk, *ctx->bsd,
+ x * block_x, y * block_y, z * block_z, *swizzle);
+ }
+
+ ctxo->manage_decompress.complete_task_assignment(count);
+ }
+
+ return ASTCENC_SUCCESS;
+}
+
+/* See header for documentation. */
+astcenc_error astcenc_decompress_reset(
+ astcenc_context* ctxo
+) {
+ ctxo->manage_decompress.reset();
+ return ASTCENC_SUCCESS;
+}
+
+/* See header for documentation. */
+astcenc_error astcenc_get_block_info(
+ astcenc_context* ctxo,
+ const uint8_t data[16],
+ astcenc_block_info* info
+) {
+#if defined(ASTCENC_DECOMPRESS_ONLY)
+ (void)ctxo;
+ (void)data;
+ (void)info;
+ return ASTCENC_ERR_BAD_CONTEXT;
+#else
+ astcenc_contexti* ctx = &ctxo->context;
+
+ // Decode the compressed data into a symbolic form
+ const physical_compressed_block&pcb = *reinterpret_cast<const physical_compressed_block*>(data);
+ symbolic_compressed_block scb;
+ physical_to_symbolic(*ctx->bsd, pcb, scb);
+
+ // Fetch the appropriate partition and decimation tables
+ block_size_descriptor& bsd = *ctx->bsd;
+
+ // Start from a clean slate
+ memset(info, 0, sizeof(*info));
+
+ // Basic info we can always populate
+ info->profile = ctx->config.profile;
+
+ info->block_x = ctx->config.block_x;
+ info->block_y = ctx->config.block_y;
+ info->block_z = ctx->config.block_z;
+ info->texel_count = bsd.texel_count;
+
+ // Check for error blocks first
+ info->is_error_block = scb.block_type == SYM_BTYPE_ERROR;
+ if (info->is_error_block)
+ {
+ return ASTCENC_SUCCESS;
+ }
+
+ // Check for constant color blocks second
+ info->is_constant_block = scb.block_type == SYM_BTYPE_CONST_F16 ||
+ scb.block_type == SYM_BTYPE_CONST_U16;
+ if (info->is_constant_block)
+ {
+ return ASTCENC_SUCCESS;
+ }
+
+ // Otherwise handle a full block ; known to be valid after conditions above have been checked
+ int partition_count = scb.partition_count;
+ const auto& pi = bsd.get_partition_info(partition_count, scb.partition_index);
+
+ const block_mode& bm = bsd.get_block_mode(scb.block_mode);
+ const decimation_info& di = bsd.get_decimation_info(bm.decimation_mode);
+
+ info->weight_x = di.weight_x;
+ info->weight_y = di.weight_y;
+ info->weight_z = di.weight_z;
+
+ info->is_dual_plane_block = bm.is_dual_plane != 0;
+
+ info->partition_count = scb.partition_count;
+ info->partition_index = scb.partition_index;
+ info->dual_plane_component = scb.plane2_component;
+
+ info->color_level_count = get_quant_level(scb.get_color_quant_mode());
+ info->weight_level_count = get_quant_level(bm.get_weight_quant_mode());
+
+ // Unpack color endpoints for each active partition
+ for (unsigned int i = 0; i < scb.partition_count; i++)
+ {
+ bool rgb_hdr;
+ bool a_hdr;
+ vint4 endpnt[2];
+
+ unpack_color_endpoints(ctx->config.profile,
+ scb.color_formats[i],
+ scb.color_values[i],
+ rgb_hdr, a_hdr,
+ endpnt[0], endpnt[1]);
+
+ // Store the color endpoint mode info
+ info->color_endpoint_modes[i] = scb.color_formats[i];
+ info->is_hdr_block = info->is_hdr_block || rgb_hdr || a_hdr;
+
+ // Store the unpacked and decoded color endpoint
+ vmask4 hdr_mask(rgb_hdr, rgb_hdr, rgb_hdr, a_hdr);
+ for (int j = 0; j < 2; j++)
+ {
+ vint4 color_lns = lns_to_sf16(endpnt[j]);
+ vint4 color_unorm = unorm16_to_sf16(endpnt[j]);
+ vint4 datai = select(color_unorm, color_lns, hdr_mask);
+ store(float16_to_float(datai), info->color_endpoints[i][j]);
+ }
+ }
+
+ // Unpack weights for each texel
+ int weight_plane1[BLOCK_MAX_TEXELS];
+ int weight_plane2[BLOCK_MAX_TEXELS];
+
+ unpack_weights(bsd, scb, di, bm.is_dual_plane, weight_plane1, weight_plane2);
+ for (unsigned int i = 0; i < bsd.texel_count; i++)
+ {
+ info->weight_values_plane1[i] = static_cast<float>(weight_plane1[i]) * (1.0f / WEIGHTS_TEXEL_SUM);
+ if (info->is_dual_plane_block)
+ {
+ info->weight_values_plane2[i] = static_cast<float>(weight_plane2[i]) * (1.0f / WEIGHTS_TEXEL_SUM);
+ }
+ }
+
+ // Unpack partition assignments for each texel
+ for (unsigned int i = 0; i < bsd.texel_count; i++)
+ {
+ info->partition_assignment[i] = pi.partition_of_texel[i];
+ }
+
+ return ASTCENC_SUCCESS;
+#endif
+}
+
+/* See header for documentation. */
+const char* astcenc_get_error_string(
+ astcenc_error status
+) {
+ // Values in this enum are from an external user, so not guaranteed to be
+ // bounded to the enum values
+ switch (static_cast<int>(status))
+ {
+ case ASTCENC_SUCCESS:
+ return "ASTCENC_SUCCESS";
+ case ASTCENC_ERR_OUT_OF_MEM:
+ return "ASTCENC_ERR_OUT_OF_MEM";
+ case ASTCENC_ERR_BAD_CPU_FLOAT:
+ return "ASTCENC_ERR_BAD_CPU_FLOAT";
+ case ASTCENC_ERR_BAD_CPU_ISA:
+ return "ASTCENC_ERR_BAD_CPU_ISA";
+ case ASTCENC_ERR_BAD_PARAM:
+ return "ASTCENC_ERR_BAD_PARAM";
+ case ASTCENC_ERR_BAD_BLOCK_SIZE:
+ return "ASTCENC_ERR_BAD_BLOCK_SIZE";
+ case ASTCENC_ERR_BAD_PROFILE:
+ return "ASTCENC_ERR_BAD_PROFILE";
+ case ASTCENC_ERR_BAD_QUALITY:
+ return "ASTCENC_ERR_BAD_QUALITY";
+ case ASTCENC_ERR_BAD_FLAGS:
+ return "ASTCENC_ERR_BAD_FLAGS";
+ case ASTCENC_ERR_BAD_SWIZZLE:
+ return "ASTCENC_ERR_BAD_SWIZZLE";
+ case ASTCENC_ERR_BAD_CONTEXT:
+ return "ASTCENC_ERR_BAD_CONTEXT";
+ case ASTCENC_ERR_NOT_IMPLEMENTED:
+ return "ASTCENC_ERR_NOT_IMPLEMENTED";
+#if defined(ASTCENC_DIAGNOSTICS)
+ case ASTCENC_ERR_DTRACE_FAILURE:
+ return "ASTCENC_ERR_DTRACE_FAILURE";
+#endif
+ default:
+ return nullptr;
+ }
+}
diff --git a/thirdparty/astcenc/astcenc_find_best_partitioning.cpp b/thirdparty/astcenc/astcenc_find_best_partitioning.cpp
new file mode 100644
index 0000000000..ffde3c7060
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_find_best_partitioning.cpp
@@ -0,0 +1,780 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2023 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+
+/**
+ * @brief Functions for finding best partition for a block.
+ *
+ * The partition search operates in two stages. The first pass uses kmeans clustering to group
+ * texels into an ideal partitioning for the requested partition count, and then compares that
+ * against the 1024 partitionings generated by the ASTC partition hash function. The generated
+ * partitions are then ranked by the number of texels in the wrong partition, compared to the ideal
+ * clustering. All 1024 partitions are tested for similarity and ranked, apart from duplicates and
+ * partitionings that actually generate fewer than the requested partition count, but only the top
+ * N candidates are actually put through a more detailed search. N is determined by the compressor
+ * quality preset.
+ *
+ * For the detailed search, each candidate is checked against two possible encoding methods:
+ *
+ * - The best partitioning assuming different chroma colors (RGB + RGB or RGB + delta endpoints).
+ * - The best partitioning assuming same chroma colors (RGB + scale endpoints).
+ *
+ * This is implemented by computing the compute mean color and dominant direction for each
+ * partition. This defines two lines, both of which go through the mean color value.
+ *
+ * - One line has a direction defined by the dominant direction; this is used to assess the error
+ * from using an uncorrelated color representation.
+ * - The other line goes through (0,0,0,1) and is used to assess the error from using a same chroma
+ * (RGB + scale) color representation.
+ *
+ * The best candidate is selected by computing the squared-errors that result from using these
+ * lines for endpoint selection.
+ */
+
+#include <limits>
+#include "astcenc_internal.h"
+
+/**
+ * @brief Pick some initial kmeans cluster centers.
+ *
+ * @param blk The image block color data to compress.
+ * @param texel_count The number of texels in the block.
+ * @param partition_count The number of partitions in the block.
+ * @param[out] cluster_centers The initial partition cluster center colors.
+ */
+static void kmeans_init(
+ const image_block& blk,
+ unsigned int texel_count,
+ unsigned int partition_count,
+ vfloat4 cluster_centers[BLOCK_MAX_PARTITIONS]
+) {
+ promise(texel_count > 0);
+ promise(partition_count > 0);
+
+ unsigned int clusters_selected = 0;
+ float distances[BLOCK_MAX_TEXELS];
+
+ // Pick a random sample as first cluster center; 145897 from random.org
+ unsigned int sample = 145897 % texel_count;
+ vfloat4 center_color = blk.texel(sample);
+ cluster_centers[clusters_selected] = center_color;
+ clusters_selected++;
+
+ // Compute the distance to the first cluster center
+ float distance_sum = 0.0f;
+ for (unsigned int i = 0; i < texel_count; i++)
+ {
+ vfloat4 color = blk.texel(i);
+ vfloat4 diff = color - center_color;
+ float distance = dot_s(diff * diff, blk.channel_weight);
+ distance_sum += distance;
+ distances[i] = distance;
+ }
+
+ // More numbers from random.org for weighted-random center selection
+ const float cluster_cutoffs[9] {
+ 0.626220f, 0.932770f, 0.275454f,
+ 0.318558f, 0.240113f, 0.009190f,
+ 0.347661f, 0.731960f, 0.156391f
+ };
+
+ unsigned int cutoff = (clusters_selected - 1) + 3 * (partition_count - 2);
+
+ // Pick the remaining samples as needed
+ while (true)
+ {
+ // Pick the next center in a weighted-random fashion.
+ float summa = 0.0f;
+ float distance_cutoff = distance_sum * cluster_cutoffs[cutoff++];
+ for (sample = 0; sample < texel_count; sample++)
+ {
+ summa += distances[sample];
+ if (summa >= distance_cutoff)
+ {
+ break;
+ }
+ }
+
+ // Clamp to a valid range and store the selected cluster center
+ sample = astc::min(sample, texel_count - 1);
+
+ center_color = blk.texel(sample);
+ cluster_centers[clusters_selected++] = center_color;
+ if (clusters_selected >= partition_count)
+ {
+ break;
+ }
+
+ // Compute the distance to the new cluster center, keep the min dist
+ distance_sum = 0.0f;
+ for (unsigned int i = 0; i < texel_count; i++)
+ {
+ vfloat4 color = blk.texel(i);
+ vfloat4 diff = color - center_color;
+ float distance = dot_s(diff * diff, blk.channel_weight);
+ distance = astc::min(distance, distances[i]);
+ distance_sum += distance;
+ distances[i] = distance;
+ }
+ }
+}
+
+/**
+ * @brief Assign texels to clusters, based on a set of chosen center points.
+ *
+ * @param blk The image block color data to compress.
+ * @param texel_count The number of texels in the block.
+ * @param partition_count The number of partitions in the block.
+ * @param cluster_centers The partition cluster center colors.
+ * @param[out] partition_of_texel The partition assigned for each texel.
+ */
+static void kmeans_assign(
+ const image_block& blk,
+ unsigned int texel_count,
+ unsigned int partition_count,
+ const vfloat4 cluster_centers[BLOCK_MAX_PARTITIONS],
+ uint8_t partition_of_texel[BLOCK_MAX_TEXELS]
+) {
+ promise(texel_count > 0);
+ promise(partition_count > 0);
+
+ uint8_t partition_texel_count[BLOCK_MAX_PARTITIONS] { 0 };
+
+ // Find the best partition for every texel
+ for (unsigned int i = 0; i < texel_count; i++)
+ {
+ float best_distance = std::numeric_limits<float>::max();
+ unsigned int best_partition = 0;
+
+ vfloat4 color = blk.texel(i);
+ for (unsigned int j = 0; j < partition_count; j++)
+ {
+ vfloat4 diff = color - cluster_centers[j];
+ float distance = dot_s(diff * diff, blk.channel_weight);
+ if (distance < best_distance)
+ {
+ best_distance = distance;
+ best_partition = j;
+ }
+ }
+
+ partition_of_texel[i] = static_cast<uint8_t>(best_partition);
+ partition_texel_count[best_partition]++;
+ }
+
+ // It is possible to get a situation where a partition ends up without any texels. In this case,
+ // assign texel N to partition N. This is silly, but ensures that every partition retains at
+ // least one texel. Reassigning a texel in this manner may cause another partition to go empty,
+ // so if we actually did a reassignment, run the whole loop over again.
+ bool problem_case;
+ do
+ {
+ problem_case = false;
+ for (unsigned int i = 0; i < partition_count; i++)
+ {
+ if (partition_texel_count[i] == 0)
+ {
+ partition_texel_count[partition_of_texel[i]]--;
+ partition_texel_count[i]++;
+ partition_of_texel[i] = static_cast<uint8_t>(i);
+ problem_case = true;
+ }
+ }
+ } while (problem_case);
+}
+
+/**
+ * @brief Compute new cluster centers based on their center of gravity.
+ *
+ * @param blk The image block color data to compress.
+ * @param texel_count The number of texels in the block.
+ * @param partition_count The number of partitions in the block.
+ * @param[out] cluster_centers The new cluster center colors.
+ * @param partition_of_texel The partition assigned for each texel.
+ */
+static void kmeans_update(
+ const image_block& blk,
+ unsigned int texel_count,
+ unsigned int partition_count,
+ vfloat4 cluster_centers[BLOCK_MAX_PARTITIONS],
+ const uint8_t partition_of_texel[BLOCK_MAX_TEXELS]
+) {
+ promise(texel_count > 0);
+ promise(partition_count > 0);
+
+ vfloat4 color_sum[BLOCK_MAX_PARTITIONS] {
+ vfloat4::zero(),
+ vfloat4::zero(),
+ vfloat4::zero(),
+ vfloat4::zero()
+ };
+
+ uint8_t partition_texel_count[BLOCK_MAX_PARTITIONS] { 0 };
+
+ // Find the center-of-gravity in each cluster
+ for (unsigned int i = 0; i < texel_count; i++)
+ {
+ uint8_t partition = partition_of_texel[i];
+ color_sum[partition] += blk.texel(i);
+ partition_texel_count[partition]++;
+ }
+
+ // Set the center of gravity to be the new cluster center
+ for (unsigned int i = 0; i < partition_count; i++)
+ {
+ float scale = 1.0f / static_cast<float>(partition_texel_count[i]);
+ cluster_centers[i] = color_sum[i] * scale;
+ }
+}
+
+/**
+ * @brief Compute bit-mismatch for partitioning in 2-partition mode.
+ *
+ * @param a The texel assignment bitvector for the block.
+ * @param b The texel assignment bitvector for the partition table.
+ *
+ * @return The number of bit mismatches.
+ */
+static inline unsigned int partition_mismatch2(
+ const uint64_t a[2],
+ const uint64_t b[2]
+) {
+ int v1 = popcount(a[0] ^ b[0]) + popcount(a[1] ^ b[1]);
+ int v2 = popcount(a[0] ^ b[1]) + popcount(a[1] ^ b[0]);
+ return astc::min(v1, v2);
+}
+
+/**
+ * @brief Compute bit-mismatch for partitioning in 3-partition mode.
+ *
+ * @param a The texel assignment bitvector for the block.
+ * @param b The texel assignment bitvector for the partition table.
+ *
+ * @return The number of bit mismatches.
+ */
+static inline unsigned int partition_mismatch3(
+ const uint64_t a[3],
+ const uint64_t b[3]
+) {
+ int p00 = popcount(a[0] ^ b[0]);
+ int p01 = popcount(a[0] ^ b[1]);
+ int p02 = popcount(a[0] ^ b[2]);
+
+ int p10 = popcount(a[1] ^ b[0]);
+ int p11 = popcount(a[1] ^ b[1]);
+ int p12 = popcount(a[1] ^ b[2]);
+
+ int p20 = popcount(a[2] ^ b[0]);
+ int p21 = popcount(a[2] ^ b[1]);
+ int p22 = popcount(a[2] ^ b[2]);
+
+ int s0 = p11 + p22;
+ int s1 = p12 + p21;
+ int v0 = astc::min(s0, s1) + p00;
+
+ int s2 = p10 + p22;
+ int s3 = p12 + p20;
+ int v1 = astc::min(s2, s3) + p01;
+
+ int s4 = p10 + p21;
+ int s5 = p11 + p20;
+ int v2 = astc::min(s4, s5) + p02;
+
+ return astc::min(v0, v1, v2);
+}
+
+/**
+ * @brief Compute bit-mismatch for partitioning in 4-partition mode.
+ *
+ * @param a The texel assignment bitvector for the block.
+ * @param b The texel assignment bitvector for the partition table.
+ *
+ * @return The number of bit mismatches.
+ */
+static inline unsigned int partition_mismatch4(
+ const uint64_t a[4],
+ const uint64_t b[4]
+) {
+ int p00 = popcount(a[0] ^ b[0]);
+ int p01 = popcount(a[0] ^ b[1]);
+ int p02 = popcount(a[0] ^ b[2]);
+ int p03 = popcount(a[0] ^ b[3]);
+
+ int p10 = popcount(a[1] ^ b[0]);
+ int p11 = popcount(a[1] ^ b[1]);
+ int p12 = popcount(a[1] ^ b[2]);
+ int p13 = popcount(a[1] ^ b[3]);
+
+ int p20 = popcount(a[2] ^ b[0]);
+ int p21 = popcount(a[2] ^ b[1]);
+ int p22 = popcount(a[2] ^ b[2]);
+ int p23 = popcount(a[2] ^ b[3]);
+
+ int p30 = popcount(a[3] ^ b[0]);
+ int p31 = popcount(a[3] ^ b[1]);
+ int p32 = popcount(a[3] ^ b[2]);
+ int p33 = popcount(a[3] ^ b[3]);
+
+ int mx23 = astc::min(p22 + p33, p23 + p32);
+ int mx13 = astc::min(p21 + p33, p23 + p31);
+ int mx12 = astc::min(p21 + p32, p22 + p31);
+ int mx03 = astc::min(p20 + p33, p23 + p30);
+ int mx02 = astc::min(p20 + p32, p22 + p30);
+ int mx01 = astc::min(p21 + p30, p20 + p31);
+
+ int v0 = p00 + astc::min(p11 + mx23, p12 + mx13, p13 + mx12);
+ int v1 = p01 + astc::min(p10 + mx23, p12 + mx03, p13 + mx02);
+ int v2 = p02 + astc::min(p11 + mx03, p10 + mx13, p13 + mx01);
+ int v3 = p03 + astc::min(p11 + mx02, p12 + mx01, p10 + mx12);
+
+ return astc::min(v0, v1, v2, v3);
+}
+
+using mismatch_dispatch = unsigned int (*)(const uint64_t*, const uint64_t*);
+
+/**
+ * @brief Count the partition table mismatches vs the data clustering.
+ *
+ * @param bsd The block size information.
+ * @param partition_count The number of partitions in the block.
+ * @param bitmaps The block texel partition assignment patterns.
+ * @param[out] mismatch_counts The array storing per partitioning mismatch counts.
+ */
+static void count_partition_mismatch_bits(
+ const block_size_descriptor& bsd,
+ unsigned int partition_count,
+ const uint64_t bitmaps[BLOCK_MAX_PARTITIONS],
+ unsigned int mismatch_counts[BLOCK_MAX_PARTITIONINGS]
+) {
+ unsigned int active_count = bsd.partitioning_count_selected[partition_count - 1];
+ promise(active_count > 0);
+
+ if (partition_count == 2)
+ {
+ for (unsigned int i = 0; i < active_count; i++)
+ {
+ mismatch_counts[i] = partition_mismatch2(bitmaps, bsd.coverage_bitmaps_2[i]);
+ }
+ }
+ else if (partition_count == 3)
+ {
+ for (unsigned int i = 0; i < active_count; i++)
+ {
+ mismatch_counts[i] = partition_mismatch3(bitmaps, bsd.coverage_bitmaps_3[i]);
+ }
+ }
+ else
+ {
+ for (unsigned int i = 0; i < active_count; i++)
+ {
+ mismatch_counts[i] = partition_mismatch4(bitmaps, bsd.coverage_bitmaps_4[i]);
+ }
+ }
+}
+
+/**
+ * @brief Use counting sort on the mismatch array to sort partition candidates.
+ *
+ * @param partitioning_count The number of packed partitionings.
+ * @param mismatch_count Partitioning mismatch counts, in index order.
+ * @param[out] partition_ordering Partition index values, in mismatch order.
+ *
+ * @return The number of active partitions in this selection.
+ */
+static unsigned int get_partition_ordering_by_mismatch_bits(
+ unsigned int partitioning_count,
+ const unsigned int mismatch_count[BLOCK_MAX_PARTITIONINGS],
+ unsigned int partition_ordering[BLOCK_MAX_PARTITIONINGS]
+) {
+ promise(partitioning_count > 0);
+ unsigned int mscount[256] { 0 };
+
+ // Create the histogram of mismatch counts
+ for (unsigned int i = 0; i < partitioning_count; i++)
+ {
+ mscount[mismatch_count[i]]++;
+ }
+
+ unsigned int active_count = partitioning_count - mscount[255];
+
+ // Create a running sum from the histogram array
+ // Cells store previous values only; i.e. exclude self after sum
+ unsigned int summa = 0;
+ for (unsigned int i = 0; i < 256; i++)
+ {
+ unsigned int cnt = mscount[i];
+ mscount[i] = summa;
+ summa += cnt;
+ }
+
+ // Use the running sum as the index, incrementing after read to allow
+ // sequential entries with the same count
+ for (unsigned int i = 0; i < partitioning_count; i++)
+ {
+ unsigned int idx = mscount[mismatch_count[i]]++;
+ partition_ordering[idx] = i;
+ }
+
+ return active_count;
+}
+
+/**
+ * @brief Use k-means clustering to compute a partition ordering for a block..
+ *
+ * @param bsd The block size information.
+ * @param blk The image block color data to compress.
+ * @param partition_count The desired number of partitions in the block.
+ * @param[out] partition_ordering The list of recommended partition indices, in priority order.
+ *
+ * @return The number of active partitionings in this selection.
+ */
+static unsigned int compute_kmeans_partition_ordering(
+ const block_size_descriptor& bsd,
+ const image_block& blk,
+ unsigned int partition_count,
+ unsigned int partition_ordering[BLOCK_MAX_PARTITIONINGS]
+) {
+ vfloat4 cluster_centers[BLOCK_MAX_PARTITIONS];
+ uint8_t texel_partitions[BLOCK_MAX_TEXELS];
+
+ // Use three passes of k-means clustering to partition the block data
+ for (unsigned int i = 0; i < 3; i++)
+ {
+ if (i == 0)
+ {
+ kmeans_init(blk, bsd.texel_count, partition_count, cluster_centers);
+ }
+ else
+ {
+ kmeans_update(blk, bsd.texel_count, partition_count, cluster_centers, texel_partitions);
+ }
+
+ kmeans_assign(blk, bsd.texel_count, partition_count, cluster_centers, texel_partitions);
+ }
+
+ // Construct the block bitmaps of texel assignments to each partition
+ uint64_t bitmaps[BLOCK_MAX_PARTITIONS] { 0 };
+ unsigned int texels_to_process = astc::min(bsd.texel_count, BLOCK_MAX_KMEANS_TEXELS);
+ promise(texels_to_process > 0);
+ for (unsigned int i = 0; i < texels_to_process; i++)
+ {
+ unsigned int idx = bsd.kmeans_texels[i];
+ bitmaps[texel_partitions[idx]] |= 1ULL << i;
+ }
+
+ // Count the mismatch between the block and the format's partition tables
+ unsigned int mismatch_counts[BLOCK_MAX_PARTITIONINGS];
+ count_partition_mismatch_bits(bsd, partition_count, bitmaps, mismatch_counts);
+
+ // Sort the partitions based on the number of mismatched bits
+ return get_partition_ordering_by_mismatch_bits(
+ bsd.partitioning_count_selected[partition_count - 1],
+ mismatch_counts, partition_ordering);
+}
+
+/**
+ * @brief Insert a partitioning into an order list of results, sorted by error.
+ *
+ * @param max_values The max number of entries in the best result arrays.
+ * @param this_error The error of the new entry.
+ * @param this_partition The partition ID of the new entry.
+ * @param[out] best_errors The array of best error values.
+ * @param[out] best_partitions The array of best partition values.
+ */
+static void insert_result(
+ unsigned int max_values,
+ float this_error,
+ unsigned int this_partition,
+ float* best_errors,
+ unsigned int* best_partitions)
+{
+ promise(max_values > 0);
+
+ // Don't bother searching if the current worst error beats the new error
+ if (this_error >= best_errors[max_values - 1])
+ {
+ return;
+ }
+
+ // Else insert into the list in error-order
+ for (unsigned int i = 0; i < max_values; i++)
+ {
+ // Existing result is better - move on ...
+ if (this_error > best_errors[i])
+ {
+ continue;
+ }
+
+ // Move existing results down one
+ for (unsigned int j = max_values - 1; j > i; j--)
+ {
+ best_errors[j] = best_errors[j - 1];
+ best_partitions[j] = best_partitions[j - 1];
+ }
+
+ // Insert new result
+ best_errors[i] = this_error;
+ best_partitions[i] = this_partition;
+ break;
+ }
+}
+
+/* See header for documentation. */
+unsigned int find_best_partition_candidates(
+ const block_size_descriptor& bsd,
+ const image_block& blk,
+ unsigned int partition_count,
+ unsigned int partition_search_limit,
+ unsigned int best_partitions[TUNE_MAX_PARTITIONING_CANDIDATES],
+ unsigned int requested_candidates
+) {
+ // Constant used to estimate quantization error for a given partitioning; the optimal value for
+ // this depends on bitrate. These values have been determined empirically.
+ unsigned int texels_per_block = bsd.texel_count;
+ float weight_imprecision_estim = 0.055f;
+ if (texels_per_block <= 20)
+ {
+ weight_imprecision_estim = 0.03f;
+ }
+ else if (texels_per_block <= 31)
+ {
+ weight_imprecision_estim = 0.04f;
+ }
+ else if (texels_per_block <= 41)
+ {
+ weight_imprecision_estim = 0.05f;
+ }
+
+ promise(partition_count > 0);
+ promise(partition_search_limit > 0);
+
+ weight_imprecision_estim = weight_imprecision_estim * weight_imprecision_estim;
+
+ unsigned int partition_sequence[BLOCK_MAX_PARTITIONINGS];
+ unsigned int sequence_len = compute_kmeans_partition_ordering(bsd, blk, partition_count, partition_sequence);
+ partition_search_limit = astc::min(partition_search_limit, sequence_len);
+ requested_candidates = astc::min(partition_search_limit, requested_candidates);
+
+ bool uses_alpha = !blk.is_constant_channel(3);
+
+ // Partitioning errors assuming uncorrelated-chrominance endpoints
+ float uncor_best_errors[TUNE_MAX_PARTITIONING_CANDIDATES];
+ unsigned int uncor_best_partitions[TUNE_MAX_PARTITIONING_CANDIDATES];
+
+ // Partitioning errors assuming same-chrominance endpoints
+ float samec_best_errors[TUNE_MAX_PARTITIONING_CANDIDATES];
+ unsigned int samec_best_partitions[TUNE_MAX_PARTITIONING_CANDIDATES];
+
+ for (unsigned int i = 0; i < requested_candidates; i++)
+ {
+ uncor_best_errors[i] = ERROR_CALC_DEFAULT;
+ samec_best_errors[i] = ERROR_CALC_DEFAULT;
+ }
+
+ if (uses_alpha)
+ {
+ for (unsigned int i = 0; i < partition_search_limit; i++)
+ {
+ unsigned int partition = partition_sequence[i];
+ const auto& pi = bsd.get_raw_partition_info(partition_count, partition);
+
+ // Compute weighting to give to each component in each partition
+ partition_metrics pms[BLOCK_MAX_PARTITIONS];
+
+ compute_avgs_and_dirs_4_comp(pi, blk, pms);
+
+ line4 uncor_lines[BLOCK_MAX_PARTITIONS];
+ line4 samec_lines[BLOCK_MAX_PARTITIONS];
+
+ processed_line4 uncor_plines[BLOCK_MAX_PARTITIONS];
+ processed_line4 samec_plines[BLOCK_MAX_PARTITIONS];
+
+ float uncor_line_lens[BLOCK_MAX_PARTITIONS];
+ float samec_line_lens[BLOCK_MAX_PARTITIONS];
+
+ for (unsigned int j = 0; j < partition_count; j++)
+ {
+ partition_metrics& pm = pms[j];
+
+ uncor_lines[j].a = pm.avg;
+ uncor_lines[j].b = normalize_safe(pm.dir, unit4());
+
+ uncor_plines[j].amod = uncor_lines[j].a - uncor_lines[j].b * dot(uncor_lines[j].a, uncor_lines[j].b);
+ uncor_plines[j].bs = uncor_lines[j].b;
+
+ samec_lines[j].a = vfloat4::zero();
+ samec_lines[j].b = normalize_safe(pm.avg, unit4());
+
+ samec_plines[j].amod = vfloat4::zero();
+ samec_plines[j].bs = samec_lines[j].b;
+ }
+
+ float uncor_error = 0.0f;
+ float samec_error = 0.0f;
+
+ compute_error_squared_rgba(pi,
+ blk,
+ uncor_plines,
+ samec_plines,
+ uncor_line_lens,
+ samec_line_lens,
+ uncor_error,
+ samec_error);
+
+ // Compute an estimate of error introduced by weight quantization imprecision.
+ // This error is computed as follows, for each partition
+ // 1: compute the principal-axis vector (full length) in error-space
+ // 2: convert the principal-axis vector to regular RGB-space
+ // 3: scale the vector by a constant that estimates average quantization error
+ // 4: for each texel, square the vector, then do a dot-product with the texel's
+ // error weight; sum up the results across all texels.
+ // 4(optimized): square the vector once, then do a dot-product with the average
+ // texel error, then multiply by the number of texels.
+
+ for (unsigned int j = 0; j < partition_count; j++)
+ {
+ float tpp = static_cast<float>(pi.partition_texel_count[j]);
+ vfloat4 error_weights(tpp * weight_imprecision_estim);
+
+ vfloat4 uncor_vector = uncor_lines[j].b * uncor_line_lens[j];
+ vfloat4 samec_vector = samec_lines[j].b * samec_line_lens[j];
+
+ uncor_error += dot_s(uncor_vector * uncor_vector, error_weights);
+ samec_error += dot_s(samec_vector * samec_vector, error_weights);
+ }
+
+ insert_result(requested_candidates, uncor_error, partition, uncor_best_errors, uncor_best_partitions);
+ insert_result(requested_candidates, samec_error, partition, samec_best_errors, samec_best_partitions);
+ }
+ }
+ else
+ {
+ for (unsigned int i = 0; i < partition_search_limit; i++)
+ {
+ unsigned int partition = partition_sequence[i];
+ const auto& pi = bsd.get_raw_partition_info(partition_count, partition);
+
+ // Compute weighting to give to each component in each partition
+ partition_metrics pms[BLOCK_MAX_PARTITIONS];
+ compute_avgs_and_dirs_3_comp_rgb(pi, blk, pms);
+
+ partition_lines3 plines[BLOCK_MAX_PARTITIONS];
+
+ for (unsigned int j = 0; j < partition_count; j++)
+ {
+ partition_metrics& pm = pms[j];
+ partition_lines3& pl = plines[j];
+
+ pl.uncor_line.a = pm.avg;
+ pl.uncor_line.b = normalize_safe(pm.dir, unit3());
+
+ pl.samec_line.a = vfloat4::zero();
+ pl.samec_line.b = normalize_safe(pm.avg, unit3());
+
+ pl.uncor_pline.amod = pl.uncor_line.a - pl.uncor_line.b * dot3(pl.uncor_line.a, pl.uncor_line.b);
+ pl.uncor_pline.bs = pl.uncor_line.b;
+
+ pl.samec_pline.amod = vfloat4::zero();
+ pl.samec_pline.bs = pl.samec_line.b;
+ }
+
+ float uncor_error = 0.0f;
+ float samec_error = 0.0f;
+
+ compute_error_squared_rgb(pi,
+ blk,
+ plines,
+ uncor_error,
+ samec_error);
+
+ // Compute an estimate of error introduced by weight quantization imprecision.
+ // This error is computed as follows, for each partition
+ // 1: compute the principal-axis vector (full length) in error-space
+ // 2: convert the principal-axis vector to regular RGB-space
+ // 3: scale the vector by a constant that estimates average quantization error
+ // 4: for each texel, square the vector, then do a dot-product with the texel's
+ // error weight; sum up the results across all texels.
+ // 4(optimized): square the vector once, then do a dot-product with the average
+ // texel error, then multiply by the number of texels.
+
+ for (unsigned int j = 0; j < partition_count; j++)
+ {
+ partition_lines3& pl = plines[j];
+
+ float tpp = static_cast<float>(pi.partition_texel_count[j]);
+ vfloat4 error_weights(tpp * weight_imprecision_estim);
+
+ vfloat4 uncor_vector = pl.uncor_line.b * pl.uncor_line_len;
+ vfloat4 samec_vector = pl.samec_line.b * pl.samec_line_len;
+
+ uncor_error += dot3_s(uncor_vector * uncor_vector, error_weights);
+ samec_error += dot3_s(samec_vector * samec_vector, error_weights);
+ }
+
+ insert_result(requested_candidates, uncor_error, partition, uncor_best_errors, uncor_best_partitions);
+ insert_result(requested_candidates, samec_error, partition, samec_best_errors, samec_best_partitions);
+ }
+ }
+
+ bool best_is_uncor = uncor_best_partitions[0] > samec_best_partitions[0];
+
+ unsigned int interleave[2 * TUNE_MAX_PARTITIONING_CANDIDATES];
+ for (unsigned int i = 0; i < requested_candidates; i++)
+ {
+ if (best_is_uncor)
+ {
+ interleave[2 * i] = bsd.get_raw_partition_info(partition_count, uncor_best_partitions[i]).partition_index;
+ interleave[2 * i + 1] = bsd.get_raw_partition_info(partition_count, samec_best_partitions[i]).partition_index;
+ }
+ else
+ {
+ interleave[2 * i] = bsd.get_raw_partition_info(partition_count, samec_best_partitions[i]).partition_index;
+ interleave[2 * i + 1] = bsd.get_raw_partition_info(partition_count, uncor_best_partitions[i]).partition_index;
+ }
+ }
+
+ uint64_t bitmasks[1024/64] { 0 };
+ unsigned int emitted = 0;
+
+ // Deduplicate the first "requested" entries
+ for (unsigned int i = 0; i < requested_candidates * 2; i++)
+ {
+ unsigned int partition = interleave[i];
+
+ unsigned int word = partition / 64;
+ unsigned int bit = partition % 64;
+
+ bool written = bitmasks[word] & (1ull << bit);
+
+ if (!written)
+ {
+ best_partitions[emitted] = partition;
+ bitmasks[word] |= 1ull << bit;
+ emitted++;
+
+ if (emitted == requested_candidates)
+ {
+ break;
+ }
+ }
+ }
+
+ return emitted;
+}
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_ideal_endpoints_and_weights.cpp b/thirdparty/astcenc/astcenc_ideal_endpoints_and_weights.cpp
new file mode 100644
index 0000000000..5145e08693
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_ideal_endpoints_and_weights.cpp
@@ -0,0 +1,1663 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2023 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+
+/**
+ * @brief Functions for computing color endpoints and texel weights.
+ */
+
+#include <cassert>
+
+#include "astcenc_internal.h"
+#include "astcenc_vecmathlib.h"
+
+/**
+ * @brief Compute the infilled weight for N texel indices in a decimated grid.
+ *
+ * @param di The weight grid decimation to use.
+ * @param weights The decimated weight values to use.
+ * @param index The first texel index to interpolate.
+ *
+ * @return The interpolated weight for the given set of SIMD_WIDTH texels.
+ */
+static vfloat bilinear_infill_vla(
+ const decimation_info& di,
+ const float* weights,
+ unsigned int index
+) {
+ // Load the bilinear filter texel weight indexes in the decimated grid
+ vint weight_idx0 = vint(di.texel_weights_tr[0] + index);
+ vint weight_idx1 = vint(di.texel_weights_tr[1] + index);
+ vint weight_idx2 = vint(di.texel_weights_tr[2] + index);
+ vint weight_idx3 = vint(di.texel_weights_tr[3] + index);
+
+ // Load the bilinear filter weights from the decimated grid
+ vfloat weight_val0 = gatherf(weights, weight_idx0);
+ vfloat weight_val1 = gatherf(weights, weight_idx1);
+ vfloat weight_val2 = gatherf(weights, weight_idx2);
+ vfloat weight_val3 = gatherf(weights, weight_idx3);
+
+ // Load the weight contribution factors for each decimated weight
+ vfloat tex_weight_float0 = loada(di.texel_weight_contribs_float_tr[0] + index);
+ vfloat tex_weight_float1 = loada(di.texel_weight_contribs_float_tr[1] + index);
+ vfloat tex_weight_float2 = loada(di.texel_weight_contribs_float_tr[2] + index);
+ vfloat tex_weight_float3 = loada(di.texel_weight_contribs_float_tr[3] + index);
+
+ // Compute the bilinear interpolation to generate the per-texel weight
+ return (weight_val0 * tex_weight_float0 + weight_val1 * tex_weight_float1) +
+ (weight_val2 * tex_weight_float2 + weight_val3 * tex_weight_float3);
+}
+
+/**
+ * @brief Compute the infilled weight for N texel indices in a decimated grid.
+ *
+ * This is specialized version which computes only two weights per texel for
+ * encodings that are only decimated in a single axis.
+ *
+ * @param di The weight grid decimation to use.
+ * @param weights The decimated weight values to use.
+ * @param index The first texel index to interpolate.
+ *
+ * @return The interpolated weight for the given set of SIMD_WIDTH texels.
+ */
+static vfloat bilinear_infill_vla_2(
+ const decimation_info& di,
+ const float* weights,
+ unsigned int index
+) {
+ // Load the bilinear filter texel weight indexes in the decimated grid
+ vint weight_idx0 = vint(di.texel_weights_tr[0] + index);
+ vint weight_idx1 = vint(di.texel_weights_tr[1] + index);
+
+ // Load the bilinear filter weights from the decimated grid
+ vfloat weight_val0 = gatherf(weights, weight_idx0);
+ vfloat weight_val1 = gatherf(weights, weight_idx1);
+
+ // Load the weight contribution factors for each decimated weight
+ vfloat tex_weight_float0 = loada(di.texel_weight_contribs_float_tr[0] + index);
+ vfloat tex_weight_float1 = loada(di.texel_weight_contribs_float_tr[1] + index);
+
+ // Compute the bilinear interpolation to generate the per-texel weight
+ return (weight_val0 * tex_weight_float0 + weight_val1 * tex_weight_float1);
+}
+
+/**
+ * @brief Compute the ideal endpoints and weights for 1 color component.
+ *
+ * @param blk The image block color data to compress.
+ * @param pi The partition info for the current trial.
+ * @param[out] ei The computed ideal endpoints and weights.
+ * @param component The color component to compute.
+ */
+static void compute_ideal_colors_and_weights_1_comp(
+ const image_block& blk,
+ const partition_info& pi,
+ endpoints_and_weights& ei,
+ unsigned int component
+) {
+ unsigned int partition_count = pi.partition_count;
+ ei.ep.partition_count = partition_count;
+ promise(partition_count > 0);
+
+ unsigned int texel_count = blk.texel_count;
+ promise(texel_count > 0);
+
+ float error_weight;
+ const float* data_vr = nullptr;
+
+ assert(component < BLOCK_MAX_COMPONENTS);
+ switch (component)
+ {
+ case 0:
+ error_weight = blk.channel_weight.lane<0>();
+ data_vr = blk.data_r;
+ break;
+ case 1:
+ error_weight = blk.channel_weight.lane<1>();
+ data_vr = blk.data_g;
+ break;
+ case 2:
+ error_weight = blk.channel_weight.lane<2>();
+ data_vr = blk.data_b;
+ break;
+ default:
+ assert(component == 3);
+ error_weight = blk.channel_weight.lane<3>();
+ data_vr = blk.data_a;
+ break;
+ }
+
+ vmask4 sep_mask = vint4::lane_id() == vint4(component);
+ bool is_constant_wes { true };
+ float partition0_len_sq { 0.0f };
+
+ for (unsigned int i = 0; i < partition_count; i++)
+ {
+ float lowvalue { 1e10f };
+ float highvalue { -1e10f };
+
+ unsigned int partition_texel_count = pi.partition_texel_count[i];
+ for (unsigned int j = 0; j < partition_texel_count; j++)
+ {
+ unsigned int tix = pi.texels_of_partition[i][j];
+ float value = data_vr[tix];
+ lowvalue = astc::min(value, lowvalue);
+ highvalue = astc::max(value, highvalue);
+ }
+
+ if (highvalue <= lowvalue)
+ {
+ lowvalue = 0.0f;
+ highvalue = 1e-7f;
+ }
+
+ float length = highvalue - lowvalue;
+ float length_squared = length * length;
+ float scale = 1.0f / length;
+
+ if (i == 0)
+ {
+ partition0_len_sq = length_squared;
+ }
+ else
+ {
+ is_constant_wes = is_constant_wes && length_squared == partition0_len_sq;
+ }
+
+ for (unsigned int j = 0; j < partition_texel_count; j++)
+ {
+ unsigned int tix = pi.texels_of_partition[i][j];
+ float value = (data_vr[tix] - lowvalue) * scale;
+ value = astc::clamp1f(value);
+
+ ei.weights[tix] = value;
+ ei.weight_error_scale[tix] = length_squared * error_weight;
+ assert(!astc::isnan(ei.weight_error_scale[tix]));
+ }
+
+ ei.ep.endpt0[i] = select(blk.data_min, vfloat4(lowvalue), sep_mask);
+ ei.ep.endpt1[i] = select(blk.data_max, vfloat4(highvalue), sep_mask);
+ }
+
+ // Zero initialize any SIMD over-fetch
+ unsigned int texel_count_simd = round_up_to_simd_multiple_vla(texel_count);
+ for (unsigned int i = texel_count; i < texel_count_simd; i++)
+ {
+ ei.weights[i] = 0.0f;
+ ei.weight_error_scale[i] = 0.0f;
+ }
+
+ ei.is_constant_weight_error_scale = is_constant_wes;
+}
+
+/**
+ * @brief Compute the ideal endpoints and weights for 2 color components.
+ *
+ * @param blk The image block color data to compress.
+ * @param pi The partition info for the current trial.
+ * @param[out] ei The computed ideal endpoints and weights.
+ * @param component1 The first color component to compute.
+ * @param component2 The second color component to compute.
+ */
+static void compute_ideal_colors_and_weights_2_comp(
+ const image_block& blk,
+ const partition_info& pi,
+ endpoints_and_weights& ei,
+ int component1,
+ int component2
+) {
+ unsigned int partition_count = pi.partition_count;
+ ei.ep.partition_count = partition_count;
+ promise(partition_count > 0);
+
+ unsigned int texel_count = blk.texel_count;
+ promise(texel_count > 0);
+
+ partition_metrics pms[BLOCK_MAX_PARTITIONS];
+
+ float error_weight;
+ const float* data_vr = nullptr;
+ const float* data_vg = nullptr;
+
+ if (component1 == 0 && component2 == 1)
+ {
+ error_weight = hadd_s(blk.channel_weight.swz<0, 1>()) / 2.0f;
+
+ data_vr = blk.data_r;
+ data_vg = blk.data_g;
+ }
+ else if (component1 == 0 && component2 == 2)
+ {
+ error_weight = hadd_s(blk.channel_weight.swz<0, 2>()) / 2.0f;
+
+ data_vr = blk.data_r;
+ data_vg = blk.data_b;
+ }
+ else // (component1 == 1 && component2 == 2)
+ {
+ assert(component1 == 1 && component2 == 2);
+
+ error_weight = hadd_s(blk.channel_weight.swz<1, 2>()) / 2.0f;
+
+ data_vr = blk.data_g;
+ data_vg = blk.data_b;
+ }
+
+ compute_avgs_and_dirs_2_comp(pi, blk, component1, component2, pms);
+
+ bool is_constant_wes { true };
+ float partition0_len_sq { 0.0f };
+
+ vmask4 comp1_mask = vint4::lane_id() == vint4(component1);
+ vmask4 comp2_mask = vint4::lane_id() == vint4(component2);
+
+ for (unsigned int i = 0; i < partition_count; i++)
+ {
+ vfloat4 dir = pms[i].dir;
+ if (hadd_s(dir) < 0.0f)
+ {
+ dir = vfloat4::zero() - dir;
+ }
+
+ line2 line { pms[i].avg, normalize_safe(dir, unit2()) };
+ float lowparam { 1e10f };
+ float highparam { -1e10f };
+
+ unsigned int partition_texel_count = pi.partition_texel_count[i];
+ for (unsigned int j = 0; j < partition_texel_count; j++)
+ {
+ unsigned int tix = pi.texels_of_partition[i][j];
+ vfloat4 point = vfloat2(data_vr[tix], data_vg[tix]);
+ float param = dot_s(point - line.a, line.b);
+ ei.weights[tix] = param;
+
+ lowparam = astc::min(param, lowparam);
+ highparam = astc::max(param, highparam);
+ }
+
+ // It is possible for a uniform-color partition to produce length=0;
+ // this causes NaN issues so set to small value to avoid this problem
+ if (highparam <= lowparam)
+ {
+ lowparam = 0.0f;
+ highparam = 1e-7f;
+ }
+
+ float length = highparam - lowparam;
+ float length_squared = length * length;
+ float scale = 1.0f / length;
+
+ if (i == 0)
+ {
+ partition0_len_sq = length_squared;
+ }
+ else
+ {
+ is_constant_wes = is_constant_wes && length_squared == partition0_len_sq;
+ }
+
+ for (unsigned int j = 0; j < partition_texel_count; j++)
+ {
+ unsigned int tix = pi.texels_of_partition[i][j];
+ float idx = (ei.weights[tix] - lowparam) * scale;
+ idx = astc::clamp1f(idx);
+
+ ei.weights[tix] = idx;
+ ei.weight_error_scale[tix] = length_squared * error_weight;
+ assert(!astc::isnan(ei.weight_error_scale[tix]));
+ }
+
+ vfloat4 lowvalue = line.a + line.b * lowparam;
+ vfloat4 highvalue = line.a + line.b * highparam;
+
+ vfloat4 ep0 = select(blk.data_min, vfloat4(lowvalue.lane<0>()), comp1_mask);
+ vfloat4 ep1 = select(blk.data_max, vfloat4(highvalue.lane<0>()), comp1_mask);
+
+ ei.ep.endpt0[i] = select(ep0, vfloat4(lowvalue.lane<1>()), comp2_mask);
+ ei.ep.endpt1[i] = select(ep1, vfloat4(highvalue.lane<1>()), comp2_mask);
+ }
+
+ // Zero initialize any SIMD over-fetch
+ unsigned int texel_count_simd = round_up_to_simd_multiple_vla(texel_count);
+ for (unsigned int i = texel_count; i < texel_count_simd; i++)
+ {
+ ei.weights[i] = 0.0f;
+ ei.weight_error_scale[i] = 0.0f;
+ }
+
+ ei.is_constant_weight_error_scale = is_constant_wes;
+}
+
+/**
+ * @brief Compute the ideal endpoints and weights for 3 color components.
+ *
+ * @param blk The image block color data to compress.
+ * @param pi The partition info for the current trial.
+ * @param[out] ei The computed ideal endpoints and weights.
+ * @param omitted_component The color component excluded from the calculation.
+ */
+static void compute_ideal_colors_and_weights_3_comp(
+ const image_block& blk,
+ const partition_info& pi,
+ endpoints_and_weights& ei,
+ unsigned int omitted_component
+) {
+ unsigned int partition_count = pi.partition_count;
+ ei.ep.partition_count = partition_count;
+ promise(partition_count > 0);
+
+ unsigned int texel_count = blk.texel_count;
+ promise(texel_count > 0);
+
+ partition_metrics pms[BLOCK_MAX_PARTITIONS];
+
+ float error_weight;
+ const float* data_vr = nullptr;
+ const float* data_vg = nullptr;
+ const float* data_vb = nullptr;
+ if (omitted_component == 0)
+ {
+ error_weight = hadd_s(blk.channel_weight.swz<0, 1, 2>());
+ data_vr = blk.data_g;
+ data_vg = blk.data_b;
+ data_vb = blk.data_a;
+ }
+ else if (omitted_component == 1)
+ {
+ error_weight = hadd_s(blk.channel_weight.swz<0, 2, 3>());
+ data_vr = blk.data_r;
+ data_vg = blk.data_b;
+ data_vb = blk.data_a;
+ }
+ else if (omitted_component == 2)
+ {
+ error_weight = hadd_s(blk.channel_weight.swz<0, 1, 3>());
+ data_vr = blk.data_r;
+ data_vg = blk.data_g;
+ data_vb = blk.data_a;
+ }
+ else
+ {
+ assert(omitted_component == 3);
+
+ error_weight = hadd_s(blk.channel_weight.swz<0, 1, 2>());
+ data_vr = blk.data_r;
+ data_vg = blk.data_g;
+ data_vb = blk.data_b;
+ }
+
+ error_weight = error_weight * (1.0f / 3.0f);
+
+ if (omitted_component == 3)
+ {
+ compute_avgs_and_dirs_3_comp_rgb(pi, blk, pms);
+ }
+ else
+ {
+ compute_avgs_and_dirs_3_comp(pi, blk, omitted_component, pms);
+ }
+
+ bool is_constant_wes { true };
+ float partition0_len_sq { 0.0f };
+
+ for (unsigned int i = 0; i < partition_count; i++)
+ {
+ vfloat4 dir = pms[i].dir;
+ if (hadd_rgb_s(dir) < 0.0f)
+ {
+ dir = vfloat4::zero() - dir;
+ }
+
+ line3 line { pms[i].avg, normalize_safe(dir, unit3()) };
+ float lowparam { 1e10f };
+ float highparam { -1e10f };
+
+ unsigned int partition_texel_count = pi.partition_texel_count[i];
+ for (unsigned int j = 0; j < partition_texel_count; j++)
+ {
+ unsigned int tix = pi.texels_of_partition[i][j];
+ vfloat4 point = vfloat3(data_vr[tix], data_vg[tix], data_vb[tix]);
+ float param = dot3_s(point - line.a, line.b);
+ ei.weights[tix] = param;
+
+ lowparam = astc::min(param, lowparam);
+ highparam = astc::max(param, highparam);
+ }
+
+ // It is possible for a uniform-color partition to produce length=0;
+ // this causes NaN issues so set to small value to avoid this problem
+ if (highparam <= lowparam)
+ {
+ lowparam = 0.0f;
+ highparam = 1e-7f;
+ }
+
+ float length = highparam - lowparam;
+ float length_squared = length * length;
+ float scale = 1.0f / length;
+
+ if (i == 0)
+ {
+ partition0_len_sq = length_squared;
+ }
+ else
+ {
+ is_constant_wes = is_constant_wes && length_squared == partition0_len_sq;
+ }
+
+ for (unsigned int j = 0; j < partition_texel_count; j++)
+ {
+ unsigned int tix = pi.texels_of_partition[i][j];
+ float idx = (ei.weights[tix] - lowparam) * scale;
+ idx = astc::clamp1f(idx);
+
+ ei.weights[tix] = idx;
+ ei.weight_error_scale[tix] = length_squared * error_weight;
+ assert(!astc::isnan(ei.weight_error_scale[tix]));
+ }
+
+ vfloat4 ep0 = line.a + line.b * lowparam;
+ vfloat4 ep1 = line.a + line.b * highparam;
+
+ vfloat4 bmin = blk.data_min;
+ vfloat4 bmax = blk.data_max;
+
+ assert(omitted_component < BLOCK_MAX_COMPONENTS);
+ switch (omitted_component)
+ {
+ case 0:
+ ei.ep.endpt0[i] = vfloat4(bmin.lane<0>(), ep0.lane<0>(), ep0.lane<1>(), ep0.lane<2>());
+ ei.ep.endpt1[i] = vfloat4(bmax.lane<0>(), ep1.lane<0>(), ep1.lane<1>(), ep1.lane<2>());
+ break;
+ case 1:
+ ei.ep.endpt0[i] = vfloat4(ep0.lane<0>(), bmin.lane<1>(), ep0.lane<1>(), ep0.lane<2>());
+ ei.ep.endpt1[i] = vfloat4(ep1.lane<0>(), bmax.lane<1>(), ep1.lane<1>(), ep1.lane<2>());
+ break;
+ case 2:
+ ei.ep.endpt0[i] = vfloat4(ep0.lane<0>(), ep0.lane<1>(), bmin.lane<2>(), ep0.lane<2>());
+ ei.ep.endpt1[i] = vfloat4(ep1.lane<0>(), ep1.lane<1>(), bmax.lane<2>(), ep1.lane<2>());
+ break;
+ default:
+ ei.ep.endpt0[i] = vfloat4(ep0.lane<0>(), ep0.lane<1>(), ep0.lane<2>(), bmin.lane<3>());
+ ei.ep.endpt1[i] = vfloat4(ep1.lane<0>(), ep1.lane<1>(), ep1.lane<2>(), bmax.lane<3>());
+ break;
+ }
+ }
+
+ // Zero initialize any SIMD over-fetch
+ unsigned int texel_count_simd = round_up_to_simd_multiple_vla(texel_count);
+ for (unsigned int i = texel_count; i < texel_count_simd; i++)
+ {
+ ei.weights[i] = 0.0f;
+ ei.weight_error_scale[i] = 0.0f;
+ }
+
+ ei.is_constant_weight_error_scale = is_constant_wes;
+}
+
+/**
+ * @brief Compute the ideal endpoints and weights for 4 color components.
+ *
+ * @param blk The image block color data to compress.
+ * @param pi The partition info for the current trial.
+ * @param[out] ei The computed ideal endpoints and weights.
+ */
+static void compute_ideal_colors_and_weights_4_comp(
+ const image_block& blk,
+ const partition_info& pi,
+ endpoints_and_weights& ei
+) {
+ const float error_weight = hadd_s(blk.channel_weight) / 4.0f;
+
+ unsigned int partition_count = pi.partition_count;
+
+ unsigned int texel_count = blk.texel_count;
+ promise(texel_count > 0);
+ promise(partition_count > 0);
+
+ partition_metrics pms[BLOCK_MAX_PARTITIONS];
+
+ compute_avgs_and_dirs_4_comp(pi, blk, pms);
+
+ bool is_constant_wes { true };
+ float partition0_len_sq { 0.0f };
+
+ for (unsigned int i = 0; i < partition_count; i++)
+ {
+ vfloat4 dir = pms[i].dir;
+ if (hadd_rgb_s(dir) < 0.0f)
+ {
+ dir = vfloat4::zero() - dir;
+ }
+
+ line4 line { pms[i].avg, normalize_safe(dir, unit4()) };
+ float lowparam { 1e10f };
+ float highparam { -1e10f };
+
+ unsigned int partition_texel_count = pi.partition_texel_count[i];
+ for (unsigned int j = 0; j < partition_texel_count; j++)
+ {
+ unsigned int tix = pi.texels_of_partition[i][j];
+ vfloat4 point = blk.texel(tix);
+ float param = dot_s(point - line.a, line.b);
+ ei.weights[tix] = param;
+
+ lowparam = astc::min(param, lowparam);
+ highparam = astc::max(param, highparam);
+ }
+
+ // It is possible for a uniform-color partition to produce length=0;
+ // this causes NaN issues so set to small value to avoid this problem
+ if (highparam <= lowparam)
+ {
+ lowparam = 0.0f;
+ highparam = 1e-7f;
+ }
+
+ float length = highparam - lowparam;
+ float length_squared = length * length;
+ float scale = 1.0f / length;
+
+ if (i == 0)
+ {
+ partition0_len_sq = length_squared;
+ }
+ else
+ {
+ is_constant_wes = is_constant_wes && length_squared == partition0_len_sq;
+ }
+
+ ei.ep.endpt0[i] = line.a + line.b * lowparam;
+ ei.ep.endpt1[i] = line.a + line.b * highparam;
+
+ for (unsigned int j = 0; j < partition_texel_count; j++)
+ {
+ unsigned int tix = pi.texels_of_partition[i][j];
+ float idx = (ei.weights[tix] - lowparam) * scale;
+ idx = astc::clamp1f(idx);
+
+ ei.weights[tix] = idx;
+ ei.weight_error_scale[tix] = length_squared * error_weight;
+ assert(!astc::isnan(ei.weight_error_scale[tix]));
+ }
+ }
+
+ // Zero initialize any SIMD over-fetch
+ unsigned int texel_count_simd = round_up_to_simd_multiple_vla(texel_count);
+ for (unsigned int i = texel_count; i < texel_count_simd; i++)
+ {
+ ei.weights[i] = 0.0f;
+ ei.weight_error_scale[i] = 0.0f;
+ }
+
+ ei.is_constant_weight_error_scale = is_constant_wes;
+}
+
+/* See header for documentation. */
+void compute_ideal_colors_and_weights_1plane(
+ const image_block& blk,
+ const partition_info& pi,
+ endpoints_and_weights& ei
+) {
+ bool uses_alpha = !blk.is_constant_channel(3);
+
+ if (uses_alpha)
+ {
+ compute_ideal_colors_and_weights_4_comp(blk, pi, ei);
+ }
+ else
+ {
+ compute_ideal_colors_and_weights_3_comp(blk, pi, ei, 3);
+ }
+}
+
+/* See header for documentation. */
+void compute_ideal_colors_and_weights_2planes(
+ const block_size_descriptor& bsd,
+ const image_block& blk,
+ unsigned int plane2_component,
+ endpoints_and_weights& ei1,
+ endpoints_and_weights& ei2
+) {
+ const auto& pi = bsd.get_partition_info(1, 0);
+ bool uses_alpha = !blk.is_constant_channel(3);
+
+ assert(plane2_component < BLOCK_MAX_COMPONENTS);
+ switch (plane2_component)
+ {
+ case 0: // Separate weights for red
+ if (uses_alpha)
+ {
+ compute_ideal_colors_and_weights_3_comp(blk, pi, ei1, 0);
+ }
+ else
+ {
+ compute_ideal_colors_and_weights_2_comp(blk, pi, ei1, 1, 2);
+ }
+ compute_ideal_colors_and_weights_1_comp(blk, pi, ei2, 0);
+ break;
+
+ case 1: // Separate weights for green
+ if (uses_alpha)
+ {
+ compute_ideal_colors_and_weights_3_comp(blk, pi, ei1, 1);
+ }
+ else
+ {
+ compute_ideal_colors_and_weights_2_comp(blk, pi, ei1, 0, 2);
+ }
+ compute_ideal_colors_and_weights_1_comp(blk, pi, ei2, 1);
+ break;
+
+ case 2: // Separate weights for blue
+ if (uses_alpha)
+ {
+ compute_ideal_colors_and_weights_3_comp(blk, pi, ei1, 2);
+ }
+ else
+ {
+ compute_ideal_colors_and_weights_2_comp(blk, pi, ei1, 0, 1);
+ }
+ compute_ideal_colors_and_weights_1_comp(blk, pi, ei2, 2);
+ break;
+
+ default: // Separate weights for alpha
+ assert(uses_alpha);
+ compute_ideal_colors_and_weights_3_comp(blk, pi, ei1, 3);
+ compute_ideal_colors_and_weights_1_comp(blk, pi, ei2, 3);
+ break;
+ }
+}
+
+/* See header for documentation. */
+float compute_error_of_weight_set_1plane(
+ const endpoints_and_weights& eai,
+ const decimation_info& di,
+ const float* dec_weight_quant_uvalue
+) {
+ vfloatacc error_summav = vfloatacc::zero();
+ unsigned int texel_count = di.texel_count;
+ promise(texel_count > 0);
+
+ // Process SIMD-width chunks, safe to over-fetch - the extra space is zero initialized
+ if (di.max_texel_weight_count > 2)
+ {
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ // Compute the bilinear interpolation of the decimated weight grid
+ vfloat current_values = bilinear_infill_vla(di, dec_weight_quant_uvalue, i);
+
+ // Compute the error between the computed value and the ideal weight
+ vfloat actual_values = loada(eai.weights + i);
+ vfloat diff = current_values - actual_values;
+ vfloat significance = loada(eai.weight_error_scale + i);
+ vfloat error = diff * diff * significance;
+
+ haccumulate(error_summav, error);
+ }
+ }
+ else if (di.max_texel_weight_count > 1)
+ {
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ // Compute the bilinear interpolation of the decimated weight grid
+ vfloat current_values = bilinear_infill_vla_2(di, dec_weight_quant_uvalue, i);
+
+ // Compute the error between the computed value and the ideal weight
+ vfloat actual_values = loada(eai.weights + i);
+ vfloat diff = current_values - actual_values;
+ vfloat significance = loada(eai.weight_error_scale + i);
+ vfloat error = diff * diff * significance;
+
+ haccumulate(error_summav, error);
+ }
+ }
+ else
+ {
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ // Load the weight set directly, without interpolation
+ vfloat current_values = loada(dec_weight_quant_uvalue + i);
+
+ // Compute the error between the computed value and the ideal weight
+ vfloat actual_values = loada(eai.weights + i);
+ vfloat diff = current_values - actual_values;
+ vfloat significance = loada(eai.weight_error_scale + i);
+ vfloat error = diff * diff * significance;
+
+ haccumulate(error_summav, error);
+ }
+ }
+
+ // Resolve the final scalar accumulator sum
+ return hadd_s(error_summav);
+}
+
+/* See header for documentation. */
+float compute_error_of_weight_set_2planes(
+ const endpoints_and_weights& eai1,
+ const endpoints_and_weights& eai2,
+ const decimation_info& di,
+ const float* dec_weight_quant_uvalue_plane1,
+ const float* dec_weight_quant_uvalue_plane2
+) {
+ vfloatacc error_summav = vfloatacc::zero();
+ unsigned int texel_count = di.texel_count;
+ promise(texel_count > 0);
+
+ // Process SIMD-width chunks, safe to over-fetch - the extra space is zero initialized
+ if (di.max_texel_weight_count > 2)
+ {
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ // Plane 1
+ // Compute the bilinear interpolation of the decimated weight grid
+ vfloat current_values1 = bilinear_infill_vla(di, dec_weight_quant_uvalue_plane1, i);
+
+ // Compute the error between the computed value and the ideal weight
+ vfloat actual_values1 = loada(eai1.weights + i);
+ vfloat diff = current_values1 - actual_values1;
+ vfloat error1 = diff * diff * loada(eai1.weight_error_scale + i);
+
+ // Plane 2
+ // Compute the bilinear interpolation of the decimated weight grid
+ vfloat current_values2 = bilinear_infill_vla(di, dec_weight_quant_uvalue_plane2, i);
+
+ // Compute the error between the computed value and the ideal weight
+ vfloat actual_values2 = loada(eai2.weights + i);
+ diff = current_values2 - actual_values2;
+ vfloat error2 = diff * diff * loada(eai2.weight_error_scale + i);
+
+ haccumulate(error_summav, error1 + error2);
+ }
+ }
+ else if (di.max_texel_weight_count > 1)
+ {
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ // Plane 1
+ // Compute the bilinear interpolation of the decimated weight grid
+ vfloat current_values1 = bilinear_infill_vla_2(di, dec_weight_quant_uvalue_plane1, i);
+
+ // Compute the error between the computed value and the ideal weight
+ vfloat actual_values1 = loada(eai1.weights + i);
+ vfloat diff = current_values1 - actual_values1;
+ vfloat error1 = diff * diff * loada(eai1.weight_error_scale + i);
+
+ // Plane 2
+ // Compute the bilinear interpolation of the decimated weight grid
+ vfloat current_values2 = bilinear_infill_vla_2(di, dec_weight_quant_uvalue_plane2, i);
+
+ // Compute the error between the computed value and the ideal weight
+ vfloat actual_values2 = loada(eai2.weights + i);
+ diff = current_values2 - actual_values2;
+ vfloat error2 = diff * diff * loada(eai2.weight_error_scale + i);
+
+ haccumulate(error_summav, error1 + error2);
+ }
+ }
+ else
+ {
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ // Plane 1
+ // Load the weight set directly, without interpolation
+ vfloat current_values1 = loada(dec_weight_quant_uvalue_plane1 + i);
+
+ // Compute the error between the computed value and the ideal weight
+ vfloat actual_values1 = loada(eai1.weights + i);
+ vfloat diff = current_values1 - actual_values1;
+ vfloat error1 = diff * diff * loada(eai1.weight_error_scale + i);
+
+ // Plane 2
+ // Load the weight set directly, without interpolation
+ vfloat current_values2 = loada(dec_weight_quant_uvalue_plane2 + i);
+
+ // Compute the error between the computed value and the ideal weight
+ vfloat actual_values2 = loada(eai2.weights + i);
+ diff = current_values2 - actual_values2;
+ vfloat error2 = diff * diff * loada(eai2.weight_error_scale + i);
+
+ haccumulate(error_summav, error1 + error2);
+ }
+ }
+
+ // Resolve the final scalar accumulator sum
+ return hadd_s(error_summav);
+}
+
+/* See header for documentation. */
+void compute_ideal_weights_for_decimation(
+ const endpoints_and_weights& ei,
+ const decimation_info& di,
+ float* dec_weight_ideal_value
+) {
+ unsigned int texel_count = di.texel_count;
+ unsigned int weight_count = di.weight_count;
+ bool is_direct = texel_count == weight_count;
+ promise(texel_count > 0);
+ promise(weight_count > 0);
+
+ // Ensure that the end of the output arrays that are used for SIMD paths later are filled so we
+ // can safely run SIMD elsewhere without a loop tail. Note that this is always safe as weight
+ // arrays always contain space for 64 elements
+ unsigned int prev_weight_count_simd = round_down_to_simd_multiple_vla(weight_count - 1);
+ storea(vfloat::zero(), dec_weight_ideal_value + prev_weight_count_simd);
+
+ // If we have a 1:1 mapping just shortcut the computation. Transfer enough to also copy the
+ // zero-initialized SIMD over-fetch region
+ if (is_direct)
+ {
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vfloat weight(ei.weights + i);
+ storea(weight, dec_weight_ideal_value + i);
+ }
+
+ return;
+ }
+
+ // Otherwise compute an estimate and perform single refinement iteration
+ alignas(ASTCENC_VECALIGN) float infilled_weights[BLOCK_MAX_TEXELS];
+
+ // Compute an initial average for each decimated weight
+ bool constant_wes = ei.is_constant_weight_error_scale;
+ vfloat weight_error_scale(ei.weight_error_scale[0]);
+
+ // This overshoots - this is OK as we initialize the array tails in the
+ // decimation table structures to safe values ...
+ for (unsigned int i = 0; i < weight_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ // Start with a small value to avoid div-by-zero later
+ vfloat weight_weight(1e-10f);
+ vfloat initial_weight = vfloat::zero();
+
+ // Accumulate error weighting of all the texels using this weight
+ vint weight_texel_count(di.weight_texel_count + i);
+ unsigned int max_texel_count = hmax(weight_texel_count).lane<0>();
+ promise(max_texel_count > 0);
+
+ for (unsigned int j = 0; j < max_texel_count; j++)
+ {
+ vint texel(di.weight_texels_tr[j] + i);
+ vfloat weight = loada(di.weights_texel_contribs_tr[j] + i);
+
+ if (!constant_wes)
+ {
+ weight_error_scale = gatherf(ei.weight_error_scale, texel);
+ }
+
+ vfloat contrib_weight = weight * weight_error_scale;
+
+ weight_weight += contrib_weight;
+ initial_weight += gatherf(ei.weights, texel) * contrib_weight;
+ }
+
+ storea(initial_weight / weight_weight, dec_weight_ideal_value + i);
+ }
+
+ // Populate the interpolated weight grid based on the initial average
+ // Process SIMD-width texel coordinates at at time while we can. Safe to
+ // over-process full SIMD vectors - the tail is zeroed.
+ if (di.max_texel_weight_count <= 2)
+ {
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vfloat weight = bilinear_infill_vla_2(di, dec_weight_ideal_value, i);
+ storea(weight, infilled_weights + i);
+ }
+ }
+ else
+ {
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vfloat weight = bilinear_infill_vla(di, dec_weight_ideal_value, i);
+ storea(weight, infilled_weights + i);
+ }
+ }
+
+ // Perform a single iteration of refinement
+ // Empirically determined step size; larger values don't help but smaller drops image quality
+ constexpr float stepsize = 0.25f;
+ constexpr float chd_scale = -WEIGHTS_TEXEL_SUM;
+
+ for (unsigned int i = 0; i < weight_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vfloat weight_val = loada(dec_weight_ideal_value + i);
+
+ // Accumulate error weighting of all the texels using this weight
+ // Start with a small value to avoid div-by-zero later
+ vfloat error_change0(1e-10f);
+ vfloat error_change1(0.0f);
+
+ // Accumulate error weighting of all the texels using this weight
+ vint weight_texel_count(di.weight_texel_count + i);
+ unsigned int max_texel_count = hmax(weight_texel_count).lane<0>();
+ promise(max_texel_count > 0);
+
+ for (unsigned int j = 0; j < max_texel_count; j++)
+ {
+ vint texel(di.weight_texels_tr[j] + i);
+ vfloat contrib_weight = loada(di.weights_texel_contribs_tr[j] + i);
+
+ if (!constant_wes)
+ {
+ weight_error_scale = gatherf(ei.weight_error_scale, texel);
+ }
+
+ vfloat scale = weight_error_scale * contrib_weight;
+ vfloat old_weight = gatherf(infilled_weights, texel);
+ vfloat ideal_weight = gatherf(ei.weights, texel);
+
+ error_change0 += contrib_weight * scale;
+ error_change1 += (old_weight - ideal_weight) * scale;
+ }
+
+ vfloat step = (error_change1 * chd_scale) / error_change0;
+ step = clamp(-stepsize, stepsize, step);
+
+ // Update the weight; note this can store negative values
+ storea(weight_val + step, dec_weight_ideal_value + i);
+ }
+}
+
+/* See header for documentation. */
+void compute_quantized_weights_for_decimation(
+ const decimation_info& di,
+ float low_bound,
+ float high_bound,
+ const float* dec_weight_ideal_value,
+ float* weight_set_out,
+ uint8_t* quantized_weight_set,
+ quant_method quant_level
+) {
+ int weight_count = di.weight_count;
+ promise(weight_count > 0);
+ const quant_and_transfer_table& qat = quant_and_xfer_tables[quant_level];
+
+ // The available quant levels, stored with a minus 1 bias
+ static const float quant_levels_m1[12] {
+ 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 7.0f, 9.0f, 11.0f, 15.0f, 19.0f, 23.0f, 31.0f
+ };
+
+ vint steps_m1(get_quant_level(quant_level) - 1);
+ float quant_level_m1 = quant_levels_m1[quant_level];
+
+ // Quantize the weight set using both the specified low/high bounds and standard 0..1 bounds
+
+ // TODO: Oddity to investigate; triggered by test in issue #265.
+ if (high_bound <= low_bound)
+ {
+ low_bound = 0.0f;
+ high_bound = 1.0f;
+ }
+
+ float rscale = high_bound - low_bound;
+ float scale = 1.0f / rscale;
+
+ float scaled_low_bound = low_bound * scale;
+ rscale *= 1.0f / 64.0f;
+
+ vfloat scalev(scale);
+ vfloat scaled_low_boundv(scaled_low_bound);
+ vfloat quant_level_m1v(quant_level_m1);
+ vfloat rscalev(rscale);
+ vfloat low_boundv(low_bound);
+
+ // This runs to the rounded-up SIMD size, which is safe as the loop tail is filled with known
+ // safe data in compute_ideal_weights_for_decimation and arrays are always 64 elements
+ if (get_quant_level(quant_level) <= 16)
+ {
+ vint4 tab0(reinterpret_cast<const int*>(qat.quant_to_unquant));
+ vint tab0p;
+ vtable_prepare(tab0, tab0p);
+
+ for (int i = 0; i < weight_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vfloat ix = loada(dec_weight_ideal_value + i) * scalev - scaled_low_boundv;
+ ix = clampzo(ix);
+
+ // Look up the two closest indexes and return the one that was closest
+ vfloat ix1 = ix * quant_level_m1v;
+
+ vint weightl = float_to_int(ix1);
+ vint weighth = min(weightl + vint(1), steps_m1);
+
+ vint ixli = vtable_8bt_32bi(tab0p, weightl);
+ vint ixhi = vtable_8bt_32bi(tab0p, weighth);
+
+ vfloat ixl = int_to_float(ixli);
+ vfloat ixh = int_to_float(ixhi);
+
+ vmask mask = (ixl + ixh) < (vfloat(128.0f) * ix);
+ vint weight = select(ixli, ixhi, mask);
+ ixl = select(ixl, ixh, mask);
+
+ // Invert the weight-scaling that was done initially
+ storea(ixl * rscalev + low_boundv, weight_set_out + i);
+ vint scn = pack_low_bytes(weight);
+ store_nbytes(scn, quantized_weight_set + i);
+ }
+ }
+ else
+ {
+ vint4 tab0(reinterpret_cast<const int*>(qat.quant_to_unquant));
+ vint4 tab1(reinterpret_cast<const int*>(qat.quant_to_unquant + 16));
+ vint tab0p, tab1p;
+ vtable_prepare(tab0, tab1, tab0p, tab1p);
+
+ for (int i = 0; i < weight_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vfloat ix = loada(dec_weight_ideal_value + i) * scalev - scaled_low_boundv;
+ ix = clampzo(ix);
+
+ // Look up the two closest indexes and return the one that was closest
+ vfloat ix1 = ix * quant_level_m1v;
+
+ vint weightl = float_to_int(ix1);
+ vint weighth = min(weightl + vint(1), steps_m1);
+
+ vint ixli = vtable_8bt_32bi(tab0p, tab1p, weightl);
+ vint ixhi = vtable_8bt_32bi(tab0p, tab1p, weighth);
+
+ vfloat ixl = int_to_float(ixli);
+ vfloat ixh = int_to_float(ixhi);
+
+ vmask mask = (ixl + ixh) < (vfloat(128.0f) * ix);
+ vint weight = select(ixli, ixhi, mask);
+ ixl = select(ixl, ixh, mask);
+
+ // Invert the weight-scaling that was done initially
+ storea(ixl * rscalev + low_boundv, weight_set_out + i);
+ vint scn = pack_low_bytes(weight);
+ store_nbytes(scn, quantized_weight_set + i);
+ }
+ }
+}
+
+/**
+ * @brief Compute the RGB + offset for a HDR endpoint mode #7.
+ *
+ * Since the matrix needed has a regular structure we can simplify the inverse calculation. This
+ * gives us ~24 multiplications vs. 96 for a generic inverse.
+ *
+ * mat[0] = vfloat4(rgba_ws.x, 0.0f, 0.0f, wght_ws.x);
+ * mat[1] = vfloat4( 0.0f, rgba_ws.y, 0.0f, wght_ws.y);
+ * mat[2] = vfloat4( 0.0f, 0.0f, rgba_ws.z, wght_ws.z);
+ * mat[3] = vfloat4(wght_ws.x, wght_ws.y, wght_ws.z, psum);
+ * mat = invert(mat);
+ *
+ * @param rgba_weight_sum Sum of partition component error weights.
+ * @param weight_weight_sum Sum of partition component error weights * texel weight.
+ * @param rgbq_sum Sum of partition component error weights * texel weight * color data.
+ * @param psum Sum of RGB color weights * texel weight^2.
+ */
+static inline vfloat4 compute_rgbo_vector(
+ vfloat4 rgba_weight_sum,
+ vfloat4 weight_weight_sum,
+ vfloat4 rgbq_sum,
+ float psum
+) {
+ float X = rgba_weight_sum.lane<0>();
+ float Y = rgba_weight_sum.lane<1>();
+ float Z = rgba_weight_sum.lane<2>();
+ float P = weight_weight_sum.lane<0>();
+ float Q = weight_weight_sum.lane<1>();
+ float R = weight_weight_sum.lane<2>();
+ float S = psum;
+
+ float PP = P * P;
+ float QQ = Q * Q;
+ float RR = R * R;
+
+ float SZmRR = S * Z - RR;
+ float DT = SZmRR * Y - Z * QQ;
+ float YP = Y * P;
+ float QX = Q * X;
+ float YX = Y * X;
+ float mZYP = -Z * YP;
+ float mZQX = -Z * QX;
+ float mRYX = -R * YX;
+ float ZQP = Z * Q * P;
+ float RYP = R * YP;
+ float RQX = R * QX;
+
+ // Compute the reciprocal of matrix determinant
+ float rdet = 1.0f / (DT * X + mZYP * P);
+
+ // Actually compute the adjugate, and then apply 1/det separately
+ vfloat4 mat0(DT, ZQP, RYP, mZYP);
+ vfloat4 mat1(ZQP, SZmRR * X - Z * PP, RQX, mZQX);
+ vfloat4 mat2(RYP, RQX, (S * Y - QQ) * X - Y * PP, mRYX);
+ vfloat4 mat3(mZYP, mZQX, mRYX, Z * YX);
+ vfloat4 vect = rgbq_sum * rdet;
+
+ return vfloat4(dot_s(mat0, vect),
+ dot_s(mat1, vect),
+ dot_s(mat2, vect),
+ dot_s(mat3, vect));
+}
+
+/* See header for documentation. */
+void recompute_ideal_colors_1plane(
+ const image_block& blk,
+ const partition_info& pi,
+ const decimation_info& di,
+ const uint8_t* dec_weights_uquant,
+ endpoints& ep,
+ vfloat4 rgbs_vectors[BLOCK_MAX_PARTITIONS],
+ vfloat4 rgbo_vectors[BLOCK_MAX_PARTITIONS]
+) {
+ unsigned int weight_count = di.weight_count;
+ unsigned int total_texel_count = blk.texel_count;
+ unsigned int partition_count = pi.partition_count;
+
+ promise(weight_count > 0);
+ promise(total_texel_count > 0);
+ promise(partition_count > 0);
+
+ alignas(ASTCENC_VECALIGN) float dec_weight[BLOCK_MAX_WEIGHTS];
+ for (unsigned int i = 0; i < weight_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vint unquant_value(dec_weights_uquant + i);
+ vfloat unquant_valuef = int_to_float(unquant_value) * vfloat(1.0f / 64.0f);
+ storea(unquant_valuef, dec_weight + i);
+ }
+
+ alignas(ASTCENC_VECALIGN) float undec_weight[BLOCK_MAX_TEXELS];
+ float* undec_weight_ref;
+ if (di.max_texel_weight_count == 1)
+ {
+ undec_weight_ref = dec_weight;
+ }
+ else if (di.max_texel_weight_count <= 2)
+ {
+ for (unsigned int i = 0; i < total_texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vfloat weight = bilinear_infill_vla_2(di, dec_weight, i);
+ storea(weight, undec_weight + i);
+ }
+
+ undec_weight_ref = undec_weight;
+ }
+ else
+ {
+ for (unsigned int i = 0; i < total_texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vfloat weight = bilinear_infill_vla(di, dec_weight, i);
+ storea(weight, undec_weight + i);
+ }
+
+ undec_weight_ref = undec_weight;
+ }
+
+ vfloat4 rgba_sum(blk.data_mean * static_cast<float>(blk.texel_count));
+
+ for (unsigned int i = 0; i < partition_count; i++)
+ {
+ unsigned int texel_count = pi.partition_texel_count[i];
+ const uint8_t *texel_indexes = pi.texels_of_partition[i];
+
+ // Only compute a partition mean if more than one partition
+ if (partition_count > 1)
+ {
+ rgba_sum = vfloat4::zero();
+ promise(texel_count > 0);
+ for (unsigned int j = 0; j < texel_count; j++)
+ {
+ unsigned int tix = texel_indexes[j];
+ rgba_sum += blk.texel(tix);
+ }
+ }
+
+ rgba_sum = rgba_sum * blk.channel_weight;
+ vfloat4 rgba_weight_sum = max(blk.channel_weight * static_cast<float>(texel_count), 1e-17f);
+ vfloat4 scale_dir = normalize((rgba_sum / rgba_weight_sum).swz<0, 1, 2>());
+
+ float scale_max = 0.0f;
+ float scale_min = 1e10f;
+
+ float wmin1 = 1.0f;
+ float wmax1 = 0.0f;
+
+ float left_sum_s = 0.0f;
+ float middle_sum_s = 0.0f;
+ float right_sum_s = 0.0f;
+
+ vfloat4 color_vec_x = vfloat4::zero();
+ vfloat4 color_vec_y = vfloat4::zero();
+
+ vfloat4 scale_vec = vfloat4::zero();
+
+ float weight_weight_sum_s = 1e-17f;
+
+ vfloat4 color_weight = blk.channel_weight;
+ float ls_weight = hadd_rgb_s(color_weight);
+
+ for (unsigned int j = 0; j < texel_count; j++)
+ {
+ unsigned int tix = texel_indexes[j];
+ vfloat4 rgba = blk.texel(tix);
+
+ float idx0 = undec_weight_ref[tix];
+
+ float om_idx0 = 1.0f - idx0;
+ wmin1 = astc::min(idx0, wmin1);
+ wmax1 = astc::max(idx0, wmax1);
+
+ float scale = dot3_s(scale_dir, rgba);
+ scale_min = astc::min(scale, scale_min);
+ scale_max = astc::max(scale, scale_max);
+
+ left_sum_s += om_idx0 * om_idx0;
+ middle_sum_s += om_idx0 * idx0;
+ right_sum_s += idx0 * idx0;
+ weight_weight_sum_s += idx0;
+
+ vfloat4 color_idx(idx0);
+ vfloat4 cwprod = rgba;
+ vfloat4 cwiprod = cwprod * color_idx;
+
+ color_vec_y += cwiprod;
+ color_vec_x += cwprod - cwiprod;
+
+ scale_vec += vfloat2(om_idx0, idx0) * (scale * ls_weight);
+ }
+
+ vfloat4 left_sum = vfloat4(left_sum_s) * color_weight;
+ vfloat4 middle_sum = vfloat4(middle_sum_s) * color_weight;
+ vfloat4 right_sum = vfloat4(right_sum_s) * color_weight;
+ vfloat4 lmrs_sum = vfloat3(left_sum_s, middle_sum_s, right_sum_s) * ls_weight;
+
+ color_vec_x = color_vec_x * color_weight;
+ color_vec_y = color_vec_y * color_weight;
+
+ // Initialize the luminance and scale vectors with a reasonable default
+ float scalediv = scale_min / astc::max(scale_max, 1e-10f);
+ scalediv = astc::clamp1f(scalediv);
+
+ vfloat4 sds = scale_dir * scale_max;
+
+ rgbs_vectors[i] = vfloat4(sds.lane<0>(), sds.lane<1>(), sds.lane<2>(), scalediv);
+
+ if (wmin1 >= wmax1 * 0.999f)
+ {
+ // If all weights in the partition were equal, then just take average of all colors in
+ // the partition and use that as both endpoint colors
+ vfloat4 avg = (color_vec_x + color_vec_y) / rgba_weight_sum;
+
+ vmask4 notnan_mask = avg == avg;
+ ep.endpt0[i] = select(ep.endpt0[i], avg, notnan_mask);
+ ep.endpt1[i] = select(ep.endpt1[i], avg, notnan_mask);
+
+ rgbs_vectors[i] = vfloat4(sds.lane<0>(), sds.lane<1>(), sds.lane<2>(), 1.0f);
+ }
+ else
+ {
+ // Otherwise, complete the analytic calculation of ideal-endpoint-values for the given
+ // set of texel weights and pixel colors
+ vfloat4 color_det1 = (left_sum * right_sum) - (middle_sum * middle_sum);
+ vfloat4 color_rdet1 = 1.0f / color_det1;
+
+ float ls_det1 = (lmrs_sum.lane<0>() * lmrs_sum.lane<2>()) - (lmrs_sum.lane<1>() * lmrs_sum.lane<1>());
+ float ls_rdet1 = 1.0f / ls_det1;
+
+ vfloat4 color_mss1 = (left_sum * left_sum)
+ + (2.0f * middle_sum * middle_sum)
+ + (right_sum * right_sum);
+
+ float ls_mss1 = (lmrs_sum.lane<0>() * lmrs_sum.lane<0>())
+ + (2.0f * lmrs_sum.lane<1>() * lmrs_sum.lane<1>())
+ + (lmrs_sum.lane<2>() * lmrs_sum.lane<2>());
+
+ vfloat4 ep0 = (right_sum * color_vec_x - middle_sum * color_vec_y) * color_rdet1;
+ vfloat4 ep1 = (left_sum * color_vec_y - middle_sum * color_vec_x) * color_rdet1;
+
+ vmask4 det_mask = abs(color_det1) > (color_mss1 * 1e-4f);
+ vmask4 notnan_mask = (ep0 == ep0) & (ep1 == ep1);
+ vmask4 full_mask = det_mask & notnan_mask;
+
+ ep.endpt0[i] = select(ep.endpt0[i], ep0, full_mask);
+ ep.endpt1[i] = select(ep.endpt1[i], ep1, full_mask);
+
+ float scale_ep0 = (lmrs_sum.lane<2>() * scale_vec.lane<0>() - lmrs_sum.lane<1>() * scale_vec.lane<1>()) * ls_rdet1;
+ float scale_ep1 = (lmrs_sum.lane<0>() * scale_vec.lane<1>() - lmrs_sum.lane<1>() * scale_vec.lane<0>()) * ls_rdet1;
+
+ if (fabsf(ls_det1) > (ls_mss1 * 1e-4f) && scale_ep0 == scale_ep0 && scale_ep1 == scale_ep1 && scale_ep0 < scale_ep1)
+ {
+ float scalediv2 = scale_ep0 / scale_ep1;
+ vfloat4 sdsm = scale_dir * scale_ep1;
+ rgbs_vectors[i] = vfloat4(sdsm.lane<0>(), sdsm.lane<1>(), sdsm.lane<2>(), scalediv2);
+ }
+ }
+
+ // Calculations specific to mode #7, the HDR RGB-scale mode - skip if known LDR
+ if (blk.rgb_lns[0] || blk.alpha_lns[0])
+ {
+ vfloat4 weight_weight_sum = vfloat4(weight_weight_sum_s) * color_weight;
+ float psum = right_sum_s * hadd_rgb_s(color_weight);
+
+ vfloat4 rgbq_sum = color_vec_x + color_vec_y;
+ rgbq_sum.set_lane<3>(hadd_rgb_s(color_vec_y));
+
+ vfloat4 rgbovec = compute_rgbo_vector(rgba_weight_sum, weight_weight_sum, rgbq_sum, psum);
+ rgbo_vectors[i] = rgbovec;
+
+ // We can get a failure due to the use of a singular (non-invertible) matrix
+ // If it failed, compute rgbo_vectors[] with a different method ...
+ if (astc::isnan(dot_s(rgbovec, rgbovec)))
+ {
+ vfloat4 v0 = ep.endpt0[i];
+ vfloat4 v1 = ep.endpt1[i];
+
+ float avgdif = hadd_rgb_s(v1 - v0) * (1.0f / 3.0f);
+ avgdif = astc::max(avgdif, 0.0f);
+
+ vfloat4 avg = (v0 + v1) * 0.5f;
+ vfloat4 ep0 = avg - vfloat4(avgdif) * 0.5f;
+ rgbo_vectors[i] = vfloat4(ep0.lane<0>(), ep0.lane<1>(), ep0.lane<2>(), avgdif);
+ }
+ }
+ }
+}
+
+/* See header for documentation. */
+void recompute_ideal_colors_2planes(
+ const image_block& blk,
+ const block_size_descriptor& bsd,
+ const decimation_info& di,
+ const uint8_t* dec_weights_uquant_plane1,
+ const uint8_t* dec_weights_uquant_plane2,
+ endpoints& ep,
+ vfloat4& rgbs_vector,
+ vfloat4& rgbo_vector,
+ int plane2_component
+) {
+ unsigned int weight_count = di.weight_count;
+ unsigned int total_texel_count = blk.texel_count;
+
+ promise(total_texel_count > 0);
+ promise(weight_count > 0);
+
+ alignas(ASTCENC_VECALIGN) float dec_weight_plane1[BLOCK_MAX_WEIGHTS_2PLANE];
+ alignas(ASTCENC_VECALIGN) float dec_weight_plane2[BLOCK_MAX_WEIGHTS_2PLANE];
+
+ assert(weight_count <= BLOCK_MAX_WEIGHTS_2PLANE);
+
+ for (unsigned int i = 0; i < weight_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vint unquant_value1(dec_weights_uquant_plane1 + i);
+ vfloat unquant_value1f = int_to_float(unquant_value1) * vfloat(1.0f / 64.0f);
+ storea(unquant_value1f, dec_weight_plane1 + i);
+
+ vint unquant_value2(dec_weights_uquant_plane2 + i);
+ vfloat unquant_value2f = int_to_float(unquant_value2) * vfloat(1.0f / 64.0f);
+ storea(unquant_value2f, dec_weight_plane2 + i);
+ }
+
+ alignas(ASTCENC_VECALIGN) float undec_weight_plane1[BLOCK_MAX_TEXELS];
+ alignas(ASTCENC_VECALIGN) float undec_weight_plane2[BLOCK_MAX_TEXELS];
+
+ float* undec_weight_plane1_ref;
+ float* undec_weight_plane2_ref;
+
+ if (di.max_texel_weight_count == 1)
+ {
+ undec_weight_plane1_ref = dec_weight_plane1;
+ undec_weight_plane2_ref = dec_weight_plane2;
+ }
+ else if (di.max_texel_weight_count <= 2)
+ {
+ for (unsigned int i = 0; i < total_texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vfloat weight = bilinear_infill_vla_2(di, dec_weight_plane1, i);
+ storea(weight, undec_weight_plane1 + i);
+
+ weight = bilinear_infill_vla_2(di, dec_weight_plane2, i);
+ storea(weight, undec_weight_plane2 + i);
+ }
+
+ undec_weight_plane1_ref = undec_weight_plane1;
+ undec_weight_plane2_ref = undec_weight_plane2;
+ }
+ else
+ {
+ for (unsigned int i = 0; i < total_texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vfloat weight = bilinear_infill_vla(di, dec_weight_plane1, i);
+ storea(weight, undec_weight_plane1 + i);
+
+ weight = bilinear_infill_vla(di, dec_weight_plane2, i);
+ storea(weight, undec_weight_plane2 + i);
+ }
+
+ undec_weight_plane1_ref = undec_weight_plane1;
+ undec_weight_plane2_ref = undec_weight_plane2;
+ }
+
+ unsigned int texel_count = bsd.texel_count;
+ vfloat4 rgba_weight_sum = max(blk.channel_weight * static_cast<float>(texel_count), 1e-17f);
+ vfloat4 scale_dir = normalize(blk.data_mean.swz<0, 1, 2>());
+
+ float scale_max = 0.0f;
+ float scale_min = 1e10f;
+
+ float wmin1 = 1.0f;
+ float wmax1 = 0.0f;
+
+ float wmin2 = 1.0f;
+ float wmax2 = 0.0f;
+
+ float left1_sum_s = 0.0f;
+ float middle1_sum_s = 0.0f;
+ float right1_sum_s = 0.0f;
+
+ float left2_sum_s = 0.0f;
+ float middle2_sum_s = 0.0f;
+ float right2_sum_s = 0.0f;
+
+ vfloat4 color_vec_x = vfloat4::zero();
+ vfloat4 color_vec_y = vfloat4::zero();
+
+ vfloat4 scale_vec = vfloat4::zero();
+
+ vfloat4 weight_weight_sum = vfloat4(1e-17f);
+
+ vmask4 p2_mask = vint4::lane_id() == vint4(plane2_component);
+ vfloat4 color_weight = blk.channel_weight;
+ float ls_weight = hadd_rgb_s(color_weight);
+
+ for (unsigned int j = 0; j < texel_count; j++)
+ {
+ vfloat4 rgba = blk.texel(j);
+
+ float idx0 = undec_weight_plane1_ref[j];
+
+ float om_idx0 = 1.0f - idx0;
+ wmin1 = astc::min(idx0, wmin1);
+ wmax1 = astc::max(idx0, wmax1);
+
+ float scale = dot3_s(scale_dir, rgba);
+ scale_min = astc::min(scale, scale_min);
+ scale_max = astc::max(scale, scale_max);
+
+ left1_sum_s += om_idx0 * om_idx0;
+ middle1_sum_s += om_idx0 * idx0;
+ right1_sum_s += idx0 * idx0;
+
+ float idx1 = undec_weight_plane2_ref[j];
+
+ float om_idx1 = 1.0f - idx1;
+ wmin2 = astc::min(idx1, wmin2);
+ wmax2 = astc::max(idx1, wmax2);
+
+ left2_sum_s += om_idx1 * om_idx1;
+ middle2_sum_s += om_idx1 * idx1;
+ right2_sum_s += idx1 * idx1;
+
+ vfloat4 color_idx = select(vfloat4(idx0), vfloat4(idx1), p2_mask);
+
+ vfloat4 cwprod = rgba;
+ vfloat4 cwiprod = cwprod * color_idx;
+
+ color_vec_y += cwiprod;
+ color_vec_x += cwprod - cwiprod;
+
+ scale_vec += vfloat2(om_idx0, idx0) * (ls_weight * scale);
+ weight_weight_sum += color_idx;
+ }
+
+ vfloat4 left1_sum = vfloat4(left1_sum_s) * color_weight;
+ vfloat4 middle1_sum = vfloat4(middle1_sum_s) * color_weight;
+ vfloat4 right1_sum = vfloat4(right1_sum_s) * color_weight;
+ vfloat4 lmrs_sum = vfloat3(left1_sum_s, middle1_sum_s, right1_sum_s) * ls_weight;
+
+ vfloat4 left2_sum = vfloat4(left2_sum_s) * color_weight;
+ vfloat4 middle2_sum = vfloat4(middle2_sum_s) * color_weight;
+ vfloat4 right2_sum = vfloat4(right2_sum_s) * color_weight;
+
+ color_vec_x = color_vec_x * color_weight;
+ color_vec_y = color_vec_y * color_weight;
+
+ // Initialize the luminance and scale vectors with a reasonable default
+ float scalediv = scale_min / astc::max(scale_max, 1e-10f);
+ scalediv = astc::clamp1f(scalediv);
+
+ vfloat4 sds = scale_dir * scale_max;
+
+ rgbs_vector = vfloat4(sds.lane<0>(), sds.lane<1>(), sds.lane<2>(), scalediv);
+
+ if (wmin1 >= wmax1 * 0.999f)
+ {
+ // If all weights in the partition were equal, then just take average of all colors in
+ // the partition and use that as both endpoint colors
+ vfloat4 avg = (color_vec_x + color_vec_y) / rgba_weight_sum;
+
+ vmask4 p1_mask = vint4::lane_id() != vint4(plane2_component);
+ vmask4 notnan_mask = avg == avg;
+ vmask4 full_mask = p1_mask & notnan_mask;
+
+ ep.endpt0[0] = select(ep.endpt0[0], avg, full_mask);
+ ep.endpt1[0] = select(ep.endpt1[0], avg, full_mask);
+
+ rgbs_vector = vfloat4(sds.lane<0>(), sds.lane<1>(), sds.lane<2>(), 1.0f);
+ }
+ else
+ {
+ // Otherwise, complete the analytic calculation of ideal-endpoint-values for the given
+ // set of texel weights and pixel colors
+ vfloat4 color_det1 = (left1_sum * right1_sum) - (middle1_sum * middle1_sum);
+ vfloat4 color_rdet1 = 1.0f / color_det1;
+
+ float ls_det1 = (lmrs_sum.lane<0>() * lmrs_sum.lane<2>()) - (lmrs_sum.lane<1>() * lmrs_sum.lane<1>());
+ float ls_rdet1 = 1.0f / ls_det1;
+
+ vfloat4 color_mss1 = (left1_sum * left1_sum)
+ + (2.0f * middle1_sum * middle1_sum)
+ + (right1_sum * right1_sum);
+
+ float ls_mss1 = (lmrs_sum.lane<0>() * lmrs_sum.lane<0>())
+ + (2.0f * lmrs_sum.lane<1>() * lmrs_sum.lane<1>())
+ + (lmrs_sum.lane<2>() * lmrs_sum.lane<2>());
+
+ vfloat4 ep0 = (right1_sum * color_vec_x - middle1_sum * color_vec_y) * color_rdet1;
+ vfloat4 ep1 = (left1_sum * color_vec_y - middle1_sum * color_vec_x) * color_rdet1;
+
+ float scale_ep0 = (lmrs_sum.lane<2>() * scale_vec.lane<0>() - lmrs_sum.lane<1>() * scale_vec.lane<1>()) * ls_rdet1;
+ float scale_ep1 = (lmrs_sum.lane<0>() * scale_vec.lane<1>() - lmrs_sum.lane<1>() * scale_vec.lane<0>()) * ls_rdet1;
+
+ vmask4 p1_mask = vint4::lane_id() != vint4(plane2_component);
+ vmask4 det_mask = abs(color_det1) > (color_mss1 * 1e-4f);
+ vmask4 notnan_mask = (ep0 == ep0) & (ep1 == ep1);
+ vmask4 full_mask = p1_mask & det_mask & notnan_mask;
+
+ ep.endpt0[0] = select(ep.endpt0[0], ep0, full_mask);
+ ep.endpt1[0] = select(ep.endpt1[0], ep1, full_mask);
+
+ if (fabsf(ls_det1) > (ls_mss1 * 1e-4f) && scale_ep0 == scale_ep0 && scale_ep1 == scale_ep1 && scale_ep0 < scale_ep1)
+ {
+ float scalediv2 = scale_ep0 / scale_ep1;
+ vfloat4 sdsm = scale_dir * scale_ep1;
+ rgbs_vector = vfloat4(sdsm.lane<0>(), sdsm.lane<1>(), sdsm.lane<2>(), scalediv2);
+ }
+ }
+
+ if (wmin2 >= wmax2 * 0.999f)
+ {
+ // If all weights in the partition were equal, then just take average of all colors in
+ // the partition and use that as both endpoint colors
+ vfloat4 avg = (color_vec_x + color_vec_y) / rgba_weight_sum;
+
+ vmask4 notnan_mask = avg == avg;
+ vmask4 full_mask = p2_mask & notnan_mask;
+
+ ep.endpt0[0] = select(ep.endpt0[0], avg, full_mask);
+ ep.endpt1[0] = select(ep.endpt1[0], avg, full_mask);
+ }
+ else
+ {
+ // Otherwise, complete the analytic calculation of ideal-endpoint-values for the given
+ // set of texel weights and pixel colors
+ vfloat4 color_det2 = (left2_sum * right2_sum) - (middle2_sum * middle2_sum);
+ vfloat4 color_rdet2 = 1.0f / color_det2;
+
+ vfloat4 color_mss2 = (left2_sum * left2_sum)
+ + (2.0f * middle2_sum * middle2_sum)
+ + (right2_sum * right2_sum);
+
+ vfloat4 ep0 = (right2_sum * color_vec_x - middle2_sum * color_vec_y) * color_rdet2;
+ vfloat4 ep1 = (left2_sum * color_vec_y - middle2_sum * color_vec_x) * color_rdet2;
+
+ vmask4 det_mask = abs(color_det2) > (color_mss2 * 1e-4f);
+ vmask4 notnan_mask = (ep0 == ep0) & (ep1 == ep1);
+ vmask4 full_mask = p2_mask & det_mask & notnan_mask;
+
+ ep.endpt0[0] = select(ep.endpt0[0], ep0, full_mask);
+ ep.endpt1[0] = select(ep.endpt1[0], ep1, full_mask);
+ }
+
+ // Calculations specific to mode #7, the HDR RGB-scale mode - skip if known LDR
+ if (blk.rgb_lns[0] || blk.alpha_lns[0])
+ {
+ weight_weight_sum = weight_weight_sum * color_weight;
+ float psum = dot3_s(select(right1_sum, right2_sum, p2_mask), color_weight);
+
+ vfloat4 rgbq_sum = color_vec_x + color_vec_y;
+ rgbq_sum.set_lane<3>(hadd_rgb_s(color_vec_y));
+
+ rgbo_vector = compute_rgbo_vector(rgba_weight_sum, weight_weight_sum, rgbq_sum, psum);
+
+ // We can get a failure due to the use of a singular (non-invertible) matrix
+ // If it failed, compute rgbo_vectors[] with a different method ...
+ if (astc::isnan(dot_s(rgbo_vector, rgbo_vector)))
+ {
+ vfloat4 v0 = ep.endpt0[0];
+ vfloat4 v1 = ep.endpt1[0];
+
+ float avgdif = hadd_rgb_s(v1 - v0) * (1.0f / 3.0f);
+ avgdif = astc::max(avgdif, 0.0f);
+
+ vfloat4 avg = (v0 + v1) * 0.5f;
+ vfloat4 ep0 = avg - vfloat4(avgdif) * 0.5f;
+
+ rgbo_vector = vfloat4(ep0.lane<0>(), ep0.lane<1>(), ep0.lane<2>(), avgdif);
+ }
+ }
+}
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_image.cpp b/thirdparty/astcenc/astcenc_image.cpp
new file mode 100644
index 0000000000..9c0d6727d0
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_image.cpp
@@ -0,0 +1,558 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2022 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Functions for creating in-memory ASTC image structures.
+ */
+
+#include <cassert>
+#include <cstring>
+
+#include "astcenc_internal.h"
+
+/**
+ * @brief Loader pipeline function type for data fetch from memory.
+ */
+using pixel_loader = vfloat4(*)(const void*, int);
+
+/**
+ * @brief Loader pipeline function type for swizzling data in a vector.
+ */
+using pixel_swizzler = vfloat4(*)(vfloat4, const astcenc_swizzle&);
+
+/**
+ * @brief Loader pipeline function type for converting data in a vector to LNS.
+ */
+using pixel_converter = vfloat4(*)(vfloat4, vmask4);
+
+/**
+ * @brief Load a 8-bit UNORM texel from a data array.
+ *
+ * @param data The data pointer.
+ * @param base_offset The index offset to the start of the pixel.
+ */
+static vfloat4 load_texel_u8(
+ const void* data,
+ int base_offset
+) {
+ const uint8_t* data8 = static_cast<const uint8_t*>(data);
+ return int_to_float(vint4(data8 + base_offset)) / 255.0f;
+}
+
+/**
+ * @brief Load a 16-bit fp16 texel from a data array.
+ *
+ * @param data The data pointer.
+ * @param base_offset The index offset to the start of the pixel.
+ */
+static vfloat4 load_texel_f16(
+ const void* data,
+ int base_offset
+) {
+ const uint16_t* data16 = static_cast<const uint16_t*>(data);
+ int r = data16[base_offset ];
+ int g = data16[base_offset + 1];
+ int b = data16[base_offset + 2];
+ int a = data16[base_offset + 3];
+ return float16_to_float(vint4(r, g, b, a));
+}
+
+/**
+ * @brief Load a 32-bit float texel from a data array.
+ *
+ * @param data The data pointer.
+ * @param base_offset The index offset to the start of the pixel.
+ */
+static vfloat4 load_texel_f32(
+ const void* data,
+ int base_offset
+) {
+ const float* data32 = static_cast<const float*>(data);
+ return vfloat4(data32 + base_offset);
+}
+
+/**
+ * @brief Dummy no-op swizzle function.
+ *
+ * @param data The source RGBA vector to swizzle.
+ * @param swz The swizzle to use.
+ */
+static vfloat4 swz_texel_skip(
+ vfloat4 data,
+ const astcenc_swizzle& swz
+) {
+ (void)swz;
+ return data;
+}
+
+/**
+ * @brief Swizzle a texel into a new arrangement.
+ *
+ * @param data The source RGBA vector to swizzle.
+ * @param swz The swizzle to use.
+ */
+static vfloat4 swz_texel(
+ vfloat4 data,
+ const astcenc_swizzle& swz
+) {
+ alignas(16) float datas[6];
+
+ storea(data, datas);
+ datas[ASTCENC_SWZ_0] = 0.0f;
+ datas[ASTCENC_SWZ_1] = 1.0f;
+
+ return vfloat4(datas[swz.r], datas[swz.g], datas[swz.b], datas[swz.a]);
+}
+
+/**
+ * @brief Encode a texel that is entirely LDR linear.
+ *
+ * @param data The RGBA data to encode.
+ * @param lns_mask The mask for the HDR channels than need LNS encoding.
+ */
+static vfloat4 encode_texel_unorm(
+ vfloat4 data,
+ vmask4 lns_mask
+) {
+ (void)lns_mask;
+ return data * 65535.0f;
+}
+
+/**
+ * @brief Encode a texel that includes at least some HDR LNS texels.
+ *
+ * @param data The RGBA data to encode.
+ * @param lns_mask The mask for the HDR channels than need LNS encoding.
+ */
+static vfloat4 encode_texel_lns(
+ vfloat4 data,
+ vmask4 lns_mask
+) {
+ vfloat4 datav_unorm = data * 65535.0f;
+ vfloat4 datav_lns = float_to_lns(data);
+ return select(datav_unorm, datav_lns, lns_mask);
+}
+
+/* See header for documentation. */
+void load_image_block(
+ astcenc_profile decode_mode,
+ const astcenc_image& img,
+ image_block& blk,
+ const block_size_descriptor& bsd,
+ unsigned int xpos,
+ unsigned int ypos,
+ unsigned int zpos,
+ const astcenc_swizzle& swz
+) {
+ unsigned int xsize = img.dim_x;
+ unsigned int ysize = img.dim_y;
+ unsigned int zsize = img.dim_z;
+
+ blk.xpos = xpos;
+ blk.ypos = ypos;
+ blk.zpos = zpos;
+
+ // True if any non-identity swizzle
+ bool needs_swz = (swz.r != ASTCENC_SWZ_R) || (swz.g != ASTCENC_SWZ_G) ||
+ (swz.b != ASTCENC_SWZ_B) || (swz.a != ASTCENC_SWZ_A);
+
+ int idx = 0;
+
+ vfloat4 data_min(1e38f);
+ vfloat4 data_mean(0.0f);
+ vfloat4 data_mean_scale(1.0f / static_cast<float>(bsd.texel_count));
+ vfloat4 data_max(-1e38f);
+ vmask4 grayscalev(true);
+
+ // This works because we impose the same choice everywhere during encode
+ uint8_t rgb_lns = (decode_mode == ASTCENC_PRF_HDR) ||
+ (decode_mode == ASTCENC_PRF_HDR_RGB_LDR_A) ? 1 : 0;
+ uint8_t a_lns = decode_mode == ASTCENC_PRF_HDR ? 1 : 0;
+ vint4 use_lns(rgb_lns, rgb_lns, rgb_lns, a_lns);
+ vmask4 lns_mask = use_lns != vint4::zero();
+
+ // Set up the function pointers for loading pipeline as needed
+ pixel_loader loader = load_texel_u8;
+ if (img.data_type == ASTCENC_TYPE_F16)
+ {
+ loader = load_texel_f16;
+ }
+ else if (img.data_type == ASTCENC_TYPE_F32)
+ {
+ loader = load_texel_f32;
+ }
+
+ pixel_swizzler swizzler = swz_texel_skip;
+ if (needs_swz)
+ {
+ swizzler = swz_texel;
+ }
+
+ pixel_converter converter = encode_texel_unorm;
+ if (any(lns_mask))
+ {
+ converter = encode_texel_lns;
+ }
+
+ for (unsigned int z = 0; z < bsd.zdim; z++)
+ {
+ unsigned int zi = astc::min(zpos + z, zsize - 1);
+ void* plane = img.data[zi];
+
+ for (unsigned int y = 0; y < bsd.ydim; y++)
+ {
+ unsigned int yi = astc::min(ypos + y, ysize - 1);
+
+ for (unsigned int x = 0; x < bsd.xdim; x++)
+ {
+ unsigned int xi = astc::min(xpos + x, xsize - 1);
+
+ vfloat4 datav = loader(plane, (4 * xsize * yi) + (4 * xi));
+ datav = swizzler(datav, swz);
+ datav = converter(datav, lns_mask);
+
+ // Compute block metadata
+ data_min = min(data_min, datav);
+ data_mean += datav * data_mean_scale;
+ data_max = max(data_max, datav);
+
+ grayscalev = grayscalev & (datav.swz<0,0,0,0>() == datav.swz<1,1,2,2>());
+
+ blk.data_r[idx] = datav.lane<0>();
+ blk.data_g[idx] = datav.lane<1>();
+ blk.data_b[idx] = datav.lane<2>();
+ blk.data_a[idx] = datav.lane<3>();
+
+ blk.rgb_lns[idx] = rgb_lns;
+ blk.alpha_lns[idx] = a_lns;
+
+ idx++;
+ }
+ }
+ }
+
+ // Reverse the encoding so we store origin block in the original format
+ vfloat4 data_enc = blk.texel(0);
+ vfloat4 data_enc_unorm = data_enc / 65535.0f;
+ vfloat4 data_enc_lns = vfloat4::zero();
+
+ if (rgb_lns || a_lns)
+ {
+ data_enc_lns = float16_to_float(lns_to_sf16(float_to_int(data_enc)));
+ }
+
+ blk.origin_texel = select(data_enc_unorm, data_enc_lns, lns_mask);
+
+ // Store block metadata
+ blk.data_min = data_min;
+ blk.data_mean = data_mean;
+ blk.data_max = data_max;
+ blk.grayscale = all(grayscalev);
+}
+
+/* See header for documentation. */
+void load_image_block_fast_ldr(
+ astcenc_profile decode_mode,
+ const astcenc_image& img,
+ image_block& blk,
+ const block_size_descriptor& bsd,
+ unsigned int xpos,
+ unsigned int ypos,
+ unsigned int zpos,
+ const astcenc_swizzle& swz
+) {
+ (void)swz;
+ (void)decode_mode;
+
+ unsigned int xsize = img.dim_x;
+ unsigned int ysize = img.dim_y;
+
+ blk.xpos = xpos;
+ blk.ypos = ypos;
+ blk.zpos = zpos;
+
+ vfloat4 data_min(1e38f);
+ vfloat4 data_mean = vfloat4::zero();
+ vfloat4 data_max(-1e38f);
+ vmask4 grayscalev(true);
+ int idx = 0;
+
+ const uint8_t* plane = static_cast<const uint8_t*>(img.data[0]);
+ for (unsigned int y = ypos; y < ypos + bsd.ydim; y++)
+ {
+ unsigned int yi = astc::min(y, ysize - 1);
+
+ for (unsigned int x = xpos; x < xpos + bsd.xdim; x++)
+ {
+ unsigned int xi = astc::min(x, xsize - 1);
+
+ vint4 datavi = vint4(plane + (4 * xsize * yi) + (4 * xi));
+ vfloat4 datav = int_to_float(datavi) * (65535.0f / 255.0f);
+
+ // Compute block metadata
+ data_min = min(data_min, datav);
+ data_mean += datav;
+ data_max = max(data_max, datav);
+
+ grayscalev = grayscalev & (datav.swz<0,0,0,0>() == datav.swz<1,1,2,2>());
+
+ blk.data_r[idx] = datav.lane<0>();
+ blk.data_g[idx] = datav.lane<1>();
+ blk.data_b[idx] = datav.lane<2>();
+ blk.data_a[idx] = datav.lane<3>();
+
+ idx++;
+ }
+ }
+
+ // Reverse the encoding so we store origin block in the original format
+ blk.origin_texel = blk.texel(0) / 65535.0f;
+
+ // Store block metadata
+ blk.rgb_lns[0] = 0;
+ blk.alpha_lns[0] = 0;
+ blk.data_min = data_min;
+ blk.data_mean = data_mean / static_cast<float>(bsd.texel_count);
+ blk.data_max = data_max;
+ blk.grayscale = all(grayscalev);
+}
+
+/* See header for documentation. */
+void store_image_block(
+ astcenc_image& img,
+ const image_block& blk,
+ const block_size_descriptor& bsd,
+ unsigned int xpos,
+ unsigned int ypos,
+ unsigned int zpos,
+ const astcenc_swizzle& swz
+) {
+ unsigned int x_size = img.dim_x;
+ unsigned int x_start = xpos;
+ unsigned int x_end = astc::min(x_size, xpos + bsd.xdim);
+ unsigned int x_count = x_end - x_start;
+ unsigned int x_nudge = bsd.xdim - x_count;
+
+ unsigned int y_size = img.dim_y;
+ unsigned int y_start = ypos;
+ unsigned int y_end = astc::min(y_size, ypos + bsd.ydim);
+ unsigned int y_count = y_end - y_start;
+ unsigned int y_nudge = (bsd.ydim - y_count) * bsd.xdim;
+
+ unsigned int z_size = img.dim_z;
+ unsigned int z_start = zpos;
+ unsigned int z_end = astc::min(z_size, zpos + bsd.zdim);
+
+ // True if any non-identity swizzle
+ bool needs_swz = (swz.r != ASTCENC_SWZ_R) || (swz.g != ASTCENC_SWZ_G) ||
+ (swz.b != ASTCENC_SWZ_B) || (swz.a != ASTCENC_SWZ_A);
+
+ // True if any swizzle uses Z reconstruct
+ bool needs_z = (swz.r == ASTCENC_SWZ_Z) || (swz.g == ASTCENC_SWZ_Z) ||
+ (swz.b == ASTCENC_SWZ_Z) || (swz.a == ASTCENC_SWZ_Z);
+
+ int idx = 0;
+ if (img.data_type == ASTCENC_TYPE_U8)
+ {
+ for (unsigned int z = z_start; z < z_end; z++)
+ {
+ // Fetch the image plane
+ uint8_t* data8 = static_cast<uint8_t*>(img.data[z]);
+
+ for (unsigned int y = y_start; y < y_end; y++)
+ {
+ uint8_t* data8_row = data8 + (4 * x_size * y) + (4 * x_start);
+
+ for (unsigned int x = 0; x < x_count; x += ASTCENC_SIMD_WIDTH)
+ {
+ unsigned int max_texels = ASTCENC_SIMD_WIDTH;
+ unsigned int used_texels = astc::min(x_count - x, max_texels);
+
+ // Unaligned load as rows are not always SIMD_WIDTH long
+ vfloat data_r(blk.data_r + idx);
+ vfloat data_g(blk.data_g + idx);
+ vfloat data_b(blk.data_b + idx);
+ vfloat data_a(blk.data_a + idx);
+
+ vint data_ri = float_to_int_rtn(min(data_r, 1.0f) * 255.0f);
+ vint data_gi = float_to_int_rtn(min(data_g, 1.0f) * 255.0f);
+ vint data_bi = float_to_int_rtn(min(data_b, 1.0f) * 255.0f);
+ vint data_ai = float_to_int_rtn(min(data_a, 1.0f) * 255.0f);
+
+ if (needs_swz)
+ {
+ vint swizzle_table[7];
+ swizzle_table[ASTCENC_SWZ_0] = vint(0);
+ swizzle_table[ASTCENC_SWZ_1] = vint(255);
+ swizzle_table[ASTCENC_SWZ_R] = data_ri;
+ swizzle_table[ASTCENC_SWZ_G] = data_gi;
+ swizzle_table[ASTCENC_SWZ_B] = data_bi;
+ swizzle_table[ASTCENC_SWZ_A] = data_ai;
+
+ if (needs_z)
+ {
+ vfloat data_x = (data_r * vfloat(2.0f)) - vfloat(1.0f);
+ vfloat data_y = (data_a * vfloat(2.0f)) - vfloat(1.0f);
+ vfloat data_z = vfloat(1.0f) - (data_x * data_x) - (data_y * data_y);
+ data_z = max(data_z, 0.0f);
+ data_z = (sqrt(data_z) * vfloat(0.5f)) + vfloat(0.5f);
+
+ swizzle_table[ASTCENC_SWZ_Z] = float_to_int_rtn(min(data_z, 1.0f) * 255.0f);
+ }
+
+ data_ri = swizzle_table[swz.r];
+ data_gi = swizzle_table[swz.g];
+ data_bi = swizzle_table[swz.b];
+ data_ai = swizzle_table[swz.a];
+ }
+
+ // Errors are NaN encoded - convert to magenta error color
+ // Branch is OK here - it is almost never true so predicts well
+ vmask nan_mask = data_r != data_r;
+ if (any(nan_mask))
+ {
+ data_ri = select(data_ri, vint(0xFF), nan_mask);
+ data_gi = select(data_gi, vint(0x00), nan_mask);
+ data_bi = select(data_bi, vint(0xFF), nan_mask);
+ data_ai = select(data_ai, vint(0xFF), nan_mask);
+ }
+
+ vint data_rgbai = interleave_rgba8(data_ri, data_gi, data_bi, data_ai);
+ vmask store_mask = vint::lane_id() < vint(used_texels);
+ store_lanes_masked(reinterpret_cast<int*>(data8_row), data_rgbai, store_mask);
+
+ data8_row += ASTCENC_SIMD_WIDTH * 4;
+ idx += used_texels;
+ }
+ idx += x_nudge;
+ }
+ idx += y_nudge;
+ }
+ }
+ else if (img.data_type == ASTCENC_TYPE_F16)
+ {
+ for (unsigned int z = z_start; z < z_end; z++)
+ {
+ // Fetch the image plane
+ uint16_t* data16 = static_cast<uint16_t*>(img.data[z]);
+
+ for (unsigned int y = y_start; y < y_end; y++)
+ {
+ uint16_t* data16_row = data16 + (4 * x_size * y) + (4 * x_start);
+
+ for (unsigned int x = 0; x < x_count; x++)
+ {
+ vint4 color;
+
+ // NaNs are handled inline - no need to special case
+ if (needs_swz)
+ {
+ float data[7];
+ data[ASTCENC_SWZ_0] = 0.0f;
+ data[ASTCENC_SWZ_1] = 1.0f;
+ data[ASTCENC_SWZ_R] = blk.data_r[idx];
+ data[ASTCENC_SWZ_G] = blk.data_g[idx];
+ data[ASTCENC_SWZ_B] = blk.data_b[idx];
+ data[ASTCENC_SWZ_A] = blk.data_a[idx];
+
+ if (needs_z)
+ {
+ float xN = (data[0] * 2.0f) - 1.0f;
+ float yN = (data[3] * 2.0f) - 1.0f;
+ float zN = 1.0f - xN * xN - yN * yN;
+ if (zN < 0.0f)
+ {
+ zN = 0.0f;
+ }
+ data[ASTCENC_SWZ_Z] = (astc::sqrt(zN) * 0.5f) + 0.5f;
+ }
+
+ vfloat4 colorf(data[swz.r], data[swz.g], data[swz.b], data[swz.a]);
+ color = float_to_float16(colorf);
+ }
+ else
+ {
+ vfloat4 colorf = blk.texel(idx);
+ color = float_to_float16(colorf);
+ }
+
+ // TODO: Vectorize with store N shorts?
+ data16_row[0] = static_cast<uint16_t>(color.lane<0>());
+ data16_row[1] = static_cast<uint16_t>(color.lane<1>());
+ data16_row[2] = static_cast<uint16_t>(color.lane<2>());
+ data16_row[3] = static_cast<uint16_t>(color.lane<3>());
+ data16_row += 4;
+ idx++;
+ }
+ idx += x_nudge;
+ }
+ idx += y_nudge;
+ }
+ }
+ else // if (img.data_type == ASTCENC_TYPE_F32)
+ {
+ assert(img.data_type == ASTCENC_TYPE_F32);
+
+ for (unsigned int z = z_start; z < z_end; z++)
+ {
+ // Fetch the image plane
+ float* data32 = static_cast<float*>(img.data[z]);
+
+ for (unsigned int y = y_start; y < y_end; y++)
+ {
+ float* data32_row = data32 + (4 * x_size * y) + (4 * x_start);
+
+ for (unsigned int x = 0; x < x_count; x++)
+ {
+ vfloat4 color = blk.texel(idx);
+
+ // NaNs are handled inline - no need to special case
+ if (needs_swz)
+ {
+ float data[7];
+ data[ASTCENC_SWZ_0] = 0.0f;
+ data[ASTCENC_SWZ_1] = 1.0f;
+ data[ASTCENC_SWZ_R] = color.lane<0>();
+ data[ASTCENC_SWZ_G] = color.lane<1>();
+ data[ASTCENC_SWZ_B] = color.lane<2>();
+ data[ASTCENC_SWZ_A] = color.lane<3>();
+
+ if (needs_z)
+ {
+ float xN = (data[0] * 2.0f) - 1.0f;
+ float yN = (data[3] * 2.0f) - 1.0f;
+ float zN = 1.0f - xN * xN - yN * yN;
+ if (zN < 0.0f)
+ {
+ zN = 0.0f;
+ }
+ data[ASTCENC_SWZ_Z] = (astc::sqrt(zN) * 0.5f) + 0.5f;
+ }
+
+ color = vfloat4(data[swz.r], data[swz.g], data[swz.b], data[swz.a]);
+ }
+
+ store(color, data32_row);
+ data32_row += 4;
+ idx++;
+ }
+ idx += x_nudge;
+ }
+ idx += y_nudge;
+ }
+ }
+}
diff --git a/thirdparty/astcenc/astcenc_integer_sequence.cpp b/thirdparty/astcenc/astcenc_integer_sequence.cpp
new file mode 100644
index 0000000000..416750374d
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_integer_sequence.cpp
@@ -0,0 +1,739 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2021 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Functions for encoding/decoding Bounded Integer Sequence Encoding.
+ */
+
+#include "astcenc_internal.h"
+
+#include <array>
+
+/** @brief Unpacked quint triplets <low,middle,high> for each packed value */
+// TODO: Bitpack these into a uint16_t?
+static const uint8_t quints_of_integer[128][3] {
+ {0, 0, 0}, {1, 0, 0}, {2, 0, 0}, {3, 0, 0},
+ {4, 0, 0}, {0, 4, 0}, {4, 4, 0}, {4, 4, 4},
+ {0, 1, 0}, {1, 1, 0}, {2, 1, 0}, {3, 1, 0},
+ {4, 1, 0}, {1, 4, 0}, {4, 4, 1}, {4, 4, 4},
+ {0, 2, 0}, {1, 2, 0}, {2, 2, 0}, {3, 2, 0},
+ {4, 2, 0}, {2, 4, 0}, {4, 4, 2}, {4, 4, 4},
+ {0, 3, 0}, {1, 3, 0}, {2, 3, 0}, {3, 3, 0},
+ {4, 3, 0}, {3, 4, 0}, {4, 4, 3}, {4, 4, 4},
+ {0, 0, 1}, {1, 0, 1}, {2, 0, 1}, {3, 0, 1},
+ {4, 0, 1}, {0, 4, 1}, {4, 0, 4}, {0, 4, 4},
+ {0, 1, 1}, {1, 1, 1}, {2, 1, 1}, {3, 1, 1},
+ {4, 1, 1}, {1, 4, 1}, {4, 1, 4}, {1, 4, 4},
+ {0, 2, 1}, {1, 2, 1}, {2, 2, 1}, {3, 2, 1},
+ {4, 2, 1}, {2, 4, 1}, {4, 2, 4}, {2, 4, 4},
+ {0, 3, 1}, {1, 3, 1}, {2, 3, 1}, {3, 3, 1},
+ {4, 3, 1}, {3, 4, 1}, {4, 3, 4}, {3, 4, 4},
+ {0, 0, 2}, {1, 0, 2}, {2, 0, 2}, {3, 0, 2},
+ {4, 0, 2}, {0, 4, 2}, {2, 0, 4}, {3, 0, 4},
+ {0, 1, 2}, {1, 1, 2}, {2, 1, 2}, {3, 1, 2},
+ {4, 1, 2}, {1, 4, 2}, {2, 1, 4}, {3, 1, 4},
+ {0, 2, 2}, {1, 2, 2}, {2, 2, 2}, {3, 2, 2},
+ {4, 2, 2}, {2, 4, 2}, {2, 2, 4}, {3, 2, 4},
+ {0, 3, 2}, {1, 3, 2}, {2, 3, 2}, {3, 3, 2},
+ {4, 3, 2}, {3, 4, 2}, {2, 3, 4}, {3, 3, 4},
+ {0, 0, 3}, {1, 0, 3}, {2, 0, 3}, {3, 0, 3},
+ {4, 0, 3}, {0, 4, 3}, {0, 0, 4}, {1, 0, 4},
+ {0, 1, 3}, {1, 1, 3}, {2, 1, 3}, {3, 1, 3},
+ {4, 1, 3}, {1, 4, 3}, {0, 1, 4}, {1, 1, 4},
+ {0, 2, 3}, {1, 2, 3}, {2, 2, 3}, {3, 2, 3},
+ {4, 2, 3}, {2, 4, 3}, {0, 2, 4}, {1, 2, 4},
+ {0, 3, 3}, {1, 3, 3}, {2, 3, 3}, {3, 3, 3},
+ {4, 3, 3}, {3, 4, 3}, {0, 3, 4}, {1, 3, 4}
+};
+
+/** @brief Packed quint values for each unpacked value, indexed [hi][mid][lo]. */
+static const uint8_t integer_of_quints[5][5][5] {
+ {
+ {0, 1, 2, 3, 4},
+ {8, 9, 10, 11, 12},
+ {16, 17, 18, 19, 20},
+ {24, 25, 26, 27, 28},
+ {5, 13, 21, 29, 6}
+ },
+ {
+ {32, 33, 34, 35, 36},
+ {40, 41, 42, 43, 44},
+ {48, 49, 50, 51, 52},
+ {56, 57, 58, 59, 60},
+ {37, 45, 53, 61, 14}
+ },
+ {
+ {64, 65, 66, 67, 68},
+ {72, 73, 74, 75, 76},
+ {80, 81, 82, 83, 84},
+ {88, 89, 90, 91, 92},
+ {69, 77, 85, 93, 22}
+ },
+ {
+ {96, 97, 98, 99, 100},
+ {104, 105, 106, 107, 108},
+ {112, 113, 114, 115, 116},
+ {120, 121, 122, 123, 124},
+ {101, 109, 117, 125, 30}
+ },
+ {
+ {102, 103, 70, 71, 38},
+ {110, 111, 78, 79, 46},
+ {118, 119, 86, 87, 54},
+ {126, 127, 94, 95, 62},
+ {39, 47, 55, 63, 31}
+ }
+};
+
+/** @brief Unpacked trit quintuplets <low,...,high> for each packed value */
+// TODO: Bitpack these into a uint16_t?
+static const uint8_t trits_of_integer[256][5] {
+ {0, 0, 0, 0, 0}, {1, 0, 0, 0, 0}, {2, 0, 0, 0, 0}, {0, 0, 2, 0, 0},
+ {0, 1, 0, 0, 0}, {1, 1, 0, 0, 0}, {2, 1, 0, 0, 0}, {1, 0, 2, 0, 0},
+ {0, 2, 0, 0, 0}, {1, 2, 0, 0, 0}, {2, 2, 0, 0, 0}, {2, 0, 2, 0, 0},
+ {0, 2, 2, 0, 0}, {1, 2, 2, 0, 0}, {2, 2, 2, 0, 0}, {2, 0, 2, 0, 0},
+ {0, 0, 1, 0, 0}, {1, 0, 1, 0, 0}, {2, 0, 1, 0, 0}, {0, 1, 2, 0, 0},
+ {0, 1, 1, 0, 0}, {1, 1, 1, 0, 0}, {2, 1, 1, 0, 0}, {1, 1, 2, 0, 0},
+ {0, 2, 1, 0, 0}, {1, 2, 1, 0, 0}, {2, 2, 1, 0, 0}, {2, 1, 2, 0, 0},
+ {0, 0, 0, 2, 2}, {1, 0, 0, 2, 2}, {2, 0, 0, 2, 2}, {0, 0, 2, 2, 2},
+ {0, 0, 0, 1, 0}, {1, 0, 0, 1, 0}, {2, 0, 0, 1, 0}, {0, 0, 2, 1, 0},
+ {0, 1, 0, 1, 0}, {1, 1, 0, 1, 0}, {2, 1, 0, 1, 0}, {1, 0, 2, 1, 0},
+ {0, 2, 0, 1, 0}, {1, 2, 0, 1, 0}, {2, 2, 0, 1, 0}, {2, 0, 2, 1, 0},
+ {0, 2, 2, 1, 0}, {1, 2, 2, 1, 0}, {2, 2, 2, 1, 0}, {2, 0, 2, 1, 0},
+ {0, 0, 1, 1, 0}, {1, 0, 1, 1, 0}, {2, 0, 1, 1, 0}, {0, 1, 2, 1, 0},
+ {0, 1, 1, 1, 0}, {1, 1, 1, 1, 0}, {2, 1, 1, 1, 0}, {1, 1, 2, 1, 0},
+ {0, 2, 1, 1, 0}, {1, 2, 1, 1, 0}, {2, 2, 1, 1, 0}, {2, 1, 2, 1, 0},
+ {0, 1, 0, 2, 2}, {1, 1, 0, 2, 2}, {2, 1, 0, 2, 2}, {1, 0, 2, 2, 2},
+ {0, 0, 0, 2, 0}, {1, 0, 0, 2, 0}, {2, 0, 0, 2, 0}, {0, 0, 2, 2, 0},
+ {0, 1, 0, 2, 0}, {1, 1, 0, 2, 0}, {2, 1, 0, 2, 0}, {1, 0, 2, 2, 0},
+ {0, 2, 0, 2, 0}, {1, 2, 0, 2, 0}, {2, 2, 0, 2, 0}, {2, 0, 2, 2, 0},
+ {0, 2, 2, 2, 0}, {1, 2, 2, 2, 0}, {2, 2, 2, 2, 0}, {2, 0, 2, 2, 0},
+ {0, 0, 1, 2, 0}, {1, 0, 1, 2, 0}, {2, 0, 1, 2, 0}, {0, 1, 2, 2, 0},
+ {0, 1, 1, 2, 0}, {1, 1, 1, 2, 0}, {2, 1, 1, 2, 0}, {1, 1, 2, 2, 0},
+ {0, 2, 1, 2, 0}, {1, 2, 1, 2, 0}, {2, 2, 1, 2, 0}, {2, 1, 2, 2, 0},
+ {0, 2, 0, 2, 2}, {1, 2, 0, 2, 2}, {2, 2, 0, 2, 2}, {2, 0, 2, 2, 2},
+ {0, 0, 0, 0, 2}, {1, 0, 0, 0, 2}, {2, 0, 0, 0, 2}, {0, 0, 2, 0, 2},
+ {0, 1, 0, 0, 2}, {1, 1, 0, 0, 2}, {2, 1, 0, 0, 2}, {1, 0, 2, 0, 2},
+ {0, 2, 0, 0, 2}, {1, 2, 0, 0, 2}, {2, 2, 0, 0, 2}, {2, 0, 2, 0, 2},
+ {0, 2, 2, 0, 2}, {1, 2, 2, 0, 2}, {2, 2, 2, 0, 2}, {2, 0, 2, 0, 2},
+ {0, 0, 1, 0, 2}, {1, 0, 1, 0, 2}, {2, 0, 1, 0, 2}, {0, 1, 2, 0, 2},
+ {0, 1, 1, 0, 2}, {1, 1, 1, 0, 2}, {2, 1, 1, 0, 2}, {1, 1, 2, 0, 2},
+ {0, 2, 1, 0, 2}, {1, 2, 1, 0, 2}, {2, 2, 1, 0, 2}, {2, 1, 2, 0, 2},
+ {0, 2, 2, 2, 2}, {1, 2, 2, 2, 2}, {2, 2, 2, 2, 2}, {2, 0, 2, 2, 2},
+ {0, 0, 0, 0, 1}, {1, 0, 0, 0, 1}, {2, 0, 0, 0, 1}, {0, 0, 2, 0, 1},
+ {0, 1, 0, 0, 1}, {1, 1, 0, 0, 1}, {2, 1, 0, 0, 1}, {1, 0, 2, 0, 1},
+ {0, 2, 0, 0, 1}, {1, 2, 0, 0, 1}, {2, 2, 0, 0, 1}, {2, 0, 2, 0, 1},
+ {0, 2, 2, 0, 1}, {1, 2, 2, 0, 1}, {2, 2, 2, 0, 1}, {2, 0, 2, 0, 1},
+ {0, 0, 1, 0, 1}, {1, 0, 1, 0, 1}, {2, 0, 1, 0, 1}, {0, 1, 2, 0, 1},
+ {0, 1, 1, 0, 1}, {1, 1, 1, 0, 1}, {2, 1, 1, 0, 1}, {1, 1, 2, 0, 1},
+ {0, 2, 1, 0, 1}, {1, 2, 1, 0, 1}, {2, 2, 1, 0, 1}, {2, 1, 2, 0, 1},
+ {0, 0, 1, 2, 2}, {1, 0, 1, 2, 2}, {2, 0, 1, 2, 2}, {0, 1, 2, 2, 2},
+ {0, 0, 0, 1, 1}, {1, 0, 0, 1, 1}, {2, 0, 0, 1, 1}, {0, 0, 2, 1, 1},
+ {0, 1, 0, 1, 1}, {1, 1, 0, 1, 1}, {2, 1, 0, 1, 1}, {1, 0, 2, 1, 1},
+ {0, 2, 0, 1, 1}, {1, 2, 0, 1, 1}, {2, 2, 0, 1, 1}, {2, 0, 2, 1, 1},
+ {0, 2, 2, 1, 1}, {1, 2, 2, 1, 1}, {2, 2, 2, 1, 1}, {2, 0, 2, 1, 1},
+ {0, 0, 1, 1, 1}, {1, 0, 1, 1, 1}, {2, 0, 1, 1, 1}, {0, 1, 2, 1, 1},
+ {0, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {2, 1, 1, 1, 1}, {1, 1, 2, 1, 1},
+ {0, 2, 1, 1, 1}, {1, 2, 1, 1, 1}, {2, 2, 1, 1, 1}, {2, 1, 2, 1, 1},
+ {0, 1, 1, 2, 2}, {1, 1, 1, 2, 2}, {2, 1, 1, 2, 2}, {1, 1, 2, 2, 2},
+ {0, 0, 0, 2, 1}, {1, 0, 0, 2, 1}, {2, 0, 0, 2, 1}, {0, 0, 2, 2, 1},
+ {0, 1, 0, 2, 1}, {1, 1, 0, 2, 1}, {2, 1, 0, 2, 1}, {1, 0, 2, 2, 1},
+ {0, 2, 0, 2, 1}, {1, 2, 0, 2, 1}, {2, 2, 0, 2, 1}, {2, 0, 2, 2, 1},
+ {0, 2, 2, 2, 1}, {1, 2, 2, 2, 1}, {2, 2, 2, 2, 1}, {2, 0, 2, 2, 1},
+ {0, 0, 1, 2, 1}, {1, 0, 1, 2, 1}, {2, 0, 1, 2, 1}, {0, 1, 2, 2, 1},
+ {0, 1, 1, 2, 1}, {1, 1, 1, 2, 1}, {2, 1, 1, 2, 1}, {1, 1, 2, 2, 1},
+ {0, 2, 1, 2, 1}, {1, 2, 1, 2, 1}, {2, 2, 1, 2, 1}, {2, 1, 2, 2, 1},
+ {0, 2, 1, 2, 2}, {1, 2, 1, 2, 2}, {2, 2, 1, 2, 2}, {2, 1, 2, 2, 2},
+ {0, 0, 0, 1, 2}, {1, 0, 0, 1, 2}, {2, 0, 0, 1, 2}, {0, 0, 2, 1, 2},
+ {0, 1, 0, 1, 2}, {1, 1, 0, 1, 2}, {2, 1, 0, 1, 2}, {1, 0, 2, 1, 2},
+ {0, 2, 0, 1, 2}, {1, 2, 0, 1, 2}, {2, 2, 0, 1, 2}, {2, 0, 2, 1, 2},
+ {0, 2, 2, 1, 2}, {1, 2, 2, 1, 2}, {2, 2, 2, 1, 2}, {2, 0, 2, 1, 2},
+ {0, 0, 1, 1, 2}, {1, 0, 1, 1, 2}, {2, 0, 1, 1, 2}, {0, 1, 2, 1, 2},
+ {0, 1, 1, 1, 2}, {1, 1, 1, 1, 2}, {2, 1, 1, 1, 2}, {1, 1, 2, 1, 2},
+ {0, 2, 1, 1, 2}, {1, 2, 1, 1, 2}, {2, 2, 1, 1, 2}, {2, 1, 2, 1, 2},
+ {0, 2, 2, 2, 2}, {1, 2, 2, 2, 2}, {2, 2, 2, 2, 2}, {2, 1, 2, 2, 2}
+};
+
+/** @brief Packed trit values for each unpacked value, indexed [hi][][][][lo]. */
+static const uint8_t integer_of_trits[3][3][3][3][3] {
+ {
+ {
+ {
+ {0, 1, 2},
+ {4, 5, 6},
+ {8, 9, 10}
+ },
+ {
+ {16, 17, 18},
+ {20, 21, 22},
+ {24, 25, 26}
+ },
+ {
+ {3, 7, 15},
+ {19, 23, 27},
+ {12, 13, 14}
+ }
+ },
+ {
+ {
+ {32, 33, 34},
+ {36, 37, 38},
+ {40, 41, 42}
+ },
+ {
+ {48, 49, 50},
+ {52, 53, 54},
+ {56, 57, 58}
+ },
+ {
+ {35, 39, 47},
+ {51, 55, 59},
+ {44, 45, 46}
+ }
+ },
+ {
+ {
+ {64, 65, 66},
+ {68, 69, 70},
+ {72, 73, 74}
+ },
+ {
+ {80, 81, 82},
+ {84, 85, 86},
+ {88, 89, 90}
+ },
+ {
+ {67, 71, 79},
+ {83, 87, 91},
+ {76, 77, 78}
+ }
+ }
+ },
+ {
+ {
+ {
+ {128, 129, 130},
+ {132, 133, 134},
+ {136, 137, 138}
+ },
+ {
+ {144, 145, 146},
+ {148, 149, 150},
+ {152, 153, 154}
+ },
+ {
+ {131, 135, 143},
+ {147, 151, 155},
+ {140, 141, 142}
+ }
+ },
+ {
+ {
+ {160, 161, 162},
+ {164, 165, 166},
+ {168, 169, 170}
+ },
+ {
+ {176, 177, 178},
+ {180, 181, 182},
+ {184, 185, 186}
+ },
+ {
+ {163, 167, 175},
+ {179, 183, 187},
+ {172, 173, 174}
+ }
+ },
+ {
+ {
+ {192, 193, 194},
+ {196, 197, 198},
+ {200, 201, 202}
+ },
+ {
+ {208, 209, 210},
+ {212, 213, 214},
+ {216, 217, 218}
+ },
+ {
+ {195, 199, 207},
+ {211, 215, 219},
+ {204, 205, 206}
+ }
+ }
+ },
+ {
+ {
+ {
+ {96, 97, 98},
+ {100, 101, 102},
+ {104, 105, 106}
+ },
+ {
+ {112, 113, 114},
+ {116, 117, 118},
+ {120, 121, 122}
+ },
+ {
+ {99, 103, 111},
+ {115, 119, 123},
+ {108, 109, 110}
+ }
+ },
+ {
+ {
+ {224, 225, 226},
+ {228, 229, 230},
+ {232, 233, 234}
+ },
+ {
+ {240, 241, 242},
+ {244, 245, 246},
+ {248, 249, 250}
+ },
+ {
+ {227, 231, 239},
+ {243, 247, 251},
+ {236, 237, 238}
+ }
+ },
+ {
+ {
+ {28, 29, 30},
+ {60, 61, 62},
+ {92, 93, 94}
+ },
+ {
+ {156, 157, 158},
+ {188, 189, 190},
+ {220, 221, 222}
+ },
+ {
+ {31, 63, 127},
+ {159, 191, 255},
+ {252, 253, 254}
+ }
+ }
+ }
+};
+
+/**
+ * @brief The number of bits, trits, and quints needed for a quant level.
+ */
+struct btq_count
+{
+ /** @brief The number of bits. */
+ uint8_t bits:6;
+
+ /** @brief The number of trits. */
+ uint8_t trits:1;
+
+ /** @brief The number of quints. */
+ uint8_t quints:1;
+};
+
+/**
+ * @brief The table of bits, trits, and quints needed for a quant encode.
+ */
+static const std::array<btq_count, 21> btq_counts {{
+ { 1, 0, 0 }, // QUANT_2
+ { 0, 1, 0 }, // QUANT_3
+ { 2, 0, 0 }, // QUANT_4
+ { 0, 0, 1 }, // QUANT_5
+ { 1, 1, 0 }, // QUANT_6
+ { 3, 0, 0 }, // QUANT_8
+ { 1, 0, 1 }, // QUANT_10
+ { 2, 1, 0 }, // QUANT_12
+ { 4, 0, 0 }, // QUANT_16
+ { 2, 0, 1 }, // QUANT_20
+ { 3, 1, 0 }, // QUANT_24
+ { 5, 0, 0 }, // QUANT_32
+ { 3, 0, 1 }, // QUANT_40
+ { 4, 1, 0 }, // QUANT_48
+ { 6, 0, 0 }, // QUANT_64
+ { 4, 0, 1 }, // QUANT_80
+ { 5, 1, 0 }, // QUANT_96
+ { 7, 0, 0 }, // QUANT_128
+ { 5, 0, 1 }, // QUANT_160
+ { 6, 1, 0 }, // QUANT_192
+ { 8, 0, 0 } // QUANT_256
+}};
+
+/**
+ * @brief The sequence scale, round, and divisors needed to compute sizing.
+ *
+ * The length of a quantized sequence in bits is:
+ * (scale * <sequence_len> + round) / divisor
+ */
+struct ise_size
+{
+ /** @brief The scaling parameter. */
+ uint8_t scale:6;
+
+ /** @brief The divisor parameter. */
+ uint8_t divisor:2;
+};
+
+/**
+ * @brief The table of scale, round, and divisors needed for quant sizing.
+ */
+static const std::array<ise_size, 21> ise_sizes {{
+ { 1, 0 }, // QUANT_2
+ { 8, 2 }, // QUANT_3
+ { 2, 0 }, // QUANT_4
+ { 7, 1 }, // QUANT_5
+ { 13, 2 }, // QUANT_6
+ { 3, 0 }, // QUANT_8
+ { 10, 1 }, // QUANT_10
+ { 18, 2 }, // QUANT_12
+ { 4, 0 }, // QUANT_16
+ { 13, 1 }, // QUANT_20
+ { 23, 2 }, // QUANT_24
+ { 5, 0 }, // QUANT_32
+ { 16, 1 }, // QUANT_40
+ { 28, 2 }, // QUANT_48
+ { 6, 0 }, // QUANT_64
+ { 19, 1 }, // QUANT_80
+ { 33, 2 }, // QUANT_96
+ { 7, 0 }, // QUANT_128
+ { 22, 1 }, // QUANT_160
+ { 38, 2 }, // QUANT_192
+ { 8, 0 } // QUANT_256
+}};
+
+/* See header for documentation. */
+unsigned int get_ise_sequence_bitcount(
+ unsigned int character_count,
+ quant_method quant_level
+) {
+ // Cope with out-of bounds values - input might be invalid
+ if (static_cast<size_t>(quant_level) >= ise_sizes.size())
+ {
+ // Arbitrary large number that's more than an ASTC block can hold
+ return 1024;
+ }
+
+ auto& entry = ise_sizes[quant_level];
+ unsigned int divisor = (entry.divisor << 1) + 1;
+ return (entry.scale * character_count + divisor - 1) / divisor;
+}
+
+/**
+ * @brief Write up to 8 bits at an arbitrary bit offset.
+ *
+ * The stored value is at most 8 bits, but can be stored at an offset of between 0 and 7 bits so may
+ * span two separate bytes in memory.
+ *
+ * @param value The value to write.
+ * @param bitcount The number of bits to write, starting from LSB.
+ * @param bitoffset The bit offset to store at, between 0 and 7.
+ * @param[in,out] ptr The data pointer to write to.
+ */
+static inline void write_bits(
+ unsigned int value,
+ unsigned int bitcount,
+ unsigned int bitoffset,
+ uint8_t ptr[2]
+) {
+ unsigned int mask = (1 << bitcount) - 1;
+ value &= mask;
+ ptr += bitoffset >> 3;
+ bitoffset &= 7;
+ value <<= bitoffset;
+ mask <<= bitoffset;
+ mask = ~mask;
+
+ ptr[0] &= mask;
+ ptr[0] |= value;
+ ptr[1] &= mask >> 8;
+ ptr[1] |= value >> 8;
+}
+
+/**
+ * @brief Read up to 8 bits at an arbitrary bit offset.
+ *
+ * The stored value is at most 8 bits, but can be stored at an offset of between 0 and 7 bits so may
+ * span two separate bytes in memory.
+ *
+ * @param bitcount The number of bits to read.
+ * @param bitoffset The bit offset to read from, between 0 and 7.
+ * @param[in,out] ptr The data pointer to read from.
+ *
+ * @return The read value.
+ */
+static inline unsigned int read_bits(
+ unsigned int bitcount,
+ unsigned int bitoffset,
+ const uint8_t* ptr
+) {
+ unsigned int mask = (1 << bitcount) - 1;
+ ptr += bitoffset >> 3;
+ bitoffset &= 7;
+ unsigned int value = ptr[0] | (ptr[1] << 8);
+ value >>= bitoffset;
+ value &= mask;
+ return value;
+}
+
+/* See header for documentation. */
+void encode_ise(
+ quant_method quant_level,
+ unsigned int character_count,
+ const uint8_t* input_data,
+ uint8_t* output_data,
+ unsigned int bit_offset
+) {
+ promise(character_count > 0);
+
+ unsigned int bits = btq_counts[quant_level].bits;
+ unsigned int trits = btq_counts[quant_level].trits;
+ unsigned int quints = btq_counts[quant_level].quints;
+ unsigned int mask = (1 << bits) - 1;
+
+ // Write out trits and bits
+ if (trits)
+ {
+ unsigned int i = 0;
+ unsigned int full_trit_blocks = character_count / 5;
+
+ for (unsigned int j = 0; j < full_trit_blocks; j++)
+ {
+ unsigned int i4 = input_data[i + 4] >> bits;
+ unsigned int i3 = input_data[i + 3] >> bits;
+ unsigned int i2 = input_data[i + 2] >> bits;
+ unsigned int i1 = input_data[i + 1] >> bits;
+ unsigned int i0 = input_data[i + 0] >> bits;
+
+ uint8_t T = integer_of_trits[i4][i3][i2][i1][i0];
+
+ // The max size of a trit bit count is 6, so we can always safely
+ // pack a single MX value with the following 1 or 2 T bits.
+ uint8_t pack;
+
+ // Element 0 + T0 + T1
+ pack = (input_data[i++] & mask) | (((T >> 0) & 0x3) << bits);
+ write_bits(pack, bits + 2, bit_offset, output_data);
+ bit_offset += bits + 2;
+
+ // Element 1 + T2 + T3
+ pack = (input_data[i++] & mask) | (((T >> 2) & 0x3) << bits);
+ write_bits(pack, bits + 2, bit_offset, output_data);
+ bit_offset += bits + 2;
+
+ // Element 2 + T4
+ pack = (input_data[i++] & mask) | (((T >> 4) & 0x1) << bits);
+ write_bits(pack, bits + 1, bit_offset, output_data);
+ bit_offset += bits + 1;
+
+ // Element 3 + T5 + T6
+ pack = (input_data[i++] & mask) | (((T >> 5) & 0x3) << bits);
+ write_bits(pack, bits + 2, bit_offset, output_data);
+ bit_offset += bits + 2;
+
+ // Element 4 + T7
+ pack = (input_data[i++] & mask) | (((T >> 7) & 0x1) << bits);
+ write_bits(pack, bits + 1, bit_offset, output_data);
+ bit_offset += bits + 1;
+ }
+
+ // Loop tail for a partial block
+ if (i != character_count)
+ {
+ // i4 cannot be present - we know the block is partial
+ // i0 must be present - we know the block isn't empty
+ unsigned int i4 = 0;
+ unsigned int i3 = i + 3 >= character_count ? 0 : input_data[i + 3] >> bits;
+ unsigned int i2 = i + 2 >= character_count ? 0 : input_data[i + 2] >> bits;
+ unsigned int i1 = i + 1 >= character_count ? 0 : input_data[i + 1] >> bits;
+ unsigned int i0 = input_data[i + 0] >> bits;
+
+ uint8_t T = integer_of_trits[i4][i3][i2][i1][i0];
+
+ for (unsigned int j = 0; i < character_count; i++, j++)
+ {
+ // Truncated table as this iteration is always partital
+ static const uint8_t tbits[4] { 2, 2, 1, 2 };
+ static const uint8_t tshift[4] { 0, 2, 4, 5 };
+
+ uint8_t pack = (input_data[i] & mask) |
+ (((T >> tshift[j]) & ((1 << tbits[j]) - 1)) << bits);
+
+ write_bits(pack, bits + tbits[j], bit_offset, output_data);
+ bit_offset += bits + tbits[j];
+ }
+ }
+ }
+ // Write out quints and bits
+ else if (quints)
+ {
+ unsigned int i = 0;
+ unsigned int full_quint_blocks = character_count / 3;
+
+ for (unsigned int j = 0; j < full_quint_blocks; j++)
+ {
+ unsigned int i2 = input_data[i + 2] >> bits;
+ unsigned int i1 = input_data[i + 1] >> bits;
+ unsigned int i0 = input_data[i + 0] >> bits;
+
+ uint8_t T = integer_of_quints[i2][i1][i0];
+
+ // The max size of a quint bit count is 5, so we can always safely
+ // pack a single M value with the following 2 or 3 T bits.
+ uint8_t pack;
+
+ // Element 0
+ pack = (input_data[i++] & mask) | (((T >> 0) & 0x7) << bits);
+ write_bits(pack, bits + 3, bit_offset, output_data);
+ bit_offset += bits + 3;
+
+ // Element 1
+ pack = (input_data[i++] & mask) | (((T >> 3) & 0x3) << bits);
+ write_bits(pack, bits + 2, bit_offset, output_data);
+ bit_offset += bits + 2;
+
+ // Element 2
+ pack = (input_data[i++] & mask) | (((T >> 5) & 0x3) << bits);
+ write_bits(pack, bits + 2, bit_offset, output_data);
+ bit_offset += bits + 2;
+ }
+
+ // Loop tail for a partial block
+ if (i != character_count)
+ {
+ // i2 cannot be present - we know the block is partial
+ // i0 must be present - we know the block isn't empty
+ unsigned int i2 = 0;
+ unsigned int i1 = i + 1 >= character_count ? 0 : input_data[i + 1] >> bits;
+ unsigned int i0 = input_data[i + 0] >> bits;
+
+ uint8_t T = integer_of_quints[i2][i1][i0];
+
+ for (unsigned int j = 0; i < character_count; i++, j++)
+ {
+ // Truncated table as this iteration is always partital
+ static const uint8_t tbits[2] { 3, 2 };
+ static const uint8_t tshift[2] { 0, 3 };
+
+ uint8_t pack = (input_data[i] & mask) |
+ (((T >> tshift[j]) & ((1 << tbits[j]) - 1)) << bits);
+
+ write_bits(pack, bits + tbits[j], bit_offset, output_data);
+ bit_offset += bits + tbits[j];
+ }
+ }
+ }
+ // Write out just bits
+ else
+ {
+ for (unsigned int i = 0; i < character_count; i++)
+ {
+ write_bits(input_data[i], bits, bit_offset, output_data);
+ bit_offset += bits;
+ }
+ }
+}
+
+/* See header for documentation. */
+void decode_ise(
+ quant_method quant_level,
+ unsigned int character_count,
+ const uint8_t* input_data,
+ uint8_t* output_data,
+ unsigned int bit_offset
+) {
+ promise(character_count > 0);
+
+ // Note: due to how the trit/quint-block unpacking is done in this function, we may write more
+ // temporary results than the number of outputs. The maximum actual number of results is 64 bit,
+ // but we keep 4 additional character_count of padding.
+ uint8_t results[68];
+ uint8_t tq_blocks[22] { 0 }; // Trit-blocks or quint-blocks, must be zeroed
+
+ unsigned int bits = btq_counts[quant_level].bits;
+ unsigned int trits = btq_counts[quant_level].trits;
+ unsigned int quints = btq_counts[quant_level].quints;
+
+ unsigned int lcounter = 0;
+ unsigned int hcounter = 0;
+
+ // Collect bits for each element, as well as bits for any trit-blocks and quint-blocks.
+ for (unsigned int i = 0; i < character_count; i++)
+ {
+ results[i] = static_cast<uint8_t>(read_bits(bits, bit_offset, input_data));
+ bit_offset += bits;
+
+ if (trits)
+ {
+ static const uint8_t bits_to_read[5] { 2, 2, 1, 2, 1 };
+ static const uint8_t block_shift[5] { 0, 2, 4, 5, 7 };
+ static const uint8_t next_lcounter[5] { 1, 2, 3, 4, 0 };
+ static const uint8_t hcounter_incr[5] { 0, 0, 0, 0, 1 };
+ unsigned int tdata = read_bits(bits_to_read[lcounter], bit_offset, input_data);
+ bit_offset += bits_to_read[lcounter];
+ tq_blocks[hcounter] |= tdata << block_shift[lcounter];
+ hcounter += hcounter_incr[lcounter];
+ lcounter = next_lcounter[lcounter];
+ }
+
+ if (quints)
+ {
+ static const uint8_t bits_to_read[3] { 3, 2, 2 };
+ static const uint8_t block_shift[3] { 0, 3, 5 };
+ static const uint8_t next_lcounter[3] { 1, 2, 0 };
+ static const uint8_t hcounter_incr[3] { 0, 0, 1 };
+ unsigned int tdata = read_bits(bits_to_read[lcounter], bit_offset, input_data);
+ bit_offset += bits_to_read[lcounter];
+ tq_blocks[hcounter] |= tdata << block_shift[lcounter];
+ hcounter += hcounter_incr[lcounter];
+ lcounter = next_lcounter[lcounter];
+ }
+ }
+
+ // Unpack trit-blocks or quint-blocks as needed
+ if (trits)
+ {
+ unsigned int trit_blocks = (character_count + 4) / 5;
+ promise(trit_blocks > 0);
+ for (unsigned int i = 0; i < trit_blocks; i++)
+ {
+ const uint8_t *tritptr = trits_of_integer[tq_blocks[i]];
+ results[5 * i ] |= tritptr[0] << bits;
+ results[5 * i + 1] |= tritptr[1] << bits;
+ results[5 * i + 2] |= tritptr[2] << bits;
+ results[5 * i + 3] |= tritptr[3] << bits;
+ results[5 * i + 4] |= tritptr[4] << bits;
+ }
+ }
+
+ if (quints)
+ {
+ unsigned int quint_blocks = (character_count + 2) / 3;
+ promise(quint_blocks > 0);
+ for (unsigned int i = 0; i < quint_blocks; i++)
+ {
+ const uint8_t *quintptr = quints_of_integer[tq_blocks[i]];
+ results[3 * i ] |= quintptr[0] << bits;
+ results[3 * i + 1] |= quintptr[1] << bits;
+ results[3 * i + 2] |= quintptr[2] << bits;
+ }
+ }
+
+ for (unsigned int i = 0; i < character_count; i++)
+ {
+ output_data[i] = results[i];
+ }
+}
diff --git a/thirdparty/astcenc/astcenc_internal.h b/thirdparty/astcenc/astcenc_internal.h
new file mode 100644
index 0000000000..0aa8fa0f81
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_internal.h
@@ -0,0 +1,2196 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2023 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Functions and data declarations.
+ */
+
+#ifndef ASTCENC_INTERNAL_INCLUDED
+#define ASTCENC_INTERNAL_INCLUDED
+
+#include <algorithm>
+#include <cstddef>
+#include <cstdint>
+#if defined(ASTCENC_DIAGNOSTICS)
+ #include <cstdio>
+#endif
+#include <cstdlib>
+
+#include "astcenc.h"
+#include "astcenc_mathlib.h"
+#include "astcenc_vecmathlib.h"
+
+/**
+ * @brief Make a promise to the compiler's optimizer.
+ *
+ * A promise is an expression that the optimizer is can assume is true for to help it generate
+ * faster code. Common use cases for this are to promise that a for loop will iterate more than
+ * once, or that the loop iteration count is a multiple of a vector length, which avoids pre-loop
+ * checks and can avoid loop tails if loops are unrolled by the auto-vectorizer.
+ */
+#if defined(NDEBUG)
+ #if !defined(__clang__) && defined(_MSC_VER)
+ #define promise(cond) __assume(cond)
+ #elif defined(__clang__)
+ #if __has_builtin(__builtin_assume)
+ #define promise(cond) __builtin_assume(cond)
+ #elif __has_builtin(__builtin_unreachable)
+ #define promise(cond) if (!(cond)) { __builtin_unreachable(); }
+ #else
+ #define promise(cond)
+ #endif
+ #else // Assume GCC
+ #define promise(cond) if (!(cond)) { __builtin_unreachable(); }
+ #endif
+#else
+ #define promise(cond) assert(cond)
+#endif
+
+/* ============================================================================
+ Constants
+============================================================================ */
+#if !defined(ASTCENC_BLOCK_MAX_TEXELS)
+ #define ASTCENC_BLOCK_MAX_TEXELS 216 // A 3D 6x6x6 block
+#endif
+
+/** @brief The maximum number of texels a block can support (6x6x6 block). */
+static constexpr unsigned int BLOCK_MAX_TEXELS { ASTCENC_BLOCK_MAX_TEXELS };
+
+/** @brief The maximum number of components a block can support. */
+static constexpr unsigned int BLOCK_MAX_COMPONENTS { 4 };
+
+/** @brief The maximum number of partitions a block can support. */
+static constexpr unsigned int BLOCK_MAX_PARTITIONS { 4 };
+
+/** @brief The number of partitionings, per partition count, suported by the ASTC format. */
+static constexpr unsigned int BLOCK_MAX_PARTITIONINGS { 1024 };
+
+/** @brief The maximum number of weights used during partition selection for texel clustering. */
+static constexpr uint8_t BLOCK_MAX_KMEANS_TEXELS { 64 };
+
+/** @brief The maximum number of weights a block can support. */
+static constexpr unsigned int BLOCK_MAX_WEIGHTS { 64 };
+
+/** @brief The maximum number of weights a block can support per plane in 2 plane mode. */
+static constexpr unsigned int BLOCK_MAX_WEIGHTS_2PLANE { BLOCK_MAX_WEIGHTS / 2 };
+
+/** @brief The minimum number of weight bits a candidate encoding must encode. */
+static constexpr unsigned int BLOCK_MIN_WEIGHT_BITS { 24 };
+
+/** @brief The maximum number of weight bits a candidate encoding can encode. */
+static constexpr unsigned int BLOCK_MAX_WEIGHT_BITS { 96 };
+
+/** @brief The index indicating a bad (unused) block mode in the remap array. */
+static constexpr uint16_t BLOCK_BAD_BLOCK_MODE { 0xFFFFu };
+
+/** @brief The index indicating a bad (unused) partitioning in the remap array. */
+static constexpr uint16_t BLOCK_BAD_PARTITIONING { 0xFFFFu };
+
+/** @brief The number of partition index bits supported by the ASTC format . */
+static constexpr unsigned int PARTITION_INDEX_BITS { 10 };
+
+/** @brief The offset of the plane 2 weights in shared weight arrays. */
+static constexpr unsigned int WEIGHTS_PLANE2_OFFSET { BLOCK_MAX_WEIGHTS_2PLANE };
+
+/** @brief The sum of quantized weights for one texel. */
+static constexpr float WEIGHTS_TEXEL_SUM { 16.0f };
+
+/** @brief The number of block modes supported by the ASTC format. */
+static constexpr unsigned int WEIGHTS_MAX_BLOCK_MODES { 2048 };
+
+/** @brief The number of weight grid decimation modes supported by the ASTC format. */
+static constexpr unsigned int WEIGHTS_MAX_DECIMATION_MODES { 87 };
+
+/** @brief The high default error used to initialize error trackers. */
+static constexpr float ERROR_CALC_DEFAULT { 1e30f };
+
+/**
+ * @brief The minimum texel count for a block to use the one partition fast path.
+ *
+ * This setting skips 4x4 and 5x4 block sizes.
+ */
+static constexpr unsigned int TUNE_MIN_TEXELS_MODE0_FASTPATH { 24 };
+
+/**
+ * @brief The maximum number of candidate encodings tested for each encoding mode.
+ *
+ * This can be dynamically reduced by the compression quality preset.
+ */
+static constexpr unsigned int TUNE_MAX_TRIAL_CANDIDATES { 8 };
+
+/**
+ * @brief The maximum number of candidate partitionings tested for each encoding mode.
+ *
+ * This can be dynamically reduced by the compression quality preset.
+ */
+static constexpr unsigned int TUNE_MAX_PARTITIONING_CANDIDATES { 32 };
+
+/**
+ * @brief The maximum quant level using full angular endpoint search method.
+ *
+ * The angular endpoint search is used to find the min/max weight that should
+ * be used for a given quantization level. It is effective but expensive, so
+ * we only use it where it has the most value - low quant levels with wide
+ * spacing. It is used below TUNE_MAX_ANGULAR_QUANT (inclusive). Above this we
+ * assume the min weight is 0.0f, and the max weight is 1.0f.
+ *
+ * Note the angular algorithm is vectorized, and using QUANT_12 exactly fills
+ * one 8-wide vector. Decreasing by one doesn't buy much performance, and
+ * increasing by one is disproportionately expensive.
+ */
+static constexpr unsigned int TUNE_MAX_ANGULAR_QUANT { 7 }; /* QUANT_12 */
+
+static_assert((BLOCK_MAX_TEXELS % ASTCENC_SIMD_WIDTH) == 0,
+ "BLOCK_MAX_TEXELS must be multiple of ASTCENC_SIMD_WIDTH");
+
+static_assert(BLOCK_MAX_TEXELS <= 216,
+ "BLOCK_MAX_TEXELS must not be greater than 216");
+
+static_assert((BLOCK_MAX_WEIGHTS % ASTCENC_SIMD_WIDTH) == 0,
+ "BLOCK_MAX_WEIGHTS must be multiple of ASTCENC_SIMD_WIDTH");
+
+static_assert((WEIGHTS_MAX_BLOCK_MODES % ASTCENC_SIMD_WIDTH) == 0,
+ "WEIGHTS_MAX_BLOCK_MODES must be multiple of ASTCENC_SIMD_WIDTH");
+
+
+/* ============================================================================
+ Commonly used data structures
+============================================================================ */
+
+/**
+ * @brief The ASTC endpoint formats.
+ *
+ * Note, the values here are used directly in the encoding in the format so do not rearrange.
+ */
+enum endpoint_formats
+{
+ FMT_LUMINANCE = 0,
+ FMT_LUMINANCE_DELTA = 1,
+ FMT_HDR_LUMINANCE_LARGE_RANGE = 2,
+ FMT_HDR_LUMINANCE_SMALL_RANGE = 3,
+ FMT_LUMINANCE_ALPHA = 4,
+ FMT_LUMINANCE_ALPHA_DELTA = 5,
+ FMT_RGB_SCALE = 6,
+ FMT_HDR_RGB_SCALE = 7,
+ FMT_RGB = 8,
+ FMT_RGB_DELTA = 9,
+ FMT_RGB_SCALE_ALPHA = 10,
+ FMT_HDR_RGB = 11,
+ FMT_RGBA = 12,
+ FMT_RGBA_DELTA = 13,
+ FMT_HDR_RGB_LDR_ALPHA = 14,
+ FMT_HDR_RGBA = 15
+};
+
+/**
+ * @brief The ASTC quantization methods.
+ *
+ * Note, the values here are used directly in the encoding in the format so do not rearrange.
+ */
+enum quant_method
+{
+ QUANT_2 = 0,
+ QUANT_3 = 1,
+ QUANT_4 = 2,
+ QUANT_5 = 3,
+ QUANT_6 = 4,
+ QUANT_8 = 5,
+ QUANT_10 = 6,
+ QUANT_12 = 7,
+ QUANT_16 = 8,
+ QUANT_20 = 9,
+ QUANT_24 = 10,
+ QUANT_32 = 11,
+ QUANT_40 = 12,
+ QUANT_48 = 13,
+ QUANT_64 = 14,
+ QUANT_80 = 15,
+ QUANT_96 = 16,
+ QUANT_128 = 17,
+ QUANT_160 = 18,
+ QUANT_192 = 19,
+ QUANT_256 = 20
+};
+
+/**
+ * @brief The number of levels use by an ASTC quantization method.
+ *
+ * @param method The quantization method
+ *
+ * @return The number of levels used by @c method.
+ */
+static inline unsigned int get_quant_level(quant_method method)
+{
+ switch (method)
+ {
+ case QUANT_2: return 2;
+ case QUANT_3: return 3;
+ case QUANT_4: return 4;
+ case QUANT_5: return 5;
+ case QUANT_6: return 6;
+ case QUANT_8: return 8;
+ case QUANT_10: return 10;
+ case QUANT_12: return 12;
+ case QUANT_16: return 16;
+ case QUANT_20: return 20;
+ case QUANT_24: return 24;
+ case QUANT_32: return 32;
+ case QUANT_40: return 40;
+ case QUANT_48: return 48;
+ case QUANT_64: return 64;
+ case QUANT_80: return 80;
+ case QUANT_96: return 96;
+ case QUANT_128: return 128;
+ case QUANT_160: return 160;
+ case QUANT_192: return 192;
+ case QUANT_256: return 256;
+ }
+
+ // Unreachable - the enum is fully described
+ return 0;
+}
+
+/**
+ * @brief Computed metrics about a partition in a block.
+ */
+struct partition_metrics
+{
+ /** @brief The error-weighted average color in the partition. */
+ vfloat4 avg;
+
+ /** @brief The dominant error-weighted direction in the partition. */
+ vfloat4 dir;
+};
+
+/**
+ * @brief Computed lines for a a three component analysis.
+ */
+struct partition_lines3
+{
+ /** @brief Line for uncorrelated chroma. */
+ line3 uncor_line;
+
+ /** @brief Line for correlated chroma, passing though the origin. */
+ line3 samec_line;
+
+ /** @brief Post-processed line for uncorrelated chroma. */
+ processed_line3 uncor_pline;
+
+ /** @brief Post-processed line for correlated chroma, passing though the origin. */
+ processed_line3 samec_pline;
+
+ /** @brief The length of the line for uncorrelated chroma. */
+ float uncor_line_len;
+
+ /** @brief The length of the line for correlated chroma. */
+ float samec_line_len;
+};
+
+/**
+ * @brief The partition information for a single partition.
+ *
+ * ASTC has a total of 1024 candidate partitions for each of 2/3/4 partition counts, although this
+ * 1024 includes seeds that generate duplicates of other seeds and seeds that generate completely
+ * empty partitions. These are both valid encodings, but astcenc will skip both during compression
+ * as they are not useful.
+ */
+struct partition_info
+{
+ /** @brief The number of partitions in this partitioning. */
+ uint16_t partition_count;
+
+ /** @brief The index (seed) of this partitioning. */
+ uint16_t partition_index;
+
+ /**
+ * @brief The number of texels in each partition.
+ *
+ * Note that some seeds result in zero texels assigned to a partition are valid, but are skipped
+ * by this compressor as there is no point spending bits encoding an unused color endpoint.
+ */
+ uint8_t partition_texel_count[BLOCK_MAX_PARTITIONS];
+
+ /** @brief The partition of each texel in the block. */
+ uint8_t partition_of_texel[BLOCK_MAX_TEXELS];
+
+ /** @brief The list of texels in each partition. */
+ uint8_t texels_of_partition[BLOCK_MAX_PARTITIONS][BLOCK_MAX_TEXELS];
+};
+
+/**
+ * @brief The weight grid information for a single decimation pattern.
+ *
+ * ASTC can store one weight per texel, but is also capable of storing lower resolution weight grids
+ * that are interpolated during decompression to assign a with to a texel. Storing fewer weights
+ * can free up a substantial amount of bits that we can then spend on more useful things, such as
+ * more accurate endpoints and weights, or additional partitions.
+ *
+ * This data structure is used to store information about a single weight grid decimation pattern,
+ * for a single block size.
+ */
+struct decimation_info
+{
+ /** @brief The total number of texels in the block. */
+ uint8_t texel_count;
+
+ /** @brief The maximum number of stored weights that contribute to each texel, between 1 and 4. */
+ uint8_t max_texel_weight_count;
+
+ /** @brief The total number of weights stored. */
+ uint8_t weight_count;
+
+ /** @brief The number of stored weights in the X dimension. */
+ uint8_t weight_x;
+
+ /** @brief The number of stored weights in the Y dimension. */
+ uint8_t weight_y;
+
+ /** @brief The number of stored weights in the Z dimension. */
+ uint8_t weight_z;
+
+ /**
+ * @brief The number of weights that contribute to each texel.
+ * Value is between 1 and 4.
+ */
+ uint8_t texel_weight_count[BLOCK_MAX_TEXELS];
+
+ /**
+ * @brief The weight index of the N weights that are interpolated for each texel.
+ * Stored transposed to improve vectorization.
+ */
+ uint8_t texel_weights_tr[4][BLOCK_MAX_TEXELS];
+
+ /**
+ * @brief The bilinear contribution of the N weights that are interpolated for each texel.
+ * Value is between 0 and 16, stored transposed to improve vectorization.
+ */
+ uint8_t texel_weight_contribs_int_tr[4][BLOCK_MAX_TEXELS];
+
+ /**
+ * @brief The bilinear contribution of the N weights that are interpolated for each texel.
+ * Value is between 0 and 1, stored transposed to improve vectorization.
+ */
+ alignas(ASTCENC_VECALIGN) float texel_weight_contribs_float_tr[4][BLOCK_MAX_TEXELS];
+
+ /** @brief The number of texels that each stored weight contributes to. */
+ uint8_t weight_texel_count[BLOCK_MAX_WEIGHTS];
+
+ /**
+ * @brief The list of texels that use a specific weight index.
+ * Stored transposed to improve vectorization.
+ */
+ uint8_t weight_texels_tr[BLOCK_MAX_TEXELS][BLOCK_MAX_WEIGHTS];
+
+ /**
+ * @brief The bilinear contribution to the N texels that use each weight.
+ * Value is between 0 and 1, stored transposed to improve vectorization.
+ */
+ alignas(ASTCENC_VECALIGN) float weights_texel_contribs_tr[BLOCK_MAX_TEXELS][BLOCK_MAX_WEIGHTS];
+
+ /**
+ * @brief The bilinear contribution to the Nth texel that uses each weight.
+ * Value is between 0 and 1, stored transposed to improve vectorization.
+ */
+ float texel_contrib_for_weight[BLOCK_MAX_TEXELS][BLOCK_MAX_WEIGHTS];
+};
+
+/**
+ * @brief Metadata for single block mode for a specific block size.
+ */
+struct block_mode
+{
+ /** @brief The block mode index in the ASTC encoded form. */
+ uint16_t mode_index;
+
+ /** @brief The decimation mode index in the compressor reindexed list. */
+ uint8_t decimation_mode;
+
+ /** @brief The weight quantization used by this block mode. */
+ uint8_t quant_mode;
+
+ /** @brief The weight quantization used by this block mode. */
+ uint8_t weight_bits;
+
+ /** @brief Is a dual weight plane used by this block mode? */
+ uint8_t is_dual_plane : 1;
+
+ /**
+ * @brief Get the weight quantization used by this block mode.
+ *
+ * @return The quantization level.
+ */
+ inline quant_method get_weight_quant_mode() const
+ {
+ return static_cast<quant_method>(this->quant_mode);
+ }
+};
+
+/**
+ * @brief Metadata for single decimation mode for a specific block size.
+ */
+struct decimation_mode
+{
+ /** @brief The max weight precision for 1 plane, or -1 if not supported. */
+ int8_t maxprec_1plane;
+
+ /** @brief The max weight precision for 2 planes, or -1 if not supported. */
+ int8_t maxprec_2planes;
+
+ /**
+ * @brief Bitvector indicating weight quant modes used by active 1 plane block modes.
+ *
+ * Bit 0 = QUANT_2, Bit 1 = QUANT_3, etc.
+ */
+ uint16_t refprec_1_plane;
+
+ /**
+ * @brief Bitvector indicating weight quant methods used by active 2 plane block modes.
+ *
+ * Bit 0 = QUANT_2, Bit 1 = QUANT_3, etc.
+ */
+ uint16_t refprec_2_planes;
+
+ /**
+ * @brief Set a 1 plane weight quant as active.
+ *
+ * @param weight_quant The quant method to set.
+ */
+ void set_ref_1_plane(quant_method weight_quant)
+ {
+ refprec_1_plane |= (1 << weight_quant);
+ }
+
+ /**
+ * @brief Test if this mode is active below a given 1 plane weight quant (inclusive).
+ *
+ * @param max_weight_quant The max quant method to test.
+ */
+ bool is_ref_1_plane(quant_method max_weight_quant) const
+ {
+ uint16_t mask = static_cast<uint16_t>((1 << (max_weight_quant + 1)) - 1);
+ return (refprec_1_plane & mask) != 0;
+ }
+
+ /**
+ * @brief Set a 2 plane weight quant as active.
+ *
+ * @param weight_quant The quant method to set.
+ */
+ void set_ref_2_plane(quant_method weight_quant)
+ {
+ refprec_2_planes |= static_cast<uint16_t>(1 << weight_quant);
+ }
+
+ /**
+ * @brief Test if this mode is active below a given 2 plane weight quant (inclusive).
+ *
+ * @param max_weight_quant The max quant method to test.
+ */
+ bool is_ref_2_plane(quant_method max_weight_quant) const
+ {
+ uint16_t mask = static_cast<uint16_t>((1 << (max_weight_quant + 1)) - 1);
+ return (refprec_2_planes & mask) != 0;
+ }
+};
+
+/**
+ * @brief Data tables for a single block size.
+ *
+ * The decimation tables store the information to apply weight grid dimension reductions. We only
+ * store the decimation modes that are actually needed by the current context; many of the possible
+ * modes will be unused (too many weights for the current block size or disabled by heuristics). The
+ * actual number of weights stored is @c decimation_mode_count, and the @c decimation_modes and
+ * @c decimation_tables arrays store the active modes contiguously at the start of the array. These
+ * entries are not stored in any particular order.
+ *
+ * The block mode tables store the unpacked block mode settings. Block modes are stored in the
+ * compressed block as an 11 bit field, but for any given block size and set of compressor
+ * heuristics, only a subset of the block modes will be used. The actual number of block modes
+ * stored is indicated in @c block_mode_count, and the @c block_modes array store the active modes
+ * contiguously at the start of the array. These entries are stored in incrementing "packed" value
+ * order, which doesn't mean much once unpacked. To allow decompressors to reference the packed data
+ * efficiently the @c block_mode_packed_index array stores the mapping between physical ID and the
+ * actual remapped array index.
+ */
+struct block_size_descriptor
+{
+ /** @brief The block X dimension, in texels. */
+ uint8_t xdim;
+
+ /** @brief The block Y dimension, in texels. */
+ uint8_t ydim;
+
+ /** @brief The block Z dimension, in texels. */
+ uint8_t zdim;
+
+ /** @brief The block total texel count. */
+ uint8_t texel_count;
+
+ /**
+ * @brief The number of stored decimation modes which are "always" modes.
+ *
+ * Always modes are stored at the start of the decimation_modes list.
+ */
+ unsigned int decimation_mode_count_always;
+
+ /** @brief The number of stored decimation modes for selected encodings. */
+ unsigned int decimation_mode_count_selected;
+
+ /** @brief The number of stored decimation modes for any encoding. */
+ unsigned int decimation_mode_count_all;
+
+ /**
+ * @brief The number of stored block modes which are "always" modes.
+ *
+ * Always modes are stored at the start of the block_modes list.
+ */
+ unsigned int block_mode_count_1plane_always;
+
+ /** @brief The number of stored block modes for active 1 plane encodings. */
+ unsigned int block_mode_count_1plane_selected;
+
+ /** @brief The number of stored block modes for active 1 and 2 plane encodings. */
+ unsigned int block_mode_count_1plane_2plane_selected;
+
+ /** @brief The number of stored block modes for any encoding. */
+ unsigned int block_mode_count_all;
+
+ /** @brief The number of selected partitionings for 1/2/3/4 partitionings. */
+ unsigned int partitioning_count_selected[BLOCK_MAX_PARTITIONS];
+
+ /** @brief The number of partitionings for 1/2/3/4 partitionings. */
+ unsigned int partitioning_count_all[BLOCK_MAX_PARTITIONS];
+
+ /** @brief The active decimation modes, stored in low indices. */
+ decimation_mode decimation_modes[WEIGHTS_MAX_DECIMATION_MODES];
+
+ /** @brief The active decimation tables, stored in low indices. */
+ alignas(ASTCENC_VECALIGN) decimation_info decimation_tables[WEIGHTS_MAX_DECIMATION_MODES];
+
+ /** @brief The packed block mode array index, or @c BLOCK_BAD_BLOCK_MODE if not active. */
+ uint16_t block_mode_packed_index[WEIGHTS_MAX_BLOCK_MODES];
+
+ /** @brief The active block modes, stored in low indices. */
+ block_mode block_modes[WEIGHTS_MAX_BLOCK_MODES];
+
+ /** @brief The active partition tables, stored in low indices per-count. */
+ partition_info partitionings[(3 * BLOCK_MAX_PARTITIONINGS) + 1];
+
+ /**
+ * @brief The packed partition table array index, or @c BLOCK_BAD_PARTITIONING if not active.
+ *
+ * Indexed by partition_count - 2, containing 2, 3 and 4 partitions.
+ */
+ uint16_t partitioning_packed_index[3][BLOCK_MAX_PARTITIONINGS];
+
+ /** @brief The active texels for k-means partition selection. */
+ uint8_t kmeans_texels[BLOCK_MAX_KMEANS_TEXELS];
+
+ /**
+ * @brief The canonical 2-partition coverage pattern used during block partition search.
+ *
+ * Indexed by remapped index, not physical index.
+ */
+ uint64_t coverage_bitmaps_2[BLOCK_MAX_PARTITIONINGS][2];
+
+ /**
+ * @brief The canonical 3-partition coverage pattern used during block partition search.
+ *
+ * Indexed by remapped index, not physical index.
+ */
+ uint64_t coverage_bitmaps_3[BLOCK_MAX_PARTITIONINGS][3];
+
+ /**
+ * @brief The canonical 4-partition coverage pattern used during block partition search.
+ *
+ * Indexed by remapped index, not physical index.
+ */
+ uint64_t coverage_bitmaps_4[BLOCK_MAX_PARTITIONINGS][4];
+
+ /**
+ * @brief Get the block mode structure for index @c block_mode.
+ *
+ * This function can only return block modes that are enabled by the current compressor config.
+ * Decompression from an arbitrary source should not use this without first checking that the
+ * packed block mode index is not @c BLOCK_BAD_BLOCK_MODE.
+ *
+ * @param block_mode The packed block mode index.
+ *
+ * @return The block mode structure.
+ */
+ const block_mode& get_block_mode(unsigned int block_mode) const
+ {
+ unsigned int packed_index = this->block_mode_packed_index[block_mode];
+ assert(packed_index != BLOCK_BAD_BLOCK_MODE && packed_index < this->block_mode_count_all);
+ return this->block_modes[packed_index];
+ }
+
+ /**
+ * @brief Get the decimation mode structure for index @c decimation_mode.
+ *
+ * This function can only return decimation modes that are enabled by the current compressor
+ * config. The mode array is stored packed, but this is only ever indexed by the packed index
+ * stored in the @c block_mode and never exists in an unpacked form.
+ *
+ * @param decimation_mode The packed decimation mode index.
+ *
+ * @return The decimation mode structure.
+ */
+ const decimation_mode& get_decimation_mode(unsigned int decimation_mode) const
+ {
+ return this->decimation_modes[decimation_mode];
+ }
+
+ /**
+ * @brief Get the decimation info structure for index @c decimation_mode.
+ *
+ * This function can only return decimation modes that are enabled by the current compressor
+ * config. The mode array is stored packed, but this is only ever indexed by the packed index
+ * stored in the @c block_mode and never exists in an unpacked form.
+ *
+ * @param decimation_mode The packed decimation mode index.
+ *
+ * @return The decimation info structure.
+ */
+ const decimation_info& get_decimation_info(unsigned int decimation_mode) const
+ {
+ return this->decimation_tables[decimation_mode];
+ }
+
+ /**
+ * @brief Get the partition info table for a given partition count.
+ *
+ * @param partition_count The number of partitions we want the table for.
+ *
+ * @return The pointer to the table of 1024 entries (for 2/3/4 parts) or 1 entry (for 1 part).
+ */
+ const partition_info* get_partition_table(unsigned int partition_count) const
+ {
+ if (partition_count == 1)
+ {
+ partition_count = 5;
+ }
+ unsigned int index = (partition_count - 2) * BLOCK_MAX_PARTITIONINGS;
+ return this->partitionings + index;
+ }
+
+ /**
+ * @brief Get the partition info structure for a given partition count and seed.
+ *
+ * @param partition_count The number of partitions we want the info for.
+ * @param index The partition seed (between 0 and 1023).
+ *
+ * @return The partition info structure.
+ */
+ const partition_info& get_partition_info(unsigned int partition_count, unsigned int index) const
+ {
+ unsigned int packed_index = 0;
+ if (partition_count >= 2)
+ {
+ packed_index = this->partitioning_packed_index[partition_count - 2][index];
+ }
+
+ assert(packed_index != BLOCK_BAD_PARTITIONING && packed_index < this->partitioning_count_all[partition_count - 1]);
+ auto& result = get_partition_table(partition_count)[packed_index];
+ assert(index == result.partition_index);
+ return result;
+ }
+
+ /**
+ * @brief Get the partition info structure for a given partition count and seed.
+ *
+ * @param partition_count The number of partitions we want the info for.
+ * @param packed_index The raw array offset.
+ *
+ * @return The partition info structure.
+ */
+ const partition_info& get_raw_partition_info(unsigned int partition_count, unsigned int packed_index) const
+ {
+ assert(packed_index != BLOCK_BAD_PARTITIONING && packed_index < this->partitioning_count_all[partition_count - 1]);
+ auto& result = get_partition_table(partition_count)[packed_index];
+ return result;
+ }
+};
+
+/**
+ * @brief The image data for a single block.
+ *
+ * The @c data_[rgba] fields store the image data in an encoded SoA float form designed for easy
+ * vectorization. Input data is converted to float and stored as values between 0 and 65535. LDR
+ * data is stored as direct UNORM data, HDR data is stored as LNS data.
+ *
+ * The @c rgb_lns and @c alpha_lns fields that assigned a per-texel use of HDR are only used during
+ * decompression. The current compressor will always use HDR endpoint formats when in HDR mode.
+ */
+struct image_block
+{
+ /** @brief The input (compress) or output (decompress) data for the red color component. */
+ alignas(ASTCENC_VECALIGN) float data_r[BLOCK_MAX_TEXELS];
+
+ /** @brief The input (compress) or output (decompress) data for the green color component. */
+ alignas(ASTCENC_VECALIGN) float data_g[BLOCK_MAX_TEXELS];
+
+ /** @brief The input (compress) or output (decompress) data for the blue color component. */
+ alignas(ASTCENC_VECALIGN) float data_b[BLOCK_MAX_TEXELS];
+
+ /** @brief The input (compress) or output (decompress) data for the alpha color component. */
+ alignas(ASTCENC_VECALIGN) float data_a[BLOCK_MAX_TEXELS];
+
+ /** @brief The number of texels in the block. */
+ uint8_t texel_count;
+
+ /** @brief The original data for texel 0 for constant color block encoding. */
+ vfloat4 origin_texel;
+
+ /** @brief The min component value of all texels in the block. */
+ vfloat4 data_min;
+
+ /** @brief The mean component value of all texels in the block. */
+ vfloat4 data_mean;
+
+ /** @brief The max component value of all texels in the block. */
+ vfloat4 data_max;
+
+ /** @brief The relative error significance of the color channels. */
+ vfloat4 channel_weight;
+
+ /** @brief Is this grayscale block where R == G == B for all texels? */
+ bool grayscale;
+
+ /** @brief Set to 1 if a texel is using HDR RGB endpoints (decompression only). */
+ uint8_t rgb_lns[BLOCK_MAX_TEXELS];
+
+ /** @brief Set to 1 if a texel is using HDR alpha endpoints (decompression only). */
+ uint8_t alpha_lns[BLOCK_MAX_TEXELS];
+
+ /** @brief The X position of this block in the input or output image. */
+ unsigned int xpos;
+
+ /** @brief The Y position of this block in the input or output image. */
+ unsigned int ypos;
+
+ /** @brief The Z position of this block in the input or output image. */
+ unsigned int zpos;
+
+ /**
+ * @brief Get an RGBA texel value from the data.
+ *
+ * @param index The texel index.
+ *
+ * @return The texel in RGBA component ordering.
+ */
+ inline vfloat4 texel(unsigned int index) const
+ {
+ return vfloat4(data_r[index],
+ data_g[index],
+ data_b[index],
+ data_a[index]);
+ }
+
+ /**
+ * @brief Get an RGB texel value from the data.
+ *
+ * @param index The texel index.
+ *
+ * @return The texel in RGB0 component ordering.
+ */
+ inline vfloat4 texel3(unsigned int index) const
+ {
+ return vfloat3(data_r[index],
+ data_g[index],
+ data_b[index]);
+ }
+
+ /**
+ * @brief Get the default alpha value for endpoints that don't store it.
+ *
+ * The default depends on whether the alpha endpoint is LDR or HDR.
+ *
+ * @return The alpha value in the scaled range used by the compressor.
+ */
+ inline float get_default_alpha() const
+ {
+ return this->alpha_lns[0] ? static_cast<float>(0x7800) : static_cast<float>(0xFFFF);
+ }
+
+ /**
+ * @brief Test if a single color channel is constant across the block.
+ *
+ * Constant color channels are easier to compress as interpolating between two identical colors
+ * always returns the same value, irrespective of the weight used. They therefore can be ignored
+ * for the purposes of weight selection and use of a second weight plane.
+ *
+ * @return @c true if the channel is constant across the block, @c false otherwise.
+ */
+ inline bool is_constant_channel(int channel) const
+ {
+ vmask4 lane_mask = vint4::lane_id() == vint4(channel);
+ vmask4 color_mask = this->data_min == this->data_max;
+ return any(lane_mask & color_mask);
+ }
+
+ /**
+ * @brief Test if this block is a luminance block with constant 1.0 alpha.
+ *
+ * @return @c true if the block is a luminance block , @c false otherwise.
+ */
+ inline bool is_luminance() const
+ {
+ float default_alpha = this->get_default_alpha();
+ bool alpha1 = (this->data_min.lane<3>() == default_alpha) &&
+ (this->data_max.lane<3>() == default_alpha);
+ return this->grayscale && alpha1;
+ }
+
+ /**
+ * @brief Test if this block is a luminance block with variable alpha.
+ *
+ * @return @c true if the block is a luminance + alpha block , @c false otherwise.
+ */
+ inline bool is_luminancealpha() const
+ {
+ float default_alpha = this->get_default_alpha();
+ bool alpha1 = (this->data_min.lane<3>() == default_alpha) &&
+ (this->data_max.lane<3>() == default_alpha);
+ return this->grayscale && !alpha1;
+ }
+};
+
+/**
+ * @brief Data structure storing the color endpoints for a block.
+ */
+struct endpoints
+{
+ /** @brief The number of partition endpoints stored. */
+ unsigned int partition_count;
+
+ /** @brief The colors for endpoint 0. */
+ vfloat4 endpt0[BLOCK_MAX_PARTITIONS];
+
+ /** @brief The colors for endpoint 1. */
+ vfloat4 endpt1[BLOCK_MAX_PARTITIONS];
+};
+
+/**
+ * @brief Data structure storing the color endpoints and weights.
+ */
+struct endpoints_and_weights
+{
+ /** @brief True if all active values in weight_error_scale are the same. */
+ bool is_constant_weight_error_scale;
+
+ /** @brief The color endpoints. */
+ endpoints ep;
+
+ /** @brief The ideal weight for each texel; may be undecimated or decimated. */
+ alignas(ASTCENC_VECALIGN) float weights[BLOCK_MAX_TEXELS];
+
+ /** @brief The ideal weight error scaling for each texel; may be undecimated or decimated. */
+ alignas(ASTCENC_VECALIGN) float weight_error_scale[BLOCK_MAX_TEXELS];
+};
+
+/**
+ * @brief Utility storing estimated errors from choosing particular endpoint encodings.
+ */
+struct encoding_choice_errors
+{
+ /** @brief Error of using LDR RGB-scale instead of complete endpoints. */
+ float rgb_scale_error;
+
+ /** @brief Error of using HDR RGB-scale instead of complete endpoints. */
+ float rgb_luma_error;
+
+ /** @brief Error of using luminance instead of RGB. */
+ float luminance_error;
+
+ /** @brief Error of discarding alpha and using a constant 1.0 alpha. */
+ float alpha_drop_error;
+
+ /** @brief Can we use delta offset encoding? */
+ bool can_offset_encode;
+
+ /** @brief Can we use blue contraction encoding? */
+ bool can_blue_contract;
+};
+
+/**
+ * @brief Preallocated working buffers, allocated per thread during context creation.
+ */
+struct alignas(ASTCENC_VECALIGN) compression_working_buffers
+{
+ /** @brief Ideal endpoints and weights for plane 1. */
+ endpoints_and_weights ei1;
+
+ /** @brief Ideal endpoints and weights for plane 2. */
+ endpoints_and_weights ei2;
+
+ /**
+ * @brief Decimated ideal weight values in the ~0-1 range.
+ *
+ * Note that values can be slightly below zero or higher than one due to
+ * endpoint extents being inside the ideal color representation.
+ *
+ * For two planes, second plane starts at @c WEIGHTS_PLANE2_OFFSET offsets.
+ */
+ alignas(ASTCENC_VECALIGN) float dec_weights_ideal[WEIGHTS_MAX_DECIMATION_MODES * BLOCK_MAX_WEIGHTS];
+
+ /**
+ * @brief Decimated quantized weight values in the unquantized 0-64 range.
+ *
+ * For two planes, second plane starts at @c WEIGHTS_PLANE2_OFFSET offsets.
+ */
+ uint8_t dec_weights_uquant[WEIGHTS_MAX_BLOCK_MODES * BLOCK_MAX_WEIGHTS];
+
+ /** @brief Error of the best encoding combination for each block mode. */
+ alignas(ASTCENC_VECALIGN) float errors_of_best_combination[WEIGHTS_MAX_BLOCK_MODES];
+
+ /** @brief The best color quant for each block mode. */
+ uint8_t best_quant_levels[WEIGHTS_MAX_BLOCK_MODES];
+
+ /** @brief The best color quant for each block mode if modes are the same and we have spare bits. */
+ uint8_t best_quant_levels_mod[WEIGHTS_MAX_BLOCK_MODES];
+
+ /** @brief The best endpoint format for each partition. */
+ uint8_t best_ep_formats[WEIGHTS_MAX_BLOCK_MODES][BLOCK_MAX_PARTITIONS];
+
+ /** @brief The total bit storage needed for quantized weights for each block mode. */
+ int8_t qwt_bitcounts[WEIGHTS_MAX_BLOCK_MODES];
+
+ /** @brief The cumulative error for quantized weights for each block mode. */
+ float qwt_errors[WEIGHTS_MAX_BLOCK_MODES];
+
+ /** @brief The low weight value in plane 1 for each block mode. */
+ float weight_low_value1[WEIGHTS_MAX_BLOCK_MODES];
+
+ /** @brief The high weight value in plane 1 for each block mode. */
+ float weight_high_value1[WEIGHTS_MAX_BLOCK_MODES];
+
+ /** @brief The low weight value in plane 1 for each quant level and decimation mode. */
+ float weight_low_values1[WEIGHTS_MAX_DECIMATION_MODES][TUNE_MAX_ANGULAR_QUANT + 1];
+
+ /** @brief The high weight value in plane 1 for each quant level and decimation mode. */
+ float weight_high_values1[WEIGHTS_MAX_DECIMATION_MODES][TUNE_MAX_ANGULAR_QUANT + 1];
+
+ /** @brief The low weight value in plane 2 for each block mode. */
+ float weight_low_value2[WEIGHTS_MAX_BLOCK_MODES];
+
+ /** @brief The high weight value in plane 2 for each block mode. */
+ float weight_high_value2[WEIGHTS_MAX_BLOCK_MODES];
+
+ /** @brief The low weight value in plane 2 for each quant level and decimation mode. */
+ float weight_low_values2[WEIGHTS_MAX_DECIMATION_MODES][TUNE_MAX_ANGULAR_QUANT + 1];
+
+ /** @brief The high weight value in plane 2 for each quant level and decimation mode. */
+ float weight_high_values2[WEIGHTS_MAX_DECIMATION_MODES][TUNE_MAX_ANGULAR_QUANT + 1];
+};
+
+struct dt_init_working_buffers
+{
+ uint8_t weight_count_of_texel[BLOCK_MAX_TEXELS];
+ uint8_t grid_weights_of_texel[BLOCK_MAX_TEXELS][4];
+ uint8_t weights_of_texel[BLOCK_MAX_TEXELS][4];
+
+ uint8_t texel_count_of_weight[BLOCK_MAX_WEIGHTS];
+ uint8_t texels_of_weight[BLOCK_MAX_WEIGHTS][BLOCK_MAX_TEXELS];
+ uint8_t texel_weights_of_weight[BLOCK_MAX_WEIGHTS][BLOCK_MAX_TEXELS];
+};
+
+/**
+ * @brief Weight quantization transfer table.
+ *
+ * ASTC can store texel weights at many quantization levels, so for performance we store essential
+ * information about each level as a precomputed data structure. Unquantized weights are integers
+ * or floats in the range [0, 64].
+ *
+ * This structure provides a table, used to estimate the closest quantized weight for a given
+ * floating-point weight. For each quantized weight, the corresponding unquantized values. For each
+ * quantized weight, a previous-value and a next-value.
+*/
+struct quant_and_transfer_table
+{
+ /** @brief The unscrambled unquantized value. */
+ int8_t quant_to_unquant[32];
+
+ /** @brief The scrambling order: scrambled_quant = map[unscrambled_quant]. */
+ int8_t scramble_map[32];
+
+ /** @brief The unscrambling order: unscrambled_unquant = map[scrambled_quant]. */
+ int8_t unscramble_and_unquant_map[32];
+
+ /**
+ * @brief A table of previous-and-next weights, indexed by the current unquantized value.
+ * * bits 7:0 = previous-index, unquantized
+ * * bits 15:8 = next-index, unquantized
+ */
+ uint16_t prev_next_values[65];
+};
+
+/** @brief The precomputed quant and transfer table. */
+extern const quant_and_transfer_table quant_and_xfer_tables[12];
+
+/** @brief The block is an error block, and will return error color or NaN. */
+static constexpr uint8_t SYM_BTYPE_ERROR { 0 };
+
+/** @brief The block is a constant color block using FP16 colors. */
+static constexpr uint8_t SYM_BTYPE_CONST_F16 { 1 };
+
+/** @brief The block is a constant color block using UNORM16 colors. */
+static constexpr uint8_t SYM_BTYPE_CONST_U16 { 2 };
+
+/** @brief The block is a normal non-constant color block. */
+static constexpr uint8_t SYM_BTYPE_NONCONST { 3 };
+
+/**
+ * @brief A symbolic representation of a compressed block.
+ *
+ * The symbolic representation stores the unpacked content of a single
+ * @c physical_compressed_block, in a form which is much easier to access for
+ * the rest of the compressor code.
+ */
+struct symbolic_compressed_block
+{
+ /** @brief The block type, one of the @c SYM_BTYPE_* constants. */
+ uint8_t block_type;
+
+ /** @brief The number of partitions; valid for @c NONCONST blocks. */
+ uint8_t partition_count;
+
+ /** @brief Non-zero if the color formats matched; valid for @c NONCONST blocks. */
+ uint8_t color_formats_matched;
+
+ /** @brief The plane 2 color component, or -1 if single plane; valid for @c NONCONST blocks. */
+ int8_t plane2_component;
+
+ /** @brief The block mode; valid for @c NONCONST blocks. */
+ uint16_t block_mode;
+
+ /** @brief The partition index; valid for @c NONCONST blocks if 2 or more partitions. */
+ uint16_t partition_index;
+
+ /** @brief The endpoint color formats for each partition; valid for @c NONCONST blocks. */
+ uint8_t color_formats[BLOCK_MAX_PARTITIONS];
+
+ /** @brief The endpoint color quant mode; valid for @c NONCONST blocks. */
+ quant_method quant_mode;
+
+ /** @brief The error of the current encoding; valid for @c NONCONST blocks. */
+ float errorval;
+
+ // We can't have both of these at the same time
+ union {
+ /** @brief The constant color; valid for @c CONST blocks. */
+ int constant_color[BLOCK_MAX_COMPONENTS];
+
+ /** @brief The quantized endpoint color pairs; valid for @c NONCONST blocks. */
+ uint8_t color_values[BLOCK_MAX_PARTITIONS][8];
+ };
+
+ /** @brief The quantized and decimated weights.
+ *
+ * Weights are stored in the 0-64 unpacked range allowing them to be used
+ * directly in encoding passes without per-use unpacking. Packing happens
+ * when converting to/from the physical bitstream encoding.
+ *
+ * If dual plane, the second plane starts at @c weights[WEIGHTS_PLANE2_OFFSET].
+ */
+ uint8_t weights[BLOCK_MAX_WEIGHTS];
+
+ /**
+ * @brief Get the weight quantization used by this block mode.
+ *
+ * @return The quantization level.
+ */
+ inline quant_method get_color_quant_mode() const
+ {
+ return this->quant_mode;
+ }
+};
+
+/**
+ * @brief A physical representation of a compressed block.
+ *
+ * The physical representation stores the raw bytes of the format in memory.
+ */
+struct physical_compressed_block
+{
+ /** @brief The ASTC encoded data for a single block. */
+ uint8_t data[16];
+};
+
+
+/**
+ * @brief Parameter structure for @c compute_pixel_region_variance().
+ *
+ * This function takes a structure to avoid spilling arguments to the stack on every function
+ * invocation, as there are a lot of parameters.
+ */
+struct pixel_region_args
+{
+ /** @brief The image to analyze. */
+ const astcenc_image* img;
+
+ /** @brief The component swizzle pattern. */
+ astcenc_swizzle swz;
+
+ /** @brief Should the algorithm bother with Z axis processing? */
+ bool have_z;
+
+ /** @brief The kernel radius for alpha processing. */
+ unsigned int alpha_kernel_radius;
+
+ /** @brief The X dimension of the working data to process. */
+ unsigned int size_x;
+
+ /** @brief The Y dimension of the working data to process. */
+ unsigned int size_y;
+
+ /** @brief The Z dimension of the working data to process. */
+ unsigned int size_z;
+
+ /** @brief The X position of first src and dst data in the data set. */
+ unsigned int offset_x;
+
+ /** @brief The Y position of first src and dst data in the data set. */
+ unsigned int offset_y;
+
+ /** @brief The Z position of first src and dst data in the data set. */
+ unsigned int offset_z;
+
+ /** @brief The working memory buffer. */
+ vfloat4 *work_memory;
+};
+
+/**
+ * @brief Parameter structure for @c compute_averages_proc().
+ */
+struct avg_args
+{
+ /** @brief The arguments for the nested variance computation. */
+ pixel_region_args arg;
+
+ /** @brief The image X dimensions. */
+ unsigned int img_size_x;
+
+ /** @brief The image Y dimensions. */
+ unsigned int img_size_y;
+
+ /** @brief The image Z dimensions. */
+ unsigned int img_size_z;
+
+ /** @brief The maximum working block dimensions in X and Y dimensions. */
+ unsigned int blk_size_xy;
+
+ /** @brief The maximum working block dimensions in Z dimensions. */
+ unsigned int blk_size_z;
+
+ /** @brief The working block memory size. */
+ unsigned int work_memory_size;
+};
+
+#if defined(ASTCENC_DIAGNOSTICS)
+/* See astcenc_diagnostic_trace header for details. */
+class TraceLog;
+#endif
+
+/**
+ * @brief The astcenc compression context.
+ */
+struct astcenc_contexti
+{
+ /** @brief The configuration this context was created with. */
+ astcenc_config config;
+
+ /** @brief The thread count supported by this context. */
+ unsigned int thread_count;
+
+ /** @brief The block size descriptor this context was created with. */
+ block_size_descriptor* bsd;
+
+ /*
+ * Fields below here are not needed in a decompress-only build, but some remain as they are
+ * small and it avoids littering the code with #ifdefs. The most significant contributors to
+ * large structure size are omitted.
+ */
+
+ /** @brief The input image alpha channel averages table, may be @c nullptr if not needed. */
+ float* input_alpha_averages;
+
+ /** @brief The scratch working buffers, one per thread (see @c thread_count). */
+ compression_working_buffers* working_buffers;
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+ /** @brief The pixel region and variance worker arguments. */
+ avg_args avg_preprocess_args;
+#endif
+
+#if defined(ASTCENC_DIAGNOSTICS)
+ /**
+ * @brief The diagnostic trace logger.
+ *
+ * Note that this is a singleton, so can only be used in single threaded mode. It only exists
+ * here so we have a reference to close the file at the end of the capture.
+ */
+ TraceLog* trace_log;
+#endif
+};
+
+/* ============================================================================
+ Functionality for managing block sizes and partition tables.
+============================================================================ */
+
+/**
+ * @brief Populate the block size descriptor for the target block size.
+ *
+ * This will also initialize the partition table metadata, which is stored as part of the BSD
+ * structure.
+ *
+ * @param x_texels The number of texels in the block X dimension.
+ * @param y_texels The number of texels in the block Y dimension.
+ * @param z_texels The number of texels in the block Z dimension.
+ * @param can_omit_modes Can we discard modes and partitionings that astcenc won't use?
+ * @param partition_count_cutoff The partition count cutoff to use, if we can omit partitionings.
+ * @param mode_cutoff The block mode percentile cutoff [0-1].
+ * @param[out] bsd The descriptor to initialize.
+ */
+void init_block_size_descriptor(
+ unsigned int x_texels,
+ unsigned int y_texels,
+ unsigned int z_texels,
+ bool can_omit_modes,
+ unsigned int partition_count_cutoff,
+ float mode_cutoff,
+ block_size_descriptor& bsd);
+
+/**
+ * @brief Populate the partition tables for the target block size.
+ *
+ * Note the @c bsd descriptor must be initialized by calling @c init_block_size_descriptor() before
+ * calling this function.
+ *
+ * @param[out] bsd The block size information structure to populate.
+ * @param can_omit_partitionings True if we can we drop partitionings that astcenc won't use.
+ * @param partition_count_cutoff The partition count cutoff to use, if we can omit partitionings.
+ */
+void init_partition_tables(
+ block_size_descriptor& bsd,
+ bool can_omit_partitionings,
+ unsigned int partition_count_cutoff);
+
+/**
+ * @brief Get the percentile table for 2D block modes.
+ *
+ * This is an empirically determined prioritization of which block modes to use in the search in
+ * terms of their centile (lower centiles = more useful).
+ *
+ * Returns a dynamically allocated array; caller must free with delete[].
+ *
+ * @param xdim The block x size.
+ * @param ydim The block y size.
+ *
+ * @return The unpacked table.
+ */
+const float* get_2d_percentile_table(
+ unsigned int xdim,
+ unsigned int ydim);
+
+/**
+ * @brief Query if a 2D block size is legal.
+ *
+ * @return True if legal, false otherwise.
+ */
+bool is_legal_2d_block_size(
+ unsigned int xdim,
+ unsigned int ydim);
+
+/**
+ * @brief Query if a 3D block size is legal.
+ *
+ * @return True if legal, false otherwise.
+ */
+bool is_legal_3d_block_size(
+ unsigned int xdim,
+ unsigned int ydim,
+ unsigned int zdim);
+
+/* ============================================================================
+ Functionality for managing BISE quantization and unquantization.
+============================================================================ */
+
+/**
+ * @brief The precomputed table for quantizing color values.
+ *
+ * Converts unquant value in 0-255 range into quant value in 0-255 range.
+ * No BISE scrambling is applied at this stage.
+ *
+ * Indexed by [quant_mode - 4][data_value].
+ */
+extern const uint8_t color_unquant_to_uquant_tables[17][256];
+
+/**
+ * @brief The precomputed table for packing quantized color values.
+ *
+ * Converts quant value in 0-255 range into packed quant value in 0-N range,
+ * with BISE scrambling applied.
+ *
+ * Indexed by [quant_mode - 4][data_value].
+ */
+extern const uint8_t color_uquant_to_scrambled_pquant_tables[17][256];
+
+/**
+ * @brief The precomputed table for unpacking color values.
+ *
+ * Converts quant value in 0-N range into unpacked value in 0-255 range,
+ * with BISE unscrambling applied.
+ *
+ * Indexed by [quant_mode - 4][data_value].
+ */
+extern const uint8_t* color_scrambled_pquant_to_uquant_tables[17];
+
+/**
+ * @brief The precomputed quant mode storage table.
+ *
+ * Indexing by [integer_count/2][bits] gives us the quantization level for a given integer count and
+ * number of compressed storage bits. Returns -1 for cases where the requested integer count cannot
+ * ever fit in the supplied storage size.
+ */
+extern const int8_t quant_mode_table[10][128];
+
+/**
+ * @brief Encode a packed string using BISE.
+ *
+ * Note that BISE can return strings that are not a whole number of bytes in length, and ASTC can
+ * start storing strings in a block at arbitrary bit offsets in the encoded data.
+ *
+ * @param quant_level The BISE alphabet size.
+ * @param character_count The number of characters in the string.
+ * @param input_data The unpacked string, one byte per character.
+ * @param[in,out] output_data The output packed string.
+ * @param bit_offset The starting offset in the output storage.
+ */
+void encode_ise(
+ quant_method quant_level,
+ unsigned int character_count,
+ const uint8_t* input_data,
+ uint8_t* output_data,
+ unsigned int bit_offset);
+
+/**
+ * @brief Decode a packed string using BISE.
+ *
+ * Note that BISE input strings are not a whole number of bytes in length, and ASTC can start
+ * strings at arbitrary bit offsets in the encoded data.
+ *
+ * @param quant_level The BISE alphabet size.
+ * @param character_count The number of characters in the string.
+ * @param input_data The packed string.
+ * @param[in,out] output_data The output storage, one byte per character.
+ * @param bit_offset The starting offset in the output storage.
+ */
+void decode_ise(
+ quant_method quant_level,
+ unsigned int character_count,
+ const uint8_t* input_data,
+ uint8_t* output_data,
+ unsigned int bit_offset);
+
+/**
+ * @brief Return the number of bits needed to encode an ISE sequence.
+ *
+ * This implementation assumes that the @c quant level is untrusted, given it may come from random
+ * data being decompressed, so we return an arbitrary unencodable size if that is the case.
+ *
+ * @param character_count The number of items in the sequence.
+ * @param quant_level The desired quantization level.
+ *
+ * @return The number of bits needed to encode the BISE string.
+ */
+unsigned int get_ise_sequence_bitcount(
+ unsigned int character_count,
+ quant_method quant_level);
+
+/* ============================================================================
+ Functionality for managing color partitioning.
+============================================================================ */
+
+/**
+ * @brief Compute averages and dominant directions for each partition in a 2 component texture.
+ *
+ * @param pi The partition info for the current trial.
+ * @param blk The image block color data to be compressed.
+ * @param component1 The first component included in the analysis.
+ * @param component2 The second component included in the analysis.
+ * @param[out] pm The output partition metrics.
+ * - Only pi.partition_count array entries actually get initialized.
+ * - Direction vectors @c pm.dir are not normalized.
+ */
+void compute_avgs_and_dirs_2_comp(
+ const partition_info& pi,
+ const image_block& blk,
+ unsigned int component1,
+ unsigned int component2,
+ partition_metrics pm[BLOCK_MAX_PARTITIONS]);
+
+/**
+ * @brief Compute averages and dominant directions for each partition in a 3 component texture.
+ *
+ * @param pi The partition info for the current trial.
+ * @param blk The image block color data to be compressed.
+ * @param omitted_component The component excluded from the analysis.
+ * @param[out] pm The output partition metrics.
+ * - Only pi.partition_count array entries actually get initialized.
+ * - Direction vectors @c pm.dir are not normalized.
+ */
+void compute_avgs_and_dirs_3_comp(
+ const partition_info& pi,
+ const image_block& blk,
+ unsigned int omitted_component,
+ partition_metrics pm[BLOCK_MAX_PARTITIONS]);
+
+/**
+ * @brief Compute averages and dominant directions for each partition in a 3 component texture.
+ *
+ * This is a specialization of @c compute_avgs_and_dirs_3_comp where the omitted component is
+ * always alpha, a common case during partition search.
+ *
+ * @param pi The partition info for the current trial.
+ * @param blk The image block color data to be compressed.
+ * @param[out] pm The output partition metrics.
+ * - Only pi.partition_count array entries actually get initialized.
+ * - Direction vectors @c pm.dir are not normalized.
+ */
+void compute_avgs_and_dirs_3_comp_rgb(
+ const partition_info& pi,
+ const image_block& blk,
+ partition_metrics pm[BLOCK_MAX_PARTITIONS]);
+
+/**
+ * @brief Compute averages and dominant directions for each partition in a 4 component texture.
+ *
+ * @param pi The partition info for the current trial.
+ * @param blk The image block color data to be compressed.
+ * @param[out] pm The output partition metrics.
+ * - Only pi.partition_count array entries actually get initialized.
+ * - Direction vectors @c pm.dir are not normalized.
+ */
+void compute_avgs_and_dirs_4_comp(
+ const partition_info& pi,
+ const image_block& blk,
+ partition_metrics pm[BLOCK_MAX_PARTITIONS]);
+
+/**
+ * @brief Compute the RGB error for uncorrelated and same chroma projections.
+ *
+ * The output of compute averages and dirs is post processed to define two lines, both of which go
+ * through the mean-color-value. One line has a direction defined by the dominant direction; this
+ * is used to assess the error from using an uncorrelated color representation. The other line goes
+ * through (0,0,0) and is used to assess the error from using an RGBS color representation.
+ *
+ * This function computes the squared error when using these two representations.
+ *
+ * @param pi The partition info for the current trial.
+ * @param blk The image block color data to be compressed.
+ * @param[in,out] plines Processed line inputs, and line length outputs.
+ * @param[out] uncor_error The cumulative error for using the uncorrelated line.
+ * @param[out] samec_error The cumulative error for using the same chroma line.
+ */
+void compute_error_squared_rgb(
+ const partition_info& pi,
+ const image_block& blk,
+ partition_lines3 plines[BLOCK_MAX_PARTITIONS],
+ float& uncor_error,
+ float& samec_error);
+
+/**
+ * @brief Compute the RGBA error for uncorrelated and same chroma projections.
+ *
+ * The output of compute averages and dirs is post processed to define two lines, both of which go
+ * through the mean-color-value. One line has a direction defined by the dominant direction; this
+ * is used to assess the error from using an uncorrelated color representation. The other line goes
+ * through (0,0,0,1) and is used to assess the error from using an RGBS color representation.
+ *
+ * This function computes the squared error when using these two representations.
+ *
+ * @param pi The partition info for the current trial.
+ * @param blk The image block color data to be compressed.
+ * @param uncor_plines Processed uncorrelated partition lines for each partition.
+ * @param samec_plines Processed same chroma partition lines for each partition.
+ * @param[out] uncor_lengths The length of each components deviation from the line.
+ * @param[out] samec_lengths The length of each components deviation from the line.
+ * @param[out] uncor_error The cumulative error for using the uncorrelated line.
+ * @param[out] samec_error The cumulative error for using the same chroma line.
+ */
+void compute_error_squared_rgba(
+ const partition_info& pi,
+ const image_block& blk,
+ const processed_line4 uncor_plines[BLOCK_MAX_PARTITIONS],
+ const processed_line4 samec_plines[BLOCK_MAX_PARTITIONS],
+ float uncor_lengths[BLOCK_MAX_PARTITIONS],
+ float samec_lengths[BLOCK_MAX_PARTITIONS],
+ float& uncor_error,
+ float& samec_error);
+
+/**
+ * @brief Find the best set of partitions to trial for a given block.
+ *
+ * On return the @c best_partitions list will contain the two best partition
+ * candidates; one assuming data has uncorrelated chroma and one assuming the
+ * data has correlated chroma. The best candidate is returned first in the list.
+ *
+ * @param bsd The block size information.
+ * @param blk The image block color data to compress.
+ * @param partition_count The number of partitions in the block.
+ * @param partition_search_limit The number of candidate partition encodings to trial.
+ * @param[out] best_partitions The best partition candidates.
+ * @param requested_candidates The number of requested partitionings. May return fewer if
+ * candidates are not available.
+ *
+ * @return The actual number of candidates returned.
+ */
+unsigned int find_best_partition_candidates(
+ const block_size_descriptor& bsd,
+ const image_block& blk,
+ unsigned int partition_count,
+ unsigned int partition_search_limit,
+ unsigned int best_partitions[TUNE_MAX_PARTITIONING_CANDIDATES],
+ unsigned int requested_candidates);
+
+/* ============================================================================
+ Functionality for managing images and image related data.
+============================================================================ */
+
+/**
+ * @brief Setup computation of regional averages in an image.
+ *
+ * This must be done by only a single thread per image, before any thread calls
+ * @c compute_averages().
+ *
+ * Results are written back into @c img->input_alpha_averages.
+ *
+ * @param img The input image data, also holds output data.
+ * @param alpha_kernel_radius The kernel radius (in pixels) for alpha mods.
+ * @param swz Input data component swizzle.
+ * @param[out] ag The average variance arguments to init.
+ *
+ * @return The number of tasks in the processing stage.
+ */
+unsigned int init_compute_averages(
+ const astcenc_image& img,
+ unsigned int alpha_kernel_radius,
+ const astcenc_swizzle& swz,
+ avg_args& ag);
+
+/**
+ * @brief Compute averages for a pixel region.
+ *
+ * The routine computes both in a single pass, using a summed-area table to decouple the running
+ * time from the averaging/variance kernel size.
+ *
+ * @param[out] ctx The compressor context storing the output data.
+ * @param arg The input parameter structure.
+ */
+void compute_pixel_region_variance(
+ astcenc_contexti& ctx,
+ const pixel_region_args& arg);
+/**
+ * @brief Load a single image block from the input image.
+ *
+ * @param decode_mode The compression color profile.
+ * @param img The input image data.
+ * @param[out] blk The image block to populate.
+ * @param bsd The block size information.
+ * @param xpos The block X coordinate in the input image.
+ * @param ypos The block Y coordinate in the input image.
+ * @param zpos The block Z coordinate in the input image.
+ * @param swz The swizzle to apply on load.
+ */
+void load_image_block(
+ astcenc_profile decode_mode,
+ const astcenc_image& img,
+ image_block& blk,
+ const block_size_descriptor& bsd,
+ unsigned int xpos,
+ unsigned int ypos,
+ unsigned int zpos,
+ const astcenc_swizzle& swz);
+
+/**
+ * @brief Load a single image block from the input image.
+ *
+ * This specialized variant can be used only if the block is 2D LDR U8 data,
+ * with no swizzle.
+ *
+ * @param decode_mode The compression color profile.
+ * @param img The input image data.
+ * @param[out] blk The image block to populate.
+ * @param bsd The block size information.
+ * @param xpos The block X coordinate in the input image.
+ * @param ypos The block Y coordinate in the input image.
+ * @param zpos The block Z coordinate in the input image.
+ * @param swz The swizzle to apply on load.
+ */
+void load_image_block_fast_ldr(
+ astcenc_profile decode_mode,
+ const astcenc_image& img,
+ image_block& blk,
+ const block_size_descriptor& bsd,
+ unsigned int xpos,
+ unsigned int ypos,
+ unsigned int zpos,
+ const astcenc_swizzle& swz);
+
+/**
+ * @brief Store a single image block to the output image.
+ *
+ * @param[out] img The output image data.
+ * @param blk The image block to export.
+ * @param bsd The block size information.
+ * @param xpos The block X coordinate in the input image.
+ * @param ypos The block Y coordinate in the input image.
+ * @param zpos The block Z coordinate in the input image.
+ * @param swz The swizzle to apply on store.
+ */
+void store_image_block(
+ astcenc_image& img,
+ const image_block& blk,
+ const block_size_descriptor& bsd,
+ unsigned int xpos,
+ unsigned int ypos,
+ unsigned int zpos,
+ const astcenc_swizzle& swz);
+
+/* ============================================================================
+ Functionality for computing endpoint colors and weights for a block.
+============================================================================ */
+
+/**
+ * @brief Compute ideal endpoint colors and weights for 1 plane of weights.
+ *
+ * The ideal endpoints define a color line for the partition. For each texel the ideal weight
+ * defines an exact position on the partition color line. We can then use these to assess the error
+ * introduced by removing and quantizing the weight grid.
+ *
+ * @param blk The image block color data to compress.
+ * @param pi The partition info for the current trial.
+ * @param[out] ei The endpoint and weight values.
+ */
+void compute_ideal_colors_and_weights_1plane(
+ const image_block& blk,
+ const partition_info& pi,
+ endpoints_and_weights& ei);
+
+/**
+ * @brief Compute ideal endpoint colors and weights for 2 planes of weights.
+ *
+ * The ideal endpoints define a color line for the partition. For each texel the ideal weight
+ * defines an exact position on the partition color line. We can then use these to assess the error
+ * introduced by removing and quantizing the weight grid.
+ *
+ * @param bsd The block size information.
+ * @param blk The image block color data to compress.
+ * @param plane2_component The component assigned to plane 2.
+ * @param[out] ei1 The endpoint and weight values for plane 1.
+ * @param[out] ei2 The endpoint and weight values for plane 2.
+ */
+void compute_ideal_colors_and_weights_2planes(
+ const block_size_descriptor& bsd,
+ const image_block& blk,
+ unsigned int plane2_component,
+ endpoints_and_weights& ei1,
+ endpoints_and_weights& ei2);
+
+/**
+ * @brief Compute the optimal unquantized weights for a decimation table.
+ *
+ * After computing ideal weights for the case for a complete weight grid, we we want to compute the
+ * ideal weights for the case where weights exist only for some texels. We do this with a
+ * steepest-descent grid solver which works as follows:
+ *
+ * First, for each actual weight, perform a weighted averaging of the texels affected by the weight.
+ * Then, set step size to <some initial value> and attempt one step towards the original ideal
+ * weight if it helps to reduce error.
+ *
+ * @param ei The non-decimated endpoints and weights.
+ * @param di The selected weight decimation.
+ * @param[out] dec_weight_ideal_value The ideal values for the decimated weight set.
+ */
+void compute_ideal_weights_for_decimation(
+ const endpoints_and_weights& ei,
+ const decimation_info& di,
+ float* dec_weight_ideal_value);
+
+/**
+ * @brief Compute the optimal quantized weights for a decimation table.
+ *
+ * We test the two closest weight indices in the allowed quantization range and keep the weight that
+ * is the closest match.
+ *
+ * @param di The selected weight decimation.
+ * @param low_bound The lowest weight allowed.
+ * @param high_bound The highest weight allowed.
+ * @param dec_weight_ideal_value The ideal weight set.
+ * @param[out] dec_weight_quant_uvalue The output quantized weight as a float.
+ * @param[out] dec_weight_uquant The output quantized weight as encoded int.
+ * @param quant_level The desired weight quant level.
+ */
+void compute_quantized_weights_for_decimation(
+ const decimation_info& di,
+ float low_bound,
+ float high_bound,
+ const float* dec_weight_ideal_value,
+ float* dec_weight_quant_uvalue,
+ uint8_t* dec_weight_uquant,
+ quant_method quant_level);
+
+/**
+ * @brief Compute the error of a decimated weight set for 1 plane.
+ *
+ * After computing ideal weights for the case with one weight per texel, we want to compute the
+ * error for decimated weight grids where weights are stored at a lower resolution. This function
+ * computes the error of the reduced grid, compared to the full grid.
+ *
+ * @param eai The ideal weights for the full grid.
+ * @param di The selected weight decimation.
+ * @param dec_weight_quant_uvalue The quantized weights for the decimated grid.
+ *
+ * @return The accumulated error.
+ */
+float compute_error_of_weight_set_1plane(
+ const endpoints_and_weights& eai,
+ const decimation_info& di,
+ const float* dec_weight_quant_uvalue);
+
+/**
+ * @brief Compute the error of a decimated weight set for 2 planes.
+ *
+ * After computing ideal weights for the case with one weight per texel, we want to compute the
+ * error for decimated weight grids where weights are stored at a lower resolution. This function
+ * computes the error of the reduced grid, compared to the full grid.
+ *
+ * @param eai1 The ideal weights for the full grid and plane 1.
+ * @param eai2 The ideal weights for the full grid and plane 2.
+ * @param di The selected weight decimation.
+ * @param dec_weight_quant_uvalue_plane1 The quantized weights for the decimated grid plane 1.
+ * @param dec_weight_quant_uvalue_plane2 The quantized weights for the decimated grid plane 2.
+ *
+ * @return The accumulated error.
+ */
+float compute_error_of_weight_set_2planes(
+ const endpoints_and_weights& eai1,
+ const endpoints_and_weights& eai2,
+ const decimation_info& di,
+ const float* dec_weight_quant_uvalue_plane1,
+ const float* dec_weight_quant_uvalue_plane2);
+
+/**
+ * @brief Pack a single pair of color endpoints as effectively as possible.
+ *
+ * The user requests a base color endpoint mode in @c format, but the quantizer may choose a
+ * delta-based representation. It will report back the format variant it actually used.
+ *
+ * @param color0 The input unquantized color0 endpoint for absolute endpoint pairs.
+ * @param color1 The input unquantized color1 endpoint for absolute endpoint pairs.
+ * @param rgbs_color The input unquantized RGBS variant endpoint for same chroma endpoints.
+ * @param rgbo_color The input unquantized RGBS variant endpoint for HDR endpoints.
+ * @param format The desired base format.
+ * @param[out] output The output storage for the quantized colors/
+ * @param quant_level The quantization level requested.
+ *
+ * @return The actual endpoint mode used.
+ */
+uint8_t pack_color_endpoints(
+ vfloat4 color0,
+ vfloat4 color1,
+ vfloat4 rgbs_color,
+ vfloat4 rgbo_color,
+ int format,
+ uint8_t* output,
+ quant_method quant_level);
+
+/**
+ * @brief Unpack a single pair of encoded endpoints.
+ *
+ * Endpoints must be unscrambled and converted into the 0-255 range before calling this functions.
+ *
+ * @param decode_mode The decode mode (LDR, HDR).
+ * @param format The color endpoint mode used.
+ * @param input The raw array of encoded input integers. The length of this array
+ * depends on @c format; it can be safely assumed to be large enough.
+ * @param[out] rgb_hdr Is the endpoint using HDR for the RGB channels?
+ * @param[out] alpha_hdr Is the endpoint using HDR for the A channel?
+ * @param[out] output0 The output color for endpoint 0.
+ * @param[out] output1 The output color for endpoint 1.
+ */
+void unpack_color_endpoints(
+ astcenc_profile decode_mode,
+ int format,
+ const uint8_t* input,
+ bool& rgb_hdr,
+ bool& alpha_hdr,
+ vint4& output0,
+ vint4& output1);
+
+/**
+ * @brief Unpack a set of quantized and decimated weights.
+ *
+ * TODO: Can we skip this for non-decimated weights now that the @c scb is
+ * already storing unquantized weights?
+ *
+ * @param bsd The block size information.
+ * @param scb The symbolic compressed encoding.
+ * @param di The weight grid decimation table.
+ * @param is_dual_plane @c true if this is a dual plane block, @c false otherwise.
+ * @param[out] weights_plane1 The output array for storing the plane 1 weights.
+ * @param[out] weights_plane2 The output array for storing the plane 2 weights.
+ */
+void unpack_weights(
+ const block_size_descriptor& bsd,
+ const symbolic_compressed_block& scb,
+ const decimation_info& di,
+ bool is_dual_plane,
+ int weights_plane1[BLOCK_MAX_TEXELS],
+ int weights_plane2[BLOCK_MAX_TEXELS]);
+
+/**
+ * @brief Identify, for each mode, which set of color endpoint produces the best result.
+ *
+ * Returns the best @c tune_candidate_limit best looking modes, along with the ideal color encoding
+ * combination for each. The modified quantization level can be used when all formats are the same,
+ * as this frees up two additional bits of storage.
+ *
+ * @param pi The partition info for the current trial.
+ * @param blk The image block color data to compress.
+ * @param ep The ideal endpoints.
+ * @param qwt_bitcounts Bit counts for different quantization methods.
+ * @param qwt_errors Errors for different quantization methods.
+ * @param tune_candidate_limit The max number of candidates to return, may be less.
+ * @param start_block_mode The first block mode to inspect.
+ * @param end_block_mode The last block mode to inspect.
+ * @param[out] partition_format_specifiers The best formats per partition.
+ * @param[out] block_mode The best packed block mode indexes.
+ * @param[out] quant_level The best color quant level.
+ * @param[out] quant_level_mod The best color quant level if endpoints are the same.
+ * @param[out] tmpbuf Preallocated scratch buffers for the compressor.
+ *
+ * @return The actual number of candidate matches returned.
+ */
+unsigned int compute_ideal_endpoint_formats(
+ const partition_info& pi,
+ const image_block& blk,
+ const endpoints& ep,
+ const int8_t* qwt_bitcounts,
+ const float* qwt_errors,
+ unsigned int tune_candidate_limit,
+ unsigned int start_block_mode,
+ unsigned int end_block_mode,
+ uint8_t partition_format_specifiers[TUNE_MAX_TRIAL_CANDIDATES][BLOCK_MAX_PARTITIONS],
+ int block_mode[TUNE_MAX_TRIAL_CANDIDATES],
+ quant_method quant_level[TUNE_MAX_TRIAL_CANDIDATES],
+ quant_method quant_level_mod[TUNE_MAX_TRIAL_CANDIDATES],
+ compression_working_buffers& tmpbuf);
+
+/**
+ * @brief For a given 1 plane weight set recompute the endpoint colors.
+ *
+ * As we quantize and decimate weights the optimal endpoint colors may change slightly, so we must
+ * recompute the ideal colors for a specific weight set.
+ *
+ * @param blk The image block color data to compress.
+ * @param pi The partition info for the current trial.
+ * @param di The weight grid decimation table.
+ * @param dec_weights_uquant The quantized weight set.
+ * @param[in,out] ep The color endpoints (modifed in place).
+ * @param[out] rgbs_vectors The RGB+scale vectors for LDR blocks.
+ * @param[out] rgbo_vectors The RGB+offset vectors for HDR blocks.
+ */
+void recompute_ideal_colors_1plane(
+ const image_block& blk,
+ const partition_info& pi,
+ const decimation_info& di,
+ const uint8_t* dec_weights_uquant,
+ endpoints& ep,
+ vfloat4 rgbs_vectors[BLOCK_MAX_PARTITIONS],
+ vfloat4 rgbo_vectors[BLOCK_MAX_PARTITIONS]);
+
+/**
+ * @brief For a given 2 plane weight set recompute the endpoint colors.
+ *
+ * As we quantize and decimate weights the optimal endpoint colors may change slightly, so we must
+ * recompute the ideal colors for a specific weight set.
+ *
+ * @param blk The image block color data to compress.
+ * @param bsd The block_size descriptor.
+ * @param di The weight grid decimation table.
+ * @param dec_weights_uquant_plane1 The quantized weight set for plane 1.
+ * @param dec_weights_uquant_plane2 The quantized weight set for plane 2.
+ * @param[in,out] ep The color endpoints (modifed in place).
+ * @param[out] rgbs_vector The RGB+scale color for LDR blocks.
+ * @param[out] rgbo_vector The RGB+offset color for HDR blocks.
+ * @param plane2_component The component assigned to plane 2.
+ */
+void recompute_ideal_colors_2planes(
+ const image_block& blk,
+ const block_size_descriptor& bsd,
+ const decimation_info& di,
+ const uint8_t* dec_weights_uquant_plane1,
+ const uint8_t* dec_weights_uquant_plane2,
+ endpoints& ep,
+ vfloat4& rgbs_vector,
+ vfloat4& rgbo_vector,
+ int plane2_component);
+
+/**
+ * @brief Expand the angular tables needed for the alternative to PCA that we use.
+ */
+void prepare_angular_tables();
+
+/**
+ * @brief Compute the angular endpoints for one plane for each block mode.
+ *
+ * @param only_always Only consider block modes that are always enabled.
+ * @param bsd The block size descriptor for the current trial.
+ * @param dec_weight_ideal_value The ideal decimated unquantized weight values.
+ * @param max_weight_quant The maximum block mode weight quantization allowed.
+ * @param[out] tmpbuf Preallocated scratch buffers for the compressor.
+ */
+void compute_angular_endpoints_1plane(
+ bool only_always,
+ const block_size_descriptor& bsd,
+ const float* dec_weight_ideal_value,
+ unsigned int max_weight_quant,
+ compression_working_buffers& tmpbuf);
+
+/**
+ * @brief Compute the angular endpoints for two planes for each block mode.
+ *
+ * @param bsd The block size descriptor for the current trial.
+ * @param dec_weight_ideal_value The ideal decimated unquantized weight values.
+ * @param max_weight_quant The maximum block mode weight quantization allowed.
+ * @param[out] tmpbuf Preallocated scratch buffers for the compressor.
+ */
+void compute_angular_endpoints_2planes(
+ const block_size_descriptor& bsd,
+ const float* dec_weight_ideal_value,
+ unsigned int max_weight_quant,
+ compression_working_buffers& tmpbuf);
+
+/* ============================================================================
+ Functionality for high level compression and decompression access.
+============================================================================ */
+
+/**
+ * @brief Compress an image block into a physical block.
+ *
+ * @param ctx The compressor context and configuration.
+ * @param blk The image block color data to compress.
+ * @param[out] pcb The physical compressed block output.
+ * @param[out] tmpbuf Preallocated scratch buffers for the compressor.
+ */
+void compress_block(
+ const astcenc_contexti& ctx,
+ const image_block& blk,
+ physical_compressed_block& pcb,
+ compression_working_buffers& tmpbuf);
+
+/**
+ * @brief Decompress a symbolic block in to an image block.
+ *
+ * @param decode_mode The decode mode (LDR, HDR, etc).
+ * @param bsd The block size information.
+ * @param xpos The X coordinate of the block in the overall image.
+ * @param ypos The Y coordinate of the block in the overall image.
+ * @param zpos The Z coordinate of the block in the overall image.
+ * @param[out] blk The decompressed image block color data.
+ */
+void decompress_symbolic_block(
+ astcenc_profile decode_mode,
+ const block_size_descriptor& bsd,
+ int xpos,
+ int ypos,
+ int zpos,
+ const symbolic_compressed_block& scb,
+ image_block& blk);
+
+/**
+ * @brief Compute the error between a symbolic block and the original input data.
+ *
+ * This function is specialized for 2 plane and 1 partition search.
+ *
+ * In RGBM mode this will reject blocks that attempt to encode a zero M value.
+ *
+ * @param config The compressor config.
+ * @param bsd The block size information.
+ * @param scb The symbolic compressed encoding.
+ * @param blk The original image block color data.
+ *
+ * @return Returns the computed error, or a negative value if the encoding
+ * should be rejected for any reason.
+ */
+float compute_symbolic_block_difference_2plane(
+ const astcenc_config& config,
+ const block_size_descriptor& bsd,
+ const symbolic_compressed_block& scb,
+ const image_block& blk);
+
+/**
+ * @brief Compute the error between a symbolic block and the original input data.
+ *
+ * This function is specialized for 1 plane and N partition search.
+ *
+ * In RGBM mode this will reject blocks that attempt to encode a zero M value.
+ *
+ * @param config The compressor config.
+ * @param bsd The block size information.
+ * @param scb The symbolic compressed encoding.
+ * @param blk The original image block color data.
+ *
+ * @return Returns the computed error, or a negative value if the encoding
+ * should be rejected for any reason.
+ */
+float compute_symbolic_block_difference_1plane(
+ const astcenc_config& config,
+ const block_size_descriptor& bsd,
+ const symbolic_compressed_block& scb,
+ const image_block& blk);
+
+/**
+ * @brief Compute the error between a symbolic block and the original input data.
+ *
+ * This function is specialized for 1 plane and 1 partition search.
+ *
+ * In RGBM mode this will reject blocks that attempt to encode a zero M value.
+ *
+ * @param config The compressor config.
+ * @param bsd The block size information.
+ * @param scb The symbolic compressed encoding.
+ * @param blk The original image block color data.
+ *
+ * @return Returns the computed error, or a negative value if the encoding
+ * should be rejected for any reason.
+ */
+float compute_symbolic_block_difference_1plane_1partition(
+ const astcenc_config& config,
+ const block_size_descriptor& bsd,
+ const symbolic_compressed_block& scb,
+ const image_block& blk);
+
+/**
+ * @brief Convert a symbolic representation into a binary physical encoding.
+ *
+ * It is assumed that the symbolic encoding is valid and encodable, or
+ * previously flagged as an error block if an error color it to be encoded.
+ *
+ * @param bsd The block size information.
+ * @param scb The symbolic representation.
+ * @param[out] pcb The binary encoded data.
+ */
+void symbolic_to_physical(
+ const block_size_descriptor& bsd,
+ const symbolic_compressed_block& scb,
+ physical_compressed_block& pcb);
+
+/**
+ * @brief Convert a binary physical encoding into a symbolic representation.
+ *
+ * This function can cope with arbitrary input data; output blocks will be
+ * flagged as an error block if the encoding is invalid.
+ *
+ * @param bsd The block size information.
+ * @param pcb The binary encoded data.
+ * @param[out] scb The output symbolic representation.
+ */
+void physical_to_symbolic(
+ const block_size_descriptor& bsd,
+ const physical_compressed_block& pcb,
+ symbolic_compressed_block& scb);
+
+/* ============================================================================
+Platform-specific functions.
+============================================================================ */
+/**
+ * @brief Run-time detection if the host CPU supports the POPCNT extension.
+ *
+ * @return @c true if supported, @c false if not.
+ */
+bool cpu_supports_popcnt();
+
+/**
+ * @brief Run-time detection if the host CPU supports F16C extension.
+ *
+ * @return @c true if supported, @c false if not.
+ */
+bool cpu_supports_f16c();
+
+/**
+ * @brief Run-time detection if the host CPU supports SSE 4.1 extension.
+ *
+ * @return @c true if supported, @c false if not.
+ */
+bool cpu_supports_sse41();
+
+/**
+ * @brief Run-time detection if the host CPU supports AVX 2 extension.
+ *
+ * @return @c true if supported, @c false if not.
+ */
+bool cpu_supports_avx2();
+
+/**
+ * @brief Allocate an aligned memory buffer.
+ *
+ * Allocated memory must be freed by aligned_free;
+ *
+ * @param size The desired buffer size.
+ * @param align The desired buffer alignment; must be 2^N.
+ *
+ * @return The memory buffer pointer or nullptr on allocation failure.
+ */
+template<typename T>
+T* aligned_malloc(size_t size, size_t align)
+{
+ void* ptr;
+ int error = 0;
+
+#if defined(_WIN32)
+ ptr = _aligned_malloc(size, align);
+#else
+ error = posix_memalign(&ptr, align, size);
+#endif
+
+ if (error || (!ptr))
+ {
+ return nullptr;
+ }
+
+ return static_cast<T*>(ptr);
+}
+
+/**
+ * @brief Free an aligned memory buffer.
+ *
+ * @param ptr The buffer to free.
+ */
+template<typename T>
+void aligned_free(T* ptr)
+{
+#if defined(_WIN32)
+ _aligned_free(reinterpret_cast<void*>(ptr));
+#else
+ free(reinterpret_cast<void*>(ptr));
+#endif
+}
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_internal_entry.h b/thirdparty/astcenc/astcenc_internal_entry.h
new file mode 100644
index 0000000000..4e8794547a
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_internal_entry.h
@@ -0,0 +1,273 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2022 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Functions and data declarations for the outer context.
+ *
+ * The outer context includes thread-pool management, which is slower to
+ * compile due to increased use of C++ stdlib. The inner context used in the
+ * majority of the codec library does not include this.
+ */
+
+#ifndef ASTCENC_INTERNAL_ENTRY_INCLUDED
+#define ASTCENC_INTERNAL_ENTRY_INCLUDED
+
+#include <atomic>
+#include <condition_variable>
+#include <functional>
+#include <mutex>
+
+#include "astcenc_internal.h"
+
+/* ============================================================================
+ Parallel execution control
+============================================================================ */
+
+/**
+ * @brief A simple counter-based manager for parallel task execution.
+ *
+ * The task processing execution consists of:
+ *
+ * * A single-threaded init stage.
+ * * A multi-threaded processing stage.
+ * * A condition variable so threads can wait for processing completion.
+ *
+ * The init stage will be executed by the first thread to arrive in the critical section, there is
+ * no main thread in the thread pool.
+ *
+ * The processing stage uses dynamic dispatch to assign task tickets to threads on an on-demand
+ * basis. Threads may each therefore executed different numbers of tasks, depending on their
+ * processing complexity. The task queue and the task tickets are just counters; the caller must map
+ * these integers to an actual processing partition in a specific problem domain.
+ *
+ * The exit wait condition is needed to ensure processing has finished before a worker thread can
+ * progress to the next stage of the pipeline. Specifically a worker may exit the processing stage
+ * because there are no new tasks to assign to it while other worker threads are still processing.
+ * Calling @c wait() will ensure that all other worker have finished before the thread can proceed.
+ *
+ * The basic usage model:
+ *
+ * // --------- From single-threaded code ---------
+ *
+ * // Reset the tracker state
+ * manager->reset()
+ *
+ * // --------- From multi-threaded code ---------
+ *
+ * // Run the stage init; only first thread actually runs the lambda
+ * manager->init(<lambda>)
+ *
+ * do
+ * {
+ * // Request a task assignment
+ * uint task_count;
+ * uint base_index = manager->get_tasks(<granule>, task_count);
+ *
+ * // Process any tasks we were given (task_count <= granule size)
+ * if (task_count)
+ * {
+ * // Run the user task processing code for N tasks here
+ * ...
+ *
+ * // Flag these tasks as complete
+ * manager->complete_tasks(task_count);
+ * }
+ * } while (task_count);
+ *
+ * // Wait for all threads to complete tasks before progressing
+ * manager->wait()
+ *
+ * // Run the stage term; only first thread actually runs the lambda
+ * manager->term(<lambda>)
+ */
+class ParallelManager
+{
+private:
+ /** @brief Lock used for critical section and condition synchronization. */
+ std::mutex m_lock;
+
+ /** @brief True if the stage init() step has been executed. */
+ bool m_init_done;
+
+ /** @brief True if the stage term() step has been executed. */
+ bool m_term_done;
+
+ /** @brief Condition variable for tracking stage processing completion. */
+ std::condition_variable m_complete;
+
+ /** @brief Number of tasks started, but not necessarily finished. */
+ std::atomic<unsigned int> m_start_count;
+
+ /** @brief Number of tasks finished. */
+ unsigned int m_done_count;
+
+ /** @brief Number of tasks that need to be processed. */
+ unsigned int m_task_count;
+
+public:
+ /** @brief Create a new ParallelManager. */
+ ParallelManager()
+ {
+ reset();
+ }
+
+ /**
+ * @brief Reset the tracker for a new processing batch.
+ *
+ * This must be called from single-threaded code before starting the multi-threaded processing
+ * operations.
+ */
+ void reset()
+ {
+ m_init_done = false;
+ m_term_done = false;
+ m_start_count = 0;
+ m_done_count = 0;
+ m_task_count = 0;
+ }
+
+ /**
+ * @brief Trigger the pipeline stage init step.
+ *
+ * This can be called from multi-threaded code. The first thread to hit this will process the
+ * initialization. Other threads will block and wait for it to complete.
+ *
+ * @param init_func Callable which executes the stage initialization. It must return the
+ * total number of tasks in the stage.
+ */
+ void init(std::function<unsigned int(void)> init_func)
+ {
+ std::lock_guard<std::mutex> lck(m_lock);
+ if (!m_init_done)
+ {
+ m_task_count = init_func();
+ m_init_done = true;
+ }
+ }
+
+ /**
+ * @brief Trigger the pipeline stage init step.
+ *
+ * This can be called from multi-threaded code. The first thread to hit this will process the
+ * initialization. Other threads will block and wait for it to complete.
+ *
+ * @param task_count Total number of tasks needing processing.
+ */
+ void init(unsigned int task_count)
+ {
+ std::lock_guard<std::mutex> lck(m_lock);
+ if (!m_init_done)
+ {
+ m_task_count = task_count;
+ m_init_done = true;
+ }
+ }
+
+ /**
+ * @brief Request a task assignment.
+ *
+ * Assign up to @c granule tasks to the caller for processing.
+ *
+ * @param granule Maximum number of tasks that can be assigned.
+ * @param[out] count Actual number of tasks assigned, or zero if no tasks were assigned.
+ *
+ * @return Task index of the first assigned task; assigned tasks increment from this.
+ */
+ unsigned int get_task_assignment(unsigned int granule, unsigned int& count)
+ {
+ unsigned int base = m_start_count.fetch_add(granule, std::memory_order_relaxed);
+ if (base >= m_task_count)
+ {
+ count = 0;
+ return 0;
+ }
+
+ count = astc::min(m_task_count - base, granule);
+ return base;
+ }
+
+ /**
+ * @brief Complete a task assignment.
+ *
+ * Mark @c count tasks as complete. This will notify all threads blocked on @c wait() if this
+ * completes the processing of the stage.
+ *
+ * @param count The number of completed tasks.
+ */
+ void complete_task_assignment(unsigned int count)
+ {
+ // Note: m_done_count cannot use an atomic without the mutex; this has a race between the
+ // update here and the wait() for other threads
+ std::unique_lock<std::mutex> lck(m_lock);
+ this->m_done_count += count;
+ if (m_done_count == m_task_count)
+ {
+ lck.unlock();
+ m_complete.notify_all();
+ }
+ }
+
+ /**
+ * @brief Wait for stage processing to complete.
+ */
+ void wait()
+ {
+ std::unique_lock<std::mutex> lck(m_lock);
+ m_complete.wait(lck, [this]{ return m_done_count == m_task_count; });
+ }
+
+ /**
+ * @brief Trigger the pipeline stage term step.
+ *
+ * This can be called from multi-threaded code. The first thread to hit this will process the
+ * work pool termination. Caller must have called @c wait() prior to calling this function to
+ * ensure that processing is complete.
+ *
+ * @param term_func Callable which executes the stage termination.
+ */
+ void term(std::function<void(void)> term_func)
+ {
+ std::lock_guard<std::mutex> lck(m_lock);
+ if (!m_term_done)
+ {
+ term_func();
+ m_term_done = true;
+ }
+ }
+};
+
+/**
+ * @brief The astcenc compression context.
+ */
+struct astcenc_context
+{
+ /** @brief The context internal state. */
+ astcenc_contexti context;
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+ /** @brief The parallel manager for averages computation. */
+ ParallelManager manage_avg;
+
+ /** @brief The parallel manager for compression. */
+ ParallelManager manage_compress;
+#endif
+
+ /** @brief The parallel manager for decompression. */
+ ParallelManager manage_decompress;
+};
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_mathlib.cpp b/thirdparty/astcenc/astcenc_mathlib.cpp
new file mode 100644
index 0000000000..f276ac7e3d
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_mathlib.cpp
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2021 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+#include "astcenc_mathlib.h"
+
+/**
+ * @brief 64-bit rotate left.
+ *
+ * @param val The value to rotate.
+ * @param count The rotation, in bits.
+ */
+static inline uint64_t rotl(uint64_t val, int count)
+{
+ return (val << count) | (val >> (64 - count));
+}
+
+/* See header for documentation. */
+void astc::rand_init(uint64_t state[2])
+{
+ state[0] = 0xfaf9e171cea1ec6bULL;
+ state[1] = 0xf1b318cc06af5d71ULL;
+}
+
+/* See header for documentation. */
+uint64_t astc::rand(uint64_t state[2])
+{
+ uint64_t s0 = state[0];
+ uint64_t s1 = state[1];
+ uint64_t res = s0 + s1;
+ s1 ^= s0;
+ state[0] = rotl(s0, 24) ^ s1 ^ (s1 << 16);
+ state[1] = rotl(s1, 37);
+ return res;
+}
diff --git a/thirdparty/astcenc/astcenc_mathlib.h b/thirdparty/astcenc/astcenc_mathlib.h
new file mode 100644
index 0000000000..0540c4fedd
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_mathlib.h
@@ -0,0 +1,476 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2021 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/*
+ * This module implements a variety of mathematical data types and library
+ * functions used by the codec.
+ */
+
+#ifndef ASTC_MATHLIB_H_INCLUDED
+#define ASTC_MATHLIB_H_INCLUDED
+
+#include <cassert>
+#include <cstdint>
+#include <cmath>
+
+#ifndef ASTCENC_POPCNT
+ #if defined(__POPCNT__)
+ #define ASTCENC_POPCNT 1
+ #else
+ #define ASTCENC_POPCNT 0
+ #endif
+#endif
+
+#ifndef ASTCENC_F16C
+ #if defined(__F16C__)
+ #define ASTCENC_F16C 1
+ #else
+ #define ASTCENC_F16C 0
+ #endif
+#endif
+
+#ifndef ASTCENC_SSE
+ #if defined(__SSE4_2__)
+ #define ASTCENC_SSE 42
+ #elif defined(__SSE4_1__)
+ #define ASTCENC_SSE 41
+ #elif defined(__SSE2__)
+ #define ASTCENC_SSE 20
+ #else
+ #define ASTCENC_SSE 0
+ #endif
+#endif
+
+#ifndef ASTCENC_AVX
+ #if defined(__AVX2__)
+ #define ASTCENC_AVX 2
+ #elif defined(__AVX__)
+ #define ASTCENC_AVX 1
+ #else
+ #define ASTCENC_AVX 0
+ #endif
+#endif
+
+#ifndef ASTCENC_NEON
+ #if defined(__aarch64__)
+ #define ASTCENC_NEON 1
+ #else
+ #define ASTCENC_NEON 0
+ #endif
+#endif
+
+#if ASTCENC_AVX
+ #define ASTCENC_VECALIGN 32
+#else
+ #define ASTCENC_VECALIGN 16
+#endif
+
+#if ASTCENC_SSE != 0 || ASTCENC_AVX != 0 || ASTCENC_POPCNT != 0
+ #include <immintrin.h>
+#endif
+
+/* ============================================================================
+ Fast math library; note that many of the higher-order functions in this set
+ use approximations which are less accurate, but faster, than <cmath> standard
+ library equivalents.
+
+ Note: Many of these are not necessarily faster than simple C versions when
+ used on a single scalar value, but are included for testing purposes as most
+ have an option based on SSE intrinsics and therefore provide an obvious route
+ to future vectorization.
+============================================================================ */
+
+// Union for manipulation of float bit patterns
+typedef union
+{
+ uint32_t u;
+ int32_t s;
+ float f;
+} if32;
+
+// These are namespaced to avoid colliding with C standard library functions.
+namespace astc
+{
+
+static const float PI = 3.14159265358979323846f;
+static const float PI_OVER_TWO = 1.57079632679489661923f;
+
+/**
+ * @brief SP float absolute value.
+ *
+ * @param v The value to make absolute.
+ *
+ * @return The absolute value.
+ */
+static inline float fabs(float v)
+{
+ return std::fabs(v);
+}
+
+/**
+ * @brief Test if a float value is a nan.
+ *
+ * @param v The value test.
+ *
+ * @return Zero is not a NaN, non-zero otherwise.
+ */
+static inline bool isnan(float v)
+{
+ return v != v;
+}
+
+/**
+ * @brief Return the minimum of two values.
+ *
+ * For floats, NaNs are turned into @c q.
+ *
+ * @param p The first value to compare.
+ * @param q The second value to compare.
+ *
+ * @return The smallest value.
+ */
+template<typename T>
+static inline T min(T p, T q)
+{
+ return p < q ? p : q;
+}
+
+/**
+ * @brief Return the minimum of three values.
+ *
+ * For floats, NaNs are turned into @c r.
+ *
+ * @param p The first value to compare.
+ * @param q The second value to compare.
+ * @param r The third value to compare.
+ *
+ * @return The smallest value.
+ */
+template<typename T>
+static inline T min(T p, T q, T r)
+{
+ return min(min(p, q), r);
+}
+
+/**
+ * @brief Return the minimum of four values.
+ *
+ * For floats, NaNs are turned into @c s.
+ *
+ * @param p The first value to compare.
+ * @param q The second value to compare.
+ * @param r The third value to compare.
+ * @param s The fourth value to compare.
+ *
+ * @return The smallest value.
+ */
+template<typename T>
+static inline T min(T p, T q, T r, T s)
+{
+ return min(min(p, q), min(r, s));
+}
+
+/**
+ * @brief Return the maximum of two values.
+ *
+ * For floats, NaNs are turned into @c q.
+ *
+ * @param p The first value to compare.
+ * @param q The second value to compare.
+ *
+ * @return The largest value.
+ */
+template<typename T>
+static inline T max(T p, T q)
+{
+ return p > q ? p : q;
+}
+
+/**
+ * @brief Return the maximum of three values.
+ *
+ * For floats, NaNs are turned into @c r.
+ *
+ * @param p The first value to compare.
+ * @param q The second value to compare.
+ * @param r The third value to compare.
+ *
+ * @return The largest value.
+ */
+template<typename T>
+static inline T max(T p, T q, T r)
+{
+ return max(max(p, q), r);
+}
+
+/**
+ * @brief Return the maximum of four values.
+ *
+ * For floats, NaNs are turned into @c s.
+ *
+ * @param p The first value to compare.
+ * @param q The second value to compare.
+ * @param r The third value to compare.
+ * @param s The fourth value to compare.
+ *
+ * @return The largest value.
+ */
+template<typename T>
+static inline T max(T p, T q, T r, T s)
+{
+ return max(max(p, q), max(r, s));
+}
+
+/**
+ * @brief Clamp a value value between @c mn and @c mx.
+ *
+ * For floats, NaNs are turned into @c mn.
+ *
+ * @param v The value to clamp.
+ * @param mn The min value (inclusive).
+ * @param mx The max value (inclusive).
+ *
+ * @return The clamped value.
+ */
+template<typename T>
+inline T clamp(T v, T mn, T mx)
+{
+ // Do not reorder; correct NaN handling relies on the fact that comparison
+ // with NaN returns false and will fall-though to the "min" value.
+ if (v > mx) return mx;
+ if (v > mn) return v;
+ return mn;
+}
+
+/**
+ * @brief Clamp a float value between 0.0f and 1.0f.
+ *
+ * NaNs are turned into 0.0f.
+ *
+ * @param v The value to clamp.
+ *
+ * @return The clamped value.
+ */
+static inline float clamp1f(float v)
+{
+ return astc::clamp(v, 0.0f, 1.0f);
+}
+
+/**
+ * @brief Clamp a float value between 0.0f and 255.0f.
+ *
+ * NaNs are turned into 0.0f.
+ *
+ * @param v The value to clamp.
+ *
+ * @return The clamped value.
+ */
+static inline float clamp255f(float v)
+{
+ return astc::clamp(v, 0.0f, 255.0f);
+}
+
+/**
+ * @brief SP float round-down.
+ *
+ * @param v The value to round.
+ *
+ * @return The rounded value.
+ */
+static inline float flt_rd(float v)
+{
+ return std::floor(v);
+}
+
+/**
+ * @brief SP float round-to-nearest and convert to integer.
+ *
+ * @param v The value to round.
+ *
+ * @return The rounded value.
+ */
+static inline int flt2int_rtn(float v)
+{
+
+ return static_cast<int>(v + 0.5f);
+}
+
+/**
+ * @brief SP float round down and convert to integer.
+ *
+ * @param v The value to round.
+ *
+ * @return The rounded value.
+ */
+static inline int flt2int_rd(float v)
+{
+ return static_cast<int>(v);
+}
+
+/**
+ * @brief SP float bit-interpreted as an integer.
+ *
+ * @param v The value to bitcast.
+ *
+ * @return The converted value.
+ */
+static inline int float_as_int(float v)
+{
+ union { int a; float b; } u;
+ u.b = v;
+ return u.a;
+}
+
+/**
+ * @brief Integer bit-interpreted as an SP float.
+ *
+ * @param v The value to bitcast.
+ *
+ * @return The converted value.
+ */
+static inline float int_as_float(int v)
+{
+ union { int a; float b; } u;
+ u.a = v;
+ return u.b;
+}
+
+/**
+ * @brief Fast approximation of 1.0 / sqrt(val).
+ *
+ * @param v The input value.
+ *
+ * @return The approximated result.
+ */
+static inline float rsqrt(float v)
+{
+ return 1.0f / std::sqrt(v);
+}
+
+/**
+ * @brief Fast approximation of sqrt(val).
+ *
+ * @param v The input value.
+ *
+ * @return The approximated result.
+ */
+static inline float sqrt(float v)
+{
+ return std::sqrt(v);
+}
+
+/**
+ * @brief Extract mantissa and exponent of a float value.
+ *
+ * @param v The input value.
+ * @param[out] expo The output exponent.
+ *
+ * @return The mantissa.
+ */
+static inline float frexp(float v, int* expo)
+{
+ if32 p;
+ p.f = v;
+ *expo = ((p.u >> 23) & 0xFF) - 126;
+ p.u = (p.u & 0x807fffff) | 0x3f000000;
+ return p.f;
+}
+
+/**
+ * @brief Initialize the seed structure for a random number generator.
+ *
+ * Important note: For the purposes of ASTC we want sets of random numbers to
+ * use the codec, but we want the same seed value across instances and threads
+ * to ensure that image output is stable across compressor runs and across
+ * platforms. Every PRNG created by this call will therefore return the same
+ * sequence of values ...
+ *
+ * @param state The state structure to initialize.
+ */
+void rand_init(uint64_t state[2]);
+
+/**
+ * @brief Return the next random number from the generator.
+ *
+ * This RNG is an implementation of the "xoroshoro-128+ 1.0" PRNG, based on the
+ * public-domain implementation given by David Blackman & Sebastiano Vigna at
+ * http://vigna.di.unimi.it/xorshift/xoroshiro128plus.c
+ *
+ * @param state The state structure to use/update.
+ */
+uint64_t rand(uint64_t state[2]);
+
+}
+
+/* ============================================================================
+ Softfloat library with fp32 and fp16 conversion functionality.
+============================================================================ */
+#if (ASTCENC_F16C == 0) && (ASTCENC_NEON == 0)
+ /* narrowing float->float conversions */
+ uint16_t float_to_sf16(float val);
+ float sf16_to_float(uint16_t val);
+#endif
+
+/*********************************
+ Vector library
+*********************************/
+#include "astcenc_vecmathlib.h"
+
+/*********************************
+ Declaration of line types
+*********************************/
+// parametric line, 2D: The line is given by line = a + b * t.
+
+struct line2
+{
+ vfloat4 a;
+ vfloat4 b;
+};
+
+// parametric line, 3D
+struct line3
+{
+ vfloat4 a;
+ vfloat4 b;
+};
+
+struct line4
+{
+ vfloat4 a;
+ vfloat4 b;
+};
+
+
+struct processed_line2
+{
+ vfloat4 amod;
+ vfloat4 bs;
+};
+
+struct processed_line3
+{
+ vfloat4 amod;
+ vfloat4 bs;
+};
+
+struct processed_line4
+{
+ vfloat4 amod;
+ vfloat4 bs;
+};
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_mathlib_softfloat.cpp b/thirdparty/astcenc/astcenc_mathlib_softfloat.cpp
new file mode 100644
index 0000000000..42db764549
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_mathlib_softfloat.cpp
@@ -0,0 +1,411 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2021 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Soft-float library for IEEE-754.
+ */
+#if (ASTCENC_F16C == 0) && (ASTCENC_NEON == 0)
+
+#include "astcenc_mathlib.h"
+
+/* sized soft-float types. These are mapped to the sized integer
+ types of C99, instead of C's floating-point types; this is because
+ the library needs to maintain exact, bit-level control on all
+ operations on these data types. */
+typedef uint16_t sf16;
+typedef uint32_t sf32;
+
+/******************************************
+ helper functions and their lookup tables
+ ******************************************/
+/* count leading zeros functions. Only used when the input is nonzero. */
+
+#if defined(__GNUC__) && (defined(__i386) || defined(__amd64))
+#elif defined(__arm__) && defined(__ARMCC_VERSION)
+#elif defined(__arm__) && defined(__GNUC__)
+#else
+ /* table used for the slow default versions. */
+ static const uint8_t clz_table[256] =
+ {
+ 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+#endif
+
+/*
+ 32-bit count-leading-zeros function: use the Assembly instruction whenever possible. */
+static uint32_t clz32(uint32_t inp)
+{
+ #if defined(__GNUC__) && (defined(__i386) || defined(__amd64))
+ uint32_t bsr;
+ __asm__("bsrl %1, %0": "=r"(bsr):"r"(inp | 1));
+ return 31 - bsr;
+ #else
+ #if defined(__arm__) && defined(__ARMCC_VERSION)
+ return __clz(inp); /* armcc builtin */
+ #else
+ #if defined(__arm__) && defined(__GNUC__)
+ uint32_t lz;
+ __asm__("clz %0, %1": "=r"(lz):"r"(inp));
+ return lz;
+ #else
+ /* slow default version */
+ uint32_t summa = 24;
+ if (inp >= UINT32_C(0x10000))
+ {
+ inp >>= 16;
+ summa -= 16;
+ }
+ if (inp >= UINT32_C(0x100))
+ {
+ inp >>= 8;
+ summa -= 8;
+ }
+ return summa + clz_table[inp];
+ #endif
+ #endif
+ #endif
+}
+
+/* the five rounding modes that IEEE-754r defines */
+typedef enum
+{
+ SF_UP = 0, /* round towards positive infinity */
+ SF_DOWN = 1, /* round towards negative infinity */
+ SF_TOZERO = 2, /* round towards zero */
+ SF_NEARESTEVEN = 3, /* round toward nearest value; if mid-between, round to even value */
+ SF_NEARESTAWAY = 4 /* round toward nearest value; if mid-between, round away from zero */
+} roundmode;
+
+
+static uint32_t rtne_shift32(uint32_t inp, uint32_t shamt)
+{
+ uint32_t vl1 = UINT32_C(1) << shamt;
+ uint32_t inp2 = inp + (vl1 >> 1); /* added 0.5 ULP */
+ uint32_t msk = (inp | UINT32_C(1)) & vl1; /* nonzero if odd. '| 1' forces it to 1 if the shamt is 0. */
+ msk--; /* negative if even, nonnegative if odd. */
+ inp2 -= (msk >> 31); /* subtract epsilon before shift if even. */
+ inp2 >>= shamt;
+ return inp2;
+}
+
+static uint32_t rtna_shift32(uint32_t inp, uint32_t shamt)
+{
+ uint32_t vl1 = (UINT32_C(1) << shamt) >> 1;
+ inp += vl1;
+ inp >>= shamt;
+ return inp;
+}
+
+static uint32_t rtup_shift32(uint32_t inp, uint32_t shamt)
+{
+ uint32_t vl1 = UINT32_C(1) << shamt;
+ inp += vl1;
+ inp--;
+ inp >>= shamt;
+ return inp;
+}
+
+/* convert from FP16 to FP32. */
+static sf32 sf16_to_sf32(sf16 inp)
+{
+ uint32_t inpx = inp;
+
+ /*
+ This table contains, for every FP16 sign/exponent value combination,
+ the difference between the input FP16 value and the value obtained
+ by shifting the correct FP32 result right by 13 bits.
+ This table allows us to handle every case except denormals and NaN
+ with just 1 table lookup, 2 shifts and 1 add.
+ */
+
+ #define WITH_MSB(a) (UINT32_C(a) | (1u << 31))
+ static const uint32_t tbl[64] =
+ {
+ WITH_MSB(0x00000), 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000,
+ 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000,
+ 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000,
+ 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, WITH_MSB(0x38000),
+ WITH_MSB(0x38000), 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000,
+ 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000,
+ 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000,
+ 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, WITH_MSB(0x70000)
+ };
+
+ uint32_t res = tbl[inpx >> 10];
+ res += inpx;
+
+ /* Normal cases: MSB of 'res' not set. */
+ if ((res & WITH_MSB(0)) == 0)
+ {
+ return res << 13;
+ }
+
+ /* Infinity and Zero: 10 LSB of 'res' not set. */
+ if ((res & 0x3FF) == 0)
+ {
+ return res << 13;
+ }
+
+ /* NaN: the exponent field of 'inp' is non-zero. */
+ if ((inpx & 0x7C00) != 0)
+ {
+ /* All NaNs are quietened. */
+ return (res << 13) | 0x400000;
+ }
+
+ /* Denormal cases */
+ uint32_t sign = (inpx & 0x8000) << 16;
+ uint32_t mskval = inpx & 0x7FFF;
+ uint32_t leadingzeroes = clz32(mskval);
+ mskval <<= leadingzeroes;
+ return (mskval >> 8) + ((0x85 - leadingzeroes) << 23) + sign;
+}
+
+/* Conversion routine that converts from FP32 to FP16. It supports denormals and all rounding modes. If a NaN is given as input, it is quietened. */
+static sf16 sf32_to_sf16(sf32 inp, roundmode rmode)
+{
+ /* for each possible sign/exponent combination, store a case index. This gives a 512-byte table */
+ static const uint8_t tab[512] {
+ 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 50,
+
+ 5, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 55,
+ };
+
+ /* many of the cases below use a case-dependent magic constant. So we look up a magic constant before actually performing the switch. This table allows us to group cases, thereby minimizing code
+ size. */
+ static const uint32_t tabx[60] {
+ UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0x8000), UINT32_C(0x80000000), UINT32_C(0x8000), UINT32_C(0x8000), UINT32_C(0x8000),
+ UINT32_C(1), UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0x8000), UINT32_C(0x8001), UINT32_C(0x8000), UINT32_C(0x8000), UINT32_C(0x8000),
+ UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0x8000), UINT32_C(0x8000), UINT32_C(0x8000), UINT32_C(0x8000), UINT32_C(0x8000),
+ UINT32_C(0xC8001FFF), UINT32_C(0xC8000000), UINT32_C(0xC8000000), UINT32_C(0xC8000FFF), UINT32_C(0xC8001000),
+ UINT32_C(0x58000000), UINT32_C(0x38001FFF), UINT32_C(0x58000000), UINT32_C(0x58000FFF), UINT32_C(0x58001000),
+ UINT32_C(0x7C00), UINT32_C(0x7BFF), UINT32_C(0x7BFF), UINT32_C(0x7C00), UINT32_C(0x7C00),
+ UINT32_C(0xFBFF), UINT32_C(0xFC00), UINT32_C(0xFBFF), UINT32_C(0xFC00), UINT32_C(0xFC00),
+ UINT32_C(0x90000000), UINT32_C(0x90000000), UINT32_C(0x90000000), UINT32_C(0x90000000), UINT32_C(0x90000000),
+ UINT32_C(0x20000000), UINT32_C(0x20000000), UINT32_C(0x20000000), UINT32_C(0x20000000), UINT32_C(0x20000000)
+ };
+
+ uint32_t p;
+ uint32_t idx = rmode + tab[inp >> 23];
+ uint32_t vlx = tabx[idx];
+ switch (idx)
+ {
+ /*
+ Positive number which may be Infinity or NaN.
+ We need to check whether it is NaN; if it is, quieten it by setting the top bit of the mantissa.
+ (If we don't do this quieting, then a NaN that is distinguished only by having
+ its low-order bits set, would be turned into an INF. */
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ case 56:
+ case 57:
+ case 58:
+ case 59:
+ /*
+ the input value is 0x7F800000 or 0xFF800000 if it is INF.
+ By subtracting 1, we get 7F7FFFFF or FF7FFFFF, that is, bit 23 becomes zero.
+ For NaNs, however, this operation will keep bit 23 with the value 1.
+ We can then extract bit 23, and logical-OR bit 9 of the result with this
+ bit in order to quieten the NaN (a Quiet NaN is a NaN where the top bit
+ of the mantissa is set.)
+ */
+ p = (inp - 1) & UINT32_C(0x800000); /* zero if INF, nonzero if NaN. */
+ return static_cast<sf16>(((inp + vlx) >> 13) | (p >> 14));
+ /*
+ positive, exponent = 0, round-mode == UP; need to check whether number actually is 0.
+ If it is, then return 0, else return 1 (the smallest representable nonzero number)
+ */
+ case 0:
+ /*
+ -inp will set the MSB if the input number is nonzero.
+ Thus (-inp) >> 31 will turn into 0 if the input number is 0 and 1 otherwise.
+ */
+ return static_cast<sf16>(static_cast<uint32_t>((-static_cast<int32_t>(inp))) >> 31);
+
+ /*
+ negative, exponent = , round-mode == DOWN, need to check whether number is
+ actually 0. If it is, return 0x8000 ( float -0.0 )
+ Else return the smallest negative number ( 0x8001 ) */
+ case 6:
+ /*
+ in this case 'vlx' is 0x80000000. By subtracting the input value from it,
+ we obtain a value that is 0 if the input value is in fact zero and has
+ the MSB set if it isn't. We then right-shift the value by 31 places to
+ get a value that is 0 if the input is -0.0 and 1 otherwise.
+ */
+ return static_cast<sf16>(((vlx - inp) >> 31) + UINT32_C(0x8000));
+
+ /*
+ for all other cases involving underflow/overflow, we don't need to
+ do actual tests; we just return 'vlx'.
+ */
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 7:
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ case 16:
+ case 17:
+ case 18:
+ case 19:
+ case 40:
+ case 41:
+ case 42:
+ case 43:
+ case 44:
+ case 45:
+ case 46:
+ case 47:
+ case 48:
+ case 49:
+ return static_cast<sf16>(vlx);
+
+ /*
+ for normal numbers, 'vlx' is the difference between the FP32 value of a number and the
+ FP16 representation of the same number left-shifted by 13 places. In addition, a rounding constant is
+ baked into 'vlx': for rounding-away-from zero, the constant is 2^13 - 1, causing roundoff away
+ from zero. for round-to-nearest away, the constant is 2^12, causing roundoff away from zero.
+ for round-to-nearest-even, the constant is 2^12 - 1. This causes correct round-to-nearest-even
+ except for odd input numbers. For odd input numbers, we need to add 1 to the constant. */
+
+ /* normal number, all rounding modes except round-to-nearest-even: */
+ case 30:
+ case 31:
+ case 32:
+ case 34:
+ case 35:
+ case 36:
+ case 37:
+ case 39:
+ return static_cast<sf16>((inp + vlx) >> 13);
+
+ /* normal number, round-to-nearest-even. */
+ case 33:
+ case 38:
+ p = inp + vlx;
+ p += (inp >> 13) & 1;
+ return static_cast<sf16>(p >> 13);
+
+ /*
+ the various denormal cases. These are not expected to be common, so their performance is a bit
+ less important. For each of these cases, we need to extract an exponent and a mantissa
+ (including the implicit '1'!), and then right-shift the mantissa by a shift-amount that
+ depends on the exponent. The shift must apply the correct rounding mode. 'vlx' is used to supply the
+ sign of the resulting denormal number.
+ */
+ case 21:
+ case 22:
+ case 25:
+ case 27:
+ /* denormal, round towards zero. */
+ p = 126 - ((inp >> 23) & 0xFF);
+ return static_cast<sf16>((((inp & UINT32_C(0x7FFFFF)) + UINT32_C(0x800000)) >> p) | vlx);
+ case 20:
+ case 26:
+ /* denormal, round away from zero. */
+ p = 126 - ((inp >> 23) & 0xFF);
+ return static_cast<sf16>(rtup_shift32((inp & UINT32_C(0x7FFFFF)) + UINT32_C(0x800000), p) | vlx);
+ case 24:
+ case 29:
+ /* denormal, round to nearest-away */
+ p = 126 - ((inp >> 23) & 0xFF);
+ return static_cast<sf16>(rtna_shift32((inp & UINT32_C(0x7FFFFF)) + UINT32_C(0x800000), p) | vlx);
+ case 23:
+ case 28:
+ /* denormal, round to nearest-even. */
+ p = 126 - ((inp >> 23) & 0xFF);
+ return static_cast<sf16>(rtne_shift32((inp & UINT32_C(0x7FFFFF)) + UINT32_C(0x800000), p) | vlx);
+ }
+
+ return 0;
+}
+
+/* convert from soft-float to native-float */
+float sf16_to_float(uint16_t p)
+{
+ if32 i;
+ i.u = sf16_to_sf32(p);
+ return i.f;
+}
+
+/* convert from native-float to soft-float */
+uint16_t float_to_sf16(float p)
+{
+ if32 i;
+ i.f = p;
+ return sf32_to_sf16(i.u, SF_NEARESTEVEN);
+}
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_partition_tables.cpp b/thirdparty/astcenc/astcenc_partition_tables.cpp
new file mode 100644
index 0000000000..cad42384d7
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_partition_tables.cpp
@@ -0,0 +1,481 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2023 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Functions for generating partition tables on demand.
+ */
+
+#include "astcenc_internal.h"
+
+/** @brief The number of 64-bit words needed to represent a canonical partition bit pattern. */
+#define BIT_PATTERN_WORDS (((ASTCENC_BLOCK_MAX_TEXELS * 2) + 63) / 64)
+
+/**
+ * @brief Generate a canonical representation of a partition pattern.
+ *
+ * The returned value stores two bits per texel, for up to 6x6x6 texels, where the two bits store
+ * the remapped texel index. Remapping ensures that we only match on the partition pattern,
+ * independent of the partition order generated by the hash.
+ *
+ * @param texel_count The number of texels in the block.
+ * @param partition_of_texel The partition assignments, in hash order.
+ * @param[out] bit_pattern The output bit pattern representation.
+ */
+static void generate_canonical_partitioning(
+ unsigned int texel_count,
+ const uint8_t* partition_of_texel,
+ uint64_t bit_pattern[BIT_PATTERN_WORDS]
+) {
+ // Clear the pattern
+ for (unsigned int i = 0; i < BIT_PATTERN_WORDS; i++)
+ {
+ bit_pattern[i] = 0;
+ }
+
+ // Store a mapping to reorder the raw partitions so that the partitions are ordered such
+ // that the lowest texel index in partition N is smaller than the lowest texel index in
+ // partition N + 1.
+ int mapped_index[BLOCK_MAX_PARTITIONS];
+ int map_weight_count = 0;
+
+ for (unsigned int i = 0; i < BLOCK_MAX_PARTITIONS; i++)
+ {
+ mapped_index[i] = -1;
+ }
+
+ for (unsigned int i = 0; i < texel_count; i++)
+ {
+ int index = partition_of_texel[i];
+ if (mapped_index[index] < 0)
+ {
+ mapped_index[index] = map_weight_count++;
+ }
+
+ uint64_t xlat_index = mapped_index[index];
+ bit_pattern[i >> 5] |= xlat_index << (2 * (i & 0x1F));
+ }
+}
+
+/**
+ * @brief Compare two canonical patterns to see if they are the same.
+ *
+ * @param part1 The first canonical bit pattern to check.
+ * @param part2 The second canonical bit pattern to check.
+ *
+ * @return @c true if the patterns are the same, @c false otherwise.
+ */
+static bool compare_canonical_partitionings(
+ const uint64_t part1[BIT_PATTERN_WORDS],
+ const uint64_t part2[BIT_PATTERN_WORDS]
+) {
+ return (part1[0] == part2[0])
+#if BIT_PATTERN_WORDS > 1
+ && (part1[1] == part2[1])
+#endif
+#if BIT_PATTERN_WORDS > 2
+ && (part1[2] == part2[2])
+#endif
+#if BIT_PATTERN_WORDS > 3
+ && (part1[3] == part2[3])
+#endif
+#if BIT_PATTERN_WORDS > 4
+ && (part1[4] == part2[4])
+#endif
+#if BIT_PATTERN_WORDS > 5
+ && (part1[5] == part2[5])
+#endif
+#if BIT_PATTERN_WORDS > 6
+ && (part1[6] == part2[6])
+#endif
+ ;
+}
+
+/**
+ * @brief Hash function used for procedural partition assignment.
+ *
+ * @param inp The hash seed.
+ *
+ * @return The hashed value.
+ */
+static uint32_t hash52(
+ uint32_t inp
+) {
+ inp ^= inp >> 15;
+
+ // (2^4 + 1) * (2^7 + 1) * (2^17 - 1)
+ inp *= 0xEEDE0891;
+ inp ^= inp >> 5;
+ inp += inp << 16;
+ inp ^= inp >> 7;
+ inp ^= inp >> 3;
+ inp ^= inp << 6;
+ inp ^= inp >> 17;
+ return inp;
+}
+
+/**
+ * @brief Select texel assignment for a single coordinate.
+ *
+ * @param seed The seed - the partition index from the block.
+ * @param x The texel X coordinate in the block.
+ * @param y The texel Y coordinate in the block.
+ * @param z The texel Z coordinate in the block.
+ * @param partition_count The total partition count of this encoding.
+ * @param small_block @c true if the block has fewer than 32 texels.
+ *
+ * @return The assigned partition index for this texel.
+ */
+static uint8_t select_partition(
+ int seed,
+ int x,
+ int y,
+ int z,
+ int partition_count,
+ bool small_block
+) {
+ // For small blocks bias the coordinates to get better distribution
+ if (small_block)
+ {
+ x <<= 1;
+ y <<= 1;
+ z <<= 1;
+ }
+
+ seed += (partition_count - 1) * 1024;
+
+ uint32_t rnum = hash52(seed);
+
+ uint8_t seed1 = rnum & 0xF;
+ uint8_t seed2 = (rnum >> 4) & 0xF;
+ uint8_t seed3 = (rnum >> 8) & 0xF;
+ uint8_t seed4 = (rnum >> 12) & 0xF;
+ uint8_t seed5 = (rnum >> 16) & 0xF;
+ uint8_t seed6 = (rnum >> 20) & 0xF;
+ uint8_t seed7 = (rnum >> 24) & 0xF;
+ uint8_t seed8 = (rnum >> 28) & 0xF;
+ uint8_t seed9 = (rnum >> 18) & 0xF;
+ uint8_t seed10 = (rnum >> 22) & 0xF;
+ uint8_t seed11 = (rnum >> 26) & 0xF;
+ uint8_t seed12 = ((rnum >> 30) | (rnum << 2)) & 0xF;
+
+ // Squaring all the seeds in order to bias their distribution towards lower values.
+ seed1 *= seed1;
+ seed2 *= seed2;
+ seed3 *= seed3;
+ seed4 *= seed4;
+ seed5 *= seed5;
+ seed6 *= seed6;
+ seed7 *= seed7;
+ seed8 *= seed8;
+ seed9 *= seed9;
+ seed10 *= seed10;
+ seed11 *= seed11;
+ seed12 *= seed12;
+
+ int sh1, sh2;
+ if (seed & 1)
+ {
+ sh1 = (seed & 2 ? 4 : 5);
+ sh2 = (partition_count == 3 ? 6 : 5);
+ }
+ else
+ {
+ sh1 = (partition_count == 3 ? 6 : 5);
+ sh2 = (seed & 2 ? 4 : 5);
+ }
+
+ int sh3 = (seed & 0x10) ? sh1 : sh2;
+
+ seed1 >>= sh1;
+ seed2 >>= sh2;
+ seed3 >>= sh1;
+ seed4 >>= sh2;
+ seed5 >>= sh1;
+ seed6 >>= sh2;
+ seed7 >>= sh1;
+ seed8 >>= sh2;
+
+ seed9 >>= sh3;
+ seed10 >>= sh3;
+ seed11 >>= sh3;
+ seed12 >>= sh3;
+
+ int a = seed1 * x + seed2 * y + seed11 * z + (rnum >> 14);
+ int b = seed3 * x + seed4 * y + seed12 * z + (rnum >> 10);
+ int c = seed5 * x + seed6 * y + seed9 * z + (rnum >> 6);
+ int d = seed7 * x + seed8 * y + seed10 * z + (rnum >> 2);
+
+ // Apply the saw
+ a &= 0x3F;
+ b &= 0x3F;
+ c &= 0x3F;
+ d &= 0x3F;
+
+ // Remove some of the components if we are to output < 4 partitions.
+ if (partition_count <= 3)
+ {
+ d = 0;
+ }
+
+ if (partition_count <= 2)
+ {
+ c = 0;
+ }
+
+ if (partition_count <= 1)
+ {
+ b = 0;
+ }
+
+ uint8_t partition;
+ if (a >= b && a >= c && a >= d)
+ {
+ partition = 0;
+ }
+ else if (b >= c && b >= d)
+ {
+ partition = 1;
+ }
+ else if (c >= d)
+ {
+ partition = 2;
+ }
+ else
+ {
+ partition = 3;
+ }
+
+ return partition;
+}
+
+/**
+ * @brief Generate a single partition info structure.
+ *
+ * @param[out] bsd The block size information.
+ * @param partition_count The partition count of this partitioning.
+ * @param partition_index The partition index / seed of this partitioning.
+ * @param partition_remap_index The remapped partition index of this partitioning.
+ * @param[out] pi The partition info structure to populate.
+ *
+ * @return True if this is a useful partition index, False if we can skip it.
+ */
+static bool generate_one_partition_info_entry(
+ block_size_descriptor& bsd,
+ unsigned int partition_count,
+ unsigned int partition_index,
+ unsigned int partition_remap_index,
+ partition_info& pi
+) {
+ int texels_per_block = bsd.texel_count;
+ bool small_block = texels_per_block < 32;
+
+ uint8_t *partition_of_texel = pi.partition_of_texel;
+
+ // Assign texels to partitions
+ int texel_idx = 0;
+ int counts[BLOCK_MAX_PARTITIONS] { 0 };
+ for (unsigned int z = 0; z < bsd.zdim; z++)
+ {
+ for (unsigned int y = 0; y < bsd.ydim; y++)
+ {
+ for (unsigned int x = 0; x < bsd.xdim; x++)
+ {
+ uint8_t part = select_partition(partition_index, x, y, z, partition_count, small_block);
+ pi.texels_of_partition[part][counts[part]++] = static_cast<uint8_t>(texel_idx++);
+ *partition_of_texel++ = part;
+ }
+ }
+ }
+
+ // Fill loop tail so we can overfetch later
+ for (unsigned int i = 0; i < partition_count; i++)
+ {
+ int ptex_count = counts[i];
+ int ptex_count_simd = round_up_to_simd_multiple_vla(ptex_count);
+ for (int j = ptex_count; j < ptex_count_simd; j++)
+ {
+ pi.texels_of_partition[i][j] = pi.texels_of_partition[i][ptex_count - 1];
+ }
+ }
+
+ // Populate the actual procedural partition count
+ if (counts[0] == 0)
+ {
+ pi.partition_count = 0;
+ }
+ else if (counts[1] == 0)
+ {
+ pi.partition_count = 1;
+ }
+ else if (counts[2] == 0)
+ {
+ pi.partition_count = 2;
+ }
+ else if (counts[3] == 0)
+ {
+ pi.partition_count = 3;
+ }
+ else
+ {
+ pi.partition_count = 4;
+ }
+
+ // Populate the partition index
+ pi.partition_index = static_cast<uint16_t>(partition_index);
+
+ // Populate the coverage bitmaps for 2/3/4 partitions
+ uint64_t* bitmaps { nullptr };
+ if (partition_count == 2)
+ {
+ bitmaps = bsd.coverage_bitmaps_2[partition_remap_index];
+ }
+ else if (partition_count == 3)
+ {
+ bitmaps = bsd.coverage_bitmaps_3[partition_remap_index];
+ }
+ else if (partition_count == 4)
+ {
+ bitmaps = bsd.coverage_bitmaps_4[partition_remap_index];
+ }
+
+ for (unsigned int i = 0; i < BLOCK_MAX_PARTITIONS; i++)
+ {
+ pi.partition_texel_count[i] = static_cast<uint8_t>(counts[i]);
+ }
+
+ // Valid partitionings have texels in all of the requested partitions
+ bool valid = pi.partition_count == partition_count;
+
+ if (bitmaps)
+ {
+ // Populate the partition coverage bitmap
+ for (unsigned int i = 0; i < partition_count; i++)
+ {
+ bitmaps[i] = 0ULL;
+ }
+
+ unsigned int texels_to_process = astc::min(bsd.texel_count, BLOCK_MAX_KMEANS_TEXELS);
+ for (unsigned int i = 0; i < texels_to_process; i++)
+ {
+ unsigned int idx = bsd.kmeans_texels[i];
+ bitmaps[pi.partition_of_texel[idx]] |= 1ULL << i;
+ }
+ }
+
+ return valid;
+}
+
+static void build_partition_table_for_one_partition_count(
+ block_size_descriptor& bsd,
+ bool can_omit_partitionings,
+ unsigned int partition_count_cutoff,
+ unsigned int partition_count,
+ partition_info* ptab,
+ uint64_t* canonical_patterns
+) {
+ unsigned int next_index = 0;
+ bsd.partitioning_count_selected[partition_count - 1] = 0;
+ bsd.partitioning_count_all[partition_count - 1] = 0;
+
+ // Skip tables larger than config max partition count if we can omit modes
+ if (can_omit_partitionings && (partition_count > partition_count_cutoff))
+ {
+ return;
+ }
+
+ // Iterate through twice
+ // - Pass 0: Keep selected partitionings
+ // - Pass 1: Keep non-selected partitionings (skip if in omit mode)
+ unsigned int max_iter = can_omit_partitionings ? 1 : 2;
+
+ // Tracker for things we built in the first iteration
+ uint8_t build[BLOCK_MAX_PARTITIONINGS] { 0 };
+ for (unsigned int x = 0; x < max_iter; x++)
+ {
+ for (unsigned int i = 0; i < BLOCK_MAX_PARTITIONINGS; i++)
+ {
+ // Don't include things we built in the first pass
+ if ((x == 1) && build[i])
+ {
+ continue;
+ }
+
+ bool keep_useful = generate_one_partition_info_entry(bsd, partition_count, i, next_index, ptab[next_index]);
+ if ((x == 0) && !keep_useful)
+ {
+ continue;
+ }
+
+ generate_canonical_partitioning(bsd.texel_count, ptab[next_index].partition_of_texel, canonical_patterns + next_index * BIT_PATTERN_WORDS);
+ bool keep_canonical = true;
+ for (unsigned int j = 0; j < next_index; j++)
+ {
+ bool match = compare_canonical_partitionings(canonical_patterns + next_index * BIT_PATTERN_WORDS, canonical_patterns + j * BIT_PATTERN_WORDS);
+ if (match)
+ {
+ keep_canonical = false;
+ break;
+ }
+ }
+
+ if (keep_useful && keep_canonical)
+ {
+ if (x == 0)
+ {
+ bsd.partitioning_packed_index[partition_count - 2][i] = static_cast<uint16_t>(next_index);
+ bsd.partitioning_count_selected[partition_count - 1]++;
+ bsd.partitioning_count_all[partition_count - 1]++;
+ build[i] = 1;
+ next_index++;
+ }
+ }
+ else
+ {
+ if (x == 1)
+ {
+ bsd.partitioning_packed_index[partition_count - 2][i] = static_cast<uint16_t>(next_index);
+ bsd.partitioning_count_all[partition_count - 1]++;
+ next_index++;
+ }
+ }
+ }
+ }
+}
+
+/* See header for documentation. */
+void init_partition_tables(
+ block_size_descriptor& bsd,
+ bool can_omit_partitionings,
+ unsigned int partition_count_cutoff
+) {
+ partition_info* par_tab2 = bsd.partitionings;
+ partition_info* par_tab3 = par_tab2 + BLOCK_MAX_PARTITIONINGS;
+ partition_info* par_tab4 = par_tab3 + BLOCK_MAX_PARTITIONINGS;
+ partition_info* par_tab1 = par_tab4 + BLOCK_MAX_PARTITIONINGS;
+
+ generate_one_partition_info_entry(bsd, 1, 0, 0, *par_tab1);
+ bsd.partitioning_count_selected[0] = 1;
+ bsd.partitioning_count_all[0] = 1;
+
+ uint64_t* canonical_patterns = new uint64_t[BLOCK_MAX_PARTITIONINGS * BIT_PATTERN_WORDS];
+
+ build_partition_table_for_one_partition_count(bsd, can_omit_partitionings, partition_count_cutoff, 2, par_tab2, canonical_patterns);
+ build_partition_table_for_one_partition_count(bsd, can_omit_partitionings, partition_count_cutoff, 3, par_tab3, canonical_patterns);
+ build_partition_table_for_one_partition_count(bsd, can_omit_partitionings, partition_count_cutoff, 4, par_tab4, canonical_patterns);
+
+ delete[] canonical_patterns;
+}
diff --git a/thirdparty/astcenc/astcenc_percentile_tables.cpp b/thirdparty/astcenc/astcenc_percentile_tables.cpp
new file mode 100644
index 0000000000..448ddcc968
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_percentile_tables.cpp
@@ -0,0 +1,1251 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2022 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Percentile data tables for different block encodings.
+ *
+ * To reduce binary size the tables are stored using a packed differential encoding.
+ */
+
+#include "astcenc_internal.h"
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+/**
+ * @brief Structure containing packed percentile metadata.
+ *
+ * Note that percentile tables do not exist for 3D textures, so no zdim is stored.
+ */
+struct packed_percentile_table
+{
+ /** The block X dimension. */
+ uint8_t xdim;
+
+ /** The block Y dimension. */
+ uint8_t ydim;
+
+ /** The number of packed items in the 1 and 2 plane data. */
+ uint16_t item_count[2];
+
+ /** The accumulator divisor for 1 and 2 plane data. */
+ uint16_t difscales[2];
+
+ /** The initial accumulator values for 1 and 2 plane data. */
+ uint16_t initial_percs[2];
+
+ /** The packed data for the 1 and 2 plane data. */
+ const uint16_t *items[2];
+};
+
+#if ASTCENC_BLOCK_MAX_TEXELS >= (4 * 4)
+static const uint16_t percentile_arr_4x4_0[61] {
+ 0x0242, 0x7243, 0x6A51, 0x6A52, 0x5A41, 0x4A53, 0x8851, 0x3842,
+ 0x3852, 0x3853, 0x3043, 0xFA33, 0x1BDF, 0x2022, 0x1032, 0x29CE,
+ 0x21DE, 0x2823, 0x0813, 0x0A13, 0x0A31, 0x0A23, 0x09CF, 0x0833,
+ 0x0A32, 0x01DF, 0x0BDD, 0x0BCF, 0x0221, 0x095F, 0x0A01, 0x0BDE,
+ 0x0BCD, 0x0A22, 0x09AF, 0x0B5F, 0x0B4D, 0x0BCE, 0x0BBF, 0x0A11,
+ 0x01BF, 0x0202, 0x0B5D, 0x1203, 0x034E, 0x0B8E, 0x035E, 0x0212,
+ 0x032E, 0x0B4F, 0x03AF, 0x03AD, 0x03BD, 0x0BBE, 0x03AE, 0x039F,
+ 0x039E, 0x033E, 0x033F, 0x038F, 0x032F
+};
+
+static const uint16_t percentile_arr_4x4_1[84] {
+ 0x0452, 0xFFAE, 0x2433, 0x1DDF, 0x17CD, 0x1E21, 0x1C43, 0x1442,
+ 0x3FBE, 0x1FDD, 0x0E31, 0x0F4F, 0x1423, 0x0FBD, 0x1451, 0x0E03,
+ 0x05CF, 0x0C32, 0x0DDE, 0x27AD, 0x274E, 0x0E02, 0x0F5E, 0x07AF,
+ 0x0F5F, 0x0DCE, 0x0C41, 0x0422, 0x0613, 0x0E12, 0x0611, 0x0F3F,
+ 0x0601, 0x0DBF, 0x05DD, 0x075D, 0x0C02, 0x054E, 0x0431, 0x0413,
+ 0x079F, 0x05BE, 0x0F4D, 0x0403, 0x05AF, 0x055F, 0x05AE, 0x054F,
+ 0x0421, 0x05BD, 0x0DCD, 0x0411, 0x0412, 0x055E, 0x055D, 0x073D,
+ 0x058E, 0x072F, 0x072D, 0x079D, 0x0D2E, 0x0453, 0x078D, 0x053E,
+ 0x053F, 0x059E, 0x052F, 0x058F, 0x072E, 0x078F, 0x059F, 0x078E,
+ 0x071F, 0x073E, 0x051F, 0x070D, 0x079E, 0x070E, 0x071D, 0x0622,
+ 0x070F, 0x071E, 0x07BF, 0x07CE
+};
+
+static const packed_percentile_table block_pcd_4x4 {
+ 4, 4,
+ { 61, 84 },
+ { 184, 141 },
+ { 0, 53 },
+ { percentile_arr_4x4_0, percentile_arr_4x4_1 }
+};
+#endif
+
+#if ASTCENC_BLOCK_MAX_TEXELS >= (5 * 4)
+static const uint16_t percentile_arr_5x4_0[91] {
+ 0x02C1, 0xFAD1, 0xE8D3, 0xDAC2, 0xA8D2, 0x70D1, 0x50C2, 0x80C3,
+ 0xD2C3, 0x4AA2, 0x2AD2, 0x2242, 0x2251, 0x42A3, 0x1A43, 0x4A52,
+ 0x32B3, 0x2A41, 0x1042, 0x1851, 0x5892, 0x10A2, 0x2253, 0x10B2,
+ 0x10B3, 0x13DF, 0x3083, 0x08B1, 0x1043, 0x12B1, 0x0AB2, 0x1A93,
+ 0x1852, 0x1A33, 0x09CE, 0x08A3, 0x1022, 0x1283, 0x0853, 0x1AA1,
+ 0x1093, 0x11DE, 0x135F, 0x1832, 0x195F, 0x0A81, 0x11CF, 0x0A31,
+ 0x09DF, 0x0B4D, 0x09AF, 0x03CF, 0x0813, 0x03DD, 0x0A92, 0x0A82,
+ 0x03CD, 0x0023, 0x0BDE, 0x0BBF, 0x1232, 0x0221, 0x0291, 0x0A23,
+ 0x0833, 0x035D, 0x0BCE, 0x01BF, 0x0222, 0x134E, 0x0213, 0x0A01,
+ 0x0B4F, 0x0B5E, 0x038E, 0x032E, 0x03AF, 0x0A11, 0x03AD, 0x0203,
+ 0x0202, 0x0BBD, 0x033E, 0x03AE, 0x03BE, 0x0212, 0x033F, 0x039E,
+ 0x039F, 0x032F, 0x038F
+};
+
+static const uint16_t percentile_arr_5x4_1[104] {
+ 0x0433, 0xB621, 0x5452, 0x4443, 0x7FAE, 0xFCA3, 0x7CC2, 0x24B2,
+ 0x45DF, 0x44B3, 0x7631, 0x27CD, 0x1CD1, 0x1E03, 0x4FBE, 0x774F,
+ 0x1C42, 0x7691, 0x24A2, 0x2681, 0x3C23, 0x3C93, 0x0FBD, 0x1C32,
+ 0x1E82, 0x1E12, 0x0F4E, 0x1602, 0x0FAD, 0x0C51, 0x1FDD, 0x0E13,
+ 0x0DCF, 0x175E, 0x0C22, 0x175F, 0x15DE, 0x0CB1, 0x17AF, 0x1CC1,
+ 0x1F3F, 0x1483, 0x0441, 0x0C91, 0x04D2, 0x0DCE, 0x154E, 0x079F,
+ 0x0CA1, 0x0F5D, 0x0431, 0x15DD, 0x05BF, 0x0C92, 0x0611, 0x0C82,
+ 0x0402, 0x074D, 0x0DBD, 0x055E, 0x05BE, 0x0DCD, 0x0421, 0x05AF,
+ 0x0403, 0x0D4F, 0x055F, 0x05AE, 0x0413, 0x0E01, 0x055D, 0x073D,
+ 0x0C12, 0x0692, 0x0411, 0x072D, 0x078D, 0x079D, 0x058E, 0x0D2E,
+ 0x0453, 0x072F, 0x059E, 0x052F, 0x071F, 0x053F, 0x053E, 0x078F,
+ 0x058F, 0x051F, 0x0F2E, 0x059F, 0x078E, 0x073E, 0x071D, 0x070D,
+ 0x070E, 0x079E, 0x0622, 0x0683, 0x070F, 0x071E, 0x07BF, 0x07CE
+};
+
+static const packed_percentile_table block_pcd_5x4 {
+ 5, 4,
+ { 91, 104 },
+ { 322, 464 },
+ { 0, 202 },
+ { percentile_arr_5x4_0, percentile_arr_5x4_1 }
+};
+#endif
+
+#if ASTCENC_BLOCK_MAX_TEXELS >= (5 * 5)
+static const uint16_t percentile_arr_5x5_0[129] {
+ 0x00F3, 0xF8F2, 0x70E3, 0x62E1, 0x60E1, 0x4AC1, 0x3261, 0x38D3,
+ 0x3271, 0x5AF1, 0x5873, 0x2AD1, 0x28E2, 0x28F1, 0x2262, 0x9AC2,
+ 0x18D2, 0x1072, 0x1071, 0x22A2, 0x2062, 0x1A51, 0x10C2, 0x0892,
+ 0x08D1, 0x1AA3, 0x23EE, 0x08C3, 0x0BEF, 0x2242, 0x0863, 0x0AB3,
+ 0x0BFF, 0x0A93, 0x08A2, 0x0A41, 0x1083, 0x0842, 0x10B3, 0x21EE,
+ 0x10B2, 0x00B1, 0x1263, 0x12C3, 0x0A83, 0x0851, 0x11FE, 0x0253,
+ 0x09FD, 0x0A72, 0x09FF, 0x1AB2, 0x0BDF, 0x0A33, 0x0243, 0x0B7F,
+ 0x0AB1, 0x12D2, 0x0252, 0x096F, 0x00A3, 0x0893, 0x0822, 0x0843,
+ 0x097E, 0x097F, 0x01EF, 0x09CE, 0x03FE, 0x0A81, 0x036F, 0x0052,
+ 0x13FD, 0x0AA1, 0x1853, 0x036D, 0x0A92, 0x0832, 0x01DE, 0x0A82,
+ 0x0BED, 0x0231, 0x0BBF, 0x03DD, 0x0B6E, 0x01AF, 0x0813, 0x0023,
+ 0x0A91, 0x015F, 0x037E, 0x01CF, 0x0232, 0x0BCD, 0x0221, 0x0BDE,
+ 0x0213, 0x035F, 0x0B7D, 0x0223, 0x01BF, 0x0BCF, 0x01DF, 0x0033,
+ 0x0222, 0x03CE, 0x0A01, 0x03AF, 0x034D, 0x0B8E, 0x032E, 0x0203,
+ 0x0211, 0x0202, 0x0B5D, 0x03AD, 0x034E, 0x03AE, 0x034F, 0x033F,
+ 0x039F, 0x03BD, 0x03BE, 0x035E, 0x0212, 0x033E, 0x039E, 0x032F,
+ 0x038F
+};
+
+static const uint16_t percentile_arr_5x5_1[126] {
+ 0x0443, 0x6452, 0xFE21, 0x27AE, 0x2433, 0x1FCD, 0x25DF, 0x6CC2,
+ 0x2C62, 0x1F4F, 0x4C42, 0x1FBE, 0x0DEF, 0x34A3, 0x0E03, 0x54B2,
+ 0x1F7D, 0x17DD, 0x0DFF, 0x0CD1, 0x0E31, 0x0C71, 0x1CF1, 0x15FE,
+ 0x1691, 0x1681, 0x24B3, 0x174E, 0x0F6E, 0x0493, 0x175E, 0x1C51,
+ 0x17BD, 0x076D, 0x2CA2, 0x05EE, 0x1472, 0x2423, 0x0DCF, 0x0432,
+ 0x15DE, 0x0612, 0x0CD2, 0x0682, 0x0F5F, 0x07AD, 0x0602, 0x0CE1,
+ 0x0C91, 0x0FAF, 0x073F, 0x0E13, 0x0D7F, 0x0DCE, 0x0422, 0x0D7D,
+ 0x0441, 0x05FD, 0x0CB1, 0x0C83, 0x04C1, 0x0461, 0x0F9F, 0x0DDD,
+ 0x056E, 0x0C92, 0x0482, 0x0431, 0x05ED, 0x0D6F, 0x075D, 0x0402,
+ 0x057E, 0x0DBF, 0x04A1, 0x054E, 0x0F4D, 0x0403, 0x05CD, 0x0453,
+ 0x05AE, 0x0421, 0x0F1F, 0x05BE, 0x0601, 0x0611, 0x05BD, 0x05AF,
+ 0x078D, 0x072D, 0x073D, 0x055E, 0x0F9D, 0x0411, 0x0413, 0x0412,
+ 0x055F, 0x077E, 0x055D, 0x052E, 0x054F, 0x053E, 0x058E, 0x078F,
+ 0x059E, 0x071D, 0x0E92, 0x053F, 0x059F, 0x051F, 0x072F, 0x052F,
+ 0x070D, 0x079E, 0x058F, 0x072E, 0x070E, 0x078E, 0x070F, 0x073E,
+ 0x0622, 0x0683, 0x071E, 0x076F, 0x07BF, 0x07CE
+};
+
+static const packed_percentile_table block_pcd_5x5 {
+ 5, 5,
+ { 129, 126 },
+ { 258, 291 },
+ { 0, 116 },
+ { percentile_arr_5x5_0, percentile_arr_5x5_1 }
+};
+#endif
+
+#if ASTCENC_BLOCK_MAX_TEXELS >= (6 * 5)
+static const uint16_t percentile_arr_6x5_0[165] {
+ 0x0163, 0xF8F3, 0x9962, 0x8972, 0x7961, 0x7173, 0x6953, 0x5943,
+ 0x4B41, 0x3AE1, 0x38E3, 0x6971, 0x32C1, 0x28D3, 0x2A61, 0xC8F2,
+ 0x2271, 0x4873, 0x5B21, 0x3AD1, 0x1B13, 0x1952, 0x1B51, 0x12F1,
+ 0x1A62, 0x1322, 0x1951, 0x10E2, 0x1B31, 0x20F1, 0x2102, 0x2072,
+ 0x10D2, 0x1142, 0x2912, 0x3871, 0x2BEE, 0x0862, 0x1123, 0x0AC2,
+ 0x12A2, 0x0A51, 0x1922, 0x0941, 0x1BEF, 0x0B42, 0x08D1, 0x13FF,
+ 0x1933, 0x08C3, 0x08C2, 0x1131, 0x08E1, 0x2903, 0x0863, 0x0B32,
+ 0x1132, 0x1AC3, 0x0A42, 0x1A41, 0x0042, 0x21EE, 0x09FF, 0x03DF,
+ 0x0AA3, 0x11FE, 0x02B3, 0x0B11, 0x10B3, 0x0B03, 0x11FD, 0x0913,
+ 0x0A53, 0x037F, 0x1263, 0x0051, 0x0A33, 0x0B01, 0x016F, 0x0A72,
+ 0x1312, 0x08A2, 0x10B1, 0x0BFE, 0x11EF, 0x0B02, 0x0A52, 0x0043,
+ 0x0822, 0x01CE, 0x0A43, 0x097F, 0x036F, 0x08B2, 0x03FD, 0x0A83,
+ 0x0B33, 0x0AB1, 0x017E, 0x0B23, 0x0852, 0x02D2, 0x0BBF, 0x0BDD,
+ 0x03ED, 0x0AB2, 0x02A1, 0x0853, 0x036D, 0x0892, 0x0032, 0x0A31,
+ 0x0083, 0x09DE, 0x0A93, 0x08A3, 0x1213, 0x0BDE, 0x03CD, 0x036E,
+ 0x037E, 0x0A21, 0x0023, 0x0BCF, 0x01CF, 0x0013, 0x01AF, 0x0A92,
+ 0x0232, 0x035F, 0x0093, 0x0B7D, 0x015F, 0x0282, 0x01BF, 0x09DF,
+ 0x03CE, 0x0223, 0x0833, 0x0222, 0x03AF, 0x0A01, 0x0291, 0x0B4D,
+ 0x032E, 0x038E, 0x0203, 0x0281, 0x035D, 0x03AD, 0x0B9F, 0x0202,
+ 0x034F, 0x03BE, 0x0211, 0x03AE, 0x03BD, 0x0212, 0x034E, 0x033F,
+ 0x033E, 0x035E, 0x039E, 0x032F, 0x038F
+};
+
+static const uint16_t percentile_arr_6x5_1[145] {
+ 0x0443, 0xEFAE, 0x2CC2, 0x2E21, 0x2C52, 0x7C33, 0x47CD, 0x25DF,
+ 0x3CA3, 0xFFBE, 0x2551, 0x24B3, 0x474F, 0x1513, 0x2691, 0x1603,
+ 0x1462, 0x1D32, 0x14B2, 0x5442, 0x2CD2, 0x35EF, 0x0CD1, 0x3D22,
+ 0x17BD, 0x0FDD, 0x0DFF, 0x2631, 0x177D, 0x0CF1, 0x1E81, 0x0E82,
+ 0x1DFE, 0x0F5E, 0x0701, 0x2CA2, 0x1D03, 0x0F4E, 0x1471, 0x0C51,
+ 0x1F6E, 0x2FAF, 0x0561, 0x0C72, 0x176D, 0x0FAD, 0x0DEE, 0x05CF,
+ 0x0E13, 0x0F5F, 0x0E12, 0x0C23, 0x1E02, 0x1D12, 0x0CB1, 0x0C32,
+ 0x0C93, 0x15DE, 0x0F9F, 0x0F3F, 0x0D41, 0x0C41, 0x0CC1, 0x0D31,
+ 0x0C22, 0x05FD, 0x057F, 0x0D01, 0x0461, 0x04E1, 0x0D7D, 0x05CE,
+ 0x0502, 0x0C31, 0x05ED, 0x05DD, 0x0511, 0x0F11, 0x0491, 0x0D6F,
+ 0x0521, 0x056E, 0x0C83, 0x0D23, 0x04A1, 0x0C02, 0x075D, 0x05BF,
+ 0x0C21, 0x079D, 0x0482, 0x05BD, 0x0DBE, 0x05CD, 0x054E, 0x057E,
+ 0x0DAE, 0x074D, 0x078D, 0x0542, 0x0492, 0x05AF, 0x0611, 0x0F3D,
+ 0x0601, 0x071F, 0x055E, 0x059E, 0x0571, 0x054F, 0x0412, 0x0453,
+ 0x058E, 0x0413, 0x0D3E, 0x077E, 0x072D, 0x052E, 0x059F, 0x055D,
+ 0x072F, 0x0403, 0x0411, 0x058F, 0x055F, 0x0692, 0x078E, 0x053F,
+ 0x0D2F, 0x078F, 0x070D, 0x071D, 0x051F, 0x072E, 0x079E, 0x070E,
+ 0x070F, 0x073E, 0x0622, 0x0683, 0x0702, 0x071E, 0x076F, 0x07BF,
+ 0x07CE
+};
+
+static const packed_percentile_table block_pcd_6x5 {
+ 6, 5,
+ { 165, 145 },
+ { 388, 405 },
+ { 0, 156 },
+ { percentile_arr_6x5_0, percentile_arr_6x5_1 }
+};
+#endif
+
+#if ASTCENC_BLOCK_MAX_TEXELS >= (6 * 6)
+static const uint16_t percentile_arr_6x6_0[206] {
+ 0x006F, 0xF908, 0xF104, 0xE918, 0xE963, 0xD114, 0xB0F3, 0xA07E,
+ 0x7972, 0x705F, 0x687F, 0x6162, 0x5953, 0x586E, 0x610C, 0x524D,
+ 0x5973, 0x9943, 0x98E3, 0x904F, 0x8341, 0x7AC1, 0x3A61, 0x70D3,
+ 0xA073, 0x6AE1, 0x30F2, 0x3313, 0x2B21, 0x9A2E, 0x4322, 0x225D,
+ 0x2331, 0x2271, 0x22D1, 0x1A2D, 0x221F, 0x22F1, 0x1971, 0x6952,
+ 0x1951, 0x187D, 0x18F1, 0x1902, 0x185E, 0x1B51, 0x105D, 0x1A3D,
+ 0x30E2, 0x10D2, 0x1961, 0x12A2, 0x6072, 0x3942, 0x386D, 0x33EE,
+ 0x104E, 0x4923, 0x101E, 0x2122, 0x1251, 0x1141, 0x182F, 0x3133,
+ 0x080E, 0x1262, 0x123E, 0x1B32, 0x102E, 0x1931, 0x10D1, 0x1912,
+ 0x0871, 0x12C2, 0x08C2, 0x1103, 0x0B03, 0x1062, 0x083D, 0x08E1,
+ 0x1132, 0x184D, 0x0863, 0x08C3, 0x303F, 0x083E, 0x10B3, 0x12A3,
+ 0x0BEF, 0x0B11, 0x1A42, 0x2233, 0x13FF, 0x080F, 0x0A41, 0x0AC3,
+ 0x0842, 0x1A63, 0x0BDF, 0x09FF, 0x12B3, 0x124E, 0x0B12, 0x0B42,
+ 0x0A2F, 0x1253, 0x0913, 0x1051, 0x0B01, 0x120F, 0x0B02, 0x08A2,
+ 0x0BBF, 0x00B1, 0x22B1, 0x01EE, 0x1B33, 0x0B23, 0x0283, 0x13FD,
+ 0x0AB2, 0x11FD, 0x09FE, 0x0A43, 0x08B2, 0x0A1D, 0x0A52, 0x023F,
+ 0x101F, 0x01CE, 0x0A31, 0x0BDD, 0x0293, 0x1822, 0x12A1, 0x03FE,
+ 0x121E, 0x0843, 0x0272, 0x0B6F, 0x0052, 0x0A0D, 0x0BED, 0x12D2,
+ 0x1B7F, 0x1053, 0x0032, 0x01DE, 0x08A3, 0x020E, 0x0883, 0x09EF,
+ 0x0892, 0x0A21, 0x03CD, 0x0B5F, 0x0213, 0x0A32, 0x016F, 0x1292,
+ 0x03DE, 0x017E, 0x0BAF, 0x0223, 0x1093, 0x0BCF, 0x037E, 0x01DF,
+ 0x09CF, 0x015F, 0x09AF, 0x0023, 0x01BF, 0x0222, 0x0282, 0x03CE,
+ 0x1013, 0x036E, 0x097F, 0x0033, 0x0A01, 0x0B6D, 0x03BE, 0x037D,
+ 0x0281, 0x0BAE, 0x0203, 0x032E, 0x034D, 0x034F, 0x0291, 0x0211,
+ 0x038E, 0x03BD, 0x039E, 0x0BAD, 0x033E, 0x034E, 0x039F, 0x0202,
+ 0x035D, 0x0212, 0x033F, 0x035E, 0x038F, 0x032F
+};
+
+static const uint16_t percentile_arr_6x6_1[164] {
+ 0x07AE, 0x8443, 0x7E21, 0x77CD, 0x6C62, 0x9433, 0x6452, 0x34C2,
+ 0x5DDF, 0xC7BE, 0x25EF, 0x24A3, 0x3CF1, 0xFDFF, 0x177D, 0x1F4F,
+ 0xC551, 0x5CB3, 0x1532, 0x1513, 0x143E, 0x245D, 0x14B2, 0x2472,
+ 0x14D2, 0x1FBD, 0x1631, 0x2DFE, 0x1691, 0x17DD, 0x2E03, 0x376E,
+ 0x2442, 0x0F6D, 0x3C71, 0x2CD1, 0x2522, 0x6C51, 0x260D, 0x17AF,
+ 0x0DEE, 0x1C1F, 0x2F01, 0x142E, 0x0CA2, 0x0FAD, 0x3D03, 0x275E,
+ 0x1681, 0x274E, 0x1682, 0x1C23, 0x273F, 0x0F5F, 0x05DE, 0x15FD,
+ 0x0DCF, 0x1E02, 0x04B1, 0x144D, 0x0E12, 0x0D12, 0x1CC1, 0x0E13,
+ 0x1C6D, 0x0C32, 0x043D, 0x0C61, 0x0F9F, 0x04E1, 0x0DCE, 0x0D41,
+ 0x1C93, 0x0C22, 0x061D, 0x0D7F, 0x0C41, 0x0561, 0x0531, 0x0D21,
+ 0x0711, 0x0C91, 0x0501, 0x0C1E, 0x040F, 0x15DD, 0x0431, 0x0C2F,
+ 0x057D, 0x0C2D, 0x0DBE, 0x040E, 0x0D02, 0x0D11, 0x054E, 0x040D,
+ 0x0D23, 0x0DBF, 0x04A1, 0x05ED, 0x0C1D, 0x05BD, 0x072D, 0x056E,
+ 0x0483, 0x0F3D, 0x0482, 0x078D, 0x0F5D, 0x0453, 0x0D9E, 0x0C4E,
+ 0x05CD, 0x079D, 0x0402, 0x05AE, 0x0F1F, 0x0542, 0x074D, 0x056F,
+ 0x0421, 0x0D4F, 0x0601, 0x0571, 0x0492, 0x059F, 0x053F, 0x05AF,
+ 0x0611, 0x055E, 0x0D8E, 0x053E, 0x055D, 0x047D, 0x0411, 0x052E,
+ 0x058F, 0x051F, 0x055F, 0x0D7E, 0x072F, 0x052F, 0x0412, 0x078F,
+ 0x0403, 0x077E, 0x070D, 0x070E, 0x078E, 0x0F1D, 0x072E, 0x0413,
+ 0x070F, 0x0692, 0x079E, 0x060E, 0x0622, 0x0683, 0x0702, 0x071E,
+ 0x073E, 0x076F, 0x07BF, 0x07CE
+};
+
+static const packed_percentile_table block_pcd_6x6 {
+ 6, 6,
+ { 206, 164 },
+ { 769, 644 },
+ { 0, 256 },
+ { percentile_arr_6x6_0, percentile_arr_6x6_1 }
+};
+#endif
+
+#if ASTCENC_BLOCK_MAX_TEXELS >= (8 * 5)
+static const uint16_t percentile_arr_8x5_0[226] {
+ 0x0066, 0xF865, 0xE963, 0xA856, 0xA1F2, 0x9875, 0x91C3, 0x91E2,
+ 0x80F3, 0x8076, 0x61E3, 0x6153, 0x5172, 0x59D2, 0x51D3, 0x5047,
+ 0xA943, 0x49B3, 0x4846, 0x4962, 0xC037, 0x4173, 0x39F1, 0x7027,
+ 0xA2C1, 0x3AE1, 0x9341, 0x30D3, 0x5225, 0x2A61, 0x33C1, 0x28E3,
+ 0x53A1, 0x49C2, 0x2A06, 0x4055, 0x2006, 0x21D1, 0x2271, 0x4321,
+ 0x3873, 0x18F2, 0x2015, 0x1A15, 0x1857, 0x52D1, 0x3045, 0x4835,
+ 0x1952, 0x29E1, 0x3207, 0x1036, 0x1816, 0x2A16, 0x2971, 0x13B1,
+ 0x2A17, 0x2351, 0x1025, 0x1826, 0x30E2, 0x1262, 0x20F1, 0x1007,
+ 0x1072, 0x1151, 0x10D2, 0x1235, 0x1205, 0x1062, 0x4AF1, 0x1251,
+ 0x0B31, 0x1381, 0x13EE, 0x1B92, 0x13EF, 0x0942, 0x1AA2, 0x13FF,
+ 0x1161, 0x0B93, 0x19A2, 0x11B1, 0x08D1, 0x12C2, 0x0B13, 0x1B22,
+ 0x2123, 0x09A3, 0x2071, 0x1B7F, 0x1817, 0x0A42, 0x10C2, 0x1233,
+ 0x08C3, 0x0A41, 0x0B42, 0x09C1, 0x0933, 0x1AB3, 0x1382, 0x1BDF,
+ 0x2122, 0x0A53, 0x0AC3, 0x20E1, 0x0941, 0x0931, 0x0042, 0x0BA2,
+ 0x0AA3, 0x0992, 0x0863, 0x08B3, 0x11B2, 0x0902, 0x1283, 0x09FF,
+ 0x0B83, 0x0982, 0x0932, 0x0BFE, 0x0B32, 0x0BBF, 0x11FE, 0x036F,
+ 0x0851, 0x08B1, 0x18A2, 0x11EE, 0x0A52, 0x0BB2, 0x01FD, 0x0A43,
+ 0x1A63, 0x1193, 0x0B91, 0x0043, 0x1231, 0x0A26, 0x0AB1, 0x03FD,
+ 0x096F, 0x00B2, 0x0983, 0x0A72, 0x01CE, 0x0BDD, 0x0022, 0x0B11,
+ 0x1213, 0x0B6D, 0x017E, 0x1333, 0x0112, 0x0852, 0x02D2, 0x097F,
+ 0x01EF, 0x0AB2, 0x0293, 0x0853, 0x0BED, 0x0B12, 0x1303, 0x02A1,
+ 0x0892, 0x0032, 0x0883, 0x0B6E, 0x0292, 0x0A32, 0x037E, 0x0B23,
+ 0x0103, 0x0A21, 0x0B01, 0x0302, 0x0BCD, 0x00A3, 0x0BCF, 0x0BDE,
+ 0x0113, 0x01DE, 0x0B5F, 0x0013, 0x0BAF, 0x0223, 0x0222, 0x0A82,
+ 0x0833, 0x0023, 0x09CF, 0x037D, 0x01AF, 0x095F, 0x03CE, 0x09DF,
+ 0x01BF, 0x0893, 0x0203, 0x0201, 0x0B4D, 0x03BE, 0x032E, 0x03AE,
+ 0x0291, 0x0A02, 0x0211, 0x039F, 0x0281, 0x038E, 0x03AD, 0x033F,
+ 0x035D, 0x033E, 0x034E, 0x034F, 0x0212, 0x03BD, 0x032F, 0x035E,
+ 0x038F, 0x039E
+};
+
+static const uint16_t percentile_arr_8x5_1[167] {
+ 0x0621, 0xFCC2, 0x3443, 0xA433, 0x5532, 0x2551, 0x6CA3, 0x27AE,
+ 0x6452, 0x8E03, 0x3CB3, 0x4DA2, 0x6DDF, 0x37CD, 0x6F01, 0x1691,
+ 0x2E82, 0x27BE, 0x1513, 0x34D2, 0x1D22, 0x3E31, 0x2593, 0x2CB2,
+ 0x1C16, 0x374F, 0x0DD1, 0x2583, 0x6613, 0x0CD1, 0x0C35, 0x1462,
+ 0x3E81, 0x2612, 0x2C42, 0x3407, 0x14A2, 0x0E02, 0x1CF1, 0x0C06,
+ 0x17BD, 0x0F7D, 0x1D23, 0x35B1, 0x179F, 0x0D92, 0x0F5E, 0x1451,
+ 0x04B1, 0x1F6E, 0x0DEF, 0x0D31, 0x374E, 0x15C1, 0x0541, 0x2405,
+ 0x17AD, 0x0471, 0x1472, 0x0DFE, 0x0711, 0x0FDD, 0x0DFF, 0x0432,
+ 0x1D82, 0x0423, 0x0F6D, 0x07AF, 0x0F5F, 0x04C1, 0x1542, 0x0561,
+ 0x0DCF, 0x1D03, 0x1493, 0x0422, 0x0445, 0x0D12, 0x0C25, 0x0415,
+ 0x0DA1, 0x1591, 0x0DEE, 0x05DE, 0x0C31, 0x0491, 0x0441, 0x0D21,
+ 0x078D, 0x057D, 0x0C61, 0x0F3F, 0x0581, 0x0D6E, 0x0501, 0x0CA1,
+ 0x04E1, 0x0DFD, 0x057F, 0x0502, 0x0511, 0x0C82, 0x0483, 0x0C03,
+ 0x079D, 0x0402, 0x0DDD, 0x0611, 0x05AE, 0x0DCE, 0x056F, 0x0421,
+ 0x057E, 0x071F, 0x0DBF, 0x05BE, 0x0412, 0x059F, 0x054E, 0x077E,
+ 0x0C26, 0x05ED, 0x073D, 0x0601, 0x0492, 0x0453, 0x075D, 0x058E,
+ 0x0F2D, 0x05CD, 0x0571, 0x053E, 0x0692, 0x05BD, 0x054F, 0x055E,
+ 0x0411, 0x0F1D, 0x074D, 0x059E, 0x05AF, 0x070D, 0x053F, 0x058F,
+ 0x0413, 0x070F, 0x055D, 0x070E, 0x078F, 0x052E, 0x072F, 0x055F,
+ 0x078E, 0x0F2E, 0x052F, 0x051F, 0x0417, 0x071E, 0x0781, 0x0622,
+ 0x0683, 0x0702, 0x073E, 0x076F, 0x079E, 0x07BF, 0x07CE
+};
+
+static const packed_percentile_table block_pcd_8x5 {
+ 8, 5,
+ { 226, 167 },
+ { 763, 517 },
+ { 0, 178 },
+ { percentile_arr_8x5_0, percentile_arr_8x5_1 }
+};
+#endif
+
+#if ASTCENC_BLOCK_MAX_TEXELS >= (8 * 6)
+static const uint16_t percentile_arr_8x6_0[273] {
+ 0x0154, 0xF944, 0xE066, 0xA128, 0x9963, 0x8118, 0x806F, 0x79F2,
+ 0x79E2, 0x7108, 0xD934, 0x6056, 0x69C3, 0x60F3, 0x5972, 0x59E3,
+ 0x5075, 0x91B3, 0xC9D2, 0x807E, 0x385F, 0x4153, 0x3943, 0x4162,
+ 0x3837, 0x3847, 0x7173, 0x31D3, 0x6948, 0x3046, 0x307F, 0x5827,
+ 0x3114, 0x32C1, 0x3076, 0x2A4D, 0x58E3, 0x306E, 0x2924, 0x2A61,
+ 0x29F1, 0x50D3, 0x704F, 0x210C, 0x2BA1, 0x2225, 0x2873, 0x4865,
+ 0x2206, 0x8341, 0x2006, 0x3B21, 0x18F2, 0x21C2, 0x1A1F, 0x23C1,
+ 0x3AE1, 0x1855, 0x19D1, 0x1A15, 0x3815, 0x1207, 0x1835, 0x2A2E,
+ 0x1A16, 0x1836, 0x2271, 0x2845, 0x1A2D, 0x11E1, 0x1816, 0x1171,
+ 0x2217, 0x1952, 0x12D1, 0x3904, 0x125D, 0x4BB1, 0x207D, 0x10E2,
+ 0x1026, 0x2025, 0x12F1, 0x28F1, 0x105D, 0x1235, 0x12A2, 0x1007,
+ 0x123D, 0x1A05, 0x1072, 0x1331, 0x101E, 0x0951, 0x10D2, 0x1057,
+ 0x1B92, 0x185E, 0x1251, 0x19A2, 0x186D, 0x0B81, 0x2BEE, 0x080E,
+ 0x1A33, 0x1942, 0x0B13, 0x0B51, 0x11A3, 0x0923, 0x2322, 0x09B1,
+ 0x184E, 0x1161, 0x18D1, 0x0933, 0x0B93, 0x4A62, 0x1017, 0x082F,
+ 0x0A42, 0x0B82, 0x0AA3, 0x0A41, 0x08C2, 0x08B3, 0x0A3E, 0x22B3,
+ 0x0871, 0x1BBF, 0x09C1, 0x0AC2, 0x09B2, 0x0BEF, 0x082E, 0x1062,
+ 0x0922, 0x08C3, 0x1063, 0x0A53, 0x0BDF, 0x080F, 0x0B42, 0x0A83,
+ 0x084D, 0x103F, 0x0931, 0x08E1, 0x0A0F, 0x1BA2, 0x09FF, 0x1332,
+ 0x03FF, 0x0941, 0x12C3, 0x0A63, 0x003D, 0x0842, 0x083E, 0x0B83,
+ 0x0BB2, 0x0A31, 0x0932, 0x1102, 0x0992, 0x0982, 0x1051, 0x08B1,
+ 0x0A2F, 0x121E, 0x02B1, 0x0A4E, 0x11EE, 0x00A2, 0x1022, 0x0043,
+ 0x0A52, 0x0A1D, 0x0226, 0x1193, 0x03DD, 0x08B2, 0x0BFD, 0x0A43,
+ 0x0A13, 0x0AB2, 0x01FD, 0x09FE, 0x020D, 0x081F, 0x0B33, 0x0053,
+ 0x0B91, 0x0293, 0x0B11, 0x0B7F, 0x0AA1, 0x0B03, 0x0A0E, 0x03FE,
+ 0x01CE, 0x0B6F, 0x0183, 0x0912, 0x023F, 0x0852, 0x0A21, 0x0323,
+ 0x03ED, 0x0A32, 0x13AF, 0x0272, 0x08A3, 0x0B12, 0x0083, 0x0832,
+ 0x13CD, 0x0223, 0x0A92, 0x0092, 0x0AD2, 0x0301, 0x0302, 0x0BDE,
+ 0x0A22, 0x01EF, 0x0B5F, 0x0103, 0x0BCF, 0x096F, 0x017E, 0x0113,
+ 0x01DE, 0x0823, 0x0282, 0x0B6E, 0x015F, 0x0813, 0x01AF, 0x01CF,
+ 0x0B7E, 0x0033, 0x01DF, 0x0BCE, 0x01BF, 0x036D, 0x0A03, 0x017F,
+ 0x03BE, 0x0201, 0x0893, 0x038E, 0x034D, 0x03AE, 0x0202, 0x039F,
+ 0x0291, 0x0A11, 0x032E, 0x033F, 0x034F, 0x0281, 0x037D, 0x03BD,
+ 0x0212, 0x033E, 0x035E, 0x034E, 0x035D, 0x03AD, 0x032F, 0x038F,
+ 0x039E
+};
+
+static const uint16_t percentile_arr_8x6_1[186] {
+ 0x0621, 0xFC33, 0x37AE, 0x1CC2, 0x2C43, 0xAD32, 0x34A3, 0x4551,
+ 0x6452, 0x5C62, 0x1FCD, 0x14F1, 0x4CB3, 0x24D2, 0x15DF, 0x0FBE,
+ 0x2603, 0x3DA2, 0x2E31, 0x25D1, 0x25EF, 0x0D22, 0x2E91, 0x1E82,
+ 0x0FBD, 0x1513, 0x0CB2, 0x0CD1, 0x0F4F, 0x1F7D, 0x1701, 0x0C16,
+ 0x2593, 0x2C42, 0x0C72, 0x14A2, 0x0F6E, 0x0C35, 0x0C71, 0x0D83,
+ 0x0C07, 0x1DFF, 0x043E, 0x1613, 0x07DD, 0x0FAD, 0x1451, 0x076D,
+ 0x0E81, 0x05FE, 0x0406, 0x0E0D, 0x045D, 0x2612, 0x0E02, 0x07AF,
+ 0x0DB1, 0x0F5E, 0x15C1, 0x0C23, 0x1523, 0x0C1F, 0x0D92, 0x04B1,
+ 0x0D31, 0x0432, 0x0D61, 0x0F4E, 0x0D41, 0x0DEE, 0x0D42, 0x04C1,
+ 0x0CE1, 0x079F, 0x0C2E, 0x0405, 0x0C22, 0x0461, 0x0E1D, 0x0582,
+ 0x073F, 0x0571, 0x0C4D, 0x0DFD, 0x05CE, 0x0C6D, 0x05DE, 0x0415,
+ 0x0C45, 0x075F, 0x0C41, 0x0D03, 0x05A1, 0x0711, 0x05CF, 0x0425,
+ 0x0C93, 0x0D21, 0x0591, 0x043D, 0x0D12, 0x0501, 0x040F, 0x0511,
+ 0x0431, 0x0C03, 0x04A1, 0x078D, 0x0581, 0x041E, 0x040D, 0x0C02,
+ 0x040E, 0x05DD, 0x057F, 0x079D, 0x042D, 0x0D9F, 0x0502, 0x056E,
+ 0x0412, 0x071F, 0x044E, 0x05BF, 0x0C1D, 0x0482, 0x05AE, 0x042F,
+ 0x057D, 0x0491, 0x054E, 0x047D, 0x0DBE, 0x0611, 0x0492, 0x0601,
+ 0x05BD, 0x05CD, 0x0426, 0x05ED, 0x072D, 0x073D, 0x0483, 0x0F5D,
+ 0x0421, 0x056F, 0x053F, 0x058E, 0x054F, 0x078F, 0x053E, 0x059E,
+ 0x057E, 0x051F, 0x055D, 0x0413, 0x070D, 0x05AF, 0x0411, 0x0453,
+ 0x0D5E, 0x077E, 0x052F, 0x070F, 0x074D, 0x0692, 0x070E, 0x072F,
+ 0x072E, 0x058F, 0x071D, 0x052E, 0x0417, 0x073E, 0x0781, 0x078E,
+ 0x055F, 0x060E, 0x0622, 0x0683, 0x0702, 0x071E, 0x076F, 0x079E,
+ 0x07BF, 0x07CE
+};
+
+static const packed_percentile_table block_pcd_8x6 {
+ 8, 6,
+ { 273, 186 },
+ { 880, 300 },
+ { 0, 64 },
+ { percentile_arr_8x6_0, percentile_arr_8x6_1 }
+};
+#endif
+
+#if ASTCENC_BLOCK_MAX_TEXELS >= (8 * 8)
+static const uint16_t percentile_arr_8x8_0[347] {
+ 0x0334, 0xFD44, 0xDD14, 0x9154, 0x9B08, 0x906A, 0x8928, 0x8108,
+ 0xE866, 0xC918, 0x606F, 0xC0FE, 0x5963, 0x58EE, 0x6534, 0x505A,
+ 0x51E2, 0xA8CF, 0x5354, 0x5314, 0x5134, 0x5524, 0x48F3, 0x504B,
+ 0x487E, 0x5344, 0x49C3, 0x4972, 0x49F2, 0x4856, 0xD0EF, 0x81D2,
+ 0x78DE, 0x4261, 0x3AC1, 0x71E3, 0x6879, 0x390C, 0x3143, 0x31B3,
+ 0x385F, 0x3153, 0x306E, 0x3037, 0x30DF, 0x3162, 0x304F, 0x3075,
+ 0xB03B, 0x2847, 0x28E3, 0x2914, 0x507F, 0x28BF, 0x5173, 0x5073,
+ 0x20D3, 0x2A06, 0x2827, 0x2508, 0x2229, 0x29D3, 0x204A, 0x207A,
+ 0x2046, 0x4148, 0x20FD, 0x4225, 0x23A1, 0x3944, 0x2065, 0x1924,
+ 0x2324, 0x1806, 0x19F1, 0x2215, 0x1876, 0x22AD, 0x502B, 0x1B04,
+ 0x18F2, 0x3A4D, 0x3216, 0x3504, 0x18DD, 0x1B21, 0x10CE, 0x1869,
+ 0x1B41, 0x1855, 0x1207, 0x1AE1, 0x2845, 0x19D1, 0x2A0A, 0x1A2D,
+ 0x2A1A, 0x11C2, 0x1A0B, 0x1217, 0x2816, 0x121B, 0x1271, 0x2AD1,
+ 0x1035, 0x1015, 0x287D, 0x12F1, 0x43C1, 0x1171, 0x1A05, 0x08E2,
+ 0x11E1, 0x3251, 0x2049, 0x20F1, 0x12CD, 0x0A39, 0x1219, 0x1059,
+ 0x1104, 0x1036, 0x1872, 0x3007, 0x08ED, 0x205E, 0x1026, 0x0952,
+ 0x1392, 0x1019, 0x0951, 0x100A, 0x13EE, 0x08D2, 0x1242, 0x0ABD,
+ 0x22A2, 0x0BDF, 0x2B81, 0x0A35, 0x13B1, 0x0839, 0x13BF, 0x0A33,
+ 0x1B31, 0x205D, 0x1241, 0x183A, 0x2025, 0x0B93, 0x0A3D, 0x1017,
+ 0x1313, 0x1253, 0x082A, 0x204E, 0x09A2, 0x080B, 0x0A1F, 0x125D,
+ 0x0A2E, 0x081A, 0x08D1, 0x082F, 0x086D, 0x1B82, 0x0A09, 0x0B22,
+ 0x1062, 0x11A3, 0x2161, 0x0923, 0x129F, 0x1A62, 0x0871, 0x0942,
+ 0x081B, 0x1133, 0x18AE, 0x0A9E, 0x0863, 0x09FF, 0x18C2, 0x0B51,
+ 0x08BD, 0x0AA3, 0x09B1, 0x1AC2, 0x08B3, 0x0829, 0x0BEF, 0x0B83,
+ 0x0AAE, 0x0A8D, 0x1857, 0x185B, 0x08AF, 0x103F, 0x08C3, 0x09B2,
+ 0x0A4E, 0x11C1, 0x0A31, 0x0B42, 0x0A83, 0x0BFF, 0x13DD, 0x00CD,
+ 0x0AB3, 0x0842, 0x08BE, 0x0922, 0x1A8E, 0x08E1, 0x002E, 0x0BA2,
+ 0x0A8F, 0x2263, 0x0252, 0x0B32, 0x0AC3, 0x0941, 0x0A43, 0x083D,
+ 0x083E, 0x0A3E, 0x084D, 0x1131, 0x136F, 0x0AB1, 0x0193, 0x0BFD,
+ 0x0391, 0x0851, 0x13AF, 0x0843, 0x0213, 0x1226, 0x0932, 0x03B2,
+ 0x0902, 0x0BCD, 0x0221, 0x089E, 0x00B1, 0x0BDE, 0x03FE, 0x02A1,
+ 0x0982, 0x009F, 0x080E, 0x0B5F, 0x02BE, 0x0A32, 0x0A2A, 0x01EE,
+ 0x0053, 0x0AB2, 0x0192, 0x09FD, 0x0052, 0x0B03, 0x0293, 0x00A2,
+ 0x0B7F, 0x0BED, 0x0311, 0x08B2, 0x0A72, 0x088E, 0x0333, 0x0B12,
+ 0x0A23, 0x0822, 0x0083, 0x11CE, 0x021D, 0x08A3, 0x088F, 0x029D,
+ 0x0A22, 0x0A3F, 0x01FE, 0x020F, 0x0983, 0x02D2, 0x0292, 0x0B23,
+ 0x001E, 0x0BCF, 0x03CE, 0x09AF, 0x0B02, 0x0301, 0x022F, 0x137E,
+ 0x021E, 0x09EF, 0x016F, 0x0112, 0x097E, 0x080F, 0x020D, 0x0092,
+ 0x01DE, 0x09DF, 0x0032, 0x0033, 0x0A82, 0x03BE, 0x0B6E, 0x001F,
+ 0x020E, 0x0023, 0x09CF, 0x0113, 0x0103, 0x0013, 0x0BAE, 0x0203,
+ 0x0BAD, 0x01BF, 0x034F, 0x095F, 0x036D, 0x0202, 0x017F, 0x0093,
+ 0x0201, 0x034D, 0x0212, 0x035D, 0x03BD, 0x0B3F, 0x035E, 0x0211,
+ 0x0281, 0x0291, 0x032E, 0x037D, 0x034E, 0x038E, 0x039F, 0x032F,
+ 0x033E, 0x038F, 0x039E
+};
+
+static const uint16_t percentile_arr_8x8_1[208] {
+ 0x0621, 0x3443, 0x47CD, 0x97AE, 0xFC62, 0x14F1, 0x24C2, 0x25DF,
+ 0x3C33, 0x1C52, 0x9C72, 0x0FBE, 0x0C5D, 0x343E, 0x24A3, 0x1551,
+ 0x5D32, 0x1CD2, 0x15EF, 0x4E31, 0x04DD, 0x1FDD, 0x174F, 0x0DD1,
+ 0x3E0D, 0x15FF, 0x0DA2, 0x1E03, 0x17BD, 0x177D, 0x14B3, 0x0471,
+ 0x0CAE, 0x1C1F, 0x04D1, 0x0F6E, 0x0DFE, 0x1C42, 0x0C16, 0x0D22,
+ 0x0C9F, 0x2C2E, 0x0FAD, 0x0571, 0x147D, 0x0C07, 0x04B2, 0x0F6D,
+ 0x0F5E, 0x07AF, 0x146D, 0x0C51, 0x0593, 0x2583, 0x0C4E, 0x040B,
+ 0x0C35, 0x0513, 0x0E91, 0x0406, 0x073F, 0x144D, 0x0561, 0x048F,
+ 0x0F01, 0x0F4E, 0x0CA2, 0x075F, 0x1682, 0x04E1, 0x0C1A, 0x04BD,
+ 0x0542, 0x0D41, 0x0DEE, 0x04CD, 0x0DCF, 0x04B1, 0x0C15, 0x0C3D,
+ 0x0423, 0x0592, 0x0DDE, 0x0422, 0x0432, 0x05FD, 0x0DC1, 0x05B1,
+ 0x0DCE, 0x0612, 0x0C2F, 0x0445, 0x0602, 0x0531, 0x0439, 0x0E81,
+ 0x0582, 0x0C61, 0x061D, 0x049E, 0x0405, 0x0409, 0x0DBE, 0x079F,
+ 0x0D21, 0x04C1, 0x0C0A, 0x0E13, 0x04AD, 0x040E, 0x0581, 0x0419,
+ 0x05DD, 0x0D03, 0x049D, 0x0449, 0x0429, 0x048E, 0x0DA1, 0x0425,
+ 0x0512, 0x0501, 0x0431, 0x0523, 0x0441, 0x042D, 0x040F, 0x0D7D,
+ 0x0511, 0x0502, 0x05BF, 0x04A1, 0x0C03, 0x0402, 0x079D, 0x05AE,
+ 0x075D, 0x057F, 0x041D, 0x048D, 0x042A, 0x0453, 0x05AF, 0x078D,
+ 0x0C0D, 0x073D, 0x0491, 0x0591, 0x05BD, 0x072D, 0x057E, 0x051F,
+ 0x0482, 0x0492, 0x041E, 0x0412, 0x0D9F, 0x0421, 0x0493, 0x0711,
+ 0x056E, 0x059E, 0x054E, 0x0611, 0x05ED, 0x074D, 0x070F, 0x056F,
+ 0x052F, 0x053F, 0x071F, 0x054F, 0x05CD, 0x0483, 0x055E, 0x072F,
+ 0x0E01, 0x0426, 0x058F, 0x0413, 0x078F, 0x071D, 0x055F, 0x058E,
+ 0x0411, 0x053E, 0x071E, 0x055D, 0x077E, 0x052E, 0x0692, 0x0417,
+ 0x070D, 0x078E, 0x070E, 0x072E, 0x041B, 0x060E, 0x0622, 0x0683,
+ 0x068D, 0x0702, 0x073E, 0x076F, 0x0781, 0x079E, 0x07BF, 0x07CE
+};
+
+static const packed_percentile_table block_pcd_8x8 {
+ 8, 8,
+ { 347, 208 },
+ { 1144, 267 },
+ { 0, 38 },
+ { percentile_arr_8x8_0, percentile_arr_8x8_1 }
+};
+#endif
+
+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 5)
+static const uint16_t percentile_arr_10x5_0[274] {
+ 0x0165, 0xF975, 0xD866, 0xC056, 0xA946, 0x90C6, 0x90F5, 0x8963,
+ 0x80D6, 0x80E6, 0x60F3, 0x61C3, 0x59F2, 0xA927, 0x5075, 0x4847,
+ 0x5153, 0x4955, 0x49E2, 0x48B6, 0x41D2, 0x4943, 0x8305, 0x8172,
+ 0x4046, 0x4037, 0x40A7, 0x70B7, 0x7AC1, 0x31E3, 0x7027, 0x30E5,
+ 0x69D3, 0x99B3, 0x3315, 0x6115, 0x3136, 0x3076, 0x3173, 0x30D5,
+ 0x3106, 0x8962, 0x2916, 0x30C7, 0x5126, 0x30D3, 0x2956, 0x5117,
+ 0x2B41, 0x2AE1, 0x2A61, 0x29F1, 0x2306, 0x2145, 0x4A85, 0x2057,
+ 0x40E3, 0x4137, 0x3B21, 0x23C1, 0x2065, 0x1925, 0x51C2, 0x5225,
+ 0x4935, 0x1AD1, 0x23A1, 0x19D1, 0x1A71, 0x4055, 0x1873, 0x1A86,
+ 0x1295, 0x18F2, 0x28A6, 0x1952, 0x4AA5, 0x20B5, 0x10C5, 0x2AA2,
+ 0x11E1, 0x1107, 0x10D2, 0x2171, 0x1351, 0x3036, 0x1331, 0x1BEE,
+ 0x2035, 0x1045, 0x1313, 0x0A15, 0x1087, 0x1296, 0x13EF, 0x18E2,
+ 0x1151, 0x1086, 0x10F1, 0x08A5, 0x12C2, 0x1BFF, 0x1095, 0x1A62,
+ 0x1322, 0x0942, 0x1026, 0x1872, 0x1062, 0x0897, 0x1123, 0x08D1,
+ 0x1A06, 0x0806, 0x137F, 0x13B1, 0x13DF, 0x1A51, 0x09B1, 0x0A83,
+ 0x1015, 0x22F1, 0x0961, 0x0B81, 0x12B3, 0x0A35, 0x0AA3, 0x20B3,
+ 0x08C3, 0x2342, 0x0933, 0x0A33, 0x09A2, 0x10C2, 0x0896, 0x2205,
+ 0x0825, 0x20E1, 0x0922, 0x1242, 0x0B16, 0x0B32, 0x09A3, 0x0AC3,
+ 0x0BBF, 0x0B93, 0x0071, 0x0931, 0x0A41, 0x2392, 0x13FE, 0x09C1,
+ 0x0B07, 0x0016, 0x1182, 0x09B2, 0x0A26, 0x0132, 0x0941, 0x0A93,
+ 0x0992, 0x1063, 0x1217, 0x01FF, 0x11EE, 0x1216, 0x0B23, 0x0B82,
+ 0x0042, 0x1102, 0x0213, 0x0B6F, 0x09FE, 0x1207, 0x0807, 0x18B1,
+ 0x0253, 0x0AB1, 0x08A2, 0x13FD, 0x01FD, 0x1983, 0x0AB2, 0x0A31,
+ 0x016F, 0x0B11, 0x00B2, 0x0851, 0x0AD2, 0x0993, 0x0BDD, 0x12A1,
+ 0x017F, 0x0A97, 0x1022, 0x0383, 0x0843, 0x0A52, 0x03A2, 0x097E,
+ 0x0817, 0x03B2, 0x0A43, 0x09EF, 0x0A63, 0x0B33, 0x0B03, 0x0292,
+ 0x0272, 0x09CE, 0x0287, 0x136D, 0x0053, 0x0B12, 0x0083, 0x0892,
+ 0x0112, 0x1282, 0x03ED, 0x0852, 0x0301, 0x1391, 0x0232, 0x0B7E,
+ 0x0221, 0x08A3, 0x0BCD, 0x0BCF, 0x036E, 0x09DE, 0x0103, 0x03DE,
+ 0x0832, 0x0BAF, 0x0302, 0x13CE, 0x035F, 0x0093, 0x0A23, 0x01DF,
+ 0x0013, 0x0A22, 0x0023, 0x0113, 0x09AF, 0x01BF, 0x0033, 0x095F,
+ 0x0203, 0x0281, 0x09CF, 0x037D, 0x0201, 0x0B4D, 0x03AE, 0x03BE,
+ 0x0291, 0x035E, 0x038E, 0x0B9F, 0x03AD, 0x0202, 0x034F, 0x0211,
+ 0x035D, 0x0212, 0x032E, 0x039E, 0x033F, 0x034E, 0x03BD, 0x032F,
+ 0x033E, 0x038F
+};
+
+static const uint16_t percentile_arr_10x5_1[180] {
+ 0x0532, 0xFCA3, 0x3621, 0x6E82, 0x2CC2, 0x3D51, 0x3F01, 0x2691,
+ 0x17AE, 0x35A2, 0x74B3, 0x1603, 0x4433, 0x3C43, 0x6C35, 0x25D1,
+ 0x1D13, 0x15DF, 0x37CD, 0x0D93, 0x1D22, 0x0E81, 0x1452, 0x0CD2,
+ 0x37BE, 0x0CB2, 0x3407, 0x1523, 0x0C16, 0x0CB5, 0x0C96, 0x1486,
+ 0x2631, 0x1506, 0x0F4F, 0x1583, 0x0CD1, 0x2CA2, 0x2612, 0x1613,
+ 0x1602, 0x1F11, 0x179F, 0x17BD, 0x15B1, 0x0406, 0x1D41, 0x0CF1,
+ 0x0D31, 0x0442, 0x1C62, 0x0F6E, 0x077D, 0x0C51, 0x0445, 0x0D15,
+ 0x2592, 0x0CB1, 0x05EF, 0x0542, 0x17AF, 0x1425, 0x075E, 0x0FAD,
+ 0x0CC1, 0x0503, 0x0512, 0x15C1, 0x0C95, 0x0415, 0x0505, 0x0F4E,
+ 0x04A5, 0x0493, 0x0C32, 0x0F5F, 0x04E1, 0x0521, 0x0C85, 0x07DD,
+ 0x0582, 0x15FF, 0x05CF, 0x0405, 0x0D91, 0x05A1, 0x05FE, 0x0C23,
+ 0x0561, 0x0472, 0x0471, 0x0C22, 0x0DEE, 0x076D, 0x0502, 0x0426,
+ 0x0C61, 0x0D7D, 0x0525, 0x05DE, 0x0DCE, 0x079D, 0x0692, 0x0441,
+ 0x0C91, 0x05DD, 0x0511, 0x057F, 0x0611, 0x0DFD, 0x078D, 0x056E,
+ 0x0492, 0x04A1, 0x073F, 0x0C31, 0x05BE, 0x0483, 0x0571, 0x056F,
+ 0x0D9F, 0x0581, 0x0501, 0x057E, 0x05BF, 0x078F, 0x0516, 0x05ED,
+ 0x0402, 0x0F7E, 0x0482, 0x054E, 0x075D, 0x071F, 0x05CD, 0x0535,
+ 0x05AE, 0x0C11, 0x058F, 0x05AF, 0x0421, 0x0413, 0x0601, 0x054F,
+ 0x073D, 0x059E, 0x0487, 0x070F, 0x078E, 0x0781, 0x053E, 0x0403,
+ 0x072D, 0x055D, 0x05BD, 0x079E, 0x0D8E, 0x0412, 0x052E, 0x074D,
+ 0x053F, 0x051F, 0x070E, 0x055F, 0x072F, 0x052F, 0x070D, 0x055E,
+ 0x0417, 0x0453, 0x072E, 0x0622, 0x0683, 0x0702, 0x071D, 0x071E,
+ 0x073E, 0x076F, 0x07BF, 0x07CE
+};
+
+static const packed_percentile_table block_pcd_10x5 {
+ 10, 5,
+ { 274, 180 },
+ { 954, 324 },
+ { 0, 79 },
+ { percentile_arr_10x5_0, percentile_arr_10x5_1 }
+};
+#endif
+
+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 6)
+static const uint16_t percentile_arr_10x6_0[325] {
+ 0x01A4, 0xF954, 0xA066, 0x9975, 0x80F5, 0x7056, 0x6918, 0x6963,
+ 0x58C6, 0x5946, 0x5928, 0x5174, 0x586F, 0xA0E6, 0x5108, 0x48D6,
+ 0x49E2, 0x40F3, 0x9172, 0x41F2, 0xB875, 0x3927, 0x39C3, 0xA953,
+ 0x3934, 0x3305, 0x30B6, 0x6943, 0x31D2, 0x3876, 0x3037, 0x2955,
+ 0x30A7, 0x32C1, 0x29B3, 0x3027, 0x287E, 0x30B7, 0x29E3, 0x5846,
+ 0x2B15, 0x2847, 0x3162, 0x5173, 0x4936, 0x285F, 0x48D3, 0x2164,
+ 0x4906, 0x20E5, 0x2915, 0x2116, 0x407F, 0x20D5, 0x2A61, 0x4117,
+ 0x20E3, 0x2126, 0x4148, 0x206E, 0x39D3, 0x2145, 0x41B4, 0x1B06,
+ 0x2114, 0x2165, 0x5321, 0x5A85, 0x1A4D, 0x1A1F, 0x19F1, 0x3341,
+ 0x184F, 0x1956, 0x3125, 0x30C7, 0x28F2, 0x1937, 0x1AE1, 0x1073,
+ 0x1BA1, 0x1935, 0x110C, 0x1BC1, 0x3A25, 0x19C2, 0x1295, 0x122E,
+ 0x1944, 0x11D1, 0x1124, 0x1857, 0x22D1, 0x2286, 0x1A2D, 0x12A2,
+ 0x2107, 0x1055, 0x2065, 0x0A71, 0x2152, 0x10C5, 0x10D2, 0x1331,
+ 0x08B5, 0x1171, 0x2836, 0x10A6, 0x0904, 0x123D, 0x20F1, 0x12A5,
+ 0x10E2, 0x107D, 0x1AF1, 0x1313, 0x0951, 0x11E1, 0x1B22, 0x1B51,
+ 0x0835, 0x101E, 0x0A5D, 0x0A15, 0x3045, 0x0A96, 0x08A5, 0x1142,
+ 0x12A3, 0x1872, 0x085D, 0x09B1, 0x100E, 0x0887, 0x0886, 0x086D,
+ 0x0933, 0x12B3, 0x0897, 0x08B3, 0x0A33, 0x0923, 0x1095, 0x0BEE,
+ 0x2BB1, 0x085E, 0x1283, 0x0A51, 0x1026, 0x0A06, 0x12C2, 0x08D1,
+ 0x11A2, 0x13BF, 0x08C3, 0x10C2, 0x0A3E, 0x0BDF, 0x0B81, 0x13EF,
+ 0x0A35, 0x0B16, 0x082F, 0x2161, 0x1B32, 0x0806, 0x084E, 0x11A3,
+ 0x1015, 0x1122, 0x2931, 0x0342, 0x0825, 0x0A0F, 0x0896, 0x0A05,
+ 0x0241, 0x09C1, 0x083F, 0x0A42, 0x0071, 0x0B07, 0x082E, 0x0393,
+ 0x12B1, 0x0A62, 0x0226, 0x0A2F, 0x0B92, 0x0063, 0x0932, 0x0862,
+ 0x09FF, 0x0A31, 0x00E1, 0x12B2, 0x09B2, 0x0AC3, 0x0941, 0x0293,
+ 0x1323, 0x104D, 0x003E, 0x083D, 0x0992, 0x1382, 0x03FF, 0x0A13,
+ 0x1016, 0x0A53, 0x0182, 0x1007, 0x0AA1, 0x080F, 0x0A16, 0x0A1E,
+ 0x0042, 0x0902, 0x13DD, 0x0BB2, 0x0A63, 0x00A2, 0x08B1, 0x03FE,
+ 0x1207, 0x08B2, 0x0B83, 0x09EE, 0x0311, 0x0A87, 0x0BAF, 0x03A2,
+ 0x09FD, 0x0051, 0x0B33, 0x020D, 0x09CE, 0x0217, 0x021D, 0x0817,
+ 0x020E, 0x0A4E, 0x001F, 0x0BFD, 0x0297, 0x0983, 0x0A92, 0x0252,
+ 0x0243, 0x0B03, 0x0193, 0x036F, 0x0B12, 0x0043, 0x0822, 0x0A21,
+ 0x01FE, 0x0853, 0x037F, 0x023F, 0x0BED, 0x02D2, 0x0B91, 0x0232,
+ 0x0282, 0x0912, 0x08A3, 0x0852, 0x0223, 0x0BCD, 0x0083, 0x0301,
+ 0x0832, 0x01EF, 0x0892, 0x0302, 0x0A72, 0x03DE, 0x0893, 0x0BCF,
+ 0x09DE, 0x03CE, 0x035F, 0x0833, 0x0023, 0x0103, 0x017E, 0x0813,
+ 0x01CF, 0x01BF, 0x016F, 0x0A22, 0x037E, 0x0113, 0x01AF, 0x0B6E,
+ 0x03BE, 0x0201, 0x0A03, 0x01DF, 0x036D, 0x03AE, 0x015F, 0x0281,
+ 0x033E, 0x0A02, 0x038E, 0x017F, 0x0291, 0x034D, 0x03BD, 0x0B7D,
+ 0x03AD, 0x0211, 0x0212, 0x034F, 0x032E, 0x039F, 0x034E, 0x035D,
+ 0x035E, 0x033F, 0x039E, 0x032F, 0x038F
+};
+
+static const uint16_t percentile_arr_10x6_1[199] {
+ 0x0621, 0xBD32, 0x5CA3, 0x1FAE, 0x64C2, 0x1D51, 0x6C33, 0xFC43,
+ 0x5CB3, 0x25A2, 0x2E82, 0x35D1, 0x4F01, 0x3FBE, 0x3691, 0x2DDF,
+ 0x2E03, 0x3FCD, 0x14D2, 0x1CF1, 0x0C52, 0x3C35, 0x2D22, 0x1513,
+ 0x1462, 0x54B2, 0x0E31, 0x4E81, 0x1593, 0x1D23, 0x1CD1, 0x14B5,
+ 0x2FBD, 0x0C07, 0x1D06, 0x0DEF, 0x14A2, 0x1612, 0x1F4F, 0x0C16,
+ 0x1F7D, 0x0C96, 0x0486, 0x1F9F, 0x0D42, 0x4583, 0x0E02, 0x0472,
+ 0x0DB1, 0x1613, 0x0FAD, 0x0D41, 0x0F11, 0x0E0D, 0x1C42, 0x143E,
+ 0x076E, 0x04B1, 0x0FAF, 0x0D61, 0x0531, 0x0C71, 0x0DFF, 0x0DFE,
+ 0x0406, 0x0C45, 0x0451, 0x0D15, 0x05C1, 0x2CC1, 0x141F, 0x0CE1,
+ 0x0FDD, 0x0C22, 0x0582, 0x0D92, 0x0571, 0x0F6D, 0x0C93, 0x045D,
+ 0x0F5E, 0x044D, 0x0423, 0x0D05, 0x0425, 0x0C95, 0x04A5, 0x0DCE,
+ 0x075F, 0x0E1D, 0x0503, 0x042E, 0x0D91, 0x0512, 0x0DDE, 0x05A1,
+ 0x074E, 0x0C32, 0x0431, 0x0415, 0x0D21, 0x05EE, 0x040E, 0x0DDD,
+ 0x0485, 0x1525, 0x0491, 0x0C26, 0x046D, 0x0C05, 0x05CF, 0x05FD,
+ 0x0E92, 0x073F, 0x0C0D, 0x043D, 0x0502, 0x0C1E, 0x041D, 0x0461,
+ 0x04A1, 0x0511, 0x0581, 0x05BD, 0x0C41, 0x059F, 0x05BF, 0x040F,
+ 0x0C7D, 0x0402, 0x054E, 0x057D, 0x0403, 0x078D, 0x05AE, 0x042D,
+ 0x0483, 0x079D, 0x0D7F, 0x0482, 0x0611, 0x056E, 0x0516, 0x05BE,
+ 0x0535, 0x044E, 0x05AF, 0x0DED, 0x042F, 0x0492, 0x058E, 0x078F,
+ 0x0412, 0x057E, 0x053E, 0x0F1F, 0x073D, 0x0601, 0x0501, 0x075D,
+ 0x059E, 0x05CD, 0x053F, 0x054F, 0x055E, 0x055D, 0x0421, 0x074D,
+ 0x051F, 0x072F, 0x0781, 0x0411, 0x0D6F, 0x077E, 0x0487, 0x070E,
+ 0x070F, 0x072D, 0x058F, 0x078E, 0x079E, 0x052E, 0x0413, 0x072E,
+ 0x071D, 0x052F, 0x055F, 0x073E, 0x0417, 0x0453, 0x060E, 0x0622,
+ 0x0683, 0x0702, 0x070D, 0x071E, 0x076F, 0x07BF, 0x07CE
+};
+
+static const packed_percentile_table block_pcd_10x6 {
+ 10, 6,
+ { 325, 199 },
+ { 922, 381 },
+ { 0, 78 },
+ { percentile_arr_10x6_0, percentile_arr_10x6_1 }
+};
+#endif
+
+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 8)
+static const uint16_t percentile_arr_10x8_0[400] {
+ 0x0154, 0xAB34, 0xAD44, 0x8308, 0x7866, 0x7B64, 0x79A4, 0x7975,
+ 0x686A, 0x6908, 0xC514, 0x6174, 0x6128, 0x6118, 0x5B54, 0x5163,
+ 0xF856, 0x50F5, 0x986F, 0xDD34, 0x48FE, 0x4972, 0x48E6, 0x4146,
+ 0x48EE, 0x40F3, 0x4AC1, 0x38C6, 0x41E2, 0xBB05, 0x707E, 0x38D6,
+ 0x3927, 0x6B14, 0x384B, 0x3948, 0x3153, 0x385A, 0x3134, 0x6B15,
+ 0x39F2, 0x30CF, 0x3143, 0x91D2, 0x31C3, 0x60EF, 0x5973, 0x3076,
+ 0x28D3, 0x3261, 0x2875, 0x28DE, 0x290C, 0x51E3, 0x28A7, 0x20E3,
+ 0x2962, 0x2B06, 0x2917, 0x483B, 0x20B6, 0x2D24, 0x206E, 0x285F,
+ 0x20B7, 0x2936, 0x4047, 0x2037, 0x20DF, 0x28BF, 0x21B4, 0x21B3,
+ 0x1D08, 0x2027, 0x404F, 0x3846, 0x2116, 0x187F, 0x1879, 0x2285,
+ 0x1A29, 0x3915, 0x4873, 0x1955, 0x3114, 0x1B44, 0x2165, 0x107A,
+ 0x1956, 0x6137, 0x1106, 0x3145, 0x1B21, 0x19D3, 0x12AD, 0x1B41,
+ 0x1AD1, 0x1126, 0x18F2, 0x282B, 0x40E5, 0x20D5, 0x2A0A, 0x284A,
+ 0x1286, 0x1295, 0x121A, 0x2A0B, 0x321B, 0x122D, 0x10FD, 0x13A1,
+ 0x32A2, 0x12E1, 0x1164, 0x13C1, 0x124D, 0x1239, 0x4504, 0x10C7,
+ 0x22F1, 0x11F1, 0x0AC2, 0x2125, 0x1225, 0x0B04, 0x1107, 0x1069,
+ 0x1A19, 0x13BF, 0x2A96, 0x08D2, 0x1271, 0x0952, 0x2BDF, 0x0B31,
+ 0x1251, 0x2124, 0x0B13, 0x12BD, 0x1233, 0x13EE, 0x2144, 0x0B16,
+ 0x0A15, 0x18E2, 0x08DD, 0x1097, 0x0857, 0x0B24, 0x0AA5, 0x12A3,
+ 0x11C2, 0x11D1, 0x10CE, 0x0865, 0x123D, 0x08B3, 0x0B51, 0x1971,
+ 0x0A41, 0x0A06, 0x1039, 0x080A, 0x0B22, 0x0923, 0x0836, 0x08C3,
+ 0x0A1F, 0x1072, 0x080B, 0x0935, 0x0855, 0x18A6, 0x0A42, 0x1133,
+ 0x0A83, 0x0A09, 0x0ACD, 0x0A2E, 0x0887, 0x083A, 0x10C5, 0x085E,
+ 0x13B1, 0x087D, 0x0819, 0x0A9F, 0x0049, 0x08F1, 0x0BEF, 0x1161,
+ 0x0B42, 0x09E1, 0x0A05, 0x0904, 0x12AE, 0x029E, 0x0A31, 0x09FF,
+ 0x0951, 0x0859, 0x001A, 0x082F, 0x0B81, 0x08B5, 0x0A35, 0x082A,
+ 0x08ED, 0x1142, 0x1262, 0x0B32, 0x08A5, 0x12D2, 0x03DD, 0x0B07,
+ 0x18AE, 0x083F, 0x00AF, 0x0AB3, 0x086D, 0x0287, 0x0A93, 0x025D,
+ 0x0816, 0x13FF, 0x0A8D, 0x005D, 0x08D1, 0x0392, 0x0845, 0x0AC3,
+ 0x08C2, 0x01A3, 0x0AB1, 0x09A2, 0x005B, 0x0B93, 0x02B2, 0x1086,
+ 0x001B, 0x0863, 0x0216, 0x0AA1, 0x0896, 0x0A8F, 0x084E, 0x0A8E,
+ 0x0A53, 0x0026, 0x0A26, 0x0382, 0x0807, 0x0862, 0x0029, 0x0871,
+ 0x00BD, 0x0835, 0x024E, 0x0806, 0x0941, 0x0895, 0x03AF, 0x0A13,
+ 0x0932, 0x03ED, 0x0BFD, 0x0207, 0x0B83, 0x0993, 0x09B1, 0x03CD,
+ 0x0A3E, 0x03FE, 0x0A21, 0x0015, 0x0B11, 0x0A43, 0x00E1, 0x136F,
+ 0x00BE, 0x00A2, 0x0842, 0x0043, 0x0825, 0x082E, 0x0A2A, 0x03DE,
+ 0x0BA2, 0x0122, 0x0BCF, 0x004D, 0x0323, 0x09C1, 0x0292, 0x083E,
+ 0x0252, 0x0017, 0x0A72, 0x00CD, 0x0182, 0x0A63, 0x0131, 0x09B2,
+ 0x0303, 0x0902, 0x0053, 0x035F, 0x0A32, 0x003D, 0x0992, 0x0A2F,
+ 0x03B2, 0x0ABE, 0x009F, 0x0183, 0x0312, 0x08B1, 0x0B02, 0x0A17,
+ 0x0B7F, 0x0333, 0x0297, 0x0A23, 0x020F, 0x0282, 0x0851, 0x0822,
+ 0x03CE, 0x01EE, 0x000E, 0x08B2, 0x0083, 0x0A1D, 0x00A3, 0x0222,
+ 0x088F, 0x0112, 0x029D, 0x0092, 0x0A3F, 0x0391, 0x089E, 0x0301,
+ 0x01FD, 0x09BF, 0x01CE, 0x0852, 0x01FE, 0x0013, 0x0903, 0x088E,
+ 0x037E, 0x021E, 0x01EF, 0x095F, 0x016F, 0x09DE, 0x03BE, 0x020E,
+ 0x0113, 0x01DF, 0x080F, 0x020D, 0x0833, 0x03AE, 0x0032, 0x03BD,
+ 0x0823, 0x001E, 0x01AF, 0x0203, 0x034F, 0x0093, 0x0A81, 0x036E,
+ 0x0291, 0x038E, 0x0A01, 0x001F, 0x017F, 0x01CF, 0x017E, 0x0202,
+ 0x0BAD, 0x0211, 0x035D, 0x035E, 0x039F, 0x0212, 0x032E, 0x033F,
+ 0x034D, 0x034E, 0x036D, 0x032F, 0x033E, 0x037D, 0x038F, 0x039E
+};
+
+static const uint16_t percentile_arr_10x8_1[221] {
+ 0x0621, 0xDFAE, 0x2443, 0x54C2, 0x37CD, 0x1CF1, 0xFCA3, 0x14D2,
+ 0x2D32, 0x5551, 0x7DDF, 0x5C33, 0x15D1, 0x3462, 0x24B3, 0x7452,
+ 0x5FBE, 0x6472, 0x65A2, 0x1D06, 0x445D, 0x15EF, 0x0E31, 0x1D71,
+ 0x343E, 0x0D42, 0x0CDD, 0x1F01, 0x4691, 0x1435, 0x0E82, 0x0DFF,
+ 0x17DD, 0x0D22, 0x24B2, 0x1603, 0x04B5, 0x24AE, 0x060D, 0x2D13,
+ 0x0C7D, 0x0496, 0x17BD, 0x1F4F, 0x1F7D, 0x1486, 0x0593, 0x1C16,
+ 0x0C07, 0x15FE, 0x041F, 0x14D1, 0x0C9F, 0x0E81, 0x0D15, 0x27AF,
+ 0x0C2E, 0x0D23, 0x176E, 0x0FAD, 0x1C06, 0x1561, 0x0DB1, 0x040B,
+ 0x1C4E, 0x0D83, 0x1711, 0x0C42, 0x0C71, 0x1C1A, 0x0D25, 0x04A2,
+ 0x0C45, 0x076D, 0x0F9F, 0x075F, 0x0E12, 0x046D, 0x048F, 0x1D92,
+ 0x0602, 0x0C39, 0x174E, 0x0C51, 0x0CA1, 0x075E, 0x05C1, 0x14BD,
+ 0x0D31, 0x0423, 0x0F3F, 0x0495, 0x0C93, 0x049E, 0x0D05, 0x04E1,
+ 0x0DEE, 0x0415, 0x04B1, 0x0503, 0x0CCD, 0x042F, 0x0DCF, 0x044D,
+ 0x0541, 0x1582, 0x05DE, 0x0D01, 0x0487, 0x040A, 0x0516, 0x0CA5,
+ 0x05FD, 0x05BF, 0x057D, 0x0DA1, 0x0426, 0x040F, 0x071F, 0x0613,
+ 0x0432, 0x0D12, 0x043D, 0x0425, 0x0461, 0x061D, 0x0D21, 0x0591,
+ 0x079D, 0x048D, 0x0429, 0x0C49, 0x04C1, 0x042A, 0x040E, 0x0485,
+ 0x0511, 0x0405, 0x0502, 0x0441, 0x0C19, 0x0692, 0x0535, 0x058F,
+ 0x041D, 0x059F, 0x072D, 0x04AD, 0x049D, 0x05CE, 0x048E, 0x0C31,
+ 0x057F, 0x078D, 0x0409, 0x041E, 0x05AE, 0x0611, 0x058E, 0x05DD,
+ 0x05CD, 0x056E, 0x0483, 0x073D, 0x054E, 0x0D9E, 0x0402, 0x0491,
+ 0x040D, 0x056F, 0x042D, 0x0581, 0x0421, 0x057E, 0x0781, 0x053E,
+ 0x0482, 0x078F, 0x0413, 0x052E, 0x0601, 0x0422, 0x0492, 0x055E,
+ 0x05BE, 0x0F9E, 0x072F, 0x074D, 0x0412, 0x070F, 0x075D, 0x05BD,
+ 0x051F, 0x071D, 0x073E, 0x077E, 0x0403, 0x0411, 0x078E, 0x055D,
+ 0x05AF, 0x05ED, 0x052F, 0x053F, 0x070D, 0x070E, 0x072E, 0x054F,
+ 0x0417, 0x041B, 0x0453, 0x055F, 0x060E, 0x0622, 0x0683, 0x068D,
+ 0x0702, 0x071E, 0x076F, 0x07BF, 0x07CE
+};
+
+static const packed_percentile_table block_pcd_10x8 =
+{
+ 10, 8,
+ { 400, 221 },
+ { 1119, 376 },
+ { 0, 52 },
+ { percentile_arr_10x8_0, percentile_arr_10x8_1 }
+};
+#endif
+
+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 10)
+static const uint16_t percentile_arr_10x10_0[453] {
+ 0x0334, 0x9514, 0x8954, 0x806A, 0x6F14, 0x6724, 0x6108, 0x6364,
+ 0x5175, 0x5D44, 0x5866, 0x5118, 0x5308, 0xA179, 0x5128, 0xF534,
+ 0x49A4, 0x5354, 0x9174, 0x486F, 0x48EA, 0x40F3, 0x4963, 0x414A,
+ 0xF8F9, 0x3984, 0x4172, 0x387E, 0x405A, 0x38DA, 0x38F5, 0x9B05,
+ 0x30EE, 0x32C1, 0x3261, 0x3D08, 0x31E2, 0x3056, 0x292B, 0x3146,
+ 0x3127, 0x3315, 0x58CA, 0x58E6, 0x290C, 0x3314, 0x8134, 0x28E3,
+ 0x28FE, 0x2948, 0x28C6, 0x78DE, 0x28BB, 0x68D6, 0x286E, 0x2173,
+ 0x2962, 0x21D2, 0x205F, 0x49F2, 0x2917, 0x2306, 0x207F, 0x404F,
+ 0x2153, 0x2943, 0x20CF, 0x21C3, 0x2073, 0x20D3, 0x2136, 0x183B,
+ 0x430A, 0x40A7, 0x18B6, 0x2079, 0x2309, 0x2075, 0x184B, 0x20EF,
+ 0x187A, 0x7837, 0x1B19, 0x20AB, 0x18BA, 0x20B7, 0x1994, 0x19E3,
+ 0x21B4, 0x49B3, 0x38BF, 0x193B, 0x1876, 0x182B, 0x30F2, 0x193A,
+ 0x1827, 0x1965, 0x1914, 0x184A, 0x4047, 0x1916, 0x1285, 0x1937,
+ 0x122D, 0x1915, 0x1321, 0x1955, 0x1046, 0x191B, 0x2106, 0x2919,
+ 0x1344, 0x1524, 0x12E1, 0x3926, 0x10E5, 0x2295, 0x1159, 0x1145,
+ 0x10DF, 0x124D, 0x1271, 0x092A, 0x2169, 0x1704, 0x22A2, 0x1164,
+ 0x13EE, 0x12F1, 0x0AD1, 0x128A, 0x110A, 0x11D3, 0x1286, 0x115A,
+ 0x2BA1, 0x0BBF, 0x3956, 0x2A89, 0x12AD, 0x10E9, 0x0B41, 0x1A29,
+ 0x2225, 0x08FD, 0x1107, 0x08D5, 0x191A, 0x1125, 0x1A96, 0x0B04,
+ 0x18D9, 0x2B16, 0x11F1, 0x0A33, 0x0924, 0x131A, 0x1149, 0x1324,
+ 0x0BEF, 0x0A99, 0x08CB, 0x123D, 0x1331, 0x0BDF, 0x0872, 0x22A3,
+ 0x0AC2, 0x1144, 0x0D04, 0x08D2, 0x08CE, 0x0AA9, 0x0A9A, 0x0B13,
+ 0x1251, 0x0865, 0x1069, 0x0897, 0x1215, 0x18B3, 0x1A62, 0x08C7,
+ 0x185E, 0x10E2, 0x0AA5, 0x21FF, 0x090B, 0x0952, 0x09E1, 0x0A42,
+ 0x08F1, 0x0A06, 0x0B22, 0x087D, 0x1139, 0x021F, 0x122E, 0x082F,
+ 0x09C2, 0x0887, 0x0A0A, 0x03C1, 0x0929, 0x0A5D, 0x0A83, 0x0BFF,
+ 0x0935, 0x085B, 0x0104, 0x08DD, 0x0923, 0x083F, 0x0241, 0x09D1,
+ 0x0A39, 0x0863, 0x0A8B, 0x08A6, 0x008B, 0x1133, 0x13B1, 0x089B,
+ 0x0AB3, 0x0036, 0x0BDD, 0x08ED, 0x0857, 0x0971, 0x0219, 0x1235,
+ 0x0AB1, 0x0ACD, 0x036F, 0x0A31, 0x08AA, 0x003A, 0x08C3, 0x0A05,
+ 0x02BD, 0x0B92, 0x0B07, 0x12B2, 0x08C5, 0x0B51, 0x0381, 0x0A8D,
+ 0x01A3, 0x0896, 0x0855, 0x0BFD, 0x005D, 0x0BFE, 0x023E, 0x08AF,
+ 0x00B9, 0x0A93, 0x00B5, 0x0862, 0x0A0B, 0x0A09, 0x0A72, 0x0332,
+ 0x0AA1, 0x08C9, 0x024E, 0x1382, 0x0951, 0x00A5, 0x0A2A, 0x0059,
+ 0x0A9E, 0x0B42, 0x004E, 0x0942, 0x03ED, 0x09B2, 0x02D2, 0x0849,
+ 0x0035, 0x0216, 0x0961, 0x0BAF, 0x00AE, 0x0826, 0x0287, 0x0A1A,
+ 0x0393, 0x0221, 0x09A2, 0x086D, 0x0226, 0x0871, 0x0039, 0x082A,
+ 0x08C2, 0x08E1, 0x0845, 0x0207, 0x0B23, 0x0015, 0x00D1, 0x0B83,
+ 0x037F, 0x0252, 0x08A9, 0x0099, 0x0A13, 0x0053, 0x0807, 0x03CD,
+ 0x0BDE, 0x0016, 0x089A, 0x0232, 0x035F, 0x0A8E, 0x0AC3, 0x022F,
+ 0x0263, 0x0829, 0x004D, 0x0132, 0x0806, 0x0311, 0x01B1, 0x0941,
+ 0x0086, 0x000B, 0x1122, 0x0025, 0x0842, 0x00BD, 0x0BCF, 0x03A2,
+ 0x0043, 0x0B03, 0x0895, 0x0A8F, 0x008A, 0x09EF, 0x0253, 0x0A1B,
+ 0x0182, 0x0243, 0x0A92, 0x00CD, 0x083E, 0x030B, 0x0223, 0x081A,
+ 0x0A9F, 0x0193, 0x00BE, 0x0017, 0x0931, 0x0391, 0x037E, 0x09C1,
+ 0x0312, 0x0333, 0x03B2, 0x083D, 0x08B1, 0x00B2, 0x002E, 0x021D,
+ 0x0A9D, 0x0192, 0x02AE, 0x0102, 0x0022, 0x081B, 0x0222, 0x009E,
+ 0x021E, 0x000A, 0x089F, 0x0217, 0x0BCE, 0x0052, 0x020F, 0x0A97,
+ 0x0282, 0x008E, 0x0A3F, 0x01FD, 0x00A3, 0x0019, 0x08A2, 0x0301,
+ 0x036E, 0x01FE, 0x03BE, 0x0ABE, 0x01CE, 0x0302, 0x029B, 0x0051,
+ 0x0883, 0x008F, 0x0BAE, 0x01DF, 0x0183, 0x0912, 0x000E, 0x020D,
+ 0x01EE, 0x0B4F, 0x0033, 0x0103, 0x020E, 0x0832, 0x01AF, 0x0913,
+ 0x01DE, 0x0203, 0x001E, 0x0092, 0x0093, 0x000F, 0x015F, 0x0291,
+ 0x0281, 0x0813, 0x001F, 0x01CF, 0x033F, 0x0023, 0x01BF, 0x0202,
+ 0x016F, 0x017E, 0x03AD, 0x0201, 0x034E, 0x0BBD, 0x036D, 0x017F,
+ 0x0211, 0x038E, 0x0212, 0x032E, 0x034D, 0x035E, 0x037D, 0x039E,
+ 0x032F, 0x033E, 0x035D, 0x038F, 0x039F
+};
+
+static const uint16_t percentile_arr_10x10_1[234] {
+ 0x07CD, 0x6E21, 0x24F1, 0x8443, 0xD7AE, 0x24C2, 0x1C62, 0xCCA3,
+ 0x1C33, 0xFDEF, 0x2532, 0x55DF, 0x1472, 0x6C3E, 0x14D2, 0x34DD,
+ 0x1452, 0x745D, 0x4D51, 0x8DD1, 0x247D, 0x75FF, 0x0CB3, 0x17BE,
+ 0x6CAE, 0x17DD, 0x1571, 0x3D06, 0x4E31, 0x0DA2, 0x67BD, 0x160D,
+ 0x2C4E, 0x0D22, 0x176E, 0x3CB2, 0x142E, 0x4DFE, 0x0F4F, 0x1435,
+ 0x0F01, 0x0D42, 0x0F7D, 0x0CB5, 0x1E03, 0x149F, 0x1C96, 0x141F,
+ 0x14B9, 0x0FAF, 0x0439, 0x0E91, 0x2682, 0x1D13, 0x1FAD, 0x0407,
+ 0x3471, 0x0C86, 0x0F6D, 0x0D15, 0x0D61, 0x040B, 0x0C6D, 0x0C16,
+ 0x0C9A, 0x0D0A, 0x0593, 0x0CD1, 0x248F, 0x0C2F, 0x3C42, 0x1523,
+ 0x0445, 0x0E81, 0x0CA2, 0x1525, 0x0406, 0x1C8A, 0x0C1A, 0x04BD,
+ 0x0F5E, 0x0F3F, 0x1F4E, 0x0E1D, 0x0423, 0x0DCF, 0x044D, 0x0D92,
+ 0x0583, 0x0DB1, 0x1449, 0x15EE, 0x0F5F, 0x079F, 0x0D19, 0x0409,
+ 0x04CD, 0x05FD, 0x143D, 0x0612, 0x0D03, 0x0D82, 0x04B1, 0x0C95,
+ 0x0C2A, 0x049E, 0x05AF, 0x0D31, 0x05BE, 0x04E1, 0x0D05, 0x0516,
+ 0x0711, 0x05C1, 0x0509, 0x0D41, 0x0493, 0x048E, 0x0602, 0x05BF,
+ 0x0CA5, 0x0529, 0x0535, 0x0D12, 0x0539, 0x0451, 0x0C29, 0x071F,
+ 0x040A, 0x0F3D, 0x0432, 0x059F, 0x0425, 0x0C99, 0x05DE, 0x05CE,
+ 0x0C0F, 0x0489, 0x051A, 0x0501, 0x0415, 0x057F, 0x0431, 0x0E13,
+ 0x040D, 0x041D, 0x075D, 0x0C53, 0x0502, 0x04C1, 0x049D, 0x0426,
+ 0x040E, 0x05A1, 0x055F, 0x0781, 0x0591, 0x04A9, 0x048B, 0x0D8E,
+ 0x052E, 0x0412, 0x0521, 0x0405, 0x04AD, 0x074D, 0x0611, 0x077E,
+ 0x078F, 0x078D, 0x048D, 0x041E, 0x0487, 0x0461, 0x0C85, 0x05ED,
+ 0x0402, 0x0483, 0x0419, 0x0511, 0x0491, 0x0482, 0x059E, 0x068D,
+ 0x055D, 0x072E, 0x05DD, 0x054E, 0x0441, 0x0422, 0x052F, 0x057D,
+ 0x072D, 0x079D, 0x0CA1, 0x072F, 0x079E, 0x0581, 0x042D, 0x055E,
+ 0x0601, 0x0413, 0x0692, 0x0403, 0x051F, 0x053F, 0x054F, 0x05CD,
+ 0x070F, 0x071D, 0x05AE, 0x05BD, 0x0492, 0x056E, 0x0411, 0x0417,
+ 0x041B, 0x0421, 0x053E, 0x056F, 0x057E, 0x058F, 0x060E, 0x0622,
+ 0x0683, 0x0702, 0x070D, 0x070E, 0x071E, 0x073E, 0x076F, 0x078E,
+ 0x07BF, 0x07CE
+};
+
+static const packed_percentile_table block_pcd_10x10 {
+ 10, 10,
+ { 453, 234 },
+ { 1095, 472 },
+ { 0, 70 },
+ { percentile_arr_10x10_0, percentile_arr_10x10_1 }
+};
+#endif
+
+#if ASTCENC_BLOCK_MAX_TEXELS >= (12 * 10)
+static const uint16_t percentile_arr_12x10_0[491] {
+ 0x0334, 0x9954, 0x8514, 0x7128, 0x6364, 0xC174, 0x5D34, 0x5866,
+ 0x5975, 0x5354, 0xAF14, 0x506A, 0x5108, 0x5724, 0x5308, 0x4544,
+ 0x4918, 0x4064, 0x49E2, 0x4179, 0x8163, 0x4054, 0xF81C, 0x394A,
+ 0x38F3, 0x4172, 0x38F5, 0xA06F, 0x68EA, 0x69F2, 0x3134, 0x31A4,
+ 0x305A, 0x68DA, 0x3056, 0x3146, 0x31F5, 0x3148, 0x5A61, 0x32C1,
+ 0x31D2, 0x307E, 0x29E3, 0x30E6, 0x59C3, 0x2984, 0x29B6, 0x28F9,
+ 0x5204, 0x28EE, 0x50CA, 0x2997, 0x48C6, 0x4838, 0x2953, 0x200C,
+ 0x2943, 0x2173, 0x2D08, 0x4162, 0x29B4, 0x2314, 0x21B3, 0x212B,
+ 0x210C, 0x48E3, 0x60DE, 0x205F, 0x20FE, 0x2028, 0x21A6, 0x404F,
+ 0x20D6, 0x2214, 0x2127, 0x1873, 0x40CF, 0x206E, 0x1B09, 0x21C6,
+ 0x2075, 0x19D5, 0x2305, 0x18D3, 0x2076, 0x1804, 0x230A, 0x304B,
+ 0x20BB, 0x18B6, 0x1936, 0x1B19, 0x3037, 0x187F, 0x18A7, 0x1B85,
+ 0x30BA, 0x183B, 0x1027, 0x18EF, 0x1B21, 0x1879, 0x10AB, 0x1917,
+ 0x1114, 0x18BF, 0x1074, 0x1994, 0x2847, 0x111B, 0x28F2, 0x11E5,
+ 0x19A7, 0x113A, 0x1046, 0x28B7, 0x207A, 0x182B, 0x1155, 0x104A,
+ 0x1344, 0x293B, 0x11D3, 0x2014, 0x1044, 0x1018, 0x13A1, 0x1315,
+ 0x2524, 0x20DF, 0x10E5, 0x1126, 0x12A2, 0x1824, 0x2271, 0x11F1,
+ 0x2964, 0x12D1, 0x115A, 0x092A, 0x2341, 0x1A2D, 0x12E1, 0x090A,
+ 0x13BF, 0x0A4D, 0x2119, 0x0BC1, 0x1233, 0x1A8A, 0x2008, 0x1159,
+ 0x1A89, 0x08D5, 0x1156, 0x0834, 0x13EE, 0x1169, 0x1187, 0x1AA3,
+ 0x1229, 0x1331, 0x0A85, 0x0937, 0x1704, 0x08FD, 0x2124, 0x0B13,
+ 0x1251, 0x0AAD, 0x082C, 0x091A, 0x18D9, 0x0A99, 0x1848, 0x18E9,
+ 0x0B95, 0x1144, 0x0AF1, 0x1A25, 0x131A, 0x09C5, 0x0986, 0x1BDF,
+ 0x0B24, 0x0965, 0x1262, 0x0949, 0x0872, 0x09C2, 0x12C2, 0x0916,
+ 0x085E, 0x0B06, 0x08CB, 0x08C7, 0x1242, 0x1BEF, 0x0A9A, 0x1152,
+ 0x08B3, 0x0AA9, 0x090B, 0x08D2, 0x1B22, 0x0B04, 0x0865, 0x0A15,
+ 0x1286, 0x0A83, 0x0A95, 0x09D1, 0x0A06, 0x0196, 0x1139, 0x0A3D,
+ 0x0933, 0x13B1, 0x0123, 0x0D04, 0x08E2, 0x122E, 0x08A6, 0x00CE,
+ 0x0A31, 0x1241, 0x0B51, 0x1057, 0x1171, 0x007D, 0x1145, 0x0A0A,
+ 0x0129, 0x09FF, 0x089B, 0x085B, 0x0063, 0x0AB1, 0x0A1F, 0x0A5D,
+ 0x0AA5, 0x0036, 0x0904, 0x0B86, 0x0A8B, 0x0897, 0x11E1, 0x0332,
+ 0x083F, 0x0A19, 0x02B3, 0x0859, 0x08C3, 0x0855, 0x11B5, 0x01A5,
+ 0x0AB2, 0x0392, 0x10DD, 0x09A3, 0x00ED, 0x0907, 0x1161, 0x002F,
+ 0x0887, 0x0216, 0x0ABD, 0x0B81, 0x0A93, 0x0A21, 0x003A, 0x0ACD,
+ 0x0AA1, 0x0A35, 0x0272, 0x0BDD, 0x03FE, 0x0BAF, 0x0869, 0x0213,
+ 0x088B, 0x020B, 0x00B5, 0x1035, 0x08F1, 0x0151, 0x0A4E, 0x0239,
+ 0x0BA2, 0x00AA, 0x0896, 0x0382, 0x0A08, 0x0A05, 0x0A09, 0x0142,
+ 0x086D, 0x004E, 0x0B23, 0x0106, 0x0807, 0x036F, 0x0995, 0x03FD,
+ 0x08AF, 0x08C5, 0x0062, 0x0053, 0x0B42, 0x0826, 0x021A, 0x01A2,
+ 0x09B1, 0x00C9, 0x09B2, 0x0045, 0x0207, 0x08B9, 0x00A5, 0x0AD2,
+ 0x0095, 0x003E, 0x0A32, 0x0383, 0x0849, 0x0135, 0x029E, 0x0A26,
+ 0x023E, 0x0BFF, 0x0A52, 0x0311, 0x001B, 0x0915, 0x0A8D, 0x0223,
+ 0x022A, 0x0BED, 0x0086, 0x0A96, 0x0222, 0x035F, 0x0A43, 0x085D,
+ 0x0303, 0x0393, 0x0A63, 0x082A, 0x037F, 0x0932, 0x0043, 0x0292,
+ 0x03CD, 0x0BDE, 0x009F, 0x0125, 0x08A9, 0x0253, 0x0015, 0x0192,
+ 0x0A17, 0x08C2, 0x0316, 0x00D1, 0x0282, 0x0871, 0x0312, 0x0122,
+ 0x0A9F, 0x02AE, 0x0006, 0x0A8E, 0x08E1, 0x0016, 0x0B0B, 0x00AE,
+ 0x0025, 0x0193, 0x0AC3, 0x0017, 0x0307, 0x00BD, 0x08BE, 0x0039,
+ 0x0BB2, 0x021B, 0x01FD, 0x084D, 0x03CE, 0x00A3, 0x0302, 0x0BCF,
+ 0x0033, 0x0391, 0x028F, 0x0852, 0x0287, 0x008A, 0x0333, 0x080B,
+ 0x0131, 0x01C1, 0x037E, 0x0A0F, 0x00B1, 0x002E, 0x0099, 0x0902,
+ 0x009A, 0x003D, 0x0982, 0x0301, 0x00CD, 0x0941, 0x0042, 0x0183,
+ 0x029D, 0x08A2, 0x021D, 0x001A, 0x0A97, 0x01EF, 0x01CE, 0x0051,
+ 0x0BAE, 0x022F, 0x03BE, 0x021E, 0x000A, 0x09DF, 0x0029, 0x020D,
+ 0x02BE, 0x029B, 0x09EE, 0x00B2, 0x0912, 0x036E, 0x009E, 0x0022,
+ 0x0019, 0x0892, 0x0032, 0x01FE, 0x0083, 0x023F, 0x0B96, 0x000E,
+ 0x008F, 0x0113, 0x0103, 0x001E, 0x0A0E, 0x0013, 0x008E, 0x0281,
+ 0x09AF, 0x017E, 0x0203, 0x016F, 0x0291, 0x0023, 0x0093, 0x03BD,
+ 0x001F, 0x01CF, 0x01DE, 0x0201, 0x01BF, 0x0B4F, 0x000F, 0x0202,
+ 0x037D, 0x038E, 0x0211, 0x0212, 0x034E, 0x039F, 0x03AD, 0x015F,
+ 0x017F, 0x032E, 0x033F, 0x034D, 0x035E, 0x036D, 0x032F, 0x033E,
+ 0x035D, 0x038F, 0x039E
+};
+
+static const uint16_t percentile_arr_12x10_1[240] {
+ 0x0621, 0xA443, 0xFCC2, 0x3CA3, 0x1D32, 0x14F1, 0x7462, 0x1433,
+ 0x27CD, 0x2571, 0x57AE, 0x5DD1, 0x64B3, 0x44D2, 0x2C72, 0x25A2,
+ 0x1E31, 0x55DF, 0x4C52, 0x1DEF, 0x0D51, 0x3C5D, 0x3C3E, 0x74DD,
+ 0x347D, 0x27BE, 0x5CB5, 0x17DD, 0x2C14, 0x0CAE, 0x24B2, 0x15FF,
+ 0x2701, 0x0D42, 0x1FBD, 0x0C35, 0x1603, 0x060D, 0x1D93, 0x0C96,
+ 0x1C07, 0x1522, 0x0D06, 0x0F4F, 0x0C9F, 0x1F6E, 0x0D86, 0x0C2E,
+ 0x1DFE, 0x0682, 0x1E91, 0x0F7D, 0x0C86, 0x040B, 0x1513, 0x044E,
+ 0x14D1, 0x0C39, 0x14B9, 0x1C71, 0x05B1, 0x0C1F, 0x0681, 0x1445,
+ 0x0C16, 0x0D95, 0x1583, 0x0D61, 0x0FAD, 0x1442, 0x048F, 0x0D0A,
+ 0x049A, 0x0F6D, 0x146D, 0x0C2F, 0x0D25, 0x0406, 0x0C1A, 0x0D23,
+ 0x0612, 0x0FAF, 0x0F11, 0x0592, 0x0515, 0x14E1, 0x0602, 0x048A,
+ 0x0E1D, 0x0CBD, 0x0F9F, 0x0423, 0x075E, 0x174E, 0x0426, 0x0404,
+ 0x0C22, 0x0CA2, 0x0DEE, 0x0CA5, 0x0F3F, 0x05C1, 0x0CCD, 0x0503,
+ 0x044D, 0x0D16, 0x0449, 0x0D82, 0x0613, 0x0585, 0x0519, 0x0C95,
+ 0x075F, 0x0D35, 0x04B1, 0x0509, 0x0531, 0x0DA1, 0x049E, 0x040A,
+ 0x05CF, 0x0D41, 0x0415, 0x0692, 0x05FD, 0x0C25, 0x04A1, 0x0529,
+ 0x0591, 0x0C93, 0x057F, 0x04C1, 0x0512, 0x051A, 0x078D, 0x0451,
+ 0x0C0F, 0x0487, 0x0611, 0x0432, 0x042A, 0x05AF, 0x0461, 0x072D,
+ 0x0409, 0x0405, 0x0D39, 0x05DE, 0x048E, 0x0499, 0x0483, 0x04A9,
+ 0x0491, 0x042D, 0x049D, 0x0429, 0x040E, 0x05AE, 0x0521, 0x043D,
+ 0x0581, 0x05DD, 0x0492, 0x0CAD, 0x041E, 0x058F, 0x071F, 0x072F,
+ 0x0419, 0x073D, 0x057D, 0x0511, 0x05CE, 0x041D, 0x0485, 0x056E,
+ 0x0412, 0x0431, 0x05BF, 0x0441, 0x054E, 0x0489, 0x0421, 0x0502,
+ 0x0408, 0x040D, 0x051F, 0x059F, 0x073E, 0x078F, 0x0482, 0x079D,
+ 0x0C02, 0x05BE, 0x048B, 0x0411, 0x0505, 0x057E, 0x052E, 0x074D,
+ 0x077E, 0x054F, 0x0601, 0x055F, 0x068D, 0x070D, 0x070F, 0x071E,
+ 0x072E, 0x05CD, 0x0403, 0x0501, 0x055D, 0x059E, 0x0781, 0x0413,
+ 0x0417, 0x041B, 0x0453, 0x048D, 0x052F, 0x053E, 0x053F, 0x055E,
+ 0x056F, 0x058E, 0x05BD, 0x05ED, 0x060E, 0x0622, 0x0683, 0x0702,
+ 0x070E, 0x071D, 0x075D, 0x076F, 0x078E, 0x079E, 0x07BF, 0x07CE
+};
+
+static const packed_percentile_table block_pcd_12x10 =
+{
+ 12, 10,
+ { 491, 240 },
+ { 1099, 341 },
+ { 0, 23 },
+ { percentile_arr_12x10_0, percentile_arr_12x10_1 }
+};
+#endif
+
+#if ASTCENC_BLOCK_MAX_TEXELS >= (12 * 12)
+static const uint16_t percentile_arr_12x12_0[529] {
+ 0x0334, 0xF534, 0x8514, 0x8954, 0x7F14, 0xFB54, 0x7B08, 0x7128,
+ 0x7974, 0x6179, 0x6B64, 0x6908, 0x606A, 0x6724, 0xB544, 0xB066,
+ 0xA14A, 0x5118, 0x9975, 0x51F9, 0x981C, 0x49CA, 0x4854, 0x886F,
+ 0x88D4, 0x48EE, 0x41E2, 0x4163, 0x40F3, 0x4261, 0x4064, 0x407E,
+ 0x385A, 0x42C1, 0x4172, 0x38EA, 0x3946, 0x78CF, 0xA056, 0x38DE,
+ 0x3D08, 0x38F9, 0x3B14, 0x38FE, 0xA134, 0x38B8, 0x31A4, 0x71D2,
+ 0x60DA, 0x39C3, 0x99BA, 0x60CA, 0x39F2, 0x30F5, 0x304F, 0x31B6,
+ 0x31F5, 0x3204, 0x3148, 0x305F, 0x2953, 0x3194, 0x3184, 0x310C,
+ 0x889C, 0x300C, 0x2943, 0x30EF, 0x28C6, 0x2997, 0x2838, 0x58E6,
+ 0x20E4, 0x28E3, 0x2873, 0x29E3, 0x2A84, 0x28D3, 0x492B, 0x2962,
+ 0x286E, 0x20BF, 0x21AA, 0x29A6, 0x6A14, 0x2828, 0x89C6, 0x21B3,
+ 0x2305, 0x29B4, 0x2173, 0x2127, 0x20D6, 0x407F, 0x2294, 0x21D9,
+ 0x21D5, 0x2004, 0x404B, 0x18DF, 0x2079, 0x219B, 0x18A8, 0x2385,
+ 0x1936, 0x21AB, 0x188C, 0x1B09, 0x18BA, 0x203B, 0x187A, 0x1875,
+ 0x2344, 0x18BB, 0x18B6, 0x193A, 0x1837, 0x1914, 0x1846, 0x1876,
+ 0x1884, 0x1D24, 0x182B, 0x284A, 0x18A7, 0x18AB, 0x1917, 0x322D,
+ 0x1047, 0x1874, 0x1818, 0x18F2, 0x1164, 0x1B89, 0x2959, 0x1B21,
+ 0x39E5, 0x1827, 0x10F4, 0x18B7, 0x11D3, 0x1A4D, 0x1315, 0x12AD,
+ 0x1AD1, 0x3A71, 0x1319, 0x11A7, 0x2044, 0x2F04, 0x2341, 0x10E5,
+ 0x1155, 0x195A, 0x1024, 0x111B, 0x1251, 0x1233, 0x12E1, 0x13A1,
+ 0x13BF, 0x212A, 0x22A2, 0x113B, 0x23DF, 0x10D5, 0x2399, 0x0814,
+ 0x1126, 0x13EE, 0x1285, 0x10C4, 0x18FD, 0x20D9, 0x0987, 0x1242,
+ 0x29C5, 0x2313, 0x0898, 0x13C1, 0x08C8, 0x11F1, 0x1034, 0x1B24,
+ 0x0B0A, 0x11E9, 0x0808, 0x125D, 0x18E9, 0x0848, 0x1395, 0x0965,
+ 0x123D, 0x2186, 0x1295, 0x18CE, 0x098B, 0x0BEF, 0x1504, 0x082C,
+ 0x0A41, 0x1144, 0x0A89, 0x0956, 0x1331, 0x085E, 0x0B04, 0x128A,
+ 0x12A3, 0x1937, 0x19C2, 0x0952, 0x0872, 0x08B4, 0x1262, 0x1124,
+ 0x1969, 0x1063, 0x0AF1, 0x1225, 0x0894, 0x11C9, 0x18D2, 0x0ACD,
+ 0x0A29, 0x0B06, 0x09B5, 0x18C7, 0x0916, 0x1088, 0x09FF, 0x2206,
+ 0x0A15, 0x08B3, 0x0B51, 0x0A1F, 0x18CB, 0x0AC2, 0x0A2E, 0x1865,
+ 0x08AC, 0x0A31, 0x08A4, 0x138A, 0x0A99, 0x09D1, 0x0A86, 0x189B,
+ 0x0283, 0x0BDD, 0x0ABD, 0x1933, 0x083F, 0x1386, 0x0923, 0x0322,
+ 0x0869, 0x10DD, 0x13B1, 0x082F, 0x087D, 0x11B9, 0x085B, 0x08ED,
+ 0x00C3, 0x08E2, 0x084E, 0x0887, 0x0855, 0x0A0A, 0x0857, 0x0B92,
+ 0x1036, 0x12A5, 0x0293, 0x0945, 0x08A6, 0x0196, 0x19A3, 0x036F,
+ 0x0904, 0x1205, 0x09E1, 0x0381, 0x0971, 0x1219, 0x0BAF, 0x0949,
+ 0x00AF, 0x0AA9, 0x018A, 0x0907, 0x0BFD, 0x003A, 0x0BCD, 0x0AB2,
+ 0x088B, 0x0252, 0x0A4E, 0x03FF, 0x0845, 0x0897, 0x0059, 0x090B,
+ 0x0B42, 0x0807, 0x0A16, 0x0853, 0x0A8D, 0x01B2, 0x0AB1, 0x091A,
+ 0x0195, 0x0A35, 0x00B5, 0x10AA, 0x0115, 0x0A21, 0x0096, 0x0A08,
+ 0x03FE, 0x0B7F, 0x08B9, 0x12B3, 0x023E, 0x0A23, 0x029E, 0x08F1,
+ 0x01A9, 0x0BDE, 0x0843, 0x02D2, 0x0A1A, 0x08C5, 0x0151, 0x0A43,
+ 0x0332, 0x0383, 0x0826, 0x0BED, 0x10C2, 0x00AE, 0x0B82, 0x0213,
+ 0x0232, 0x085D, 0x02A1, 0x101B, 0x035F, 0x0303, 0x0A39, 0x0207,
+ 0x0A53, 0x0142, 0x01A5, 0x082A, 0x0099, 0x0A17, 0x03CF, 0x0906,
+ 0x0125, 0x0A96, 0x0A9A, 0x0209, 0x0393, 0x0961, 0x0131, 0x0A88,
+ 0x0139, 0x099A, 0x0292, 0x0272, 0x0862, 0x08BE, 0x0141, 0x02C3,
+ 0x0886, 0x0039, 0x08A9, 0x01A2, 0x01B1, 0x0851, 0x020B, 0x086D,
+ 0x0312, 0x08CD, 0x020F, 0x0311, 0x0BCE, 0x0135, 0x0006, 0x0849,
+ 0x0132, 0x0A8F, 0x022F, 0x022A, 0x0AAE, 0x0A8E, 0x0263, 0x03A2,
+ 0x083E, 0x009A, 0x021B, 0x0835, 0x0323, 0x0871, 0x0993, 0x0226,
+ 0x0302, 0x0922, 0x0119, 0x0222, 0x021D, 0x0B07, 0x08C9, 0x037E,
+ 0x08BD, 0x0042, 0x00D1, 0x0B33, 0x01C1, 0x0B9A, 0x0282, 0x088A,
+ 0x0182, 0x083D, 0x004D, 0x010A, 0x0A1E, 0x0019, 0x00B2, 0x0999,
+ 0x00A5, 0x0095, 0x0817, 0x0022, 0x031A, 0x0902, 0x00A3, 0x01BF,
+ 0x029F, 0x0816, 0x03B2, 0x0015, 0x0391, 0x0BBE, 0x01FE, 0x1129,
+ 0x002E, 0x01DF, 0x0301, 0x0033, 0x0B6E, 0x00E1, 0x0297, 0x00B1,
+ 0x009F, 0x0B16, 0x000A, 0x001A, 0x0052, 0x080B, 0x030B, 0x029D,
+ 0x0BAE, 0x01FD, 0x020E, 0x00A2, 0x0A3F, 0x0192, 0x0ABE, 0x020D,
+ 0x008F, 0x028B, 0x0083, 0x0025, 0x09EE, 0x01EF, 0x0029, 0x0291,
+ 0x0B4F, 0x0396, 0x0287, 0x008E, 0x0092, 0x0B4E, 0x017E, 0x001E,
+ 0x009E, 0x0103, 0x080F, 0x000E, 0x0113, 0x0203, 0x01CF, 0x0183,
+ 0x01CE, 0x001F, 0x0112, 0x01DE, 0x038E, 0x0832, 0x033E, 0x0212,
+ 0x029B, 0x0023, 0x016F, 0x0201, 0x09AF, 0x0202, 0x0281, 0x035E,
+ 0x034D, 0x037D, 0x03AD, 0x0013, 0x0093, 0x015F, 0x0211, 0x033F,
+ 0x036D, 0x039F, 0x03BD, 0x017F, 0x032E, 0x032F, 0x035D, 0x038F,
+ 0x039E
+};
+
+static const uint16_t percentile_arr_12x12_1[246] {
+ 0x0443, 0xFFCD, 0x2C62, 0x2E21, 0x3CF1, 0x34C2, 0x4CDD, 0x2452,
+ 0xD5DF, 0x1DD1, 0x0FAE, 0x64A3, 0x0C7D, 0x3433, 0x1CD2, 0x2DEF,
+ 0x0C3E, 0x1D71, 0xA472, 0x0D32, 0x54B3, 0x4D51, 0x445D, 0x0E31,
+ 0x1FDD, 0x0DFF, 0x0CAE, 0x45A2, 0x2FBE, 0xA4B9, 0x1C4E, 0x2C9F,
+ 0x160D, 0x0D42, 0x342E, 0x074F, 0x1414, 0x0F6E, 0x0CB2, 0x34B5,
+ 0x0DFE, 0x0D86, 0x1496, 0x1D22, 0x0691, 0x140B, 0x041F, 0x0C35,
+ 0x1D93, 0x1506, 0x1439, 0x0C9A, 0x0F01, 0x2442, 0x0C8F, 0x04D1,
+ 0x1486, 0x0C6D, 0x0513, 0x0C71, 0x0E82, 0x177D, 0x0E03, 0x07BD,
+ 0x0C2F, 0x0D83, 0x07AF, 0x0D61, 0x1407, 0x0DB1, 0x050A, 0x0C94,
+ 0x07AD, 0x0D8A, 0x0C04, 0x0416, 0x0C49, 0x0445, 0x15C1, 0x0C1A,
+ 0x0525, 0x0595, 0x0C8A, 0x075E, 0x0CBD, 0x0681, 0x0F4E, 0x075F,
+ 0x061D, 0x1541, 0x0CB1, 0x0F3F, 0x0406, 0x076D, 0x0DCF, 0x05EE,
+ 0x0D23, 0x0599, 0x0CCD, 0x0711, 0x0C23, 0x079F, 0x0D15, 0x0585,
+ 0x04A2, 0x042A, 0x0D31, 0x05BF, 0x0D92, 0x0C26, 0x043D, 0x0C93,
+ 0x0502, 0x0C15, 0x048B, 0x0D03, 0x0613, 0x0516, 0x0495, 0x0C29,
+ 0x04A5, 0x040F, 0x0425, 0x0539, 0x0D19, 0x04E1, 0x05BE, 0x0422,
+ 0x0432, 0x0C0A, 0x0431, 0x041E, 0x0492, 0x04A9, 0x0582, 0x0529,
+ 0x0487, 0x0C4D, 0x0512, 0x049E, 0x0505, 0x0451, 0x0D7F, 0x0489,
+ 0x0602, 0x05DE, 0x0591, 0x0535, 0x074D, 0x055E, 0x04C1, 0x0612,
+ 0x05DD, 0x05FD, 0x0C61, 0x0521, 0x0484, 0x05CE, 0x0581, 0x0491,
+ 0x051A, 0x04A1, 0x048E, 0x040D, 0x0499, 0x071F, 0x072E, 0x075D,
+ 0x0441, 0x0589, 0x057E, 0x0CAD, 0x0501, 0x054F, 0x0692, 0x0511,
+ 0x049D, 0x0509, 0x056E, 0x040E, 0x0409, 0x0601, 0x048D, 0x0413,
+ 0x053E, 0x0419, 0x072D, 0x0408, 0x0485, 0x042D, 0x041D, 0x05A1,
+ 0x0781, 0x0402, 0x05ED, 0x0C82, 0x0403, 0x057D, 0x05CD, 0x0611,
+ 0x0488, 0x0411, 0x054E, 0x051F, 0x053F, 0x056F, 0x059F, 0x070F,
+ 0x071D, 0x073D, 0x073E, 0x077E, 0x078F, 0x0405, 0x079D, 0x079E,
+ 0x058E, 0x0412, 0x055D, 0x05AE, 0x041B, 0x0421, 0x0453, 0x0417,
+ 0x0483, 0x052E, 0x052F, 0x055F, 0x058F, 0x059E, 0x05AF, 0x05BD,
+ 0x060E, 0x0622, 0x0683, 0x068D, 0x0702, 0x070D, 0x070E, 0x071E,
+ 0x072F, 0x076F, 0x078D, 0x078E, 0x07BF, 0x07CE
+};
+
+static const packed_percentile_table block_pcd_12x12 {
+ 12, 12,
+ { 529, 246 },
+ { 1435, 335 },
+ { 0, 22 },
+ { percentile_arr_12x12_0, percentile_arr_12x12_1 }
+};
+#endif
+
+/**
+ * @brief Fetch the packed percentile table for the given 2D block size.
+ *
+ * @param xdim The block x size.
+ * @param ydim The block y size.
+ *
+ * @return The packed table.
+ */
+static const packed_percentile_table *get_packed_table(
+ int xdim,
+ int ydim
+) {
+ int idx = (ydim << 8) | xdim;
+ switch (idx)
+ {
+#if ASTCENC_BLOCK_MAX_TEXELS >= (4 * 4)
+ case 0x0404: return &block_pcd_4x4;
+#endif
+#if ASTCENC_BLOCK_MAX_TEXELS >= (5 * 4)
+ case 0x0405: return &block_pcd_5x4;
+#endif
+#if ASTCENC_BLOCK_MAX_TEXELS >= (5 * 5)
+ case 0x0505: return &block_pcd_5x5;
+#endif
+#if ASTCENC_BLOCK_MAX_TEXELS >= (6 * 5)
+ case 0x0506: return &block_pcd_6x5;
+#endif
+#if ASTCENC_BLOCK_MAX_TEXELS >= (6 * 6)
+ case 0x0606: return &block_pcd_6x6;
+#endif
+#if ASTCENC_BLOCK_MAX_TEXELS >= (8 * 5)
+ case 0x0508: return &block_pcd_8x5;
+#endif
+#if ASTCENC_BLOCK_MAX_TEXELS >= (8 * 6)
+ case 0x0608: return &block_pcd_8x6;
+#endif
+#if ASTCENC_BLOCK_MAX_TEXELS >= (8 * 8)
+ case 0x0808: return &block_pcd_8x8;
+#endif
+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 5)
+ case 0x050A: return &block_pcd_10x5;
+#endif
+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 6)
+ case 0x060A: return &block_pcd_10x6;
+#endif
+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 8)
+ case 0x080A: return &block_pcd_10x8;
+#endif
+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 10)
+ case 0x0A0A: return &block_pcd_10x10;
+#endif
+#if ASTCENC_BLOCK_MAX_TEXELS >= (12 * 10)
+ case 0x0A0C: return &block_pcd_12x10;
+#endif
+#if ASTCENC_BLOCK_MAX_TEXELS >= (12 * 12)
+ case 0x0C0C: return &block_pcd_12x12;
+#endif
+ }
+
+ // Should never hit this with a valid 2D block size
+ return nullptr;
+}
+
+/* See header for documentation. */
+const float *get_2d_percentile_table(
+ unsigned int xdim,
+ unsigned int ydim
+) {
+ float* unpacked_table = new float[WEIGHTS_MAX_BLOCK_MODES];
+ const packed_percentile_table *apt = get_packed_table(xdim, ydim);
+
+ // Set the default percentile
+ for (unsigned int i = 0; i < WEIGHTS_MAX_BLOCK_MODES; i++)
+ {
+ unpacked_table[i] = 1.0f;
+ }
+
+ // Populate the unpacked percentile values
+ for (int i = 0; i < 2; i++)
+ {
+ unsigned int itemcount = apt->item_count[i];
+ unsigned int difscale = apt->difscales[i];
+ unsigned int accum = apt->initial_percs[i];
+ const uint16_t *item_ptr = apt->items[i];
+
+ for (unsigned int j = 0; j < itemcount; j++)
+ {
+ uint16_t item = item_ptr[j];
+ unsigned int idx = item & 0x7FF;
+ unsigned int weight = (item >> 11) & 0x1F;
+ accum += weight;
+ unpacked_table[idx] = static_cast<float>(accum) / static_cast<float>(difscale);
+ }
+ }
+
+ return unpacked_table;
+}
+#endif
+
+/* See header for documentation. */
+bool is_legal_2d_block_size(
+ unsigned int xdim,
+ unsigned int ydim
+) {
+ unsigned int idx = (xdim << 8) | ydim;
+ switch (idx)
+ {
+ case 0x0404:
+ case 0x0504:
+ case 0x0505:
+ case 0x0605:
+ case 0x0606:
+ case 0x0805:
+ case 0x0806:
+ case 0x0808:
+ case 0x0A05:
+ case 0x0A06:
+ case 0x0A08:
+ case 0x0A0A:
+ case 0x0C0A:
+ case 0x0C0C:
+ return true;
+ }
+
+ return false;
+}
+
+/* See header for documentation. */
+bool is_legal_3d_block_size(
+ unsigned int xdim,
+ unsigned int ydim,
+ unsigned int zdim
+) {
+ unsigned int idx = (xdim << 16) | (ydim << 8) | zdim;
+ switch (idx)
+ {
+ case 0x030303:
+ case 0x040303:
+ case 0x040403:
+ case 0x040404:
+ case 0x050404:
+ case 0x050504:
+ case 0x050505:
+ case 0x060505:
+ case 0x060605:
+ case 0x060606:
+ return true;
+ }
+
+ return false;
+}
diff --git a/thirdparty/astcenc/astcenc_pick_best_endpoint_format.cpp b/thirdparty/astcenc/astcenc_pick_best_endpoint_format.cpp
new file mode 100644
index 0000000000..f25140d4c7
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_pick_best_endpoint_format.cpp
@@ -0,0 +1,1350 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2022 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+
+/**
+ * @brief Functions for finding best endpoint format.
+ *
+ * We assume there are two independent sources of error in any given partition:
+ *
+ * - Encoding choice errors
+ * - Quantization errors
+ *
+ * Encoding choice errors are caused by encoder decisions. For example:
+ *
+ * - Using luminance instead of separate RGB components.
+ * - Using a constant 1.0 alpha instead of storing an alpha component.
+ * - Using RGB+scale instead of storing two full RGB endpoints.
+ *
+ * Quantization errors occur due to the limited precision we use for storage. These errors generally
+ * scale with quantization level, but are not actually independent of color encoding. In particular:
+ *
+ * - If we can use offset encoding then quantization error is halved.
+ * - If we can use blue-contraction then quantization error for RG is halved.
+ * - If we use HDR endpoints the quantization error is higher.
+ *
+ * Apart from these effects, we assume the error is proportional to the quantization step size.
+ */
+
+
+#include "astcenc_internal.h"
+#include "astcenc_vecmathlib.h"
+
+#include <assert.h>
+
+/**
+ * @brief Compute the errors of the endpoint line options for one partition.
+ *
+ * Uncorrelated data assumes storing completely independent RGBA channels for each endpoint. Same
+ * chroma data assumes storing RGBA endpoints which pass though the origin (LDR only). RGBL data
+ * assumes storing RGB + lumashift (HDR only). Luminance error assumes storing RGB channels as a
+ * single value.
+ *
+ *
+ * @param pi The partition info data.
+ * @param partition_index The partition index to compule the error for.
+ * @param blk The image block.
+ * @param uncor_pline The endpoint line assuming uncorrelated endpoints.
+ * @param[out] uncor_err The computed error for the uncorrelated endpoint line.
+ * @param samec_pline The endpoint line assuming the same chroma for both endpoints.
+ * @param[out] samec_err The computed error for the uncorrelated endpoint line.
+ * @param rgbl_pline The endpoint line assuming RGB + lumashift data.
+ * @param[out] rgbl_err The computed error for the RGB + lumashift endpoint line.
+ * @param l_pline The endpoint line assuming luminance data.
+ * @param[out] l_err The computed error for the luminance endpoint line.
+ * @param[out] a_drop_err The computed error for dropping the alpha component.
+ */
+static void compute_error_squared_rgb_single_partition(
+ const partition_info& pi,
+ int partition_index,
+ const image_block& blk,
+ const processed_line3& uncor_pline,
+ float& uncor_err,
+ const processed_line3& samec_pline,
+ float& samec_err,
+ const processed_line3& rgbl_pline,
+ float& rgbl_err,
+ const processed_line3& l_pline,
+ float& l_err,
+ float& a_drop_err
+) {
+ vfloat4 ews = blk.channel_weight;
+
+ unsigned int texel_count = pi.partition_texel_count[partition_index];
+ const uint8_t* texel_indexes = pi.texels_of_partition[partition_index];
+ promise(texel_count > 0);
+
+ vfloatacc a_drop_errv = vfloatacc::zero();
+ vfloat default_a(blk.get_default_alpha());
+
+ vfloatacc uncor_errv = vfloatacc::zero();
+ vfloat uncor_bs0(uncor_pline.bs.lane<0>());
+ vfloat uncor_bs1(uncor_pline.bs.lane<1>());
+ vfloat uncor_bs2(uncor_pline.bs.lane<2>());
+
+ vfloat uncor_amod0(uncor_pline.amod.lane<0>());
+ vfloat uncor_amod1(uncor_pline.amod.lane<1>());
+ vfloat uncor_amod2(uncor_pline.amod.lane<2>());
+
+ vfloatacc samec_errv = vfloatacc::zero();
+ vfloat samec_bs0(samec_pline.bs.lane<0>());
+ vfloat samec_bs1(samec_pline.bs.lane<1>());
+ vfloat samec_bs2(samec_pline.bs.lane<2>());
+
+ vfloatacc rgbl_errv = vfloatacc::zero();
+ vfloat rgbl_bs0(rgbl_pline.bs.lane<0>());
+ vfloat rgbl_bs1(rgbl_pline.bs.lane<1>());
+ vfloat rgbl_bs2(rgbl_pline.bs.lane<2>());
+
+ vfloat rgbl_amod0(rgbl_pline.amod.lane<0>());
+ vfloat rgbl_amod1(rgbl_pline.amod.lane<1>());
+ vfloat rgbl_amod2(rgbl_pline.amod.lane<2>());
+
+ vfloatacc l_errv = vfloatacc::zero();
+ vfloat l_bs0(l_pline.bs.lane<0>());
+ vfloat l_bs1(l_pline.bs.lane<1>());
+ vfloat l_bs2(l_pline.bs.lane<2>());
+
+ vint lane_ids = vint::lane_id();
+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ vint tix(texel_indexes + i);
+
+ vmask mask = lane_ids < vint(texel_count);
+ lane_ids += vint(ASTCENC_SIMD_WIDTH);
+
+ // Compute the error that arises from just ditching alpha
+ vfloat data_a = gatherf(blk.data_a, tix);
+ vfloat alpha_diff = data_a - default_a;
+ alpha_diff = alpha_diff * alpha_diff;
+
+ haccumulate(a_drop_errv, alpha_diff, mask);
+
+ vfloat data_r = gatherf(blk.data_r, tix);
+ vfloat data_g = gatherf(blk.data_g, tix);
+ vfloat data_b = gatherf(blk.data_b, tix);
+
+ // Compute uncorrelated error
+ vfloat param = data_r * uncor_bs0
+ + data_g * uncor_bs1
+ + data_b * uncor_bs2;
+
+ vfloat dist0 = (uncor_amod0 + param * uncor_bs0) - data_r;
+ vfloat dist1 = (uncor_amod1 + param * uncor_bs1) - data_g;
+ vfloat dist2 = (uncor_amod2 + param * uncor_bs2) - data_b;
+
+ vfloat error = dist0 * dist0 * ews.lane<0>()
+ + dist1 * dist1 * ews.lane<1>()
+ + dist2 * dist2 * ews.lane<2>();
+
+ haccumulate(uncor_errv, error, mask);
+
+ // Compute same chroma error - no "amod", its always zero
+ param = data_r * samec_bs0
+ + data_g * samec_bs1
+ + data_b * samec_bs2;
+
+ dist0 = (param * samec_bs0) - data_r;
+ dist1 = (param * samec_bs1) - data_g;
+ dist2 = (param * samec_bs2) - data_b;
+
+ error = dist0 * dist0 * ews.lane<0>()
+ + dist1 * dist1 * ews.lane<1>()
+ + dist2 * dist2 * ews.lane<2>();
+
+ haccumulate(samec_errv, error, mask);
+
+ // Compute rgbl error
+ param = data_r * rgbl_bs0
+ + data_g * rgbl_bs1
+ + data_b * rgbl_bs2;
+
+ dist0 = (rgbl_amod0 + param * rgbl_bs0) - data_r;
+ dist1 = (rgbl_amod1 + param * rgbl_bs1) - data_g;
+ dist2 = (rgbl_amod2 + param * rgbl_bs2) - data_b;
+
+ error = dist0 * dist0 * ews.lane<0>()
+ + dist1 * dist1 * ews.lane<1>()
+ + dist2 * dist2 * ews.lane<2>();
+
+ haccumulate(rgbl_errv, error, mask);
+
+ // Compute luma error - no "amod", its always zero
+ param = data_r * l_bs0
+ + data_g * l_bs1
+ + data_b * l_bs2;
+
+ dist0 = (param * l_bs0) - data_r;
+ dist1 = (param * l_bs1) - data_g;
+ dist2 = (param * l_bs2) - data_b;
+
+ error = dist0 * dist0 * ews.lane<0>()
+ + dist1 * dist1 * ews.lane<1>()
+ + dist2 * dist2 * ews.lane<2>();
+
+ haccumulate(l_errv, error, mask);
+ }
+
+ a_drop_err = hadd_s(a_drop_errv) * ews.lane<3>();
+ uncor_err = hadd_s(uncor_errv);
+ samec_err = hadd_s(samec_errv);
+ rgbl_err = hadd_s(rgbl_errv);
+ l_err = hadd_s(l_errv);
+}
+
+/**
+ * @brief For a given set of input colors and partitioning determine endpoint encode errors.
+ *
+ * This function determines the color error that results from RGB-scale encoding (LDR only),
+ * RGB-lumashift encoding (HDR only), luminance-encoding, and alpha drop. Also determines whether
+ * the endpoints are eligible for offset encoding or blue-contraction
+ *
+ * @param blk The image block.
+ * @param pi The partition info data.
+ * @param ep The idealized endpoints.
+ * @param[out] eci The resulting encoding choice error metrics.
+ */
+static void compute_encoding_choice_errors(
+ const image_block& blk,
+ const partition_info& pi,
+ const endpoints& ep,
+ encoding_choice_errors eci[BLOCK_MAX_PARTITIONS])
+{
+ int partition_count = pi.partition_count;
+ promise(partition_count > 0);
+
+ partition_metrics pms[BLOCK_MAX_PARTITIONS];
+
+ compute_avgs_and_dirs_3_comp_rgb(pi, blk, pms);
+
+ for (int i = 0; i < partition_count; i++)
+ {
+ partition_metrics& pm = pms[i];
+
+ line3 uncor_rgb_lines;
+ line3 samec_rgb_lines; // for LDR-RGB-scale
+ line3 rgb_luma_lines; // for HDR-RGB-scale
+
+ processed_line3 uncor_rgb_plines;
+ processed_line3 samec_rgb_plines;
+ processed_line3 rgb_luma_plines;
+ processed_line3 luminance_plines;
+
+ float uncorr_rgb_error;
+ float samechroma_rgb_error;
+ float rgb_luma_error;
+ float luminance_rgb_error;
+ float alpha_drop_error;
+
+ uncor_rgb_lines.a = pm.avg;
+ uncor_rgb_lines.b = normalize_safe(pm.dir, unit3());
+
+ samec_rgb_lines.a = vfloat4::zero();
+ samec_rgb_lines.b = normalize_safe(pm.avg, unit3());
+
+ rgb_luma_lines.a = pm.avg;
+ rgb_luma_lines.b = unit3();
+
+ uncor_rgb_plines.amod = uncor_rgb_lines.a - uncor_rgb_lines.b * dot3(uncor_rgb_lines.a, uncor_rgb_lines.b);
+ uncor_rgb_plines.bs = uncor_rgb_lines.b;
+
+ // Same chroma always goes though zero, so this is simpler than the others
+ samec_rgb_plines.amod = vfloat4::zero();
+ samec_rgb_plines.bs = samec_rgb_lines.b;
+
+ rgb_luma_plines.amod = rgb_luma_lines.a - rgb_luma_lines.b * dot3(rgb_luma_lines.a, rgb_luma_lines.b);
+ rgb_luma_plines.bs = rgb_luma_lines.b;
+
+ // Luminance always goes though zero, so this is simpler than the others
+ luminance_plines.amod = vfloat4::zero();
+ luminance_plines.bs = unit3();
+
+ compute_error_squared_rgb_single_partition(
+ pi, i, blk,
+ uncor_rgb_plines, uncorr_rgb_error,
+ samec_rgb_plines, samechroma_rgb_error,
+ rgb_luma_plines, rgb_luma_error,
+ luminance_plines, luminance_rgb_error,
+ alpha_drop_error);
+
+ // Determine if we can offset encode RGB lanes
+ vfloat4 endpt0 = ep.endpt0[i];
+ vfloat4 endpt1 = ep.endpt1[i];
+ vfloat4 endpt_diff = abs(endpt1 - endpt0);
+ vmask4 endpt_can_offset = endpt_diff < vfloat4(0.12f * 65535.0f);
+ bool can_offset_encode = (mask(endpt_can_offset) & 0x7) == 0x7;
+
+ // Store out the settings
+ eci[i].rgb_scale_error = (samechroma_rgb_error - uncorr_rgb_error) * 0.7f; // empirical
+ eci[i].rgb_luma_error = (rgb_luma_error - uncorr_rgb_error) * 1.5f; // wild guess
+ eci[i].luminance_error = (luminance_rgb_error - uncorr_rgb_error) * 3.0f; // empirical
+ eci[i].alpha_drop_error = alpha_drop_error * 3.0f;
+ eci[i].can_offset_encode = can_offset_encode;
+ eci[i].can_blue_contract = !blk.is_luminance();
+ }
+}
+
+/**
+ * @brief For a given partition compute the error for every endpoint integer count and quant level.
+ *
+ * @param encode_hdr_rgb @c true if using HDR for RGB, @c false for LDR.
+ * @param encode_hdr_alpha @c true if using HDR for alpha, @c false for LDR.
+ * @param partition_index The partition index.
+ * @param pi The partition info.
+ * @param eci The encoding choice error metrics.
+ * @param ep The idealized endpoints.
+ * @param error_weight The resulting encoding choice error metrics.
+ * @param[out] best_error The best error for each integer count and quant level.
+ * @param[out] format_of_choice The preferred endpoint format for each integer count and quant level.
+ */
+static void compute_color_error_for_every_integer_count_and_quant_level(
+ bool encode_hdr_rgb,
+ bool encode_hdr_alpha,
+ int partition_index,
+ const partition_info& pi,
+ const encoding_choice_errors& eci,
+ const endpoints& ep,
+ vfloat4 error_weight,
+ float best_error[21][4],
+ uint8_t format_of_choice[21][4]
+) {
+ int partition_size = pi.partition_texel_count[partition_index];
+
+ static const float baseline_quant_error[21 - QUANT_6] {
+ (65536.0f * 65536.0f / 18.0f) / (5 * 5),
+ (65536.0f * 65536.0f / 18.0f) / (7 * 7),
+ (65536.0f * 65536.0f / 18.0f) / (9 * 9),
+ (65536.0f * 65536.0f / 18.0f) / (11 * 11),
+ (65536.0f * 65536.0f / 18.0f) / (15 * 15),
+ (65536.0f * 65536.0f / 18.0f) / (19 * 19),
+ (65536.0f * 65536.0f / 18.0f) / (23 * 23),
+ (65536.0f * 65536.0f / 18.0f) / (31 * 31),
+ (65536.0f * 65536.0f / 18.0f) / (39 * 39),
+ (65536.0f * 65536.0f / 18.0f) / (47 * 47),
+ (65536.0f * 65536.0f / 18.0f) / (63 * 63),
+ (65536.0f * 65536.0f / 18.0f) / (79 * 79),
+ (65536.0f * 65536.0f / 18.0f) / (95 * 95),
+ (65536.0f * 65536.0f / 18.0f) / (127 * 127),
+ (65536.0f * 65536.0f / 18.0f) / (159 * 159),
+ (65536.0f * 65536.0f / 18.0f) / (191 * 191),
+ (65536.0f * 65536.0f / 18.0f) / (255 * 255)
+ };
+
+ vfloat4 ep0 = ep.endpt0[partition_index];
+ vfloat4 ep1 = ep.endpt1[partition_index];
+
+ float ep1_min = hmin_rgb_s(ep1);
+ ep1_min = astc::max(ep1_min, 0.0f);
+
+ float error_weight_rgbsum = hadd_rgb_s(error_weight);
+
+ float range_upper_limit_rgb = encode_hdr_rgb ? 61440.0f : 65535.0f;
+ float range_upper_limit_alpha = encode_hdr_alpha ? 61440.0f : 65535.0f;
+
+ // It is possible to get endpoint colors significantly outside [0,upper-limit] even if the
+ // input data are safely contained in [0,upper-limit]; we need to add an error term for this
+ vfloat4 offset(range_upper_limit_rgb, range_upper_limit_rgb, range_upper_limit_rgb, range_upper_limit_alpha);
+ vfloat4 ep0_range_error_high = max(ep0 - offset, 0.0f);
+ vfloat4 ep1_range_error_high = max(ep1 - offset, 0.0f);
+
+ vfloat4 ep0_range_error_low = min(ep0, 0.0f);
+ vfloat4 ep1_range_error_low = min(ep1, 0.0f);
+
+ vfloat4 sum_range_error =
+ (ep0_range_error_low * ep0_range_error_low) +
+ (ep1_range_error_low * ep1_range_error_low) +
+ (ep0_range_error_high * ep0_range_error_high) +
+ (ep1_range_error_high * ep1_range_error_high);
+
+ float rgb_range_error = dot3_s(sum_range_error, error_weight)
+ * 0.5f * static_cast<float>(partition_size);
+ float alpha_range_error = sum_range_error.lane<3>() * error_weight.lane<3>()
+ * 0.5f * static_cast<float>(partition_size);
+
+ if (encode_hdr_rgb)
+ {
+
+ // Collect some statistics
+ float af, cf;
+ if (ep1.lane<0>() > ep1.lane<1>() && ep1.lane<0>() > ep1.lane<2>())
+ {
+ af = ep1.lane<0>();
+ cf = ep1.lane<0>() - ep0.lane<0>();
+ }
+ else if (ep1.lane<1>() > ep1.lane<2>())
+ {
+ af = ep1.lane<1>();
+ cf = ep1.lane<1>() - ep0.lane<1>();
+ }
+ else
+ {
+ af = ep1.lane<2>();
+ cf = ep1.lane<2>() - ep0.lane<2>();
+ }
+
+ // Estimate of color-component spread in high endpoint color
+ float bf = af - ep1_min;
+ vfloat4 prd = (ep1 - vfloat4(cf)).swz<0, 1, 2>();
+ vfloat4 pdif = prd - ep0.swz<0, 1, 2>();
+ // Estimate of color-component spread in low endpoint color
+ float df = hmax_s(abs(pdif));
+
+ int b = static_cast<int>(bf);
+ int c = static_cast<int>(cf);
+ int d = static_cast<int>(df);
+
+ // Determine which one of the 6 submodes is likely to be used in case of an RGBO-mode
+ int rgbo_mode = 5; // 7 bits per component
+ // mode 4: 8 7 6
+ if (b < 32768 && c < 16384)
+ {
+ rgbo_mode = 4;
+ }
+
+ // mode 3: 9 6 7
+ if (b < 8192 && c < 16384)
+ {
+ rgbo_mode = 3;
+ }
+
+ // mode 2: 10 5 8
+ if (b < 2048 && c < 16384)
+ {
+ rgbo_mode = 2;
+ }
+
+ // mode 1: 11 6 5
+ if (b < 2048 && c < 1024)
+ {
+ rgbo_mode = 1;
+ }
+
+ // mode 0: 11 5 7
+ if (b < 1024 && c < 4096)
+ {
+ rgbo_mode = 0;
+ }
+
+ // Determine which one of the 9 submodes is likely to be used in case of an RGB-mode.
+ int rgb_mode = 8; // 8 bits per component, except 7 bits for blue
+
+ // mode 0: 9 7 6 7
+ if (b < 16384 && c < 8192 && d < 8192)
+ {
+ rgb_mode = 0;
+ }
+
+ // mode 1: 9 8 6 6
+ if (b < 32768 && c < 8192 && d < 4096)
+ {
+ rgb_mode = 1;
+ }
+
+ // mode 2: 10 6 7 7
+ if (b < 4096 && c < 8192 && d < 4096)
+ {
+ rgb_mode = 2;
+ }
+
+ // mode 3: 10 7 7 6
+ if (b < 8192 && c < 8192 && d < 2048)
+ {
+ rgb_mode = 3;
+ }
+
+ // mode 4: 11 8 6 5
+ if (b < 8192 && c < 2048 && d < 512)
+ {
+ rgb_mode = 4;
+ }
+
+ // mode 5: 11 6 8 6
+ if (b < 2048 && c < 8192 && d < 1024)
+ {
+ rgb_mode = 5;
+ }
+
+ // mode 6: 12 7 7 5
+ if (b < 2048 && c < 2048 && d < 256)
+ {
+ rgb_mode = 6;
+ }
+
+ // mode 7: 12 6 7 6
+ if (b < 1024 && c < 2048 && d < 512)
+ {
+ rgb_mode = 7;
+ }
+
+ static const float rgbo_error_scales[6] { 4.0f, 4.0f, 16.0f, 64.0f, 256.0f, 1024.0f };
+ static const float rgb_error_scales[9] { 64.0f, 64.0f, 16.0f, 16.0f, 4.0f, 4.0f, 1.0f, 1.0f, 384.0f };
+
+ float mode7mult = rgbo_error_scales[rgbo_mode] * 0.0015f; // Empirically determined ....
+ float mode11mult = rgb_error_scales[rgb_mode] * 0.010f; // Empirically determined ....
+
+
+ float lum_high = hadd_rgb_s(ep1) * (1.0f / 3.0f);
+ float lum_low = hadd_rgb_s(ep0) * (1.0f / 3.0f);
+ float lumdif = lum_high - lum_low;
+ float mode23mult = lumdif < 960 ? 4.0f : lumdif < 3968 ? 16.0f : 128.0f;
+
+ mode23mult *= 0.0005f; // Empirically determined ....
+
+ // Pick among the available HDR endpoint modes
+ for (int i = QUANT_2; i < QUANT_16; i++)
+ {
+ best_error[i][3] = ERROR_CALC_DEFAULT;
+ best_error[i][2] = ERROR_CALC_DEFAULT;
+ best_error[i][1] = ERROR_CALC_DEFAULT;
+ best_error[i][0] = ERROR_CALC_DEFAULT;
+
+ format_of_choice[i][3] = static_cast<uint8_t>(encode_hdr_alpha ? FMT_HDR_RGBA : FMT_HDR_RGB_LDR_ALPHA);
+ format_of_choice[i][2] = FMT_HDR_RGB;
+ format_of_choice[i][1] = FMT_HDR_RGB_SCALE;
+ format_of_choice[i][0] = FMT_HDR_LUMINANCE_LARGE_RANGE;
+ }
+
+ for (int i = QUANT_16; i <= QUANT_256; i++)
+ {
+ // The base_quant_error should depend on the scale-factor that would be used during
+ // actual encode of the color value
+
+ float base_quant_error = baseline_quant_error[i - QUANT_6] * static_cast<float>(partition_size);
+ float rgb_quantization_error = error_weight_rgbsum * base_quant_error * 2.0f;
+ float alpha_quantization_error = error_weight.lane<3>() * base_quant_error * 2.0f;
+ float rgba_quantization_error = rgb_quantization_error + alpha_quantization_error;
+
+ // For 8 integers, we have two encodings: one with HDR A and another one with LDR A
+
+ float full_hdr_rgba_error = rgba_quantization_error + rgb_range_error + alpha_range_error;
+ best_error[i][3] = full_hdr_rgba_error;
+ format_of_choice[i][3] = static_cast<uint8_t>(encode_hdr_alpha ? FMT_HDR_RGBA : FMT_HDR_RGB_LDR_ALPHA);
+
+ // For 6 integers, we have one HDR-RGB encoding
+ float full_hdr_rgb_error = (rgb_quantization_error * mode11mult) + rgb_range_error + eci.alpha_drop_error;
+ best_error[i][2] = full_hdr_rgb_error;
+ format_of_choice[i][2] = FMT_HDR_RGB;
+
+ // For 4 integers, we have one HDR-RGB-Scale encoding
+ float hdr_rgb_scale_error = (rgb_quantization_error * mode7mult) + rgb_range_error + eci.alpha_drop_error + eci.rgb_luma_error;
+
+ best_error[i][1] = hdr_rgb_scale_error;
+ format_of_choice[i][1] = FMT_HDR_RGB_SCALE;
+
+ // For 2 integers, we assume luminance-with-large-range
+ float hdr_luminance_error = (rgb_quantization_error * mode23mult) + rgb_range_error + eci.alpha_drop_error + eci.luminance_error;
+ best_error[i][0] = hdr_luminance_error;
+ format_of_choice[i][0] = FMT_HDR_LUMINANCE_LARGE_RANGE;
+ }
+ }
+ else
+ {
+ for (int i = QUANT_2; i < QUANT_6; i++)
+ {
+ best_error[i][3] = ERROR_CALC_DEFAULT;
+ best_error[i][2] = ERROR_CALC_DEFAULT;
+ best_error[i][1] = ERROR_CALC_DEFAULT;
+ best_error[i][0] = ERROR_CALC_DEFAULT;
+
+ format_of_choice[i][3] = FMT_RGBA;
+ format_of_choice[i][2] = FMT_RGB;
+ format_of_choice[i][1] = FMT_RGB_SCALE;
+ format_of_choice[i][0] = FMT_LUMINANCE;
+ }
+
+ float base_quant_error_rgb = error_weight_rgbsum * static_cast<float>(partition_size);
+ float base_quant_error_a = error_weight.lane<3>() * static_cast<float>(partition_size);
+ float base_quant_error_rgba = base_quant_error_rgb + base_quant_error_a;
+
+ float error_scale_bc_rgba = eci.can_blue_contract ? 0.625f : 1.0f;
+ float error_scale_oe_rgba = eci.can_offset_encode ? 0.5f : 1.0f;
+
+ float error_scale_bc_rgb = eci.can_blue_contract ? 0.5f : 1.0f;
+ float error_scale_oe_rgb = eci.can_offset_encode ? 0.25f : 1.0f;
+
+ // Pick among the available LDR endpoint modes
+ for (int i = QUANT_6; i <= QUANT_256; i++)
+ {
+ // Offset encoding not possible at higher quant levels
+ if (i >= QUANT_192)
+ {
+ error_scale_oe_rgba = 1.0f;
+ error_scale_oe_rgb = 1.0f;
+ }
+
+ float base_quant_error = baseline_quant_error[i - QUANT_6];
+ float quant_error_rgb = base_quant_error_rgb * base_quant_error;
+ float quant_error_rgba = base_quant_error_rgba * base_quant_error;
+
+ // 8 integers can encode as RGBA+RGBA
+ float full_ldr_rgba_error = quant_error_rgba
+ * error_scale_bc_rgba
+ * error_scale_oe_rgba
+ + rgb_range_error
+ + alpha_range_error;
+
+ best_error[i][3] = full_ldr_rgba_error;
+ format_of_choice[i][3] = FMT_RGBA;
+
+ // 6 integers can encode as RGB+RGB or RGBS+AA
+ float full_ldr_rgb_error = quant_error_rgb
+ * error_scale_bc_rgb
+ * error_scale_oe_rgb
+ + rgb_range_error
+ + eci.alpha_drop_error;
+
+ float rgbs_alpha_error = quant_error_rgba
+ + eci.rgb_scale_error
+ + rgb_range_error
+ + alpha_range_error;
+
+ if (rgbs_alpha_error < full_ldr_rgb_error)
+ {
+ best_error[i][2] = rgbs_alpha_error;
+ format_of_choice[i][2] = FMT_RGB_SCALE_ALPHA;
+ }
+ else
+ {
+ best_error[i][2] = full_ldr_rgb_error;
+ format_of_choice[i][2] = FMT_RGB;
+ }
+
+ // 4 integers can encode as RGBS or LA+LA
+ float ldr_rgbs_error = quant_error_rgb
+ + rgb_range_error
+ + eci.alpha_drop_error
+ + eci.rgb_scale_error;
+
+ float lum_alpha_error = quant_error_rgba
+ + rgb_range_error
+ + alpha_range_error
+ + eci.luminance_error;
+
+ if (ldr_rgbs_error < lum_alpha_error)
+ {
+ best_error[i][1] = ldr_rgbs_error;
+ format_of_choice[i][1] = FMT_RGB_SCALE;
+ }
+ else
+ {
+ best_error[i][1] = lum_alpha_error;
+ format_of_choice[i][1] = FMT_LUMINANCE_ALPHA;
+ }
+
+ // 2 integers can encode as L+L
+ float luminance_error = quant_error_rgb
+ + rgb_range_error
+ + eci.alpha_drop_error
+ + eci.luminance_error;
+
+ best_error[i][0] = luminance_error;
+ format_of_choice[i][0] = FMT_LUMINANCE;
+ }
+ }
+}
+
+/**
+ * @brief For one partition compute the best format and quantization for a given bit count.
+ *
+ * @param best_combined_error The best error for each quant level and integer count.
+ * @param best_combined_format The best format for each quant level and integer count.
+ * @param bits_available The number of bits available for encoding.
+ * @param[out] best_quant_level The output best color quant level.
+ * @param[out] best_format The output best color format.
+ *
+ * @return The output error for the best pairing.
+ */
+static float one_partition_find_best_combination_for_bitcount(
+ const float best_combined_error[21][4],
+ const uint8_t best_combined_format[21][4],
+ int bits_available,
+ uint8_t& best_quant_level,
+ uint8_t& best_format
+) {
+ int best_integer_count = 0;
+ float best_integer_count_error = ERROR_CALC_DEFAULT;
+
+ for (int integer_count = 1; integer_count <= 4; integer_count++)
+ {
+ // Compute the quantization level for a given number of integers and a given number of bits
+ int quant_level = quant_mode_table[integer_count][bits_available];
+
+ // Don't have enough bits to represent a given endpoint format at all!
+ if (quant_level < QUANT_6)
+ {
+ continue;
+ }
+
+ float integer_count_error = best_combined_error[quant_level][integer_count - 1];
+ if (integer_count_error < best_integer_count_error)
+ {
+ best_integer_count_error = integer_count_error;
+ best_integer_count = integer_count - 1;
+ }
+ }
+
+ int ql = quant_mode_table[best_integer_count + 1][bits_available];
+
+ best_quant_level = static_cast<uint8_t>(ql);
+ best_format = FMT_LUMINANCE;
+
+ if (ql >= QUANT_6)
+ {
+ best_format = best_combined_format[ql][best_integer_count];
+ }
+
+ return best_integer_count_error;
+}
+
+/**
+ * @brief For 2 partitions compute the best format combinations for every pair of quant mode and integer count.
+ *
+ * @param best_error The best error for a single endpoint quant level and integer count.
+ * @param best_format The best format for a single endpoint quant level and integer count.
+ * @param[out] best_combined_error The best combined error pairings for the 2 partitions.
+ * @param[out] best_combined_format The best combined format pairings for the 2 partitions.
+ */
+static void two_partitions_find_best_combination_for_every_quantization_and_integer_count(
+ const float best_error[2][21][4], // indexed by (partition, quant-level, integer-pair-count-minus-1)
+ const uint8_t best_format[2][21][4],
+ float best_combined_error[21][7], // indexed by (quant-level, integer-pair-count-minus-2)
+ uint8_t best_combined_format[21][7][2]
+) {
+ for (int i = QUANT_2; i <= QUANT_256; i++)
+ {
+ for (int j = 0; j < 7; j++)
+ {
+ best_combined_error[i][j] = ERROR_CALC_DEFAULT;
+ }
+ }
+
+ for (int quant = QUANT_6; quant <= QUANT_256; quant++)
+ {
+ for (int i = 0; i < 4; i++) // integer-count for first endpoint-pair
+ {
+ for (int j = 0; j < 4; j++) // integer-count for second endpoint-pair
+ {
+ int low2 = astc::min(i, j);
+ int high2 = astc::max(i, j);
+ if ((high2 - low2) > 1)
+ {
+ continue;
+ }
+
+ int intcnt = i + j;
+ float errorterm = astc::min(best_error[0][quant][i] + best_error[1][quant][j], 1e10f);
+ if (errorterm <= best_combined_error[quant][intcnt])
+ {
+ best_combined_error[quant][intcnt] = errorterm;
+ best_combined_format[quant][intcnt][0] = best_format[0][quant][i];
+ best_combined_format[quant][intcnt][1] = best_format[1][quant][j];
+ }
+ }
+ }
+ }
+}
+
+/**
+ * @brief For 2 partitions compute the best format and quantization for a given bit count.
+ *
+ * @param best_combined_error The best error for each quant level and integer count.
+ * @param best_combined_format The best format for each quant level and integer count.
+ * @param bits_available The number of bits available for encoding.
+ * @param[out] best_quant_level The output best color quant level.
+ * @param[out] best_quant_level_mod The output best color quant level assuming two more bits are available.
+ * @param[out] best_formats The output best color formats.
+ *
+ * @return The output error for the best pairing.
+ */
+static float two_partitions_find_best_combination_for_bitcount(
+ float best_combined_error[21][7],
+ uint8_t best_combined_format[21][7][2],
+ int bits_available,
+ uint8_t& best_quant_level,
+ uint8_t& best_quant_level_mod,
+ uint8_t* best_formats
+) {
+ int best_integer_count = 0;
+ float best_integer_count_error = ERROR_CALC_DEFAULT;
+
+ for (int integer_count = 2; integer_count <= 8; integer_count++)
+ {
+ // Compute the quantization level for a given number of integers and a given number of bits
+ int quant_level = quant_mode_table[integer_count][bits_available];
+
+ // Don't have enough bits to represent a given endpoint format at all!
+ if (quant_level < QUANT_6)
+ {
+ break;
+ }
+
+ float integer_count_error = best_combined_error[quant_level][integer_count - 2];
+ if (integer_count_error < best_integer_count_error)
+ {
+ best_integer_count_error = integer_count_error;
+ best_integer_count = integer_count;
+ }
+ }
+
+ int ql = quant_mode_table[best_integer_count][bits_available];
+ int ql_mod = quant_mode_table[best_integer_count][bits_available + 2];
+
+ best_quant_level = static_cast<uint8_t>(ql);
+ best_quant_level_mod = static_cast<uint8_t>(ql_mod);
+
+ if (ql >= QUANT_6)
+ {
+ for (int i = 0; i < 2; i++)
+ {
+ best_formats[i] = best_combined_format[ql][best_integer_count - 2][i];
+ }
+ }
+ else
+ {
+ for (int i = 0; i < 2; i++)
+ {
+ best_formats[i] = FMT_LUMINANCE;
+ }
+ }
+
+ return best_integer_count_error;
+}
+
+/**
+ * @brief For 3 partitions compute the best format combinations for every pair of quant mode and integer count.
+ *
+ * @param best_error The best error for a single endpoint quant level and integer count.
+ * @param best_format The best format for a single endpoint quant level and integer count.
+ * @param[out] best_combined_error The best combined error pairings for the 3 partitions.
+ * @param[out] best_combined_format The best combined format pairings for the 3 partitions.
+ */
+static void three_partitions_find_best_combination_for_every_quantization_and_integer_count(
+ const float best_error[3][21][4], // indexed by (partition, quant-level, integer-count)
+ const uint8_t best_format[3][21][4],
+ float best_combined_error[21][10],
+ uint8_t best_combined_format[21][10][3]
+) {
+ for (int i = QUANT_2; i <= QUANT_256; i++)
+ {
+ for (int j = 0; j < 10; j++)
+ {
+ best_combined_error[i][j] = ERROR_CALC_DEFAULT;
+ }
+ }
+
+ for (int quant = QUANT_6; quant <= QUANT_256; quant++)
+ {
+ for (int i = 0; i < 4; i++) // integer-count for first endpoint-pair
+ {
+ for (int j = 0; j < 4; j++) // integer-count for second endpoint-pair
+ {
+ int low2 = astc::min(i, j);
+ int high2 = astc::max(i, j);
+ if ((high2 - low2) > 1)
+ {
+ continue;
+ }
+
+ for (int k = 0; k < 4; k++) // integer-count for third endpoint-pair
+ {
+ int low3 = astc::min(k, low2);
+ int high3 = astc::max(k, high2);
+ if ((high3 - low3) > 1)
+ {
+ continue;
+ }
+
+ int intcnt = i + j + k;
+ float errorterm = astc::min(best_error[0][quant][i] + best_error[1][quant][j] + best_error[2][quant][k], 1e10f);
+ if (errorterm <= best_combined_error[quant][intcnt])
+ {
+ best_combined_error[quant][intcnt] = errorterm;
+ best_combined_format[quant][intcnt][0] = best_format[0][quant][i];
+ best_combined_format[quant][intcnt][1] = best_format[1][quant][j];
+ best_combined_format[quant][intcnt][2] = best_format[2][quant][k];
+ }
+ }
+ }
+ }
+ }
+}
+
+/**
+ * @brief For 3 partitions compute the best format and quantization for a given bit count.
+ *
+ * @param best_combined_error The best error for each quant level and integer count.
+ * @param best_combined_format The best format for each quant level and integer count.
+ * @param bits_available The number of bits available for encoding.
+ * @param[out] best_quant_level The output best color quant level.
+ * @param[out] best_quant_level_mod The output best color quant level assuming two more bits are available.
+ * @param[out] best_formats The output best color formats.
+ *
+ * @return The output error for the best pairing.
+ */
+static float three_partitions_find_best_combination_for_bitcount(
+ const float best_combined_error[21][10],
+ const uint8_t best_combined_format[21][10][3],
+ int bits_available,
+ uint8_t& best_quant_level,
+ uint8_t& best_quant_level_mod,
+ uint8_t* best_formats
+) {
+ int best_integer_count = 0;
+ float best_integer_count_error = ERROR_CALC_DEFAULT;
+
+ for (int integer_count = 3; integer_count <= 9; integer_count++)
+ {
+ // Compute the quantization level for a given number of integers and a given number of bits
+ int quant_level = quant_mode_table[integer_count][bits_available];
+
+ // Don't have enough bits to represent a given endpoint format at all!
+ if (quant_level < QUANT_6)
+ {
+ break;
+ }
+
+ float integer_count_error = best_combined_error[quant_level][integer_count - 3];
+ if (integer_count_error < best_integer_count_error)
+ {
+ best_integer_count_error = integer_count_error;
+ best_integer_count = integer_count;
+ }
+ }
+
+ int ql = quant_mode_table[best_integer_count][bits_available];
+ int ql_mod = quant_mode_table[best_integer_count][bits_available + 5];
+
+ best_quant_level = static_cast<uint8_t>(ql);
+ best_quant_level_mod = static_cast<uint8_t>(ql_mod);
+
+ if (ql >= QUANT_6)
+ {
+ for (int i = 0; i < 3; i++)
+ {
+ best_formats[i] = best_combined_format[ql][best_integer_count - 3][i];
+ }
+ }
+ else
+ {
+ for (int i = 0; i < 3; i++)
+ {
+ best_formats[i] = FMT_LUMINANCE;
+ }
+ }
+
+ return best_integer_count_error;
+}
+
+/**
+ * @brief For 4 partitions compute the best format combinations for every pair of quant mode and integer count.
+ *
+ * @param best_error The best error for a single endpoint quant level and integer count.
+ * @param best_format The best format for a single endpoint quant level and integer count.
+ * @param[out] best_combined_error The best combined error pairings for the 4 partitions.
+ * @param[out] best_combined_format The best combined format pairings for the 4 partitions.
+ */
+static void four_partitions_find_best_combination_for_every_quantization_and_integer_count(
+ const float best_error[4][21][4], // indexed by (partition, quant-level, integer-count)
+ const uint8_t best_format[4][21][4],
+ float best_combined_error[21][13],
+ uint8_t best_combined_format[21][13][4]
+) {
+ for (int i = QUANT_2; i <= QUANT_256; i++)
+ {
+ for (int j = 0; j < 13; j++)
+ {
+ best_combined_error[i][j] = ERROR_CALC_DEFAULT;
+ }
+ }
+
+ for (int quant = QUANT_6; quant <= QUANT_256; quant++)
+ {
+ for (int i = 0; i < 4; i++) // integer-count for first endpoint-pair
+ {
+ for (int j = 0; j < 4; j++) // integer-count for second endpoint-pair
+ {
+ int low2 = astc::min(i, j);
+ int high2 = astc::max(i, j);
+ if ((high2 - low2) > 1)
+ {
+ continue;
+ }
+
+ for (int k = 0; k < 4; k++) // integer-count for third endpoint-pair
+ {
+ int low3 = astc::min(k, low2);
+ int high3 = astc::max(k, high2);
+ if ((high3 - low3) > 1)
+ {
+ continue;
+ }
+
+ for (int l = 0; l < 4; l++) // integer-count for fourth endpoint-pair
+ {
+ int low4 = astc::min(l, low3);
+ int high4 = astc::max(l, high3);
+ if ((high4 - low4) > 1)
+ {
+ continue;
+ }
+
+ int intcnt = i + j + k + l;
+ float errorterm = astc::min(best_error[0][quant][i] + best_error[1][quant][j] + best_error[2][quant][k] + best_error[3][quant][l], 1e10f);
+ if (errorterm <= best_combined_error[quant][intcnt])
+ {
+ best_combined_error[quant][intcnt] = errorterm;
+ best_combined_format[quant][intcnt][0] = best_format[0][quant][i];
+ best_combined_format[quant][intcnt][1] = best_format[1][quant][j];
+ best_combined_format[quant][intcnt][2] = best_format[2][quant][k];
+ best_combined_format[quant][intcnt][3] = best_format[3][quant][l];
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+/**
+ * @brief For 4 partitions compute the best format and quantization for a given bit count.
+ *
+ * @param best_combined_error The best error for each quant level and integer count.
+ * @param best_combined_format The best format for each quant level and integer count.
+ * @param bits_available The number of bits available for encoding.
+ * @param[out] best_quant_level The output best color quant level.
+ * @param[out] best_quant_level_mod The output best color quant level assuming two more bits are available.
+ * @param[out] best_formats The output best color formats.
+ *
+ * @return best_error The output error for the best pairing.
+ */
+static float four_partitions_find_best_combination_for_bitcount(
+ const float best_combined_error[21][13],
+ const uint8_t best_combined_format[21][13][4],
+ int bits_available,
+ uint8_t& best_quant_level,
+ uint8_t& best_quant_level_mod,
+ uint8_t* best_formats
+) {
+ int best_integer_count = 0;
+ float best_integer_count_error = ERROR_CALC_DEFAULT;
+
+ for (int integer_count = 4; integer_count <= 9; integer_count++)
+ {
+ // Compute the quantization level for a given number of integers and a given number of bits
+ int quant_level = quant_mode_table[integer_count][bits_available];
+
+ // Don't have enough bits to represent a given endpoint format at all!
+ if (quant_level < QUANT_6)
+ {
+ break;
+ }
+
+ float integer_count_error = best_combined_error[quant_level][integer_count - 4];
+ if (integer_count_error < best_integer_count_error)
+ {
+ best_integer_count_error = integer_count_error;
+ best_integer_count = integer_count;
+ }
+ }
+
+ int ql = quant_mode_table[best_integer_count][bits_available];
+ int ql_mod = quant_mode_table[best_integer_count][bits_available + 8];
+
+ best_quant_level = static_cast<uint8_t>(ql);
+ best_quant_level_mod = static_cast<uint8_t>(ql_mod);
+
+ if (ql >= QUANT_6)
+ {
+ for (int i = 0; i < 4; i++)
+ {
+ best_formats[i] = best_combined_format[ql][best_integer_count - 4][i];
+ }
+ }
+ else
+ {
+ for (int i = 0; i < 4; i++)
+ {
+ best_formats[i] = FMT_LUMINANCE;
+ }
+ }
+
+ return best_integer_count_error;
+}
+
+/* See header for documentation. */
+unsigned int compute_ideal_endpoint_formats(
+ const partition_info& pi,
+ const image_block& blk,
+ const endpoints& ep,
+ // bitcounts and errors computed for the various quantization methods
+ const int8_t* qwt_bitcounts,
+ const float* qwt_errors,
+ unsigned int tune_candidate_limit,
+ unsigned int start_block_mode,
+ unsigned int end_block_mode,
+ // output data
+ uint8_t partition_format_specifiers[TUNE_MAX_TRIAL_CANDIDATES][BLOCK_MAX_PARTITIONS],
+ int block_mode[TUNE_MAX_TRIAL_CANDIDATES],
+ quant_method quant_level[TUNE_MAX_TRIAL_CANDIDATES],
+ quant_method quant_level_mod[TUNE_MAX_TRIAL_CANDIDATES],
+ compression_working_buffers& tmpbuf
+) {
+ int partition_count = pi.partition_count;
+
+ promise(partition_count > 0);
+
+ bool encode_hdr_rgb = static_cast<bool>(blk.rgb_lns[0]);
+ bool encode_hdr_alpha = static_cast<bool>(blk.alpha_lns[0]);
+
+ // Compute the errors that result from various encoding choices (such as using luminance instead
+ // of RGB, discarding Alpha, using RGB-scale in place of two separate RGB endpoints and so on)
+ encoding_choice_errors eci[BLOCK_MAX_PARTITIONS];
+ compute_encoding_choice_errors(blk, pi, ep, eci);
+
+ float best_error[BLOCK_MAX_PARTITIONS][21][4];
+ uint8_t format_of_choice[BLOCK_MAX_PARTITIONS][21][4];
+ for (int i = 0; i < partition_count; i++)
+ {
+ compute_color_error_for_every_integer_count_and_quant_level(
+ encode_hdr_rgb, encode_hdr_alpha, i,
+ pi, eci[i], ep, blk.channel_weight, best_error[i],
+ format_of_choice[i]);
+ }
+
+ float* errors_of_best_combination = tmpbuf.errors_of_best_combination;
+ uint8_t* best_quant_levels = tmpbuf.best_quant_levels;
+ uint8_t* best_quant_levels_mod = tmpbuf.best_quant_levels_mod;
+ uint8_t (&best_ep_formats)[WEIGHTS_MAX_BLOCK_MODES][BLOCK_MAX_PARTITIONS] = tmpbuf.best_ep_formats;
+
+ // Ensure that the first iteration understep contains data that will never be picked
+ vfloat clear_error(ERROR_CALC_DEFAULT);
+ vint clear_quant(0);
+
+ unsigned int packed_start_block_mode = round_down_to_simd_multiple_vla(start_block_mode);
+ storea(clear_error, errors_of_best_combination + packed_start_block_mode);
+ store_nbytes(clear_quant, best_quant_levels + packed_start_block_mode);
+ store_nbytes(clear_quant, best_quant_levels_mod + packed_start_block_mode);
+
+ // Ensure that last iteration overstep contains data that will never be picked
+ unsigned int packed_end_block_mode = round_down_to_simd_multiple_vla(end_block_mode - 1);
+ storea(clear_error, errors_of_best_combination + packed_end_block_mode);
+ store_nbytes(clear_quant, best_quant_levels + packed_end_block_mode);
+ store_nbytes(clear_quant, best_quant_levels_mod + packed_end_block_mode);
+
+ // Track a scalar best to avoid expensive search at least once ...
+ float error_of_best_combination = ERROR_CALC_DEFAULT;
+ int index_of_best_combination = -1;
+
+ // The block contains 1 partition
+ if (partition_count == 1)
+ {
+ for (unsigned int i = start_block_mode; i < end_block_mode; i++)
+ {
+ if (qwt_errors[i] >= ERROR_CALC_DEFAULT)
+ {
+ errors_of_best_combination[i] = ERROR_CALC_DEFAULT;
+ continue;
+ }
+
+ float error_of_best = one_partition_find_best_combination_for_bitcount(
+ best_error[0], format_of_choice[0], qwt_bitcounts[i],
+ best_quant_levels[i], best_ep_formats[i][0]);
+
+ float total_error = error_of_best + qwt_errors[i];
+ errors_of_best_combination[i] = total_error;
+ best_quant_levels_mod[i] = best_quant_levels[i];
+
+ if (total_error < error_of_best_combination)
+ {
+ error_of_best_combination = total_error;
+ index_of_best_combination = i;
+ }
+ }
+ }
+ // The block contains 2 partitions
+ else if (partition_count == 2)
+ {
+ float combined_best_error[21][7];
+ uint8_t formats_of_choice[21][7][2];
+
+ two_partitions_find_best_combination_for_every_quantization_and_integer_count(
+ best_error, format_of_choice, combined_best_error, formats_of_choice);
+
+ assert(start_block_mode == 0);
+ for (unsigned int i = 0; i < end_block_mode; i++)
+ {
+ if (qwt_errors[i] >= ERROR_CALC_DEFAULT)
+ {
+ errors_of_best_combination[i] = ERROR_CALC_DEFAULT;
+ continue;
+ }
+
+ float error_of_best = two_partitions_find_best_combination_for_bitcount(
+ combined_best_error, formats_of_choice, qwt_bitcounts[i],
+ best_quant_levels[i], best_quant_levels_mod[i],
+ best_ep_formats[i]);
+
+ float total_error = error_of_best + qwt_errors[i];
+ errors_of_best_combination[i] = total_error;
+
+ if (total_error < error_of_best_combination)
+ {
+ error_of_best_combination = total_error;
+ index_of_best_combination = i;
+ }
+ }
+ }
+ // The block contains 3 partitions
+ else if (partition_count == 3)
+ {
+ float combined_best_error[21][10];
+ uint8_t formats_of_choice[21][10][3];
+
+ three_partitions_find_best_combination_for_every_quantization_and_integer_count(
+ best_error, format_of_choice, combined_best_error, formats_of_choice);
+
+ assert(start_block_mode == 0);
+ for (unsigned int i = 0; i < end_block_mode; i++)
+ {
+ if (qwt_errors[i] >= ERROR_CALC_DEFAULT)
+ {
+ errors_of_best_combination[i] = ERROR_CALC_DEFAULT;
+ continue;
+ }
+
+ float error_of_best = three_partitions_find_best_combination_for_bitcount(
+ combined_best_error, formats_of_choice, qwt_bitcounts[i],
+ best_quant_levels[i], best_quant_levels_mod[i],
+ best_ep_formats[i]);
+
+ float total_error = error_of_best + qwt_errors[i];
+ errors_of_best_combination[i] = total_error;
+
+ if (total_error < error_of_best_combination)
+ {
+ error_of_best_combination = total_error;
+ index_of_best_combination = i;
+ }
+ }
+ }
+ // The block contains 4 partitions
+ else // if (partition_count == 4)
+ {
+ assert(partition_count == 4);
+ float combined_best_error[21][13];
+ uint8_t formats_of_choice[21][13][4];
+
+ four_partitions_find_best_combination_for_every_quantization_and_integer_count(
+ best_error, format_of_choice, combined_best_error, formats_of_choice);
+
+ assert(start_block_mode == 0);
+ for (unsigned int i = 0; i < end_block_mode; i++)
+ {
+ if (qwt_errors[i] >= ERROR_CALC_DEFAULT)
+ {
+ errors_of_best_combination[i] = ERROR_CALC_DEFAULT;
+ continue;
+ }
+
+ float error_of_best = four_partitions_find_best_combination_for_bitcount(
+ combined_best_error, formats_of_choice, qwt_bitcounts[i],
+ best_quant_levels[i], best_quant_levels_mod[i],
+ best_ep_formats[i]);
+
+ float total_error = error_of_best + qwt_errors[i];
+ errors_of_best_combination[i] = total_error;
+
+ if (total_error < error_of_best_combination)
+ {
+ error_of_best_combination = total_error;
+ index_of_best_combination = i;
+ }
+ }
+ }
+
+ int best_error_weights[TUNE_MAX_TRIAL_CANDIDATES];
+
+ // Fast path the first result and avoid the list search for trial 0
+ best_error_weights[0] = index_of_best_combination;
+ if (index_of_best_combination >= 0)
+ {
+ errors_of_best_combination[index_of_best_combination] = ERROR_CALC_DEFAULT;
+ }
+
+ // Search the remaining results and pick the best candidate modes for trial 1+
+ for (unsigned int i = 1; i < tune_candidate_limit; i++)
+ {
+ vint vbest_error_index(-1);
+ vfloat vbest_ep_error(ERROR_CALC_DEFAULT);
+
+ start_block_mode = round_down_to_simd_multiple_vla(start_block_mode);
+ vint lane_ids = vint::lane_id() + vint(start_block_mode);
+ for (unsigned int j = start_block_mode; j < end_block_mode; j += ASTCENC_SIMD_WIDTH)
+ {
+ vfloat err = vfloat(errors_of_best_combination + j);
+ vmask mask = err < vbest_ep_error;
+ vbest_ep_error = select(vbest_ep_error, err, mask);
+ vbest_error_index = select(vbest_error_index, lane_ids, mask);
+ lane_ids += vint(ASTCENC_SIMD_WIDTH);
+ }
+
+ // Pick best mode from the SIMD result, using lowest matching index to ensure invariance
+ vmask lanes_min_error = vbest_ep_error == hmin(vbest_ep_error);
+ vbest_error_index = select(vint(0x7FFFFFFF), vbest_error_index, lanes_min_error);
+ vbest_error_index = hmin(vbest_error_index);
+ int best_error_index = vbest_error_index.lane<0>();
+
+ best_error_weights[i] = best_error_index;
+
+ // Max the error for this candidate so we don't pick it again
+ if (best_error_index >= 0)
+ {
+ errors_of_best_combination[best_error_index] = ERROR_CALC_DEFAULT;
+ }
+ // Early-out if no more candidates are valid
+ else
+ {
+ break;
+ }
+ }
+
+ for (unsigned int i = 0; i < tune_candidate_limit; i++)
+ {
+ if (best_error_weights[i] < 0)
+ {
+ return i;
+ }
+
+ block_mode[i] = best_error_weights[i];
+
+ quant_level[i] = static_cast<quant_method>(best_quant_levels[best_error_weights[i]]);
+ quant_level_mod[i] = static_cast<quant_method>(best_quant_levels_mod[best_error_weights[i]]);
+
+ assert(quant_level[i] >= QUANT_6 && quant_level[i] <= QUANT_256);
+ assert(quant_level_mod[i] >= QUANT_6 && quant_level_mod[i] <= QUANT_256);
+
+ for (int j = 0; j < partition_count; j++)
+ {
+ partition_format_specifiers[i][j] = best_ep_formats[best_error_weights[i]][j];
+ }
+ }
+
+ return tune_candidate_limit;
+}
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_platform_isa_detection.cpp b/thirdparty/astcenc/astcenc_platform_isa_detection.cpp
new file mode 100644
index 0000000000..8ed98437ea
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_platform_isa_detection.cpp
@@ -0,0 +1,166 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2020-2022 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Platform-specific function implementations.
+ *
+ * This module contains functions for querying the host extended ISA support.
+ */
+
+// Include before the defines below to pick up any auto-setup based on compiler
+// built-in config, if not being set explicitly by the build system
+#include "astcenc_internal.h"
+
+#if (ASTCENC_SSE > 0) || (ASTCENC_AVX > 0) || \
+ (ASTCENC_POPCNT > 0) || (ASTCENC_F16C > 0)
+
+static bool g_init { false };
+
+/** Does this CPU support SSE 4.1? Set to -1 if not yet initialized. */
+static bool g_cpu_has_sse41 { false };
+
+/** Does this CPU support AVX2? Set to -1 if not yet initialized. */
+static bool g_cpu_has_avx2 { false };
+
+/** Does this CPU support POPCNT? Set to -1 if not yet initialized. */
+static bool g_cpu_has_popcnt { false };
+
+/** Does this CPU support F16C? Set to -1 if not yet initialized. */
+static bool g_cpu_has_f16c { false };
+
+/* ============================================================================
+ Platform code for Visual Studio
+============================================================================ */
+#if !defined(__clang__) && defined(_MSC_VER)
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <intrin.h>
+
+/**
+ * @brief Detect platform CPU ISA support and update global trackers.
+ */
+static void detect_cpu_isa()
+{
+ int data[4];
+
+ __cpuid(data, 0);
+ int num_id = data[0];
+
+ if (num_id >= 1)
+ {
+ __cpuidex(data, 1, 0);
+ // SSE41 = Bank 1, ECX, bit 19
+ g_cpu_has_sse41 = data[2] & (1 << 19) ? true : false;
+ // POPCNT = Bank 1, ECX, bit 23
+ g_cpu_has_popcnt = data[2] & (1 << 23) ? true : false;
+ // F16C = Bank 1, ECX, bit 29
+ g_cpu_has_f16c = data[2] & (1 << 29) ? true : false;
+ }
+
+ if (num_id >= 7)
+ {
+ __cpuidex(data, 7, 0);
+ // AVX2 = Bank 7, EBX, bit 5
+ g_cpu_has_avx2 = data[1] & (1 << 5) ? true : false;
+ }
+
+ // Ensure state bits are updated before init flag is updated
+ MemoryBarrier();
+ g_init = true;
+}
+
+/* ============================================================================
+ Platform code for GCC and Clang
+============================================================================ */
+#else
+#include <cpuid.h>
+
+/**
+ * @brief Detect platform CPU ISA support and update global trackers.
+ */
+static void detect_cpu_isa()
+{
+ unsigned int data[4];
+
+ if (__get_cpuid_count(1, 0, &data[0], &data[1], &data[2], &data[3]))
+ {
+ // SSE41 = Bank 1, ECX, bit 19
+ g_cpu_has_sse41 = data[2] & (1 << 19) ? true : false;
+ // POPCNT = Bank 1, ECX, bit 23
+ g_cpu_has_popcnt = data[2] & (1 << 23) ? true : false;
+ // F16C = Bank 1, ECX, bit 29
+ g_cpu_has_f16c = data[2] & (1 << 29) ? true : false;
+ }
+
+ g_cpu_has_avx2 = 0;
+ if (__get_cpuid_count(7, 0, &data[0], &data[1], &data[2], &data[3]))
+ {
+ // AVX2 = Bank 7, EBX, bit 5
+ g_cpu_has_avx2 = data[1] & (1 << 5) ? true : false;
+ }
+
+ // Ensure state bits are updated before init flag is updated
+ __sync_synchronize();
+ g_init = true;
+}
+#endif
+
+/* See header for documentation. */
+bool cpu_supports_popcnt()
+{
+ if (!g_init)
+ {
+ detect_cpu_isa();
+ }
+
+ return g_cpu_has_popcnt;
+}
+
+/* See header for documentation. */
+bool cpu_supports_f16c()
+{
+ if (!g_init)
+ {
+ detect_cpu_isa();
+ }
+
+ return g_cpu_has_f16c;
+}
+
+/* See header for documentation. */
+bool cpu_supports_sse41()
+{
+ if (!g_init)
+ {
+ detect_cpu_isa();
+ }
+
+ return g_cpu_has_sse41;
+}
+
+/* See header for documentation. */
+bool cpu_supports_avx2()
+{
+ if (!g_init)
+ {
+ detect_cpu_isa();
+ }
+
+ return g_cpu_has_avx2;
+}
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_quantization.cpp b/thirdparty/astcenc/astcenc_quantization.cpp
new file mode 100644
index 0000000000..478a21ead7
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_quantization.cpp
@@ -0,0 +1,904 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2021 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Functions and data tables for numeric quantization..
+ */
+
+#include "astcenc_internal.h"
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+
+// Starts from QUANT_6
+// Not scrambled
+const uint8_t color_unquant_to_uquant_tables[17][256] {
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 51, 51, 51, 51, 51,
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 102, 102, 102,
+ 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
+ 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
+ 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
+ 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
+ 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
+ 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
+ 153, 153, 153, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
+ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
+ 36, 36, 36, 36, 36, 36, 36, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 109, 109, 109, 109,
+ 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109,
+ 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109,
+ 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
+ 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
+ 146, 146, 146, 146, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182,
+ 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182,
+ 182, 182, 182, 182, 182, 182, 182, 182, 182, 219, 219, 219, 219, 219, 219, 219,
+ 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219,
+ 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 84, 84, 84, 84, 84, 84, 84, 84, 84,
+ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
+ 84, 84, 84, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
+ 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
+ 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
+ 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 199, 199, 199, 199, 199, 199, 199,
+ 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
+ 199, 199, 199, 199, 199, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
+ 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
+ 227, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 69, 69, 69, 69, 69, 69,
+ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
+ 69, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 116, 116, 116, 116, 116, 116, 116,
+ 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116,
+ 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
+ 139, 139, 139, 139, 139, 139, 139, 163, 163, 163, 163, 163, 163, 163, 163, 163,
+ 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 186,
+ 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
+ 186, 186, 186, 186, 186, 186, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
+ 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 232, 232, 232,
+ 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232,
+ 232, 232, 232, 232, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 34, 34, 34, 34, 34, 34,
+ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 51, 51, 51, 51, 51,
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 68, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 85, 85, 85,
+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 102, 102,
+ 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 119,
+ 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
+ 153, 153, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
+ 170, 170, 170, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
+ 221, 221, 221, 221, 221, 221, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238,
+ 238, 238, 238, 238, 238, 238, 238, 255, 255, 255, 255, 255, 255, 255, 255, 255
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 67, 67, 67,
+ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 80, 80, 80, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 80, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
+ 107, 107, 107, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
+ 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 148, 148, 148,
+ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 161, 161, 161, 161, 161,
+ 161, 161, 161, 161, 161, 161, 161, 161, 175, 175, 175, 175, 175, 175, 175, 175,
+ 175, 175, 175, 175, 175, 175, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
+ 188, 188, 188, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
+ 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 228, 228,
+ 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 242, 242, 242, 242, 242,
+ 242, 242, 242, 242, 242, 242, 242, 242, 242, 255, 255, 255, 255, 255, 255, 255
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99, 99, 110, 110, 110, 110, 110, 110, 110,
+ 110, 110, 110, 110, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
+ 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 145, 145, 145, 145,
+ 145, 145, 145, 145, 145, 145, 145, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 189, 189, 189, 189, 189, 189, 189, 189,
+ 189, 189, 189, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 211, 211,
+ 211, 211, 211, 211, 211, 211, 211, 211, 211, 222, 222, 222, 222, 222, 222, 222,
+ 222, 222, 222, 222, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 244,
+ 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 255, 255, 255, 255, 255, 255
+ },
+ {
+ 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16,
+ 16, 16, 16, 16, 16, 24, 24, 24, 24, 24, 24, 24, 24, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 41, 41, 41, 41, 41, 41, 41, 41, 49, 49,
+ 49, 49, 49, 49, 49, 49, 57, 57, 57, 57, 57, 57, 57, 57, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 74, 74, 74, 74, 74, 74, 74, 74, 82,
+ 82, 82, 82, 82, 82, 82, 82, 90, 90, 90, 90, 90, 90, 90, 90, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99, 107, 107, 107, 107, 107, 107, 107, 107,
+ 115, 115, 115, 115, 115, 115, 115, 115, 123, 123, 123, 123, 123, 123, 123, 123,
+ 132, 132, 132, 132, 132, 132, 132, 132, 140, 140, 140, 140, 140, 140, 140, 140,
+ 148, 148, 148, 148, 148, 148, 148, 148, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 165, 165, 165, 165, 165, 165, 165, 165, 173, 173, 173, 173, 173, 173, 173,
+ 173, 181, 181, 181, 181, 181, 181, 181, 181, 189, 189, 189, 189, 189, 189, 189,
+ 189, 189, 198, 198, 198, 198, 198, 198, 198, 198, 206, 206, 206, 206, 206, 206,
+ 206, 206, 214, 214, 214, 214, 214, 214, 214, 214, 222, 222, 222, 222, 222, 222,
+ 222, 222, 222, 231, 231, 231, 231, 231, 231, 231, 231, 239, 239, 239, 239, 239,
+ 239, 239, 239, 247, 247, 247, 247, 247, 247, 247, 247, 255, 255, 255, 255, 255
+ },
+ {
+ 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 13, 13, 13, 13, 13, 13,
+ 13, 19, 19, 19, 19, 19, 19, 26, 26, 26, 26, 26, 26, 26, 32, 32,
+ 32, 32, 32, 32, 39, 39, 39, 39, 39, 39, 39, 45, 45, 45, 45, 45,
+ 45, 52, 52, 52, 52, 52, 52, 52, 58, 58, 58, 58, 58, 58, 65, 65,
+ 65, 65, 65, 65, 65, 71, 71, 71, 71, 71, 71, 78, 78, 78, 78, 78,
+ 78, 78, 84, 84, 84, 84, 84, 84, 91, 91, 91, 91, 91, 91, 91, 97,
+ 97, 97, 97, 97, 97, 104, 104, 104, 104, 104, 104, 104, 110, 110, 110, 110,
+ 110, 110, 117, 117, 117, 117, 117, 117, 117, 123, 123, 123, 123, 123, 123, 123,
+ 132, 132, 132, 132, 132, 132, 132, 138, 138, 138, 138, 138, 138, 138, 145, 145,
+ 145, 145, 145, 145, 151, 151, 151, 151, 151, 151, 151, 158, 158, 158, 158, 158,
+ 158, 164, 164, 164, 164, 164, 164, 164, 171, 171, 171, 171, 171, 171, 177, 177,
+ 177, 177, 177, 177, 177, 184, 184, 184, 184, 184, 184, 190, 190, 190, 190, 190,
+ 190, 190, 197, 197, 197, 197, 197, 197, 203, 203, 203, 203, 203, 203, 203, 210,
+ 210, 210, 210, 210, 210, 216, 216, 216, 216, 216, 216, 216, 223, 223, 223, 223,
+ 223, 223, 229, 229, 229, 229, 229, 229, 229, 236, 236, 236, 236, 236, 236, 242,
+ 242, 242, 242, 242, 242, 242, 249, 249, 249, 249, 249, 249, 255, 255, 255, 255
+ },
+ {
+ 0, 0, 0, 5, 5, 5, 5, 5, 5, 11, 11, 11, 11, 11, 16, 16,
+ 16, 16, 16, 21, 21, 21, 21, 21, 21, 27, 27, 27, 27, 27, 32, 32,
+ 32, 32, 32, 32, 38, 38, 38, 38, 38, 43, 43, 43, 43, 43, 48, 48,
+ 48, 48, 48, 48, 54, 54, 54, 54, 54, 59, 59, 59, 59, 59, 59, 65,
+ 65, 65, 65, 65, 70, 70, 70, 70, 70, 70, 76, 76, 76, 76, 76, 81,
+ 81, 81, 81, 81, 86, 86, 86, 86, 86, 86, 92, 92, 92, 92, 92, 97,
+ 97, 97, 97, 97, 97, 103, 103, 103, 103, 103, 108, 108, 108, 108, 108, 113,
+ 113, 113, 113, 113, 113, 119, 119, 119, 119, 119, 124, 124, 124, 124, 124, 124,
+ 131, 131, 131, 131, 131, 131, 136, 136, 136, 136, 136, 142, 142, 142, 142, 142,
+ 142, 147, 147, 147, 147, 147, 152, 152, 152, 152, 152, 158, 158, 158, 158, 158,
+ 158, 163, 163, 163, 163, 163, 169, 169, 169, 169, 169, 169, 174, 174, 174, 174,
+ 174, 179, 179, 179, 179, 179, 185, 185, 185, 185, 185, 185, 190, 190, 190, 190,
+ 190, 196, 196, 196, 196, 196, 196, 201, 201, 201, 201, 201, 207, 207, 207, 207,
+ 207, 207, 212, 212, 212, 212, 212, 217, 217, 217, 217, 217, 223, 223, 223, 223,
+ 223, 223, 228, 228, 228, 228, 228, 234, 234, 234, 234, 234, 234, 239, 239, 239,
+ 239, 239, 244, 244, 244, 244, 244, 250, 250, 250, 250, 250, 250, 255, 255, 255
+ },
+ {
+ 0, 0, 0, 4, 4, 4, 4, 8, 8, 8, 8, 12, 12, 12, 12, 16,
+ 16, 16, 16, 20, 20, 20, 20, 24, 24, 24, 24, 28, 28, 28, 28, 32,
+ 32, 32, 32, 36, 36, 36, 36, 40, 40, 40, 40, 44, 44, 44, 44, 48,
+ 48, 48, 48, 52, 52, 52, 52, 56, 56, 56, 56, 60, 60, 60, 60, 65,
+ 65, 65, 65, 65, 69, 69, 69, 69, 73, 73, 73, 73, 77, 77, 77, 77,
+ 81, 81, 81, 81, 85, 85, 85, 85, 89, 89, 89, 89, 93, 93, 93, 93,
+ 97, 97, 97, 97, 101, 101, 101, 101, 105, 105, 105, 105, 109, 109, 109, 109,
+ 113, 113, 113, 113, 117, 117, 117, 117, 121, 121, 121, 121, 125, 125, 125, 125,
+ 130, 130, 130, 130, 134, 134, 134, 134, 138, 138, 138, 138, 142, 142, 142, 142,
+ 146, 146, 146, 146, 150, 150, 150, 150, 154, 154, 154, 154, 158, 158, 158, 158,
+ 162, 162, 162, 162, 166, 166, 166, 166, 170, 170, 170, 170, 174, 174, 174, 174,
+ 178, 178, 178, 178, 182, 182, 182, 182, 186, 186, 186, 186, 190, 190, 190, 190,
+ 190, 195, 195, 195, 195, 199, 199, 199, 199, 203, 203, 203, 203, 207, 207, 207,
+ 207, 211, 211, 211, 211, 215, 215, 215, 215, 219, 219, 219, 219, 223, 223, 223,
+ 223, 227, 227, 227, 227, 231, 231, 231, 231, 235, 235, 235, 235, 239, 239, 239,
+ 239, 243, 243, 243, 243, 247, 247, 247, 247, 251, 251, 251, 251, 255, 255, 255
+ },
+ {
+ 0, 0, 3, 3, 3, 6, 6, 6, 9, 9, 9, 9, 13, 13, 13, 16,
+ 16, 16, 19, 19, 19, 22, 22, 22, 25, 25, 25, 25, 29, 29, 29, 32,
+ 32, 32, 35, 35, 35, 38, 38, 38, 38, 42, 42, 42, 45, 45, 45, 48,
+ 48, 48, 51, 51, 51, 54, 54, 54, 54, 58, 58, 58, 61, 61, 61, 64,
+ 64, 64, 67, 67, 67, 67, 71, 71, 71, 74, 74, 74, 77, 77, 77, 80,
+ 80, 80, 83, 83, 83, 83, 87, 87, 87, 90, 90, 90, 93, 93, 93, 96,
+ 96, 96, 96, 100, 100, 100, 103, 103, 103, 106, 106, 106, 109, 109, 109, 112,
+ 112, 112, 112, 116, 116, 116, 119, 119, 119, 122, 122, 122, 125, 125, 125, 125,
+ 130, 130, 130, 130, 133, 133, 133, 136, 136, 136, 139, 139, 139, 143, 143, 143,
+ 143, 146, 146, 146, 149, 149, 149, 152, 152, 152, 155, 155, 155, 159, 159, 159,
+ 159, 162, 162, 162, 165, 165, 165, 168, 168, 168, 172, 172, 172, 172, 175, 175,
+ 175, 178, 178, 178, 181, 181, 181, 184, 184, 184, 188, 188, 188, 188, 191, 191,
+ 191, 194, 194, 194, 197, 197, 197, 201, 201, 201, 201, 204, 204, 204, 207, 207,
+ 207, 210, 210, 210, 213, 213, 213, 217, 217, 217, 217, 220, 220, 220, 223, 223,
+ 223, 226, 226, 226, 230, 230, 230, 230, 233, 233, 233, 236, 236, 236, 239, 239,
+ 239, 242, 242, 242, 246, 246, 246, 246, 249, 249, 249, 252, 252, 252, 255, 255
+ },
+ {
+ 0, 0, 2, 2, 5, 5, 5, 8, 8, 8, 10, 10, 13, 13, 13, 16,
+ 16, 16, 18, 18, 21, 21, 21, 24, 24, 24, 26, 26, 29, 29, 29, 32,
+ 32, 32, 35, 35, 35, 37, 37, 40, 40, 40, 43, 43, 43, 45, 45, 48,
+ 48, 48, 51, 51, 51, 53, 53, 56, 56, 56, 59, 59, 59, 61, 61, 64,
+ 64, 64, 67, 67, 67, 70, 70, 70, 72, 72, 75, 75, 75, 78, 78, 78,
+ 80, 80, 83, 83, 83, 86, 86, 86, 88, 88, 91, 91, 91, 94, 94, 94,
+ 96, 96, 99, 99, 99, 102, 102, 102, 104, 104, 107, 107, 107, 110, 110, 110,
+ 112, 112, 115, 115, 115, 118, 118, 118, 120, 120, 123, 123, 123, 126, 126, 126,
+ 129, 129, 129, 132, 132, 132, 135, 135, 137, 137, 137, 140, 140, 140, 143, 143,
+ 145, 145, 145, 148, 148, 148, 151, 151, 153, 153, 153, 156, 156, 156, 159, 159,
+ 161, 161, 161, 164, 164, 164, 167, 167, 169, 169, 169, 172, 172, 172, 175, 175,
+ 177, 177, 177, 180, 180, 180, 183, 183, 185, 185, 185, 188, 188, 188, 191, 191,
+ 191, 194, 194, 196, 196, 196, 199, 199, 199, 202, 202, 204, 204, 204, 207, 207,
+ 207, 210, 210, 212, 212, 212, 215, 215, 215, 218, 218, 220, 220, 220, 223, 223,
+ 223, 226, 226, 226, 229, 229, 231, 231, 231, 234, 234, 234, 237, 237, 239, 239,
+ 239, 242, 242, 242, 245, 245, 247, 247, 247, 250, 250, 250, 253, 253, 255, 255
+ },
+ {
+ 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14,
+ 16, 16, 18, 18, 20, 20, 22, 22, 24, 24, 26, 26, 28, 28, 30, 30,
+ 32, 32, 34, 34, 36, 36, 38, 38, 40, 40, 42, 42, 44, 44, 46, 46,
+ 48, 48, 50, 50, 52, 52, 54, 54, 56, 56, 58, 58, 60, 60, 62, 62,
+ 64, 64, 66, 66, 68, 68, 70, 70, 72, 72, 74, 74, 76, 76, 78, 78,
+ 80, 80, 82, 82, 84, 84, 86, 86, 88, 88, 90, 90, 92, 92, 94, 94,
+ 96, 96, 98, 98, 100, 100, 102, 102, 104, 104, 106, 106, 108, 108, 110, 110,
+ 112, 112, 114, 114, 116, 116, 118, 118, 120, 120, 122, 122, 124, 124, 126, 126,
+ 129, 129, 131, 131, 133, 133, 135, 135, 137, 137, 139, 139, 141, 141, 143, 143,
+ 145, 145, 147, 147, 149, 149, 151, 151, 153, 153, 155, 155, 157, 157, 159, 159,
+ 161, 161, 163, 163, 165, 165, 167, 167, 169, 169, 171, 171, 173, 173, 175, 175,
+ 177, 177, 179, 179, 181, 181, 183, 183, 185, 185, 187, 187, 189, 189, 191, 191,
+ 193, 193, 195, 195, 197, 197, 199, 199, 201, 201, 203, 203, 205, 205, 207, 207,
+ 209, 209, 211, 211, 213, 213, 215, 215, 217, 217, 219, 219, 221, 221, 223, 223,
+ 225, 225, 227, 227, 229, 229, 231, 231, 233, 233, 235, 235, 237, 237, 239, 239,
+ 241, 241, 243, 243, 245, 245, 247, 247, 249, 249, 251, 251, 253, 253, 255, 255
+ },
+ {
+ 0, 1, 1, 3, 4, 4, 6, 6, 8, 9, 9, 11, 12, 12, 14, 14,
+ 16, 17, 17, 19, 20, 20, 22, 22, 24, 25, 25, 27, 28, 28, 30, 30,
+ 32, 33, 33, 35, 36, 36, 38, 38, 40, 41, 41, 43, 44, 44, 46, 46,
+ 48, 49, 49, 51, 52, 52, 54, 54, 56, 57, 57, 59, 60, 60, 62, 62,
+ 64, 65, 65, 67, 68, 68, 70, 70, 72, 73, 73, 75, 76, 76, 78, 78,
+ 80, 81, 81, 83, 84, 84, 86, 86, 88, 89, 89, 91, 92, 92, 94, 94,
+ 96, 97, 97, 99, 100, 100, 102, 102, 104, 105, 105, 107, 108, 108, 110, 110,
+ 112, 113, 113, 115, 116, 116, 118, 118, 120, 121, 121, 123, 124, 124, 126, 126,
+ 129, 129, 131, 131, 132, 134, 134, 135, 137, 137, 139, 139, 140, 142, 142, 143,
+ 145, 145, 147, 147, 148, 150, 150, 151, 153, 153, 155, 155, 156, 158, 158, 159,
+ 161, 161, 163, 163, 164, 166, 166, 167, 169, 169, 171, 171, 172, 174, 174, 175,
+ 177, 177, 179, 179, 180, 182, 182, 183, 185, 185, 187, 187, 188, 190, 190, 191,
+ 193, 193, 195, 195, 196, 198, 198, 199, 201, 201, 203, 203, 204, 206, 206, 207,
+ 209, 209, 211, 211, 212, 214, 214, 215, 217, 217, 219, 219, 220, 222, 222, 223,
+ 225, 225, 227, 227, 228, 230, 230, 231, 233, 233, 235, 235, 236, 238, 238, 239,
+ 241, 241, 243, 243, 244, 246, 246, 247, 249, 249, 251, 251, 252, 254, 254, 255
+ },
+ {
+ 0, 1, 2, 2, 4, 5, 6, 6, 8, 9, 10, 10, 12, 13, 14, 14,
+ 16, 17, 18, 18, 20, 21, 22, 22, 24, 25, 26, 26, 28, 29, 30, 30,
+ 32, 33, 34, 34, 36, 37, 38, 38, 40, 41, 42, 42, 44, 45, 46, 46,
+ 48, 49, 50, 50, 52, 53, 54, 54, 56, 57, 58, 58, 60, 61, 62, 62,
+ 64, 65, 66, 66, 68, 69, 70, 70, 72, 73, 74, 74, 76, 77, 78, 78,
+ 80, 81, 82, 82, 84, 85, 86, 86, 88, 89, 90, 90, 92, 93, 94, 94,
+ 96, 97, 98, 98, 100, 101, 102, 102, 104, 105, 106, 106, 108, 109, 110, 110,
+ 112, 113, 114, 114, 116, 117, 118, 118, 120, 121, 122, 122, 124, 125, 126, 126,
+ 129, 129, 130, 131, 133, 133, 134, 135, 137, 137, 138, 139, 141, 141, 142, 143,
+ 145, 145, 146, 147, 149, 149, 150, 151, 153, 153, 154, 155, 157, 157, 158, 159,
+ 161, 161, 162, 163, 165, 165, 166, 167, 169, 169, 170, 171, 173, 173, 174, 175,
+ 177, 177, 178, 179, 181, 181, 182, 183, 185, 185, 186, 187, 189, 189, 190, 191,
+ 193, 193, 194, 195, 197, 197, 198, 199, 201, 201, 202, 203, 205, 205, 206, 207,
+ 209, 209, 210, 211, 213, 213, 214, 215, 217, 217, 218, 219, 221, 221, 222, 223,
+ 225, 225, 226, 227, 229, 229, 230, 231, 233, 233, 234, 235, 237, 237, 238, 239,
+ 241, 241, 242, 243, 245, 245, 246, 247, 249, 249, 250, 251, 253, 253, 254, 255
+ },
+ {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
+ 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
+ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
+ 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
+ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
+ 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
+ 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
+ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
+ 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
+ }
+};
+
+// Starts from QUANT_6
+// Scrambled
+const uint8_t color_uquant_to_scrambled_pquant_tables[17][256] {
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 1, 1, 1, 1, 1, 1
+ },
+ {
+ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
+ 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6,
+ 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10,
+ 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13,
+ 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
+ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17,
+ 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21,
+ 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25,
+ 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29,
+ 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31
+ },
+ {
+ 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16,
+ 16, 24, 24, 24, 24, 24, 24, 32, 32, 32, 32, 32, 32, 32, 2, 2,
+ 2, 2, 2, 2, 10, 10, 10, 10, 10, 10, 10, 18, 18, 18, 18, 18,
+ 18, 26, 26, 26, 26, 26, 26, 26, 34, 34, 34, 34, 34, 34, 4, 4,
+ 4, 4, 4, 4, 4, 12, 12, 12, 12, 12, 12, 20, 20, 20, 20, 20,
+ 20, 20, 28, 28, 28, 28, 28, 28, 36, 36, 36, 36, 36, 36, 36, 6,
+ 6, 6, 6, 6, 6, 14, 14, 14, 14, 14, 14, 14, 22, 22, 22, 22,
+ 22, 22, 30, 30, 30, 30, 30, 30, 30, 38, 38, 38, 38, 38, 38, 38,
+ 39, 39, 39, 39, 39, 39, 39, 31, 31, 31, 31, 31, 31, 31, 23, 23,
+ 23, 23, 23, 23, 15, 15, 15, 15, 15, 15, 15, 7, 7, 7, 7, 7,
+ 7, 37, 37, 37, 37, 37, 37, 37, 29, 29, 29, 29, 29, 29, 21, 21,
+ 21, 21, 21, 21, 21, 13, 13, 13, 13, 13, 13, 5, 5, 5, 5, 5,
+ 5, 5, 35, 35, 35, 35, 35, 35, 27, 27, 27, 27, 27, 27, 27, 19,
+ 19, 19, 19, 19, 19, 11, 11, 11, 11, 11, 11, 11, 3, 3, 3, 3,
+ 3, 3, 33, 33, 33, 33, 33, 33, 33, 25, 25, 25, 25, 25, 25, 17,
+ 17, 17, 17, 17, 17, 17, 9, 9, 9, 9, 9, 9, 1, 1, 1, 1
+ },
+ {
+ 0, 0, 0, 16, 16, 16, 16, 16, 16, 32, 32, 32, 32, 32, 2, 2,
+ 2, 2, 2, 18, 18, 18, 18, 18, 18, 34, 34, 34, 34, 34, 4, 4,
+ 4, 4, 4, 4, 20, 20, 20, 20, 20, 36, 36, 36, 36, 36, 6, 6,
+ 6, 6, 6, 6, 22, 22, 22, 22, 22, 38, 38, 38, 38, 38, 38, 8,
+ 8, 8, 8, 8, 24, 24, 24, 24, 24, 24, 40, 40, 40, 40, 40, 10,
+ 10, 10, 10, 10, 26, 26, 26, 26, 26, 26, 42, 42, 42, 42, 42, 12,
+ 12, 12, 12, 12, 12, 28, 28, 28, 28, 28, 44, 44, 44, 44, 44, 14,
+ 14, 14, 14, 14, 14, 30, 30, 30, 30, 30, 46, 46, 46, 46, 46, 46,
+ 47, 47, 47, 47, 47, 47, 31, 31, 31, 31, 31, 15, 15, 15, 15, 15,
+ 15, 45, 45, 45, 45, 45, 29, 29, 29, 29, 29, 13, 13, 13, 13, 13,
+ 13, 43, 43, 43, 43, 43, 27, 27, 27, 27, 27, 27, 11, 11, 11, 11,
+ 11, 41, 41, 41, 41, 41, 25, 25, 25, 25, 25, 25, 9, 9, 9, 9,
+ 9, 39, 39, 39, 39, 39, 39, 23, 23, 23, 23, 23, 7, 7, 7, 7,
+ 7, 7, 37, 37, 37, 37, 37, 21, 21, 21, 21, 21, 5, 5, 5, 5,
+ 5, 5, 35, 35, 35, 35, 35, 19, 19, 19, 19, 19, 19, 3, 3, 3,
+ 3, 3, 33, 33, 33, 33, 33, 17, 17, 17, 17, 17, 17, 1, 1, 1
+ },
+ {
+ 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4,
+ 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8,
+ 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12,
+ 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16,
+ 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19,
+ 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23,
+ 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27,
+ 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31,
+ 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35,
+ 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39,
+ 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43,
+ 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47,
+ 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51,
+ 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55,
+ 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59,
+ 59, 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63
+ },
+ {
+ 0, 0, 16, 16, 16, 32, 32, 32, 48, 48, 48, 48, 64, 64, 64, 2,
+ 2, 2, 18, 18, 18, 34, 34, 34, 50, 50, 50, 50, 66, 66, 66, 4,
+ 4, 4, 20, 20, 20, 36, 36, 36, 36, 52, 52, 52, 68, 68, 68, 6,
+ 6, 6, 22, 22, 22, 38, 38, 38, 38, 54, 54, 54, 70, 70, 70, 8,
+ 8, 8, 24, 24, 24, 24, 40, 40, 40, 56, 56, 56, 72, 72, 72, 10,
+ 10, 10, 26, 26, 26, 26, 42, 42, 42, 58, 58, 58, 74, 74, 74, 12,
+ 12, 12, 12, 28, 28, 28, 44, 44, 44, 60, 60, 60, 76, 76, 76, 14,
+ 14, 14, 14, 30, 30, 30, 46, 46, 46, 62, 62, 62, 78, 78, 78, 78,
+ 79, 79, 79, 79, 63, 63, 63, 47, 47, 47, 31, 31, 31, 15, 15, 15,
+ 15, 77, 77, 77, 61, 61, 61, 45, 45, 45, 29, 29, 29, 13, 13, 13,
+ 13, 75, 75, 75, 59, 59, 59, 43, 43, 43, 27, 27, 27, 27, 11, 11,
+ 11, 73, 73, 73, 57, 57, 57, 41, 41, 41, 25, 25, 25, 25, 9, 9,
+ 9, 71, 71, 71, 55, 55, 55, 39, 39, 39, 39, 23, 23, 23, 7, 7,
+ 7, 69, 69, 69, 53, 53, 53, 37, 37, 37, 37, 21, 21, 21, 5, 5,
+ 5, 67, 67, 67, 51, 51, 51, 51, 35, 35, 35, 19, 19, 19, 3, 3,
+ 3, 65, 65, 65, 49, 49, 49, 49, 33, 33, 33, 17, 17, 17, 1, 1
+ },
+ {
+ 0, 0, 32, 32, 64, 64, 64, 2, 2, 2, 34, 34, 66, 66, 66, 4,
+ 4, 4, 36, 36, 68, 68, 68, 6, 6, 6, 38, 38, 70, 70, 70, 8,
+ 8, 8, 40, 40, 40, 72, 72, 10, 10, 10, 42, 42, 42, 74, 74, 12,
+ 12, 12, 44, 44, 44, 76, 76, 14, 14, 14, 46, 46, 46, 78, 78, 16,
+ 16, 16, 48, 48, 48, 80, 80, 80, 18, 18, 50, 50, 50, 82, 82, 82,
+ 20, 20, 52, 52, 52, 84, 84, 84, 22, 22, 54, 54, 54, 86, 86, 86,
+ 24, 24, 56, 56, 56, 88, 88, 88, 26, 26, 58, 58, 58, 90, 90, 90,
+ 28, 28, 60, 60, 60, 92, 92, 92, 30, 30, 62, 62, 62, 94, 94, 94,
+ 95, 95, 95, 63, 63, 63, 31, 31, 93, 93, 93, 61, 61, 61, 29, 29,
+ 91, 91, 91, 59, 59, 59, 27, 27, 89, 89, 89, 57, 57, 57, 25, 25,
+ 87, 87, 87, 55, 55, 55, 23, 23, 85, 85, 85, 53, 53, 53, 21, 21,
+ 83, 83, 83, 51, 51, 51, 19, 19, 81, 81, 81, 49, 49, 49, 17, 17,
+ 17, 79, 79, 47, 47, 47, 15, 15, 15, 77, 77, 45, 45, 45, 13, 13,
+ 13, 75, 75, 43, 43, 43, 11, 11, 11, 73, 73, 41, 41, 41, 9, 9,
+ 9, 71, 71, 71, 39, 39, 7, 7, 7, 69, 69, 69, 37, 37, 5, 5,
+ 5, 67, 67, 67, 35, 35, 3, 3, 3, 65, 65, 65, 33, 33, 1, 1
+ },
+ {
+ 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7,
+ 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15,
+ 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23,
+ 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31,
+ 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39,
+ 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47,
+ 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55,
+ 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63,
+ 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71,
+ 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79,
+ 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87,
+ 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95,
+ 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103,
+ 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111,
+ 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119,
+ 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 127
+ },
+ {
+ 0, 32, 32, 64, 96, 96, 128, 128, 2, 34, 34, 66, 98, 98, 130, 130,
+ 4, 36, 36, 68, 100, 100, 132, 132, 6, 38, 38, 70, 102, 102, 134, 134,
+ 8, 40, 40, 72, 104, 104, 136, 136, 10, 42, 42, 74, 106, 106, 138, 138,
+ 12, 44, 44, 76, 108, 108, 140, 140, 14, 46, 46, 78, 110, 110, 142, 142,
+ 16, 48, 48, 80, 112, 112, 144, 144, 18, 50, 50, 82, 114, 114, 146, 146,
+ 20, 52, 52, 84, 116, 116, 148, 148, 22, 54, 54, 86, 118, 118, 150, 150,
+ 24, 56, 56, 88, 120, 120, 152, 152, 26, 58, 58, 90, 122, 122, 154, 154,
+ 28, 60, 60, 92, 124, 124, 156, 156, 30, 62, 62, 94, 126, 126, 158, 158,
+ 159, 159, 127, 127, 95, 63, 63, 31, 157, 157, 125, 125, 93, 61, 61, 29,
+ 155, 155, 123, 123, 91, 59, 59, 27, 153, 153, 121, 121, 89, 57, 57, 25,
+ 151, 151, 119, 119, 87, 55, 55, 23, 149, 149, 117, 117, 85, 53, 53, 21,
+ 147, 147, 115, 115, 83, 51, 51, 19, 145, 145, 113, 113, 81, 49, 49, 17,
+ 143, 143, 111, 111, 79, 47, 47, 15, 141, 141, 109, 109, 77, 45, 45, 13,
+ 139, 139, 107, 107, 75, 43, 43, 11, 137, 137, 105, 105, 73, 41, 41, 9,
+ 135, 135, 103, 103, 71, 39, 39, 7, 133, 133, 101, 101, 69, 37, 37, 5,
+ 131, 131, 99, 99, 67, 35, 35, 3, 129, 129, 97, 97, 65, 33, 33, 1
+ },
+ {
+ 0, 64, 128, 128, 2, 66, 130, 130, 4, 68, 132, 132, 6, 70, 134, 134,
+ 8, 72, 136, 136, 10, 74, 138, 138, 12, 76, 140, 140, 14, 78, 142, 142,
+ 16, 80, 144, 144, 18, 82, 146, 146, 20, 84, 148, 148, 22, 86, 150, 150,
+ 24, 88, 152, 152, 26, 90, 154, 154, 28, 92, 156, 156, 30, 94, 158, 158,
+ 32, 96, 160, 160, 34, 98, 162, 162, 36, 100, 164, 164, 38, 102, 166, 166,
+ 40, 104, 168, 168, 42, 106, 170, 170, 44, 108, 172, 172, 46, 110, 174, 174,
+ 48, 112, 176, 176, 50, 114, 178, 178, 52, 116, 180, 180, 54, 118, 182, 182,
+ 56, 120, 184, 184, 58, 122, 186, 186, 60, 124, 188, 188, 62, 126, 190, 190,
+ 191, 191, 127, 63, 189, 189, 125, 61, 187, 187, 123, 59, 185, 185, 121, 57,
+ 183, 183, 119, 55, 181, 181, 117, 53, 179, 179, 115, 51, 177, 177, 113, 49,
+ 175, 175, 111, 47, 173, 173, 109, 45, 171, 171, 107, 43, 169, 169, 105, 41,
+ 167, 167, 103, 39, 165, 165, 101, 37, 163, 163, 99, 35, 161, 161, 97, 33,
+ 159, 159, 95, 31, 157, 157, 93, 29, 155, 155, 91, 27, 153, 153, 89, 25,
+ 151, 151, 87, 23, 149, 149, 85, 21, 147, 147, 83, 19, 145, 145, 81, 17,
+ 143, 143, 79, 15, 141, 141, 77, 13, 139, 139, 75, 11, 137, 137, 73, 9,
+ 135, 135, 71, 7, 133, 133, 69, 5, 131, 131, 67, 3, 129, 129, 65, 1
+ },
+ {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
+ 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
+ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
+ 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
+ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
+ 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
+ 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
+ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
+ 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
+ }
+};
+
+#endif
+
+// Starts from QUANT_6
+// Scrambled
+static const uint8_t color_scrambled_pquant_to_uquant_q6[6] {
+ 0, 255, 51, 204, 102, 153
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q8[8] {
+ 0, 36, 73, 109, 146, 182, 219, 255
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q10[10] {
+ 0, 255, 28, 227, 56, 199, 84, 171, 113, 142
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q12[12] {
+ 0, 255, 69, 186, 23, 232, 92, 163, 46, 209, 116, 139
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q16[16] {
+ 0, 17, 34, 51, 68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q20[20] {
+ 0, 255, 67, 188, 13, 242, 80, 175, 27, 228, 94, 161, 40, 215, 107, 148,
+ 54, 201, 121, 134
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q24[24] {
+ 0, 255, 33, 222, 66, 189, 99, 156, 11, 244, 44, 211, 77, 178, 110, 145,
+ 22, 233, 55, 200, 88, 167, 121, 134
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q32[32] {
+ 0, 8, 16, 24, 33, 41, 49, 57, 66, 74, 82, 90, 99, 107, 115, 123,
+ 132, 140, 148, 156, 165, 173, 181, 189, 198, 206, 214, 222, 231, 239, 247, 255
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q40[40] {
+ 0, 255, 32, 223, 65, 190, 97, 158, 6, 249, 39, 216, 71, 184, 104, 151,
+ 13, 242, 45, 210, 78, 177, 110, 145, 19, 236, 52, 203, 84, 171, 117, 138,
+ 26, 229, 58, 197, 91, 164, 123, 132
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q48[48] {
+ 0, 255, 16, 239, 32, 223, 48, 207, 65, 190, 81, 174, 97, 158, 113, 142,
+ 5, 250, 21, 234, 38, 217, 54, 201, 70, 185, 86, 169, 103, 152, 119, 136,
+ 11, 244, 27, 228, 43, 212, 59, 196, 76, 179, 92, 163, 108, 147, 124, 131
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q64[64] {
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60,
+ 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125,
+ 130, 134, 138, 142, 146, 150, 154, 158, 162, 166, 170, 174, 178, 182, 186, 190,
+ 195, 199, 203, 207, 211, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, 255,
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q80[80] {
+ 0, 255, 16, 239, 32, 223, 48, 207, 64, 191, 80, 175, 96, 159, 112, 143,
+ 3, 252, 19, 236, 35, 220, 51, 204, 67, 188, 83, 172, 100, 155, 116, 139,
+ 6, 249, 22, 233, 38, 217, 54, 201, 71, 184, 87, 168, 103, 152, 119, 136,
+ 9, 246, 25, 230, 42, 213, 58, 197, 74, 181, 90, 165, 106, 149, 122, 133,
+ 13, 242, 29, 226, 45, 210, 61, 194, 77, 178, 93, 162, 109, 146, 125, 130
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q96[96] {
+ 0, 255, 8, 247, 16, 239, 24, 231, 32, 223, 40, 215, 48, 207, 56, 199,
+ 64, 191, 72, 183, 80, 175, 88, 167, 96, 159, 104, 151, 112, 143, 120, 135,
+ 2, 253, 10, 245, 18, 237, 26, 229, 35, 220, 43, 212, 51, 204, 59, 196,
+ 67, 188, 75, 180, 83, 172, 91, 164, 99, 156, 107, 148, 115, 140, 123, 132,
+ 5, 250, 13, 242, 21, 234, 29, 226, 37, 218, 45, 210, 53, 202, 61, 194,
+ 70, 185, 78, 177, 86, 169, 94, 161, 102, 153, 110, 145, 118, 137, 126, 129
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q128[128] {
+ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
+ 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62,
+ 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94,
+ 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126,
+ 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159,
+ 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, 181, 183, 185, 187, 189, 191,
+ 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 223,
+ 225, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q160[160] {
+ 0, 255, 8, 247, 16, 239, 24, 231, 32, 223, 40, 215, 48, 207, 56, 199,
+ 64, 191, 72, 183, 80, 175, 88, 167, 96, 159, 104, 151, 112, 143, 120, 135,
+ 1, 254, 9, 246, 17, 238, 25, 230, 33, 222, 41, 214, 49, 206, 57, 198,
+ 65, 190, 73, 182, 81, 174, 89, 166, 97, 158, 105, 150, 113, 142, 121, 134,
+ 3, 252, 11, 244, 19, 236, 27, 228, 35, 220, 43, 212, 51, 204, 59, 196,
+ 67, 188, 75, 180, 83, 172, 91, 164, 99, 156, 107, 148, 115, 140, 123, 132,
+ 4, 251, 12, 243, 20, 235, 28, 227, 36, 219, 44, 211, 52, 203, 60, 195,
+ 68, 187, 76, 179, 84, 171, 92, 163, 100, 155, 108, 147, 116, 139, 124, 131,
+ 6, 249, 14, 241, 22, 233, 30, 225, 38, 217, 46, 209, 54, 201, 62, 193,
+ 70, 185, 78, 177, 86, 169, 94, 161, 102, 153, 110, 145, 118, 137, 126, 129
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q192[192] {
+ 0, 255, 4, 251, 8, 247, 12, 243, 16, 239, 20, 235, 24, 231, 28, 227,
+ 32, 223, 36, 219, 40, 215, 44, 211, 48, 207, 52, 203, 56, 199, 60, 195,
+ 64, 191, 68, 187, 72, 183, 76, 179, 80, 175, 84, 171, 88, 167, 92, 163,
+ 96, 159, 100, 155, 104, 151, 108, 147, 112, 143, 116, 139, 120, 135, 124, 131,
+ 1, 254, 5, 250, 9, 246, 13, 242, 17, 238, 21, 234, 25, 230, 29, 226,
+ 33, 222, 37, 218, 41, 214, 45, 210, 49, 206, 53, 202, 57, 198, 61, 194,
+ 65, 190, 69, 186, 73, 182, 77, 178, 81, 174, 85, 170, 89, 166, 93, 162,
+ 97, 158, 101, 154, 105, 150, 109, 146, 113, 142, 117, 138, 121, 134, 125, 130,
+ 2, 253, 6, 249, 10, 245, 14, 241, 18, 237, 22, 233, 26, 229, 30, 225,
+ 34, 221, 38, 217, 42, 213, 46, 209, 50, 205, 54, 201, 58, 197, 62, 193,
+ 66, 189, 70, 185, 74, 181, 78, 177, 82, 173, 86, 169, 90, 165, 94, 161,
+ 98, 157, 102, 153, 106, 149, 110, 145, 114, 141, 118, 137, 122, 133, 126, 129
+};
+
+static const uint8_t color_scrambled_pquant_to_uquant_q256[256] {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
+ 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
+ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
+ 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
+ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
+ 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
+ 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
+ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
+ 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
+};
+
+const uint8_t* color_scrambled_pquant_to_uquant_tables[17] {
+ color_scrambled_pquant_to_uquant_q6,
+ color_scrambled_pquant_to_uquant_q8,
+ color_scrambled_pquant_to_uquant_q10,
+ color_scrambled_pquant_to_uquant_q12,
+ color_scrambled_pquant_to_uquant_q16,
+ color_scrambled_pquant_to_uquant_q20,
+ color_scrambled_pquant_to_uquant_q24,
+ color_scrambled_pquant_to_uquant_q32,
+ color_scrambled_pquant_to_uquant_q40,
+ color_scrambled_pquant_to_uquant_q48,
+ color_scrambled_pquant_to_uquant_q64,
+ color_scrambled_pquant_to_uquant_q80,
+ color_scrambled_pquant_to_uquant_q96,
+ color_scrambled_pquant_to_uquant_q128,
+ color_scrambled_pquant_to_uquant_q160,
+ color_scrambled_pquant_to_uquant_q192,
+ color_scrambled_pquant_to_uquant_q256
+};
+
+// The quant_mode_table[integer_count/2][bits] gives us the quantization level for a given integer
+// count and number of bits that the integer may fit into.
+const int8_t quant_mode_table[10][128] {
+ {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ },
+ {
+ -1, -1, 0, 0, 2, 3, 5, 6, 8, 9, 11, 12, 14, 15, 17, 18,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
+ },
+ {
+ -1, -1, -1, -1, 0, 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7,
+ 8, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 17, 17, 18, 19,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
+ },
+ {
+ -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3,
+ 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
+ 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
+ },
+ {
+ -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1,
+ 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7,
+ 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13,
+ 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 19, 19, 19,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
+ },
+ {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5,
+ 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10,
+ 10, 10, 11, 11, 11, 11, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14,
+ 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 19, 19, 19, 19,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
+ },
+ {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
+ 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
+ 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11,
+ 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15,
+ 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
+ },
+ {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2,
+ 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6,
+ 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9,
+ 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13,
+ 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16,
+ 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 19,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
+ },
+ {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4,
+ 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7,
+ 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10,
+ 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13,
+ 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16,
+ 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19
+ },
+ {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
+ 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4,
+ 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6,
+ 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9,
+ 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11,
+ 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14,
+ 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17
+ }
+};
diff --git a/thirdparty/astcenc/astcenc_symbolic_physical.cpp b/thirdparty/astcenc/astcenc_symbolic_physical.cpp
new file mode 100644
index 0000000000..80221a6013
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_symbolic_physical.cpp
@@ -0,0 +1,534 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2021 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Functions for converting between symbolic and physical encodings.
+ */
+
+#include "astcenc_internal.h"
+
+#include <cassert>
+
+/**
+ * @brief Write up to 8 bits at an arbitrary bit offset.
+ *
+ * The stored value is at most 8 bits, but can be stored at an offset of between 0 and 7 bits so
+ * may span two separate bytes in memory.
+ *
+ * @param value The value to write.
+ * @param bitcount The number of bits to write, starting from LSB.
+ * @param bitoffset The bit offset to store at, between 0 and 7.
+ * @param[in,out] ptr The data pointer to write to.
+ */
+static inline void write_bits(
+ int value,
+ int bitcount,
+ int bitoffset,
+ uint8_t* ptr
+) {
+ int mask = (1 << bitcount) - 1;
+ value &= mask;
+ ptr += bitoffset >> 3;
+ bitoffset &= 7;
+ value <<= bitoffset;
+ mask <<= bitoffset;
+ mask = ~mask;
+
+ ptr[0] &= mask;
+ ptr[0] |= value;
+ ptr[1] &= mask >> 8;
+ ptr[1] |= value >> 8;
+}
+
+/**
+ * @brief Read up to 8 bits at an arbitrary bit offset.
+ *
+ * The stored value is at most 8 bits, but can be stored at an offset of between 0 and 7 bits so may
+ * span two separate bytes in memory.
+ *
+ * @param bitcount The number of bits to read.
+ * @param bitoffset The bit offset to read from, between 0 and 7.
+ * @param[in,out] ptr The data pointer to read from.
+ *
+ * @return The read value.
+ */
+static inline int read_bits(
+ int bitcount,
+ int bitoffset,
+ const uint8_t* ptr
+) {
+ int mask = (1 << bitcount) - 1;
+ ptr += bitoffset >> 3;
+ bitoffset &= 7;
+ int value = ptr[0] | (ptr[1] << 8);
+ value >>= bitoffset;
+ value &= mask;
+ return value;
+}
+
+/**
+ * @brief Reverse bits in a byte.
+ *
+ * @param p The value to reverse.
+ *
+ * @return The reversed result.
+ */
+static inline int bitrev8(int p)
+{
+ p = ((p & 0x0F) << 4) | ((p >> 4) & 0x0F);
+ p = ((p & 0x33) << 2) | ((p >> 2) & 0x33);
+ p = ((p & 0x55) << 1) | ((p >> 1) & 0x55);
+ return p;
+}
+
+/* See header for documentation. */
+void symbolic_to_physical(
+ const block_size_descriptor& bsd,
+ const symbolic_compressed_block& scb,
+ physical_compressed_block& pcb
+) {
+ assert(scb.block_type != SYM_BTYPE_ERROR);
+
+ // Constant color block using UNORM16 colors
+ if (scb.block_type == SYM_BTYPE_CONST_U16)
+ {
+ // There is currently no attempt to coalesce larger void-extents
+ static const uint8_t cbytes[8] { 0xFC, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
+ for (unsigned int i = 0; i < 8; i++)
+ {
+ pcb.data[i] = cbytes[i];
+ }
+
+ for (unsigned int i = 0; i < BLOCK_MAX_COMPONENTS; i++)
+ {
+ pcb.data[2 * i + 8] = scb.constant_color[i] & 0xFF;
+ pcb.data[2 * i + 9] = (scb.constant_color[i] >> 8) & 0xFF;
+ }
+
+ return;
+ }
+
+ // Constant color block using FP16 colors
+ if (scb.block_type == SYM_BTYPE_CONST_F16)
+ {
+ // There is currently no attempt to coalesce larger void-extents
+ static const uint8_t cbytes[8] { 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
+ for (unsigned int i = 0; i < 8; i++)
+ {
+ pcb.data[i] = cbytes[i];
+ }
+
+ for (unsigned int i = 0; i < BLOCK_MAX_COMPONENTS; i++)
+ {
+ pcb.data[2 * i + 8] = scb.constant_color[i] & 0xFF;
+ pcb.data[2 * i + 9] = (scb.constant_color[i] >> 8) & 0xFF;
+ }
+
+ return;
+ }
+
+ unsigned int partition_count = scb.partition_count;
+
+ // Compress the weights.
+ // They are encoded as an ordinary integer-sequence, then bit-reversed
+ uint8_t weightbuf[16] { 0 };
+
+ const auto& bm = bsd.get_block_mode(scb.block_mode);
+ const auto& di = bsd.get_decimation_info(bm.decimation_mode);
+ int weight_count = di.weight_count;
+ quant_method weight_quant_method = bm.get_weight_quant_mode();
+ float weight_quant_levels = static_cast<float>(get_quant_level(weight_quant_method));
+ int is_dual_plane = bm.is_dual_plane;
+
+ const auto& qat = quant_and_xfer_tables[weight_quant_method];
+
+ int real_weight_count = is_dual_plane ? 2 * weight_count : weight_count;
+
+ int bits_for_weights = get_ise_sequence_bitcount(real_weight_count, weight_quant_method);
+
+ uint8_t weights[64];
+ if (is_dual_plane)
+ {
+ for (int i = 0; i < weight_count; i++)
+ {
+ float uqw = static_cast<float>(scb.weights[i]);
+ float qw = (uqw / 64.0f) * (weight_quant_levels - 1.0f);
+ int qwi = static_cast<int>(qw + 0.5f);
+ weights[2 * i] = qat.scramble_map[qwi];
+
+ uqw = static_cast<float>(scb.weights[i + WEIGHTS_PLANE2_OFFSET]);
+ qw = (uqw / 64.0f) * (weight_quant_levels - 1.0f);
+ qwi = static_cast<int>(qw + 0.5f);
+ weights[2 * i + 1] = qat.scramble_map[qwi];
+ }
+ }
+ else
+ {
+ for (int i = 0; i < weight_count; i++)
+ {
+ float uqw = static_cast<float>(scb.weights[i]);
+ float qw = (uqw / 64.0f) * (weight_quant_levels - 1.0f);
+ int qwi = static_cast<int>(qw + 0.5f);
+ weights[i] = qat.scramble_map[qwi];
+ }
+ }
+
+ encode_ise(weight_quant_method, real_weight_count, weights, weightbuf, 0);
+
+ for (int i = 0; i < 16; i++)
+ {
+ pcb.data[i] = static_cast<uint8_t>(bitrev8(weightbuf[15 - i]));
+ }
+
+ write_bits(scb.block_mode, 11, 0, pcb.data);
+ write_bits(partition_count - 1, 2, 11, pcb.data);
+
+ int below_weights_pos = 128 - bits_for_weights;
+
+ // Encode partition index and color endpoint types for blocks with 2+ partitions
+ if (partition_count > 1)
+ {
+ write_bits(scb.partition_index, 6, 13, pcb.data);
+ write_bits(scb.partition_index >> 6, PARTITION_INDEX_BITS - 6, 19, pcb.data);
+
+ if (scb.color_formats_matched)
+ {
+ write_bits(scb.color_formats[0] << 2, 6, 13 + PARTITION_INDEX_BITS, pcb.data);
+ }
+ else
+ {
+ // Check endpoint types for each partition to determine the lowest class present
+ int low_class = 4;
+
+ for (unsigned int i = 0; i < partition_count; i++)
+ {
+ int class_of_format = scb.color_formats[i] >> 2;
+ low_class = astc::min(class_of_format, low_class);
+ }
+
+ if (low_class == 3)
+ {
+ low_class = 2;
+ }
+
+ int encoded_type = low_class + 1;
+ int bitpos = 2;
+
+ for (unsigned int i = 0; i < partition_count; i++)
+ {
+ int classbit_of_format = (scb.color_formats[i] >> 2) - low_class;
+ encoded_type |= classbit_of_format << bitpos;
+ bitpos++;
+ }
+
+ for (unsigned int i = 0; i < partition_count; i++)
+ {
+ int lowbits_of_format = scb.color_formats[i] & 3;
+ encoded_type |= lowbits_of_format << bitpos;
+ bitpos += 2;
+ }
+
+ int encoded_type_lowpart = encoded_type & 0x3F;
+ int encoded_type_highpart = encoded_type >> 6;
+ int encoded_type_highpart_size = (3 * partition_count) - 4;
+ int encoded_type_highpart_pos = 128 - bits_for_weights - encoded_type_highpart_size;
+ write_bits(encoded_type_lowpart, 6, 13 + PARTITION_INDEX_BITS, pcb.data);
+ write_bits(encoded_type_highpart, encoded_type_highpart_size, encoded_type_highpart_pos, pcb.data);
+ below_weights_pos -= encoded_type_highpart_size;
+ }
+ }
+ else
+ {
+ write_bits(scb.color_formats[0], 4, 13, pcb.data);
+ }
+
+ // In dual-plane mode, encode the color component of the second plane of weights
+ if (is_dual_plane)
+ {
+ write_bits(scb.plane2_component, 2, below_weights_pos - 2, pcb.data);
+ }
+
+ // Encode the color components
+ uint8_t values_to_encode[32];
+ int valuecount_to_encode = 0;
+
+ const uint8_t* pack_table = color_uquant_to_scrambled_pquant_tables[scb.quant_mode - QUANT_6];
+ for (unsigned int i = 0; i < scb.partition_count; i++)
+ {
+ int vals = 2 * (scb.color_formats[i] >> 2) + 2;
+ assert(vals <= 8);
+ for (int j = 0; j < vals; j++)
+ {
+ values_to_encode[j + valuecount_to_encode] = pack_table[scb.color_values[i][j]];
+ }
+ valuecount_to_encode += vals;
+ }
+
+ encode_ise(scb.get_color_quant_mode(), valuecount_to_encode, values_to_encode, pcb.data,
+ scb.partition_count == 1 ? 17 : 19 + PARTITION_INDEX_BITS);
+}
+
+/* See header for documentation. */
+void physical_to_symbolic(
+ const block_size_descriptor& bsd,
+ const physical_compressed_block& pcb,
+ symbolic_compressed_block& scb
+) {
+ uint8_t bswapped[16];
+
+ scb.block_type = SYM_BTYPE_NONCONST;
+
+ // Extract header fields
+ int block_mode = read_bits(11, 0, pcb.data);
+ if ((block_mode & 0x1FF) == 0x1FC)
+ {
+ // Constant color block
+
+ // Check what format the data has
+ if (block_mode & 0x200)
+ {
+ scb.block_type = SYM_BTYPE_CONST_F16;
+ }
+ else
+ {
+ scb.block_type = SYM_BTYPE_CONST_U16;
+ }
+
+ scb.partition_count = 0;
+ for (int i = 0; i < 4; i++)
+ {
+ scb.constant_color[i] = pcb.data[2 * i + 8] | (pcb.data[2 * i + 9] << 8);
+ }
+
+ // Additionally, check that the void-extent
+ if (bsd.zdim == 1)
+ {
+ // 2D void-extent
+ int rsvbits = read_bits(2, 10, pcb.data);
+ if (rsvbits != 3)
+ {
+ scb.block_type = SYM_BTYPE_ERROR;
+ return;
+ }
+
+ int vx_low_s = read_bits(8, 12, pcb.data) | (read_bits(5, 12 + 8, pcb.data) << 8);
+ int vx_high_s = read_bits(8, 25, pcb.data) | (read_bits(5, 25 + 8, pcb.data) << 8);
+ int vx_low_t = read_bits(8, 38, pcb.data) | (read_bits(5, 38 + 8, pcb.data) << 8);
+ int vx_high_t = read_bits(8, 51, pcb.data) | (read_bits(5, 51 + 8, pcb.data) << 8);
+
+ int all_ones = vx_low_s == 0x1FFF && vx_high_s == 0x1FFF && vx_low_t == 0x1FFF && vx_high_t == 0x1FFF;
+
+ if ((vx_low_s >= vx_high_s || vx_low_t >= vx_high_t) && !all_ones)
+ {
+ scb.block_type = SYM_BTYPE_ERROR;
+ return;
+ }
+ }
+ else
+ {
+ // 3D void-extent
+ int vx_low_s = read_bits(9, 10, pcb.data);
+ int vx_high_s = read_bits(9, 19, pcb.data);
+ int vx_low_t = read_bits(9, 28, pcb.data);
+ int vx_high_t = read_bits(9, 37, pcb.data);
+ int vx_low_p = read_bits(9, 46, pcb.data);
+ int vx_high_p = read_bits(9, 55, pcb.data);
+
+ int all_ones = vx_low_s == 0x1FF && vx_high_s == 0x1FF && vx_low_t == 0x1FF && vx_high_t == 0x1FF && vx_low_p == 0x1FF && vx_high_p == 0x1FF;
+
+ if ((vx_low_s >= vx_high_s || vx_low_t >= vx_high_t || vx_low_p >= vx_high_p) && !all_ones)
+ {
+ scb.block_type = SYM_BTYPE_ERROR;
+ return;
+ }
+ }
+
+ return;
+ }
+
+ unsigned int packed_index = bsd.block_mode_packed_index[block_mode];
+ if (packed_index == BLOCK_BAD_BLOCK_MODE)
+ {
+ scb.block_type = SYM_BTYPE_ERROR;
+ return;
+ }
+
+ const auto& bm = bsd.get_block_mode(block_mode);
+ const auto& di = bsd.get_decimation_info(bm.decimation_mode);
+
+ int weight_count = di.weight_count;
+ promise(weight_count > 0);
+
+ quant_method weight_quant_method = static_cast<quant_method>(bm.quant_mode);
+ int is_dual_plane = bm.is_dual_plane;
+
+ int real_weight_count = is_dual_plane ? 2 * weight_count : weight_count;
+
+ int partition_count = read_bits(2, 11, pcb.data) + 1;
+ promise(partition_count > 0);
+
+ scb.block_mode = static_cast<uint16_t>(block_mode);
+ scb.partition_count = static_cast<uint8_t>(partition_count);
+
+ for (int i = 0; i < 16; i++)
+ {
+ bswapped[i] = static_cast<uint8_t>(bitrev8(pcb.data[15 - i]));
+ }
+
+ int bits_for_weights = get_ise_sequence_bitcount(real_weight_count, weight_quant_method);
+
+ int below_weights_pos = 128 - bits_for_weights;
+
+ uint8_t indices[64];
+ const auto& qat = quant_and_xfer_tables[weight_quant_method];
+
+ decode_ise(weight_quant_method, real_weight_count, bswapped, indices, 0);
+
+ if (is_dual_plane)
+ {
+ for (int i = 0; i < weight_count; i++)
+ {
+ scb.weights[i] = qat.unscramble_and_unquant_map[indices[2 * i]];
+ scb.weights[i + WEIGHTS_PLANE2_OFFSET] = qat.unscramble_and_unquant_map[indices[2 * i + 1]];
+ }
+ }
+ else
+ {
+ for (int i = 0; i < weight_count; i++)
+ {
+ scb.weights[i] = qat.unscramble_and_unquant_map[indices[i]];
+ }
+ }
+
+ if (is_dual_plane && partition_count == 4)
+ {
+ scb.block_type = SYM_BTYPE_ERROR;
+ return;
+ }
+
+ scb.color_formats_matched = 0;
+
+ // Determine the format of each endpoint pair
+ int color_formats[BLOCK_MAX_PARTITIONS];
+ int encoded_type_highpart_size = 0;
+ if (partition_count == 1)
+ {
+ color_formats[0] = read_bits(4, 13, pcb.data);
+ scb.partition_index = 0;
+ }
+ else
+ {
+ encoded_type_highpart_size = (3 * partition_count) - 4;
+ below_weights_pos -= encoded_type_highpart_size;
+ int encoded_type = read_bits(6, 13 + PARTITION_INDEX_BITS, pcb.data) | (read_bits(encoded_type_highpart_size, below_weights_pos, pcb.data) << 6);
+ int baseclass = encoded_type & 0x3;
+ if (baseclass == 0)
+ {
+ for (int i = 0; i < partition_count; i++)
+ {
+ color_formats[i] = (encoded_type >> 2) & 0xF;
+ }
+
+ below_weights_pos += encoded_type_highpart_size;
+ scb.color_formats_matched = 1;
+ encoded_type_highpart_size = 0;
+ }
+ else
+ {
+ int bitpos = 2;
+ baseclass--;
+
+ for (int i = 0; i < partition_count; i++)
+ {
+ color_formats[i] = (((encoded_type >> bitpos) & 1) + baseclass) << 2;
+ bitpos++;
+ }
+
+ for (int i = 0; i < partition_count; i++)
+ {
+ color_formats[i] |= (encoded_type >> bitpos) & 3;
+ bitpos += 2;
+ }
+ }
+ scb.partition_index = static_cast<uint16_t>(read_bits(6, 13, pcb.data) | (read_bits(PARTITION_INDEX_BITS - 6, 19, pcb.data) << 6));
+ }
+
+ for (int i = 0; i < partition_count; i++)
+ {
+ scb.color_formats[i] = static_cast<uint8_t>(color_formats[i]);
+ }
+
+ // Determine number of color endpoint integers
+ int color_integer_count = 0;
+ for (int i = 0; i < partition_count; i++)
+ {
+ int endpoint_class = color_formats[i] >> 2;
+ color_integer_count += (endpoint_class + 1) * 2;
+ }
+
+ if (color_integer_count > 18)
+ {
+ scb.block_type = SYM_BTYPE_ERROR;
+ return;
+ }
+
+ // Determine the color endpoint format to use
+ static const int color_bits_arr[5] { -1, 115 - 4, 113 - 4 - PARTITION_INDEX_BITS, 113 - 4 - PARTITION_INDEX_BITS, 113 - 4 - PARTITION_INDEX_BITS };
+ int color_bits = color_bits_arr[partition_count] - bits_for_weights - encoded_type_highpart_size;
+ if (is_dual_plane)
+ {
+ color_bits -= 2;
+ }
+
+ if (color_bits < 0)
+ {
+ color_bits = 0;
+ }
+
+ int color_quant_level = quant_mode_table[color_integer_count >> 1][color_bits];
+ if (color_quant_level < QUANT_6)
+ {
+ scb.block_type = SYM_BTYPE_ERROR;
+ return;
+ }
+
+ // Unpack the integer color values and assign to endpoints
+ scb.quant_mode = static_cast<quant_method>(color_quant_level);
+
+ uint8_t values_to_decode[32];
+ decode_ise(static_cast<quant_method>(color_quant_level), color_integer_count, pcb.data,
+ values_to_decode, (partition_count == 1 ? 17 : 19 + PARTITION_INDEX_BITS));
+
+ int valuecount_to_decode = 0;
+ const uint8_t* unpack_table = color_scrambled_pquant_to_uquant_tables[scb.quant_mode - QUANT_6];
+ for (int i = 0; i < partition_count; i++)
+ {
+ int vals = 2 * (color_formats[i] >> 2) + 2;
+ for (int j = 0; j < vals; j++)
+ {
+ scb.color_values[i][j] = unpack_table[values_to_decode[j + valuecount_to_decode]];
+ }
+ valuecount_to_decode += vals;
+ }
+
+ // Fetch component for second-plane in the case of dual plane of weights.
+ scb.plane2_component = -1;
+ if (is_dual_plane)
+ {
+ scb.plane2_component = static_cast<int8_t>(read_bits(2, below_weights_pos - 2, pcb.data));
+ }
+}
diff --git a/thirdparty/astcenc/astcenc_vecmathlib.h b/thirdparty/astcenc/astcenc_vecmathlib.h
new file mode 100644
index 0000000000..d48f1d73ea
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_vecmathlib.h
@@ -0,0 +1,570 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2019-2022 Arm Limited
+// Copyright 2008 Jose Fonseca
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/*
+ * This module implements vector support for floats, ints, and vector lane
+ * control masks. It provides access to both explicit vector width types, and
+ * flexible N-wide types where N can be determined at compile time.
+ *
+ * The design of this module encourages use of vector length agnostic code, via
+ * the vint, vfloat, and vmask types. These will take on the widest SIMD vector
+ * with that is available at compile time. The current vector width is
+ * accessible for e.g. loop strides via the ASTCENC_SIMD_WIDTH constant.
+ *
+ * Explicit scalar types are accessible via the vint1, vfloat1, vmask1 types.
+ * These are provided primarily for prototyping and algorithm debug of VLA
+ * implementations.
+ *
+ * Explicit 4-wide types are accessible via the vint4, vfloat4, and vmask4
+ * types. These are provided for use by VLA code, but are also expected to be
+ * used as a fixed-width type and will supported a reference C++ fallback for
+ * use on platforms without SIMD intrinsics.
+ *
+ * Explicit 8-wide types are accessible via the vint8, vfloat8, and vmask8
+ * types. These are provide for use by VLA code, and are not expected to be
+ * used as a fixed-width type in normal code. No reference C implementation is
+ * provided on platforms without underlying SIMD intrinsics.
+ *
+ * With the current implementation ISA support is provided for:
+ *
+ * * 1-wide for scalar reference.
+ * * 4-wide for Armv8-A NEON.
+ * * 4-wide for x86-64 SSE2.
+ * * 4-wide for x86-64 SSE4.1.
+ * * 8-wide for x86-64 AVX2.
+ */
+
+#ifndef ASTC_VECMATHLIB_H_INCLUDED
+#define ASTC_VECMATHLIB_H_INCLUDED
+
+#if ASTCENC_SSE != 0 || ASTCENC_AVX != 0
+ #include <immintrin.h>
+#elif ASTCENC_NEON != 0
+ #include <arm_neon.h>
+#endif
+
+#if !defined(__clang__) && defined(_MSC_VER)
+ #define ASTCENC_SIMD_INLINE __forceinline
+ #define ASTCENC_NO_INLINE
+#elif defined(__GNUC__) && !defined(__clang__)
+ #define ASTCENC_SIMD_INLINE __attribute__((always_inline)) inline
+ #define ASTCENC_NO_INLINE __attribute__ ((noinline))
+#else
+ #define ASTCENC_SIMD_INLINE __attribute__((always_inline, nodebug)) inline
+ #define ASTCENC_NO_INLINE __attribute__ ((noinline))
+#endif
+
+#if ASTCENC_AVX >= 2
+ /* If we have AVX2 expose 8-wide VLA. */
+ #include "astcenc_vecmathlib_sse_4.h"
+ #include "astcenc_vecmathlib_common_4.h"
+ #include "astcenc_vecmathlib_avx2_8.h"
+
+ #define ASTCENC_SIMD_WIDTH 8
+
+ using vfloat = vfloat8;
+
+ #if defined(ASTCENC_NO_INVARIANCE)
+ using vfloatacc = vfloat8;
+ #else
+ using vfloatacc = vfloat4;
+ #endif
+
+ using vint = vint8;
+ using vmask = vmask8;
+
+ constexpr auto loada = vfloat8::loada;
+ constexpr auto load1 = vfloat8::load1;
+
+#elif ASTCENC_SSE >= 20
+ /* If we have SSE expose 4-wide VLA, and 4-wide fixed width. */
+ #include "astcenc_vecmathlib_sse_4.h"
+ #include "astcenc_vecmathlib_common_4.h"
+
+ #define ASTCENC_SIMD_WIDTH 4
+
+ using vfloat = vfloat4;
+ using vfloatacc = vfloat4;
+ using vint = vint4;
+ using vmask = vmask4;
+
+ constexpr auto loada = vfloat4::loada;
+ constexpr auto load1 = vfloat4::load1;
+
+#elif ASTCENC_NEON > 0
+ /* If we have NEON expose 4-wide VLA. */
+ #include "astcenc_vecmathlib_neon_4.h"
+ #include "astcenc_vecmathlib_common_4.h"
+
+ #define ASTCENC_SIMD_WIDTH 4
+
+ using vfloat = vfloat4;
+ using vfloatacc = vfloat4;
+ using vint = vint4;
+ using vmask = vmask4;
+
+ constexpr auto loada = vfloat4::loada;
+ constexpr auto load1 = vfloat4::load1;
+
+#else
+ // If we have nothing expose 4-wide VLA, and 4-wide fixed width.
+
+ // Note: We no longer expose the 1-wide scalar fallback because it is not
+ // invariant with the 4-wide path due to algorithms that use horizontal
+ // operations that accumulate a local vector sum before accumulating into
+ // a running sum.
+ //
+ // For 4 items adding into an accumulator using 1-wide vectors the sum is:
+ //
+ // result = ((((sum + l0) + l1) + l2) + l3)
+ //
+ // ... whereas the accumulator for a 4-wide vector sum is:
+ //
+ // result = sum + ((l0 + l2) + (l1 + l3))
+ //
+ // In "normal maths" this is the same, but the floating point reassociation
+ // differences mean that these will not produce the same result.
+
+ #include "astcenc_vecmathlib_none_4.h"
+ #include "astcenc_vecmathlib_common_4.h"
+
+ #define ASTCENC_SIMD_WIDTH 4
+
+ using vfloat = vfloat4;
+ using vfloatacc = vfloat4;
+ using vint = vint4;
+ using vmask = vmask4;
+
+ constexpr auto loada = vfloat4::loada;
+ constexpr auto load1 = vfloat4::load1;
+#endif
+
+/**
+ * @brief Round a count down to the largest multiple of 8.
+ *
+ * @param count The unrounded value.
+ *
+ * @return The rounded value.
+ */
+ASTCENC_SIMD_INLINE unsigned int round_down_to_simd_multiple_8(unsigned int count)
+{
+ return count & static_cast<unsigned int>(~(8 - 1));
+}
+
+/**
+ * @brief Round a count down to the largest multiple of 4.
+ *
+ * @param count The unrounded value.
+ *
+ * @return The rounded value.
+ */
+ASTCENC_SIMD_INLINE unsigned int round_down_to_simd_multiple_4(unsigned int count)
+{
+ return count & static_cast<unsigned int>(~(4 - 1));
+}
+
+/**
+ * @brief Round a count down to the largest multiple of the SIMD width.
+ *
+ * Assumption that the vector width is a power of two ...
+ *
+ * @param count The unrounded value.
+ *
+ * @return The rounded value.
+ */
+ASTCENC_SIMD_INLINE unsigned int round_down_to_simd_multiple_vla(unsigned int count)
+{
+ return count & static_cast<unsigned int>(~(ASTCENC_SIMD_WIDTH - 1));
+}
+
+/**
+ * @brief Round a count up to the largest multiple of the SIMD width.
+ *
+ * Assumption that the vector width is a power of two ...
+ *
+ * @param count The unrounded value.
+ *
+ * @return The rounded value.
+ */
+ASTCENC_SIMD_INLINE unsigned int round_up_to_simd_multiple_vla(unsigned int count)
+{
+ unsigned int multiples = (count + ASTCENC_SIMD_WIDTH - 1) / ASTCENC_SIMD_WIDTH;
+ return multiples * ASTCENC_SIMD_WIDTH;
+}
+
+/**
+ * @brief Return @c a with lanes negated if the @c b lane is negative.
+ */
+ASTCENC_SIMD_INLINE vfloat change_sign(vfloat a, vfloat b)
+{
+ vint ia = float_as_int(a);
+ vint ib = float_as_int(b);
+ vint sign_mask(static_cast<int>(0x80000000));
+ vint r = ia ^ (ib & sign_mask);
+ return int_as_float(r);
+}
+
+/**
+ * @brief Return fast, but approximate, vector atan(x).
+ *
+ * Max error of this implementation is 0.004883.
+ */
+ASTCENC_SIMD_INLINE vfloat atan(vfloat x)
+{
+ vmask c = abs(x) > vfloat(1.0f);
+ vfloat z = change_sign(vfloat(astc::PI_OVER_TWO), x);
+ vfloat y = select(x, vfloat(1.0f) / x, c);
+ y = y / (y * y * vfloat(0.28f) + vfloat(1.0f));
+ return select(y, z - y, c);
+}
+
+/**
+ * @brief Return fast, but approximate, vector atan2(x, y).
+ */
+ASTCENC_SIMD_INLINE vfloat atan2(vfloat y, vfloat x)
+{
+ vfloat z = atan(abs(y / x));
+ vmask xmask = vmask(float_as_int(x).m);
+ return change_sign(select_msb(z, vfloat(astc::PI) - z, xmask), y);
+}
+
+/*
+ * @brief Factory that returns a unit length 4 component vfloat4.
+ */
+static ASTCENC_SIMD_INLINE vfloat4 unit4()
+{
+ return vfloat4(0.5f);
+}
+
+/**
+ * @brief Factory that returns a unit length 3 component vfloat4.
+ */
+static ASTCENC_SIMD_INLINE vfloat4 unit3()
+{
+ float val = 0.577350258827209473f;
+ return vfloat4(val, val, val, 0.0f);
+}
+
+/**
+ * @brief Factory that returns a unit length 2 component vfloat4.
+ */
+static ASTCENC_SIMD_INLINE vfloat4 unit2()
+{
+ float val = 0.707106769084930420f;
+ return vfloat4(val, val, 0.0f, 0.0f);
+}
+
+/**
+ * @brief Factory that returns a 3 component vfloat4.
+ */
+static ASTCENC_SIMD_INLINE vfloat4 vfloat3(float a, float b, float c)
+{
+ return vfloat4(a, b, c, 0.0f);
+}
+
+/**
+ * @brief Factory that returns a 2 component vfloat4.
+ */
+static ASTCENC_SIMD_INLINE vfloat4 vfloat2(float a, float b)
+{
+ return vfloat4(a, b, 0.0f, 0.0f);
+}
+
+/**
+ * @brief Normalize a non-zero length vector to unit length.
+ */
+static ASTCENC_SIMD_INLINE vfloat4 normalize(vfloat4 a)
+{
+ vfloat4 length = dot(a, a);
+ return a / sqrt(length);
+}
+
+/**
+ * @brief Normalize a vector, returning @c safe if len is zero.
+ */
+static ASTCENC_SIMD_INLINE vfloat4 normalize_safe(vfloat4 a, vfloat4 safe)
+{
+ vfloat4 length = dot(a, a);
+ if (length.lane<0>() != 0.0f)
+ {
+ return a / sqrt(length);
+ }
+
+ return safe;
+}
+
+
+
+#define POLY0(x, c0) ( c0)
+#define POLY1(x, c0, c1) ((POLY0(x, c1) * x) + c0)
+#define POLY2(x, c0, c1, c2) ((POLY1(x, c1, c2) * x) + c0)
+#define POLY3(x, c0, c1, c2, c3) ((POLY2(x, c1, c2, c3) * x) + c0)
+#define POLY4(x, c0, c1, c2, c3, c4) ((POLY3(x, c1, c2, c3, c4) * x) + c0)
+#define POLY5(x, c0, c1, c2, c3, c4, c5) ((POLY4(x, c1, c2, c3, c4, c5) * x) + c0)
+
+/**
+ * @brief Compute an approximate exp2(x) for each lane in the vector.
+ *
+ * Based on 5th degree minimax polynomials, ported from this blog
+ * https://jrfonseca.blogspot.com/2008/09/fast-sse2-pow-tables-or-polynomials.html
+ */
+static ASTCENC_SIMD_INLINE vfloat4 exp2(vfloat4 x)
+{
+ x = clamp(-126.99999f, 129.0f, x);
+
+ vint4 ipart = float_to_int(x - 0.5f);
+ vfloat4 fpart = x - int_to_float(ipart);
+
+ // Integer contrib, using 1 << ipart
+ vfloat4 iexp = int_as_float(lsl<23>(ipart + 127));
+
+ // Fractional contrib, using polynomial fit of 2^x in range [-0.5, 0.5)
+ vfloat4 fexp = POLY5(fpart,
+ 9.9999994e-1f,
+ 6.9315308e-1f,
+ 2.4015361e-1f,
+ 5.5826318e-2f,
+ 8.9893397e-3f,
+ 1.8775767e-3f);
+
+ return iexp * fexp;
+}
+
+/**
+ * @brief Compute an approximate log2(x) for each lane in the vector.
+ *
+ * Based on 5th degree minimax polynomials, ported from this blog
+ * https://jrfonseca.blogspot.com/2008/09/fast-sse2-pow-tables-or-polynomials.html
+ */
+static ASTCENC_SIMD_INLINE vfloat4 log2(vfloat4 x)
+{
+ vint4 exp(0x7F800000);
+ vint4 mant(0x007FFFFF);
+ vint4 one(0x3F800000);
+
+ vint4 i = float_as_int(x);
+
+ vfloat4 e = int_to_float(lsr<23>(i & exp) - 127);
+
+ vfloat4 m = int_as_float((i & mant) | one);
+
+ // Polynomial fit of log2(x)/(x - 1), for x in range [1, 2)
+ vfloat4 p = POLY4(m,
+ 2.8882704548164776201f,
+ -2.52074962577807006663f,
+ 1.48116647521213171641f,
+ -0.465725644288844778798f,
+ 0.0596515482674574969533f);
+
+ // Increases the polynomial degree, but ensures that log2(1) == 0
+ p = p * (m - 1.0f);
+
+ return p + e;
+}
+
+/**
+ * @brief Compute an approximate pow(x, y) for each lane in the vector.
+ *
+ * Power function based on the exp2(log2(x) * y) transform.
+ */
+static ASTCENC_SIMD_INLINE vfloat4 pow(vfloat4 x, vfloat4 y)
+{
+ vmask4 zero_mask = y == vfloat4(0.0f);
+ vfloat4 estimate = exp2(log2(x) * y);
+
+ // Guarantee that y == 0 returns exactly 1.0f
+ return select(estimate, vfloat4(1.0f), zero_mask);
+}
+
+/**
+ * @brief Count the leading zeros for each lane in @c a.
+ *
+ * Valid for all data values of @c a; will return a per-lane value [0, 32].
+ */
+static ASTCENC_SIMD_INLINE vint4 clz(vint4 a)
+{
+ // This function is a horrible abuse of floating point exponents to convert
+ // the original integer value into a 2^N encoding we can recover easily.
+
+ // Convert to float without risk of rounding up by keeping only top 8 bits.
+ // This trick is is guaranteed to keep top 8 bits and clear the 9th.
+ a = (~lsr<8>(a)) & a;
+ a = float_as_int(int_to_float(a));
+
+ // Extract and unbias exponent
+ a = vint4(127 + 31) - lsr<23>(a);
+
+ // Clamp result to a valid 32-bit range
+ return clamp(0, 32, a);
+}
+
+/**
+ * @brief Return lanewise 2^a for each lane in @c a.
+ *
+ * Use of signed int means that this is only valid for values in range [0, 31].
+ */
+static ASTCENC_SIMD_INLINE vint4 two_to_the_n(vint4 a)
+{
+ // 2^30 is the largest signed number than can be represented
+ assert(all(a < vint4(31)));
+
+ // This function is a horrible abuse of floating point to use the exponent
+ // and float conversion to generate a 2^N multiple.
+
+ // Bias the exponent
+ vint4 exp = a + 127;
+ exp = lsl<23>(exp);
+
+ // Reinterpret the bits as a float, and then convert to an int
+ vfloat4 f = int_as_float(exp);
+ return float_to_int(f);
+}
+
+/**
+ * @brief Convert unorm16 [0, 65535] to float16 in range [0, 1].
+ */
+static ASTCENC_SIMD_INLINE vint4 unorm16_to_sf16(vint4 p)
+{
+ vint4 fp16_one = vint4(0x3C00);
+ vint4 fp16_small = lsl<8>(p);
+
+ vmask4 is_one = p == vint4(0xFFFF);
+ vmask4 is_small = p < vint4(4);
+
+ // Manually inline clz() on Visual Studio to avoid release build codegen bug
+ // see https://github.com/ARM-software/astc-encoder/issues/259
+#if !defined(__clang__) && defined(_MSC_VER)
+ vint4 a = (~lsr<8>(p)) & p;
+ a = float_as_int(int_to_float(a));
+ a = vint4(127 + 31) - lsr<23>(a);
+ vint4 lz = clamp(0, 32, a) - 16;
+#else
+ vint4 lz = clz(p) - 16;
+#endif
+
+ p = p * two_to_the_n(lz + 1);
+ p = p & vint4(0xFFFF);
+
+ p = lsr<6>(p);
+
+ p = p | lsl<10>(vint4(14) - lz);
+
+ vint4 r = select(p, fp16_one, is_one);
+ r = select(r, fp16_small, is_small);
+ return r;
+}
+
+/**
+ * @brief Convert 16-bit LNS to float16.
+ */
+static ASTCENC_SIMD_INLINE vint4 lns_to_sf16(vint4 p)
+{
+ vint4 mc = p & 0x7FF;
+ vint4 ec = lsr<11>(p);
+
+ vint4 mc_512 = mc * 3;
+ vmask4 mask_512 = mc < vint4(512);
+
+ vint4 mc_1536 = mc * 4 - 512;
+ vmask4 mask_1536 = mc < vint4(1536);
+
+ vint4 mc_else = mc * 5 - 2048;
+
+ vint4 mt = mc_else;
+ mt = select(mt, mc_1536, mask_1536);
+ mt = select(mt, mc_512, mask_512);
+
+ vint4 res = lsl<10>(ec) | lsr<3>(mt);
+ return min(res, vint4(0x7BFF));
+}
+
+/**
+ * @brief Extract mantissa and exponent of a float value.
+ *
+ * @param a The input value.
+ * @param[out] exp The output exponent.
+ *
+ * @return The mantissa.
+ */
+static ASTCENC_SIMD_INLINE vfloat4 frexp(vfloat4 a, vint4& exp)
+{
+ // Interpret the bits as an integer
+ vint4 ai = float_as_int(a);
+
+ // Extract and unbias the exponent
+ exp = (lsr<23>(ai) & 0xFF) - 126;
+
+ // Extract and unbias the mantissa
+ vint4 manti = (ai & static_cast<int>(0x807FFFFF)) | 0x3F000000;
+ return int_as_float(manti);
+}
+
+/**
+ * @brief Convert float to 16-bit LNS.
+ */
+static ASTCENC_SIMD_INLINE vfloat4 float_to_lns(vfloat4 a)
+{
+ vint4 exp;
+ vfloat4 mant = frexp(a, exp);
+
+ // Do these early before we start messing about ...
+ vmask4 mask_underflow_nan = ~(a > vfloat4(1.0f / 67108864.0f));
+ vmask4 mask_infinity = a >= vfloat4(65536.0f);
+
+ // If input is smaller than 2^-14, multiply by 2^25 and don't bias.
+ vmask4 exp_lt_m13 = exp < vint4(-13);
+
+ vfloat4 a1a = a * 33554432.0f;
+ vint4 expa = vint4::zero();
+
+ vfloat4 a1b = (mant - 0.5f) * 4096;
+ vint4 expb = exp + 14;
+
+ a = select(a1b, a1a, exp_lt_m13);
+ exp = select(expb, expa, exp_lt_m13);
+
+ vmask4 a_lt_384 = a < vfloat4(384.0f);
+ vmask4 a_lt_1408 = a <= vfloat4(1408.0f);
+
+ vfloat4 a2a = a * (4.0f / 3.0f);
+ vfloat4 a2b = a + 128.0f;
+ vfloat4 a2c = (a + 512.0f) * (4.0f / 5.0f);
+
+ a = a2c;
+ a = select(a, a2b, a_lt_1408);
+ a = select(a, a2a, a_lt_384);
+
+ a = a + (int_to_float(exp) * 2048.0f) + 1.0f;
+
+ a = select(a, vfloat4(65535.0f), mask_infinity);
+ a = select(a, vfloat4::zero(), mask_underflow_nan);
+
+ return a;
+}
+
+namespace astc
+{
+
+static ASTCENC_SIMD_INLINE float pow(float x, float y)
+{
+ return pow(vfloat4(x), vfloat4(y)).lane<0>();
+}
+
+}
+
+#endif // #ifndef ASTC_VECMATHLIB_H_INCLUDED
diff --git a/thirdparty/astcenc/astcenc_vecmathlib_avx2_8.h b/thirdparty/astcenc/astcenc_vecmathlib_avx2_8.h
new file mode 100644
index 0000000000..a785aca75b
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_vecmathlib_avx2_8.h
@@ -0,0 +1,1204 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2019-2022 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief 8x32-bit vectors, implemented using AVX2.
+ *
+ * This module implements 8-wide 32-bit float, int, and mask vectors for x86
+ * AVX2.
+ *
+ * There is a baseline level of functionality provided by all vector widths and
+ * implementations. This is implemented using identical function signatures,
+ * modulo data type, so we can use them as substitutable implementations in VLA
+ * code.
+ */
+
+#ifndef ASTC_VECMATHLIB_AVX2_8_H_INCLUDED
+#define ASTC_VECMATHLIB_AVX2_8_H_INCLUDED
+
+#ifndef ASTCENC_SIMD_INLINE
+ #error "Include astcenc_vecmathlib.h, do not include directly"
+#endif
+
+#include <cstdio>
+
+// Define convenience intrinsics that are missing on older compilers
+#define astcenc_mm256_set_m128i(m, n) _mm256_insertf128_si256(_mm256_castsi128_si256((n)), (m), 1)
+
+// ============================================================================
+// vfloat8 data type
+// ============================================================================
+
+/**
+ * @brief Data type for 8-wide floats.
+ */
+struct vfloat8
+{
+ /**
+ * @brief Construct from zero-initialized value.
+ */
+ ASTCENC_SIMD_INLINE vfloat8() = default;
+
+ /**
+ * @brief Construct from 4 values loaded from an unaligned address.
+ *
+ * Consider using loada() which is better with vectors if data is aligned
+ * to vector length.
+ */
+ ASTCENC_SIMD_INLINE explicit vfloat8(const float *p)
+ {
+ m = _mm256_loadu_ps(p);
+ }
+
+ /**
+ * @brief Construct from 1 scalar value replicated across all lanes.
+ *
+ * Consider using zero() for constexpr zeros.
+ */
+ ASTCENC_SIMD_INLINE explicit vfloat8(float a)
+ {
+ m = _mm256_set1_ps(a);
+ }
+
+ /**
+ * @brief Construct from 8 scalar values.
+ *
+ * The value of @c a is stored to lane 0 (LSB) in the SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vfloat8(
+ float a, float b, float c, float d,
+ float e, float f, float g, float h)
+ {
+ m = _mm256_set_ps(h, g, f, e, d, c, b, a);
+ }
+
+ /**
+ * @brief Construct from an existing SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vfloat8(__m256 a)
+ {
+ m = a;
+ }
+
+ /**
+ * @brief Get the scalar value of a single lane.
+ */
+ template <int l> ASTCENC_SIMD_INLINE float lane() const
+ {
+ #if !defined(__clang__) && defined(_MSC_VER)
+ return m.m256_f32[l];
+ #else
+ union { __m256 m; float f[8]; } cvt;
+ cvt.m = m;
+ return cvt.f[l];
+ #endif
+ }
+
+ /**
+ * @brief Factory that returns a vector of zeros.
+ */
+ static ASTCENC_SIMD_INLINE vfloat8 zero()
+ {
+ return vfloat8(_mm256_setzero_ps());
+ }
+
+ /**
+ * @brief Factory that returns a replicated scalar loaded from memory.
+ */
+ static ASTCENC_SIMD_INLINE vfloat8 load1(const float* p)
+ {
+ return vfloat8(_mm256_broadcast_ss(p));
+ }
+
+ /**
+ * @brief Factory that returns a vector loaded from 32B aligned memory.
+ */
+ static ASTCENC_SIMD_INLINE vfloat8 loada(const float* p)
+ {
+ return vfloat8(_mm256_load_ps(p));
+ }
+
+ /**
+ * @brief Factory that returns a vector containing the lane IDs.
+ */
+ static ASTCENC_SIMD_INLINE vfloat8 lane_id()
+ {
+ return vfloat8(_mm256_set_ps(7, 6, 5, 4, 3, 2, 1, 0));
+ }
+
+ /**
+ * @brief The vector ...
+ */
+ __m256 m;
+};
+
+// ============================================================================
+// vint8 data type
+// ============================================================================
+
+/**
+ * @brief Data type for 8-wide ints.
+ */
+struct vint8
+{
+ /**
+ * @brief Construct from zero-initialized value.
+ */
+ ASTCENC_SIMD_INLINE vint8() = default;
+
+ /**
+ * @brief Construct from 8 values loaded from an unaligned address.
+ *
+ * Consider using loada() which is better with vectors if data is aligned
+ * to vector length.
+ */
+ ASTCENC_SIMD_INLINE explicit vint8(const int *p)
+ {
+ m = _mm256_loadu_si256(reinterpret_cast<const __m256i*>(p));
+ }
+
+ /**
+ * @brief Construct from 8 uint8_t loaded from an unaligned address.
+ */
+ ASTCENC_SIMD_INLINE explicit vint8(const uint8_t *p)
+ {
+ // _mm_loadu_si64 would be nicer syntax, but missing on older GCC
+ m = _mm256_cvtepu8_epi32(_mm_cvtsi64_si128(*reinterpret_cast<const long long*>(p)));
+ }
+
+ /**
+ * @brief Construct from 1 scalar value replicated across all lanes.
+ *
+ * Consider using vfloat4::zero() for constexpr zeros.
+ */
+ ASTCENC_SIMD_INLINE explicit vint8(int a)
+ {
+ m = _mm256_set1_epi32(a);
+ }
+
+ /**
+ * @brief Construct from 8 scalar values.
+ *
+ * The value of @c a is stored to lane 0 (LSB) in the SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vint8(
+ int a, int b, int c, int d,
+ int e, int f, int g, int h)
+ {
+ m = _mm256_set_epi32(h, g, f, e, d, c, b, a);
+ }
+
+ /**
+ * @brief Construct from an existing SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vint8(__m256i a)
+ {
+ m = a;
+ }
+
+ /**
+ * @brief Get the scalar from a single lane.
+ */
+ template <int l> ASTCENC_SIMD_INLINE int lane() const
+ {
+ #if !defined(__clang__) && defined(_MSC_VER)
+ return m.m256i_i32[l];
+ #else
+ union { __m256i m; int f[8]; } cvt;
+ cvt.m = m;
+ return cvt.f[l];
+ #endif
+ }
+
+ /**
+ * @brief Factory that returns a vector of zeros.
+ */
+ static ASTCENC_SIMD_INLINE vint8 zero()
+ {
+ return vint8(_mm256_setzero_si256());
+ }
+
+ /**
+ * @brief Factory that returns a replicated scalar loaded from memory.
+ */
+ static ASTCENC_SIMD_INLINE vint8 load1(const int* p)
+ {
+ __m128i a = _mm_set1_epi32(*p);
+ return vint8(_mm256_broadcastd_epi32(a));
+ }
+
+ /**
+ * @brief Factory that returns a vector loaded from 32B aligned memory.
+ */
+ static ASTCENC_SIMD_INLINE vint8 loada(const int* p)
+ {
+ return vint8(_mm256_load_si256(reinterpret_cast<const __m256i*>(p)));
+ }
+
+ /**
+ * @brief Factory that returns a vector containing the lane IDs.
+ */
+ static ASTCENC_SIMD_INLINE vint8 lane_id()
+ {
+ return vint8(_mm256_set_epi32(7, 6, 5, 4, 3, 2, 1, 0));
+ }
+
+ /**
+ * @brief The vector ...
+ */
+ __m256i m;
+};
+
+// ============================================================================
+// vmask8 data type
+// ============================================================================
+
+/**
+ * @brief Data type for 8-wide control plane masks.
+ */
+struct vmask8
+{
+ /**
+ * @brief Construct from an existing SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vmask8(__m256 a)
+ {
+ m = a;
+ }
+
+ /**
+ * @brief Construct from an existing SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vmask8(__m256i a)
+ {
+ m = _mm256_castsi256_ps(a);
+ }
+
+ /**
+ * @brief Construct from 1 scalar value.
+ */
+ ASTCENC_SIMD_INLINE explicit vmask8(bool a)
+ {
+ vint8 mask(a == false ? 0 : -1);
+ m = _mm256_castsi256_ps(mask.m);
+ }
+
+ /**
+ * @brief The vector ...
+ */
+ __m256 m;
+};
+
+// ============================================================================
+// vmask8 operators and functions
+// ============================================================================
+
+/**
+ * @brief Overload: mask union (or).
+ */
+ASTCENC_SIMD_INLINE vmask8 operator|(vmask8 a, vmask8 b)
+{
+ return vmask8(_mm256_or_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: mask intersect (and).
+ */
+ASTCENC_SIMD_INLINE vmask8 operator&(vmask8 a, vmask8 b)
+{
+ return vmask8(_mm256_and_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: mask difference (xor).
+ */
+ASTCENC_SIMD_INLINE vmask8 operator^(vmask8 a, vmask8 b)
+{
+ return vmask8(_mm256_xor_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: mask invert (not).
+ */
+ASTCENC_SIMD_INLINE vmask8 operator~(vmask8 a)
+{
+ return vmask8(_mm256_xor_si256(_mm256_castps_si256(a.m), _mm256_set1_epi32(-1)));
+}
+
+/**
+ * @brief Return a 8-bit mask code indicating mask status.
+ *
+ * bit0 = lane 0
+ */
+ASTCENC_SIMD_INLINE unsigned int mask(vmask8 a)
+{
+ return static_cast<unsigned int>(_mm256_movemask_ps(a.m));
+}
+
+/**
+ * @brief True if any lanes are enabled, false otherwise.
+ */
+ASTCENC_SIMD_INLINE bool any(vmask8 a)
+{
+ return mask(a) != 0;
+}
+
+/**
+ * @brief True if all lanes are enabled, false otherwise.
+ */
+ASTCENC_SIMD_INLINE bool all(vmask8 a)
+{
+ return mask(a) == 0xFF;
+}
+
+// ============================================================================
+// vint8 operators and functions
+// ============================================================================
+/**
+ * @brief Overload: vector by vector addition.
+ */
+ASTCENC_SIMD_INLINE vint8 operator+(vint8 a, vint8 b)
+{
+ return vint8(_mm256_add_epi32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector incremental addition.
+ */
+ASTCENC_SIMD_INLINE vint8& operator+=(vint8& a, const vint8& b)
+{
+ a = a + b;
+ return a;
+}
+
+/**
+ * @brief Overload: vector by vector subtraction.
+ */
+ASTCENC_SIMD_INLINE vint8 operator-(vint8 a, vint8 b)
+{
+ return vint8(_mm256_sub_epi32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector multiplication.
+ */
+ASTCENC_SIMD_INLINE vint8 operator*(vint8 a, vint8 b)
+{
+ return vint8(_mm256_mullo_epi32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector bit invert.
+ */
+ASTCENC_SIMD_INLINE vint8 operator~(vint8 a)
+{
+ return vint8(_mm256_xor_si256(a.m, _mm256_set1_epi32(-1)));
+}
+
+/**
+ * @brief Overload: vector by vector bitwise or.
+ */
+ASTCENC_SIMD_INLINE vint8 operator|(vint8 a, vint8 b)
+{
+ return vint8(_mm256_or_si256(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector bitwise and.
+ */
+ASTCENC_SIMD_INLINE vint8 operator&(vint8 a, vint8 b)
+{
+ return vint8(_mm256_and_si256(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector bitwise xor.
+ */
+ASTCENC_SIMD_INLINE vint8 operator^(vint8 a, vint8 b)
+{
+ return vint8(_mm256_xor_si256(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector equality.
+ */
+ASTCENC_SIMD_INLINE vmask8 operator==(vint8 a, vint8 b)
+{
+ return vmask8(_mm256_cmpeq_epi32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector inequality.
+ */
+ASTCENC_SIMD_INLINE vmask8 operator!=(vint8 a, vint8 b)
+{
+ return ~vmask8(_mm256_cmpeq_epi32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector less than.
+ */
+ASTCENC_SIMD_INLINE vmask8 operator<(vint8 a, vint8 b)
+{
+ return vmask8(_mm256_cmpgt_epi32(b.m, a.m));
+}
+
+/**
+ * @brief Overload: vector by vector greater than.
+ */
+ASTCENC_SIMD_INLINE vmask8 operator>(vint8 a, vint8 b)
+{
+ return vmask8(_mm256_cmpgt_epi32(a.m, b.m));
+}
+
+/**
+ * @brief Logical shift left.
+ */
+template <int s> ASTCENC_SIMD_INLINE vint8 lsl(vint8 a)
+{
+ return vint8(_mm256_slli_epi32(a.m, s));
+}
+
+/**
+ * @brief Arithmetic shift right.
+ */
+template <int s> ASTCENC_SIMD_INLINE vint8 asr(vint8 a)
+{
+ return vint8(_mm256_srai_epi32(a.m, s));
+}
+
+/**
+ * @brief Logical shift right.
+ */
+template <int s> ASTCENC_SIMD_INLINE vint8 lsr(vint8 a)
+{
+ return vint8(_mm256_srli_epi32(a.m, s));
+}
+
+/**
+ * @brief Return the min vector of two vectors.
+ */
+ASTCENC_SIMD_INLINE vint8 min(vint8 a, vint8 b)
+{
+ return vint8(_mm256_min_epi32(a.m, b.m));
+}
+
+/**
+ * @brief Return the max vector of two vectors.
+ */
+ASTCENC_SIMD_INLINE vint8 max(vint8 a, vint8 b)
+{
+ return vint8(_mm256_max_epi32(a.m, b.m));
+}
+
+/**
+ * @brief Return the horizontal minimum of a vector.
+ */
+ASTCENC_SIMD_INLINE vint8 hmin(vint8 a)
+{
+ __m128i m = _mm_min_epi32(_mm256_extracti128_si256(a.m, 0), _mm256_extracti128_si256(a.m, 1));
+ m = _mm_min_epi32(m, _mm_shuffle_epi32(m, _MM_SHUFFLE(0,0,3,2)));
+ m = _mm_min_epi32(m, _mm_shuffle_epi32(m, _MM_SHUFFLE(0,0,0,1)));
+ m = _mm_shuffle_epi32(m, _MM_SHUFFLE(0,0,0,0));
+
+ __m256i r = astcenc_mm256_set_m128i(m, m);
+ vint8 vmin(r);
+ return vmin;
+}
+
+/**
+ * @brief Return the horizontal maximum of a vector.
+ */
+ASTCENC_SIMD_INLINE vint8 hmax(vint8 a)
+{
+ __m128i m = _mm_max_epi32(_mm256_extracti128_si256(a.m, 0), _mm256_extracti128_si256(a.m, 1));
+ m = _mm_max_epi32(m, _mm_shuffle_epi32(m, _MM_SHUFFLE(0,0,3,2)));
+ m = _mm_max_epi32(m, _mm_shuffle_epi32(m, _MM_SHUFFLE(0,0,0,1)));
+ m = _mm_shuffle_epi32(m, _MM_SHUFFLE(0,0,0,0));
+
+ __m256i r = astcenc_mm256_set_m128i(m, m);
+ vint8 vmax(r);
+ return vmax;
+}
+
+/**
+ * @brief Store a vector to a 16B aligned memory address.
+ */
+ASTCENC_SIMD_INLINE void storea(vint8 a, int* p)
+{
+ _mm256_store_si256(reinterpret_cast<__m256i*>(p), a.m);
+}
+
+/**
+ * @brief Store a vector to an unaligned memory address.
+ */
+ASTCENC_SIMD_INLINE void store(vint8 a, int* p)
+{
+ _mm256_storeu_si256(reinterpret_cast<__m256i*>(p), a.m);
+}
+
+/**
+ * @brief Store lowest N (vector width) bytes into an unaligned address.
+ */
+ASTCENC_SIMD_INLINE void store_nbytes(vint8 a, uint8_t* p)
+{
+ // This is the most logical implementation, but the convenience intrinsic
+ // is missing on older compilers (supported in g++ 9 and clang++ 9).
+ // _mm_storeu_si64(ptr, _mm256_extracti128_si256(v.m, 0))
+ _mm_storel_epi64(reinterpret_cast<__m128i*>(p), _mm256_extracti128_si256(a.m, 0));
+}
+
+/**
+ * @brief Gather N (vector width) indices from the array.
+ */
+ASTCENC_SIMD_INLINE vint8 gatheri(const int* base, vint8 indices)
+{
+ return vint8(_mm256_i32gather_epi32(base, indices.m, 4));
+}
+
+/**
+ * @brief Pack low 8 bits of N (vector width) lanes into bottom of vector.
+ */
+ASTCENC_SIMD_INLINE vint8 pack_low_bytes(vint8 v)
+{
+ __m256i shuf = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 28, 24, 20, 16,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 12, 8, 4, 0);
+ __m256i a = _mm256_shuffle_epi8(v.m, shuf);
+ __m128i a0 = _mm256_extracti128_si256(a, 0);
+ __m128i a1 = _mm256_extracti128_si256(a, 1);
+ __m128i b = _mm_unpacklo_epi32(a0, a1);
+
+ __m256i r = astcenc_mm256_set_m128i(b, b);
+ return vint8(r);
+}
+
+/**
+ * @brief Return lanes from @c b if @c cond is set, else @c a.
+ */
+ASTCENC_SIMD_INLINE vint8 select(vint8 a, vint8 b, vmask8 cond)
+{
+ __m256i condi = _mm256_castps_si256(cond.m);
+ return vint8(_mm256_blendv_epi8(a.m, b.m, condi));
+}
+
+// ============================================================================
+// vfloat4 operators and functions
+// ============================================================================
+
+/**
+ * @brief Overload: vector by vector addition.
+ */
+ASTCENC_SIMD_INLINE vfloat8 operator+(vfloat8 a, vfloat8 b)
+{
+ return vfloat8(_mm256_add_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector incremental addition.
+ */
+ASTCENC_SIMD_INLINE vfloat8& operator+=(vfloat8& a, const vfloat8& b)
+{
+ a = a + b;
+ return a;
+}
+
+/**
+ * @brief Overload: vector by vector subtraction.
+ */
+ASTCENC_SIMD_INLINE vfloat8 operator-(vfloat8 a, vfloat8 b)
+{
+ return vfloat8(_mm256_sub_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector multiplication.
+ */
+ASTCENC_SIMD_INLINE vfloat8 operator*(vfloat8 a, vfloat8 b)
+{
+ return vfloat8(_mm256_mul_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by scalar multiplication.
+ */
+ASTCENC_SIMD_INLINE vfloat8 operator*(vfloat8 a, float b)
+{
+ return vfloat8(_mm256_mul_ps(a.m, _mm256_set1_ps(b)));
+}
+
+/**
+ * @brief Overload: scalar by vector multiplication.
+ */
+ASTCENC_SIMD_INLINE vfloat8 operator*(float a, vfloat8 b)
+{
+ return vfloat8(_mm256_mul_ps(_mm256_set1_ps(a), b.m));
+}
+
+/**
+ * @brief Overload: vector by vector division.
+ */
+ASTCENC_SIMD_INLINE vfloat8 operator/(vfloat8 a, vfloat8 b)
+{
+ return vfloat8(_mm256_div_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by scalar division.
+ */
+ASTCENC_SIMD_INLINE vfloat8 operator/(vfloat8 a, float b)
+{
+ return vfloat8(_mm256_div_ps(a.m, _mm256_set1_ps(b)));
+}
+
+
+/**
+ * @brief Overload: scalar by vector division.
+ */
+ASTCENC_SIMD_INLINE vfloat8 operator/(float a, vfloat8 b)
+{
+ return vfloat8(_mm256_div_ps(_mm256_set1_ps(a), b.m));
+}
+
+
+/**
+ * @brief Overload: vector by vector equality.
+ */
+ASTCENC_SIMD_INLINE vmask8 operator==(vfloat8 a, vfloat8 b)
+{
+ return vmask8(_mm256_cmp_ps(a.m, b.m, _CMP_EQ_OQ));
+}
+
+/**
+ * @brief Overload: vector by vector inequality.
+ */
+ASTCENC_SIMD_INLINE vmask8 operator!=(vfloat8 a, vfloat8 b)
+{
+ return vmask8(_mm256_cmp_ps(a.m, b.m, _CMP_NEQ_OQ));
+}
+
+/**
+ * @brief Overload: vector by vector less than.
+ */
+ASTCENC_SIMD_INLINE vmask8 operator<(vfloat8 a, vfloat8 b)
+{
+ return vmask8(_mm256_cmp_ps(a.m, b.m, _CMP_LT_OQ));
+}
+
+/**
+ * @brief Overload: vector by vector greater than.
+ */
+ASTCENC_SIMD_INLINE vmask8 operator>(vfloat8 a, vfloat8 b)
+{
+ return vmask8(_mm256_cmp_ps(a.m, b.m, _CMP_GT_OQ));
+}
+
+/**
+ * @brief Overload: vector by vector less than or equal.
+ */
+ASTCENC_SIMD_INLINE vmask8 operator<=(vfloat8 a, vfloat8 b)
+{
+ return vmask8(_mm256_cmp_ps(a.m, b.m, _CMP_LE_OQ));
+}
+
+/**
+ * @brief Overload: vector by vector greater than or equal.
+ */
+ASTCENC_SIMD_INLINE vmask8 operator>=(vfloat8 a, vfloat8 b)
+{
+ return vmask8(_mm256_cmp_ps(a.m, b.m, _CMP_GE_OQ));
+}
+
+/**
+ * @brief Return the min vector of two vectors.
+ *
+ * If either lane value is NaN, @c b will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat8 min(vfloat8 a, vfloat8 b)
+{
+ return vfloat8(_mm256_min_ps(a.m, b.m));
+}
+
+/**
+ * @brief Return the min vector of a vector and a scalar.
+ *
+ * If either lane value is NaN, @c b will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat8 min(vfloat8 a, float b)
+{
+ return min(a, vfloat8(b));
+}
+
+/**
+ * @brief Return the max vector of two vectors.
+ *
+ * If either lane value is NaN, @c b will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat8 max(vfloat8 a, vfloat8 b)
+{
+ return vfloat8(_mm256_max_ps(a.m, b.m));
+}
+
+/**
+ * @brief Return the max vector of a vector and a scalar.
+ *
+ * If either lane value is NaN, @c b will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat8 max(vfloat8 a, float b)
+{
+ return max(a, vfloat8(b));
+}
+
+/**
+ * @brief Return the clamped value between min and max.
+ *
+ * It is assumed that neither @c min nor @c max are NaN values. If @c a is NaN
+ * then @c min will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat8 clamp(float min, float max, vfloat8 a)
+{
+ // Do not reorder - second operand will return if either is NaN
+ a.m = _mm256_max_ps(a.m, _mm256_set1_ps(min));
+ a.m = _mm256_min_ps(a.m, _mm256_set1_ps(max));
+ return a;
+}
+
+/**
+ * @brief Return a clamped value between 0.0f and max.
+ *
+ * It is assumed that @c max is not a NaN value. If @c a is NaN then zero will
+ * be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat8 clampz(float max, vfloat8 a)
+{
+ a.m = _mm256_max_ps(a.m, _mm256_setzero_ps());
+ a.m = _mm256_min_ps(a.m, _mm256_set1_ps(max));
+ return a;
+}
+
+/**
+ * @brief Return a clamped value between 0.0f and 1.0f.
+ *
+ * If @c a is NaN then zero will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat8 clampzo(vfloat8 a)
+{
+ a.m = _mm256_max_ps(a.m, _mm256_setzero_ps());
+ a.m = _mm256_min_ps(a.m, _mm256_set1_ps(1.0f));
+ return a;
+}
+
+/**
+ * @brief Return the absolute value of the float vector.
+ */
+ASTCENC_SIMD_INLINE vfloat8 abs(vfloat8 a)
+{
+ __m256 msk = _mm256_castsi256_ps(_mm256_set1_epi32(0x7fffffff));
+ return vfloat8(_mm256_and_ps(a.m, msk));
+}
+
+/**
+ * @brief Return a float rounded to the nearest integer value.
+ */
+ASTCENC_SIMD_INLINE vfloat8 round(vfloat8 a)
+{
+ constexpr int flags = _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC;
+ return vfloat8(_mm256_round_ps(a.m, flags));
+}
+
+/**
+ * @brief Return the horizontal minimum of a vector.
+ */
+ASTCENC_SIMD_INLINE vfloat8 hmin(vfloat8 a)
+{
+ __m128 vlow = _mm256_castps256_ps128(a.m);
+ __m128 vhigh = _mm256_extractf128_ps(a.m, 1);
+ vlow = _mm_min_ps(vlow, vhigh);
+
+ // First do an horizontal reduction.
+ __m128 shuf = _mm_shuffle_ps(vlow, vlow, _MM_SHUFFLE(2, 3, 0, 1));
+ __m128 mins = _mm_min_ps(vlow, shuf);
+ shuf = _mm_movehl_ps(shuf, mins);
+ mins = _mm_min_ss(mins, shuf);
+
+ // This is the most logical implementation, but the convenience intrinsic
+ // is missing on older compilers (supported in g++ 9 and clang++ 9).
+ //__m256i r = _mm256_set_m128(m, m)
+ __m256 r = _mm256_insertf128_ps(_mm256_castps128_ps256(mins), mins, 1);
+
+ return vfloat8(_mm256_permute_ps(r, 0));
+}
+
+/**
+ * @brief Return the horizontal minimum of a vector.
+ */
+ASTCENC_SIMD_INLINE float hmin_s(vfloat8 a)
+{
+ return hmin(a).lane<0>();
+}
+
+/**
+ * @brief Return the horizontal maximum of a vector.
+ */
+ASTCENC_SIMD_INLINE vfloat8 hmax(vfloat8 a)
+{
+ __m128 vlow = _mm256_castps256_ps128(a.m);
+ __m128 vhigh = _mm256_extractf128_ps(a.m, 1);
+ vhigh = _mm_max_ps(vlow, vhigh);
+
+ // First do an horizontal reduction.
+ __m128 shuf = _mm_shuffle_ps(vhigh, vhigh, _MM_SHUFFLE(2, 3, 0, 1));
+ __m128 maxs = _mm_max_ps(vhigh, shuf);
+ shuf = _mm_movehl_ps(shuf,maxs);
+ maxs = _mm_max_ss(maxs, shuf);
+
+ // This is the most logical implementation, but the convenience intrinsic
+ // is missing on older compilers (supported in g++ 9 and clang++ 9).
+ //__m256i r = _mm256_set_m128(m, m)
+ __m256 r = _mm256_insertf128_ps(_mm256_castps128_ps256(maxs), maxs, 1);
+ return vfloat8(_mm256_permute_ps(r, 0));
+}
+
+/**
+ * @brief Return the horizontal maximum of a vector.
+ */
+ASTCENC_SIMD_INLINE float hmax_s(vfloat8 a)
+{
+ return hmax(a).lane<0>();
+}
+
+/**
+ * @brief Return the horizontal sum of a vector.
+ */
+ASTCENC_SIMD_INLINE float hadd_s(vfloat8 a)
+{
+ // Two sequential 4-wide adds gives invariance with 4-wide code
+ vfloat4 lo(_mm256_extractf128_ps(a.m, 0));
+ vfloat4 hi(_mm256_extractf128_ps(a.m, 1));
+ return hadd_s(lo) + hadd_s(hi);
+}
+
+/**
+ * @brief Return lanes from @c b if @c cond is set, else @c a.
+ */
+ASTCENC_SIMD_INLINE vfloat8 select(vfloat8 a, vfloat8 b, vmask8 cond)
+{
+ return vfloat8(_mm256_blendv_ps(a.m, b.m, cond.m));
+}
+
+/**
+ * @brief Return lanes from @c b if MSB of @c cond is set, else @c a.
+ */
+ASTCENC_SIMD_INLINE vfloat8 select_msb(vfloat8 a, vfloat8 b, vmask8 cond)
+{
+ return vfloat8(_mm256_blendv_ps(a.m, b.m, cond.m));
+}
+
+/**
+ * @brief Accumulate lane-wise sums for a vector, folded 4-wide.
+ *
+ * This is invariant with 4-wide implementations.
+ */
+ASTCENC_SIMD_INLINE void haccumulate(vfloat4& accum, vfloat8 a)
+{
+ vfloat4 lo(_mm256_extractf128_ps(a.m, 0));
+ haccumulate(accum, lo);
+
+ vfloat4 hi(_mm256_extractf128_ps(a.m, 1));
+ haccumulate(accum, hi);
+}
+
+/**
+ * @brief Accumulate lane-wise sums for a vector.
+ *
+ * This is NOT invariant with 4-wide implementations.
+ */
+ASTCENC_SIMD_INLINE void haccumulate(vfloat8& accum, vfloat8 a)
+{
+ accum += a;
+}
+
+/**
+ * @brief Accumulate masked lane-wise sums for a vector, folded 4-wide.
+ *
+ * This is invariant with 4-wide implementations.
+ */
+ASTCENC_SIMD_INLINE void haccumulate(vfloat4& accum, vfloat8 a, vmask8 m)
+{
+ a = select(vfloat8::zero(), a, m);
+ haccumulate(accum, a);
+}
+
+/**
+ * @brief Accumulate masked lane-wise sums for a vector.
+ *
+ * This is NOT invariant with 4-wide implementations.
+ */
+ASTCENC_SIMD_INLINE void haccumulate(vfloat8& accum, vfloat8 a, vmask8 m)
+{
+ a = select(vfloat8::zero(), a, m);
+ haccumulate(accum, a);
+}
+
+/**
+ * @brief Return the sqrt of the lanes in the vector.
+ */
+ASTCENC_SIMD_INLINE vfloat8 sqrt(vfloat8 a)
+{
+ return vfloat8(_mm256_sqrt_ps(a.m));
+}
+
+/**
+ * @brief Load a vector of gathered results from an array;
+ */
+ASTCENC_SIMD_INLINE vfloat8 gatherf(const float* base, vint8 indices)
+{
+ return vfloat8(_mm256_i32gather_ps(base, indices.m, 4));
+}
+
+/**
+ * @brief Store a vector to an unaligned memory address.
+ */
+ASTCENC_SIMD_INLINE void store(vfloat8 a, float* p)
+{
+ _mm256_storeu_ps(p, a.m);
+}
+
+/**
+ * @brief Store a vector to a 32B aligned memory address.
+ */
+ASTCENC_SIMD_INLINE void storea(vfloat8 a, float* p)
+{
+ _mm256_store_ps(p, a.m);
+}
+
+/**
+ * @brief Return a integer value for a float vector, using truncation.
+ */
+ASTCENC_SIMD_INLINE vint8 float_to_int(vfloat8 a)
+{
+ return vint8(_mm256_cvttps_epi32(a.m));
+}
+
+/**
+ * @brief Return a integer value for a float vector, using round-to-nearest.
+ */
+ASTCENC_SIMD_INLINE vint8 float_to_int_rtn(vfloat8 a)
+{
+ a = round(a);
+ return vint8(_mm256_cvttps_epi32(a.m));
+}
+
+
+/**
+ * @brief Return a float value for an integer vector.
+ */
+ASTCENC_SIMD_INLINE vfloat8 int_to_float(vint8 a)
+{
+ return vfloat8(_mm256_cvtepi32_ps(a.m));
+}
+
+/**
+ * @brief Return a float value as an integer bit pattern (i.e. no conversion).
+ *
+ * It is a common trick to convert floats into integer bit patterns, perform
+ * some bit hackery based on knowledge they are IEEE 754 layout, and then
+ * convert them back again. This is the first half of that flip.
+ */
+ASTCENC_SIMD_INLINE vint8 float_as_int(vfloat8 a)
+{
+ return vint8(_mm256_castps_si256(a.m));
+}
+
+/**
+ * @brief Return a integer value as a float bit pattern (i.e. no conversion).
+ *
+ * It is a common trick to convert floats into integer bit patterns, perform
+ * some bit hackery based on knowledge they are IEEE 754 layout, and then
+ * convert them back again. This is the second half of that flip.
+ */
+ASTCENC_SIMD_INLINE vfloat8 int_as_float(vint8 a)
+{
+ return vfloat8(_mm256_castsi256_ps(a.m));
+}
+
+/**
+ * @brief Prepare a vtable lookup table for use with the native SIMD size.
+ */
+ASTCENC_SIMD_INLINE void vtable_prepare(vint4 t0, vint8& t0p)
+{
+ // AVX2 duplicates the table within each 128-bit lane
+ __m128i t0n = t0.m;
+ t0p = vint8(astcenc_mm256_set_m128i(t0n, t0n));
+}
+
+/**
+ * @brief Prepare a vtable lookup table for use with the native SIMD size.
+ */
+ASTCENC_SIMD_INLINE void vtable_prepare(vint4 t0, vint4 t1, vint8& t0p, vint8& t1p)
+{
+ // AVX2 duplicates the table within each 128-bit lane
+ __m128i t0n = t0.m;
+ t0p = vint8(astcenc_mm256_set_m128i(t0n, t0n));
+
+ __m128i t1n = _mm_xor_si128(t0.m, t1.m);
+ t1p = vint8(astcenc_mm256_set_m128i(t1n, t1n));
+}
+
+/**
+ * @brief Prepare a vtable lookup table for use with the native SIMD size.
+ */
+ASTCENC_SIMD_INLINE void vtable_prepare(
+ vint4 t0, vint4 t1, vint4 t2, vint4 t3,
+ vint8& t0p, vint8& t1p, vint8& t2p, vint8& t3p)
+{
+ // AVX2 duplicates the table within each 128-bit lane
+ __m128i t0n = t0.m;
+ t0p = vint8(astcenc_mm256_set_m128i(t0n, t0n));
+
+ __m128i t1n = _mm_xor_si128(t0.m, t1.m);
+ t1p = vint8(astcenc_mm256_set_m128i(t1n, t1n));
+
+ __m128i t2n = _mm_xor_si128(t1.m, t2.m);
+ t2p = vint8(astcenc_mm256_set_m128i(t2n, t2n));
+
+ __m128i t3n = _mm_xor_si128(t2.m, t3.m);
+ t3p = vint8(astcenc_mm256_set_m128i(t3n, t3n));
+}
+
+/**
+ * @brief Perform an 8-bit 16-entry table lookup, with 32-bit indexes.
+ */
+ASTCENC_SIMD_INLINE vint8 vtable_8bt_32bi(vint8 t0, vint8 idx)
+{
+ // Set index byte MSB to 1 for unused bytes so shuffle returns zero
+ __m256i idxx = _mm256_or_si256(idx.m, _mm256_set1_epi32(static_cast<int>(0xFFFFFF00)));
+
+ __m256i result = _mm256_shuffle_epi8(t0.m, idxx);
+ return vint8(result);
+}
+
+/**
+ * @brief Perform an 8-bit 32-entry table lookup, with 32-bit indexes.
+ */
+ASTCENC_SIMD_INLINE vint8 vtable_8bt_32bi(vint8 t0, vint8 t1, vint8 idx)
+{
+ // Set index byte MSB to 1 for unused bytes so shuffle returns zero
+ __m256i idxx = _mm256_or_si256(idx.m, _mm256_set1_epi32(static_cast<int>(0xFFFFFF00)));
+
+ __m256i result = _mm256_shuffle_epi8(t0.m, idxx);
+ idxx = _mm256_sub_epi8(idxx, _mm256_set1_epi8(16));
+
+ __m256i result2 = _mm256_shuffle_epi8(t1.m, idxx);
+ result = _mm256_xor_si256(result, result2);
+ return vint8(result);
+}
+
+/**
+ * @brief Perform an 8-bit 64-entry table lookup, with 32-bit indexes.
+ */
+ASTCENC_SIMD_INLINE vint8 vtable_8bt_32bi(vint8 t0, vint8 t1, vint8 t2, vint8 t3, vint8 idx)
+{
+ // Set index byte MSB to 1 for unused bytes so shuffle returns zero
+ __m256i idxx = _mm256_or_si256(idx.m, _mm256_set1_epi32(static_cast<int>(0xFFFFFF00)));
+
+ __m256i result = _mm256_shuffle_epi8(t0.m, idxx);
+ idxx = _mm256_sub_epi8(idxx, _mm256_set1_epi8(16));
+
+ __m256i result2 = _mm256_shuffle_epi8(t1.m, idxx);
+ result = _mm256_xor_si256(result, result2);
+ idxx = _mm256_sub_epi8(idxx, _mm256_set1_epi8(16));
+
+ result2 = _mm256_shuffle_epi8(t2.m, idxx);
+ result = _mm256_xor_si256(result, result2);
+ idxx = _mm256_sub_epi8(idxx, _mm256_set1_epi8(16));
+
+ result2 = _mm256_shuffle_epi8(t3.m, idxx);
+ result = _mm256_xor_si256(result, result2);
+
+ return vint8(result);
+}
+
+/**
+ * @brief Return a vector of interleaved RGBA data.
+ *
+ * Input vectors have the value stored in the bottom 8 bits of each lane,
+ * with high bits set to zero.
+ *
+ * Output vector stores a single RGBA texel packed in each lane.
+ */
+ASTCENC_SIMD_INLINE vint8 interleave_rgba8(vint8 r, vint8 g, vint8 b, vint8 a)
+{
+ return r + lsl<8>(g) + lsl<16>(b) + lsl<24>(a);
+}
+
+/**
+ * @brief Store a vector, skipping masked lanes.
+ *
+ * All masked lanes must be at the end of vector, after all non-masked lanes.
+ */
+ASTCENC_SIMD_INLINE void store_lanes_masked(int* base, vint8 data, vmask8 mask)
+{
+ _mm256_maskstore_epi32(base, _mm256_castps_si256(mask.m), data.m);
+}
+
+/**
+ * @brief Debug function to print a vector of ints.
+ */
+ASTCENC_SIMD_INLINE void print(vint8 a)
+{
+ alignas(ASTCENC_VECALIGN) int v[8];
+ storea(a, v);
+ printf("v8_i32:\n %8d %8d %8d %8d %8d %8d %8d %8d\n",
+ v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]);
+}
+
+/**
+ * @brief Debug function to print a vector of ints.
+ */
+ASTCENC_SIMD_INLINE void printx(vint8 a)
+{
+ alignas(ASTCENC_VECALIGN) int v[8];
+ storea(a, v);
+ printf("v8_i32:\n %08x %08x %08x %08x %08x %08x %08x %08x\n",
+ v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]);
+}
+
+/**
+ * @brief Debug function to print a vector of floats.
+ */
+ASTCENC_SIMD_INLINE void print(vfloat8 a)
+{
+ alignas(ASTCENC_VECALIGN) float v[8];
+ storea(a, v);
+ printf("v8_f32:\n %0.4f %0.4f %0.4f %0.4f %0.4f %0.4f %0.4f %0.4f\n",
+ static_cast<double>(v[0]), static_cast<double>(v[1]),
+ static_cast<double>(v[2]), static_cast<double>(v[3]),
+ static_cast<double>(v[4]), static_cast<double>(v[5]),
+ static_cast<double>(v[6]), static_cast<double>(v[7]));
+}
+
+/**
+ * @brief Debug function to print a vector of masks.
+ */
+ASTCENC_SIMD_INLINE void print(vmask8 a)
+{
+ print(select(vint8(0), vint8(1), a));
+}
+
+#endif // #ifndef ASTC_VECMATHLIB_AVX2_8_H_INCLUDED
diff --git a/thirdparty/astcenc/astcenc_vecmathlib_common_4.h b/thirdparty/astcenc/astcenc_vecmathlib_common_4.h
new file mode 100644
index 0000000000..86ee4fd3e1
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_vecmathlib_common_4.h
@@ -0,0 +1,423 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2020-2021 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Generic 4x32-bit vector functions.
+ *
+ * This module implements generic 4-wide vector functions that are valid for
+ * all instruction sets, typically implemented using lower level 4-wide
+ * operations that are ISA-specific.
+ */
+
+#ifndef ASTC_VECMATHLIB_COMMON_4_H_INCLUDED
+#define ASTC_VECMATHLIB_COMMON_4_H_INCLUDED
+
+#ifndef ASTCENC_SIMD_INLINE
+ #error "Include astcenc_vecmathlib.h, do not include directly"
+#endif
+
+#include <cstdio>
+
+// ============================================================================
+// vmask4 operators and functions
+// ============================================================================
+
+/**
+ * @brief True if any lanes are enabled, false otherwise.
+ */
+ASTCENC_SIMD_INLINE bool any(vmask4 a)
+{
+ return mask(a) != 0;
+}
+
+/**
+ * @brief True if all lanes are enabled, false otherwise.
+ */
+ASTCENC_SIMD_INLINE bool all(vmask4 a)
+{
+ return mask(a) == 0xF;
+}
+
+// ============================================================================
+// vint4 operators and functions
+// ============================================================================
+
+/**
+ * @brief Overload: vector by scalar addition.
+ */
+ASTCENC_SIMD_INLINE vint4 operator+(vint4 a, int b)
+{
+ return a + vint4(b);
+}
+
+/**
+ * @brief Overload: vector by vector incremental addition.
+ */
+ASTCENC_SIMD_INLINE vint4& operator+=(vint4& a, const vint4& b)
+{
+ a = a + b;
+ return a;
+}
+
+/**
+ * @brief Overload: vector by scalar subtraction.
+ */
+ASTCENC_SIMD_INLINE vint4 operator-(vint4 a, int b)
+{
+ return a - vint4(b);
+}
+
+/**
+ * @brief Overload: vector by scalar multiplication.
+ */
+ASTCENC_SIMD_INLINE vint4 operator*(vint4 a, int b)
+{
+ return a * vint4(b);
+}
+
+/**
+ * @brief Overload: vector by scalar bitwise or.
+ */
+ASTCENC_SIMD_INLINE vint4 operator|(vint4 a, int b)
+{
+ return a | vint4(b);
+}
+
+/**
+ * @brief Overload: vector by scalar bitwise and.
+ */
+ASTCENC_SIMD_INLINE vint4 operator&(vint4 a, int b)
+{
+ return a & vint4(b);
+}
+
+/**
+ * @brief Overload: vector by scalar bitwise xor.
+ */
+ASTCENC_SIMD_INLINE vint4 operator^(vint4 a, int b)
+{
+ return a ^ vint4(b);
+}
+
+/**
+ * @brief Return the clamped value between min and max.
+ */
+ASTCENC_SIMD_INLINE vint4 clamp(int minv, int maxv, vint4 a)
+{
+ return min(max(a, vint4(minv)), vint4(maxv));
+}
+
+/**
+ * @brief Return the horizontal sum of RGB vector lanes as a scalar.
+ */
+ASTCENC_SIMD_INLINE int hadd_rgb_s(vint4 a)
+{
+ return a.lane<0>() + a.lane<1>() + a.lane<2>();
+}
+
+// ============================================================================
+// vfloat4 operators and functions
+// ============================================================================
+
+/**
+ * @brief Overload: vector by vector incremental addition.
+ */
+ASTCENC_SIMD_INLINE vfloat4& operator+=(vfloat4& a, const vfloat4& b)
+{
+ a = a + b;
+ return a;
+}
+
+/**
+ * @brief Overload: vector by scalar addition.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator+(vfloat4 a, float b)
+{
+ return a + vfloat4(b);
+}
+
+/**
+ * @brief Overload: vector by scalar subtraction.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator-(vfloat4 a, float b)
+{
+ return a - vfloat4(b);
+}
+
+/**
+ * @brief Overload: vector by scalar multiplication.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator*(vfloat4 a, float b)
+{
+ return a * vfloat4(b);
+}
+
+/**
+ * @brief Overload: scalar by vector multiplication.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator*(float a, vfloat4 b)
+{
+ return vfloat4(a) * b;
+}
+
+/**
+ * @brief Overload: vector by scalar division.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator/(vfloat4 a, float b)
+{
+ return a / vfloat4(b);
+}
+
+/**
+ * @brief Overload: scalar by vector division.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator/(float a, vfloat4 b)
+{
+ return vfloat4(a) / b;
+}
+
+/**
+ * @brief Return the min vector of a vector and a scalar.
+ *
+ * If either lane value is NaN, @c b will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat4 min(vfloat4 a, float b)
+{
+ return min(a, vfloat4(b));
+}
+
+/**
+ * @brief Return the max vector of a vector and a scalar.
+ *
+ * If either lane value is NaN, @c b will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat4 max(vfloat4 a, float b)
+{
+ return max(a, vfloat4(b));
+}
+
+/**
+ * @brief Return the clamped value between min and max.
+ *
+ * It is assumed that neither @c min nor @c max are NaN values. If @c a is NaN
+ * then @c min will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat4 clamp(float minv, float maxv, vfloat4 a)
+{
+ // Do not reorder - second operand will return if either is NaN
+ return min(max(a, minv), maxv);
+}
+
+/**
+ * @brief Return the clamped value between 0.0f and max.
+ *
+ * It is assumed that @c max is not a NaN value. If @c a is NaN then zero will
+ * be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat4 clampz(float maxv, vfloat4 a)
+{
+ // Do not reorder - second operand will return if either is NaN
+ return min(max(a, vfloat4::zero()), maxv);
+}
+
+/**
+ * @brief Return the clamped value between 0.0f and 1.0f.
+ *
+ * If @c a is NaN then zero will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat4 clampzo(vfloat4 a)
+{
+ // Do not reorder - second operand will return if either is NaN
+ return min(max(a, vfloat4::zero()), 1.0f);
+}
+
+/**
+ * @brief Return the horizontal minimum of a vector.
+ */
+ASTCENC_SIMD_INLINE float hmin_s(vfloat4 a)
+{
+ return hmin(a).lane<0>();
+}
+
+/**
+ * @brief Return the horizontal min of RGB vector lanes as a scalar.
+ */
+ASTCENC_SIMD_INLINE float hmin_rgb_s(vfloat4 a)
+{
+ a.set_lane<3>(a.lane<0>());
+ return hmin_s(a);
+}
+
+/**
+ * @brief Return the horizontal maximum of a vector.
+ */
+ASTCENC_SIMD_INLINE float hmax_s(vfloat4 a)
+{
+ return hmax(a).lane<0>();
+}
+
+/**
+ * @brief Accumulate lane-wise sums for a vector.
+ */
+ASTCENC_SIMD_INLINE void haccumulate(vfloat4& accum, vfloat4 a)
+{
+ accum = accum + a;
+}
+
+/**
+ * @brief Accumulate lane-wise sums for a masked vector.
+ */
+ASTCENC_SIMD_INLINE void haccumulate(vfloat4& accum, vfloat4 a, vmask4 m)
+{
+ a = select(vfloat4::zero(), a, m);
+ haccumulate(accum, a);
+}
+
+/**
+ * @brief Return the horizontal sum of RGB vector lanes as a scalar.
+ */
+ASTCENC_SIMD_INLINE float hadd_rgb_s(vfloat4 a)
+{
+ return a.lane<0>() + a.lane<1>() + a.lane<2>();
+}
+
+#if !defined(ASTCENC_USE_NATIVE_DOT_PRODUCT)
+
+/**
+ * @brief Return the dot product for the full 4 lanes, returning scalar.
+ */
+ASTCENC_SIMD_INLINE float dot_s(vfloat4 a, vfloat4 b)
+{
+ vfloat4 m = a * b;
+ return hadd_s(m);
+}
+
+/**
+ * @brief Return the dot product for the full 4 lanes, returning vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 dot(vfloat4 a, vfloat4 b)
+{
+ vfloat4 m = a * b;
+ return vfloat4(hadd_s(m));
+}
+
+/**
+ * @brief Return the dot product for the bottom 3 lanes, returning scalar.
+ */
+ASTCENC_SIMD_INLINE float dot3_s(vfloat4 a, vfloat4 b)
+{
+ vfloat4 m = a * b;
+ return hadd_rgb_s(m);
+}
+
+/**
+ * @brief Return the dot product for the bottom 3 lanes, returning vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 dot3(vfloat4 a, vfloat4 b)
+{
+ vfloat4 m = a * b;
+ float d3 = hadd_rgb_s(m);
+ return vfloat4(d3, d3, d3, 0.0f);
+}
+
+#endif
+
+#if !defined(ASTCENC_USE_NATIVE_POPCOUNT)
+
+/**
+ * @brief Population bit count.
+ *
+ * @param v The value to population count.
+ *
+ * @return The number of 1 bits.
+ */
+static inline int popcount(uint64_t v)
+{
+ uint64_t mask1 = 0x5555555555555555ULL;
+ uint64_t mask2 = 0x3333333333333333ULL;
+ uint64_t mask3 = 0x0F0F0F0F0F0F0F0FULL;
+ v -= (v >> 1) & mask1;
+ v = (v & mask2) + ((v >> 2) & mask2);
+ v += v >> 4;
+ v &= mask3;
+ v *= 0x0101010101010101ULL;
+ v >>= 56;
+ return static_cast<int>(v);
+}
+
+#endif
+
+/**
+ * @brief Apply signed bit transfer.
+ *
+ * @param input0 The first encoded endpoint.
+ * @param input1 The second encoded endpoint.
+ */
+static ASTCENC_SIMD_INLINE void bit_transfer_signed(
+ vint4& input0,
+ vint4& input1
+) {
+ input1 = lsr<1>(input1) | (input0 & 0x80);
+ input0 = lsr<1>(input0) & 0x3F;
+
+ vmask4 mask = (input0 & 0x20) != vint4::zero();
+ input0 = select(input0, input0 - 0x40, mask);
+}
+
+/**
+ * @brief Debug function to print a vector of ints.
+ */
+ASTCENC_SIMD_INLINE void print(vint4 a)
+{
+ alignas(16) int v[4];
+ storea(a, v);
+ printf("v4_i32:\n %8d %8d %8d %8d\n",
+ v[0], v[1], v[2], v[3]);
+}
+
+/**
+ * @brief Debug function to print a vector of ints.
+ */
+ASTCENC_SIMD_INLINE void printx(vint4 a)
+{
+ alignas(16) int v[4];
+ storea(a, v);
+ printf("v4_i32:\n %08x %08x %08x %08x\n",
+ v[0], v[1], v[2], v[3]);
+}
+
+/**
+ * @brief Debug function to print a vector of floats.
+ */
+ASTCENC_SIMD_INLINE void print(vfloat4 a)
+{
+ alignas(16) float v[4];
+ storea(a, v);
+ printf("v4_f32:\n %0.4f %0.4f %0.4f %0.4f\n",
+ static_cast<double>(v[0]), static_cast<double>(v[1]),
+ static_cast<double>(v[2]), static_cast<double>(v[3]));
+}
+
+/**
+ * @brief Debug function to print a vector of masks.
+ */
+ASTCENC_SIMD_INLINE void print(vmask4 a)
+{
+ print(select(vint4(0), vint4(1), a));
+}
+
+#endif // #ifndef ASTC_VECMATHLIB_COMMON_4_H_INCLUDED
diff --git a/thirdparty/astcenc/astcenc_vecmathlib_neon_4.h b/thirdparty/astcenc/astcenc_vecmathlib_neon_4.h
new file mode 100644
index 0000000000..e742eae6cb
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_vecmathlib_neon_4.h
@@ -0,0 +1,1072 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2019-2022 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief 4x32-bit vectors, implemented using Armv8-A NEON.
+ *
+ * This module implements 4-wide 32-bit float, int, and mask vectors for
+ * Armv8-A NEON.
+ *
+ * There is a baseline level of functionality provided by all vector widths and
+ * implementations. This is implemented using identical function signatures,
+ * modulo data type, so we can use them as substitutable implementations in VLA
+ * code.
+ *
+ * The 4-wide vectors are also used as a fixed-width type, and significantly
+ * extend the functionality above that available to VLA code.
+ */
+
+#ifndef ASTC_VECMATHLIB_NEON_4_H_INCLUDED
+#define ASTC_VECMATHLIB_NEON_4_H_INCLUDED
+
+#ifndef ASTCENC_SIMD_INLINE
+ #error "Include astcenc_vecmathlib.h, do not include directly"
+#endif
+
+#include <cstdio>
+
+// ============================================================================
+// vfloat4 data type
+// ============================================================================
+
+/**
+ * @brief Data type for 4-wide floats.
+ */
+struct vfloat4
+{
+ /**
+ * @brief Construct from zero-initialized value.
+ */
+ ASTCENC_SIMD_INLINE vfloat4() = default;
+
+ /**
+ * @brief Construct from 4 values loaded from an unaligned address.
+ *
+ * Consider using loada() which is better with vectors if data is aligned
+ * to vector length.
+ */
+ ASTCENC_SIMD_INLINE explicit vfloat4(const float *p)
+ {
+ m = vld1q_f32(p);
+ }
+
+ /**
+ * @brief Construct from 1 scalar value replicated across all lanes.
+ *
+ * Consider using zero() for constexpr zeros.
+ */
+ ASTCENC_SIMD_INLINE explicit vfloat4(float a)
+ {
+ m = vdupq_n_f32(a);
+ }
+
+ /**
+ * @brief Construct from 4 scalar values.
+ *
+ * The value of @c a is stored to lane 0 (LSB) in the SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vfloat4(float a, float b, float c, float d)
+ {
+ float v[4] { a, b, c, d };
+ m = vld1q_f32(v);
+ }
+
+ /**
+ * @brief Construct from an existing SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vfloat4(float32x4_t a)
+ {
+ m = a;
+ }
+
+ /**
+ * @brief Get the scalar value of a single lane.
+ */
+ template <int l> ASTCENC_SIMD_INLINE float lane() const
+ {
+ return vgetq_lane_f32(m, l);
+ }
+
+ /**
+ * @brief Set the scalar value of a single lane.
+ */
+ template <int l> ASTCENC_SIMD_INLINE void set_lane(float a)
+ {
+ m = vsetq_lane_f32(a, m, l);
+ }
+
+ /**
+ * @brief Factory that returns a vector of zeros.
+ */
+ static ASTCENC_SIMD_INLINE vfloat4 zero()
+ {
+ return vfloat4(vdupq_n_f32(0.0f));
+ }
+
+ /**
+ * @brief Factory that returns a replicated scalar loaded from memory.
+ */
+ static ASTCENC_SIMD_INLINE vfloat4 load1(const float* p)
+ {
+ return vfloat4(vld1q_dup_f32(p));
+ }
+
+ /**
+ * @brief Factory that returns a vector loaded from 16B aligned memory.
+ */
+ static ASTCENC_SIMD_INLINE vfloat4 loada(const float* p)
+ {
+ return vfloat4(vld1q_f32(p));
+ }
+
+ /**
+ * @brief Factory that returns a vector containing the lane IDs.
+ */
+ static ASTCENC_SIMD_INLINE vfloat4 lane_id()
+ {
+ alignas(16) float data[4] { 0.0f, 1.0f, 2.0f, 3.0f };
+ return vfloat4(vld1q_f32(data));
+ }
+
+ /**
+ * @brief Return a swizzled float 2.
+ */
+ template <int l0, int l1> ASTCENC_SIMD_INLINE vfloat4 swz() const
+ {
+ return vfloat4(lane<l0>(), lane<l1>(), 0.0f, 0.0f);
+ }
+
+ /**
+ * @brief Return a swizzled float 3.
+ */
+ template <int l0, int l1, int l2> ASTCENC_SIMD_INLINE vfloat4 swz() const
+ {
+ return vfloat4(lane<l0>(), lane<l1>(), lane<l2>(), 0.0f);
+ }
+
+ /**
+ * @brief Return a swizzled float 4.
+ */
+ template <int l0, int l1, int l2, int l3> ASTCENC_SIMD_INLINE vfloat4 swz() const
+ {
+ return vfloat4(lane<l0>(), lane<l1>(), lane<l2>(), lane<l3>());
+ }
+
+ /**
+ * @brief The vector ...
+ */
+ float32x4_t m;
+};
+
+// ============================================================================
+// vint4 data type
+// ============================================================================
+
+/**
+ * @brief Data type for 4-wide ints.
+ */
+struct vint4
+{
+ /**
+ * @brief Construct from zero-initialized value.
+ */
+ ASTCENC_SIMD_INLINE vint4() = default;
+
+ /**
+ * @brief Construct from 4 values loaded from an unaligned address.
+ *
+ * Consider using loada() which is better with vectors if data is aligned
+ * to vector length.
+ */
+ ASTCENC_SIMD_INLINE explicit vint4(const int *p)
+ {
+ m = vld1q_s32(p);
+ }
+
+ /**
+ * @brief Construct from 4 uint8_t loaded from an unaligned address.
+ */
+ ASTCENC_SIMD_INLINE explicit vint4(const uint8_t *p)
+ {
+ // Cast is safe - NEON loads are allowed to be unaligned
+ uint32x2_t t8 = vld1_dup_u32(reinterpret_cast<const uint32_t*>(p));
+ uint16x4_t t16 = vget_low_u16(vmovl_u8(vreinterpret_u8_u32(t8)));
+ m = vreinterpretq_s32_u32(vmovl_u16(t16));
+ }
+
+ /**
+ * @brief Construct from 1 scalar value replicated across all lanes.
+ *
+ * Consider using vfloat4::zero() for constexpr zeros.
+ */
+ ASTCENC_SIMD_INLINE explicit vint4(int a)
+ {
+ m = vdupq_n_s32(a);
+ }
+
+ /**
+ * @brief Construct from 4 scalar values.
+ *
+ * The value of @c a is stored to lane 0 (LSB) in the SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vint4(int a, int b, int c, int d)
+ {
+ int v[4] { a, b, c, d };
+ m = vld1q_s32(v);
+ }
+
+ /**
+ * @brief Construct from an existing SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vint4(int32x4_t a)
+ {
+ m = a;
+ }
+
+ /**
+ * @brief Get the scalar from a single lane.
+ */
+ template <int l> ASTCENC_SIMD_INLINE int lane() const
+ {
+ return vgetq_lane_s32(m, l);
+ }
+
+ /**
+ * @brief Set the scalar value of a single lane.
+ */
+ template <int l> ASTCENC_SIMD_INLINE void set_lane(int a)
+ {
+ m = vsetq_lane_s32(a, m, l);
+ }
+
+ /**
+ * @brief Factory that returns a vector of zeros.
+ */
+ static ASTCENC_SIMD_INLINE vint4 zero()
+ {
+ return vint4(0);
+ }
+
+ /**
+ * @brief Factory that returns a replicated scalar loaded from memory.
+ */
+ static ASTCENC_SIMD_INLINE vint4 load1(const int* p)
+ {
+ return vint4(*p);
+ }
+
+ /**
+ * @brief Factory that returns a vector loaded from 16B aligned memory.
+ */
+ static ASTCENC_SIMD_INLINE vint4 loada(const int* p)
+ {
+ return vint4(p);
+ }
+
+ /**
+ * @brief Factory that returns a vector containing the lane IDs.
+ */
+ static ASTCENC_SIMD_INLINE vint4 lane_id()
+ {
+ alignas(16) static const int data[4] { 0, 1, 2, 3 };
+ return vint4(vld1q_s32(data));
+ }
+
+ /**
+ * @brief The vector ...
+ */
+ int32x4_t m;
+};
+
+// ============================================================================
+// vmask4 data type
+// ============================================================================
+
+/**
+ * @brief Data type for 4-wide control plane masks.
+ */
+struct vmask4
+{
+ /**
+ * @brief Construct from an existing SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vmask4(uint32x4_t a)
+ {
+ m = a;
+ }
+
+#if !defined(_MSC_VER)
+ /**
+ * @brief Construct from an existing SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vmask4(int32x4_t a)
+ {
+ m = vreinterpretq_u32_s32(a);
+ }
+#endif
+
+ /**
+ * @brief Construct from 1 scalar value.
+ */
+ ASTCENC_SIMD_INLINE explicit vmask4(bool a)
+ {
+ m = vreinterpretq_u32_s32(vdupq_n_s32(a == true ? -1 : 0));
+ }
+
+ /**
+ * @brief Construct from 4 scalar values.
+ *
+ * The value of @c a is stored to lane 0 (LSB) in the SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vmask4(bool a, bool b, bool c, bool d)
+ {
+ int v[4] {
+ a == true ? -1 : 0,
+ b == true ? -1 : 0,
+ c == true ? -1 : 0,
+ d == true ? -1 : 0
+ };
+
+ int32x4_t ms = vld1q_s32(v);
+ m = vreinterpretq_u32_s32(ms);
+ }
+
+ /**
+ * @brief Get the scalar from a single lane.
+ */
+ template <int32_t l> ASTCENC_SIMD_INLINE uint32_t lane() const
+ {
+ return vgetq_lane_u32(m, l);
+ }
+
+ /**
+ * @brief The vector ...
+ */
+ uint32x4_t m;
+};
+
+// ============================================================================
+// vmask4 operators and functions
+// ============================================================================
+
+/**
+ * @brief Overload: mask union (or).
+ */
+ASTCENC_SIMD_INLINE vmask4 operator|(vmask4 a, vmask4 b)
+{
+ return vmask4(vorrq_u32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: mask intersect (and).
+ */
+ASTCENC_SIMD_INLINE vmask4 operator&(vmask4 a, vmask4 b)
+{
+ return vmask4(vandq_u32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: mask difference (xor).
+ */
+ASTCENC_SIMD_INLINE vmask4 operator^(vmask4 a, vmask4 b)
+{
+ return vmask4(veorq_u32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: mask invert (not).
+ */
+ASTCENC_SIMD_INLINE vmask4 operator~(vmask4 a)
+{
+ return vmask4(vmvnq_u32(a.m));
+}
+
+/**
+ * @brief Return a 4-bit mask code indicating mask status.
+ *
+ * bit0 = lane 0
+ */
+ASTCENC_SIMD_INLINE unsigned int mask(vmask4 a)
+{
+ static const int shifta[4] { 0, 1, 2, 3 };
+ static const int32x4_t shift = vld1q_s32(shifta);
+
+ uint32x4_t tmp = vshrq_n_u32(a.m, 31);
+ return vaddvq_u32(vshlq_u32(tmp, shift));
+}
+
+// ============================================================================
+// vint4 operators and functions
+// ============================================================================
+
+/**
+ * @brief Overload: vector by vector addition.
+ */
+ASTCENC_SIMD_INLINE vint4 operator+(vint4 a, vint4 b)
+{
+ return vint4(vaddq_s32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector subtraction.
+ */
+ASTCENC_SIMD_INLINE vint4 operator-(vint4 a, vint4 b)
+{
+ return vint4(vsubq_s32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector multiplication.
+ */
+ASTCENC_SIMD_INLINE vint4 operator*(vint4 a, vint4 b)
+{
+ return vint4(vmulq_s32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector bit invert.
+ */
+ASTCENC_SIMD_INLINE vint4 operator~(vint4 a)
+{
+ return vint4(vmvnq_s32(a.m));
+}
+
+/**
+ * @brief Overload: vector by vector bitwise or.
+ */
+ASTCENC_SIMD_INLINE vint4 operator|(vint4 a, vint4 b)
+{
+ return vint4(vorrq_s32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector bitwise and.
+ */
+ASTCENC_SIMD_INLINE vint4 operator&(vint4 a, vint4 b)
+{
+ return vint4(vandq_s32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector bitwise xor.
+ */
+ASTCENC_SIMD_INLINE vint4 operator^(vint4 a, vint4 b)
+{
+ return vint4(veorq_s32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector equality.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator==(vint4 a, vint4 b)
+{
+ return vmask4(vceqq_s32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector inequality.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator!=(vint4 a, vint4 b)
+{
+ return ~vmask4(vceqq_s32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector less than.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator<(vint4 a, vint4 b)
+{
+ return vmask4(vcltq_s32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector greater than.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator>(vint4 a, vint4 b)
+{
+ return vmask4(vcgtq_s32(a.m, b.m));
+}
+
+/**
+ * @brief Logical shift left.
+ */
+template <int s> ASTCENC_SIMD_INLINE vint4 lsl(vint4 a)
+{
+ return vint4(vshlq_s32(a.m, vdupq_n_s32(s)));
+}
+
+/**
+ * @brief Logical shift right.
+ */
+template <int s> ASTCENC_SIMD_INLINE vint4 lsr(vint4 a)
+{
+ uint32x4_t ua = vreinterpretq_u32_s32(a.m);
+ ua = vshlq_u32(ua, vdupq_n_s32(-s));
+ return vint4(vreinterpretq_s32_u32(ua));
+}
+
+/**
+ * @brief Arithmetic shift right.
+ */
+template <int s> ASTCENC_SIMD_INLINE vint4 asr(vint4 a)
+{
+ return vint4(vshlq_s32(a.m, vdupq_n_s32(-s)));
+}
+
+/**
+ * @brief Return the min vector of two vectors.
+ */
+ASTCENC_SIMD_INLINE vint4 min(vint4 a, vint4 b)
+{
+ return vint4(vminq_s32(a.m, b.m));
+}
+
+/**
+ * @brief Return the max vector of two vectors.
+ */
+ASTCENC_SIMD_INLINE vint4 max(vint4 a, vint4 b)
+{
+ return vint4(vmaxq_s32(a.m, b.m));
+}
+
+/**
+ * @brief Return the horizontal minimum of a vector.
+ */
+ASTCENC_SIMD_INLINE vint4 hmin(vint4 a)
+{
+ return vint4(vminvq_s32(a.m));
+}
+
+/**
+ * @brief Return the horizontal maximum of a vector.
+ */
+ASTCENC_SIMD_INLINE vint4 hmax(vint4 a)
+{
+ return vint4(vmaxvq_s32(a.m));
+}
+
+/**
+ * @brief Return the horizontal sum of a vector.
+ */
+ASTCENC_SIMD_INLINE int hadd_s(vint4 a)
+{
+ int32x2_t t = vadd_s32(vget_high_s32(a.m), vget_low_s32(a.m));
+ return vget_lane_s32(vpadd_s32(t, t), 0);
+}
+
+/**
+ * @brief Store a vector to a 16B aligned memory address.
+ */
+ASTCENC_SIMD_INLINE void storea(vint4 a, int* p)
+{
+ vst1q_s32(p, a.m);
+}
+
+/**
+ * @brief Store a vector to an unaligned memory address.
+ */
+ASTCENC_SIMD_INLINE void store(vint4 a, int* p)
+{
+ vst1q_s32(p, a.m);
+}
+
+/**
+ * @brief Store lowest N (vector width) bytes into an unaligned address.
+ */
+ASTCENC_SIMD_INLINE void store_nbytes(vint4 a, uint8_t* p)
+{
+ vst1q_lane_s32(reinterpret_cast<int32_t*>(p), a.m, 0);
+}
+
+/**
+ * @brief Gather N (vector width) indices from the array.
+ */
+ASTCENC_SIMD_INLINE vint4 gatheri(const int* base, vint4 indices)
+{
+ alignas(16) int idx[4];
+ storea(indices, idx);
+ alignas(16) int vals[4];
+ vals[0] = base[idx[0]];
+ vals[1] = base[idx[1]];
+ vals[2] = base[idx[2]];
+ vals[3] = base[idx[3]];
+ return vint4(vals);
+}
+
+/**
+ * @brief Pack low 8 bits of N (vector width) lanes into bottom of vector.
+ */
+ASTCENC_SIMD_INLINE vint4 pack_low_bytes(vint4 a)
+{
+ alignas(16) uint8_t shuf[16] {
+ 0, 4, 8, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ uint8x16_t idx = vld1q_u8(shuf);
+ int8x16_t av = vreinterpretq_s8_s32(a.m);
+ return vint4(vreinterpretq_s32_s8(vqtbl1q_s8(av, idx)));
+}
+
+/**
+ * @brief Return lanes from @c b if @c cond is set, else @c a.
+ */
+ASTCENC_SIMD_INLINE vint4 select(vint4 a, vint4 b, vmask4 cond)
+{
+ return vint4(vbslq_s32(cond.m, b.m, a.m));
+}
+
+// ============================================================================
+// vfloat4 operators and functions
+// ============================================================================
+
+/**
+ * @brief Overload: vector by vector addition.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator+(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(vaddq_f32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector subtraction.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator-(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(vsubq_f32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector multiplication.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator*(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(vmulq_f32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector division.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator/(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(vdivq_f32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector equality.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator==(vfloat4 a, vfloat4 b)
+{
+ return vmask4(vceqq_f32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector inequality.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator!=(vfloat4 a, vfloat4 b)
+{
+ return vmask4(vmvnq_u32(vceqq_f32(a.m, b.m)));
+}
+
+/**
+ * @brief Overload: vector by vector less than.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator<(vfloat4 a, vfloat4 b)
+{
+ return vmask4(vcltq_f32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector greater than.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator>(vfloat4 a, vfloat4 b)
+{
+ return vmask4(vcgtq_f32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector less than or equal.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator<=(vfloat4 a, vfloat4 b)
+{
+ return vmask4(vcleq_f32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector greater than or equal.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator>=(vfloat4 a, vfloat4 b)
+{
+ return vmask4(vcgeq_f32(a.m, b.m));
+}
+
+/**
+ * @brief Return the min vector of two vectors.
+ *
+ * If either lane value is NaN, @c b will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat4 min(vfloat4 a, vfloat4 b)
+{
+ // Do not reorder - second operand will return if either is NaN
+ return vfloat4(vminnmq_f32(a.m, b.m));
+}
+
+/**
+ * @brief Return the max vector of two vectors.
+ *
+ * If either lane value is NaN, @c b will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat4 max(vfloat4 a, vfloat4 b)
+{
+ // Do not reorder - second operand will return if either is NaN
+ return vfloat4(vmaxnmq_f32(a.m, b.m));
+}
+
+/**
+ * @brief Return the absolute value of the float vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 abs(vfloat4 a)
+{
+ float32x4_t zero = vdupq_n_f32(0.0f);
+ float32x4_t inv = vsubq_f32(zero, a.m);
+ return vfloat4(vmaxq_f32(a.m, inv));
+}
+
+/**
+ * @brief Return a float rounded to the nearest integer value.
+ */
+ASTCENC_SIMD_INLINE vfloat4 round(vfloat4 a)
+{
+ return vfloat4(vrndnq_f32(a.m));
+}
+
+/**
+ * @brief Return the horizontal minimum of a vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 hmin(vfloat4 a)
+{
+ return vfloat4(vminvq_f32(a.m));
+}
+
+/**
+ * @brief Return the horizontal maximum of a vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 hmax(vfloat4 a)
+{
+ return vfloat4(vmaxvq_f32(a.m));
+}
+
+/**
+ * @brief Return the horizontal sum of a vector.
+ */
+ASTCENC_SIMD_INLINE float hadd_s(vfloat4 a)
+{
+ // Perform halving add to ensure invariance; we cannot use vaddqv as this
+ // does (0 + 1 + 2 + 3) which is not invariant with x86 (0 + 2) + (1 + 3).
+ float32x2_t t = vadd_f32(vget_high_f32(a.m), vget_low_f32(a.m));
+ return vget_lane_f32(vpadd_f32(t, t), 0);
+}
+
+/**
+ * @brief Return the sqrt of the lanes in the vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 sqrt(vfloat4 a)
+{
+ return vfloat4(vsqrtq_f32(a.m));
+}
+
+/**
+ * @brief Return lanes from @c b if @c cond is set, else @c a.
+ */
+ASTCENC_SIMD_INLINE vfloat4 select(vfloat4 a, vfloat4 b, vmask4 cond)
+{
+ return vfloat4(vbslq_f32(cond.m, b.m, a.m));
+}
+
+/**
+ * @brief Return lanes from @c b if MSB of @c cond is set, else @c a.
+ */
+ASTCENC_SIMD_INLINE vfloat4 select_msb(vfloat4 a, vfloat4 b, vmask4 cond)
+{
+ static const uint32x4_t msb = vdupq_n_u32(0x80000000u);
+ uint32x4_t mask = vcgeq_u32(cond.m, msb);
+ return vfloat4(vbslq_f32(mask, b.m, a.m));
+}
+
+/**
+ * @brief Load a vector of gathered results from an array;
+ */
+ASTCENC_SIMD_INLINE vfloat4 gatherf(const float* base, vint4 indices)
+{
+ alignas(16) int idx[4];
+ storea(indices, idx);
+ alignas(16) float vals[4];
+ vals[0] = base[idx[0]];
+ vals[1] = base[idx[1]];
+ vals[2] = base[idx[2]];
+ vals[3] = base[idx[3]];
+ return vfloat4(vals);
+}
+
+/**
+ * @brief Store a vector to an unaligned memory address.
+ */
+ASTCENC_SIMD_INLINE void store(vfloat4 a, float* p)
+{
+ vst1q_f32(p, a.m);
+}
+
+/**
+ * @brief Store a vector to a 16B aligned memory address.
+ */
+ASTCENC_SIMD_INLINE void storea(vfloat4 a, float* p)
+{
+ vst1q_f32(p, a.m);
+}
+
+/**
+ * @brief Return a integer value for a float vector, using truncation.
+ */
+ASTCENC_SIMD_INLINE vint4 float_to_int(vfloat4 a)
+{
+ return vint4(vcvtq_s32_f32(a.m));
+}
+
+/**
+ * @brief Return a integer value for a float vector, using round-to-nearest.
+ */
+ASTCENC_SIMD_INLINE vint4 float_to_int_rtn(vfloat4 a)
+{
+ a = round(a);
+ return vint4(vcvtq_s32_f32(a.m));
+}
+
+/**
+ * @brief Return a float value for an integer vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 int_to_float(vint4 a)
+{
+ return vfloat4(vcvtq_f32_s32(a.m));
+}
+
+/**
+ * @brief Return a float16 value for a float vector, using round-to-nearest.
+ */
+ASTCENC_SIMD_INLINE vint4 float_to_float16(vfloat4 a)
+{
+ // Generate float16 value
+ float16x4_t f16 = vcvt_f16_f32(a.m);
+
+ // Convert each 16-bit float pattern to a 32-bit pattern
+ uint16x4_t u16 = vreinterpret_u16_f16(f16);
+ uint32x4_t u32 = vmovl_u16(u16);
+ return vint4(vreinterpretq_s32_u32(u32));
+}
+
+/**
+ * @brief Return a float16 value for a float scalar, using round-to-nearest.
+ */
+static inline uint16_t float_to_float16(float a)
+{
+ vfloat4 av(a);
+ return static_cast<uint16_t>(float_to_float16(av).lane<0>());
+}
+
+/**
+ * @brief Return a float value for a float16 vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 float16_to_float(vint4 a)
+{
+ // Convert each 32-bit float pattern to a 16-bit pattern
+ uint32x4_t u32 = vreinterpretq_u32_s32(a.m);
+ uint16x4_t u16 = vmovn_u32(u32);
+ float16x4_t f16 = vreinterpret_f16_u16(u16);
+
+ // Generate float16 value
+ return vfloat4(vcvt_f32_f16(f16));
+}
+
+/**
+ * @brief Return a float value for a float16 scalar.
+ */
+ASTCENC_SIMD_INLINE float float16_to_float(uint16_t a)
+{
+ vint4 av(a);
+ return float16_to_float(av).lane<0>();
+}
+
+/**
+ * @brief Return a float value as an integer bit pattern (i.e. no conversion).
+ *
+ * It is a common trick to convert floats into integer bit patterns, perform
+ * some bit hackery based on knowledge they are IEEE 754 layout, and then
+ * convert them back again. This is the first half of that flip.
+ */
+ASTCENC_SIMD_INLINE vint4 float_as_int(vfloat4 a)
+{
+ return vint4(vreinterpretq_s32_f32(a.m));
+}
+
+/**
+ * @brief Return a integer value as a float bit pattern (i.e. no conversion).
+ *
+ * It is a common trick to convert floats into integer bit patterns, perform
+ * some bit hackery based on knowledge they are IEEE 754 layout, and then
+ * convert them back again. This is the second half of that flip.
+ */
+ASTCENC_SIMD_INLINE vfloat4 int_as_float(vint4 v)
+{
+ return vfloat4(vreinterpretq_f32_s32(v.m));
+}
+
+/**
+ * @brief Prepare a vtable lookup table for use with the native SIMD size.
+ */
+ASTCENC_SIMD_INLINE void vtable_prepare(vint4 t0, vint4& t0p)
+{
+ t0p = t0;
+}
+
+
+/**
+ * @brief Prepare a vtable lookup table for use with the native SIMD size.
+ */
+ASTCENC_SIMD_INLINE void vtable_prepare(vint4 t0, vint4 t1, vint4& t0p, vint4& t1p)
+{
+ t0p = t0;
+ t1p = t1;
+}
+
+/**
+ * @brief Prepare a vtable lookup table for use with the native SIMD size.
+ */
+ASTCENC_SIMD_INLINE void vtable_prepare(
+ vint4 t0, vint4 t1, vint4 t2, vint4 t3,
+ vint4& t0p, vint4& t1p, vint4& t2p, vint4& t3p)
+{
+ t0p = t0;
+ t1p = t1;
+ t2p = t2;
+ t3p = t3;
+}
+
+/**
+ * @brief Perform an 8-bit 16-entry table lookup, with 32-bit indexes.
+ */
+ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 idx)
+{
+ int8x16_t table {
+ vreinterpretq_s8_s32(t0.m)
+ };
+
+ // Set index byte above max index for unused bytes so table lookup returns zero
+ int32x4_t idx_masked = vorrq_s32(idx.m, vdupq_n_s32(0xFFFFFF00));
+ uint8x16_t idx_bytes = vreinterpretq_u8_s32(idx_masked);
+
+ return vint4(vreinterpretq_s32_s8(vqtbl1q_s8(table, idx_bytes)));
+}
+
+/**
+ * @brief Perform an 8-bit 32-entry table lookup, with 32-bit indexes.
+ */
+ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 t1, vint4 idx)
+{
+ int8x16x2_t table {
+ vreinterpretq_s8_s32(t0.m),
+ vreinterpretq_s8_s32(t1.m)
+ };
+
+ // Set index byte above max index for unused bytes so table lookup returns zero
+ int32x4_t idx_masked = vorrq_s32(idx.m, vdupq_n_s32(0xFFFFFF00));
+ uint8x16_t idx_bytes = vreinterpretq_u8_s32(idx_masked);
+
+ return vint4(vreinterpretq_s32_s8(vqtbl2q_s8(table, idx_bytes)));
+}
+
+/**
+ * @brief Perform an 8-bit 64-entry table lookup, with 32-bit indexes.
+ */
+ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 t1, vint4 t2, vint4 t3, vint4 idx)
+{
+ int8x16x4_t table {
+ vreinterpretq_s8_s32(t0.m),
+ vreinterpretq_s8_s32(t1.m),
+ vreinterpretq_s8_s32(t2.m),
+ vreinterpretq_s8_s32(t3.m)
+ };
+
+ // Set index byte above max index for unused bytes so table lookup returns zero
+ int32x4_t idx_masked = vorrq_s32(idx.m, vdupq_n_s32(0xFFFFFF00));
+ uint8x16_t idx_bytes = vreinterpretq_u8_s32(idx_masked);
+
+ return vint4(vreinterpretq_s32_s8(vqtbl4q_s8(table, idx_bytes)));
+}
+
+/**
+ * @brief Return a vector of interleaved RGBA data.
+ *
+ * Input vectors have the value stored in the bottom 8 bits of each lane,
+ * with high bits set to zero.
+ *
+ * Output vector stores a single RGBA texel packed in each lane.
+ */
+ASTCENC_SIMD_INLINE vint4 interleave_rgba8(vint4 r, vint4 g, vint4 b, vint4 a)
+{
+ return r + lsl<8>(g) + lsl<16>(b) + lsl<24>(a);
+}
+
+/**
+ * @brief Store a vector, skipping masked lanes.
+ *
+ * All masked lanes must be at the end of vector, after all non-masked lanes.
+ */
+ASTCENC_SIMD_INLINE void store_lanes_masked(int* base, vint4 data, vmask4 mask)
+{
+ if (mask.lane<3>())
+ {
+ store(data, base);
+ }
+ else if (mask.lane<2>())
+ {
+ base[0] = data.lane<0>();
+ base[1] = data.lane<1>();
+ base[2] = data.lane<2>();
+ }
+ else if (mask.lane<1>())
+ {
+ base[0] = data.lane<0>();
+ base[1] = data.lane<1>();
+ }
+ else if (mask.lane<0>())
+ {
+ base[0] = data.lane<0>();
+ }
+}
+
+#define ASTCENC_USE_NATIVE_POPCOUNT 1
+
+/**
+ * @brief Population bit count.
+ *
+ * @param v The value to population count.
+ *
+ * @return The number of 1 bits.
+ */
+ASTCENC_SIMD_INLINE int popcount(uint64_t v)
+{
+ return static_cast<int>(vaddlv_u8(vcnt_u8(vcreate_u8(v))));
+}
+
+#endif // #ifndef ASTC_VECMATHLIB_NEON_4_H_INCLUDED
diff --git a/thirdparty/astcenc/astcenc_vecmathlib_none_4.h b/thirdparty/astcenc/astcenc_vecmathlib_none_4.h
new file mode 100644
index 0000000000..d9b52be3e4
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_vecmathlib_none_4.h
@@ -0,0 +1,1169 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2019-2022 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief 4x32-bit vectors, implemented using plain C++.
+ *
+ * This module implements 4-wide 32-bit float, int, and mask vectors. This
+ * module provides a scalar fallback for VLA code, primarily useful for
+ * debugging VLA algorithms without the complexity of handling SIMD. Only the
+ * baseline level of functionality needed to support VLA is provided.
+ *
+ * Note that the vector conditional operators implemented by this module are
+ * designed to behave like SIMD conditional operators that generate lane masks.
+ * Rather than returning 0/1 booleans like normal C++ code they will return
+ * 0/-1 to give a full lane-width bitmask.
+ *
+ * Note that the documentation for this module still talks about "vectors" to
+ * help developers think about the implied VLA behavior when writing optimized
+ * paths.
+ */
+
+#ifndef ASTC_VECMATHLIB_NONE_4_H_INCLUDED
+#define ASTC_VECMATHLIB_NONE_4_H_INCLUDED
+
+#ifndef ASTCENC_SIMD_INLINE
+ #error "Include astcenc_vecmathlib.h, do not include directly"
+#endif
+
+#include <algorithm>
+#include <cstdio>
+#include <cstring>
+#include <cfenv>
+
+// ============================================================================
+// vfloat4 data type
+// ============================================================================
+
+/**
+ * @brief Data type for 4-wide floats.
+ */
+struct vfloat4
+{
+ /**
+ * @brief Construct from zero-initialized value.
+ */
+ ASTCENC_SIMD_INLINE vfloat4() = default;
+
+ /**
+ * @brief Construct from 4 values loaded from an unaligned address.
+ *
+ * Consider using loada() which is better with wider VLA vectors if data is
+ * aligned to vector length.
+ */
+ ASTCENC_SIMD_INLINE explicit vfloat4(const float* p)
+ {
+ m[0] = p[0];
+ m[1] = p[1];
+ m[2] = p[2];
+ m[3] = p[3];
+ }
+
+ /**
+ * @brief Construct from 4 scalar values replicated across all lanes.
+ *
+ * Consider using zero() for constexpr zeros.
+ */
+ ASTCENC_SIMD_INLINE explicit vfloat4(float a)
+ {
+ m[0] = a;
+ m[1] = a;
+ m[2] = a;
+ m[3] = a;
+ }
+
+ /**
+ * @brief Construct from 4 scalar values.
+ *
+ * The value of @c a is stored to lane 0 (LSB) in the SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vfloat4(float a, float b, float c, float d)
+ {
+ m[0] = a;
+ m[1] = b;
+ m[2] = c;
+ m[3] = d;
+ }
+
+ /**
+ * @brief Get the scalar value of a single lane.
+ */
+ template <int l> ASTCENC_SIMD_INLINE float lane() const
+ {
+ return m[l];
+ }
+
+ /**
+ * @brief Set the scalar value of a single lane.
+ */
+ template <int l> ASTCENC_SIMD_INLINE void set_lane(float a)
+ {
+ m[l] = a;
+ }
+
+ /**
+ * @brief Factory that returns a vector of zeros.
+ */
+ static ASTCENC_SIMD_INLINE vfloat4 zero()
+ {
+ return vfloat4(0.0f);
+ }
+
+ /**
+ * @brief Factory that returns a replicated scalar loaded from memory.
+ */
+ static ASTCENC_SIMD_INLINE vfloat4 load1(const float* p)
+ {
+ return vfloat4(*p);
+ }
+
+ /**
+ * @brief Factory that returns a vector loaded from aligned memory.
+ */
+ static ASTCENC_SIMD_INLINE vfloat4 loada(const float* p)
+ {
+ return vfloat4(p);
+ }
+
+ /**
+ * @brief Factory that returns a vector containing the lane IDs.
+ */
+ static ASTCENC_SIMD_INLINE vfloat4 lane_id()
+ {
+ return vfloat4(0.0f, 1.0f, 2.0f, 3.0f);
+ }
+
+ /**
+ * @brief Return a swizzled float 2.
+ */
+ template <int l0, int l1> ASTCENC_SIMD_INLINE vfloat4 swz() const
+ {
+ return vfloat4(lane<l0>(), lane<l1>(), 0.0f, 0.0f);
+ }
+
+ /**
+ * @brief Return a swizzled float 3.
+ */
+ template <int l0, int l1, int l2> ASTCENC_SIMD_INLINE vfloat4 swz() const
+ {
+ return vfloat4(lane<l0>(), lane<l1>(), lane<l2>(), 0.0f);
+ }
+
+ /**
+ * @brief Return a swizzled float 4.
+ */
+ template <int l0, int l1, int l2, int l3> ASTCENC_SIMD_INLINE vfloat4 swz() const
+ {
+ return vfloat4(lane<l0>(), lane<l1>(), lane<l2>(), lane<l3>());
+ }
+
+ /**
+ * @brief The vector ...
+ */
+ float m[4];
+};
+
+// ============================================================================
+// vint4 data type
+// ============================================================================
+
+/**
+ * @brief Data type for 4-wide ints.
+ */
+struct vint4
+{
+ /**
+ * @brief Construct from zero-initialized value.
+ */
+ ASTCENC_SIMD_INLINE vint4() = default;
+
+ /**
+ * @brief Construct from 4 values loaded from an unaligned address.
+ *
+ * Consider using vint4::loada() which is better with wider VLA vectors
+ * if data is aligned.
+ */
+ ASTCENC_SIMD_INLINE explicit vint4(const int* p)
+ {
+ m[0] = p[0];
+ m[1] = p[1];
+ m[2] = p[2];
+ m[3] = p[3];
+ }
+
+ /**
+ * @brief Construct from 4 uint8_t loaded from an unaligned address.
+ */
+ ASTCENC_SIMD_INLINE explicit vint4(const uint8_t *p)
+ {
+ m[0] = p[0];
+ m[1] = p[1];
+ m[2] = p[2];
+ m[3] = p[3];
+ }
+
+ /**
+ * @brief Construct from 4 scalar values.
+ *
+ * The value of @c a is stored to lane 0 (LSB) in the SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vint4(int a, int b, int c, int d)
+ {
+ m[0] = a;
+ m[1] = b;
+ m[2] = c;
+ m[3] = d;
+ }
+
+
+ /**
+ * @brief Construct from 4 scalar values replicated across all lanes.
+ *
+ * Consider using vint4::zero() for constexpr zeros.
+ */
+ ASTCENC_SIMD_INLINE explicit vint4(int a)
+ {
+ m[0] = a;
+ m[1] = a;
+ m[2] = a;
+ m[3] = a;
+ }
+
+ /**
+ * @brief Get the scalar value of a single lane.
+ */
+ template <int l> ASTCENC_SIMD_INLINE int lane() const
+ {
+ return m[l];
+ }
+
+ /**
+ * @brief Set the scalar value of a single lane.
+ */
+ template <int l> ASTCENC_SIMD_INLINE void set_lane(int a)
+ {
+ m[l] = a;
+ }
+
+ /**
+ * @brief Factory that returns a vector of zeros.
+ */
+ static ASTCENC_SIMD_INLINE vint4 zero()
+ {
+ return vint4(0);
+ }
+
+ /**
+ * @brief Factory that returns a replicated scalar loaded from memory.
+ */
+ static ASTCENC_SIMD_INLINE vint4 load1(const int* p)
+ {
+ return vint4(*p);
+ }
+
+ /**
+ * @brief Factory that returns a vector loaded from 16B aligned memory.
+ */
+ static ASTCENC_SIMD_INLINE vint4 loada(const int* p)
+ {
+ return vint4(p);
+ }
+
+ /**
+ * @brief Factory that returns a vector containing the lane IDs.
+ */
+ static ASTCENC_SIMD_INLINE vint4 lane_id()
+ {
+ return vint4(0, 1, 2, 3);
+ }
+
+ /**
+ * @brief The vector ...
+ */
+ int m[4];
+};
+
+// ============================================================================
+// vmask4 data type
+// ============================================================================
+
+/**
+ * @brief Data type for 4-wide control plane masks.
+ */
+struct vmask4
+{
+ /**
+ * @brief Construct from an existing mask value.
+ */
+ ASTCENC_SIMD_INLINE explicit vmask4(int* p)
+ {
+ m[0] = p[0];
+ m[1] = p[1];
+ m[2] = p[2];
+ m[3] = p[3];
+ }
+
+ /**
+ * @brief Construct from 1 scalar value.
+ */
+ ASTCENC_SIMD_INLINE explicit vmask4(bool a)
+ {
+ m[0] = a == false ? 0 : -1;
+ m[1] = a == false ? 0 : -1;
+ m[2] = a == false ? 0 : -1;
+ m[3] = a == false ? 0 : -1;
+ }
+
+ /**
+ * @brief Construct from 4 scalar values.
+ *
+ * The value of @c a is stored to lane 0 (LSB) in the SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vmask4(bool a, bool b, bool c, bool d)
+ {
+ m[0] = a == false ? 0 : -1;
+ m[1] = b == false ? 0 : -1;
+ m[2] = c == false ? 0 : -1;
+ m[3] = d == false ? 0 : -1;
+ }
+
+
+ /**
+ * @brief The vector ...
+ */
+ int m[4];
+};
+
+// ============================================================================
+// vmask4 operators and functions
+// ============================================================================
+
+/**
+ * @brief Overload: mask union (or).
+ */
+ASTCENC_SIMD_INLINE vmask4 operator|(vmask4 a, vmask4 b)
+{
+ return vmask4(a.m[0] | b.m[0],
+ a.m[1] | b.m[1],
+ a.m[2] | b.m[2],
+ a.m[3] | b.m[3]);
+}
+
+/**
+ * @brief Overload: mask intersect (and).
+ */
+ASTCENC_SIMD_INLINE vmask4 operator&(vmask4 a, vmask4 b)
+{
+ return vmask4(a.m[0] & b.m[0],
+ a.m[1] & b.m[1],
+ a.m[2] & b.m[2],
+ a.m[3] & b.m[3]);
+}
+
+/**
+ * @brief Overload: mask difference (xor).
+ */
+ASTCENC_SIMD_INLINE vmask4 operator^(vmask4 a, vmask4 b)
+{
+ return vmask4(a.m[0] ^ b.m[0],
+ a.m[1] ^ b.m[1],
+ a.m[2] ^ b.m[2],
+ a.m[3] ^ b.m[3]);
+}
+
+/**
+ * @brief Overload: mask invert (not).
+ */
+ASTCENC_SIMD_INLINE vmask4 operator~(vmask4 a)
+{
+ return vmask4(~a.m[0],
+ ~a.m[1],
+ ~a.m[2],
+ ~a.m[3]);
+}
+
+/**
+ * @brief Return a 1-bit mask code indicating mask status.
+ *
+ * bit0 = lane 0
+ */
+ASTCENC_SIMD_INLINE unsigned int mask(vmask4 a)
+{
+ return ((a.m[0] >> 31) & 0x1) |
+ ((a.m[1] >> 30) & 0x2) |
+ ((a.m[2] >> 29) & 0x4) |
+ ((a.m[3] >> 28) & 0x8);
+}
+
+// ============================================================================
+// vint4 operators and functions
+// ============================================================================
+
+/**
+ * @brief Overload: vector by vector addition.
+ */
+ASTCENC_SIMD_INLINE vint4 operator+(vint4 a, vint4 b)
+{
+ return vint4(a.m[0] + b.m[0],
+ a.m[1] + b.m[1],
+ a.m[2] + b.m[2],
+ a.m[3] + b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector subtraction.
+ */
+ASTCENC_SIMD_INLINE vint4 operator-(vint4 a, vint4 b)
+{
+ return vint4(a.m[0] - b.m[0],
+ a.m[1] - b.m[1],
+ a.m[2] - b.m[2],
+ a.m[3] - b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector multiplication.
+ */
+ASTCENC_SIMD_INLINE vint4 operator*(vint4 a, vint4 b)
+{
+ return vint4(a.m[0] * b.m[0],
+ a.m[1] * b.m[1],
+ a.m[2] * b.m[2],
+ a.m[3] * b.m[3]);
+}
+
+/**
+ * @brief Overload: vector bit invert.
+ */
+ASTCENC_SIMD_INLINE vint4 operator~(vint4 a)
+{
+ return vint4(~a.m[0],
+ ~a.m[1],
+ ~a.m[2],
+ ~a.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector bitwise or.
+ */
+ASTCENC_SIMD_INLINE vint4 operator|(vint4 a, vint4 b)
+{
+ return vint4(a.m[0] | b.m[0],
+ a.m[1] | b.m[1],
+ a.m[2] | b.m[2],
+ a.m[3] | b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector bitwise and.
+ */
+ASTCENC_SIMD_INLINE vint4 operator&(vint4 a, vint4 b)
+{
+ return vint4(a.m[0] & b.m[0],
+ a.m[1] & b.m[1],
+ a.m[2] & b.m[2],
+ a.m[3] & b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector bitwise xor.
+ */
+ASTCENC_SIMD_INLINE vint4 operator^(vint4 a, vint4 b)
+{
+ return vint4(a.m[0] ^ b.m[0],
+ a.m[1] ^ b.m[1],
+ a.m[2] ^ b.m[2],
+ a.m[3] ^ b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector equality.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator==(vint4 a, vint4 b)
+{
+ return vmask4(a.m[0] == b.m[0],
+ a.m[1] == b.m[1],
+ a.m[2] == b.m[2],
+ a.m[3] == b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector inequality.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator!=(vint4 a, vint4 b)
+{
+ return vmask4(a.m[0] != b.m[0],
+ a.m[1] != b.m[1],
+ a.m[2] != b.m[2],
+ a.m[3] != b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector less than.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator<(vint4 a, vint4 b)
+{
+ return vmask4(a.m[0] < b.m[0],
+ a.m[1] < b.m[1],
+ a.m[2] < b.m[2],
+ a.m[3] < b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector greater than.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator>(vint4 a, vint4 b)
+{
+ return vmask4(a.m[0] > b.m[0],
+ a.m[1] > b.m[1],
+ a.m[2] > b.m[2],
+ a.m[3] > b.m[3]);
+}
+
+/**
+ * @brief Logical shift left.
+ */
+template <int s> ASTCENC_SIMD_INLINE vint4 lsl(vint4 a)
+{
+ return vint4(a.m[0] << s,
+ a.m[1] << s,
+ a.m[2] << s,
+ a.m[3] << s);
+}
+
+/**
+ * @brief Logical shift right.
+ */
+template <int s> ASTCENC_SIMD_INLINE vint4 lsr(vint4 a)
+{
+ unsigned int as0 = static_cast<unsigned int>(a.m[0]) >> s;
+ unsigned int as1 = static_cast<unsigned int>(a.m[1]) >> s;
+ unsigned int as2 = static_cast<unsigned int>(a.m[2]) >> s;
+ unsigned int as3 = static_cast<unsigned int>(a.m[3]) >> s;
+
+ return vint4(static_cast<int>(as0),
+ static_cast<int>(as1),
+ static_cast<int>(as2),
+ static_cast<int>(as3));
+}
+
+/**
+ * @brief Arithmetic shift right.
+ */
+template <int s> ASTCENC_SIMD_INLINE vint4 asr(vint4 a)
+{
+ return vint4(a.m[0] >> s,
+ a.m[1] >> s,
+ a.m[2] >> s,
+ a.m[3] >> s);
+}
+
+/**
+ * @brief Return the min vector of two vectors.
+ */
+ASTCENC_SIMD_INLINE vint4 min(vint4 a, vint4 b)
+{
+ return vint4(a.m[0] < b.m[0] ? a.m[0] : b.m[0],
+ a.m[1] < b.m[1] ? a.m[1] : b.m[1],
+ a.m[2] < b.m[2] ? a.m[2] : b.m[2],
+ a.m[3] < b.m[3] ? a.m[3] : b.m[3]);
+}
+
+/**
+ * @brief Return the min vector of two vectors.
+ */
+ASTCENC_SIMD_INLINE vint4 max(vint4 a, vint4 b)
+{
+ return vint4(a.m[0] > b.m[0] ? a.m[0] : b.m[0],
+ a.m[1] > b.m[1] ? a.m[1] : b.m[1],
+ a.m[2] > b.m[2] ? a.m[2] : b.m[2],
+ a.m[3] > b.m[3] ? a.m[3] : b.m[3]);
+}
+
+/**
+ * @brief Return the horizontal minimum of a single vector.
+ */
+ASTCENC_SIMD_INLINE vint4 hmin(vint4 a)
+{
+ int b = std::min(a.m[0], a.m[1]);
+ int c = std::min(a.m[2], a.m[3]);
+ return vint4(std::min(b, c));
+}
+
+/**
+ * @brief Return the horizontal maximum of a single vector.
+ */
+ASTCENC_SIMD_INLINE vint4 hmax(vint4 a)
+{
+ int b = std::max(a.m[0], a.m[1]);
+ int c = std::max(a.m[2], a.m[3]);
+ return vint4(std::max(b, c));
+}
+
+/**
+ * @brief Return the horizontal sum of vector lanes as a scalar.
+ */
+ASTCENC_SIMD_INLINE int hadd_s(vint4 a)
+{
+ return a.m[0] + a.m[1] + a.m[2] + a.m[3];
+}
+
+/**
+ * @brief Store a vector to an aligned memory address.
+ */
+ASTCENC_SIMD_INLINE void storea(vint4 a, int* p)
+{
+ p[0] = a.m[0];
+ p[1] = a.m[1];
+ p[2] = a.m[2];
+ p[3] = a.m[3];
+}
+
+/**
+ * @brief Store a vector to an unaligned memory address.
+ */
+ASTCENC_SIMD_INLINE void store(vint4 a, int* p)
+{
+ p[0] = a.m[0];
+ p[1] = a.m[1];
+ p[2] = a.m[2];
+ p[3] = a.m[3];
+}
+
+/**
+ * @brief Store lowest N (vector width) bytes into an unaligned address.
+ */
+ASTCENC_SIMD_INLINE void store_nbytes(vint4 a, uint8_t* p)
+{
+ int* pi = reinterpret_cast<int*>(p);
+ *pi = a.m[0];
+}
+
+/**
+ * @brief Gather N (vector width) indices from the array.
+ */
+ASTCENC_SIMD_INLINE vint4 gatheri(const int* base, vint4 indices)
+{
+ return vint4(base[indices.m[0]],
+ base[indices.m[1]],
+ base[indices.m[2]],
+ base[indices.m[3]]);
+}
+
+/**
+ * @brief Pack low 8 bits of N (vector width) lanes into bottom of vector.
+ */
+ASTCENC_SIMD_INLINE vint4 pack_low_bytes(vint4 a)
+{
+ int b0 = a.m[0] & 0xFF;
+ int b1 = a.m[1] & 0xFF;
+ int b2 = a.m[2] & 0xFF;
+ int b3 = a.m[3] & 0xFF;
+
+ int b = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
+ return vint4(b, 0, 0, 0);
+}
+
+/**
+ * @brief Return lanes from @c b if MSB of @c cond is set, else @c a.
+ */
+ASTCENC_SIMD_INLINE vint4 select(vint4 a, vint4 b, vmask4 cond)
+{
+ return vint4((cond.m[0] & static_cast<int>(0x80000000)) ? b.m[0] : a.m[0],
+ (cond.m[1] & static_cast<int>(0x80000000)) ? b.m[1] : a.m[1],
+ (cond.m[2] & static_cast<int>(0x80000000)) ? b.m[2] : a.m[2],
+ (cond.m[3] & static_cast<int>(0x80000000)) ? b.m[3] : a.m[3]);
+}
+
+// ============================================================================
+// vfloat4 operators and functions
+// ============================================================================
+
+/**
+ * @brief Overload: vector by vector addition.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator+(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(a.m[0] + b.m[0],
+ a.m[1] + b.m[1],
+ a.m[2] + b.m[2],
+ a.m[3] + b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector subtraction.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator-(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(a.m[0] - b.m[0],
+ a.m[1] - b.m[1],
+ a.m[2] - b.m[2],
+ a.m[3] - b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector multiplication.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator*(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(a.m[0] * b.m[0],
+ a.m[1] * b.m[1],
+ a.m[2] * b.m[2],
+ a.m[3] * b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector division.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator/(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(a.m[0] / b.m[0],
+ a.m[1] / b.m[1],
+ a.m[2] / b.m[2],
+ a.m[3] / b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector equality.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator==(vfloat4 a, vfloat4 b)
+{
+ return vmask4(a.m[0] == b.m[0],
+ a.m[1] == b.m[1],
+ a.m[2] == b.m[2],
+ a.m[3] == b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector inequality.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator!=(vfloat4 a, vfloat4 b)
+{
+ return vmask4(a.m[0] != b.m[0],
+ a.m[1] != b.m[1],
+ a.m[2] != b.m[2],
+ a.m[3] != b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector less than.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator<(vfloat4 a, vfloat4 b)
+{
+ return vmask4(a.m[0] < b.m[0],
+ a.m[1] < b.m[1],
+ a.m[2] < b.m[2],
+ a.m[3] < b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector greater than.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator>(vfloat4 a, vfloat4 b)
+{
+ return vmask4(a.m[0] > b.m[0],
+ a.m[1] > b.m[1],
+ a.m[2] > b.m[2],
+ a.m[3] > b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector less than or equal.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator<=(vfloat4 a, vfloat4 b)
+{
+ return vmask4(a.m[0] <= b.m[0],
+ a.m[1] <= b.m[1],
+ a.m[2] <= b.m[2],
+ a.m[3] <= b.m[3]);
+}
+
+/**
+ * @brief Overload: vector by vector greater than or equal.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator>=(vfloat4 a, vfloat4 b)
+{
+ return vmask4(a.m[0] >= b.m[0],
+ a.m[1] >= b.m[1],
+ a.m[2] >= b.m[2],
+ a.m[3] >= b.m[3]);
+}
+
+/**
+ * @brief Return the min vector of two vectors.
+ *
+ * If either lane value is NaN, @c b will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat4 min(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(a.m[0] < b.m[0] ? a.m[0] : b.m[0],
+ a.m[1] < b.m[1] ? a.m[1] : b.m[1],
+ a.m[2] < b.m[2] ? a.m[2] : b.m[2],
+ a.m[3] < b.m[3] ? a.m[3] : b.m[3]);
+}
+
+/**
+ * @brief Return the max vector of two vectors.
+ *
+ * If either lane value is NaN, @c b will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat4 max(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(a.m[0] > b.m[0] ? a.m[0] : b.m[0],
+ a.m[1] > b.m[1] ? a.m[1] : b.m[1],
+ a.m[2] > b.m[2] ? a.m[2] : b.m[2],
+ a.m[3] > b.m[3] ? a.m[3] : b.m[3]);
+}
+
+/**
+ * @brief Return the absolute value of the float vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 abs(vfloat4 a)
+{
+ return vfloat4(std::abs(a.m[0]),
+ std::abs(a.m[1]),
+ std::abs(a.m[2]),
+ std::abs(a.m[3]));
+}
+
+/**
+ * @brief Return a float rounded to the nearest integer value.
+ */
+ASTCENC_SIMD_INLINE vfloat4 round(vfloat4 a)
+{
+ assert(std::fegetround() == FE_TONEAREST);
+ return vfloat4(std::nearbyint(a.m[0]),
+ std::nearbyint(a.m[1]),
+ std::nearbyint(a.m[2]),
+ std::nearbyint(a.m[3]));
+}
+
+/**
+ * @brief Return the horizontal minimum of a vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 hmin(vfloat4 a)
+{
+ float tmp1 = std::min(a.m[0], a.m[1]);
+ float tmp2 = std::min(a.m[2], a.m[3]);
+ return vfloat4(std::min(tmp1, tmp2));
+}
+
+/**
+ * @brief Return the horizontal maximum of a vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 hmax(vfloat4 a)
+{
+ float tmp1 = std::max(a.m[0], a.m[1]);
+ float tmp2 = std::max(a.m[2], a.m[3]);
+ return vfloat4(std::max(tmp1, tmp2));
+}
+
+/**
+ * @brief Return the horizontal sum of a vector.
+ */
+ASTCENC_SIMD_INLINE float hadd_s(vfloat4 a)
+{
+ // Use halving add, gives invariance with SIMD versions
+ return (a.m[0] + a.m[2]) + (a.m[1] + a.m[3]);
+}
+
+/**
+ * @brief Return the sqrt of the lanes in the vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 sqrt(vfloat4 a)
+{
+ return vfloat4(std::sqrt(a.m[0]),
+ std::sqrt(a.m[1]),
+ std::sqrt(a.m[2]),
+ std::sqrt(a.m[3]));
+}
+
+/**
+ * @brief Return lanes from @c b if @c cond is set, else @c a.
+ */
+ASTCENC_SIMD_INLINE vfloat4 select(vfloat4 a, vfloat4 b, vmask4 cond)
+{
+ return vfloat4((cond.m[0] & static_cast<int>(0x80000000)) ? b.m[0] : a.m[0],
+ (cond.m[1] & static_cast<int>(0x80000000)) ? b.m[1] : a.m[1],
+ (cond.m[2] & static_cast<int>(0x80000000)) ? b.m[2] : a.m[2],
+ (cond.m[3] & static_cast<int>(0x80000000)) ? b.m[3] : a.m[3]);
+}
+
+/**
+ * @brief Return lanes from @c b if MSB of @c cond is set, else @c a.
+ */
+ASTCENC_SIMD_INLINE vfloat4 select_msb(vfloat4 a, vfloat4 b, vmask4 cond)
+{
+ return vfloat4((cond.m[0] & static_cast<int>(0x80000000)) ? b.m[0] : a.m[0],
+ (cond.m[1] & static_cast<int>(0x80000000)) ? b.m[1] : a.m[1],
+ (cond.m[2] & static_cast<int>(0x80000000)) ? b.m[2] : a.m[2],
+ (cond.m[3] & static_cast<int>(0x80000000)) ? b.m[3] : a.m[3]);
+}
+
+/**
+ * @brief Load a vector of gathered results from an array;
+ */
+ASTCENC_SIMD_INLINE vfloat4 gatherf(const float* base, vint4 indices)
+{
+ return vfloat4(base[indices.m[0]],
+ base[indices.m[1]],
+ base[indices.m[2]],
+ base[indices.m[3]]);
+}
+
+/**
+ * @brief Store a vector to an unaligned memory address.
+ */
+ASTCENC_SIMD_INLINE void store(vfloat4 a, float* ptr)
+{
+ ptr[0] = a.m[0];
+ ptr[1] = a.m[1];
+ ptr[2] = a.m[2];
+ ptr[3] = a.m[3];
+}
+
+/**
+ * @brief Store a vector to an aligned memory address.
+ */
+ASTCENC_SIMD_INLINE void storea(vfloat4 a, float* ptr)
+{
+ ptr[0] = a.m[0];
+ ptr[1] = a.m[1];
+ ptr[2] = a.m[2];
+ ptr[3] = a.m[3];
+}
+
+/**
+ * @brief Return a integer value for a float vector, using truncation.
+ */
+ASTCENC_SIMD_INLINE vint4 float_to_int(vfloat4 a)
+{
+ return vint4(static_cast<int>(a.m[0]),
+ static_cast<int>(a.m[1]),
+ static_cast<int>(a.m[2]),
+ static_cast<int>(a.m[3]));
+}
+
+/**f
+ * @brief Return a integer value for a float vector, using round-to-nearest.
+ */
+ASTCENC_SIMD_INLINE vint4 float_to_int_rtn(vfloat4 a)
+{
+ return vint4(static_cast<int>(a.m[0] + 0.5f),
+ static_cast<int>(a.m[1] + 0.5f),
+ static_cast<int>(a.m[2] + 0.5f),
+ static_cast<int>(a.m[3] + 0.5f));
+}
+
+/**
+ * @brief Return a float value for a integer vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 int_to_float(vint4 a)
+{
+ return vfloat4(static_cast<float>(a.m[0]),
+ static_cast<float>(a.m[1]),
+ static_cast<float>(a.m[2]),
+ static_cast<float>(a.m[3]));
+}
+
+/**
+ * @brief Return a float16 value for a float vector, using round-to-nearest.
+ */
+ASTCENC_SIMD_INLINE vint4 float_to_float16(vfloat4 a)
+{
+ return vint4(
+ float_to_sf16(a.lane<0>()),
+ float_to_sf16(a.lane<1>()),
+ float_to_sf16(a.lane<2>()),
+ float_to_sf16(a.lane<3>()));
+}
+
+/**
+ * @brief Return a float16 value for a float scalar, using round-to-nearest.
+ */
+static inline uint16_t float_to_float16(float a)
+{
+ return float_to_sf16(a);
+}
+
+/**
+ * @brief Return a float value for a float16 vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 float16_to_float(vint4 a)
+{
+ return vfloat4(
+ sf16_to_float(static_cast<uint16_t>(a.lane<0>())),
+ sf16_to_float(static_cast<uint16_t>(a.lane<1>())),
+ sf16_to_float(static_cast<uint16_t>(a.lane<2>())),
+ sf16_to_float(static_cast<uint16_t>(a.lane<3>())));
+}
+
+/**
+ * @brief Return a float value for a float16 scalar.
+ */
+ASTCENC_SIMD_INLINE float float16_to_float(uint16_t a)
+{
+ return sf16_to_float(a);
+}
+
+/**
+ * @brief Return a float value as an integer bit pattern (i.e. no conversion).
+ *
+ * It is a common trick to convert floats into integer bit patterns, perform
+ * some bit hackery based on knowledge they are IEEE 754 layout, and then
+ * convert them back again. This is the first half of that flip.
+ */
+ASTCENC_SIMD_INLINE vint4 float_as_int(vfloat4 a)
+{
+ vint4 r;
+ memcpy(r.m, a.m, 4 * 4);
+ return r;
+}
+
+/**
+ * @brief Return a integer value as a float bit pattern (i.e. no conversion).
+ *
+ * It is a common trick to convert floats into integer bit patterns, perform
+ * some bit hackery based on knowledge they are IEEE 754 layout, and then
+ * convert them back again. This is the second half of that flip.
+ */
+ASTCENC_SIMD_INLINE vfloat4 int_as_float(vint4 a)
+{
+ vfloat4 r;
+ memcpy(r.m, a.m, 4 * 4);
+ return r;
+}
+
+/**
+ * @brief Prepare a vtable lookup table for use with the native SIMD size.
+ */
+ASTCENC_SIMD_INLINE void vtable_prepare(vint4 t0, vint4& t0p)
+{
+ t0p = t0;
+}
+
+/**
+ * @brief Prepare a vtable lookup table for use with the native SIMD size.
+ */
+ASTCENC_SIMD_INLINE void vtable_prepare(vint4 t0, vint4 t1, vint4& t0p, vint4& t1p)
+{
+ t0p = t0;
+ t1p = t1;
+}
+
+/**
+ * @brief Prepare a vtable lookup table for use with the native SIMD size.
+ */
+ASTCENC_SIMD_INLINE void vtable_prepare(
+ vint4 t0, vint4 t1, vint4 t2, vint4 t3,
+ vint4& t0p, vint4& t1p, vint4& t2p, vint4& t3p)
+{
+ t0p = t0;
+ t1p = t1;
+ t2p = t2;
+ t3p = t3;
+}
+
+/**
+ * @brief Perform an 8-bit 32-entry table lookup, with 32-bit indexes.
+ */
+ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 idx)
+{
+ uint8_t table[16];
+ storea(t0, reinterpret_cast<int*>(table + 0));
+
+ return vint4(table[idx.lane<0>()],
+ table[idx.lane<1>()],
+ table[idx.lane<2>()],
+ table[idx.lane<3>()]);
+}
+
+
+/**
+ * @brief Perform an 8-bit 32-entry table lookup, with 32-bit indexes.
+ */
+ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 t1, vint4 idx)
+{
+ uint8_t table[32];
+ storea(t0, reinterpret_cast<int*>(table + 0));
+ storea(t1, reinterpret_cast<int*>(table + 16));
+
+ return vint4(table[idx.lane<0>()],
+ table[idx.lane<1>()],
+ table[idx.lane<2>()],
+ table[idx.lane<3>()]);
+}
+
+/**
+ * @brief Perform an 8-bit 64-entry table lookup, with 32-bit indexes.
+ */
+ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 t1, vint4 t2, vint4 t3, vint4 idx)
+{
+ uint8_t table[64];
+ storea(t0, reinterpret_cast<int*>(table + 0));
+ storea(t1, reinterpret_cast<int*>(table + 16));
+ storea(t2, reinterpret_cast<int*>(table + 32));
+ storea(t3, reinterpret_cast<int*>(table + 48));
+
+ return vint4(table[idx.lane<0>()],
+ table[idx.lane<1>()],
+ table[idx.lane<2>()],
+ table[idx.lane<3>()]);
+}
+
+/**
+ * @brief Return a vector of interleaved RGBA data.
+ *
+ * Input vectors have the value stored in the bottom 8 bits of each lane,
+ * with high bits set to zero.
+ *
+ * Output vector stores a single RGBA texel packed in each lane.
+ */
+ASTCENC_SIMD_INLINE vint4 interleave_rgba8(vint4 r, vint4 g, vint4 b, vint4 a)
+{
+ return r + lsl<8>(g) + lsl<16>(b) + lsl<24>(a);
+}
+
+/**
+ * @brief Store a vector, skipping masked lanes.
+ *
+ * All masked lanes must be at the end of vector, after all non-masked lanes.
+ */
+ASTCENC_SIMD_INLINE void store_lanes_masked(int* base, vint4 data, vmask4 mask)
+{
+ if (mask.m[3])
+ {
+ store(data, base);
+ }
+ else if (mask.m[2])
+ {
+ base[0] = data.lane<0>();
+ base[1] = data.lane<1>();
+ base[2] = data.lane<2>();
+ }
+ else if (mask.m[1])
+ {
+ base[0] = data.lane<0>();
+ base[1] = data.lane<1>();
+ }
+ else if (mask.m[0])
+ {
+ base[0] = data.lane<0>();
+ }
+}
+
+#endif // #ifndef ASTC_VECMATHLIB_NONE_4_H_INCLUDED
diff --git a/thirdparty/astcenc/astcenc_vecmathlib_sse_4.h b/thirdparty/astcenc/astcenc_vecmathlib_sse_4.h
new file mode 100644
index 0000000000..26dcc4a891
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_vecmathlib_sse_4.h
@@ -0,0 +1,1283 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2019-2022 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief 4x32-bit vectors, implemented using SSE.
+ *
+ * This module implements 4-wide 32-bit float, int, and mask vectors for x86
+ * SSE. The implementation requires at least SSE2, but higher levels of SSE can
+ * be selected at compile time to improve performance.
+ *
+ * There is a baseline level of functionality provided by all vector widths and
+ * implementations. This is implemented using identical function signatures,
+ * modulo data type, so we can use them as substitutable implementations in VLA
+ * code.
+ *
+ * The 4-wide vectors are also used as a fixed-width type, and significantly
+ * extend the functionality above that available to VLA code.
+ */
+
+#ifndef ASTC_VECMATHLIB_SSE_4_H_INCLUDED
+#define ASTC_VECMATHLIB_SSE_4_H_INCLUDED
+
+#ifndef ASTCENC_SIMD_INLINE
+ #error "Include astcenc_vecmathlib.h, do not include directly"
+#endif
+
+#include <cstdio>
+
+// ============================================================================
+// vfloat4 data type
+// ============================================================================
+
+/**
+ * @brief Data type for 4-wide floats.
+ */
+struct vfloat4
+{
+ /**
+ * @brief Construct from zero-initialized value.
+ */
+ ASTCENC_SIMD_INLINE vfloat4() = default;
+
+ /**
+ * @brief Construct from 4 values loaded from an unaligned address.
+ *
+ * Consider using loada() which is better with vectors if data is aligned
+ * to vector length.
+ */
+ ASTCENC_SIMD_INLINE explicit vfloat4(const float *p)
+ {
+ m = _mm_loadu_ps(p);
+ }
+
+ /**
+ * @brief Construct from 1 scalar value replicated across all lanes.
+ *
+ * Consider using zero() for constexpr zeros.
+ */
+ ASTCENC_SIMD_INLINE explicit vfloat4(float a)
+ {
+ m = _mm_set1_ps(a);
+ }
+
+ /**
+ * @brief Construct from 4 scalar values.
+ *
+ * The value of @c a is stored to lane 0 (LSB) in the SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vfloat4(float a, float b, float c, float d)
+ {
+ m = _mm_set_ps(d, c, b, a);
+ }
+
+ /**
+ * @brief Construct from an existing SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vfloat4(__m128 a)
+ {
+ m = a;
+ }
+
+ /**
+ * @brief Get the scalar value of a single lane.
+ */
+ template <int l> ASTCENC_SIMD_INLINE float lane() const
+ {
+ return _mm_cvtss_f32(_mm_shuffle_ps(m, m, l));
+ }
+
+ /**
+ * @brief Set the scalar value of a single lane.
+ */
+ template <int l> ASTCENC_SIMD_INLINE void set_lane(float a)
+ {
+#if ASTCENC_SSE >= 41
+ __m128 v = _mm_set1_ps(a);
+ m = _mm_insert_ps(m, v, l << 6 | l << 4);
+#else
+ alignas(16) float idx[4];
+ _mm_store_ps(idx, m);
+ idx[l] = a;
+ m = _mm_load_ps(idx);
+#endif
+ }
+
+ /**
+ * @brief Factory that returns a vector of zeros.
+ */
+ static ASTCENC_SIMD_INLINE vfloat4 zero()
+ {
+ return vfloat4(_mm_setzero_ps());
+ }
+
+ /**
+ * @brief Factory that returns a replicated scalar loaded from memory.
+ */
+ static ASTCENC_SIMD_INLINE vfloat4 load1(const float* p)
+ {
+ return vfloat4(_mm_load_ps1(p));
+ }
+
+ /**
+ * @brief Factory that returns a vector loaded from 16B aligned memory.
+ */
+ static ASTCENC_SIMD_INLINE vfloat4 loada(const float* p)
+ {
+ return vfloat4(_mm_load_ps(p));
+ }
+
+ /**
+ * @brief Factory that returns a vector containing the lane IDs.
+ */
+ static ASTCENC_SIMD_INLINE vfloat4 lane_id()
+ {
+ return vfloat4(_mm_set_ps(3, 2, 1, 0));
+ }
+
+ /**
+ * @brief Return a swizzled float 2.
+ */
+ template <int l0, int l1> ASTCENC_SIMD_INLINE vfloat4 swz() const
+ {
+ vfloat4 result(_mm_shuffle_ps(m, m, l0 | l1 << 2));
+ result.set_lane<2>(0.0f);
+ result.set_lane<3>(0.0f);
+ return result;
+ }
+
+ /**
+ * @brief Return a swizzled float 3.
+ */
+ template <int l0, int l1, int l2> ASTCENC_SIMD_INLINE vfloat4 swz() const
+ {
+ vfloat4 result(_mm_shuffle_ps(m, m, l0 | l1 << 2 | l2 << 4));
+ result.set_lane<3>(0.0f);
+ return result;
+ }
+
+ /**
+ * @brief Return a swizzled float 4.
+ */
+ template <int l0, int l1, int l2, int l3> ASTCENC_SIMD_INLINE vfloat4 swz() const
+ {
+ return vfloat4(_mm_shuffle_ps(m, m, l0 | l1 << 2 | l2 << 4 | l3 << 6));
+ }
+
+ /**
+ * @brief The vector ...
+ */
+ __m128 m;
+};
+
+// ============================================================================
+// vint4 data type
+// ============================================================================
+
+/**
+ * @brief Data type for 4-wide ints.
+ */
+struct vint4
+{
+ /**
+ * @brief Construct from zero-initialized value.
+ */
+ ASTCENC_SIMD_INLINE vint4() = default;
+
+ /**
+ * @brief Construct from 4 values loaded from an unaligned address.
+ *
+ * Consider using loada() which is better with vectors if data is aligned
+ * to vector length.
+ */
+ ASTCENC_SIMD_INLINE explicit vint4(const int *p)
+ {
+ m = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
+ }
+
+ /**
+ * @brief Construct from 4 uint8_t loaded from an unaligned address.
+ */
+ ASTCENC_SIMD_INLINE explicit vint4(const uint8_t *p)
+ {
+ // _mm_loadu_si32 would be nicer syntax, but missing on older GCC
+ __m128i t = _mm_cvtsi32_si128(*reinterpret_cast<const int*>(p));
+
+#if ASTCENC_SSE >= 41
+ m = _mm_cvtepu8_epi32(t);
+#else
+ t = _mm_unpacklo_epi8(t, _mm_setzero_si128());
+ m = _mm_unpacklo_epi16(t, _mm_setzero_si128());
+#endif
+ }
+
+ /**
+ * @brief Construct from 1 scalar value replicated across all lanes.
+ *
+ * Consider using vfloat4::zero() for constexpr zeros.
+ */
+ ASTCENC_SIMD_INLINE explicit vint4(int a)
+ {
+ m = _mm_set1_epi32(a);
+ }
+
+ /**
+ * @brief Construct from 4 scalar values.
+ *
+ * The value of @c a is stored to lane 0 (LSB) in the SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vint4(int a, int b, int c, int d)
+ {
+ m = _mm_set_epi32(d, c, b, a);
+ }
+
+ /**
+ * @brief Construct from an existing SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vint4(__m128i a)
+ {
+ m = a;
+ }
+
+ /**
+ * @brief Get the scalar from a single lane.
+ */
+ template <int l> ASTCENC_SIMD_INLINE int lane() const
+ {
+ return _mm_cvtsi128_si32(_mm_shuffle_epi32(m, l));
+ }
+
+ /**
+ * @brief Set the scalar value of a single lane.
+ */
+ template <int l> ASTCENC_SIMD_INLINE void set_lane(int a)
+ {
+#if ASTCENC_SSE >= 41
+ m = _mm_insert_epi32(m, a, l);
+#else
+ alignas(16) int idx[4];
+ _mm_store_si128(reinterpret_cast<__m128i*>(idx), m);
+ idx[l] = a;
+ m = _mm_load_si128(reinterpret_cast<const __m128i*>(idx));
+#endif
+ }
+
+ /**
+ * @brief Factory that returns a vector of zeros.
+ */
+ static ASTCENC_SIMD_INLINE vint4 zero()
+ {
+ return vint4(_mm_setzero_si128());
+ }
+
+ /**
+ * @brief Factory that returns a replicated scalar loaded from memory.
+ */
+ static ASTCENC_SIMD_INLINE vint4 load1(const int* p)
+ {
+ return vint4(*p);
+ }
+
+ /**
+ * @brief Factory that returns a vector loaded from 16B aligned memory.
+ */
+ static ASTCENC_SIMD_INLINE vint4 loada(const int* p)
+ {
+ return vint4(_mm_load_si128(reinterpret_cast<const __m128i*>(p)));
+ }
+
+ /**
+ * @brief Factory that returns a vector containing the lane IDs.
+ */
+ static ASTCENC_SIMD_INLINE vint4 lane_id()
+ {
+ return vint4(_mm_set_epi32(3, 2, 1, 0));
+ }
+
+ /**
+ * @brief The vector ...
+ */
+ __m128i m;
+};
+
+// ============================================================================
+// vmask4 data type
+// ============================================================================
+
+/**
+ * @brief Data type for 4-wide control plane masks.
+ */
+struct vmask4
+{
+ /**
+ * @brief Construct from an existing SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vmask4(__m128 a)
+ {
+ m = a;
+ }
+
+ /**
+ * @brief Construct from an existing SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vmask4(__m128i a)
+ {
+ m = _mm_castsi128_ps(a);
+ }
+
+ /**
+ * @brief Construct from 1 scalar value.
+ */
+ ASTCENC_SIMD_INLINE explicit vmask4(bool a)
+ {
+ vint4 mask(a == false ? 0 : -1);
+ m = _mm_castsi128_ps(mask.m);
+ }
+
+ /**
+ * @brief Construct from 4 scalar values.
+ *
+ * The value of @c a is stored to lane 0 (LSB) in the SIMD register.
+ */
+ ASTCENC_SIMD_INLINE explicit vmask4(bool a, bool b, bool c, bool d)
+ {
+ vint4 mask(a == false ? 0 : -1,
+ b == false ? 0 : -1,
+ c == false ? 0 : -1,
+ d == false ? 0 : -1);
+
+ m = _mm_castsi128_ps(mask.m);
+ }
+
+ /**
+ * @brief Get the scalar value of a single lane.
+ */
+ template <int l> ASTCENC_SIMD_INLINE float lane() const
+ {
+ return _mm_cvtss_f32(_mm_shuffle_ps(m, m, l));
+ }
+
+ /**
+ * @brief The vector ...
+ */
+ __m128 m;
+};
+
+// ============================================================================
+// vmask4 operators and functions
+// ============================================================================
+
+/**
+ * @brief Overload: mask union (or).
+ */
+ASTCENC_SIMD_INLINE vmask4 operator|(vmask4 a, vmask4 b)
+{
+ return vmask4(_mm_or_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: mask intersect (and).
+ */
+ASTCENC_SIMD_INLINE vmask4 operator&(vmask4 a, vmask4 b)
+{
+ return vmask4(_mm_and_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: mask difference (xor).
+ */
+ASTCENC_SIMD_INLINE vmask4 operator^(vmask4 a, vmask4 b)
+{
+ return vmask4(_mm_xor_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: mask invert (not).
+ */
+ASTCENC_SIMD_INLINE vmask4 operator~(vmask4 a)
+{
+ return vmask4(_mm_xor_si128(_mm_castps_si128(a.m), _mm_set1_epi32(-1)));
+}
+
+/**
+ * @brief Return a 4-bit mask code indicating mask status.
+ *
+ * bit0 = lane 0
+ */
+ASTCENC_SIMD_INLINE unsigned int mask(vmask4 a)
+{
+ return static_cast<unsigned int>(_mm_movemask_ps(a.m));
+}
+
+// ============================================================================
+// vint4 operators and functions
+// ============================================================================
+
+/**
+ * @brief Overload: vector by vector addition.
+ */
+ASTCENC_SIMD_INLINE vint4 operator+(vint4 a, vint4 b)
+{
+ return vint4(_mm_add_epi32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector subtraction.
+ */
+ASTCENC_SIMD_INLINE vint4 operator-(vint4 a, vint4 b)
+{
+ return vint4(_mm_sub_epi32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector multiplication.
+ */
+ASTCENC_SIMD_INLINE vint4 operator*(vint4 a, vint4 b)
+{
+#if ASTCENC_SSE >= 41
+ return vint4(_mm_mullo_epi32 (a.m, b.m));
+#else
+ __m128i t1 = _mm_mul_epu32(a.m, b.m);
+ __m128i t2 = _mm_mul_epu32(
+ _mm_srli_si128(a.m, 4),
+ _mm_srli_si128(b.m, 4));
+ __m128i r = _mm_unpacklo_epi32(
+ _mm_shuffle_epi32(t1, _MM_SHUFFLE (0, 0, 2, 0)),
+ _mm_shuffle_epi32(t2, _MM_SHUFFLE (0, 0, 2, 0)));
+ return vint4(r);
+#endif
+}
+
+/**
+ * @brief Overload: vector bit invert.
+ */
+ASTCENC_SIMD_INLINE vint4 operator~(vint4 a)
+{
+ return vint4(_mm_xor_si128(a.m, _mm_set1_epi32(-1)));
+}
+
+/**
+ * @brief Overload: vector by vector bitwise or.
+ */
+ASTCENC_SIMD_INLINE vint4 operator|(vint4 a, vint4 b)
+{
+ return vint4(_mm_or_si128(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector bitwise and.
+ */
+ASTCENC_SIMD_INLINE vint4 operator&(vint4 a, vint4 b)
+{
+ return vint4(_mm_and_si128(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector bitwise xor.
+ */
+ASTCENC_SIMD_INLINE vint4 operator^(vint4 a, vint4 b)
+{
+ return vint4(_mm_xor_si128(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector equality.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator==(vint4 a, vint4 b)
+{
+ return vmask4(_mm_cmpeq_epi32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector inequality.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator!=(vint4 a, vint4 b)
+{
+ return ~vmask4(_mm_cmpeq_epi32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector less than.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator<(vint4 a, vint4 b)
+{
+ return vmask4(_mm_cmplt_epi32(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector greater than.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator>(vint4 a, vint4 b)
+{
+ return vmask4(_mm_cmpgt_epi32(a.m, b.m));
+}
+
+/**
+ * @brief Logical shift left.
+ */
+template <int s> ASTCENC_SIMD_INLINE vint4 lsl(vint4 a)
+{
+ return vint4(_mm_slli_epi32(a.m, s));
+}
+
+/**
+ * @brief Logical shift right.
+ */
+template <int s> ASTCENC_SIMD_INLINE vint4 lsr(vint4 a)
+{
+ return vint4(_mm_srli_epi32(a.m, s));
+}
+
+/**
+ * @brief Arithmetic shift right.
+ */
+template <int s> ASTCENC_SIMD_INLINE vint4 asr(vint4 a)
+{
+ return vint4(_mm_srai_epi32(a.m, s));
+}
+
+/**
+ * @brief Return the min vector of two vectors.
+ */
+ASTCENC_SIMD_INLINE vint4 min(vint4 a, vint4 b)
+{
+#if ASTCENC_SSE >= 41
+ return vint4(_mm_min_epi32(a.m, b.m));
+#else
+ vmask4 d = a < b;
+ __m128i ap = _mm_and_si128(_mm_castps_si128(d.m), a.m);
+ __m128i bp = _mm_andnot_si128(_mm_castps_si128(d.m), b.m);
+ return vint4(_mm_or_si128(ap,bp));
+#endif
+}
+
+/**
+ * @brief Return the max vector of two vectors.
+ */
+ASTCENC_SIMD_INLINE vint4 max(vint4 a, vint4 b)
+{
+#if ASTCENC_SSE >= 41
+ return vint4(_mm_max_epi32(a.m, b.m));
+#else
+ vmask4 d = a > b;
+ __m128i ap = _mm_and_si128(_mm_castps_si128(d.m), a.m);
+ __m128i bp = _mm_andnot_si128(_mm_castps_si128(d.m), b.m);
+ return vint4(_mm_or_si128(ap,bp));
+#endif
+}
+
+/**
+ * @brief Return the horizontal minimum of a vector.
+ */
+ASTCENC_SIMD_INLINE vint4 hmin(vint4 a)
+{
+ a = min(a, vint4(_mm_shuffle_epi32(a.m, _MM_SHUFFLE(0, 0, 3, 2))));
+ a = min(a, vint4(_mm_shuffle_epi32(a.m, _MM_SHUFFLE(0, 0, 0, 1))));
+ return vint4(_mm_shuffle_epi32(a.m, _MM_SHUFFLE(0, 0, 0, 0)));
+}
+
+/*
+ * @brief Return the horizontal maximum of a vector.
+ */
+ASTCENC_SIMD_INLINE vint4 hmax(vint4 a)
+{
+ a = max(a, vint4(_mm_shuffle_epi32(a.m, _MM_SHUFFLE(0, 0, 3, 2))));
+ a = max(a, vint4(_mm_shuffle_epi32(a.m, _MM_SHUFFLE(0, 0, 0, 1))));
+ return vint4(_mm_shuffle_epi32(a.m, _MM_SHUFFLE(0, 0, 0, 0)));
+}
+
+/**
+ * @brief Return the horizontal sum of a vector as a scalar.
+ */
+ASTCENC_SIMD_INLINE int hadd_s(vint4 a)
+{
+ // Add top and bottom halves, lane 1/0
+ __m128i fold = _mm_castps_si128(_mm_movehl_ps(_mm_castsi128_ps(a.m),
+ _mm_castsi128_ps(a.m)));
+ __m128i t = _mm_add_epi32(a.m, fold);
+
+ // Add top and bottom halves, lane 0 (_mm_hadd_ps exists but slow)
+ t = _mm_add_epi32(t, _mm_shuffle_epi32(t, 0x55));
+
+ return _mm_cvtsi128_si32(t);
+}
+
+/**
+ * @brief Store a vector to a 16B aligned memory address.
+ */
+ASTCENC_SIMD_INLINE void storea(vint4 a, int* p)
+{
+ _mm_store_si128(reinterpret_cast<__m128i*>(p), a.m);
+}
+
+/**
+ * @brief Store a vector to an unaligned memory address.
+ */
+ASTCENC_SIMD_INLINE void store(vint4 a, int* p)
+{
+ // Cast due to missing intrinsics
+ _mm_storeu_ps(reinterpret_cast<float*>(p), _mm_castsi128_ps(a.m));
+}
+
+/**
+ * @brief Store lowest N (vector width) bytes into an unaligned address.
+ */
+ASTCENC_SIMD_INLINE void store_nbytes(vint4 a, uint8_t* p)
+{
+ // Cast due to missing intrinsics
+ _mm_store_ss(reinterpret_cast<float*>(p), _mm_castsi128_ps(a.m));
+}
+
+/**
+ * @brief Gather N (vector width) indices from the array.
+ */
+ASTCENC_SIMD_INLINE vint4 gatheri(const int* base, vint4 indices)
+{
+#if ASTCENC_AVX >= 2
+ return vint4(_mm_i32gather_epi32(base, indices.m, 4));
+#else
+ alignas(16) int idx[4];
+ storea(indices, idx);
+ return vint4(base[idx[0]], base[idx[1]], base[idx[2]], base[idx[3]]);
+#endif
+}
+
+/**
+ * @brief Pack low 8 bits of N (vector width) lanes into bottom of vector.
+ */
+ASTCENC_SIMD_INLINE vint4 pack_low_bytes(vint4 a)
+{
+#if ASTCENC_SSE >= 41
+ __m128i shuf = _mm_set_epi8(0,0,0,0, 0,0,0,0, 0,0,0,0, 12,8,4,0);
+ return vint4(_mm_shuffle_epi8(a.m, shuf));
+#else
+ __m128i va = _mm_unpacklo_epi8(a.m, _mm_shuffle_epi32(a.m, _MM_SHUFFLE(1,1,1,1)));
+ __m128i vb = _mm_unpackhi_epi8(a.m, _mm_shuffle_epi32(a.m, _MM_SHUFFLE(3,3,3,3)));
+ return vint4(_mm_unpacklo_epi16(va, vb));
+#endif
+}
+
+/**
+ * @brief Return lanes from @c b if @c cond is set, else @c a.
+ */
+ASTCENC_SIMD_INLINE vint4 select(vint4 a, vint4 b, vmask4 cond)
+{
+ __m128i condi = _mm_castps_si128(cond.m);
+
+#if ASTCENC_SSE >= 41
+ return vint4(_mm_blendv_epi8(a.m, b.m, condi));
+#else
+ return vint4(_mm_or_si128(_mm_and_si128(condi, b.m), _mm_andnot_si128(condi, a.m)));
+#endif
+}
+
+// ============================================================================
+// vfloat4 operators and functions
+// ============================================================================
+
+/**
+ * @brief Overload: vector by vector addition.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator+(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(_mm_add_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector subtraction.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator-(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(_mm_sub_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector multiplication.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator*(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(_mm_mul_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector division.
+ */
+ASTCENC_SIMD_INLINE vfloat4 operator/(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(_mm_div_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector equality.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator==(vfloat4 a, vfloat4 b)
+{
+ return vmask4(_mm_cmpeq_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector inequality.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator!=(vfloat4 a, vfloat4 b)
+{
+ return vmask4(_mm_cmpneq_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector less than.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator<(vfloat4 a, vfloat4 b)
+{
+ return vmask4(_mm_cmplt_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector greater than.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator>(vfloat4 a, vfloat4 b)
+{
+ return vmask4(_mm_cmpgt_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector less than or equal.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator<=(vfloat4 a, vfloat4 b)
+{
+ return vmask4(_mm_cmple_ps(a.m, b.m));
+}
+
+/**
+ * @brief Overload: vector by vector greater than or equal.
+ */
+ASTCENC_SIMD_INLINE vmask4 operator>=(vfloat4 a, vfloat4 b)
+{
+ return vmask4(_mm_cmpge_ps(a.m, b.m));
+}
+
+/**
+ * @brief Return the min vector of two vectors.
+ *
+ * If either lane value is NaN, @c b will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat4 min(vfloat4 a, vfloat4 b)
+{
+ // Do not reorder - second operand will return if either is NaN
+ return vfloat4(_mm_min_ps(a.m, b.m));
+}
+
+/**
+ * @brief Return the max vector of two vectors.
+ *
+ * If either lane value is NaN, @c b will be returned for that lane.
+ */
+ASTCENC_SIMD_INLINE vfloat4 max(vfloat4 a, vfloat4 b)
+{
+ // Do not reorder - second operand will return if either is NaN
+ return vfloat4(_mm_max_ps(a.m, b.m));
+}
+
+/**
+ * @brief Return the absolute value of the float vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 abs(vfloat4 a)
+{
+ return vfloat4(_mm_max_ps(_mm_sub_ps(_mm_setzero_ps(), a.m), a.m));
+}
+
+/**
+ * @brief Return a float rounded to the nearest integer value.
+ */
+ASTCENC_SIMD_INLINE vfloat4 round(vfloat4 a)
+{
+#if ASTCENC_SSE >= 41
+ constexpr int flags = _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC;
+ return vfloat4(_mm_round_ps(a.m, flags));
+#else
+ __m128 v = a.m;
+ __m128 neg_zero = _mm_castsi128_ps(_mm_set1_epi32(static_cast<int>(0x80000000)));
+ __m128 no_fraction = _mm_set1_ps(8388608.0f);
+ __m128 abs_mask = _mm_castsi128_ps(_mm_set1_epi32(0x7FFFFFFF));
+ __m128 sign = _mm_and_ps(v, neg_zero);
+ __m128 s_magic = _mm_or_ps(no_fraction, sign);
+ __m128 r1 = _mm_add_ps(v, s_magic);
+ r1 = _mm_sub_ps(r1, s_magic);
+ __m128 r2 = _mm_and_ps(v, abs_mask);
+ __m128 mask = _mm_cmple_ps(r2, no_fraction);
+ r2 = _mm_andnot_ps(mask, v);
+ r1 = _mm_and_ps(r1, mask);
+ return vfloat4(_mm_xor_ps(r1, r2));
+#endif
+}
+
+/**
+ * @brief Return the horizontal minimum of a vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 hmin(vfloat4 a)
+{
+ a = min(a, vfloat4(_mm_shuffle_ps(a.m, a.m, _MM_SHUFFLE(0, 0, 3, 2))));
+ a = min(a, vfloat4(_mm_shuffle_ps(a.m, a.m, _MM_SHUFFLE(0, 0, 0, 1))));
+ return vfloat4(_mm_shuffle_ps(a.m, a.m, _MM_SHUFFLE(0, 0, 0, 0)));
+}
+
+/**
+ * @brief Return the horizontal maximum of a vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 hmax(vfloat4 a)
+{
+ a = max(a, vfloat4(_mm_shuffle_ps(a.m, a.m, _MM_SHUFFLE(0, 0, 3, 2))));
+ a = max(a, vfloat4(_mm_shuffle_ps(a.m, a.m, _MM_SHUFFLE(0, 0, 0, 1))));
+ return vfloat4(_mm_shuffle_ps(a.m, a.m, _MM_SHUFFLE(0, 0, 0, 0)));
+}
+
+/**
+ * @brief Return the horizontal sum of a vector as a scalar.
+ */
+ASTCENC_SIMD_INLINE float hadd_s(vfloat4 a)
+{
+ // Add top and bottom halves, lane 1/0
+ __m128 t = _mm_add_ps(a.m, _mm_movehl_ps(a.m, a.m));
+
+ // Add top and bottom halves, lane 0 (_mm_hadd_ps exists but slow)
+ t = _mm_add_ss(t, _mm_shuffle_ps(t, t, 0x55));
+
+ return _mm_cvtss_f32(t);
+}
+
+/**
+ * @brief Return the sqrt of the lanes in the vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 sqrt(vfloat4 a)
+{
+ return vfloat4(_mm_sqrt_ps(a.m));
+}
+
+/**
+ * @brief Return lanes from @c b if @c cond is set, else @c a.
+ */
+ASTCENC_SIMD_INLINE vfloat4 select(vfloat4 a, vfloat4 b, vmask4 cond)
+{
+#if ASTCENC_SSE >= 41
+ return vfloat4(_mm_blendv_ps(a.m, b.m, cond.m));
+#else
+ return vfloat4(_mm_or_ps(_mm_and_ps(cond.m, b.m), _mm_andnot_ps(cond.m, a.m)));
+#endif
+}
+
+/**
+ * @brief Return lanes from @c b if MSB of @c cond is set, else @c a.
+ */
+ASTCENC_SIMD_INLINE vfloat4 select_msb(vfloat4 a, vfloat4 b, vmask4 cond)
+{
+#if ASTCENC_SSE >= 41
+ return vfloat4(_mm_blendv_ps(a.m, b.m, cond.m));
+#else
+ __m128 d = _mm_castsi128_ps(_mm_srai_epi32(_mm_castps_si128(cond.m), 31));
+ return vfloat4(_mm_or_ps(_mm_and_ps(d, b.m), _mm_andnot_ps(d, a.m)));
+#endif
+}
+
+/**
+ * @brief Load a vector of gathered results from an array;
+ */
+ASTCENC_SIMD_INLINE vfloat4 gatherf(const float* base, vint4 indices)
+{
+#if ASTCENC_AVX >= 2
+ return vfloat4(_mm_i32gather_ps(base, indices.m, 4));
+#else
+ alignas(16) int idx[4];
+ storea(indices, idx);
+ return vfloat4(base[idx[0]], base[idx[1]], base[idx[2]], base[idx[3]]);
+#endif
+}
+
+/**
+ * @brief Store a vector to an unaligned memory address.
+ */
+ASTCENC_SIMD_INLINE void store(vfloat4 a, float* p)
+{
+ _mm_storeu_ps(p, a.m);
+}
+
+/**
+ * @brief Store a vector to a 16B aligned memory address.
+ */
+ASTCENC_SIMD_INLINE void storea(vfloat4 a, float* p)
+{
+ _mm_store_ps(p, a.m);
+}
+
+/**
+ * @brief Return a integer value for a float vector, using truncation.
+ */
+ASTCENC_SIMD_INLINE vint4 float_to_int(vfloat4 a)
+{
+ return vint4(_mm_cvttps_epi32(a.m));
+}
+
+/**
+ * @brief Return a integer value for a float vector, using round-to-nearest.
+ */
+ASTCENC_SIMD_INLINE vint4 float_to_int_rtn(vfloat4 a)
+{
+ a = round(a);
+ return vint4(_mm_cvttps_epi32(a.m));
+}
+
+/**
+ * @brief Return a float value for an integer vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 int_to_float(vint4 a)
+{
+ return vfloat4(_mm_cvtepi32_ps(a.m));
+}
+
+/**
+ * @brief Return a float16 value for a float vector, using round-to-nearest.
+ */
+ASTCENC_SIMD_INLINE vint4 float_to_float16(vfloat4 a)
+{
+#if ASTCENC_F16C >= 1
+ __m128i packedf16 = _mm_cvtps_ph(a.m, 0);
+ __m128i f16 = _mm_cvtepu16_epi32(packedf16);
+ return vint4(f16);
+#else
+ return vint4(
+ float_to_sf16(a.lane<0>()),
+ float_to_sf16(a.lane<1>()),
+ float_to_sf16(a.lane<2>()),
+ float_to_sf16(a.lane<3>()));
+#endif
+}
+
+/**
+ * @brief Return a float16 value for a float scalar, using round-to-nearest.
+ */
+static inline uint16_t float_to_float16(float a)
+{
+#if ASTCENC_F16C >= 1
+ __m128i f16 = _mm_cvtps_ph(_mm_set1_ps(a), 0);
+ return static_cast<uint16_t>(_mm_cvtsi128_si32(f16));
+#else
+ return float_to_sf16(a);
+#endif
+}
+
+/**
+ * @brief Return a float value for a float16 vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 float16_to_float(vint4 a)
+{
+#if ASTCENC_F16C >= 1
+ __m128i packed = _mm_packs_epi32(a.m, a.m);
+ __m128 f32 = _mm_cvtph_ps(packed);
+ return vfloat4(f32);
+#else
+ return vfloat4(
+ sf16_to_float(static_cast<uint16_t>(a.lane<0>())),
+ sf16_to_float(static_cast<uint16_t>(a.lane<1>())),
+ sf16_to_float(static_cast<uint16_t>(a.lane<2>())),
+ sf16_to_float(static_cast<uint16_t>(a.lane<3>())));
+#endif
+}
+
+/**
+ * @brief Return a float value for a float16 scalar.
+ */
+ASTCENC_SIMD_INLINE float float16_to_float(uint16_t a)
+{
+#if ASTCENC_F16C >= 1
+ __m128i packed = _mm_set1_epi16(static_cast<short>(a));
+ __m128 f32 = _mm_cvtph_ps(packed);
+ return _mm_cvtss_f32(f32);
+#else
+ return sf16_to_float(a);
+#endif
+}
+
+/**
+ * @brief Return a float value as an integer bit pattern (i.e. no conversion).
+ *
+ * It is a common trick to convert floats into integer bit patterns, perform
+ * some bit hackery based on knowledge they are IEEE 754 layout, and then
+ * convert them back again. This is the first half of that flip.
+ */
+ASTCENC_SIMD_INLINE vint4 float_as_int(vfloat4 a)
+{
+ return vint4(_mm_castps_si128(a.m));
+}
+
+/**
+ * @brief Return a integer value as a float bit pattern (i.e. no conversion).
+ *
+ * It is a common trick to convert floats into integer bit patterns, perform
+ * some bit hackery based on knowledge they are IEEE 754 layout, and then
+ * convert them back again. This is the second half of that flip.
+ */
+ASTCENC_SIMD_INLINE vfloat4 int_as_float(vint4 v)
+{
+ return vfloat4(_mm_castsi128_ps(v.m));
+}
+
+/**
+ * @brief Prepare a vtable lookup table for use with the native SIMD size.
+ */
+ASTCENC_SIMD_INLINE void vtable_prepare(vint4 t0, vint4& t0p)
+{
+ t0p = t0;
+}
+
+/**
+ * @brief Prepare a vtable lookup table for use with the native SIMD size.
+ */
+ASTCENC_SIMD_INLINE void vtable_prepare(vint4 t0, vint4 t1, vint4& t0p, vint4& t1p)
+{
+#if ASTCENC_SSE >= 41
+ t0p = t0;
+ t1p = t0 ^ t1;
+#else
+ t0p = t0;
+ t1p = t1;
+#endif
+}
+
+/**
+ * @brief Prepare a vtable lookup table for use with the native SIMD size.
+ */
+ASTCENC_SIMD_INLINE void vtable_prepare(
+ vint4 t0, vint4 t1, vint4 t2, vint4 t3,
+ vint4& t0p, vint4& t1p, vint4& t2p, vint4& t3p)
+{
+#if ASTCENC_SSE >= 41
+ t0p = t0;
+ t1p = t0 ^ t1;
+ t2p = t1 ^ t2;
+ t3p = t2 ^ t3;
+#else
+ t0p = t0;
+ t1p = t1;
+ t2p = t2;
+ t3p = t3;
+#endif
+}
+
+/**
+ * @brief Perform an 8-bit 16-entry table lookup, with 32-bit indexes.
+ */
+ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 idx)
+{
+#if ASTCENC_SSE >= 41
+ // Set index byte MSB to 1 for unused bytes so shuffle returns zero
+ __m128i idxx = _mm_or_si128(idx.m, _mm_set1_epi32(static_cast<int>(0xFFFFFF00)));
+
+ __m128i result = _mm_shuffle_epi8(t0.m, idxx);
+ return vint4(result);
+#else
+ alignas(ASTCENC_VECALIGN) uint8_t table[16];
+ storea(t0, reinterpret_cast<int*>(table + 0));
+
+ return vint4(table[idx.lane<0>()],
+ table[idx.lane<1>()],
+ table[idx.lane<2>()],
+ table[idx.lane<3>()]);
+#endif
+}
+
+/**
+ * @brief Perform an 8-bit 32-entry table lookup, with 32-bit indexes.
+ */
+ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 t1, vint4 idx)
+{
+#if ASTCENC_SSE >= 41
+ // Set index byte MSB to 1 for unused bytes so shuffle returns zero
+ __m128i idxx = _mm_or_si128(idx.m, _mm_set1_epi32(static_cast<int>(0xFFFFFF00)));
+
+ __m128i result = _mm_shuffle_epi8(t0.m, idxx);
+ idxx = _mm_sub_epi8(idxx, _mm_set1_epi8(16));
+
+ __m128i result2 = _mm_shuffle_epi8(t1.m, idxx);
+ result = _mm_xor_si128(result, result2);
+
+ return vint4(result);
+#else
+ alignas(ASTCENC_VECALIGN) uint8_t table[32];
+ storea(t0, reinterpret_cast<int*>(table + 0));
+ storea(t1, reinterpret_cast<int*>(table + 16));
+
+ return vint4(table[idx.lane<0>()],
+ table[idx.lane<1>()],
+ table[idx.lane<2>()],
+ table[idx.lane<3>()]);
+#endif
+}
+
+/**
+ * @brief Perform an 8-bit 64-entry table lookup, with 32-bit indexes.
+ */
+ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 t1, vint4 t2, vint4 t3, vint4 idx)
+{
+#if ASTCENC_SSE >= 41
+ // Set index byte MSB to 1 for unused bytes so shuffle returns zero
+ __m128i idxx = _mm_or_si128(idx.m, _mm_set1_epi32(static_cast<int>(0xFFFFFF00)));
+
+ __m128i result = _mm_shuffle_epi8(t0.m, idxx);
+ idxx = _mm_sub_epi8(idxx, _mm_set1_epi8(16));
+
+ __m128i result2 = _mm_shuffle_epi8(t1.m, idxx);
+ result = _mm_xor_si128(result, result2);
+ idxx = _mm_sub_epi8(idxx, _mm_set1_epi8(16));
+
+ result2 = _mm_shuffle_epi8(t2.m, idxx);
+ result = _mm_xor_si128(result, result2);
+ idxx = _mm_sub_epi8(idxx, _mm_set1_epi8(16));
+
+ result2 = _mm_shuffle_epi8(t3.m, idxx);
+ result = _mm_xor_si128(result, result2);
+
+ return vint4(result);
+#else
+ alignas(ASTCENC_VECALIGN) uint8_t table[64];
+ storea(t0, reinterpret_cast<int*>(table + 0));
+ storea(t1, reinterpret_cast<int*>(table + 16));
+ storea(t2, reinterpret_cast<int*>(table + 32));
+ storea(t3, reinterpret_cast<int*>(table + 48));
+
+ return vint4(table[idx.lane<0>()],
+ table[idx.lane<1>()],
+ table[idx.lane<2>()],
+ table[idx.lane<3>()]);
+#endif
+}
+
+/**
+ * @brief Return a vector of interleaved RGBA data.
+ *
+ * Input vectors have the value stored in the bottom 8 bits of each lane,
+ * with high bits set to zero.
+ *
+ * Output vector stores a single RGBA texel packed in each lane.
+ */
+ASTCENC_SIMD_INLINE vint4 interleave_rgba8(vint4 r, vint4 g, vint4 b, vint4 a)
+{
+// Workaround an XCode compiler internal fault; note is slower than slli_epi32
+// so we should revert this when we get the opportunity
+#if defined(__APPLE__)
+ __m128i value = r.m;
+ value = _mm_add_epi32(value, _mm_bslli_si128(g.m, 1));
+ value = _mm_add_epi32(value, _mm_bslli_si128(b.m, 2));
+ value = _mm_add_epi32(value, _mm_bslli_si128(a.m, 3));
+ return vint4(value);
+#else
+ __m128i value = r.m;
+ value = _mm_add_epi32(value, _mm_slli_epi32(g.m, 8));
+ value = _mm_add_epi32(value, _mm_slli_epi32(b.m, 16));
+ value = _mm_add_epi32(value, _mm_slli_epi32(a.m, 24));
+ return vint4(value);
+#endif
+}
+
+/**
+ * @brief Store a vector, skipping masked lanes.
+ *
+ * All masked lanes must be at the end of vector, after all non-masked lanes.
+ */
+ASTCENC_SIMD_INLINE void store_lanes_masked(int* base, vint4 data, vmask4 mask)
+{
+#if ASTCENC_AVX >= 2
+ _mm_maskstore_epi32(base, _mm_castps_si128(mask.m), data.m);
+#else
+ // Note - we cannot use _mm_maskmoveu_si128 as the underlying hardware doesn't guarantee
+ // fault suppression on masked lanes so we can get page faults at the end of an image.
+ if (mask.lane<3>() != 0.0f)
+ {
+ store(data, base);
+ }
+ else if (mask.lane<2>() != 0.0f)
+ {
+ base[0] = data.lane<0>();
+ base[1] = data.lane<1>();
+ base[2] = data.lane<2>();
+ }
+ else if (mask.lane<1>() != 0.0f)
+ {
+ base[0] = data.lane<0>();
+ base[1] = data.lane<1>();
+ }
+ else if (mask.lane<0>() != 0.0f)
+ {
+ base[0] = data.lane<0>();
+ }
+#endif
+}
+
+#if defined(ASTCENC_NO_INVARIANCE) && (ASTCENC_SSE >= 41)
+
+#define ASTCENC_USE_NATIVE_DOT_PRODUCT 1
+
+/**
+ * @brief Return the dot product for the full 4 lanes, returning scalar.
+ */
+ASTCENC_SIMD_INLINE float dot_s(vfloat4 a, vfloat4 b)
+{
+ return _mm_cvtss_f32(_mm_dp_ps(a.m, b.m, 0xFF));
+}
+
+/**
+ * @brief Return the dot product for the full 4 lanes, returning vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 dot(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(_mm_dp_ps(a.m, b.m, 0xFF));
+}
+
+/**
+ * @brief Return the dot product for the bottom 3 lanes, returning scalar.
+ */
+ASTCENC_SIMD_INLINE float dot3_s(vfloat4 a, vfloat4 b)
+{
+ return _mm_cvtss_f32(_mm_dp_ps(a.m, b.m, 0x77));
+}
+
+/**
+ * @brief Return the dot product for the bottom 3 lanes, returning vector.
+ */
+ASTCENC_SIMD_INLINE vfloat4 dot3(vfloat4 a, vfloat4 b)
+{
+ return vfloat4(_mm_dp_ps(a.m, b.m, 0x77));
+}
+
+#endif // #if defined(ASTCENC_NO_INVARIANCE) && (ASTCENC_SSE >= 41)
+
+#if ASTCENC_POPCNT >= 1
+
+#define ASTCENC_USE_NATIVE_POPCOUNT 1
+
+/**
+ * @brief Population bit count.
+ *
+ * @param v The value to population count.
+ *
+ * @return The number of 1 bits.
+ */
+ASTCENC_SIMD_INLINE int popcount(uint64_t v)
+{
+ return static_cast<int>(_mm_popcnt_u64(v));
+}
+
+#endif // ASTCENC_POPCNT >= 1
+
+#endif // #ifndef ASTC_VECMATHLIB_SSE_4_H_INCLUDED
diff --git a/thirdparty/astcenc/astcenc_weight_align.cpp b/thirdparty/astcenc/astcenc_weight_align.cpp
new file mode 100644
index 0000000000..e40a318cf5
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_weight_align.cpp
@@ -0,0 +1,479 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2022 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+#if !defined(ASTCENC_DECOMPRESS_ONLY)
+
+/**
+ * @brief Functions for angular-sum algorithm for weight alignment.
+ *
+ * This algorithm works as follows:
+ * - we compute a complex number P as (cos s*i, sin s*i) for each weight,
+ * where i is the input value and s is a scaling factor based on the spacing between the weights.
+ * - we then add together complex numbers for all the weights.
+ * - we then compute the length and angle of the resulting sum.
+ *
+ * This should produce the following results:
+ * - perfect alignment results in a vector whose length is equal to the sum of lengths of all inputs
+ * - even distribution results in a vector of length 0.
+ * - all samples identical results in perfect alignment for every scaling.
+ *
+ * For each scaling factor within a given set, we compute an alignment factor from 0 to 1. This
+ * should then result in some scalings standing out as having particularly good alignment factors;
+ * we can use this to produce a set of candidate scale/shift values for various quantization levels;
+ * we should then actually try them and see what happens.
+ */
+
+#include "astcenc_internal.h"
+#include "astcenc_vecmathlib.h"
+
+#include <stdio.h>
+#include <cassert>
+#include <cstring>
+
+static constexpr unsigned int ANGULAR_STEPS { 32 };
+
+static_assert((ANGULAR_STEPS % ASTCENC_SIMD_WIDTH) == 0,
+ "ANGULAR_STEPS must be multiple of ASTCENC_SIMD_WIDTH");
+
+static_assert(ANGULAR_STEPS >= 32,
+ "ANGULAR_STEPS must be at least max(steps_for_quant_level)");
+
+// Store a reduced sin/cos table for 64 possible weight values; this causes
+// slight quality loss compared to using sin() and cos() directly. Must be 2^N.
+static constexpr unsigned int SINCOS_STEPS { 64 };
+
+static const uint8_t steps_for_quant_level[12] {
+ 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32
+};
+
+alignas(ASTCENC_VECALIGN) static float sin_table[SINCOS_STEPS][ANGULAR_STEPS];
+alignas(ASTCENC_VECALIGN) static float cos_table[SINCOS_STEPS][ANGULAR_STEPS];
+
+#if defined(ASTCENC_DIAGNOSTICS)
+ static bool print_once { true };
+#endif
+
+/* See header for documentation. */
+void prepare_angular_tables()
+{
+ for (unsigned int i = 0; i < ANGULAR_STEPS; i++)
+ {
+ float angle_step = static_cast<float>(i + 1);
+
+ for (unsigned int j = 0; j < SINCOS_STEPS; j++)
+ {
+ sin_table[j][i] = static_cast<float>(sinf((2.0f * astc::PI / (SINCOS_STEPS - 1.0f)) * angle_step * static_cast<float>(j)));
+ cos_table[j][i] = static_cast<float>(cosf((2.0f * astc::PI / (SINCOS_STEPS - 1.0f)) * angle_step * static_cast<float>(j)));
+ }
+ }
+}
+
+/**
+ * @brief Compute the angular alignment factors and offsets.
+ *
+ * @param weight_count The number of (decimated) weights.
+ * @param dec_weight_ideal_value The ideal decimated unquantized weight values.
+ * @param max_angular_steps The maximum number of steps to be tested.
+ * @param[out] offsets The output angular offsets array.
+ */
+static void compute_angular_offsets(
+ unsigned int weight_count,
+ const float* dec_weight_ideal_value,
+ unsigned int max_angular_steps,
+ float* offsets
+) {
+ promise(weight_count > 0);
+ promise(max_angular_steps > 0);
+
+ alignas(ASTCENC_VECALIGN) int isamplev[BLOCK_MAX_WEIGHTS];
+
+ // Precompute isample; arrays are always allocated 64 elements long
+ for (unsigned int i = 0; i < weight_count; i += ASTCENC_SIMD_WIDTH)
+ {
+ // Add 2^23 and interpreting bits extracts round-to-nearest int
+ vfloat sample = loada(dec_weight_ideal_value + i) * (SINCOS_STEPS - 1.0f) + vfloat(12582912.0f);
+ vint isample = float_as_int(sample) & vint((SINCOS_STEPS - 1));
+ storea(isample, isamplev + i);
+ }
+
+ // Arrays are multiple of SIMD width (ANGULAR_STEPS), safe to overshoot max
+ vfloat mult = vfloat(1.0f / (2.0f * astc::PI));
+
+ for (unsigned int i = 0; i < max_angular_steps; i += ASTCENC_SIMD_WIDTH)
+ {
+ vfloat anglesum_x = vfloat::zero();
+ vfloat anglesum_y = vfloat::zero();
+
+ for (unsigned int j = 0; j < weight_count; j++)
+ {
+ int isample = isamplev[j];
+ anglesum_x += loada(cos_table[isample] + i);
+ anglesum_y += loada(sin_table[isample] + i);
+ }
+
+ vfloat angle = atan2(anglesum_y, anglesum_x);
+ vfloat ofs = angle * mult;
+ storea(ofs, offsets + i);
+ }
+}
+
+/**
+ * @brief For a given step size compute the lowest and highest weight.
+ *
+ * Compute the lowest and highest weight that results from quantizing using the given stepsize and
+ * offset, and then compute the resulting error. The cut errors indicate the error that results from
+ * forcing samples that should have had one weight value one step up or down.
+ *
+ * @param weight_count The number of (decimated) weights.
+ * @param dec_weight_ideal_value The ideal decimated unquantized weight values.
+ * @param max_angular_steps The maximum number of steps to be tested.
+ * @param max_quant_steps The maximum quantization level to be tested.
+ * @param offsets The angular offsets array.
+ * @param[out] lowest_weight Per angular step, the lowest weight.
+ * @param[out] weight_span Per angular step, the span between lowest and highest weight.
+ * @param[out] error Per angular step, the error.
+ * @param[out] cut_low_weight_error Per angular step, the low weight cut error.
+ * @param[out] cut_high_weight_error Per angular step, the high weight cut error.
+ */
+static void compute_lowest_and_highest_weight(
+ unsigned int weight_count,
+ const float* dec_weight_ideal_value,
+ unsigned int max_angular_steps,
+ unsigned int max_quant_steps,
+ const float* offsets,
+ float* lowest_weight,
+ int* weight_span,
+ float* error,
+ float* cut_low_weight_error,
+ float* cut_high_weight_error
+) {
+ promise(weight_count > 0);
+ promise(max_angular_steps > 0);
+
+ vfloat rcp_stepsize = vfloat::lane_id() + vfloat(1.0f);
+
+ // Arrays are ANGULAR_STEPS long, so always safe to run full vectors
+ for (unsigned int sp = 0; sp < max_angular_steps; sp += ASTCENC_SIMD_WIDTH)
+ {
+ vfloat minidx(128.0f);
+ vfloat maxidx(-128.0f);
+ vfloat errval = vfloat::zero();
+ vfloat cut_low_weight_err = vfloat::zero();
+ vfloat cut_high_weight_err = vfloat::zero();
+ vfloat offset = loada(offsets + sp);
+
+ for (unsigned int j = 0; j < weight_count; j++)
+ {
+ vfloat sval = load1(dec_weight_ideal_value + j) * rcp_stepsize - offset;
+ vfloat svalrte = round(sval);
+ vfloat diff = sval - svalrte;
+ errval += diff * diff;
+
+ // Reset tracker on min hit
+ vmask mask = svalrte < minidx;
+ minidx = select(minidx, svalrte, mask);
+ cut_low_weight_err = select(cut_low_weight_err, vfloat::zero(), mask);
+
+ // Accumulate on min hit
+ mask = svalrte == minidx;
+ vfloat accum = cut_low_weight_err + vfloat(1.0f) - vfloat(2.0f) * diff;
+ cut_low_weight_err = select(cut_low_weight_err, accum, mask);
+
+ // Reset tracker on max hit
+ mask = svalrte > maxidx;
+ maxidx = select(maxidx, svalrte, mask);
+ cut_high_weight_err = select(cut_high_weight_err, vfloat::zero(), mask);
+
+ // Accumulate on max hit
+ mask = svalrte == maxidx;
+ accum = cut_high_weight_err + vfloat(1.0f) + vfloat(2.0f) * diff;
+ cut_high_weight_err = select(cut_high_weight_err, accum, mask);
+ }
+
+ // Write out min weight and weight span; clamp span to a usable range
+ vint span = float_to_int(maxidx - minidx + vfloat(1));
+ span = min(span, vint(max_quant_steps + 3));
+ span = max(span, vint(2));
+ storea(minidx, lowest_weight + sp);
+ storea(span, weight_span + sp);
+
+ // The cut_(lowest/highest)_weight_error indicate the error that results from forcing
+ // samples that should have had the weight value one step (up/down).
+ vfloat ssize = 1.0f / rcp_stepsize;
+ vfloat errscale = ssize * ssize;
+ storea(errval * errscale, error + sp);
+ storea(cut_low_weight_err * errscale, cut_low_weight_error + sp);
+ storea(cut_high_weight_err * errscale, cut_high_weight_error + sp);
+
+ rcp_stepsize = rcp_stepsize + vfloat(ASTCENC_SIMD_WIDTH);
+ }
+}
+
+/**
+ * @brief The main function for the angular algorithm.
+ *
+ * @param weight_count The number of (decimated) weights.
+ * @param dec_weight_ideal_value The ideal decimated unquantized weight values.
+ * @param max_quant_level The maximum quantization level to be tested.
+ * @param[out] low_value Per angular step, the lowest weight value.
+ * @param[out] high_value Per angular step, the highest weight value.
+ */
+static void compute_angular_endpoints_for_quant_levels(
+ unsigned int weight_count,
+ const float* dec_weight_ideal_value,
+ unsigned int max_quant_level,
+ float low_value[TUNE_MAX_ANGULAR_QUANT + 1],
+ float high_value[TUNE_MAX_ANGULAR_QUANT + 1]
+) {
+ unsigned int max_quant_steps = steps_for_quant_level[max_quant_level];
+ unsigned int max_angular_steps = steps_for_quant_level[max_quant_level];
+
+ alignas(ASTCENC_VECALIGN) float angular_offsets[ANGULAR_STEPS];
+
+ compute_angular_offsets(weight_count, dec_weight_ideal_value,
+ max_angular_steps, angular_offsets);
+
+ alignas(ASTCENC_VECALIGN) float lowest_weight[ANGULAR_STEPS];
+ alignas(ASTCENC_VECALIGN) int32_t weight_span[ANGULAR_STEPS];
+ alignas(ASTCENC_VECALIGN) float error[ANGULAR_STEPS];
+ alignas(ASTCENC_VECALIGN) float cut_low_weight_error[ANGULAR_STEPS];
+ alignas(ASTCENC_VECALIGN) float cut_high_weight_error[ANGULAR_STEPS];
+
+ compute_lowest_and_highest_weight(weight_count, dec_weight_ideal_value,
+ max_angular_steps, max_quant_steps,
+ angular_offsets, lowest_weight, weight_span, error,
+ cut_low_weight_error, cut_high_weight_error);
+
+ // For each quantization level, find the best error terms. Use packed vectors so data-dependent
+ // branches can become selects. This involves some integer to float casts, but the values are
+ // small enough so they never round the wrong way.
+ vfloat4 best_results[36];
+
+ // Initialize the array to some safe defaults
+ promise(max_quant_steps > 0);
+ for (unsigned int i = 0; i < (max_quant_steps + 4); i++)
+ {
+ // Lane<0> = Best error
+ // Lane<1> = Best scale; -1 indicates no solution found
+ // Lane<2> = Cut low weight
+ best_results[i] = vfloat4(ERROR_CALC_DEFAULT, -1.0f, 0.0f, 0.0f);
+ }
+
+ promise(max_angular_steps > 0);
+ for (unsigned int i = 0; i < max_angular_steps; i++)
+ {
+ float i_flt = static_cast<float>(i);
+
+ int idx_span = weight_span[i];
+
+ float error_cut_low = error[i] + cut_low_weight_error[i];
+ float error_cut_high = error[i] + cut_high_weight_error[i];
+ float error_cut_low_high = error[i] + cut_low_weight_error[i] + cut_high_weight_error[i];
+
+ // Check best error against record N
+ vfloat4 best_result = best_results[idx_span];
+ vfloat4 new_result = vfloat4(error[i], i_flt, 0.0f, 0.0f);
+ vmask4 mask = vfloat4(best_result.lane<0>()) > vfloat4(error[i]);
+ best_results[idx_span] = select(best_result, new_result, mask);
+
+ // Check best error against record N-1 with either cut low or cut high
+ best_result = best_results[idx_span - 1];
+
+ new_result = vfloat4(error_cut_low, i_flt, 1.0f, 0.0f);
+ mask = vfloat4(best_result.lane<0>()) > vfloat4(error_cut_low);
+ best_result = select(best_result, new_result, mask);
+
+ new_result = vfloat4(error_cut_high, i_flt, 0.0f, 0.0f);
+ mask = vfloat4(best_result.lane<0>()) > vfloat4(error_cut_high);
+ best_results[idx_span - 1] = select(best_result, new_result, mask);
+
+ // Check best error against record N-2 with both cut low and high
+ best_result = best_results[idx_span - 2];
+ new_result = vfloat4(error_cut_low_high, i_flt, 1.0f, 0.0f);
+ mask = vfloat4(best_result.lane<0>()) > vfloat4(error_cut_low_high);
+ best_results[idx_span - 2] = select(best_result, new_result, mask);
+ }
+
+ for (unsigned int i = 0; i <= max_quant_level; i++)
+ {
+ unsigned int q = steps_for_quant_level[i];
+ int bsi = static_cast<int>(best_results[q].lane<1>());
+
+ // Did we find anything?
+#if defined(ASTCENC_DIAGNOSTICS)
+ if ((bsi < 0) && print_once)
+ {
+ print_once = false;
+ printf("INFO: Unable to find full encoding within search error limit.\n\n");
+ }
+#endif
+
+ bsi = astc::max(0, bsi);
+
+ float lwi = lowest_weight[bsi] + best_results[q].lane<2>();
+ float hwi = lwi + static_cast<float>(q) - 1.0f;
+
+ float stepsize = 1.0f / (1.0f + static_cast<float>(bsi));
+ low_value[i] = (angular_offsets[bsi] + lwi) * stepsize;
+ high_value[i] = (angular_offsets[bsi] + hwi) * stepsize;
+ }
+}
+
+/* See header for documentation. */
+void compute_angular_endpoints_1plane(
+ bool only_always,
+ const block_size_descriptor& bsd,
+ const float* dec_weight_ideal_value,
+ unsigned int max_weight_quant,
+ compression_working_buffers& tmpbuf
+) {
+ float (&low_value)[WEIGHTS_MAX_BLOCK_MODES] = tmpbuf.weight_low_value1;
+ float (&high_value)[WEIGHTS_MAX_BLOCK_MODES] = tmpbuf.weight_high_value1;
+
+ float (&low_values)[WEIGHTS_MAX_DECIMATION_MODES][TUNE_MAX_ANGULAR_QUANT + 1] = tmpbuf.weight_low_values1;
+ float (&high_values)[WEIGHTS_MAX_DECIMATION_MODES][TUNE_MAX_ANGULAR_QUANT + 1] = tmpbuf.weight_high_values1;
+
+ unsigned int max_decimation_modes = only_always ? bsd.decimation_mode_count_always
+ : bsd.decimation_mode_count_selected;
+ promise(max_decimation_modes > 0);
+ for (unsigned int i = 0; i < max_decimation_modes; i++)
+ {
+ const decimation_mode& dm = bsd.decimation_modes[i];
+ if (!dm.is_ref_1_plane(static_cast<quant_method>(max_weight_quant)))
+ {
+ continue;
+ }
+
+ unsigned int weight_count = bsd.get_decimation_info(i).weight_count;
+
+ unsigned int max_precision = dm.maxprec_1plane;
+ if (max_precision > TUNE_MAX_ANGULAR_QUANT)
+ {
+ max_precision = TUNE_MAX_ANGULAR_QUANT;
+ }
+
+ if (max_precision > max_weight_quant)
+ {
+ max_precision = max_weight_quant;
+ }
+
+ compute_angular_endpoints_for_quant_levels(
+ weight_count,
+ dec_weight_ideal_value + i * BLOCK_MAX_WEIGHTS,
+ max_precision, low_values[i], high_values[i]);
+ }
+
+ unsigned int max_block_modes = only_always ? bsd.block_mode_count_1plane_always
+ : bsd.block_mode_count_1plane_selected;
+ promise(max_block_modes > 0);
+ for (unsigned int i = 0; i < max_block_modes; i++)
+ {
+ const block_mode& bm = bsd.block_modes[i];
+ assert(!bm.is_dual_plane);
+
+ unsigned int quant_mode = bm.quant_mode;
+ unsigned int decim_mode = bm.decimation_mode;
+
+ if (quant_mode <= TUNE_MAX_ANGULAR_QUANT)
+ {
+ low_value[i] = low_values[decim_mode][quant_mode];
+ high_value[i] = high_values[decim_mode][quant_mode];
+ }
+ else
+ {
+ low_value[i] = 0.0f;
+ high_value[i] = 1.0f;
+ }
+ }
+}
+
+/* See header for documentation. */
+void compute_angular_endpoints_2planes(
+ const block_size_descriptor& bsd,
+ const float* dec_weight_ideal_value,
+ unsigned int max_weight_quant,
+ compression_working_buffers& tmpbuf
+) {
+ float (&low_value1)[WEIGHTS_MAX_BLOCK_MODES] = tmpbuf.weight_low_value1;
+ float (&high_value1)[WEIGHTS_MAX_BLOCK_MODES] = tmpbuf.weight_high_value1;
+ float (&low_value2)[WEIGHTS_MAX_BLOCK_MODES] = tmpbuf.weight_low_value2;
+ float (&high_value2)[WEIGHTS_MAX_BLOCK_MODES] = tmpbuf.weight_high_value2;
+
+ float (&low_values1)[WEIGHTS_MAX_DECIMATION_MODES][TUNE_MAX_ANGULAR_QUANT + 1] = tmpbuf.weight_low_values1;
+ float (&high_values1)[WEIGHTS_MAX_DECIMATION_MODES][TUNE_MAX_ANGULAR_QUANT + 1] = tmpbuf.weight_high_values1;
+ float (&low_values2)[WEIGHTS_MAX_DECIMATION_MODES][TUNE_MAX_ANGULAR_QUANT + 1] = tmpbuf.weight_low_values2;
+ float (&high_values2)[WEIGHTS_MAX_DECIMATION_MODES][TUNE_MAX_ANGULAR_QUANT + 1] = tmpbuf.weight_high_values2;
+
+ promise(bsd.decimation_mode_count_selected > 0);
+ for (unsigned int i = 0; i < bsd.decimation_mode_count_selected; i++)
+ {
+ const decimation_mode& dm = bsd.decimation_modes[i];
+ if (!dm.is_ref_2_plane(static_cast<quant_method>(max_weight_quant)))
+ {
+ continue;
+ }
+
+ unsigned int weight_count = bsd.get_decimation_info(i).weight_count;
+
+ unsigned int max_precision = dm.maxprec_2planes;
+ if (max_precision > TUNE_MAX_ANGULAR_QUANT)
+ {
+ max_precision = TUNE_MAX_ANGULAR_QUANT;
+ }
+
+ if (max_precision > max_weight_quant)
+ {
+ max_precision = max_weight_quant;
+ }
+
+ compute_angular_endpoints_for_quant_levels(
+ weight_count,
+ dec_weight_ideal_value + i * BLOCK_MAX_WEIGHTS,
+ max_precision, low_values1[i], high_values1[i]);
+
+ compute_angular_endpoints_for_quant_levels(
+ weight_count,
+ dec_weight_ideal_value + i * BLOCK_MAX_WEIGHTS + WEIGHTS_PLANE2_OFFSET,
+ max_precision, low_values2[i], high_values2[i]);
+ }
+
+ unsigned int start = bsd.block_mode_count_1plane_selected;
+ unsigned int end = bsd.block_mode_count_1plane_2plane_selected;
+ for (unsigned int i = start; i < end; i++)
+ {
+ const block_mode& bm = bsd.block_modes[i];
+ unsigned int quant_mode = bm.quant_mode;
+ unsigned int decim_mode = bm.decimation_mode;
+
+ if (quant_mode <= TUNE_MAX_ANGULAR_QUANT)
+ {
+ low_value1[i] = low_values1[decim_mode][quant_mode];
+ high_value1[i] = high_values1[decim_mode][quant_mode];
+ low_value2[i] = low_values2[decim_mode][quant_mode];
+ high_value2[i] = high_values2[decim_mode][quant_mode];
+ }
+ else
+ {
+ low_value1[i] = 0.0f;
+ high_value1[i] = 1.0f;
+ low_value2[i] = 0.0f;
+ high_value2[i] = 1.0f;
+ }
+ }
+}
+
+#endif
diff --git a/thirdparty/astcenc/astcenc_weight_quant_xfer_tables.cpp b/thirdparty/astcenc/astcenc_weight_quant_xfer_tables.cpp
new file mode 100644
index 0000000000..8fdf73adc2
--- /dev/null
+++ b/thirdparty/astcenc/astcenc_weight_quant_xfer_tables.cpp
@@ -0,0 +1,147 @@
+// SPDX-License-Identifier: Apache-2.0
+// ----------------------------------------------------------------------------
+// Copyright 2011-2021 Arm Limited
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
+// under the License.
+// ----------------------------------------------------------------------------
+
+/**
+ * @brief Data tables for quantization transfer.
+ */
+
+#include "astcenc_internal.h"
+
+#define _ 0 // Using _ to indicate an entry that will not be used.
+
+const quant_and_transfer_table quant_and_xfer_tables[12] {
+ // QUANT2, range 0..1
+ {
+ {0, 64},
+ {0, 1},
+ {0, 64},
+ {0x4000,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,
+ _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,
+ 0x4000}
+ },
+ // QUANT_3, range 0..2
+ {
+ {0, 32, 64},
+ {0, 1, 2},
+ {0, 32, 64},
+ {0x2000,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,
+ _,_,0x4000,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,
+ _,_,_,_,0x4020}
+ },
+ // QUANT_4, range 0..3
+ {
+ {0, 21, 43, 64},
+ {0, 1, 2, 3},
+ {0, 21, 43, 64},
+ {0x1500,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x2b00,_,_,_,_,
+ _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x4015,_,_,_,_,_,_,_,_,_,_,_,_,
+ _,_,_,_,_,_,_,_,0x402b}
+ },
+ //QUANT_5, range 0..4
+ {
+ {0, 16, 32, 48, 64},
+ {0, 1, 2, 3, 4},
+ {0, 16, 32, 48, 64},
+ {0x1000,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x2000,_,_,_,_,_,_,_,_,_,
+ _,_,_,_,_,_,0x3010,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x4020,_,_,_,
+ _,_,_,_,_,_,_,_,_,_,_,_,0x4030}
+ },
+ // QUANT_6, range 0..5
+ {
+ {0, 12, 25, 39, 52, 64},
+ {0, 2, 4, 5, 3, 1},
+ {0, 64, 12, 52, 25, 39},
+ {0x0c00,_,_,_,_,_,_,_,_,_,_,_,0x1900,_,_,_,_,_,_,_,_,_,_,_,_,
+ 0x270c,_,_,_,_,_,_,_,_,_,_,_,_,_,0x3419,_,_,_,_,_,_,_,_,_,_,
+ _,_,0x4027,_,_,_,_,_,_,_,_,_,_,_,0x4034}
+ },
+ // QUANT_8, range 0..7
+ {
+ {0, 9, 18, 27, 37, 46, 55, 64},
+ {0, 1, 2, 3, 4, 5, 6, 7},
+ {0, 9, 18, 27, 37, 46, 55, 64},
+ {0x0900,_,_,_,_,_,_,_,_,0x1200,_,_,_,_,_,_,_,_,0x1b09,_,_,
+ _,_,_,_,_,_,0x2512,_,_,_,_,_,_,_,_,_,0x2e1b,_,_,_,_,_,_,_,_,
+ 0x3725,_,_,_,_,_,_,_,_,0x402e,_,_,_,_,_,_,_,_,0x4037}
+ },
+ // QUANT_10, range 0..9
+ {
+ {0, 7, 14, 21, 28, 36, 43, 50, 57, 64},
+ {0, 2, 4, 6, 8, 9, 7, 5, 3, 1},
+ {0, 64, 7, 57, 14, 50, 21, 43, 28, 36},
+ {0x0700,_,_,_,_,_,_,0x0e00,_,_,_,_,_,_,0x1507,_,_,_,_,_,_,
+ 0x1c0e,_,_,_,_,_,_,0x2415,_,_,_,_,_,_,_,0x2b1c,_,_,_,_,_,
+ _,0x3224,_,_,_,_,_,_,0x392b,_,_,_,_,_,_,0x4032,_,_,_,_,_,
+ _,0x4039}
+ },
+ // QUANT_12, range 0..11
+ {
+ {0, 5, 11, 17, 23, 28, 36, 41, 47, 53, 59, 64},
+ {0, 4, 8, 2, 6, 10, 11, 7, 3, 9, 5, 1},
+ {0, 64, 17, 47, 5, 59, 23, 41, 11, 53, 28, 36},
+ {0x0500,_,_,_,_,0x0b00,_,_,_,_,_,0x1105,_,_,_,_,_,
+ 0x170b,_,_,_,_,_,0x1c11,_,_,_,_,0x2417,_,_,_,_,_,_,_,
+ 0x291c,_,_,_,_,0x2f24,_,_,_,_,_,0x3529,_,_,_,_,_,
+ 0x3b2f,_,_,_,_,_,0x4035,_,_,_,_,0x403b}
+ },
+ // QUANT_16, range 0..15
+ {
+ {0, 4, 8, 12, 17, 21, 25, 29, 35, 39, 43, 47, 52, 56, 60, 64},
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
+ {0, 4, 8, 12, 17, 21, 25, 29, 35, 39, 43, 47, 52, 56, 60, 64},
+ {0x0400,_,_,_,0x0800,_,_,_,0x0c04,_,_,_,0x1108,_,_,_,_,
+ 0x150c,_,_,_,0x1911,_,_,_,0x1d15,_,_,_,0x2319,_,_,_,_,
+ _,0x271d,_,_,_,0x2b23,_,_,_,0x2f27,_,_,_,0x342b,_,_,_,
+ _,0x382f,_,_,_,0x3c34,_,_,_,0x4038,_,_,_,0x403c}
+ },
+ // QUANT_20, range 0..19
+ {
+ {0, 3, 6, 9, 13, 16, 19, 23, 26, 29, 35, 38, 41, 45, 48, 51, 55, 58, 61, 64},
+ {0, 4, 8, 12, 16, 2, 6, 10, 14, 18, 19, 15, 11, 7, 3, 17, 13, 9, 5, 1},
+ {0, 64, 16, 48, 3, 61, 19, 45, 6, 58, 23, 41, 9, 55, 26, 38, 13, 51, 29, 35},
+ {0x0300,_,_,0x0600,_,_,0x0903,_,_,0x0d06,_,_,_,
+ 0x1009,_,_,0x130d,_,_,0x1710,_,_,_,0x1a13,_,_,
+ 0x1d17,_,_,0x231a,_,_,_,_,_,0x261d,_,_,0x2923,_,_,
+ 0x2d26,_,_,_,0x3029,_,_,0x332d,_,_,0x3730,_,_,_,
+ 0x3a33,_,_,0x3d37,_,_,0x403a,_,_,0x403d}
+ },
+ // QUANT_24, range 0..23
+ {
+ {0, 2, 5, 8, 11, 13, 16, 19, 22, 24, 27, 30, 34, 37, 40, 42, 45, 48, 51, 53, 56, 59, 62, 64},
+ {0, 8, 16, 2, 10, 18, 4, 12, 20, 6, 14, 22, 23, 15, 7, 21, 13, 5, 19, 11, 3, 17, 9, 1},
+ {0, 64, 8, 56, 16, 48, 24, 40, 2, 62, 11, 53, 19, 45, 27, 37, 5, 59, 13, 51, 22, 42, 30, 34},
+ {0x0200,_,0x0500,_,_,0x0802,_,_,0x0b05,_,_,0x0d08,
+ _,0x100b,_,_,0x130d,_,_,0x1610,_,_,0x1813,_,
+ 0x1b16,_,_,0x1e18,_,_,0x221b,_,_,_,0x251e,_,_,
+ 0x2822,_,_,0x2a25,_,0x2d28,_,_,0x302a,_,_,0x332d,
+ _,_,0x3530,_,0x3833,_,_,0x3b35,_,_,0x3e38,_,_,
+ 0x403b,_,0x403e}
+ },
+ // QUANT_32, range 0..31
+ {
+ {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64},
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31},
+ {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64},
+ {0x0200,_,0x0400,_,0x0602,_,0x0804,_,0x0a06,_,
+ 0x0c08,_,0x0e0a,_,0x100c,_,0x120e,_,0x1410,_,
+ 0x1612,_,0x1814,_,0x1a16,_,0x1c18,_,0x1e1a,_,
+ 0x221c,_,_,_,0x241e,_,0x2622,_,0x2824,_,0x2a26,_,
+ 0x2c28,_,0x2e2a,_,0x302c,_,0x322e,_,0x3430,_,
+ 0x3632,_,0x3834,_,0x3a36,_,0x3c38,_,0x3e3a,_,
+ 0x403c,_,0x403e}
+ }
+};
diff --git a/thirdparty/astcenc/patches/fix-build-no-ssse3.patch b/thirdparty/astcenc/patches/fix-build-no-ssse3.patch
new file mode 100644
index 0000000000..9da4f3e1f3
--- /dev/null
+++ b/thirdparty/astcenc/patches/fix-build-no-ssse3.patch
@@ -0,0 +1,81 @@
+From 02c22d3df501dc284ba732fa82a6c408c57b3237 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
+Date: Thu, 19 Jan 2023 23:30:13 +0100
+Subject: [PATCH] mathlib: Remove incomplete support for SSE3 which assumed
+ SSSE3
+
+`_mm_shuffle_epi8` requires SSSE3 so the check on `ASTCENC_SSE >= 30` is
+too lax and would fail if `__SSE3__` is supported, but not `__SSSE3__`.
+
+The only supported configurations are SSE2, SSE4.1, and AVX2, so as
+discussed in #393 we drop the SSE3 checks and require SSE4.1 instead.
+---
+ Source/astcenc_mathlib.h | 2 --
+ Source/astcenc_vecmathlib_sse_4.h | 10 +++++-----
+ 2 files changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/Source/astcenc_mathlib.h b/Source/astcenc_mathlib.h
+index 67e989e..0540c4f 100644
+--- a/Source/astcenc_mathlib.h
++++ b/Source/astcenc_mathlib.h
+@@ -48,8 +48,6 @@
+ #define ASTCENC_SSE 42
+ #elif defined(__SSE4_1__)
+ #define ASTCENC_SSE 41
+- #elif defined(__SSE3__)
+- #define ASTCENC_SSE 30
+ #elif defined(__SSE2__)
+ #define ASTCENC_SSE 20
+ #else
+diff --git a/Source/astcenc_vecmathlib_sse_4.h b/Source/astcenc_vecmathlib_sse_4.h
+index 76fe577..26dcc4a 100644
+--- a/Source/astcenc_vecmathlib_sse_4.h
++++ b/Source/astcenc_vecmathlib_sse_4.h
+@@ -1046,7 +1046,7 @@ ASTCENC_SIMD_INLINE void vtable_prepare(vint4 t0, vint4& t0p)
+ */
+ ASTCENC_SIMD_INLINE void vtable_prepare(vint4 t0, vint4 t1, vint4& t0p, vint4& t1p)
+ {
+-#if ASTCENC_SSE >= 30
++#if ASTCENC_SSE >= 41
+ t0p = t0;
+ t1p = t0 ^ t1;
+ #else
+@@ -1062,7 +1062,7 @@ ASTCENC_SIMD_INLINE void vtable_prepare(
+ vint4 t0, vint4 t1, vint4 t2, vint4 t3,
+ vint4& t0p, vint4& t1p, vint4& t2p, vint4& t3p)
+ {
+-#if ASTCENC_SSE >= 30
++#if ASTCENC_SSE >= 41
+ t0p = t0;
+ t1p = t0 ^ t1;
+ t2p = t1 ^ t2;
+@@ -1080,7 +1080,7 @@ ASTCENC_SIMD_INLINE void vtable_prepare(
+ */
+ ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 idx)
+ {
+-#if ASTCENC_SSE >= 30
++#if ASTCENC_SSE >= 41
+ // Set index byte MSB to 1 for unused bytes so shuffle returns zero
+ __m128i idxx = _mm_or_si128(idx.m, _mm_set1_epi32(static_cast<int>(0xFFFFFF00)));
+
+@@ -1102,7 +1102,7 @@ ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 idx)
+ */
+ ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 t1, vint4 idx)
+ {
+-#if ASTCENC_SSE >= 30
++#if ASTCENC_SSE >= 41
+ // Set index byte MSB to 1 for unused bytes so shuffle returns zero
+ __m128i idxx = _mm_or_si128(idx.m, _mm_set1_epi32(static_cast<int>(0xFFFFFF00)));
+
+@@ -1130,7 +1130,7 @@ ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 t1, vint4 idx)
+ */
+ ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 t1, vint4 t2, vint4 t3, vint4 idx)
+ {
+-#if ASTCENC_SSE >= 30
++#if ASTCENC_SSE >= 41
+ // Set index byte MSB to 1 for unused bytes so shuffle returns zero
+ __m128i idxx = _mm_or_si128(idx.m, _mm_set1_epi32(static_cast<int>(0xFFFFFF00)));
+
+--
+2.39.1
+
diff --git a/thirdparty/enet/enet/godot_ext.h b/thirdparty/enet/enet/godot_ext.h
index 648f3d2f24..06a621b790 100644
--- a/thirdparty/enet/enet/godot_ext.h
+++ b/thirdparty/enet/enet/godot_ext.h
@@ -11,8 +11,8 @@
*/
ENET_API void enet_address_set_ip(ENetAddress * address, const uint8_t * ip, size_t size);
-ENET_API int enet_host_dtls_server_setup (ENetHost *, void *, void *);
-ENET_API int enet_host_dtls_client_setup (ENetHost *, void *, uint8_t, const char *);
+ENET_API int enet_host_dtls_server_setup (ENetHost *, void *);
+ENET_API int enet_host_dtls_client_setup (ENetHost *, const char *, void *);
ENET_API void enet_host_refuse_new_connections (ENetHost *, int);
#endif // __ENET_GODOT_EXT_H__
diff --git a/thirdparty/enet/godot.cpp b/thirdparty/enet/godot.cpp
index 47298dcf6a..ea7f4957a2 100644
--- a/thirdparty/enet/godot.cpp
+++ b/thirdparty/enet/godot.cpp
@@ -164,16 +164,14 @@ class ENetDTLSClient : public ENetGodotSocket {
bool connected = false;
Ref<PacketPeerUDP> udp;
Ref<PacketPeerDTLS> dtls;
- bool verify = false;
+ Ref<TLSOptions> tls_options;
String for_hostname;
- Ref<X509Certificate> cert;
IPAddress local_address;
public:
- ENetDTLSClient(ENetUDP *p_base, Ref<X509Certificate> p_cert, bool p_verify, String p_for_hostname) {
- verify = p_verify;
+ ENetDTLSClient(ENetUDP *p_base, String p_for_hostname, Ref<TLSOptions> p_options) {
for_hostname = p_for_hostname;
- cert = p_cert;
+ tls_options = p_options;
udp.instantiate();
dtls = Ref<PacketPeerDTLS>(PacketPeerDTLS::create());
if (p_base->bound) {
@@ -205,7 +203,7 @@ public:
Error sendto(const uint8_t *p_buffer, int p_len, int &r_sent, IPAddress p_ip, uint16_t p_port) {
if (!connected) {
udp->connect_to_host(p_ip, p_port);
- if (dtls->connect_to_peer(udp, verify, for_hostname, cert)) {
+ if (dtls->connect_to_peer(udp, for_hostname, tls_options)) {
return FAILED;
}
connected = true;
@@ -265,7 +263,7 @@ class ENetDTLSServer : public ENetGodotSocket {
IPAddress local_address;
public:
- ENetDTLSServer(ENetUDP *p_base, Ref<CryptoKey> p_key, Ref<X509Certificate> p_cert) {
+ ENetDTLSServer(ENetUDP *p_base, Ref<TLSOptions> p_options) {
udp_server.instantiate();
if (p_base->bound) {
uint16_t port;
@@ -274,7 +272,7 @@ public:
bind(local_address, port);
}
server = Ref<DTLSServer>(DTLSServer::create());
- server->setup(p_key, p_cert);
+ server->setup(p_options);
}
~ENetDTLSServer() {
@@ -437,22 +435,22 @@ ENetSocket enet_socket_create(ENetSocketType type) {
return socket;
}
-int enet_host_dtls_server_setup(ENetHost *host, void *p_key, void *p_cert) {
+int enet_host_dtls_server_setup(ENetHost *host, void *p_options) {
ENetGodotSocket *sock = (ENetGodotSocket *)host->socket;
if (!sock->can_upgrade()) {
return -1;
}
- host->socket = memnew(ENetDTLSServer((ENetUDP *)sock, Ref<CryptoKey>((CryptoKey *)p_key), Ref<X509Certificate>((X509Certificate *)p_cert)));
+ host->socket = memnew(ENetDTLSServer(static_cast<ENetUDP *>(sock), Ref<TLSOptions>(static_cast<TLSOptions *>(p_options))));
memdelete(sock);
return 0;
}
-int enet_host_dtls_client_setup(ENetHost *host, void *p_cert, uint8_t p_verify, const char *p_for_hostname) {
+int enet_host_dtls_client_setup(ENetHost *host, const char *p_for_hostname, void *p_options) {
ENetGodotSocket *sock = (ENetGodotSocket *)host->socket;
if (!sock->can_upgrade()) {
return -1;
}
- host->socket = memnew(ENetDTLSClient((ENetUDP *)sock, Ref<X509Certificate>((X509Certificate *)p_cert), p_verify, String::utf8(p_for_hostname)));
+ host->socket = memnew(ENetDTLSClient(static_cast<ENetUDP *>(sock), String::utf8(p_for_hostname), Ref<TLSOptions>(static_cast<TLSOptions *>(p_options))));
memdelete(sock);
return 0;
}
diff --git a/thirdparty/linuxbsd_headers/README.md b/thirdparty/linuxbsd_headers/README.md
new file mode 100644
index 0000000000..af902aa97a
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/README.md
@@ -0,0 +1,69 @@
+# Linux/BSD headers
+
+Please keep categories (`##` level) listed alphabetically and matching their
+respective folder names. Use two empty lines to separate categories for
+readability.
+
+
+## ALSA
+
+- Upstream: https://www.alsa-project.org/
+- Version: 1.1.3-5
+- License: LPGL-2.1+
+
+Patches in the `patches` directory should be re-applied after updates.
+
+## dbus
+
+- Upstream: https://www.freedesktop.org/wiki/software/dbus/
+- Version: 1.12.2
+- License: AFL-2.1
+
+
+## fontconfig
+
+- Upstream: https://www.freedesktop.org/wiki/software/fontconfig/
+- Version: 2.12.6
+- License: fontconfig
+
+
+## pulse
+
+- Upstream: http://pulseaudio.org/
+- Version: 1.11.1
+- License: LPGL-2.1+
+
+
+# speechd
+
+- Upstream: https://www.freebsoft.org/pub/projects/speechd/
+- Version: 0.8.8
+- License: LPGL-2.1+
+
+
+# udev
+
+- Upstream: https://www.freedesktop.org/wiki/software/systemd/
+- Version: 237
+- License: LPGL-2.1+
+
+
+## X11
+
+- Upstream: https://x.org/wiki/
+- Version:
+ * Xcursor: 1.2.0
+ * Xext: 1.3.5
+ * Xinerama: 1.1.4
+ * Xi: 1.7.10
+ * Xlib: 1.6.9
+ * Xrandr: 1.5.2
+ * Xrender: 0.9.10
+- License: MIT
+
+
+## xkbcommon
+
+- Upstream: https://xkbcommon.org/
+- Version: 1.4.0
+- License: MIT
diff --git a/thirdparty/linuxbsd_headers/X11/X.h b/thirdparty/linuxbsd_headers/X11/X.h
new file mode 100644
index 0000000000..4df7d22e95
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/X.h
@@ -0,0 +1,717 @@
+/* Definitions for the X window system likely to be used by applications */
+
+#ifndef X_H
+#define X_H
+
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#define X_PROTOCOL 11 /* current protocol version */
+#define X_PROTOCOL_REVISION 0 /* current minor version */
+
+/* Resources */
+
+/*
+ * _XSERVER64 must ONLY be defined when compiling X server sources on
+ * systems where unsigned long is not 32 bits, must NOT be used in
+ * client or library code.
+ */
+#ifndef _XSERVER64
+# ifndef _XTYPEDEF_XID
+# define _XTYPEDEF_XID
+typedef unsigned long XID;
+# endif
+# ifndef _XTYPEDEF_MASK
+# define _XTYPEDEF_MASK
+typedef unsigned long Mask;
+# endif
+# ifndef _XTYPEDEF_ATOM
+# define _XTYPEDEF_ATOM
+typedef unsigned long Atom; /* Also in Xdefs.h */
+# endif
+typedef unsigned long VisualID;
+typedef unsigned long Time;
+#else
+# include <X11/Xmd.h>
+# ifndef _XTYPEDEF_XID
+# define _XTYPEDEF_XID
+typedef CARD32 XID;
+# endif
+# ifndef _XTYPEDEF_MASK
+# define _XTYPEDEF_MASK
+typedef CARD32 Mask;
+# endif
+# ifndef _XTYPEDEF_ATOM
+# define _XTYPEDEF_ATOM
+typedef CARD32 Atom;
+# endif
+typedef CARD32 VisualID;
+typedef CARD32 Time;
+#endif
+
+typedef XID Window;
+typedef XID Drawable;
+#ifndef _XTYPEDEF_FONT
+# define _XTYPEDEF_FONT
+typedef XID Font;
+#endif
+typedef XID Pixmap;
+typedef XID Cursor;
+typedef XID Colormap;
+typedef XID GContext;
+typedef XID KeySym;
+
+typedef unsigned char KeyCode;
+
+/*****************************************************************
+ * RESERVED RESOURCE AND CONSTANT DEFINITIONS
+ *****************************************************************/
+
+#ifndef None
+#define None 0L /* universal null resource or null atom */
+#endif
+
+#define ParentRelative 1L /* background pixmap in CreateWindow
+ and ChangeWindowAttributes */
+
+#define CopyFromParent 0L /* border pixmap in CreateWindow
+ and ChangeWindowAttributes
+ special VisualID and special window
+ class passed to CreateWindow */
+
+#define PointerWindow 0L /* destination window in SendEvent */
+#define InputFocus 1L /* destination window in SendEvent */
+
+#define PointerRoot 1L /* focus window in SetInputFocus */
+
+#define AnyPropertyType 0L /* special Atom, passed to GetProperty */
+
+#define AnyKey 0L /* special Key Code, passed to GrabKey */
+
+#define AnyButton 0L /* special Button Code, passed to GrabButton */
+
+#define AllTemporary 0L /* special Resource ID passed to KillClient */
+
+#define CurrentTime 0L /* special Time */
+
+#define NoSymbol 0L /* special KeySym */
+
+/*****************************************************************
+ * EVENT DEFINITIONS
+ *****************************************************************/
+
+/* Input Event Masks. Used as event-mask window attribute and as arguments
+ to Grab requests. Not to be confused with event names. */
+
+#define NoEventMask 0L
+#define KeyPressMask (1L<<0)
+#define KeyReleaseMask (1L<<1)
+#define ButtonPressMask (1L<<2)
+#define ButtonReleaseMask (1L<<3)
+#define EnterWindowMask (1L<<4)
+#define LeaveWindowMask (1L<<5)
+#define PointerMotionMask (1L<<6)
+#define PointerMotionHintMask (1L<<7)
+#define Button1MotionMask (1L<<8)
+#define Button2MotionMask (1L<<9)
+#define Button3MotionMask (1L<<10)
+#define Button4MotionMask (1L<<11)
+#define Button5MotionMask (1L<<12)
+#define ButtonMotionMask (1L<<13)
+#define KeymapStateMask (1L<<14)
+#define ExposureMask (1L<<15)
+#define VisibilityChangeMask (1L<<16)
+#define StructureNotifyMask (1L<<17)
+#define ResizeRedirectMask (1L<<18)
+#define SubstructureNotifyMask (1L<<19)
+#define SubstructureRedirectMask (1L<<20)
+#define FocusChangeMask (1L<<21)
+#define PropertyChangeMask (1L<<22)
+#define ColormapChangeMask (1L<<23)
+#define OwnerGrabButtonMask (1L<<24)
+
+/* Event names. Used in "type" field in XEvent structures. Not to be
+confused with event masks above. They start from 2 because 0 and 1
+are reserved in the protocol for errors and replies. */
+
+#define KeyPress 2
+#define KeyRelease 3
+#define ButtonPress 4
+#define ButtonRelease 5
+#define MotionNotify 6
+#define EnterNotify 7
+#define LeaveNotify 8
+#define FocusIn 9
+#define FocusOut 10
+#define KeymapNotify 11
+#define Expose 12
+#define GraphicsExpose 13
+#define NoExpose 14
+#define VisibilityNotify 15
+#define CreateNotify 16
+#define DestroyNotify 17
+#define UnmapNotify 18
+#define MapNotify 19
+#define MapRequest 20
+#define ReparentNotify 21
+#define ConfigureNotify 22
+#define ConfigureRequest 23
+#define GravityNotify 24
+#define ResizeRequest 25
+#define CirculateNotify 26
+#define CirculateRequest 27
+#define PropertyNotify 28
+#define SelectionClear 29
+#define SelectionRequest 30
+#define SelectionNotify 31
+#define ColormapNotify 32
+#define ClientMessage 33
+#define MappingNotify 34
+#define GenericEvent 35
+#define LASTEvent 36 /* must be bigger than any event # */
+
+
+/* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
+ state in various key-, mouse-, and button-related events. */
+
+#define ShiftMask (1<<0)
+#define LockMask (1<<1)
+#define ControlMask (1<<2)
+#define Mod1Mask (1<<3)
+#define Mod2Mask (1<<4)
+#define Mod3Mask (1<<5)
+#define Mod4Mask (1<<6)
+#define Mod5Mask (1<<7)
+
+/* modifier names. Used to build a SetModifierMapping request or
+ to read a GetModifierMapping request. These correspond to the
+ masks defined above. */
+#define ShiftMapIndex 0
+#define LockMapIndex 1
+#define ControlMapIndex 2
+#define Mod1MapIndex 3
+#define Mod2MapIndex 4
+#define Mod3MapIndex 5
+#define Mod4MapIndex 6
+#define Mod5MapIndex 7
+
+
+/* button masks. Used in same manner as Key masks above. Not to be confused
+ with button names below. */
+
+#define Button1Mask (1<<8)
+#define Button2Mask (1<<9)
+#define Button3Mask (1<<10)
+#define Button4Mask (1<<11)
+#define Button5Mask (1<<12)
+
+#define AnyModifier (1<<15) /* used in GrabButton, GrabKey */
+
+
+/* button names. Used as arguments to GrabButton and as detail in ButtonPress
+ and ButtonRelease events. Not to be confused with button masks above.
+ Note that 0 is already defined above as "AnyButton". */
+
+#define Button1 1
+#define Button2 2
+#define Button3 3
+#define Button4 4
+#define Button5 5
+
+/* Notify modes */
+
+#define NotifyNormal 0
+#define NotifyGrab 1
+#define NotifyUngrab 2
+#define NotifyWhileGrabbed 3
+
+#define NotifyHint 1 /* for MotionNotify events */
+
+/* Notify detail */
+
+#define NotifyAncestor 0
+#define NotifyVirtual 1
+#define NotifyInferior 2
+#define NotifyNonlinear 3
+#define NotifyNonlinearVirtual 4
+#define NotifyPointer 5
+#define NotifyPointerRoot 6
+#define NotifyDetailNone 7
+
+/* Visibility notify */
+
+#define VisibilityUnobscured 0
+#define VisibilityPartiallyObscured 1
+#define VisibilityFullyObscured 2
+
+/* Circulation request */
+
+#define PlaceOnTop 0
+#define PlaceOnBottom 1
+
+/* protocol families */
+
+#define FamilyInternet 0 /* IPv4 */
+#define FamilyDECnet 1
+#define FamilyChaos 2
+#define FamilyInternet6 6 /* IPv6 */
+
+/* authentication families not tied to a specific protocol */
+#define FamilyServerInterpreted 5
+
+/* Property notification */
+
+#define PropertyNewValue 0
+#define PropertyDelete 1
+
+/* Color Map notification */
+
+#define ColormapUninstalled 0
+#define ColormapInstalled 1
+
+/* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */
+
+#define GrabModeSync 0
+#define GrabModeAsync 1
+
+/* GrabPointer, GrabKeyboard reply status */
+
+#define GrabSuccess 0
+#define AlreadyGrabbed 1
+#define GrabInvalidTime 2
+#define GrabNotViewable 3
+#define GrabFrozen 4
+
+/* AllowEvents modes */
+
+#define AsyncPointer 0
+#define SyncPointer 1
+#define ReplayPointer 2
+#define AsyncKeyboard 3
+#define SyncKeyboard 4
+#define ReplayKeyboard 5
+#define AsyncBoth 6
+#define SyncBoth 7
+
+/* Used in SetInputFocus, GetInputFocus */
+
+#define RevertToNone (int)None
+#define RevertToPointerRoot (int)PointerRoot
+#define RevertToParent 2
+
+/*****************************************************************
+ * ERROR CODES
+ *****************************************************************/
+
+#define Success 0 /* everything's okay */
+#define BadRequest 1 /* bad request code */
+#define BadValue 2 /* int parameter out of range */
+#define BadWindow 3 /* parameter not a Window */
+#define BadPixmap 4 /* parameter not a Pixmap */
+#define BadAtom 5 /* parameter not an Atom */
+#define BadCursor 6 /* parameter not a Cursor */
+#define BadFont 7 /* parameter not a Font */
+#define BadMatch 8 /* parameter mismatch */
+#define BadDrawable 9 /* parameter not a Pixmap or Window */
+#define BadAccess 10 /* depending on context:
+ - key/button already grabbed
+ - attempt to free an illegal
+ cmap entry
+ - attempt to store into a read-only
+ color map entry.
+ - attempt to modify the access control
+ list from other than the local host.
+ */
+#define BadAlloc 11 /* insufficient resources */
+#define BadColor 12 /* no such colormap */
+#define BadGC 13 /* parameter not a GC */
+#define BadIDChoice 14 /* choice not in range or already used */
+#define BadName 15 /* font or color name doesn't exist */
+#define BadLength 16 /* Request length incorrect */
+#define BadImplementation 17 /* server is defective */
+
+#define FirstExtensionError 128
+#define LastExtensionError 255
+
+/*****************************************************************
+ * WINDOW DEFINITIONS
+ *****************************************************************/
+
+/* Window classes used by CreateWindow */
+/* Note that CopyFromParent is already defined as 0 above */
+
+#define InputOutput 1
+#define InputOnly 2
+
+/* Window attributes for CreateWindow and ChangeWindowAttributes */
+
+#define CWBackPixmap (1L<<0)
+#define CWBackPixel (1L<<1)
+#define CWBorderPixmap (1L<<2)
+#define CWBorderPixel (1L<<3)
+#define CWBitGravity (1L<<4)
+#define CWWinGravity (1L<<5)
+#define CWBackingStore (1L<<6)
+#define CWBackingPlanes (1L<<7)
+#define CWBackingPixel (1L<<8)
+#define CWOverrideRedirect (1L<<9)
+#define CWSaveUnder (1L<<10)
+#define CWEventMask (1L<<11)
+#define CWDontPropagate (1L<<12)
+#define CWColormap (1L<<13)
+#define CWCursor (1L<<14)
+
+/* ConfigureWindow structure */
+
+#define CWX (1<<0)
+#define CWY (1<<1)
+#define CWWidth (1<<2)
+#define CWHeight (1<<3)
+#define CWBorderWidth (1<<4)
+#define CWSibling (1<<5)
+#define CWStackMode (1<<6)
+
+
+/* Bit Gravity */
+
+#define ForgetGravity 0
+#define NorthWestGravity 1
+#define NorthGravity 2
+#define NorthEastGravity 3
+#define WestGravity 4
+#define CenterGravity 5
+#define EastGravity 6
+#define SouthWestGravity 7
+#define SouthGravity 8
+#define SouthEastGravity 9
+#define StaticGravity 10
+
+/* Window gravity + bit gravity above */
+
+#define UnmapGravity 0
+
+/* Used in CreateWindow for backing-store hint */
+
+#define NotUseful 0
+#define WhenMapped 1
+#define Always 2
+
+/* Used in GetWindowAttributes reply */
+
+#define IsUnmapped 0
+#define IsUnviewable 1
+#define IsViewable 2
+
+/* Used in ChangeSaveSet */
+
+#define SetModeInsert 0
+#define SetModeDelete 1
+
+/* Used in ChangeCloseDownMode */
+
+#define DestroyAll 0
+#define RetainPermanent 1
+#define RetainTemporary 2
+
+/* Window stacking method (in configureWindow) */
+
+#define Above 0
+#define Below 1
+#define TopIf 2
+#define BottomIf 3
+#define Opposite 4
+
+/* Circulation direction */
+
+#define RaiseLowest 0
+#define LowerHighest 1
+
+/* Property modes */
+
+#define PropModeReplace 0
+#define PropModePrepend 1
+#define PropModeAppend 2
+
+/*****************************************************************
+ * GRAPHICS DEFINITIONS
+ *****************************************************************/
+
+/* graphics functions, as in GC.alu */
+
+#define GXclear 0x0 /* 0 */
+#define GXand 0x1 /* src AND dst */
+#define GXandReverse 0x2 /* src AND NOT dst */
+#define GXcopy 0x3 /* src */
+#define GXandInverted 0x4 /* NOT src AND dst */
+#define GXnoop 0x5 /* dst */
+#define GXxor 0x6 /* src XOR dst */
+#define GXor 0x7 /* src OR dst */
+#define GXnor 0x8 /* NOT src AND NOT dst */
+#define GXequiv 0x9 /* NOT src XOR dst */
+#define GXinvert 0xa /* NOT dst */
+#define GXorReverse 0xb /* src OR NOT dst */
+#define GXcopyInverted 0xc /* NOT src */
+#define GXorInverted 0xd /* NOT src OR dst */
+#define GXnand 0xe /* NOT src OR NOT dst */
+#define GXset 0xf /* 1 */
+
+/* LineStyle */
+
+#define LineSolid 0
+#define LineOnOffDash 1
+#define LineDoubleDash 2
+
+/* capStyle */
+
+#define CapNotLast 0
+#define CapButt 1
+#define CapRound 2
+#define CapProjecting 3
+
+/* joinStyle */
+
+#define JoinMiter 0
+#define JoinRound 1
+#define JoinBevel 2
+
+/* fillStyle */
+
+#define FillSolid 0
+#define FillTiled 1
+#define FillStippled 2
+#define FillOpaqueStippled 3
+
+/* fillRule */
+
+#define EvenOddRule 0
+#define WindingRule 1
+
+/* subwindow mode */
+
+#define ClipByChildren 0
+#define IncludeInferiors 1
+
+/* SetClipRectangles ordering */
+
+#define Unsorted 0
+#define YSorted 1
+#define YXSorted 2
+#define YXBanded 3
+
+/* CoordinateMode for drawing routines */
+
+#define CoordModeOrigin 0 /* relative to the origin */
+#define CoordModePrevious 1 /* relative to previous point */
+
+/* Polygon shapes */
+
+#define Complex 0 /* paths may intersect */
+#define Nonconvex 1 /* no paths intersect, but not convex */
+#define Convex 2 /* wholly convex */
+
+/* Arc modes for PolyFillArc */
+
+#define ArcChord 0 /* join endpoints of arc */
+#define ArcPieSlice 1 /* join endpoints to center of arc */
+
+/* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into
+ GC.stateChanges */
+
+#define GCFunction (1L<<0)
+#define GCPlaneMask (1L<<1)
+#define GCForeground (1L<<2)
+#define GCBackground (1L<<3)
+#define GCLineWidth (1L<<4)
+#define GCLineStyle (1L<<5)
+#define GCCapStyle (1L<<6)
+#define GCJoinStyle (1L<<7)
+#define GCFillStyle (1L<<8)
+#define GCFillRule (1L<<9)
+#define GCTile (1L<<10)
+#define GCStipple (1L<<11)
+#define GCTileStipXOrigin (1L<<12)
+#define GCTileStipYOrigin (1L<<13)
+#define GCFont (1L<<14)
+#define GCSubwindowMode (1L<<15)
+#define GCGraphicsExposures (1L<<16)
+#define GCClipXOrigin (1L<<17)
+#define GCClipYOrigin (1L<<18)
+#define GCClipMask (1L<<19)
+#define GCDashOffset (1L<<20)
+#define GCDashList (1L<<21)
+#define GCArcMode (1L<<22)
+
+#define GCLastBit 22
+/*****************************************************************
+ * FONTS
+ *****************************************************************/
+
+/* used in QueryFont -- draw direction */
+
+#define FontLeftToRight 0
+#define FontRightToLeft 1
+
+#define FontChange 255
+
+/*****************************************************************
+ * IMAGING
+ *****************************************************************/
+
+/* ImageFormat -- PutImage, GetImage */
+
+#define XYBitmap 0 /* depth 1, XYFormat */
+#define XYPixmap 1 /* depth == drawable depth */
+#define ZPixmap 2 /* depth == drawable depth */
+
+/*****************************************************************
+ * COLOR MAP STUFF
+ *****************************************************************/
+
+/* For CreateColormap */
+
+#define AllocNone 0 /* create map with no entries */
+#define AllocAll 1 /* allocate entire map writeable */
+
+
+/* Flags used in StoreNamedColor, StoreColors */
+
+#define DoRed (1<<0)
+#define DoGreen (1<<1)
+#define DoBlue (1<<2)
+
+/*****************************************************************
+ * CURSOR STUFF
+ *****************************************************************/
+
+/* QueryBestSize Class */
+
+#define CursorShape 0 /* largest size that can be displayed */
+#define TileShape 1 /* size tiled fastest */
+#define StippleShape 2 /* size stippled fastest */
+
+/*****************************************************************
+ * KEYBOARD/POINTER STUFF
+ *****************************************************************/
+
+#define AutoRepeatModeOff 0
+#define AutoRepeatModeOn 1
+#define AutoRepeatModeDefault 2
+
+#define LedModeOff 0
+#define LedModeOn 1
+
+/* masks for ChangeKeyboardControl */
+
+#define KBKeyClickPercent (1L<<0)
+#define KBBellPercent (1L<<1)
+#define KBBellPitch (1L<<2)
+#define KBBellDuration (1L<<3)
+#define KBLed (1L<<4)
+#define KBLedMode (1L<<5)
+#define KBKey (1L<<6)
+#define KBAutoRepeatMode (1L<<7)
+
+#define MappingSuccess 0
+#define MappingBusy 1
+#define MappingFailed 2
+
+#define MappingModifier 0
+#define MappingKeyboard 1
+#define MappingPointer 2
+
+/*****************************************************************
+ * SCREEN SAVER STUFF
+ *****************************************************************/
+
+#define DontPreferBlanking 0
+#define PreferBlanking 1
+#define DefaultBlanking 2
+
+#define DisableScreenSaver 0
+#define DisableScreenInterval 0
+
+#define DontAllowExposures 0
+#define AllowExposures 1
+#define DefaultExposures 2
+
+/* for ForceScreenSaver */
+
+#define ScreenSaverReset 0
+#define ScreenSaverActive 1
+
+/*****************************************************************
+ * HOSTS AND CONNECTIONS
+ *****************************************************************/
+
+/* for ChangeHosts */
+
+#define HostInsert 0
+#define HostDelete 1
+
+/* for ChangeAccessControl */
+
+#define EnableAccess 1
+#define DisableAccess 0
+
+/* Display classes used in opening the connection
+ * Note that the statically allocated ones are even numbered and the
+ * dynamically changeable ones are odd numbered */
+
+#define StaticGray 0
+#define GrayScale 1
+#define StaticColor 2
+#define PseudoColor 3
+#define TrueColor 4
+#define DirectColor 5
+
+
+/* Byte order used in imageByteOrder and bitmapBitOrder */
+
+#define LSBFirst 0
+#define MSBFirst 1
+
+#endif /* X_H */
diff --git a/thirdparty/linuxbsd_headers/X11/XF86keysym.h b/thirdparty/linuxbsd_headers/X11/XF86keysym.h
new file mode 100644
index 0000000000..c242e42f5f
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/XF86keysym.h
@@ -0,0 +1,467 @@
+/*
+ * XFree86 vendor specific keysyms.
+ *
+ * The XFree86 keysym range is 0x10080001 - 0x1008FFFF.
+ *
+ * The XF86 set of keysyms is a catch-all set of defines for keysyms found
+ * on various multimedia keyboards. Originally specific to XFree86 they have
+ * been been adopted over time and are considered a "standard" part of X
+ * keysym definitions.
+ * XFree86 never properly commented these keysyms, so we have done our
+ * best to explain the semantic meaning of these keys.
+ *
+ * XFree86 has removed their mail archives of the period, that might have
+ * shed more light on some of these definitions. Until/unless we resurrect
+ * these archives, these are from memory and usage.
+ */
+
+/*
+ * ModeLock
+ *
+ * This one is old, and not really used any more since XKB offers this
+ * functionality.
+ */
+
+#define XF86XK_ModeLock 0x1008FF01 /* Mode Switch Lock */
+
+/* Backlight controls. */
+#define XF86XK_MonBrightnessUp 0x1008FF02 /* Monitor/panel brightness */
+#define XF86XK_MonBrightnessDown 0x1008FF03 /* Monitor/panel brightness */
+#define XF86XK_KbdLightOnOff 0x1008FF04 /* Keyboards may be lit */
+#define XF86XK_KbdBrightnessUp 0x1008FF05 /* Keyboards may be lit */
+#define XF86XK_KbdBrightnessDown 0x1008FF06 /* Keyboards may be lit */
+#define XF86XK_MonBrightnessCycle 0x1008FF07 /* Monitor/panel brightness */
+
+/*
+ * Keys found on some "Internet" keyboards.
+ */
+#define XF86XK_Standby 0x1008FF10 /* System into standby mode */
+#define XF86XK_AudioLowerVolume 0x1008FF11 /* Volume control down */
+#define XF86XK_AudioMute 0x1008FF12 /* Mute sound from the system */
+#define XF86XK_AudioRaiseVolume 0x1008FF13 /* Volume control up */
+#define XF86XK_AudioPlay 0x1008FF14 /* Start playing of audio > */
+#define XF86XK_AudioStop 0x1008FF15 /* Stop playing audio */
+#define XF86XK_AudioPrev 0x1008FF16 /* Previous track */
+#define XF86XK_AudioNext 0x1008FF17 /* Next track */
+#define XF86XK_HomePage 0x1008FF18 /* Display user's home page */
+#define XF86XK_Mail 0x1008FF19 /* Invoke user's mail program */
+#define XF86XK_Start 0x1008FF1A /* Start application */
+#define XF86XK_Search 0x1008FF1B /* Search */
+#define XF86XK_AudioRecord 0x1008FF1C /* Record audio application */
+
+/* These are sometimes found on PDA's (e.g. Palm, PocketPC or elsewhere) */
+#define XF86XK_Calculator 0x1008FF1D /* Invoke calculator program */
+#define XF86XK_Memo 0x1008FF1E /* Invoke Memo taking program */
+#define XF86XK_ToDoList 0x1008FF1F /* Invoke To Do List program */
+#define XF86XK_Calendar 0x1008FF20 /* Invoke Calendar program */
+#define XF86XK_PowerDown 0x1008FF21 /* Deep sleep the system */
+#define XF86XK_ContrastAdjust 0x1008FF22 /* Adjust screen contrast */
+#define XF86XK_RockerUp 0x1008FF23 /* Rocker switches exist up */
+#define XF86XK_RockerDown 0x1008FF24 /* and down */
+#define XF86XK_RockerEnter 0x1008FF25 /* and let you press them */
+
+/* Some more "Internet" keyboard symbols */
+#define XF86XK_Back 0x1008FF26 /* Like back on a browser */
+#define XF86XK_Forward 0x1008FF27 /* Like forward on a browser */
+#define XF86XK_Stop 0x1008FF28 /* Stop current operation */
+#define XF86XK_Refresh 0x1008FF29 /* Refresh the page */
+#define XF86XK_PowerOff 0x1008FF2A /* Power off system entirely */
+#define XF86XK_WakeUp 0x1008FF2B /* Wake up system from sleep */
+#define XF86XK_Eject 0x1008FF2C /* Eject device (e.g. DVD) */
+#define XF86XK_ScreenSaver 0x1008FF2D /* Invoke screensaver */
+#define XF86XK_WWW 0x1008FF2E /* Invoke web browser */
+#define XF86XK_Sleep 0x1008FF2F /* Put system to sleep */
+#define XF86XK_Favorites 0x1008FF30 /* Show favorite locations */
+#define XF86XK_AudioPause 0x1008FF31 /* Pause audio playing */
+#define XF86XK_AudioMedia 0x1008FF32 /* Launch media collection app */
+#define XF86XK_MyComputer 0x1008FF33 /* Display "My Computer" window */
+#define XF86XK_VendorHome 0x1008FF34 /* Display vendor home web site */
+#define XF86XK_LightBulb 0x1008FF35 /* Light bulb keys exist */
+#define XF86XK_Shop 0x1008FF36 /* Display shopping web site */
+#define XF86XK_History 0x1008FF37 /* Show history of web surfing */
+#define XF86XK_OpenURL 0x1008FF38 /* Open selected URL */
+#define XF86XK_AddFavorite 0x1008FF39 /* Add URL to favorites list */
+#define XF86XK_HotLinks 0x1008FF3A /* Show "hot" links */
+#define XF86XK_BrightnessAdjust 0x1008FF3B /* Invoke brightness adj. UI */
+#define XF86XK_Finance 0x1008FF3C /* Display financial site */
+#define XF86XK_Community 0x1008FF3D /* Display user's community */
+#define XF86XK_AudioRewind 0x1008FF3E /* "rewind" audio track */
+#define XF86XK_BackForward 0x1008FF3F /* ??? */
+#define XF86XK_Launch0 0x1008FF40 /* Launch Application */
+#define XF86XK_Launch1 0x1008FF41 /* Launch Application */
+#define XF86XK_Launch2 0x1008FF42 /* Launch Application */
+#define XF86XK_Launch3 0x1008FF43 /* Launch Application */
+#define XF86XK_Launch4 0x1008FF44 /* Launch Application */
+#define XF86XK_Launch5 0x1008FF45 /* Launch Application */
+#define XF86XK_Launch6 0x1008FF46 /* Launch Application */
+#define XF86XK_Launch7 0x1008FF47 /* Launch Application */
+#define XF86XK_Launch8 0x1008FF48 /* Launch Application */
+#define XF86XK_Launch9 0x1008FF49 /* Launch Application */
+#define XF86XK_LaunchA 0x1008FF4A /* Launch Application */
+#define XF86XK_LaunchB 0x1008FF4B /* Launch Application */
+#define XF86XK_LaunchC 0x1008FF4C /* Launch Application */
+#define XF86XK_LaunchD 0x1008FF4D /* Launch Application */
+#define XF86XK_LaunchE 0x1008FF4E /* Launch Application */
+#define XF86XK_LaunchF 0x1008FF4F /* Launch Application */
+
+#define XF86XK_ApplicationLeft 0x1008FF50 /* switch to application, left */
+#define XF86XK_ApplicationRight 0x1008FF51 /* switch to application, right*/
+#define XF86XK_Book 0x1008FF52 /* Launch bookreader */
+#define XF86XK_CD 0x1008FF53 /* Launch CD/DVD player */
+#define XF86XK_Calculater 0x1008FF54 /* Launch Calculater */
+#define XF86XK_Clear 0x1008FF55 /* Clear window, screen */
+#define XF86XK_Close 0x1008FF56 /* Close window */
+#define XF86XK_Copy 0x1008FF57 /* Copy selection */
+#define XF86XK_Cut 0x1008FF58 /* Cut selection */
+#define XF86XK_Display 0x1008FF59 /* Output switch key */
+#define XF86XK_DOS 0x1008FF5A /* Launch DOS (emulation) */
+#define XF86XK_Documents 0x1008FF5B /* Open documents window */
+#define XF86XK_Excel 0x1008FF5C /* Launch spread sheet */
+#define XF86XK_Explorer 0x1008FF5D /* Launch file explorer */
+#define XF86XK_Game 0x1008FF5E /* Launch game */
+#define XF86XK_Go 0x1008FF5F /* Go to URL */
+#define XF86XK_iTouch 0x1008FF60 /* Logitech iTouch- don't use */
+#define XF86XK_LogOff 0x1008FF61 /* Log off system */
+#define XF86XK_Market 0x1008FF62 /* ?? */
+#define XF86XK_Meeting 0x1008FF63 /* enter meeting in calendar */
+#define XF86XK_MenuKB 0x1008FF65 /* distinguish keyboard from PB */
+#define XF86XK_MenuPB 0x1008FF66 /* distinguish PB from keyboard */
+#define XF86XK_MySites 0x1008FF67 /* Favourites */
+#define XF86XK_New 0x1008FF68 /* New (folder, document... */
+#define XF86XK_News 0x1008FF69 /* News */
+#define XF86XK_OfficeHome 0x1008FF6A /* Office home (old Staroffice)*/
+#define XF86XK_Open 0x1008FF6B /* Open */
+#define XF86XK_Option 0x1008FF6C /* ?? */
+#define XF86XK_Paste 0x1008FF6D /* Paste */
+#define XF86XK_Phone 0x1008FF6E /* Launch phone; dial number */
+#define XF86XK_Q 0x1008FF70 /* Compaq's Q - don't use */
+#define XF86XK_Reply 0x1008FF72 /* Reply e.g., mail */
+#define XF86XK_Reload 0x1008FF73 /* Reload web page, file, etc. */
+#define XF86XK_RotateWindows 0x1008FF74 /* Rotate windows e.g. xrandr */
+#define XF86XK_RotationPB 0x1008FF75 /* don't use */
+#define XF86XK_RotationKB 0x1008FF76 /* don't use */
+#define XF86XK_Save 0x1008FF77 /* Save (file, document, state */
+#define XF86XK_ScrollUp 0x1008FF78 /* Scroll window/contents up */
+#define XF86XK_ScrollDown 0x1008FF79 /* Scrool window/contentd down */
+#define XF86XK_ScrollClick 0x1008FF7A /* Use XKB mousekeys instead */
+#define XF86XK_Send 0x1008FF7B /* Send mail, file, object */
+#define XF86XK_Spell 0x1008FF7C /* Spell checker */
+#define XF86XK_SplitScreen 0x1008FF7D /* Split window or screen */
+#define XF86XK_Support 0x1008FF7E /* Get support (??) */
+#define XF86XK_TaskPane 0x1008FF7F /* Show tasks */
+#define XF86XK_Terminal 0x1008FF80 /* Launch terminal emulator */
+#define XF86XK_Tools 0x1008FF81 /* toolbox of desktop/app. */
+#define XF86XK_Travel 0x1008FF82 /* ?? */
+#define XF86XK_UserPB 0x1008FF84 /* ?? */
+#define XF86XK_User1KB 0x1008FF85 /* ?? */
+#define XF86XK_User2KB 0x1008FF86 /* ?? */
+#define XF86XK_Video 0x1008FF87 /* Launch video player */
+#define XF86XK_WheelButton 0x1008FF88 /* button from a mouse wheel */
+#define XF86XK_Word 0x1008FF89 /* Launch word processor */
+#define XF86XK_Xfer 0x1008FF8A
+#define XF86XK_ZoomIn 0x1008FF8B /* zoom in view, map, etc. */
+#define XF86XK_ZoomOut 0x1008FF8C /* zoom out view, map, etc. */
+
+#define XF86XK_Away 0x1008FF8D /* mark yourself as away */
+#define XF86XK_Messenger 0x1008FF8E /* as in instant messaging */
+#define XF86XK_WebCam 0x1008FF8F /* Launch web camera app. */
+#define XF86XK_MailForward 0x1008FF90 /* Forward in mail */
+#define XF86XK_Pictures 0x1008FF91 /* Show pictures */
+#define XF86XK_Music 0x1008FF92 /* Launch music application */
+
+#define XF86XK_Battery 0x1008FF93 /* Display battery information */
+#define XF86XK_Bluetooth 0x1008FF94 /* Enable/disable Bluetooth */
+#define XF86XK_WLAN 0x1008FF95 /* Enable/disable WLAN */
+#define XF86XK_UWB 0x1008FF96 /* Enable/disable UWB */
+
+#define XF86XK_AudioForward 0x1008FF97 /* fast-forward audio track */
+#define XF86XK_AudioRepeat 0x1008FF98 /* toggle repeat mode */
+#define XF86XK_AudioRandomPlay 0x1008FF99 /* toggle shuffle mode */
+#define XF86XK_Subtitle 0x1008FF9A /* cycle through subtitle */
+#define XF86XK_AudioCycleTrack 0x1008FF9B /* cycle through audio tracks */
+#define XF86XK_CycleAngle 0x1008FF9C /* cycle through angles */
+#define XF86XK_FrameBack 0x1008FF9D /* video: go one frame back */
+#define XF86XK_FrameForward 0x1008FF9E /* video: go one frame forward */
+#define XF86XK_Time 0x1008FF9F /* display, or shows an entry for time seeking */
+#define XF86XK_Select 0x1008FFA0 /* Select button on joypads and remotes */
+#define XF86XK_View 0x1008FFA1 /* Show a view options/properties */
+#define XF86XK_TopMenu 0x1008FFA2 /* Go to a top-level menu in a video */
+
+#define XF86XK_Red 0x1008FFA3 /* Red button */
+#define XF86XK_Green 0x1008FFA4 /* Green button */
+#define XF86XK_Yellow 0x1008FFA5 /* Yellow button */
+#define XF86XK_Blue 0x1008FFA6 /* Blue button */
+
+#define XF86XK_Suspend 0x1008FFA7 /* Sleep to RAM */
+#define XF86XK_Hibernate 0x1008FFA8 /* Sleep to disk */
+#define XF86XK_TouchpadToggle 0x1008FFA9 /* Toggle between touchpad/trackstick */
+#define XF86XK_TouchpadOn 0x1008FFB0 /* The touchpad got switched on */
+#define XF86XK_TouchpadOff 0x1008FFB1 /* The touchpad got switched off */
+
+#define XF86XK_AudioMicMute 0x1008FFB2 /* Mute the Mic from the system */
+
+#define XF86XK_Keyboard 0x1008FFB3 /* User defined keyboard related action */
+
+#define XF86XK_WWAN 0x1008FFB4 /* Toggle WWAN (LTE, UMTS, etc.) radio */
+#define XF86XK_RFKill 0x1008FFB5 /* Toggle radios on/off */
+
+#define XF86XK_AudioPreset 0x1008FFB6 /* Select equalizer preset, e.g. theatre-mode */
+
+#define XF86XK_RotationLockToggle 0x1008FFB7 /* Toggle screen rotation lock on/off */
+
+#define XF86XK_FullScreen 0x1008FFB8 /* Toggle fullscreen */
+
+/* Keys for special action keys (hot keys) */
+/* Virtual terminals on some operating systems */
+#define XF86XK_Switch_VT_1 0x1008FE01
+#define XF86XK_Switch_VT_2 0x1008FE02
+#define XF86XK_Switch_VT_3 0x1008FE03
+#define XF86XK_Switch_VT_4 0x1008FE04
+#define XF86XK_Switch_VT_5 0x1008FE05
+#define XF86XK_Switch_VT_6 0x1008FE06
+#define XF86XK_Switch_VT_7 0x1008FE07
+#define XF86XK_Switch_VT_8 0x1008FE08
+#define XF86XK_Switch_VT_9 0x1008FE09
+#define XF86XK_Switch_VT_10 0x1008FE0A
+#define XF86XK_Switch_VT_11 0x1008FE0B
+#define XF86XK_Switch_VT_12 0x1008FE0C
+
+#define XF86XK_Ungrab 0x1008FE20 /* force ungrab */
+#define XF86XK_ClearGrab 0x1008FE21 /* kill application with grab */
+#define XF86XK_Next_VMode 0x1008FE22 /* next video mode available */
+#define XF86XK_Prev_VMode 0x1008FE23 /* prev. video mode available */
+#define XF86XK_LogWindowTree 0x1008FE24 /* print window tree to log */
+#define XF86XK_LogGrabInfo 0x1008FE25 /* print all active grabs to log */
+
+
+/*
+ * Reserved range for evdev symbols: 0x10081000-0x10081FFF
+ *
+ * Key syms within this range must match the Linux kernel
+ * input-event-codes.h file in the format:
+ * XF86XK_CamelCaseKernelName _EVDEVK(kernel value)
+ * For example, the kernel
+ * #define KEY_MACRO_RECORD_START 0x2b0
+ * effectively ends up as:
+ * #define XF86XK_MacroRecordStart 0x100812b0
+ *
+ * For historical reasons, some keysyms within the reserved range will be
+ * missing, most notably all "normal" keys that are mapped through default
+ * XKB layouts (e.g. KEY_Q).
+ *
+ * CamelCasing is done with a human control as last authority, e.g. see VOD
+ * instead of Vod for the Video on Demand key.
+ *
+ * The format for #defines is strict:
+ *
+ * #define XF86XK_FOO<tab...>_EVDEVK(0xABC)<tab><tab> |* kver KEY_FOO *|
+ *
+ * Where
+ * - alignment by tabs
+ * - the _EVDEVK macro must be used
+ * - the hex code must be in uppercase hex
+ * - the kernel version (kver) is in the form v5.10
+ * - kver and key name are within a slash-star comment (a pipe is used in
+ * this example for technical reasons)
+ * These #defines are parsed by scripts. Do not stray from the given format.
+ *
+ * Where the evdev keycode is mapped to a different symbol, please add a
+ * comment line starting with Use: but otherwise the same format, e.g.
+ * Use: XF86XK_RotationLockToggle _EVDEVK(0x231) v4.16 KEY_ROTATE_LOCK_TOGGLE
+ *
+ */
+#define _EVDEVK(_v) (0x10081000 + _v)
+/* Use: XF86XK_Eject _EVDEVK(0x0A2) KEY_EJECTCLOSECD */
+/* Use: XF86XK_New _EVDEVK(0x0B5) v2.6.14 KEY_NEW */
+/* Use: XK_Redo _EVDEVK(0x0B6) v2.6.14 KEY_REDO */
+/* KEY_DASHBOARD has been mapped to LaunchB in xkeyboard-config since 2011 */
+/* Use: XF86XK_LaunchB _EVDEVK(0x0CC) v2.6.28 KEY_DASHBOARD */
+/* Use: XF86XK_Display _EVDEVK(0x0E3) v2.6.12 KEY_SWITCHVIDEOMODE */
+/* Use: XF86XK_KbdLightOnOff _EVDEVK(0x0E4) v2.6.12 KEY_KBDILLUMTOGGLE */
+/* Use: XF86XK_KbdBrightnessDown _EVDEVK(0x0E5) v2.6.12 KEY_KBDILLUMDOWN */
+/* Use: XF86XK_KbdBrightnessUp _EVDEVK(0x0E6) v2.6.12 KEY_KBDILLUMUP */
+/* Use: XF86XK_Send _EVDEVK(0x0E7) v2.6.14 KEY_SEND */
+/* Use: XF86XK_Reply _EVDEVK(0x0E8) v2.6.14 KEY_REPLY */
+/* Use: XF86XK_MailForward _EVDEVK(0x0E9) v2.6.14 KEY_FORWARDMAIL */
+/* Use: XF86XK_Save _EVDEVK(0x0EA) v2.6.14 KEY_SAVE */
+/* Use: XF86XK_Documents _EVDEVK(0x0EB) v2.6.14 KEY_DOCUMENTS */
+/* Use: XF86XK_Battery _EVDEVK(0x0EC) v2.6.17 KEY_BATTERY */
+/* Use: XF86XK_Bluetooth _EVDEVK(0x0ED) v2.6.19 KEY_BLUETOOTH */
+/* Use: XF86XK_WLAN _EVDEVK(0x0EE) v2.6.19 KEY_WLAN */
+/* Use: XF86XK_UWB _EVDEVK(0x0EF) v2.6.24 KEY_UWB */
+/* Use: XF86XK_Next_VMode _EVDEVK(0x0F1) v2.6.23 KEY_VIDEO_NEXT */
+/* Use: XF86XK_Prev_VMode _EVDEVK(0x0F2) v2.6.23 KEY_VIDEO_PREV */
+/* Use: XF86XK_MonBrightnessCycle _EVDEVK(0x0F3) v2.6.23 KEY_BRIGHTNESS_CYCLE */
+#define XF86XK_BrightnessAuto _EVDEVK(0x0F4) /* v3.16 KEY_BRIGHTNESS_AUTO */
+#define XF86XK_DisplayOff _EVDEVK(0x0F5) /* v2.6.23 KEY_DISPLAY_OFF */
+/* Use: XF86XK_WWAN _EVDEVK(0x0F6) v3.13 KEY_WWAN */
+/* Use: XF86XK_RFKill _EVDEVK(0x0F7) v2.6.33 KEY_RFKILL */
+/* Use: XF86XK_AudioMicMute _EVDEVK(0x0F8) v3.1 KEY_MICMUTE */
+#define XF86XK_Info _EVDEVK(0x166) /* KEY_INFO */
+/* Use: XF86XK_CycleAngle _EVDEVK(0x173) KEY_ANGLE */
+/* Use: XF86XK_FullScreen _EVDEVK(0x174) v5.1 KEY_FULL_SCREEN */
+#define XF86XK_AspectRatio _EVDEVK(0x177) /* v5.1 KEY_ASPECT_RATIO */
+#define XF86XK_DVD _EVDEVK(0x185) /* KEY_DVD */
+#define XF86XK_Audio _EVDEVK(0x188) /* KEY_AUDIO */
+/* Use: XF86XK_Video _EVDEVK(0x189) KEY_VIDEO */
+/* Use: XF86XK_Calendar _EVDEVK(0x18D) KEY_CALENDAR */
+#define XF86XK_ChannelUp _EVDEVK(0x192) /* KEY_CHANNELUP */
+#define XF86XK_ChannelDown _EVDEVK(0x193) /* KEY_CHANNELDOWN */
+/* Use: XF86XK_AudioRandomPlay _EVDEVK(0x19A) KEY_SHUFFLE */
+#define XF86XK_Break _EVDEVK(0x19B) /* KEY_BREAK */
+#define XF86XK_VideoPhone _EVDEVK(0x1A0) /* v2.6.20 KEY_VIDEOPHONE */
+/* Use: XF86XK_Game _EVDEVK(0x1A1) v2.6.20 KEY_GAMES */
+/* Use: XF86XK_ZoomIn _EVDEVK(0x1A2) v2.6.20 KEY_ZOOMIN */
+/* Use: XF86XK_ZoomOut _EVDEVK(0x1A3) v2.6.20 KEY_ZOOMOUT */
+#define XF86XK_ZoomReset _EVDEVK(0x1A4) /* v2.6.20 KEY_ZOOMRESET */
+/* Use: XF86XK_Word _EVDEVK(0x1A5) v2.6.20 KEY_WORDPROCESSOR */
+#define XF86XK_Editor _EVDEVK(0x1A6) /* v2.6.20 KEY_EDITOR */
+/* Use: XF86XK_Excel _EVDEVK(0x1A7) v2.6.20 KEY_SPREADSHEET */
+#define XF86XK_GraphicsEditor _EVDEVK(0x1A8) /* v2.6.20 KEY_GRAPHICSEDITOR */
+#define XF86XK_Presentation _EVDEVK(0x1A9) /* v2.6.20 KEY_PRESENTATION */
+#define XF86XK_Database _EVDEVK(0x1AA) /* v2.6.20 KEY_DATABASE */
+/* Use: XF86XK_News _EVDEVK(0x1AB) v2.6.20 KEY_NEWS */
+#define XF86XK_Voicemail _EVDEVK(0x1AC) /* v2.6.20 KEY_VOICEMAIL */
+#define XF86XK_Addressbook _EVDEVK(0x1AD) /* v2.6.20 KEY_ADDRESSBOOK */
+/* Use: XF86XK_Messenger _EVDEVK(0x1AE) v2.6.20 KEY_MESSENGER */
+#define XF86XK_DisplayToggle _EVDEVK(0x1AF) /* v2.6.20 KEY_DISPLAYTOGGLE */
+#define XF86XK_SpellCheck _EVDEVK(0x1B0) /* v2.6.24 KEY_SPELLCHECK */
+/* Use: XF86XK_LogOff _EVDEVK(0x1B1) v2.6.24 KEY_LOGOFF */
+/* Use: XK_dollar _EVDEVK(0x1B2) v2.6.24 KEY_DOLLAR */
+/* Use: XK_EuroSign _EVDEVK(0x1B3) v2.6.24 KEY_EURO */
+/* Use: XF86XK_FrameBack _EVDEVK(0x1B4) v2.6.24 KEY_FRAMEBACK */
+/* Use: XF86XK_FrameForward _EVDEVK(0x1B5) v2.6.24 KEY_FRAMEFORWARD */
+#define XF86XK_ContextMenu _EVDEVK(0x1B6) /* v2.6.24 KEY_CONTEXT_MENU */
+#define XF86XK_MediaRepeat _EVDEVK(0x1B7) /* v2.6.26 KEY_MEDIA_REPEAT */
+#define XF86XK_10ChannelsUp _EVDEVK(0x1B8) /* v2.6.38 KEY_10CHANNELSUP */
+#define XF86XK_10ChannelsDown _EVDEVK(0x1B9) /* v2.6.38 KEY_10CHANNELSDOWN */
+#define XF86XK_Images _EVDEVK(0x1BA) /* v2.6.39 KEY_IMAGES */
+#define XF86XK_NotificationCenter _EVDEVK(0x1BC) /* v5.10 KEY_NOTIFICATION_CENTER */
+#define XF86XK_PickupPhone _EVDEVK(0x1BD) /* v5.10 KEY_PICKUP_PHONE */
+#define XF86XK_HangupPhone _EVDEVK(0x1BE) /* v5.10 KEY_HANGUP_PHONE */
+#define XF86XK_Fn _EVDEVK(0x1D0) /* KEY_FN */
+#define XF86XK_Fn_Esc _EVDEVK(0x1D1) /* KEY_FN_ESC */
+#define XF86XK_FnRightShift _EVDEVK(0x1E5) /* v5.10 KEY_FN_RIGHT_SHIFT */
+/* Use: XK_braille_dot_1 _EVDEVK(0x1F1) v2.6.17 KEY_BRL_DOT1 */
+/* Use: XK_braille_dot_2 _EVDEVK(0x1F2) v2.6.17 KEY_BRL_DOT2 */
+/* Use: XK_braille_dot_3 _EVDEVK(0x1F3) v2.6.17 KEY_BRL_DOT3 */
+/* Use: XK_braille_dot_4 _EVDEVK(0x1F4) v2.6.17 KEY_BRL_DOT4 */
+/* Use: XK_braille_dot_5 _EVDEVK(0x1F5) v2.6.17 KEY_BRL_DOT5 */
+/* Use: XK_braille_dot_6 _EVDEVK(0x1F6) v2.6.17 KEY_BRL_DOT6 */
+/* Use: XK_braille_dot_7 _EVDEVK(0x1F7) v2.6.17 KEY_BRL_DOT7 */
+/* Use: XK_braille_dot_8 _EVDEVK(0x1F8) v2.6.17 KEY_BRL_DOT8 */
+/* Use: XK_braille_dot_9 _EVDEVK(0x1F9) v2.6.23 KEY_BRL_DOT9 */
+/* Use: XK_braille_dot_1 _EVDEVK(0x1FA) v2.6.23 KEY_BRL_DOT10 */
+#define XF86XK_Numeric0 _EVDEVK(0x200) /* v2.6.28 KEY_NUMERIC_0 */
+#define XF86XK_Numeric1 _EVDEVK(0x201) /* v2.6.28 KEY_NUMERIC_1 */
+#define XF86XK_Numeric2 _EVDEVK(0x202) /* v2.6.28 KEY_NUMERIC_2 */
+#define XF86XK_Numeric3 _EVDEVK(0x203) /* v2.6.28 KEY_NUMERIC_3 */
+#define XF86XK_Numeric4 _EVDEVK(0x204) /* v2.6.28 KEY_NUMERIC_4 */
+#define XF86XK_Numeric5 _EVDEVK(0x205) /* v2.6.28 KEY_NUMERIC_5 */
+#define XF86XK_Numeric6 _EVDEVK(0x206) /* v2.6.28 KEY_NUMERIC_6 */
+#define XF86XK_Numeric7 _EVDEVK(0x207) /* v2.6.28 KEY_NUMERIC_7 */
+#define XF86XK_Numeric8 _EVDEVK(0x208) /* v2.6.28 KEY_NUMERIC_8 */
+#define XF86XK_Numeric9 _EVDEVK(0x209) /* v2.6.28 KEY_NUMERIC_9 */
+#define XF86XK_NumericStar _EVDEVK(0x20A) /* v2.6.28 KEY_NUMERIC_STAR */
+#define XF86XK_NumericPound _EVDEVK(0x20B) /* v2.6.28 KEY_NUMERIC_POUND */
+#define XF86XK_NumericA _EVDEVK(0x20C) /* v4.1 KEY_NUMERIC_A */
+#define XF86XK_NumericB _EVDEVK(0x20D) /* v4.1 KEY_NUMERIC_B */
+#define XF86XK_NumericC _EVDEVK(0x20E) /* v4.1 KEY_NUMERIC_C */
+#define XF86XK_NumericD _EVDEVK(0x20F) /* v4.1 KEY_NUMERIC_D */
+#define XF86XK_CameraFocus _EVDEVK(0x210) /* v2.6.33 KEY_CAMERA_FOCUS */
+#define XF86XK_WPSButton _EVDEVK(0x211) /* v2.6.34 KEY_WPS_BUTTON */
+/* Use: XF86XK_TouchpadToggle _EVDEVK(0x212) v2.6.37 KEY_TOUCHPAD_TOGGLE */
+/* Use: XF86XK_TouchpadOn _EVDEVK(0x213) v2.6.37 KEY_TOUCHPAD_ON */
+/* Use: XF86XK_TouchpadOff _EVDEVK(0x214) v2.6.37 KEY_TOUCHPAD_OFF */
+#define XF86XK_CameraZoomIn _EVDEVK(0x215) /* v2.6.39 KEY_CAMERA_ZOOMIN */
+#define XF86XK_CameraZoomOut _EVDEVK(0x216) /* v2.6.39 KEY_CAMERA_ZOOMOUT */
+#define XF86XK_CameraUp _EVDEVK(0x217) /* v2.6.39 KEY_CAMERA_UP */
+#define XF86XK_CameraDown _EVDEVK(0x218) /* v2.6.39 KEY_CAMERA_DOWN */
+#define XF86XK_CameraLeft _EVDEVK(0x219) /* v2.6.39 KEY_CAMERA_LEFT */
+#define XF86XK_CameraRight _EVDEVK(0x21A) /* v2.6.39 KEY_CAMERA_RIGHT */
+#define XF86XK_AttendantOn _EVDEVK(0x21B) /* v3.10 KEY_ATTENDANT_ON */
+#define XF86XK_AttendantOff _EVDEVK(0x21C) /* v3.10 KEY_ATTENDANT_OFF */
+#define XF86XK_AttendantToggle _EVDEVK(0x21D) /* v3.10 KEY_ATTENDANT_TOGGLE */
+#define XF86XK_LightsToggle _EVDEVK(0x21E) /* v3.10 KEY_LIGHTS_TOGGLE */
+#define XF86XK_ALSToggle _EVDEVK(0x230) /* v3.13 KEY_ALS_TOGGLE */
+/* Use: XF86XK_RotationLockToggle _EVDEVK(0x231) v4.16 KEY_ROTATE_LOCK_TOGGLE */
+#define XF86XK_Buttonconfig _EVDEVK(0x240) /* v3.16 KEY_BUTTONCONFIG */
+#define XF86XK_Taskmanager _EVDEVK(0x241) /* v3.16 KEY_TASKMANAGER */
+#define XF86XK_Journal _EVDEVK(0x242) /* v3.16 KEY_JOURNAL */
+#define XF86XK_ControlPanel _EVDEVK(0x243) /* v3.16 KEY_CONTROLPANEL */
+#define XF86XK_AppSelect _EVDEVK(0x244) /* v3.16 KEY_APPSELECT */
+#define XF86XK_Screensaver _EVDEVK(0x245) /* v3.16 KEY_SCREENSAVER */
+#define XF86XK_VoiceCommand _EVDEVK(0x246) /* v3.16 KEY_VOICECOMMAND */
+#define XF86XK_Assistant _EVDEVK(0x247) /* v4.13 KEY_ASSISTANT */
+/* Use: XK_ISO_Next_Group _EVDEVK(0x248) v5.2 KEY_KBD_LAYOUT_NEXT */
+#define XF86XK_BrightnessMin _EVDEVK(0x250) /* v3.16 KEY_BRIGHTNESS_MIN */
+#define XF86XK_BrightnessMax _EVDEVK(0x251) /* v3.16 KEY_BRIGHTNESS_MAX */
+#define XF86XK_KbdInputAssistPrev _EVDEVK(0x260) /* v3.18 KEY_KBDINPUTASSIST_PREV */
+#define XF86XK_KbdInputAssistNext _EVDEVK(0x261) /* v3.18 KEY_KBDINPUTASSIST_NEXT */
+#define XF86XK_KbdInputAssistPrevgroup _EVDEVK(0x262) /* v3.18 KEY_KBDINPUTASSIST_PREVGROUP */
+#define XF86XK_KbdInputAssistNextgroup _EVDEVK(0x263) /* v3.18 KEY_KBDINPUTASSIST_NEXTGROUP */
+#define XF86XK_KbdInputAssistAccept _EVDEVK(0x264) /* v3.18 KEY_KBDINPUTASSIST_ACCEPT */
+#define XF86XK_KbdInputAssistCancel _EVDEVK(0x265) /* v3.18 KEY_KBDINPUTASSIST_CANCEL */
+#define XF86XK_RightUp _EVDEVK(0x266) /* v4.7 KEY_RIGHT_UP */
+#define XF86XK_RightDown _EVDEVK(0x267) /* v4.7 KEY_RIGHT_DOWN */
+#define XF86XK_LeftUp _EVDEVK(0x268) /* v4.7 KEY_LEFT_UP */
+#define XF86XK_LeftDown _EVDEVK(0x269) /* v4.7 KEY_LEFT_DOWN */
+#define XF86XK_RootMenu _EVDEVK(0x26A) /* v4.7 KEY_ROOT_MENU */
+#define XF86XK_MediaTopMenu _EVDEVK(0x26B) /* v4.7 KEY_MEDIA_TOP_MENU */
+#define XF86XK_Numeric11 _EVDEVK(0x26C) /* v4.7 KEY_NUMERIC_11 */
+#define XF86XK_Numeric12 _EVDEVK(0x26D) /* v4.7 KEY_NUMERIC_12 */
+#define XF86XK_AudioDesc _EVDEVK(0x26E) /* v4.7 KEY_AUDIO_DESC */
+#define XF86XK_3DMode _EVDEVK(0x26F) /* v4.7 KEY_3D_MODE */
+#define XF86XK_NextFavorite _EVDEVK(0x270) /* v4.7 KEY_NEXT_FAVORITE */
+#define XF86XK_StopRecord _EVDEVK(0x271) /* v4.7 KEY_STOP_RECORD */
+#define XF86XK_PauseRecord _EVDEVK(0x272) /* v4.7 KEY_PAUSE_RECORD */
+#define XF86XK_VOD _EVDEVK(0x273) /* v4.7 KEY_VOD */
+#define XF86XK_Unmute _EVDEVK(0x274) /* v4.7 KEY_UNMUTE */
+#define XF86XK_FastReverse _EVDEVK(0x275) /* v4.7 KEY_FASTREVERSE */
+#define XF86XK_SlowReverse _EVDEVK(0x276) /* v4.7 KEY_SLOWREVERSE */
+#define XF86XK_Data _EVDEVK(0x277) /* v4.7 KEY_DATA */
+#define XF86XK_OnScreenKeyboard _EVDEVK(0x278) /* v4.12 KEY_ONSCREEN_KEYBOARD */
+#define XF86XK_PrivacyScreenToggle _EVDEVK(0x279) /* v5.5 KEY_PRIVACY_SCREEN_TOGGLE */
+#define XF86XK_SelectiveScreenshot _EVDEVK(0x27A) /* v5.6 KEY_SELECTIVE_SCREENSHOT */
+#define XF86XK_Macro1 _EVDEVK(0x290) /* v5.5 KEY_MACRO1 */
+#define XF86XK_Macro2 _EVDEVK(0x291) /* v5.5 KEY_MACRO2 */
+#define XF86XK_Macro3 _EVDEVK(0x292) /* v5.5 KEY_MACRO3 */
+#define XF86XK_Macro4 _EVDEVK(0x293) /* v5.5 KEY_MACRO4 */
+#define XF86XK_Macro5 _EVDEVK(0x294) /* v5.5 KEY_MACRO5 */
+#define XF86XK_Macro6 _EVDEVK(0x295) /* v5.5 KEY_MACRO6 */
+#define XF86XK_Macro7 _EVDEVK(0x296) /* v5.5 KEY_MACRO7 */
+#define XF86XK_Macro8 _EVDEVK(0x297) /* v5.5 KEY_MACRO8 */
+#define XF86XK_Macro9 _EVDEVK(0x298) /* v5.5 KEY_MACRO9 */
+#define XF86XK_Macro10 _EVDEVK(0x299) /* v5.5 KEY_MACRO10 */
+#define XF86XK_Macro11 _EVDEVK(0x29A) /* v5.5 KEY_MACRO11 */
+#define XF86XK_Macro12 _EVDEVK(0x29B) /* v5.5 KEY_MACRO12 */
+#define XF86XK_Macro13 _EVDEVK(0x29C) /* v5.5 KEY_MACRO13 */
+#define XF86XK_Macro14 _EVDEVK(0x29D) /* v5.5 KEY_MACRO14 */
+#define XF86XK_Macro15 _EVDEVK(0x29E) /* v5.5 KEY_MACRO15 */
+#define XF86XK_Macro16 _EVDEVK(0x29F) /* v5.5 KEY_MACRO16 */
+#define XF86XK_Macro17 _EVDEVK(0x2A0) /* v5.5 KEY_MACRO17 */
+#define XF86XK_Macro18 _EVDEVK(0x2A1) /* v5.5 KEY_MACRO18 */
+#define XF86XK_Macro19 _EVDEVK(0x2A2) /* v5.5 KEY_MACRO19 */
+#define XF86XK_Macro20 _EVDEVK(0x2A3) /* v5.5 KEY_MACRO20 */
+#define XF86XK_Macro21 _EVDEVK(0x2A4) /* v5.5 KEY_MACRO21 */
+#define XF86XK_Macro22 _EVDEVK(0x2A5) /* v5.5 KEY_MACRO22 */
+#define XF86XK_Macro23 _EVDEVK(0x2A6) /* v5.5 KEY_MACRO23 */
+#define XF86XK_Macro24 _EVDEVK(0x2A7) /* v5.5 KEY_MACRO24 */
+#define XF86XK_Macro25 _EVDEVK(0x2A8) /* v5.5 KEY_MACRO25 */
+#define XF86XK_Macro26 _EVDEVK(0x2A9) /* v5.5 KEY_MACRO26 */
+#define XF86XK_Macro27 _EVDEVK(0x2AA) /* v5.5 KEY_MACRO27 */
+#define XF86XK_Macro28 _EVDEVK(0x2AB) /* v5.5 KEY_MACRO28 */
+#define XF86XK_Macro29 _EVDEVK(0x2AC) /* v5.5 KEY_MACRO29 */
+#define XF86XK_Macro30 _EVDEVK(0x2AD) /* v5.5 KEY_MACRO30 */
+#define XF86XK_MacroRecordStart _EVDEVK(0x2B0) /* v5.5 KEY_MACRO_RECORD_START */
+#define XF86XK_MacroRecordStop _EVDEVK(0x2B1) /* v5.5 KEY_MACRO_RECORD_STOP */
+#define XF86XK_MacroPresetCycle _EVDEVK(0x2B2) /* v5.5 KEY_MACRO_PRESET_CYCLE */
+#define XF86XK_MacroPreset1 _EVDEVK(0x2B3) /* v5.5 KEY_MACRO_PRESET1 */
+#define XF86XK_MacroPreset2 _EVDEVK(0x2B4) /* v5.5 KEY_MACRO_PRESET2 */
+#define XF86XK_MacroPreset3 _EVDEVK(0x2B5) /* v5.5 KEY_MACRO_PRESET3 */
+#define XF86XK_KbdLcdMenu1 _EVDEVK(0x2B8) /* v5.5 KEY_KBD_LCD_MENU1 */
+#define XF86XK_KbdLcdMenu2 _EVDEVK(0x2B9) /* v5.5 KEY_KBD_LCD_MENU2 */
+#define XF86XK_KbdLcdMenu3 _EVDEVK(0x2BA) /* v5.5 KEY_KBD_LCD_MENU3 */
+#define XF86XK_KbdLcdMenu4 _EVDEVK(0x2BB) /* v5.5 KEY_KBD_LCD_MENU4 */
+#define XF86XK_KbdLcdMenu5 _EVDEVK(0x2BC) /* v5.5 KEY_KBD_LCD_MENU5 */
+#undef _EVDEVK
diff --git a/thirdparty/linuxbsd_headers/X11/XKBlib.h b/thirdparty/linuxbsd_headers/X11/XKBlib.h
new file mode 100644
index 0000000000..dd532b2241
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/XKBlib.h
@@ -0,0 +1,1149 @@
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef _X11_XKBLIB_H_
+#define _X11_XKBLIB_H_
+
+#include <X11/Xlib.h>
+#include <X11/extensions/XKBstr.h>
+
+typedef struct _XkbAnyEvent {
+ int type; /* XkbAnyEvent */
+ unsigned long serial; /* # of last req processed by server */
+ Bool send_event; /* is this from a SendEvent request? */
+ Display * display; /* Display the event was read from */
+ Time time; /* milliseconds */
+ int xkb_type; /* XKB event minor code */
+ unsigned int device; /* device ID */
+} XkbAnyEvent;
+
+typedef struct _XkbNewKeyboardNotify {
+ int type; /* XkbAnyEvent */
+ unsigned long serial; /* of last req processed by server */
+ Bool send_event; /* is this from a SendEvent request? */
+ Display * display; /* Display the event was read from */
+ Time time; /* milliseconds */
+ int xkb_type; /* XkbNewKeyboardNotify */
+ int device; /* device ID */
+ int old_device; /* device ID of previous keyboard */
+ int min_key_code; /* minimum key code */
+ int max_key_code; /* maximum key code */
+ int old_min_key_code;/* min key code of previous kbd */
+ int old_max_key_code;/* max key code of previous kbd */
+ unsigned int changed; /* changed aspects of the keyboard */
+ char req_major; /* major and minor opcode of req */
+ char req_minor; /* that caused change, if applicable */
+} XkbNewKeyboardNotifyEvent;
+
+typedef struct _XkbMapNotifyEvent {
+ int type; /* XkbAnyEvent */
+ unsigned long serial; /* of last req processed by server */
+ Bool send_event; /* is this from a SendEvent request */
+ Display * display; /* Display the event was read from */
+ Time time; /* milliseconds */
+ int xkb_type; /* XkbMapNotify */
+ int device; /* device ID */
+ unsigned int changed; /* fields which have been changed */
+ unsigned int flags; /* reserved */
+ int first_type; /* first changed key type */
+ int num_types; /* number of changed key types */
+ KeyCode min_key_code;
+ KeyCode max_key_code;
+ KeyCode first_key_sym;
+ KeyCode first_key_act;
+ KeyCode first_key_behavior;
+ KeyCode first_key_explicit;
+ KeyCode first_modmap_key;
+ KeyCode first_vmodmap_key;
+ int num_key_syms;
+ int num_key_acts;
+ int num_key_behaviors;
+ int num_key_explicit;
+ int num_modmap_keys;
+ int num_vmodmap_keys;
+ unsigned int vmods; /* mask of changed virtual mods */
+} XkbMapNotifyEvent;
+
+typedef struct _XkbStateNotifyEvent {
+ int type; /* XkbAnyEvent */
+ unsigned long serial; /* # of last req processed by server */
+ Bool send_event; /* is this from a SendEvent request? */
+ Display * display; /* Display the event was read from */
+ Time time; /* milliseconds */
+ int xkb_type; /* XkbStateNotify */
+ int device; /* device ID */
+ unsigned int changed; /* mask of changed state components */
+ int group; /* keyboard group */
+ int base_group; /* base keyboard group */
+ int latched_group; /* latched keyboard group */
+ int locked_group; /* locked keyboard group */
+ unsigned int mods; /* modifier state */
+ unsigned int base_mods; /* base modifier state */
+ unsigned int latched_mods; /* latched modifiers */
+ unsigned int locked_mods; /* locked modifiers */
+ int compat_state; /* compatibility state */
+ unsigned char grab_mods; /* mods used for grabs */
+ unsigned char compat_grab_mods;/* grab mods for non-XKB clients */
+ unsigned char lookup_mods; /* mods sent to clients */
+ unsigned char compat_lookup_mods; /* mods sent to non-XKB clients */
+ int ptr_buttons; /* pointer button state */
+ KeyCode keycode; /* keycode that caused the change */
+ char event_type; /* KeyPress or KeyRelease */
+ char req_major; /* Major opcode of request */
+ char req_minor; /* Minor opcode of request */
+} XkbStateNotifyEvent;
+
+typedef struct _XkbControlsNotify {
+ int type; /* XkbAnyEvent */
+ unsigned long serial; /* of last req processed by server */
+ Bool send_event; /* is this from a SendEvent request? */
+ Display * display; /* Display the event was read from */
+ Time time; /* milliseconds */
+ int xkb_type; /* XkbControlsNotify */
+ int device; /* device ID */
+ unsigned int changed_ctrls; /* controls with changed sub-values */
+ unsigned int enabled_ctrls; /* controls currently enabled */
+ unsigned int enabled_ctrl_changes;/* controls just {en,dis}abled */
+ int num_groups; /* total groups on keyboard */
+ KeyCode keycode; /* key that caused change or 0 */
+ char event_type; /* type of event that caused change */
+ char req_major; /* if keycode==0, major and minor */
+ char req_minor; /* opcode of req that caused change */
+} XkbControlsNotifyEvent;
+
+typedef struct _XkbIndicatorNotify {
+ int type; /* XkbAnyEvent */
+ unsigned long serial; /* of last req processed by server */
+ Bool send_event; /* is this from a SendEvent request? */
+ Display * display; /* Display the event was read from */
+ Time time; /* milliseconds */
+ int xkb_type; /* XkbIndicatorNotify */
+ int device; /* device ID */
+ unsigned int changed; /* indicators with new state or map */
+ unsigned int state; /* current state of all indicators */
+} XkbIndicatorNotifyEvent;
+
+typedef struct _XkbNamesNotify {
+ int type; /* XkbAnyEvent */
+ unsigned long serial; /* of last req processed by server */
+ Bool send_event; /* is this from a SendEvent request? */
+ Display * display; /* Display the event was read from */
+ Time time; /* milliseconds */
+ int xkb_type; /* XkbNamesNotify */
+ int device; /* device ID */
+ unsigned int changed; /* names that have changed */
+ int first_type; /* first key type with new name */
+ int num_types; /* number of key types with new names */
+ int first_lvl; /* first key type new new level names */
+ int num_lvls; /* # of key types w/new level names */
+ int num_aliases; /* total number of key aliases*/
+ int num_radio_groups;/* total number of radio groups */
+ unsigned int changed_vmods; /* virtual modifiers with new names */
+ unsigned int changed_groups; /* groups with new names */
+ unsigned int changed_indicators;/* indicators with new names */
+ int first_key; /* first key with new name */
+ int num_keys; /* number of keys with new names */
+} XkbNamesNotifyEvent;
+
+typedef struct _XkbCompatMapNotify {
+ int type; /* XkbAnyEvent */
+ unsigned long serial; /* of last req processed by server */
+ Bool send_event; /* is this from a SendEvent request? */
+ Display * display; /* Display the event was read from */
+ Time time; /* milliseconds */
+ int xkb_type; /* XkbCompatMapNotify */
+ int device; /* device ID */
+ unsigned int changed_groups; /* groups with new compat maps */
+ int first_si; /* first new symbol interp */
+ int num_si; /* number of new symbol interps */
+ int num_total_si; /* total # of symbol interps */
+} XkbCompatMapNotifyEvent;
+
+typedef struct _XkbBellNotify {
+ int type; /* XkbAnyEvent */
+ unsigned long serial; /* of last req processed by server */
+ Bool send_event; /* is this from a SendEvent request? */
+ Display * display; /* Display the event was read from */
+ Time time; /* milliseconds */
+ int xkb_type; /* XkbBellNotify */
+ int device; /* device ID */
+ int percent; /* requested volume as a % of maximum */
+ int pitch; /* requested pitch in Hz */
+ int duration; /* requested duration in useconds */
+ int bell_class; /* (input extension) feedback class */
+ int bell_id; /* (input extension) ID of feedback */
+ Atom name; /* "name" of requested bell */
+ Window window; /* window associated with event */
+ Bool event_only; /* "event only" requested */
+} XkbBellNotifyEvent;
+
+typedef struct _XkbActionMessage {
+ int type; /* XkbAnyEvent */
+ unsigned long serial; /* of last req processed by server */
+ Bool send_event; /* is this from a SendEvent request? */
+ Display * display; /* Display the event was read from */
+ Time time; /* milliseconds */
+ int xkb_type; /* XkbActionMessage */
+ int device; /* device ID */
+ KeyCode keycode; /* key that generated the event */
+ Bool press; /* true if act caused by key press */
+ Bool key_event_follows;/* true if key event also generated */
+ int group; /* effective group */
+ unsigned int mods; /* effective mods */
+ char message[XkbActionMessageLength+1];
+ /* message -- leave space for NUL */
+} XkbActionMessageEvent;
+
+typedef struct _XkbAccessXNotify {
+ int type; /* XkbAnyEvent */
+ unsigned long serial; /* of last req processed by server */
+ Bool send_event; /* is this from a SendEvent request? */
+ Display * display; /* Display the event was read from */
+ Time time; /* milliseconds */
+ int xkb_type; /* XkbAccessXNotify */
+ int device; /* device ID */
+ int detail; /* XkbAXN_* */
+ int keycode; /* key of event */
+ int sk_delay; /* current slow keys delay */
+ int debounce_delay; /* current debounce delay */
+} XkbAccessXNotifyEvent;
+
+typedef struct _XkbExtensionDeviceNotify {
+ int type; /* XkbAnyEvent */
+ unsigned long serial; /* of last req processed by server */
+ Bool send_event; /* is this from a SendEvent request? */
+ Display * display; /* Display the event was read from */
+ Time time; /* milliseconds */
+ int xkb_type; /* XkbExtensionDeviceNotify */
+ int device; /* device ID */
+ unsigned int reason; /* reason for the event */
+ unsigned int supported; /* mask of supported features */
+ unsigned int unsupported; /* mask of unsupported features */
+ /* that some app tried to use */
+ int first_btn; /* first button that changed */
+ int num_btns; /* range of buttons changed */
+ unsigned int leds_defined; /* indicators with names or maps */
+ unsigned int led_state; /* current state of the indicators */
+ int led_class; /* feedback class for led changes */
+ int led_id; /* feedback id for led changes */
+} XkbExtensionDeviceNotifyEvent;
+
+typedef union _XkbEvent {
+ int type;
+ XkbAnyEvent any;
+ XkbNewKeyboardNotifyEvent new_kbd;
+ XkbMapNotifyEvent map;
+ XkbStateNotifyEvent state;
+ XkbControlsNotifyEvent ctrls;
+ XkbIndicatorNotifyEvent indicators;
+ XkbNamesNotifyEvent names;
+ XkbCompatMapNotifyEvent compat;
+ XkbBellNotifyEvent bell;
+ XkbActionMessageEvent message;
+ XkbAccessXNotifyEvent accessx;
+ XkbExtensionDeviceNotifyEvent device;
+ XEvent core;
+} XkbEvent;
+
+typedef struct _XkbKbdDpyState XkbKbdDpyStateRec,*XkbKbdDpyStatePtr;
+
+ /* XkbOpenDisplay error codes */
+#define XkbOD_Success 0
+#define XkbOD_BadLibraryVersion 1
+#define XkbOD_ConnectionRefused 2
+#define XkbOD_NonXkbServer 3
+#define XkbOD_BadServerVersion 4
+
+ /* Values for XlibFlags */
+#define XkbLC_ForceLatin1Lookup (1<<0)
+#define XkbLC_ConsumeLookupMods (1<<1)
+#define XkbLC_AlwaysConsumeShiftAndLock (1<<2)
+#define XkbLC_IgnoreNewKeyboards (1<<3)
+#define XkbLC_ControlFallback (1<<4)
+#define XkbLC_ConsumeKeysOnComposeFail (1<<29)
+#define XkbLC_ComposeLED (1<<30)
+#define XkbLC_BeepOnComposeFail (1<<31)
+
+#define XkbLC_AllComposeControls (0xc0000000)
+#define XkbLC_AllControls (0xc000001f)
+
+_XFUNCPROTOBEGIN
+
+extern Bool XkbIgnoreExtension(
+ Bool /* ignore */
+);
+
+extern Display *XkbOpenDisplay(
+ char * /* name */,
+ int * /* ev_rtrn */,
+ int * /* err_rtrn */,
+ int * /* major_rtrn */,
+ int * /* minor_rtrn */,
+ int * /* reason */
+);
+
+extern Bool XkbQueryExtension(
+ Display * /* dpy */,
+ int * /* opcodeReturn */,
+ int * /* eventBaseReturn */,
+ int * /* errorBaseReturn */,
+ int * /* majorRtrn */,
+ int * /* minorRtrn */
+);
+
+extern Bool XkbUseExtension(
+ Display * /* dpy */,
+ int * /* major_rtrn */,
+ int * /* minor_rtrn */
+);
+
+extern Bool XkbLibraryVersion(
+ int * /* libMajorRtrn */,
+ int * /* libMinorRtrn */
+);
+
+extern unsigned int XkbSetXlibControls(
+ Display* /* dpy */,
+ unsigned int /* affect */,
+ unsigned int /* values */
+);
+
+extern unsigned int XkbGetXlibControls(
+ Display* /* dpy */
+);
+
+extern unsigned int XkbXlibControlsImplemented(void);
+
+typedef Atom (*XkbInternAtomFunc)(
+ Display * /* dpy */,
+ _Xconst char * /* name */,
+ Bool /* only_if_exists */
+);
+
+typedef char * (*XkbGetAtomNameFunc)(
+ Display * /* dpy */,
+ Atom /* atom */
+);
+
+extern void XkbSetAtomFuncs(
+ XkbInternAtomFunc /* getAtom */,
+ XkbGetAtomNameFunc /* getName */
+);
+
+extern KeySym XkbKeycodeToKeysym(
+ Display * /* dpy */,
+#if NeedWidePrototypes
+ unsigned int /* kc */,
+#else
+ KeyCode /* kc */,
+#endif
+ int /* group */,
+ int /* level */
+);
+
+extern unsigned int XkbKeysymToModifiers(
+ Display * /* dpy */,
+ KeySym /* ks */
+);
+
+extern Bool XkbLookupKeySym(
+ Display * /* dpy */,
+ KeyCode /* keycode */,
+ unsigned int /* modifiers */,
+ unsigned int * /* modifiers_return */,
+ KeySym * /* keysym_return */
+);
+
+extern int XkbLookupKeyBinding(
+ Display * /* dpy */,
+ KeySym /* sym_rtrn */,
+ unsigned int /* mods */,
+ char * /* buffer */,
+ int /* nbytes */,
+ int * /* extra_rtrn */
+);
+
+extern Bool XkbTranslateKeyCode(
+ XkbDescPtr /* xkb */,
+ KeyCode /* keycode */,
+ unsigned int /* modifiers */,
+ unsigned int * /* modifiers_return */,
+ KeySym * /* keysym_return */
+);
+
+extern int XkbTranslateKeySym(
+ Display * /* dpy */,
+ KeySym * /* sym_return */,
+ unsigned int /* modifiers */,
+ char * /* buffer */,
+ int /* nbytes */,
+ int * /* extra_rtrn */
+);
+
+extern Bool XkbSetAutoRepeatRate(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ unsigned int /* delay */,
+ unsigned int /* interval */
+);
+
+extern Bool XkbGetAutoRepeatRate(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ unsigned int * /* delayRtrn */,
+ unsigned int * /* intervalRtrn */
+);
+
+extern Bool XkbChangeEnabledControls(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ unsigned int /* affect */,
+ unsigned int /* values */
+);
+
+extern Bool XkbDeviceBell(
+ Display * /* dpy */,
+ Window /* win */,
+ int /* deviceSpec */,
+ int /* bellClass */,
+ int /* bellID */,
+ int /* percent */,
+ Atom /* name */
+);
+
+extern Bool XkbForceDeviceBell(
+ Display * /* dpy */,
+ int /* deviceSpec */,
+ int /* bellClass */,
+ int /* bellID */,
+ int /* percent */
+);
+
+extern Bool XkbDeviceBellEvent(
+ Display * /* dpy */,
+ Window /* win */,
+ int /* deviceSpec */,
+ int /* bellClass */,
+ int /* bellID */,
+ int /* percent */,
+ Atom /* name */
+);
+
+extern Bool XkbBell(
+ Display * /* dpy */,
+ Window /* win */,
+ int /* percent */,
+ Atom /* name */
+);
+
+extern Bool XkbForceBell(
+ Display * /* dpy */,
+ int /* percent */
+);
+
+extern Bool XkbBellEvent(
+ Display * /* dpy */,
+ Window /* win */,
+ int /* percent */,
+ Atom /* name */
+);
+
+extern Bool XkbSelectEvents(
+ Display * /* dpy */,
+ unsigned int /* deviceID */,
+ unsigned int /* affect */,
+ unsigned int /* values */
+);
+
+extern Bool XkbSelectEventDetails(
+ Display * /* dpy */,
+ unsigned int /* deviceID */,
+ unsigned int /* eventType */,
+ unsigned long /* affect */,
+ unsigned long /* details */
+);
+
+extern void XkbNoteMapChanges(
+ XkbMapChangesPtr /* old */,
+ XkbMapNotifyEvent * /* new */,
+ unsigned int /* wanted */
+);
+
+extern void XkbNoteNameChanges(
+ XkbNameChangesPtr /* old */,
+ XkbNamesNotifyEvent * /* new */,
+ unsigned int /* wanted */
+);
+
+extern Status XkbGetIndicatorState(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ unsigned int * /* pStateRtrn */
+);
+
+extern Status XkbGetDeviceIndicatorState(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ unsigned int /* ledClass */,
+ unsigned int /* ledID */,
+ unsigned int * /* pStateRtrn */
+);
+
+extern Status XkbGetIndicatorMap(
+ Display * /* dpy */,
+ unsigned long /* which */,
+ XkbDescPtr /* desc */
+);
+
+extern Bool XkbSetIndicatorMap(
+ Display * /* dpy */,
+ unsigned long /* which */,
+ XkbDescPtr /* desc */
+);
+
+#define XkbNoteIndicatorMapChanges(o,n,w) \
+ ((o)->map_changes|=((n)->map_changes&(w)))
+#define XkbNoteIndicatorStateChanges(o,n,w)\
+ ((o)->state_changes|=((n)->state_changes&(w)))
+#define XkbGetIndicatorMapChanges(d,x,c) \
+ (XkbGetIndicatorMap((d),(c)->map_changes,x))
+#define XkbChangeIndicatorMaps(d,x,c) \
+ (XkbSetIndicatorMap((d),(c)->map_changes,x))
+
+extern Bool XkbGetNamedIndicator(
+ Display * /* dpy */,
+ Atom /* name */,
+ int * /* pNdxRtrn */,
+ Bool * /* pStateRtrn */,
+ XkbIndicatorMapPtr /* pMapRtrn */,
+ Bool * /* pRealRtrn */
+);
+
+extern Bool XkbGetNamedDeviceIndicator(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ unsigned int /* ledClass */,
+ unsigned int /* ledID */,
+ Atom /* name */,
+ int * /* pNdxRtrn */,
+ Bool * /* pStateRtrn */,
+ XkbIndicatorMapPtr /* pMapRtrn */,
+ Bool * /* pRealRtrn */
+);
+
+extern Bool XkbSetNamedIndicator(
+ Display * /* dpy */,
+ Atom /* name */,
+ Bool /* changeState */,
+ Bool /* state */,
+ Bool /* createNewMap */,
+ XkbIndicatorMapPtr /* pMap */
+);
+
+extern Bool XkbSetNamedDeviceIndicator(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ unsigned int /* ledClass */,
+ unsigned int /* ledID */,
+ Atom /* name */,
+ Bool /* changeState */,
+ Bool /* state */,
+ Bool /* createNewMap */,
+ XkbIndicatorMapPtr /* pMap */
+);
+
+extern Bool XkbLockModifiers(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ unsigned int /* affect */,
+ unsigned int /* values */
+);
+
+extern Bool XkbLatchModifiers(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ unsigned int /* affect */,
+ unsigned int /* values */
+);
+
+extern Bool XkbLockGroup(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ unsigned int /* group */
+);
+
+extern Bool XkbLatchGroup(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ unsigned int /* group */
+);
+
+extern Bool XkbSetServerInternalMods(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ unsigned int /* affectReal */,
+ unsigned int /* realValues */,
+ unsigned int /* affectVirtual */,
+ unsigned int /* virtualValues */
+);
+
+extern Bool XkbSetIgnoreLockMods(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ unsigned int /* affectReal */,
+ unsigned int /* realValues */,
+ unsigned int /* affectVirtual */,
+ unsigned int /* virtualValues */
+);
+
+
+extern Bool XkbVirtualModsToReal(
+ XkbDescPtr /* xkb */,
+ unsigned int /* virtual_mask */,
+ unsigned int * /* mask_rtrn */
+);
+
+extern Bool XkbComputeEffectiveMap(
+ XkbDescPtr /* xkb */,
+ XkbKeyTypePtr /* type */,
+ unsigned char * /* map_rtrn */
+);
+
+extern Status XkbInitCanonicalKeyTypes(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ int /* keypadVMod */
+);
+
+extern XkbDescPtr XkbAllocKeyboard(
+ void
+);
+
+extern void XkbFreeKeyboard(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ Bool /* freeDesc */
+);
+
+extern Status XkbAllocClientMap(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ unsigned int /* nTypes */
+);
+
+extern Status XkbAllocServerMap(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ unsigned int /* nActions */
+);
+
+extern void XkbFreeClientMap(
+ XkbDescPtr /* xkb */,
+ unsigned int /* what */,
+ Bool /* freeMap */
+);
+
+extern void XkbFreeServerMap(
+ XkbDescPtr /* xkb */,
+ unsigned int /* what */,
+ Bool /* freeMap */
+);
+
+extern XkbKeyTypePtr XkbAddKeyType(
+ XkbDescPtr /* xkb */,
+ Atom /* name */,
+ int /* map_count */,
+ Bool /* want_preserve */,
+ int /* num_lvls */
+);
+
+extern Status XkbAllocIndicatorMaps(
+ XkbDescPtr /* xkb */
+);
+
+extern void XkbFreeIndicatorMaps(
+ XkbDescPtr /* xkb */
+);
+
+extern XkbDescPtr XkbGetMap(
+ Display * /* dpy */,
+ unsigned int /* which */,
+ unsigned int /* deviceSpec */
+);
+
+extern Status XkbGetUpdatedMap(
+ Display * /* dpy */,
+ unsigned int /* which */,
+ XkbDescPtr /* desc */
+);
+
+extern Status XkbGetMapChanges(
+ Display * /* dpy */,
+ XkbDescPtr /* xkb */,
+ XkbMapChangesPtr /* changes */
+);
+
+
+extern Status XkbRefreshKeyboardMapping(
+ XkbMapNotifyEvent * /* event */
+);
+
+extern Status XkbGetKeyTypes(
+ Display * /* dpy */,
+ unsigned int /* first */,
+ unsigned int /* num */,
+ XkbDescPtr /* xkb */
+);
+
+extern Status XkbGetKeySyms(
+ Display * /* dpy */,
+ unsigned int /* first */,
+ unsigned int /* num */,
+ XkbDescPtr /* xkb */
+);
+
+extern Status XkbGetKeyActions(
+ Display * /* dpy */,
+ unsigned int /* first */,
+ unsigned int /* num */,
+ XkbDescPtr /* xkb */
+);
+
+extern Status XkbGetKeyBehaviors(
+ Display * /* dpy */,
+ unsigned int /* firstKey */,
+ unsigned int /* nKeys */,
+ XkbDescPtr /* desc */
+);
+
+extern Status XkbGetVirtualMods(
+ Display * /* dpy */,
+ unsigned int /* which */,
+ XkbDescPtr /* desc */
+);
+
+extern Status XkbGetKeyExplicitComponents(
+ Display * /* dpy */,
+ unsigned int /* firstKey */,
+ unsigned int /* nKeys */,
+ XkbDescPtr /* desc */
+);
+
+extern Status XkbGetKeyModifierMap(
+ Display * /* dpy */,
+ unsigned int /* firstKey */,
+ unsigned int /* nKeys */,
+ XkbDescPtr /* desc */
+);
+
+extern Status XkbGetKeyVirtualModMap(
+ Display * /* dpy */,
+ unsigned int /* first */,
+ unsigned int /* num */,
+ XkbDescPtr /* xkb */
+);
+
+extern Status XkbAllocControls(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which*/
+);
+
+extern void XkbFreeControls(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ Bool /* freeMap */
+);
+
+extern Status XkbGetControls(
+ Display * /* dpy */,
+ unsigned long /* which */,
+ XkbDescPtr /* desc */
+);
+
+extern Bool XkbSetControls(
+ Display * /* dpy */,
+ unsigned long /* which */,
+ XkbDescPtr /* desc */
+);
+
+extern void XkbNoteControlsChanges(
+ XkbControlsChangesPtr /* old */,
+ XkbControlsNotifyEvent * /* new */,
+ unsigned int /* wanted */
+);
+
+#define XkbGetControlsChanges(d,x,c) XkbGetControls(d,(c)->changed_ctrls,x)
+#define XkbChangeControls(d,x,c) XkbSetControls(d,(c)->changed_ctrls,x)
+
+extern Status XkbAllocCompatMap(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ unsigned int /* nInterpret */
+);
+
+extern void XkbFreeCompatMap(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ Bool /* freeMap */
+);
+
+extern Status XkbGetCompatMap(
+ Display * /* dpy */,
+ unsigned int /* which */,
+ XkbDescPtr /* xkb */
+);
+
+extern Bool XkbSetCompatMap(
+ Display * /* dpy */,
+ unsigned int /* which */,
+ XkbDescPtr /* xkb */,
+ Bool /* updateActions */
+);
+
+extern XkbSymInterpretPtr XkbAddSymInterpret(
+ XkbDescPtr /* xkb */,
+ XkbSymInterpretPtr /* si */,
+ Bool /* updateMap */,
+ XkbChangesPtr /* changes */
+);
+
+extern Status XkbAllocNames(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ int /* nTotalRG */,
+ int /* nTotalAliases */
+);
+
+extern Status XkbGetNames(
+ Display * /* dpy */,
+ unsigned int /* which */,
+ XkbDescPtr /* desc */
+);
+
+extern Bool XkbSetNames(
+ Display * /* dpy */,
+ unsigned int /* which */,
+ unsigned int /* firstType */,
+ unsigned int /* nTypes */,
+ XkbDescPtr /* desc */
+);
+
+extern Bool XkbChangeNames(
+ Display * /* dpy */,
+ XkbDescPtr /* xkb */,
+ XkbNameChangesPtr /* changes */
+);
+
+extern void XkbFreeNames(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ Bool /* freeMap */
+);
+
+
+extern Status XkbGetState(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ XkbStatePtr /* rtrnState */
+);
+
+extern Bool XkbSetMap(
+ Display * /* dpy */,
+ unsigned int /* which */,
+ XkbDescPtr /* desc */
+);
+
+extern Bool XkbChangeMap(
+ Display* /* dpy */,
+ XkbDescPtr /* desc */,
+ XkbMapChangesPtr /* changes */
+);
+
+extern Bool XkbSetDetectableAutoRepeat(
+ Display * /* dpy */,
+ Bool /* detectable */,
+ Bool * /* supported */
+);
+
+extern Bool XkbGetDetectableAutoRepeat(
+ Display * /* dpy */,
+ Bool * /* supported */
+);
+
+extern Bool XkbSetAutoResetControls(
+ Display * /* dpy */,
+ unsigned int /* changes */,
+ unsigned int * /* auto_ctrls */,
+ unsigned int * /* auto_values */
+);
+
+extern Bool XkbGetAutoResetControls(
+ Display * /* dpy */,
+ unsigned int * /* auto_ctrls */,
+ unsigned int * /* auto_ctrl_values */
+);
+
+extern Bool XkbSetPerClientControls(
+ Display * /* dpy */,
+ unsigned int /* change */,
+ unsigned int * /* values */
+);
+
+extern Bool XkbGetPerClientControls(
+ Display * /* dpy */,
+ unsigned int * /* ctrls */
+);
+
+extern Status XkbCopyKeyType(
+ XkbKeyTypePtr /* from */,
+ XkbKeyTypePtr /* into */
+);
+
+extern Status XkbCopyKeyTypes(
+ XkbKeyTypePtr /* from */,
+ XkbKeyTypePtr /* into */,
+ int /* num_types */
+);
+
+extern Status XkbResizeKeyType(
+ XkbDescPtr /* xkb */,
+ int /* type_ndx */,
+ int /* map_count */,
+ Bool /* want_preserve */,
+ int /* new_num_lvls */
+);
+
+extern KeySym *XkbResizeKeySyms(
+ XkbDescPtr /* desc */,
+ int /* forKey */,
+ int /* symsNeeded */
+);
+
+extern XkbAction *XkbResizeKeyActions(
+ XkbDescPtr /* desc */,
+ int /* forKey */,
+ int /* actsNeeded */
+);
+
+extern Status XkbChangeTypesOfKey(
+ XkbDescPtr /* xkb */,
+ int /* key */,
+ int /* num_groups */,
+ unsigned int /* groups */,
+ int * /* newTypes */,
+ XkbMapChangesPtr /* pChanges */
+);
+
+extern Status XkbChangeKeycodeRange(
+ XkbDescPtr /* xkb */,
+ int /* minKC */,
+ int /* maxKC */,
+ XkbChangesPtr /* changes */
+);
+
+/***====================================================================***/
+
+extern XkbComponentListPtr XkbListComponents(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ XkbComponentNamesPtr /* ptrns */,
+ int * /* max_inout */
+);
+
+extern void XkbFreeComponentList(
+ XkbComponentListPtr /* list */
+);
+
+extern XkbDescPtr XkbGetKeyboard(
+ Display * /* dpy */,
+ unsigned int /* which */,
+ unsigned int /* deviceSpec */
+);
+
+extern XkbDescPtr XkbGetKeyboardByName(
+ Display * /* dpy */,
+ unsigned int /* deviceSpec */,
+ XkbComponentNamesPtr /* names */,
+ unsigned int /* want */,
+ unsigned int /* need */,
+ Bool /* load */
+);
+
+/***====================================================================***/
+
+extern int XkbKeyTypesForCoreSymbols( /* returns # of groups */
+ XkbDescPtr /* xkb */, /* keyboard device */
+ int /* map_width */, /* width of core KeySym array */
+ KeySym * /* core_syms */, /* always mapWidth symbols */
+ unsigned int /* protected */, /* explicit key types */
+ int * /* types_inout */, /* always four type indices */
+ KeySym * /* xkb_syms_rtrn */ /* must have enough space */
+);
+
+extern Bool XkbApplyCompatMapToKey( /* False only on error */
+ XkbDescPtr /* xkb */, /* keymap to be edited */
+ KeyCode /* key */, /* key to be updated */
+ XkbChangesPtr /* changes */ /* resulting changes to map */
+);
+
+extern Bool XkbUpdateMapFromCore( /* False only on error */
+ XkbDescPtr /* xkb */, /* XKB keyboard to be edited */
+ KeyCode /* first_key */, /* first changed key */
+ int /* num_keys */, /* number of changed keys */
+ int /* map_width */, /* width of core keymap */
+ KeySym * /* core_keysyms */, /* symbols from core keymap */
+ XkbChangesPtr /* changes */ /* resulting changes */
+);
+
+/***====================================================================***/
+
+extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo(
+ XkbDeviceInfoPtr /* devi */,
+ unsigned int /* ledClass */,
+ unsigned int /* ledId */
+);
+
+extern Status XkbResizeDeviceButtonActions(
+ XkbDeviceInfoPtr /* devi */,
+ unsigned int /* newTotal */
+);
+
+extern XkbDeviceInfoPtr XkbAllocDeviceInfo(
+ unsigned int /* deviceSpec */,
+ unsigned int /* nButtons */,
+ unsigned int /* szLeds */
+);
+
+extern void XkbFreeDeviceInfo(
+ XkbDeviceInfoPtr /* devi */,
+ unsigned int /* which */,
+ Bool /* freeDevI */
+);
+
+extern void XkbNoteDeviceChanges(
+ XkbDeviceChangesPtr /* old */,
+ XkbExtensionDeviceNotifyEvent * /* new */,
+ unsigned int /* wanted */
+);
+
+extern XkbDeviceInfoPtr XkbGetDeviceInfo(
+ Display * /* dpy */,
+ unsigned int /* which */,
+ unsigned int /* deviceSpec */,
+ unsigned int /* ledClass */,
+ unsigned int /* ledID */
+);
+
+extern Status XkbGetDeviceInfoChanges(
+ Display * /* dpy */,
+ XkbDeviceInfoPtr /* devi */,
+ XkbDeviceChangesPtr /* changes */
+);
+
+extern Status XkbGetDeviceButtonActions(
+ Display * /* dpy */,
+ XkbDeviceInfoPtr /* devi */,
+ Bool /* all */,
+ unsigned int /* first */,
+ unsigned int /* nBtns */
+);
+
+extern Status XkbGetDeviceLedInfo(
+ Display * /* dpy */,
+ XkbDeviceInfoPtr /* devi */,
+ unsigned int /* ledClass (class, XIDflt, XIAll) */,
+ unsigned int /* ledId (id, XIDflt, XIAll) */,
+ unsigned int /* which (XkbXI_Indicator{Names,Map}Mask */
+);
+
+extern Bool XkbSetDeviceInfo(
+ Display * /* dpy */,
+ unsigned int /* which */,
+ XkbDeviceInfoPtr /* devi */
+);
+
+extern Bool XkbChangeDeviceInfo(
+ Display* /* dpy */,
+ XkbDeviceInfoPtr /* desc */,
+ XkbDeviceChangesPtr /* changes */
+);
+
+extern Bool XkbSetDeviceLedInfo(
+ Display * /* dpy */,
+ XkbDeviceInfoPtr /* devi */,
+ unsigned int /* ledClass */,
+ unsigned int /* ledID */,
+ unsigned int /* which */
+);
+
+extern Bool XkbSetDeviceButtonActions(
+ Display * /* dpy */,
+ XkbDeviceInfoPtr /* devi */,
+ unsigned int /* first */,
+ unsigned int /* nBtns */
+);
+
+/***====================================================================***/
+
+extern char XkbToControl(
+ char /* c */
+);
+
+/***====================================================================***/
+
+extern Bool XkbSetDebuggingFlags(
+ Display * /* dpy */,
+ unsigned int /* mask */,
+ unsigned int /* flags */,
+ char * /* msg */,
+ unsigned int /* ctrls_mask */,
+ unsigned int /* ctrls */,
+ unsigned int * /* rtrn_flags */,
+ unsigned int * /* rtrn_ctrls */
+);
+
+extern Bool XkbApplyVirtualModChanges(
+ XkbDescPtr /* xkb */,
+ unsigned int /* changed */,
+ XkbChangesPtr /* changes */
+);
+
+extern Bool XkbUpdateActionVirtualMods(
+ XkbDescPtr /* xkb */,
+ XkbAction * /* act */,
+ unsigned int /* changed */
+);
+
+extern void XkbUpdateKeyTypeVirtualMods(
+ XkbDescPtr /* xkb */,
+ XkbKeyTypePtr /* type */,
+ unsigned int /* changed */,
+ XkbChangesPtr /* changes */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _X11_XKBLIB_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/Xatom.h b/thirdparty/linuxbsd_headers/X11/Xatom.h
new file mode 100644
index 0000000000..485a4236db
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/Xatom.h
@@ -0,0 +1,79 @@
+#ifndef XATOM_H
+#define XATOM_H 1
+
+/* THIS IS A GENERATED FILE
+ *
+ * Do not change! Changing this file implies a protocol change!
+ */
+
+#define XA_PRIMARY ((Atom) 1)
+#define XA_SECONDARY ((Atom) 2)
+#define XA_ARC ((Atom) 3)
+#define XA_ATOM ((Atom) 4)
+#define XA_BITMAP ((Atom) 5)
+#define XA_CARDINAL ((Atom) 6)
+#define XA_COLORMAP ((Atom) 7)
+#define XA_CURSOR ((Atom) 8)
+#define XA_CUT_BUFFER0 ((Atom) 9)
+#define XA_CUT_BUFFER1 ((Atom) 10)
+#define XA_CUT_BUFFER2 ((Atom) 11)
+#define XA_CUT_BUFFER3 ((Atom) 12)
+#define XA_CUT_BUFFER4 ((Atom) 13)
+#define XA_CUT_BUFFER5 ((Atom) 14)
+#define XA_CUT_BUFFER6 ((Atom) 15)
+#define XA_CUT_BUFFER7 ((Atom) 16)
+#define XA_DRAWABLE ((Atom) 17)
+#define XA_FONT ((Atom) 18)
+#define XA_INTEGER ((Atom) 19)
+#define XA_PIXMAP ((Atom) 20)
+#define XA_POINT ((Atom) 21)
+#define XA_RECTANGLE ((Atom) 22)
+#define XA_RESOURCE_MANAGER ((Atom) 23)
+#define XA_RGB_COLOR_MAP ((Atom) 24)
+#define XA_RGB_BEST_MAP ((Atom) 25)
+#define XA_RGB_BLUE_MAP ((Atom) 26)
+#define XA_RGB_DEFAULT_MAP ((Atom) 27)
+#define XA_RGB_GRAY_MAP ((Atom) 28)
+#define XA_RGB_GREEN_MAP ((Atom) 29)
+#define XA_RGB_RED_MAP ((Atom) 30)
+#define XA_STRING ((Atom) 31)
+#define XA_VISUALID ((Atom) 32)
+#define XA_WINDOW ((Atom) 33)
+#define XA_WM_COMMAND ((Atom) 34)
+#define XA_WM_HINTS ((Atom) 35)
+#define XA_WM_CLIENT_MACHINE ((Atom) 36)
+#define XA_WM_ICON_NAME ((Atom) 37)
+#define XA_WM_ICON_SIZE ((Atom) 38)
+#define XA_WM_NAME ((Atom) 39)
+#define XA_WM_NORMAL_HINTS ((Atom) 40)
+#define XA_WM_SIZE_HINTS ((Atom) 41)
+#define XA_WM_ZOOM_HINTS ((Atom) 42)
+#define XA_MIN_SPACE ((Atom) 43)
+#define XA_NORM_SPACE ((Atom) 44)
+#define XA_MAX_SPACE ((Atom) 45)
+#define XA_END_SPACE ((Atom) 46)
+#define XA_SUPERSCRIPT_X ((Atom) 47)
+#define XA_SUPERSCRIPT_Y ((Atom) 48)
+#define XA_SUBSCRIPT_X ((Atom) 49)
+#define XA_SUBSCRIPT_Y ((Atom) 50)
+#define XA_UNDERLINE_POSITION ((Atom) 51)
+#define XA_UNDERLINE_THICKNESS ((Atom) 52)
+#define XA_STRIKEOUT_ASCENT ((Atom) 53)
+#define XA_STRIKEOUT_DESCENT ((Atom) 54)
+#define XA_ITALIC_ANGLE ((Atom) 55)
+#define XA_X_HEIGHT ((Atom) 56)
+#define XA_QUAD_WIDTH ((Atom) 57)
+#define XA_WEIGHT ((Atom) 58)
+#define XA_POINT_SIZE ((Atom) 59)
+#define XA_RESOLUTION ((Atom) 60)
+#define XA_COPYRIGHT ((Atom) 61)
+#define XA_NOTICE ((Atom) 62)
+#define XA_FONT_NAME ((Atom) 63)
+#define XA_FAMILY_NAME ((Atom) 64)
+#define XA_FULL_NAME ((Atom) 65)
+#define XA_CAP_HEIGHT ((Atom) 66)
+#define XA_WM_CLASS ((Atom) 67)
+#define XA_WM_TRANSIENT_FOR ((Atom) 68)
+
+#define XA_LAST_PREDEFINED ((Atom) 68)
+#endif /* XATOM_H */
diff --git a/thirdparty/linuxbsd_headers/X11/Xcursor/Xcursor.h b/thirdparty/linuxbsd_headers/X11/Xcursor/Xcursor.h
new file mode 100644
index 0000000000..79dd0349a7
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/Xcursor/Xcursor.h
@@ -0,0 +1,500 @@
+/* include/X11/Xcursor/Xcursor.h. Generated from Xcursor.h.in by configure. */
+/*
+ * Copyright © 2002 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _XCURSOR_H_
+#define _XCURSOR_H_
+#include <stdio.h>
+#include <X11/Xfuncproto.h>
+#include <X11/Xlib.h>
+
+typedef int XcursorBool;
+typedef unsigned int XcursorUInt;
+
+typedef XcursorUInt XcursorDim;
+typedef XcursorUInt XcursorPixel;
+
+#define XcursorTrue 1
+#define XcursorFalse 0
+
+/*
+ * Cursor files start with a header. The header
+ * contains a magic number, a version number and a
+ * table of contents which has type and offset information
+ * for the remaining tables in the file.
+ *
+ * File minor versions increment for compatible changes
+ * File major versions increment for incompatible changes (never, we hope)
+ *
+ * Chunks of the same type are always upward compatible. Incompatible
+ * changes are made with new chunk types; the old data can remain under
+ * the old type. Upward compatible changes can add header data as the
+ * header lengths are specified in the file.
+ *
+ * File:
+ * FileHeader
+ * LISTofChunk
+ *
+ * FileHeader:
+ * CARD32 magic magic number
+ * CARD32 header bytes in file header
+ * CARD32 version file version
+ * CARD32 ntoc number of toc entries
+ * LISTofFileToc toc table of contents
+ *
+ * FileToc:
+ * CARD32 type entry type
+ * CARD32 subtype entry subtype (size for images)
+ * CARD32 position absolute file position
+ */
+
+#define XCURSOR_MAGIC 0x72756358 /* "Xcur" LSBFirst */
+
+/*
+ * Current Xcursor version number. Will be substituted by configure
+ * from the version in the libXcursor configure.ac file.
+ */
+
+#define XCURSOR_LIB_MAJOR 1
+#define XCURSOR_LIB_MINOR 2
+#define XCURSOR_LIB_REVISION 0
+#define XCURSOR_LIB_VERSION ((XCURSOR_LIB_MAJOR * 10000) + \
+ (XCURSOR_LIB_MINOR * 100) + \
+ (XCURSOR_LIB_REVISION))
+
+/*
+ * This version number is stored in cursor files; changes to the
+ * file format require updating this version number
+ */
+#define XCURSOR_FILE_MAJOR 1
+#define XCURSOR_FILE_MINOR 0
+#define XCURSOR_FILE_VERSION ((XCURSOR_FILE_MAJOR << 16) | (XCURSOR_FILE_MINOR))
+#define XCURSOR_FILE_HEADER_LEN (4 * 4)
+#define XCURSOR_FILE_TOC_LEN (3 * 4)
+
+typedef struct _XcursorFileToc {
+ XcursorUInt type; /* chunk type */
+ XcursorUInt subtype; /* subtype (size for images) */
+ XcursorUInt position; /* absolute position in file */
+} XcursorFileToc;
+
+typedef struct _XcursorFileHeader {
+ XcursorUInt magic; /* magic number */
+ XcursorUInt header; /* byte length of header */
+ XcursorUInt version; /* file version number */
+ XcursorUInt ntoc; /* number of toc entries */
+ XcursorFileToc *tocs; /* table of contents */
+} XcursorFileHeader;
+
+/*
+ * The rest of the file is a list of chunks, each tagged by type
+ * and version.
+ *
+ * Chunk:
+ * ChunkHeader
+ * <extra type-specific header fields>
+ * <type-specific data>
+ *
+ * ChunkHeader:
+ * CARD32 header bytes in chunk header + type header
+ * CARD32 type chunk type
+ * CARD32 subtype chunk subtype
+ * CARD32 version chunk type version
+ */
+
+#define XCURSOR_CHUNK_HEADER_LEN (4 * 4)
+
+typedef struct _XcursorChunkHeader {
+ XcursorUInt header; /* bytes in chunk header */
+ XcursorUInt type; /* chunk type */
+ XcursorUInt subtype; /* chunk subtype (size for images) */
+ XcursorUInt version; /* version of this type */
+} XcursorChunkHeader;
+
+/*
+ * Here's a list of the known chunk types
+ */
+
+/*
+ * Comments consist of a 4-byte length field followed by
+ * UTF-8 encoded text
+ *
+ * Comment:
+ * ChunkHeader header chunk header
+ * CARD32 length bytes in text
+ * LISTofCARD8 text UTF-8 encoded text
+ */
+
+#define XCURSOR_COMMENT_TYPE 0xfffe0001
+#define XCURSOR_COMMENT_VERSION 1
+#define XCURSOR_COMMENT_HEADER_LEN (XCURSOR_CHUNK_HEADER_LEN + (1 *4))
+#define XCURSOR_COMMENT_COPYRIGHT 1
+#define XCURSOR_COMMENT_LICENSE 2
+#define XCURSOR_COMMENT_OTHER 3
+#define XCURSOR_COMMENT_MAX_LEN 0x100000
+
+typedef struct _XcursorComment {
+ XcursorUInt version;
+ XcursorUInt comment_type;
+ char *comment;
+} XcursorComment;
+
+/*
+ * Each cursor image occupies a separate image chunk.
+ * The length of the image header follows the chunk header
+ * so that future versions can extend the header without
+ * breaking older applications
+ *
+ * Image:
+ * ChunkHeader header chunk header
+ * CARD32 width actual width
+ * CARD32 height actual height
+ * CARD32 xhot hot spot x
+ * CARD32 yhot hot spot y
+ * CARD32 delay animation delay
+ * LISTofCARD32 pixels ARGB pixels
+ */
+
+#define XCURSOR_IMAGE_TYPE 0xfffd0002
+#define XCURSOR_IMAGE_VERSION 1
+#define XCURSOR_IMAGE_HEADER_LEN (XCURSOR_CHUNK_HEADER_LEN + (5*4))
+#define XCURSOR_IMAGE_MAX_SIZE 0x7fff /* 32767x32767 max cursor size */
+
+typedef struct _XcursorImage {
+ XcursorUInt version; /* version of the image data */
+ XcursorDim size; /* nominal size for matching */
+ XcursorDim width; /* actual width */
+ XcursorDim height; /* actual height */
+ XcursorDim xhot; /* hot spot x (must be inside image) */
+ XcursorDim yhot; /* hot spot y (must be inside image) */
+ XcursorUInt delay; /* animation delay to next frame (ms) */
+ XcursorPixel *pixels; /* pointer to pixels */
+} XcursorImage;
+
+/*
+ * Other data structures exposed by the library API
+ */
+typedef struct _XcursorImages {
+ int nimage; /* number of images */
+ XcursorImage **images; /* array of XcursorImage pointers */
+ char *name; /* name used to load images */
+} XcursorImages;
+
+typedef struct _XcursorCursors {
+ Display *dpy; /* Display holding cursors */
+ int ref; /* reference count */
+ int ncursor; /* number of cursors */
+ Cursor *cursors; /* array of cursors */
+} XcursorCursors;
+
+typedef struct _XcursorAnimate {
+ XcursorCursors *cursors; /* list of cursors to use */
+ int sequence; /* which cursor is next */
+} XcursorAnimate;
+
+typedef struct _XcursorFile XcursorFile;
+
+struct _XcursorFile {
+ void *closure;
+ int (*read) (XcursorFile *file, unsigned char *buf, int len);
+ int (*write) (XcursorFile *file, unsigned char *buf, int len);
+ int (*seek) (XcursorFile *file, long offset, int whence);
+};
+
+typedef struct _XcursorComments {
+ int ncomment; /* number of comments */
+ XcursorComment **comments; /* array of XcursorComment pointers */
+} XcursorComments;
+
+#define XCURSOR_CORE_THEME "core"
+
+_XFUNCPROTOBEGIN
+
+/*
+ * Manage Image objects
+ */
+XcursorImage *
+XcursorImageCreate (int width, int height);
+
+void
+XcursorImageDestroy (XcursorImage *image);
+
+/*
+ * Manage Images objects
+ */
+XcursorImages *
+XcursorImagesCreate (int size);
+
+void
+XcursorImagesDestroy (XcursorImages *images);
+
+void
+XcursorImagesSetName (XcursorImages *images, const char *name);
+
+/*
+ * Manage Cursor objects
+ */
+XcursorCursors *
+XcursorCursorsCreate (Display *dpy, int size);
+
+void
+XcursorCursorsDestroy (XcursorCursors *cursors);
+
+/*
+ * Manage Animate objects
+ */
+XcursorAnimate *
+XcursorAnimateCreate (XcursorCursors *cursors);
+
+void
+XcursorAnimateDestroy (XcursorAnimate *animate);
+
+Cursor
+XcursorAnimateNext (XcursorAnimate *animate);
+
+/*
+ * Manage Comment objects
+ */
+XcursorComment *
+XcursorCommentCreate (XcursorUInt comment_type, int length);
+
+void
+XcursorCommentDestroy (XcursorComment *comment);
+
+XcursorComments *
+XcursorCommentsCreate (int size);
+
+void
+XcursorCommentsDestroy (XcursorComments *comments);
+
+/*
+ * XcursorFile/Image APIs
+ */
+XcursorImage *
+XcursorXcFileLoadImage (XcursorFile *file, int size);
+
+XcursorImages *
+XcursorXcFileLoadImages (XcursorFile *file, int size);
+
+XcursorImages *
+XcursorXcFileLoadAllImages (XcursorFile *file);
+
+XcursorBool
+XcursorXcFileLoad (XcursorFile *file,
+ XcursorComments **commentsp,
+ XcursorImages **imagesp);
+
+XcursorBool
+XcursorXcFileSave (XcursorFile *file,
+ const XcursorComments *comments,
+ const XcursorImages *images);
+
+/*
+ * FILE/Image APIs
+ */
+XcursorImage *
+XcursorFileLoadImage (FILE *file, int size);
+
+XcursorImages *
+XcursorFileLoadImages (FILE *file, int size);
+
+XcursorImages *
+XcursorFileLoadAllImages (FILE *file);
+
+XcursorBool
+XcursorFileLoad (FILE *file,
+ XcursorComments **commentsp,
+ XcursorImages **imagesp);
+
+XcursorBool
+XcursorFileSaveImages (FILE *file, const XcursorImages *images);
+
+XcursorBool
+XcursorFileSave (FILE * file,
+ const XcursorComments *comments,
+ const XcursorImages *images);
+
+/*
+ * Filename/Image APIs
+ */
+XcursorImage *
+XcursorFilenameLoadImage (const char *filename, int size);
+
+XcursorImages *
+XcursorFilenameLoadImages (const char *filename, int size);
+
+XcursorImages *
+XcursorFilenameLoadAllImages (const char *filename);
+
+XcursorBool
+XcursorFilenameLoad (const char *file,
+ XcursorComments **commentsp,
+ XcursorImages **imagesp);
+
+XcursorBool
+XcursorFilenameSaveImages (const char *filename, const XcursorImages *images);
+
+XcursorBool
+XcursorFilenameSave (const char *file,
+ const XcursorComments *comments,
+ const XcursorImages *images);
+
+/*
+ * Library/Image APIs
+ */
+XcursorImage *
+XcursorLibraryLoadImage (const char *library, const char *theme, int size);
+
+XcursorImages *
+XcursorLibraryLoadImages (const char *library, const char *theme, int size);
+
+/*
+ * Library/shape API
+ */
+
+const char *
+XcursorLibraryPath (void);
+
+int
+XcursorLibraryShape (const char *library);
+
+/*
+ * Image/Cursor APIs
+ */
+
+Cursor
+XcursorImageLoadCursor (Display *dpy, const XcursorImage *image);
+
+XcursorCursors *
+XcursorImagesLoadCursors (Display *dpy, const XcursorImages *images);
+
+Cursor
+XcursorImagesLoadCursor (Display *dpy, const XcursorImages *images);
+
+/*
+ * Filename/Cursor APIs
+ */
+Cursor
+XcursorFilenameLoadCursor (Display *dpy, const char *file);
+
+XcursorCursors *
+XcursorFilenameLoadCursors (Display *dpy, const char *file);
+
+/*
+ * Library/Cursor APIs
+ */
+Cursor
+XcursorLibraryLoadCursor (Display *dpy, const char *file);
+
+XcursorCursors *
+XcursorLibraryLoadCursors (Display *dpy, const char *file);
+
+/*
+ * Shape/Image APIs
+ */
+
+XcursorImage *
+XcursorShapeLoadImage (unsigned int shape, const char *theme, int size);
+
+XcursorImages *
+XcursorShapeLoadImages (unsigned int shape, const char *theme, int size);
+
+/*
+ * Shape/Cursor APIs
+ */
+Cursor
+XcursorShapeLoadCursor (Display *dpy, unsigned int shape);
+
+XcursorCursors *
+XcursorShapeLoadCursors (Display *dpy, unsigned int shape);
+
+/*
+ * This is the function called by Xlib when attempting to
+ * load cursors from XCreateGlyphCursor. The interface must
+ * not change as Xlib loads 'libXcursor.so' instead of
+ * a specific major version
+ */
+Cursor
+XcursorTryShapeCursor (Display *dpy,
+ Font source_font,
+ Font mask_font,
+ unsigned int source_char,
+ unsigned int mask_char,
+ XColor _Xconst *foreground,
+ XColor _Xconst *background);
+
+void
+XcursorNoticeCreateBitmap (Display *dpy,
+ Pixmap pid,
+ unsigned int width,
+ unsigned int height);
+
+void
+XcursorNoticePutBitmap (Display *dpy,
+ Drawable draw,
+ XImage *image);
+
+Cursor
+XcursorTryShapeBitmapCursor (Display *dpy,
+ Pixmap source,
+ Pixmap mask,
+ XColor *foreground,
+ XColor *background,
+ unsigned int x,
+ unsigned int y);
+
+#define XCURSOR_BITMAP_HASH_SIZE 16
+
+void
+XcursorImageHash (XImage *image,
+ unsigned char hash[XCURSOR_BITMAP_HASH_SIZE]);
+
+/*
+ * Display information APIs
+ */
+XcursorBool
+XcursorSupportsARGB (Display *dpy);
+
+XcursorBool
+XcursorSupportsAnim (Display *dpy);
+
+XcursorBool
+XcursorSetDefaultSize (Display *dpy, int size);
+
+int
+XcursorGetDefaultSize (Display *dpy);
+
+XcursorBool
+XcursorSetTheme (Display *dpy, const char *theme);
+
+char *
+XcursorGetTheme (Display *dpy);
+
+XcursorBool
+XcursorGetThemeCore (Display *dpy);
+
+XcursorBool
+XcursorSetThemeCore (Display *dpy, XcursorBool theme_core);
+
+_XFUNCPROTOEND
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/X11/Xdefs.h b/thirdparty/linuxbsd_headers/X11/Xdefs.h
new file mode 100644
index 0000000000..f58946dfba
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/Xdefs.h
@@ -0,0 +1,108 @@
+/***********************************************************
+
+Copyright (c) 1999 The XFree86 Project Inc.
+
+All Rights Reserved.
+
+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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The XFree86 Project
+Inc. shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from The XFree86 Project Inc..
+
+*/
+
+/**
+ ** Types definitions shared between server and clients
+ **/
+
+#ifndef _XDEFS_H
+#define _XDEFS_H
+
+#ifdef _XSERVER64
+#include <X11/Xmd.h>
+#endif
+
+#ifndef _XTYPEDEF_ATOM
+# define _XTYPEDEF_ATOM
+# ifndef _XSERVER64
+typedef unsigned long Atom;
+# else
+typedef CARD32 Atom;
+# endif
+#endif
+
+#ifndef Bool
+# ifndef _XTYPEDEF_BOOL
+# define _XTYPEDEF_BOOL
+typedef int Bool;
+# endif
+#endif
+
+#ifndef _XTYPEDEF_POINTER
+# define _XTYPEDEF_POINTER
+typedef void *pointer;
+#endif
+
+#ifndef _XTYPEDEF_CLIENTPTR
+typedef struct _Client *ClientPtr;
+# define _XTYPEDEF_CLIENTPTR
+#endif
+
+#ifndef _XTYPEDEF_XID
+# define _XTYPEDEF_XID
+# ifndef _XSERVER64
+typedef unsigned long XID;
+# else
+typedef CARD32 XID;
+# endif
+#endif
+
+#ifndef _XTYPEDEF_MASK
+# define _XTYPEDEF_MASK
+# ifndef _XSERVER64
+typedef unsigned long Mask;
+# else
+typedef CARD32 Mask;
+# endif
+#endif
+
+#ifndef _XTYPEDEF_FONTPTR
+# define _XTYPEDEF_FONTPTR
+typedef struct _Font *FontPtr; /* also in fonts/include/font.h */
+#endif
+
+#ifndef _XTYPEDEF_FONT
+# define _XTYPEDEF_FONT
+typedef XID Font;
+#endif
+
+#ifndef _XTYPEDEF_FSID
+# ifndef _XSERVER64
+typedef unsigned long FSID;
+# else
+typedef CARD32 FSID;
+# endif
+#endif
+
+typedef FSID AccContext;
+
+/* OS independent time value
+ XXX Should probably go in Xos.h */
+typedef struct timeval **OSTimePtr;
+
+
+typedef void (* BlockHandlerProcPtr)(void * /* blockData */,
+ OSTimePtr /* pTimeout */,
+ void * /* pReadmask */);
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/X11/Xfuncproto.h b/thirdparty/linuxbsd_headers/X11/Xfuncproto.h
new file mode 100644
index 0000000000..f689073602
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/Xfuncproto.h
@@ -0,0 +1,229 @@
+/*
+ *
+Copyright 1989, 1991, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ */
+
+/* Definitions to make function prototypes manageable */
+
+#ifndef _XFUNCPROTO_H_
+#define _XFUNCPROTO_H_
+
+#ifndef NeedFunctionPrototypes
+#define NeedFunctionPrototypes 1
+#endif /* NeedFunctionPrototypes */
+
+#ifndef NeedVarargsPrototypes
+#define NeedVarargsPrototypes 1
+#endif /* NeedVarargsPrototypes */
+
+#if NeedFunctionPrototypes
+
+#ifndef NeedNestedPrototypes
+#define NeedNestedPrototypes 1
+#endif /* NeedNestedPrototypes */
+
+#ifndef _Xconst
+#define _Xconst const
+#endif /* _Xconst */
+
+/* Function prototype configuration (see configure for more info) */
+#if !defined(NARROWPROTO) && \
+ (defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__))
+#define NARROWPROTO
+#endif
+#ifndef FUNCPROTO
+#define FUNCPROTO 15
+#endif
+
+#ifndef NeedWidePrototypes
+#ifdef NARROWPROTO
+#define NeedWidePrototypes 0
+#else
+#define NeedWidePrototypes 1 /* default to make interropt. easier */
+#endif
+#endif /* NeedWidePrototypes */
+
+#endif /* NeedFunctionPrototypes */
+
+#ifndef _XFUNCPROTOBEGIN
+#if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
+#define _XFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
+#define _XFUNCPROTOEND }
+#else
+#define _XFUNCPROTOBEGIN
+#define _XFUNCPROTOEND
+#endif
+#endif /* _XFUNCPROTOBEGIN */
+
+/* http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute */
+#ifndef __has_attribute
+# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
+#endif
+#ifndef __has_feature
+# define __has_feature(x) 0 /* Compatibility with non-clang compilers. */
+#endif
+#ifndef __has_extension
+# define __has_extension(x) 0 /* Compatibility with non-clang compilers. */
+#endif
+
+/* Added in X11R6.9, so available in any version of modular xproto */
+#if __has_attribute(__sentinel__) || (defined(__GNUC__) && (__GNUC__ >= 4))
+# define _X_SENTINEL(x) __attribute__ ((__sentinel__(x)))
+#else
+# define _X_SENTINEL(x)
+#endif /* GNUC >= 4 */
+
+/* Added in X11R6.9, so available in any version of modular xproto */
+#if (__has_attribute(visibility) || (defined(__GNUC__) && (__GNUC__ >= 4))) \
+ && !defined(__CYGWIN__) && !defined(__MINGW32__)
+# define _X_EXPORT __attribute__((visibility("default")))
+# define _X_HIDDEN __attribute__((visibility("hidden")))
+# define _X_INTERNAL __attribute__((visibility("internal")))
+#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
+# define _X_EXPORT __global
+# define _X_HIDDEN __hidden
+# define _X_INTERNAL __hidden
+#else /* not gcc >= 4 and not Sun Studio >= 8 */
+# define _X_EXPORT
+# define _X_HIDDEN
+# define _X_INTERNAL
+#endif /* GNUC >= 4 */
+
+/* Branch prediction hints for individual conditionals */
+/* requires xproto >= 7.0.9 */
+#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
+# define _X_LIKELY(x) __builtin_expect(!!(x), 1)
+# define _X_UNLIKELY(x) __builtin_expect(!!(x), 0)
+#else /* not gcc >= 3.3 */
+# define _X_LIKELY(x) (x)
+# define _X_UNLIKELY(x) (x)
+#endif
+
+/* Bulk branch prediction hints via marking error path functions as "cold" */
+/* requires xproto >= 7.0.25 */
+#if __has_attribute(__cold__) || \
+ (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403)) /* 4.3+ */
+# define _X_COLD __attribute__((__cold__))
+#else
+# define _X_COLD /* nothing */
+#endif
+
+/* Added in X11R6.9, so available in any version of modular xproto */
+#if __has_attribute(deprecated) \
+ || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301)) \
+ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5130))
+# define _X_DEPRECATED __attribute__((deprecated))
+#else /* not gcc >= 3.1 */
+# define _X_DEPRECATED
+#endif
+
+/* requires xproto >= 7.0.30 */
+#if __has_extension(attribute_deprecated_with_message) || \
+ (defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))))
+# define _X_DEPRECATED_MSG(_msg) __attribute__((deprecated(_msg)))
+#else
+# define _X_DEPRECATED_MSG(_msg) _X_DEPRECATED
+#endif
+
+/* requires xproto >= 7.0.17 */
+#if __has_attribute(noreturn) \
+ || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \
+ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+# define _X_NORETURN __attribute((noreturn))
+#else
+# define _X_NORETURN
+#endif /* GNUC */
+
+/* Added in X11R6.9, so available in any version of modular xproto */
+#if __has_attribute(__format__) \
+ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)
+# define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y)))
+#else /* not gcc >= 2.3 */
+# define _X_ATTRIBUTE_PRINTF(x,y)
+#endif
+
+/* requires xproto >= 7.0.22 - since this uses either gcc or C99 variable
+ argument macros, must be only used inside #ifdef _X_NONNULL guards, as
+ many legacy X clients are compiled in C89 mode still. */
+#if __has_attribute(nonnull) \
+ && defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */
+#define _X_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
+#elif __has_attribute(nonnull) \
+ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
+#define _X_NONNULL(args...) __attribute__((nonnull(args)))
+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */
+#define _X_NONNULL(...) /* */
+#endif
+
+/* requires xproto >= 7.0.22 */
+#if __has_attribute(__unused__) \
+ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)
+#define _X_UNUSED __attribute__((__unused__))
+#else
+#define _X_UNUSED /* */
+#endif
+
+/* C99 keyword "inline" or equivalent extensions in pre-C99 compilers */
+/* requires xproto >= 7.0.9
+ (introduced in 7.0.8 but didn't support all compilers until 7.0.9) */
+#if defined(inline) /* assume autoconf set it correctly */ || \
+ (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */ || \
+ (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550))
+# define _X_INLINE inline
+#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
+# define _X_INLINE __inline__
+#else
+# define _X_INLINE
+#endif
+
+/* C99 keyword "restrict" or equivalent extensions in pre-C99 compilers */
+/* requires xproto >= 7.0.21 */
+#ifndef _X_RESTRICT_KYWD
+# if defined(restrict) /* assume autoconf set it correctly */ || \
+ (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ \
+ && !defined(__cplusplus)) /* Workaround g++ issue on Solaris */
+# define _X_RESTRICT_KYWD restrict
+# elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
+# define _X_RESTRICT_KYWD __restrict__
+# else
+# define _X_RESTRICT_KYWD
+# endif
+#endif
+
+/* requires xproto >= 7.0.30 */
+#if __has_attribute(no_sanitize_thread)
+# define _X_NOTSAN __attribute__((no_sanitize_thread))
+#else
+# define _X_NOTSAN
+#endif
+
+/* Mark a char array/pointer as not containing a NUL-terminated string */
+/* requires xproto >= 7.0.33 */
+#if __has_attribute(nonstring)
+# define _X_NONSTRING __attribute__((nonstring))
+#else
+# define _X_NONSTRING
+#endif
+
+#endif /* _XFUNCPROTO_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/Xfuncs.h b/thirdparty/linuxbsd_headers/X11/Xfuncs.h
new file mode 100644
index 0000000000..b23c283107
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/Xfuncs.h
@@ -0,0 +1,69 @@
+/*
+ *
+Copyright 1990, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ */
+
+#ifndef _XFUNCS_H_
+# define _XFUNCS_H_
+
+# include <X11/Xosdefs.h>
+
+/* the old Xfuncs.h, for pre-R6 */
+# if !(defined(XFree86LOADER) && defined(IN_MODULE))
+
+# ifdef X_USEBFUNCS
+void bcopy();
+void bzero();
+int bcmp();
+# else
+# if defined(SYSV) && !defined(__SCO__) && !defined(__sun) && !defined(__UNIXWARE__) && !defined(_AIX)
+# include <memory.h>
+void bcopy();
+# define bzero(b,len) memset(b, 0, len)
+# define bcmp(b1,b2,len) memcmp(b1, b2, len)
+# else
+# include <string.h>
+# if defined(__SCO__) || defined(__sun) || defined(__UNIXWARE__) || defined(__CYGWIN__) || defined(_AIX) || defined(__APPLE__)
+# include <strings.h>
+# endif
+# define _XFUNCS_H_INCLUDED_STRING_H
+# endif
+# endif /* X_USEBFUNCS */
+
+/* the new Xfuncs.h */
+
+/* the ANSI C way */
+# ifndef _XFUNCS_H_INCLUDED_STRING_H
+# include <string.h>
+# endif
+# undef bzero
+# define bzero(b,len) memset(b,0,len)
+
+# if defined WIN32 && defined __MINGW32__
+# define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len))
+# endif
+
+# endif /* !(defined(XFree86LOADER) && defined(IN_MODULE)) */
+
+#endif /* _XFUNCS_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/Xlib.h b/thirdparty/linuxbsd_headers/X11/Xlib.h
new file mode 100644
index 0000000000..f62fb4707f
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/Xlib.h
@@ -0,0 +1,4025 @@
+/*
+
+Copyright 1985, 1986, 1987, 1991, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+
+/*
+ * Xlib.h - Header definition and support file for the C subroutine
+ * interface library (Xlib) to the X Window System Protocol (V11).
+ * Structures and symbols starting with "_" are private to the library.
+ */
+#ifndef _X11_XLIB_H_
+#define _X11_XLIB_H_
+
+#define XlibSpecificationRelease 6
+
+#include <sys/types.h>
+
+#if defined(__SCO__) || defined(__UNIXWARE__)
+#include <stdint.h>
+#endif
+
+#include <X11/X.h>
+
+/* applications should not depend on these two headers being included! */
+#include <X11/Xfuncproto.h>
+#include <X11/Xosdefs.h>
+
+#ifndef X_WCHAR
+#include <stddef.h>
+#else
+#ifdef __UNIXOS2__
+#include <stdlib.h>
+#else
+/* replace this with #include or typedef appropriate for your system */
+typedef unsigned long wchar_t;
+#endif
+#endif
+
+
+extern int
+_Xmblen(
+ char *str,
+ int len
+ );
+
+/* API mentioning "UTF8" or "utf8" is an XFree86 extension, introduced in
+ November 2000. Its presence is indicated through the following macro. */
+#define X_HAVE_UTF8_STRING 1
+
+/* The Xlib structs are full of implicit padding to properly align members.
+ We can't clean that up without breaking ABI, so tell clang not to bother
+ complaining about it. */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+typedef char *XPointer;
+
+#define Bool int
+#define Status int
+#define True 1
+#define False 0
+
+#define QueuedAlready 0
+#define QueuedAfterReading 1
+#define QueuedAfterFlush 2
+
+#define ConnectionNumber(dpy) (((_XPrivDisplay)(dpy))->fd)
+#define RootWindow(dpy, scr) (ScreenOfDisplay(dpy,scr)->root)
+#define DefaultScreen(dpy) (((_XPrivDisplay)(dpy))->default_screen)
+#define DefaultRootWindow(dpy) (ScreenOfDisplay(dpy,DefaultScreen(dpy))->root)
+#define DefaultVisual(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_visual)
+#define DefaultGC(dpy, scr) (ScreenOfDisplay(dpy,scr)->default_gc)
+#define BlackPixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->black_pixel)
+#define WhitePixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->white_pixel)
+#define AllPlanes ((unsigned long)~0L)
+#define QLength(dpy) (((_XPrivDisplay)(dpy))->qlen)
+#define DisplayWidth(dpy, scr) (ScreenOfDisplay(dpy,scr)->width)
+#define DisplayHeight(dpy, scr) (ScreenOfDisplay(dpy,scr)->height)
+#define DisplayWidthMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mwidth)
+#define DisplayHeightMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mheight)
+#define DisplayPlanes(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth)
+#define DisplayCells(dpy, scr) (DefaultVisual(dpy,scr)->map_entries)
+#define ScreenCount(dpy) (((_XPrivDisplay)(dpy))->nscreens)
+#define ServerVendor(dpy) (((_XPrivDisplay)(dpy))->vendor)
+#define ProtocolVersion(dpy) (((_XPrivDisplay)(dpy))->proto_major_version)
+#define ProtocolRevision(dpy) (((_XPrivDisplay)(dpy))->proto_minor_version)
+#define VendorRelease(dpy) (((_XPrivDisplay)(dpy))->release)
+#define DisplayString(dpy) (((_XPrivDisplay)(dpy))->display_name)
+#define DefaultDepth(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth)
+#define DefaultColormap(dpy, scr)(ScreenOfDisplay(dpy,scr)->cmap)
+#define BitmapUnit(dpy) (((_XPrivDisplay)(dpy))->bitmap_unit)
+#define BitmapBitOrder(dpy) (((_XPrivDisplay)(dpy))->bitmap_bit_order)
+#define BitmapPad(dpy) (((_XPrivDisplay)(dpy))->bitmap_pad)
+#define ImageByteOrder(dpy) (((_XPrivDisplay)(dpy))->byte_order)
+#define NextRequest(dpy) (((_XPrivDisplay)(dpy))->request + 1)
+#define LastKnownRequestProcessed(dpy) (((_XPrivDisplay)(dpy))->last_request_read)
+
+/* macros for screen oriented applications (toolkit) */
+#define ScreenOfDisplay(dpy, scr)(&((_XPrivDisplay)(dpy))->screens[scr])
+#define DefaultScreenOfDisplay(dpy) ScreenOfDisplay(dpy,DefaultScreen(dpy))
+#define DisplayOfScreen(s) ((s)->display)
+#define RootWindowOfScreen(s) ((s)->root)
+#define BlackPixelOfScreen(s) ((s)->black_pixel)
+#define WhitePixelOfScreen(s) ((s)->white_pixel)
+#define DefaultColormapOfScreen(s)((s)->cmap)
+#define DefaultDepthOfScreen(s) ((s)->root_depth)
+#define DefaultGCOfScreen(s) ((s)->default_gc)
+#define DefaultVisualOfScreen(s)((s)->root_visual)
+#define WidthOfScreen(s) ((s)->width)
+#define HeightOfScreen(s) ((s)->height)
+#define WidthMMOfScreen(s) ((s)->mwidth)
+#define HeightMMOfScreen(s) ((s)->mheight)
+#define PlanesOfScreen(s) ((s)->root_depth)
+#define CellsOfScreen(s) (DefaultVisualOfScreen((s))->map_entries)
+#define MinCmapsOfScreen(s) ((s)->min_maps)
+#define MaxCmapsOfScreen(s) ((s)->max_maps)
+#define DoesSaveUnders(s) ((s)->save_unders)
+#define DoesBackingStore(s) ((s)->backing_store)
+#define EventMaskOfScreen(s) ((s)->root_input_mask)
+
+/*
+ * Extensions need a way to hang private data on some structures.
+ */
+typedef struct _XExtData {
+ int number; /* number returned by XRegisterExtension */
+ struct _XExtData *next; /* next item on list of data for structure */
+ int (*free_private)( /* called to free private storage */
+ struct _XExtData *extension
+ );
+ XPointer private_data; /* data private to this extension. */
+} XExtData;
+
+/*
+ * This file contains structures used by the extension mechanism.
+ */
+typedef struct { /* public to extension, cannot be changed */
+ int extension; /* extension number */
+ int major_opcode; /* major op-code assigned by server */
+ int first_event; /* first event number for the extension */
+ int first_error; /* first error number for the extension */
+} XExtCodes;
+
+/*
+ * Data structure for retrieving info about pixmap formats.
+ */
+
+typedef struct {
+ int depth;
+ int bits_per_pixel;
+ int scanline_pad;
+} XPixmapFormatValues;
+
+
+/*
+ * Data structure for setting graphics context.
+ */
+typedef struct {
+ int function; /* logical operation */
+ unsigned long plane_mask;/* plane mask */
+ unsigned long foreground;/* foreground pixel */
+ unsigned long background;/* background pixel */
+ int line_width; /* line width */
+ int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */
+ int cap_style; /* CapNotLast, CapButt,
+ CapRound, CapProjecting */
+ int join_style; /* JoinMiter, JoinRound, JoinBevel */
+ int fill_style; /* FillSolid, FillTiled,
+ FillStippled, FillOpaqueStippled */
+ int fill_rule; /* EvenOddRule, WindingRule */
+ int arc_mode; /* ArcChord, ArcPieSlice */
+ Pixmap tile; /* tile pixmap for tiling operations */
+ Pixmap stipple; /* stipple 1 plane pixmap for stippling */
+ int ts_x_origin; /* offset for tile or stipple operations */
+ int ts_y_origin;
+ Font font; /* default text font for text operations */
+ int subwindow_mode; /* ClipByChildren, IncludeInferiors */
+ Bool graphics_exposures;/* boolean, should exposures be generated */
+ int clip_x_origin; /* origin for clipping */
+ int clip_y_origin;
+ Pixmap clip_mask; /* bitmap clipping; other calls for rects */
+ int dash_offset; /* patterned/dashed line information */
+ char dashes;
+} XGCValues;
+
+/*
+ * Graphics context. The contents of this structure are implementation
+ * dependent. A GC should be treated as opaque by application code.
+ */
+
+typedef struct _XGC
+#ifdef XLIB_ILLEGAL_ACCESS
+{
+ XExtData *ext_data; /* hook for extension to hang data */
+ GContext gid; /* protocol ID for graphics context */
+ /* there is more to this structure, but it is private to Xlib */
+}
+#endif
+*GC;
+
+/*
+ * Visual structure; contains information about colormapping possible.
+ */
+typedef struct {
+ XExtData *ext_data; /* hook for extension to hang data */
+ VisualID visualid; /* visual id of this visual */
+#if defined(__cplusplus) || defined(c_plusplus)
+ int c_class; /* C++ class of screen (monochrome, etc.) */
+#else
+ int class; /* class of screen (monochrome, etc.) */
+#endif
+ unsigned long red_mask, green_mask, blue_mask; /* mask values */
+ int bits_per_rgb; /* log base 2 of distinct color values */
+ int map_entries; /* color map entries */
+} Visual;
+
+/*
+ * Depth structure; contains information for each possible depth.
+ */
+typedef struct {
+ int depth; /* this depth (Z) of the depth */
+ int nvisuals; /* number of Visual types at this depth */
+ Visual *visuals; /* list of visuals possible at this depth */
+} Depth;
+
+/*
+ * Information about the screen. The contents of this structure are
+ * implementation dependent. A Screen should be treated as opaque
+ * by application code.
+ */
+
+struct _XDisplay; /* Forward declare before use for C++ */
+
+typedef struct {
+ XExtData *ext_data; /* hook for extension to hang data */
+ struct _XDisplay *display;/* back pointer to display structure */
+ Window root; /* Root window id. */
+ int width, height; /* width and height of screen */
+ int mwidth, mheight; /* width and height of in millimeters */
+ int ndepths; /* number of depths possible */
+ Depth *depths; /* list of allowable depths on the screen */
+ int root_depth; /* bits per pixel */
+ Visual *root_visual; /* root visual */
+ GC default_gc; /* GC for the root root visual */
+ Colormap cmap; /* default color map */
+ unsigned long white_pixel;
+ unsigned long black_pixel; /* White and Black pixel values */
+ int max_maps, min_maps; /* max and min color maps */
+ int backing_store; /* Never, WhenMapped, Always */
+ Bool save_unders;
+ long root_input_mask; /* initial root input mask */
+} Screen;
+
+/*
+ * Format structure; describes ZFormat data the screen will understand.
+ */
+typedef struct {
+ XExtData *ext_data; /* hook for extension to hang data */
+ int depth; /* depth of this image format */
+ int bits_per_pixel; /* bits/pixel at this depth */
+ int scanline_pad; /* scanline must padded to this multiple */
+} ScreenFormat;
+
+/*
+ * Data structure for setting window attributes.
+ */
+typedef struct {
+ Pixmap background_pixmap; /* background or None or ParentRelative */
+ unsigned long background_pixel; /* background pixel */
+ Pixmap border_pixmap; /* border of the window */
+ unsigned long border_pixel; /* border pixel value */
+ int bit_gravity; /* one of bit gravity values */
+ int win_gravity; /* one of the window gravity values */
+ int backing_store; /* NotUseful, WhenMapped, Always */
+ unsigned long backing_planes;/* planes to be preserved if possible */
+ unsigned long backing_pixel;/* value to use in restoring planes */
+ Bool save_under; /* should bits under be saved? (popups) */
+ long event_mask; /* set of events that should be saved */
+ long do_not_propagate_mask; /* set of events that should not propagate */
+ Bool override_redirect; /* boolean value for override-redirect */
+ Colormap colormap; /* color map to be associated with window */
+ Cursor cursor; /* cursor to be displayed (or None) */
+} XSetWindowAttributes;
+
+typedef struct {
+ int x, y; /* location of window */
+ int width, height; /* width and height of window */
+ int border_width; /* border width of window */
+ int depth; /* depth of window */
+ Visual *visual; /* the associated visual structure */
+ Window root; /* root of screen containing window */
+#if defined(__cplusplus) || defined(c_plusplus)
+ int c_class; /* C++ InputOutput, InputOnly*/
+#else
+ int class; /* InputOutput, InputOnly*/
+#endif
+ int bit_gravity; /* one of bit gravity values */
+ int win_gravity; /* one of the window gravity values */
+ int backing_store; /* NotUseful, WhenMapped, Always */
+ unsigned long backing_planes;/* planes to be preserved if possible */
+ unsigned long backing_pixel;/* value to be used when restoring planes */
+ Bool save_under; /* boolean, should bits under be saved? */
+ Colormap colormap; /* color map to be associated with window */
+ Bool map_installed; /* boolean, is color map currently installed*/
+ int map_state; /* IsUnmapped, IsUnviewable, IsViewable */
+ long all_event_masks; /* set of events all people have interest in*/
+ long your_event_mask; /* my event mask */
+ long do_not_propagate_mask; /* set of events that should not propagate */
+ Bool override_redirect; /* boolean value for override-redirect */
+ Screen *screen; /* back pointer to correct screen */
+} XWindowAttributes;
+
+/*
+ * Data structure for host setting; getting routines.
+ *
+ */
+
+typedef struct {
+ int family; /* for example FamilyInternet */
+ int length; /* length of address, in bytes */
+ char *address; /* pointer to where to find the bytes */
+} XHostAddress;
+
+/*
+ * Data structure for ServerFamilyInterpreted addresses in host routines
+ */
+typedef struct {
+ int typelength; /* length of type string, in bytes */
+ int valuelength; /* length of value string, in bytes */
+ char *type; /* pointer to where to find the type string */
+ char *value; /* pointer to where to find the address */
+} XServerInterpretedAddress;
+
+/*
+ * Data structure for "image" data, used by image manipulation routines.
+ */
+typedef struct _XImage {
+ int width, height; /* size of image */
+ int xoffset; /* number of pixels offset in X direction */
+ int format; /* XYBitmap, XYPixmap, ZPixmap */
+ char *data; /* pointer to image data */
+ int byte_order; /* data byte order, LSBFirst, MSBFirst */
+ int bitmap_unit; /* quant. of scanline 8, 16, 32 */
+ int bitmap_bit_order; /* LSBFirst, MSBFirst */
+ int bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */
+ int depth; /* depth of image */
+ int bytes_per_line; /* accelerator to next line */
+ int bits_per_pixel; /* bits per pixel (ZPixmap) */
+ unsigned long red_mask; /* bits in z arrangement */
+ unsigned long green_mask;
+ unsigned long blue_mask;
+ XPointer obdata; /* hook for the object routines to hang on */
+ struct funcs { /* image manipulation routines */
+ struct _XImage *(*create_image)(
+ struct _XDisplay* /* display */,
+ Visual* /* visual */,
+ unsigned int /* depth */,
+ int /* format */,
+ int /* offset */,
+ char* /* data */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ int /* bitmap_pad */,
+ int /* bytes_per_line */);
+ int (*destroy_image) (struct _XImage *);
+ unsigned long (*get_pixel) (struct _XImage *, int, int);
+ int (*put_pixel) (struct _XImage *, int, int, unsigned long);
+ struct _XImage *(*sub_image)(struct _XImage *, int, int, unsigned int, unsigned int);
+ int (*add_pixel) (struct _XImage *, long);
+ } f;
+} XImage;
+
+/*
+ * Data structure for XReconfigureWindow
+ */
+typedef struct {
+ int x, y;
+ int width, height;
+ int border_width;
+ Window sibling;
+ int stack_mode;
+} XWindowChanges;
+
+/*
+ * Data structure used by color operations
+ */
+typedef struct {
+ unsigned long pixel;
+ unsigned short red, green, blue;
+ char flags; /* do_red, do_green, do_blue */
+ char pad;
+} XColor;
+
+/*
+ * Data structures for graphics operations. On most machines, these are
+ * congruent with the wire protocol structures, so reformatting the data
+ * can be avoided on these architectures.
+ */
+typedef struct {
+ short x1, y1, x2, y2;
+} XSegment;
+
+typedef struct {
+ short x, y;
+} XPoint;
+
+typedef struct {
+ short x, y;
+ unsigned short width, height;
+} XRectangle;
+
+typedef struct {
+ short x, y;
+ unsigned short width, height;
+ short angle1, angle2;
+} XArc;
+
+
+/* Data structure for XChangeKeyboardControl */
+
+typedef struct {
+ int key_click_percent;
+ int bell_percent;
+ int bell_pitch;
+ int bell_duration;
+ int led;
+ int led_mode;
+ int key;
+ int auto_repeat_mode; /* On, Off, Default */
+} XKeyboardControl;
+
+/* Data structure for XGetKeyboardControl */
+
+typedef struct {
+ int key_click_percent;
+ int bell_percent;
+ unsigned int bell_pitch, bell_duration;
+ unsigned long led_mask;
+ int global_auto_repeat;
+ char auto_repeats[32];
+} XKeyboardState;
+
+/* Data structure for XGetMotionEvents. */
+
+typedef struct {
+ Time time;
+ short x, y;
+} XTimeCoord;
+
+/* Data structure for X{Set,Get}ModifierMapping */
+
+typedef struct {
+ int max_keypermod; /* The server's max # of keys per modifier */
+ KeyCode *modifiermap; /* An 8 by max_keypermod array of modifiers */
+} XModifierKeymap;
+
+
+/*
+ * Display datatype maintaining display specific data.
+ * The contents of this structure are implementation dependent.
+ * A Display should be treated as opaque by application code.
+ */
+#ifndef XLIB_ILLEGAL_ACCESS
+typedef struct _XDisplay Display;
+#endif
+
+struct _XPrivate; /* Forward declare before use for C++ */
+struct _XrmHashBucketRec;
+
+typedef struct
+#ifdef XLIB_ILLEGAL_ACCESS
+_XDisplay
+#endif
+{
+ XExtData *ext_data; /* hook for extension to hang data */
+ struct _XPrivate *private1;
+ int fd; /* Network socket. */
+ int private2;
+ int proto_major_version;/* major version of server's X protocol */
+ int proto_minor_version;/* minor version of servers X protocol */
+ char *vendor; /* vendor of the server hardware */
+ XID private3;
+ XID private4;
+ XID private5;
+ int private6;
+ XID (*resource_alloc)( /* allocator function */
+ struct _XDisplay*
+ );
+ int byte_order; /* screen byte order, LSBFirst, MSBFirst */
+ int bitmap_unit; /* padding and data requirements */
+ int bitmap_pad; /* padding requirements on bitmaps */
+ int bitmap_bit_order; /* LeastSignificant or MostSignificant */
+ int nformats; /* number of pixmap formats in list */
+ ScreenFormat *pixmap_format; /* pixmap format list */
+ int private8;
+ int release; /* release of the server */
+ struct _XPrivate *private9, *private10;
+ int qlen; /* Length of input event queue */
+ unsigned long last_request_read; /* seq number of last event read */
+ unsigned long request; /* sequence number of last request. */
+ XPointer private11;
+ XPointer private12;
+ XPointer private13;
+ XPointer private14;
+ unsigned max_request_size; /* maximum number 32 bit words in request*/
+ struct _XrmHashBucketRec *db;
+ int (*private15)(
+ struct _XDisplay*
+ );
+ char *display_name; /* "host:display" string used on this connect*/
+ int default_screen; /* default screen for operations */
+ int nscreens; /* number of screens on this server*/
+ Screen *screens; /* pointer to list of screens */
+ unsigned long motion_buffer; /* size of motion buffer */
+ unsigned long private16;
+ int min_keycode; /* minimum defined keycode */
+ int max_keycode; /* maximum defined keycode */
+ XPointer private17;
+ XPointer private18;
+ int private19;
+ char *xdefaults; /* contents of defaults from server */
+ /* there is more to this structure, but it is private to Xlib */
+}
+#ifdef XLIB_ILLEGAL_ACCESS
+Display,
+#endif
+*_XPrivDisplay;
+
+#undef _XEVENT_
+#ifndef _XEVENT_
+/*
+ * Definitions of specific events.
+ */
+typedef struct {
+ int type; /* of event */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* "event" window it is reported relative to */
+ Window root; /* root window that the event occurred on */
+ Window subwindow; /* child window */
+ Time time; /* milliseconds */
+ int x, y; /* pointer x, y coordinates in event window */
+ int x_root, y_root; /* coordinates relative to root */
+ unsigned int state; /* key or button mask */
+ unsigned int keycode; /* detail */
+ Bool same_screen; /* same screen flag */
+} XKeyEvent;
+typedef XKeyEvent XKeyPressedEvent;
+typedef XKeyEvent XKeyReleasedEvent;
+
+typedef struct {
+ int type; /* of event */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* "event" window it is reported relative to */
+ Window root; /* root window that the event occurred on */
+ Window subwindow; /* child window */
+ Time time; /* milliseconds */
+ int x, y; /* pointer x, y coordinates in event window */
+ int x_root, y_root; /* coordinates relative to root */
+ unsigned int state; /* key or button mask */
+ unsigned int button; /* detail */
+ Bool same_screen; /* same screen flag */
+} XButtonEvent;
+typedef XButtonEvent XButtonPressedEvent;
+typedef XButtonEvent XButtonReleasedEvent;
+
+typedef struct {
+ int type; /* of event */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* "event" window reported relative to */
+ Window root; /* root window that the event occurred on */
+ Window subwindow; /* child window */
+ Time time; /* milliseconds */
+ int x, y; /* pointer x, y coordinates in event window */
+ int x_root, y_root; /* coordinates relative to root */
+ unsigned int state; /* key or button mask */
+ char is_hint; /* detail */
+ Bool same_screen; /* same screen flag */
+} XMotionEvent;
+typedef XMotionEvent XPointerMovedEvent;
+
+typedef struct {
+ int type; /* of event */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* "event" window reported relative to */
+ Window root; /* root window that the event occurred on */
+ Window subwindow; /* child window */
+ Time time; /* milliseconds */
+ int x, y; /* pointer x, y coordinates in event window */
+ int x_root, y_root; /* coordinates relative to root */
+ int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */
+ int detail;
+ /*
+ * NotifyAncestor, NotifyVirtual, NotifyInferior,
+ * NotifyNonlinear,NotifyNonlinearVirtual
+ */
+ Bool same_screen; /* same screen flag */
+ Bool focus; /* boolean focus */
+ unsigned int state; /* key or button mask */
+} XCrossingEvent;
+typedef XCrossingEvent XEnterWindowEvent;
+typedef XCrossingEvent XLeaveWindowEvent;
+
+typedef struct {
+ int type; /* FocusIn or FocusOut */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* window of event */
+ int mode; /* NotifyNormal, NotifyWhileGrabbed,
+ NotifyGrab, NotifyUngrab */
+ int detail;
+ /*
+ * NotifyAncestor, NotifyVirtual, NotifyInferior,
+ * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
+ * NotifyPointerRoot, NotifyDetailNone
+ */
+} XFocusChangeEvent;
+typedef XFocusChangeEvent XFocusInEvent;
+typedef XFocusChangeEvent XFocusOutEvent;
+
+/* generated on EnterWindow and FocusIn when KeyMapState selected */
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window;
+ char key_vector[32];
+} XKeymapEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window;
+ int x, y;
+ int width, height;
+ int count; /* if non-zero, at least this many more */
+} XExposeEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Drawable drawable;
+ int x, y;
+ int width, height;
+ int count; /* if non-zero, at least this many more */
+ int major_code; /* core is CopyArea or CopyPlane */
+ int minor_code; /* not defined in the core */
+} XGraphicsExposeEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Drawable drawable;
+ int major_code; /* core is CopyArea or CopyPlane */
+ int minor_code; /* not defined in the core */
+} XNoExposeEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window;
+ int state; /* Visibility state */
+} XVisibilityEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window parent; /* parent of the window */
+ Window window; /* window id of window created */
+ int x, y; /* window location */
+ int width, height; /* size of window */
+ int border_width; /* border width */
+ Bool override_redirect; /* creation should be overridden */
+} XCreateWindowEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window event;
+ Window window;
+} XDestroyWindowEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window event;
+ Window window;
+ Bool from_configure;
+} XUnmapEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window event;
+ Window window;
+ Bool override_redirect; /* boolean, is override set... */
+} XMapEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window parent;
+ Window window;
+} XMapRequestEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window event;
+ Window window;
+ Window parent;
+ int x, y;
+ Bool override_redirect;
+} XReparentEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window event;
+ Window window;
+ int x, y;
+ int width, height;
+ int border_width;
+ Window above;
+ Bool override_redirect;
+} XConfigureEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window event;
+ Window window;
+ int x, y;
+} XGravityEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window;
+ int width, height;
+} XResizeRequestEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window parent;
+ Window window;
+ int x, y;
+ int width, height;
+ int border_width;
+ Window above;
+ int detail; /* Above, Below, TopIf, BottomIf, Opposite */
+ unsigned long value_mask;
+} XConfigureRequestEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window event;
+ Window window;
+ int place; /* PlaceOnTop, PlaceOnBottom */
+} XCirculateEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window parent;
+ Window window;
+ int place; /* PlaceOnTop, PlaceOnBottom */
+} XCirculateRequestEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window;
+ Atom atom;
+ Time time;
+ int state; /* NewValue, Deleted */
+} XPropertyEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window;
+ Atom selection;
+ Time time;
+} XSelectionClearEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window owner;
+ Window requestor;
+ Atom selection;
+ Atom target;
+ Atom property;
+ Time time;
+} XSelectionRequestEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window requestor;
+ Atom selection;
+ Atom target;
+ Atom property; /* ATOM or None */
+ Time time;
+} XSelectionEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window;
+ Colormap colormap; /* COLORMAP or None */
+#if defined(__cplusplus) || defined(c_plusplus)
+ Bool c_new; /* C++ */
+#else
+ Bool new;
+#endif
+ int state; /* ColormapInstalled, ColormapUninstalled */
+} XColormapEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window;
+ Atom message_type;
+ int format;
+ union {
+ char b[20];
+ short s[10];
+ long l[5];
+ } data;
+} XClientMessageEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* unused */
+ int request; /* one of MappingModifier, MappingKeyboard,
+ MappingPointer */
+ int first_keycode; /* first keycode */
+ int count; /* defines range of change w. first_keycode*/
+} XMappingEvent;
+
+typedef struct {
+ int type;
+ Display *display; /* Display the event was read from */
+ XID resourceid; /* resource id */
+ unsigned long serial; /* serial number of failed request */
+ unsigned char error_code; /* error code of failed request */
+ unsigned char request_code; /* Major op-code of failed request */
+ unsigned char minor_code; /* Minor op-code of failed request */
+} XErrorEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display;/* Display the event was read from */
+ Window window; /* window on which event was requested in event mask */
+} XAnyEvent;
+
+
+/***************************************************************
+ *
+ * GenericEvent. This event is the standard event for all newer extensions.
+ */
+
+typedef struct
+ {
+ int type; /* of event. Always GenericEvent */
+ unsigned long serial; /* # of last request processed */
+ Bool send_event; /* true if from SendEvent request */
+ Display *display; /* Display the event was read from */
+ int extension; /* major opcode of extension that caused the event */
+ int evtype; /* actual event type. */
+ } XGenericEvent;
+
+typedef struct {
+ int type; /* of event. Always GenericEvent */
+ unsigned long serial; /* # of last request processed */
+ Bool send_event; /* true if from SendEvent request */
+ Display *display; /* Display the event was read from */
+ int extension; /* major opcode of extension that caused the event */
+ int evtype; /* actual event type. */
+ unsigned int cookie;
+ void *data;
+} XGenericEventCookie;
+
+/*
+ * this union is defined so Xlib can always use the same sized
+ * event structure internally, to avoid memory fragmentation.
+ */
+typedef union _XEvent {
+ int type; /* must not be changed; first element */
+ XAnyEvent xany;
+ XKeyEvent xkey;
+ XButtonEvent xbutton;
+ XMotionEvent xmotion;
+ XCrossingEvent xcrossing;
+ XFocusChangeEvent xfocus;
+ XExposeEvent xexpose;
+ XGraphicsExposeEvent xgraphicsexpose;
+ XNoExposeEvent xnoexpose;
+ XVisibilityEvent xvisibility;
+ XCreateWindowEvent xcreatewindow;
+ XDestroyWindowEvent xdestroywindow;
+ XUnmapEvent xunmap;
+ XMapEvent xmap;
+ XMapRequestEvent xmaprequest;
+ XReparentEvent xreparent;
+ XConfigureEvent xconfigure;
+ XGravityEvent xgravity;
+ XResizeRequestEvent xresizerequest;
+ XConfigureRequestEvent xconfigurerequest;
+ XCirculateEvent xcirculate;
+ XCirculateRequestEvent xcirculaterequest;
+ XPropertyEvent xproperty;
+ XSelectionClearEvent xselectionclear;
+ XSelectionRequestEvent xselectionrequest;
+ XSelectionEvent xselection;
+ XColormapEvent xcolormap;
+ XClientMessageEvent xclient;
+ XMappingEvent xmapping;
+ XErrorEvent xerror;
+ XKeymapEvent xkeymap;
+ XGenericEvent xgeneric;
+ XGenericEventCookie xcookie;
+ long pad[24];
+} XEvent;
+#endif
+
+#define XAllocID(dpy) ((*((_XPrivDisplay)(dpy))->resource_alloc)((dpy)))
+
+/*
+ * per character font metric information.
+ */
+typedef struct {
+ short lbearing; /* origin to left edge of raster */
+ short rbearing; /* origin to right edge of raster */
+ short width; /* advance to next char's origin */
+ short ascent; /* baseline to top edge of raster */
+ short descent; /* baseline to bottom edge of raster */
+ unsigned short attributes; /* per char flags (not predefined) */
+} XCharStruct;
+
+/*
+ * To allow arbitrary information with fonts, there are additional properties
+ * returned.
+ */
+typedef struct {
+ Atom name;
+ unsigned long card32;
+} XFontProp;
+
+typedef struct {
+ XExtData *ext_data; /* hook for extension to hang data */
+ Font fid; /* Font id for this font */
+ unsigned direction; /* hint about direction the font is painted */
+ unsigned min_char_or_byte2;/* first character */
+ unsigned max_char_or_byte2;/* last character */
+ unsigned min_byte1; /* first row that exists */
+ unsigned max_byte1; /* last row that exists */
+ Bool all_chars_exist;/* flag if all characters have non-zero size*/
+ unsigned default_char; /* char to print for undefined character */
+ int n_properties; /* how many properties there are */
+ XFontProp *properties; /* pointer to array of additional properties*/
+ XCharStruct min_bounds; /* minimum bounds over all existing char*/
+ XCharStruct max_bounds; /* maximum bounds over all existing char*/
+ XCharStruct *per_char; /* first_char to last_char information */
+ int ascent; /* log. extent above baseline for spacing */
+ int descent; /* log. descent below baseline for spacing */
+} XFontStruct;
+
+/*
+ * PolyText routines take these as arguments.
+ */
+typedef struct {
+ char *chars; /* pointer to string */
+ int nchars; /* number of characters */
+ int delta; /* delta between strings */
+ Font font; /* font to print it in, None don't change */
+} XTextItem;
+
+typedef struct { /* normal 16 bit characters are two bytes */
+ unsigned char byte1;
+ unsigned char byte2;
+} XChar2b;
+
+typedef struct {
+ XChar2b *chars; /* two byte characters */
+ int nchars; /* number of characters */
+ int delta; /* delta between strings */
+ Font font; /* font to print it in, None don't change */
+} XTextItem16;
+
+
+typedef union { Display *display;
+ GC gc;
+ Visual *visual;
+ Screen *screen;
+ ScreenFormat *pixmap_format;
+ XFontStruct *font; } XEDataObject;
+
+typedef struct {
+ XRectangle max_ink_extent;
+ XRectangle max_logical_extent;
+} XFontSetExtents;
+
+/* unused:
+typedef void (*XOMProc)();
+ */
+
+typedef struct _XOM *XOM;
+typedef struct _XOC *XOC, *XFontSet;
+
+typedef struct {
+ char *chars;
+ int nchars;
+ int delta;
+ XFontSet font_set;
+} XmbTextItem;
+
+typedef struct {
+ wchar_t *chars;
+ int nchars;
+ int delta;
+ XFontSet font_set;
+} XwcTextItem;
+
+#define XNRequiredCharSet "requiredCharSet"
+#define XNQueryOrientation "queryOrientation"
+#define XNBaseFontName "baseFontName"
+#define XNOMAutomatic "omAutomatic"
+#define XNMissingCharSet "missingCharSet"
+#define XNDefaultString "defaultString"
+#define XNOrientation "orientation"
+#define XNDirectionalDependentDrawing "directionalDependentDrawing"
+#define XNContextualDrawing "contextualDrawing"
+#define XNFontInfo "fontInfo"
+
+typedef struct {
+ int charset_count;
+ char **charset_list;
+} XOMCharSetList;
+
+typedef enum {
+ XOMOrientation_LTR_TTB,
+ XOMOrientation_RTL_TTB,
+ XOMOrientation_TTB_LTR,
+ XOMOrientation_TTB_RTL,
+ XOMOrientation_Context
+} XOrientation;
+
+typedef struct {
+ int num_orientation;
+ XOrientation *orientation; /* Input Text description */
+} XOMOrientation;
+
+typedef struct {
+ int num_font;
+ XFontStruct **font_struct_list;
+ char **font_name_list;
+} XOMFontInfo;
+
+typedef struct _XIM *XIM;
+typedef struct _XIC *XIC;
+
+typedef void (*XIMProc)(
+ XIM,
+ XPointer,
+ XPointer
+);
+
+typedef Bool (*XICProc)(
+ XIC,
+ XPointer,
+ XPointer
+);
+
+typedef void (*XIDProc)(
+ Display*,
+ XPointer,
+ XPointer
+);
+
+typedef unsigned long XIMStyle;
+
+typedef struct {
+ unsigned short count_styles;
+ XIMStyle *supported_styles;
+} XIMStyles;
+
+#define XIMPreeditArea 0x0001L
+#define XIMPreeditCallbacks 0x0002L
+#define XIMPreeditPosition 0x0004L
+#define XIMPreeditNothing 0x0008L
+#define XIMPreeditNone 0x0010L
+#define XIMStatusArea 0x0100L
+#define XIMStatusCallbacks 0x0200L
+#define XIMStatusNothing 0x0400L
+#define XIMStatusNone 0x0800L
+
+#define XNVaNestedList "XNVaNestedList"
+#define XNQueryInputStyle "queryInputStyle"
+#define XNClientWindow "clientWindow"
+#define XNInputStyle "inputStyle"
+#define XNFocusWindow "focusWindow"
+#define XNResourceName "resourceName"
+#define XNResourceClass "resourceClass"
+#define XNGeometryCallback "geometryCallback"
+#define XNDestroyCallback "destroyCallback"
+#define XNFilterEvents "filterEvents"
+#define XNPreeditStartCallback "preeditStartCallback"
+#define XNPreeditDoneCallback "preeditDoneCallback"
+#define XNPreeditDrawCallback "preeditDrawCallback"
+#define XNPreeditCaretCallback "preeditCaretCallback"
+#define XNPreeditStateNotifyCallback "preeditStateNotifyCallback"
+#define XNPreeditAttributes "preeditAttributes"
+#define XNStatusStartCallback "statusStartCallback"
+#define XNStatusDoneCallback "statusDoneCallback"
+#define XNStatusDrawCallback "statusDrawCallback"
+#define XNStatusAttributes "statusAttributes"
+#define XNArea "area"
+#define XNAreaNeeded "areaNeeded"
+#define XNSpotLocation "spotLocation"
+#define XNColormap "colorMap"
+#define XNStdColormap "stdColorMap"
+#define XNForeground "foreground"
+#define XNBackground "background"
+#define XNBackgroundPixmap "backgroundPixmap"
+#define XNFontSet "fontSet"
+#define XNLineSpace "lineSpace"
+#define XNCursor "cursor"
+
+#define XNQueryIMValuesList "queryIMValuesList"
+#define XNQueryICValuesList "queryICValuesList"
+#define XNVisiblePosition "visiblePosition"
+#define XNR6PreeditCallback "r6PreeditCallback"
+#define XNStringConversionCallback "stringConversionCallback"
+#define XNStringConversion "stringConversion"
+#define XNResetState "resetState"
+#define XNHotKey "hotKey"
+#define XNHotKeyState "hotKeyState"
+#define XNPreeditState "preeditState"
+#define XNSeparatorofNestedList "separatorofNestedList"
+
+#define XBufferOverflow -1
+#define XLookupNone 1
+#define XLookupChars 2
+#define XLookupKeySym 3
+#define XLookupBoth 4
+
+typedef void *XVaNestedList;
+
+typedef struct {
+ XPointer client_data;
+ XIMProc callback;
+} XIMCallback;
+
+typedef struct {
+ XPointer client_data;
+ XICProc callback;
+} XICCallback;
+
+typedef unsigned long XIMFeedback;
+
+#define XIMReverse 1L
+#define XIMUnderline (1L<<1)
+#define XIMHighlight (1L<<2)
+#define XIMPrimary (1L<<5)
+#define XIMSecondary (1L<<6)
+#define XIMTertiary (1L<<7)
+#define XIMVisibleToForward (1L<<8)
+#define XIMVisibleToBackword (1L<<9)
+#define XIMVisibleToCenter (1L<<10)
+
+typedef struct _XIMText {
+ unsigned short length;
+ XIMFeedback *feedback;
+ Bool encoding_is_wchar;
+ union {
+ char *multi_byte;
+ wchar_t *wide_char;
+ } string;
+} XIMText;
+
+typedef unsigned long XIMPreeditState;
+
+#define XIMPreeditUnKnown 0L
+#define XIMPreeditEnable 1L
+#define XIMPreeditDisable (1L<<1)
+
+typedef struct _XIMPreeditStateNotifyCallbackStruct {
+ XIMPreeditState state;
+} XIMPreeditStateNotifyCallbackStruct;
+
+typedef unsigned long XIMResetState;
+
+#define XIMInitialState 1L
+#define XIMPreserveState (1L<<1)
+
+typedef unsigned long XIMStringConversionFeedback;
+
+#define XIMStringConversionLeftEdge (0x00000001)
+#define XIMStringConversionRightEdge (0x00000002)
+#define XIMStringConversionTopEdge (0x00000004)
+#define XIMStringConversionBottomEdge (0x00000008)
+#define XIMStringConversionConcealed (0x00000010)
+#define XIMStringConversionWrapped (0x00000020)
+
+typedef struct _XIMStringConversionText {
+ unsigned short length;
+ XIMStringConversionFeedback *feedback;
+ Bool encoding_is_wchar;
+ union {
+ char *mbs;
+ wchar_t *wcs;
+ } string;
+} XIMStringConversionText;
+
+typedef unsigned short XIMStringConversionPosition;
+
+typedef unsigned short XIMStringConversionType;
+
+#define XIMStringConversionBuffer (0x0001)
+#define XIMStringConversionLine (0x0002)
+#define XIMStringConversionWord (0x0003)
+#define XIMStringConversionChar (0x0004)
+
+typedef unsigned short XIMStringConversionOperation;
+
+#define XIMStringConversionSubstitution (0x0001)
+#define XIMStringConversionRetrieval (0x0002)
+
+typedef enum {
+ XIMForwardChar, XIMBackwardChar,
+ XIMForwardWord, XIMBackwardWord,
+ XIMCaretUp, XIMCaretDown,
+ XIMNextLine, XIMPreviousLine,
+ XIMLineStart, XIMLineEnd,
+ XIMAbsolutePosition,
+ XIMDontChange
+} XIMCaretDirection;
+
+typedef struct _XIMStringConversionCallbackStruct {
+ XIMStringConversionPosition position;
+ XIMCaretDirection direction;
+ XIMStringConversionOperation operation;
+ unsigned short factor;
+ XIMStringConversionText *text;
+} XIMStringConversionCallbackStruct;
+
+typedef struct _XIMPreeditDrawCallbackStruct {
+ int caret; /* Cursor offset within pre-edit string */
+ int chg_first; /* Starting change position */
+ int chg_length; /* Length of the change in character count */
+ XIMText *text;
+} XIMPreeditDrawCallbackStruct;
+
+typedef enum {
+ XIMIsInvisible, /* Disable caret feedback */
+ XIMIsPrimary, /* UI defined caret feedback */
+ XIMIsSecondary /* UI defined caret feedback */
+} XIMCaretStyle;
+
+typedef struct _XIMPreeditCaretCallbackStruct {
+ int position; /* Caret offset within pre-edit string */
+ XIMCaretDirection direction; /* Caret moves direction */
+ XIMCaretStyle style; /* Feedback of the caret */
+} XIMPreeditCaretCallbackStruct;
+
+typedef enum {
+ XIMTextType,
+ XIMBitmapType
+} XIMStatusDataType;
+
+typedef struct _XIMStatusDrawCallbackStruct {
+ XIMStatusDataType type;
+ union {
+ XIMText *text;
+ Pixmap bitmap;
+ } data;
+} XIMStatusDrawCallbackStruct;
+
+typedef struct _XIMHotKeyTrigger {
+ KeySym keysym;
+ int modifier;
+ int modifier_mask;
+} XIMHotKeyTrigger;
+
+typedef struct _XIMHotKeyTriggers {
+ int num_hot_key;
+ XIMHotKeyTrigger *key;
+} XIMHotKeyTriggers;
+
+typedef unsigned long XIMHotKeyState;
+
+#define XIMHotKeyStateON (0x0001L)
+#define XIMHotKeyStateOFF (0x0002L)
+
+typedef struct {
+ unsigned short count_values;
+ char **supported_values;
+} XIMValuesList;
+
+_XFUNCPROTOBEGIN
+
+#if defined(WIN32) && !defined(_XLIBINT_)
+#define _Xdebug (*_Xdebug_p)
+#endif
+
+extern int _Xdebug;
+
+extern XFontStruct *XLoadQueryFont(
+ Display* /* display */,
+ _Xconst char* /* name */
+);
+
+extern XFontStruct *XQueryFont(
+ Display* /* display */,
+ XID /* font_ID */
+);
+
+
+extern XTimeCoord *XGetMotionEvents(
+ Display* /* display */,
+ Window /* w */,
+ Time /* start */,
+ Time /* stop */,
+ int* /* nevents_return */
+);
+
+extern XModifierKeymap *XDeleteModifiermapEntry(
+ XModifierKeymap* /* modmap */,
+#if NeedWidePrototypes
+ unsigned int /* keycode_entry */,
+#else
+ KeyCode /* keycode_entry */,
+#endif
+ int /* modifier */
+);
+
+extern XModifierKeymap *XGetModifierMapping(
+ Display* /* display */
+);
+
+extern XModifierKeymap *XInsertModifiermapEntry(
+ XModifierKeymap* /* modmap */,
+#if NeedWidePrototypes
+ unsigned int /* keycode_entry */,
+#else
+ KeyCode /* keycode_entry */,
+#endif
+ int /* modifier */
+);
+
+extern XModifierKeymap *XNewModifiermap(
+ int /* max_keys_per_mod */
+);
+
+extern XImage *XCreateImage(
+ Display* /* display */,
+ Visual* /* visual */,
+ unsigned int /* depth */,
+ int /* format */,
+ int /* offset */,
+ char* /* data */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ int /* bitmap_pad */,
+ int /* bytes_per_line */
+);
+extern Status XInitImage(
+ XImage* /* image */
+);
+extern XImage *XGetImage(
+ Display* /* display */,
+ Drawable /* d */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned long /* plane_mask */,
+ int /* format */
+);
+extern XImage *XGetSubImage(
+ Display* /* display */,
+ Drawable /* d */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned long /* plane_mask */,
+ int /* format */,
+ XImage* /* dest_image */,
+ int /* dest_x */,
+ int /* dest_y */
+);
+
+/*
+ * X function declarations.
+ */
+extern Display *XOpenDisplay(
+ _Xconst char* /* display_name */
+);
+
+extern void XrmInitialize(
+ void
+);
+
+extern char *XFetchBytes(
+ Display* /* display */,
+ int* /* nbytes_return */
+);
+extern char *XFetchBuffer(
+ Display* /* display */,
+ int* /* nbytes_return */,
+ int /* buffer */
+);
+extern char *XGetAtomName(
+ Display* /* display */,
+ Atom /* atom */
+);
+extern Status XGetAtomNames(
+ Display* /* dpy */,
+ Atom* /* atoms */,
+ int /* count */,
+ char** /* names_return */
+);
+extern char *XGetDefault(
+ Display* /* display */,
+ _Xconst char* /* program */,
+ _Xconst char* /* option */
+);
+extern char *XDisplayName(
+ _Xconst char* /* string */
+);
+extern char *XKeysymToString(
+ KeySym /* keysym */
+);
+
+extern int (*XSynchronize(
+ Display* /* display */,
+ Bool /* onoff */
+))(
+ Display* /* display */
+);
+extern int (*XSetAfterFunction(
+ Display* /* display */,
+ int (*) (
+ Display* /* display */
+ ) /* procedure */
+))(
+ Display* /* display */
+);
+extern Atom XInternAtom(
+ Display* /* display */,
+ _Xconst char* /* atom_name */,
+ Bool /* only_if_exists */
+);
+extern Status XInternAtoms(
+ Display* /* dpy */,
+ char** /* names */,
+ int /* count */,
+ Bool /* onlyIfExists */,
+ Atom* /* atoms_return */
+);
+extern Colormap XCopyColormapAndFree(
+ Display* /* display */,
+ Colormap /* colormap */
+);
+extern Colormap XCreateColormap(
+ Display* /* display */,
+ Window /* w */,
+ Visual* /* visual */,
+ int /* alloc */
+);
+extern Cursor XCreatePixmapCursor(
+ Display* /* display */,
+ Pixmap /* source */,
+ Pixmap /* mask */,
+ XColor* /* foreground_color */,
+ XColor* /* background_color */,
+ unsigned int /* x */,
+ unsigned int /* y */
+);
+extern Cursor XCreateGlyphCursor(
+ Display* /* display */,
+ Font /* source_font */,
+ Font /* mask_font */,
+ unsigned int /* source_char */,
+ unsigned int /* mask_char */,
+ XColor _Xconst * /* foreground_color */,
+ XColor _Xconst * /* background_color */
+);
+extern Cursor XCreateFontCursor(
+ Display* /* display */,
+ unsigned int /* shape */
+);
+extern Font XLoadFont(
+ Display* /* display */,
+ _Xconst char* /* name */
+);
+extern GC XCreateGC(
+ Display* /* display */,
+ Drawable /* d */,
+ unsigned long /* valuemask */,
+ XGCValues* /* values */
+);
+extern GContext XGContextFromGC(
+ GC /* gc */
+);
+extern void XFlushGC(
+ Display* /* display */,
+ GC /* gc */
+);
+extern Pixmap XCreatePixmap(
+ Display* /* display */,
+ Drawable /* d */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned int /* depth */
+);
+extern Pixmap XCreateBitmapFromData(
+ Display* /* display */,
+ Drawable /* d */,
+ _Xconst char* /* data */,
+ unsigned int /* width */,
+ unsigned int /* height */
+);
+extern Pixmap XCreatePixmapFromBitmapData(
+ Display* /* display */,
+ Drawable /* d */,
+ char* /* data */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned long /* fg */,
+ unsigned long /* bg */,
+ unsigned int /* depth */
+);
+extern Window XCreateSimpleWindow(
+ Display* /* display */,
+ Window /* parent */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned int /* border_width */,
+ unsigned long /* border */,
+ unsigned long /* background */
+);
+extern Window XGetSelectionOwner(
+ Display* /* display */,
+ Atom /* selection */
+);
+extern Window XCreateWindow(
+ Display* /* display */,
+ Window /* parent */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned int /* border_width */,
+ int /* depth */,
+ unsigned int /* class */,
+ Visual* /* visual */,
+ unsigned long /* valuemask */,
+ XSetWindowAttributes* /* attributes */
+);
+extern Colormap *XListInstalledColormaps(
+ Display* /* display */,
+ Window /* w */,
+ int* /* num_return */
+);
+extern char **XListFonts(
+ Display* /* display */,
+ _Xconst char* /* pattern */,
+ int /* maxnames */,
+ int* /* actual_count_return */
+);
+extern char **XListFontsWithInfo(
+ Display* /* display */,
+ _Xconst char* /* pattern */,
+ int /* maxnames */,
+ int* /* count_return */,
+ XFontStruct** /* info_return */
+);
+extern char **XGetFontPath(
+ Display* /* display */,
+ int* /* npaths_return */
+);
+extern char **XListExtensions(
+ Display* /* display */,
+ int* /* nextensions_return */
+);
+extern Atom *XListProperties(
+ Display* /* display */,
+ Window /* w */,
+ int* /* num_prop_return */
+);
+extern XHostAddress *XListHosts(
+ Display* /* display */,
+ int* /* nhosts_return */,
+ Bool* /* state_return */
+);
+_X_DEPRECATED
+extern KeySym XKeycodeToKeysym(
+ Display* /* display */,
+#if NeedWidePrototypes
+ unsigned int /* keycode */,
+#else
+ KeyCode /* keycode */,
+#endif
+ int /* index */
+);
+extern KeySym XLookupKeysym(
+ XKeyEvent* /* key_event */,
+ int /* index */
+);
+extern KeySym *XGetKeyboardMapping(
+ Display* /* display */,
+#if NeedWidePrototypes
+ unsigned int /* first_keycode */,
+#else
+ KeyCode /* first_keycode */,
+#endif
+ int /* keycode_count */,
+ int* /* keysyms_per_keycode_return */
+);
+extern KeySym XStringToKeysym(
+ _Xconst char* /* string */
+);
+extern long XMaxRequestSize(
+ Display* /* display */
+);
+extern long XExtendedMaxRequestSize(
+ Display* /* display */
+);
+extern char *XResourceManagerString(
+ Display* /* display */
+);
+extern char *XScreenResourceString(
+ Screen* /* screen */
+);
+extern unsigned long XDisplayMotionBufferSize(
+ Display* /* display */
+);
+extern VisualID XVisualIDFromVisual(
+ Visual* /* visual */
+);
+
+/* multithread routines */
+
+extern Status XInitThreads(
+ void
+);
+
+extern void XLockDisplay(
+ Display* /* display */
+);
+
+extern void XUnlockDisplay(
+ Display* /* display */
+);
+
+/* routines for dealing with extensions */
+
+extern XExtCodes *XInitExtension(
+ Display* /* display */,
+ _Xconst char* /* name */
+);
+
+extern XExtCodes *XAddExtension(
+ Display* /* display */
+);
+extern XExtData *XFindOnExtensionList(
+ XExtData** /* structure */,
+ int /* number */
+);
+extern XExtData **XEHeadOfExtensionList(
+ XEDataObject /* object */
+);
+
+/* these are routines for which there are also macros */
+extern Window XRootWindow(
+ Display* /* display */,
+ int /* screen_number */
+);
+extern Window XDefaultRootWindow(
+ Display* /* display */
+);
+extern Window XRootWindowOfScreen(
+ Screen* /* screen */
+);
+extern Visual *XDefaultVisual(
+ Display* /* display */,
+ int /* screen_number */
+);
+extern Visual *XDefaultVisualOfScreen(
+ Screen* /* screen */
+);
+extern GC XDefaultGC(
+ Display* /* display */,
+ int /* screen_number */
+);
+extern GC XDefaultGCOfScreen(
+ Screen* /* screen */
+);
+extern unsigned long XBlackPixel(
+ Display* /* display */,
+ int /* screen_number */
+);
+extern unsigned long XWhitePixel(
+ Display* /* display */,
+ int /* screen_number */
+);
+extern unsigned long XAllPlanes(
+ void
+);
+extern unsigned long XBlackPixelOfScreen(
+ Screen* /* screen */
+);
+extern unsigned long XWhitePixelOfScreen(
+ Screen* /* screen */
+);
+extern unsigned long XNextRequest(
+ Display* /* display */
+);
+extern unsigned long XLastKnownRequestProcessed(
+ Display* /* display */
+);
+extern char *XServerVendor(
+ Display* /* display */
+);
+extern char *XDisplayString(
+ Display* /* display */
+);
+extern Colormap XDefaultColormap(
+ Display* /* display */,
+ int /* screen_number */
+);
+extern Colormap XDefaultColormapOfScreen(
+ Screen* /* screen */
+);
+extern Display *XDisplayOfScreen(
+ Screen* /* screen */
+);
+extern Screen *XScreenOfDisplay(
+ Display* /* display */,
+ int /* screen_number */
+);
+extern Screen *XDefaultScreenOfDisplay(
+ Display* /* display */
+);
+extern long XEventMaskOfScreen(
+ Screen* /* screen */
+);
+
+extern int XScreenNumberOfScreen(
+ Screen* /* screen */
+);
+
+typedef int (*XErrorHandler) ( /* WARNING, this type not in Xlib spec */
+ Display* /* display */,
+ XErrorEvent* /* error_event */
+);
+
+extern XErrorHandler XSetErrorHandler (
+ XErrorHandler /* handler */
+);
+
+
+typedef int (*XIOErrorHandler) ( /* WARNING, this type not in Xlib spec */
+ Display* /* display */
+);
+
+extern XIOErrorHandler XSetIOErrorHandler (
+ XIOErrorHandler /* handler */
+);
+
+typedef void (*XIOErrorExitHandler) ( /* WARNING, this type not in Xlib spec */
+ Display*, /* display */
+ void* /* user_data */
+);
+
+extern void XSetIOErrorExitHandler (
+ Display*, /* display */
+ XIOErrorExitHandler, /* handler */
+ void* /* user_data */
+);
+
+extern XPixmapFormatValues *XListPixmapFormats(
+ Display* /* display */,
+ int* /* count_return */
+);
+extern int *XListDepths(
+ Display* /* display */,
+ int /* screen_number */,
+ int* /* count_return */
+);
+
+/* ICCCM routines for things that don't require special include files; */
+/* other declarations are given in Xutil.h */
+extern Status XReconfigureWMWindow(
+ Display* /* display */,
+ Window /* w */,
+ int /* screen_number */,
+ unsigned int /* mask */,
+ XWindowChanges* /* changes */
+);
+
+extern Status XGetWMProtocols(
+ Display* /* display */,
+ Window /* w */,
+ Atom** /* protocols_return */,
+ int* /* count_return */
+);
+extern Status XSetWMProtocols(
+ Display* /* display */,
+ Window /* w */,
+ Atom* /* protocols */,
+ int /* count */
+);
+extern Status XIconifyWindow(
+ Display* /* display */,
+ Window /* w */,
+ int /* screen_number */
+);
+extern Status XWithdrawWindow(
+ Display* /* display */,
+ Window /* w */,
+ int /* screen_number */
+);
+extern Status XGetCommand(
+ Display* /* display */,
+ Window /* w */,
+ char*** /* argv_return */,
+ int* /* argc_return */
+);
+extern Status XGetWMColormapWindows(
+ Display* /* display */,
+ Window /* w */,
+ Window** /* windows_return */,
+ int* /* count_return */
+);
+extern Status XSetWMColormapWindows(
+ Display* /* display */,
+ Window /* w */,
+ Window* /* colormap_windows */,
+ int /* count */
+);
+extern void XFreeStringList(
+ char** /* list */
+);
+extern int XSetTransientForHint(
+ Display* /* display */,
+ Window /* w */,
+ Window /* prop_window */
+);
+
+/* The following are given in alphabetical order */
+
+extern int XActivateScreenSaver(
+ Display* /* display */
+);
+
+extern int XAddHost(
+ Display* /* display */,
+ XHostAddress* /* host */
+);
+
+extern int XAddHosts(
+ Display* /* display */,
+ XHostAddress* /* hosts */,
+ int /* num_hosts */
+);
+
+extern int XAddToExtensionList(
+ struct _XExtData** /* structure */,
+ XExtData* /* ext_data */
+);
+
+extern int XAddToSaveSet(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern Status XAllocColor(
+ Display* /* display */,
+ Colormap /* colormap */,
+ XColor* /* screen_in_out */
+);
+
+extern Status XAllocColorCells(
+ Display* /* display */,
+ Colormap /* colormap */,
+ Bool /* contig */,
+ unsigned long* /* plane_masks_return */,
+ unsigned int /* nplanes */,
+ unsigned long* /* pixels_return */,
+ unsigned int /* npixels */
+);
+
+extern Status XAllocColorPlanes(
+ Display* /* display */,
+ Colormap /* colormap */,
+ Bool /* contig */,
+ unsigned long* /* pixels_return */,
+ int /* ncolors */,
+ int /* nreds */,
+ int /* ngreens */,
+ int /* nblues */,
+ unsigned long* /* rmask_return */,
+ unsigned long* /* gmask_return */,
+ unsigned long* /* bmask_return */
+);
+
+extern Status XAllocNamedColor(
+ Display* /* display */,
+ Colormap /* colormap */,
+ _Xconst char* /* color_name */,
+ XColor* /* screen_def_return */,
+ XColor* /* exact_def_return */
+);
+
+extern int XAllowEvents(
+ Display* /* display */,
+ int /* event_mode */,
+ Time /* time */
+);
+
+extern int XAutoRepeatOff(
+ Display* /* display */
+);
+
+extern int XAutoRepeatOn(
+ Display* /* display */
+);
+
+extern int XBell(
+ Display* /* display */,
+ int /* percent */
+);
+
+extern int XBitmapBitOrder(
+ Display* /* display */
+);
+
+extern int XBitmapPad(
+ Display* /* display */
+);
+
+extern int XBitmapUnit(
+ Display* /* display */
+);
+
+extern int XCellsOfScreen(
+ Screen* /* screen */
+);
+
+extern int XChangeActivePointerGrab(
+ Display* /* display */,
+ unsigned int /* event_mask */,
+ Cursor /* cursor */,
+ Time /* time */
+);
+
+extern int XChangeGC(
+ Display* /* display */,
+ GC /* gc */,
+ unsigned long /* valuemask */,
+ XGCValues* /* values */
+);
+
+extern int XChangeKeyboardControl(
+ Display* /* display */,
+ unsigned long /* value_mask */,
+ XKeyboardControl* /* values */
+);
+
+extern int XChangeKeyboardMapping(
+ Display* /* display */,
+ int /* first_keycode */,
+ int /* keysyms_per_keycode */,
+ KeySym* /* keysyms */,
+ int /* num_codes */
+);
+
+extern int XChangePointerControl(
+ Display* /* display */,
+ Bool /* do_accel */,
+ Bool /* do_threshold */,
+ int /* accel_numerator */,
+ int /* accel_denominator */,
+ int /* threshold */
+);
+
+extern int XChangeProperty(
+ Display* /* display */,
+ Window /* w */,
+ Atom /* property */,
+ Atom /* type */,
+ int /* format */,
+ int /* mode */,
+ _Xconst unsigned char* /* data */,
+ int /* nelements */
+);
+
+extern int XChangeSaveSet(
+ Display* /* display */,
+ Window /* w */,
+ int /* change_mode */
+);
+
+extern int XChangeWindowAttributes(
+ Display* /* display */,
+ Window /* w */,
+ unsigned long /* valuemask */,
+ XSetWindowAttributes* /* attributes */
+);
+
+extern Bool XCheckIfEvent(
+ Display* /* display */,
+ XEvent* /* event_return */,
+ Bool (*) (
+ Display* /* display */,
+ XEvent* /* event */,
+ XPointer /* arg */
+ ) /* predicate */,
+ XPointer /* arg */
+);
+
+extern Bool XCheckMaskEvent(
+ Display* /* display */,
+ long /* event_mask */,
+ XEvent* /* event_return */
+);
+
+extern Bool XCheckTypedEvent(
+ Display* /* display */,
+ int /* event_type */,
+ XEvent* /* event_return */
+);
+
+extern Bool XCheckTypedWindowEvent(
+ Display* /* display */,
+ Window /* w */,
+ int /* event_type */,
+ XEvent* /* event_return */
+);
+
+extern Bool XCheckWindowEvent(
+ Display* /* display */,
+ Window /* w */,
+ long /* event_mask */,
+ XEvent* /* event_return */
+);
+
+extern int XCirculateSubwindows(
+ Display* /* display */,
+ Window /* w */,
+ int /* direction */
+);
+
+extern int XCirculateSubwindowsDown(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern int XCirculateSubwindowsUp(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern int XClearArea(
+ Display* /* display */,
+ Window /* w */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ Bool /* exposures */
+);
+
+extern int XClearWindow(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern int XCloseDisplay(
+ Display* /* display */
+);
+
+extern int XConfigureWindow(
+ Display* /* display */,
+ Window /* w */,
+ unsigned int /* value_mask */,
+ XWindowChanges* /* values */
+);
+
+extern int XConnectionNumber(
+ Display* /* display */
+);
+
+extern int XConvertSelection(
+ Display* /* display */,
+ Atom /* selection */,
+ Atom /* target */,
+ Atom /* property */,
+ Window /* requestor */,
+ Time /* time */
+);
+
+extern int XCopyArea(
+ Display* /* display */,
+ Drawable /* src */,
+ Drawable /* dest */,
+ GC /* gc */,
+ int /* src_x */,
+ int /* src_y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ int /* dest_x */,
+ int /* dest_y */
+);
+
+extern int XCopyGC(
+ Display* /* display */,
+ GC /* src */,
+ unsigned long /* valuemask */,
+ GC /* dest */
+);
+
+extern int XCopyPlane(
+ Display* /* display */,
+ Drawable /* src */,
+ Drawable /* dest */,
+ GC /* gc */,
+ int /* src_x */,
+ int /* src_y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ int /* dest_x */,
+ int /* dest_y */,
+ unsigned long /* plane */
+);
+
+extern int XDefaultDepth(
+ Display* /* display */,
+ int /* screen_number */
+);
+
+extern int XDefaultDepthOfScreen(
+ Screen* /* screen */
+);
+
+extern int XDefaultScreen(
+ Display* /* display */
+);
+
+extern int XDefineCursor(
+ Display* /* display */,
+ Window /* w */,
+ Cursor /* cursor */
+);
+
+extern int XDeleteProperty(
+ Display* /* display */,
+ Window /* w */,
+ Atom /* property */
+);
+
+extern int XDestroyWindow(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern int XDestroySubwindows(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern int XDoesBackingStore(
+ Screen* /* screen */
+);
+
+extern Bool XDoesSaveUnders(
+ Screen* /* screen */
+);
+
+extern int XDisableAccessControl(
+ Display* /* display */
+);
+
+
+extern int XDisplayCells(
+ Display* /* display */,
+ int /* screen_number */
+);
+
+extern int XDisplayHeight(
+ Display* /* display */,
+ int /* screen_number */
+);
+
+extern int XDisplayHeightMM(
+ Display* /* display */,
+ int /* screen_number */
+);
+
+extern int XDisplayKeycodes(
+ Display* /* display */,
+ int* /* min_keycodes_return */,
+ int* /* max_keycodes_return */
+);
+
+extern int XDisplayPlanes(
+ Display* /* display */,
+ int /* screen_number */
+);
+
+extern int XDisplayWidth(
+ Display* /* display */,
+ int /* screen_number */
+);
+
+extern int XDisplayWidthMM(
+ Display* /* display */,
+ int /* screen_number */
+);
+
+extern int XDrawArc(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ int /* angle1 */,
+ int /* angle2 */
+);
+
+extern int XDrawArcs(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XArc* /* arcs */,
+ int /* narcs */
+);
+
+extern int XDrawImageString(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst char* /* string */,
+ int /* length */
+);
+
+extern int XDrawImageString16(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst XChar2b* /* string */,
+ int /* length */
+);
+
+extern int XDrawLine(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x1 */,
+ int /* y1 */,
+ int /* x2 */,
+ int /* y2 */
+);
+
+extern int XDrawLines(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XPoint* /* points */,
+ int /* npoints */,
+ int /* mode */
+);
+
+extern int XDrawPoint(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */
+);
+
+extern int XDrawPoints(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XPoint* /* points */,
+ int /* npoints */,
+ int /* mode */
+);
+
+extern int XDrawRectangle(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */
+);
+
+extern int XDrawRectangles(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XRectangle* /* rectangles */,
+ int /* nrectangles */
+);
+
+extern int XDrawSegments(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XSegment* /* segments */,
+ int /* nsegments */
+);
+
+extern int XDrawString(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst char* /* string */,
+ int /* length */
+);
+
+extern int XDrawString16(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst XChar2b* /* string */,
+ int /* length */
+);
+
+extern int XDrawText(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ XTextItem* /* items */,
+ int /* nitems */
+);
+
+extern int XDrawText16(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ XTextItem16* /* items */,
+ int /* nitems */
+);
+
+extern int XEnableAccessControl(
+ Display* /* display */
+);
+
+extern int XEventsQueued(
+ Display* /* display */,
+ int /* mode */
+);
+
+extern Status XFetchName(
+ Display* /* display */,
+ Window /* w */,
+ char** /* window_name_return */
+);
+
+extern int XFillArc(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ int /* angle1 */,
+ int /* angle2 */
+);
+
+extern int XFillArcs(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XArc* /* arcs */,
+ int /* narcs */
+);
+
+extern int XFillPolygon(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XPoint* /* points */,
+ int /* npoints */,
+ int /* shape */,
+ int /* mode */
+);
+
+extern int XFillRectangle(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */
+);
+
+extern int XFillRectangles(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XRectangle* /* rectangles */,
+ int /* nrectangles */
+);
+
+extern int XFlush(
+ Display* /* display */
+);
+
+extern int XForceScreenSaver(
+ Display* /* display */,
+ int /* mode */
+);
+
+extern int XFree(
+ void* /* data */
+);
+
+extern int XFreeColormap(
+ Display* /* display */,
+ Colormap /* colormap */
+);
+
+extern int XFreeColors(
+ Display* /* display */,
+ Colormap /* colormap */,
+ unsigned long* /* pixels */,
+ int /* npixels */,
+ unsigned long /* planes */
+);
+
+extern int XFreeCursor(
+ Display* /* display */,
+ Cursor /* cursor */
+);
+
+extern int XFreeExtensionList(
+ char** /* list */
+);
+
+extern int XFreeFont(
+ Display* /* display */,
+ XFontStruct* /* font_struct */
+);
+
+extern int XFreeFontInfo(
+ char** /* names */,
+ XFontStruct* /* free_info */,
+ int /* actual_count */
+);
+
+extern int XFreeFontNames(
+ char** /* list */
+);
+
+extern int XFreeFontPath(
+ char** /* list */
+);
+
+extern int XFreeGC(
+ Display* /* display */,
+ GC /* gc */
+);
+
+extern int XFreeModifiermap(
+ XModifierKeymap* /* modmap */
+);
+
+extern int XFreePixmap(
+ Display* /* display */,
+ Pixmap /* pixmap */
+);
+
+extern int XGeometry(
+ Display* /* display */,
+ int /* screen */,
+ _Xconst char* /* position */,
+ _Xconst char* /* default_position */,
+ unsigned int /* bwidth */,
+ unsigned int /* fwidth */,
+ unsigned int /* fheight */,
+ int /* xadder */,
+ int /* yadder */,
+ int* /* x_return */,
+ int* /* y_return */,
+ int* /* width_return */,
+ int* /* height_return */
+);
+
+extern int XGetErrorDatabaseText(
+ Display* /* display */,
+ _Xconst char* /* name */,
+ _Xconst char* /* message */,
+ _Xconst char* /* default_string */,
+ char* /* buffer_return */,
+ int /* length */
+);
+
+extern int XGetErrorText(
+ Display* /* display */,
+ int /* code */,
+ char* /* buffer_return */,
+ int /* length */
+);
+
+extern Bool XGetFontProperty(
+ XFontStruct* /* font_struct */,
+ Atom /* atom */,
+ unsigned long* /* value_return */
+);
+
+extern Status XGetGCValues(
+ Display* /* display */,
+ GC /* gc */,
+ unsigned long /* valuemask */,
+ XGCValues* /* values_return */
+);
+
+extern Status XGetGeometry(
+ Display* /* display */,
+ Drawable /* d */,
+ Window* /* root_return */,
+ int* /* x_return */,
+ int* /* y_return */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */,
+ unsigned int* /* border_width_return */,
+ unsigned int* /* depth_return */
+);
+
+extern Status XGetIconName(
+ Display* /* display */,
+ Window /* w */,
+ char** /* icon_name_return */
+);
+
+extern int XGetInputFocus(
+ Display* /* display */,
+ Window* /* focus_return */,
+ int* /* revert_to_return */
+);
+
+extern int XGetKeyboardControl(
+ Display* /* display */,
+ XKeyboardState* /* values_return */
+);
+
+extern int XGetPointerControl(
+ Display* /* display */,
+ int* /* accel_numerator_return */,
+ int* /* accel_denominator_return */,
+ int* /* threshold_return */
+);
+
+extern int XGetPointerMapping(
+ Display* /* display */,
+ unsigned char* /* map_return */,
+ int /* nmap */
+);
+
+extern int XGetScreenSaver(
+ Display* /* display */,
+ int* /* timeout_return */,
+ int* /* interval_return */,
+ int* /* prefer_blanking_return */,
+ int* /* allow_exposures_return */
+);
+
+extern Status XGetTransientForHint(
+ Display* /* display */,
+ Window /* w */,
+ Window* /* prop_window_return */
+);
+
+extern int XGetWindowProperty(
+ Display* /* display */,
+ Window /* w */,
+ Atom /* property */,
+ long /* long_offset */,
+ long /* long_length */,
+ Bool /* delete */,
+ Atom /* req_type */,
+ Atom* /* actual_type_return */,
+ int* /* actual_format_return */,
+ unsigned long* /* nitems_return */,
+ unsigned long* /* bytes_after_return */,
+ unsigned char** /* prop_return */
+);
+
+extern Status XGetWindowAttributes(
+ Display* /* display */,
+ Window /* w */,
+ XWindowAttributes* /* window_attributes_return */
+);
+
+extern int XGrabButton(
+ Display* /* display */,
+ unsigned int /* button */,
+ unsigned int /* modifiers */,
+ Window /* grab_window */,
+ Bool /* owner_events */,
+ unsigned int /* event_mask */,
+ int /* pointer_mode */,
+ int /* keyboard_mode */,
+ Window /* confine_to */,
+ Cursor /* cursor */
+);
+
+extern int XGrabKey(
+ Display* /* display */,
+ int /* keycode */,
+ unsigned int /* modifiers */,
+ Window /* grab_window */,
+ Bool /* owner_events */,
+ int /* pointer_mode */,
+ int /* keyboard_mode */
+);
+
+extern int XGrabKeyboard(
+ Display* /* display */,
+ Window /* grab_window */,
+ Bool /* owner_events */,
+ int /* pointer_mode */,
+ int /* keyboard_mode */,
+ Time /* time */
+);
+
+extern int XGrabPointer(
+ Display* /* display */,
+ Window /* grab_window */,
+ Bool /* owner_events */,
+ unsigned int /* event_mask */,
+ int /* pointer_mode */,
+ int /* keyboard_mode */,
+ Window /* confine_to */,
+ Cursor /* cursor */,
+ Time /* time */
+);
+
+extern int XGrabServer(
+ Display* /* display */
+);
+
+extern int XHeightMMOfScreen(
+ Screen* /* screen */
+);
+
+extern int XHeightOfScreen(
+ Screen* /* screen */
+);
+
+extern int XIfEvent(
+ Display* /* display */,
+ XEvent* /* event_return */,
+ Bool (*) (
+ Display* /* display */,
+ XEvent* /* event */,
+ XPointer /* arg */
+ ) /* predicate */,
+ XPointer /* arg */
+);
+
+extern int XImageByteOrder(
+ Display* /* display */
+);
+
+extern int XInstallColormap(
+ Display* /* display */,
+ Colormap /* colormap */
+);
+
+extern KeyCode XKeysymToKeycode(
+ Display* /* display */,
+ KeySym /* keysym */
+);
+
+extern int XKillClient(
+ Display* /* display */,
+ XID /* resource */
+);
+
+extern Status XLookupColor(
+ Display* /* display */,
+ Colormap /* colormap */,
+ _Xconst char* /* color_name */,
+ XColor* /* exact_def_return */,
+ XColor* /* screen_def_return */
+);
+
+extern int XLowerWindow(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern int XMapRaised(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern int XMapSubwindows(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern int XMapWindow(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern int XMaskEvent(
+ Display* /* display */,
+ long /* event_mask */,
+ XEvent* /* event_return */
+);
+
+extern int XMaxCmapsOfScreen(
+ Screen* /* screen */
+);
+
+extern int XMinCmapsOfScreen(
+ Screen* /* screen */
+);
+
+extern int XMoveResizeWindow(
+ Display* /* display */,
+ Window /* w */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */
+);
+
+extern int XMoveWindow(
+ Display* /* display */,
+ Window /* w */,
+ int /* x */,
+ int /* y */
+);
+
+extern int XNextEvent(
+ Display* /* display */,
+ XEvent* /* event_return */
+);
+
+extern int XNoOp(
+ Display* /* display */
+);
+
+extern Status XParseColor(
+ Display* /* display */,
+ Colormap /* colormap */,
+ _Xconst char* /* spec */,
+ XColor* /* exact_def_return */
+);
+
+extern int XParseGeometry(
+ _Xconst char* /* parsestring */,
+ int* /* x_return */,
+ int* /* y_return */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */
+);
+
+extern int XPeekEvent(
+ Display* /* display */,
+ XEvent* /* event_return */
+);
+
+extern int XPeekIfEvent(
+ Display* /* display */,
+ XEvent* /* event_return */,
+ Bool (*) (
+ Display* /* display */,
+ XEvent* /* event */,
+ XPointer /* arg */
+ ) /* predicate */,
+ XPointer /* arg */
+);
+
+extern int XPending(
+ Display* /* display */
+);
+
+extern int XPlanesOfScreen(
+ Screen* /* screen */
+);
+
+extern int XProtocolRevision(
+ Display* /* display */
+);
+
+extern int XProtocolVersion(
+ Display* /* display */
+);
+
+
+extern int XPutBackEvent(
+ Display* /* display */,
+ XEvent* /* event */
+);
+
+extern int XPutImage(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ XImage* /* image */,
+ int /* src_x */,
+ int /* src_y */,
+ int /* dest_x */,
+ int /* dest_y */,
+ unsigned int /* width */,
+ unsigned int /* height */
+);
+
+extern int XQLength(
+ Display* /* display */
+);
+
+extern Status XQueryBestCursor(
+ Display* /* display */,
+ Drawable /* d */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */
+);
+
+extern Status XQueryBestSize(
+ Display* /* display */,
+ int /* class */,
+ Drawable /* which_screen */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */
+);
+
+extern Status XQueryBestStipple(
+ Display* /* display */,
+ Drawable /* which_screen */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */
+);
+
+extern Status XQueryBestTile(
+ Display* /* display */,
+ Drawable /* which_screen */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */
+);
+
+extern int XQueryColor(
+ Display* /* display */,
+ Colormap /* colormap */,
+ XColor* /* def_in_out */
+);
+
+extern int XQueryColors(
+ Display* /* display */,
+ Colormap /* colormap */,
+ XColor* /* defs_in_out */,
+ int /* ncolors */
+);
+
+extern Bool XQueryExtension(
+ Display* /* display */,
+ _Xconst char* /* name */,
+ int* /* major_opcode_return */,
+ int* /* first_event_return */,
+ int* /* first_error_return */
+);
+
+extern int XQueryKeymap(
+ Display* /* display */,
+ char [32] /* keys_return */
+);
+
+extern Bool XQueryPointer(
+ Display* /* display */,
+ Window /* w */,
+ Window* /* root_return */,
+ Window* /* child_return */,
+ int* /* root_x_return */,
+ int* /* root_y_return */,
+ int* /* win_x_return */,
+ int* /* win_y_return */,
+ unsigned int* /* mask_return */
+);
+
+extern int XQueryTextExtents(
+ Display* /* display */,
+ XID /* font_ID */,
+ _Xconst char* /* string */,
+ int /* nchars */,
+ int* /* direction_return */,
+ int* /* font_ascent_return */,
+ int* /* font_descent_return */,
+ XCharStruct* /* overall_return */
+);
+
+extern int XQueryTextExtents16(
+ Display* /* display */,
+ XID /* font_ID */,
+ _Xconst XChar2b* /* string */,
+ int /* nchars */,
+ int* /* direction_return */,
+ int* /* font_ascent_return */,
+ int* /* font_descent_return */,
+ XCharStruct* /* overall_return */
+);
+
+extern Status XQueryTree(
+ Display* /* display */,
+ Window /* w */,
+ Window* /* root_return */,
+ Window* /* parent_return */,
+ Window** /* children_return */,
+ unsigned int* /* nchildren_return */
+);
+
+extern int XRaiseWindow(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern int XReadBitmapFile(
+ Display* /* display */,
+ Drawable /* d */,
+ _Xconst char* /* filename */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */,
+ Pixmap* /* bitmap_return */,
+ int* /* x_hot_return */,
+ int* /* y_hot_return */
+);
+
+extern int XReadBitmapFileData(
+ _Xconst char* /* filename */,
+ unsigned int* /* width_return */,
+ unsigned int* /* height_return */,
+ unsigned char** /* data_return */,
+ int* /* x_hot_return */,
+ int* /* y_hot_return */
+);
+
+extern int XRebindKeysym(
+ Display* /* display */,
+ KeySym /* keysym */,
+ KeySym* /* list */,
+ int /* mod_count */,
+ _Xconst unsigned char* /* string */,
+ int /* bytes_string */
+);
+
+extern int XRecolorCursor(
+ Display* /* display */,
+ Cursor /* cursor */,
+ XColor* /* foreground_color */,
+ XColor* /* background_color */
+);
+
+extern int XRefreshKeyboardMapping(
+ XMappingEvent* /* event_map */
+);
+
+extern int XRemoveFromSaveSet(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern int XRemoveHost(
+ Display* /* display */,
+ XHostAddress* /* host */
+);
+
+extern int XRemoveHosts(
+ Display* /* display */,
+ XHostAddress* /* hosts */,
+ int /* num_hosts */
+);
+
+extern int XReparentWindow(
+ Display* /* display */,
+ Window /* w */,
+ Window /* parent */,
+ int /* x */,
+ int /* y */
+);
+
+extern int XResetScreenSaver(
+ Display* /* display */
+);
+
+extern int XResizeWindow(
+ Display* /* display */,
+ Window /* w */,
+ unsigned int /* width */,
+ unsigned int /* height */
+);
+
+extern int XRestackWindows(
+ Display* /* display */,
+ Window* /* windows */,
+ int /* nwindows */
+);
+
+extern int XRotateBuffers(
+ Display* /* display */,
+ int /* rotate */
+);
+
+extern int XRotateWindowProperties(
+ Display* /* display */,
+ Window /* w */,
+ Atom* /* properties */,
+ int /* num_prop */,
+ int /* npositions */
+);
+
+extern int XScreenCount(
+ Display* /* display */
+);
+
+extern int XSelectInput(
+ Display* /* display */,
+ Window /* w */,
+ long /* event_mask */
+);
+
+extern Status XSendEvent(
+ Display* /* display */,
+ Window /* w */,
+ Bool /* propagate */,
+ long /* event_mask */,
+ XEvent* /* event_send */
+);
+
+extern int XSetAccessControl(
+ Display* /* display */,
+ int /* mode */
+);
+
+extern int XSetArcMode(
+ Display* /* display */,
+ GC /* gc */,
+ int /* arc_mode */
+);
+
+extern int XSetBackground(
+ Display* /* display */,
+ GC /* gc */,
+ unsigned long /* background */
+);
+
+extern int XSetClipMask(
+ Display* /* display */,
+ GC /* gc */,
+ Pixmap /* pixmap */
+);
+
+extern int XSetClipOrigin(
+ Display* /* display */,
+ GC /* gc */,
+ int /* clip_x_origin */,
+ int /* clip_y_origin */
+);
+
+extern int XSetClipRectangles(
+ Display* /* display */,
+ GC /* gc */,
+ int /* clip_x_origin */,
+ int /* clip_y_origin */,
+ XRectangle* /* rectangles */,
+ int /* n */,
+ int /* ordering */
+);
+
+extern int XSetCloseDownMode(
+ Display* /* display */,
+ int /* close_mode */
+);
+
+extern int XSetCommand(
+ Display* /* display */,
+ Window /* w */,
+ char** /* argv */,
+ int /* argc */
+);
+
+extern int XSetDashes(
+ Display* /* display */,
+ GC /* gc */,
+ int /* dash_offset */,
+ _Xconst char* /* dash_list */,
+ int /* n */
+);
+
+extern int XSetFillRule(
+ Display* /* display */,
+ GC /* gc */,
+ int /* fill_rule */
+);
+
+extern int XSetFillStyle(
+ Display* /* display */,
+ GC /* gc */,
+ int /* fill_style */
+);
+
+extern int XSetFont(
+ Display* /* display */,
+ GC /* gc */,
+ Font /* font */
+);
+
+extern int XSetFontPath(
+ Display* /* display */,
+ char** /* directories */,
+ int /* ndirs */
+);
+
+extern int XSetForeground(
+ Display* /* display */,
+ GC /* gc */,
+ unsigned long /* foreground */
+);
+
+extern int XSetFunction(
+ Display* /* display */,
+ GC /* gc */,
+ int /* function */
+);
+
+extern int XSetGraphicsExposures(
+ Display* /* display */,
+ GC /* gc */,
+ Bool /* graphics_exposures */
+);
+
+extern int XSetIconName(
+ Display* /* display */,
+ Window /* w */,
+ _Xconst char* /* icon_name */
+);
+
+extern int XSetInputFocus(
+ Display* /* display */,
+ Window /* focus */,
+ int /* revert_to */,
+ Time /* time */
+);
+
+extern int XSetLineAttributes(
+ Display* /* display */,
+ GC /* gc */,
+ unsigned int /* line_width */,
+ int /* line_style */,
+ int /* cap_style */,
+ int /* join_style */
+);
+
+extern int XSetModifierMapping(
+ Display* /* display */,
+ XModifierKeymap* /* modmap */
+);
+
+extern int XSetPlaneMask(
+ Display* /* display */,
+ GC /* gc */,
+ unsigned long /* plane_mask */
+);
+
+extern int XSetPointerMapping(
+ Display* /* display */,
+ _Xconst unsigned char* /* map */,
+ int /* nmap */
+);
+
+extern int XSetScreenSaver(
+ Display* /* display */,
+ int /* timeout */,
+ int /* interval */,
+ int /* prefer_blanking */,
+ int /* allow_exposures */
+);
+
+extern int XSetSelectionOwner(
+ Display* /* display */,
+ Atom /* selection */,
+ Window /* owner */,
+ Time /* time */
+);
+
+extern int XSetState(
+ Display* /* display */,
+ GC /* gc */,
+ unsigned long /* foreground */,
+ unsigned long /* background */,
+ int /* function */,
+ unsigned long /* plane_mask */
+);
+
+extern int XSetStipple(
+ Display* /* display */,
+ GC /* gc */,
+ Pixmap /* stipple */
+);
+
+extern int XSetSubwindowMode(
+ Display* /* display */,
+ GC /* gc */,
+ int /* subwindow_mode */
+);
+
+extern int XSetTSOrigin(
+ Display* /* display */,
+ GC /* gc */,
+ int /* ts_x_origin */,
+ int /* ts_y_origin */
+);
+
+extern int XSetTile(
+ Display* /* display */,
+ GC /* gc */,
+ Pixmap /* tile */
+);
+
+extern int XSetWindowBackground(
+ Display* /* display */,
+ Window /* w */,
+ unsigned long /* background_pixel */
+);
+
+extern int XSetWindowBackgroundPixmap(
+ Display* /* display */,
+ Window /* w */,
+ Pixmap /* background_pixmap */
+);
+
+extern int XSetWindowBorder(
+ Display* /* display */,
+ Window /* w */,
+ unsigned long /* border_pixel */
+);
+
+extern int XSetWindowBorderPixmap(
+ Display* /* display */,
+ Window /* w */,
+ Pixmap /* border_pixmap */
+);
+
+extern int XSetWindowBorderWidth(
+ Display* /* display */,
+ Window /* w */,
+ unsigned int /* width */
+);
+
+extern int XSetWindowColormap(
+ Display* /* display */,
+ Window /* w */,
+ Colormap /* colormap */
+);
+
+extern int XStoreBuffer(
+ Display* /* display */,
+ _Xconst char* /* bytes */,
+ int /* nbytes */,
+ int /* buffer */
+);
+
+extern int XStoreBytes(
+ Display* /* display */,
+ _Xconst char* /* bytes */,
+ int /* nbytes */
+);
+
+extern int XStoreColor(
+ Display* /* display */,
+ Colormap /* colormap */,
+ XColor* /* color */
+);
+
+extern int XStoreColors(
+ Display* /* display */,
+ Colormap /* colormap */,
+ XColor* /* color */,
+ int /* ncolors */
+);
+
+extern int XStoreName(
+ Display* /* display */,
+ Window /* w */,
+ _Xconst char* /* window_name */
+);
+
+extern int XStoreNamedColor(
+ Display* /* display */,
+ Colormap /* colormap */,
+ _Xconst char* /* color */,
+ unsigned long /* pixel */,
+ int /* flags */
+);
+
+extern int XSync(
+ Display* /* display */,
+ Bool /* discard */
+);
+
+extern int XTextExtents(
+ XFontStruct* /* font_struct */,
+ _Xconst char* /* string */,
+ int /* nchars */,
+ int* /* direction_return */,
+ int* /* font_ascent_return */,
+ int* /* font_descent_return */,
+ XCharStruct* /* overall_return */
+);
+
+extern int XTextExtents16(
+ XFontStruct* /* font_struct */,
+ _Xconst XChar2b* /* string */,
+ int /* nchars */,
+ int* /* direction_return */,
+ int* /* font_ascent_return */,
+ int* /* font_descent_return */,
+ XCharStruct* /* overall_return */
+);
+
+extern int XTextWidth(
+ XFontStruct* /* font_struct */,
+ _Xconst char* /* string */,
+ int /* count */
+);
+
+extern int XTextWidth16(
+ XFontStruct* /* font_struct */,
+ _Xconst XChar2b* /* string */,
+ int /* count */
+);
+
+extern Bool XTranslateCoordinates(
+ Display* /* display */,
+ Window /* src_w */,
+ Window /* dest_w */,
+ int /* src_x */,
+ int /* src_y */,
+ int* /* dest_x_return */,
+ int* /* dest_y_return */,
+ Window* /* child_return */
+);
+
+extern int XUndefineCursor(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern int XUngrabButton(
+ Display* /* display */,
+ unsigned int /* button */,
+ unsigned int /* modifiers */,
+ Window /* grab_window */
+);
+
+extern int XUngrabKey(
+ Display* /* display */,
+ int /* keycode */,
+ unsigned int /* modifiers */,
+ Window /* grab_window */
+);
+
+extern int XUngrabKeyboard(
+ Display* /* display */,
+ Time /* time */
+);
+
+extern int XUngrabPointer(
+ Display* /* display */,
+ Time /* time */
+);
+
+extern int XUngrabServer(
+ Display* /* display */
+);
+
+extern int XUninstallColormap(
+ Display* /* display */,
+ Colormap /* colormap */
+);
+
+extern int XUnloadFont(
+ Display* /* display */,
+ Font /* font */
+);
+
+extern int XUnmapSubwindows(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern int XUnmapWindow(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern int XVendorRelease(
+ Display* /* display */
+);
+
+extern int XWarpPointer(
+ Display* /* display */,
+ Window /* src_w */,
+ Window /* dest_w */,
+ int /* src_x */,
+ int /* src_y */,
+ unsigned int /* src_width */,
+ unsigned int /* src_height */,
+ int /* dest_x */,
+ int /* dest_y */
+);
+
+extern int XWidthMMOfScreen(
+ Screen* /* screen */
+);
+
+extern int XWidthOfScreen(
+ Screen* /* screen */
+);
+
+extern int XWindowEvent(
+ Display* /* display */,
+ Window /* w */,
+ long /* event_mask */,
+ XEvent* /* event_return */
+);
+
+extern int XWriteBitmapFile(
+ Display* /* display */,
+ _Xconst char* /* filename */,
+ Pixmap /* bitmap */,
+ unsigned int /* width */,
+ unsigned int /* height */,
+ int /* x_hot */,
+ int /* y_hot */
+);
+
+extern Bool XSupportsLocale (void);
+
+extern char *XSetLocaleModifiers(
+ const char* /* modifier_list */
+);
+
+extern XOM XOpenOM(
+ Display* /* display */,
+ struct _XrmHashBucketRec* /* rdb */,
+ _Xconst char* /* res_name */,
+ _Xconst char* /* res_class */
+);
+
+extern Status XCloseOM(
+ XOM /* om */
+);
+
+extern char *XSetOMValues(
+ XOM /* om */,
+ ...
+) _X_SENTINEL(0);
+
+extern char *XGetOMValues(
+ XOM /* om */,
+ ...
+) _X_SENTINEL(0);
+
+extern Display *XDisplayOfOM(
+ XOM /* om */
+);
+
+extern char *XLocaleOfOM(
+ XOM /* om */
+);
+
+extern XOC XCreateOC(
+ XOM /* om */,
+ ...
+) _X_SENTINEL(0);
+
+extern void XDestroyOC(
+ XOC /* oc */
+);
+
+extern XOM XOMOfOC(
+ XOC /* oc */
+);
+
+extern char *XSetOCValues(
+ XOC /* oc */,
+ ...
+) _X_SENTINEL(0);
+
+extern char *XGetOCValues(
+ XOC /* oc */,
+ ...
+) _X_SENTINEL(0);
+
+extern XFontSet XCreateFontSet(
+ Display* /* display */,
+ _Xconst char* /* base_font_name_list */,
+ char*** /* missing_charset_list */,
+ int* /* missing_charset_count */,
+ char** /* def_string */
+);
+
+extern void XFreeFontSet(
+ Display* /* display */,
+ XFontSet /* font_set */
+);
+
+extern int XFontsOfFontSet(
+ XFontSet /* font_set */,
+ XFontStruct*** /* font_struct_list */,
+ char*** /* font_name_list */
+);
+
+extern char *XBaseFontNameListOfFontSet(
+ XFontSet /* font_set */
+);
+
+extern char *XLocaleOfFontSet(
+ XFontSet /* font_set */
+);
+
+extern Bool XContextDependentDrawing(
+ XFontSet /* font_set */
+);
+
+extern Bool XDirectionalDependentDrawing(
+ XFontSet /* font_set */
+);
+
+extern Bool XContextualDrawing(
+ XFontSet /* font_set */
+);
+
+extern XFontSetExtents *XExtentsOfFontSet(
+ XFontSet /* font_set */
+);
+
+extern int XmbTextEscapement(
+ XFontSet /* font_set */,
+ _Xconst char* /* text */,
+ int /* bytes_text */
+);
+
+extern int XwcTextEscapement(
+ XFontSet /* font_set */,
+ _Xconst wchar_t* /* text */,
+ int /* num_wchars */
+);
+
+extern int Xutf8TextEscapement(
+ XFontSet /* font_set */,
+ _Xconst char* /* text */,
+ int /* bytes_text */
+);
+
+extern int XmbTextExtents(
+ XFontSet /* font_set */,
+ _Xconst char* /* text */,
+ int /* bytes_text */,
+ XRectangle* /* overall_ink_return */,
+ XRectangle* /* overall_logical_return */
+);
+
+extern int XwcTextExtents(
+ XFontSet /* font_set */,
+ _Xconst wchar_t* /* text */,
+ int /* num_wchars */,
+ XRectangle* /* overall_ink_return */,
+ XRectangle* /* overall_logical_return */
+);
+
+extern int Xutf8TextExtents(
+ XFontSet /* font_set */,
+ _Xconst char* /* text */,
+ int /* bytes_text */,
+ XRectangle* /* overall_ink_return */,
+ XRectangle* /* overall_logical_return */
+);
+
+extern Status XmbTextPerCharExtents(
+ XFontSet /* font_set */,
+ _Xconst char* /* text */,
+ int /* bytes_text */,
+ XRectangle* /* ink_extents_buffer */,
+ XRectangle* /* logical_extents_buffer */,
+ int /* buffer_size */,
+ int* /* num_chars */,
+ XRectangle* /* overall_ink_return */,
+ XRectangle* /* overall_logical_return */
+);
+
+extern Status XwcTextPerCharExtents(
+ XFontSet /* font_set */,
+ _Xconst wchar_t* /* text */,
+ int /* num_wchars */,
+ XRectangle* /* ink_extents_buffer */,
+ XRectangle* /* logical_extents_buffer */,
+ int /* buffer_size */,
+ int* /* num_chars */,
+ XRectangle* /* overall_ink_return */,
+ XRectangle* /* overall_logical_return */
+);
+
+extern Status Xutf8TextPerCharExtents(
+ XFontSet /* font_set */,
+ _Xconst char* /* text */,
+ int /* bytes_text */,
+ XRectangle* /* ink_extents_buffer */,
+ XRectangle* /* logical_extents_buffer */,
+ int /* buffer_size */,
+ int* /* num_chars */,
+ XRectangle* /* overall_ink_return */,
+ XRectangle* /* overall_logical_return */
+);
+
+extern void XmbDrawText(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ XmbTextItem* /* text_items */,
+ int /* nitems */
+);
+
+extern void XwcDrawText(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ XwcTextItem* /* text_items */,
+ int /* nitems */
+);
+
+extern void Xutf8DrawText(
+ Display* /* display */,
+ Drawable /* d */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ XmbTextItem* /* text_items */,
+ int /* nitems */
+);
+
+extern void XmbDrawString(
+ Display* /* display */,
+ Drawable /* d */,
+ XFontSet /* font_set */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst char* /* text */,
+ int /* bytes_text */
+);
+
+extern void XwcDrawString(
+ Display* /* display */,
+ Drawable /* d */,
+ XFontSet /* font_set */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst wchar_t* /* text */,
+ int /* num_wchars */
+);
+
+extern void Xutf8DrawString(
+ Display* /* display */,
+ Drawable /* d */,
+ XFontSet /* font_set */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst char* /* text */,
+ int /* bytes_text */
+);
+
+extern void XmbDrawImageString(
+ Display* /* display */,
+ Drawable /* d */,
+ XFontSet /* font_set */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst char* /* text */,
+ int /* bytes_text */
+);
+
+extern void XwcDrawImageString(
+ Display* /* display */,
+ Drawable /* d */,
+ XFontSet /* font_set */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst wchar_t* /* text */,
+ int /* num_wchars */
+);
+
+extern void Xutf8DrawImageString(
+ Display* /* display */,
+ Drawable /* d */,
+ XFontSet /* font_set */,
+ GC /* gc */,
+ int /* x */,
+ int /* y */,
+ _Xconst char* /* text */,
+ int /* bytes_text */
+);
+
+extern XIM XOpenIM(
+ Display* /* dpy */,
+ struct _XrmHashBucketRec* /* rdb */,
+ char* /* res_name */,
+ char* /* res_class */
+);
+
+extern Status XCloseIM(
+ XIM /* im */
+);
+
+extern char *XGetIMValues(
+ XIM /* im */, ...
+) _X_SENTINEL(0);
+
+extern char *XSetIMValues(
+ XIM /* im */, ...
+) _X_SENTINEL(0);
+
+extern Display *XDisplayOfIM(
+ XIM /* im */
+);
+
+extern char *XLocaleOfIM(
+ XIM /* im*/
+);
+
+extern XIC XCreateIC(
+ XIM /* im */, ...
+) _X_SENTINEL(0);
+
+extern void XDestroyIC(
+ XIC /* ic */
+);
+
+extern void XSetICFocus(
+ XIC /* ic */
+);
+
+extern void XUnsetICFocus(
+ XIC /* ic */
+);
+
+extern wchar_t *XwcResetIC(
+ XIC /* ic */
+);
+
+extern char *XmbResetIC(
+ XIC /* ic */
+);
+
+extern char *Xutf8ResetIC(
+ XIC /* ic */
+);
+
+extern char *XSetICValues(
+ XIC /* ic */, ...
+) _X_SENTINEL(0);
+
+extern char *XGetICValues(
+ XIC /* ic */, ...
+) _X_SENTINEL(0);
+
+extern XIM XIMOfIC(
+ XIC /* ic */
+);
+
+extern Bool XFilterEvent(
+ XEvent* /* event */,
+ Window /* window */
+);
+
+extern int XmbLookupString(
+ XIC /* ic */,
+ XKeyPressedEvent* /* event */,
+ char* /* buffer_return */,
+ int /* bytes_buffer */,
+ KeySym* /* keysym_return */,
+ Status* /* status_return */
+);
+
+extern int XwcLookupString(
+ XIC /* ic */,
+ XKeyPressedEvent* /* event */,
+ wchar_t* /* buffer_return */,
+ int /* wchars_buffer */,
+ KeySym* /* keysym_return */,
+ Status* /* status_return */
+);
+
+extern int Xutf8LookupString(
+ XIC /* ic */,
+ XKeyPressedEvent* /* event */,
+ char* /* buffer_return */,
+ int /* bytes_buffer */,
+ KeySym* /* keysym_return */,
+ Status* /* status_return */
+);
+
+extern XVaNestedList XVaCreateNestedList(
+ int /*unused*/, ...
+) _X_SENTINEL(0);
+
+/* internal connections for IMs */
+
+extern Bool XRegisterIMInstantiateCallback(
+ Display* /* dpy */,
+ struct _XrmHashBucketRec* /* rdb */,
+ char* /* res_name */,
+ char* /* res_class */,
+ XIDProc /* callback */,
+ XPointer /* client_data */
+);
+
+extern Bool XUnregisterIMInstantiateCallback(
+ Display* /* dpy */,
+ struct _XrmHashBucketRec* /* rdb */,
+ char* /* res_name */,
+ char* /* res_class */,
+ XIDProc /* callback */,
+ XPointer /* client_data */
+);
+
+typedef void (*XConnectionWatchProc)(
+ Display* /* dpy */,
+ XPointer /* client_data */,
+ int /* fd */,
+ Bool /* opening */, /* open or close flag */
+ XPointer* /* watch_data */ /* open sets, close uses */
+);
+
+
+extern Status XInternalConnectionNumbers(
+ Display* /* dpy */,
+ int** /* fd_return */,
+ int* /* count_return */
+);
+
+extern void XProcessInternalConnection(
+ Display* /* dpy */,
+ int /* fd */
+);
+
+extern Status XAddConnectionWatch(
+ Display* /* dpy */,
+ XConnectionWatchProc /* callback */,
+ XPointer /* client_data */
+);
+
+extern void XRemoveConnectionWatch(
+ Display* /* dpy */,
+ XConnectionWatchProc /* callback */,
+ XPointer /* client_data */
+);
+
+extern void XSetAuthorization(
+ char * /* name */,
+ int /* namelen */,
+ char * /* data */,
+ int /* datalen */
+);
+
+extern int _Xmbtowc(
+ wchar_t * /* wstr */,
+ char * /* str */,
+ int /* len */
+);
+
+extern int _Xwctomb(
+ char * /* str */,
+ wchar_t /* wc */
+);
+
+extern Bool XGetEventData(
+ Display* /* dpy */,
+ XGenericEventCookie* /* cookie*/
+);
+
+extern void XFreeEventData(
+ Display* /* dpy */,
+ XGenericEventCookie* /* cookie*/
+);
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _X11_XLIB_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/Xosdefs.h b/thirdparty/linuxbsd_headers/X11/Xosdefs.h
new file mode 100644
index 0000000000..33eaee4360
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/Xosdefs.h
@@ -0,0 +1,116 @@
+/*
+ * O/S-dependent (mis)feature macro definitions
+ *
+Copyright 1991, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+#ifndef _XOSDEFS_H_
+# define _XOSDEFS_H_
+
+/*
+ * X_NOT_POSIX means does not have POSIX header files. Lack of this
+ * symbol does NOT mean that the POSIX environment is the default.
+ * You may still have to define _POSIX_SOURCE to get it.
+ */
+
+
+# ifdef _SCO_DS
+# ifndef __SCO__
+# define __SCO__
+# endif
+# endif
+
+# ifdef __i386__
+# ifdef SYSV
+# if !defined(__SCO__) && \
+ !defined(__UNIXWARE__) && !defined(__sun)
+# if !defined(_POSIX_SOURCE)
+# define X_NOT_POSIX
+# endif
+# endif
+# endif
+# endif
+
+# ifdef __sun
+/* Imake configs define SVR4 on Solaris, but cc & gcc only define __SVR4
+ * This check allows non-Imake configured programs to build correctly.
+ */
+# if defined(__SVR4) && !defined(SVR4)
+# define SVR4 1
+# endif
+# ifdef SVR4
+/* define this to whatever it needs to be */
+# define X_POSIX_C_SOURCE 199300L
+# endif
+# endif
+
+# ifdef WIN32
+# ifndef _POSIX_
+# define X_NOT_POSIX
+# endif
+# endif
+
+
+# ifdef __APPLE__
+# define NULL_NOT_ZERO
+
+/* Defining any of these will sanitize the namespace to JUST want is defined by
+ * that particular standard. If that happens, we don't get some expected
+ * prototypes, typedefs, etc (like fd_mask). We can define _DARWIN_C_SOURCE to
+ * loosen our belts a tad.
+ */
+# if defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE)
+# ifndef _DARWIN_C_SOURCE
+# define _DARWIN_C_SOURCE
+# endif
+# endif
+
+# endif
+
+# ifdef __GNU__
+# ifndef PATH_MAX
+# define PATH_MAX 4096
+# endif
+# ifndef MAXPATHLEN
+# define MAXPATHLEN 4096
+# endif
+# endif
+
+# if defined(__SCO__) || defined(__UNIXWARE__)
+# ifndef PATH_MAX
+# define PATH_MAX 1024
+# endif
+# ifndef MAXPATHLEN
+# define MAXPATHLEN 1024
+# endif
+# endif
+
+# if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) \
+ || defined(__APPLE__) || defined(__DragonFly__)
+# ifndef CSRG_BASED
+# define CSRG_BASED
+# endif
+# endif
+
+#endif /* _XOSDEFS_H_ */
+
diff --git a/thirdparty/linuxbsd_headers/X11/Xutil.h b/thirdparty/linuxbsd_headers/X11/Xutil.h
new file mode 100644
index 0000000000..62cdf55563
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/Xutil.h
@@ -0,0 +1,838 @@
+
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _X11_XUTIL_H_
+#define _X11_XUTIL_H_
+
+/* You must include <X11/Xlib.h> before including this file */
+#include <X11/Xlib.h>
+#include <X11/keysym.h>
+
+/* The Xlib structs are full of implicit padding to properly align members.
+ We can't clean that up without breaking ABI, so tell clang not to bother
+ complaining about it. */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+/*
+ * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
+ * value (x, y, width, height) was found in the parsed string.
+ */
+#define NoValue 0x0000
+#define XValue 0x0001
+#define YValue 0x0002
+#define WidthValue 0x0004
+#define HeightValue 0x0008
+#define AllValues 0x000F
+#define XNegative 0x0010
+#define YNegative 0x0020
+
+/*
+ * new version containing base_width, base_height, and win_gravity fields;
+ * used with WM_NORMAL_HINTS.
+ */
+typedef struct {
+ long flags; /* marks which fields in this structure are defined */
+ int x, y; /* obsolete for new window mgrs, but clients */
+ int width, height; /* should set so old wm's don't mess up */
+ int min_width, min_height;
+ int max_width, max_height;
+ int width_inc, height_inc;
+ struct {
+ int x; /* numerator */
+ int y; /* denominator */
+ } min_aspect, max_aspect;
+ int base_width, base_height; /* added by ICCCM version 1 */
+ int win_gravity; /* added by ICCCM version 1 */
+} XSizeHints;
+
+/*
+ * The next block of definitions are for window manager properties that
+ * clients and applications use for communication.
+ */
+
+/* flags argument in size hints */
+#define USPosition (1L << 0) /* user specified x, y */
+#define USSize (1L << 1) /* user specified width, height */
+
+#define PPosition (1L << 2) /* program specified position */
+#define PSize (1L << 3) /* program specified size */
+#define PMinSize (1L << 4) /* program specified minimum size */
+#define PMaxSize (1L << 5) /* program specified maximum size */
+#define PResizeInc (1L << 6) /* program specified resize increments */
+#define PAspect (1L << 7) /* program specified min and max aspect ratios */
+#define PBaseSize (1L << 8) /* program specified base for incrementing */
+#define PWinGravity (1L << 9) /* program specified window gravity */
+
+/* obsolete */
+#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
+
+
+
+typedef struct {
+ long flags; /* marks which fields in this structure are defined */
+ Bool input; /* does this application rely on the window manager to
+ get keyboard input? */
+ int initial_state; /* see below */
+ Pixmap icon_pixmap; /* pixmap to be used as icon */
+ Window icon_window; /* window to be used as icon */
+ int icon_x, icon_y; /* initial position of icon */
+ Pixmap icon_mask; /* icon mask bitmap */
+ XID window_group; /* id of related window group */
+ /* this structure may be extended in the future */
+} XWMHints;
+
+/* definition for flags of XWMHints */
+
+#define InputHint (1L << 0)
+#define StateHint (1L << 1)
+#define IconPixmapHint (1L << 2)
+#define IconWindowHint (1L << 3)
+#define IconPositionHint (1L << 4)
+#define IconMaskHint (1L << 5)
+#define WindowGroupHint (1L << 6)
+#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
+IconPositionHint|IconMaskHint|WindowGroupHint)
+#define XUrgencyHint (1L << 8)
+
+/* definitions for initial window state */
+#define WithdrawnState 0 /* for windows that are not mapped */
+#define NormalState 1 /* most applications want to start this way */
+#define IconicState 3 /* application wants to start as an icon */
+
+/*
+ * Obsolete states no longer defined by ICCCM
+ */
+#define DontCareState 0 /* don't know or care */
+#define ZoomState 2 /* application wants to start zoomed */
+#define InactiveState 4 /* application believes it is seldom used; */
+ /* some wm's may put it on inactive menu */
+
+
+/*
+ * new structure for manipulating TEXT properties; used with WM_NAME,
+ * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
+ */
+typedef struct {
+ unsigned char *value; /* same as Property routines */
+ Atom encoding; /* prop type */
+ int format; /* prop data format: 8, 16, or 32 */
+ unsigned long nitems; /* number of data items in value */
+} XTextProperty;
+
+#define XNoMemory -1
+#define XLocaleNotSupported -2
+#define XConverterNotFound -3
+
+typedef enum {
+ XStringStyle, /* STRING */
+ XCompoundTextStyle, /* COMPOUND_TEXT */
+ XTextStyle, /* text in owner's encoding (current locale)*/
+ XStdICCTextStyle, /* STRING, else COMPOUND_TEXT */
+ /* The following is an XFree86 extension, introduced in November 2000 */
+ XUTF8StringStyle /* UTF8_STRING */
+} XICCEncodingStyle;
+
+typedef struct {
+ int min_width, min_height;
+ int max_width, max_height;
+ int width_inc, height_inc;
+} XIconSize;
+
+typedef struct {
+ char *res_name;
+ char *res_class;
+} XClassHint;
+
+#ifdef XUTIL_DEFINE_FUNCTIONS
+extern int XDestroyImage(
+ XImage *ximage);
+extern unsigned long XGetPixel(
+ XImage *ximage,
+ int x, int y);
+extern int XPutPixel(
+ XImage *ximage,
+ int x, int y,
+ unsigned long pixel);
+extern XImage *XSubImage(
+ XImage *ximage,
+ int x, int y,
+ unsigned int width, unsigned int height);
+extern int XAddPixel(
+ XImage *ximage,
+ long value);
+#else
+/*
+ * These macros are used to give some sugar to the image routines so that
+ * naive people are more comfortable with them.
+ */
+#define XDestroyImage(ximage) \
+ ((*((ximage)->f.destroy_image))((ximage)))
+#define XGetPixel(ximage, x, y) \
+ ((*((ximage)->f.get_pixel))((ximage), (x), (y)))
+#define XPutPixel(ximage, x, y, pixel) \
+ ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
+#define XSubImage(ximage, x, y, width, height) \
+ ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
+#define XAddPixel(ximage, value) \
+ ((*((ximage)->f.add_pixel))((ximage), (value)))
+#endif
+
+/*
+ * Compose sequence status structure, used in calling XLookupString.
+ */
+typedef struct _XComposeStatus {
+ XPointer compose_ptr; /* state table pointer */
+ int chars_matched; /* match state */
+} XComposeStatus;
+
+/*
+ * Keysym macros, used on Keysyms to test for classes of symbols
+ */
+#define IsKeypadKey(keysym) \
+ (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal))
+
+#define IsPrivateKeypadKey(keysym) \
+ (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
+
+#define IsCursorKey(keysym) \
+ (((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select))
+
+#define IsPFKey(keysym) \
+ (((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4))
+
+#define IsFunctionKey(keysym) \
+ (((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35))
+
+#define IsMiscFunctionKey(keysym) \
+ (((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break))
+
+#ifdef XK_XKB_KEYS
+#define IsModifierKey(keysym) \
+ ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
+ || (((KeySym)(keysym) >= XK_ISO_Lock) && \
+ ((KeySym)(keysym) <= XK_ISO_Level5_Lock)) \
+ || ((KeySym)(keysym) == XK_Mode_switch) \
+ || ((KeySym)(keysym) == XK_Num_Lock))
+#else
+#define IsModifierKey(keysym) \
+ ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
+ || ((KeySym)(keysym) == XK_Mode_switch) \
+ || ((KeySym)(keysym) == XK_Num_Lock))
+#endif
+/*
+ * opaque reference to Region data type
+ */
+typedef struct _XRegion *Region;
+
+/* Return values from XRectInRegion() */
+
+#define RectangleOut 0
+#define RectangleIn 1
+#define RectanglePart 2
+
+
+/*
+ * Information used by the visual utility routines to find desired visual
+ * type from the many visuals a display may support.
+ */
+
+typedef struct {
+ Visual *visual;
+ VisualID visualid;
+ int screen;
+ int depth;
+#if defined(__cplusplus) || defined(c_plusplus)
+ int c_class; /* C++ */
+#else
+ int class;
+#endif
+ unsigned long red_mask;
+ unsigned long green_mask;
+ unsigned long blue_mask;
+ int colormap_size;
+ int bits_per_rgb;
+} XVisualInfo;
+
+#define VisualNoMask 0x0
+#define VisualIDMask 0x1
+#define VisualScreenMask 0x2
+#define VisualDepthMask 0x4
+#define VisualClassMask 0x8
+#define VisualRedMaskMask 0x10
+#define VisualGreenMaskMask 0x20
+#define VisualBlueMaskMask 0x40
+#define VisualColormapSizeMask 0x80
+#define VisualBitsPerRGBMask 0x100
+#define VisualAllMask 0x1FF
+
+/*
+ * This defines a window manager property that clients may use to
+ * share standard color maps of type RGB_COLOR_MAP:
+ */
+typedef struct {
+ Colormap colormap;
+ unsigned long red_max;
+ unsigned long red_mult;
+ unsigned long green_max;
+ unsigned long green_mult;
+ unsigned long blue_max;
+ unsigned long blue_mult;
+ unsigned long base_pixel;
+ VisualID visualid; /* added by ICCCM version 1 */
+ XID killid; /* added by ICCCM version 1 */
+} XStandardColormap;
+
+#define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */
+
+
+/*
+ * return codes for XReadBitmapFile and XWriteBitmapFile
+ */
+#define BitmapSuccess 0
+#define BitmapOpenFailed 1
+#define BitmapFileInvalid 2
+#define BitmapNoMemory 3
+
+/****************************************************************
+ *
+ * Context Management
+ *
+ ****************************************************************/
+
+
+/* Associative lookup table return codes */
+
+#define XCSUCCESS 0 /* No error. */
+#define XCNOMEM 1 /* Out of memory */
+#define XCNOENT 2 /* No entry in table */
+
+typedef int XContext;
+
+#define XUniqueContext() ((XContext) XrmUniqueQuark())
+#define XStringToContext(string) ((XContext) XrmStringToQuark(string))
+
+_XFUNCPROTOBEGIN
+
+/* The following declarations are alphabetized. */
+
+extern XClassHint *XAllocClassHint (
+ void
+);
+
+extern XIconSize *XAllocIconSize (
+ void
+);
+
+extern XSizeHints *XAllocSizeHints (
+ void
+);
+
+extern XStandardColormap *XAllocStandardColormap (
+ void
+);
+
+extern XWMHints *XAllocWMHints (
+ void
+);
+
+extern int XClipBox(
+ Region /* r */,
+ XRectangle* /* rect_return */
+);
+
+extern Region XCreateRegion(
+ void
+);
+
+extern const char *XDefaultString (void);
+
+extern int XDeleteContext(
+ Display* /* display */,
+ XID /* rid */,
+ XContext /* context */
+);
+
+extern int XDestroyRegion(
+ Region /* r */
+);
+
+extern int XEmptyRegion(
+ Region /* r */
+);
+
+extern int XEqualRegion(
+ Region /* r1 */,
+ Region /* r2 */
+);
+
+extern int XFindContext(
+ Display* /* display */,
+ XID /* rid */,
+ XContext /* context */,
+ XPointer* /* data_return */
+);
+
+extern Status XGetClassHint(
+ Display* /* display */,
+ Window /* w */,
+ XClassHint* /* class_hints_return */
+);
+
+extern Status XGetIconSizes(
+ Display* /* display */,
+ Window /* w */,
+ XIconSize** /* size_list_return */,
+ int* /* count_return */
+);
+
+extern Status XGetNormalHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints_return */
+);
+
+extern Status XGetRGBColormaps(
+ Display* /* display */,
+ Window /* w */,
+ XStandardColormap** /* stdcmap_return */,
+ int* /* count_return */,
+ Atom /* property */
+);
+
+extern Status XGetSizeHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints_return */,
+ Atom /* property */
+);
+
+extern Status XGetStandardColormap(
+ Display* /* display */,
+ Window /* w */,
+ XStandardColormap* /* colormap_return */,
+ Atom /* property */
+);
+
+extern Status XGetTextProperty(
+ Display* /* display */,
+ Window /* window */,
+ XTextProperty* /* text_prop_return */,
+ Atom /* property */
+);
+
+extern XVisualInfo *XGetVisualInfo(
+ Display* /* display */,
+ long /* vinfo_mask */,
+ XVisualInfo* /* vinfo_template */,
+ int* /* nitems_return */
+);
+
+extern Status XGetWMClientMachine(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* text_prop_return */
+);
+
+extern XWMHints *XGetWMHints(
+ Display* /* display */,
+ Window /* w */
+);
+
+extern Status XGetWMIconName(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* text_prop_return */
+);
+
+extern Status XGetWMName(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* text_prop_return */
+);
+
+extern Status XGetWMNormalHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints_return */,
+ long* /* supplied_return */
+);
+
+extern Status XGetWMSizeHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints_return */,
+ long* /* supplied_return */,
+ Atom /* property */
+);
+
+extern Status XGetZoomHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* zhints_return */
+);
+
+extern int XIntersectRegion(
+ Region /* sra */,
+ Region /* srb */,
+ Region /* dr_return */
+);
+
+extern void XConvertCase(
+ KeySym /* sym */,
+ KeySym* /* lower */,
+ KeySym* /* upper */
+);
+
+extern int XLookupString(
+ XKeyEvent* /* event_struct */,
+ char* /* buffer_return */,
+ int /* bytes_buffer */,
+ KeySym* /* keysym_return */,
+ XComposeStatus* /* status_in_out */
+);
+
+extern Status XMatchVisualInfo(
+ Display* /* display */,
+ int /* screen */,
+ int /* depth */,
+ int /* class */,
+ XVisualInfo* /* vinfo_return */
+);
+
+extern int XOffsetRegion(
+ Region /* r */,
+ int /* dx */,
+ int /* dy */
+);
+
+extern Bool XPointInRegion(
+ Region /* r */,
+ int /* x */,
+ int /* y */
+);
+
+extern Region XPolygonRegion(
+ XPoint* /* points */,
+ int /* n */,
+ int /* fill_rule */
+);
+
+extern int XRectInRegion(
+ Region /* r */,
+ int /* x */,
+ int /* y */,
+ unsigned int /* width */,
+ unsigned int /* height */
+);
+
+extern int XSaveContext(
+ Display* /* display */,
+ XID /* rid */,
+ XContext /* context */,
+ _Xconst char* /* data */
+);
+
+extern int XSetClassHint(
+ Display* /* display */,
+ Window /* w */,
+ XClassHint* /* class_hints */
+);
+
+extern int XSetIconSizes(
+ Display* /* display */,
+ Window /* w */,
+ XIconSize* /* size_list */,
+ int /* count */
+);
+
+extern int XSetNormalHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints */
+);
+
+extern void XSetRGBColormaps(
+ Display* /* display */,
+ Window /* w */,
+ XStandardColormap* /* stdcmaps */,
+ int /* count */,
+ Atom /* property */
+);
+
+extern int XSetSizeHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints */,
+ Atom /* property */
+);
+
+extern int XSetStandardProperties(
+ Display* /* display */,
+ Window /* w */,
+ _Xconst char* /* window_name */,
+ _Xconst char* /* icon_name */,
+ Pixmap /* icon_pixmap */,
+ char** /* argv */,
+ int /* argc */,
+ XSizeHints* /* hints */
+);
+
+extern void XSetTextProperty(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* text_prop */,
+ Atom /* property */
+);
+
+extern void XSetWMClientMachine(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* text_prop */
+);
+
+extern int XSetWMHints(
+ Display* /* display */,
+ Window /* w */,
+ XWMHints* /* wm_hints */
+);
+
+extern void XSetWMIconName(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* text_prop */
+);
+
+extern void XSetWMName(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* text_prop */
+);
+
+extern void XSetWMNormalHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints */
+);
+
+extern void XSetWMProperties(
+ Display* /* display */,
+ Window /* w */,
+ XTextProperty* /* window_name */,
+ XTextProperty* /* icon_name */,
+ char** /* argv */,
+ int /* argc */,
+ XSizeHints* /* normal_hints */,
+ XWMHints* /* wm_hints */,
+ XClassHint* /* class_hints */
+);
+
+extern void XmbSetWMProperties(
+ Display* /* display */,
+ Window /* w */,
+ _Xconst char* /* window_name */,
+ _Xconst char* /* icon_name */,
+ char** /* argv */,
+ int /* argc */,
+ XSizeHints* /* normal_hints */,
+ XWMHints* /* wm_hints */,
+ XClassHint* /* class_hints */
+);
+
+extern void Xutf8SetWMProperties(
+ Display* /* display */,
+ Window /* w */,
+ _Xconst char* /* window_name */,
+ _Xconst char* /* icon_name */,
+ char** /* argv */,
+ int /* argc */,
+ XSizeHints* /* normal_hints */,
+ XWMHints* /* wm_hints */,
+ XClassHint* /* class_hints */
+);
+
+extern void XSetWMSizeHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* hints */,
+ Atom /* property */
+);
+
+extern int XSetRegion(
+ Display* /* display */,
+ GC /* gc */,
+ Region /* r */
+);
+
+extern void XSetStandardColormap(
+ Display* /* display */,
+ Window /* w */,
+ XStandardColormap* /* colormap */,
+ Atom /* property */
+);
+
+extern int XSetZoomHints(
+ Display* /* display */,
+ Window /* w */,
+ XSizeHints* /* zhints */
+);
+
+extern int XShrinkRegion(
+ Region /* r */,
+ int /* dx */,
+ int /* dy */
+);
+
+extern Status XStringListToTextProperty(
+ char** /* list */,
+ int /* count */,
+ XTextProperty* /* text_prop_return */
+);
+
+extern int XSubtractRegion(
+ Region /* sra */,
+ Region /* srb */,
+ Region /* dr_return */
+);
+
+extern int XmbTextListToTextProperty(
+ Display* display,
+ char** list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty* text_prop_return
+);
+
+extern int XwcTextListToTextProperty(
+ Display* display,
+ wchar_t** list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty* text_prop_return
+);
+
+extern int Xutf8TextListToTextProperty(
+ Display* display,
+ char** list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty* text_prop_return
+);
+
+extern void XwcFreeStringList(
+ wchar_t** list
+);
+
+extern Status XTextPropertyToStringList(
+ XTextProperty* /* text_prop */,
+ char*** /* list_return */,
+ int* /* count_return */
+);
+
+extern int XmbTextPropertyToTextList(
+ Display* display,
+ const XTextProperty* text_prop,
+ char*** list_return,
+ int* count_return
+);
+
+extern int XwcTextPropertyToTextList(
+ Display* display,
+ const XTextProperty* text_prop,
+ wchar_t*** list_return,
+ int* count_return
+);
+
+extern int Xutf8TextPropertyToTextList(
+ Display* display,
+ const XTextProperty* text_prop,
+ char*** list_return,
+ int* count_return
+);
+
+extern int XUnionRectWithRegion(
+ XRectangle* /* rectangle */,
+ Region /* src_region */,
+ Region /* dest_region_return */
+);
+
+extern int XUnionRegion(
+ Region /* sra */,
+ Region /* srb */,
+ Region /* dr_return */
+);
+
+extern int XWMGeometry(
+ Display* /* display */,
+ int /* screen_number */,
+ _Xconst char* /* user_geometry */,
+ _Xconst char* /* default_geometry */,
+ unsigned int /* border_width */,
+ XSizeHints* /* hints */,
+ int* /* x_return */,
+ int* /* y_return */,
+ int* /* width_return */,
+ int* /* height_return */,
+ int* /* gravity_return */
+);
+
+extern int XXorRegion(
+ Region /* sra */,
+ Region /* srb */,
+ Region /* dr_return */
+);
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+_XFUNCPROTOEND
+
+#endif /* _X11_XUTIL_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/XI2.h b/thirdparty/linuxbsd_headers/X11/extensions/XI2.h
new file mode 100644
index 0000000000..cc47085df0
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/XI2.h
@@ -0,0 +1,259 @@
+/*
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ * 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 (including the next
+ * paragraph) 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 _XI2_H_
+#define _XI2_H_
+
+#define XInput_2_0 7
+/* DO NOT ADD TO THIS LIST. These are libXi-specific defines.
+ See commit libXi-1.4.2-21-ge8531dd */
+
+#define XI_2_Major 2
+#define XI_2_Minor 4
+
+/* Property event flags */
+#define XIPropertyDeleted 0
+#define XIPropertyCreated 1
+#define XIPropertyModified 2
+
+/* Property modes */
+#define XIPropModeReplace 0
+#define XIPropModePrepend 1
+#define XIPropModeAppend 2
+
+/* Special property type used for XIGetProperty */
+#define XIAnyPropertyType 0L
+
+/* Enter/Leave and Focus In/Out modes */
+#define XINotifyNormal 0
+#define XINotifyGrab 1
+#define XINotifyUngrab 2
+#define XINotifyWhileGrabbed 3
+#define XINotifyPassiveGrab 4
+#define XINotifyPassiveUngrab 5
+
+/* Enter/Leave and focus In/out detail */
+#define XINotifyAncestor 0
+#define XINotifyVirtual 1
+#define XINotifyInferior 2
+#define XINotifyNonlinear 3
+#define XINotifyNonlinearVirtual 4
+#define XINotifyPointer 5
+#define XINotifyPointerRoot 6
+#define XINotifyDetailNone 7
+
+/* Grab modes */
+#define XIGrabModeSync 0
+#define XIGrabModeAsync 1
+#define XIGrabModeTouch 2
+
+/* Grab reply status codes */
+#define XIGrabSuccess 0
+#define XIAlreadyGrabbed 1
+#define XIGrabInvalidTime 2
+#define XIGrabNotViewable 3
+#define XIGrabFrozen 4
+
+/* Grab owner events values */
+#define XIOwnerEvents True
+#define XINoOwnerEvents False
+
+/* Passive grab types */
+#define XIGrabtypeButton 0
+#define XIGrabtypeKeycode 1
+#define XIGrabtypeEnter 2
+#define XIGrabtypeFocusIn 3
+#define XIGrabtypeTouchBegin 4
+#define XIGrabtypeGesturePinchBegin 5
+#define XIGrabtypeGestureSwipeBegin 6
+
+/* Passive grab modifier */
+#define XIAnyModifier (1U << 31)
+#define XIAnyButton 0
+#define XIAnyKeycode 0
+
+/* XIAllowEvents event-modes */
+#define XIAsyncDevice 0
+#define XISyncDevice 1
+#define XIReplayDevice 2
+#define XIAsyncPairedDevice 3
+#define XIAsyncPair 4
+#define XISyncPair 5
+#define XIAcceptTouch 6
+#define XIRejectTouch 7
+
+/* DeviceChangedEvent change reasons */
+#define XISlaveSwitch 1
+#define XIDeviceChange 2
+
+/* Hierarchy flags */
+#define XIMasterAdded (1 << 0)
+#define XIMasterRemoved (1 << 1)
+#define XISlaveAdded (1 << 2)
+#define XISlaveRemoved (1 << 3)
+#define XISlaveAttached (1 << 4)
+#define XISlaveDetached (1 << 5)
+#define XIDeviceEnabled (1 << 6)
+#define XIDeviceDisabled (1 << 7)
+
+/* ChangeHierarchy constants */
+#define XIAddMaster 1
+#define XIRemoveMaster 2
+#define XIAttachSlave 3
+#define XIDetachSlave 4
+
+#define XIAttachToMaster 1
+#define XIFloating 2
+
+/* Valuator modes */
+#define XIModeRelative 0
+#define XIModeAbsolute 1
+
+/* Device types */
+#define XIMasterPointer 1
+#define XIMasterKeyboard 2
+#define XISlavePointer 3
+#define XISlaveKeyboard 4
+#define XIFloatingSlave 5
+
+/* Device classes: classes that are not identical to Xi 1.x classes must be
+ * numbered starting from 8. */
+#define XIKeyClass 0
+#define XIButtonClass 1
+#define XIValuatorClass 2
+#define XIScrollClass 3
+#define XITouchClass 8
+#define XIGestureClass 9
+
+/* Scroll class types */
+#define XIScrollTypeVertical 1
+#define XIScrollTypeHorizontal 2
+
+/* Scroll class flags */
+#define XIScrollFlagNoEmulation (1 << 0)
+#define XIScrollFlagPreferred (1 << 1)
+
+/* Device event flags (common) */
+/* Device event flags (key events only) */
+#define XIKeyRepeat (1 << 16)
+/* Device event flags (pointer events only) */
+#define XIPointerEmulated (1 << 16)
+/* Device event flags (touch events only) */
+#define XITouchPendingEnd (1 << 16)
+#define XITouchEmulatingPointer (1 << 17)
+
+/* Barrier event flags */
+#define XIBarrierPointerReleased (1 << 0)
+#define XIBarrierDeviceIsGrabbed (1 << 1)
+
+/* Gesture pinch event flags */
+#define XIGesturePinchEventCancelled (1 << 0)
+
+/* Gesture swipe event flags */
+#define XIGestureSwipeEventCancelled (1 << 0)
+
+/* Touch modes */
+#define XIDirectTouch 1
+#define XIDependentTouch 2
+
+/* XI2 event mask macros */
+#define XISetMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] |= (1 << ((event) & 7)))
+#define XIClearMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &= ~(1 << ((event) & 7)))
+#define XIMaskIsSet(ptr, event) (((unsigned char*)(ptr))[(event)>>3] & (1 << ((event) & 7)))
+#define XIMaskLen(event) (((event) >> 3) + 1)
+
+/* Fake device ID's for event selection */
+#define XIAllDevices 0
+#define XIAllMasterDevices 1
+
+/* Event types */
+#define XI_DeviceChanged 1
+#define XI_KeyPress 2
+#define XI_KeyRelease 3
+#define XI_ButtonPress 4
+#define XI_ButtonRelease 5
+#define XI_Motion 6
+#define XI_Enter 7
+#define XI_Leave 8
+#define XI_FocusIn 9
+#define XI_FocusOut 10
+#define XI_HierarchyChanged 11
+#define XI_PropertyEvent 12
+#define XI_RawKeyPress 13
+#define XI_RawKeyRelease 14
+#define XI_RawButtonPress 15
+#define XI_RawButtonRelease 16
+#define XI_RawMotion 17
+#define XI_TouchBegin 18 /* XI 2.2 */
+#define XI_TouchUpdate 19
+#define XI_TouchEnd 20
+#define XI_TouchOwnership 21
+#define XI_RawTouchBegin 22
+#define XI_RawTouchUpdate 23
+#define XI_RawTouchEnd 24
+#define XI_BarrierHit 25 /* XI 2.3 */
+#define XI_BarrierLeave 26
+#define XI_GesturePinchBegin 27 /* XI 2.4 */
+#define XI_GesturePinchUpdate 28
+#define XI_GesturePinchEnd 29
+#define XI_GestureSwipeBegin 30
+#define XI_GestureSwipeUpdate 31
+#define XI_GestureSwipeEnd 32
+#define XI_LASTEVENT XI_GestureSwipeEnd
+/* NOTE: XI2LASTEVENT in xserver/include/inputstr.h must be the same value
+ * as XI_LASTEVENT if the server is supposed to handle masks etc. for this
+ * type of event. */
+
+/* Event masks.
+ * Note: the protocol spec defines a mask to be of (1 << type). Clients are
+ * free to create masks by bitshifting instead of using these defines.
+ */
+#define XI_DeviceChangedMask (1 << XI_DeviceChanged)
+#define XI_KeyPressMask (1 << XI_KeyPress)
+#define XI_KeyReleaseMask (1 << XI_KeyRelease)
+#define XI_ButtonPressMask (1 << XI_ButtonPress)
+#define XI_ButtonReleaseMask (1 << XI_ButtonRelease)
+#define XI_MotionMask (1 << XI_Motion)
+#define XI_EnterMask (1 << XI_Enter)
+#define XI_LeaveMask (1 << XI_Leave)
+#define XI_FocusInMask (1 << XI_FocusIn)
+#define XI_FocusOutMask (1 << XI_FocusOut)
+#define XI_HierarchyChangedMask (1 << XI_HierarchyChanged)
+#define XI_PropertyEventMask (1 << XI_PropertyEvent)
+#define XI_RawKeyPressMask (1 << XI_RawKeyPress)
+#define XI_RawKeyReleaseMask (1 << XI_RawKeyRelease)
+#define XI_RawButtonPressMask (1 << XI_RawButtonPress)
+#define XI_RawButtonReleaseMask (1 << XI_RawButtonRelease)
+#define XI_RawMotionMask (1 << XI_RawMotion)
+#define XI_TouchBeginMask (1 << XI_TouchBegin)
+#define XI_TouchEndMask (1 << XI_TouchEnd)
+#define XI_TouchOwnershipChangedMask (1 << XI_TouchOwnership)
+#define XI_TouchUpdateMask (1 << XI_TouchUpdate)
+#define XI_RawTouchBeginMask (1 << XI_RawTouchBegin)
+#define XI_RawTouchEndMask (1 << XI_RawTouchEnd)
+#define XI_RawTouchUpdateMask (1 << XI_RawTouchUpdate)
+#define XI_BarrierHitMask (1 << XI_BarrierHit)
+#define XI_BarrierLeaveMask (1 << XI_BarrierLeave)
+
+#endif /* _XI2_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/XInput2.h b/thirdparty/linuxbsd_headers/X11/extensions/XInput2.h
new file mode 100644
index 0000000000..33670ebf20
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/XInput2.h
@@ -0,0 +1,657 @@
+/*
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ * 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 (including the next
+ * paragraph) 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.
+ *
+ */
+
+/* Definitions used by the library and client */
+
+#ifndef _XINPUT2_H_
+#define _XINPUT2_H_
+
+#include <X11/Xlib.h>
+#include <X11/extensions/XI2.h>
+#include <X11/extensions/Xge.h>
+#include <X11/extensions/Xfixes.h> /* PointerBarrier */
+
+/*******************************************************************
+ *
+ */
+typedef struct {
+ int type;
+ char* name;
+ Bool send_core;
+ Bool enable;
+} XIAddMasterInfo;
+
+typedef struct {
+ int type;
+ int deviceid;
+ int return_mode; /* AttachToMaster, Floating */
+ int return_pointer;
+ int return_keyboard;
+} XIRemoveMasterInfo;
+
+typedef struct {
+ int type;
+ int deviceid;
+ int new_master;
+} XIAttachSlaveInfo;
+
+typedef struct {
+ int type;
+ int deviceid;
+} XIDetachSlaveInfo;
+
+typedef union {
+ int type; /* must be first element */
+ XIAddMasterInfo add;
+ XIRemoveMasterInfo remove;
+ XIAttachSlaveInfo attach;
+ XIDetachSlaveInfo detach;
+} XIAnyHierarchyChangeInfo;
+
+typedef struct
+{
+ int base;
+ int latched;
+ int locked;
+ int effective;
+} XIModifierState;
+
+typedef XIModifierState XIGroupState;
+
+typedef struct {
+ int mask_len;
+ unsigned char *mask;
+} XIButtonState;
+
+typedef struct {
+ int mask_len;
+ unsigned char *mask;
+ double *values;
+} XIValuatorState;
+
+
+typedef struct
+{
+ int deviceid;
+ int mask_len;
+ unsigned char* mask;
+} XIEventMask;
+
+typedef struct
+{
+ int type;
+ int sourceid;
+} XIAnyClassInfo;
+
+typedef struct
+{
+ int type;
+ int sourceid;
+ int num_buttons;
+ Atom *labels;
+ XIButtonState state;
+} XIButtonClassInfo;
+
+typedef struct
+{
+ int type;
+ int sourceid;
+ int num_keycodes;
+ int *keycodes;
+} XIKeyClassInfo;
+
+typedef struct
+{
+ int type;
+ int sourceid;
+ int number;
+ Atom label;
+ double min;
+ double max;
+ double value;
+ int resolution;
+ int mode;
+} XIValuatorClassInfo;
+
+/* new in XI 2.1 */
+typedef struct
+{
+ int type;
+ int sourceid;
+ int number;
+ int scroll_type;
+ double increment;
+ int flags;
+} XIScrollClassInfo;
+
+typedef struct
+{
+ int type;
+ int sourceid;
+ int mode;
+ int num_touches;
+} XITouchClassInfo;
+
+typedef struct
+{
+ int deviceid;
+ char *name;
+ int use;
+ int attachment;
+ Bool enabled;
+ int num_classes;
+ XIAnyClassInfo **classes;
+} XIDeviceInfo;
+
+typedef struct
+{
+ int modifiers;
+ int status;
+} XIGrabModifiers;
+
+typedef unsigned int BarrierEventID;
+
+typedef struct
+{
+ int deviceid;
+ PointerBarrier barrier;
+ BarrierEventID eventid;
+} XIBarrierReleasePointerInfo;
+
+/**
+ * Generic XI2 event. All XI2 events have the same header.
+ */
+typedef struct {
+ int type; /* GenericEvent */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ int extension; /* XI extension offset */
+ int evtype;
+ Time time;
+} XIEvent;
+
+
+typedef struct {
+ int deviceid;
+ int attachment;
+ int use;
+ Bool enabled;
+ int flags;
+} XIHierarchyInfo;
+
+/*
+ * Notifies the client that the device hierarchy has been changed. The client
+ * is expected to re-query the server for the device hierarchy.
+ */
+typedef struct {
+ int type; /* GenericEvent */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ int extension; /* XI extension offset */
+ int evtype; /* XI_HierarchyChanged */
+ Time time;
+ int flags;
+ int num_info;
+ XIHierarchyInfo *info;
+} XIHierarchyEvent;
+
+/*
+ * Notifies the client that the classes have been changed. This happens when
+ * the slave device that sends through the master changes.
+ */
+typedef struct {
+ int type; /* GenericEvent */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ int extension; /* XI extension offset */
+ int evtype; /* XI_DeviceChanged */
+ Time time;
+ int deviceid; /* id of the device that changed */
+ int sourceid; /* Source for the new classes. */
+ int reason; /* Reason for the change */
+ int num_classes;
+ XIAnyClassInfo **classes; /* same as in XIDeviceInfo */
+} XIDeviceChangedEvent;
+
+typedef struct {
+ int type; /* GenericEvent */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ int extension; /* XI extension offset */
+ int evtype;
+ Time time;
+ int deviceid;
+ int sourceid;
+ int detail;
+ Window root;
+ Window event;
+ Window child;
+ double root_x;
+ double root_y;
+ double event_x;
+ double event_y;
+ int flags;
+ XIButtonState buttons;
+ XIValuatorState valuators;
+ XIModifierState mods;
+ XIGroupState group;
+} XIDeviceEvent;
+
+typedef struct {
+ int type; /* GenericEvent */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ int extension; /* XI extension offset */
+ int evtype; /* XI_RawKeyPress, XI_RawKeyRelease, etc. */
+ Time time;
+ int deviceid;
+ int sourceid; /* Bug: Always 0. https://bugs.freedesktop.org//show_bug.cgi?id=34240 */
+ int detail;
+ int flags;
+ XIValuatorState valuators;
+ double *raw_values;
+} XIRawEvent;
+
+typedef struct {
+ int type; /* GenericEvent */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ int extension; /* XI extension offset */
+ int evtype;
+ Time time;
+ int deviceid;
+ int sourceid;
+ int detail;
+ Window root;
+ Window event;
+ Window child;
+ double root_x;
+ double root_y;
+ double event_x;
+ double event_y;
+ int mode;
+ Bool focus;
+ Bool same_screen;
+ XIButtonState buttons;
+ XIModifierState mods;
+ XIGroupState group;
+} XIEnterEvent;
+
+typedef XIEnterEvent XILeaveEvent;
+typedef XIEnterEvent XIFocusInEvent;
+typedef XIEnterEvent XIFocusOutEvent;
+
+typedef struct {
+ int type; /* GenericEvent */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ int extension; /* XI extension offset */
+ int evtype; /* XI_PropertyEvent */
+ Time time;
+ int deviceid; /* id of the device that changed */
+ Atom property;
+ int what;
+} XIPropertyEvent;
+
+typedef struct {
+ int type; /* GenericEvent */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ int extension; /* XI extension offset */
+ int evtype;
+ Time time;
+ int deviceid;
+ int sourceid;
+ unsigned int touchid;
+ Window root;
+ Window event;
+ Window child;
+ int flags;
+} XITouchOwnershipEvent;
+
+typedef struct {
+ int type; /* GenericEvent */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ int extension; /* XI extension offset */
+ int evtype;
+ Time time;
+ int deviceid;
+ int sourceid;
+ Window event;
+ Window root;
+ double root_x;
+ double root_y;
+ double dx;
+ double dy;
+ int dtime;
+ int flags;
+ PointerBarrier barrier;
+ BarrierEventID eventid;
+} XIBarrierEvent;
+
+_XFUNCPROTOBEGIN
+
+extern Bool XIQueryPointer(
+ Display* display,
+ int deviceid,
+ Window win,
+ Window* root,
+ Window* child,
+ double* root_x,
+ double* root_y,
+ double* win_x,
+ double* win_y,
+ XIButtonState *buttons,
+ XIModifierState *mods,
+ XIGroupState *group
+);
+
+extern Bool XIWarpPointer(
+ Display* display,
+ int deviceid,
+ Window src_win,
+ Window dst_win,
+ double src_x,
+ double src_y,
+ unsigned int src_width,
+ unsigned int src_height,
+ double dst_x,
+ double dst_y
+);
+
+extern Status XIDefineCursor(
+ Display* display,
+ int deviceid,
+ Window win,
+ Cursor cursor
+);
+
+extern Status XIUndefineCursor(
+ Display* display,
+ int deviceid,
+ Window win
+);
+
+extern Status XIChangeHierarchy(
+ Display* display,
+ XIAnyHierarchyChangeInfo* changes,
+ int num_changes
+);
+
+extern Status XISetClientPointer(
+ Display* dpy,
+ Window win,
+ int deviceid
+);
+
+extern Bool XIGetClientPointer(
+ Display* dpy,
+ Window win,
+ int* deviceid
+);
+
+extern int XISelectEvents(
+ Display* dpy,
+ Window win,
+ XIEventMask *masks,
+ int num_masks
+);
+
+extern XIEventMask *XIGetSelectedEvents(
+ Display* dpy,
+ Window win,
+ int *num_masks_return
+);
+
+extern Status XIQueryVersion(
+ Display* dpy,
+ int* major_version_inout,
+ int* minor_version_inout
+);
+
+extern XIDeviceInfo* XIQueryDevice(
+ Display* dpy,
+ int deviceid,
+ int* ndevices_return
+);
+
+extern Status XISetFocus(
+ Display* dpy,
+ int deviceid,
+ Window focus,
+ Time time
+);
+
+extern Status XIGetFocus(
+ Display* dpy,
+ int deviceid,
+ Window *focus_return);
+
+extern Status XIGrabDevice(
+ Display* dpy,
+ int deviceid,
+ Window grab_window,
+ Time time,
+ Cursor cursor,
+ int grab_mode,
+ int paired_device_mode,
+ Bool owner_events,
+ XIEventMask *mask
+);
+
+extern Status XIUngrabDevice(
+ Display* dpy,
+ int deviceid,
+ Time time
+);
+
+extern Status XIAllowEvents(
+ Display* display,
+ int deviceid,
+ int event_mode,
+ Time time
+);
+
+extern Status XIAllowTouchEvents(
+ Display* display,
+ int deviceid,
+ unsigned int touchid,
+ Window grab_window,
+ int event_mode
+);
+
+extern int XIGrabButton(
+ Display* display,
+ int deviceid,
+ int button,
+ Window grab_window,
+ Cursor cursor,
+ int grab_mode,
+ int paired_device_mode,
+ int owner_events,
+ XIEventMask *mask,
+ int num_modifiers,
+ XIGrabModifiers *modifiers_inout
+);
+
+extern int XIGrabKeycode(
+ Display* display,
+ int deviceid,
+ int keycode,
+ Window grab_window,
+ int grab_mode,
+ int paired_device_mode,
+ int owner_events,
+ XIEventMask *mask,
+ int num_modifiers,
+ XIGrabModifiers *modifiers_inout
+);
+
+extern int XIGrabEnter(
+ Display* display,
+ int deviceid,
+ Window grab_window,
+ Cursor cursor,
+ int grab_mode,
+ int paired_device_mode,
+ int owner_events,
+ XIEventMask *mask,
+ int num_modifiers,
+ XIGrabModifiers *modifiers_inout
+);
+
+extern int XIGrabFocusIn(
+ Display* display,
+ int deviceid,
+ Window grab_window,
+ int grab_mode,
+ int paired_device_mode,
+ int owner_events,
+ XIEventMask *mask,
+ int num_modifiers,
+ XIGrabModifiers *modifiers_inout
+);
+
+extern int XIGrabTouchBegin(
+ Display* display,
+ int deviceid,
+ Window grab_window,
+ int owner_events,
+ XIEventMask *mask,
+ int num_modifiers,
+ XIGrabModifiers *modifiers_inout
+);
+
+extern Status XIUngrabButton(
+ Display* display,
+ int deviceid,
+ int button,
+ Window grab_window,
+ int num_modifiers,
+ XIGrabModifiers *modifiers
+);
+
+extern Status XIUngrabKeycode(
+ Display* display,
+ int deviceid,
+ int keycode,
+ Window grab_window,
+ int num_modifiers,
+ XIGrabModifiers *modifiers
+);
+
+extern Status XIUngrabEnter(
+ Display* display,
+ int deviceid,
+ Window grab_window,
+ int num_modifiers,
+ XIGrabModifiers *modifiers
+);
+
+extern Status XIUngrabFocusIn(
+ Display* display,
+ int deviceid,
+ Window grab_window,
+ int num_modifiers,
+ XIGrabModifiers *modifiers
+);
+
+extern Status XIUngrabTouchBegin(
+ Display* display,
+ int deviceid,
+ Window grab_window,
+ int num_modifiers,
+ XIGrabModifiers *modifiers
+);
+
+extern Atom *XIListProperties(
+ Display* display,
+ int deviceid,
+ int *num_props_return
+);
+
+extern void XIChangeProperty(
+ Display* display,
+ int deviceid,
+ Atom property,
+ Atom type,
+ int format,
+ int mode,
+ unsigned char *data,
+ int num_items
+);
+
+extern void
+XIDeleteProperty(
+ Display* display,
+ int deviceid,
+ Atom property
+);
+
+extern Status
+XIGetProperty(
+ Display* display,
+ int deviceid,
+ Atom property,
+ long offset,
+ long length,
+ Bool delete_property,
+ Atom type,
+ Atom *type_return,
+ int *format_return,
+ unsigned long *num_items_return,
+ unsigned long *bytes_after_return,
+ unsigned char **data
+);
+
+extern void
+XIBarrierReleasePointers(
+ Display* display,
+ XIBarrierReleasePointerInfo *barriers,
+ int num_barriers
+);
+
+extern void
+XIBarrierReleasePointer(
+ Display* display,
+ int deviceid,
+ PointerBarrier barrier,
+ BarrierEventID eventid
+);
+
+extern void XIFreeDeviceInfo(XIDeviceInfo *info);
+
+_XFUNCPROTOEND
+
+#endif /* XINPUT2_H */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/XKB.h b/thirdparty/linuxbsd_headers/X11/extensions/XKB.h
new file mode 100644
index 0000000000..5d3f87016f
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/XKB.h
@@ -0,0 +1,786 @@
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef _XKB_H_
+#define _XKB_H_
+
+ /*
+ * XKB request codes, used in:
+ * - xkbReqType field of all requests
+ * - requestMinor field of some events
+ */
+#define X_kbUseExtension 0
+#define X_kbSelectEvents 1
+#define X_kbBell 3
+#define X_kbGetState 4
+#define X_kbLatchLockState 5
+#define X_kbGetControls 6
+#define X_kbSetControls 7
+#define X_kbGetMap 8
+#define X_kbSetMap 9
+#define X_kbGetCompatMap 10
+#define X_kbSetCompatMap 11
+#define X_kbGetIndicatorState 12
+#define X_kbGetIndicatorMap 13
+#define X_kbSetIndicatorMap 14
+#define X_kbGetNamedIndicator 15
+#define X_kbSetNamedIndicator 16
+#define X_kbGetNames 17
+#define X_kbSetNames 18
+#define X_kbGetGeometry 19
+#define X_kbSetGeometry 20
+#define X_kbPerClientFlags 21
+#define X_kbListComponents 22
+#define X_kbGetKbdByName 23
+#define X_kbGetDeviceInfo 24
+#define X_kbSetDeviceInfo 25
+#define X_kbSetDebuggingFlags 101
+
+ /*
+ * In the X sense, XKB reports only one event.
+ * The type field of all XKB events is XkbEventCode
+ */
+#define XkbEventCode 0
+#define XkbNumberEvents (XkbEventCode+1)
+
+ /*
+ * XKB has a minor event code so it can use one X event code for
+ * multiple purposes.
+ * - reported in the xkbType field of all XKB events.
+ * - XkbSelectEventDetails: Indicates the event for which event details
+ * are being changed
+ */
+#define XkbNewKeyboardNotify 0
+#define XkbMapNotify 1
+#define XkbStateNotify 2
+#define XkbControlsNotify 3
+#define XkbIndicatorStateNotify 4
+#define XkbIndicatorMapNotify 5
+#define XkbNamesNotify 6
+#define XkbCompatMapNotify 7
+#define XkbBellNotify 8
+#define XkbActionMessage 9
+#define XkbAccessXNotify 10
+#define XkbExtensionDeviceNotify 11
+
+ /*
+ * Event Mask:
+ * - XkbSelectEvents: Specifies event interest.
+ */
+#define XkbNewKeyboardNotifyMask (1L << 0)
+#define XkbMapNotifyMask (1L << 1)
+#define XkbStateNotifyMask (1L << 2)
+#define XkbControlsNotifyMask (1L << 3)
+#define XkbIndicatorStateNotifyMask (1L << 4)
+#define XkbIndicatorMapNotifyMask (1L << 5)
+#define XkbNamesNotifyMask (1L << 6)
+#define XkbCompatMapNotifyMask (1L << 7)
+#define XkbBellNotifyMask (1L << 8)
+#define XkbActionMessageMask (1L << 9)
+#define XkbAccessXNotifyMask (1L << 10)
+#define XkbExtensionDeviceNotifyMask (1L << 11)
+#define XkbAllEventsMask (0xFFF)
+
+ /*
+ * NewKeyboardNotify event details:
+ */
+#define XkbNKN_KeycodesMask (1L << 0)
+#define XkbNKN_GeometryMask (1L << 1)
+#define XkbNKN_DeviceIDMask (1L << 2)
+#define XkbAllNewKeyboardEventsMask (0x7)
+
+ /*
+ * AccessXNotify event types:
+ * - The 'what' field of AccessXNotify events reports the
+ * reason that the event was generated.
+ */
+#define XkbAXN_SKPress 0
+#define XkbAXN_SKAccept 1
+#define XkbAXN_SKReject 2
+#define XkbAXN_SKRelease 3
+#define XkbAXN_BKAccept 4
+#define XkbAXN_BKReject 5
+#define XkbAXN_AXKWarning 6
+
+ /*
+ * AccessXNotify details:
+ * - Used as an event detail mask to limit the conditions under which
+ * AccessXNotify events are reported
+ */
+#define XkbAXN_SKPressMask (1L << 0)
+#define XkbAXN_SKAcceptMask (1L << 1)
+#define XkbAXN_SKRejectMask (1L << 2)
+#define XkbAXN_SKReleaseMask (1L << 3)
+#define XkbAXN_BKAcceptMask (1L << 4)
+#define XkbAXN_BKRejectMask (1L << 5)
+#define XkbAXN_AXKWarningMask (1L << 6)
+#define XkbAllAccessXEventsMask (0x7f)
+
+ /*
+ * Miscellaneous event details:
+ * - event detail masks for assorted events that don't really
+ * have any details.
+ */
+#define XkbAllStateEventsMask XkbAllStateComponentsMask
+#define XkbAllMapEventsMask XkbAllMapComponentsMask
+#define XkbAllControlEventsMask XkbAllControlsMask
+#define XkbAllIndicatorEventsMask XkbAllIndicatorsMask
+#define XkbAllNameEventsMask XkbAllNamesMask
+#define XkbAllCompatMapEventsMask XkbAllCompatMask
+#define XkbAllBellEventsMask (1L << 0)
+#define XkbAllActionMessagesMask (1L << 0)
+
+ /*
+ * XKB reports one error: BadKeyboard
+ * A further reason for the error is encoded into to most significant
+ * byte of the resourceID for the error:
+ * XkbErr_BadDevice - the device in question was not found
+ * XkbErr_BadClass - the device was found but it doesn't belong to
+ * the appropriate class.
+ * XkbErr_BadId - the device was found and belongs to the right
+ * class, but not feedback with a matching id was
+ * found.
+ * The low byte of the resourceID for this error contains the device
+ * id, class specifier or feedback id that failed.
+ */
+#define XkbKeyboard 0
+#define XkbNumberErrors 1
+
+#define XkbErr_BadDevice 0xff
+#define XkbErr_BadClass 0xfe
+#define XkbErr_BadId 0xfd
+
+ /*
+ * Keyboard Components Mask:
+ * - Specifies the components that follow a GetKeyboardByNameReply
+ */
+#define XkbClientMapMask (1L << 0)
+#define XkbServerMapMask (1L << 1)
+#define XkbCompatMapMask (1L << 2)
+#define XkbIndicatorMapMask (1L << 3)
+#define XkbNamesMask (1L << 4)
+#define XkbGeometryMask (1L << 5)
+#define XkbControlsMask (1L << 6)
+#define XkbAllComponentsMask (0x7f)
+
+ /*
+ * State detail mask:
+ * - The 'changed' field of StateNotify events reports which of
+ * the keyboard state components have changed.
+ * - Used as an event detail mask to limit the conditions under
+ * which StateNotify events are reported.
+ */
+#define XkbModifierStateMask (1L << 0)
+#define XkbModifierBaseMask (1L << 1)
+#define XkbModifierLatchMask (1L << 2)
+#define XkbModifierLockMask (1L << 3)
+#define XkbGroupStateMask (1L << 4)
+#define XkbGroupBaseMask (1L << 5)
+#define XkbGroupLatchMask (1L << 6)
+#define XkbGroupLockMask (1L << 7)
+#define XkbCompatStateMask (1L << 8)
+#define XkbGrabModsMask (1L << 9)
+#define XkbCompatGrabModsMask (1L << 10)
+#define XkbLookupModsMask (1L << 11)
+#define XkbCompatLookupModsMask (1L << 12)
+#define XkbPointerButtonMask (1L << 13)
+#define XkbAllStateComponentsMask (0x3fff)
+
+ /*
+ * Controls detail masks:
+ * The controls specified in XkbAllControlsMask:
+ * - The 'changed' field of ControlsNotify events reports which of
+ * the keyboard controls have changed.
+ * - The 'changeControls' field of the SetControls request specifies
+ * the controls for which values are to be changed.
+ * - Used as an event detail mask to limit the conditions under
+ * which ControlsNotify events are reported.
+ *
+ * The controls specified in the XkbAllBooleanCtrlsMask:
+ * - The 'enabledControls' field of ControlsNotify events reports the
+ * current status of the boolean controls.
+ * - The 'enabledControlsChanges' field of ControlsNotify events reports
+ * any boolean controls that have been turned on or off.
+ * - The 'affectEnabledControls' and 'enabledControls' fields of the
+ * kbSetControls request change the set of enabled controls.
+ * - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of
+ * an XkbControlsRec specify the controls to be changed if the keyboard
+ * times out and the values to which they should be changed.
+ * - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags
+ * request specifies the specify the controls to be reset when the
+ * client exits and the values to which they should be reset.
+ * - The 'ctrls' field of an indicator map specifies the controls
+ * that drive the indicator.
+ * - Specifies the boolean controls affected by the SetControls and
+ * LockControls key actions.
+ */
+#define XkbRepeatKeysMask (1L << 0)
+#define XkbSlowKeysMask (1L << 1)
+#define XkbBounceKeysMask (1L << 2)
+#define XkbStickyKeysMask (1L << 3)
+#define XkbMouseKeysMask (1L << 4)
+#define XkbMouseKeysAccelMask (1L << 5)
+#define XkbAccessXKeysMask (1L << 6)
+#define XkbAccessXTimeoutMask (1L << 7)
+#define XkbAccessXFeedbackMask (1L << 8)
+#define XkbAudibleBellMask (1L << 9)
+#define XkbOverlay1Mask (1L << 10)
+#define XkbOverlay2Mask (1L << 11)
+#define XkbIgnoreGroupLockMask (1L << 12)
+#define XkbGroupsWrapMask (1L << 27)
+#define XkbInternalModsMask (1L << 28)
+#define XkbIgnoreLockModsMask (1L << 29)
+#define XkbPerKeyRepeatMask (1L << 30)
+#define XkbControlsEnabledMask (1L << 31)
+
+#define XkbAccessXOptionsMask (XkbStickyKeysMask|XkbAccessXFeedbackMask)
+
+#define XkbAllBooleanCtrlsMask (0x00001FFF)
+#define XkbAllControlsMask (0xF8001FFF)
+#define XkbAllControlEventsMask XkbAllControlsMask
+
+ /*
+ * AccessX Options Mask
+ * - The 'accessXOptions' field of an XkbControlsRec specifies the
+ * AccessX options that are currently in effect.
+ * - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues'
+ * fields of an XkbControlsRec specify the Access X options to be
+ * changed if the keyboard times out and the values to which they
+ * should be changed.
+ */
+#define XkbAX_SKPressFBMask (1L << 0)
+#define XkbAX_SKAcceptFBMask (1L << 1)
+#define XkbAX_FeatureFBMask (1L << 2)
+#define XkbAX_SlowWarnFBMask (1L << 3)
+#define XkbAX_IndicatorFBMask (1L << 4)
+#define XkbAX_StickyKeysFBMask (1L << 5)
+#define XkbAX_TwoKeysMask (1L << 6)
+#define XkbAX_LatchToLockMask (1L << 7)
+#define XkbAX_SKReleaseFBMask (1L << 8)
+#define XkbAX_SKRejectFBMask (1L << 9)
+#define XkbAX_BKRejectFBMask (1L << 10)
+#define XkbAX_DumbBellFBMask (1L << 11)
+#define XkbAX_FBOptionsMask (0xF3F)
+#define XkbAX_SKOptionsMask (0x0C0)
+#define XkbAX_AllOptionsMask (0xFFF)
+
+ /*
+ * XkbUseCoreKbd is used to specify the core keyboard without having
+ * to look up its X input extension identifier.
+ * XkbUseCorePtr is used to specify the core pointer without having
+ * to look up its X input extension identifier.
+ * XkbDfltXIClass is used to specify "don't care" any place that the
+ * XKB protocol is looking for an X Input Extension
+ * device class.
+ * XkbDfltXIId is used to specify "don't care" any place that the
+ * XKB protocol is looking for an X Input Extension
+ * feedback identifier.
+ * XkbAllXIClasses is used to get information about all device indicators,
+ * whether they're part of the indicator feedback class
+ * or the keyboard feedback class.
+ * XkbAllXIIds is used to get information about all device indicator
+ * feedbacks without having to list them.
+ * XkbXINone is used to indicate that no class or id has been specified.
+ * XkbLegalXILedClass(c) True if 'c' specifies a legal class with LEDs
+ * XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells
+ * XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device
+ * XkbExplicitXIClass(c) True if 'c' explicitly specifies a device class
+ * XkbExplicitXIId(c) True if 'i' explicitly specifies a device id
+ * XkbSingleXIClass(c) True if 'c' specifies exactly one device class,
+ * including the default.
+ * XkbSingleXIId(i) True if 'i' specifies exactly one device
+ * identifier, including the default.
+ */
+#define XkbUseCoreKbd 0x0100
+#define XkbUseCorePtr 0x0200
+#define XkbDfltXIClass 0x0300
+#define XkbDfltXIId 0x0400
+#define XkbAllXIClasses 0x0500
+#define XkbAllXIIds 0x0600
+#define XkbXINone 0xff00
+
+#define XkbLegalXILedClass(c) (((c)==KbdFeedbackClass)||\
+ ((c)==LedFeedbackClass)||\
+ ((c)==XkbDfltXIClass)||\
+ ((c)==XkbAllXIClasses))
+#define XkbLegalXIBellClass(c) (((c)==KbdFeedbackClass)||\
+ ((c)==BellFeedbackClass)||\
+ ((c)==XkbDfltXIClass)||\
+ ((c)==XkbAllXIClasses))
+#define XkbExplicitXIDevice(c) (((c)&(~0xff))==0)
+#define XkbExplicitXIClass(c) (((c)&(~0xff))==0)
+#define XkbExplicitXIId(c) (((c)&(~0xff))==0)
+#define XkbSingleXIClass(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIClass))
+#define XkbSingleXIId(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIId))
+
+#define XkbNoModifier 0xff
+#define XkbNoShiftLevel 0xff
+#define XkbNoShape 0xff
+#define XkbNoIndicator 0xff
+
+#define XkbNoModifierMask 0
+#define XkbAllModifiersMask 0xff
+#define XkbAllVirtualModsMask 0xffff
+
+#define XkbNumKbdGroups 4
+#define XkbMaxKbdGroup (XkbNumKbdGroups-1)
+
+#define XkbMaxMouseKeysBtn 4
+
+ /*
+ * Group Index and Mask:
+ * - Indices into the kt_index array of a key type.
+ * - Mask specifies types to be changed for XkbChangeTypesOfKey
+ */
+#define XkbGroup1Index 0
+#define XkbGroup2Index 1
+#define XkbGroup3Index 2
+#define XkbGroup4Index 3
+#define XkbAnyGroup 254
+#define XkbAllGroups 255
+
+#define XkbGroup1Mask (1<<0)
+#define XkbGroup2Mask (1<<1)
+#define XkbGroup3Mask (1<<2)
+#define XkbGroup4Mask (1<<3)
+#define XkbAnyGroupMask (1<<7)
+#define XkbAllGroupsMask (0xf)
+
+ /*
+ * BuildCoreState: Given a keyboard group and a modifier state,
+ * construct the value to be reported an event.
+ * GroupForCoreState: Given the state reported in an event,
+ * determine the keyboard group.
+ * IsLegalGroup: Returns TRUE if 'g' is a valid group index.
+ */
+#define XkbBuildCoreState(m,g) ((((g)&0x3)<<13)|((m)&0xff))
+#define XkbGroupForCoreState(s) (((s)>>13)&0x3)
+#define XkbIsLegalGroup(g) (((g)>=0)&&((g)<XkbNumKbdGroups))
+
+ /*
+ * GroupsWrap values:
+ * - The 'groupsWrap' field of an XkbControlsRec specifies the
+ * treatment of out of range groups.
+ * - Bits 6 and 7 of the group info field of a key symbol map
+ * specify the interpretation of out of range groups for the
+ * corresponding key.
+ */
+#define XkbWrapIntoRange (0x00)
+#define XkbClampIntoRange (0x40)
+#define XkbRedirectIntoRange (0x80)
+
+ /*
+ * Action flags: Reported in the 'flags' field of most key actions.
+ * Interpretation depends on the type of the action; not all actions
+ * accept all flags.
+ *
+ * Option Used for Actions
+ * ------ ----------------
+ * ClearLocks SetMods, LatchMods, SetGroup, LatchGroup
+ * LatchToLock SetMods, LatchMods, SetGroup, LatchGroup
+ * LockNoLock LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
+ * LockNoUnlock LockMods, ISOLock, LockPtrBtn, LockDeviceBtn
+ * UseModMapMods SetMods, LatchMods, LockMods, ISOLock
+ * GroupAbsolute SetGroup, LatchGroup, LockGroup, ISOLock
+ * UseDfltButton PtrBtn, LockPtrBtn
+ * NoAcceleration MovePtr
+ * MoveAbsoluteX MovePtr
+ * MoveAbsoluteY MovePtr
+ * ISODfltIsGroup ISOLock
+ * ISONoAffectMods ISOLock
+ * ISONoAffectGroup ISOLock
+ * ISONoAffectPtr ISOLock
+ * ISONoAffectCtrls ISOLock
+ * MessageOnPress ActionMessage
+ * MessageOnRelease ActionMessage
+ * MessageGenKeyEvent ActionMessage
+ * AffectDfltBtn SetPtrDflt
+ * DfltBtnAbsolute SetPtrDflt
+ * SwitchApplication SwitchScreen
+ * SwitchAbsolute SwitchScreen
+ */
+
+#define XkbSA_ClearLocks (1L << 0)
+#define XkbSA_LatchToLock (1L << 1)
+
+#define XkbSA_LockNoLock (1L << 0)
+#define XkbSA_LockNoUnlock (1L << 1)
+
+#define XkbSA_UseModMapMods (1L << 2)
+
+#define XkbSA_GroupAbsolute (1L << 2)
+#define XkbSA_UseDfltButton 0
+
+#define XkbSA_NoAcceleration (1L << 0)
+#define XkbSA_MoveAbsoluteX (1L << 1)
+#define XkbSA_MoveAbsoluteY (1L << 2)
+
+#define XkbSA_ISODfltIsGroup (1L << 7)
+#define XkbSA_ISONoAffectMods (1L << 6)
+#define XkbSA_ISONoAffectGroup (1L << 5)
+#define XkbSA_ISONoAffectPtr (1L << 4)
+#define XkbSA_ISONoAffectCtrls (1L << 3)
+#define XkbSA_ISOAffectMask (0x78)
+
+#define XkbSA_MessageOnPress (1L << 0)
+#define XkbSA_MessageOnRelease (1L << 1)
+#define XkbSA_MessageGenKeyEvent (1L << 2)
+
+#define XkbSA_AffectDfltBtn 1
+#define XkbSA_DfltBtnAbsolute (1L << 2)
+
+#define XkbSA_SwitchApplication (1L << 0)
+#define XkbSA_SwitchAbsolute (1L << 2)
+
+ /*
+ * The following values apply to the SA_DeviceValuator
+ * action only. Valuator operations specify the action
+ * to be taken. Values specified in the action are
+ * multiplied by 2^scale before they are applied.
+ */
+#define XkbSA_IgnoreVal (0x00)
+#define XkbSA_SetValMin (0x10)
+#define XkbSA_SetValCenter (0x20)
+#define XkbSA_SetValMax (0x30)
+#define XkbSA_SetValRelative (0x40)
+#define XkbSA_SetValAbsolute (0x50)
+#define XkbSA_ValOpMask (0x70)
+#define XkbSA_ValScaleMask (0x07)
+#define XkbSA_ValOp(a) ((a)&XkbSA_ValOpMask)
+#define XkbSA_ValScale(a) ((a)&XkbSA_ValScaleMask)
+
+ /*
+ * Action types: specifies the type of a key action. Reported in the
+ * type field of all key actions.
+ */
+#define XkbSA_NoAction 0x00
+#define XkbSA_SetMods 0x01
+#define XkbSA_LatchMods 0x02
+#define XkbSA_LockMods 0x03
+#define XkbSA_SetGroup 0x04
+#define XkbSA_LatchGroup 0x05
+#define XkbSA_LockGroup 0x06
+#define XkbSA_MovePtr 0x07
+#define XkbSA_PtrBtn 0x08
+#define XkbSA_LockPtrBtn 0x09
+#define XkbSA_SetPtrDflt 0x0a
+#define XkbSA_ISOLock 0x0b
+#define XkbSA_Terminate 0x0c
+#define XkbSA_SwitchScreen 0x0d
+#define XkbSA_SetControls 0x0e
+#define XkbSA_LockControls 0x0f
+#define XkbSA_ActionMessage 0x10
+#define XkbSA_RedirectKey 0x11
+#define XkbSA_DeviceBtn 0x12
+#define XkbSA_LockDeviceBtn 0x13
+#define XkbSA_DeviceValuator 0x14
+#define XkbSA_LastAction XkbSA_DeviceValuator
+#define XkbSA_NumActions (XkbSA_LastAction+1)
+
+#define XkbSA_XFree86Private 0x86
+
+ /*
+ * Specifies the key actions that clear latched groups or modifiers.
+ */
+#define XkbSA_BreakLatch \
+ ((1<<XkbSA_NoAction)|(1<<XkbSA_PtrBtn)|(1<<XkbSA_LockPtrBtn)|\
+ (1<<XkbSA_Terminate)|(1<<XkbSA_SwitchScreen)|(1<<XkbSA_SetControls)|\
+ (1<<XkbSA_LockControls)|(1<<XkbSA_ActionMessage)|\
+ (1<<XkbSA_RedirectKey)|(1<<XkbSA_DeviceBtn)|(1<<XkbSA_LockDeviceBtn))
+
+ /*
+ * Macros to classify key actions
+ */
+#define XkbIsModAction(a) (((a)->type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods))
+#define XkbIsGroupAction(a) (((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup))
+#define XkbIsPtrAction(a) (((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt))
+
+
+ /*
+ * Key Behavior Qualifier:
+ * KB_Permanent indicates that the behavior describes an unalterable
+ * characteristic of the keyboard, not an XKB software-simulation of
+ * the listed behavior.
+ * Key Behavior Types:
+ * Specifies the behavior of the underlying key.
+ */
+#define XkbKB_Permanent 0x80
+#define XkbKB_OpMask 0x7f
+
+#define XkbKB_Default 0x00
+#define XkbKB_Lock 0x01
+#define XkbKB_RadioGroup 0x02
+#define XkbKB_Overlay1 0x03
+#define XkbKB_Overlay2 0x04
+
+#define XkbKB_RGAllowNone 0x80
+
+ /*
+ * Various macros which describe the range of legal keycodes.
+ */
+#define XkbMinLegalKeyCode 8
+#define XkbMaxLegalKeyCode 255
+#define XkbMaxKeyCount (XkbMaxLegalKeyCode-XkbMinLegalKeyCode+1)
+#define XkbPerKeyBitArraySize ((XkbMaxLegalKeyCode+1)/8)
+/* Seems kinda silly to check that an unsigned char is <= 255... */
+#define XkbIsLegalKeycode(k) ((k)>=XkbMinLegalKeyCode)
+
+ /*
+ * Assorted constants and limits.
+ */
+#define XkbNumModifiers 8
+#define XkbNumVirtualMods 16
+#define XkbNumIndicators 32
+#define XkbAllIndicatorsMask (0xffffffff)
+#define XkbMaxRadioGroups 32
+#define XkbAllRadioGroupsMask (0xffffffff)
+#define XkbMaxShiftLevel 63
+#define XkbMaxSymsPerKey (XkbMaxShiftLevel*XkbNumKbdGroups)
+#define XkbRGMaxMembers 12
+#define XkbActionMessageLength 6
+#define XkbKeyNameLength 4
+#define XkbMaxRedirectCount 8
+
+#define XkbGeomPtsPerMM 10
+#define XkbGeomMaxColors 32
+#define XkbGeomMaxLabelColors 3
+#define XkbGeomMaxPriority 255
+
+ /*
+ * Key Type index and mask for the four standard key types.
+ */
+#define XkbOneLevelIndex 0
+#define XkbTwoLevelIndex 1
+#define XkbAlphabeticIndex 2
+#define XkbKeypadIndex 3
+#define XkbLastRequiredType XkbKeypadIndex
+#define XkbNumRequiredTypes (XkbLastRequiredType+1)
+#define XkbMaxKeyTypes 255
+
+#define XkbOneLevelMask (1<<0)
+#define XkbTwoLevelMask (1<<1)
+#define XkbAlphabeticMask (1<<2)
+#define XkbKeypadMask (1<<3)
+#define XkbAllRequiredTypes (0xf)
+
+#define XkbShiftLevel(n) ((n)-1)
+#define XkbShiftLevelMask(n) (1<<((n)-1))
+
+ /*
+ * Extension name and version information
+ */
+#define XkbName "XKEYBOARD"
+#define XkbMajorVersion 1
+#define XkbMinorVersion 0
+
+ /*
+ * Explicit map components:
+ * - Used in the 'explicit' field of an XkbServerMap. Specifies
+ * the keyboard components that should _not_ be updated automatically
+ * in response to core protocol keyboard mapping requests.
+ */
+#define XkbExplicitKeyTypesMask (0x0f)
+#define XkbExplicitKeyType1Mask (1<<0)
+#define XkbExplicitKeyType2Mask (1<<1)
+#define XkbExplicitKeyType3Mask (1<<2)
+#define XkbExplicitKeyType4Mask (1<<3)
+#define XkbExplicitInterpretMask (1<<4)
+#define XkbExplicitAutoRepeatMask (1<<5)
+#define XkbExplicitBehaviorMask (1<<6)
+#define XkbExplicitVModMapMask (1<<7)
+#define XkbAllExplicitMask (0xff)
+
+ /*
+ * Map components masks:
+ * Those in AllMapComponentsMask:
+ * - Specifies the individual fields to be loaded or changed for the
+ * GetMap and SetMap requests.
+ * Those in ClientInfoMask:
+ * - Specifies the components to be allocated by XkbAllocClientMap.
+ * Those in ServerInfoMask:
+ * - Specifies the components to be allocated by XkbAllocServerMap.
+ */
+#define XkbKeyTypesMask (1<<0)
+#define XkbKeySymsMask (1<<1)
+#define XkbModifierMapMask (1<<2)
+#define XkbExplicitComponentsMask (1<<3)
+#define XkbKeyActionsMask (1<<4)
+#define XkbKeyBehaviorsMask (1<<5)
+#define XkbVirtualModsMask (1<<6)
+#define XkbVirtualModMapMask (1<<7)
+
+#define XkbAllClientInfoMask (XkbKeyTypesMask|XkbKeySymsMask|XkbModifierMapMask)
+#define XkbAllServerInfoMask (XkbExplicitComponentsMask|XkbKeyActionsMask|XkbKeyBehaviorsMask|XkbVirtualModsMask|XkbVirtualModMapMask)
+#define XkbAllMapComponentsMask (XkbAllClientInfoMask|XkbAllServerInfoMask)
+
+ /*
+ * Symbol interpretations flags:
+ * - Used in the flags field of a symbol interpretation
+ */
+#define XkbSI_AutoRepeat (1<<0)
+#define XkbSI_LockingKey (1<<1)
+
+ /*
+ * Symbol interpretations match specification:
+ * - Used in the match field of a symbol interpretation to specify
+ * the conditions under which an interpretation is used.
+ */
+#define XkbSI_LevelOneOnly (0x80)
+#define XkbSI_OpMask (0x7f)
+#define XkbSI_NoneOf (0)
+#define XkbSI_AnyOfOrNone (1)
+#define XkbSI_AnyOf (2)
+#define XkbSI_AllOf (3)
+#define XkbSI_Exactly (4)
+
+ /*
+ * Indicator map flags:
+ * - Used in the flags field of an indicator map to indicate the
+ * conditions under which and indicator can be changed and the
+ * effects of changing the indicator.
+ */
+#define XkbIM_NoExplicit (1L << 7)
+#define XkbIM_NoAutomatic (1L << 6)
+#define XkbIM_LEDDrivesKB (1L << 5)
+
+ /*
+ * Indicator map component specifications:
+ * - Used by the 'which_groups' and 'which_mods' fields of an indicator
+ * map to specify which keyboard components should be used to drive
+ * the indicator.
+ */
+#define XkbIM_UseBase (1L << 0)
+#define XkbIM_UseLatched (1L << 1)
+#define XkbIM_UseLocked (1L << 2)
+#define XkbIM_UseEffective (1L << 3)
+#define XkbIM_UseCompat (1L << 4)
+
+#define XkbIM_UseNone 0
+#define XkbIM_UseAnyGroup (XkbIM_UseBase|XkbIM_UseLatched|XkbIM_UseLocked\
+ |XkbIM_UseEffective)
+#define XkbIM_UseAnyMods (XkbIM_UseAnyGroup|XkbIM_UseCompat)
+
+ /*
+ * Compatibility Map Components:
+ * - Specifies the components to be allocated in XkbAllocCompatMap.
+ */
+#define XkbSymInterpMask (1<<0)
+#define XkbGroupCompatMask (1<<1)
+#define XkbAllCompatMask (0x3)
+
+ /*
+ * Names component mask:
+ * - Specifies the names to be loaded or changed for the GetNames and
+ * SetNames requests.
+ * - Specifies the names that have changed in a NamesNotify event.
+ * - Specifies the names components to be allocated by XkbAllocNames.
+ */
+#define XkbKeycodesNameMask (1<<0)
+#define XkbGeometryNameMask (1<<1)
+#define XkbSymbolsNameMask (1<<2)
+#define XkbPhysSymbolsNameMask (1<<3)
+#define XkbTypesNameMask (1<<4)
+#define XkbCompatNameMask (1<<5)
+#define XkbKeyTypeNamesMask (1<<6)
+#define XkbKTLevelNamesMask (1<<7)
+#define XkbIndicatorNamesMask (1<<8)
+#define XkbKeyNamesMask (1<<9)
+#define XkbKeyAliasesMask (1<<10)
+#define XkbVirtualModNamesMask (1<<11)
+#define XkbGroupNamesMask (1<<12)
+#define XkbRGNamesMask (1<<13)
+#define XkbComponentNamesMask (0x3f)
+#define XkbAllNamesMask (0x3fff)
+
+ /*
+ * GetByName components:
+ * - Specifies desired or necessary components to GetKbdByName request.
+ * - Reports the components that were found in a GetKbdByNameReply
+ */
+#define XkbGBN_TypesMask (1L << 0)
+#define XkbGBN_CompatMapMask (1L << 1)
+#define XkbGBN_ClientSymbolsMask (1L << 2)
+#define XkbGBN_ServerSymbolsMask (1L << 3)
+#define XkbGBN_SymbolsMask (XkbGBN_ClientSymbolsMask|XkbGBN_ServerSymbolsMask)
+#define XkbGBN_IndicatorMapMask (1L << 4)
+#define XkbGBN_KeyNamesMask (1L << 5)
+#define XkbGBN_GeometryMask (1L << 6)
+#define XkbGBN_OtherNamesMask (1L << 7)
+#define XkbGBN_AllComponentsMask (0xff)
+
+ /*
+ * ListComponents flags
+ */
+#define XkbLC_Hidden (1L << 0)
+#define XkbLC_Default (1L << 1)
+#define XkbLC_Partial (1L << 2)
+
+#define XkbLC_AlphanumericKeys (1L << 8)
+#define XkbLC_ModifierKeys (1L << 9)
+#define XkbLC_KeypadKeys (1L << 10)
+#define XkbLC_FunctionKeys (1L << 11)
+#define XkbLC_AlternateGroup (1L << 12)
+
+ /*
+ * X Input Extension Interactions
+ * - Specifies the possible interactions between XKB and the X input
+ * extension
+ * - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo)
+ * XKB information about an extension device.
+ * - Reports the list of supported optional features in the reply to
+ * XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event.
+ * XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify
+ * events to indicate an attempt to use an unsupported feature.
+ */
+#define XkbXI_KeyboardsMask (1L << 0)
+#define XkbXI_ButtonActionsMask (1L << 1)
+#define XkbXI_IndicatorNamesMask (1L << 2)
+#define XkbXI_IndicatorMapsMask (1L << 3)
+#define XkbXI_IndicatorStateMask (1L << 4)
+#define XkbXI_UnsupportedFeatureMask (1L << 15)
+#define XkbXI_AllFeaturesMask (0x001f)
+#define XkbXI_AllDeviceFeaturesMask (0x001e)
+
+#define XkbXI_IndicatorsMask (0x001c)
+#define XkbAllExtensionDeviceEventsMask (0x801f)
+
+ /*
+ * Per-Client Flags:
+ * - Specifies flags to be changed by the PerClientFlags request.
+ */
+#define XkbPCF_DetectableAutoRepeatMask (1L << 0)
+#define XkbPCF_GrabsUseXKBStateMask (1L << 1)
+#define XkbPCF_AutoResetControlsMask (1L << 2)
+#define XkbPCF_LookupStateWhenGrabbed (1L << 3)
+#define XkbPCF_SendEventUsesXKBState (1L << 4)
+#define XkbPCF_AllFlagsMask (0x1F)
+
+ /*
+ * Debugging flags and controls
+ */
+#define XkbDF_DisableLocks (1<<0)
+
+#endif /* _XKB_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/XKBstr.h b/thirdparty/linuxbsd_headers/X11/extensions/XKBstr.h
new file mode 100644
index 0000000000..eaefae8220
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/XKBstr.h
@@ -0,0 +1,643 @@
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef _XKBSTR_H_
+#define _XKBSTR_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/XKB.h>
+
+#define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f))
+#define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff)))
+#define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l)))
+
+/*
+ * The Xkb structs are full of implicit padding to properly align members.
+ * We can't clean that up without breaking ABI, so tell clang not to bother
+ * complaining about it.
+ */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+ /*
+ * Common data structures and access macros
+ */
+
+typedef struct _XkbStateRec {
+ unsigned char group;
+ unsigned char locked_group;
+ unsigned short base_group;
+ unsigned short latched_group;
+ unsigned char mods;
+ unsigned char base_mods;
+ unsigned char latched_mods;
+ unsigned char locked_mods;
+ unsigned char compat_state;
+ unsigned char grab_mods;
+ unsigned char compat_grab_mods;
+ unsigned char lookup_mods;
+ unsigned char compat_lookup_mods;
+ unsigned short ptr_buttons;
+} XkbStateRec,*XkbStatePtr;
+#define XkbModLocks(s) ((s)->locked_mods)
+#define XkbStateMods(s) ((s)->base_mods|(s)->latched_mods|XkbModLocks(s))
+#define XkbGroupLock(s) ((s)->locked_group)
+#define XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s))
+#define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group)
+#define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group)
+
+typedef struct _XkbMods {
+ unsigned char mask; /* effective mods */
+ unsigned char real_mods;
+ unsigned short vmods;
+} XkbModsRec,*XkbModsPtr;
+
+typedef struct _XkbKTMapEntry {
+ Bool active;
+ unsigned char level;
+ XkbModsRec mods;
+} XkbKTMapEntryRec,*XkbKTMapEntryPtr;
+
+typedef struct _XkbKeyType {
+ XkbModsRec mods;
+ unsigned char num_levels;
+ unsigned char map_count;
+ /* map is an array of map_count XkbKTMapEntryRec structs */
+ XkbKTMapEntryPtr map;
+ /* preserve is an array of map_count XkbModsRec structs */
+ XkbModsPtr preserve;
+ Atom name;
+ /* level_names is an array of num_levels Atoms */
+ Atom * level_names;
+} XkbKeyTypeRec, *XkbKeyTypePtr;
+
+#define XkbNumGroups(g) ((g)&0x0f)
+#define XkbOutOfRangeGroupInfo(g) ((g)&0xf0)
+#define XkbOutOfRangeGroupAction(g) ((g)&0xc0)
+#define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4)
+#define XkbSetGroupInfo(g,w,n) (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f))
+#define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f))
+
+ /*
+ * Structures and access macros used primarily by the server
+ */
+
+typedef struct _XkbBehavior {
+ unsigned char type;
+ unsigned char data;
+} XkbBehavior;
+
+#define XkbAnyActionDataSize 7
+typedef struct _XkbAnyAction {
+ unsigned char type;
+ unsigned char data[XkbAnyActionDataSize];
+} XkbAnyAction;
+
+typedef struct _XkbModAction {
+ unsigned char type;
+ unsigned char flags;
+ unsigned char mask;
+ unsigned char real_mods;
+ unsigned char vmods1;
+ unsigned char vmods2;
+} XkbModAction;
+#define XkbModActionVMods(a) \
+ ((short)(((a)->vmods1<<8)|((a)->vmods2)))
+#define XkbSetModActionVMods(a,v) \
+ (((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff))
+
+typedef struct _XkbGroupAction {
+ unsigned char type;
+ unsigned char flags;
+ char group_XXX;
+} XkbGroupAction;
+#define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX))
+#define XkbSASetGroup(a,g) ((a)->group_XXX=(g))
+
+typedef struct _XkbISOAction {
+ unsigned char type;
+ unsigned char flags;
+ unsigned char mask;
+ unsigned char real_mods;
+ char group_XXX;
+ unsigned char affect;
+ unsigned char vmods1;
+ unsigned char vmods2;
+} XkbISOAction;
+
+typedef struct _XkbPtrAction {
+ unsigned char type;
+ unsigned char flags;
+ unsigned char high_XXX;
+ unsigned char low_XXX;
+ unsigned char high_YYY;
+ unsigned char low_YYY;
+} XkbPtrAction;
+#define XkbPtrActionX(a) (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX))
+#define XkbPtrActionY(a) (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY))
+#define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX))
+#define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY))
+
+typedef struct _XkbPtrBtnAction {
+ unsigned char type;
+ unsigned char flags;
+ unsigned char count;
+ unsigned char button;
+} XkbPtrBtnAction;
+
+typedef struct _XkbPtrDfltAction {
+ unsigned char type;
+ unsigned char flags;
+ unsigned char affect;
+ char valueXXX;
+} XkbPtrDfltAction;
+#define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX))
+#define XkbSASetPtrDfltValue(a,c) ((a)->valueXXX= ((c)&0xff))
+
+typedef struct _XkbSwitchScreenAction {
+ unsigned char type;
+ unsigned char flags;
+ char screenXXX;
+} XkbSwitchScreenAction;
+#define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX))
+#define XkbSASetScreen(a,s) ((a)->screenXXX= ((s)&0xff))
+
+typedef struct _XkbCtrlsAction {
+ unsigned char type;
+ unsigned char flags;
+ unsigned char ctrls3;
+ unsigned char ctrls2;
+ unsigned char ctrls1;
+ unsigned char ctrls0;
+} XkbCtrlsAction;
+#define XkbActionSetCtrls(a,c) (((a)->ctrls3=(((c)>>24)&0xff)),\
+ ((a)->ctrls2=(((c)>>16)&0xff)),\
+ ((a)->ctrls1=(((c)>>8)&0xff)),\
+ ((a)->ctrls0=((c)&0xff)))
+#define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\
+ (((unsigned int)(a)->ctrls2)<<16)|\
+ (((unsigned int)(a)->ctrls1)<<8)|\
+ ((unsigned int)((a)->ctrls0)))
+
+typedef struct _XkbMessageAction {
+ unsigned char type;
+ unsigned char flags;
+ unsigned char message[6];
+} XkbMessageAction;
+
+typedef struct _XkbRedirectKeyAction {
+ unsigned char type;
+ unsigned char new_key;
+ unsigned char mods_mask;
+ unsigned char mods;
+ unsigned char vmods_mask0;
+ unsigned char vmods_mask1;
+ unsigned char vmods0;
+ unsigned char vmods1;
+} XkbRedirectKeyAction;
+
+#define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\
+ ((unsigned int)(a)->vmods0))
+#define XkbSARedirectSetVMods(a,m) (((a)->vmods1=(((m)>>8)&0xff)),\
+ ((a)->vmods0=((m)&0xff)))
+#define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|\
+ ((unsigned int)(a)->vmods_mask0))
+#define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\
+ ((a)->vmods_mask0=((m)&0xff)))
+
+typedef struct _XkbDeviceBtnAction {
+ unsigned char type;
+ unsigned char flags;
+ unsigned char count;
+ unsigned char button;
+ unsigned char device;
+} XkbDeviceBtnAction;
+
+typedef struct _XkbDeviceValuatorAction {
+ unsigned char type;
+ unsigned char device;
+ unsigned char v1_what;
+ unsigned char v1_ndx;
+ unsigned char v1_value;
+ unsigned char v2_what;
+ unsigned char v2_ndx;
+ unsigned char v2_value;
+} XkbDeviceValuatorAction;
+
+typedef union _XkbAction {
+ XkbAnyAction any;
+ XkbModAction mods;
+ XkbGroupAction group;
+ XkbISOAction iso;
+ XkbPtrAction ptr;
+ XkbPtrBtnAction btn;
+ XkbPtrDfltAction dflt;
+ XkbSwitchScreenAction screen;
+ XkbCtrlsAction ctrls;
+ XkbMessageAction msg;
+ XkbRedirectKeyAction redirect;
+ XkbDeviceBtnAction devbtn;
+ XkbDeviceValuatorAction devval;
+ unsigned char type;
+} XkbAction;
+
+typedef struct _XkbControls {
+ unsigned char mk_dflt_btn;
+ unsigned char num_groups;
+ unsigned char groups_wrap;
+ XkbModsRec internal;
+ XkbModsRec ignore_lock;
+ unsigned int enabled_ctrls;
+ unsigned short repeat_delay;
+ unsigned short repeat_interval;
+ unsigned short slow_keys_delay;
+ unsigned short debounce_delay;
+ unsigned short mk_delay;
+ unsigned short mk_interval;
+ unsigned short mk_time_to_max;
+ unsigned short mk_max_speed;
+ short mk_curve;
+ unsigned short ax_options;
+ unsigned short ax_timeout;
+ unsigned short axt_opts_mask;
+ unsigned short axt_opts_values;
+ unsigned int axt_ctrls_mask;
+ unsigned int axt_ctrls_values;
+ unsigned char per_key_repeat[XkbPerKeyBitArraySize];
+} XkbControlsRec, *XkbControlsPtr;
+
+#define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask)
+#define XkbAX_NeedOption(c,w) ((c)->ax_options&(w))
+#define XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w))
+
+typedef struct _XkbServerMapRec {
+ /* acts is an array of XkbActions structs, with size_acts entries
+ allocated, and num_acts entries used. */
+ unsigned short num_acts;
+ unsigned short size_acts;
+ XkbAction *acts;
+
+ /* behaviors, key_acts, explicit, & vmodmap are all arrays with
+ (xkb->max_key_code + 1) entries allocated for each. */
+ XkbBehavior *behaviors;
+ unsigned short *key_acts;
+#if defined(__cplusplus) || defined(c_plusplus)
+ /* explicit is a C++ reserved word */
+ unsigned char *c_explicit;
+#else
+ unsigned char *explicit;
+#endif
+ unsigned char vmods[XkbNumVirtualMods];
+ unsigned short *vmodmap;
+} XkbServerMapRec, *XkbServerMapPtr;
+
+#define XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]])
+
+ /*
+ * Structures and access macros used primarily by clients
+ */
+
+typedef struct _XkbSymMapRec {
+ unsigned char kt_index[XkbNumKbdGroups];
+ unsigned char group_info;
+ unsigned char width;
+ unsigned short offset;
+} XkbSymMapRec, *XkbSymMapPtr;
+
+typedef struct _XkbClientMapRec {
+ /* types is an array of XkbKeyTypeRec structs, with size_types entries
+ allocated, and num_types entries used. */
+ unsigned char size_types;
+ unsigned char num_types;
+ XkbKeyTypePtr types;
+
+ /* syms is an array of size_syms KeySyms, in which num_syms are used */
+ unsigned short size_syms;
+ unsigned short num_syms;
+ KeySym *syms;
+ /* key_sym_map is an array of (max_key_code + 1) XkbSymMapRec structs */
+ XkbSymMapPtr key_sym_map;
+
+ /* modmap is an array of (max_key_code + 1) unsigned chars */
+ unsigned char *modmap;
+} XkbClientMapRec, *XkbClientMapPtr;
+
+#define XkbCMKeyGroupInfo(m,k) ((m)->key_sym_map[k].group_info)
+#define XkbCMKeyNumGroups(m,k) (XkbNumGroups((m)->key_sym_map[k].group_info))
+#define XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels)
+#define XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width)
+#define XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3])
+#define XkbCMKeyType(m,k,g) (&(m)->types[XkbCMKeyTypeIndex(m,k,g)])
+#define XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k))
+#define XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset)
+#define XkbCMKeySymsPtr(m,k) (&(m)->syms[XkbCMKeySymsOffset(m,k)])
+
+ /*
+ * Compatibility structures and access macros
+ */
+
+typedef struct _XkbSymInterpretRec {
+ KeySym sym;
+ unsigned char flags;
+ unsigned char match;
+ unsigned char mods;
+ unsigned char virtual_mod;
+ XkbAnyAction act;
+} XkbSymInterpretRec,*XkbSymInterpretPtr;
+
+typedef struct _XkbCompatMapRec {
+ /* sym_interpret is an array of XkbSymInterpretRec structs,
+ in which size_si are allocated & num_si are used. */
+ XkbSymInterpretPtr sym_interpret;
+ XkbModsRec groups[XkbNumKbdGroups];
+ unsigned short num_si;
+ unsigned short size_si;
+} XkbCompatMapRec, *XkbCompatMapPtr;
+
+typedef struct _XkbIndicatorMapRec {
+ unsigned char flags;
+ unsigned char which_groups;
+ unsigned char groups;
+ unsigned char which_mods;
+ XkbModsRec mods;
+ unsigned int ctrls;
+} XkbIndicatorMapRec, *XkbIndicatorMapPtr;
+
+#define XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&\
+ (((i)->which_groups&&(i)->groups)||\
+ ((i)->which_mods&&(i)->mods.mask)||\
+ ((i)->ctrls)))
+#define XkbIM_InUse(i) (((i)->flags)||((i)->which_groups)||\
+ ((i)->which_mods)||((i)->ctrls))
+
+
+typedef struct _XkbIndicatorRec {
+ unsigned long phys_indicators;
+ XkbIndicatorMapRec maps[XkbNumIndicators];
+} XkbIndicatorRec,*XkbIndicatorPtr;
+
+typedef struct _XkbKeyNameRec {
+ char name[XkbKeyNameLength] _X_NONSTRING;
+} XkbKeyNameRec,*XkbKeyNamePtr;
+
+typedef struct _XkbKeyAliasRec {
+ char real[XkbKeyNameLength] _X_NONSTRING;
+ char alias[XkbKeyNameLength] _X_NONSTRING;
+} XkbKeyAliasRec,*XkbKeyAliasPtr;
+
+ /*
+ * Names for everything
+ */
+typedef struct _XkbNamesRec {
+ Atom keycodes;
+ Atom geometry;
+ Atom symbols;
+ Atom types;
+ Atom compat;
+ Atom vmods[XkbNumVirtualMods];
+ Atom indicators[XkbNumIndicators];
+ Atom groups[XkbNumKbdGroups];
+ /* keys is an array of (xkb->max_key_code + 1) XkbKeyNameRec entries */
+ XkbKeyNamePtr keys;
+ /* key_aliases is an array of num_key_aliases XkbKeyAliasRec entries */
+ XkbKeyAliasPtr key_aliases;
+ /* radio_groups is an array of num_rg Atoms */
+ Atom *radio_groups;
+ Atom phys_symbols;
+
+ /* num_keys seems to be unused in libX11 */
+ unsigned char num_keys;
+ unsigned char num_key_aliases;
+ unsigned short num_rg;
+} XkbNamesRec,*XkbNamesPtr;
+
+typedef struct _XkbGeometry *XkbGeometryPtr;
+ /*
+ * Tie it all together into one big keyboard description
+ */
+typedef struct _XkbDesc {
+ struct _XDisplay * dpy;
+ unsigned short flags;
+ unsigned short device_spec;
+ KeyCode min_key_code;
+ KeyCode max_key_code;
+
+ XkbControlsPtr ctrls;
+ XkbServerMapPtr server;
+ XkbClientMapPtr map;
+ XkbIndicatorPtr indicators;
+ XkbNamesPtr names;
+ XkbCompatMapPtr compat;
+ XkbGeometryPtr geom;
+} XkbDescRec, *XkbDescPtr;
+#define XkbKeyKeyTypeIndex(d,k,g) (XkbCMKeyTypeIndex((d)->map,k,g))
+#define XkbKeyKeyType(d,k,g) (XkbCMKeyType((d)->map,k,g))
+#define XkbKeyGroupWidth(d,k,g) (XkbCMKeyGroupWidth((d)->map,k,g))
+#define XkbKeyGroupsWidth(d,k) (XkbCMKeyGroupsWidth((d)->map,k))
+#define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k)))
+#define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k)))
+#define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k)))
+#define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k)))
+#define XkbKeySym(d,k,n) (XkbKeySymsPtr(d,k)[n])
+#define XkbKeySymEntry(d,k,sl,g) \
+ (XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))))
+#define XkbKeyAction(d,k,n) \
+ (XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL)
+#define XkbKeyActionEntry(d,k,sl,g) \
+ (XkbKeyHasActions(d,k)?\
+ XkbKeyAction(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))):NULL)
+
+#define XkbKeyHasActions(d,k) ((d)->server->key_acts[k]!=0)
+#define XkbKeyNumActions(d,k) (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1)
+#define XkbKeyActionsPtr(d,k) (XkbSMKeyActionsPtr((d)->server,k))
+#define XkbKeycodeInRange(d,k) (((k)>=(d)->min_key_code)&&\
+ ((k)<=(d)->max_key_code))
+#define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1)
+
+
+ /*
+ * The following structures can be used to track changes
+ * to a keyboard device
+ */
+typedef struct _XkbMapChanges {
+ unsigned short changed;
+ KeyCode min_key_code;
+ KeyCode max_key_code;
+ unsigned char first_type;
+ unsigned char num_types;
+ KeyCode first_key_sym;
+ unsigned char num_key_syms;
+ KeyCode first_key_act;
+ unsigned char num_key_acts;
+ KeyCode first_key_behavior;
+ unsigned char num_key_behaviors;
+ KeyCode first_key_explicit;
+ unsigned char num_key_explicit;
+ KeyCode first_modmap_key;
+ unsigned char num_modmap_keys;
+ KeyCode first_vmodmap_key;
+ unsigned char num_vmodmap_keys;
+ unsigned char pad;
+ unsigned short vmods;
+} XkbMapChangesRec,*XkbMapChangesPtr;
+
+typedef struct _XkbControlsChanges {
+ unsigned int changed_ctrls;
+ unsigned int enabled_ctrls_changes;
+ Bool num_groups_changed;
+} XkbControlsChangesRec,*XkbControlsChangesPtr;
+
+typedef struct _XkbIndicatorChanges {
+ unsigned int state_changes;
+ unsigned int map_changes;
+} XkbIndicatorChangesRec,*XkbIndicatorChangesPtr;
+
+typedef struct _XkbNameChanges {
+ unsigned int changed;
+ unsigned char first_type;
+ unsigned char num_types;
+ unsigned char first_lvl;
+ unsigned char num_lvls;
+ unsigned char num_aliases;
+ unsigned char num_rg;
+ unsigned char first_key;
+ unsigned char num_keys;
+ unsigned short changed_vmods;
+ unsigned long changed_indicators;
+ unsigned char changed_groups;
+} XkbNameChangesRec,*XkbNameChangesPtr;
+
+typedef struct _XkbCompatChanges {
+ unsigned char changed_groups;
+ unsigned short first_si;
+ unsigned short num_si;
+} XkbCompatChangesRec,*XkbCompatChangesPtr;
+
+typedef struct _XkbChanges {
+ unsigned short device_spec;
+ unsigned short state_changes;
+ XkbMapChangesRec map;
+ XkbControlsChangesRec ctrls;
+ XkbIndicatorChangesRec indicators;
+ XkbNameChangesRec names;
+ XkbCompatChangesRec compat;
+} XkbChangesRec, *XkbChangesPtr;
+
+ /*
+ * These data structures are used to construct a keymap from
+ * a set of components or to list components in the server
+ * database.
+ */
+typedef struct _XkbComponentNames {
+ char * keymap;
+ char * keycodes;
+ char * types;
+ char * compat;
+ char * symbols;
+ char * geometry;
+} XkbComponentNamesRec, *XkbComponentNamesPtr;
+
+typedef struct _XkbComponentName {
+ unsigned short flags;
+ char * name;
+} XkbComponentNameRec,*XkbComponentNamePtr;
+
+typedef struct _XkbComponentList {
+ int num_keymaps;
+ int num_keycodes;
+ int num_types;
+ int num_compat;
+ int num_symbols;
+ int num_geometry;
+ XkbComponentNamePtr keymaps;
+ XkbComponentNamePtr keycodes;
+ XkbComponentNamePtr types;
+ XkbComponentNamePtr compat;
+ XkbComponentNamePtr symbols;
+ XkbComponentNamePtr geometry;
+} XkbComponentListRec, *XkbComponentListPtr;
+
+ /*
+ * The following data structures describe and track changes to a
+ * non-keyboard extension device
+ */
+typedef struct _XkbDeviceLedInfo {
+ unsigned short led_class;
+ unsigned short led_id;
+ unsigned int phys_indicators;
+ unsigned int maps_present;
+ unsigned int names_present;
+ unsigned int state;
+ Atom names[XkbNumIndicators];
+ XkbIndicatorMapRec maps[XkbNumIndicators];
+} XkbDeviceLedInfoRec,*XkbDeviceLedInfoPtr;
+
+typedef struct _XkbDeviceInfo {
+ char * name;
+ Atom type;
+ unsigned short device_spec;
+ Bool has_own_state;
+ unsigned short supported;
+ unsigned short unsupported;
+
+ /* btn_acts is an array of num_btn XkbAction entries */
+ unsigned short num_btns;
+ XkbAction * btn_acts;
+
+ unsigned short sz_leds;
+ unsigned short num_leds;
+ unsigned short dflt_kbd_fb;
+ unsigned short dflt_led_fb;
+ /* leds is an array of XkbDeviceLedInfoRec in which
+ sz_leds entries are allocated and num_leds entries are used */
+ XkbDeviceLedInfoPtr leds;
+} XkbDeviceInfoRec,*XkbDeviceInfoPtr;
+
+#define XkbXI_DevHasBtnActs(d) (((d)->num_btns>0)&&((d)->btn_acts!=NULL))
+#define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns))
+#define XkbXI_DevHasLeds(d) (((d)->num_leds>0)&&((d)->leds!=NULL))
+
+typedef struct _XkbDeviceLedChanges {
+ unsigned short led_class;
+ unsigned short led_id;
+ unsigned int defined; /* names or maps changed */
+ struct _XkbDeviceLedChanges *next;
+} XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr;
+
+typedef struct _XkbDeviceChanges {
+ unsigned int changed;
+ unsigned short first_btn;
+ unsigned short num_btns;
+ XkbDeviceLedChangesRec leds;
+} XkbDeviceChangesRec,*XkbDeviceChangesPtr;
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+#endif /* _XKBSTR_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/Xext.h b/thirdparty/linuxbsd_headers/X11/extensions/Xext.h
new file mode 100644
index 0000000000..858592b78b
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/Xext.h
@@ -0,0 +1,53 @@
+/*
+ *
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+#ifndef _XEXT_H_
+#define _XEXT_H_
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+typedef int (*XextErrorHandler) (
+ Display * /* dpy */,
+ _Xconst char* /* ext_name */,
+ _Xconst char* /* reason */
+);
+
+extern XextErrorHandler XSetExtensionErrorHandler(
+ XextErrorHandler /* handler */
+);
+
+extern int XMissingExtension(
+ Display* /* dpy */,
+ _Xconst char* /* ext_name */
+);
+
+_XFUNCPROTOEND
+
+#define X_EXTENSION_UNKNOWN "unknown"
+#define X_EXTENSION_MISSING "missing"
+
+#endif /* _XEXT_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/Xfixes.h b/thirdparty/linuxbsd_headers/X11/extensions/Xfixes.h
new file mode 100644
index 0000000000..b62b95bac6
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/Xfixes.h
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2011, 2021 Red Hat, Inc.
+ *
+ * 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 (including the next
+ * paragraph) 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.
+ */
+/*
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _XFIXES_H_
+#define _XFIXES_H_
+
+#include <X11/extensions/xfixeswire.h>
+
+#include <X11/Xfuncproto.h>
+#include <X11/Xlib.h>
+
+/*
+ * This revision number also appears in configure.ac, they have
+ * to be manually synchronized
+ */
+#define XFIXES_REVISION 1
+#define XFIXES_VERSION ((XFIXES_MAJOR * 10000) + (XFIXES_MINOR * 100) + (XFIXES_REVISION))
+
+typedef struct {
+ int type; /* event base */
+ unsigned long serial;
+ Bool send_event;
+ Display *display;
+ Window window;
+ int subtype;
+ Window owner;
+ Atom selection;
+ Time timestamp;
+ Time selection_timestamp;
+} XFixesSelectionNotifyEvent;
+
+typedef struct {
+ int type; /* event base */
+ unsigned long serial;
+ Bool send_event;
+ Display *display;
+ Window window;
+ int subtype;
+ unsigned long cursor_serial;
+ Time timestamp;
+ Atom cursor_name;
+} XFixesCursorNotifyEvent;
+
+typedef struct {
+ short x, y;
+ unsigned short width, height;
+ unsigned short xhot, yhot;
+ unsigned long cursor_serial;
+ unsigned long *pixels;
+#if XFIXES_MAJOR >= 2
+ Atom atom; /* Version >= 2 only */
+ const char *name; /* Version >= 2 only */
+#endif
+} XFixesCursorImage;
+
+#if XFIXES_MAJOR >= 2
+/* Version 2 types */
+
+typedef XID XserverRegion;
+
+typedef struct {
+ short x, y;
+ unsigned short width, height;
+ unsigned short xhot, yhot;
+ unsigned long cursor_serial;
+ unsigned long *pixels;
+ Atom atom;
+ const char *name;
+} XFixesCursorImageAndName;
+
+#endif
+
+_XFUNCPROTOBEGIN
+
+Bool XFixesQueryExtension (Display *dpy,
+ int *event_base_return,
+ int *error_base_return);
+Status XFixesQueryVersion (Display *dpy,
+ int *major_version_return,
+ int *minor_version_return);
+
+int XFixesVersion (void);
+
+void
+XFixesChangeSaveSet (Display *dpy,
+ Window win,
+ int mode,
+ int target,
+ int map);
+
+void
+XFixesSelectSelectionInput (Display *dpy,
+ Window win,
+ Atom selection,
+ unsigned long eventMask);
+
+void
+XFixesSelectCursorInput (Display *dpy,
+ Window win,
+ unsigned long eventMask);
+
+XFixesCursorImage *
+XFixesGetCursorImage (Display *dpy);
+
+#if XFIXES_MAJOR >= 2
+/* Version 2 functions */
+
+XserverRegion
+XFixesCreateRegion (Display *dpy, XRectangle *rectangles, int nrectangles);
+
+XserverRegion
+XFixesCreateRegionFromBitmap (Display *dpy, Pixmap bitmap);
+
+XserverRegion
+XFixesCreateRegionFromWindow (Display *dpy, Window window, int kind);
+
+XserverRegion
+XFixesCreateRegionFromGC (Display *dpy, GC gc);
+
+XserverRegion
+XFixesCreateRegionFromPicture (Display *dpy, XID picture);
+
+void
+XFixesDestroyRegion (Display *dpy, XserverRegion region);
+
+void
+XFixesSetRegion (Display *dpy, XserverRegion region,
+ XRectangle *rectangles, int nrectangles);
+
+void
+XFixesCopyRegion (Display *dpy, XserverRegion dst, XserverRegion src);
+
+void
+XFixesUnionRegion (Display *dpy, XserverRegion dst,
+ XserverRegion src1, XserverRegion src2);
+
+void
+XFixesIntersectRegion (Display *dpy, XserverRegion dst,
+ XserverRegion src1, XserverRegion src2);
+
+void
+XFixesSubtractRegion (Display *dpy, XserverRegion dst,
+ XserverRegion src1, XserverRegion src2);
+
+void
+XFixesInvertRegion (Display *dpy, XserverRegion dst,
+ XRectangle *rect, XserverRegion src);
+
+void
+XFixesTranslateRegion (Display *dpy, XserverRegion region, int dx, int dy);
+
+void
+XFixesRegionExtents (Display *dpy, XserverRegion dst, XserverRegion src);
+
+XRectangle *
+XFixesFetchRegion (Display *dpy, XserverRegion region, int *nrectanglesRet);
+
+XRectangle *
+XFixesFetchRegionAndBounds (Display *dpy, XserverRegion region,
+ int *nrectanglesRet,
+ XRectangle *bounds);
+
+void
+XFixesSetGCClipRegion (Display *dpy, GC gc,
+ int clip_x_origin, int clip_y_origin,
+ XserverRegion region);
+
+void
+XFixesSetWindowShapeRegion (Display *dpy, Window win, int shape_kind,
+ int x_off, int y_off, XserverRegion region);
+
+void
+XFixesSetPictureClipRegion (Display *dpy, XID picture,
+ int clip_x_origin, int clip_y_origin,
+ XserverRegion region);
+
+void
+XFixesSetCursorName (Display *dpy, Cursor cursor, const char *name);
+
+const char *
+XFixesGetCursorName (Display *dpy, Cursor cursor, Atom *atom);
+
+void
+XFixesChangeCursor (Display *dpy, Cursor source, Cursor destination);
+
+void
+XFixesChangeCursorByName (Display *dpy, Cursor source, const char *name);
+
+#endif /* XFIXES_MAJOR >= 2 */
+
+#if XFIXES_MAJOR >= 3
+
+void
+XFixesExpandRegion (Display *dpy, XserverRegion dst, XserverRegion src,
+ unsigned left, unsigned right,
+ unsigned top, unsigned bottom);
+
+#endif /* XFIXES_MAJOR >= 3 */
+
+#if XFIXES_MAJOR >= 4
+/* Version 4.0 externs */
+
+void
+XFixesHideCursor (Display *dpy, Window win);
+
+void
+XFixesShowCursor (Display *dpy, Window win);
+
+#endif /* XFIXES_MAJOR >= 4 */
+
+#if XFIXES_MAJOR >= 5
+
+typedef XID PointerBarrier;
+
+PointerBarrier
+XFixesCreatePointerBarrier(Display *dpy, Window w, int x1, int y1,
+ int x2, int y2, int directions,
+ int num_devices, int *devices);
+
+void
+XFixesDestroyPointerBarrier(Display *dpy, PointerBarrier b);
+
+#endif /* XFIXES_MAJOR >= 5 */
+
+#if XFIXES_MAJOR >= 6
+
+void
+XFixesSetClientDisconnectMode(Display *dpy, int disconnect_mode);
+
+int
+XFixesGetClientDisconnectMode(Display *dpy);
+
+#endif /* XFIXES_MAJOR >= 6 */
+
+_XFUNCPROTOEND
+
+#endif /* _XFIXES_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/Xge.h b/thirdparty/linuxbsd_headers/X11/extensions/Xge.h
new file mode 100644
index 0000000000..76b5a6a019
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/Xge.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright © 2007-2008 Peter Hutterer
+ *
+ * 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 (including the next
+ * paragraph) 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.
+ *
+ * Authors: Peter Hutterer, University of South Australia, NICTA
+ *
+ */
+
+
+/* XGE Client interfaces */
+
+#ifndef _XGE_H_
+#define _XGE_H_
+
+#include <X11/Xlib.h>
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+/**
+ * Generic Event mask.
+ * To be used whenever a list of masks per extension has to be provided.
+ *
+ * But, don't actually use the CARD{8,16,32} types. We can't get them them
+ * defined here without polluting the namespace.
+ */
+typedef struct {
+ unsigned char extension;
+ unsigned char pad0;
+ unsigned short pad1;
+ unsigned int evmask;
+} XGenericEventMask;
+
+Bool XGEQueryExtension(Display* dpy, int *event_basep, int *err_basep);
+Bool XGEQueryVersion(Display* dpy, int *major, int* minor);
+
+_XFUNCPROTOEND
+
+#endif /* _XGE_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/Xinerama.h b/thirdparty/linuxbsd_headers/X11/extensions/Xinerama.h
new file mode 100644
index 0000000000..8c0f8296ac
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/Xinerama.h
@@ -0,0 +1,74 @@
+/*
+
+Copyright 2003 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _Xinerama_h
+#define _Xinerama_h
+
+#include <X11/Xlib.h>
+
+typedef struct {
+ int screen_number;
+ short x_org;
+ short y_org;
+ short width;
+ short height;
+} XineramaScreenInfo;
+
+_XFUNCPROTOBEGIN
+
+Bool XineramaQueryExtension (
+ Display *dpy,
+ int *event_base,
+ int *error_base
+);
+
+Status XineramaQueryVersion(
+ Display *dpy,
+ int *major_versionp,
+ int *minor_versionp
+);
+
+Bool XineramaIsActive(Display *dpy);
+
+
+/*
+ Returns the number of heads and a pointer to an array of
+ structures describing the position and size of the individual
+ heads. Returns NULL and number = 0 if Xinerama is not active.
+
+ Returned array should be freed with XFree().
+*/
+
+XineramaScreenInfo *
+XineramaQueryScreens(
+ Display *dpy,
+ int *number
+);
+
+_XFUNCPROTOEND
+
+#endif /* _Xinerama_h */
+
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/Xrandr.h b/thirdparty/linuxbsd_headers/X11/extensions/Xrandr.h
new file mode 100644
index 0000000000..65940bbdb1
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/Xrandr.h
@@ -0,0 +1,587 @@
+/*
+ * Copyright © 2000 Compaq Computer Corporation, Inc.
+ * Copyright © 2002 Hewlett-Packard Company, Inc.
+ * Copyright © 2006 Intel Corporation
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc.
+ * Keith Packard, Intel Corporation
+ */
+
+#ifndef _XRANDR_H_
+#define _XRANDR_H_
+
+#include <X11/extensions/randr.h>
+#include <X11/extensions/Xrender.h>
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+typedef XID RROutput;
+typedef XID RRCrtc;
+typedef XID RRMode;
+typedef XID RRProvider;
+
+typedef struct {
+ int width, height;
+ int mwidth, mheight;
+} XRRScreenSize;
+
+/*
+ * Events.
+ */
+
+typedef struct {
+ int type; /* event base */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* window which selected for this event */
+ Window root; /* Root window for changed screen */
+ Time timestamp; /* when the screen change occurred */
+ Time config_timestamp; /* when the last configuration change */
+ SizeID size_index;
+ SubpixelOrder subpixel_order;
+ Rotation rotation;
+ int width;
+ int height;
+ int mwidth;
+ int mheight;
+} XRRScreenChangeNotifyEvent;
+
+typedef struct {
+ int type; /* event base */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* window which selected for this event */
+ int subtype; /* RRNotify_ subtype */
+} XRRNotifyEvent;
+
+typedef struct {
+ int type; /* event base */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* window which selected for this event */
+ int subtype; /* RRNotify_OutputChange */
+ RROutput output; /* affected output */
+ RRCrtc crtc; /* current crtc (or None) */
+ RRMode mode; /* current mode (or None) */
+ Rotation rotation; /* current rotation of associated crtc */
+ Connection connection; /* current connection status */
+ SubpixelOrder subpixel_order;
+} XRROutputChangeNotifyEvent;
+
+typedef struct {
+ int type; /* event base */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* window which selected for this event */
+ int subtype; /* RRNotify_CrtcChange */
+ RRCrtc crtc; /* current crtc (or None) */
+ RRMode mode; /* current mode (or None) */
+ Rotation rotation; /* current rotation of associated crtc */
+ int x, y; /* position */
+ unsigned int width, height; /* size */
+} XRRCrtcChangeNotifyEvent;
+
+typedef struct {
+ int type; /* event base */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* window which selected for this event */
+ int subtype; /* RRNotify_OutputProperty */
+ RROutput output; /* related output */
+ Atom property; /* changed property */
+ Time timestamp; /* time of change */
+ int state; /* NewValue, Deleted */
+} XRROutputPropertyNotifyEvent;
+
+typedef struct {
+ int type; /* event base */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* window which selected for this event */
+ int subtype; /* RRNotify_ProviderChange */
+ RRProvider provider; /* current provider (or None) */
+ Time timestamp; /* time of change */
+ unsigned int current_role;
+} XRRProviderChangeNotifyEvent;
+
+typedef struct {
+ int type; /* event base */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* window which selected for this event */
+ int subtype; /* RRNotify_ProviderProperty */
+ RRProvider provider; /* related provider */
+ Atom property; /* changed property */
+ Time timestamp; /* time of change */
+ int state; /* NewValue, Deleted */
+} XRRProviderPropertyNotifyEvent;
+
+typedef struct {
+ int type; /* event base */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* window which selected for this event */
+ int subtype; /* RRNotify_ResourceChange */
+ Time timestamp; /* time of change */
+} XRRResourceChangeNotifyEvent;
+
+/* internal representation is private to the library */
+typedef struct _XRRScreenConfiguration XRRScreenConfiguration;
+
+Bool XRRQueryExtension (Display *dpy,
+ int *event_base_return,
+ int *error_base_return);
+Status XRRQueryVersion (Display *dpy,
+ int *major_version_return,
+ int *minor_version_return);
+
+XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy,
+ Window window);
+
+void XRRFreeScreenConfigInfo (XRRScreenConfiguration *config);
+
+/*
+ * Note that screen configuration changes are only permitted if the client can
+ * prove it has up to date configuration information. We are trying to
+ * insist that it become possible for screens to change dynamically, so
+ * we want to ensure the client knows what it is talking about when requesting
+ * changes.
+ */
+Status XRRSetScreenConfig (Display *dpy,
+ XRRScreenConfiguration *config,
+ Drawable draw,
+ int size_index,
+ Rotation rotation,
+ Time timestamp);
+
+/* added in v1.1, sorry for the lame name */
+Status XRRSetScreenConfigAndRate (Display *dpy,
+ XRRScreenConfiguration *config,
+ Drawable draw,
+ int size_index,
+ Rotation rotation,
+ short rate,
+ Time timestamp);
+
+
+Rotation XRRConfigRotations(XRRScreenConfiguration *config, Rotation *current_rotation);
+
+Time XRRConfigTimes (XRRScreenConfiguration *config, Time *config_timestamp);
+
+XRRScreenSize *XRRConfigSizes(XRRScreenConfiguration *config, int *nsizes);
+
+short *XRRConfigRates (XRRScreenConfiguration *config, int sizeID, int *nrates);
+
+SizeID XRRConfigCurrentConfiguration (XRRScreenConfiguration *config,
+ Rotation *rotation);
+
+short XRRConfigCurrentRate (XRRScreenConfiguration *config);
+
+int XRRRootToScreen(Display *dpy, Window root);
+
+/*
+ * returns the screen configuration for the specified screen; does a lazy
+ * evalution to delay getting the information, and caches the result.
+ * These routines should be used in preference to XRRGetScreenInfo
+ * to avoid unneeded round trips to the X server. These are new
+ * in protocol version 0.1.
+ */
+
+
+void XRRSelectInput(Display *dpy, Window window, int mask);
+
+/*
+ * the following are always safe to call, even if RandR is not implemented
+ * on a screen
+ */
+
+
+Rotation XRRRotations(Display *dpy, int screen, Rotation *current_rotation);
+XRRScreenSize *XRRSizes(Display *dpy, int screen, int *nsizes);
+short *XRRRates (Display *dpy, int screen, int sizeID, int *nrates);
+Time XRRTimes (Display *dpy, int screen, Time *config_timestamp);
+
+
+/* Version 1.2 additions */
+
+/* despite returning a Status, this returns 1 for success */
+Status
+XRRGetScreenSizeRange (Display *dpy, Window window,
+ int *minWidth, int *minHeight,
+ int *maxWidth, int *maxHeight);
+
+void
+XRRSetScreenSize (Display *dpy, Window window,
+ int width, int height,
+ int mmWidth, int mmHeight);
+
+typedef unsigned long XRRModeFlags;
+
+typedef struct _XRRModeInfo {
+ RRMode id;
+ unsigned int width;
+ unsigned int height;
+ unsigned long dotClock;
+ unsigned int hSyncStart;
+ unsigned int hSyncEnd;
+ unsigned int hTotal;
+ unsigned int hSkew;
+ unsigned int vSyncStart;
+ unsigned int vSyncEnd;
+ unsigned int vTotal;
+ char *name;
+ unsigned int nameLength;
+ XRRModeFlags modeFlags;
+} XRRModeInfo;
+
+typedef struct _XRRScreenResources {
+ Time timestamp;
+ Time configTimestamp;
+ int ncrtc;
+ RRCrtc *crtcs;
+ int noutput;
+ RROutput *outputs;
+ int nmode;
+ XRRModeInfo *modes;
+} XRRScreenResources;
+
+XRRScreenResources *
+XRRGetScreenResources (Display *dpy, Window window);
+
+void
+XRRFreeScreenResources (XRRScreenResources *resources);
+
+typedef struct _XRROutputInfo {
+ Time timestamp;
+ RRCrtc crtc;
+ char *name;
+ int nameLen;
+ unsigned long mm_width;
+ unsigned long mm_height;
+ Connection connection;
+ SubpixelOrder subpixel_order;
+ int ncrtc;
+ RRCrtc *crtcs;
+ int nclone;
+ RROutput *clones;
+ int nmode;
+ int npreferred;
+ RRMode *modes;
+} XRROutputInfo;
+
+XRROutputInfo *
+XRRGetOutputInfo (Display *dpy, XRRScreenResources *resources, RROutput output);
+
+void
+XRRFreeOutputInfo (XRROutputInfo *outputInfo);
+
+Atom *
+XRRListOutputProperties (Display *dpy, RROutput output, int *nprop);
+
+typedef struct {
+ Bool pending;
+ Bool range;
+ Bool immutable;
+ int num_values;
+ long *values;
+} XRRPropertyInfo;
+
+XRRPropertyInfo *
+XRRQueryOutputProperty (Display *dpy, RROutput output, Atom property);
+
+void
+XRRConfigureOutputProperty (Display *dpy, RROutput output, Atom property,
+ Bool pending, Bool range, int num_values,
+ long *values);
+
+void
+XRRChangeOutputProperty (Display *dpy, RROutput output,
+ Atom property, Atom type,
+ int format, int mode,
+ _Xconst unsigned char *data, int nelements);
+
+void
+XRRDeleteOutputProperty (Display *dpy, RROutput output, Atom property);
+
+int
+XRRGetOutputProperty (Display *dpy, RROutput output,
+ Atom property, long offset, long length,
+ Bool _delete, Bool pending, Atom req_type,
+ Atom *actual_type, int *actual_format,
+ unsigned long *nitems, unsigned long *bytes_after,
+ unsigned char **prop);
+
+XRRModeInfo *
+XRRAllocModeInfo (_Xconst char *name, int nameLength);
+
+RRMode
+XRRCreateMode (Display *dpy, Window window, XRRModeInfo *modeInfo);
+
+void
+XRRDestroyMode (Display *dpy, RRMode mode);
+
+void
+XRRAddOutputMode (Display *dpy, RROutput output, RRMode mode);
+
+void
+XRRDeleteOutputMode (Display *dpy, RROutput output, RRMode mode);
+
+void
+XRRFreeModeInfo (XRRModeInfo *modeInfo);
+
+typedef struct _XRRCrtcInfo {
+ Time timestamp;
+ int x, y;
+ unsigned int width, height;
+ RRMode mode;
+ Rotation rotation;
+ int noutput;
+ RROutput *outputs;
+ Rotation rotations;
+ int npossible;
+ RROutput *possible;
+} XRRCrtcInfo;
+
+XRRCrtcInfo *
+XRRGetCrtcInfo (Display *dpy, XRRScreenResources *resources, RRCrtc crtc);
+
+void
+XRRFreeCrtcInfo (XRRCrtcInfo *crtcInfo);
+
+Status
+XRRSetCrtcConfig (Display *dpy,
+ XRRScreenResources *resources,
+ RRCrtc crtc,
+ Time timestamp,
+ int x, int y,
+ RRMode mode,
+ Rotation rotation,
+ RROutput *outputs,
+ int noutputs);
+
+int
+XRRGetCrtcGammaSize (Display *dpy, RRCrtc crtc);
+
+typedef struct _XRRCrtcGamma {
+ int size;
+ unsigned short *red;
+ unsigned short *green;
+ unsigned short *blue;
+} XRRCrtcGamma;
+
+XRRCrtcGamma *
+XRRGetCrtcGamma (Display *dpy, RRCrtc crtc);
+
+XRRCrtcGamma *
+XRRAllocGamma (int size);
+
+void
+XRRSetCrtcGamma (Display *dpy, RRCrtc crtc, XRRCrtcGamma *gamma);
+
+void
+XRRFreeGamma (XRRCrtcGamma *gamma);
+
+/* Version 1.3 additions */
+
+XRRScreenResources *
+XRRGetScreenResourcesCurrent (Display *dpy, Window window);
+
+void
+XRRSetCrtcTransform (Display *dpy,
+ RRCrtc crtc,
+ XTransform *transform,
+ _Xconst char *filter,
+ XFixed *params,
+ int nparams);
+
+typedef struct _XRRCrtcTransformAttributes {
+ XTransform pendingTransform;
+ char *pendingFilter;
+ int pendingNparams;
+ XFixed *pendingParams;
+ XTransform currentTransform;
+ char *currentFilter;
+ int currentNparams;
+ XFixed *currentParams;
+} XRRCrtcTransformAttributes;
+
+/*
+ * Get current crtc transforms and filters.
+ * Pass *attributes to XFree to free
+ */
+Status
+XRRGetCrtcTransform (Display *dpy,
+ RRCrtc crtc,
+ XRRCrtcTransformAttributes **attributes);
+
+/*
+ * intended to take RRScreenChangeNotify, or
+ * ConfigureNotify (on the root window)
+ * returns 1 if it is an event type it understands, 0 if not
+ */
+int XRRUpdateConfiguration(XEvent *event);
+
+typedef struct _XRRPanning {
+ Time timestamp;
+ unsigned int left;
+ unsigned int top;
+ unsigned int width;
+ unsigned int height;
+ unsigned int track_left;
+ unsigned int track_top;
+ unsigned int track_width;
+ unsigned int track_height;
+ int border_left;
+ int border_top;
+ int border_right;
+ int border_bottom;
+} XRRPanning;
+
+XRRPanning *
+XRRGetPanning (Display *dpy, XRRScreenResources *resources, RRCrtc crtc);
+
+void
+XRRFreePanning (XRRPanning *panning);
+
+Status
+XRRSetPanning (Display *dpy,
+ XRRScreenResources *resources,
+ RRCrtc crtc,
+ XRRPanning *panning);
+
+void
+XRRSetOutputPrimary(Display *dpy,
+ Window window,
+ RROutput output);
+
+RROutput
+XRRGetOutputPrimary(Display *dpy,
+ Window window);
+
+typedef struct _XRRProviderResources {
+ Time timestamp;
+ int nproviders;
+ RRProvider *providers;
+} XRRProviderResources;
+
+XRRProviderResources *
+XRRGetProviderResources(Display *dpy, Window window);
+
+void
+XRRFreeProviderResources(XRRProviderResources *resources);
+
+typedef struct _XRRProviderInfo {
+ unsigned int capabilities;
+ int ncrtcs;
+ RRCrtc *crtcs;
+ int noutputs;
+ RROutput *outputs;
+ char *name;
+ int nassociatedproviders;
+ RRProvider *associated_providers;
+ unsigned int *associated_capability;
+ int nameLen;
+} XRRProviderInfo;
+
+XRRProviderInfo *
+XRRGetProviderInfo(Display *dpy, XRRScreenResources *resources, RRProvider provider);
+
+void
+XRRFreeProviderInfo(XRRProviderInfo *provider);
+
+int
+XRRSetProviderOutputSource(Display *dpy, XID provider, XID source_provider);
+
+int
+XRRSetProviderOffloadSink(Display *dpy, XID provider, XID sink_provider);
+
+Atom *
+XRRListProviderProperties (Display *dpy, RRProvider provider, int *nprop);
+
+XRRPropertyInfo *
+XRRQueryProviderProperty (Display *dpy, RRProvider provider, Atom property);
+
+void
+XRRConfigureProviderProperty (Display *dpy, RRProvider provider, Atom property,
+ Bool pending, Bool range, int num_values,
+ long *values);
+
+void
+XRRChangeProviderProperty (Display *dpy, RRProvider provider,
+ Atom property, Atom type,
+ int format, int mode,
+ _Xconst unsigned char *data, int nelements);
+
+void
+XRRDeleteProviderProperty (Display *dpy, RRProvider provider, Atom property);
+
+int
+XRRGetProviderProperty (Display *dpy, RRProvider provider,
+ Atom property, long offset, long length,
+ Bool _delete, Bool pending, Atom req_type,
+ Atom *actual_type, int *actual_format,
+ unsigned long *nitems, unsigned long *bytes_after,
+ unsigned char **prop);
+
+
+typedef struct _XRRMonitorInfo {
+ Atom name;
+ Bool primary;
+ Bool automatic;
+ int noutput;
+ int x;
+ int y;
+ int width;
+ int height;
+ int mwidth;
+ int mheight;
+ RROutput *outputs;
+} XRRMonitorInfo;
+
+XRRMonitorInfo *
+XRRAllocateMonitor(Display *dpy, int noutput);
+
+XRRMonitorInfo *
+XRRGetMonitors(Display *dpy, Window window, Bool get_active, int *nmonitors);
+
+void
+XRRSetMonitor(Display *dpy, Window window, XRRMonitorInfo *monitor);
+
+void
+XRRDeleteMonitor(Display *dpy, Window window, Atom name);
+
+void
+XRRFreeMonitors(XRRMonitorInfo *monitors);
+
+_XFUNCPROTOEND
+
+#endif /* _XRANDR_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/Xrender.h b/thirdparty/linuxbsd_headers/X11/extensions/Xrender.h
new file mode 100644
index 0000000000..1d1cd086ec
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/Xrender.h
@@ -0,0 +1,528 @@
+/*
+ *
+ * Copyright © 2000 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. SuSE makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, SuSE, Inc.
+ */
+
+#ifndef _XRENDER_H_
+#define _XRENDER_H_
+
+#include <X11/Xlib.h>
+#include <X11/Xfuncproto.h>
+#include <X11/Xosdefs.h>
+#include <X11/Xutil.h>
+
+#include <X11/extensions/render.h>
+
+typedef struct {
+ short red;
+ short redMask;
+ short green;
+ short greenMask;
+ short blue;
+ short blueMask;
+ short alpha;
+ short alphaMask;
+} XRenderDirectFormat;
+
+typedef struct {
+ PictFormat id;
+ int type;
+ int depth;
+ XRenderDirectFormat direct;
+ Colormap colormap;
+} XRenderPictFormat;
+
+#define PictFormatID (1 << 0)
+#define PictFormatType (1 << 1)
+#define PictFormatDepth (1 << 2)
+#define PictFormatRed (1 << 3)
+#define PictFormatRedMask (1 << 4)
+#define PictFormatGreen (1 << 5)
+#define PictFormatGreenMask (1 << 6)
+#define PictFormatBlue (1 << 7)
+#define PictFormatBlueMask (1 << 8)
+#define PictFormatAlpha (1 << 9)
+#define PictFormatAlphaMask (1 << 10)
+#define PictFormatColormap (1 << 11)
+
+typedef struct _XRenderPictureAttributes {
+ int repeat;
+ Picture alpha_map;
+ int alpha_x_origin;
+ int alpha_y_origin;
+ int clip_x_origin;
+ int clip_y_origin;
+ Pixmap clip_mask;
+ Bool graphics_exposures;
+ int subwindow_mode;
+ int poly_edge;
+ int poly_mode;
+ Atom dither;
+ Bool component_alpha;
+} XRenderPictureAttributes;
+
+typedef struct {
+ unsigned short red;
+ unsigned short green;
+ unsigned short blue;
+ unsigned short alpha;
+} XRenderColor;
+
+typedef struct _XGlyphInfo {
+ unsigned short width;
+ unsigned short height;
+ short x;
+ short y;
+ short xOff;
+ short yOff;
+} XGlyphInfo;
+
+typedef struct _XGlyphElt8 {
+ GlyphSet glyphset;
+ _Xconst char *chars;
+ int nchars;
+ int xOff;
+ int yOff;
+} XGlyphElt8;
+
+typedef struct _XGlyphElt16 {
+ GlyphSet glyphset;
+ _Xconst unsigned short *chars;
+ int nchars;
+ int xOff;
+ int yOff;
+} XGlyphElt16;
+
+typedef struct _XGlyphElt32 {
+ GlyphSet glyphset;
+ _Xconst unsigned int *chars;
+ int nchars;
+ int xOff;
+ int yOff;
+} XGlyphElt32;
+
+typedef double XDouble;
+
+typedef struct _XPointDouble {
+ XDouble x, y;
+} XPointDouble;
+
+#define XDoubleToFixed(f) ((XFixed) ((f) * 65536))
+#define XFixedToDouble(f) (((XDouble) (f)) / 65536)
+
+typedef int XFixed;
+
+typedef struct _XPointFixed {
+ XFixed x, y;
+} XPointFixed;
+
+typedef struct _XLineFixed {
+ XPointFixed p1, p2;
+} XLineFixed;
+
+typedef struct _XTriangle {
+ XPointFixed p1, p2, p3;
+} XTriangle;
+
+typedef struct _XCircle {
+ XFixed x;
+ XFixed y;
+ XFixed radius;
+} XCircle;
+
+typedef struct _XTrapezoid {
+ XFixed top, bottom;
+ XLineFixed left, right;
+} XTrapezoid;
+
+typedef struct _XTransform {
+ XFixed matrix[3][3];
+} XTransform;
+
+typedef struct _XFilters {
+ int nfilter;
+ char **filter;
+ int nalias;
+ short *alias;
+} XFilters;
+
+typedef struct _XIndexValue {
+ unsigned long pixel;
+ unsigned short red, green, blue, alpha;
+} XIndexValue;
+
+typedef struct _XAnimCursor {
+ Cursor cursor;
+ unsigned long delay;
+} XAnimCursor;
+
+typedef struct _XSpanFix {
+ XFixed left, right, y;
+} XSpanFix;
+
+typedef struct _XTrap {
+ XSpanFix top, bottom;
+} XTrap;
+
+typedef struct _XLinearGradient {
+ XPointFixed p1;
+ XPointFixed p2;
+} XLinearGradient;
+
+typedef struct _XRadialGradient {
+ XCircle inner;
+ XCircle outer;
+} XRadialGradient;
+
+typedef struct _XConicalGradient {
+ XPointFixed center;
+ XFixed angle; /* in degrees */
+} XConicalGradient;
+
+_XFUNCPROTOBEGIN
+
+Bool XRenderQueryExtension (Display *dpy, int *event_basep, int *error_basep);
+
+Status XRenderQueryVersion (Display *dpy,
+ int *major_versionp,
+ int *minor_versionp);
+
+Status XRenderQueryFormats (Display *dpy);
+
+int XRenderQuerySubpixelOrder (Display *dpy, int screen);
+
+Bool XRenderSetSubpixelOrder (Display *dpy, int screen, int subpixel);
+
+XRenderPictFormat *
+XRenderFindVisualFormat (Display *dpy, _Xconst Visual *visual);
+
+XRenderPictFormat *
+XRenderFindFormat (Display *dpy,
+ unsigned long mask,
+ _Xconst XRenderPictFormat *templ,
+ int count);
+
+#define PictStandardARGB32 0
+#define PictStandardRGB24 1
+#define PictStandardA8 2
+#define PictStandardA4 3
+#define PictStandardA1 4
+#define PictStandardNUM 5
+
+XRenderPictFormat *
+XRenderFindStandardFormat (Display *dpy,
+ int format);
+
+XIndexValue *
+XRenderQueryPictIndexValues(Display *dpy,
+ _Xconst XRenderPictFormat *format,
+ int *num);
+
+Picture
+XRenderCreatePicture (Display *dpy,
+ Drawable drawable,
+ _Xconst XRenderPictFormat *format,
+ unsigned long valuemask,
+ _Xconst XRenderPictureAttributes *attributes);
+
+void
+XRenderChangePicture (Display *dpy,
+ Picture picture,
+ unsigned long valuemask,
+ _Xconst XRenderPictureAttributes *attributes);
+
+void
+XRenderSetPictureClipRectangles (Display *dpy,
+ Picture picture,
+ int xOrigin,
+ int yOrigin,
+ _Xconst XRectangle *rects,
+ int n);
+
+void
+XRenderSetPictureClipRegion (Display *dpy,
+ Picture picture,
+ Region r);
+
+void
+XRenderSetPictureTransform (Display *dpy,
+ Picture picture,
+ XTransform *transform);
+
+void
+XRenderFreePicture (Display *dpy,
+ Picture picture);
+
+void
+XRenderComposite (Display *dpy,
+ int op,
+ Picture src,
+ Picture mask,
+ Picture dst,
+ int src_x,
+ int src_y,
+ int mask_x,
+ int mask_y,
+ int dst_x,
+ int dst_y,
+ unsigned int width,
+ unsigned int height);
+
+GlyphSet
+XRenderCreateGlyphSet (Display *dpy, _Xconst XRenderPictFormat *format);
+
+GlyphSet
+XRenderReferenceGlyphSet (Display *dpy, GlyphSet existing);
+
+void
+XRenderFreeGlyphSet (Display *dpy, GlyphSet glyphset);
+
+void
+XRenderAddGlyphs (Display *dpy,
+ GlyphSet glyphset,
+ _Xconst Glyph *gids,
+ _Xconst XGlyphInfo *glyphs,
+ int nglyphs,
+ _Xconst char *images,
+ int nbyte_images);
+
+void
+XRenderFreeGlyphs (Display *dpy,
+ GlyphSet glyphset,
+ _Xconst Glyph *gids,
+ int nglyphs);
+
+void
+XRenderCompositeString8 (Display *dpy,
+ int op,
+ Picture src,
+ Picture dst,
+ _Xconst XRenderPictFormat *maskFormat,
+ GlyphSet glyphset,
+ int xSrc,
+ int ySrc,
+ int xDst,
+ int yDst,
+ _Xconst char *string,
+ int nchar);
+
+void
+XRenderCompositeString16 (Display *dpy,
+ int op,
+ Picture src,
+ Picture dst,
+ _Xconst XRenderPictFormat *maskFormat,
+ GlyphSet glyphset,
+ int xSrc,
+ int ySrc,
+ int xDst,
+ int yDst,
+ _Xconst unsigned short *string,
+ int nchar);
+
+void
+XRenderCompositeString32 (Display *dpy,
+ int op,
+ Picture src,
+ Picture dst,
+ _Xconst XRenderPictFormat *maskFormat,
+ GlyphSet glyphset,
+ int xSrc,
+ int ySrc,
+ int xDst,
+ int yDst,
+ _Xconst unsigned int *string,
+ int nchar);
+
+void
+XRenderCompositeText8 (Display *dpy,
+ int op,
+ Picture src,
+ Picture dst,
+ _Xconst XRenderPictFormat *maskFormat,
+ int xSrc,
+ int ySrc,
+ int xDst,
+ int yDst,
+ _Xconst XGlyphElt8 *elts,
+ int nelt);
+
+void
+XRenderCompositeText16 (Display *dpy,
+ int op,
+ Picture src,
+ Picture dst,
+ _Xconst XRenderPictFormat *maskFormat,
+ int xSrc,
+ int ySrc,
+ int xDst,
+ int yDst,
+ _Xconst XGlyphElt16 *elts,
+ int nelt);
+
+void
+XRenderCompositeText32 (Display *dpy,
+ int op,
+ Picture src,
+ Picture dst,
+ _Xconst XRenderPictFormat *maskFormat,
+ int xSrc,
+ int ySrc,
+ int xDst,
+ int yDst,
+ _Xconst XGlyphElt32 *elts,
+ int nelt);
+
+void
+XRenderFillRectangle (Display *dpy,
+ int op,
+ Picture dst,
+ _Xconst XRenderColor *color,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height);
+
+void
+XRenderFillRectangles (Display *dpy,
+ int op,
+ Picture dst,
+ _Xconst XRenderColor *color,
+ _Xconst XRectangle *rectangles,
+ int n_rects);
+
+void
+XRenderCompositeTrapezoids (Display *dpy,
+ int op,
+ Picture src,
+ Picture dst,
+ _Xconst XRenderPictFormat *maskFormat,
+ int xSrc,
+ int ySrc,
+ _Xconst XTrapezoid *traps,
+ int ntrap);
+
+void
+XRenderCompositeTriangles (Display *dpy,
+ int op,
+ Picture src,
+ Picture dst,
+ _Xconst XRenderPictFormat *maskFormat,
+ int xSrc,
+ int ySrc,
+ _Xconst XTriangle *triangles,
+ int ntriangle);
+
+void
+XRenderCompositeTriStrip (Display *dpy,
+ int op,
+ Picture src,
+ Picture dst,
+ _Xconst XRenderPictFormat *maskFormat,
+ int xSrc,
+ int ySrc,
+ _Xconst XPointFixed *points,
+ int npoint);
+
+void
+XRenderCompositeTriFan (Display *dpy,
+ int op,
+ Picture src,
+ Picture dst,
+ _Xconst XRenderPictFormat *maskFormat,
+ int xSrc,
+ int ySrc,
+ _Xconst XPointFixed *points,
+ int npoint);
+
+void
+XRenderCompositeDoublePoly (Display *dpy,
+ int op,
+ Picture src,
+ Picture dst,
+ _Xconst XRenderPictFormat *maskFormat,
+ int xSrc,
+ int ySrc,
+ int xDst,
+ int yDst,
+ _Xconst XPointDouble *fpoints,
+ int npoints,
+ int winding);
+Status
+XRenderParseColor(Display *dpy,
+ char *spec,
+ XRenderColor *def);
+
+Cursor
+XRenderCreateCursor (Display *dpy,
+ Picture source,
+ unsigned int x,
+ unsigned int y);
+
+XFilters *
+XRenderQueryFilters (Display *dpy, Drawable drawable);
+
+void
+XRenderSetPictureFilter (Display *dpy,
+ Picture picture,
+ const char *filter,
+ XFixed *params,
+ int nparams);
+
+Cursor
+XRenderCreateAnimCursor (Display *dpy,
+ int ncursor,
+ XAnimCursor *cursors);
+
+
+void
+XRenderAddTraps (Display *dpy,
+ Picture picture,
+ int xOff,
+ int yOff,
+ _Xconst XTrap *traps,
+ int ntrap);
+
+Picture XRenderCreateSolidFill (Display *dpy,
+ const XRenderColor *color);
+
+Picture XRenderCreateLinearGradient (Display *dpy,
+ const XLinearGradient *gradient,
+ const XFixed *stops,
+ const XRenderColor *colors,
+ int nstops);
+
+Picture XRenderCreateRadialGradient (Display *dpy,
+ const XRadialGradient *gradient,
+ const XFixed *stops,
+ const XRenderColor *colors,
+ int nstops);
+
+Picture XRenderCreateConicalGradient (Display *dpy,
+ const XConicalGradient *gradient,
+ const XFixed *stops,
+ const XRenderColor *colors,
+ int nstops);
+
+_XFUNCPROTOEND
+
+#endif /* _XRENDER_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/randr.h b/thirdparty/linuxbsd_headers/X11/extensions/randr.h
new file mode 100644
index 0000000000..e7caab1725
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/randr.h
@@ -0,0 +1,208 @@
+/*
+ * Copyright © 2000 Compaq Computer Corporation
+ * Copyright © 2002 Hewlett Packard Company
+ * Copyright © 2006 Intel Corporation
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc.
+ * Keith Packard, Intel Corporation
+ */
+
+#ifndef _RANDR_H_
+#define _RANDR_H_
+
+typedef unsigned short Rotation;
+typedef unsigned short SizeID;
+typedef unsigned short SubpixelOrder;
+typedef unsigned short Connection;
+typedef unsigned short XRandrRotation;
+typedef unsigned short XRandrSizeID;
+typedef unsigned short XRandrSubpixelOrder;
+typedef unsigned long XRandrModeFlags;
+
+#define RANDR_NAME "RANDR"
+#define RANDR_MAJOR 1
+#define RANDR_MINOR 6
+
+#define RRNumberErrors 5
+#define RRNumberEvents 2
+#define RRNumberRequests 47
+
+#define X_RRQueryVersion 0
+/* we skip 1 to make old clients fail pretty immediately */
+#define X_RROldGetScreenInfo 1
+#define X_RR1_0SetScreenConfig 2
+/* V1.0 apps share the same set screen config request id */
+#define X_RRSetScreenConfig 2
+#define X_RROldScreenChangeSelectInput 3
+/* 3 used to be ScreenChangeSelectInput; deprecated */
+#define X_RRSelectInput 4
+#define X_RRGetScreenInfo 5
+
+/* V1.2 additions */
+#define X_RRGetScreenSizeRange 6
+#define X_RRSetScreenSize 7
+#define X_RRGetScreenResources 8
+#define X_RRGetOutputInfo 9
+#define X_RRListOutputProperties 10
+#define X_RRQueryOutputProperty 11
+#define X_RRConfigureOutputProperty 12
+#define X_RRChangeOutputProperty 13
+#define X_RRDeleteOutputProperty 14
+#define X_RRGetOutputProperty 15
+#define X_RRCreateMode 16
+#define X_RRDestroyMode 17
+#define X_RRAddOutputMode 18
+#define X_RRDeleteOutputMode 19
+#define X_RRGetCrtcInfo 20
+#define X_RRSetCrtcConfig 21
+#define X_RRGetCrtcGammaSize 22
+#define X_RRGetCrtcGamma 23
+#define X_RRSetCrtcGamma 24
+
+/* V1.3 additions */
+#define X_RRGetScreenResourcesCurrent 25
+#define X_RRSetCrtcTransform 26
+#define X_RRGetCrtcTransform 27
+#define X_RRGetPanning 28
+#define X_RRSetPanning 29
+#define X_RRSetOutputPrimary 30
+#define X_RRGetOutputPrimary 31
+
+#define RRTransformUnit (1L << 0)
+#define RRTransformScaleUp (1L << 1)
+#define RRTransformScaleDown (1L << 2)
+#define RRTransformProjective (1L << 3)
+
+/* v1.4 */
+#define X_RRGetProviders 32
+#define X_RRGetProviderInfo 33
+#define X_RRSetProviderOffloadSink 34
+#define X_RRSetProviderOutputSource 35
+#define X_RRListProviderProperties 36
+#define X_RRQueryProviderProperty 37
+#define X_RRConfigureProviderProperty 38
+#define X_RRChangeProviderProperty 39
+#define X_RRDeleteProviderProperty 40
+#define X_RRGetProviderProperty 41
+
+/* v1.5 */
+#define X_RRGetMonitors 42
+#define X_RRSetMonitor 43
+#define X_RRDeleteMonitor 44
+
+/* v1.6 */
+#define X_RRCreateLease 45
+#define X_RRFreeLease 46
+
+/* Event selection bits */
+#define RRScreenChangeNotifyMask (1L << 0)
+/* V1.2 additions */
+#define RRCrtcChangeNotifyMask (1L << 1)
+#define RROutputChangeNotifyMask (1L << 2)
+#define RROutputPropertyNotifyMask (1L << 3)
+/* V1.4 additions */
+#define RRProviderChangeNotifyMask (1L << 4)
+#define RRProviderPropertyNotifyMask (1L << 5)
+#define RRResourceChangeNotifyMask (1L << 6)
+/* V1.6 additions */
+#define RRLeaseNotifyMask (1L << 7)
+
+/* Event codes */
+#define RRScreenChangeNotify 0
+/* V1.2 additions */
+#define RRNotify 1
+/* RRNotify Subcodes */
+#define RRNotify_CrtcChange 0
+#define RRNotify_OutputChange 1
+#define RRNotify_OutputProperty 2
+#define RRNotify_ProviderChange 3
+#define RRNotify_ProviderProperty 4
+#define RRNotify_ResourceChange 5
+/* V1.6 additions */
+#define RRNotify_Lease 6
+/* used in the rotation field; rotation and reflection in 0.1 proto. */
+#define RR_Rotate_0 1
+#define RR_Rotate_90 2
+#define RR_Rotate_180 4
+#define RR_Rotate_270 8
+
+/* new in 1.0 protocol, to allow reflection of screen */
+
+#define RR_Reflect_X 16
+#define RR_Reflect_Y 32
+
+#define RRSetConfigSuccess 0
+#define RRSetConfigInvalidConfigTime 1
+#define RRSetConfigInvalidTime 2
+#define RRSetConfigFailed 3
+
+/* new in 1.2 protocol */
+
+#define RR_HSyncPositive 0x00000001
+#define RR_HSyncNegative 0x00000002
+#define RR_VSyncPositive 0x00000004
+#define RR_VSyncNegative 0x00000008
+#define RR_Interlace 0x00000010
+#define RR_DoubleScan 0x00000020
+#define RR_CSync 0x00000040
+#define RR_CSyncPositive 0x00000080
+#define RR_CSyncNegative 0x00000100
+#define RR_HSkewPresent 0x00000200
+#define RR_BCast 0x00000400
+#define RR_PixelMultiplex 0x00000800
+#define RR_DoubleClock 0x00001000
+#define RR_ClockDivideBy2 0x00002000
+
+#define RR_Connected 0
+#define RR_Disconnected 1
+#define RR_UnknownConnection 2
+
+#define BadRROutput 0
+#define BadRRCrtc 1
+#define BadRRMode 2
+#define BadRRProvider 3
+#define BadRRLease 4
+
+/* Conventional RandR output properties */
+
+#define RR_PROPERTY_BACKLIGHT "Backlight"
+#define RR_PROPERTY_RANDR_EDID "EDID"
+#define RR_PROPERTY_SIGNAL_FORMAT "SignalFormat"
+#define RR_PROPERTY_SIGNAL_PROPERTIES "SignalProperties"
+#define RR_PROPERTY_CONNECTOR_TYPE "ConnectorType"
+#define RR_PROPERTY_CONNECTOR_NUMBER "ConnectorNumber"
+#define RR_PROPERTY_COMPATIBILITY_LIST "CompatibilityList"
+#define RR_PROPERTY_CLONE_LIST "CloneList"
+#define RR_PROPERTY_BORDER "Border"
+#define RR_PROPERTY_BORDER_DIMENSIONS "BorderDimensions"
+#define RR_PROPERTY_GUID "GUID"
+#define RR_PROPERTY_RANDR_TILE "TILE"
+#define RR_PROPERTY_NON_DESKTOP "non-desktop"
+
+/* roles this device can carry out */
+#define RR_Capability_None 0
+#define RR_Capability_SourceOutput 1
+#define RR_Capability_SinkOutput 2
+#define RR_Capability_SourceOffload 4
+#define RR_Capability_SinkOffload 8
+
+#endif /* _RANDR_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/randrproto.h b/thirdparty/linuxbsd_headers/X11/extensions/randrproto.h
new file mode 100644
index 0000000000..624c2544c9
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/randrproto.h
@@ -0,0 +1,1152 @@
+/*
+ * Copyright © 2000 Compaq Computer Corporation
+ * Copyright © 2002 Hewlett-Packard Company
+ * Copyright © 2006 Intel Corporation
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ * Author: Jim Gettys, Hewlett-Packard Company, Inc.
+ * Keith Packard, Intel Corporation
+ */
+
+/* note that RANDR 1.0 is incompatible with version 0.0, or 0.1 */
+/* V1.0 removes depth switching from the protocol */
+#ifndef _XRANDRP_H_
+#define _XRANDRP_H_
+
+#include <X11/extensions/randr.h>
+#include <X11/extensions/renderproto.h>
+
+#define Window CARD32
+#define Drawable CARD32
+#define Font CARD32
+#define Pixmap CARD32
+#define Cursor CARD32
+#define Colormap CARD32
+#define GContext CARD32
+#define Atom CARD32
+#define Time CARD32
+#define KeyCode CARD8
+#define KeySym CARD32
+#define RROutput CARD32
+#define RRMode CARD32
+#define RRCrtc CARD32
+#define RRProvider CARD32
+#define RRModeFlags CARD32
+#define RRLease CARD32
+
+#define Rotation CARD16
+#define SizeID CARD16
+#define SubpixelOrder CARD16
+
+/*
+ * data structures
+ */
+
+typedef struct {
+ CARD16 widthInPixels;
+ CARD16 heightInPixels;
+ CARD16 widthInMillimeters;
+ CARD16 heightInMillimeters;
+} xScreenSizes;
+#define sz_xScreenSizes 8
+
+/*
+ * requests and replies
+ */
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ CARD32 majorVersion;
+ CARD32 minorVersion;
+} xRRQueryVersionReq;
+#define sz_xRRQueryVersionReq 12
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BYTE pad1;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ CARD32 majorVersion;
+ CARD32 minorVersion;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+} xRRQueryVersionReply;
+#define sz_xRRQueryVersionReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ Window window;
+} xRRGetScreenInfoReq;
+#define sz_xRRGetScreenInfoReq 8
+
+/*
+ * the xRRScreenInfoReply structure is followed by:
+ *
+ * the size information
+ */
+
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BYTE setOfRotations;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ Window root;
+ Time timestamp;
+ Time configTimestamp;
+ CARD16 nSizes;
+ SizeID sizeID;
+ Rotation rotation;
+ CARD16 rate;
+ CARD16 nrateEnts;
+ CARD16 pad;
+} xRRGetScreenInfoReply;
+#define sz_xRRGetScreenInfoReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ Drawable drawable;
+ Time timestamp;
+ Time configTimestamp;
+ SizeID sizeID;
+ Rotation rotation;
+} xRR1_0SetScreenConfigReq;
+#define sz_xRR1_0SetScreenConfigReq 20
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ Drawable drawable;
+ Time timestamp;
+ Time configTimestamp;
+ SizeID sizeID;
+ Rotation rotation;
+ CARD16 rate;
+ CARD16 pad;
+} xRRSetScreenConfigReq;
+#define sz_xRRSetScreenConfigReq 24
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 status;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ Time newTimestamp;
+ Time newConfigTimestamp;
+ Window root;
+ CARD16 subpixelOrder;
+ CARD16 pad4;
+ CARD32 pad5;
+ CARD32 pad6;
+} xRRSetScreenConfigReply;
+#define sz_xRRSetScreenConfigReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ Window window;
+ CARD16 enable;
+ CARD16 pad2;
+} xRRSelectInputReq;
+#define sz_xRRSelectInputReq 12
+
+/*
+ * Additions for version 1.2
+ */
+
+typedef struct _xRRModeInfo {
+ RRMode id;
+ CARD16 width;
+ CARD16 height;
+ CARD32 dotClock;
+ CARD16 hSyncStart;
+ CARD16 hSyncEnd;
+ CARD16 hTotal;
+ CARD16 hSkew;
+ CARD16 vSyncStart;
+ CARD16 vSyncEnd;
+ CARD16 vTotal;
+ CARD16 nameLength;
+ RRModeFlags modeFlags;
+} xRRModeInfo;
+#define sz_xRRModeInfo 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ Window window;
+} xRRGetScreenSizeRangeReq;
+#define sz_xRRGetScreenSizeRangeReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 pad;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ CARD16 minWidth;
+ CARD16 minHeight;
+ CARD16 maxWidth;
+ CARD16 maxHeight;
+ CARD32 pad0;
+ CARD32 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+} xRRGetScreenSizeRangeReply;
+#define sz_xRRGetScreenSizeRangeReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ Window window;
+ CARD16 width;
+ CARD16 height;
+ CARD32 widthInMillimeters;
+ CARD32 heightInMillimeters;
+} xRRSetScreenSizeReq;
+#define sz_xRRSetScreenSizeReq 20
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ Window window;
+} xRRGetScreenResourcesReq;
+#define sz_xRRGetScreenResourcesReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 pad;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ Time timestamp;
+ Time configTimestamp;
+ CARD16 nCrtcs;
+ CARD16 nOutputs;
+ CARD16 nModes;
+ CARD16 nbytesNames;
+ CARD32 pad1;
+ CARD32 pad2;
+} xRRGetScreenResourcesReply;
+#define sz_xRRGetScreenResourcesReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RROutput output;
+ Time configTimestamp;
+} xRRGetOutputInfoReq;
+#define sz_xRRGetOutputInfoReq 12
+
+typedef struct {
+ BYTE type;
+ CARD8 status;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ Time timestamp;
+ RRCrtc crtc;
+ CARD32 mmWidth;
+ CARD32 mmHeight;
+ CARD8 connection;
+ CARD8 subpixelOrder;
+ CARD16 nCrtcs;
+ CARD16 nModes;
+ CARD16 nPreferred;
+ CARD16 nClones;
+ CARD16 nameLength;
+} xRRGetOutputInfoReply;
+#define sz_xRRGetOutputInfoReply 36
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RROutput output;
+} xRRListOutputPropertiesReq;
+#define sz_xRRListOutputPropertiesReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 pad0;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ CARD16 nAtoms;
+ CARD16 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+ CARD32 pad6;
+} xRRListOutputPropertiesReply;
+#define sz_xRRListOutputPropertiesReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RROutput output;
+ Atom property;
+} xRRQueryOutputPropertyReq;
+#define sz_xRRQueryOutputPropertyReq 12
+
+typedef struct {
+ BYTE type;
+ BYTE pad0;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ BOOL pending;
+ BOOL range;
+ BOOL immutable;
+ BYTE pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+ CARD32 pad6;
+} xRRQueryOutputPropertyReply;
+#define sz_xRRQueryOutputPropertyReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RROutput output;
+ Atom property;
+ BOOL pending;
+ BOOL range;
+ CARD16 pad;
+} xRRConfigureOutputPropertyReq;
+#define sz_xRRConfigureOutputPropertyReq 16
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RROutput output;
+ Atom property;
+ Atom type;
+ CARD8 format;
+ CARD8 mode;
+ CARD16 pad;
+ CARD32 nUnits;
+} xRRChangeOutputPropertyReq;
+#define sz_xRRChangeOutputPropertyReq 24
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RROutput output;
+ Atom property;
+} xRRDeleteOutputPropertyReq;
+#define sz_xRRDeleteOutputPropertyReq 12
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RROutput output;
+ Atom property;
+ Atom type;
+ CARD32 longOffset;
+ CARD32 longLength;
+#ifdef __cplusplus
+ BOOL _delete;
+#else
+ BOOL delete;
+#endif
+ BOOL pending;
+ CARD16 pad1;
+} xRRGetOutputPropertyReq;
+#define sz_xRRGetOutputPropertyReq 28
+
+typedef struct {
+ BYTE type;
+ CARD8 format;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ Atom propertyType;
+ CARD32 bytesAfter;
+ CARD32 nItems;
+ CARD32 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+} xRRGetOutputPropertyReply;
+#define sz_xRRGetOutputPropertyReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ Window window;
+ xRRModeInfo modeInfo;
+} xRRCreateModeReq;
+#define sz_xRRCreateModeReq 40
+
+typedef struct {
+ BYTE type;
+ CARD8 pad0;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ RRMode mode;
+ CARD32 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+} xRRCreateModeReply;
+#define sz_xRRCreateModeReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRMode mode;
+} xRRDestroyModeReq;
+#define sz_xRRDestroyModeReq 8
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RROutput output;
+ RRMode mode;
+} xRRAddOutputModeReq;
+#define sz_xRRAddOutputModeReq 12
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RROutput output;
+ RRMode mode;
+} xRRDeleteOutputModeReq;
+#define sz_xRRDeleteOutputModeReq 12
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRCrtc crtc;
+ Time configTimestamp;
+} xRRGetCrtcInfoReq;
+#define sz_xRRGetCrtcInfoReq 12
+
+typedef struct {
+ BYTE type;
+ CARD8 status;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ Time timestamp;
+ INT16 x;
+ INT16 y;
+ CARD16 width;
+ CARD16 height;
+ RRMode mode;
+ Rotation rotation;
+ Rotation rotations;
+ CARD16 nOutput;
+ CARD16 nPossibleOutput;
+} xRRGetCrtcInfoReply;
+#define sz_xRRGetCrtcInfoReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRCrtc crtc;
+ Time timestamp;
+ Time configTimestamp;
+ INT16 x;
+ INT16 y;
+ RRMode mode;
+ Rotation rotation;
+ CARD16 pad;
+} xRRSetCrtcConfigReq;
+#define sz_xRRSetCrtcConfigReq 28
+
+typedef struct {
+ BYTE type;
+ CARD8 status;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ Time newTimestamp;
+ CARD32 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+} xRRSetCrtcConfigReply;
+#define sz_xRRSetCrtcConfigReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRCrtc crtc;
+} xRRGetCrtcGammaSizeReq;
+#define sz_xRRGetCrtcGammaSizeReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 status;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ CARD16 size;
+ CARD16 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+ CARD32 pad6;
+} xRRGetCrtcGammaSizeReply;
+#define sz_xRRGetCrtcGammaSizeReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRCrtc crtc;
+} xRRGetCrtcGammaReq;
+#define sz_xRRGetCrtcGammaReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 status;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ CARD16 size;
+ CARD16 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+ CARD32 pad6;
+} xRRGetCrtcGammaReply;
+#define sz_xRRGetCrtcGammaReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRCrtc crtc;
+ CARD16 size;
+ CARD16 pad1;
+} xRRSetCrtcGammaReq;
+#define sz_xRRSetCrtcGammaReq 12
+
+/*
+ * Additions for V1.3
+ */
+
+typedef xRRGetScreenResourcesReq xRRGetScreenResourcesCurrentReq;
+
+#define sz_xRRGetScreenResourcesCurrentReq sz_xRRGetScreenResourcesReq
+
+typedef xRRGetScreenResourcesReply xRRGetScreenResourcesCurrentReply;
+#define sz_xRRGetScreenResourcesCurrentReply sz_xRRGetScreenResourcesReply
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRCrtc crtc;
+ xRenderTransform transform;
+ CARD16 nbytesFilter; /* number of bytes in filter name */
+ CARD16 pad;
+} xRRSetCrtcTransformReq;
+
+#define sz_xRRSetCrtcTransformReq 48
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRCrtc crtc;
+} xRRGetCrtcTransformReq;
+
+#define sz_xRRGetCrtcTransformReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 status;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ xRenderTransform pendingTransform;
+ BYTE hasTransforms;
+ CARD8 pad0;
+ CARD16 pad1;
+ xRenderTransform currentTransform;
+ CARD32 pad2;
+ CARD16 pendingNbytesFilter; /* number of bytes in filter name */
+ CARD16 pendingNparamsFilter; /* number of filter params */
+ CARD16 currentNbytesFilter; /* number of bytes in filter name */
+ CARD16 currentNparamsFilter; /* number of filter params */
+} xRRGetCrtcTransformReply;
+
+#define sz_xRRGetCrtcTransformReply 96
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ Window window;
+ RROutput output;
+} xRRSetOutputPrimaryReq;
+#define sz_xRRSetOutputPrimaryReq 12
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ Window window;
+} xRRGetOutputPrimaryReq;
+#define sz_xRRGetOutputPrimaryReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 pad;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ RROutput output;
+ CARD32 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+} xRRGetOutputPrimaryReply;
+#define sz_xRRGetOutputPrimaryReply 32
+
+/*
+ * Additions for V1.4
+ */
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ Window window;
+} xRRGetProvidersReq;
+#define sz_xRRGetProvidersReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 pad;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ Time timestamp;
+ CARD16 nProviders;
+ CARD16 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+} xRRGetProvidersReply;
+#define sz_xRRGetProvidersReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRProvider provider;
+ Time configTimestamp;
+} xRRGetProviderInfoReq;
+#define sz_xRRGetProviderInfoReq 12
+
+typedef struct {
+ BYTE type;
+ CARD8 status;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ Time timestamp;
+ CARD32 capabilities;
+ CARD16 nCrtcs;
+ CARD16 nOutputs;
+ CARD16 nAssociatedProviders;
+ CARD16 nameLength;
+ CARD32 pad1;
+ CARD32 pad2;
+} xRRGetProviderInfoReply;
+#define sz_xRRGetProviderInfoReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRProvider provider;
+ RRProvider source_provider;
+ Time configTimestamp;
+} xRRSetProviderOutputSourceReq;
+#define sz_xRRSetProviderOutputSourceReq 16
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRProvider provider;
+ RRProvider sink_provider;
+ Time configTimestamp;
+} xRRSetProviderOffloadSinkReq;
+#define sz_xRRSetProviderOffloadSinkReq 16
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRProvider provider;
+} xRRListProviderPropertiesReq;
+#define sz_xRRListProviderPropertiesReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 pad0;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ CARD16 nAtoms;
+ CARD16 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+ CARD32 pad6;
+} xRRListProviderPropertiesReply;
+#define sz_xRRListProviderPropertiesReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRProvider provider;
+ Atom property;
+} xRRQueryProviderPropertyReq;
+#define sz_xRRQueryProviderPropertyReq 12
+
+typedef struct {
+ BYTE type;
+ BYTE pad0;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ BOOL pending;
+ BOOL range;
+ BOOL immutable;
+ BYTE pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+ CARD32 pad6;
+} xRRQueryProviderPropertyReply;
+#define sz_xRRQueryProviderPropertyReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRProvider provider;
+ Atom property;
+ BOOL pending;
+ BOOL range;
+ CARD16 pad;
+} xRRConfigureProviderPropertyReq;
+#define sz_xRRConfigureProviderPropertyReq 16
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRProvider provider;
+ Atom property;
+ Atom type;
+ CARD8 format;
+ CARD8 mode;
+ CARD16 pad;
+ CARD32 nUnits;
+} xRRChangeProviderPropertyReq;
+#define sz_xRRChangeProviderPropertyReq 24
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRProvider provider;
+ Atom property;
+} xRRDeleteProviderPropertyReq;
+#define sz_xRRDeleteProviderPropertyReq 12
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRProvider provider;
+ Atom property;
+ Atom type;
+ CARD32 longOffset;
+ CARD32 longLength;
+#ifdef __cplusplus
+ BOOL _delete;
+#else
+ BOOL delete;
+#endif
+ BOOL pending;
+ CARD16 pad1;
+} xRRGetProviderPropertyReq;
+#define sz_xRRGetProviderPropertyReq 28
+
+typedef struct {
+ BYTE type;
+ CARD8 format;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ Atom propertyType;
+ CARD32 bytesAfter;
+ CARD32 nItems;
+ CARD32 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+} xRRGetProviderPropertyReply;
+#define sz_xRRGetProviderPropertyReply 32
+
+/*
+ * Additions for V1.6
+ */
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ Window window;
+ RRLease lid;
+ CARD16 nCrtcs;
+ CARD16 nOutputs;
+} xRRCreateLeaseReq;
+#define sz_xRRCreateLeaseReq 16
+
+typedef struct {
+ BYTE type;
+ CARD8 nfd;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+ CARD32 pad6;
+ CARD32 pad7;
+} xRRCreateLeaseReply;
+#define sz_xRRCreateLeaseReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRLease lid;
+ BYTE terminate;
+ CARD8 pad1;
+ CARD16 pad2;
+} xRRFreeLeaseReq;
+#define sz_xRRFreeLeaseReq 12
+
+/*
+ * event
+ */
+typedef struct {
+ CARD8 type; /* always evBase + ScreenChangeNotify */
+ CARD8 rotation; /* new rotation */
+ CARD16 sequenceNumber;
+ Time timestamp; /* time screen was changed */
+ Time configTimestamp; /* time config data was changed */
+ Window root; /* root window */
+ Window window; /* window requesting notification */
+ SizeID sizeID; /* new size ID */
+ CARD16 subpixelOrder; /* subpixel order */
+ CARD16 widthInPixels; /* new size */
+ CARD16 heightInPixels;
+ CARD16 widthInMillimeters;
+ CARD16 heightInMillimeters;
+} xRRScreenChangeNotifyEvent;
+#define sz_xRRScreenChangeNotifyEvent 32
+
+typedef struct {
+ CARD8 type; /* always evBase + RRNotify */
+ CARD8 subCode; /* RRNotify_CrtcChange */
+ CARD16 sequenceNumber;
+ Time timestamp; /* time crtc was changed */
+ Window window; /* window requesting notification */
+ RRCrtc crtc; /* affected CRTC */
+ RRMode mode; /* current mode */
+ CARD16 rotation; /* rotation and reflection */
+ CARD16 pad1; /* unused */
+ INT16 x; /* new location */
+ INT16 y;
+ CARD16 width; /* new size */
+ CARD16 height;
+} xRRCrtcChangeNotifyEvent;
+#define sz_xRRCrtcChangeNotifyEvent 32
+
+typedef struct {
+ CARD8 type; /* always evBase + RRNotify */
+ CARD8 subCode; /* RRNotify_OutputChange */
+ CARD16 sequenceNumber;
+ Time timestamp; /* time output was changed */
+ Time configTimestamp; /* time config was changed */
+ Window window; /* window requesting notification */
+ RROutput output; /* affected output */
+ RRCrtc crtc; /* current crtc */
+ RRMode mode; /* current mode */
+ CARD16 rotation; /* rotation and reflection */
+ CARD8 connection; /* connection status */
+ CARD8 subpixelOrder; /* subpixel order */
+} xRROutputChangeNotifyEvent;
+#define sz_xRROutputChangeNotifyEvent 32
+
+typedef struct {
+ CARD8 type; /* always evBase + RRNotify */
+ CARD8 subCode; /* RRNotify_OutputProperty */
+ CARD16 sequenceNumber;
+ Window window; /* window requesting notification */
+ RROutput output; /* affected output */
+ Atom atom; /* property name */
+ Time timestamp; /* time crtc was changed */
+ CARD8 state; /* NewValue or Deleted */
+ CARD8 pad1;
+ CARD16 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+} xRROutputPropertyNotifyEvent;
+#define sz_xRROutputPropertyNotifyEvent 32
+
+typedef struct {
+ CARD8 type; /* always evBase + RRNotify */
+ CARD8 subCode; /* RRNotify_ProviderChange */
+ CARD16 sequenceNumber;
+ Time timestamp; /* time provider was changed */
+ Window window; /* window requesting notification */
+ RRProvider provider; /* affected provider */
+ CARD32 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+} xRRProviderChangeNotifyEvent;
+#define sz_xRRProviderChangeNotifyEvent 32
+
+typedef struct {
+ CARD8 type; /* always evBase + RRNotify */
+ CARD8 subCode; /* RRNotify_ProviderProperty */
+ CARD16 sequenceNumber;
+ Window window; /* window requesting notification */
+ RRProvider provider; /* affected provider */
+ Atom atom; /* property name */
+ Time timestamp; /* time provider was changed */
+ CARD8 state; /* NewValue or Deleted */
+ CARD8 pad1;
+ CARD16 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+} xRRProviderPropertyNotifyEvent;
+#define sz_xRRProviderPropertyNotifyEvent 32
+
+typedef struct {
+ CARD8 type; /* always evBase + RRNotify */
+ CARD8 subCode; /* RRNotify_ResourceChange */
+ CARD16 sequenceNumber;
+ Time timestamp; /* time resource was changed */
+ Window window; /* window requesting notification */
+ CARD32 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+} xRRResourceChangeNotifyEvent;
+#define sz_xRRResourceChangeNotifyEvent 32
+
+typedef struct {
+ CARD8 type; /* always evBase + RRNotify */
+ CARD8 subCode; /* RRNotify_Lease */
+ CARD16 sequenceNumber;
+ Time timestamp; /* time resource was changed */
+ Window window; /* window requesting notification */
+ RRLease lease;
+ CARD8 created; /* created/deleted */
+ CARD8 pad0;
+ CARD16 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+} xRRLeaseNotifyEvent;
+#define sz_xRRLeaseNotifyEvent 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRCrtc crtc;
+} xRRGetPanningReq;
+#define sz_xRRGetPanningReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 status;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ Time timestamp;
+ CARD16 left;
+ CARD16 top;
+ CARD16 width;
+ CARD16 height;
+ CARD16 track_left;
+ CARD16 track_top;
+ CARD16 track_width;
+ CARD16 track_height;
+ INT16 border_left;
+ INT16 border_top;
+ INT16 border_right;
+ INT16 border_bottom;
+} xRRGetPanningReply;
+#define sz_xRRGetPanningReply 36
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ RRCrtc crtc;
+ Time timestamp;
+ CARD16 left;
+ CARD16 top;
+ CARD16 width;
+ CARD16 height;
+ CARD16 track_left;
+ CARD16 track_top;
+ CARD16 track_width;
+ CARD16 track_height;
+ INT16 border_left;
+ INT16 border_top;
+ INT16 border_right;
+ INT16 border_bottom;
+} xRRSetPanningReq;
+#define sz_xRRSetPanningReq 36
+
+typedef struct {
+ BYTE type;
+ CARD8 status;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ Time newTimestamp;
+ CARD32 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+} xRRSetPanningReply;
+#define sz_xRRSetPanningReply 32
+
+typedef struct {
+ Atom name;
+ BOOL primary;
+ BOOL automatic;
+ CARD16 noutput;
+ INT16 x;
+ INT16 y;
+ CARD16 width;
+ CARD16 height;
+ CARD32 widthInMillimeters;
+ CARD32 heightInMillimeters;
+} xRRMonitorInfo;
+#define sz_xRRMonitorInfo 24
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ Window window;
+ BOOL get_active;
+ CARD8 pad;
+ CARD16 pad2;
+} xRRGetMonitorsReq;
+#define sz_xRRGetMonitorsReq 12
+
+typedef struct {
+ BYTE type;
+ CARD8 status;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ Time timestamp;
+ CARD32 nmonitors;
+ CARD32 noutputs;
+ CARD32 pad1;
+ CARD32 pad2;
+ CARD32 pad3;
+} xRRGetMonitorsReply;
+#define sz_xRRGetMonitorsReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ Window window;
+ xRRMonitorInfo monitor;
+} xRRSetMonitorReq;
+#define sz_xRRSetMonitorReq 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length;
+ Window window;
+ Atom name;
+} xRRDeleteMonitorReq;
+#define sz_xRRDeleteMonitorReq 12
+
+#undef RRLease
+#undef RRModeFlags
+#undef RRCrtc
+#undef RRMode
+#undef RROutput
+#undef RRMode
+#undef RRCrtc
+#undef RRProvider
+#undef Drawable
+#undef Window
+#undef Font
+#undef Pixmap
+#undef Cursor
+#undef Colormap
+#undef GContext
+#undef Atom
+#undef Time
+#undef KeyCode
+#undef KeySym
+#undef Rotation
+#undef SizeID
+#undef SubpixelOrder
+
+#endif /* _XRANDRP_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/render.h b/thirdparty/linuxbsd_headers/X11/extensions/render.h
new file mode 100644
index 0000000000..7ecde3f59e
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/render.h
@@ -0,0 +1,210 @@
+/*
+ * Copyright © 2000 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. SuSE makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, SuSE, Inc.
+ */
+
+#ifndef _RENDER_H_
+#define _RENDER_H_
+
+#include <X11/Xdefs.h>
+
+typedef XID Glyph;
+typedef XID GlyphSet;
+typedef XID Picture;
+typedef XID PictFormat;
+
+#define RENDER_NAME "RENDER"
+#define RENDER_MAJOR 0
+#define RENDER_MINOR 11
+
+#define X_RenderQueryVersion 0
+#define X_RenderQueryPictFormats 1
+#define X_RenderQueryPictIndexValues 2 /* 0.7 */
+#define X_RenderQueryDithers 3
+#define X_RenderCreatePicture 4
+#define X_RenderChangePicture 5
+#define X_RenderSetPictureClipRectangles 6
+#define X_RenderFreePicture 7
+#define X_RenderComposite 8
+#define X_RenderScale 9
+#define X_RenderTrapezoids 10
+#define X_RenderTriangles 11
+#define X_RenderTriStrip 12
+#define X_RenderTriFan 13
+#define X_RenderColorTrapezoids 14
+#define X_RenderColorTriangles 15
+/* #define X_RenderTransform 16 */
+#define X_RenderCreateGlyphSet 17
+#define X_RenderReferenceGlyphSet 18
+#define X_RenderFreeGlyphSet 19
+#define X_RenderAddGlyphs 20
+#define X_RenderAddGlyphsFromPicture 21
+#define X_RenderFreeGlyphs 22
+#define X_RenderCompositeGlyphs8 23
+#define X_RenderCompositeGlyphs16 24
+#define X_RenderCompositeGlyphs32 25
+#define X_RenderFillRectangles 26
+/* 0.5 */
+#define X_RenderCreateCursor 27
+/* 0.6 */
+#define X_RenderSetPictureTransform 28
+#define X_RenderQueryFilters 29
+#define X_RenderSetPictureFilter 30
+/* 0.8 */
+#define X_RenderCreateAnimCursor 31
+/* 0.9 */
+#define X_RenderAddTraps 32
+/* 0.10 */
+#define X_RenderCreateSolidFill 33
+#define X_RenderCreateLinearGradient 34
+#define X_RenderCreateRadialGradient 35
+#define X_RenderCreateConicalGradient 36
+#define RenderNumberRequests (X_RenderCreateConicalGradient+1)
+
+#define BadPictFormat 0
+#define BadPicture 1
+#define BadPictOp 2
+#define BadGlyphSet 3
+#define BadGlyph 4
+#define RenderNumberErrors (BadGlyph+1)
+
+#define PictTypeIndexed 0
+#define PictTypeDirect 1
+
+#define PictOpMinimum 0
+#define PictOpClear 0
+#define PictOpSrc 1
+#define PictOpDst 2
+#define PictOpOver 3
+#define PictOpOverReverse 4
+#define PictOpIn 5
+#define PictOpInReverse 6
+#define PictOpOut 7
+#define PictOpOutReverse 8
+#define PictOpAtop 9
+#define PictOpAtopReverse 10
+#define PictOpXor 11
+#define PictOpAdd 12
+#define PictOpSaturate 13
+#define PictOpMaximum 13
+
+/*
+ * Operators only available in version 0.2
+ */
+#define PictOpDisjointMinimum 0x10
+#define PictOpDisjointClear 0x10
+#define PictOpDisjointSrc 0x11
+#define PictOpDisjointDst 0x12
+#define PictOpDisjointOver 0x13
+#define PictOpDisjointOverReverse 0x14
+#define PictOpDisjointIn 0x15
+#define PictOpDisjointInReverse 0x16
+#define PictOpDisjointOut 0x17
+#define PictOpDisjointOutReverse 0x18
+#define PictOpDisjointAtop 0x19
+#define PictOpDisjointAtopReverse 0x1a
+#define PictOpDisjointXor 0x1b
+#define PictOpDisjointMaximum 0x1b
+
+#define PictOpConjointMinimum 0x20
+#define PictOpConjointClear 0x20
+#define PictOpConjointSrc 0x21
+#define PictOpConjointDst 0x22
+#define PictOpConjointOver 0x23
+#define PictOpConjointOverReverse 0x24
+#define PictOpConjointIn 0x25
+#define PictOpConjointInReverse 0x26
+#define PictOpConjointOut 0x27
+#define PictOpConjointOutReverse 0x28
+#define PictOpConjointAtop 0x29
+#define PictOpConjointAtopReverse 0x2a
+#define PictOpConjointXor 0x2b
+#define PictOpConjointMaximum 0x2b
+
+/*
+ * Operators only available in version 0.11
+ */
+#define PictOpBlendMinimum 0x30
+#define PictOpMultiply 0x30
+#define PictOpScreen 0x31
+#define PictOpOverlay 0x32
+#define PictOpDarken 0x33
+#define PictOpLighten 0x34
+#define PictOpColorDodge 0x35
+#define PictOpColorBurn 0x36
+#define PictOpHardLight 0x37
+#define PictOpSoftLight 0x38
+#define PictOpDifference 0x39
+#define PictOpExclusion 0x3a
+#define PictOpHSLHue 0x3b
+#define PictOpHSLSaturation 0x3c
+#define PictOpHSLColor 0x3d
+#define PictOpHSLLuminosity 0x3e
+#define PictOpBlendMaximum 0x3e
+
+#define PolyEdgeSharp 0
+#define PolyEdgeSmooth 1
+
+#define PolyModePrecise 0
+#define PolyModeImprecise 1
+
+#define CPRepeat (1 << 0)
+#define CPAlphaMap (1 << 1)
+#define CPAlphaXOrigin (1 << 2)
+#define CPAlphaYOrigin (1 << 3)
+#define CPClipXOrigin (1 << 4)
+#define CPClipYOrigin (1 << 5)
+#define CPClipMask (1 << 6)
+#define CPGraphicsExposure (1 << 7)
+#define CPSubwindowMode (1 << 8)
+#define CPPolyEdge (1 << 9)
+#define CPPolyMode (1 << 10)
+#define CPDither (1 << 11)
+#define CPComponentAlpha (1 << 12)
+#define CPLastBit 12
+
+/* Filters included in 0.6 */
+#define FilterNearest "nearest"
+#define FilterBilinear "bilinear"
+/* Filters included in 0.10 */
+#define FilterConvolution "convolution"
+
+#define FilterFast "fast"
+#define FilterGood "good"
+#define FilterBest "best"
+
+#define FilterAliasNone -1
+
+/* Subpixel orders included in 0.6 */
+#define SubPixelUnknown 0
+#define SubPixelHorizontalRGB 1
+#define SubPixelHorizontalBGR 2
+#define SubPixelVerticalRGB 3
+#define SubPixelVerticalBGR 4
+#define SubPixelNone 5
+
+/* Extended repeat attributes included in 0.10 */
+#define RepeatNone 0
+#define RepeatNormal 1
+#define RepeatPad 2
+#define RepeatReflect 3
+
+#endif /* _RENDER_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/renderproto.h b/thirdparty/linuxbsd_headers/X11/extensions/renderproto.h
new file mode 100644
index 0000000000..2cd06af5d2
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/renderproto.h
@@ -0,0 +1,661 @@
+/*
+ * Copyright © 2000 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. SuSE makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, SuSE, Inc.
+ */
+
+#ifndef _XRENDERP_H_
+#define _XRENDERP_H_
+
+#include <X11/Xmd.h>
+#include <X11/extensions/render.h>
+
+#define Window CARD32
+#define Drawable CARD32
+#define Font CARD32
+#define Pixmap CARD32
+#define Cursor CARD32
+#define Colormap CARD32
+#define GContext CARD32
+#define Atom CARD32
+#define VisualID CARD32
+#define Time CARD32
+#define KeyCode CARD8
+#define KeySym CARD32
+
+#define Picture CARD32
+#define PictFormat CARD32
+#define Fixed INT32
+#define Glyphset CARD32
+
+/*
+ * data structures
+ */
+
+typedef struct {
+ CARD16 red;
+ CARD16 redMask;
+ CARD16 green;
+ CARD16 greenMask;
+ CARD16 blue;
+ CARD16 blueMask;
+ CARD16 alpha;
+ CARD16 alphaMask;
+} xDirectFormat;
+
+#define sz_xDirectFormat 16
+
+typedef struct {
+ PictFormat id;
+ CARD8 type;
+ CARD8 depth;
+ CARD16 pad1;
+ xDirectFormat direct;
+ Colormap colormap;
+} xPictFormInfo;
+
+#define sz_xPictFormInfo 28
+
+typedef struct {
+ VisualID visual;
+ PictFormat format;
+} xPictVisual;
+
+#define sz_xPictVisual 8
+
+typedef struct {
+ CARD8 depth;
+ CARD8 pad1;
+ CARD16 nPictVisuals;
+ CARD32 pad2;
+} xPictDepth;
+
+#define sz_xPictDepth 8
+
+typedef struct {
+ CARD32 nDepth;
+ PictFormat fallback;
+} xPictScreen;
+
+#define sz_xPictScreen 8
+
+typedef struct {
+ CARD32 pixel;
+ CARD16 red;
+ CARD16 green;
+ CARD16 blue;
+ CARD16 alpha;
+} xIndexValue;
+
+#define sz_xIndexValue 12
+
+typedef struct {
+ CARD16 red;
+ CARD16 green;
+ CARD16 blue;
+ CARD16 alpha;
+} xRenderColor;
+
+#define sz_xRenderColor 8
+
+typedef struct {
+ Fixed x;
+ Fixed y;
+} xPointFixed;
+
+#define sz_xPointFixed 8
+
+typedef struct {
+ xPointFixed p1;
+ xPointFixed p2;
+} xLineFixed;
+
+#define sz_xLineFixed 16
+
+typedef struct {
+ xPointFixed p1, p2, p3;
+} xTriangle;
+
+#define sz_xTriangle 24
+
+typedef struct {
+ Fixed top;
+ Fixed bottom;
+ xLineFixed left;
+ xLineFixed right;
+} xTrapezoid;
+
+#define sz_xTrapezoid 40
+
+typedef struct {
+ CARD16 width;
+ CARD16 height;
+ INT16 x;
+ INT16 y;
+ INT16 xOff;
+ INT16 yOff;
+} xGlyphInfo;
+
+#define sz_xGlyphInfo 12
+
+typedef struct {
+ CARD8 len;
+ CARD8 pad1;
+ CARD16 pad2;
+ INT16 deltax;
+ INT16 deltay;
+} xGlyphElt;
+
+#define sz_xGlyphElt 8
+
+typedef struct {
+ Fixed l, r, y;
+} xSpanFix;
+
+#define sz_xSpanFix 12
+
+typedef struct {
+ xSpanFix top, bot;
+} xTrap;
+
+#define sz_xTrap 24
+
+/*
+ * requests and replies
+ */
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ CARD32 majorVersion;
+ CARD32 minorVersion;
+} xRenderQueryVersionReq;
+
+#define sz_xRenderQueryVersionReq 12
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BYTE pad1;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ CARD32 majorVersion;
+ CARD32 minorVersion;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+} xRenderQueryVersionReply;
+
+#define sz_xRenderQueryVersionReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+} xRenderQueryPictFormatsReq;
+
+#define sz_xRenderQueryPictFormatsReq 4
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BYTE pad1;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ CARD32 numFormats;
+ CARD32 numScreens;
+ CARD32 numDepths;
+ CARD32 numVisuals;
+ CARD32 numSubpixel; /* Version 0.6 */
+ CARD32 pad5;
+} xRenderQueryPictFormatsReply;
+
+#define sz_xRenderQueryPictFormatsReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ PictFormat format;
+} xRenderQueryPictIndexValuesReq;
+
+#define sz_xRenderQueryPictIndexValuesReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BYTE pad1;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ CARD32 numIndexValues;
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+ CARD32 pad6;
+} xRenderQueryPictIndexValuesReply;
+
+#define sz_xRenderQueryPictIndexValuesReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Picture pid;
+ Drawable drawable;
+ PictFormat format;
+ CARD32 mask;
+} xRenderCreatePictureReq;
+
+#define sz_xRenderCreatePictureReq 20
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Picture picture;
+ CARD32 mask;
+} xRenderChangePictureReq;
+
+#define sz_xRenderChangePictureReq 12
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Picture picture;
+ INT16 xOrigin;
+ INT16 yOrigin;
+} xRenderSetPictureClipRectanglesReq;
+
+#define sz_xRenderSetPictureClipRectanglesReq 12
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Picture picture;
+} xRenderFreePictureReq;
+
+#define sz_xRenderFreePictureReq 8
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ CARD8 op;
+ CARD8 pad1;
+ CARD16 pad2;
+ Picture src;
+ Picture mask;
+ Picture dst;
+ INT16 xSrc;
+ INT16 ySrc;
+ INT16 xMask;
+ INT16 yMask;
+ INT16 xDst;
+ INT16 yDst;
+ CARD16 width;
+ CARD16 height;
+} xRenderCompositeReq;
+
+#define sz_xRenderCompositeReq 36
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Picture src;
+ Picture dst;
+ CARD32 colorScale;
+ CARD32 alphaScale;
+ INT16 xSrc;
+ INT16 ySrc;
+ INT16 xDst;
+ INT16 yDst;
+ CARD16 width;
+ CARD16 height;
+} xRenderScaleReq;
+
+#define sz_xRenderScaleReq 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ CARD8 op;
+ CARD8 pad1;
+ CARD16 pad2;
+ Picture src;
+ Picture dst;
+ PictFormat maskFormat;
+ INT16 xSrc;
+ INT16 ySrc;
+} xRenderTrapezoidsReq;
+
+#define sz_xRenderTrapezoidsReq 24
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ CARD8 op;
+ CARD8 pad1;
+ CARD16 pad2;
+ Picture src;
+ Picture dst;
+ PictFormat maskFormat;
+ INT16 xSrc;
+ INT16 ySrc;
+} xRenderTrianglesReq;
+
+#define sz_xRenderTrianglesReq 24
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ CARD8 op;
+ CARD8 pad1;
+ CARD16 pad2;
+ Picture src;
+ Picture dst;
+ PictFormat maskFormat;
+ INT16 xSrc;
+ INT16 ySrc;
+} xRenderTriStripReq;
+
+#define sz_xRenderTriStripReq 24
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ CARD8 op;
+ CARD8 pad1;
+ CARD16 pad2;
+ Picture src;
+ Picture dst;
+ PictFormat maskFormat;
+ INT16 xSrc;
+ INT16 ySrc;
+} xRenderTriFanReq;
+
+#define sz_xRenderTriFanReq 24
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Glyphset gsid;
+ PictFormat format;
+} xRenderCreateGlyphSetReq;
+
+#define sz_xRenderCreateGlyphSetReq 12
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Glyphset gsid;
+ Glyphset existing;
+} xRenderReferenceGlyphSetReq;
+
+#define sz_xRenderReferenceGlyphSetReq 24
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Glyphset glyphset;
+} xRenderFreeGlyphSetReq;
+
+#define sz_xRenderFreeGlyphSetReq 8
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Glyphset glyphset;
+ CARD32 nglyphs;
+} xRenderAddGlyphsReq;
+
+#define sz_xRenderAddGlyphsReq 12
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Glyphset glyphset;
+} xRenderFreeGlyphsReq;
+
+#define sz_xRenderFreeGlyphsReq 8
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ CARD8 op;
+ CARD8 pad1;
+ CARD16 pad2;
+ Picture src;
+ Picture dst;
+ PictFormat maskFormat;
+ Glyphset glyphset;
+ INT16 xSrc;
+ INT16 ySrc;
+} xRenderCompositeGlyphsReq, xRenderCompositeGlyphs8Req,
+xRenderCompositeGlyphs16Req, xRenderCompositeGlyphs32Req;
+
+#define sz_xRenderCompositeGlyphs8Req 28
+#define sz_xRenderCompositeGlyphs16Req 28
+#define sz_xRenderCompositeGlyphs32Req 28
+
+/* 0.1 and higher */
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ CARD8 op;
+ CARD8 pad1;
+ CARD16 pad2;
+ Picture dst;
+ xRenderColor color;
+} xRenderFillRectanglesReq;
+
+#define sz_xRenderFillRectanglesReq 20
+
+/* 0.5 and higher */
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Cursor cid;
+ Picture src;
+ CARD16 x;
+ CARD16 y;
+} xRenderCreateCursorReq;
+
+#define sz_xRenderCreateCursorReq 16
+
+/* 0.6 and higher */
+
+/*
+ * This can't use an array because 32-bit values may be in bitfields
+ */
+typedef struct {
+ Fixed matrix11;
+ Fixed matrix12;
+ Fixed matrix13;
+ Fixed matrix21;
+ Fixed matrix22;
+ Fixed matrix23;
+ Fixed matrix31;
+ Fixed matrix32;
+ Fixed matrix33;
+} xRenderTransform;
+
+#define sz_xRenderTransform 36
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Picture picture;
+ xRenderTransform transform;
+} xRenderSetPictureTransformReq;
+
+#define sz_xRenderSetPictureTransformReq 44
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Drawable drawable;
+} xRenderQueryFiltersReq;
+
+#define sz_xRenderQueryFiltersReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BYTE pad1;
+ CARD16 sequenceNumber;
+ CARD32 length;
+ CARD32 numAliases; /* LISTofCARD16 */
+ CARD32 numFilters; /* LISTofSTRING8 */
+ CARD32 pad2;
+ CARD32 pad3;
+ CARD32 pad4;
+ CARD32 pad5;
+} xRenderQueryFiltersReply;
+
+#define sz_xRenderQueryFiltersReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Picture picture;
+ CARD16 nbytes; /* number of bytes in name */
+ CARD16 pad;
+} xRenderSetPictureFilterReq;
+
+#define sz_xRenderSetPictureFilterReq 12
+
+/* 0.8 and higher */
+
+typedef struct {
+ Cursor cursor;
+ CARD32 delay;
+} xAnimCursorElt;
+
+#define sz_xAnimCursorElt 8
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Cursor cid;
+} xRenderCreateAnimCursorReq;
+
+#define sz_xRenderCreateAnimCursorReq 8
+
+/* 0.9 and higher */
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Picture picture;
+ INT16 xOff;
+ INT16 yOff;
+} xRenderAddTrapsReq;
+
+#define sz_xRenderAddTrapsReq 12
+
+/* 0.10 and higher */
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Picture pid;
+ xRenderColor color;
+} xRenderCreateSolidFillReq;
+
+#define sz_xRenderCreateSolidFillReq 16
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Picture pid;
+ xPointFixed p1;
+ xPointFixed p2;
+ CARD32 nStops;
+} xRenderCreateLinearGradientReq;
+
+#define sz_xRenderCreateLinearGradientReq 28
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Picture pid;
+ xPointFixed inner;
+ xPointFixed outer;
+ Fixed inner_radius;
+ Fixed outer_radius;
+ CARD32 nStops;
+} xRenderCreateRadialGradientReq;
+
+#define sz_xRenderCreateRadialGradientReq 36
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 renderReqType;
+ CARD16 length;
+ Picture pid;
+ xPointFixed center;
+ Fixed angle; /* in degrees */
+ CARD32 nStops;
+} xRenderCreateConicalGradientReq;
+
+#define sz_xRenderCreateConicalGradientReq 24
+
+#undef Window
+#undef Drawable
+#undef Font
+#undef Pixmap
+#undef Cursor
+#undef Colormap
+#undef GContext
+#undef Atom
+#undef VisualID
+#undef Time
+#undef KeyCode
+#undef KeySym
+
+#undef Picture
+#undef PictFormat
+#undef Fixed
+#undef Glyphset
+
+#endif /* _XRENDERP_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/shape.h b/thirdparty/linuxbsd_headers/X11/extensions/shape.h
new file mode 100644
index 0000000000..66af5b1b44
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/shape.h
@@ -0,0 +1,152 @@
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+#ifndef _SHAPE_H_
+#define _SHAPE_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/shapeconst.h>
+
+#ifndef _SHAPE_SERVER_
+#include <X11/Xutil.h>
+
+typedef struct {
+ int type; /* of event */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came frome a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* window of event */
+ int kind; /* ShapeBounding or ShapeClip */
+ int x, y; /* extents of new region */
+ unsigned width, height;
+ Time time; /* server timestamp when region changed */
+ Bool shaped; /* true if the region exists */
+} XShapeEvent;
+
+_XFUNCPROTOBEGIN
+
+extern Bool XShapeQueryExtension (
+ Display* /* display */,
+ int* /* event_base */,
+ int* /* error_base */
+);
+
+extern Status XShapeQueryVersion (
+ Display* /* display */,
+ int* /* major_version */,
+ int* /* minor_version */
+);
+
+extern void XShapeCombineRegion (
+ Display* /* display */,
+ Window /* dest */,
+ int /* dest_kind */,
+ int /* x_off */,
+ int /* y_off */,
+ Region /* region */,
+ int /* op */
+);
+
+extern void XShapeCombineRectangles (
+ Display* /* display */,
+ Window /* dest */,
+ int /* dest_kind */,
+ int /* x_off */,
+ int /* y_off */,
+ XRectangle* /* rectangles */,
+ int /* n_rects */,
+ int /* op */,
+ int /* ordering */
+);
+
+extern void XShapeCombineMask (
+ Display* /* display */,
+ Window /* dest */,
+ int /* dest_kind */,
+ int /* x_off */,
+ int /* y_off */,
+ Pixmap /* src */,
+ int /* op */
+);
+
+extern void XShapeCombineShape (
+ Display* /* display */,
+ Window /* dest */,
+ int /* dest_kind */,
+ int /* x_off */,
+ int /* y_off */,
+ Window /* src */,
+ int /* src_kind */,
+ int /* op */
+);
+
+extern void XShapeOffsetShape (
+ Display* /* display */,
+ Window /* dest */,
+ int /* dest_kind */,
+ int /* x_off */,
+ int /* y_off */
+);
+
+extern Status XShapeQueryExtents (
+ Display* /* display */,
+ Window /* window */,
+ Bool* /* bounding_shaped */,
+ int* /* x_bounding */,
+ int* /* y_bounding */,
+ unsigned int* /* w_bounding */,
+ unsigned int* /* h_bounding */,
+ Bool* /* clip_shaped */,
+ int* /* x_clip */,
+ int* /* y_clip */,
+ unsigned int* /* w_clip */,
+ unsigned int* /* h_clip */
+);
+
+extern void XShapeSelectInput (
+ Display* /* display */,
+ Window /* window */,
+ unsigned long /* mask */
+);
+
+extern unsigned long XShapeInputSelected (
+ Display* /* display */,
+ Window /* window */
+);
+
+extern XRectangle *XShapeGetRectangles (
+ Display* /* display */,
+ Window /* window */,
+ int /* kind */,
+ int* /* count */,
+ int* /* ordering */
+);
+
+_XFUNCPROTOEND
+
+#endif /* !_SHAPE_SERVER_ */
+
+#endif /* _SHAPE_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/shapeconst.h b/thirdparty/linuxbsd_headers/X11/extensions/shapeconst.h
new file mode 100644
index 0000000000..9088956f1b
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/shapeconst.h
@@ -0,0 +1,55 @@
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+#ifndef _SHAPECONST_H_
+#define _SHAPECONST_H_
+
+/*
+ * Protocol requests constants and alignment values
+ * These would really be in SHAPE's X.h and Xproto.h equivalents
+ */
+
+#define SHAPENAME "SHAPE"
+
+#define SHAPE_MAJOR_VERSION 1 /* current version numbers */
+#define SHAPE_MINOR_VERSION 1
+
+#define ShapeSet 0
+#define ShapeUnion 1
+#define ShapeIntersect 2
+#define ShapeSubtract 3
+#define ShapeInvert 4
+
+#define ShapeBounding 0
+#define ShapeClip 1
+#define ShapeInput 2
+
+#define ShapeNotifyMask (1L << 0)
+#define ShapeNotify 0
+
+#define ShapeNumberEvents (ShapeNotify + 1)
+
+#endif /* _SHAPECONST_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/extensions/xfixeswire.h b/thirdparty/linuxbsd_headers/X11/extensions/xfixeswire.h
new file mode 100644
index 0000000000..f6953e5c6d
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/extensions/xfixeswire.h
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2010 Red Hat, Inc.
+ *
+ * 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 (including the next
+ * paragraph) 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.
+ */
+/*
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#ifndef _XFIXESWIRE_H_
+#define _XFIXESWIRE_H_
+
+#define XFIXES_NAME "XFIXES"
+#define XFIXES_MAJOR 6
+#define XFIXES_MINOR 0
+
+/*************** Version 1 ******************/
+#define X_XFixesQueryVersion 0
+#define X_XFixesChangeSaveSet 1
+#define X_XFixesSelectSelectionInput 2
+#define X_XFixesSelectCursorInput 3
+#define X_XFixesGetCursorImage 4
+/*************** Version 2 ******************/
+#define X_XFixesCreateRegion 5
+#define X_XFixesCreateRegionFromBitmap 6
+#define X_XFixesCreateRegionFromWindow 7
+#define X_XFixesCreateRegionFromGC 8
+#define X_XFixesCreateRegionFromPicture 9
+#define X_XFixesDestroyRegion 10
+#define X_XFixesSetRegion 11
+#define X_XFixesCopyRegion 12
+#define X_XFixesUnionRegion 13
+#define X_XFixesIntersectRegion 14
+#define X_XFixesSubtractRegion 15
+#define X_XFixesInvertRegion 16
+#define X_XFixesTranslateRegion 17
+#define X_XFixesRegionExtents 18
+#define X_XFixesFetchRegion 19
+#define X_XFixesSetGCClipRegion 20
+#define X_XFixesSetWindowShapeRegion 21
+#define X_XFixesSetPictureClipRegion 22
+#define X_XFixesSetCursorName 23
+#define X_XFixesGetCursorName 24
+#define X_XFixesGetCursorImageAndName 25
+#define X_XFixesChangeCursor 26
+#define X_XFixesChangeCursorByName 27
+/*************** Version 3 ******************/
+#define X_XFixesExpandRegion 28
+/*************** Version 4 ******************/
+#define X_XFixesHideCursor 29
+#define X_XFixesShowCursor 30
+/*************** Version 5 ******************/
+#define X_XFixesCreatePointerBarrier 31
+#define X_XFixesDestroyPointerBarrier 32
+/*************** Version 6 ******************/
+#define X_XFixesSetClientDisconnectMode 33
+#define X_XFixesGetClientDisconnectMode 34
+
+#define XFixesNumberRequests (X_XFixesGetClientDisconnectMode+1)
+
+/* Selection events share one event number */
+#define XFixesSelectionNotify 0
+
+/* Within the selection, the 'subtype' field distinguishes */
+#define XFixesSetSelectionOwnerNotify 0
+#define XFixesSelectionWindowDestroyNotify 1
+#define XFixesSelectionClientCloseNotify 2
+
+#define XFixesSetSelectionOwnerNotifyMask (1L << 0)
+#define XFixesSelectionWindowDestroyNotifyMask (1L << 1)
+#define XFixesSelectionClientCloseNotifyMask (1L << 2)
+
+/* There's only one cursor event so far */
+#define XFixesCursorNotify 1
+
+#define XFixesDisplayCursorNotify 0
+
+#define XFixesDisplayCursorNotifyMask (1L << 0)
+
+#define XFixesNumberEvents (2)
+
+/* errors */
+#define BadRegion 0
+#define BadBarrier 1
+#define XFixesNumberErrors (BadBarrier+1)
+
+#define SaveSetNearest 0
+#define SaveSetRoot 1
+
+#define SaveSetMap 0
+#define SaveSetUnmap 1
+
+/*************** Version 2 ******************/
+
+#define WindowRegionBounding 0
+#define WindowRegionClip 1
+
+/*************** Version 5 ******************/
+
+#define BarrierPositiveX (1L << 0)
+#define BarrierPositiveY (1L << 1)
+#define BarrierNegativeX (1L << 2)
+#define BarrierNegativeY (1L << 3)
+
+/*************** Version 6 ******************/
+
+/* The default server behaviour */
+#define XFixesClientDisconnectFlagDefault 0
+/* The server may disconnect this client to shut down */
+#define XFixesClientDisconnectFlagTerminate (1L << 0)
+
+#endif /* _XFIXESWIRE_H_ */
diff --git a/thirdparty/linuxbsd_headers/X11/keysym.h b/thirdparty/linuxbsd_headers/X11/keysym.h
new file mode 100644
index 0000000000..0ffdde4a5a
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/keysym.h
@@ -0,0 +1,74 @@
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* default keysyms */
+#define XK_MISCELLANY
+#define XK_XKB_KEYS
+#define XK_LATIN1
+#define XK_LATIN2
+#define XK_LATIN3
+#define XK_LATIN4
+#define XK_LATIN8
+#define XK_LATIN9
+#define XK_CAUCASUS
+#define XK_GREEK
+#define XK_KATAKANA
+#define XK_ARABIC
+#define XK_CYRILLIC
+#define XK_HEBREW
+#define XK_THAI
+#define XK_KOREAN
+#define XK_ARMENIAN
+#define XK_GEORGIAN
+#define XK_VIETNAMESE
+#define XK_CURRENCY
+#define XK_MATHEMATICAL
+#define XK_BRAILLE
+#define XK_SINHALA
+
+#include <X11/keysymdef.h>
+
diff --git a/thirdparty/linuxbsd_headers/X11/keysymdef.h b/thirdparty/linuxbsd_headers/X11/keysymdef.h
new file mode 100644
index 0000000000..35cf5439e3
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/X11/keysymdef.h
@@ -0,0 +1,2502 @@
+/***********************************************************
+Copyright 1987, 1994, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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 OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * The "X11 Window System Protocol" standard defines in Appendix A the
+ * keysym codes. These 29-bit integer values identify characters or
+ * functions associated with each key (e.g., via the visible
+ * engraving) of a keyboard layout. This file assigns mnemonic macro
+ * names for these keysyms.
+ *
+ * This file is also compiled (by src/util/makekeys.c in libX11) into
+ * hash tables that can be accessed with X11 library functions such as
+ * XStringToKeysym() and XKeysymToString().
+ *
+ * Where a keysym corresponds one-to-one to an ISO 10646 / Unicode
+ * character, this is noted in a comment that provides both the U+xxxx
+ * Unicode position, as well as the official Unicode name of the
+ * character.
+ *
+ * Where the correspondence is either not one-to-one or semantically
+ * unclear, the Unicode position and name are enclosed in
+ * parentheses. Such legacy keysyms should be considered deprecated
+ * and are not recommended for use in future keyboard mappings.
+ *
+ * For any future extension of the keysyms with characters already
+ * found in ISO 10646 / Unicode, the following algorithm shall be
+ * used. The new keysym code position will simply be the character's
+ * Unicode number plus 0x01000000. The keysym values in the range
+ * 0x01000100 to 0x0110ffff are reserved to represent Unicode
+ * characters in the range U+0100 to U+10FFFF.
+ *
+ * While most newer Unicode-based X11 clients do already accept
+ * Unicode-mapped keysyms in the range 0x01000100 to 0x0110ffff, it
+ * will remain necessary for clients -- in the interest of
+ * compatibility with existing servers -- to also understand the
+ * existing legacy keysym values in the range 0x0100 to 0x20ff.
+ *
+ * Where several mnemonic names are defined for the same keysym in this
+ * file, all but the first one listed should be considered deprecated.
+ *
+ * Mnemonic names for keysyms are defined in this file with lines
+ * that match one of these Perl regular expressions:
+ *
+ * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\* U\+([0-9A-F]{4,6}) (.*) \*\/\s*$/
+ * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\*\(U\+([0-9A-F]{4,6}) (.*)\)\*\/\s*$/
+ * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*(\/\*\s*(.*)\s*\*\/)?\s*$/
+ *
+ * Before adding new keysyms, please do consider the following: In
+ * addition to the keysym names defined in this file, the
+ * XStringToKeysym() and XKeysymToString() functions will also handle
+ * any keysym string of the form "U0020" to "U007E" and "U00A0" to
+ * "U10FFFF" for all possible Unicode characters. In other words,
+ * every possible Unicode character has already a keysym string
+ * defined algorithmically, even if it is not listed here. Therefore,
+ * defining an additional keysym macro is only necessary where a
+ * non-hexadecimal mnemonic name is needed, or where the new keysym
+ * does not represent any existing Unicode character.
+ *
+ * When adding new keysyms to this file, do not forget to also update the
+ * following as needed:
+ *
+ * - the mappings in src/KeyBind.c in the libX11 repo
+ * https://gitlab.freedesktop.org/xorg/lib/libx11
+ *
+ * - the protocol specification in specs/keysyms.xml in this repo
+ * https://gitlab.freedesktop.org/xorg/proto/xorgproto
+ *
+ */
+
+#define XK_VoidSymbol 0xffffff /* Void symbol */
+
+#ifdef XK_MISCELLANY
+/*
+ * TTY function keys, cleverly chosen to map to ASCII, for convenience of
+ * programming, but could have been arbitrary (at the cost of lookup
+ * tables in client code).
+ */
+
+#define XK_BackSpace 0xff08 /* Back space, back char */
+#define XK_Tab 0xff09
+#define XK_Linefeed 0xff0a /* Linefeed, LF */
+#define XK_Clear 0xff0b
+#define XK_Return 0xff0d /* Return, enter */
+#define XK_Pause 0xff13 /* Pause, hold */
+#define XK_Scroll_Lock 0xff14
+#define XK_Sys_Req 0xff15
+#define XK_Escape 0xff1b
+#define XK_Delete 0xffff /* Delete, rubout */
+
+
+
+/* International & multi-key character composition */
+
+#define XK_Multi_key 0xff20 /* Multi-key character compose */
+#define XK_Codeinput 0xff37
+#define XK_SingleCandidate 0xff3c
+#define XK_MultipleCandidate 0xff3d
+#define XK_PreviousCandidate 0xff3e
+
+/* Japanese keyboard support */
+
+#define XK_Kanji 0xff21 /* Kanji, Kanji convert */
+#define XK_Muhenkan 0xff22 /* Cancel Conversion */
+#define XK_Henkan_Mode 0xff23 /* Start/Stop Conversion */
+#define XK_Henkan 0xff23 /* Alias for Henkan_Mode */
+#define XK_Romaji 0xff24 /* to Romaji */
+#define XK_Hiragana 0xff25 /* to Hiragana */
+#define XK_Katakana 0xff26 /* to Katakana */
+#define XK_Hiragana_Katakana 0xff27 /* Hiragana/Katakana toggle */
+#define XK_Zenkaku 0xff28 /* to Zenkaku */
+#define XK_Hankaku 0xff29 /* to Hankaku */
+#define XK_Zenkaku_Hankaku 0xff2a /* Zenkaku/Hankaku toggle */
+#define XK_Touroku 0xff2b /* Add to Dictionary */
+#define XK_Massyo 0xff2c /* Delete from Dictionary */
+#define XK_Kana_Lock 0xff2d /* Kana Lock */
+#define XK_Kana_Shift 0xff2e /* Kana Shift */
+#define XK_Eisu_Shift 0xff2f /* Alphanumeric Shift */
+#define XK_Eisu_toggle 0xff30 /* Alphanumeric toggle */
+#define XK_Kanji_Bangou 0xff37 /* Codeinput */
+#define XK_Zen_Koho 0xff3d /* Multiple/All Candidate(s) */
+#define XK_Mae_Koho 0xff3e /* Previous Candidate */
+
+/* 0xff31 thru 0xff3f are under XK_KOREAN */
+
+/* Cursor control & motion */
+
+#define XK_Home 0xff50
+#define XK_Left 0xff51 /* Move left, left arrow */
+#define XK_Up 0xff52 /* Move up, up arrow */
+#define XK_Right 0xff53 /* Move right, right arrow */
+#define XK_Down 0xff54 /* Move down, down arrow */
+#define XK_Prior 0xff55 /* Prior, previous */
+#define XK_Page_Up 0xff55
+#define XK_Next 0xff56 /* Next */
+#define XK_Page_Down 0xff56
+#define XK_End 0xff57 /* EOL */
+#define XK_Begin 0xff58 /* BOL */
+
+
+/* Misc functions */
+
+#define XK_Select 0xff60 /* Select, mark */
+#define XK_Print 0xff61
+#define XK_Execute 0xff62 /* Execute, run, do */
+#define XK_Insert 0xff63 /* Insert, insert here */
+#define XK_Undo 0xff65
+#define XK_Redo 0xff66 /* Redo, again */
+#define XK_Menu 0xff67
+#define XK_Find 0xff68 /* Find, search */
+#define XK_Cancel 0xff69 /* Cancel, stop, abort, exit */
+#define XK_Help 0xff6a /* Help */
+#define XK_Break 0xff6b
+#define XK_Mode_switch 0xff7e /* Character set switch */
+#define XK_script_switch 0xff7e /* Alias for mode_switch */
+#define XK_Num_Lock 0xff7f
+
+/* Keypad functions, keypad numbers cleverly chosen to map to ASCII */
+
+#define XK_KP_Space 0xff80 /* Space */
+#define XK_KP_Tab 0xff89
+#define XK_KP_Enter 0xff8d /* Enter */
+#define XK_KP_F1 0xff91 /* PF1, KP_A, ... */
+#define XK_KP_F2 0xff92
+#define XK_KP_F3 0xff93
+#define XK_KP_F4 0xff94
+#define XK_KP_Home 0xff95
+#define XK_KP_Left 0xff96
+#define XK_KP_Up 0xff97
+#define XK_KP_Right 0xff98
+#define XK_KP_Down 0xff99
+#define XK_KP_Prior 0xff9a
+#define XK_KP_Page_Up 0xff9a
+#define XK_KP_Next 0xff9b
+#define XK_KP_Page_Down 0xff9b
+#define XK_KP_End 0xff9c
+#define XK_KP_Begin 0xff9d
+#define XK_KP_Insert 0xff9e
+#define XK_KP_Delete 0xff9f
+#define XK_KP_Equal 0xffbd /* Equals */
+#define XK_KP_Multiply 0xffaa
+#define XK_KP_Add 0xffab
+#define XK_KP_Separator 0xffac /* Separator, often comma */
+#define XK_KP_Subtract 0xffad
+#define XK_KP_Decimal 0xffae
+#define XK_KP_Divide 0xffaf
+
+#define XK_KP_0 0xffb0
+#define XK_KP_1 0xffb1
+#define XK_KP_2 0xffb2
+#define XK_KP_3 0xffb3
+#define XK_KP_4 0xffb4
+#define XK_KP_5 0xffb5
+#define XK_KP_6 0xffb6
+#define XK_KP_7 0xffb7
+#define XK_KP_8 0xffb8
+#define XK_KP_9 0xffb9
+
+
+
+/*
+ * Auxiliary functions; note the duplicate definitions for left and right
+ * function keys; Sun keyboards and a few other manufacturers have such
+ * function key groups on the left and/or right sides of the keyboard.
+ * We've not found a keyboard with more than 35 function keys total.
+ */
+
+#define XK_F1 0xffbe
+#define XK_F2 0xffbf
+#define XK_F3 0xffc0
+#define XK_F4 0xffc1
+#define XK_F5 0xffc2
+#define XK_F6 0xffc3
+#define XK_F7 0xffc4
+#define XK_F8 0xffc5
+#define XK_F9 0xffc6
+#define XK_F10 0xffc7
+#define XK_F11 0xffc8
+#define XK_L1 0xffc8
+#define XK_F12 0xffc9
+#define XK_L2 0xffc9
+#define XK_F13 0xffca
+#define XK_L3 0xffca
+#define XK_F14 0xffcb
+#define XK_L4 0xffcb
+#define XK_F15 0xffcc
+#define XK_L5 0xffcc
+#define XK_F16 0xffcd
+#define XK_L6 0xffcd
+#define XK_F17 0xffce
+#define XK_L7 0xffce
+#define XK_F18 0xffcf
+#define XK_L8 0xffcf
+#define XK_F19 0xffd0
+#define XK_L9 0xffd0
+#define XK_F20 0xffd1
+#define XK_L10 0xffd1
+#define XK_F21 0xffd2
+#define XK_R1 0xffd2
+#define XK_F22 0xffd3
+#define XK_R2 0xffd3
+#define XK_F23 0xffd4
+#define XK_R3 0xffd4
+#define XK_F24 0xffd5
+#define XK_R4 0xffd5
+#define XK_F25 0xffd6
+#define XK_R5 0xffd6
+#define XK_F26 0xffd7
+#define XK_R6 0xffd7
+#define XK_F27 0xffd8
+#define XK_R7 0xffd8
+#define XK_F28 0xffd9
+#define XK_R8 0xffd9
+#define XK_F29 0xffda
+#define XK_R9 0xffda
+#define XK_F30 0xffdb
+#define XK_R10 0xffdb
+#define XK_F31 0xffdc
+#define XK_R11 0xffdc
+#define XK_F32 0xffdd
+#define XK_R12 0xffdd
+#define XK_F33 0xffde
+#define XK_R13 0xffde
+#define XK_F34 0xffdf
+#define XK_R14 0xffdf
+#define XK_F35 0xffe0
+#define XK_R15 0xffe0
+
+/* Modifiers */
+
+#define XK_Shift_L 0xffe1 /* Left shift */
+#define XK_Shift_R 0xffe2 /* Right shift */
+#define XK_Control_L 0xffe3 /* Left control */
+#define XK_Control_R 0xffe4 /* Right control */
+#define XK_Caps_Lock 0xffe5 /* Caps lock */
+#define XK_Shift_Lock 0xffe6 /* Shift lock */
+
+#define XK_Meta_L 0xffe7 /* Left meta */
+#define XK_Meta_R 0xffe8 /* Right meta */
+#define XK_Alt_L 0xffe9 /* Left alt */
+#define XK_Alt_R 0xffea /* Right alt */
+#define XK_Super_L 0xffeb /* Left super */
+#define XK_Super_R 0xffec /* Right super */
+#define XK_Hyper_L 0xffed /* Left hyper */
+#define XK_Hyper_R 0xffee /* Right hyper */
+#endif /* XK_MISCELLANY */
+
+/*
+ * Keyboard (XKB) Extension function and modifier keys
+ * (from Appendix C of "The X Keyboard Extension: Protocol Specification")
+ * Byte 3 = 0xfe
+ */
+
+#ifdef XK_XKB_KEYS
+#define XK_ISO_Lock 0xfe01
+#define XK_ISO_Level2_Latch 0xfe02
+#define XK_ISO_Level3_Shift 0xfe03
+#define XK_ISO_Level3_Latch 0xfe04
+#define XK_ISO_Level3_Lock 0xfe05
+#define XK_ISO_Level5_Shift 0xfe11
+#define XK_ISO_Level5_Latch 0xfe12
+#define XK_ISO_Level5_Lock 0xfe13
+#define XK_ISO_Group_Shift 0xff7e /* Alias for mode_switch */
+#define XK_ISO_Group_Latch 0xfe06
+#define XK_ISO_Group_Lock 0xfe07
+#define XK_ISO_Next_Group 0xfe08
+#define XK_ISO_Next_Group_Lock 0xfe09
+#define XK_ISO_Prev_Group 0xfe0a
+#define XK_ISO_Prev_Group_Lock 0xfe0b
+#define XK_ISO_First_Group 0xfe0c
+#define XK_ISO_First_Group_Lock 0xfe0d
+#define XK_ISO_Last_Group 0xfe0e
+#define XK_ISO_Last_Group_Lock 0xfe0f
+
+#define XK_ISO_Left_Tab 0xfe20
+#define XK_ISO_Move_Line_Up 0xfe21
+#define XK_ISO_Move_Line_Down 0xfe22
+#define XK_ISO_Partial_Line_Up 0xfe23
+#define XK_ISO_Partial_Line_Down 0xfe24
+#define XK_ISO_Partial_Space_Left 0xfe25
+#define XK_ISO_Partial_Space_Right 0xfe26
+#define XK_ISO_Set_Margin_Left 0xfe27
+#define XK_ISO_Set_Margin_Right 0xfe28
+#define XK_ISO_Release_Margin_Left 0xfe29
+#define XK_ISO_Release_Margin_Right 0xfe2a
+#define XK_ISO_Release_Both_Margins 0xfe2b
+#define XK_ISO_Fast_Cursor_Left 0xfe2c
+#define XK_ISO_Fast_Cursor_Right 0xfe2d
+#define XK_ISO_Fast_Cursor_Up 0xfe2e
+#define XK_ISO_Fast_Cursor_Down 0xfe2f
+#define XK_ISO_Continuous_Underline 0xfe30
+#define XK_ISO_Discontinuous_Underline 0xfe31
+#define XK_ISO_Emphasize 0xfe32
+#define XK_ISO_Center_Object 0xfe33
+#define XK_ISO_Enter 0xfe34
+
+#define XK_dead_grave 0xfe50
+#define XK_dead_acute 0xfe51
+#define XK_dead_circumflex 0xfe52
+#define XK_dead_tilde 0xfe53
+#define XK_dead_perispomeni 0xfe53 /* alias for dead_tilde */
+#define XK_dead_macron 0xfe54
+#define XK_dead_breve 0xfe55
+#define XK_dead_abovedot 0xfe56
+#define XK_dead_diaeresis 0xfe57
+#define XK_dead_abovering 0xfe58
+#define XK_dead_doubleacute 0xfe59
+#define XK_dead_caron 0xfe5a
+#define XK_dead_cedilla 0xfe5b
+#define XK_dead_ogonek 0xfe5c
+#define XK_dead_iota 0xfe5d
+#define XK_dead_voiced_sound 0xfe5e
+#define XK_dead_semivoiced_sound 0xfe5f
+#define XK_dead_belowdot 0xfe60
+#define XK_dead_hook 0xfe61
+#define XK_dead_horn 0xfe62
+#define XK_dead_stroke 0xfe63
+#define XK_dead_abovecomma 0xfe64
+#define XK_dead_psili 0xfe64 /* alias for dead_abovecomma */
+#define XK_dead_abovereversedcomma 0xfe65
+#define XK_dead_dasia 0xfe65 /* alias for dead_abovereversedcomma */
+#define XK_dead_doublegrave 0xfe66
+#define XK_dead_belowring 0xfe67
+#define XK_dead_belowmacron 0xfe68
+#define XK_dead_belowcircumflex 0xfe69
+#define XK_dead_belowtilde 0xfe6a
+#define XK_dead_belowbreve 0xfe6b
+#define XK_dead_belowdiaeresis 0xfe6c
+#define XK_dead_invertedbreve 0xfe6d
+#define XK_dead_belowcomma 0xfe6e
+#define XK_dead_currency 0xfe6f
+
+/* extra dead elements for German T3 layout */
+#define XK_dead_lowline 0xfe90
+#define XK_dead_aboveverticalline 0xfe91
+#define XK_dead_belowverticalline 0xfe92
+#define XK_dead_longsolidusoverlay 0xfe93
+
+/* dead vowels for universal syllable entry */
+#define XK_dead_a 0xfe80
+#define XK_dead_A 0xfe81
+#define XK_dead_e 0xfe82
+#define XK_dead_E 0xfe83
+#define XK_dead_i 0xfe84
+#define XK_dead_I 0xfe85
+#define XK_dead_o 0xfe86
+#define XK_dead_O 0xfe87
+#define XK_dead_u 0xfe88
+#define XK_dead_U 0xfe89
+#define XK_dead_small_schwa 0xfe8a
+#define XK_dead_capital_schwa 0xfe8b
+
+#define XK_dead_greek 0xfe8c
+
+#define XK_First_Virtual_Screen 0xfed0
+#define XK_Prev_Virtual_Screen 0xfed1
+#define XK_Next_Virtual_Screen 0xfed2
+#define XK_Last_Virtual_Screen 0xfed4
+#define XK_Terminate_Server 0xfed5
+
+#define XK_AccessX_Enable 0xfe70
+#define XK_AccessX_Feedback_Enable 0xfe71
+#define XK_RepeatKeys_Enable 0xfe72
+#define XK_SlowKeys_Enable 0xfe73
+#define XK_BounceKeys_Enable 0xfe74
+#define XK_StickyKeys_Enable 0xfe75
+#define XK_MouseKeys_Enable 0xfe76
+#define XK_MouseKeys_Accel_Enable 0xfe77
+#define XK_Overlay1_Enable 0xfe78
+#define XK_Overlay2_Enable 0xfe79
+#define XK_AudibleBell_Enable 0xfe7a
+
+#define XK_Pointer_Left 0xfee0
+#define XK_Pointer_Right 0xfee1
+#define XK_Pointer_Up 0xfee2
+#define XK_Pointer_Down 0xfee3
+#define XK_Pointer_UpLeft 0xfee4
+#define XK_Pointer_UpRight 0xfee5
+#define XK_Pointer_DownLeft 0xfee6
+#define XK_Pointer_DownRight 0xfee7
+#define XK_Pointer_Button_Dflt 0xfee8
+#define XK_Pointer_Button1 0xfee9
+#define XK_Pointer_Button2 0xfeea
+#define XK_Pointer_Button3 0xfeeb
+#define XK_Pointer_Button4 0xfeec
+#define XK_Pointer_Button5 0xfeed
+#define XK_Pointer_DblClick_Dflt 0xfeee
+#define XK_Pointer_DblClick1 0xfeef
+#define XK_Pointer_DblClick2 0xfef0
+#define XK_Pointer_DblClick3 0xfef1
+#define XK_Pointer_DblClick4 0xfef2
+#define XK_Pointer_DblClick5 0xfef3
+#define XK_Pointer_Drag_Dflt 0xfef4
+#define XK_Pointer_Drag1 0xfef5
+#define XK_Pointer_Drag2 0xfef6
+#define XK_Pointer_Drag3 0xfef7
+#define XK_Pointer_Drag4 0xfef8
+#define XK_Pointer_Drag5 0xfefd
+
+#define XK_Pointer_EnableKeys 0xfef9
+#define XK_Pointer_Accelerate 0xfefa
+#define XK_Pointer_DfltBtnNext 0xfefb
+#define XK_Pointer_DfltBtnPrev 0xfefc
+
+/* Single-Stroke Multiple-Character N-Graph Keysyms For The X Input Method */
+
+#define XK_ch 0xfea0
+#define XK_Ch 0xfea1
+#define XK_CH 0xfea2
+#define XK_c_h 0xfea3
+#define XK_C_h 0xfea4
+#define XK_C_H 0xfea5
+
+#endif /* XK_XKB_KEYS */
+
+/*
+ * 3270 Terminal Keys
+ * Byte 3 = 0xfd
+ */
+
+#ifdef XK_3270
+#define XK_3270_Duplicate 0xfd01
+#define XK_3270_FieldMark 0xfd02
+#define XK_3270_Right2 0xfd03
+#define XK_3270_Left2 0xfd04
+#define XK_3270_BackTab 0xfd05
+#define XK_3270_EraseEOF 0xfd06
+#define XK_3270_EraseInput 0xfd07
+#define XK_3270_Reset 0xfd08
+#define XK_3270_Quit 0xfd09
+#define XK_3270_PA1 0xfd0a
+#define XK_3270_PA2 0xfd0b
+#define XK_3270_PA3 0xfd0c
+#define XK_3270_Test 0xfd0d
+#define XK_3270_Attn 0xfd0e
+#define XK_3270_CursorBlink 0xfd0f
+#define XK_3270_AltCursor 0xfd10
+#define XK_3270_KeyClick 0xfd11
+#define XK_3270_Jump 0xfd12
+#define XK_3270_Ident 0xfd13
+#define XK_3270_Rule 0xfd14
+#define XK_3270_Copy 0xfd15
+#define XK_3270_Play 0xfd16
+#define XK_3270_Setup 0xfd17
+#define XK_3270_Record 0xfd18
+#define XK_3270_ChangeScreen 0xfd19
+#define XK_3270_DeleteWord 0xfd1a
+#define XK_3270_ExSelect 0xfd1b
+#define XK_3270_CursorSelect 0xfd1c
+#define XK_3270_PrintScreen 0xfd1d
+#define XK_3270_Enter 0xfd1e
+#endif /* XK_3270 */
+
+/*
+ * Latin 1
+ * (ISO/IEC 8859-1 = Unicode U+0020..U+00FF)
+ * Byte 3 = 0
+ */
+#ifdef XK_LATIN1
+#define XK_space 0x0020 /* U+0020 SPACE */
+#define XK_exclam 0x0021 /* U+0021 EXCLAMATION MARK */
+#define XK_quotedbl 0x0022 /* U+0022 QUOTATION MARK */
+#define XK_numbersign 0x0023 /* U+0023 NUMBER SIGN */
+#define XK_dollar 0x0024 /* U+0024 DOLLAR SIGN */
+#define XK_percent 0x0025 /* U+0025 PERCENT SIGN */
+#define XK_ampersand 0x0026 /* U+0026 AMPERSAND */
+#define XK_apostrophe 0x0027 /* U+0027 APOSTROPHE */
+#define XK_quoteright 0x0027 /* deprecated */
+#define XK_parenleft 0x0028 /* U+0028 LEFT PARENTHESIS */
+#define XK_parenright 0x0029 /* U+0029 RIGHT PARENTHESIS */
+#define XK_asterisk 0x002a /* U+002A ASTERISK */
+#define XK_plus 0x002b /* U+002B PLUS SIGN */
+#define XK_comma 0x002c /* U+002C COMMA */
+#define XK_minus 0x002d /* U+002D HYPHEN-MINUS */
+#define XK_period 0x002e /* U+002E FULL STOP */
+#define XK_slash 0x002f /* U+002F SOLIDUS */
+#define XK_0 0x0030 /* U+0030 DIGIT ZERO */
+#define XK_1 0x0031 /* U+0031 DIGIT ONE */
+#define XK_2 0x0032 /* U+0032 DIGIT TWO */
+#define XK_3 0x0033 /* U+0033 DIGIT THREE */
+#define XK_4 0x0034 /* U+0034 DIGIT FOUR */
+#define XK_5 0x0035 /* U+0035 DIGIT FIVE */
+#define XK_6 0x0036 /* U+0036 DIGIT SIX */
+#define XK_7 0x0037 /* U+0037 DIGIT SEVEN */
+#define XK_8 0x0038 /* U+0038 DIGIT EIGHT */
+#define XK_9 0x0039 /* U+0039 DIGIT NINE */
+#define XK_colon 0x003a /* U+003A COLON */
+#define XK_semicolon 0x003b /* U+003B SEMICOLON */
+#define XK_less 0x003c /* U+003C LESS-THAN SIGN */
+#define XK_equal 0x003d /* U+003D EQUALS SIGN */
+#define XK_greater 0x003e /* U+003E GREATER-THAN SIGN */
+#define XK_question 0x003f /* U+003F QUESTION MARK */
+#define XK_at 0x0040 /* U+0040 COMMERCIAL AT */
+#define XK_A 0x0041 /* U+0041 LATIN CAPITAL LETTER A */
+#define XK_B 0x0042 /* U+0042 LATIN CAPITAL LETTER B */
+#define XK_C 0x0043 /* U+0043 LATIN CAPITAL LETTER C */
+#define XK_D 0x0044 /* U+0044 LATIN CAPITAL LETTER D */
+#define XK_E 0x0045 /* U+0045 LATIN CAPITAL LETTER E */
+#define XK_F 0x0046 /* U+0046 LATIN CAPITAL LETTER F */
+#define XK_G 0x0047 /* U+0047 LATIN CAPITAL LETTER G */
+#define XK_H 0x0048 /* U+0048 LATIN CAPITAL LETTER H */
+#define XK_I 0x0049 /* U+0049 LATIN CAPITAL LETTER I */
+#define XK_J 0x004a /* U+004A LATIN CAPITAL LETTER J */
+#define XK_K 0x004b /* U+004B LATIN CAPITAL LETTER K */
+#define XK_L 0x004c /* U+004C LATIN CAPITAL LETTER L */
+#define XK_M 0x004d /* U+004D LATIN CAPITAL LETTER M */
+#define XK_N 0x004e /* U+004E LATIN CAPITAL LETTER N */
+#define XK_O 0x004f /* U+004F LATIN CAPITAL LETTER O */
+#define XK_P 0x0050 /* U+0050 LATIN CAPITAL LETTER P */
+#define XK_Q 0x0051 /* U+0051 LATIN CAPITAL LETTER Q */
+#define XK_R 0x0052 /* U+0052 LATIN CAPITAL LETTER R */
+#define XK_S 0x0053 /* U+0053 LATIN CAPITAL LETTER S */
+#define XK_T 0x0054 /* U+0054 LATIN CAPITAL LETTER T */
+#define XK_U 0x0055 /* U+0055 LATIN CAPITAL LETTER U */
+#define XK_V 0x0056 /* U+0056 LATIN CAPITAL LETTER V */
+#define XK_W 0x0057 /* U+0057 LATIN CAPITAL LETTER W */
+#define XK_X 0x0058 /* U+0058 LATIN CAPITAL LETTER X */
+#define XK_Y 0x0059 /* U+0059 LATIN CAPITAL LETTER Y */
+#define XK_Z 0x005a /* U+005A LATIN CAPITAL LETTER Z */
+#define XK_bracketleft 0x005b /* U+005B LEFT SQUARE BRACKET */
+#define XK_backslash 0x005c /* U+005C REVERSE SOLIDUS */
+#define XK_bracketright 0x005d /* U+005D RIGHT SQUARE BRACKET */
+#define XK_asciicircum 0x005e /* U+005E CIRCUMFLEX ACCENT */
+#define XK_underscore 0x005f /* U+005F LOW LINE */
+#define XK_grave 0x0060 /* U+0060 GRAVE ACCENT */
+#define XK_quoteleft 0x0060 /* deprecated */
+#define XK_a 0x0061 /* U+0061 LATIN SMALL LETTER A */
+#define XK_b 0x0062 /* U+0062 LATIN SMALL LETTER B */
+#define XK_c 0x0063 /* U+0063 LATIN SMALL LETTER C */
+#define XK_d 0x0064 /* U+0064 LATIN SMALL LETTER D */
+#define XK_e 0x0065 /* U+0065 LATIN SMALL LETTER E */
+#define XK_f 0x0066 /* U+0066 LATIN SMALL LETTER F */
+#define XK_g 0x0067 /* U+0067 LATIN SMALL LETTER G */
+#define XK_h 0x0068 /* U+0068 LATIN SMALL LETTER H */
+#define XK_i 0x0069 /* U+0069 LATIN SMALL LETTER I */
+#define XK_j 0x006a /* U+006A LATIN SMALL LETTER J */
+#define XK_k 0x006b /* U+006B LATIN SMALL LETTER K */
+#define XK_l 0x006c /* U+006C LATIN SMALL LETTER L */
+#define XK_m 0x006d /* U+006D LATIN SMALL LETTER M */
+#define XK_n 0x006e /* U+006E LATIN SMALL LETTER N */
+#define XK_o 0x006f /* U+006F LATIN SMALL LETTER O */
+#define XK_p 0x0070 /* U+0070 LATIN SMALL LETTER P */
+#define XK_q 0x0071 /* U+0071 LATIN SMALL LETTER Q */
+#define XK_r 0x0072 /* U+0072 LATIN SMALL LETTER R */
+#define XK_s 0x0073 /* U+0073 LATIN SMALL LETTER S */
+#define XK_t 0x0074 /* U+0074 LATIN SMALL LETTER T */
+#define XK_u 0x0075 /* U+0075 LATIN SMALL LETTER U */
+#define XK_v 0x0076 /* U+0076 LATIN SMALL LETTER V */
+#define XK_w 0x0077 /* U+0077 LATIN SMALL LETTER W */
+#define XK_x 0x0078 /* U+0078 LATIN SMALL LETTER X */
+#define XK_y 0x0079 /* U+0079 LATIN SMALL LETTER Y */
+#define XK_z 0x007a /* U+007A LATIN SMALL LETTER Z */
+#define XK_braceleft 0x007b /* U+007B LEFT CURLY BRACKET */
+#define XK_bar 0x007c /* U+007C VERTICAL LINE */
+#define XK_braceright 0x007d /* U+007D RIGHT CURLY BRACKET */
+#define XK_asciitilde 0x007e /* U+007E TILDE */
+
+#define XK_nobreakspace 0x00a0 /* U+00A0 NO-BREAK SPACE */
+#define XK_exclamdown 0x00a1 /* U+00A1 INVERTED EXCLAMATION MARK */
+#define XK_cent 0x00a2 /* U+00A2 CENT SIGN */
+#define XK_sterling 0x00a3 /* U+00A3 POUND SIGN */
+#define XK_currency 0x00a4 /* U+00A4 CURRENCY SIGN */
+#define XK_yen 0x00a5 /* U+00A5 YEN SIGN */
+#define XK_brokenbar 0x00a6 /* U+00A6 BROKEN BAR */
+#define XK_section 0x00a7 /* U+00A7 SECTION SIGN */
+#define XK_diaeresis 0x00a8 /* U+00A8 DIAERESIS */
+#define XK_copyright 0x00a9 /* U+00A9 COPYRIGHT SIGN */
+#define XK_ordfeminine 0x00aa /* U+00AA FEMININE ORDINAL INDICATOR */
+#define XK_guillemotleft 0x00ab /* U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */
+#define XK_notsign 0x00ac /* U+00AC NOT SIGN */
+#define XK_hyphen 0x00ad /* U+00AD SOFT HYPHEN */
+#define XK_registered 0x00ae /* U+00AE REGISTERED SIGN */
+#define XK_macron 0x00af /* U+00AF MACRON */
+#define XK_degree 0x00b0 /* U+00B0 DEGREE SIGN */
+#define XK_plusminus 0x00b1 /* U+00B1 PLUS-MINUS SIGN */
+#define XK_twosuperior 0x00b2 /* U+00B2 SUPERSCRIPT TWO */
+#define XK_threesuperior 0x00b3 /* U+00B3 SUPERSCRIPT THREE */
+#define XK_acute 0x00b4 /* U+00B4 ACUTE ACCENT */
+#define XK_mu 0x00b5 /* U+00B5 MICRO SIGN */
+#define XK_paragraph 0x00b6 /* U+00B6 PILCROW SIGN */
+#define XK_periodcentered 0x00b7 /* U+00B7 MIDDLE DOT */
+#define XK_cedilla 0x00b8 /* U+00B8 CEDILLA */
+#define XK_onesuperior 0x00b9 /* U+00B9 SUPERSCRIPT ONE */
+#define XK_masculine 0x00ba /* U+00BA MASCULINE ORDINAL INDICATOR */
+#define XK_guillemotright 0x00bb /* U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */
+#define XK_onequarter 0x00bc /* U+00BC VULGAR FRACTION ONE QUARTER */
+#define XK_onehalf 0x00bd /* U+00BD VULGAR FRACTION ONE HALF */
+#define XK_threequarters 0x00be /* U+00BE VULGAR FRACTION THREE QUARTERS */
+#define XK_questiondown 0x00bf /* U+00BF INVERTED QUESTION MARK */
+#define XK_Agrave 0x00c0 /* U+00C0 LATIN CAPITAL LETTER A WITH GRAVE */
+#define XK_Aacute 0x00c1 /* U+00C1 LATIN CAPITAL LETTER A WITH ACUTE */
+#define XK_Acircumflex 0x00c2 /* U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */
+#define XK_Atilde 0x00c3 /* U+00C3 LATIN CAPITAL LETTER A WITH TILDE */
+#define XK_Adiaeresis 0x00c4 /* U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS */
+#define XK_Aring 0x00c5 /* U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE */
+#define XK_AE 0x00c6 /* U+00C6 LATIN CAPITAL LETTER AE */
+#define XK_Ccedilla 0x00c7 /* U+00C7 LATIN CAPITAL LETTER C WITH CEDILLA */
+#define XK_Egrave 0x00c8 /* U+00C8 LATIN CAPITAL LETTER E WITH GRAVE */
+#define XK_Eacute 0x00c9 /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+#define XK_Ecircumflex 0x00ca /* U+00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX */
+#define XK_Ediaeresis 0x00cb /* U+00CB LATIN CAPITAL LETTER E WITH DIAERESIS */
+#define XK_Igrave 0x00cc /* U+00CC LATIN CAPITAL LETTER I WITH GRAVE */
+#define XK_Iacute 0x00cd /* U+00CD LATIN CAPITAL LETTER I WITH ACUTE */
+#define XK_Icircumflex 0x00ce /* U+00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX */
+#define XK_Idiaeresis 0x00cf /* U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS */
+#define XK_ETH 0x00d0 /* U+00D0 LATIN CAPITAL LETTER ETH */
+#define XK_Eth 0x00d0 /* deprecated */
+#define XK_Ntilde 0x00d1 /* U+00D1 LATIN CAPITAL LETTER N WITH TILDE */
+#define XK_Ograve 0x00d2 /* U+00D2 LATIN CAPITAL LETTER O WITH GRAVE */
+#define XK_Oacute 0x00d3 /* U+00D3 LATIN CAPITAL LETTER O WITH ACUTE */
+#define XK_Ocircumflex 0x00d4 /* U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */
+#define XK_Otilde 0x00d5 /* U+00D5 LATIN CAPITAL LETTER O WITH TILDE */
+#define XK_Odiaeresis 0x00d6 /* U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS */
+#define XK_multiply 0x00d7 /* U+00D7 MULTIPLICATION SIGN */
+#define XK_Oslash 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+#define XK_Ooblique 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+#define XK_Ugrave 0x00d9 /* U+00D9 LATIN CAPITAL LETTER U WITH GRAVE */
+#define XK_Uacute 0x00da /* U+00DA LATIN CAPITAL LETTER U WITH ACUTE */
+#define XK_Ucircumflex 0x00db /* U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX */
+#define XK_Udiaeresis 0x00dc /* U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS */
+#define XK_Yacute 0x00dd /* U+00DD LATIN CAPITAL LETTER Y WITH ACUTE */
+#define XK_THORN 0x00de /* U+00DE LATIN CAPITAL LETTER THORN */
+#define XK_Thorn 0x00de /* deprecated */
+#define XK_ssharp 0x00df /* U+00DF LATIN SMALL LETTER SHARP S */
+#define XK_agrave 0x00e0 /* U+00E0 LATIN SMALL LETTER A WITH GRAVE */
+#define XK_aacute 0x00e1 /* U+00E1 LATIN SMALL LETTER A WITH ACUTE */
+#define XK_acircumflex 0x00e2 /* U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX */
+#define XK_atilde 0x00e3 /* U+00E3 LATIN SMALL LETTER A WITH TILDE */
+#define XK_adiaeresis 0x00e4 /* U+00E4 LATIN SMALL LETTER A WITH DIAERESIS */
+#define XK_aring 0x00e5 /* U+00E5 LATIN SMALL LETTER A WITH RING ABOVE */
+#define XK_ae 0x00e6 /* U+00E6 LATIN SMALL LETTER AE */
+#define XK_ccedilla 0x00e7 /* U+00E7 LATIN SMALL LETTER C WITH CEDILLA */
+#define XK_egrave 0x00e8 /* U+00E8 LATIN SMALL LETTER E WITH GRAVE */
+#define XK_eacute 0x00e9 /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
+#define XK_ecircumflex 0x00ea /* U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX */
+#define XK_ediaeresis 0x00eb /* U+00EB LATIN SMALL LETTER E WITH DIAERESIS */
+#define XK_igrave 0x00ec /* U+00EC LATIN SMALL LETTER I WITH GRAVE */
+#define XK_iacute 0x00ed /* U+00ED LATIN SMALL LETTER I WITH ACUTE */
+#define XK_icircumflex 0x00ee /* U+00EE LATIN SMALL LETTER I WITH CIRCUMFLEX */
+#define XK_idiaeresis 0x00ef /* U+00EF LATIN SMALL LETTER I WITH DIAERESIS */
+#define XK_eth 0x00f0 /* U+00F0 LATIN SMALL LETTER ETH */
+#define XK_ntilde 0x00f1 /* U+00F1 LATIN SMALL LETTER N WITH TILDE */
+#define XK_ograve 0x00f2 /* U+00F2 LATIN SMALL LETTER O WITH GRAVE */
+#define XK_oacute 0x00f3 /* U+00F3 LATIN SMALL LETTER O WITH ACUTE */
+#define XK_ocircumflex 0x00f4 /* U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX */
+#define XK_otilde 0x00f5 /* U+00F5 LATIN SMALL LETTER O WITH TILDE */
+#define XK_odiaeresis 0x00f6 /* U+00F6 LATIN SMALL LETTER O WITH DIAERESIS */
+#define XK_division 0x00f7 /* U+00F7 DIVISION SIGN */
+#define XK_oslash 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */
+#define XK_ooblique 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */
+#define XK_ugrave 0x00f9 /* U+00F9 LATIN SMALL LETTER U WITH GRAVE */
+#define XK_uacute 0x00fa /* U+00FA LATIN SMALL LETTER U WITH ACUTE */
+#define XK_ucircumflex 0x00fb /* U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX */
+#define XK_udiaeresis 0x00fc /* U+00FC LATIN SMALL LETTER U WITH DIAERESIS */
+#define XK_yacute 0x00fd /* U+00FD LATIN SMALL LETTER Y WITH ACUTE */
+#define XK_thorn 0x00fe /* U+00FE LATIN SMALL LETTER THORN */
+#define XK_ydiaeresis 0x00ff /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+#endif /* XK_LATIN1 */
+
+/*
+ * Latin 2
+ * Byte 3 = 1
+ */
+
+#ifdef XK_LATIN2
+#define XK_Aogonek 0x01a1 /* U+0104 LATIN CAPITAL LETTER A WITH OGONEK */
+#define XK_breve 0x01a2 /* U+02D8 BREVE */
+#define XK_Lstroke 0x01a3 /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+#define XK_Lcaron 0x01a5 /* U+013D LATIN CAPITAL LETTER L WITH CARON */
+#define XK_Sacute 0x01a6 /* U+015A LATIN CAPITAL LETTER S WITH ACUTE */
+#define XK_Scaron 0x01a9 /* U+0160 LATIN CAPITAL LETTER S WITH CARON */
+#define XK_Scedilla 0x01aa /* U+015E LATIN CAPITAL LETTER S WITH CEDILLA */
+#define XK_Tcaron 0x01ab /* U+0164 LATIN CAPITAL LETTER T WITH CARON */
+#define XK_Zacute 0x01ac /* U+0179 LATIN CAPITAL LETTER Z WITH ACUTE */
+#define XK_Zcaron 0x01ae /* U+017D LATIN CAPITAL LETTER Z WITH CARON */
+#define XK_Zabovedot 0x01af /* U+017B LATIN CAPITAL LETTER Z WITH DOT ABOVE */
+#define XK_aogonek 0x01b1 /* U+0105 LATIN SMALL LETTER A WITH OGONEK */
+#define XK_ogonek 0x01b2 /* U+02DB OGONEK */
+#define XK_lstroke 0x01b3 /* U+0142 LATIN SMALL LETTER L WITH STROKE */
+#define XK_lcaron 0x01b5 /* U+013E LATIN SMALL LETTER L WITH CARON */
+#define XK_sacute 0x01b6 /* U+015B LATIN SMALL LETTER S WITH ACUTE */
+#define XK_caron 0x01b7 /* U+02C7 CARON */
+#define XK_scaron 0x01b9 /* U+0161 LATIN SMALL LETTER S WITH CARON */
+#define XK_scedilla 0x01ba /* U+015F LATIN SMALL LETTER S WITH CEDILLA */
+#define XK_tcaron 0x01bb /* U+0165 LATIN SMALL LETTER T WITH CARON */
+#define XK_zacute 0x01bc /* U+017A LATIN SMALL LETTER Z WITH ACUTE */
+#define XK_doubleacute 0x01bd /* U+02DD DOUBLE ACUTE ACCENT */
+#define XK_zcaron 0x01be /* U+017E LATIN SMALL LETTER Z WITH CARON */
+#define XK_zabovedot 0x01bf /* U+017C LATIN SMALL LETTER Z WITH DOT ABOVE */
+#define XK_Racute 0x01c0 /* U+0154 LATIN CAPITAL LETTER R WITH ACUTE */
+#define XK_Abreve 0x01c3 /* U+0102 LATIN CAPITAL LETTER A WITH BREVE */
+#define XK_Lacute 0x01c5 /* U+0139 LATIN CAPITAL LETTER L WITH ACUTE */
+#define XK_Cacute 0x01c6 /* U+0106 LATIN CAPITAL LETTER C WITH ACUTE */
+#define XK_Ccaron 0x01c8 /* U+010C LATIN CAPITAL LETTER C WITH CARON */
+#define XK_Eogonek 0x01ca /* U+0118 LATIN CAPITAL LETTER E WITH OGONEK */
+#define XK_Ecaron 0x01cc /* U+011A LATIN CAPITAL LETTER E WITH CARON */
+#define XK_Dcaron 0x01cf /* U+010E LATIN CAPITAL LETTER D WITH CARON */
+#define XK_Dstroke 0x01d0 /* U+0110 LATIN CAPITAL LETTER D WITH STROKE */
+#define XK_Nacute 0x01d1 /* U+0143 LATIN CAPITAL LETTER N WITH ACUTE */
+#define XK_Ncaron 0x01d2 /* U+0147 LATIN CAPITAL LETTER N WITH CARON */
+#define XK_Odoubleacute 0x01d5 /* U+0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */
+#define XK_Rcaron 0x01d8 /* U+0158 LATIN CAPITAL LETTER R WITH CARON */
+#define XK_Uring 0x01d9 /* U+016E LATIN CAPITAL LETTER U WITH RING ABOVE */
+#define XK_Udoubleacute 0x01db /* U+0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */
+#define XK_Tcedilla 0x01de /* U+0162 LATIN CAPITAL LETTER T WITH CEDILLA */
+#define XK_racute 0x01e0 /* U+0155 LATIN SMALL LETTER R WITH ACUTE */
+#define XK_abreve 0x01e3 /* U+0103 LATIN SMALL LETTER A WITH BREVE */
+#define XK_lacute 0x01e5 /* U+013A LATIN SMALL LETTER L WITH ACUTE */
+#define XK_cacute 0x01e6 /* U+0107 LATIN SMALL LETTER C WITH ACUTE */
+#define XK_ccaron 0x01e8 /* U+010D LATIN SMALL LETTER C WITH CARON */
+#define XK_eogonek 0x01ea /* U+0119 LATIN SMALL LETTER E WITH OGONEK */
+#define XK_ecaron 0x01ec /* U+011B LATIN SMALL LETTER E WITH CARON */
+#define XK_dcaron 0x01ef /* U+010F LATIN SMALL LETTER D WITH CARON */
+#define XK_dstroke 0x01f0 /* U+0111 LATIN SMALL LETTER D WITH STROKE */
+#define XK_nacute 0x01f1 /* U+0144 LATIN SMALL LETTER N WITH ACUTE */
+#define XK_ncaron 0x01f2 /* U+0148 LATIN SMALL LETTER N WITH CARON */
+#define XK_odoubleacute 0x01f5 /* U+0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE */
+#define XK_rcaron 0x01f8 /* U+0159 LATIN SMALL LETTER R WITH CARON */
+#define XK_uring 0x01f9 /* U+016F LATIN SMALL LETTER U WITH RING ABOVE */
+#define XK_udoubleacute 0x01fb /* U+0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE */
+#define XK_tcedilla 0x01fe /* U+0163 LATIN SMALL LETTER T WITH CEDILLA */
+#define XK_abovedot 0x01ff /* U+02D9 DOT ABOVE */
+#endif /* XK_LATIN2 */
+
+/*
+ * Latin 3
+ * Byte 3 = 2
+ */
+
+#ifdef XK_LATIN3
+#define XK_Hstroke 0x02a1 /* U+0126 LATIN CAPITAL LETTER H WITH STROKE */
+#define XK_Hcircumflex 0x02a6 /* U+0124 LATIN CAPITAL LETTER H WITH CIRCUMFLEX */
+#define XK_Iabovedot 0x02a9 /* U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE */
+#define XK_Gbreve 0x02ab /* U+011E LATIN CAPITAL LETTER G WITH BREVE */
+#define XK_Jcircumflex 0x02ac /* U+0134 LATIN CAPITAL LETTER J WITH CIRCUMFLEX */
+#define XK_hstroke 0x02b1 /* U+0127 LATIN SMALL LETTER H WITH STROKE */
+#define XK_hcircumflex 0x02b6 /* U+0125 LATIN SMALL LETTER H WITH CIRCUMFLEX */
+#define XK_idotless 0x02b9 /* U+0131 LATIN SMALL LETTER DOTLESS I */
+#define XK_gbreve 0x02bb /* U+011F LATIN SMALL LETTER G WITH BREVE */
+#define XK_jcircumflex 0x02bc /* U+0135 LATIN SMALL LETTER J WITH CIRCUMFLEX */
+#define XK_Cabovedot 0x02c5 /* U+010A LATIN CAPITAL LETTER C WITH DOT ABOVE */
+#define XK_Ccircumflex 0x02c6 /* U+0108 LATIN CAPITAL LETTER C WITH CIRCUMFLEX */
+#define XK_Gabovedot 0x02d5 /* U+0120 LATIN CAPITAL LETTER G WITH DOT ABOVE */
+#define XK_Gcircumflex 0x02d8 /* U+011C LATIN CAPITAL LETTER G WITH CIRCUMFLEX */
+#define XK_Ubreve 0x02dd /* U+016C LATIN CAPITAL LETTER U WITH BREVE */
+#define XK_Scircumflex 0x02de /* U+015C LATIN CAPITAL LETTER S WITH CIRCUMFLEX */
+#define XK_cabovedot 0x02e5 /* U+010B LATIN SMALL LETTER C WITH DOT ABOVE */
+#define XK_ccircumflex 0x02e6 /* U+0109 LATIN SMALL LETTER C WITH CIRCUMFLEX */
+#define XK_gabovedot 0x02f5 /* U+0121 LATIN SMALL LETTER G WITH DOT ABOVE */
+#define XK_gcircumflex 0x02f8 /* U+011D LATIN SMALL LETTER G WITH CIRCUMFLEX */
+#define XK_ubreve 0x02fd /* U+016D LATIN SMALL LETTER U WITH BREVE */
+#define XK_scircumflex 0x02fe /* U+015D LATIN SMALL LETTER S WITH CIRCUMFLEX */
+#endif /* XK_LATIN3 */
+
+
+/*
+ * Latin 4
+ * Byte 3 = 3
+ */
+
+#ifdef XK_LATIN4
+#define XK_kra 0x03a2 /* U+0138 LATIN SMALL LETTER KRA */
+#define XK_kappa 0x03a2 /* deprecated */
+#define XK_Rcedilla 0x03a3 /* U+0156 LATIN CAPITAL LETTER R WITH CEDILLA */
+#define XK_Itilde 0x03a5 /* U+0128 LATIN CAPITAL LETTER I WITH TILDE */
+#define XK_Lcedilla 0x03a6 /* U+013B LATIN CAPITAL LETTER L WITH CEDILLA */
+#define XK_Emacron 0x03aa /* U+0112 LATIN CAPITAL LETTER E WITH MACRON */
+#define XK_Gcedilla 0x03ab /* U+0122 LATIN CAPITAL LETTER G WITH CEDILLA */
+#define XK_Tslash 0x03ac /* U+0166 LATIN CAPITAL LETTER T WITH STROKE */
+#define XK_rcedilla 0x03b3 /* U+0157 LATIN SMALL LETTER R WITH CEDILLA */
+#define XK_itilde 0x03b5 /* U+0129 LATIN SMALL LETTER I WITH TILDE */
+#define XK_lcedilla 0x03b6 /* U+013C LATIN SMALL LETTER L WITH CEDILLA */
+#define XK_emacron 0x03ba /* U+0113 LATIN SMALL LETTER E WITH MACRON */
+#define XK_gcedilla 0x03bb /* U+0123 LATIN SMALL LETTER G WITH CEDILLA */
+#define XK_tslash 0x03bc /* U+0167 LATIN SMALL LETTER T WITH STROKE */
+#define XK_ENG 0x03bd /* U+014A LATIN CAPITAL LETTER ENG */
+#define XK_eng 0x03bf /* U+014B LATIN SMALL LETTER ENG */
+#define XK_Amacron 0x03c0 /* U+0100 LATIN CAPITAL LETTER A WITH MACRON */
+#define XK_Iogonek 0x03c7 /* U+012E LATIN CAPITAL LETTER I WITH OGONEK */
+#define XK_Eabovedot 0x03cc /* U+0116 LATIN CAPITAL LETTER E WITH DOT ABOVE */
+#define XK_Imacron 0x03cf /* U+012A LATIN CAPITAL LETTER I WITH MACRON */
+#define XK_Ncedilla 0x03d1 /* U+0145 LATIN CAPITAL LETTER N WITH CEDILLA */
+#define XK_Omacron 0x03d2 /* U+014C LATIN CAPITAL LETTER O WITH MACRON */
+#define XK_Kcedilla 0x03d3 /* U+0136 LATIN CAPITAL LETTER K WITH CEDILLA */
+#define XK_Uogonek 0x03d9 /* U+0172 LATIN CAPITAL LETTER U WITH OGONEK */
+#define XK_Utilde 0x03dd /* U+0168 LATIN CAPITAL LETTER U WITH TILDE */
+#define XK_Umacron 0x03de /* U+016A LATIN CAPITAL LETTER U WITH MACRON */
+#define XK_amacron 0x03e0 /* U+0101 LATIN SMALL LETTER A WITH MACRON */
+#define XK_iogonek 0x03e7 /* U+012F LATIN SMALL LETTER I WITH OGONEK */
+#define XK_eabovedot 0x03ec /* U+0117 LATIN SMALL LETTER E WITH DOT ABOVE */
+#define XK_imacron 0x03ef /* U+012B LATIN SMALL LETTER I WITH MACRON */
+#define XK_ncedilla 0x03f1 /* U+0146 LATIN SMALL LETTER N WITH CEDILLA */
+#define XK_omacron 0x03f2 /* U+014D LATIN SMALL LETTER O WITH MACRON */
+#define XK_kcedilla 0x03f3 /* U+0137 LATIN SMALL LETTER K WITH CEDILLA */
+#define XK_uogonek 0x03f9 /* U+0173 LATIN SMALL LETTER U WITH OGONEK */
+#define XK_utilde 0x03fd /* U+0169 LATIN SMALL LETTER U WITH TILDE */
+#define XK_umacron 0x03fe /* U+016B LATIN SMALL LETTER U WITH MACRON */
+#endif /* XK_LATIN4 */
+
+/*
+ * Latin 8
+ */
+#ifdef XK_LATIN8
+#define XK_Wcircumflex 0x1000174 /* U+0174 LATIN CAPITAL LETTER W WITH CIRCUMFLEX */
+#define XK_wcircumflex 0x1000175 /* U+0175 LATIN SMALL LETTER W WITH CIRCUMFLEX */
+#define XK_Ycircumflex 0x1000176 /* U+0176 LATIN CAPITAL LETTER Y WITH CIRCUMFLEX */
+#define XK_ycircumflex 0x1000177 /* U+0177 LATIN SMALL LETTER Y WITH CIRCUMFLEX */
+#define XK_Babovedot 0x1001e02 /* U+1E02 LATIN CAPITAL LETTER B WITH DOT ABOVE */
+#define XK_babovedot 0x1001e03 /* U+1E03 LATIN SMALL LETTER B WITH DOT ABOVE */
+#define XK_Dabovedot 0x1001e0a /* U+1E0A LATIN CAPITAL LETTER D WITH DOT ABOVE */
+#define XK_dabovedot 0x1001e0b /* U+1E0B LATIN SMALL LETTER D WITH DOT ABOVE */
+#define XK_Fabovedot 0x1001e1e /* U+1E1E LATIN CAPITAL LETTER F WITH DOT ABOVE */
+#define XK_fabovedot 0x1001e1f /* U+1E1F LATIN SMALL LETTER F WITH DOT ABOVE */
+#define XK_Mabovedot 0x1001e40 /* U+1E40 LATIN CAPITAL LETTER M WITH DOT ABOVE */
+#define XK_mabovedot 0x1001e41 /* U+1E41 LATIN SMALL LETTER M WITH DOT ABOVE */
+#define XK_Pabovedot 0x1001e56 /* U+1E56 LATIN CAPITAL LETTER P WITH DOT ABOVE */
+#define XK_pabovedot 0x1001e57 /* U+1E57 LATIN SMALL LETTER P WITH DOT ABOVE */
+#define XK_Sabovedot 0x1001e60 /* U+1E60 LATIN CAPITAL LETTER S WITH DOT ABOVE */
+#define XK_sabovedot 0x1001e61 /* U+1E61 LATIN SMALL LETTER S WITH DOT ABOVE */
+#define XK_Tabovedot 0x1001e6a /* U+1E6A LATIN CAPITAL LETTER T WITH DOT ABOVE */
+#define XK_tabovedot 0x1001e6b /* U+1E6B LATIN SMALL LETTER T WITH DOT ABOVE */
+#define XK_Wgrave 0x1001e80 /* U+1E80 LATIN CAPITAL LETTER W WITH GRAVE */
+#define XK_wgrave 0x1001e81 /* U+1E81 LATIN SMALL LETTER W WITH GRAVE */
+#define XK_Wacute 0x1001e82 /* U+1E82 LATIN CAPITAL LETTER W WITH ACUTE */
+#define XK_wacute 0x1001e83 /* U+1E83 LATIN SMALL LETTER W WITH ACUTE */
+#define XK_Wdiaeresis 0x1001e84 /* U+1E84 LATIN CAPITAL LETTER W WITH DIAERESIS */
+#define XK_wdiaeresis 0x1001e85 /* U+1E85 LATIN SMALL LETTER W WITH DIAERESIS */
+#define XK_Ygrave 0x1001ef2 /* U+1EF2 LATIN CAPITAL LETTER Y WITH GRAVE */
+#define XK_ygrave 0x1001ef3 /* U+1EF3 LATIN SMALL LETTER Y WITH GRAVE */
+#endif /* XK_LATIN8 */
+
+/*
+ * Latin 9
+ * Byte 3 = 0x13
+ */
+
+#ifdef XK_LATIN9
+#define XK_OE 0x13bc /* U+0152 LATIN CAPITAL LIGATURE OE */
+#define XK_oe 0x13bd /* U+0153 LATIN SMALL LIGATURE OE */
+#define XK_Ydiaeresis 0x13be /* U+0178 LATIN CAPITAL LETTER Y WITH DIAERESIS */
+#endif /* XK_LATIN9 */
+
+/*
+ * Katakana
+ * Byte 3 = 4
+ */
+
+#ifdef XK_KATAKANA
+#define XK_overline 0x047e /* U+203E OVERLINE */
+#define XK_kana_fullstop 0x04a1 /* U+3002 IDEOGRAPHIC FULL STOP */
+#define XK_kana_openingbracket 0x04a2 /* U+300C LEFT CORNER BRACKET */
+#define XK_kana_closingbracket 0x04a3 /* U+300D RIGHT CORNER BRACKET */
+#define XK_kana_comma 0x04a4 /* U+3001 IDEOGRAPHIC COMMA */
+#define XK_kana_conjunctive 0x04a5 /* U+30FB KATAKANA MIDDLE DOT */
+#define XK_kana_middledot 0x04a5 /* deprecated */
+#define XK_kana_WO 0x04a6 /* U+30F2 KATAKANA LETTER WO */
+#define XK_kana_a 0x04a7 /* U+30A1 KATAKANA LETTER SMALL A */
+#define XK_kana_i 0x04a8 /* U+30A3 KATAKANA LETTER SMALL I */
+#define XK_kana_u 0x04a9 /* U+30A5 KATAKANA LETTER SMALL U */
+#define XK_kana_e 0x04aa /* U+30A7 KATAKANA LETTER SMALL E */
+#define XK_kana_o 0x04ab /* U+30A9 KATAKANA LETTER SMALL O */
+#define XK_kana_ya 0x04ac /* U+30E3 KATAKANA LETTER SMALL YA */
+#define XK_kana_yu 0x04ad /* U+30E5 KATAKANA LETTER SMALL YU */
+#define XK_kana_yo 0x04ae /* U+30E7 KATAKANA LETTER SMALL YO */
+#define XK_kana_tsu 0x04af /* U+30C3 KATAKANA LETTER SMALL TU */
+#define XK_kana_tu 0x04af /* deprecated */
+#define XK_prolongedsound 0x04b0 /* U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK */
+#define XK_kana_A 0x04b1 /* U+30A2 KATAKANA LETTER A */
+#define XK_kana_I 0x04b2 /* U+30A4 KATAKANA LETTER I */
+#define XK_kana_U 0x04b3 /* U+30A6 KATAKANA LETTER U */
+#define XK_kana_E 0x04b4 /* U+30A8 KATAKANA LETTER E */
+#define XK_kana_O 0x04b5 /* U+30AA KATAKANA LETTER O */
+#define XK_kana_KA 0x04b6 /* U+30AB KATAKANA LETTER KA */
+#define XK_kana_KI 0x04b7 /* U+30AD KATAKANA LETTER KI */
+#define XK_kana_KU 0x04b8 /* U+30AF KATAKANA LETTER KU */
+#define XK_kana_KE 0x04b9 /* U+30B1 KATAKANA LETTER KE */
+#define XK_kana_KO 0x04ba /* U+30B3 KATAKANA LETTER KO */
+#define XK_kana_SA 0x04bb /* U+30B5 KATAKANA LETTER SA */
+#define XK_kana_SHI 0x04bc /* U+30B7 KATAKANA LETTER SI */
+#define XK_kana_SU 0x04bd /* U+30B9 KATAKANA LETTER SU */
+#define XK_kana_SE 0x04be /* U+30BB KATAKANA LETTER SE */
+#define XK_kana_SO 0x04bf /* U+30BD KATAKANA LETTER SO */
+#define XK_kana_TA 0x04c0 /* U+30BF KATAKANA LETTER TA */
+#define XK_kana_CHI 0x04c1 /* U+30C1 KATAKANA LETTER TI */
+#define XK_kana_TI 0x04c1 /* deprecated */
+#define XK_kana_TSU 0x04c2 /* U+30C4 KATAKANA LETTER TU */
+#define XK_kana_TU 0x04c2 /* deprecated */
+#define XK_kana_TE 0x04c3 /* U+30C6 KATAKANA LETTER TE */
+#define XK_kana_TO 0x04c4 /* U+30C8 KATAKANA LETTER TO */
+#define XK_kana_NA 0x04c5 /* U+30CA KATAKANA LETTER NA */
+#define XK_kana_NI 0x04c6 /* U+30CB KATAKANA LETTER NI */
+#define XK_kana_NU 0x04c7 /* U+30CC KATAKANA LETTER NU */
+#define XK_kana_NE 0x04c8 /* U+30CD KATAKANA LETTER NE */
+#define XK_kana_NO 0x04c9 /* U+30CE KATAKANA LETTER NO */
+#define XK_kana_HA 0x04ca /* U+30CF KATAKANA LETTER HA */
+#define XK_kana_HI 0x04cb /* U+30D2 KATAKANA LETTER HI */
+#define XK_kana_FU 0x04cc /* U+30D5 KATAKANA LETTER HU */
+#define XK_kana_HU 0x04cc /* deprecated */
+#define XK_kana_HE 0x04cd /* U+30D8 KATAKANA LETTER HE */
+#define XK_kana_HO 0x04ce /* U+30DB KATAKANA LETTER HO */
+#define XK_kana_MA 0x04cf /* U+30DE KATAKANA LETTER MA */
+#define XK_kana_MI 0x04d0 /* U+30DF KATAKANA LETTER MI */
+#define XK_kana_MU 0x04d1 /* U+30E0 KATAKANA LETTER MU */
+#define XK_kana_ME 0x04d2 /* U+30E1 KATAKANA LETTER ME */
+#define XK_kana_MO 0x04d3 /* U+30E2 KATAKANA LETTER MO */
+#define XK_kana_YA 0x04d4 /* U+30E4 KATAKANA LETTER YA */
+#define XK_kana_YU 0x04d5 /* U+30E6 KATAKANA LETTER YU */
+#define XK_kana_YO 0x04d6 /* U+30E8 KATAKANA LETTER YO */
+#define XK_kana_RA 0x04d7 /* U+30E9 KATAKANA LETTER RA */
+#define XK_kana_RI 0x04d8 /* U+30EA KATAKANA LETTER RI */
+#define XK_kana_RU 0x04d9 /* U+30EB KATAKANA LETTER RU */
+#define XK_kana_RE 0x04da /* U+30EC KATAKANA LETTER RE */
+#define XK_kana_RO 0x04db /* U+30ED KATAKANA LETTER RO */
+#define XK_kana_WA 0x04dc /* U+30EF KATAKANA LETTER WA */
+#define XK_kana_N 0x04dd /* U+30F3 KATAKANA LETTER N */
+#define XK_voicedsound 0x04de /* U+309B KATAKANA-HIRAGANA VOICED SOUND MARK */
+#define XK_semivoicedsound 0x04df /* U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */
+#define XK_kana_switch 0xff7e /* Alias for mode_switch */
+#endif /* XK_KATAKANA */
+
+/*
+ * Arabic
+ * Byte 3 = 5
+ */
+
+#ifdef XK_ARABIC
+#define XK_Farsi_0 0x10006f0 /* U+06F0 EXTENDED ARABIC-INDIC DIGIT ZERO */
+#define XK_Farsi_1 0x10006f1 /* U+06F1 EXTENDED ARABIC-INDIC DIGIT ONE */
+#define XK_Farsi_2 0x10006f2 /* U+06F2 EXTENDED ARABIC-INDIC DIGIT TWO */
+#define XK_Farsi_3 0x10006f3 /* U+06F3 EXTENDED ARABIC-INDIC DIGIT THREE */
+#define XK_Farsi_4 0x10006f4 /* U+06F4 EXTENDED ARABIC-INDIC DIGIT FOUR */
+#define XK_Farsi_5 0x10006f5 /* U+06F5 EXTENDED ARABIC-INDIC DIGIT FIVE */
+#define XK_Farsi_6 0x10006f6 /* U+06F6 EXTENDED ARABIC-INDIC DIGIT SIX */
+#define XK_Farsi_7 0x10006f7 /* U+06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN */
+#define XK_Farsi_8 0x10006f8 /* U+06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT */
+#define XK_Farsi_9 0x10006f9 /* U+06F9 EXTENDED ARABIC-INDIC DIGIT NINE */
+#define XK_Arabic_percent 0x100066a /* U+066A ARABIC PERCENT SIGN */
+#define XK_Arabic_superscript_alef 0x1000670 /* U+0670 ARABIC LETTER SUPERSCRIPT ALEF */
+#define XK_Arabic_tteh 0x1000679 /* U+0679 ARABIC LETTER TTEH */
+#define XK_Arabic_peh 0x100067e /* U+067E ARABIC LETTER PEH */
+#define XK_Arabic_tcheh 0x1000686 /* U+0686 ARABIC LETTER TCHEH */
+#define XK_Arabic_ddal 0x1000688 /* U+0688 ARABIC LETTER DDAL */
+#define XK_Arabic_rreh 0x1000691 /* U+0691 ARABIC LETTER RREH */
+#define XK_Arabic_comma 0x05ac /* U+060C ARABIC COMMA */
+#define XK_Arabic_fullstop 0x10006d4 /* U+06D4 ARABIC FULL STOP */
+#define XK_Arabic_0 0x1000660 /* U+0660 ARABIC-INDIC DIGIT ZERO */
+#define XK_Arabic_1 0x1000661 /* U+0661 ARABIC-INDIC DIGIT ONE */
+#define XK_Arabic_2 0x1000662 /* U+0662 ARABIC-INDIC DIGIT TWO */
+#define XK_Arabic_3 0x1000663 /* U+0663 ARABIC-INDIC DIGIT THREE */
+#define XK_Arabic_4 0x1000664 /* U+0664 ARABIC-INDIC DIGIT FOUR */
+#define XK_Arabic_5 0x1000665 /* U+0665 ARABIC-INDIC DIGIT FIVE */
+#define XK_Arabic_6 0x1000666 /* U+0666 ARABIC-INDIC DIGIT SIX */
+#define XK_Arabic_7 0x1000667 /* U+0667 ARABIC-INDIC DIGIT SEVEN */
+#define XK_Arabic_8 0x1000668 /* U+0668 ARABIC-INDIC DIGIT EIGHT */
+#define XK_Arabic_9 0x1000669 /* U+0669 ARABIC-INDIC DIGIT NINE */
+#define XK_Arabic_semicolon 0x05bb /* U+061B ARABIC SEMICOLON */
+#define XK_Arabic_question_mark 0x05bf /* U+061F ARABIC QUESTION MARK */
+#define XK_Arabic_hamza 0x05c1 /* U+0621 ARABIC LETTER HAMZA */
+#define XK_Arabic_maddaonalef 0x05c2 /* U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE */
+#define XK_Arabic_hamzaonalef 0x05c3 /* U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE */
+#define XK_Arabic_hamzaonwaw 0x05c4 /* U+0624 ARABIC LETTER WAW WITH HAMZA ABOVE */
+#define XK_Arabic_hamzaunderalef 0x05c5 /* U+0625 ARABIC LETTER ALEF WITH HAMZA BELOW */
+#define XK_Arabic_hamzaonyeh 0x05c6 /* U+0626 ARABIC LETTER YEH WITH HAMZA ABOVE */
+#define XK_Arabic_alef 0x05c7 /* U+0627 ARABIC LETTER ALEF */
+#define XK_Arabic_beh 0x05c8 /* U+0628 ARABIC LETTER BEH */
+#define XK_Arabic_tehmarbuta 0x05c9 /* U+0629 ARABIC LETTER TEH MARBUTA */
+#define XK_Arabic_teh 0x05ca /* U+062A ARABIC LETTER TEH */
+#define XK_Arabic_theh 0x05cb /* U+062B ARABIC LETTER THEH */
+#define XK_Arabic_jeem 0x05cc /* U+062C ARABIC LETTER JEEM */
+#define XK_Arabic_hah 0x05cd /* U+062D ARABIC LETTER HAH */
+#define XK_Arabic_khah 0x05ce /* U+062E ARABIC LETTER KHAH */
+#define XK_Arabic_dal 0x05cf /* U+062F ARABIC LETTER DAL */
+#define XK_Arabic_thal 0x05d0 /* U+0630 ARABIC LETTER THAL */
+#define XK_Arabic_ra 0x05d1 /* U+0631 ARABIC LETTER REH */
+#define XK_Arabic_zain 0x05d2 /* U+0632 ARABIC LETTER ZAIN */
+#define XK_Arabic_seen 0x05d3 /* U+0633 ARABIC LETTER SEEN */
+#define XK_Arabic_sheen 0x05d4 /* U+0634 ARABIC LETTER SHEEN */
+#define XK_Arabic_sad 0x05d5 /* U+0635 ARABIC LETTER SAD */
+#define XK_Arabic_dad 0x05d6 /* U+0636 ARABIC LETTER DAD */
+#define XK_Arabic_tah 0x05d7 /* U+0637 ARABIC LETTER TAH */
+#define XK_Arabic_zah 0x05d8 /* U+0638 ARABIC LETTER ZAH */
+#define XK_Arabic_ain 0x05d9 /* U+0639 ARABIC LETTER AIN */
+#define XK_Arabic_ghain 0x05da /* U+063A ARABIC LETTER GHAIN */
+#define XK_Arabic_tatweel 0x05e0 /* U+0640 ARABIC TATWEEL */
+#define XK_Arabic_feh 0x05e1 /* U+0641 ARABIC LETTER FEH */
+#define XK_Arabic_qaf 0x05e2 /* U+0642 ARABIC LETTER QAF */
+#define XK_Arabic_kaf 0x05e3 /* U+0643 ARABIC LETTER KAF */
+#define XK_Arabic_lam 0x05e4 /* U+0644 ARABIC LETTER LAM */
+#define XK_Arabic_meem 0x05e5 /* U+0645 ARABIC LETTER MEEM */
+#define XK_Arabic_noon 0x05e6 /* U+0646 ARABIC LETTER NOON */
+#define XK_Arabic_ha 0x05e7 /* U+0647 ARABIC LETTER HEH */
+#define XK_Arabic_heh 0x05e7 /* deprecated */
+#define XK_Arabic_waw 0x05e8 /* U+0648 ARABIC LETTER WAW */
+#define XK_Arabic_alefmaksura 0x05e9 /* U+0649 ARABIC LETTER ALEF MAKSURA */
+#define XK_Arabic_yeh 0x05ea /* U+064A ARABIC LETTER YEH */
+#define XK_Arabic_fathatan 0x05eb /* U+064B ARABIC FATHATAN */
+#define XK_Arabic_dammatan 0x05ec /* U+064C ARABIC DAMMATAN */
+#define XK_Arabic_kasratan 0x05ed /* U+064D ARABIC KASRATAN */
+#define XK_Arabic_fatha 0x05ee /* U+064E ARABIC FATHA */
+#define XK_Arabic_damma 0x05ef /* U+064F ARABIC DAMMA */
+#define XK_Arabic_kasra 0x05f0 /* U+0650 ARABIC KASRA */
+#define XK_Arabic_shadda 0x05f1 /* U+0651 ARABIC SHADDA */
+#define XK_Arabic_sukun 0x05f2 /* U+0652 ARABIC SUKUN */
+#define XK_Arabic_madda_above 0x1000653 /* U+0653 ARABIC MADDAH ABOVE */
+#define XK_Arabic_hamza_above 0x1000654 /* U+0654 ARABIC HAMZA ABOVE */
+#define XK_Arabic_hamza_below 0x1000655 /* U+0655 ARABIC HAMZA BELOW */
+#define XK_Arabic_jeh 0x1000698 /* U+0698 ARABIC LETTER JEH */
+#define XK_Arabic_veh 0x10006a4 /* U+06A4 ARABIC LETTER VEH */
+#define XK_Arabic_keheh 0x10006a9 /* U+06A9 ARABIC LETTER KEHEH */
+#define XK_Arabic_gaf 0x10006af /* U+06AF ARABIC LETTER GAF */
+#define XK_Arabic_noon_ghunna 0x10006ba /* U+06BA ARABIC LETTER NOON GHUNNA */
+#define XK_Arabic_heh_doachashmee 0x10006be /* U+06BE ARABIC LETTER HEH DOACHASHMEE */
+#define XK_Farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */
+#define XK_Arabic_farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */
+#define XK_Arabic_yeh_baree 0x10006d2 /* U+06D2 ARABIC LETTER YEH BARREE */
+#define XK_Arabic_heh_goal 0x10006c1 /* U+06C1 ARABIC LETTER HEH GOAL */
+#define XK_Arabic_switch 0xff7e /* Alias for mode_switch */
+#endif /* XK_ARABIC */
+
+/*
+ * Cyrillic
+ * Byte 3 = 6
+ */
+#ifdef XK_CYRILLIC
+#define XK_Cyrillic_GHE_bar 0x1000492 /* U+0492 CYRILLIC CAPITAL LETTER GHE WITH STROKE */
+#define XK_Cyrillic_ghe_bar 0x1000493 /* U+0493 CYRILLIC SMALL LETTER GHE WITH STROKE */
+#define XK_Cyrillic_ZHE_descender 0x1000496 /* U+0496 CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER */
+#define XK_Cyrillic_zhe_descender 0x1000497 /* U+0497 CYRILLIC SMALL LETTER ZHE WITH DESCENDER */
+#define XK_Cyrillic_KA_descender 0x100049a /* U+049A CYRILLIC CAPITAL LETTER KA WITH DESCENDER */
+#define XK_Cyrillic_ka_descender 0x100049b /* U+049B CYRILLIC SMALL LETTER KA WITH DESCENDER */
+#define XK_Cyrillic_KA_vertstroke 0x100049c /* U+049C CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE */
+#define XK_Cyrillic_ka_vertstroke 0x100049d /* U+049D CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE */
+#define XK_Cyrillic_EN_descender 0x10004a2 /* U+04A2 CYRILLIC CAPITAL LETTER EN WITH DESCENDER */
+#define XK_Cyrillic_en_descender 0x10004a3 /* U+04A3 CYRILLIC SMALL LETTER EN WITH DESCENDER */
+#define XK_Cyrillic_U_straight 0x10004ae /* U+04AE CYRILLIC CAPITAL LETTER STRAIGHT U */
+#define XK_Cyrillic_u_straight 0x10004af /* U+04AF CYRILLIC SMALL LETTER STRAIGHT U */
+#define XK_Cyrillic_U_straight_bar 0x10004b0 /* U+04B0 CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE */
+#define XK_Cyrillic_u_straight_bar 0x10004b1 /* U+04B1 CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE */
+#define XK_Cyrillic_HA_descender 0x10004b2 /* U+04B2 CYRILLIC CAPITAL LETTER HA WITH DESCENDER */
+#define XK_Cyrillic_ha_descender 0x10004b3 /* U+04B3 CYRILLIC SMALL LETTER HA WITH DESCENDER */
+#define XK_Cyrillic_CHE_descender 0x10004b6 /* U+04B6 CYRILLIC CAPITAL LETTER CHE WITH DESCENDER */
+#define XK_Cyrillic_che_descender 0x10004b7 /* U+04B7 CYRILLIC SMALL LETTER CHE WITH DESCENDER */
+#define XK_Cyrillic_CHE_vertstroke 0x10004b8 /* U+04B8 CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE */
+#define XK_Cyrillic_che_vertstroke 0x10004b9 /* U+04B9 CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE */
+#define XK_Cyrillic_SHHA 0x10004ba /* U+04BA CYRILLIC CAPITAL LETTER SHHA */
+#define XK_Cyrillic_shha 0x10004bb /* U+04BB CYRILLIC SMALL LETTER SHHA */
+
+#define XK_Cyrillic_SCHWA 0x10004d8 /* U+04D8 CYRILLIC CAPITAL LETTER SCHWA */
+#define XK_Cyrillic_schwa 0x10004d9 /* U+04D9 CYRILLIC SMALL LETTER SCHWA */
+#define XK_Cyrillic_I_macron 0x10004e2 /* U+04E2 CYRILLIC CAPITAL LETTER I WITH MACRON */
+#define XK_Cyrillic_i_macron 0x10004e3 /* U+04E3 CYRILLIC SMALL LETTER I WITH MACRON */
+#define XK_Cyrillic_O_bar 0x10004e8 /* U+04E8 CYRILLIC CAPITAL LETTER BARRED O */
+#define XK_Cyrillic_o_bar 0x10004e9 /* U+04E9 CYRILLIC SMALL LETTER BARRED O */
+#define XK_Cyrillic_U_macron 0x10004ee /* U+04EE CYRILLIC CAPITAL LETTER U WITH MACRON */
+#define XK_Cyrillic_u_macron 0x10004ef /* U+04EF CYRILLIC SMALL LETTER U WITH MACRON */
+
+#define XK_Serbian_dje 0x06a1 /* U+0452 CYRILLIC SMALL LETTER DJE */
+#define XK_Macedonia_gje 0x06a2 /* U+0453 CYRILLIC SMALL LETTER GJE */
+#define XK_Cyrillic_io 0x06a3 /* U+0451 CYRILLIC SMALL LETTER IO */
+#define XK_Ukrainian_ie 0x06a4 /* U+0454 CYRILLIC SMALL LETTER UKRAINIAN IE */
+#define XK_Ukranian_je 0x06a4 /* deprecated */
+#define XK_Macedonia_dse 0x06a5 /* U+0455 CYRILLIC SMALL LETTER DZE */
+#define XK_Ukrainian_i 0x06a6 /* U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */
+#define XK_Ukranian_i 0x06a6 /* deprecated */
+#define XK_Ukrainian_yi 0x06a7 /* U+0457 CYRILLIC SMALL LETTER YI */
+#define XK_Ukranian_yi 0x06a7 /* deprecated */
+#define XK_Cyrillic_je 0x06a8 /* U+0458 CYRILLIC SMALL LETTER JE */
+#define XK_Serbian_je 0x06a8 /* deprecated */
+#define XK_Cyrillic_lje 0x06a9 /* U+0459 CYRILLIC SMALL LETTER LJE */
+#define XK_Serbian_lje 0x06a9 /* deprecated */
+#define XK_Cyrillic_nje 0x06aa /* U+045A CYRILLIC SMALL LETTER NJE */
+#define XK_Serbian_nje 0x06aa /* deprecated */
+#define XK_Serbian_tshe 0x06ab /* U+045B CYRILLIC SMALL LETTER TSHE */
+#define XK_Macedonia_kje 0x06ac /* U+045C CYRILLIC SMALL LETTER KJE */
+#define XK_Ukrainian_ghe_with_upturn 0x06ad /* U+0491 CYRILLIC SMALL LETTER GHE WITH UPTURN */
+#define XK_Byelorussian_shortu 0x06ae /* U+045E CYRILLIC SMALL LETTER SHORT U */
+#define XK_Cyrillic_dzhe 0x06af /* U+045F CYRILLIC SMALL LETTER DZHE */
+#define XK_Serbian_dze 0x06af /* deprecated */
+#define XK_numerosign 0x06b0 /* U+2116 NUMERO SIGN */
+#define XK_Serbian_DJE 0x06b1 /* U+0402 CYRILLIC CAPITAL LETTER DJE */
+#define XK_Macedonia_GJE 0x06b2 /* U+0403 CYRILLIC CAPITAL LETTER GJE */
+#define XK_Cyrillic_IO 0x06b3 /* U+0401 CYRILLIC CAPITAL LETTER IO */
+#define XK_Ukrainian_IE 0x06b4 /* U+0404 CYRILLIC CAPITAL LETTER UKRAINIAN IE */
+#define XK_Ukranian_JE 0x06b4 /* deprecated */
+#define XK_Macedonia_DSE 0x06b5 /* U+0405 CYRILLIC CAPITAL LETTER DZE */
+#define XK_Ukrainian_I 0x06b6 /* U+0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */
+#define XK_Ukranian_I 0x06b6 /* deprecated */
+#define XK_Ukrainian_YI 0x06b7 /* U+0407 CYRILLIC CAPITAL LETTER YI */
+#define XK_Ukranian_YI 0x06b7 /* deprecated */
+#define XK_Cyrillic_JE 0x06b8 /* U+0408 CYRILLIC CAPITAL LETTER JE */
+#define XK_Serbian_JE 0x06b8 /* deprecated */
+#define XK_Cyrillic_LJE 0x06b9 /* U+0409 CYRILLIC CAPITAL LETTER LJE */
+#define XK_Serbian_LJE 0x06b9 /* deprecated */
+#define XK_Cyrillic_NJE 0x06ba /* U+040A CYRILLIC CAPITAL LETTER NJE */
+#define XK_Serbian_NJE 0x06ba /* deprecated */
+#define XK_Serbian_TSHE 0x06bb /* U+040B CYRILLIC CAPITAL LETTER TSHE */
+#define XK_Macedonia_KJE 0x06bc /* U+040C CYRILLIC CAPITAL LETTER KJE */
+#define XK_Ukrainian_GHE_WITH_UPTURN 0x06bd /* U+0490 CYRILLIC CAPITAL LETTER GHE WITH UPTURN */
+#define XK_Byelorussian_SHORTU 0x06be /* U+040E CYRILLIC CAPITAL LETTER SHORT U */
+#define XK_Cyrillic_DZHE 0x06bf /* U+040F CYRILLIC CAPITAL LETTER DZHE */
+#define XK_Serbian_DZE 0x06bf /* deprecated */
+#define XK_Cyrillic_yu 0x06c0 /* U+044E CYRILLIC SMALL LETTER YU */
+#define XK_Cyrillic_a 0x06c1 /* U+0430 CYRILLIC SMALL LETTER A */
+#define XK_Cyrillic_be 0x06c2 /* U+0431 CYRILLIC SMALL LETTER BE */
+#define XK_Cyrillic_tse 0x06c3 /* U+0446 CYRILLIC SMALL LETTER TSE */
+#define XK_Cyrillic_de 0x06c4 /* U+0434 CYRILLIC SMALL LETTER DE */
+#define XK_Cyrillic_ie 0x06c5 /* U+0435 CYRILLIC SMALL LETTER IE */
+#define XK_Cyrillic_ef 0x06c6 /* U+0444 CYRILLIC SMALL LETTER EF */
+#define XK_Cyrillic_ghe 0x06c7 /* U+0433 CYRILLIC SMALL LETTER GHE */
+#define XK_Cyrillic_ha 0x06c8 /* U+0445 CYRILLIC SMALL LETTER HA */
+#define XK_Cyrillic_i 0x06c9 /* U+0438 CYRILLIC SMALL LETTER I */
+#define XK_Cyrillic_shorti 0x06ca /* U+0439 CYRILLIC SMALL LETTER SHORT I */
+#define XK_Cyrillic_ka 0x06cb /* U+043A CYRILLIC SMALL LETTER KA */
+#define XK_Cyrillic_el 0x06cc /* U+043B CYRILLIC SMALL LETTER EL */
+#define XK_Cyrillic_em 0x06cd /* U+043C CYRILLIC SMALL LETTER EM */
+#define XK_Cyrillic_en 0x06ce /* U+043D CYRILLIC SMALL LETTER EN */
+#define XK_Cyrillic_o 0x06cf /* U+043E CYRILLIC SMALL LETTER O */
+#define XK_Cyrillic_pe 0x06d0 /* U+043F CYRILLIC SMALL LETTER PE */
+#define XK_Cyrillic_ya 0x06d1 /* U+044F CYRILLIC SMALL LETTER YA */
+#define XK_Cyrillic_er 0x06d2 /* U+0440 CYRILLIC SMALL LETTER ER */
+#define XK_Cyrillic_es 0x06d3 /* U+0441 CYRILLIC SMALL LETTER ES */
+#define XK_Cyrillic_te 0x06d4 /* U+0442 CYRILLIC SMALL LETTER TE */
+#define XK_Cyrillic_u 0x06d5 /* U+0443 CYRILLIC SMALL LETTER U */
+#define XK_Cyrillic_zhe 0x06d6 /* U+0436 CYRILLIC SMALL LETTER ZHE */
+#define XK_Cyrillic_ve 0x06d7 /* U+0432 CYRILLIC SMALL LETTER VE */
+#define XK_Cyrillic_softsign 0x06d8 /* U+044C CYRILLIC SMALL LETTER SOFT SIGN */
+#define XK_Cyrillic_yeru 0x06d9 /* U+044B CYRILLIC SMALL LETTER YERU */
+#define XK_Cyrillic_ze 0x06da /* U+0437 CYRILLIC SMALL LETTER ZE */
+#define XK_Cyrillic_sha 0x06db /* U+0448 CYRILLIC SMALL LETTER SHA */
+#define XK_Cyrillic_e 0x06dc /* U+044D CYRILLIC SMALL LETTER E */
+#define XK_Cyrillic_shcha 0x06dd /* U+0449 CYRILLIC SMALL LETTER SHCHA */
+#define XK_Cyrillic_che 0x06de /* U+0447 CYRILLIC SMALL LETTER CHE */
+#define XK_Cyrillic_hardsign 0x06df /* U+044A CYRILLIC SMALL LETTER HARD SIGN */
+#define XK_Cyrillic_YU 0x06e0 /* U+042E CYRILLIC CAPITAL LETTER YU */
+#define XK_Cyrillic_A 0x06e1 /* U+0410 CYRILLIC CAPITAL LETTER A */
+#define XK_Cyrillic_BE 0x06e2 /* U+0411 CYRILLIC CAPITAL LETTER BE */
+#define XK_Cyrillic_TSE 0x06e3 /* U+0426 CYRILLIC CAPITAL LETTER TSE */
+#define XK_Cyrillic_DE 0x06e4 /* U+0414 CYRILLIC CAPITAL LETTER DE */
+#define XK_Cyrillic_IE 0x06e5 /* U+0415 CYRILLIC CAPITAL LETTER IE */
+#define XK_Cyrillic_EF 0x06e6 /* U+0424 CYRILLIC CAPITAL LETTER EF */
+#define XK_Cyrillic_GHE 0x06e7 /* U+0413 CYRILLIC CAPITAL LETTER GHE */
+#define XK_Cyrillic_HA 0x06e8 /* U+0425 CYRILLIC CAPITAL LETTER HA */
+#define XK_Cyrillic_I 0x06e9 /* U+0418 CYRILLIC CAPITAL LETTER I */
+#define XK_Cyrillic_SHORTI 0x06ea /* U+0419 CYRILLIC CAPITAL LETTER SHORT I */
+#define XK_Cyrillic_KA 0x06eb /* U+041A CYRILLIC CAPITAL LETTER KA */
+#define XK_Cyrillic_EL 0x06ec /* U+041B CYRILLIC CAPITAL LETTER EL */
+#define XK_Cyrillic_EM 0x06ed /* U+041C CYRILLIC CAPITAL LETTER EM */
+#define XK_Cyrillic_EN 0x06ee /* U+041D CYRILLIC CAPITAL LETTER EN */
+#define XK_Cyrillic_O 0x06ef /* U+041E CYRILLIC CAPITAL LETTER O */
+#define XK_Cyrillic_PE 0x06f0 /* U+041F CYRILLIC CAPITAL LETTER PE */
+#define XK_Cyrillic_YA 0x06f1 /* U+042F CYRILLIC CAPITAL LETTER YA */
+#define XK_Cyrillic_ER 0x06f2 /* U+0420 CYRILLIC CAPITAL LETTER ER */
+#define XK_Cyrillic_ES 0x06f3 /* U+0421 CYRILLIC CAPITAL LETTER ES */
+#define XK_Cyrillic_TE 0x06f4 /* U+0422 CYRILLIC CAPITAL LETTER TE */
+#define XK_Cyrillic_U 0x06f5 /* U+0423 CYRILLIC CAPITAL LETTER U */
+#define XK_Cyrillic_ZHE 0x06f6 /* U+0416 CYRILLIC CAPITAL LETTER ZHE */
+#define XK_Cyrillic_VE 0x06f7 /* U+0412 CYRILLIC CAPITAL LETTER VE */
+#define XK_Cyrillic_SOFTSIGN 0x06f8 /* U+042C CYRILLIC CAPITAL LETTER SOFT SIGN */
+#define XK_Cyrillic_YERU 0x06f9 /* U+042B CYRILLIC CAPITAL LETTER YERU */
+#define XK_Cyrillic_ZE 0x06fa /* U+0417 CYRILLIC CAPITAL LETTER ZE */
+#define XK_Cyrillic_SHA 0x06fb /* U+0428 CYRILLIC CAPITAL LETTER SHA */
+#define XK_Cyrillic_E 0x06fc /* U+042D CYRILLIC CAPITAL LETTER E */
+#define XK_Cyrillic_SHCHA 0x06fd /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+#define XK_Cyrillic_CHE 0x06fe /* U+0427 CYRILLIC CAPITAL LETTER CHE */
+#define XK_Cyrillic_HARDSIGN 0x06ff /* U+042A CYRILLIC CAPITAL LETTER HARD SIGN */
+#endif /* XK_CYRILLIC */
+
+/*
+ * Greek
+ * (based on an early draft of, and not quite identical to, ISO/IEC 8859-7)
+ * Byte 3 = 7
+ */
+
+#ifdef XK_GREEK
+#define XK_Greek_ALPHAaccent 0x07a1 /* U+0386 GREEK CAPITAL LETTER ALPHA WITH TONOS */
+#define XK_Greek_EPSILONaccent 0x07a2 /* U+0388 GREEK CAPITAL LETTER EPSILON WITH TONOS */
+#define XK_Greek_ETAaccent 0x07a3 /* U+0389 GREEK CAPITAL LETTER ETA WITH TONOS */
+#define XK_Greek_IOTAaccent 0x07a4 /* U+038A GREEK CAPITAL LETTER IOTA WITH TONOS */
+#define XK_Greek_IOTAdieresis 0x07a5 /* U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */
+#define XK_Greek_IOTAdiaeresis 0x07a5 /* old typo */
+#define XK_Greek_OMICRONaccent 0x07a7 /* U+038C GREEK CAPITAL LETTER OMICRON WITH TONOS */
+#define XK_Greek_UPSILONaccent 0x07a8 /* U+038E GREEK CAPITAL LETTER UPSILON WITH TONOS */
+#define XK_Greek_UPSILONdieresis 0x07a9 /* U+03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */
+#define XK_Greek_OMEGAaccent 0x07ab /* U+038F GREEK CAPITAL LETTER OMEGA WITH TONOS */
+#define XK_Greek_accentdieresis 0x07ae /* U+0385 GREEK DIALYTIKA TONOS */
+#define XK_Greek_horizbar 0x07af /* U+2015 HORIZONTAL BAR */
+#define XK_Greek_alphaaccent 0x07b1 /* U+03AC GREEK SMALL LETTER ALPHA WITH TONOS */
+#define XK_Greek_epsilonaccent 0x07b2 /* U+03AD GREEK SMALL LETTER EPSILON WITH TONOS */
+#define XK_Greek_etaaccent 0x07b3 /* U+03AE GREEK SMALL LETTER ETA WITH TONOS */
+#define XK_Greek_iotaaccent 0x07b4 /* U+03AF GREEK SMALL LETTER IOTA WITH TONOS */
+#define XK_Greek_iotadieresis 0x07b5 /* U+03CA GREEK SMALL LETTER IOTA WITH DIALYTIKA */
+#define XK_Greek_iotaaccentdieresis 0x07b6 /* U+0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */
+#define XK_Greek_omicronaccent 0x07b7 /* U+03CC GREEK SMALL LETTER OMICRON WITH TONOS */
+#define XK_Greek_upsilonaccent 0x07b8 /* U+03CD GREEK SMALL LETTER UPSILON WITH TONOS */
+#define XK_Greek_upsilondieresis 0x07b9 /* U+03CB GREEK SMALL LETTER UPSILON WITH DIALYTIKA */
+#define XK_Greek_upsilonaccentdieresis 0x07ba /* U+03B0 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */
+#define XK_Greek_omegaaccent 0x07bb /* U+03CE GREEK SMALL LETTER OMEGA WITH TONOS */
+#define XK_Greek_ALPHA 0x07c1 /* U+0391 GREEK CAPITAL LETTER ALPHA */
+#define XK_Greek_BETA 0x07c2 /* U+0392 GREEK CAPITAL LETTER BETA */
+#define XK_Greek_GAMMA 0x07c3 /* U+0393 GREEK CAPITAL LETTER GAMMA */
+#define XK_Greek_DELTA 0x07c4 /* U+0394 GREEK CAPITAL LETTER DELTA */
+#define XK_Greek_EPSILON 0x07c5 /* U+0395 GREEK CAPITAL LETTER EPSILON */
+#define XK_Greek_ZETA 0x07c6 /* U+0396 GREEK CAPITAL LETTER ZETA */
+#define XK_Greek_ETA 0x07c7 /* U+0397 GREEK CAPITAL LETTER ETA */
+#define XK_Greek_THETA 0x07c8 /* U+0398 GREEK CAPITAL LETTER THETA */
+#define XK_Greek_IOTA 0x07c9 /* U+0399 GREEK CAPITAL LETTER IOTA */
+#define XK_Greek_KAPPA 0x07ca /* U+039A GREEK CAPITAL LETTER KAPPA */
+#define XK_Greek_LAMDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */
+#define XK_Greek_LAMBDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */
+#define XK_Greek_MU 0x07cc /* U+039C GREEK CAPITAL LETTER MU */
+#define XK_Greek_NU 0x07cd /* U+039D GREEK CAPITAL LETTER NU */
+#define XK_Greek_XI 0x07ce /* U+039E GREEK CAPITAL LETTER XI */
+#define XK_Greek_OMICRON 0x07cf /* U+039F GREEK CAPITAL LETTER OMICRON */
+#define XK_Greek_PI 0x07d0 /* U+03A0 GREEK CAPITAL LETTER PI */
+#define XK_Greek_RHO 0x07d1 /* U+03A1 GREEK CAPITAL LETTER RHO */
+#define XK_Greek_SIGMA 0x07d2 /* U+03A3 GREEK CAPITAL LETTER SIGMA */
+#define XK_Greek_TAU 0x07d4 /* U+03A4 GREEK CAPITAL LETTER TAU */
+#define XK_Greek_UPSILON 0x07d5 /* U+03A5 GREEK CAPITAL LETTER UPSILON */
+#define XK_Greek_PHI 0x07d6 /* U+03A6 GREEK CAPITAL LETTER PHI */
+#define XK_Greek_CHI 0x07d7 /* U+03A7 GREEK CAPITAL LETTER CHI */
+#define XK_Greek_PSI 0x07d8 /* U+03A8 GREEK CAPITAL LETTER PSI */
+#define XK_Greek_OMEGA 0x07d9 /* U+03A9 GREEK CAPITAL LETTER OMEGA */
+#define XK_Greek_alpha 0x07e1 /* U+03B1 GREEK SMALL LETTER ALPHA */
+#define XK_Greek_beta 0x07e2 /* U+03B2 GREEK SMALL LETTER BETA */
+#define XK_Greek_gamma 0x07e3 /* U+03B3 GREEK SMALL LETTER GAMMA */
+#define XK_Greek_delta 0x07e4 /* U+03B4 GREEK SMALL LETTER DELTA */
+#define XK_Greek_epsilon 0x07e5 /* U+03B5 GREEK SMALL LETTER EPSILON */
+#define XK_Greek_zeta 0x07e6 /* U+03B6 GREEK SMALL LETTER ZETA */
+#define XK_Greek_eta 0x07e7 /* U+03B7 GREEK SMALL LETTER ETA */
+#define XK_Greek_theta 0x07e8 /* U+03B8 GREEK SMALL LETTER THETA */
+#define XK_Greek_iota 0x07e9 /* U+03B9 GREEK SMALL LETTER IOTA */
+#define XK_Greek_kappa 0x07ea /* U+03BA GREEK SMALL LETTER KAPPA */
+#define XK_Greek_lamda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */
+#define XK_Greek_lambda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */
+#define XK_Greek_mu 0x07ec /* U+03BC GREEK SMALL LETTER MU */
+#define XK_Greek_nu 0x07ed /* U+03BD GREEK SMALL LETTER NU */
+#define XK_Greek_xi 0x07ee /* U+03BE GREEK SMALL LETTER XI */
+#define XK_Greek_omicron 0x07ef /* U+03BF GREEK SMALL LETTER OMICRON */
+#define XK_Greek_pi 0x07f0 /* U+03C0 GREEK SMALL LETTER PI */
+#define XK_Greek_rho 0x07f1 /* U+03C1 GREEK SMALL LETTER RHO */
+#define XK_Greek_sigma 0x07f2 /* U+03C3 GREEK SMALL LETTER SIGMA */
+#define XK_Greek_finalsmallsigma 0x07f3 /* U+03C2 GREEK SMALL LETTER FINAL SIGMA */
+#define XK_Greek_tau 0x07f4 /* U+03C4 GREEK SMALL LETTER TAU */
+#define XK_Greek_upsilon 0x07f5 /* U+03C5 GREEK SMALL LETTER UPSILON */
+#define XK_Greek_phi 0x07f6 /* U+03C6 GREEK SMALL LETTER PHI */
+#define XK_Greek_chi 0x07f7 /* U+03C7 GREEK SMALL LETTER CHI */
+#define XK_Greek_psi 0x07f8 /* U+03C8 GREEK SMALL LETTER PSI */
+#define XK_Greek_omega 0x07f9 /* U+03C9 GREEK SMALL LETTER OMEGA */
+#define XK_Greek_switch 0xff7e /* Alias for mode_switch */
+#endif /* XK_GREEK */
+
+/*
+ * Technical
+ * (from the DEC VT330/VT420 Technical Character Set, http://vt100.net/charsets/technical.html)
+ * Byte 3 = 8
+ */
+
+#ifdef XK_TECHNICAL
+#define XK_leftradical 0x08a1 /* U+23B7 RADICAL SYMBOL BOTTOM */
+#define XK_topleftradical 0x08a2 /*(U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT)*/
+#define XK_horizconnector 0x08a3 /*(U+2500 BOX DRAWINGS LIGHT HORIZONTAL)*/
+#define XK_topintegral 0x08a4 /* U+2320 TOP HALF INTEGRAL */
+#define XK_botintegral 0x08a5 /* U+2321 BOTTOM HALF INTEGRAL */
+#define XK_vertconnector 0x08a6 /*(U+2502 BOX DRAWINGS LIGHT VERTICAL)*/
+#define XK_topleftsqbracket 0x08a7 /* U+23A1 LEFT SQUARE BRACKET UPPER CORNER */
+#define XK_botleftsqbracket 0x08a8 /* U+23A3 LEFT SQUARE BRACKET LOWER CORNER */
+#define XK_toprightsqbracket 0x08a9 /* U+23A4 RIGHT SQUARE BRACKET UPPER CORNER */
+#define XK_botrightsqbracket 0x08aa /* U+23A6 RIGHT SQUARE BRACKET LOWER CORNER */
+#define XK_topleftparens 0x08ab /* U+239B LEFT PARENTHESIS UPPER HOOK */
+#define XK_botleftparens 0x08ac /* U+239D LEFT PARENTHESIS LOWER HOOK */
+#define XK_toprightparens 0x08ad /* U+239E RIGHT PARENTHESIS UPPER HOOK */
+#define XK_botrightparens 0x08ae /* U+23A0 RIGHT PARENTHESIS LOWER HOOK */
+#define XK_leftmiddlecurlybrace 0x08af /* U+23A8 LEFT CURLY BRACKET MIDDLE PIECE */
+#define XK_rightmiddlecurlybrace 0x08b0 /* U+23AC RIGHT CURLY BRACKET MIDDLE PIECE */
+#define XK_topleftsummation 0x08b1
+#define XK_botleftsummation 0x08b2
+#define XK_topvertsummationconnector 0x08b3
+#define XK_botvertsummationconnector 0x08b4
+#define XK_toprightsummation 0x08b5
+#define XK_botrightsummation 0x08b6
+#define XK_rightmiddlesummation 0x08b7
+#define XK_lessthanequal 0x08bc /* U+2264 LESS-THAN OR EQUAL TO */
+#define XK_notequal 0x08bd /* U+2260 NOT EQUAL TO */
+#define XK_greaterthanequal 0x08be /* U+2265 GREATER-THAN OR EQUAL TO */
+#define XK_integral 0x08bf /* U+222B INTEGRAL */
+#define XK_therefore 0x08c0 /* U+2234 THEREFORE */
+#define XK_variation 0x08c1 /* U+221D PROPORTIONAL TO */
+#define XK_infinity 0x08c2 /* U+221E INFINITY */
+#define XK_nabla 0x08c5 /* U+2207 NABLA */
+#define XK_approximate 0x08c8 /* U+223C TILDE OPERATOR */
+#define XK_similarequal 0x08c9 /* U+2243 ASYMPTOTICALLY EQUAL TO */
+#define XK_ifonlyif 0x08cd /* U+21D4 LEFT RIGHT DOUBLE ARROW */
+#define XK_implies 0x08ce /* U+21D2 RIGHTWARDS DOUBLE ARROW */
+#define XK_identical 0x08cf /* U+2261 IDENTICAL TO */
+#define XK_radical 0x08d6 /* U+221A SQUARE ROOT */
+#define XK_includedin 0x08da /* U+2282 SUBSET OF */
+#define XK_includes 0x08db /* U+2283 SUPERSET OF */
+#define XK_intersection 0x08dc /* U+2229 INTERSECTION */
+#define XK_union 0x08dd /* U+222A UNION */
+#define XK_logicaland 0x08de /* U+2227 LOGICAL AND */
+#define XK_logicalor 0x08df /* U+2228 LOGICAL OR */
+#define XK_partialderivative 0x08ef /* U+2202 PARTIAL DIFFERENTIAL */
+#define XK_function 0x08f6 /* U+0192 LATIN SMALL LETTER F WITH HOOK */
+#define XK_leftarrow 0x08fb /* U+2190 LEFTWARDS ARROW */
+#define XK_uparrow 0x08fc /* U+2191 UPWARDS ARROW */
+#define XK_rightarrow 0x08fd /* U+2192 RIGHTWARDS ARROW */
+#define XK_downarrow 0x08fe /* U+2193 DOWNWARDS ARROW */
+#endif /* XK_TECHNICAL */
+
+/*
+ * Special
+ * (from the DEC VT100 Special Graphics Character Set)
+ * Byte 3 = 9
+ */
+
+#ifdef XK_SPECIAL
+#define XK_blank 0x09df
+#define XK_soliddiamond 0x09e0 /* U+25C6 BLACK DIAMOND */
+#define XK_checkerboard 0x09e1 /* U+2592 MEDIUM SHADE */
+#define XK_ht 0x09e2 /* U+2409 SYMBOL FOR HORIZONTAL TABULATION */
+#define XK_ff 0x09e3 /* U+240C SYMBOL FOR FORM FEED */
+#define XK_cr 0x09e4 /* U+240D SYMBOL FOR CARRIAGE RETURN */
+#define XK_lf 0x09e5 /* U+240A SYMBOL FOR LINE FEED */
+#define XK_nl 0x09e8 /* U+2424 SYMBOL FOR NEWLINE */
+#define XK_vt 0x09e9 /* U+240B SYMBOL FOR VERTICAL TABULATION */
+#define XK_lowrightcorner 0x09ea /* U+2518 BOX DRAWINGS LIGHT UP AND LEFT */
+#define XK_uprightcorner 0x09eb /* U+2510 BOX DRAWINGS LIGHT DOWN AND LEFT */
+#define XK_upleftcorner 0x09ec /* U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT */
+#define XK_lowleftcorner 0x09ed /* U+2514 BOX DRAWINGS LIGHT UP AND RIGHT */
+#define XK_crossinglines 0x09ee /* U+253C BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */
+#define XK_horizlinescan1 0x09ef /* U+23BA HORIZONTAL SCAN LINE-1 */
+#define XK_horizlinescan3 0x09f0 /* U+23BB HORIZONTAL SCAN LINE-3 */
+#define XK_horizlinescan5 0x09f1 /* U+2500 BOX DRAWINGS LIGHT HORIZONTAL */
+#define XK_horizlinescan7 0x09f2 /* U+23BC HORIZONTAL SCAN LINE-7 */
+#define XK_horizlinescan9 0x09f3 /* U+23BD HORIZONTAL SCAN LINE-9 */
+#define XK_leftt 0x09f4 /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */
+#define XK_rightt 0x09f5 /* U+2524 BOX DRAWINGS LIGHT VERTICAL AND LEFT */
+#define XK_bott 0x09f6 /* U+2534 BOX DRAWINGS LIGHT UP AND HORIZONTAL */
+#define XK_topt 0x09f7 /* U+252C BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */
+#define XK_vertbar 0x09f8 /* U+2502 BOX DRAWINGS LIGHT VERTICAL */
+#endif /* XK_SPECIAL */
+
+/*
+ * Publishing
+ * (these are probably from a long forgotten DEC Publishing
+ * font that once shipped with DECwrite)
+ * Byte 3 = 0x0a
+ */
+
+#ifdef XK_PUBLISHING
+#define XK_emspace 0x0aa1 /* U+2003 EM SPACE */
+#define XK_enspace 0x0aa2 /* U+2002 EN SPACE */
+#define XK_em3space 0x0aa3 /* U+2004 THREE-PER-EM SPACE */
+#define XK_em4space 0x0aa4 /* U+2005 FOUR-PER-EM SPACE */
+#define XK_digitspace 0x0aa5 /* U+2007 FIGURE SPACE */
+#define XK_punctspace 0x0aa6 /* U+2008 PUNCTUATION SPACE */
+#define XK_thinspace 0x0aa7 /* U+2009 THIN SPACE */
+#define XK_hairspace 0x0aa8 /* U+200A HAIR SPACE */
+#define XK_emdash 0x0aa9 /* U+2014 EM DASH */
+#define XK_endash 0x0aaa /* U+2013 EN DASH */
+#define XK_signifblank 0x0aac /*(U+2423 OPEN BOX)*/
+#define XK_ellipsis 0x0aae /* U+2026 HORIZONTAL ELLIPSIS */
+#define XK_doubbaselinedot 0x0aaf /* U+2025 TWO DOT LEADER */
+#define XK_onethird 0x0ab0 /* U+2153 VULGAR FRACTION ONE THIRD */
+#define XK_twothirds 0x0ab1 /* U+2154 VULGAR FRACTION TWO THIRDS */
+#define XK_onefifth 0x0ab2 /* U+2155 VULGAR FRACTION ONE FIFTH */
+#define XK_twofifths 0x0ab3 /* U+2156 VULGAR FRACTION TWO FIFTHS */
+#define XK_threefifths 0x0ab4 /* U+2157 VULGAR FRACTION THREE FIFTHS */
+#define XK_fourfifths 0x0ab5 /* U+2158 VULGAR FRACTION FOUR FIFTHS */
+#define XK_onesixth 0x0ab6 /* U+2159 VULGAR FRACTION ONE SIXTH */
+#define XK_fivesixths 0x0ab7 /* U+215A VULGAR FRACTION FIVE SIXTHS */
+#define XK_careof 0x0ab8 /* U+2105 CARE OF */
+#define XK_figdash 0x0abb /* U+2012 FIGURE DASH */
+#define XK_leftanglebracket 0x0abc /*(U+2329 LEFT-POINTING ANGLE BRACKET)*/
+#define XK_decimalpoint 0x0abd /*(U+002E FULL STOP)*/
+#define XK_rightanglebracket 0x0abe /*(U+232A RIGHT-POINTING ANGLE BRACKET)*/
+#define XK_marker 0x0abf
+#define XK_oneeighth 0x0ac3 /* U+215B VULGAR FRACTION ONE EIGHTH */
+#define XK_threeeighths 0x0ac4 /* U+215C VULGAR FRACTION THREE EIGHTHS */
+#define XK_fiveeighths 0x0ac5 /* U+215D VULGAR FRACTION FIVE EIGHTHS */
+#define XK_seveneighths 0x0ac6 /* U+215E VULGAR FRACTION SEVEN EIGHTHS */
+#define XK_trademark 0x0ac9 /* U+2122 TRADE MARK SIGN */
+#define XK_signaturemark 0x0aca /*(U+2613 SALTIRE)*/
+#define XK_trademarkincircle 0x0acb
+#define XK_leftopentriangle 0x0acc /*(U+25C1 WHITE LEFT-POINTING TRIANGLE)*/
+#define XK_rightopentriangle 0x0acd /*(U+25B7 WHITE RIGHT-POINTING TRIANGLE)*/
+#define XK_emopencircle 0x0ace /*(U+25CB WHITE CIRCLE)*/
+#define XK_emopenrectangle 0x0acf /*(U+25AF WHITE VERTICAL RECTANGLE)*/
+#define XK_leftsinglequotemark 0x0ad0 /* U+2018 LEFT SINGLE QUOTATION MARK */
+#define XK_rightsinglequotemark 0x0ad1 /* U+2019 RIGHT SINGLE QUOTATION MARK */
+#define XK_leftdoublequotemark 0x0ad2 /* U+201C LEFT DOUBLE QUOTATION MARK */
+#define XK_rightdoublequotemark 0x0ad3 /* U+201D RIGHT DOUBLE QUOTATION MARK */
+#define XK_prescription 0x0ad4 /* U+211E PRESCRIPTION TAKE */
+#define XK_permille 0x0ad5 /* U+2030 PER MILLE SIGN */
+#define XK_minutes 0x0ad6 /* U+2032 PRIME */
+#define XK_seconds 0x0ad7 /* U+2033 DOUBLE PRIME */
+#define XK_latincross 0x0ad9 /* U+271D LATIN CROSS */
+#define XK_hexagram 0x0ada
+#define XK_filledrectbullet 0x0adb /*(U+25AC BLACK RECTANGLE)*/
+#define XK_filledlefttribullet 0x0adc /*(U+25C0 BLACK LEFT-POINTING TRIANGLE)*/
+#define XK_filledrighttribullet 0x0add /*(U+25B6 BLACK RIGHT-POINTING TRIANGLE)*/
+#define XK_emfilledcircle 0x0ade /*(U+25CF BLACK CIRCLE)*/
+#define XK_emfilledrect 0x0adf /*(U+25AE BLACK VERTICAL RECTANGLE)*/
+#define XK_enopencircbullet 0x0ae0 /*(U+25E6 WHITE BULLET)*/
+#define XK_enopensquarebullet 0x0ae1 /*(U+25AB WHITE SMALL SQUARE)*/
+#define XK_openrectbullet 0x0ae2 /*(U+25AD WHITE RECTANGLE)*/
+#define XK_opentribulletup 0x0ae3 /*(U+25B3 WHITE UP-POINTING TRIANGLE)*/
+#define XK_opentribulletdown 0x0ae4 /*(U+25BD WHITE DOWN-POINTING TRIANGLE)*/
+#define XK_openstar 0x0ae5 /*(U+2606 WHITE STAR)*/
+#define XK_enfilledcircbullet 0x0ae6 /*(U+2022 BULLET)*/
+#define XK_enfilledsqbullet 0x0ae7 /*(U+25AA BLACK SMALL SQUARE)*/
+#define XK_filledtribulletup 0x0ae8 /*(U+25B2 BLACK UP-POINTING TRIANGLE)*/
+#define XK_filledtribulletdown 0x0ae9 /*(U+25BC BLACK DOWN-POINTING TRIANGLE)*/
+#define XK_leftpointer 0x0aea /*(U+261C WHITE LEFT POINTING INDEX)*/
+#define XK_rightpointer 0x0aeb /*(U+261E WHITE RIGHT POINTING INDEX)*/
+#define XK_club 0x0aec /* U+2663 BLACK CLUB SUIT */
+#define XK_diamond 0x0aed /* U+2666 BLACK DIAMOND SUIT */
+#define XK_heart 0x0aee /* U+2665 BLACK HEART SUIT */
+#define XK_maltesecross 0x0af0 /* U+2720 MALTESE CROSS */
+#define XK_dagger 0x0af1 /* U+2020 DAGGER */
+#define XK_doubledagger 0x0af2 /* U+2021 DOUBLE DAGGER */
+#define XK_checkmark 0x0af3 /* U+2713 CHECK MARK */
+#define XK_ballotcross 0x0af4 /* U+2717 BALLOT X */
+#define XK_musicalsharp 0x0af5 /* U+266F MUSIC SHARP SIGN */
+#define XK_musicalflat 0x0af6 /* U+266D MUSIC FLAT SIGN */
+#define XK_malesymbol 0x0af7 /* U+2642 MALE SIGN */
+#define XK_femalesymbol 0x0af8 /* U+2640 FEMALE SIGN */
+#define XK_telephone 0x0af9 /* U+260E BLACK TELEPHONE */
+#define XK_telephonerecorder 0x0afa /* U+2315 TELEPHONE RECORDER */
+#define XK_phonographcopyright 0x0afb /* U+2117 SOUND RECORDING COPYRIGHT */
+#define XK_caret 0x0afc /* U+2038 CARET */
+#define XK_singlelowquotemark 0x0afd /* U+201A SINGLE LOW-9 QUOTATION MARK */
+#define XK_doublelowquotemark 0x0afe /* U+201E DOUBLE LOW-9 QUOTATION MARK */
+#define XK_cursor 0x0aff
+#endif /* XK_PUBLISHING */
+
+/*
+ * APL
+ * Byte 3 = 0x0b
+ */
+
+#ifdef XK_APL
+#define XK_leftcaret 0x0ba3 /*(U+003C LESS-THAN SIGN)*/
+#define XK_rightcaret 0x0ba6 /*(U+003E GREATER-THAN SIGN)*/
+#define XK_downcaret 0x0ba8 /*(U+2228 LOGICAL OR)*/
+#define XK_upcaret 0x0ba9 /*(U+2227 LOGICAL AND)*/
+#define XK_overbar 0x0bc0 /*(U+00AF MACRON)*/
+#define XK_downtack 0x0bc2 /* U+22A4 DOWN TACK */
+#define XK_upshoe 0x0bc3 /*(U+2229 INTERSECTION)*/
+#define XK_downstile 0x0bc4 /* U+230A LEFT FLOOR */
+#define XK_underbar 0x0bc6 /*(U+005F LOW LINE)*/
+#define XK_jot 0x0bca /* U+2218 RING OPERATOR */
+#define XK_quad 0x0bcc /* U+2395 APL FUNCTIONAL SYMBOL QUAD */
+#define XK_uptack 0x0bce /* U+22A5 UP TACK */
+#define XK_circle 0x0bcf /* U+25CB WHITE CIRCLE */
+#define XK_upstile 0x0bd3 /* U+2308 LEFT CEILING */
+#define XK_downshoe 0x0bd6 /*(U+222A UNION)*/
+#define XK_rightshoe 0x0bd8 /*(U+2283 SUPERSET OF)*/
+#define XK_leftshoe 0x0bda /*(U+2282 SUBSET OF)*/
+#define XK_lefttack 0x0bdc /* U+22A3 LEFT TACK */
+#define XK_righttack 0x0bfc /* U+22A2 RIGHT TACK */
+#endif /* XK_APL */
+
+/*
+ * Hebrew
+ * Byte 3 = 0x0c
+ */
+
+#ifdef XK_HEBREW
+#define XK_hebrew_doublelowline 0x0cdf /* U+2017 DOUBLE LOW LINE */
+#define XK_hebrew_aleph 0x0ce0 /* U+05D0 HEBREW LETTER ALEF */
+#define XK_hebrew_bet 0x0ce1 /* U+05D1 HEBREW LETTER BET */
+#define XK_hebrew_beth 0x0ce1 /* deprecated */
+#define XK_hebrew_gimel 0x0ce2 /* U+05D2 HEBREW LETTER GIMEL */
+#define XK_hebrew_gimmel 0x0ce2 /* deprecated */
+#define XK_hebrew_dalet 0x0ce3 /* U+05D3 HEBREW LETTER DALET */
+#define XK_hebrew_daleth 0x0ce3 /* deprecated */
+#define XK_hebrew_he 0x0ce4 /* U+05D4 HEBREW LETTER HE */
+#define XK_hebrew_waw 0x0ce5 /* U+05D5 HEBREW LETTER VAV */
+#define XK_hebrew_zain 0x0ce6 /* U+05D6 HEBREW LETTER ZAYIN */
+#define XK_hebrew_zayin 0x0ce6 /* deprecated */
+#define XK_hebrew_chet 0x0ce7 /* U+05D7 HEBREW LETTER HET */
+#define XK_hebrew_het 0x0ce7 /* deprecated */
+#define XK_hebrew_tet 0x0ce8 /* U+05D8 HEBREW LETTER TET */
+#define XK_hebrew_teth 0x0ce8 /* deprecated */
+#define XK_hebrew_yod 0x0ce9 /* U+05D9 HEBREW LETTER YOD */
+#define XK_hebrew_finalkaph 0x0cea /* U+05DA HEBREW LETTER FINAL KAF */
+#define XK_hebrew_kaph 0x0ceb /* U+05DB HEBREW LETTER KAF */
+#define XK_hebrew_lamed 0x0cec /* U+05DC HEBREW LETTER LAMED */
+#define XK_hebrew_finalmem 0x0ced /* U+05DD HEBREW LETTER FINAL MEM */
+#define XK_hebrew_mem 0x0cee /* U+05DE HEBREW LETTER MEM */
+#define XK_hebrew_finalnun 0x0cef /* U+05DF HEBREW LETTER FINAL NUN */
+#define XK_hebrew_nun 0x0cf0 /* U+05E0 HEBREW LETTER NUN */
+#define XK_hebrew_samech 0x0cf1 /* U+05E1 HEBREW LETTER SAMEKH */
+#define XK_hebrew_samekh 0x0cf1 /* deprecated */
+#define XK_hebrew_ayin 0x0cf2 /* U+05E2 HEBREW LETTER AYIN */
+#define XK_hebrew_finalpe 0x0cf3 /* U+05E3 HEBREW LETTER FINAL PE */
+#define XK_hebrew_pe 0x0cf4 /* U+05E4 HEBREW LETTER PE */
+#define XK_hebrew_finalzade 0x0cf5 /* U+05E5 HEBREW LETTER FINAL TSADI */
+#define XK_hebrew_finalzadi 0x0cf5 /* deprecated */
+#define XK_hebrew_zade 0x0cf6 /* U+05E6 HEBREW LETTER TSADI */
+#define XK_hebrew_zadi 0x0cf6 /* deprecated */
+#define XK_hebrew_qoph 0x0cf7 /* U+05E7 HEBREW LETTER QOF */
+#define XK_hebrew_kuf 0x0cf7 /* deprecated */
+#define XK_hebrew_resh 0x0cf8 /* U+05E8 HEBREW LETTER RESH */
+#define XK_hebrew_shin 0x0cf9 /* U+05E9 HEBREW LETTER SHIN */
+#define XK_hebrew_taw 0x0cfa /* U+05EA HEBREW LETTER TAV */
+#define XK_hebrew_taf 0x0cfa /* deprecated */
+#define XK_Hebrew_switch 0xff7e /* Alias for mode_switch */
+#endif /* XK_HEBREW */
+
+/*
+ * Thai
+ * Byte 3 = 0x0d
+ */
+
+#ifdef XK_THAI
+#define XK_Thai_kokai 0x0da1 /* U+0E01 THAI CHARACTER KO KAI */
+#define XK_Thai_khokhai 0x0da2 /* U+0E02 THAI CHARACTER KHO KHAI */
+#define XK_Thai_khokhuat 0x0da3 /* U+0E03 THAI CHARACTER KHO KHUAT */
+#define XK_Thai_khokhwai 0x0da4 /* U+0E04 THAI CHARACTER KHO KHWAI */
+#define XK_Thai_khokhon 0x0da5 /* U+0E05 THAI CHARACTER KHO KHON */
+#define XK_Thai_khorakhang 0x0da6 /* U+0E06 THAI CHARACTER KHO RAKHANG */
+#define XK_Thai_ngongu 0x0da7 /* U+0E07 THAI CHARACTER NGO NGU */
+#define XK_Thai_chochan 0x0da8 /* U+0E08 THAI CHARACTER CHO CHAN */
+#define XK_Thai_choching 0x0da9 /* U+0E09 THAI CHARACTER CHO CHING */
+#define XK_Thai_chochang 0x0daa /* U+0E0A THAI CHARACTER CHO CHANG */
+#define XK_Thai_soso 0x0dab /* U+0E0B THAI CHARACTER SO SO */
+#define XK_Thai_chochoe 0x0dac /* U+0E0C THAI CHARACTER CHO CHOE */
+#define XK_Thai_yoying 0x0dad /* U+0E0D THAI CHARACTER YO YING */
+#define XK_Thai_dochada 0x0dae /* U+0E0E THAI CHARACTER DO CHADA */
+#define XK_Thai_topatak 0x0daf /* U+0E0F THAI CHARACTER TO PATAK */
+#define XK_Thai_thothan 0x0db0 /* U+0E10 THAI CHARACTER THO THAN */
+#define XK_Thai_thonangmontho 0x0db1 /* U+0E11 THAI CHARACTER THO NANGMONTHO */
+#define XK_Thai_thophuthao 0x0db2 /* U+0E12 THAI CHARACTER THO PHUTHAO */
+#define XK_Thai_nonen 0x0db3 /* U+0E13 THAI CHARACTER NO NEN */
+#define XK_Thai_dodek 0x0db4 /* U+0E14 THAI CHARACTER DO DEK */
+#define XK_Thai_totao 0x0db5 /* U+0E15 THAI CHARACTER TO TAO */
+#define XK_Thai_thothung 0x0db6 /* U+0E16 THAI CHARACTER THO THUNG */
+#define XK_Thai_thothahan 0x0db7 /* U+0E17 THAI CHARACTER THO THAHAN */
+#define XK_Thai_thothong 0x0db8 /* U+0E18 THAI CHARACTER THO THONG */
+#define XK_Thai_nonu 0x0db9 /* U+0E19 THAI CHARACTER NO NU */
+#define XK_Thai_bobaimai 0x0dba /* U+0E1A THAI CHARACTER BO BAIMAI */
+#define XK_Thai_popla 0x0dbb /* U+0E1B THAI CHARACTER PO PLA */
+#define XK_Thai_phophung 0x0dbc /* U+0E1C THAI CHARACTER PHO PHUNG */
+#define XK_Thai_fofa 0x0dbd /* U+0E1D THAI CHARACTER FO FA */
+#define XK_Thai_phophan 0x0dbe /* U+0E1E THAI CHARACTER PHO PHAN */
+#define XK_Thai_fofan 0x0dbf /* U+0E1F THAI CHARACTER FO FAN */
+#define XK_Thai_phosamphao 0x0dc0 /* U+0E20 THAI CHARACTER PHO SAMPHAO */
+#define XK_Thai_moma 0x0dc1 /* U+0E21 THAI CHARACTER MO MA */
+#define XK_Thai_yoyak 0x0dc2 /* U+0E22 THAI CHARACTER YO YAK */
+#define XK_Thai_rorua 0x0dc3 /* U+0E23 THAI CHARACTER RO RUA */
+#define XK_Thai_ru 0x0dc4 /* U+0E24 THAI CHARACTER RU */
+#define XK_Thai_loling 0x0dc5 /* U+0E25 THAI CHARACTER LO LING */
+#define XK_Thai_lu 0x0dc6 /* U+0E26 THAI CHARACTER LU */
+#define XK_Thai_wowaen 0x0dc7 /* U+0E27 THAI CHARACTER WO WAEN */
+#define XK_Thai_sosala 0x0dc8 /* U+0E28 THAI CHARACTER SO SALA */
+#define XK_Thai_sorusi 0x0dc9 /* U+0E29 THAI CHARACTER SO RUSI */
+#define XK_Thai_sosua 0x0dca /* U+0E2A THAI CHARACTER SO SUA */
+#define XK_Thai_hohip 0x0dcb /* U+0E2B THAI CHARACTER HO HIP */
+#define XK_Thai_lochula 0x0dcc /* U+0E2C THAI CHARACTER LO CHULA */
+#define XK_Thai_oang 0x0dcd /* U+0E2D THAI CHARACTER O ANG */
+#define XK_Thai_honokhuk 0x0dce /* U+0E2E THAI CHARACTER HO NOKHUK */
+#define XK_Thai_paiyannoi 0x0dcf /* U+0E2F THAI CHARACTER PAIYANNOI */
+#define XK_Thai_saraa 0x0dd0 /* U+0E30 THAI CHARACTER SARA A */
+#define XK_Thai_maihanakat 0x0dd1 /* U+0E31 THAI CHARACTER MAI HAN-AKAT */
+#define XK_Thai_saraaa 0x0dd2 /* U+0E32 THAI CHARACTER SARA AA */
+#define XK_Thai_saraam 0x0dd3 /* U+0E33 THAI CHARACTER SARA AM */
+#define XK_Thai_sarai 0x0dd4 /* U+0E34 THAI CHARACTER SARA I */
+#define XK_Thai_saraii 0x0dd5 /* U+0E35 THAI CHARACTER SARA II */
+#define XK_Thai_saraue 0x0dd6 /* U+0E36 THAI CHARACTER SARA UE */
+#define XK_Thai_sarauee 0x0dd7 /* U+0E37 THAI CHARACTER SARA UEE */
+#define XK_Thai_sarau 0x0dd8 /* U+0E38 THAI CHARACTER SARA U */
+#define XK_Thai_sarauu 0x0dd9 /* U+0E39 THAI CHARACTER SARA UU */
+#define XK_Thai_phinthu 0x0dda /* U+0E3A THAI CHARACTER PHINTHU */
+#define XK_Thai_maihanakat_maitho 0x0dde
+#define XK_Thai_baht 0x0ddf /* U+0E3F THAI CURRENCY SYMBOL BAHT */
+#define XK_Thai_sarae 0x0de0 /* U+0E40 THAI CHARACTER SARA E */
+#define XK_Thai_saraae 0x0de1 /* U+0E41 THAI CHARACTER SARA AE */
+#define XK_Thai_sarao 0x0de2 /* U+0E42 THAI CHARACTER SARA O */
+#define XK_Thai_saraaimaimuan 0x0de3 /* U+0E43 THAI CHARACTER SARA AI MAIMUAN */
+#define XK_Thai_saraaimaimalai 0x0de4 /* U+0E44 THAI CHARACTER SARA AI MAIMALAI */
+#define XK_Thai_lakkhangyao 0x0de5 /* U+0E45 THAI CHARACTER LAKKHANGYAO */
+#define XK_Thai_maiyamok 0x0de6 /* U+0E46 THAI CHARACTER MAIYAMOK */
+#define XK_Thai_maitaikhu 0x0de7 /* U+0E47 THAI CHARACTER MAITAIKHU */
+#define XK_Thai_maiek 0x0de8 /* U+0E48 THAI CHARACTER MAI EK */
+#define XK_Thai_maitho 0x0de9 /* U+0E49 THAI CHARACTER MAI THO */
+#define XK_Thai_maitri 0x0dea /* U+0E4A THAI CHARACTER MAI TRI */
+#define XK_Thai_maichattawa 0x0deb /* U+0E4B THAI CHARACTER MAI CHATTAWA */
+#define XK_Thai_thanthakhat 0x0dec /* U+0E4C THAI CHARACTER THANTHAKHAT */
+#define XK_Thai_nikhahit 0x0ded /* U+0E4D THAI CHARACTER NIKHAHIT */
+#define XK_Thai_leksun 0x0df0 /* U+0E50 THAI DIGIT ZERO */
+#define XK_Thai_leknung 0x0df1 /* U+0E51 THAI DIGIT ONE */
+#define XK_Thai_leksong 0x0df2 /* U+0E52 THAI DIGIT TWO */
+#define XK_Thai_leksam 0x0df3 /* U+0E53 THAI DIGIT THREE */
+#define XK_Thai_leksi 0x0df4 /* U+0E54 THAI DIGIT FOUR */
+#define XK_Thai_lekha 0x0df5 /* U+0E55 THAI DIGIT FIVE */
+#define XK_Thai_lekhok 0x0df6 /* U+0E56 THAI DIGIT SIX */
+#define XK_Thai_lekchet 0x0df7 /* U+0E57 THAI DIGIT SEVEN */
+#define XK_Thai_lekpaet 0x0df8 /* U+0E58 THAI DIGIT EIGHT */
+#define XK_Thai_lekkao 0x0df9 /* U+0E59 THAI DIGIT NINE */
+#endif /* XK_THAI */
+
+/*
+ * Korean
+ * Byte 3 = 0x0e
+ */
+
+#ifdef XK_KOREAN
+
+#define XK_Hangul 0xff31 /* Hangul start/stop(toggle) */
+#define XK_Hangul_Start 0xff32 /* Hangul start */
+#define XK_Hangul_End 0xff33 /* Hangul end, English start */
+#define XK_Hangul_Hanja 0xff34 /* Start Hangul->Hanja Conversion */
+#define XK_Hangul_Jamo 0xff35 /* Hangul Jamo mode */
+#define XK_Hangul_Romaja 0xff36 /* Hangul Romaja mode */
+#define XK_Hangul_Codeinput 0xff37 /* Hangul code input mode */
+#define XK_Hangul_Jeonja 0xff38 /* Jeonja mode */
+#define XK_Hangul_Banja 0xff39 /* Banja mode */
+#define XK_Hangul_PreHanja 0xff3a /* Pre Hanja conversion */
+#define XK_Hangul_PostHanja 0xff3b /* Post Hanja conversion */
+#define XK_Hangul_SingleCandidate 0xff3c /* Single candidate */
+#define XK_Hangul_MultipleCandidate 0xff3d /* Multiple candidate */
+#define XK_Hangul_PreviousCandidate 0xff3e /* Previous candidate */
+#define XK_Hangul_Special 0xff3f /* Special symbols */
+#define XK_Hangul_switch 0xff7e /* Alias for mode_switch */
+
+/* Hangul Consonant Characters */
+#define XK_Hangul_Kiyeog 0x0ea1 /* U+3131 HANGUL LETTER KIYEOK */
+#define XK_Hangul_SsangKiyeog 0x0ea2 /* U+3132 HANGUL LETTER SSANGKIYEOK */
+#define XK_Hangul_KiyeogSios 0x0ea3 /* U+3133 HANGUL LETTER KIYEOK-SIOS */
+#define XK_Hangul_Nieun 0x0ea4 /* U+3134 HANGUL LETTER NIEUN */
+#define XK_Hangul_NieunJieuj 0x0ea5 /* U+3135 HANGUL LETTER NIEUN-CIEUC */
+#define XK_Hangul_NieunHieuh 0x0ea6 /* U+3136 HANGUL LETTER NIEUN-HIEUH */
+#define XK_Hangul_Dikeud 0x0ea7 /* U+3137 HANGUL LETTER TIKEUT */
+#define XK_Hangul_SsangDikeud 0x0ea8 /* U+3138 HANGUL LETTER SSANGTIKEUT */
+#define XK_Hangul_Rieul 0x0ea9 /* U+3139 HANGUL LETTER RIEUL */
+#define XK_Hangul_RieulKiyeog 0x0eaa /* U+313A HANGUL LETTER RIEUL-KIYEOK */
+#define XK_Hangul_RieulMieum 0x0eab /* U+313B HANGUL LETTER RIEUL-MIEUM */
+#define XK_Hangul_RieulPieub 0x0eac /* U+313C HANGUL LETTER RIEUL-PIEUP */
+#define XK_Hangul_RieulSios 0x0ead /* U+313D HANGUL LETTER RIEUL-SIOS */
+#define XK_Hangul_RieulTieut 0x0eae /* U+313E HANGUL LETTER RIEUL-THIEUTH */
+#define XK_Hangul_RieulPhieuf 0x0eaf /* U+313F HANGUL LETTER RIEUL-PHIEUPH */
+#define XK_Hangul_RieulHieuh 0x0eb0 /* U+3140 HANGUL LETTER RIEUL-HIEUH */
+#define XK_Hangul_Mieum 0x0eb1 /* U+3141 HANGUL LETTER MIEUM */
+#define XK_Hangul_Pieub 0x0eb2 /* U+3142 HANGUL LETTER PIEUP */
+#define XK_Hangul_SsangPieub 0x0eb3 /* U+3143 HANGUL LETTER SSANGPIEUP */
+#define XK_Hangul_PieubSios 0x0eb4 /* U+3144 HANGUL LETTER PIEUP-SIOS */
+#define XK_Hangul_Sios 0x0eb5 /* U+3145 HANGUL LETTER SIOS */
+#define XK_Hangul_SsangSios 0x0eb6 /* U+3146 HANGUL LETTER SSANGSIOS */
+#define XK_Hangul_Ieung 0x0eb7 /* U+3147 HANGUL LETTER IEUNG */
+#define XK_Hangul_Jieuj 0x0eb8 /* U+3148 HANGUL LETTER CIEUC */
+#define XK_Hangul_SsangJieuj 0x0eb9 /* U+3149 HANGUL LETTER SSANGCIEUC */
+#define XK_Hangul_Cieuc 0x0eba /* U+314A HANGUL LETTER CHIEUCH */
+#define XK_Hangul_Khieuq 0x0ebb /* U+314B HANGUL LETTER KHIEUKH */
+#define XK_Hangul_Tieut 0x0ebc /* U+314C HANGUL LETTER THIEUTH */
+#define XK_Hangul_Phieuf 0x0ebd /* U+314D HANGUL LETTER PHIEUPH */
+#define XK_Hangul_Hieuh 0x0ebe /* U+314E HANGUL LETTER HIEUH */
+
+/* Hangul Vowel Characters */
+#define XK_Hangul_A 0x0ebf /* U+314F HANGUL LETTER A */
+#define XK_Hangul_AE 0x0ec0 /* U+3150 HANGUL LETTER AE */
+#define XK_Hangul_YA 0x0ec1 /* U+3151 HANGUL LETTER YA */
+#define XK_Hangul_YAE 0x0ec2 /* U+3152 HANGUL LETTER YAE */
+#define XK_Hangul_EO 0x0ec3 /* U+3153 HANGUL LETTER EO */
+#define XK_Hangul_E 0x0ec4 /* U+3154 HANGUL LETTER E */
+#define XK_Hangul_YEO 0x0ec5 /* U+3155 HANGUL LETTER YEO */
+#define XK_Hangul_YE 0x0ec6 /* U+3156 HANGUL LETTER YE */
+#define XK_Hangul_O 0x0ec7 /* U+3157 HANGUL LETTER O */
+#define XK_Hangul_WA 0x0ec8 /* U+3158 HANGUL LETTER WA */
+#define XK_Hangul_WAE 0x0ec9 /* U+3159 HANGUL LETTER WAE */
+#define XK_Hangul_OE 0x0eca /* U+315A HANGUL LETTER OE */
+#define XK_Hangul_YO 0x0ecb /* U+315B HANGUL LETTER YO */
+#define XK_Hangul_U 0x0ecc /* U+315C HANGUL LETTER U */
+#define XK_Hangul_WEO 0x0ecd /* U+315D HANGUL LETTER WEO */
+#define XK_Hangul_WE 0x0ece /* U+315E HANGUL LETTER WE */
+#define XK_Hangul_WI 0x0ecf /* U+315F HANGUL LETTER WI */
+#define XK_Hangul_YU 0x0ed0 /* U+3160 HANGUL LETTER YU */
+#define XK_Hangul_EU 0x0ed1 /* U+3161 HANGUL LETTER EU */
+#define XK_Hangul_YI 0x0ed2 /* U+3162 HANGUL LETTER YI */
+#define XK_Hangul_I 0x0ed3 /* U+3163 HANGUL LETTER I */
+
+/* Hangul syllable-final (JongSeong) Characters */
+#define XK_Hangul_J_Kiyeog 0x0ed4 /* U+11A8 HANGUL JONGSEONG KIYEOK */
+#define XK_Hangul_J_SsangKiyeog 0x0ed5 /* U+11A9 HANGUL JONGSEONG SSANGKIYEOK */
+#define XK_Hangul_J_KiyeogSios 0x0ed6 /* U+11AA HANGUL JONGSEONG KIYEOK-SIOS */
+#define XK_Hangul_J_Nieun 0x0ed7 /* U+11AB HANGUL JONGSEONG NIEUN */
+#define XK_Hangul_J_NieunJieuj 0x0ed8 /* U+11AC HANGUL JONGSEONG NIEUN-CIEUC */
+#define XK_Hangul_J_NieunHieuh 0x0ed9 /* U+11AD HANGUL JONGSEONG NIEUN-HIEUH */
+#define XK_Hangul_J_Dikeud 0x0eda /* U+11AE HANGUL JONGSEONG TIKEUT */
+#define XK_Hangul_J_Rieul 0x0edb /* U+11AF HANGUL JONGSEONG RIEUL */
+#define XK_Hangul_J_RieulKiyeog 0x0edc /* U+11B0 HANGUL JONGSEONG RIEUL-KIYEOK */
+#define XK_Hangul_J_RieulMieum 0x0edd /* U+11B1 HANGUL JONGSEONG RIEUL-MIEUM */
+#define XK_Hangul_J_RieulPieub 0x0ede /* U+11B2 HANGUL JONGSEONG RIEUL-PIEUP */
+#define XK_Hangul_J_RieulSios 0x0edf /* U+11B3 HANGUL JONGSEONG RIEUL-SIOS */
+#define XK_Hangul_J_RieulTieut 0x0ee0 /* U+11B4 HANGUL JONGSEONG RIEUL-THIEUTH */
+#define XK_Hangul_J_RieulPhieuf 0x0ee1 /* U+11B5 HANGUL JONGSEONG RIEUL-PHIEUPH */
+#define XK_Hangul_J_RieulHieuh 0x0ee2 /* U+11B6 HANGUL JONGSEONG RIEUL-HIEUH */
+#define XK_Hangul_J_Mieum 0x0ee3 /* U+11B7 HANGUL JONGSEONG MIEUM */
+#define XK_Hangul_J_Pieub 0x0ee4 /* U+11B8 HANGUL JONGSEONG PIEUP */
+#define XK_Hangul_J_PieubSios 0x0ee5 /* U+11B9 HANGUL JONGSEONG PIEUP-SIOS */
+#define XK_Hangul_J_Sios 0x0ee6 /* U+11BA HANGUL JONGSEONG SIOS */
+#define XK_Hangul_J_SsangSios 0x0ee7 /* U+11BB HANGUL JONGSEONG SSANGSIOS */
+#define XK_Hangul_J_Ieung 0x0ee8 /* U+11BC HANGUL JONGSEONG IEUNG */
+#define XK_Hangul_J_Jieuj 0x0ee9 /* U+11BD HANGUL JONGSEONG CIEUC */
+#define XK_Hangul_J_Cieuc 0x0eea /* U+11BE HANGUL JONGSEONG CHIEUCH */
+#define XK_Hangul_J_Khieuq 0x0eeb /* U+11BF HANGUL JONGSEONG KHIEUKH */
+#define XK_Hangul_J_Tieut 0x0eec /* U+11C0 HANGUL JONGSEONG THIEUTH */
+#define XK_Hangul_J_Phieuf 0x0eed /* U+11C1 HANGUL JONGSEONG PHIEUPH */
+#define XK_Hangul_J_Hieuh 0x0eee /* U+11C2 HANGUL JONGSEONG HIEUH */
+
+/* Ancient Hangul Consonant Characters */
+#define XK_Hangul_RieulYeorinHieuh 0x0eef /* U+316D HANGUL LETTER RIEUL-YEORINHIEUH */
+#define XK_Hangul_SunkyeongeumMieum 0x0ef0 /* U+3171 HANGUL LETTER KAPYEOUNMIEUM */
+#define XK_Hangul_SunkyeongeumPieub 0x0ef1 /* U+3178 HANGUL LETTER KAPYEOUNPIEUP */
+#define XK_Hangul_PanSios 0x0ef2 /* U+317F HANGUL LETTER PANSIOS */
+#define XK_Hangul_KkogjiDalrinIeung 0x0ef3 /* U+3181 HANGUL LETTER YESIEUNG */
+#define XK_Hangul_SunkyeongeumPhieuf 0x0ef4 /* U+3184 HANGUL LETTER KAPYEOUNPHIEUPH */
+#define XK_Hangul_YeorinHieuh 0x0ef5 /* U+3186 HANGUL LETTER YEORINHIEUH */
+
+/* Ancient Hangul Vowel Characters */
+#define XK_Hangul_AraeA 0x0ef6 /* U+318D HANGUL LETTER ARAEA */
+#define XK_Hangul_AraeAE 0x0ef7 /* U+318E HANGUL LETTER ARAEAE */
+
+/* Ancient Hangul syllable-final (JongSeong) Characters */
+#define XK_Hangul_J_PanSios 0x0ef8 /* U+11EB HANGUL JONGSEONG PANSIOS */
+#define XK_Hangul_J_KkogjiDalrinIeung 0x0ef9 /* U+11F0 HANGUL JONGSEONG YESIEUNG */
+#define XK_Hangul_J_YeorinHieuh 0x0efa /* U+11F9 HANGUL JONGSEONG YEORINHIEUH */
+
+/* Korean currency symbol */
+#define XK_Korean_Won 0x0eff /*(U+20A9 WON SIGN)*/
+
+#endif /* XK_KOREAN */
+
+/*
+ * Armenian
+ */
+
+#ifdef XK_ARMENIAN
+#define XK_Armenian_ligature_ew 0x1000587 /* U+0587 ARMENIAN SMALL LIGATURE ECH YIWN */
+#define XK_Armenian_full_stop 0x1000589 /* U+0589 ARMENIAN FULL STOP */
+#define XK_Armenian_verjaket 0x1000589 /* U+0589 ARMENIAN FULL STOP */
+#define XK_Armenian_separation_mark 0x100055d /* U+055D ARMENIAN COMMA */
+#define XK_Armenian_but 0x100055d /* U+055D ARMENIAN COMMA */
+#define XK_Armenian_hyphen 0x100058a /* U+058A ARMENIAN HYPHEN */
+#define XK_Armenian_yentamna 0x100058a /* U+058A ARMENIAN HYPHEN */
+#define XK_Armenian_exclam 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */
+#define XK_Armenian_amanak 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */
+#define XK_Armenian_accent 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */
+#define XK_Armenian_shesht 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */
+#define XK_Armenian_question 0x100055e /* U+055E ARMENIAN QUESTION MARK */
+#define XK_Armenian_paruyk 0x100055e /* U+055E ARMENIAN QUESTION MARK */
+#define XK_Armenian_AYB 0x1000531 /* U+0531 ARMENIAN CAPITAL LETTER AYB */
+#define XK_Armenian_ayb 0x1000561 /* U+0561 ARMENIAN SMALL LETTER AYB */
+#define XK_Armenian_BEN 0x1000532 /* U+0532 ARMENIAN CAPITAL LETTER BEN */
+#define XK_Armenian_ben 0x1000562 /* U+0562 ARMENIAN SMALL LETTER BEN */
+#define XK_Armenian_GIM 0x1000533 /* U+0533 ARMENIAN CAPITAL LETTER GIM */
+#define XK_Armenian_gim 0x1000563 /* U+0563 ARMENIAN SMALL LETTER GIM */
+#define XK_Armenian_DA 0x1000534 /* U+0534 ARMENIAN CAPITAL LETTER DA */
+#define XK_Armenian_da 0x1000564 /* U+0564 ARMENIAN SMALL LETTER DA */
+#define XK_Armenian_YECH 0x1000535 /* U+0535 ARMENIAN CAPITAL LETTER ECH */
+#define XK_Armenian_yech 0x1000565 /* U+0565 ARMENIAN SMALL LETTER ECH */
+#define XK_Armenian_ZA 0x1000536 /* U+0536 ARMENIAN CAPITAL LETTER ZA */
+#define XK_Armenian_za 0x1000566 /* U+0566 ARMENIAN SMALL LETTER ZA */
+#define XK_Armenian_E 0x1000537 /* U+0537 ARMENIAN CAPITAL LETTER EH */
+#define XK_Armenian_e 0x1000567 /* U+0567 ARMENIAN SMALL LETTER EH */
+#define XK_Armenian_AT 0x1000538 /* U+0538 ARMENIAN CAPITAL LETTER ET */
+#define XK_Armenian_at 0x1000568 /* U+0568 ARMENIAN SMALL LETTER ET */
+#define XK_Armenian_TO 0x1000539 /* U+0539 ARMENIAN CAPITAL LETTER TO */
+#define XK_Armenian_to 0x1000569 /* U+0569 ARMENIAN SMALL LETTER TO */
+#define XK_Armenian_ZHE 0x100053a /* U+053A ARMENIAN CAPITAL LETTER ZHE */
+#define XK_Armenian_zhe 0x100056a /* U+056A ARMENIAN SMALL LETTER ZHE */
+#define XK_Armenian_INI 0x100053b /* U+053B ARMENIAN CAPITAL LETTER INI */
+#define XK_Armenian_ini 0x100056b /* U+056B ARMENIAN SMALL LETTER INI */
+#define XK_Armenian_LYUN 0x100053c /* U+053C ARMENIAN CAPITAL LETTER LIWN */
+#define XK_Armenian_lyun 0x100056c /* U+056C ARMENIAN SMALL LETTER LIWN */
+#define XK_Armenian_KHE 0x100053d /* U+053D ARMENIAN CAPITAL LETTER XEH */
+#define XK_Armenian_khe 0x100056d /* U+056D ARMENIAN SMALL LETTER XEH */
+#define XK_Armenian_TSA 0x100053e /* U+053E ARMENIAN CAPITAL LETTER CA */
+#define XK_Armenian_tsa 0x100056e /* U+056E ARMENIAN SMALL LETTER CA */
+#define XK_Armenian_KEN 0x100053f /* U+053F ARMENIAN CAPITAL LETTER KEN */
+#define XK_Armenian_ken 0x100056f /* U+056F ARMENIAN SMALL LETTER KEN */
+#define XK_Armenian_HO 0x1000540 /* U+0540 ARMENIAN CAPITAL LETTER HO */
+#define XK_Armenian_ho 0x1000570 /* U+0570 ARMENIAN SMALL LETTER HO */
+#define XK_Armenian_DZA 0x1000541 /* U+0541 ARMENIAN CAPITAL LETTER JA */
+#define XK_Armenian_dza 0x1000571 /* U+0571 ARMENIAN SMALL LETTER JA */
+#define XK_Armenian_GHAT 0x1000542 /* U+0542 ARMENIAN CAPITAL LETTER GHAD */
+#define XK_Armenian_ghat 0x1000572 /* U+0572 ARMENIAN SMALL LETTER GHAD */
+#define XK_Armenian_TCHE 0x1000543 /* U+0543 ARMENIAN CAPITAL LETTER CHEH */
+#define XK_Armenian_tche 0x1000573 /* U+0573 ARMENIAN SMALL LETTER CHEH */
+#define XK_Armenian_MEN 0x1000544 /* U+0544 ARMENIAN CAPITAL LETTER MEN */
+#define XK_Armenian_men 0x1000574 /* U+0574 ARMENIAN SMALL LETTER MEN */
+#define XK_Armenian_HI 0x1000545 /* U+0545 ARMENIAN CAPITAL LETTER YI */
+#define XK_Armenian_hi 0x1000575 /* U+0575 ARMENIAN SMALL LETTER YI */
+#define XK_Armenian_NU 0x1000546 /* U+0546 ARMENIAN CAPITAL LETTER NOW */
+#define XK_Armenian_nu 0x1000576 /* U+0576 ARMENIAN SMALL LETTER NOW */
+#define XK_Armenian_SHA 0x1000547 /* U+0547 ARMENIAN CAPITAL LETTER SHA */
+#define XK_Armenian_sha 0x1000577 /* U+0577 ARMENIAN SMALL LETTER SHA */
+#define XK_Armenian_VO 0x1000548 /* U+0548 ARMENIAN CAPITAL LETTER VO */
+#define XK_Armenian_vo 0x1000578 /* U+0578 ARMENIAN SMALL LETTER VO */
+#define XK_Armenian_CHA 0x1000549 /* U+0549 ARMENIAN CAPITAL LETTER CHA */
+#define XK_Armenian_cha 0x1000579 /* U+0579 ARMENIAN SMALL LETTER CHA */
+#define XK_Armenian_PE 0x100054a /* U+054A ARMENIAN CAPITAL LETTER PEH */
+#define XK_Armenian_pe 0x100057a /* U+057A ARMENIAN SMALL LETTER PEH */
+#define XK_Armenian_JE 0x100054b /* U+054B ARMENIAN CAPITAL LETTER JHEH */
+#define XK_Armenian_je 0x100057b /* U+057B ARMENIAN SMALL LETTER JHEH */
+#define XK_Armenian_RA 0x100054c /* U+054C ARMENIAN CAPITAL LETTER RA */
+#define XK_Armenian_ra 0x100057c /* U+057C ARMENIAN SMALL LETTER RA */
+#define XK_Armenian_SE 0x100054d /* U+054D ARMENIAN CAPITAL LETTER SEH */
+#define XK_Armenian_se 0x100057d /* U+057D ARMENIAN SMALL LETTER SEH */
+#define XK_Armenian_VEV 0x100054e /* U+054E ARMENIAN CAPITAL LETTER VEW */
+#define XK_Armenian_vev 0x100057e /* U+057E ARMENIAN SMALL LETTER VEW */
+#define XK_Armenian_TYUN 0x100054f /* U+054F ARMENIAN CAPITAL LETTER TIWN */
+#define XK_Armenian_tyun 0x100057f /* U+057F ARMENIAN SMALL LETTER TIWN */
+#define XK_Armenian_RE 0x1000550 /* U+0550 ARMENIAN CAPITAL LETTER REH */
+#define XK_Armenian_re 0x1000580 /* U+0580 ARMENIAN SMALL LETTER REH */
+#define XK_Armenian_TSO 0x1000551 /* U+0551 ARMENIAN CAPITAL LETTER CO */
+#define XK_Armenian_tso 0x1000581 /* U+0581 ARMENIAN SMALL LETTER CO */
+#define XK_Armenian_VYUN 0x1000552 /* U+0552 ARMENIAN CAPITAL LETTER YIWN */
+#define XK_Armenian_vyun 0x1000582 /* U+0582 ARMENIAN SMALL LETTER YIWN */
+#define XK_Armenian_PYUR 0x1000553 /* U+0553 ARMENIAN CAPITAL LETTER PIWR */
+#define XK_Armenian_pyur 0x1000583 /* U+0583 ARMENIAN SMALL LETTER PIWR */
+#define XK_Armenian_KE 0x1000554 /* U+0554 ARMENIAN CAPITAL LETTER KEH */
+#define XK_Armenian_ke 0x1000584 /* U+0584 ARMENIAN SMALL LETTER KEH */
+#define XK_Armenian_O 0x1000555 /* U+0555 ARMENIAN CAPITAL LETTER OH */
+#define XK_Armenian_o 0x1000585 /* U+0585 ARMENIAN SMALL LETTER OH */
+#define XK_Armenian_FE 0x1000556 /* U+0556 ARMENIAN CAPITAL LETTER FEH */
+#define XK_Armenian_fe 0x1000586 /* U+0586 ARMENIAN SMALL LETTER FEH */
+#define XK_Armenian_apostrophe 0x100055a /* U+055A ARMENIAN APOSTROPHE */
+#endif /* XK_ARMENIAN */
+
+/*
+ * Georgian
+ */
+
+#ifdef XK_GEORGIAN
+#define XK_Georgian_an 0x10010d0 /* U+10D0 GEORGIAN LETTER AN */
+#define XK_Georgian_ban 0x10010d1 /* U+10D1 GEORGIAN LETTER BAN */
+#define XK_Georgian_gan 0x10010d2 /* U+10D2 GEORGIAN LETTER GAN */
+#define XK_Georgian_don 0x10010d3 /* U+10D3 GEORGIAN LETTER DON */
+#define XK_Georgian_en 0x10010d4 /* U+10D4 GEORGIAN LETTER EN */
+#define XK_Georgian_vin 0x10010d5 /* U+10D5 GEORGIAN LETTER VIN */
+#define XK_Georgian_zen 0x10010d6 /* U+10D6 GEORGIAN LETTER ZEN */
+#define XK_Georgian_tan 0x10010d7 /* U+10D7 GEORGIAN LETTER TAN */
+#define XK_Georgian_in 0x10010d8 /* U+10D8 GEORGIAN LETTER IN */
+#define XK_Georgian_kan 0x10010d9 /* U+10D9 GEORGIAN LETTER KAN */
+#define XK_Georgian_las 0x10010da /* U+10DA GEORGIAN LETTER LAS */
+#define XK_Georgian_man 0x10010db /* U+10DB GEORGIAN LETTER MAN */
+#define XK_Georgian_nar 0x10010dc /* U+10DC GEORGIAN LETTER NAR */
+#define XK_Georgian_on 0x10010dd /* U+10DD GEORGIAN LETTER ON */
+#define XK_Georgian_par 0x10010de /* U+10DE GEORGIAN LETTER PAR */
+#define XK_Georgian_zhar 0x10010df /* U+10DF GEORGIAN LETTER ZHAR */
+#define XK_Georgian_rae 0x10010e0 /* U+10E0 GEORGIAN LETTER RAE */
+#define XK_Georgian_san 0x10010e1 /* U+10E1 GEORGIAN LETTER SAN */
+#define XK_Georgian_tar 0x10010e2 /* U+10E2 GEORGIAN LETTER TAR */
+#define XK_Georgian_un 0x10010e3 /* U+10E3 GEORGIAN LETTER UN */
+#define XK_Georgian_phar 0x10010e4 /* U+10E4 GEORGIAN LETTER PHAR */
+#define XK_Georgian_khar 0x10010e5 /* U+10E5 GEORGIAN LETTER KHAR */
+#define XK_Georgian_ghan 0x10010e6 /* U+10E6 GEORGIAN LETTER GHAN */
+#define XK_Georgian_qar 0x10010e7 /* U+10E7 GEORGIAN LETTER QAR */
+#define XK_Georgian_shin 0x10010e8 /* U+10E8 GEORGIAN LETTER SHIN */
+#define XK_Georgian_chin 0x10010e9 /* U+10E9 GEORGIAN LETTER CHIN */
+#define XK_Georgian_can 0x10010ea /* U+10EA GEORGIAN LETTER CAN */
+#define XK_Georgian_jil 0x10010eb /* U+10EB GEORGIAN LETTER JIL */
+#define XK_Georgian_cil 0x10010ec /* U+10EC GEORGIAN LETTER CIL */
+#define XK_Georgian_char 0x10010ed /* U+10ED GEORGIAN LETTER CHAR */
+#define XK_Georgian_xan 0x10010ee /* U+10EE GEORGIAN LETTER XAN */
+#define XK_Georgian_jhan 0x10010ef /* U+10EF GEORGIAN LETTER JHAN */
+#define XK_Georgian_hae 0x10010f0 /* U+10F0 GEORGIAN LETTER HAE */
+#define XK_Georgian_he 0x10010f1 /* U+10F1 GEORGIAN LETTER HE */
+#define XK_Georgian_hie 0x10010f2 /* U+10F2 GEORGIAN LETTER HIE */
+#define XK_Georgian_we 0x10010f3 /* U+10F3 GEORGIAN LETTER WE */
+#define XK_Georgian_har 0x10010f4 /* U+10F4 GEORGIAN LETTER HAR */
+#define XK_Georgian_hoe 0x10010f5 /* U+10F5 GEORGIAN LETTER HOE */
+#define XK_Georgian_fi 0x10010f6 /* U+10F6 GEORGIAN LETTER FI */
+#endif /* XK_GEORGIAN */
+
+/*
+ * Azeri (and other Turkic or Caucasian languages)
+ */
+
+#ifdef XK_CAUCASUS
+/* latin */
+#define XK_Xabovedot 0x1001e8a /* U+1E8A LATIN CAPITAL LETTER X WITH DOT ABOVE */
+#define XK_Ibreve 0x100012c /* U+012C LATIN CAPITAL LETTER I WITH BREVE */
+#define XK_Zstroke 0x10001b5 /* U+01B5 LATIN CAPITAL LETTER Z WITH STROKE */
+#define XK_Gcaron 0x10001e6 /* U+01E6 LATIN CAPITAL LETTER G WITH CARON */
+#define XK_Ocaron 0x10001d1 /* U+01D1 LATIN CAPITAL LETTER O WITH CARON */
+#define XK_Obarred 0x100019f /* U+019F LATIN CAPITAL LETTER O WITH MIDDLE TILDE */
+#define XK_xabovedot 0x1001e8b /* U+1E8B LATIN SMALL LETTER X WITH DOT ABOVE */
+#define XK_ibreve 0x100012d /* U+012D LATIN SMALL LETTER I WITH BREVE */
+#define XK_zstroke 0x10001b6 /* U+01B6 LATIN SMALL LETTER Z WITH STROKE */
+#define XK_gcaron 0x10001e7 /* U+01E7 LATIN SMALL LETTER G WITH CARON */
+#define XK_ocaron 0x10001d2 /* U+01D2 LATIN SMALL LETTER O WITH CARON */
+#define XK_obarred 0x1000275 /* U+0275 LATIN SMALL LETTER BARRED O */
+#define XK_SCHWA 0x100018f /* U+018F LATIN CAPITAL LETTER SCHWA */
+#define XK_schwa 0x1000259 /* U+0259 LATIN SMALL LETTER SCHWA */
+#define XK_EZH 0x10001b7 /* U+01B7 LATIN CAPITAL LETTER EZH */
+#define XK_ezh 0x1000292 /* U+0292 LATIN SMALL LETTER EZH */
+/* those are not really Caucasus */
+/* For Inupiak */
+#define XK_Lbelowdot 0x1001e36 /* U+1E36 LATIN CAPITAL LETTER L WITH DOT BELOW */
+#define XK_lbelowdot 0x1001e37 /* U+1E37 LATIN SMALL LETTER L WITH DOT BELOW */
+#endif /* XK_CAUCASUS */
+
+/*
+ * Vietnamese
+ */
+
+#ifdef XK_VIETNAMESE
+#define XK_Abelowdot 0x1001ea0 /* U+1EA0 LATIN CAPITAL LETTER A WITH DOT BELOW */
+#define XK_abelowdot 0x1001ea1 /* U+1EA1 LATIN SMALL LETTER A WITH DOT BELOW */
+#define XK_Ahook 0x1001ea2 /* U+1EA2 LATIN CAPITAL LETTER A WITH HOOK ABOVE */
+#define XK_ahook 0x1001ea3 /* U+1EA3 LATIN SMALL LETTER A WITH HOOK ABOVE */
+#define XK_Acircumflexacute 0x1001ea4 /* U+1EA4 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE */
+#define XK_acircumflexacute 0x1001ea5 /* U+1EA5 LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE */
+#define XK_Acircumflexgrave 0x1001ea6 /* U+1EA6 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE */
+#define XK_acircumflexgrave 0x1001ea7 /* U+1EA7 LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE */
+#define XK_Acircumflexhook 0x1001ea8 /* U+1EA8 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XK_acircumflexhook 0x1001ea9 /* U+1EA9 LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XK_Acircumflextilde 0x1001eaa /* U+1EAA LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE */
+#define XK_acircumflextilde 0x1001eab /* U+1EAB LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE */
+#define XK_Acircumflexbelowdot 0x1001eac /* U+1EAC LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW */
+#define XK_acircumflexbelowdot 0x1001ead /* U+1EAD LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW */
+#define XK_Abreveacute 0x1001eae /* U+1EAE LATIN CAPITAL LETTER A WITH BREVE AND ACUTE */
+#define XK_abreveacute 0x1001eaf /* U+1EAF LATIN SMALL LETTER A WITH BREVE AND ACUTE */
+#define XK_Abrevegrave 0x1001eb0 /* U+1EB0 LATIN CAPITAL LETTER A WITH BREVE AND GRAVE */
+#define XK_abrevegrave 0x1001eb1 /* U+1EB1 LATIN SMALL LETTER A WITH BREVE AND GRAVE */
+#define XK_Abrevehook 0x1001eb2 /* U+1EB2 LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE */
+#define XK_abrevehook 0x1001eb3 /* U+1EB3 LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE */
+#define XK_Abrevetilde 0x1001eb4 /* U+1EB4 LATIN CAPITAL LETTER A WITH BREVE AND TILDE */
+#define XK_abrevetilde 0x1001eb5 /* U+1EB5 LATIN SMALL LETTER A WITH BREVE AND TILDE */
+#define XK_Abrevebelowdot 0x1001eb6 /* U+1EB6 LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW */
+#define XK_abrevebelowdot 0x1001eb7 /* U+1EB7 LATIN SMALL LETTER A WITH BREVE AND DOT BELOW */
+#define XK_Ebelowdot 0x1001eb8 /* U+1EB8 LATIN CAPITAL LETTER E WITH DOT BELOW */
+#define XK_ebelowdot 0x1001eb9 /* U+1EB9 LATIN SMALL LETTER E WITH DOT BELOW */
+#define XK_Ehook 0x1001eba /* U+1EBA LATIN CAPITAL LETTER E WITH HOOK ABOVE */
+#define XK_ehook 0x1001ebb /* U+1EBB LATIN SMALL LETTER E WITH HOOK ABOVE */
+#define XK_Etilde 0x1001ebc /* U+1EBC LATIN CAPITAL LETTER E WITH TILDE */
+#define XK_etilde 0x1001ebd /* U+1EBD LATIN SMALL LETTER E WITH TILDE */
+#define XK_Ecircumflexacute 0x1001ebe /* U+1EBE LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE */
+#define XK_ecircumflexacute 0x1001ebf /* U+1EBF LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE */
+#define XK_Ecircumflexgrave 0x1001ec0 /* U+1EC0 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE */
+#define XK_ecircumflexgrave 0x1001ec1 /* U+1EC1 LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE */
+#define XK_Ecircumflexhook 0x1001ec2 /* U+1EC2 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XK_ecircumflexhook 0x1001ec3 /* U+1EC3 LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XK_Ecircumflextilde 0x1001ec4 /* U+1EC4 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE */
+#define XK_ecircumflextilde 0x1001ec5 /* U+1EC5 LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE */
+#define XK_Ecircumflexbelowdot 0x1001ec6 /* U+1EC6 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW */
+#define XK_ecircumflexbelowdot 0x1001ec7 /* U+1EC7 LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW */
+#define XK_Ihook 0x1001ec8 /* U+1EC8 LATIN CAPITAL LETTER I WITH HOOK ABOVE */
+#define XK_ihook 0x1001ec9 /* U+1EC9 LATIN SMALL LETTER I WITH HOOK ABOVE */
+#define XK_Ibelowdot 0x1001eca /* U+1ECA LATIN CAPITAL LETTER I WITH DOT BELOW */
+#define XK_ibelowdot 0x1001ecb /* U+1ECB LATIN SMALL LETTER I WITH DOT BELOW */
+#define XK_Obelowdot 0x1001ecc /* U+1ECC LATIN CAPITAL LETTER O WITH DOT BELOW */
+#define XK_obelowdot 0x1001ecd /* U+1ECD LATIN SMALL LETTER O WITH DOT BELOW */
+#define XK_Ohook 0x1001ece /* U+1ECE LATIN CAPITAL LETTER O WITH HOOK ABOVE */
+#define XK_ohook 0x1001ecf /* U+1ECF LATIN SMALL LETTER O WITH HOOK ABOVE */
+#define XK_Ocircumflexacute 0x1001ed0 /* U+1ED0 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE */
+#define XK_ocircumflexacute 0x1001ed1 /* U+1ED1 LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE */
+#define XK_Ocircumflexgrave 0x1001ed2 /* U+1ED2 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE */
+#define XK_ocircumflexgrave 0x1001ed3 /* U+1ED3 LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE */
+#define XK_Ocircumflexhook 0x1001ed4 /* U+1ED4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XK_ocircumflexhook 0x1001ed5 /* U+1ED5 LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XK_Ocircumflextilde 0x1001ed6 /* U+1ED6 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE */
+#define XK_ocircumflextilde 0x1001ed7 /* U+1ED7 LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE */
+#define XK_Ocircumflexbelowdot 0x1001ed8 /* U+1ED8 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW */
+#define XK_ocircumflexbelowdot 0x1001ed9 /* U+1ED9 LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW */
+#define XK_Ohornacute 0x1001eda /* U+1EDA LATIN CAPITAL LETTER O WITH HORN AND ACUTE */
+#define XK_ohornacute 0x1001edb /* U+1EDB LATIN SMALL LETTER O WITH HORN AND ACUTE */
+#define XK_Ohorngrave 0x1001edc /* U+1EDC LATIN CAPITAL LETTER O WITH HORN AND GRAVE */
+#define XK_ohorngrave 0x1001edd /* U+1EDD LATIN SMALL LETTER O WITH HORN AND GRAVE */
+#define XK_Ohornhook 0x1001ede /* U+1EDE LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE */
+#define XK_ohornhook 0x1001edf /* U+1EDF LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE */
+#define XK_Ohorntilde 0x1001ee0 /* U+1EE0 LATIN CAPITAL LETTER O WITH HORN AND TILDE */
+#define XK_ohorntilde 0x1001ee1 /* U+1EE1 LATIN SMALL LETTER O WITH HORN AND TILDE */
+#define XK_Ohornbelowdot 0x1001ee2 /* U+1EE2 LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW */
+#define XK_ohornbelowdot 0x1001ee3 /* U+1EE3 LATIN SMALL LETTER O WITH HORN AND DOT BELOW */
+#define XK_Ubelowdot 0x1001ee4 /* U+1EE4 LATIN CAPITAL LETTER U WITH DOT BELOW */
+#define XK_ubelowdot 0x1001ee5 /* U+1EE5 LATIN SMALL LETTER U WITH DOT BELOW */
+#define XK_Uhook 0x1001ee6 /* U+1EE6 LATIN CAPITAL LETTER U WITH HOOK ABOVE */
+#define XK_uhook 0x1001ee7 /* U+1EE7 LATIN SMALL LETTER U WITH HOOK ABOVE */
+#define XK_Uhornacute 0x1001ee8 /* U+1EE8 LATIN CAPITAL LETTER U WITH HORN AND ACUTE */
+#define XK_uhornacute 0x1001ee9 /* U+1EE9 LATIN SMALL LETTER U WITH HORN AND ACUTE */
+#define XK_Uhorngrave 0x1001eea /* U+1EEA LATIN CAPITAL LETTER U WITH HORN AND GRAVE */
+#define XK_uhorngrave 0x1001eeb /* U+1EEB LATIN SMALL LETTER U WITH HORN AND GRAVE */
+#define XK_Uhornhook 0x1001eec /* U+1EEC LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE */
+#define XK_uhornhook 0x1001eed /* U+1EED LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE */
+#define XK_Uhorntilde 0x1001eee /* U+1EEE LATIN CAPITAL LETTER U WITH HORN AND TILDE */
+#define XK_uhorntilde 0x1001eef /* U+1EEF LATIN SMALL LETTER U WITH HORN AND TILDE */
+#define XK_Uhornbelowdot 0x1001ef0 /* U+1EF0 LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW */
+#define XK_uhornbelowdot 0x1001ef1 /* U+1EF1 LATIN SMALL LETTER U WITH HORN AND DOT BELOW */
+#define XK_Ybelowdot 0x1001ef4 /* U+1EF4 LATIN CAPITAL LETTER Y WITH DOT BELOW */
+#define XK_ybelowdot 0x1001ef5 /* U+1EF5 LATIN SMALL LETTER Y WITH DOT BELOW */
+#define XK_Yhook 0x1001ef6 /* U+1EF6 LATIN CAPITAL LETTER Y WITH HOOK ABOVE */
+#define XK_yhook 0x1001ef7 /* U+1EF7 LATIN SMALL LETTER Y WITH HOOK ABOVE */
+#define XK_Ytilde 0x1001ef8 /* U+1EF8 LATIN CAPITAL LETTER Y WITH TILDE */
+#define XK_ytilde 0x1001ef9 /* U+1EF9 LATIN SMALL LETTER Y WITH TILDE */
+#define XK_Ohorn 0x10001a0 /* U+01A0 LATIN CAPITAL LETTER O WITH HORN */
+#define XK_ohorn 0x10001a1 /* U+01A1 LATIN SMALL LETTER O WITH HORN */
+#define XK_Uhorn 0x10001af /* U+01AF LATIN CAPITAL LETTER U WITH HORN */
+#define XK_uhorn 0x10001b0 /* U+01B0 LATIN SMALL LETTER U WITH HORN */
+#define XK_combining_tilde 0x1000303 /* U+0303 COMBINING TILDE */
+#define XK_combining_grave 0x1000300 /* U+0300 COMBINING GRAVE ACCENT */
+#define XK_combining_acute 0x1000301 /* U+0301 COMBINING ACUTE ACCENT */
+#define XK_combining_hook 0x1000309 /* U+0309 COMBINING HOOK ABOVE */
+#define XK_combining_belowdot 0x1000323 /* U+0323 COMBINING DOT BELOW */
+
+#endif /* XK_VIETNAMESE */
+
+#ifdef XK_CURRENCY
+#define XK_EcuSign 0x10020a0 /* U+20A0 EURO-CURRENCY SIGN */
+#define XK_ColonSign 0x10020a1 /* U+20A1 COLON SIGN */
+#define XK_CruzeiroSign 0x10020a2 /* U+20A2 CRUZEIRO SIGN */
+#define XK_FFrancSign 0x10020a3 /* U+20A3 FRENCH FRANC SIGN */
+#define XK_LiraSign 0x10020a4 /* U+20A4 LIRA SIGN */
+#define XK_MillSign 0x10020a5 /* U+20A5 MILL SIGN */
+#define XK_NairaSign 0x10020a6 /* U+20A6 NAIRA SIGN */
+#define XK_PesetaSign 0x10020a7 /* U+20A7 PESETA SIGN */
+#define XK_RupeeSign 0x10020a8 /* U+20A8 RUPEE SIGN */
+#define XK_WonSign 0x10020a9 /* U+20A9 WON SIGN */
+#define XK_NewSheqelSign 0x10020aa /* U+20AA NEW SHEQEL SIGN */
+#define XK_DongSign 0x10020ab /* U+20AB DONG SIGN */
+#define XK_EuroSign 0x20ac /* U+20AC EURO SIGN */
+#endif /* XK_CURRENCY */
+
+#ifdef XK_MATHEMATICAL
+/* one, two and three are defined above. */
+#define XK_zerosuperior 0x1002070 /* U+2070 SUPERSCRIPT ZERO */
+#define XK_foursuperior 0x1002074 /* U+2074 SUPERSCRIPT FOUR */
+#define XK_fivesuperior 0x1002075 /* U+2075 SUPERSCRIPT FIVE */
+#define XK_sixsuperior 0x1002076 /* U+2076 SUPERSCRIPT SIX */
+#define XK_sevensuperior 0x1002077 /* U+2077 SUPERSCRIPT SEVEN */
+#define XK_eightsuperior 0x1002078 /* U+2078 SUPERSCRIPT EIGHT */
+#define XK_ninesuperior 0x1002079 /* U+2079 SUPERSCRIPT NINE */
+#define XK_zerosubscript 0x1002080 /* U+2080 SUBSCRIPT ZERO */
+#define XK_onesubscript 0x1002081 /* U+2081 SUBSCRIPT ONE */
+#define XK_twosubscript 0x1002082 /* U+2082 SUBSCRIPT TWO */
+#define XK_threesubscript 0x1002083 /* U+2083 SUBSCRIPT THREE */
+#define XK_foursubscript 0x1002084 /* U+2084 SUBSCRIPT FOUR */
+#define XK_fivesubscript 0x1002085 /* U+2085 SUBSCRIPT FIVE */
+#define XK_sixsubscript 0x1002086 /* U+2086 SUBSCRIPT SIX */
+#define XK_sevensubscript 0x1002087 /* U+2087 SUBSCRIPT SEVEN */
+#define XK_eightsubscript 0x1002088 /* U+2088 SUBSCRIPT EIGHT */
+#define XK_ninesubscript 0x1002089 /* U+2089 SUBSCRIPT NINE */
+#define XK_partdifferential 0x1002202 /* U+2202 PARTIAL DIFFERENTIAL */
+#define XK_emptyset 0x1002205 /* U+2205 NULL SET */
+#define XK_elementof 0x1002208 /* U+2208 ELEMENT OF */
+#define XK_notelementof 0x1002209 /* U+2209 NOT AN ELEMENT OF */
+#define XK_containsas 0x100220B /* U+220B CONTAINS AS MEMBER */
+#define XK_squareroot 0x100221A /* U+221A SQUARE ROOT */
+#define XK_cuberoot 0x100221B /* U+221B CUBE ROOT */
+#define XK_fourthroot 0x100221C /* U+221C FOURTH ROOT */
+#define XK_dintegral 0x100222C /* U+222C DOUBLE INTEGRAL */
+#define XK_tintegral 0x100222D /* U+222D TRIPLE INTEGRAL */
+#define XK_because 0x1002235 /* U+2235 BECAUSE */
+#define XK_approxeq 0x1002248 /*(U+2248 ALMOST EQUAL TO)*/
+#define XK_notapproxeq 0x1002247 /*(U+2247 NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO)*/
+#define XK_notidentical 0x1002262 /* U+2262 NOT IDENTICAL TO */
+#define XK_stricteq 0x1002263 /* U+2263 STRICTLY EQUIVALENT TO */
+#endif /* XK_MATHEMATICAL */
+
+#ifdef XK_BRAILLE
+#define XK_braille_dot_1 0xfff1
+#define XK_braille_dot_2 0xfff2
+#define XK_braille_dot_3 0xfff3
+#define XK_braille_dot_4 0xfff4
+#define XK_braille_dot_5 0xfff5
+#define XK_braille_dot_6 0xfff6
+#define XK_braille_dot_7 0xfff7
+#define XK_braille_dot_8 0xfff8
+#define XK_braille_dot_9 0xfff9
+#define XK_braille_dot_10 0xfffa
+#define XK_braille_blank 0x1002800 /* U+2800 BRAILLE PATTERN BLANK */
+#define XK_braille_dots_1 0x1002801 /* U+2801 BRAILLE PATTERN DOTS-1 */
+#define XK_braille_dots_2 0x1002802 /* U+2802 BRAILLE PATTERN DOTS-2 */
+#define XK_braille_dots_12 0x1002803 /* U+2803 BRAILLE PATTERN DOTS-12 */
+#define XK_braille_dots_3 0x1002804 /* U+2804 BRAILLE PATTERN DOTS-3 */
+#define XK_braille_dots_13 0x1002805 /* U+2805 BRAILLE PATTERN DOTS-13 */
+#define XK_braille_dots_23 0x1002806 /* U+2806 BRAILLE PATTERN DOTS-23 */
+#define XK_braille_dots_123 0x1002807 /* U+2807 BRAILLE PATTERN DOTS-123 */
+#define XK_braille_dots_4 0x1002808 /* U+2808 BRAILLE PATTERN DOTS-4 */
+#define XK_braille_dots_14 0x1002809 /* U+2809 BRAILLE PATTERN DOTS-14 */
+#define XK_braille_dots_24 0x100280a /* U+280a BRAILLE PATTERN DOTS-24 */
+#define XK_braille_dots_124 0x100280b /* U+280b BRAILLE PATTERN DOTS-124 */
+#define XK_braille_dots_34 0x100280c /* U+280c BRAILLE PATTERN DOTS-34 */
+#define XK_braille_dots_134 0x100280d /* U+280d BRAILLE PATTERN DOTS-134 */
+#define XK_braille_dots_234 0x100280e /* U+280e BRAILLE PATTERN DOTS-234 */
+#define XK_braille_dots_1234 0x100280f /* U+280f BRAILLE PATTERN DOTS-1234 */
+#define XK_braille_dots_5 0x1002810 /* U+2810 BRAILLE PATTERN DOTS-5 */
+#define XK_braille_dots_15 0x1002811 /* U+2811 BRAILLE PATTERN DOTS-15 */
+#define XK_braille_dots_25 0x1002812 /* U+2812 BRAILLE PATTERN DOTS-25 */
+#define XK_braille_dots_125 0x1002813 /* U+2813 BRAILLE PATTERN DOTS-125 */
+#define XK_braille_dots_35 0x1002814 /* U+2814 BRAILLE PATTERN DOTS-35 */
+#define XK_braille_dots_135 0x1002815 /* U+2815 BRAILLE PATTERN DOTS-135 */
+#define XK_braille_dots_235 0x1002816 /* U+2816 BRAILLE PATTERN DOTS-235 */
+#define XK_braille_dots_1235 0x1002817 /* U+2817 BRAILLE PATTERN DOTS-1235 */
+#define XK_braille_dots_45 0x1002818 /* U+2818 BRAILLE PATTERN DOTS-45 */
+#define XK_braille_dots_145 0x1002819 /* U+2819 BRAILLE PATTERN DOTS-145 */
+#define XK_braille_dots_245 0x100281a /* U+281a BRAILLE PATTERN DOTS-245 */
+#define XK_braille_dots_1245 0x100281b /* U+281b BRAILLE PATTERN DOTS-1245 */
+#define XK_braille_dots_345 0x100281c /* U+281c BRAILLE PATTERN DOTS-345 */
+#define XK_braille_dots_1345 0x100281d /* U+281d BRAILLE PATTERN DOTS-1345 */
+#define XK_braille_dots_2345 0x100281e /* U+281e BRAILLE PATTERN DOTS-2345 */
+#define XK_braille_dots_12345 0x100281f /* U+281f BRAILLE PATTERN DOTS-12345 */
+#define XK_braille_dots_6 0x1002820 /* U+2820 BRAILLE PATTERN DOTS-6 */
+#define XK_braille_dots_16 0x1002821 /* U+2821 BRAILLE PATTERN DOTS-16 */
+#define XK_braille_dots_26 0x1002822 /* U+2822 BRAILLE PATTERN DOTS-26 */
+#define XK_braille_dots_126 0x1002823 /* U+2823 BRAILLE PATTERN DOTS-126 */
+#define XK_braille_dots_36 0x1002824 /* U+2824 BRAILLE PATTERN DOTS-36 */
+#define XK_braille_dots_136 0x1002825 /* U+2825 BRAILLE PATTERN DOTS-136 */
+#define XK_braille_dots_236 0x1002826 /* U+2826 BRAILLE PATTERN DOTS-236 */
+#define XK_braille_dots_1236 0x1002827 /* U+2827 BRAILLE PATTERN DOTS-1236 */
+#define XK_braille_dots_46 0x1002828 /* U+2828 BRAILLE PATTERN DOTS-46 */
+#define XK_braille_dots_146 0x1002829 /* U+2829 BRAILLE PATTERN DOTS-146 */
+#define XK_braille_dots_246 0x100282a /* U+282a BRAILLE PATTERN DOTS-246 */
+#define XK_braille_dots_1246 0x100282b /* U+282b BRAILLE PATTERN DOTS-1246 */
+#define XK_braille_dots_346 0x100282c /* U+282c BRAILLE PATTERN DOTS-346 */
+#define XK_braille_dots_1346 0x100282d /* U+282d BRAILLE PATTERN DOTS-1346 */
+#define XK_braille_dots_2346 0x100282e /* U+282e BRAILLE PATTERN DOTS-2346 */
+#define XK_braille_dots_12346 0x100282f /* U+282f BRAILLE PATTERN DOTS-12346 */
+#define XK_braille_dots_56 0x1002830 /* U+2830 BRAILLE PATTERN DOTS-56 */
+#define XK_braille_dots_156 0x1002831 /* U+2831 BRAILLE PATTERN DOTS-156 */
+#define XK_braille_dots_256 0x1002832 /* U+2832 BRAILLE PATTERN DOTS-256 */
+#define XK_braille_dots_1256 0x1002833 /* U+2833 BRAILLE PATTERN DOTS-1256 */
+#define XK_braille_dots_356 0x1002834 /* U+2834 BRAILLE PATTERN DOTS-356 */
+#define XK_braille_dots_1356 0x1002835 /* U+2835 BRAILLE PATTERN DOTS-1356 */
+#define XK_braille_dots_2356 0x1002836 /* U+2836 BRAILLE PATTERN DOTS-2356 */
+#define XK_braille_dots_12356 0x1002837 /* U+2837 BRAILLE PATTERN DOTS-12356 */
+#define XK_braille_dots_456 0x1002838 /* U+2838 BRAILLE PATTERN DOTS-456 */
+#define XK_braille_dots_1456 0x1002839 /* U+2839 BRAILLE PATTERN DOTS-1456 */
+#define XK_braille_dots_2456 0x100283a /* U+283a BRAILLE PATTERN DOTS-2456 */
+#define XK_braille_dots_12456 0x100283b /* U+283b BRAILLE PATTERN DOTS-12456 */
+#define XK_braille_dots_3456 0x100283c /* U+283c BRAILLE PATTERN DOTS-3456 */
+#define XK_braille_dots_13456 0x100283d /* U+283d BRAILLE PATTERN DOTS-13456 */
+#define XK_braille_dots_23456 0x100283e /* U+283e BRAILLE PATTERN DOTS-23456 */
+#define XK_braille_dots_123456 0x100283f /* U+283f BRAILLE PATTERN DOTS-123456 */
+#define XK_braille_dots_7 0x1002840 /* U+2840 BRAILLE PATTERN DOTS-7 */
+#define XK_braille_dots_17 0x1002841 /* U+2841 BRAILLE PATTERN DOTS-17 */
+#define XK_braille_dots_27 0x1002842 /* U+2842 BRAILLE PATTERN DOTS-27 */
+#define XK_braille_dots_127 0x1002843 /* U+2843 BRAILLE PATTERN DOTS-127 */
+#define XK_braille_dots_37 0x1002844 /* U+2844 BRAILLE PATTERN DOTS-37 */
+#define XK_braille_dots_137 0x1002845 /* U+2845 BRAILLE PATTERN DOTS-137 */
+#define XK_braille_dots_237 0x1002846 /* U+2846 BRAILLE PATTERN DOTS-237 */
+#define XK_braille_dots_1237 0x1002847 /* U+2847 BRAILLE PATTERN DOTS-1237 */
+#define XK_braille_dots_47 0x1002848 /* U+2848 BRAILLE PATTERN DOTS-47 */
+#define XK_braille_dots_147 0x1002849 /* U+2849 BRAILLE PATTERN DOTS-147 */
+#define XK_braille_dots_247 0x100284a /* U+284a BRAILLE PATTERN DOTS-247 */
+#define XK_braille_dots_1247 0x100284b /* U+284b BRAILLE PATTERN DOTS-1247 */
+#define XK_braille_dots_347 0x100284c /* U+284c BRAILLE PATTERN DOTS-347 */
+#define XK_braille_dots_1347 0x100284d /* U+284d BRAILLE PATTERN DOTS-1347 */
+#define XK_braille_dots_2347 0x100284e /* U+284e BRAILLE PATTERN DOTS-2347 */
+#define XK_braille_dots_12347 0x100284f /* U+284f BRAILLE PATTERN DOTS-12347 */
+#define XK_braille_dots_57 0x1002850 /* U+2850 BRAILLE PATTERN DOTS-57 */
+#define XK_braille_dots_157 0x1002851 /* U+2851 BRAILLE PATTERN DOTS-157 */
+#define XK_braille_dots_257 0x1002852 /* U+2852 BRAILLE PATTERN DOTS-257 */
+#define XK_braille_dots_1257 0x1002853 /* U+2853 BRAILLE PATTERN DOTS-1257 */
+#define XK_braille_dots_357 0x1002854 /* U+2854 BRAILLE PATTERN DOTS-357 */
+#define XK_braille_dots_1357 0x1002855 /* U+2855 BRAILLE PATTERN DOTS-1357 */
+#define XK_braille_dots_2357 0x1002856 /* U+2856 BRAILLE PATTERN DOTS-2357 */
+#define XK_braille_dots_12357 0x1002857 /* U+2857 BRAILLE PATTERN DOTS-12357 */
+#define XK_braille_dots_457 0x1002858 /* U+2858 BRAILLE PATTERN DOTS-457 */
+#define XK_braille_dots_1457 0x1002859 /* U+2859 BRAILLE PATTERN DOTS-1457 */
+#define XK_braille_dots_2457 0x100285a /* U+285a BRAILLE PATTERN DOTS-2457 */
+#define XK_braille_dots_12457 0x100285b /* U+285b BRAILLE PATTERN DOTS-12457 */
+#define XK_braille_dots_3457 0x100285c /* U+285c BRAILLE PATTERN DOTS-3457 */
+#define XK_braille_dots_13457 0x100285d /* U+285d BRAILLE PATTERN DOTS-13457 */
+#define XK_braille_dots_23457 0x100285e /* U+285e BRAILLE PATTERN DOTS-23457 */
+#define XK_braille_dots_123457 0x100285f /* U+285f BRAILLE PATTERN DOTS-123457 */
+#define XK_braille_dots_67 0x1002860 /* U+2860 BRAILLE PATTERN DOTS-67 */
+#define XK_braille_dots_167 0x1002861 /* U+2861 BRAILLE PATTERN DOTS-167 */
+#define XK_braille_dots_267 0x1002862 /* U+2862 BRAILLE PATTERN DOTS-267 */
+#define XK_braille_dots_1267 0x1002863 /* U+2863 BRAILLE PATTERN DOTS-1267 */
+#define XK_braille_dots_367 0x1002864 /* U+2864 BRAILLE PATTERN DOTS-367 */
+#define XK_braille_dots_1367 0x1002865 /* U+2865 BRAILLE PATTERN DOTS-1367 */
+#define XK_braille_dots_2367 0x1002866 /* U+2866 BRAILLE PATTERN DOTS-2367 */
+#define XK_braille_dots_12367 0x1002867 /* U+2867 BRAILLE PATTERN DOTS-12367 */
+#define XK_braille_dots_467 0x1002868 /* U+2868 BRAILLE PATTERN DOTS-467 */
+#define XK_braille_dots_1467 0x1002869 /* U+2869 BRAILLE PATTERN DOTS-1467 */
+#define XK_braille_dots_2467 0x100286a /* U+286a BRAILLE PATTERN DOTS-2467 */
+#define XK_braille_dots_12467 0x100286b /* U+286b BRAILLE PATTERN DOTS-12467 */
+#define XK_braille_dots_3467 0x100286c /* U+286c BRAILLE PATTERN DOTS-3467 */
+#define XK_braille_dots_13467 0x100286d /* U+286d BRAILLE PATTERN DOTS-13467 */
+#define XK_braille_dots_23467 0x100286e /* U+286e BRAILLE PATTERN DOTS-23467 */
+#define XK_braille_dots_123467 0x100286f /* U+286f BRAILLE PATTERN DOTS-123467 */
+#define XK_braille_dots_567 0x1002870 /* U+2870 BRAILLE PATTERN DOTS-567 */
+#define XK_braille_dots_1567 0x1002871 /* U+2871 BRAILLE PATTERN DOTS-1567 */
+#define XK_braille_dots_2567 0x1002872 /* U+2872 BRAILLE PATTERN DOTS-2567 */
+#define XK_braille_dots_12567 0x1002873 /* U+2873 BRAILLE PATTERN DOTS-12567 */
+#define XK_braille_dots_3567 0x1002874 /* U+2874 BRAILLE PATTERN DOTS-3567 */
+#define XK_braille_dots_13567 0x1002875 /* U+2875 BRAILLE PATTERN DOTS-13567 */
+#define XK_braille_dots_23567 0x1002876 /* U+2876 BRAILLE PATTERN DOTS-23567 */
+#define XK_braille_dots_123567 0x1002877 /* U+2877 BRAILLE PATTERN DOTS-123567 */
+#define XK_braille_dots_4567 0x1002878 /* U+2878 BRAILLE PATTERN DOTS-4567 */
+#define XK_braille_dots_14567 0x1002879 /* U+2879 BRAILLE PATTERN DOTS-14567 */
+#define XK_braille_dots_24567 0x100287a /* U+287a BRAILLE PATTERN DOTS-24567 */
+#define XK_braille_dots_124567 0x100287b /* U+287b BRAILLE PATTERN DOTS-124567 */
+#define XK_braille_dots_34567 0x100287c /* U+287c BRAILLE PATTERN DOTS-34567 */
+#define XK_braille_dots_134567 0x100287d /* U+287d BRAILLE PATTERN DOTS-134567 */
+#define XK_braille_dots_234567 0x100287e /* U+287e BRAILLE PATTERN DOTS-234567 */
+#define XK_braille_dots_1234567 0x100287f /* U+287f BRAILLE PATTERN DOTS-1234567 */
+#define XK_braille_dots_8 0x1002880 /* U+2880 BRAILLE PATTERN DOTS-8 */
+#define XK_braille_dots_18 0x1002881 /* U+2881 BRAILLE PATTERN DOTS-18 */
+#define XK_braille_dots_28 0x1002882 /* U+2882 BRAILLE PATTERN DOTS-28 */
+#define XK_braille_dots_128 0x1002883 /* U+2883 BRAILLE PATTERN DOTS-128 */
+#define XK_braille_dots_38 0x1002884 /* U+2884 BRAILLE PATTERN DOTS-38 */
+#define XK_braille_dots_138 0x1002885 /* U+2885 BRAILLE PATTERN DOTS-138 */
+#define XK_braille_dots_238 0x1002886 /* U+2886 BRAILLE PATTERN DOTS-238 */
+#define XK_braille_dots_1238 0x1002887 /* U+2887 BRAILLE PATTERN DOTS-1238 */
+#define XK_braille_dots_48 0x1002888 /* U+2888 BRAILLE PATTERN DOTS-48 */
+#define XK_braille_dots_148 0x1002889 /* U+2889 BRAILLE PATTERN DOTS-148 */
+#define XK_braille_dots_248 0x100288a /* U+288a BRAILLE PATTERN DOTS-248 */
+#define XK_braille_dots_1248 0x100288b /* U+288b BRAILLE PATTERN DOTS-1248 */
+#define XK_braille_dots_348 0x100288c /* U+288c BRAILLE PATTERN DOTS-348 */
+#define XK_braille_dots_1348 0x100288d /* U+288d BRAILLE PATTERN DOTS-1348 */
+#define XK_braille_dots_2348 0x100288e /* U+288e BRAILLE PATTERN DOTS-2348 */
+#define XK_braille_dots_12348 0x100288f /* U+288f BRAILLE PATTERN DOTS-12348 */
+#define XK_braille_dots_58 0x1002890 /* U+2890 BRAILLE PATTERN DOTS-58 */
+#define XK_braille_dots_158 0x1002891 /* U+2891 BRAILLE PATTERN DOTS-158 */
+#define XK_braille_dots_258 0x1002892 /* U+2892 BRAILLE PATTERN DOTS-258 */
+#define XK_braille_dots_1258 0x1002893 /* U+2893 BRAILLE PATTERN DOTS-1258 */
+#define XK_braille_dots_358 0x1002894 /* U+2894 BRAILLE PATTERN DOTS-358 */
+#define XK_braille_dots_1358 0x1002895 /* U+2895 BRAILLE PATTERN DOTS-1358 */
+#define XK_braille_dots_2358 0x1002896 /* U+2896 BRAILLE PATTERN DOTS-2358 */
+#define XK_braille_dots_12358 0x1002897 /* U+2897 BRAILLE PATTERN DOTS-12358 */
+#define XK_braille_dots_458 0x1002898 /* U+2898 BRAILLE PATTERN DOTS-458 */
+#define XK_braille_dots_1458 0x1002899 /* U+2899 BRAILLE PATTERN DOTS-1458 */
+#define XK_braille_dots_2458 0x100289a /* U+289a BRAILLE PATTERN DOTS-2458 */
+#define XK_braille_dots_12458 0x100289b /* U+289b BRAILLE PATTERN DOTS-12458 */
+#define XK_braille_dots_3458 0x100289c /* U+289c BRAILLE PATTERN DOTS-3458 */
+#define XK_braille_dots_13458 0x100289d /* U+289d BRAILLE PATTERN DOTS-13458 */
+#define XK_braille_dots_23458 0x100289e /* U+289e BRAILLE PATTERN DOTS-23458 */
+#define XK_braille_dots_123458 0x100289f /* U+289f BRAILLE PATTERN DOTS-123458 */
+#define XK_braille_dots_68 0x10028a0 /* U+28a0 BRAILLE PATTERN DOTS-68 */
+#define XK_braille_dots_168 0x10028a1 /* U+28a1 BRAILLE PATTERN DOTS-168 */
+#define XK_braille_dots_268 0x10028a2 /* U+28a2 BRAILLE PATTERN DOTS-268 */
+#define XK_braille_dots_1268 0x10028a3 /* U+28a3 BRAILLE PATTERN DOTS-1268 */
+#define XK_braille_dots_368 0x10028a4 /* U+28a4 BRAILLE PATTERN DOTS-368 */
+#define XK_braille_dots_1368 0x10028a5 /* U+28a5 BRAILLE PATTERN DOTS-1368 */
+#define XK_braille_dots_2368 0x10028a6 /* U+28a6 BRAILLE PATTERN DOTS-2368 */
+#define XK_braille_dots_12368 0x10028a7 /* U+28a7 BRAILLE PATTERN DOTS-12368 */
+#define XK_braille_dots_468 0x10028a8 /* U+28a8 BRAILLE PATTERN DOTS-468 */
+#define XK_braille_dots_1468 0x10028a9 /* U+28a9 BRAILLE PATTERN DOTS-1468 */
+#define XK_braille_dots_2468 0x10028aa /* U+28aa BRAILLE PATTERN DOTS-2468 */
+#define XK_braille_dots_12468 0x10028ab /* U+28ab BRAILLE PATTERN DOTS-12468 */
+#define XK_braille_dots_3468 0x10028ac /* U+28ac BRAILLE PATTERN DOTS-3468 */
+#define XK_braille_dots_13468 0x10028ad /* U+28ad BRAILLE PATTERN DOTS-13468 */
+#define XK_braille_dots_23468 0x10028ae /* U+28ae BRAILLE PATTERN DOTS-23468 */
+#define XK_braille_dots_123468 0x10028af /* U+28af BRAILLE PATTERN DOTS-123468 */
+#define XK_braille_dots_568 0x10028b0 /* U+28b0 BRAILLE PATTERN DOTS-568 */
+#define XK_braille_dots_1568 0x10028b1 /* U+28b1 BRAILLE PATTERN DOTS-1568 */
+#define XK_braille_dots_2568 0x10028b2 /* U+28b2 BRAILLE PATTERN DOTS-2568 */
+#define XK_braille_dots_12568 0x10028b3 /* U+28b3 BRAILLE PATTERN DOTS-12568 */
+#define XK_braille_dots_3568 0x10028b4 /* U+28b4 BRAILLE PATTERN DOTS-3568 */
+#define XK_braille_dots_13568 0x10028b5 /* U+28b5 BRAILLE PATTERN DOTS-13568 */
+#define XK_braille_dots_23568 0x10028b6 /* U+28b6 BRAILLE PATTERN DOTS-23568 */
+#define XK_braille_dots_123568 0x10028b7 /* U+28b7 BRAILLE PATTERN DOTS-123568 */
+#define XK_braille_dots_4568 0x10028b8 /* U+28b8 BRAILLE PATTERN DOTS-4568 */
+#define XK_braille_dots_14568 0x10028b9 /* U+28b9 BRAILLE PATTERN DOTS-14568 */
+#define XK_braille_dots_24568 0x10028ba /* U+28ba BRAILLE PATTERN DOTS-24568 */
+#define XK_braille_dots_124568 0x10028bb /* U+28bb BRAILLE PATTERN DOTS-124568 */
+#define XK_braille_dots_34568 0x10028bc /* U+28bc BRAILLE PATTERN DOTS-34568 */
+#define XK_braille_dots_134568 0x10028bd /* U+28bd BRAILLE PATTERN DOTS-134568 */
+#define XK_braille_dots_234568 0x10028be /* U+28be BRAILLE PATTERN DOTS-234568 */
+#define XK_braille_dots_1234568 0x10028bf /* U+28bf BRAILLE PATTERN DOTS-1234568 */
+#define XK_braille_dots_78 0x10028c0 /* U+28c0 BRAILLE PATTERN DOTS-78 */
+#define XK_braille_dots_178 0x10028c1 /* U+28c1 BRAILLE PATTERN DOTS-178 */
+#define XK_braille_dots_278 0x10028c2 /* U+28c2 BRAILLE PATTERN DOTS-278 */
+#define XK_braille_dots_1278 0x10028c3 /* U+28c3 BRAILLE PATTERN DOTS-1278 */
+#define XK_braille_dots_378 0x10028c4 /* U+28c4 BRAILLE PATTERN DOTS-378 */
+#define XK_braille_dots_1378 0x10028c5 /* U+28c5 BRAILLE PATTERN DOTS-1378 */
+#define XK_braille_dots_2378 0x10028c6 /* U+28c6 BRAILLE PATTERN DOTS-2378 */
+#define XK_braille_dots_12378 0x10028c7 /* U+28c7 BRAILLE PATTERN DOTS-12378 */
+#define XK_braille_dots_478 0x10028c8 /* U+28c8 BRAILLE PATTERN DOTS-478 */
+#define XK_braille_dots_1478 0x10028c9 /* U+28c9 BRAILLE PATTERN DOTS-1478 */
+#define XK_braille_dots_2478 0x10028ca /* U+28ca BRAILLE PATTERN DOTS-2478 */
+#define XK_braille_dots_12478 0x10028cb /* U+28cb BRAILLE PATTERN DOTS-12478 */
+#define XK_braille_dots_3478 0x10028cc /* U+28cc BRAILLE PATTERN DOTS-3478 */
+#define XK_braille_dots_13478 0x10028cd /* U+28cd BRAILLE PATTERN DOTS-13478 */
+#define XK_braille_dots_23478 0x10028ce /* U+28ce BRAILLE PATTERN DOTS-23478 */
+#define XK_braille_dots_123478 0x10028cf /* U+28cf BRAILLE PATTERN DOTS-123478 */
+#define XK_braille_dots_578 0x10028d0 /* U+28d0 BRAILLE PATTERN DOTS-578 */
+#define XK_braille_dots_1578 0x10028d1 /* U+28d1 BRAILLE PATTERN DOTS-1578 */
+#define XK_braille_dots_2578 0x10028d2 /* U+28d2 BRAILLE PATTERN DOTS-2578 */
+#define XK_braille_dots_12578 0x10028d3 /* U+28d3 BRAILLE PATTERN DOTS-12578 */
+#define XK_braille_dots_3578 0x10028d4 /* U+28d4 BRAILLE PATTERN DOTS-3578 */
+#define XK_braille_dots_13578 0x10028d5 /* U+28d5 BRAILLE PATTERN DOTS-13578 */
+#define XK_braille_dots_23578 0x10028d6 /* U+28d6 BRAILLE PATTERN DOTS-23578 */
+#define XK_braille_dots_123578 0x10028d7 /* U+28d7 BRAILLE PATTERN DOTS-123578 */
+#define XK_braille_dots_4578 0x10028d8 /* U+28d8 BRAILLE PATTERN DOTS-4578 */
+#define XK_braille_dots_14578 0x10028d9 /* U+28d9 BRAILLE PATTERN DOTS-14578 */
+#define XK_braille_dots_24578 0x10028da /* U+28da BRAILLE PATTERN DOTS-24578 */
+#define XK_braille_dots_124578 0x10028db /* U+28db BRAILLE PATTERN DOTS-124578 */
+#define XK_braille_dots_34578 0x10028dc /* U+28dc BRAILLE PATTERN DOTS-34578 */
+#define XK_braille_dots_134578 0x10028dd /* U+28dd BRAILLE PATTERN DOTS-134578 */
+#define XK_braille_dots_234578 0x10028de /* U+28de BRAILLE PATTERN DOTS-234578 */
+#define XK_braille_dots_1234578 0x10028df /* U+28df BRAILLE PATTERN DOTS-1234578 */
+#define XK_braille_dots_678 0x10028e0 /* U+28e0 BRAILLE PATTERN DOTS-678 */
+#define XK_braille_dots_1678 0x10028e1 /* U+28e1 BRAILLE PATTERN DOTS-1678 */
+#define XK_braille_dots_2678 0x10028e2 /* U+28e2 BRAILLE PATTERN DOTS-2678 */
+#define XK_braille_dots_12678 0x10028e3 /* U+28e3 BRAILLE PATTERN DOTS-12678 */
+#define XK_braille_dots_3678 0x10028e4 /* U+28e4 BRAILLE PATTERN DOTS-3678 */
+#define XK_braille_dots_13678 0x10028e5 /* U+28e5 BRAILLE PATTERN DOTS-13678 */
+#define XK_braille_dots_23678 0x10028e6 /* U+28e6 BRAILLE PATTERN DOTS-23678 */
+#define XK_braille_dots_123678 0x10028e7 /* U+28e7 BRAILLE PATTERN DOTS-123678 */
+#define XK_braille_dots_4678 0x10028e8 /* U+28e8 BRAILLE PATTERN DOTS-4678 */
+#define XK_braille_dots_14678 0x10028e9 /* U+28e9 BRAILLE PATTERN DOTS-14678 */
+#define XK_braille_dots_24678 0x10028ea /* U+28ea BRAILLE PATTERN DOTS-24678 */
+#define XK_braille_dots_124678 0x10028eb /* U+28eb BRAILLE PATTERN DOTS-124678 */
+#define XK_braille_dots_34678 0x10028ec /* U+28ec BRAILLE PATTERN DOTS-34678 */
+#define XK_braille_dots_134678 0x10028ed /* U+28ed BRAILLE PATTERN DOTS-134678 */
+#define XK_braille_dots_234678 0x10028ee /* U+28ee BRAILLE PATTERN DOTS-234678 */
+#define XK_braille_dots_1234678 0x10028ef /* U+28ef BRAILLE PATTERN DOTS-1234678 */
+#define XK_braille_dots_5678 0x10028f0 /* U+28f0 BRAILLE PATTERN DOTS-5678 */
+#define XK_braille_dots_15678 0x10028f1 /* U+28f1 BRAILLE PATTERN DOTS-15678 */
+#define XK_braille_dots_25678 0x10028f2 /* U+28f2 BRAILLE PATTERN DOTS-25678 */
+#define XK_braille_dots_125678 0x10028f3 /* U+28f3 BRAILLE PATTERN DOTS-125678 */
+#define XK_braille_dots_35678 0x10028f4 /* U+28f4 BRAILLE PATTERN DOTS-35678 */
+#define XK_braille_dots_135678 0x10028f5 /* U+28f5 BRAILLE PATTERN DOTS-135678 */
+#define XK_braille_dots_235678 0x10028f6 /* U+28f6 BRAILLE PATTERN DOTS-235678 */
+#define XK_braille_dots_1235678 0x10028f7 /* U+28f7 BRAILLE PATTERN DOTS-1235678 */
+#define XK_braille_dots_45678 0x10028f8 /* U+28f8 BRAILLE PATTERN DOTS-45678 */
+#define XK_braille_dots_145678 0x10028f9 /* U+28f9 BRAILLE PATTERN DOTS-145678 */
+#define XK_braille_dots_245678 0x10028fa /* U+28fa BRAILLE PATTERN DOTS-245678 */
+#define XK_braille_dots_1245678 0x10028fb /* U+28fb BRAILLE PATTERN DOTS-1245678 */
+#define XK_braille_dots_345678 0x10028fc /* U+28fc BRAILLE PATTERN DOTS-345678 */
+#define XK_braille_dots_1345678 0x10028fd /* U+28fd BRAILLE PATTERN DOTS-1345678 */
+#define XK_braille_dots_2345678 0x10028fe /* U+28fe BRAILLE PATTERN DOTS-2345678 */
+#define XK_braille_dots_12345678 0x10028ff /* U+28ff BRAILLE PATTERN DOTS-12345678 */
+#endif /* XK_BRAILLE */
+
+/*
+ * Sinhala (http://unicode.org/charts/PDF/U0D80.pdf)
+ * http://www.nongnu.org/sinhala/doc/transliteration/sinhala-transliteration_6.html
+ */
+
+#ifdef XK_SINHALA
+#define XK_Sinh_ng 0x1000d82 /* U+0D82 SINHALA ANUSVARAYA */
+#define XK_Sinh_h2 0x1000d83 /* U+0D83 SINHALA VISARGAYA */
+#define XK_Sinh_a 0x1000d85 /* U+0D85 SINHALA AYANNA */
+#define XK_Sinh_aa 0x1000d86 /* U+0D86 SINHALA AAYANNA */
+#define XK_Sinh_ae 0x1000d87 /* U+0D87 SINHALA AEYANNA */
+#define XK_Sinh_aee 0x1000d88 /* U+0D88 SINHALA AEEYANNA */
+#define XK_Sinh_i 0x1000d89 /* U+0D89 SINHALA IYANNA */
+#define XK_Sinh_ii 0x1000d8a /* U+0D8A SINHALA IIYANNA */
+#define XK_Sinh_u 0x1000d8b /* U+0D8B SINHALA UYANNA */
+#define XK_Sinh_uu 0x1000d8c /* U+0D8C SINHALA UUYANNA */
+#define XK_Sinh_ri 0x1000d8d /* U+0D8D SINHALA IRUYANNA */
+#define XK_Sinh_rii 0x1000d8e /* U+0D8E SINHALA IRUUYANNA */
+#define XK_Sinh_lu 0x1000d8f /* U+0D8F SINHALA ILUYANNA */
+#define XK_Sinh_luu 0x1000d90 /* U+0D90 SINHALA ILUUYANNA */
+#define XK_Sinh_e 0x1000d91 /* U+0D91 SINHALA EYANNA */
+#define XK_Sinh_ee 0x1000d92 /* U+0D92 SINHALA EEYANNA */
+#define XK_Sinh_ai 0x1000d93 /* U+0D93 SINHALA AIYANNA */
+#define XK_Sinh_o 0x1000d94 /* U+0D94 SINHALA OYANNA */
+#define XK_Sinh_oo 0x1000d95 /* U+0D95 SINHALA OOYANNA */
+#define XK_Sinh_au 0x1000d96 /* U+0D96 SINHALA AUYANNA */
+#define XK_Sinh_ka 0x1000d9a /* U+0D9A SINHALA KAYANNA */
+#define XK_Sinh_kha 0x1000d9b /* U+0D9B SINHALA MAHA. KAYANNA */
+#define XK_Sinh_ga 0x1000d9c /* U+0D9C SINHALA GAYANNA */
+#define XK_Sinh_gha 0x1000d9d /* U+0D9D SINHALA MAHA. GAYANNA */
+#define XK_Sinh_ng2 0x1000d9e /* U+0D9E SINHALA KANTAJA NAASIKYAYA */
+#define XK_Sinh_nga 0x1000d9f /* U+0D9F SINHALA SANYAKA GAYANNA */
+#define XK_Sinh_ca 0x1000da0 /* U+0DA0 SINHALA CAYANNA */
+#define XK_Sinh_cha 0x1000da1 /* U+0DA1 SINHALA MAHA. CAYANNA */
+#define XK_Sinh_ja 0x1000da2 /* U+0DA2 SINHALA JAYANNA */
+#define XK_Sinh_jha 0x1000da3 /* U+0DA3 SINHALA MAHA. JAYANNA */
+#define XK_Sinh_nya 0x1000da4 /* U+0DA4 SINHALA TAALUJA NAASIKYAYA */
+#define XK_Sinh_jnya 0x1000da5 /* U+0DA5 SINHALA TAALUJA SANYOOGA NAASIKYAYA */
+#define XK_Sinh_nja 0x1000da6 /* U+0DA6 SINHALA SANYAKA JAYANNA */
+#define XK_Sinh_tta 0x1000da7 /* U+0DA7 SINHALA TTAYANNA */
+#define XK_Sinh_ttha 0x1000da8 /* U+0DA8 SINHALA MAHA. TTAYANNA */
+#define XK_Sinh_dda 0x1000da9 /* U+0DA9 SINHALA DDAYANNA */
+#define XK_Sinh_ddha 0x1000daa /* U+0DAA SINHALA MAHA. DDAYANNA */
+#define XK_Sinh_nna 0x1000dab /* U+0DAB SINHALA MUURDHAJA NAYANNA */
+#define XK_Sinh_ndda 0x1000dac /* U+0DAC SINHALA SANYAKA DDAYANNA */
+#define XK_Sinh_tha 0x1000dad /* U+0DAD SINHALA TAYANNA */
+#define XK_Sinh_thha 0x1000dae /* U+0DAE SINHALA MAHA. TAYANNA */
+#define XK_Sinh_dha 0x1000daf /* U+0DAF SINHALA DAYANNA */
+#define XK_Sinh_dhha 0x1000db0 /* U+0DB0 SINHALA MAHA. DAYANNA */
+#define XK_Sinh_na 0x1000db1 /* U+0DB1 SINHALA DANTAJA NAYANNA */
+#define XK_Sinh_ndha 0x1000db3 /* U+0DB3 SINHALA SANYAKA DAYANNA */
+#define XK_Sinh_pa 0x1000db4 /* U+0DB4 SINHALA PAYANNA */
+#define XK_Sinh_pha 0x1000db5 /* U+0DB5 SINHALA MAHA. PAYANNA */
+#define XK_Sinh_ba 0x1000db6 /* U+0DB6 SINHALA BAYANNA */
+#define XK_Sinh_bha 0x1000db7 /* U+0DB7 SINHALA MAHA. BAYANNA */
+#define XK_Sinh_ma 0x1000db8 /* U+0DB8 SINHALA MAYANNA */
+#define XK_Sinh_mba 0x1000db9 /* U+0DB9 SINHALA AMBA BAYANNA */
+#define XK_Sinh_ya 0x1000dba /* U+0DBA SINHALA YAYANNA */
+#define XK_Sinh_ra 0x1000dbb /* U+0DBB SINHALA RAYANNA */
+#define XK_Sinh_la 0x1000dbd /* U+0DBD SINHALA DANTAJA LAYANNA */
+#define XK_Sinh_va 0x1000dc0 /* U+0DC0 SINHALA VAYANNA */
+#define XK_Sinh_sha 0x1000dc1 /* U+0DC1 SINHALA TAALUJA SAYANNA */
+#define XK_Sinh_ssha 0x1000dc2 /* U+0DC2 SINHALA MUURDHAJA SAYANNA */
+#define XK_Sinh_sa 0x1000dc3 /* U+0DC3 SINHALA DANTAJA SAYANNA */
+#define XK_Sinh_ha 0x1000dc4 /* U+0DC4 SINHALA HAYANNA */
+#define XK_Sinh_lla 0x1000dc5 /* U+0DC5 SINHALA MUURDHAJA LAYANNA */
+#define XK_Sinh_fa 0x1000dc6 /* U+0DC6 SINHALA FAYANNA */
+#define XK_Sinh_al 0x1000dca /* U+0DCA SINHALA AL-LAKUNA */
+#define XK_Sinh_aa2 0x1000dcf /* U+0DCF SINHALA AELA-PILLA */
+#define XK_Sinh_ae2 0x1000dd0 /* U+0DD0 SINHALA AEDA-PILLA */
+#define XK_Sinh_aee2 0x1000dd1 /* U+0DD1 SINHALA DIGA AEDA-PILLA */
+#define XK_Sinh_i2 0x1000dd2 /* U+0DD2 SINHALA IS-PILLA */
+#define XK_Sinh_ii2 0x1000dd3 /* U+0DD3 SINHALA DIGA IS-PILLA */
+#define XK_Sinh_u2 0x1000dd4 /* U+0DD4 SINHALA PAA-PILLA */
+#define XK_Sinh_uu2 0x1000dd6 /* U+0DD6 SINHALA DIGA PAA-PILLA */
+#define XK_Sinh_ru2 0x1000dd8 /* U+0DD8 SINHALA GAETTA-PILLA */
+#define XK_Sinh_e2 0x1000dd9 /* U+0DD9 SINHALA KOMBUVA */
+#define XK_Sinh_ee2 0x1000dda /* U+0DDA SINHALA DIGA KOMBUVA */
+#define XK_Sinh_ai2 0x1000ddb /* U+0DDB SINHALA KOMBU DEKA */
+#define XK_Sinh_o2 0x1000ddc /* U+0DDC SINHALA KOMBUVA HAA AELA-PILLA*/
+#define XK_Sinh_oo2 0x1000ddd /* U+0DDD SINHALA KOMBUVA HAA DIGA AELA-PILLA*/
+#define XK_Sinh_au2 0x1000dde /* U+0DDE SINHALA KOMBUVA HAA GAYANUKITTA */
+#define XK_Sinh_lu2 0x1000ddf /* U+0DDF SINHALA GAYANUKITTA */
+#define XK_Sinh_ruu2 0x1000df2 /* U+0DF2 SINHALA DIGA GAETTA-PILLA */
+#define XK_Sinh_luu2 0x1000df3 /* U+0DF3 SINHALA DIGA GAYANUKITTA */
+#define XK_Sinh_kunddaliya 0x1000df4 /* U+0DF4 SINHALA KUNDDALIYA */
+#endif /* XK_SINHALA */
diff --git a/thirdparty/linuxbsd_headers/alsa/alisp.h b/thirdparty/linuxbsd_headers/alsa/alisp.h
new file mode 100644
index 0000000000..407ed646e8
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/alisp.h
@@ -0,0 +1,55 @@
+/*
+ * ALSA lisp implementation
+ * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+struct alisp_cfg {
+ int verbose: 1,
+ warning: 1,
+ debug: 1;
+ snd_input_t *in; /* program code */
+ snd_output_t *out; /* program output */
+ snd_output_t *eout; /* error output */
+ snd_output_t *vout; /* verbose output */
+ snd_output_t *wout; /* warning output */
+ snd_output_t *dout; /* debug output */
+};
+
+struct alisp_instance;
+struct alisp_object;
+struct alisp_seq_iterator;
+
+struct alisp_cfg *alsa_lisp_default_cfg(snd_input_t *input);
+void alsa_lisp_default_cfg_free(struct alisp_cfg *cfg);
+int alsa_lisp(struct alisp_cfg *cfg, struct alisp_instance **instance);
+void alsa_lisp_free(struct alisp_instance *instance);
+int alsa_lisp_function(struct alisp_instance *instance, struct alisp_seq_iterator **result,
+ const char *id, const char *args, ...)
+#ifndef DOC_HIDDEN
+ __attribute__ ((format (printf, 4, 5)))
+#endif
+ ;
+void alsa_lisp_result_free(struct alisp_instance *instance,
+ struct alisp_seq_iterator *result);
+int alsa_lisp_seq_first(struct alisp_instance *instance, const char *id,
+ struct alisp_seq_iterator **seq);
+int alsa_lisp_seq_next(struct alisp_seq_iterator **seq);
+int alsa_lisp_seq_count(struct alisp_seq_iterator *seq);
+int alsa_lisp_seq_integer(struct alisp_seq_iterator *seq, long *val);
+int alsa_lisp_seq_pointer(struct alisp_seq_iterator *seq, const char *ptr_id, void **ptr);
diff --git a/thirdparty/linuxbsd_headers/alsa/asoundef.h b/thirdparty/linuxbsd_headers/alsa/asoundef.h
new file mode 100644
index 0000000000..c6c4eec951
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/asoundef.h
@@ -0,0 +1,310 @@
+/**
+ * \file include/asoundef.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Definitions of constants for the ALSA driver
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_ASOUNDEF_H
+#define __ALSA_ASOUNDEF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Digital_Audio_Interface Constants for Digital Audio Interfaces
+ * AES/IEC958 channel status bits.
+ * \{
+ */
+
+#define IEC958_AES0_PROFESSIONAL (1<<0) /**< 0 = consumer, 1 = professional */
+#define IEC958_AES0_NONAUDIO (1<<1) /**< 0 = audio, 1 = non-audio */
+#define IEC958_AES0_PRO_EMPHASIS (7<<2) /**< mask - emphasis */
+#define IEC958_AES0_PRO_EMPHASIS_NOTID (0<<2) /**< emphasis not indicated */
+#define IEC958_AES0_PRO_EMPHASIS_NONE (1<<2) /**< no emphasis */
+#define IEC958_AES0_PRO_EMPHASIS_5015 (3<<2) /**< 50/15us emphasis */
+#define IEC958_AES0_PRO_EMPHASIS_CCITT (7<<2) /**< CCITT J.17 emphasis */
+#define IEC958_AES0_PRO_FREQ_UNLOCKED (1<<5) /**< source sample frequency: 0 = locked, 1 = unlocked */
+#define IEC958_AES0_PRO_FS (3<<6) /**< mask - sample frequency */
+#define IEC958_AES0_PRO_FS_NOTID (0<<6) /**< fs not indicated */
+#define IEC958_AES0_PRO_FS_44100 (1<<6) /**< 44.1kHz */
+#define IEC958_AES0_PRO_FS_48000 (2<<6) /**< 48kHz */
+#define IEC958_AES0_PRO_FS_32000 (3<<6) /**< 32kHz */
+#define IEC958_AES0_CON_NOT_COPYRIGHT (1<<2) /**< 0 = copyright, 1 = not copyright */
+#define IEC958_AES0_CON_EMPHASIS (7<<3) /**< mask - emphasis */
+#define IEC958_AES0_CON_EMPHASIS_NONE (0<<3) /**< no emphasis */
+#define IEC958_AES0_CON_EMPHASIS_5015 (1<<3) /**< 50/15us emphasis */
+#define IEC958_AES0_CON_MODE (3<<6) /**< mask - mode */
+#define IEC958_AES1_PRO_MODE (15<<0) /**< mask - channel mode */
+#define IEC958_AES1_PRO_MODE_NOTID (0<<0) /**< mode not indicated */
+#define IEC958_AES1_PRO_MODE_STEREOPHONIC (2<<0) /**< stereophonic - ch A is left */
+#define IEC958_AES1_PRO_MODE_SINGLE (4<<0) /**< single channel */
+#define IEC958_AES1_PRO_MODE_TWO (8<<0) /**< two channels */
+#define IEC958_AES1_PRO_MODE_PRIMARY (12<<0) /**< primary/secondary */
+#define IEC958_AES1_PRO_MODE_BYTE3 (15<<0) /**< vector to byte 3 */
+#define IEC958_AES1_PRO_USERBITS (15<<4) /**< mask - user bits */
+#define IEC958_AES1_PRO_USERBITS_NOTID (0<<4) /**< user bits not indicated */
+#define IEC958_AES1_PRO_USERBITS_192 (8<<4) /**< 192-bit structure */
+#define IEC958_AES1_PRO_USERBITS_UDEF (12<<4) /**< user defined application */
+#define IEC958_AES1_CON_CATEGORY 0x7f /**< consumer category */
+#define IEC958_AES1_CON_GENERAL 0x00 /**< general category */
+#define IEC958_AES1_CON_LASEROPT_MASK 0x07 /**< Laser-optical mask */
+#define IEC958_AES1_CON_LASEROPT_ID 0x01 /**< Laser-optical ID */
+#define IEC958_AES1_CON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x00) /**< IEC958 CD compatible device */
+#define IEC958_AES1_CON_NON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x08) /**< non-IEC958 CD compatible device */
+#define IEC958_AES1_CON_MINI_DISC (IEC958_AES1_CON_LASEROPT_ID|0x48) /**< Mini-Disc device */
+#define IEC958_AES1_CON_DVD (IEC958_AES1_CON_LASEROPT_ID|0x18) /**< DVD device */
+#define IEC958_AES1_CON_LASTEROPT_OTHER (IEC958_AES1_CON_LASEROPT_ID|0x78) /**< Other laser-optical product */
+#define IEC958_AES1_CON_DIGDIGCONV_MASK 0x07 /**< digital<->digital converter mask */
+#define IEC958_AES1_CON_DIGDIGCONV_ID 0x02 /**< digital<->digital converter id */
+#define IEC958_AES1_CON_PCM_CODER (IEC958_AES1_CON_DIGDIGCONV_ID|0x00) /**< PCM coder */
+#define IEC958_AES1_CON_MIXER (IEC958_AES1_CON_DIGDIGCONV_ID|0x10) /**< Digital signal mixer */
+#define IEC958_AES1_CON_RATE_CONVERTER (IEC958_AES1_CON_DIGDIGCONV_ID|0x18) /**< Rate converter */
+#define IEC958_AES1_CON_SAMPLER (IEC958_AES1_CON_DIGDIGCONV_ID|0x20) /**< PCM sampler */
+#define IEC958_AES1_CON_DSP (IEC958_AES1_CON_DIGDIGCONV_ID|0x28) /**< Digital sound processor */
+#define IEC958_AES1_CON_DIGDIGCONV_OTHER (IEC958_AES1_CON_DIGDIGCONV_ID|0x78) /**< Other digital<->digital product */
+#define IEC958_AES1_CON_MAGNETIC_MASK 0x07 /**< Magnetic device mask */
+#define IEC958_AES1_CON_MAGNETIC_ID 0x03 /**< Magnetic device ID */
+#define IEC958_AES1_CON_DAT (IEC958_AES1_CON_MAGNETIC_ID|0x00) /**< Digital Audio Tape */
+#define IEC958_AES1_CON_VCR (IEC958_AES1_CON_MAGNETIC_ID|0x08) /**< Video recorder */
+#define IEC958_AES1_CON_DCC (IEC958_AES1_CON_MAGNETIC_ID|0x40) /**< Digital compact cassette */
+#define IEC958_AES1_CON_MAGNETIC_DISC (IEC958_AES1_CON_MAGNETIC_ID|0x18) /**< Magnetic disc digital audio device */
+#define IEC958_AES1_CON_MAGNETIC_OTHER (IEC958_AES1_CON_MAGNETIC_ID|0x78) /**< Other magnetic device */
+#define IEC958_AES1_CON_BROADCAST1_MASK 0x07 /**< Broadcast mask */
+#define IEC958_AES1_CON_BROADCAST1_ID 0x04 /**< Broadcast ID */
+#define IEC958_AES1_CON_DAB_JAPAN (IEC958_AES1_CON_BROADCAST1_ID|0x00) /**< Digital audio broadcast (Japan) */
+#define IEC958_AES1_CON_DAB_EUROPE (IEC958_AES1_CON_BROADCAST1_ID|0x08) /**< Digital audio broadcast (Europe) */
+#define IEC958_AES1_CON_DAB_USA (IEC958_AES1_CON_BROADCAST1_ID|0x60) /**< Digital audio broadcast (USA) */
+#define IEC958_AES1_CON_SOFTWARE (IEC958_AES1_CON_BROADCAST1_ID|0x40) /**< Electronic software delivery */
+#define IEC958_AES1_CON_IEC62105 (IEC958_AES1_CON_BROADCAST1_ID|0x20) /**< Used by another standard (IEC 62105) */
+#define IEC958_AES1_CON_BROADCAST1_OTHER (IEC958_AES1_CON_BROADCAST1_ID|0x78) /**< Other broadcast product */
+#define IEC958_AES1_CON_BROADCAST2_MASK 0x0f /**< Broadcast alternative mask */
+#define IEC958_AES1_CON_BROADCAST2_ID 0x0e /**< Broadcast alternative ID */
+#define IEC958_AES1_CON_MUSICAL_MASK 0x07 /**< Musical device mask */
+#define IEC958_AES1_CON_MUSICAL_ID 0x05 /**< Musical device ID */
+#define IEC958_AES1_CON_SYNTHESIZER (IEC958_AES1_CON_MUSICAL_ID|0x00) /**< Synthesizer */
+#define IEC958_AES1_CON_MICROPHONE (IEC958_AES1_CON_MUSICAL_ID|0x08) /**< Microphone */
+#define IEC958_AES1_CON_MUSICAL_OTHER (IEC958_AES1_CON_MUSICAL_ID|0x78) /**< Other musical device */
+#define IEC958_AES1_CON_ADC_MASK 0x1f /**< ADC Mask */
+#define IEC958_AES1_CON_ADC_ID 0x06 /**< ADC ID */
+#define IEC958_AES1_CON_ADC (IEC958_AES1_CON_ADC_ID|0x00) /**< ADC without copyright information */
+#define IEC958_AES1_CON_ADC_OTHER (IEC958_AES1_CON_ADC_ID|0x60) /**< Other ADC product (with no copyright information) */
+#define IEC958_AES1_CON_ADC_COPYRIGHT_MASK 0x1f /**< ADC Copyright mask */
+#define IEC958_AES1_CON_ADC_COPYRIGHT_ID 0x16 /**< ADC Copyright ID */
+#define IEC958_AES1_CON_ADC_COPYRIGHT (IEC958_AES1_CON_ADC_COPYRIGHT_ID|0x00) /**< ADC with copyright information */
+#define IEC958_AES1_CON_ADC_COPYRIGHT_OTHER (IEC958_AES1_CON_ADC_COPYRIGHT_ID|0x60) /**< Other ADC with copyright information product */
+#define IEC958_AES1_CON_SOLIDMEM_MASK 0x0f /**< Solid memory based products mask */
+#define IEC958_AES1_CON_SOLIDMEM_ID 0x08 /**< Solid memory based products ID */
+#define IEC958_AES1_CON_SOLIDMEM_DIGITAL_RECORDER_PLAYER (IEC958_AES1_CON_SOLIDMEM_ID|0x00) /**< Digital audio recorder and player using solid state memory */
+#define IEC958_AES1_CON_SOLIDMEM_OTHER (IEC958_AES1_CON_SOLIDMEM_ID|0x70) /**< Other solid state memory based product */
+#define IEC958_AES1_CON_EXPERIMENTAL 0x40 /**< experimental category */
+#define IEC958_AES1_CON_ORIGINAL (1<<7) /**< this bits depends on the category code */
+#define IEC958_AES2_PRO_SBITS (7<<0) /**< mask - sample bits */
+#define IEC958_AES2_PRO_SBITS_20 (2<<0) /**< 20-bit - coordination */
+#define IEC958_AES2_PRO_SBITS_24 (4<<0) /**< 24-bit - main audio */
+#define IEC958_AES2_PRO_SBITS_UDEF (6<<0) /**< user defined application */
+#define IEC958_AES2_PRO_WORDLEN (7<<3) /**< mask - source word length */
+#define IEC958_AES2_PRO_WORDLEN_NOTID (0<<3) /**< source word length not indicated */
+#define IEC958_AES2_PRO_WORDLEN_22_18 (2<<3) /**< 22-bit or 18-bit */
+#define IEC958_AES2_PRO_WORDLEN_23_19 (4<<3) /**< 23-bit or 19-bit */
+#define IEC958_AES2_PRO_WORDLEN_24_20 (5<<3) /**< 24-bit or 20-bit */
+#define IEC958_AES2_PRO_WORDLEN_20_16 (6<<3) /**< 20-bit or 16-bit */
+#define IEC958_AES2_CON_SOURCE (15<<0) /**< mask - source number */
+#define IEC958_AES2_CON_SOURCE_UNSPEC (0<<0) /**< source number unspecified */
+#define IEC958_AES2_CON_CHANNEL (15<<4) /**< mask - channel number */
+#define IEC958_AES2_CON_CHANNEL_UNSPEC (0<<4) /**< channel number unspecified */
+#define IEC958_AES3_CON_FS (15<<0) /**< mask - sample frequency */
+#define IEC958_AES3_CON_FS_44100 (0<<0) /**< 44.1kHz */
+#define IEC958_AES3_CON_FS_NOTID (1<<0) /**< sample frequency non indicated */
+#define IEC958_AES3_CON_FS_48000 (2<<0) /**< 48kHz */
+#define IEC958_AES3_CON_FS_32000 (3<<0) /**< 32kHz */
+#define IEC958_AES3_CON_FS_22050 (4<<0) /**< 22.05kHz */
+#define IEC958_AES3_CON_FS_24000 (6<<0) /**< 24kHz */
+#define IEC958_AES3_CON_FS_88200 (8<<0) /**< 88.2kHz */
+#define IEC958_AES3_CON_FS_768000 (9<<0) /**< 768kHz */
+#define IEC958_AES3_CON_FS_96000 (10<<0) /**< 96kHz */
+#define IEC958_AES3_CON_FS_176400 (12<<0) /**< 176.4kHz */
+#define IEC958_AES3_CON_FS_192000 (14<<0) /**< 192kHz */
+#define IEC958_AES3_CON_CLOCK (3<<4) /**< mask - clock accuracy */
+#define IEC958_AES3_CON_CLOCK_1000PPM (0<<4) /**< 1000 ppm */
+#define IEC958_AES3_CON_CLOCK_50PPM (1<<4) /**< 50 ppm */
+#define IEC958_AES3_CON_CLOCK_VARIABLE (2<<4) /**< variable pitch */
+#define IEC958_AES4_CON_MAX_WORDLEN_24 (1<<0) /**< 0 = 20-bit, 1 = 24-bit */
+#define IEC958_AES4_CON_WORDLEN (7<<1) /**< mask - sample word length */
+#define IEC958_AES4_CON_WORDLEN_NOTID (0<<1) /**< not indicated */
+#define IEC958_AES4_CON_WORDLEN_20_16 (1<<1) /**< 20-bit or 16-bit */
+#define IEC958_AES4_CON_WORDLEN_22_18 (2<<1) /**< 22-bit or 18-bit */
+#define IEC958_AES4_CON_WORDLEN_23_19 (4<<1) /**< 23-bit or 19-bit */
+#define IEC958_AES4_CON_WORDLEN_24_20 (5<<1) /**< 24-bit or 20-bit */
+#define IEC958_AES4_CON_WORDLEN_21_17 (6<<1) /**< 21-bit or 17-bit */
+#define IEC958_AES4_CON_ORIGFS (15<<4) /**< mask - original sample frequency */
+#define IEC958_AES4_CON_ORIGFS_NOTID (0<<4) /**< original sample frequency not indicated */
+#define IEC958_AES4_CON_ORIGFS_192000 (1<<4) /**< 192kHz */
+#define IEC958_AES4_CON_ORIGFS_12000 (2<<4) /**< 12kHz */
+#define IEC958_AES4_CON_ORIGFS_176400 (3<<4) /**< 176.4kHz */
+#define IEC958_AES4_CON_ORIGFS_96000 (5<<4) /**< 96kHz */
+#define IEC958_AES4_CON_ORIGFS_8000 (6<<4) /**< 8kHz */
+#define IEC958_AES4_CON_ORIGFS_88200 (7<<4) /**< 88.2kHz */
+#define IEC958_AES4_CON_ORIGFS_16000 (8<<4) /**< 16kHz */
+#define IEC958_AES4_CON_ORIGFS_24000 (9<<4) /**< 24kHz */
+#define IEC958_AES4_CON_ORIGFS_11025 (10<<4) /**< 11.025kHz */
+#define IEC958_AES4_CON_ORIGFS_22050 (11<<4) /**< 22.05kHz */
+#define IEC958_AES4_CON_ORIGFS_32000 (12<<4) /**< 32kHz */
+#define IEC958_AES4_CON_ORIGFS_48000 (13<<4) /**< 48kHz */
+#define IEC958_AES4_CON_ORIGFS_44100 (15<<4) /**< 44.1kHz */
+#define IEC958_AES5_CON_CGMSA (3<<0) /**< mask - CGMS-A */
+#define IEC958_AES5_CON_CGMSA_COPYFREELY (0<<0) /**< copying is permitted without restriction */
+#define IEC958_AES5_CON_CGMSA_COPYONCE (1<<0) /**< one generation of copies may be made */
+#define IEC958_AES5_CON_CGMSA_COPYNOMORE (2<<0) /**< condition not be used */
+#define IEC958_AES5_CON_CGMSA_COPYNEVER (3<<0) /**< no copying is permitted */
+
+/** \} */
+
+/**
+ * \defgroup MIDI_Interface Constants for MIDI v1.0
+ * Constants for MIDI v1.0.
+ * \{
+ */
+
+#define MIDI_CHANNELS 16 /**< Number of channels per port/cable. */
+#define MIDI_GM_DRUM_CHANNEL (10-1) /**< Channel number for GM drums. */
+
+/**
+ * \defgroup MIDI_Commands MIDI Commands
+ * MIDI command codes.
+ * \{
+ */
+
+#define MIDI_CMD_NOTE_OFF 0x80 /**< note off */
+#define MIDI_CMD_NOTE_ON 0x90 /**< note on */
+#define MIDI_CMD_NOTE_PRESSURE 0xa0 /**< key pressure */
+#define MIDI_CMD_CONTROL 0xb0 /**< control change */
+#define MIDI_CMD_PGM_CHANGE 0xc0 /**< program change */
+#define MIDI_CMD_CHANNEL_PRESSURE 0xd0 /**< channel pressure */
+#define MIDI_CMD_BENDER 0xe0 /**< pitch bender */
+
+#define MIDI_CMD_COMMON_SYSEX 0xf0 /**< sysex (system exclusive) begin */
+#define MIDI_CMD_COMMON_MTC_QUARTER 0xf1 /**< MTC quarter frame */
+#define MIDI_CMD_COMMON_SONG_POS 0xf2 /**< song position */
+#define MIDI_CMD_COMMON_SONG_SELECT 0xf3 /**< song select */
+#define MIDI_CMD_COMMON_TUNE_REQUEST 0xf6 /**< tune request */
+#define MIDI_CMD_COMMON_SYSEX_END 0xf7 /**< end of sysex */
+#define MIDI_CMD_COMMON_CLOCK 0xf8 /**< clock */
+#define MIDI_CMD_COMMON_START 0xfa /**< start */
+#define MIDI_CMD_COMMON_CONTINUE 0xfb /**< continue */
+#define MIDI_CMD_COMMON_STOP 0xfc /**< stop */
+#define MIDI_CMD_COMMON_SENSING 0xfe /**< active sensing */
+#define MIDI_CMD_COMMON_RESET 0xff /**< reset */
+
+/** \} */
+
+/**
+ * \defgroup MIDI_Controllers MIDI Controllers
+ * MIDI controller numbers.
+ * \{
+ */
+
+#define MIDI_CTL_MSB_BANK 0x00 /**< Bank selection */
+#define MIDI_CTL_MSB_MODWHEEL 0x01 /**< Modulation */
+#define MIDI_CTL_MSB_BREATH 0x02 /**< Breath */
+#define MIDI_CTL_MSB_FOOT 0x04 /**< Foot */
+#define MIDI_CTL_MSB_PORTAMENTO_TIME 0x05 /**< Portamento time */
+#define MIDI_CTL_MSB_DATA_ENTRY 0x06 /**< Data entry */
+#define MIDI_CTL_MSB_MAIN_VOLUME 0x07 /**< Main volume */
+#define MIDI_CTL_MSB_BALANCE 0x08 /**< Balance */
+#define MIDI_CTL_MSB_PAN 0x0a /**< Panpot */
+#define MIDI_CTL_MSB_EXPRESSION 0x0b /**< Expression */
+#define MIDI_CTL_MSB_EFFECT1 0x0c /**< Effect1 */
+#define MIDI_CTL_MSB_EFFECT2 0x0d /**< Effect2 */
+#define MIDI_CTL_MSB_GENERAL_PURPOSE1 0x10 /**< General purpose 1 */
+#define MIDI_CTL_MSB_GENERAL_PURPOSE2 0x11 /**< General purpose 2 */
+#define MIDI_CTL_MSB_GENERAL_PURPOSE3 0x12 /**< General purpose 3 */
+#define MIDI_CTL_MSB_GENERAL_PURPOSE4 0x13 /**< General purpose 4 */
+#define MIDI_CTL_LSB_BANK 0x20 /**< Bank selection */
+#define MIDI_CTL_LSB_MODWHEEL 0x21 /**< Modulation */
+#define MIDI_CTL_LSB_BREATH 0x22 /**< Breath */
+#define MIDI_CTL_LSB_FOOT 0x24 /**< Foot */
+#define MIDI_CTL_LSB_PORTAMENTO_TIME 0x25 /**< Portamento time */
+#define MIDI_CTL_LSB_DATA_ENTRY 0x26 /**< Data entry */
+#define MIDI_CTL_LSB_MAIN_VOLUME 0x27 /**< Main volume */
+#define MIDI_CTL_LSB_BALANCE 0x28 /**< Balance */
+#define MIDI_CTL_LSB_PAN 0x2a /**< Panpot */
+#define MIDI_CTL_LSB_EXPRESSION 0x2b /**< Expression */
+#define MIDI_CTL_LSB_EFFECT1 0x2c /**< Effect1 */
+#define MIDI_CTL_LSB_EFFECT2 0x2d /**< Effect2 */
+#define MIDI_CTL_LSB_GENERAL_PURPOSE1 0x30 /**< General purpose 1 */
+#define MIDI_CTL_LSB_GENERAL_PURPOSE2 0x31 /**< General purpose 2 */
+#define MIDI_CTL_LSB_GENERAL_PURPOSE3 0x32 /**< General purpose 3 */
+#define MIDI_CTL_LSB_GENERAL_PURPOSE4 0x33 /**< General purpose 4 */
+#define MIDI_CTL_SUSTAIN 0x40 /**< Sustain pedal */
+#define MIDI_CTL_PORTAMENTO 0x41 /**< Portamento */
+#define MIDI_CTL_SOSTENUTO 0x42 /**< Sostenuto */
+#define MIDI_CTL_SUSTENUTO 0x42 /**< Sostenuto (a typo in the older version) */
+#define MIDI_CTL_SOFT_PEDAL 0x43 /**< Soft pedal */
+#define MIDI_CTL_LEGATO_FOOTSWITCH 0x44 /**< Legato foot switch */
+#define MIDI_CTL_HOLD2 0x45 /**< Hold2 */
+#define MIDI_CTL_SC1_SOUND_VARIATION 0x46 /**< SC1 Sound Variation */
+#define MIDI_CTL_SC2_TIMBRE 0x47 /**< SC2 Timbre */
+#define MIDI_CTL_SC3_RELEASE_TIME 0x48 /**< SC3 Release Time */
+#define MIDI_CTL_SC4_ATTACK_TIME 0x49 /**< SC4 Attack Time */
+#define MIDI_CTL_SC5_BRIGHTNESS 0x4a /**< SC5 Brightness */
+#define MIDI_CTL_SC6 0x4b /**< SC6 */
+#define MIDI_CTL_SC7 0x4c /**< SC7 */
+#define MIDI_CTL_SC8 0x4d /**< SC8 */
+#define MIDI_CTL_SC9 0x4e /**< SC9 */
+#define MIDI_CTL_SC10 0x4f /**< SC10 */
+#define MIDI_CTL_GENERAL_PURPOSE5 0x50 /**< General purpose 5 */
+#define MIDI_CTL_GENERAL_PURPOSE6 0x51 /**< General purpose 6 */
+#define MIDI_CTL_GENERAL_PURPOSE7 0x52 /**< General purpose 7 */
+#define MIDI_CTL_GENERAL_PURPOSE8 0x53 /**< General purpose 8 */
+#define MIDI_CTL_PORTAMENTO_CONTROL 0x54 /**< Portamento control */
+#define MIDI_CTL_E1_REVERB_DEPTH 0x5b /**< E1 Reverb Depth */
+#define MIDI_CTL_E2_TREMOLO_DEPTH 0x5c /**< E2 Tremolo Depth */
+#define MIDI_CTL_E3_CHORUS_DEPTH 0x5d /**< E3 Chorus Depth */
+#define MIDI_CTL_E4_DETUNE_DEPTH 0x5e /**< E4 Detune Depth */
+#define MIDI_CTL_E5_PHASER_DEPTH 0x5f /**< E5 Phaser Depth */
+#define MIDI_CTL_DATA_INCREMENT 0x60 /**< Data Increment */
+#define MIDI_CTL_DATA_DECREMENT 0x61 /**< Data Decrement */
+#define MIDI_CTL_NONREG_PARM_NUM_LSB 0x62 /**< Non-registered parameter number */
+#define MIDI_CTL_NONREG_PARM_NUM_MSB 0x63 /**< Non-registered parameter number */
+#define MIDI_CTL_REGIST_PARM_NUM_LSB 0x64 /**< Registered parameter number */
+#define MIDI_CTL_REGIST_PARM_NUM_MSB 0x65 /**< Registered parameter number */
+#define MIDI_CTL_ALL_SOUNDS_OFF 0x78 /**< All sounds off */
+#define MIDI_CTL_RESET_CONTROLLERS 0x79 /**< Reset Controllers */
+#define MIDI_CTL_LOCAL_CONTROL_SWITCH 0x7a /**< Local control switch */
+#define MIDI_CTL_ALL_NOTES_OFF 0x7b /**< All notes off */
+#define MIDI_CTL_OMNI_OFF 0x7c /**< Omni off */
+#define MIDI_CTL_OMNI_ON 0x7d /**< Omni on */
+#define MIDI_CTL_MONO1 0x7e /**< Mono1 */
+#define MIDI_CTL_MONO2 0x7f /**< Mono2 */
+
+/** \} */
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_ASOUNDEF_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/asoundlib.h b/thirdparty/linuxbsd_headers/alsa/asoundlib.h
new file mode 100644
index 0000000000..a546194382
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/asoundlib.h
@@ -0,0 +1,65 @@
+/**
+ * \file include/asoundlib.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ASOUNDLIB_H
+#define __ASOUNDLIB_H
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <string.h>
+#include <fcntl.h>
+#include <assert.h>
+#include <poll.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <endian.h>
+
+#ifndef __GNUC__
+#define __inline__ inline
+#endif
+
+#include <alsa/asoundef.h>
+#include <alsa/version.h>
+#include <alsa/global.h>
+#include <alsa/input.h>
+#include <alsa/output.h>
+#include <alsa/error.h>
+#include <alsa/conf.h>
+#include <alsa/pcm.h>
+#include <alsa/rawmidi.h>
+#include <alsa/timer.h>
+#include <alsa/hwdep.h>
+#include <alsa/control.h>
+#include <alsa/mixer.h>
+#include <alsa/seq_event.h>
+#include <alsa/seq.h>
+#include <alsa/seqmid.h>
+#include <alsa/seq_midi_event.h>
+
+#endif /* __ASOUNDLIB_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/conf.h b/thirdparty/linuxbsd_headers/alsa/conf.h
new file mode 100644
index 0000000000..5d293d583f
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/conf.h
@@ -0,0 +1,212 @@
+/**
+ * \file include/conf.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_CONF_H
+#define __ALSA_CONF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Config Configuration Interface
+ * The configuration functions and types allow you to read, enumerate,
+ * modify and write the contents of ALSA configuration files.
+ * \{
+ */
+
+/** \brief \c dlsym version for the config evaluate callback. */
+#define SND_CONFIG_DLSYM_VERSION_EVALUATE _dlsym_config_evaluate_001
+/** \brief \c dlsym version for the config hook callback. */
+#define SND_CONFIG_DLSYM_VERSION_HOOK _dlsym_config_hook_001
+
+/** \brief Configuration node type. */
+typedef enum _snd_config_type {
+ /** Integer number. */
+ SND_CONFIG_TYPE_INTEGER,
+ /** 64-bit integer number. */
+ SND_CONFIG_TYPE_INTEGER64,
+ /** Real number. */
+ SND_CONFIG_TYPE_REAL,
+ /** Character string. */
+ SND_CONFIG_TYPE_STRING,
+ /** Pointer (runtime only, cannot be saved). */
+ SND_CONFIG_TYPE_POINTER,
+ /** Compound node. */
+ SND_CONFIG_TYPE_COMPOUND = 1024
+} snd_config_type_t;
+
+/**
+ * \brief Internal structure for a configuration node object.
+ *
+ * The ALSA library uses a pointer to this structure as a handle to a
+ * configuration node. Applications don't access its contents directly.
+ */
+typedef struct _snd_config snd_config_t;
+/**
+ * \brief Type for a configuration compound iterator.
+ *
+ * The ALSA library uses this pointer type as a handle to a configuration
+ * compound iterator. Applications don't directly access the contents of
+ * the structure pointed to by this type.
+ */
+typedef struct _snd_config_iterator *snd_config_iterator_t;
+/**
+ * \brief Internal structure for a configuration private update object.
+ *
+ * The ALSA library uses this structure to save private update information.
+ */
+typedef struct _snd_config_update snd_config_update_t;
+
+extern snd_config_t *snd_config;
+
+int snd_config_top(snd_config_t **config);
+
+int snd_config_load(snd_config_t *config, snd_input_t *in);
+int snd_config_load_override(snd_config_t *config, snd_input_t *in);
+int snd_config_save(snd_config_t *config, snd_output_t *out);
+int snd_config_update(void);
+int snd_config_update_r(snd_config_t **top, snd_config_update_t **update, const char *path);
+int snd_config_update_free(snd_config_update_t *update);
+int snd_config_update_free_global(void);
+
+int snd_config_update_ref(snd_config_t **top);
+void snd_config_ref(snd_config_t *top);
+void snd_config_unref(snd_config_t *top);
+
+int snd_config_search(snd_config_t *config, const char *key,
+ snd_config_t **result);
+int snd_config_searchv(snd_config_t *config,
+ snd_config_t **result, ...);
+int snd_config_search_definition(snd_config_t *config,
+ const char *base, const char *key,
+ snd_config_t **result);
+
+int snd_config_expand(snd_config_t *config, snd_config_t *root,
+ const char *args, snd_config_t *private_data,
+ snd_config_t **result);
+int snd_config_evaluate(snd_config_t *config, snd_config_t *root,
+ snd_config_t *private_data, snd_config_t **result);
+
+int snd_config_add(snd_config_t *config, snd_config_t *leaf);
+int snd_config_delete(snd_config_t *config);
+int snd_config_delete_compound_members(const snd_config_t *config);
+int snd_config_copy(snd_config_t **dst, snd_config_t *src);
+
+int snd_config_make(snd_config_t **config, const char *key,
+ snd_config_type_t type);
+int snd_config_make_integer(snd_config_t **config, const char *key);
+int snd_config_make_integer64(snd_config_t **config, const char *key);
+int snd_config_make_real(snd_config_t **config, const char *key);
+int snd_config_make_string(snd_config_t **config, const char *key);
+int snd_config_make_pointer(snd_config_t **config, const char *key);
+int snd_config_make_compound(snd_config_t **config, const char *key, int join);
+
+int snd_config_imake_integer(snd_config_t **config, const char *key, const long value);
+int snd_config_imake_integer64(snd_config_t **config, const char *key, const long long value);
+int snd_config_imake_real(snd_config_t **config, const char *key, const double value);
+int snd_config_imake_string(snd_config_t **config, const char *key, const char *ascii);
+int snd_config_imake_safe_string(snd_config_t **config, const char *key, const char *ascii);
+int snd_config_imake_pointer(snd_config_t **config, const char *key, const void *ptr);
+
+snd_config_type_t snd_config_get_type(const snd_config_t *config);
+
+int snd_config_set_id(snd_config_t *config, const char *id);
+int snd_config_set_integer(snd_config_t *config, long value);
+int snd_config_set_integer64(snd_config_t *config, long long value);
+int snd_config_set_real(snd_config_t *config, double value);
+int snd_config_set_string(snd_config_t *config, const char *value);
+int snd_config_set_ascii(snd_config_t *config, const char *ascii);
+int snd_config_set_pointer(snd_config_t *config, const void *ptr);
+int snd_config_get_id(const snd_config_t *config, const char **value);
+int snd_config_get_integer(const snd_config_t *config, long *value);
+int snd_config_get_integer64(const snd_config_t *config, long long *value);
+int snd_config_get_real(const snd_config_t *config, double *value);
+int snd_config_get_ireal(const snd_config_t *config, double *value);
+int snd_config_get_string(const snd_config_t *config, const char **value);
+int snd_config_get_ascii(const snd_config_t *config, char **value);
+int snd_config_get_pointer(const snd_config_t *config, const void **value);
+int snd_config_test_id(const snd_config_t *config, const char *id);
+
+snd_config_iterator_t snd_config_iterator_first(const snd_config_t *node);
+snd_config_iterator_t snd_config_iterator_next(const snd_config_iterator_t iterator);
+snd_config_iterator_t snd_config_iterator_end(const snd_config_t *node);
+snd_config_t *snd_config_iterator_entry(const snd_config_iterator_t iterator);
+
+/**
+ * \brief Helper macro to iterate over the children of a compound node.
+ * \param[in,out] pos Iterator variable for the current node.
+ * \param[in,out] next Temporary iterator variable for the next node.
+ * \param[in] node Handle to the compound configuration node to iterate over.
+ *
+ * Use this macro like a \c for statement, e.g.:
+ * \code
+ * snd_config_iterator_t pos, next;
+ * snd_config_for_each(pos, next, node) {
+ * snd_config_t *entry = snd_config_iterator_entry(pos);
+ * ...
+ * }
+ * \endcode
+ *
+ * This macro allows deleting or removing the current node.
+ */
+#define snd_config_for_each(pos, next, node) \
+ for (pos = snd_config_iterator_first(node), next = snd_config_iterator_next(pos); pos != snd_config_iterator_end(node); pos = next, next = snd_config_iterator_next(pos))
+
+/* Misc functions */
+
+int snd_config_get_bool_ascii(const char *ascii);
+int snd_config_get_bool(const snd_config_t *conf);
+int snd_config_get_ctl_iface_ascii(const char *ascii);
+int snd_config_get_ctl_iface(const snd_config_t *conf);
+
+/* Names functions */
+
+/**
+ * Device-name list element
+ */
+typedef struct snd_devname snd_devname_t;
+
+/**
+ * Device-name list element (definition)
+ */
+struct snd_devname {
+ char *name; /**< Device name string */
+ char *comment; /**< Comments */
+ snd_devname_t *next; /**< Next pointer */
+};
+
+int snd_names_list(const char *iface, snd_devname_t **list);
+void snd_names_list_free(snd_devname_t *list);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_CONF_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/control.h b/thirdparty/linuxbsd_headers/alsa/control.h
new file mode 100644
index 0000000000..1d4bfcbb08
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/control.h
@@ -0,0 +1,622 @@
+/**
+ * \file include/control.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_CONTROL_H
+#define __ALSA_CONTROL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Control Control Interface
+ * The control interface.
+ * See \ref control page for more details.
+ * \{
+ */
+
+/** dlsym version for interface entry callback */
+#define SND_CONTROL_DLSYM_VERSION _dlsym_control_001
+
+/** IEC958 structure */
+typedef struct snd_aes_iec958 {
+ unsigned char status[24]; /**< AES/IEC958 channel status bits */
+ unsigned char subcode[147]; /**< AES/IEC958 subcode bits */
+ unsigned char pad; /**< nothing */
+ unsigned char dig_subframe[4]; /**< AES/IEC958 subframe bits */
+} snd_aes_iec958_t;
+
+/** CTL card info container */
+typedef struct _snd_ctl_card_info snd_ctl_card_info_t;
+
+/** CTL element identifier container */
+typedef struct _snd_ctl_elem_id snd_ctl_elem_id_t;
+
+/** CTL element identifier list container */
+typedef struct _snd_ctl_elem_list snd_ctl_elem_list_t;
+
+/** CTL element info container */
+typedef struct _snd_ctl_elem_info snd_ctl_elem_info_t;
+
+/** CTL element value container */
+typedef struct _snd_ctl_elem_value snd_ctl_elem_value_t;
+
+/** CTL event container */
+typedef struct _snd_ctl_event snd_ctl_event_t;
+
+/** CTL element type */
+typedef enum _snd_ctl_elem_type {
+ /** Invalid type */
+ SND_CTL_ELEM_TYPE_NONE = 0,
+ /** Boolean contents */
+ SND_CTL_ELEM_TYPE_BOOLEAN,
+ /** Integer contents */
+ SND_CTL_ELEM_TYPE_INTEGER,
+ /** Enumerated contents */
+ SND_CTL_ELEM_TYPE_ENUMERATED,
+ /** Bytes contents */
+ SND_CTL_ELEM_TYPE_BYTES,
+ /** IEC958 (S/PDIF) setting content */
+ SND_CTL_ELEM_TYPE_IEC958,
+ /** 64-bit integer contents */
+ SND_CTL_ELEM_TYPE_INTEGER64,
+ SND_CTL_ELEM_TYPE_LAST = SND_CTL_ELEM_TYPE_INTEGER64
+} snd_ctl_elem_type_t;
+
+/** CTL related interface */
+typedef enum _snd_ctl_elem_iface {
+ /** Card level */
+ SND_CTL_ELEM_IFACE_CARD = 0,
+ /** Hardware dependent device */
+ SND_CTL_ELEM_IFACE_HWDEP,
+ /** Mixer */
+ SND_CTL_ELEM_IFACE_MIXER,
+ /** PCM */
+ SND_CTL_ELEM_IFACE_PCM,
+ /** RawMidi */
+ SND_CTL_ELEM_IFACE_RAWMIDI,
+ /** Timer */
+ SND_CTL_ELEM_IFACE_TIMER,
+ /** Sequencer */
+ SND_CTL_ELEM_IFACE_SEQUENCER,
+ SND_CTL_ELEM_IFACE_LAST = SND_CTL_ELEM_IFACE_SEQUENCER
+} snd_ctl_elem_iface_t;
+
+/** Event class */
+typedef enum _snd_ctl_event_type {
+ /** Elements related event */
+ SND_CTL_EVENT_ELEM = 0,
+ SND_CTL_EVENT_LAST = SND_CTL_EVENT_ELEM
+}snd_ctl_event_type_t;
+
+/** Element has been removed (Warning: test this first and if set don't
+ * test the other masks) \hideinitializer */
+#define SND_CTL_EVENT_MASK_REMOVE (~0U)
+/** Element value has been changed \hideinitializer */
+#define SND_CTL_EVENT_MASK_VALUE (1<<0)
+/** Element info has been changed \hideinitializer */
+#define SND_CTL_EVENT_MASK_INFO (1<<1)
+/** Element has been added \hideinitializer */
+#define SND_CTL_EVENT_MASK_ADD (1<<2)
+/** Element's TLV value has been changed \hideinitializer */
+#define SND_CTL_EVENT_MASK_TLV (1<<3)
+
+/** CTL name helper */
+#define SND_CTL_NAME_NONE ""
+/** CTL name helper */
+#define SND_CTL_NAME_PLAYBACK "Playback "
+/** CTL name helper */
+#define SND_CTL_NAME_CAPTURE "Capture "
+
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_NONE ""
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_SWITCH "Switch"
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_VOLUME "Volume"
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_DEFAULT "Default"
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_MASK "Mask"
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_CON_MASK "Con Mask"
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_PRO_MASK "Pro Mask"
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_PCM_STREAM "PCM Stream"
+/** Element name for IEC958 (S/PDIF) */
+#define SND_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SND_CTL_NAME_##direction SND_CTL_NAME_IEC958_##what
+
+/** Mask for the major Power State identifier */
+#define SND_CTL_POWER_MASK 0xff00
+/** ACPI/PCI Power State D0 */
+#define SND_CTL_POWER_D0 0x0000
+/** ACPI/PCI Power State D1 */
+#define SND_CTL_POWER_D1 0x0100
+/** ACPI/PCI Power State D2 */
+#define SND_CTL_POWER_D2 0x0200
+/** ACPI/PCI Power State D3 */
+#define SND_CTL_POWER_D3 0x0300
+/** ACPI/PCI Power State D3hot */
+#define SND_CTL_POWER_D3hot (SND_CTL_POWER_D3|0x0000)
+/** ACPI/PCI Power State D3cold */
+#define SND_CTL_POWER_D3cold (SND_CTL_POWER_D3|0x0001)
+
+/** TLV type - Container */
+#define SND_CTL_TLVT_CONTAINER 0x0000
+/** TLV type - basic dB scale */
+#define SND_CTL_TLVT_DB_SCALE 0x0001
+/** TLV type - linear volume */
+#define SND_CTL_TLVT_DB_LINEAR 0x0002
+/** TLV type - dB range container */
+#define SND_CTL_TLVT_DB_RANGE 0x0003
+/** TLV type - dB scale specified by min/max values */
+#define SND_CTL_TLVT_DB_MINMAX 0x0004
+/** TLV type - dB scale specified by min/max values (with mute) */
+#define SND_CTL_TLVT_DB_MINMAX_MUTE 0x0005
+
+/** Mute state */
+#define SND_CTL_TLV_DB_GAIN_MUTE -9999999
+
+/** TLV type - fixed channel map positions */
+#define SND_CTL_TLVT_CHMAP_FIXED 0x00101
+/** TLV type - freely swappable channel map positions */
+#define SND_CTL_TLVT_CHMAP_VAR 0x00102
+/** TLV type - pair-wise swappable channel map positions */
+#define SND_CTL_TLVT_CHMAP_PAIRED 0x00103
+
+/** CTL type */
+typedef enum _snd_ctl_type {
+ /** Kernel level CTL */
+ SND_CTL_TYPE_HW,
+ /** Shared memory client CTL */
+ SND_CTL_TYPE_SHM,
+ /** INET client CTL (not yet implemented) */
+ SND_CTL_TYPE_INET,
+ /** External control plugin */
+ SND_CTL_TYPE_EXT
+} snd_ctl_type_t;
+
+/** Non blocking mode (flag for open mode) \hideinitializer */
+#define SND_CTL_NONBLOCK 0x0001
+
+/** Async notification (flag for open mode) \hideinitializer */
+#define SND_CTL_ASYNC 0x0002
+
+/** Read only (flag for open mode) \hideinitializer */
+#define SND_CTL_READONLY 0x0004
+
+/** CTL handle */
+typedef struct _snd_ctl snd_ctl_t;
+
+/** Don't destroy the ctl handle when close */
+#define SND_SCTL_NOFREE 0x0001
+
+/** SCTL type */
+typedef struct _snd_sctl snd_sctl_t;
+
+int snd_card_load(int card);
+int snd_card_next(int *card);
+int snd_card_get_index(const char *name);
+int snd_card_get_name(int card, char **name);
+int snd_card_get_longname(int card, char **name);
+
+int snd_device_name_hint(int card, const char *iface, void ***hints);
+int snd_device_name_free_hint(void **hints);
+char *snd_device_name_get_hint(const void *hint, const char *id);
+
+int snd_ctl_open(snd_ctl_t **ctl, const char *name, int mode);
+int snd_ctl_open_lconf(snd_ctl_t **ctl, const char *name, int mode, snd_config_t *lconf);
+int snd_ctl_open_fallback(snd_ctl_t **ctl, snd_config_t *root, const char *name, const char *orig_name, int mode);
+int snd_ctl_close(snd_ctl_t *ctl);
+int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock);
+static __inline__ int snd_ctl_abort(snd_ctl_t *ctl) { return snd_ctl_nonblock(ctl, 2); }
+int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl,
+ snd_async_callback_t callback, void *private_data);
+snd_ctl_t *snd_async_handler_get_ctl(snd_async_handler_t *handler);
+int snd_ctl_poll_descriptors_count(snd_ctl_t *ctl);
+int snd_ctl_poll_descriptors(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int space);
+int snd_ctl_poll_descriptors_revents(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+int snd_ctl_subscribe_events(snd_ctl_t *ctl, int subscribe);
+int snd_ctl_card_info(snd_ctl_t *ctl, snd_ctl_card_info_t *info);
+int snd_ctl_elem_list(snd_ctl_t *ctl, snd_ctl_elem_list_t *list);
+int snd_ctl_elem_info(snd_ctl_t *ctl, snd_ctl_elem_info_t *info);
+int snd_ctl_elem_read(snd_ctl_t *ctl, snd_ctl_elem_value_t *data);
+int snd_ctl_elem_write(snd_ctl_t *ctl, snd_ctl_elem_value_t *data);
+int snd_ctl_elem_lock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id);
+int snd_ctl_elem_unlock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id);
+int snd_ctl_elem_tlv_read(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ unsigned int *tlv, unsigned int tlv_size);
+int snd_ctl_elem_tlv_write(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ const unsigned int *tlv);
+int snd_ctl_elem_tlv_command(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ const unsigned int *tlv);
+#ifdef __ALSA_HWDEP_H
+int snd_ctl_hwdep_next_device(snd_ctl_t *ctl, int * device);
+int snd_ctl_hwdep_info(snd_ctl_t *ctl, snd_hwdep_info_t * info);
+#endif
+#ifdef __ALSA_PCM_H
+int snd_ctl_pcm_next_device(snd_ctl_t *ctl, int *device);
+int snd_ctl_pcm_info(snd_ctl_t *ctl, snd_pcm_info_t * info);
+int snd_ctl_pcm_prefer_subdevice(snd_ctl_t *ctl, int subdev);
+#endif
+#ifdef __ALSA_RAWMIDI_H
+int snd_ctl_rawmidi_next_device(snd_ctl_t *ctl, int * device);
+int snd_ctl_rawmidi_info(snd_ctl_t *ctl, snd_rawmidi_info_t * info);
+int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev);
+#endif
+int snd_ctl_set_power_state(snd_ctl_t *ctl, unsigned int state);
+int snd_ctl_get_power_state(snd_ctl_t *ctl, unsigned int *state);
+
+int snd_ctl_read(snd_ctl_t *ctl, snd_ctl_event_t *event);
+int snd_ctl_wait(snd_ctl_t *ctl, int timeout);
+const char *snd_ctl_name(snd_ctl_t *ctl);
+snd_ctl_type_t snd_ctl_type(snd_ctl_t *ctl);
+
+const char *snd_ctl_elem_type_name(snd_ctl_elem_type_t type);
+const char *snd_ctl_elem_iface_name(snd_ctl_elem_iface_t iface);
+const char *snd_ctl_event_type_name(snd_ctl_event_type_t type);
+
+unsigned int snd_ctl_event_elem_get_mask(const snd_ctl_event_t *obj);
+unsigned int snd_ctl_event_elem_get_numid(const snd_ctl_event_t *obj);
+void snd_ctl_event_elem_get_id(const snd_ctl_event_t *obj, snd_ctl_elem_id_t *ptr);
+snd_ctl_elem_iface_t snd_ctl_event_elem_get_interface(const snd_ctl_event_t *obj);
+unsigned int snd_ctl_event_elem_get_device(const snd_ctl_event_t *obj);
+unsigned int snd_ctl_event_elem_get_subdevice(const snd_ctl_event_t *obj);
+const char *snd_ctl_event_elem_get_name(const snd_ctl_event_t *obj);
+unsigned int snd_ctl_event_elem_get_index(const snd_ctl_event_t *obj);
+
+int snd_ctl_elem_list_alloc_space(snd_ctl_elem_list_t *obj, unsigned int entries);
+void snd_ctl_elem_list_free_space(snd_ctl_elem_list_t *obj);
+
+char *snd_ctl_ascii_elem_id_get(snd_ctl_elem_id_t *id);
+int snd_ctl_ascii_elem_id_parse(snd_ctl_elem_id_t *dst, const char *str);
+int snd_ctl_ascii_value_parse(snd_ctl_t *handle,
+ snd_ctl_elem_value_t *dst,
+ snd_ctl_elem_info_t *info,
+ const char *value);
+
+size_t snd_ctl_elem_id_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_ctl_elem_id_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_ctl_elem_id_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_id)
+int snd_ctl_elem_id_malloc(snd_ctl_elem_id_t **ptr);
+void snd_ctl_elem_id_free(snd_ctl_elem_id_t *obj);
+void snd_ctl_elem_id_clear(snd_ctl_elem_id_t *obj);
+void snd_ctl_elem_id_copy(snd_ctl_elem_id_t *dst, const snd_ctl_elem_id_t *src);
+unsigned int snd_ctl_elem_id_get_numid(const snd_ctl_elem_id_t *obj);
+snd_ctl_elem_iface_t snd_ctl_elem_id_get_interface(const snd_ctl_elem_id_t *obj);
+unsigned int snd_ctl_elem_id_get_device(const snd_ctl_elem_id_t *obj);
+unsigned int snd_ctl_elem_id_get_subdevice(const snd_ctl_elem_id_t *obj);
+const char *snd_ctl_elem_id_get_name(const snd_ctl_elem_id_t *obj);
+unsigned int snd_ctl_elem_id_get_index(const snd_ctl_elem_id_t *obj);
+void snd_ctl_elem_id_set_numid(snd_ctl_elem_id_t *obj, unsigned int val);
+void snd_ctl_elem_id_set_interface(snd_ctl_elem_id_t *obj, snd_ctl_elem_iface_t val);
+void snd_ctl_elem_id_set_device(snd_ctl_elem_id_t *obj, unsigned int val);
+void snd_ctl_elem_id_set_subdevice(snd_ctl_elem_id_t *obj, unsigned int val);
+void snd_ctl_elem_id_set_name(snd_ctl_elem_id_t *obj, const char *val);
+void snd_ctl_elem_id_set_index(snd_ctl_elem_id_t *obj, unsigned int val);
+
+size_t snd_ctl_card_info_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_ctl_card_info_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_ctl_card_info_alloca(ptr) __snd_alloca(ptr, snd_ctl_card_info)
+int snd_ctl_card_info_malloc(snd_ctl_card_info_t **ptr);
+void snd_ctl_card_info_free(snd_ctl_card_info_t *obj);
+void snd_ctl_card_info_clear(snd_ctl_card_info_t *obj);
+void snd_ctl_card_info_copy(snd_ctl_card_info_t *dst, const snd_ctl_card_info_t *src);
+int snd_ctl_card_info_get_card(const snd_ctl_card_info_t *obj);
+const char *snd_ctl_card_info_get_id(const snd_ctl_card_info_t *obj);
+const char *snd_ctl_card_info_get_driver(const snd_ctl_card_info_t *obj);
+const char *snd_ctl_card_info_get_name(const snd_ctl_card_info_t *obj);
+const char *snd_ctl_card_info_get_longname(const snd_ctl_card_info_t *obj);
+const char *snd_ctl_card_info_get_mixername(const snd_ctl_card_info_t *obj);
+const char *snd_ctl_card_info_get_components(const snd_ctl_card_info_t *obj);
+
+size_t snd_ctl_event_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_ctl_event_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_ctl_event_alloca(ptr) __snd_alloca(ptr, snd_ctl_event)
+int snd_ctl_event_malloc(snd_ctl_event_t **ptr);
+void snd_ctl_event_free(snd_ctl_event_t *obj);
+void snd_ctl_event_clear(snd_ctl_event_t *obj);
+void snd_ctl_event_copy(snd_ctl_event_t *dst, const snd_ctl_event_t *src);
+snd_ctl_event_type_t snd_ctl_event_get_type(const snd_ctl_event_t *obj);
+
+size_t snd_ctl_elem_list_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_ctl_elem_list_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_ctl_elem_list_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_list)
+int snd_ctl_elem_list_malloc(snd_ctl_elem_list_t **ptr);
+void snd_ctl_elem_list_free(snd_ctl_elem_list_t *obj);
+void snd_ctl_elem_list_clear(snd_ctl_elem_list_t *obj);
+void snd_ctl_elem_list_copy(snd_ctl_elem_list_t *dst, const snd_ctl_elem_list_t *src);
+void snd_ctl_elem_list_set_offset(snd_ctl_elem_list_t *obj, unsigned int val);
+unsigned int snd_ctl_elem_list_get_used(const snd_ctl_elem_list_t *obj);
+unsigned int snd_ctl_elem_list_get_count(const snd_ctl_elem_list_t *obj);
+void snd_ctl_elem_list_get_id(const snd_ctl_elem_list_t *obj, unsigned int idx, snd_ctl_elem_id_t *ptr);
+unsigned int snd_ctl_elem_list_get_numid(const snd_ctl_elem_list_t *obj, unsigned int idx);
+snd_ctl_elem_iface_t snd_ctl_elem_list_get_interface(const snd_ctl_elem_list_t *obj, unsigned int idx);
+unsigned int snd_ctl_elem_list_get_device(const snd_ctl_elem_list_t *obj, unsigned int idx);
+unsigned int snd_ctl_elem_list_get_subdevice(const snd_ctl_elem_list_t *obj, unsigned int idx);
+const char *snd_ctl_elem_list_get_name(const snd_ctl_elem_list_t *obj, unsigned int idx);
+unsigned int snd_ctl_elem_list_get_index(const snd_ctl_elem_list_t *obj, unsigned int idx);
+
+size_t snd_ctl_elem_info_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_ctl_elem_info_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_ctl_elem_info_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_info)
+int snd_ctl_elem_info_malloc(snd_ctl_elem_info_t **ptr);
+void snd_ctl_elem_info_free(snd_ctl_elem_info_t *obj);
+void snd_ctl_elem_info_clear(snd_ctl_elem_info_t *obj);
+void snd_ctl_elem_info_copy(snd_ctl_elem_info_t *dst, const snd_ctl_elem_info_t *src);
+snd_ctl_elem_type_t snd_ctl_elem_info_get_type(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_readable(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_writable(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_volatile(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_inactive(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_locked(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_tlv_readable(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_tlv_writable(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_tlv_commandable(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_owner(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_user(const snd_ctl_elem_info_t *obj);
+pid_t snd_ctl_elem_info_get_owner(const snd_ctl_elem_info_t *obj);
+unsigned int snd_ctl_elem_info_get_count(const snd_ctl_elem_info_t *obj);
+long snd_ctl_elem_info_get_min(const snd_ctl_elem_info_t *obj);
+long snd_ctl_elem_info_get_max(const snd_ctl_elem_info_t *obj);
+long snd_ctl_elem_info_get_step(const snd_ctl_elem_info_t *obj);
+long long snd_ctl_elem_info_get_min64(const snd_ctl_elem_info_t *obj);
+long long snd_ctl_elem_info_get_max64(const snd_ctl_elem_info_t *obj);
+long long snd_ctl_elem_info_get_step64(const snd_ctl_elem_info_t *obj);
+unsigned int snd_ctl_elem_info_get_items(const snd_ctl_elem_info_t *obj);
+void snd_ctl_elem_info_set_item(snd_ctl_elem_info_t *obj, unsigned int val);
+const char *snd_ctl_elem_info_get_item_name(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_get_dimensions(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_get_dimension(const snd_ctl_elem_info_t *obj, unsigned int idx);
+int snd_ctl_elem_info_set_dimension(snd_ctl_elem_info_t *info,
+ const int dimension[4]);
+void snd_ctl_elem_info_get_id(const snd_ctl_elem_info_t *obj, snd_ctl_elem_id_t *ptr);
+unsigned int snd_ctl_elem_info_get_numid(const snd_ctl_elem_info_t *obj);
+snd_ctl_elem_iface_t snd_ctl_elem_info_get_interface(const snd_ctl_elem_info_t *obj);
+unsigned int snd_ctl_elem_info_get_device(const snd_ctl_elem_info_t *obj);
+unsigned int snd_ctl_elem_info_get_subdevice(const snd_ctl_elem_info_t *obj);
+const char *snd_ctl_elem_info_get_name(const snd_ctl_elem_info_t *obj);
+unsigned int snd_ctl_elem_info_get_index(const snd_ctl_elem_info_t *obj);
+void snd_ctl_elem_info_set_id(snd_ctl_elem_info_t *obj, const snd_ctl_elem_id_t *ptr);
+void snd_ctl_elem_info_set_numid(snd_ctl_elem_info_t *obj, unsigned int val);
+void snd_ctl_elem_info_set_interface(snd_ctl_elem_info_t *obj, snd_ctl_elem_iface_t val);
+void snd_ctl_elem_info_set_device(snd_ctl_elem_info_t *obj, unsigned int val);
+void snd_ctl_elem_info_set_subdevice(snd_ctl_elem_info_t *obj, unsigned int val);
+void snd_ctl_elem_info_set_name(snd_ctl_elem_info_t *obj, const char *val);
+void snd_ctl_elem_info_set_index(snd_ctl_elem_info_t *obj, unsigned int val);
+
+int snd_ctl_add_integer_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
+ unsigned int element_count,
+ unsigned int member_count,
+ long min, long max, long step);
+int snd_ctl_add_integer64_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
+ unsigned int element_count,
+ unsigned int member_count,
+ long long min, long long max,
+ long long step);
+int snd_ctl_add_boolean_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
+ unsigned int element_count,
+ unsigned int member_count);
+int snd_ctl_add_enumerated_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
+ unsigned int element_count,
+ unsigned int member_count,
+ unsigned int items,
+ const char *const labels[]);
+int snd_ctl_add_bytes_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
+ unsigned int element_count,
+ unsigned int member_count);
+
+int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count, long imin, long imax, long istep);
+int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count, long long imin, long long imax, long long istep);
+int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count);
+int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count, unsigned int items, const char *const names[]);
+int snd_ctl_elem_add_iec958(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id);
+int snd_ctl_elem_remove(snd_ctl_t *ctl, snd_ctl_elem_id_t *id);
+
+size_t snd_ctl_elem_value_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_ctl_elem_value_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_ctl_elem_value_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_value)
+int snd_ctl_elem_value_malloc(snd_ctl_elem_value_t **ptr);
+void snd_ctl_elem_value_free(snd_ctl_elem_value_t *obj);
+void snd_ctl_elem_value_clear(snd_ctl_elem_value_t *obj);
+void snd_ctl_elem_value_copy(snd_ctl_elem_value_t *dst, const snd_ctl_elem_value_t *src);
+int snd_ctl_elem_value_compare(snd_ctl_elem_value_t *left, const snd_ctl_elem_value_t *right);
+void snd_ctl_elem_value_get_id(const snd_ctl_elem_value_t *obj, snd_ctl_elem_id_t *ptr);
+unsigned int snd_ctl_elem_value_get_numid(const snd_ctl_elem_value_t *obj);
+snd_ctl_elem_iface_t snd_ctl_elem_value_get_interface(const snd_ctl_elem_value_t *obj);
+unsigned int snd_ctl_elem_value_get_device(const snd_ctl_elem_value_t *obj);
+unsigned int snd_ctl_elem_value_get_subdevice(const snd_ctl_elem_value_t *obj);
+const char *snd_ctl_elem_value_get_name(const snd_ctl_elem_value_t *obj);
+unsigned int snd_ctl_elem_value_get_index(const snd_ctl_elem_value_t *obj);
+void snd_ctl_elem_value_set_id(snd_ctl_elem_value_t *obj, const snd_ctl_elem_id_t *ptr);
+void snd_ctl_elem_value_set_numid(snd_ctl_elem_value_t *obj, unsigned int val);
+void snd_ctl_elem_value_set_interface(snd_ctl_elem_value_t *obj, snd_ctl_elem_iface_t val);
+void snd_ctl_elem_value_set_device(snd_ctl_elem_value_t *obj, unsigned int val);
+void snd_ctl_elem_value_set_subdevice(snd_ctl_elem_value_t *obj, unsigned int val);
+void snd_ctl_elem_value_set_name(snd_ctl_elem_value_t *obj, const char *val);
+void snd_ctl_elem_value_set_index(snd_ctl_elem_value_t *obj, unsigned int val);
+int snd_ctl_elem_value_get_boolean(const snd_ctl_elem_value_t *obj, unsigned int idx);
+long snd_ctl_elem_value_get_integer(const snd_ctl_elem_value_t *obj, unsigned int idx);
+long long snd_ctl_elem_value_get_integer64(const snd_ctl_elem_value_t *obj, unsigned int idx);
+unsigned int snd_ctl_elem_value_get_enumerated(const snd_ctl_elem_value_t *obj, unsigned int idx);
+unsigned char snd_ctl_elem_value_get_byte(const snd_ctl_elem_value_t *obj, unsigned int idx);
+void snd_ctl_elem_value_set_boolean(snd_ctl_elem_value_t *obj, unsigned int idx, long val);
+void snd_ctl_elem_value_set_integer(snd_ctl_elem_value_t *obj, unsigned int idx, long val);
+void snd_ctl_elem_value_set_integer64(snd_ctl_elem_value_t *obj, unsigned int idx, long long val);
+void snd_ctl_elem_value_set_enumerated(snd_ctl_elem_value_t *obj, unsigned int idx, unsigned int val);
+void snd_ctl_elem_value_set_byte(snd_ctl_elem_value_t *obj, unsigned int idx, unsigned char val);
+void snd_ctl_elem_set_bytes(snd_ctl_elem_value_t *obj, void *data, size_t size);
+const void * snd_ctl_elem_value_get_bytes(const snd_ctl_elem_value_t *obj);
+void snd_ctl_elem_value_get_iec958(const snd_ctl_elem_value_t *obj, snd_aes_iec958_t *ptr);
+void snd_ctl_elem_value_set_iec958(snd_ctl_elem_value_t *obj, const snd_aes_iec958_t *ptr);
+
+int snd_tlv_parse_dB_info(unsigned int *tlv, unsigned int tlv_size,
+ unsigned int **db_tlvp);
+int snd_tlv_get_dB_range(unsigned int *tlv, long rangemin, long rangemax,
+ long *min, long *max);
+int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
+ long volume, long *db_gain);
+int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
+ long db_gain, long *value, int xdir);
+int snd_ctl_get_dB_range(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ long *min, long *max);
+int snd_ctl_convert_to_dB(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ long volume, long *db_gain);
+int snd_ctl_convert_from_dB(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ long db_gain, long *value, int xdir);
+
+/**
+ * \defgroup HControl High level Control Interface
+ * \ingroup Control
+ * The high level control interface.
+ * See \ref hcontrol page for more details.
+ * \{
+ */
+
+/** HCTL element handle */
+typedef struct _snd_hctl_elem snd_hctl_elem_t;
+
+/** HCTL handle */
+typedef struct _snd_hctl snd_hctl_t;
+
+/**
+ * \brief Compare function for sorting HCTL elements
+ * \param e1 First element
+ * \param e2 Second element
+ * \return -1 if e1 < e2, 0 if e1 == e2, 1 if e1 > e2
+ */
+typedef int (*snd_hctl_compare_t)(const snd_hctl_elem_t *e1,
+ const snd_hctl_elem_t *e2);
+int snd_hctl_compare_fast(const snd_hctl_elem_t *c1,
+ const snd_hctl_elem_t *c2);
+/**
+ * \brief HCTL callback function
+ * \param hctl HCTL handle
+ * \param mask event mask
+ * \param elem related HCTL element (if any)
+ * \return 0 on success otherwise a negative error code
+ */
+typedef int (*snd_hctl_callback_t)(snd_hctl_t *hctl,
+ unsigned int mask,
+ snd_hctl_elem_t *elem);
+/**
+ * \brief HCTL element callback function
+ * \param elem HCTL element
+ * \param mask event mask
+ * \return 0 on success otherwise a negative error code
+ */
+typedef int (*snd_hctl_elem_callback_t)(snd_hctl_elem_t *elem,
+ unsigned int mask);
+
+int snd_hctl_open(snd_hctl_t **hctl, const char *name, int mode);
+int snd_hctl_open_ctl(snd_hctl_t **hctlp, snd_ctl_t *ctl);
+int snd_hctl_close(snd_hctl_t *hctl);
+int snd_hctl_nonblock(snd_hctl_t *hctl, int nonblock);
+static __inline__ int snd_hctl_abort(snd_hctl_t *hctl) { return snd_hctl_nonblock(hctl, 2); }
+int snd_hctl_poll_descriptors_count(snd_hctl_t *hctl);
+int snd_hctl_poll_descriptors(snd_hctl_t *hctl, struct pollfd *pfds, unsigned int space);
+int snd_hctl_poll_descriptors_revents(snd_hctl_t *ctl, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+unsigned int snd_hctl_get_count(snd_hctl_t *hctl);
+int snd_hctl_set_compare(snd_hctl_t *hctl, snd_hctl_compare_t hsort);
+snd_hctl_elem_t *snd_hctl_first_elem(snd_hctl_t *hctl);
+snd_hctl_elem_t *snd_hctl_last_elem(snd_hctl_t *hctl);
+snd_hctl_elem_t *snd_hctl_find_elem(snd_hctl_t *hctl, const snd_ctl_elem_id_t *id);
+void snd_hctl_set_callback(snd_hctl_t *hctl, snd_hctl_callback_t callback);
+void snd_hctl_set_callback_private(snd_hctl_t *hctl, void *data);
+void *snd_hctl_get_callback_private(snd_hctl_t *hctl);
+int snd_hctl_load(snd_hctl_t *hctl);
+int snd_hctl_free(snd_hctl_t *hctl);
+int snd_hctl_handle_events(snd_hctl_t *hctl);
+const char *snd_hctl_name(snd_hctl_t *hctl);
+int snd_hctl_wait(snd_hctl_t *hctl, int timeout);
+snd_ctl_t *snd_hctl_ctl(snd_hctl_t *hctl);
+
+snd_hctl_elem_t *snd_hctl_elem_next(snd_hctl_elem_t *elem);
+snd_hctl_elem_t *snd_hctl_elem_prev(snd_hctl_elem_t *elem);
+int snd_hctl_elem_info(snd_hctl_elem_t *elem, snd_ctl_elem_info_t * info);
+int snd_hctl_elem_read(snd_hctl_elem_t *elem, snd_ctl_elem_value_t * value);
+int snd_hctl_elem_write(snd_hctl_elem_t *elem, snd_ctl_elem_value_t * value);
+int snd_hctl_elem_tlv_read(snd_hctl_elem_t *elem, unsigned int *tlv, unsigned int tlv_size);
+int snd_hctl_elem_tlv_write(snd_hctl_elem_t *elem, const unsigned int *tlv);
+int snd_hctl_elem_tlv_command(snd_hctl_elem_t *elem, const unsigned int *tlv);
+
+snd_hctl_t *snd_hctl_elem_get_hctl(snd_hctl_elem_t *elem);
+
+void snd_hctl_elem_get_id(const snd_hctl_elem_t *obj, snd_ctl_elem_id_t *ptr);
+unsigned int snd_hctl_elem_get_numid(const snd_hctl_elem_t *obj);
+snd_ctl_elem_iface_t snd_hctl_elem_get_interface(const snd_hctl_elem_t *obj);
+unsigned int snd_hctl_elem_get_device(const snd_hctl_elem_t *obj);
+unsigned int snd_hctl_elem_get_subdevice(const snd_hctl_elem_t *obj);
+const char *snd_hctl_elem_get_name(const snd_hctl_elem_t *obj);
+unsigned int snd_hctl_elem_get_index(const snd_hctl_elem_t *obj);
+void snd_hctl_elem_set_callback(snd_hctl_elem_t *obj, snd_hctl_elem_callback_t val);
+void * snd_hctl_elem_get_callback_private(const snd_hctl_elem_t *obj);
+void snd_hctl_elem_set_callback_private(snd_hctl_elem_t *obj, void * val);
+
+/** \} */
+
+/** \} */
+
+/**
+ * \defgroup SControl Setup Control Interface
+ * \ingroup Control
+ * The setup control interface - set or modify control elements from a configuration file.
+ * \{
+ */
+
+int snd_sctl_build(snd_sctl_t **ctl, snd_ctl_t *handle, snd_config_t *config,
+ snd_config_t *private_data, int mode);
+int snd_sctl_free(snd_sctl_t *handle);
+int snd_sctl_install(snd_sctl_t *handle);
+int snd_sctl_remove(snd_sctl_t *handle);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_CONTROL_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/control_external.h b/thirdparty/linuxbsd_headers/alsa/control_external.h
new file mode 100644
index 0000000000..12958e70a5
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/control_external.h
@@ -0,0 +1,286 @@
+/**
+ * \file include/control_external.h
+ * \brief External control plugin SDK
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2005
+ *
+ * External control plugin SDK.
+ */
+
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+#ifndef __ALSA_CONTROL_EXTERNAL_H
+#define __ALSA_CONTROL_EXTERNAL_H
+
+#include "control.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup CtlPlugin_SDK External Control Plugin SDK
+ * \{
+ */
+
+/**
+ * Define the object entry for external control plugins
+ */
+#define SND_CTL_PLUGIN_ENTRY(name) _snd_ctl_##name##_open
+
+/**
+ * Define the symbols of the given control plugin with versions
+ */
+#define SND_CTL_PLUGIN_SYMBOL(name) SND_DLSYM_BUILD_VERSION(SND_CTL_PLUGIN_ENTRY(name), SND_CONTROL_DLSYM_VERSION);
+
+/**
+ * Define the control plugin
+ */
+#define SND_CTL_PLUGIN_DEFINE_FUNC(plugin) \
+int SND_CTL_PLUGIN_ENTRY(plugin) (snd_ctl_t **handlep, const char *name,\
+ snd_config_t *root, snd_config_t *conf, int mode)
+
+/** External control plugin handle */
+typedef struct snd_ctl_ext snd_ctl_ext_t;
+/** Callback table of control ext */
+typedef struct snd_ctl_ext_callback snd_ctl_ext_callback_t;
+/** Key to access a control pointer */
+typedef unsigned long snd_ctl_ext_key_t;
+#ifdef DOC_HIDDEN
+/* redefine typedef's for stupid doxygen */
+typedef snd_ctl_ext snd_ctl_ext_t;
+typedef snd_ctl_ext_callback snd_ctl_ext_callback_t;
+#endif
+/** Callback to handle TLV commands. */
+typedef int (snd_ctl_ext_tlv_rw_t)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int op_flag, unsigned int numid,
+ unsigned int *tlv, unsigned int tlv_size);
+
+/*
+ * Protocol version
+ */
+#define SND_CTL_EXT_VERSION_MAJOR 1 /**< Protocol major version */
+#define SND_CTL_EXT_VERSION_MINOR 0 /**< Protocol minor version */
+#define SND_CTL_EXT_VERSION_TINY 1 /**< Protocol tiny version */
+/**
+ * external plugin protocol version
+ */
+#define SND_CTL_EXT_VERSION ((SND_CTL_EXT_VERSION_MAJOR<<16) |\
+ (SND_CTL_EXT_VERSION_MINOR<<8) |\
+ (SND_CTL_EXT_VERSION_TINY))
+
+/** Handle of control ext */
+struct snd_ctl_ext {
+ /**
+ * protocol version; #SND_CTL_EXT_VERSION must be filled here
+ * before calling #snd_ctl_ext_create()
+ */
+ unsigned int version;
+ /**
+ * Index of this card; must be filled before calling #snd_ctl_ext_create()
+ */
+ int card_idx;
+ /**
+ * ID string of this card; must be filled before calling #snd_ctl_ext_create()
+ */
+ char id[16];
+ /**
+ * Driver name of this card; must be filled before calling #snd_ctl_ext_create()
+ */
+ char driver[16];
+ /**
+ * short name of this card; must be filled before calling #snd_ctl_ext_create()
+ */
+ char name[32];
+ /**
+ * Long name of this card; must be filled before calling #snd_ctl_ext_create()
+ */
+ char longname[80];
+ /**
+ * Mixer name of this card; must be filled before calling #snd_ctl_ext_create()
+ */
+ char mixername[80];
+ /**
+ * poll descriptor
+ */
+ int poll_fd;
+
+ /**
+ * callbacks of this plugin; must be filled before calling #snd_pcm_ioplug_create()
+ */
+ const snd_ctl_ext_callback_t *callback;
+ /**
+ * private data, which can be used freely in the driver callbacks
+ */
+ void *private_data;
+ /**
+ * control handle filled by #snd_ctl_ext_create()
+ */
+ snd_ctl_t *handle;
+
+ int nonblock; /**< non-block mode; read-only */
+ int subscribed; /**< events subscribed; read-only */
+
+ /**
+ * optional TLV data for the control (since protocol 1.0.1)
+ */
+ union {
+ snd_ctl_ext_tlv_rw_t *c;
+ const unsigned int *p;
+ } tlv;
+};
+
+/** Callback table of ext. */
+struct snd_ctl_ext_callback {
+ /**
+ * close the control handle; optional
+ */
+ void (*close)(snd_ctl_ext_t *ext);
+ /**
+ * return the total number of elements; required
+ */
+ int (*elem_count)(snd_ctl_ext_t *ext);
+ /**
+ * return the element id of the given offset (array index); required
+ */
+ int (*elem_list)(snd_ctl_ext_t *ext, unsigned int offset, snd_ctl_elem_id_t *id);
+ /**
+ * convert the element id to a search key; required
+ */
+ snd_ctl_ext_key_t (*find_elem)(snd_ctl_ext_t *ext, const snd_ctl_elem_id_t *id);
+ /**
+ * the destructor of the key; optional
+ */
+ void (*free_key)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key);
+ /**
+ * get the attribute of the element; required
+ */
+ int (*get_attribute)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
+ int *type, unsigned int *acc, unsigned int *count);
+ /**
+ * get the element information of integer type
+ */
+ int (*get_integer_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
+ long *imin, long *imax, long *istep);
+ /**
+ * get the element information of integer64 type
+ */
+ int (*get_integer64_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
+ int64_t *imin, int64_t *imax, int64_t *istep);
+ /**
+ * get the element information of enumerated type
+ */
+ int (*get_enumerated_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
+ /**
+ * get the name of the enumerated item
+ */
+ int (*get_enumerated_name)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int item,
+ char *name, size_t name_max_len);
+ /**
+ * read the current values of integer type
+ */
+ int (*read_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
+ /**
+ * read the current values of integer64 type
+ */
+ int (*read_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
+ /**
+ * read the current values of enumerated type
+ */
+ int (*read_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
+ /**
+ * read the current values of bytes type
+ */
+ int (*read_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
+ size_t max_bytes);
+ /**
+ * read the current values of iec958 type
+ */
+ int (*read_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958);
+ /**
+ * update the current values of integer type with the given values
+ */
+ int (*write_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
+ /**
+ * update the current values of integer64 type with the given values
+ */
+ int (*write_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
+ /**
+ * update the current values of enumerated type with the given values
+ */
+ int (*write_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
+ /**
+ * update the current values of bytes type with the given values
+ */
+ int (*write_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
+ size_t max_bytes);
+ /**
+ * update the current values of iec958 type with the given values
+ */
+ int (*write_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958);
+ /**
+ * subscribe/unsubscribe the event notification; optional
+ */
+ void (*subscribe_events)(snd_ctl_ext_t *ext, int subscribe);
+ /**
+ * read a pending notification event; optional
+ */
+ int (*read_event)(snd_ctl_ext_t *ext, snd_ctl_elem_id_t *id, unsigned int *event_mask);
+ /**
+ * return the number of poll descriptors; optional
+ */
+ int (*poll_descriptors_count)(snd_ctl_ext_t *ext);
+ /**
+ * fill the poll descriptors; optional
+ */
+ int (*poll_descriptors)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int space);
+ /**
+ * mangle the revents of poll descriptors
+ */
+ int (*poll_revents)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+};
+
+/**
+ * The access type bits stored in get_attribute callback
+ */
+typedef enum snd_ctl_ext_access {
+ SND_CTL_EXT_ACCESS_READ = (1<<0),
+ SND_CTL_EXT_ACCESS_WRITE = (1<<1),
+ SND_CTL_EXT_ACCESS_READWRITE = (3<<0),
+ SND_CTL_EXT_ACCESS_VOLATILE = (1<<2),
+ SND_CTL_EXT_ACCESS_TLV_READ = (1<<4),
+ SND_CTL_EXT_ACCESS_TLV_WRITE = (1<<5),
+ SND_CTL_EXT_ACCESS_TLV_READWRITE = (3<<4),
+ SND_CTL_EXT_ACCESS_TLV_COMMAND = (1<<6),
+ SND_CTL_EXT_ACCESS_INACTIVE = (1<<8),
+ SND_CTL_EXT_ACCESS_TLV_CALLBACK = (1<<28),
+} snd_ctl_ext_access_t;
+
+/**
+ * find_elem callback returns this if no matching control element is found
+ */
+#define SND_CTL_EXT_KEY_NOT_FOUND (snd_ctl_ext_key_t)(-1)
+
+int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode);
+int snd_ctl_ext_delete(snd_ctl_ext_t *ext);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_CONTROL_EXTERNAL_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/error.h b/thirdparty/linuxbsd_headers/alsa/error.h
new file mode 100644
index 0000000000..38ee0704d2
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/error.h
@@ -0,0 +1,85 @@
+/**
+ * \file include/error.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_ERROR_H
+#define __ALSA_ERROR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Error Error handling
+ * Error handling macros and functions.
+ * \{
+ */
+
+#define SND_ERROR_BEGIN 500000 /**< Lower boundary of sound error codes. */
+#define SND_ERROR_INCOMPATIBLE_VERSION (SND_ERROR_BEGIN+0) /**< Kernel/library protocols are not compatible. */
+#define SND_ERROR_ALISP_NIL (SND_ERROR_BEGIN+1) /**< Lisp encountered an error during acall. */
+
+const char *snd_strerror(int errnum);
+
+/**
+ * \brief Error handler callback.
+ * \param file Source file name.
+ * \param line Line number.
+ * \param function Function name.
+ * \param err Value of \c errno, or 0 if not relevant.
+ * \param fmt \c printf(3) format.
+ * \param ... \c printf(3) arguments.
+ *
+ * A function of this type is called by the ALSA library when an error occurs.
+ * This function usually shows the message on the screen, and/or logs it.
+ */
+typedef void (*snd_lib_error_handler_t)(const char *file, int line, const char *function, int err, const char *fmt, ...) /* __attribute__ ((format (printf, 5, 6))) */;
+extern snd_lib_error_handler_t snd_lib_error;
+extern int snd_lib_error_set_handler(snd_lib_error_handler_t handler);
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
+#define SNDERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, __VA_ARGS__) /**< Shows a sound error message. */
+#define SYSERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, errno, __VA_ARGS__) /**< Shows a system error message (related to \c errno). */
+#else
+#define SNDERR(args...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, ##args) /**< Shows a sound error message. */
+#define SYSERR(args...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, errno, ##args) /**< Shows a system error message (related to \c errno). */
+#endif
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+/** Local error handler function type */
+typedef void (*snd_local_error_handler_t)(const char *file, int line,
+ const char *func, int err,
+ const char *fmt, va_list arg);
+
+snd_local_error_handler_t snd_lib_error_set_local(snd_local_error_handler_t func);
+
+#endif /* __ALSA_ERROR_H */
+
diff --git a/thirdparty/linuxbsd_headers/alsa/global.h b/thirdparty/linuxbsd_headers/alsa/global.h
new file mode 100644
index 0000000000..16a26dc835
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/global.h
@@ -0,0 +1,161 @@
+/**
+ * \file include/global.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_GLOBAL_H_
+#define __ALSA_GLOBAL_H_
+
+/* for timeval and timespec */
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Global Global defines and functions
+ * Global defines and functions.
+ * \par
+ * The ALSA library implementation uses these macros and functions.
+ * Most applications probably do not need them.
+ * \{
+ */
+
+const char *snd_asoundlib_version(void);
+
+#ifndef ATTRIBUTE_UNUSED
+/** do not print warning (gcc) when function parameter is not used */
+#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif
+
+#ifdef PIC /* dynamic build */
+
+/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
+#define __SND_DLSYM_VERSION(name, version) _ ## name ## version
+/**
+ * \hideinitializer
+ * \brief Appends the build version to the name of a versioned dynamic symbol.
+ */
+#define SND_DLSYM_BUILD_VERSION(name, version) char __SND_DLSYM_VERSION(name, version);
+
+#else /* static build */
+
+struct snd_dlsym_link {
+ struct snd_dlsym_link *next;
+ const char *dlsym_name;
+ const void *dlsym_ptr;
+};
+
+extern struct snd_dlsym_link *snd_dlsym_start;
+
+/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
+#define __SND_DLSYM_VERSION(prefix, name, version) _ ## prefix ## name ## version
+/**
+ * \hideinitializer
+ * \brief Appends the build version to the name of a versioned dynamic symbol.
+ */
+#define SND_DLSYM_BUILD_VERSION(name, version) \
+ static struct snd_dlsym_link __SND_DLSYM_VERSION(snd_dlsym_, name, version); \
+ void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) __attribute__ ((constructor)); \
+ void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) { \
+ __SND_DLSYM_VERSION(snd_dlsym_, name, version).next = snd_dlsym_start; \
+ __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_name = # name; \
+ __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_ptr = (void *)&name; \
+ snd_dlsym_start = &__SND_DLSYM_VERSION(snd_dlsym_, name, version); \
+ }
+
+#endif
+
+#ifndef __STRING
+/** \brief Return 'x' argument as string */
+#define __STRING(x) #x
+#endif
+
+/** \brief Returns the version of a dynamic symbol as a string. */
+#define SND_DLSYM_VERSION(version) __STRING(version)
+
+void *snd_dlopen(const char *file, int mode);
+void *snd_dlsym(void *handle, const char *name, const char *version);
+int snd_dlclose(void *handle);
+
+
+/** \brief alloca helper macro. */
+#define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
+
+/**
+ * \brief Internal structure for an async notification client handler.
+ *
+ * The ALSA library uses a pointer to this structure as a handle to an async
+ * notification object. Applications don't access its contents directly.
+ */
+typedef struct _snd_async_handler snd_async_handler_t;
+
+/**
+ * \brief Async notification callback.
+ *
+ * See the #snd_async_add_handler function for details.
+ */
+typedef void (*snd_async_callback_t)(snd_async_handler_t *handler);
+
+int snd_async_add_handler(snd_async_handler_t **handler, int fd,
+ snd_async_callback_t callback, void *private_data);
+int snd_async_del_handler(snd_async_handler_t *handler);
+int snd_async_handler_get_fd(snd_async_handler_t *handler);
+int snd_async_handler_get_signo(snd_async_handler_t *handler);
+void *snd_async_handler_get_callback_private(snd_async_handler_t *handler);
+
+struct snd_shm_area *snd_shm_area_create(int shmid, void *ptr);
+struct snd_shm_area *snd_shm_area_share(struct snd_shm_area *area);
+int snd_shm_area_destroy(struct snd_shm_area *area);
+
+int snd_user_file(const char *file, char **result);
+
+#ifdef __GLIBC__
+#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE)
+struct timeval {
+ time_t tv_sec; /* seconds */
+ long tv_usec; /* microseconds */
+};
+
+struct timespec {
+ time_t tv_sec; /* seconds */
+ long tv_nsec; /* nanoseconds */
+};
+#endif
+#endif
+
+/** Timestamp */
+typedef struct timeval snd_timestamp_t;
+/** Hi-res timestamp */
+typedef struct timespec snd_htimestamp_t;
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_GLOBAL_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/hwdep.h b/thirdparty/linuxbsd_headers/alsa/hwdep.h
new file mode 100644
index 0000000000..2fe78cd84d
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/hwdep.h
@@ -0,0 +1,169 @@
+/**
+ * \file include/hwdep.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_HWDEP_H
+#define __ALSA_HWDEP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup HwDep Hardware Dependant Interface
+ * The Hardware Dependant Interface.
+ * \{
+ */
+
+/** dlsym version for interface entry callback */
+#define SND_HWDEP_DLSYM_VERSION _dlsym_hwdep_001
+
+/** HwDep information container */
+typedef struct _snd_hwdep_info snd_hwdep_info_t;
+
+/** HwDep DSP status container */
+typedef struct _snd_hwdep_dsp_status snd_hwdep_dsp_status_t;
+
+/** HwDep DSP image container */
+typedef struct _snd_hwdep_dsp_image snd_hwdep_dsp_image_t;
+
+/** HwDep interface */
+typedef enum _snd_hwdep_iface {
+ SND_HWDEP_IFACE_OPL2 = 0, /**< OPL2 raw driver */
+ SND_HWDEP_IFACE_OPL3, /**< OPL3 raw driver */
+ SND_HWDEP_IFACE_OPL4, /**< OPL4 raw driver */
+ SND_HWDEP_IFACE_SB16CSP, /**< SB16CSP driver */
+ SND_HWDEP_IFACE_EMU10K1, /**< EMU10K1 driver */
+ SND_HWDEP_IFACE_YSS225, /**< YSS225 driver */
+ SND_HWDEP_IFACE_ICS2115, /**< ICS2115 driver */
+ SND_HWDEP_IFACE_SSCAPE, /**< Ensoniq SoundScape ISA card (MC68EC000) */
+ SND_HWDEP_IFACE_VX, /**< Digigram VX cards */
+ SND_HWDEP_IFACE_MIXART, /**< Digigram miXart cards */
+ SND_HWDEP_IFACE_USX2Y, /**< Tascam US122, US224 & US428 usb */
+ SND_HWDEP_IFACE_EMUX_WAVETABLE, /**< EmuX wavetable */
+ SND_HWDEP_IFACE_BLUETOOTH, /**< Bluetooth audio */
+ SND_HWDEP_IFACE_USX2Y_PCM, /**< Tascam US122, US224 & US428 raw USB PCM */
+ SND_HWDEP_IFACE_PCXHR, /**< Digigram PCXHR */
+ SND_HWDEP_IFACE_SB_RC, /**< SB Extigy/Audigy2NX remote control */
+ SND_HWDEP_IFACE_HDA, /**< HD-audio */
+ SND_HWDEP_IFACE_USB_STREAM, /**< direct access to usb stream */
+ SND_HWDEP_IFACE_FW_DICE, /**< TC DICE FireWire device */
+ SND_HWDEP_IFACE_FW_FIREWORKS, /**< Echo Audio Fireworks based device */
+ SND_HWDEP_IFACE_FW_BEBOB, /**< BridgeCo BeBoB based device */
+ SND_HWDEP_IFACE_FW_OXFW, /**< Oxford OXFW970/971 based device */
+ SND_HWDEP_IFACE_FW_DIGI00X, /* Digidesign Digi 002/003 family */
+ SND_HWDEP_IFACE_FW_TASCAM, /* TASCAM FireWire series */
+
+ SND_HWDEP_IFACE_LAST = SND_HWDEP_IFACE_FW_TASCAM /**< last known hwdep interface */
+} snd_hwdep_iface_t;
+
+/** open for reading */
+#define SND_HWDEP_OPEN_READ (O_RDONLY)
+/** open for writing */
+#define SND_HWDEP_OPEN_WRITE (O_WRONLY)
+/** open for reading and writing */
+#define SND_HWDEP_OPEN_DUPLEX (O_RDWR)
+/** open mode flag: open in nonblock mode */
+#define SND_HWDEP_OPEN_NONBLOCK (O_NONBLOCK)
+
+/** HwDep handle type */
+typedef enum _snd_hwdep_type {
+ /** Kernel level HwDep */
+ SND_HWDEP_TYPE_HW,
+ /** Shared memory client HwDep (not yet implemented) */
+ SND_HWDEP_TYPE_SHM,
+ /** INET client HwDep (not yet implemented) */
+ SND_HWDEP_TYPE_INET
+} snd_hwdep_type_t;
+
+/** HwDep handle */
+typedef struct _snd_hwdep snd_hwdep_t;
+
+int snd_hwdep_open(snd_hwdep_t **hwdep, const char *name, int mode);
+int snd_hwdep_close(snd_hwdep_t *hwdep);
+int snd_hwdep_poll_descriptors(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int space);
+int snd_hwdep_poll_descriptors_count(snd_hwdep_t *hwdep);
+int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+int snd_hwdep_nonblock(snd_hwdep_t *hwdep, int nonblock);
+int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t * info);
+int snd_hwdep_dsp_status(snd_hwdep_t *hwdep, snd_hwdep_dsp_status_t *status);
+int snd_hwdep_dsp_load(snd_hwdep_t *hwdep, snd_hwdep_dsp_image_t *block);
+int snd_hwdep_ioctl(snd_hwdep_t *hwdep, unsigned int request, void * arg);
+ssize_t snd_hwdep_write(snd_hwdep_t *hwdep, const void *buffer, size_t size);
+ssize_t snd_hwdep_read(snd_hwdep_t *hwdep, void *buffer, size_t size);
+
+size_t snd_hwdep_info_sizeof(void);
+/** allocate #snd_hwdep_info_t container on stack */
+#define snd_hwdep_info_alloca(ptr) __snd_alloca(ptr, snd_hwdep_info)
+int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr);
+void snd_hwdep_info_free(snd_hwdep_info_t *obj);
+void snd_hwdep_info_copy(snd_hwdep_info_t *dst, const snd_hwdep_info_t *src);
+
+unsigned int snd_hwdep_info_get_device(const snd_hwdep_info_t *obj);
+int snd_hwdep_info_get_card(const snd_hwdep_info_t *obj);
+const char *snd_hwdep_info_get_id(const snd_hwdep_info_t *obj);
+const char *snd_hwdep_info_get_name(const snd_hwdep_info_t *obj);
+snd_hwdep_iface_t snd_hwdep_info_get_iface(const snd_hwdep_info_t *obj);
+void snd_hwdep_info_set_device(snd_hwdep_info_t *obj, unsigned int val);
+
+size_t snd_hwdep_dsp_status_sizeof(void);
+/** allocate #snd_hwdep_dsp_status_t container on stack */
+#define snd_hwdep_dsp_status_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_status)
+int snd_hwdep_dsp_status_malloc(snd_hwdep_dsp_status_t **ptr);
+void snd_hwdep_dsp_status_free(snd_hwdep_dsp_status_t *obj);
+void snd_hwdep_dsp_status_copy(snd_hwdep_dsp_status_t *dst, const snd_hwdep_dsp_status_t *src);
+
+unsigned int snd_hwdep_dsp_status_get_version(const snd_hwdep_dsp_status_t *obj);
+const char *snd_hwdep_dsp_status_get_id(const snd_hwdep_dsp_status_t *obj);
+unsigned int snd_hwdep_dsp_status_get_num_dsps(const snd_hwdep_dsp_status_t *obj);
+unsigned int snd_hwdep_dsp_status_get_dsp_loaded(const snd_hwdep_dsp_status_t *obj);
+unsigned int snd_hwdep_dsp_status_get_chip_ready(const snd_hwdep_dsp_status_t *obj);
+
+size_t snd_hwdep_dsp_image_sizeof(void);
+/** allocate #snd_hwdep_dsp_image_t container on stack */
+#define snd_hwdep_dsp_image_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_image)
+int snd_hwdep_dsp_image_malloc(snd_hwdep_dsp_image_t **ptr);
+void snd_hwdep_dsp_image_free(snd_hwdep_dsp_image_t *obj);
+void snd_hwdep_dsp_image_copy(snd_hwdep_dsp_image_t *dst, const snd_hwdep_dsp_image_t *src);
+
+unsigned int snd_hwdep_dsp_image_get_index(const snd_hwdep_dsp_image_t *obj);
+const char *snd_hwdep_dsp_image_get_name(const snd_hwdep_dsp_image_t *obj);
+const void *snd_hwdep_dsp_image_get_image(const snd_hwdep_dsp_image_t *obj);
+size_t snd_hwdep_dsp_image_get_length(const snd_hwdep_dsp_image_t *obj);
+
+void snd_hwdep_dsp_image_set_index(snd_hwdep_dsp_image_t *obj, unsigned int _index);
+void snd_hwdep_dsp_image_set_name(snd_hwdep_dsp_image_t *obj, const char *name);
+void snd_hwdep_dsp_image_set_image(snd_hwdep_dsp_image_t *obj, void *buffer);
+void snd_hwdep_dsp_image_set_length(snd_hwdep_dsp_image_t *obj, size_t length);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_HWDEP_H */
+
diff --git a/thirdparty/linuxbsd_headers/alsa/input.h b/thirdparty/linuxbsd_headers/alsa/input.h
new file mode 100644
index 0000000000..fc5d0e6774
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/input.h
@@ -0,0 +1,83 @@
+/**
+ * \file include/input.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_INPUT_H
+#define __ALSA_INPUT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Input Input Interface
+ *
+ * The input functions present an interface similar to the stdio functions
+ * on top of different underlying input sources.
+ *
+ * The #snd_config_load function uses such an input handle to be able to
+ * load configurations not only from standard files but also from other
+ * sources, e.g. from memory buffers.
+ *
+ * \{
+ */
+
+/**
+ * \brief Internal structure for an input object.
+ *
+ * The ALSA library uses a pointer to this structure as a handle to an
+ * input object. Applications don't access its contents directly.
+ */
+typedef struct _snd_input snd_input_t;
+
+/** Input type. */
+typedef enum _snd_input_type {
+ /** Input from a stdio stream. */
+ SND_INPUT_STDIO,
+ /** Input from a memory buffer. */
+ SND_INPUT_BUFFER
+} snd_input_type_t;
+
+int snd_input_stdio_open(snd_input_t **inputp, const char *file, const char *mode);
+int snd_input_stdio_attach(snd_input_t **inputp, FILE *fp, int _close);
+int snd_input_buffer_open(snd_input_t **inputp, const char *buffer, ssize_t size);
+int snd_input_close(snd_input_t *input);
+int snd_input_scanf(snd_input_t *input, const char *format, ...)
+#ifndef DOC_HIDDEN
+ __attribute__ ((format (scanf, 2, 3)))
+#endif
+ ;
+char *snd_input_gets(snd_input_t *input, char *str, size_t size);
+int snd_input_getc(snd_input_t *input);
+int snd_input_ungetc(snd_input_t *input, int c);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_INPUT_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/mixer.h b/thirdparty/linuxbsd_headers/alsa/mixer.h
new file mode 100644
index 0000000000..066d978435
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/mixer.h
@@ -0,0 +1,317 @@
+/**
+ * \file include/mixer.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_MIXER_H
+#define __ALSA_MIXER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Mixer Mixer Interface
+ * The mixer interface.
+ * \{
+ */
+
+/** Mixer handle */
+typedef struct _snd_mixer snd_mixer_t;
+/** Mixer elements class handle */
+typedef struct _snd_mixer_class snd_mixer_class_t;
+/** Mixer element handle */
+typedef struct _snd_mixer_elem snd_mixer_elem_t;
+
+/**
+ * \brief Mixer callback function
+ * \param mixer Mixer handle
+ * \param mask event mask
+ * \param elem related mixer element (if any)
+ * \return 0 on success otherwise a negative error code
+ */
+typedef int (*snd_mixer_callback_t)(snd_mixer_t *ctl,
+ unsigned int mask,
+ snd_mixer_elem_t *elem);
+
+/**
+ * \brief Mixer element callback function
+ * \param elem Mixer element
+ * \param mask event mask
+ * \return 0 on success otherwise a negative error code
+ */
+typedef int (*snd_mixer_elem_callback_t)(snd_mixer_elem_t *elem,
+ unsigned int mask);
+
+/**
+ * \brief Compare function for sorting mixer elements
+ * \param e1 First element
+ * \param e2 Second element
+ * \return -1 if e1 < e2, 0 if e1 == e2, 1 if e1 > e2
+ */
+typedef int (*snd_mixer_compare_t)(const snd_mixer_elem_t *e1,
+ const snd_mixer_elem_t *e2);
+
+/**
+ * \brief Event callback for the mixer class
+ * \param class_ Mixer class
+ * \param mask Event mask (SND_CTL_EVENT_*)
+ * \param helem HCTL element which invoked the event
+ * \param melem Mixer element associated to HCTL element
+ * \return zero if success, otherwise a negative error value
+ */
+typedef int (*snd_mixer_event_t)(snd_mixer_class_t *class_, unsigned int mask,
+ snd_hctl_elem_t *helem, snd_mixer_elem_t *melem);
+
+
+/** Mixer element type */
+typedef enum _snd_mixer_elem_type {
+ /* Simple mixer elements */
+ SND_MIXER_ELEM_SIMPLE,
+ SND_MIXER_ELEM_LAST = SND_MIXER_ELEM_SIMPLE
+} snd_mixer_elem_type_t;
+
+int snd_mixer_open(snd_mixer_t **mixer, int mode);
+int snd_mixer_close(snd_mixer_t *mixer);
+snd_mixer_elem_t *snd_mixer_first_elem(snd_mixer_t *mixer);
+snd_mixer_elem_t *snd_mixer_last_elem(snd_mixer_t *mixer);
+int snd_mixer_handle_events(snd_mixer_t *mixer);
+int snd_mixer_attach(snd_mixer_t *mixer, const char *name);
+int snd_mixer_attach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl);
+int snd_mixer_detach(snd_mixer_t *mixer, const char *name);
+int snd_mixer_detach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl);
+int snd_mixer_get_hctl(snd_mixer_t *mixer, const char *name, snd_hctl_t **hctl);
+int snd_mixer_poll_descriptors_count(snd_mixer_t *mixer);
+int snd_mixer_poll_descriptors(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int space);
+int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+int snd_mixer_load(snd_mixer_t *mixer);
+void snd_mixer_free(snd_mixer_t *mixer);
+int snd_mixer_wait(snd_mixer_t *mixer, int timeout);
+int snd_mixer_set_compare(snd_mixer_t *mixer, snd_mixer_compare_t msort);
+void snd_mixer_set_callback(snd_mixer_t *obj, snd_mixer_callback_t val);
+void * snd_mixer_get_callback_private(const snd_mixer_t *obj);
+void snd_mixer_set_callback_private(snd_mixer_t *obj, void * val);
+unsigned int snd_mixer_get_count(const snd_mixer_t *obj);
+int snd_mixer_class_unregister(snd_mixer_class_t *clss);
+
+snd_mixer_elem_t *snd_mixer_elem_next(snd_mixer_elem_t *elem);
+snd_mixer_elem_t *snd_mixer_elem_prev(snd_mixer_elem_t *elem);
+void snd_mixer_elem_set_callback(snd_mixer_elem_t *obj, snd_mixer_elem_callback_t val);
+void * snd_mixer_elem_get_callback_private(const snd_mixer_elem_t *obj);
+void snd_mixer_elem_set_callback_private(snd_mixer_elem_t *obj, void * val);
+snd_mixer_elem_type_t snd_mixer_elem_get_type(const snd_mixer_elem_t *obj);
+
+int snd_mixer_class_register(snd_mixer_class_t *class_, snd_mixer_t *mixer);
+int snd_mixer_elem_new(snd_mixer_elem_t **elem,
+ snd_mixer_elem_type_t type,
+ int compare_weight,
+ void *private_data,
+ void (*private_free)(snd_mixer_elem_t *elem));
+int snd_mixer_elem_add(snd_mixer_elem_t *elem, snd_mixer_class_t *class_);
+int snd_mixer_elem_remove(snd_mixer_elem_t *elem);
+void snd_mixer_elem_free(snd_mixer_elem_t *elem);
+int snd_mixer_elem_info(snd_mixer_elem_t *elem);
+int snd_mixer_elem_value(snd_mixer_elem_t *elem);
+int snd_mixer_elem_attach(snd_mixer_elem_t *melem, snd_hctl_elem_t *helem);
+int snd_mixer_elem_detach(snd_mixer_elem_t *melem, snd_hctl_elem_t *helem);
+int snd_mixer_elem_empty(snd_mixer_elem_t *melem);
+void *snd_mixer_elem_get_private(const snd_mixer_elem_t *melem);
+
+size_t snd_mixer_class_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_mixer_class_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_mixer_class_alloca(ptr) __snd_alloca(ptr, snd_mixer_class)
+int snd_mixer_class_malloc(snd_mixer_class_t **ptr);
+void snd_mixer_class_free(snd_mixer_class_t *obj);
+void snd_mixer_class_copy(snd_mixer_class_t *dst, const snd_mixer_class_t *src);
+snd_mixer_t *snd_mixer_class_get_mixer(const snd_mixer_class_t *class_);
+snd_mixer_event_t snd_mixer_class_get_event(const snd_mixer_class_t *class_);
+void *snd_mixer_class_get_private(const snd_mixer_class_t *class_);
+snd_mixer_compare_t snd_mixer_class_get_compare(const snd_mixer_class_t *class_);
+int snd_mixer_class_set_event(snd_mixer_class_t *class_, snd_mixer_event_t event);
+int snd_mixer_class_set_private(snd_mixer_class_t *class_, void *private_data);
+int snd_mixer_class_set_private_free(snd_mixer_class_t *class_, void (*private_free)(snd_mixer_class_t *));
+int snd_mixer_class_set_compare(snd_mixer_class_t *class_, snd_mixer_compare_t compare);
+
+/**
+ * \defgroup SimpleMixer Simple Mixer Interface
+ * \ingroup Mixer
+ * The simple mixer interface.
+ * \{
+ */
+
+/* Simple mixer elements API */
+
+/** Mixer simple element channel identifier */
+typedef enum _snd_mixer_selem_channel_id {
+ /** Unknown */
+ SND_MIXER_SCHN_UNKNOWN = -1,
+ /** Front left */
+ SND_MIXER_SCHN_FRONT_LEFT = 0,
+ /** Front right */
+ SND_MIXER_SCHN_FRONT_RIGHT,
+ /** Rear left */
+ SND_MIXER_SCHN_REAR_LEFT,
+ /** Rear right */
+ SND_MIXER_SCHN_REAR_RIGHT,
+ /** Front center */
+ SND_MIXER_SCHN_FRONT_CENTER,
+ /** Woofer */
+ SND_MIXER_SCHN_WOOFER,
+ /** Side Left */
+ SND_MIXER_SCHN_SIDE_LEFT,
+ /** Side Right */
+ SND_MIXER_SCHN_SIDE_RIGHT,
+ /** Rear Center */
+ SND_MIXER_SCHN_REAR_CENTER,
+ SND_MIXER_SCHN_LAST = 31,
+ /** Mono (Front left alias) */
+ SND_MIXER_SCHN_MONO = SND_MIXER_SCHN_FRONT_LEFT
+} snd_mixer_selem_channel_id_t;
+
+/** Mixer simple element - register options - abstraction level */
+enum snd_mixer_selem_regopt_abstract {
+ /** no abstraction - try use all universal controls from driver */
+ SND_MIXER_SABSTRACT_NONE = 0,
+ /** basic abstraction - Master,PCM,CD,Aux,Record-Gain etc. */
+ SND_MIXER_SABSTRACT_BASIC,
+};
+
+/** Mixer simple element - register options */
+struct snd_mixer_selem_regopt {
+ /** structure version */
+ int ver;
+ /** v1: abstract layer selection */
+ enum snd_mixer_selem_regopt_abstract abstract;
+ /** v1: device name (must be NULL when playback_pcm or capture_pcm != NULL) */
+ const char *device;
+ /** v1: playback PCM connected to mixer device (NULL == none) */
+ snd_pcm_t *playback_pcm;
+ /** v1: capture PCM connected to mixer device (NULL == none) */
+ snd_pcm_t *capture_pcm;
+};
+
+/** Mixer simple element identifier */
+typedef struct _snd_mixer_selem_id snd_mixer_selem_id_t;
+
+const char *snd_mixer_selem_channel_name(snd_mixer_selem_channel_id_t channel);
+
+int snd_mixer_selem_register(snd_mixer_t *mixer,
+ struct snd_mixer_selem_regopt *options,
+ snd_mixer_class_t **classp);
+void snd_mixer_selem_get_id(snd_mixer_elem_t *element,
+ snd_mixer_selem_id_t *id);
+const char *snd_mixer_selem_get_name(snd_mixer_elem_t *elem);
+unsigned int snd_mixer_selem_get_index(snd_mixer_elem_t *elem);
+snd_mixer_elem_t *snd_mixer_find_selem(snd_mixer_t *mixer,
+ const snd_mixer_selem_id_t *id);
+
+int snd_mixer_selem_is_active(snd_mixer_elem_t *elem);
+int snd_mixer_selem_is_playback_mono(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_playback_channel(snd_mixer_elem_t *obj, snd_mixer_selem_channel_id_t channel);
+int snd_mixer_selem_is_capture_mono(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_capture_channel(snd_mixer_elem_t *obj, snd_mixer_selem_channel_id_t channel);
+int snd_mixer_selem_get_capture_group(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_common_volume(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_playback_volume(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_playback_volume_joined(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_capture_volume(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_capture_volume_joined(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_common_switch(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_playback_switch(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_playback_switch_joined(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_capture_switch(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_capture_switch_joined(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_capture_switch_exclusive(snd_mixer_elem_t *elem);
+
+int snd_mixer_selem_ask_playback_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue);
+int snd_mixer_selem_ask_capture_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue);
+int snd_mixer_selem_ask_playback_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value);
+int snd_mixer_selem_ask_capture_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value);
+int snd_mixer_selem_get_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
+int snd_mixer_selem_get_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
+int snd_mixer_selem_get_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
+int snd_mixer_selem_get_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
+int snd_mixer_selem_get_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value);
+int snd_mixer_selem_get_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value);
+int snd_mixer_selem_set_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value);
+int snd_mixer_selem_set_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value);
+int snd_mixer_selem_set_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir);
+int snd_mixer_selem_set_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir);
+int snd_mixer_selem_set_playback_volume_all(snd_mixer_elem_t *elem, long value);
+int snd_mixer_selem_set_capture_volume_all(snd_mixer_elem_t *elem, long value);
+int snd_mixer_selem_set_playback_dB_all(snd_mixer_elem_t *elem, long value, int dir);
+int snd_mixer_selem_set_capture_dB_all(snd_mixer_elem_t *elem, long value, int dir);
+int snd_mixer_selem_set_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value);
+int snd_mixer_selem_set_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value);
+int snd_mixer_selem_set_playback_switch_all(snd_mixer_elem_t *elem, int value);
+int snd_mixer_selem_set_capture_switch_all(snd_mixer_elem_t *elem, int value);
+int snd_mixer_selem_get_playback_volume_range(snd_mixer_elem_t *elem,
+ long *min, long *max);
+int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem,
+ long *min, long *max);
+int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem,
+ long min, long max);
+int snd_mixer_selem_get_capture_volume_range(snd_mixer_elem_t *elem,
+ long *min, long *max);
+int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem,
+ long *min, long *max);
+int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem,
+ long min, long max);
+
+int snd_mixer_selem_is_enumerated(snd_mixer_elem_t *elem);
+int snd_mixer_selem_is_enum_playback(snd_mixer_elem_t *elem);
+int snd_mixer_selem_is_enum_capture(snd_mixer_elem_t *elem);
+int snd_mixer_selem_get_enum_items(snd_mixer_elem_t *elem);
+int snd_mixer_selem_get_enum_item_name(snd_mixer_elem_t *elem, unsigned int idx, size_t maxlen, char *str);
+int snd_mixer_selem_get_enum_item(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *idxp);
+int snd_mixer_selem_set_enum_item(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int idx);
+
+size_t snd_mixer_selem_id_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_mixer_selem_id_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_mixer_selem_id_alloca(ptr) __snd_alloca(ptr, snd_mixer_selem_id)
+int snd_mixer_selem_id_malloc(snd_mixer_selem_id_t **ptr);
+void snd_mixer_selem_id_free(snd_mixer_selem_id_t *obj);
+void snd_mixer_selem_id_copy(snd_mixer_selem_id_t *dst, const snd_mixer_selem_id_t *src);
+const char *snd_mixer_selem_id_get_name(const snd_mixer_selem_id_t *obj);
+unsigned int snd_mixer_selem_id_get_index(const snd_mixer_selem_id_t *obj);
+void snd_mixer_selem_id_set_name(snd_mixer_selem_id_t *obj, const char *val);
+void snd_mixer_selem_id_set_index(snd_mixer_selem_id_t *obj, unsigned int val);
+
+/** \} */
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_MIXER_H */
+
diff --git a/thirdparty/linuxbsd_headers/alsa/mixer_abst.h b/thirdparty/linuxbsd_headers/alsa/mixer_abst.h
new file mode 100644
index 0000000000..7844b19101
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/mixer_abst.h
@@ -0,0 +1,112 @@
+/**
+ * \file include/mixer_abst.h
+ * \brief Mixer abstract implementation interface library for the ALSA library
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2005
+ *
+ * Mixer abstact implementation interface library for the ALSA library
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_MIXER_ABST_H
+#define __ALSA_MIXER_ABST_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Mixer_Abstract Mixer Abstact Module Interface
+ * The mixer abstact module interface.
+ * \{
+ */
+
+#define SM_PLAY 0
+#define SM_CAPT 1
+
+#define SM_CAP_GVOLUME (1<<1)
+#define SM_CAP_GSWITCH (1<<2)
+#define SM_CAP_PVOLUME (1<<3)
+#define SM_CAP_PVOLUME_JOIN (1<<4)
+#define SM_CAP_PSWITCH (1<<5)
+#define SM_CAP_PSWITCH_JOIN (1<<6)
+#define SM_CAP_CVOLUME (1<<7)
+#define SM_CAP_CVOLUME_JOIN (1<<8)
+#define SM_CAP_CSWITCH (1<<9)
+#define SM_CAP_CSWITCH_JOIN (1<<10)
+#define SM_CAP_CSWITCH_EXCL (1<<11)
+#define SM_CAP_PENUM (1<<12)
+#define SM_CAP_CENUM (1<<13)
+/* SM_CAP_* 24-31 => private for module use */
+
+#define SM_OPS_IS_ACTIVE 0
+#define SM_OPS_IS_MONO 1
+#define SM_OPS_IS_CHANNEL 2
+#define SM_OPS_IS_ENUMERATED 3
+#define SM_OPS_IS_ENUMCNT 4
+
+#define sm_selem(x) ((sm_selem_t *)((x)->private_data))
+#define sm_selem_ops(x) ((sm_selem_t *)((x)->private_data))->ops
+
+typedef struct _sm_selem {
+ snd_mixer_selem_id_t *id;
+ struct sm_elem_ops *ops;
+ unsigned int caps;
+ unsigned int capture_group;
+} sm_selem_t;
+
+typedef struct _sm_class_basic {
+ char *device;
+ snd_ctl_t *ctl;
+ snd_hctl_t *hctl;
+ snd_ctl_card_info_t *info;
+} sm_class_basic_t;
+
+struct sm_elem_ops {
+ int (*is)(snd_mixer_elem_t *elem, int dir, int cmd, int val);
+ int (*get_range)(snd_mixer_elem_t *elem, int dir, long *min, long *max);
+ int (*set_range)(snd_mixer_elem_t *elem, int dir, long min, long max);
+ int (*get_dB_range)(snd_mixer_elem_t *elem, int dir, long *min, long *max);
+ int (*ask_vol_dB)(snd_mixer_elem_t *elem, int dir, long value, long *dbValue);
+ int (*ask_dB_vol)(snd_mixer_elem_t *elem, int dir, long dbValue, long *value, int xdir);
+ int (*get_volume)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long *value);
+ int (*get_dB)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long *value);
+ int (*set_volume)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value);
+ int (*set_dB)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value, int xdir);
+ int (*get_switch)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, int *value);
+ int (*set_switch)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, int value);
+ int (*enum_item_name)(snd_mixer_elem_t *elem, unsigned int item, size_t maxlen, char *buf);
+ int (*get_enum_item)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *itemp);
+ int (*set_enum_item)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int item);
+};
+
+int snd_mixer_selem_compare(const snd_mixer_elem_t *c1, const snd_mixer_elem_t *c2);
+
+int snd_mixer_sbasic_info(const snd_mixer_class_t *class, sm_class_basic_t *info);
+void *snd_mixer_sbasic_get_private(const snd_mixer_class_t *class);
+void snd_mixer_sbasic_set_private(const snd_mixer_class_t *class, void *private_data);
+void snd_mixer_sbasic_set_private_free(const snd_mixer_class_t *class, void (*private_free)(snd_mixer_class_t *class));
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_MIXER_ABST_H */
+
diff --git a/thirdparty/linuxbsd_headers/alsa/output.h b/thirdparty/linuxbsd_headers/alsa/output.h
new file mode 100644
index 0000000000..5279aa2ed0
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/output.h
@@ -0,0 +1,86 @@
+/**
+ * \file include/output.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_OUTPUT_H
+#define __ALSA_OUTPUT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Output Output Interface
+ *
+ * The output functions present an interface similar to the stdio functions
+ * on top of different underlying output destinations.
+ *
+ * Many PCM debugging functions (\c snd_pcm_xxx_dump_xxx) use such an output
+ * handle to be able to write not only to the screen but also to other
+ * destinations, e.g. to files or to memory buffers.
+ *
+ * \{
+ */
+
+/**
+ * \brief Internal structure for an output object.
+ *
+ * The ALSA library uses a pointer to this structure as a handle to an
+ * output object. Applications don't access its contents directly.
+ */
+typedef struct _snd_output snd_output_t;
+
+/** Output type. */
+typedef enum _snd_output_type {
+ /** Output to a stdio stream. */
+ SND_OUTPUT_STDIO,
+ /** Output to a memory buffer. */
+ SND_OUTPUT_BUFFER
+} snd_output_type_t;
+
+int snd_output_stdio_open(snd_output_t **outputp, const char *file, const char *mode);
+int snd_output_stdio_attach(snd_output_t **outputp, FILE *fp, int _close);
+int snd_output_buffer_open(snd_output_t **outputp);
+size_t snd_output_buffer_string(snd_output_t *output, char **buf);
+int snd_output_close(snd_output_t *output);
+int snd_output_printf(snd_output_t *output, const char *format, ...)
+#ifndef DOC_HIDDEN
+ __attribute__ ((format (printf, 2, 3)))
+#endif
+ ;
+int snd_output_vprintf(snd_output_t *output, const char *format, va_list args);
+int snd_output_puts(snd_output_t *output, const char *str);
+int snd_output_putc(snd_output_t *output, int c);
+int snd_output_flush(snd_output_t *output);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_OUTPUT_H */
+
diff --git a/thirdparty/linuxbsd_headers/alsa/patches/use-standard-poll-h.diff b/thirdparty/linuxbsd_headers/alsa/patches/use-standard-poll-h.diff
new file mode 100644
index 0000000000..8d536df579
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/patches/use-standard-poll-h.diff
@@ -0,0 +1,11 @@
+--- a/asoundlib.h
++++ b/asoundlib.h
+@@ -35,7 +35,7 @@
+ #include <string.h>
+ #include <fcntl.h>
+ #include <assert.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <errno.h>
+ #include <stdarg.h>
+ #include <endian.h>
diff --git a/thirdparty/linuxbsd_headers/alsa/pcm.h b/thirdparty/linuxbsd_headers/alsa/pcm.h
new file mode 100644
index 0000000000..0be1a321ad
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/pcm.h
@@ -0,0 +1,1327 @@
+/**
+ * \file include/pcm.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver.
+ * See the \ref pcm page for more details.
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_PCM_H
+#define __ALSA_PCM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup PCM PCM Interface
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+/** dlsym version for interface entry callback */
+#define SND_PCM_DLSYM_VERSION _dlsym_pcm_001
+
+/** PCM generic info container */
+typedef struct _snd_pcm_info snd_pcm_info_t;
+
+/** PCM hardware configuration space container
+ *
+ * snd_pcm_hw_params_t is an opaque structure which contains a set of possible
+ * PCM hardware configurations. For example, a given instance might include a
+ * range of buffer sizes, a range of period sizes, and a set of several sample
+ * formats. Some subset of all possible combinations these sets may be valid,
+ * but not necessarily any combination will be valid.
+ *
+ * When a parameter is set or restricted using a snd_pcm_hw_params_set*
+ * function, all of the other ranges will be updated to exclude as many
+ * impossible configurations as possible. Attempting to set a parameter
+ * outside of its acceptable range will result in the function failing
+ * and an error code being returned.
+ */
+typedef struct _snd_pcm_hw_params snd_pcm_hw_params_t;
+
+/** PCM software configuration container */
+typedef struct _snd_pcm_sw_params snd_pcm_sw_params_t;
+/** PCM status container */
+ typedef struct _snd_pcm_status snd_pcm_status_t;
+/** PCM access types mask */
+typedef struct _snd_pcm_access_mask snd_pcm_access_mask_t;
+/** PCM formats mask */
+typedef struct _snd_pcm_format_mask snd_pcm_format_mask_t;
+/** PCM subformats mask */
+typedef struct _snd_pcm_subformat_mask snd_pcm_subformat_mask_t;
+
+/** PCM class */
+typedef enum _snd_pcm_class {
+ /** standard device */
+
+ SND_PCM_CLASS_GENERIC = 0,
+ /** multichannel device */
+ SND_PCM_CLASS_MULTI,
+ /** software modem device */
+ SND_PCM_CLASS_MODEM,
+ /** digitizer device */
+ SND_PCM_CLASS_DIGITIZER,
+ SND_PCM_CLASS_LAST = SND_PCM_CLASS_DIGITIZER
+} snd_pcm_class_t;
+
+/** PCM subclass */
+typedef enum _snd_pcm_subclass {
+ /** subdevices are mixed together */
+ SND_PCM_SUBCLASS_GENERIC_MIX = 0,
+ /** multichannel subdevices are mixed together */
+ SND_PCM_SUBCLASS_MULTI_MIX,
+ SND_PCM_SUBCLASS_LAST = SND_PCM_SUBCLASS_MULTI_MIX
+} snd_pcm_subclass_t;
+
+/** PCM stream (direction) */
+typedef enum _snd_pcm_stream {
+ /** Playback stream */
+ SND_PCM_STREAM_PLAYBACK = 0,
+ /** Capture stream */
+ SND_PCM_STREAM_CAPTURE,
+ SND_PCM_STREAM_LAST = SND_PCM_STREAM_CAPTURE
+} snd_pcm_stream_t;
+
+/** PCM access type */
+typedef enum _snd_pcm_access {
+ /** mmap access with simple interleaved channels */
+ SND_PCM_ACCESS_MMAP_INTERLEAVED = 0,
+ /** mmap access with simple non interleaved channels */
+ SND_PCM_ACCESS_MMAP_NONINTERLEAVED,
+ /** mmap access with complex placement */
+ SND_PCM_ACCESS_MMAP_COMPLEX,
+ /** snd_pcm_readi/snd_pcm_writei access */
+ SND_PCM_ACCESS_RW_INTERLEAVED,
+ /** snd_pcm_readn/snd_pcm_writen access */
+ SND_PCM_ACCESS_RW_NONINTERLEAVED,
+ SND_PCM_ACCESS_LAST = SND_PCM_ACCESS_RW_NONINTERLEAVED
+} snd_pcm_access_t;
+
+/** PCM sample format */
+typedef enum _snd_pcm_format {
+ /** Unknown */
+ SND_PCM_FORMAT_UNKNOWN = -1,
+ /** Signed 8 bit */
+ SND_PCM_FORMAT_S8 = 0,
+ /** Unsigned 8 bit */
+ SND_PCM_FORMAT_U8,
+ /** Signed 16 bit Little Endian */
+ SND_PCM_FORMAT_S16_LE,
+ /** Signed 16 bit Big Endian */
+ SND_PCM_FORMAT_S16_BE,
+ /** Unsigned 16 bit Little Endian */
+ SND_PCM_FORMAT_U16_LE,
+ /** Unsigned 16 bit Big Endian */
+ SND_PCM_FORMAT_U16_BE,
+ /** Signed 24 bit Little Endian using low three bytes in 32-bit word */
+ SND_PCM_FORMAT_S24_LE,
+ /** Signed 24 bit Big Endian using low three bytes in 32-bit word */
+ SND_PCM_FORMAT_S24_BE,
+ /** Unsigned 24 bit Little Endian using low three bytes in 32-bit word */
+ SND_PCM_FORMAT_U24_LE,
+ /** Unsigned 24 bit Big Endian using low three bytes in 32-bit word */
+ SND_PCM_FORMAT_U24_BE,
+ /** Signed 32 bit Little Endian */
+ SND_PCM_FORMAT_S32_LE,
+ /** Signed 32 bit Big Endian */
+ SND_PCM_FORMAT_S32_BE,
+ /** Unsigned 32 bit Little Endian */
+ SND_PCM_FORMAT_U32_LE,
+ /** Unsigned 32 bit Big Endian */
+ SND_PCM_FORMAT_U32_BE,
+ /** Float 32 bit Little Endian, Range -1.0 to 1.0 */
+ SND_PCM_FORMAT_FLOAT_LE,
+ /** Float 32 bit Big Endian, Range -1.0 to 1.0 */
+ SND_PCM_FORMAT_FLOAT_BE,
+ /** Float 64 bit Little Endian, Range -1.0 to 1.0 */
+ SND_PCM_FORMAT_FLOAT64_LE,
+ /** Float 64 bit Big Endian, Range -1.0 to 1.0 */
+ SND_PCM_FORMAT_FLOAT64_BE,
+ /** IEC-958 Little Endian */
+ SND_PCM_FORMAT_IEC958_SUBFRAME_LE,
+ /** IEC-958 Big Endian */
+ SND_PCM_FORMAT_IEC958_SUBFRAME_BE,
+ /** Mu-Law */
+ SND_PCM_FORMAT_MU_LAW,
+ /** A-Law */
+ SND_PCM_FORMAT_A_LAW,
+ /** Ima-ADPCM */
+ SND_PCM_FORMAT_IMA_ADPCM,
+ /** MPEG */
+ SND_PCM_FORMAT_MPEG,
+ /** GSM */
+ SND_PCM_FORMAT_GSM,
+ /** Special */
+ SND_PCM_FORMAT_SPECIAL = 31,
+ /** Signed 24bit Little Endian in 3bytes format */
+ SND_PCM_FORMAT_S24_3LE = 32,
+ /** Signed 24bit Big Endian in 3bytes format */
+ SND_PCM_FORMAT_S24_3BE,
+ /** Unsigned 24bit Little Endian in 3bytes format */
+ SND_PCM_FORMAT_U24_3LE,
+ /** Unsigned 24bit Big Endian in 3bytes format */
+ SND_PCM_FORMAT_U24_3BE,
+ /** Signed 20bit Little Endian in 3bytes format */
+ SND_PCM_FORMAT_S20_3LE,
+ /** Signed 20bit Big Endian in 3bytes format */
+ SND_PCM_FORMAT_S20_3BE,
+ /** Unsigned 20bit Little Endian in 3bytes format */
+ SND_PCM_FORMAT_U20_3LE,
+ /** Unsigned 20bit Big Endian in 3bytes format */
+ SND_PCM_FORMAT_U20_3BE,
+ /** Signed 18bit Little Endian in 3bytes format */
+ SND_PCM_FORMAT_S18_3LE,
+ /** Signed 18bit Big Endian in 3bytes format */
+ SND_PCM_FORMAT_S18_3BE,
+ /** Unsigned 18bit Little Endian in 3bytes format */
+ SND_PCM_FORMAT_U18_3LE,
+ /** Unsigned 18bit Big Endian in 3bytes format */
+ SND_PCM_FORMAT_U18_3BE,
+ /* G.723 (ADPCM) 24 kbit/s, 8 samples in 3 bytes */
+ SND_PCM_FORMAT_G723_24,
+ /* G.723 (ADPCM) 24 kbit/s, 1 sample in 1 byte */
+ SND_PCM_FORMAT_G723_24_1B,
+ /* G.723 (ADPCM) 40 kbit/s, 8 samples in 3 bytes */
+ SND_PCM_FORMAT_G723_40,
+ /* G.723 (ADPCM) 40 kbit/s, 1 sample in 1 byte */
+ SND_PCM_FORMAT_G723_40_1B,
+ /* Direct Stream Digital (DSD) in 1-byte samples (x8) */
+ SND_PCM_FORMAT_DSD_U8,
+ /* Direct Stream Digital (DSD) in 2-byte samples (x16) */
+ SND_PCM_FORMAT_DSD_U16_LE,
+ /* Direct Stream Digital (DSD) in 4-byte samples (x32) */
+ SND_PCM_FORMAT_DSD_U32_LE,
+ /* Direct Stream Digital (DSD) in 2-byte samples (x16) */
+ SND_PCM_FORMAT_DSD_U16_BE,
+ /* Direct Stream Digital (DSD) in 4-byte samples (x32) */
+ SND_PCM_FORMAT_DSD_U32_BE,
+ SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_DSD_U32_BE,
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ /** Signed 16 bit CPU endian */
+ SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_LE,
+ /** Unsigned 16 bit CPU endian */
+ SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_LE,
+ /** Signed 24 bit CPU endian */
+ SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_LE,
+ /** Unsigned 24 bit CPU endian */
+ SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_LE,
+ /** Signed 32 bit CPU endian */
+ SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_LE,
+ /** Unsigned 32 bit CPU endian */
+ SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_LE,
+ /** Float 32 bit CPU endian */
+ SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_LE,
+ /** Float 64 bit CPU endian */
+ SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_LE,
+ /** IEC-958 CPU Endian */
+ SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_LE
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ /** Signed 16 bit CPU endian */
+ SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_BE,
+ /** Unsigned 16 bit CPU endian */
+ SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_BE,
+ /** Signed 24 bit CPU endian */
+ SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_BE,
+ /** Unsigned 24 bit CPU endian */
+ SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_BE,
+ /** Signed 32 bit CPU endian */
+ SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_BE,
+ /** Unsigned 32 bit CPU endian */
+ SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_BE,
+ /** Float 32 bit CPU endian */
+ SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_BE,
+ /** Float 64 bit CPU endian */
+ SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_BE,
+ /** IEC-958 CPU Endian */
+ SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_BE
+#else
+#error "Unknown endian"
+#endif
+} snd_pcm_format_t;
+
+/** PCM sample subformat */
+typedef enum _snd_pcm_subformat {
+ /** Standard */
+ SND_PCM_SUBFORMAT_STD = 0,
+ SND_PCM_SUBFORMAT_LAST = SND_PCM_SUBFORMAT_STD
+} snd_pcm_subformat_t;
+
+/** PCM state */
+typedef enum _snd_pcm_state {
+ /** Open */
+ SND_PCM_STATE_OPEN = 0,
+ /** Setup installed */
+ SND_PCM_STATE_SETUP,
+ /** Ready to start */
+ SND_PCM_STATE_PREPARED,
+ /** Running */
+ SND_PCM_STATE_RUNNING,
+ /** Stopped: underrun (playback) or overrun (capture) detected */
+ SND_PCM_STATE_XRUN,
+ /** Draining: running (playback) or stopped (capture) */
+ SND_PCM_STATE_DRAINING,
+ /** Paused */
+ SND_PCM_STATE_PAUSED,
+ /** Hardware is suspended */
+ SND_PCM_STATE_SUSPENDED,
+ /** Hardware is disconnected */
+ SND_PCM_STATE_DISCONNECTED,
+ SND_PCM_STATE_LAST = SND_PCM_STATE_DISCONNECTED
+} snd_pcm_state_t;
+
+/** PCM start mode */
+typedef enum _snd_pcm_start {
+ /** Automatic start on data read/write */
+ SND_PCM_START_DATA = 0,
+ /** Explicit start */
+ SND_PCM_START_EXPLICIT,
+ SND_PCM_START_LAST = SND_PCM_START_EXPLICIT
+} snd_pcm_start_t;
+
+/** PCM xrun mode */
+typedef enum _snd_pcm_xrun {
+ /** Xrun detection disabled */
+ SND_PCM_XRUN_NONE = 0,
+ /** Stop on xrun detection */
+ SND_PCM_XRUN_STOP,
+ SND_PCM_XRUN_LAST = SND_PCM_XRUN_STOP
+} snd_pcm_xrun_t;
+
+/** PCM timestamp mode */
+typedef enum _snd_pcm_tstamp {
+ /** No timestamp */
+ SND_PCM_TSTAMP_NONE = 0,
+ /** Update timestamp at every hardware position update */
+ SND_PCM_TSTAMP_ENABLE,
+ /** Equivalent with #SND_PCM_TSTAMP_ENABLE,
+ * just for compatibility with older versions
+ */
+ SND_PCM_TSTAMP_MMAP = SND_PCM_TSTAMP_ENABLE,
+ SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_ENABLE
+} snd_pcm_tstamp_t;
+
+typedef enum _snd_pcm_tstamp_type {
+ SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /**< gettimeofday equivalent */
+ SND_PCM_TSTAMP_TYPE_MONOTONIC, /**< posix_clock_monotonic equivalent */
+ SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /**< monotonic_raw (no NTP) */
+ SND_PCM_TSTAMP_TYPE_LAST = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
+} snd_pcm_tstamp_type_t;
+
+typedef struct _snd_pcm_audio_tstamp_config {
+ /* 5 of max 16 bits used */
+ unsigned int type_requested:4;
+ unsigned int report_delay:1; /* add total delay to A/D or D/A */
+} snd_pcm_audio_tstamp_config_t;
+
+typedef struct _snd_pcm_audio_tstamp_report {
+ /* 6 of max 16 bits used for bit-fields */
+
+ /* for backwards compatibility */
+ unsigned int valid:1;
+
+ /* actual type if hardware could not support requested timestamp */
+ unsigned int actual_type:4;
+
+ /* accuracy represented in ns units */
+ unsigned int accuracy_report:1; /* 0 if accuracy unknown, 1 if accuracy field is valid */
+ unsigned int accuracy; /* up to 4.29s, will be packed in separate field */
+} snd_pcm_audio_tstamp_report_t;
+
+/** Unsigned frames quantity */
+typedef unsigned long snd_pcm_uframes_t;
+/** Signed frames quantity */
+typedef long snd_pcm_sframes_t;
+
+/** Non blocking mode (flag for open mode) \hideinitializer */
+#define SND_PCM_NONBLOCK 0x00000001
+/** Async notification (flag for open mode) \hideinitializer */
+#define SND_PCM_ASYNC 0x00000002
+/** In an abort state (internal, not allowed for open) */
+#define SND_PCM_ABORT 0x00008000
+/** Disable automatic (but not forced!) rate resamplinig */
+#define SND_PCM_NO_AUTO_RESAMPLE 0x00010000
+/** Disable automatic (but not forced!) channel conversion */
+#define SND_PCM_NO_AUTO_CHANNELS 0x00020000
+/** Disable automatic (but not forced!) format conversion */
+#define SND_PCM_NO_AUTO_FORMAT 0x00040000
+/** Disable soft volume control */
+#define SND_PCM_NO_SOFTVOL 0x00080000
+
+/** PCM handle */
+typedef struct _snd_pcm snd_pcm_t;
+
+/** PCM type */
+enum _snd_pcm_type {
+ /** Kernel level PCM */
+ SND_PCM_TYPE_HW = 0,
+ /** Hooked PCM */
+ SND_PCM_TYPE_HOOKS,
+ /** One or more linked PCM with exclusive access to selected
+ channels */
+ SND_PCM_TYPE_MULTI,
+ /** File writing plugin */
+ SND_PCM_TYPE_FILE,
+ /** Null endpoint PCM */
+ SND_PCM_TYPE_NULL,
+ /** Shared memory client PCM */
+ SND_PCM_TYPE_SHM,
+ /** INET client PCM (not yet implemented) */
+ SND_PCM_TYPE_INET,
+ /** Copying plugin */
+ SND_PCM_TYPE_COPY,
+ /** Linear format conversion PCM */
+ SND_PCM_TYPE_LINEAR,
+ /** A-Law format conversion PCM */
+ SND_PCM_TYPE_ALAW,
+ /** Mu-Law format conversion PCM */
+ SND_PCM_TYPE_MULAW,
+ /** IMA-ADPCM format conversion PCM */
+ SND_PCM_TYPE_ADPCM,
+ /** Rate conversion PCM */
+ SND_PCM_TYPE_RATE,
+ /** Attenuated static route PCM */
+ SND_PCM_TYPE_ROUTE,
+ /** Format adjusted PCM */
+ SND_PCM_TYPE_PLUG,
+ /** Sharing PCM */
+ SND_PCM_TYPE_SHARE,
+ /** Meter plugin */
+ SND_PCM_TYPE_METER,
+ /** Mixing PCM */
+ SND_PCM_TYPE_MIX,
+ /** Attenuated dynamic route PCM (not yet implemented) */
+ SND_PCM_TYPE_DROUTE,
+ /** Loopback server plugin (not yet implemented) */
+ SND_PCM_TYPE_LBSERVER,
+ /** Linear Integer <-> Linear Float format conversion PCM */
+ SND_PCM_TYPE_LINEAR_FLOAT,
+ /** LADSPA integration plugin */
+ SND_PCM_TYPE_LADSPA,
+ /** Direct Mixing plugin */
+ SND_PCM_TYPE_DMIX,
+ /** Jack Audio Connection Kit plugin */
+ SND_PCM_TYPE_JACK,
+ /** Direct Snooping plugin */
+ SND_PCM_TYPE_DSNOOP,
+ /** Direct Sharing plugin */
+ SND_PCM_TYPE_DSHARE,
+ /** IEC958 subframe plugin */
+ SND_PCM_TYPE_IEC958,
+ /** Soft volume plugin */
+ SND_PCM_TYPE_SOFTVOL,
+ /** External I/O plugin */
+ SND_PCM_TYPE_IOPLUG,
+ /** External filter plugin */
+ SND_PCM_TYPE_EXTPLUG,
+ /** Mmap-emulation plugin */
+ SND_PCM_TYPE_MMAP_EMUL,
+ SND_PCM_TYPE_LAST = SND_PCM_TYPE_MMAP_EMUL
+};
+
+/** PCM type */
+typedef enum _snd_pcm_type snd_pcm_type_t;
+
+/** PCM area specification */
+typedef struct _snd_pcm_channel_area {
+ /** base address of channel samples */
+ void *addr;
+ /** offset to first sample in bits */
+ unsigned int first;
+ /** samples distance in bits */
+ unsigned int step;
+} snd_pcm_channel_area_t;
+
+/** PCM synchronization ID */
+typedef union _snd_pcm_sync_id {
+ /** 8-bit ID */
+ unsigned char id[16];
+ /** 16-bit ID */
+ unsigned short id16[8];
+ /** 32-bit ID */
+ unsigned int id32[4];
+} snd_pcm_sync_id_t;
+
+/** #SND_PCM_TYPE_METER scope handle */
+typedef struct _snd_pcm_scope snd_pcm_scope_t;
+
+int snd_pcm_open(snd_pcm_t **pcm, const char *name,
+ snd_pcm_stream_t stream, int mode);
+int snd_pcm_open_lconf(snd_pcm_t **pcm, const char *name,
+ snd_pcm_stream_t stream, int mode,
+ snd_config_t *lconf);
+int snd_pcm_open_fallback(snd_pcm_t **pcm, snd_config_t *root,
+ const char *name, const char *orig_name,
+ snd_pcm_stream_t stream, int mode);
+
+int snd_pcm_close(snd_pcm_t *pcm);
+const char *snd_pcm_name(snd_pcm_t *pcm);
+snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm);
+snd_pcm_stream_t snd_pcm_stream(snd_pcm_t *pcm);
+int snd_pcm_poll_descriptors_count(snd_pcm_t *pcm);
+int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space);
+int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock);
+static __inline__ int snd_pcm_abort(snd_pcm_t *pcm) { return snd_pcm_nonblock(pcm, 2); }
+int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm,
+ snd_async_callback_t callback, void *private_data);
+snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler);
+int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info);
+int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int snd_pcm_hw_free(snd_pcm_t *pcm);
+int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
+int snd_pcm_prepare(snd_pcm_t *pcm);
+int snd_pcm_reset(snd_pcm_t *pcm);
+int snd_pcm_status(snd_pcm_t *pcm, snd_pcm_status_t *status);
+int snd_pcm_start(snd_pcm_t *pcm);
+int snd_pcm_drop(snd_pcm_t *pcm);
+int snd_pcm_drain(snd_pcm_t *pcm);
+int snd_pcm_pause(snd_pcm_t *pcm, int enable);
+snd_pcm_state_t snd_pcm_state(snd_pcm_t *pcm);
+int snd_pcm_hwsync(snd_pcm_t *pcm);
+int snd_pcm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp);
+int snd_pcm_resume(snd_pcm_t *pcm);
+int snd_pcm_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail, snd_htimestamp_t *tstamp);
+snd_pcm_sframes_t snd_pcm_avail(snd_pcm_t *pcm);
+snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm);
+int snd_pcm_avail_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *availp, snd_pcm_sframes_t *delayp);
+snd_pcm_sframes_t snd_pcm_rewindable(snd_pcm_t *pcm);
+snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
+snd_pcm_sframes_t snd_pcm_forwardable(snd_pcm_t *pcm);
+snd_pcm_sframes_t snd_pcm_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
+snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
+int snd_pcm_wait(snd_pcm_t *pcm, int timeout);
+
+int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2);
+int snd_pcm_unlink(snd_pcm_t *pcm);
+
+/** channel mapping API version number */
+#define SND_CHMAP_API_VERSION ((1 << 16) | (0 << 8) | 1)
+
+/** channel map list type */
+enum snd_pcm_chmap_type {
+ SND_CHMAP_TYPE_NONE = 0,/**< unspecified channel position */
+ SND_CHMAP_TYPE_FIXED, /**< fixed channel position */
+ SND_CHMAP_TYPE_VAR, /**< freely swappable channel position */
+ SND_CHMAP_TYPE_PAIRED, /**< pair-wise swappable channel position */
+ SND_CHMAP_TYPE_LAST = SND_CHMAP_TYPE_PAIRED, /**< last entry */
+};
+
+/** channel positions */
+enum snd_pcm_chmap_position {
+ SND_CHMAP_UNKNOWN = 0, /**< unspecified */
+ SND_CHMAP_NA, /**< N/A, silent */
+ SND_CHMAP_MONO, /**< mono stream */
+ SND_CHMAP_FL, /**< front left */
+ SND_CHMAP_FR, /**< front right */
+ SND_CHMAP_RL, /**< rear left */
+ SND_CHMAP_RR, /**< rear right */
+ SND_CHMAP_FC, /**< front center */
+ SND_CHMAP_LFE, /**< LFE */
+ SND_CHMAP_SL, /**< side left */
+ SND_CHMAP_SR, /**< side right */
+ SND_CHMAP_RC, /**< rear center */
+ SND_CHMAP_FLC, /**< front left center */
+ SND_CHMAP_FRC, /**< front right center */
+ SND_CHMAP_RLC, /**< rear left center */
+ SND_CHMAP_RRC, /**< rear right center */
+ SND_CHMAP_FLW, /**< front left wide */
+ SND_CHMAP_FRW, /**< front right wide */
+ SND_CHMAP_FLH, /**< front left high */
+ SND_CHMAP_FCH, /**< front center high */
+ SND_CHMAP_FRH, /**< front right high */
+ SND_CHMAP_TC, /**< top center */
+ SND_CHMAP_TFL, /**< top front left */
+ SND_CHMAP_TFR, /**< top front right */
+ SND_CHMAP_TFC, /**< top front center */
+ SND_CHMAP_TRL, /**< top rear left */
+ SND_CHMAP_TRR, /**< top rear right */
+ SND_CHMAP_TRC, /**< top rear center */
+ SND_CHMAP_TFLC, /**< top front left center */
+ SND_CHMAP_TFRC, /**< top front right center */
+ SND_CHMAP_TSL, /**< top side left */
+ SND_CHMAP_TSR, /**< top side right */
+ SND_CHMAP_LLFE, /**< left LFE */
+ SND_CHMAP_RLFE, /**< right LFE */
+ SND_CHMAP_BC, /**< bottom center */
+ SND_CHMAP_BLC, /**< bottom left center */
+ SND_CHMAP_BRC, /**< bottom right center */
+ SND_CHMAP_LAST = SND_CHMAP_BRC,
+};
+
+/** bitmask for channel position */
+#define SND_CHMAP_POSITION_MASK 0xffff
+
+/** bit flag indicating the channel is phase inverted */
+#define SND_CHMAP_PHASE_INVERSE (0x01 << 16)
+/** bit flag indicating the non-standard channel value */
+#define SND_CHMAP_DRIVER_SPEC (0x02 << 16)
+
+/** the channel map header */
+typedef struct snd_pcm_chmap {
+ unsigned int channels; /**< number of channels */
+ unsigned int pos[0]; /**< channel position array */
+} snd_pcm_chmap_t;
+
+/** the header of array items returned from snd_pcm_query_chmaps() */
+typedef struct snd_pcm_chmap_query {
+ enum snd_pcm_chmap_type type; /**< channel map type */
+ snd_pcm_chmap_t map; /**< available channel map */
+} snd_pcm_chmap_query_t;
+
+
+snd_pcm_chmap_query_t **snd_pcm_query_chmaps(snd_pcm_t *pcm);
+snd_pcm_chmap_query_t **snd_pcm_query_chmaps_from_hw(int card, int dev,
+ int subdev,
+ snd_pcm_stream_t stream);
+void snd_pcm_free_chmaps(snd_pcm_chmap_query_t **maps);
+snd_pcm_chmap_t *snd_pcm_get_chmap(snd_pcm_t *pcm);
+int snd_pcm_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map);
+
+const char *snd_pcm_chmap_type_name(enum snd_pcm_chmap_type val);
+const char *snd_pcm_chmap_name(enum snd_pcm_chmap_position val);
+const char *snd_pcm_chmap_long_name(enum snd_pcm_chmap_position val);
+int snd_pcm_chmap_print(const snd_pcm_chmap_t *map, size_t maxlen, char *buf);
+unsigned int snd_pcm_chmap_from_string(const char *str);
+snd_pcm_chmap_t *snd_pcm_chmap_parse_string(const char *str);
+
+//int snd_pcm_mixer_element(snd_pcm_t *pcm, snd_mixer_t *mixer, snd_mixer_elem_t **elem);
+
+/*
+ * application helpers - these functions are implemented on top
+ * of the basic API
+ */
+
+int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent);
+int snd_pcm_set_params(snd_pcm_t *pcm,
+ snd_pcm_format_t format,
+ snd_pcm_access_t access,
+ unsigned int channels,
+ unsigned int rate,
+ int soft_resample,
+ unsigned int latency);
+int snd_pcm_get_params(snd_pcm_t *pcm,
+ snd_pcm_uframes_t *buffer_size,
+ snd_pcm_uframes_t *period_size);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Info Stream Information
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+size_t snd_pcm_info_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_pcm_info_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_pcm_info_alloca(ptr) __snd_alloca(ptr, snd_pcm_info)
+int snd_pcm_info_malloc(snd_pcm_info_t **ptr);
+void snd_pcm_info_free(snd_pcm_info_t *obj);
+void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src);
+unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj);
+unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj);
+snd_pcm_stream_t snd_pcm_info_get_stream(const snd_pcm_info_t *obj);
+int snd_pcm_info_get_card(const snd_pcm_info_t *obj);
+const char *snd_pcm_info_get_id(const snd_pcm_info_t *obj);
+const char *snd_pcm_info_get_name(const snd_pcm_info_t *obj);
+const char *snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj);
+snd_pcm_class_t snd_pcm_info_get_class(const snd_pcm_info_t *obj);
+snd_pcm_subclass_t snd_pcm_info_get_subclass(const snd_pcm_info_t *obj);
+unsigned int snd_pcm_info_get_subdevices_count(const snd_pcm_info_t *obj);
+unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj);
+snd_pcm_sync_id_t snd_pcm_info_get_sync(const snd_pcm_info_t *obj);
+void snd_pcm_info_set_device(snd_pcm_info_t *obj, unsigned int val);
+void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val);
+void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val);
+
+/** \} */
+
+/**
+ * \defgroup PCM_HW_Params Hardware Parameters
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+int snd_pcm_hw_params_can_mmap_sample_resolution(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_is_double(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_is_batch(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_is_block_transfer(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_is_monotonic(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_can_overrange(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_can_pause(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_can_resume(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_can_disable_period_wakeup(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_supports_audio_wallclock_ts(const snd_pcm_hw_params_t *params); /* deprecated, use audio_ts_type */
+int snd_pcm_hw_params_supports_audio_ts_type(const snd_pcm_hw_params_t *params, int type);
+int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
+ unsigned int *rate_num,
+ unsigned int *rate_den);
+int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params);
+
+#if 0
+typedef struct _snd_pcm_hw_strategy snd_pcm_hw_strategy_t;
+
+/* choices need to be sorted on ascending badness */
+typedef struct _snd_pcm_hw_strategy_simple_choices_list {
+ unsigned int value;
+ unsigned int badness;
+} snd_pcm_hw_strategy_simple_choices_list_t;
+
+int snd_pcm_hw_params_strategy(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ const snd_pcm_hw_strategy_t *strategy,
+ unsigned int badness_min,
+ unsigned int badness_max);
+
+void snd_pcm_hw_strategy_free(snd_pcm_hw_strategy_t *strategy);
+int snd_pcm_hw_strategy_simple(snd_pcm_hw_strategy_t **strategyp,
+ unsigned int badness_min,
+ unsigned int badness_max);
+int snd_pcm_hw_params_try_explain_failure(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *fail,
+ snd_pcm_hw_params_t *success,
+ unsigned int depth,
+ snd_output_t *out);
+
+#endif
+
+size_t snd_pcm_hw_params_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_pcm_hw_params_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params)
+int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr);
+void snd_pcm_hw_params_free(snd_pcm_hw_params_t *obj);
+void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src);
+
+#if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_HW_PARAMS_API)
+
+int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params, snd_pcm_access_t *_access);
+int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t _access);
+int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t _access);
+int snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *_access);
+int snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *_access);
+int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
+int snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
+
+int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params, snd_pcm_format_t *val);
+int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
+int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
+int snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format);
+int snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format);
+int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
+void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
+
+int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat);
+int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat);
+int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat);
+int snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat);
+int snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat);
+int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
+void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
+
+int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max);
+int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+
+int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_get_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_get_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_get_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+
+int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+
+int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
+int snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
+int snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
+int snd_pcm_hw_params_test_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
+int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
+int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir);
+int snd_pcm_hw_params_set_period_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+
+int snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max);
+int snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+
+#endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_HW_PARAMS_API */
+
+int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+
+/** \} */
+
+/**
+ * \defgroup PCM_SW_Params Software Parameters
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+size_t snd_pcm_sw_params_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_pcm_sw_params_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_pcm_sw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_sw_params)
+int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr);
+void snd_pcm_sw_params_free(snd_pcm_sw_params_t *obj);
+void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *src);
+int snd_pcm_sw_params_get_boundary(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
+
+#if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_SW_PARAMS_API)
+
+int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val);
+int snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_t *val);
+int snd_pcm_sw_params_set_tstamp_type(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t val);
+int snd_pcm_sw_params_get_tstamp_type(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t *val);
+int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_sw_params_set_period_event(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, int val);
+int snd_pcm_sw_params_get_period_event(const snd_pcm_sw_params_t *params, int *val);
+int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_sw_params_get_start_threshold(const snd_pcm_sw_params_t *paramsm, snd_pcm_uframes_t *val);
+int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_sw_params_get_stop_threshold(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
+
+#endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_SW_PARAMS_API */
+
+/** \} */
+
+/* include old API */
+#ifndef ALSA_LIBRARY_BUILD
+#if defined(ALSA_PCM_OLD_HW_PARAMS_API) || defined(ALSA_PCM_OLD_SW_PARAMS_API)
+#include "pcm_old.h"
+#endif
+#endif
+
+/**
+ * \defgroup PCM_Access Access Mask Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+size_t snd_pcm_access_mask_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an empty #snd_pcm_access_mask_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_pcm_access_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_access_mask)
+int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr);
+void snd_pcm_access_mask_free(snd_pcm_access_mask_t *obj);
+void snd_pcm_access_mask_copy(snd_pcm_access_mask_t *dst, const snd_pcm_access_mask_t *src);
+void snd_pcm_access_mask_none(snd_pcm_access_mask_t *mask);
+void snd_pcm_access_mask_any(snd_pcm_access_mask_t *mask);
+int snd_pcm_access_mask_test(const snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
+int snd_pcm_access_mask_empty(const snd_pcm_access_mask_t *mask);
+void snd_pcm_access_mask_set(snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
+void snd_pcm_access_mask_reset(snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Format Format Mask Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+size_t snd_pcm_format_mask_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an empty #snd_pcm_format_mask_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_pcm_format_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_format_mask)
+int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr);
+void snd_pcm_format_mask_free(snd_pcm_format_mask_t *obj);
+void snd_pcm_format_mask_copy(snd_pcm_format_mask_t *dst, const snd_pcm_format_mask_t *src);
+void snd_pcm_format_mask_none(snd_pcm_format_mask_t *mask);
+void snd_pcm_format_mask_any(snd_pcm_format_mask_t *mask);
+int snd_pcm_format_mask_test(const snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
+int snd_pcm_format_mask_empty(const snd_pcm_format_mask_t *mask);
+void snd_pcm_format_mask_set(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
+void snd_pcm_format_mask_reset(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
+
+/** \} */
+
+/**
+ * \defgroup PCM_SubFormat Subformat Mask Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+size_t snd_pcm_subformat_mask_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an empty #snd_pcm_subformat_mask_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_pcm_subformat_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_subformat_mask)
+int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t **ptr);
+void snd_pcm_subformat_mask_free(snd_pcm_subformat_mask_t *obj);
+void snd_pcm_subformat_mask_copy(snd_pcm_subformat_mask_t *dst, const snd_pcm_subformat_mask_t *src);
+void snd_pcm_subformat_mask_none(snd_pcm_subformat_mask_t *mask);
+void snd_pcm_subformat_mask_any(snd_pcm_subformat_mask_t *mask);
+int snd_pcm_subformat_mask_test(const snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);
+int snd_pcm_subformat_mask_empty(const snd_pcm_subformat_mask_t *mask);
+void snd_pcm_subformat_mask_set(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);
+void snd_pcm_subformat_mask_reset(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Status Status Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+size_t snd_pcm_status_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_pcm_status_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_pcm_status_alloca(ptr) __snd_alloca(ptr, snd_pcm_status)
+int snd_pcm_status_malloc(snd_pcm_status_t **ptr);
+void snd_pcm_status_free(snd_pcm_status_t *obj);
+void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src);
+snd_pcm_state_t snd_pcm_status_get_state(const snd_pcm_status_t *obj);
+void snd_pcm_status_get_trigger_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr);
+void snd_pcm_status_get_trigger_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr);
+void snd_pcm_status_get_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr);
+void snd_pcm_status_get_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr);
+void snd_pcm_status_get_audio_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr);
+void snd_pcm_status_get_driver_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr);
+void snd_pcm_status_get_audio_htstamp_report(const snd_pcm_status_t *obj,
+ snd_pcm_audio_tstamp_report_t *audio_tstamp_report);
+void snd_pcm_status_set_audio_htstamp_config(snd_pcm_status_t *obj,
+ snd_pcm_audio_tstamp_config_t *audio_tstamp_config);
+
+static inline void snd_pcm_pack_audio_tstamp_config(unsigned int *data,
+ snd_pcm_audio_tstamp_config_t *config)
+{
+ *data = config->report_delay;
+ *data <<= 4;
+ *data |= config->type_requested;
+}
+
+static inline void snd_pcm_unpack_audio_tstamp_report(unsigned int data, unsigned int accuracy,
+ snd_pcm_audio_tstamp_report_t *report)
+{
+ data >>= 16;
+ report->valid = data & 1;
+ report->actual_type = (data >> 1) & 0xF;
+ report->accuracy_report = (data >> 5) & 1;
+ report->accuracy = accuracy;
+}
+
+snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj);
+snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj);
+snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj);
+snd_pcm_uframes_t snd_pcm_status_get_overrange(const snd_pcm_status_t *obj);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Description Description Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+const char *snd_pcm_type_name(snd_pcm_type_t type);
+const char *snd_pcm_stream_name(const snd_pcm_stream_t stream);
+const char *snd_pcm_access_name(const snd_pcm_access_t _access);
+const char *snd_pcm_format_name(const snd_pcm_format_t format);
+const char *snd_pcm_format_description(const snd_pcm_format_t format);
+const char *snd_pcm_subformat_name(const snd_pcm_subformat_t subformat);
+const char *snd_pcm_subformat_description(const snd_pcm_subformat_t subformat);
+snd_pcm_format_t snd_pcm_format_value(const char* name);
+const char *snd_pcm_tstamp_mode_name(const snd_pcm_tstamp_t mode);
+const char *snd_pcm_state_name(const snd_pcm_state_t state);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Dump Debug Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+int snd_pcm_dump(snd_pcm_t *pcm, snd_output_t *out);
+int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out);
+int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out);
+int snd_pcm_dump_setup(snd_pcm_t *pcm, snd_output_t *out);
+int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, snd_output_t *out);
+int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out);
+int snd_pcm_status_dump(snd_pcm_status_t *status, snd_output_t *out);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Direct Direct Access (MMAP) Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+int snd_pcm_mmap_begin(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t **areas,
+ snd_pcm_uframes_t *offset,
+ snd_pcm_uframes_t *frames);
+snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t frames);
+snd_pcm_sframes_t snd_pcm_mmap_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Helpers Helper Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+int snd_pcm_format_signed(snd_pcm_format_t format);
+int snd_pcm_format_unsigned(snd_pcm_format_t format);
+int snd_pcm_format_linear(snd_pcm_format_t format);
+int snd_pcm_format_float(snd_pcm_format_t format);
+int snd_pcm_format_little_endian(snd_pcm_format_t format);
+int snd_pcm_format_big_endian(snd_pcm_format_t format);
+int snd_pcm_format_cpu_endian(snd_pcm_format_t format);
+int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */
+int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */
+snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian);
+ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);
+u_int8_t snd_pcm_format_silence(snd_pcm_format_t format);
+u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
+u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
+u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
+int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples);
+
+snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes);
+ssize_t snd_pcm_frames_to_bytes(snd_pcm_t *pcm, snd_pcm_sframes_t frames);
+long snd_pcm_bytes_to_samples(snd_pcm_t *pcm, ssize_t bytes);
+ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, long samples);
+
+int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset,
+ unsigned int samples, snd_pcm_format_t format);
+int snd_pcm_areas_silence(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset,
+ unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format);
+int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_channel, snd_pcm_uframes_t src_offset,
+ unsigned int samples, snd_pcm_format_t format);
+int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_channels, snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Hook Hook Extension
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+/** type of pcm hook */
+typedef enum _snd_pcm_hook_type {
+ SND_PCM_HOOK_TYPE_HW_PARAMS = 0,
+ SND_PCM_HOOK_TYPE_HW_FREE,
+ SND_PCM_HOOK_TYPE_CLOSE,
+ SND_PCM_HOOK_TYPE_LAST = SND_PCM_HOOK_TYPE_CLOSE
+} snd_pcm_hook_type_t;
+
+/** PCM hook container */
+typedef struct _snd_pcm_hook snd_pcm_hook_t;
+/** PCM hook callback function */
+typedef int (*snd_pcm_hook_func_t)(snd_pcm_hook_t *hook);
+snd_pcm_t *snd_pcm_hook_get_pcm(snd_pcm_hook_t *hook);
+void *snd_pcm_hook_get_private(snd_pcm_hook_t *hook);
+void snd_pcm_hook_set_private(snd_pcm_hook_t *hook, void *private_data);
+int snd_pcm_hook_add(snd_pcm_hook_t **hookp, snd_pcm_t *pcm,
+ snd_pcm_hook_type_t type,
+ snd_pcm_hook_func_t func, void *private_data);
+int snd_pcm_hook_remove(snd_pcm_hook_t *hook);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Scope Scope Plugin Extension
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+/** #SND_PCM_TYPE_METER scope functions */
+typedef struct _snd_pcm_scope_ops {
+ /** \brief Enable and prepare it using current params
+ * \param scope scope handle
+ */
+ int (*enable)(snd_pcm_scope_t *scope);
+ /** \brief Disable
+ * \param scope scope handle
+ */
+ void (*disable)(snd_pcm_scope_t *scope);
+ /** \brief PCM has been started
+ * \param scope scope handle
+ */
+ void (*start)(snd_pcm_scope_t *scope);
+ /** \brief PCM has been stopped
+ * \param scope scope handle
+ */
+ void (*stop)(snd_pcm_scope_t *scope);
+ /** \brief New frames are present
+ * \param scope scope handle
+ */
+ void (*update)(snd_pcm_scope_t *scope);
+ /** \brief Reset status
+ * \param scope scope handle
+ */
+ void (*reset)(snd_pcm_scope_t *scope);
+ /** \brief PCM is closing
+ * \param scope scope handle
+ */
+ void (*close)(snd_pcm_scope_t *scope);
+} snd_pcm_scope_ops_t;
+
+snd_pcm_uframes_t snd_pcm_meter_get_bufsize(snd_pcm_t *pcm);
+unsigned int snd_pcm_meter_get_channels(snd_pcm_t *pcm);
+unsigned int snd_pcm_meter_get_rate(snd_pcm_t *pcm);
+snd_pcm_uframes_t snd_pcm_meter_get_now(snd_pcm_t *pcm);
+snd_pcm_uframes_t snd_pcm_meter_get_boundary(snd_pcm_t *pcm);
+int snd_pcm_meter_add_scope(snd_pcm_t *pcm, snd_pcm_scope_t *scope);
+snd_pcm_scope_t *snd_pcm_meter_search_scope(snd_pcm_t *pcm, const char *name);
+int snd_pcm_scope_malloc(snd_pcm_scope_t **ptr);
+void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope,
+ const snd_pcm_scope_ops_t *val);
+void snd_pcm_scope_set_name(snd_pcm_scope_t *scope, const char *val);
+const char *snd_pcm_scope_get_name(snd_pcm_scope_t *scope);
+void *snd_pcm_scope_get_callback_private(snd_pcm_scope_t *scope);
+void snd_pcm_scope_set_callback_private(snd_pcm_scope_t *scope, void *val);
+int snd_pcm_scope_s16_open(snd_pcm_t *pcm, const char *name,
+ snd_pcm_scope_t **scopep);
+int16_t *snd_pcm_scope_s16_get_channel_buffer(snd_pcm_scope_t *scope,
+ unsigned int channel);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Simple Simple setup functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+/** Simple PCM latency type */
+typedef enum _snd_spcm_latency {
+ /** standard latency - for standard playback or capture
+ (estimated latency in one direction 350ms) */
+ SND_SPCM_LATENCY_STANDARD = 0,
+ /** medium latency - software phones etc.
+ (estimated latency in one direction maximally 25ms */
+ SND_SPCM_LATENCY_MEDIUM,
+ /** realtime latency - realtime applications (effect processors etc.)
+ (estimated latency in one direction 5ms and better) */
+ SND_SPCM_LATENCY_REALTIME
+} snd_spcm_latency_t;
+
+/** Simple PCM xrun type */
+typedef enum _snd_spcm_xrun_type {
+ /** driver / library will ignore all xruns, the stream runs forever */
+ SND_SPCM_XRUN_IGNORE = 0,
+ /** driver / library stops the stream when an xrun occurs */
+ SND_SPCM_XRUN_STOP
+} snd_spcm_xrun_type_t;
+
+/** Simple PCM duplex type */
+typedef enum _snd_spcm_duplex_type {
+ /** liberal duplex - the buffer and period sizes might not match */
+ SND_SPCM_DUPLEX_LIBERAL = 0,
+ /** pedantic duplex - the buffer and period sizes MUST match */
+ SND_SPCM_DUPLEX_PEDANTIC
+} snd_spcm_duplex_type_t;
+
+int snd_spcm_init(snd_pcm_t *pcm,
+ unsigned int rate,
+ unsigned int channels,
+ snd_pcm_format_t format,
+ snd_pcm_subformat_t subformat,
+ snd_spcm_latency_t latency,
+ snd_pcm_access_t _access,
+ snd_spcm_xrun_type_t xrun_type);
+
+int snd_spcm_init_duplex(snd_pcm_t *playback_pcm,
+ snd_pcm_t *capture_pcm,
+ unsigned int rate,
+ unsigned int channels,
+ snd_pcm_format_t format,
+ snd_pcm_subformat_t subformat,
+ snd_spcm_latency_t latency,
+ snd_pcm_access_t _access,
+ snd_spcm_xrun_type_t xrun_type,
+ snd_spcm_duplex_type_t duplex_type);
+
+int snd_spcm_init_get_params(snd_pcm_t *pcm,
+ unsigned int *rate,
+ snd_pcm_uframes_t *buffer_size,
+ snd_pcm_uframes_t *period_size);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Deprecated Deprecated Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+/* Deprecated functions, for compatibility */
+const char *snd_pcm_start_mode_name(snd_pcm_start_t mode) __attribute__((deprecated));
+const char *snd_pcm_xrun_mode_name(snd_pcm_xrun_t mode) __attribute__((deprecated));
+int snd_pcm_sw_params_set_start_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_start_t val) __attribute__((deprecated));
+snd_pcm_start_t snd_pcm_sw_params_get_start_mode(const snd_pcm_sw_params_t *params) __attribute__((deprecated));
+int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_xrun_t val) __attribute__((deprecated));
+snd_pcm_xrun_t snd_pcm_sw_params_get_xrun_mode(const snd_pcm_sw_params_t *params) __attribute__((deprecated));
+#if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_SW_PARAMS_API)
+int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val) __attribute__((deprecated));
+int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val) __attribute__((deprecated));
+int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val) __attribute__((deprecated));
+int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params, unsigned int *val) __attribute__((deprecated));
+#endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_SW_PARAMS_API */
+#if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_HW_PARAMS_API)
+int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+#endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_HW_PARAMS_API */
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_PCM_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/pcm_external.h b/thirdparty/linuxbsd_headers/alsa/pcm_external.h
new file mode 100644
index 0000000000..5750418882
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/pcm_external.h
@@ -0,0 +1,70 @@
+/**
+ * \file include/pcm_external.h
+ * \brief External PCM plugin SDK
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2005
+ *
+ * Extern PCM plugin SDK.
+ */
+
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+#ifndef __ALSA_PCM_EXTERNAL_H
+#define __ALSA_PCM_EXTERNAL_H
+
+#include "pcm.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Plugin_SDK External PCM plugin SDK
+ * \{
+ */
+
+/**
+ * Define the object entry for external PCM plugins
+ */
+#define SND_PCM_PLUGIN_ENTRY(name) _snd_pcm_##name##_open
+
+/**
+ * Define the symbols of the given plugin with versions
+ */
+#define SND_PCM_PLUGIN_SYMBOL(name) SND_DLSYM_BUILD_VERSION(SND_PCM_PLUGIN_ENTRY(name), SND_PCM_DLSYM_VERSION);
+
+/**
+ * Define the plugin
+ */
+#define SND_PCM_PLUGIN_DEFINE_FUNC(plugin) \
+int SND_PCM_PLUGIN_ENTRY(plugin) (snd_pcm_t **pcmp, const char *name,\
+ snd_config_t *root, snd_config_t *conf, \
+ snd_pcm_stream_t stream, int mode)
+
+#include "pcm_ioplug.h"
+#include "pcm_extplug.h"
+
+int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int *cardp,
+ int *cchannelsp, int *hwctlp);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_PCM_EXTERNAL_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/pcm_extplug.h b/thirdparty/linuxbsd_headers/alsa/pcm_extplug.h
new file mode 100644
index 0000000000..e3b71bc07e
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/pcm_extplug.h
@@ -0,0 +1,206 @@
+/**
+ * \file include/pcm_extplug.h
+ * \brief External Filter-Plugin SDK
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2005
+ *
+ * External Filter-Plugin SDK
+ */
+
+/*
+ * ALSA external PCM plugin SDK (draft version)
+ *
+ * Copyright (c) 2005 Takashi Iwai <tiwai@suse.de>
+ *
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_PCM_EXTPLUG_H
+#define __ALSA_PCM_EXTPLUG_H
+
+/**
+ * \defgroup PCM_ExtPlug External Filter plugin SDK
+ * \ingroup Plugin_SDK
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+/** hw constraints for extplug */
+enum {
+ SND_PCM_EXTPLUG_HW_FORMAT, /**< format */
+ SND_PCM_EXTPLUG_HW_CHANNELS, /**< channels */
+ SND_PCM_EXTPLUG_HW_PARAMS /**< max number of hw constraints */
+};
+
+/** Handle of external filter plugin */
+typedef struct snd_pcm_extplug snd_pcm_extplug_t;
+/** Callback table of extplug */
+typedef struct snd_pcm_extplug_callback snd_pcm_extplug_callback_t;
+#ifdef DOC_HIDDEN
+/* redefine typedefs for stupid doxygen */
+typedef snd_pcm_extplug snd_pcm_extplug_t;
+typedef snd_pcm_extplug_callback snd_pcm_extplug_callback_t;
+#endif
+
+/*
+ * Protocol version
+ */
+#define SND_PCM_EXTPLUG_VERSION_MAJOR 1 /**< Protocol major version */
+#define SND_PCM_EXTPLUG_VERSION_MINOR 0 /**< Protocol minor version */
+#define SND_PCM_EXTPLUG_VERSION_TINY 2 /**< Protocol tiny version */
+/**
+ * Filter-plugin protocol version
+ */
+#define SND_PCM_EXTPLUG_VERSION ((SND_PCM_EXTPLUG_VERSION_MAJOR<<16) |\
+ (SND_PCM_EXTPLUG_VERSION_MINOR<<8) |\
+ (SND_PCM_EXTPLUG_VERSION_TINY))
+
+/** Handle of extplug */
+struct snd_pcm_extplug {
+ /**
+ * protocol version; #SND_PCM_EXTPLUG_VERSION must be filled here
+ * before calling #snd_pcm_extplug_create()
+ */
+ unsigned int version;
+ /**
+ * name of this plugin; must be filled before calling #snd_pcm_extplug_create()
+ */
+ const char *name;
+ /**
+ * callbacks of this plugin; must be filled before calling #snd_pcm_extplug_create()
+ */
+ const snd_pcm_extplug_callback_t *callback;
+ /**
+ * private data, which can be used freely in the driver callbacks
+ */
+ void *private_data;
+ /**
+ * PCM handle filled by #snd_pcm_extplug_create()
+ */
+ snd_pcm_t *pcm;
+ /**
+ * stream direction; read-only status
+ */
+ snd_pcm_stream_t stream;
+ /**
+ * format hw parameter; filled after hw_params is caled
+ */
+ snd_pcm_format_t format;
+ /**
+ * subformat hw parameter; filled after hw_params is caled
+ */
+ snd_pcm_subformat_t subformat;
+ /**
+ * channels hw parameter; filled after hw_params is caled
+ */
+ unsigned int channels;
+ /**
+ * rate hw parameter; filled after hw_params is caled
+ */
+ unsigned int rate;
+ /**
+ * slave_format hw parameter; filled after hw_params is caled
+ */
+ snd_pcm_format_t slave_format;
+ /**
+ * slave_subformat hw parameter; filled after hw_params is caled
+ */
+ snd_pcm_subformat_t slave_subformat;
+ /**
+ * slave_channels hw parameter; filled after hw_params is caled
+ */
+ unsigned int slave_channels;
+};
+
+/** Callback table of extplug */
+struct snd_pcm_extplug_callback {
+ /**
+ * transfer between source and destination; this is a required callback
+ */
+ snd_pcm_sframes_t (*transfer)(snd_pcm_extplug_t *ext,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ snd_pcm_uframes_t size);
+ /**
+ * close the PCM; optional
+ */
+ int (*close)(snd_pcm_extplug_t *ext);
+ /**
+ * hw_params; optional
+ */
+ int (*hw_params)(snd_pcm_extplug_t *ext, snd_pcm_hw_params_t *params);
+ /**
+ * hw_free; optional
+ */
+ int (*hw_free)(snd_pcm_extplug_t *ext);
+ /**
+ * dump; optional
+ */
+ void (*dump)(snd_pcm_extplug_t *ext, snd_output_t *out);
+ /**
+ * init; optional initialization called at prepare or reset
+ */
+ int (*init)(snd_pcm_extplug_t *ext);
+ /**
+ * query the channel maps; optional; since v1.0.2
+ */
+ snd_pcm_chmap_query_t **(*query_chmaps)(snd_pcm_extplug_t *ext);
+ /**
+ * get the channel map; optional; since v1.0.2
+ */
+ snd_pcm_chmap_t *(*get_chmap)(snd_pcm_extplug_t *ext);
+ /**
+ * set the channel map; optional; since v1.0.2
+ */
+ int (*set_chmap)(snd_pcm_extplug_t *ext, const snd_pcm_chmap_t *map);
+};
+
+
+int snd_pcm_extplug_create(snd_pcm_extplug_t *ext, const char *name,
+ snd_config_t *root, snd_config_t *slave_conf,
+ snd_pcm_stream_t stream, int mode);
+int snd_pcm_extplug_delete(snd_pcm_extplug_t *ext);
+
+/* clear hw_parameter setting */
+void snd_pcm_extplug_params_reset(snd_pcm_extplug_t *ext);
+
+/* hw_parameter setting */
+int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list);
+int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max);
+int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list);
+int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max);
+
+/**
+ * set the parameter constraint with a single value
+ */
+static __inline__ int snd_pcm_extplug_set_param(snd_pcm_extplug_t *extplug, int type, unsigned int val)
+{
+ return snd_pcm_extplug_set_param_list(extplug, type, 1, &val);
+}
+
+/**
+ * set the parameter constraint for slave PCM with a single value
+ */
+static __inline__ int snd_pcm_extplug_set_slave_param(snd_pcm_extplug_t *extplug, int type, unsigned int val)
+{
+ return snd_pcm_extplug_set_slave_param_list(extplug, type, 1, &val);
+}
+
+/** \} */
+
+#endif /* __ALSA_PCM_EXTPLUG_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/pcm_ioplug.h b/thirdparty/linuxbsd_headers/alsa/pcm_ioplug.h
new file mode 100644
index 0000000000..8c25e5e198
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/pcm_ioplug.h
@@ -0,0 +1,234 @@
+/**
+ * \file include/pcm_ioplug.h
+ * \brief External I/O-Plugin SDK
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2005
+ *
+ * External I/O-Plugin SDK
+ */
+
+/*
+ * ALSA external PCM plugin SDK
+ *
+ * Copyright (c) 2005 Takashi Iwai <tiwai@suse.de>
+ *
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_PCM_IOPLUG_H
+#define __ALSA_PCM_IOPLUG_H
+
+/**
+ * \defgroup PCM_IOPlug External I/O plugin SDK
+ * \ingroup Plugin_SDK
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+/** hw constraints for ioplug */
+enum {
+ SND_PCM_IOPLUG_HW_ACCESS = 0, /**< access type */
+ SND_PCM_IOPLUG_HW_FORMAT, /**< format */
+ SND_PCM_IOPLUG_HW_CHANNELS, /**< channels */
+ SND_PCM_IOPLUG_HW_RATE, /**< rate */
+ SND_PCM_IOPLUG_HW_PERIOD_BYTES, /**< period bytes */
+ SND_PCM_IOPLUG_HW_BUFFER_BYTES, /**< buffer bytes */
+ SND_PCM_IOPLUG_HW_PERIODS, /**< number of periods */
+ SND_PCM_IOPLUG_HW_PARAMS /**< max number of hw constraints */
+};
+
+/** I/O plugin handle */
+typedef struct snd_pcm_ioplug snd_pcm_ioplug_t;
+/** Callback table of ioplug */
+typedef struct snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;
+#ifdef DOC_HIDDEN
+/* redefine typedefs for stupid doxygen */
+typedef snd_pcm_ioplug snd_pcm_ioplug_t;
+typedef snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;
+#endif
+
+/*
+ * bit flags for additional conditions
+ */
+#define SND_PCM_IOPLUG_FLAG_LISTED (1<<0) /**< list up this PCM */
+#define SND_PCM_IOPLUG_FLAG_MONOTONIC (1<<1) /**< monotonic timestamps */
+
+/*
+ * Protocol version
+ */
+#define SND_PCM_IOPLUG_VERSION_MAJOR 1 /**< Protocol major version */
+#define SND_PCM_IOPLUG_VERSION_MINOR 0 /**< Protocol minor version */
+#define SND_PCM_IOPLUG_VERSION_TINY 2 /**< Protocol tiny version */
+/**
+ * IO-plugin protocol version
+ */
+#define SND_PCM_IOPLUG_VERSION ((SND_PCM_IOPLUG_VERSION_MAJOR<<16) |\
+ (SND_PCM_IOPLUG_VERSION_MINOR<<8) |\
+ (SND_PCM_IOPLUG_VERSION_TINY))
+
+/** Handle of ioplug */
+struct snd_pcm_ioplug {
+ /**
+ * protocol version; #SND_PCM_IOPLUG_VERSION must be filled here
+ * before calling #snd_pcm_ioplug_create()
+ */
+ unsigned int version;
+ /**
+ * name of this plugin; must be filled before calling #snd_pcm_ioplug_create()
+ */
+ const char *name;
+ unsigned int flags; /**< SND_PCM_IOPLUG_FLAG_XXX */
+ int poll_fd; /**< poll file descriptor */
+ unsigned int poll_events; /**< poll events */
+ unsigned int mmap_rw; /**< pseudo mmap mode */
+ /**
+ * callbacks of this plugin; must be filled before calling #snd_pcm_ioplug_create()
+ */
+ const snd_pcm_ioplug_callback_t *callback;
+ /**
+ * private data, which can be used freely in the driver callbacks
+ */
+ void *private_data;
+ /**
+ * PCM handle filled by #snd_pcm_extplug_create()
+ */
+ snd_pcm_t *pcm;
+
+ snd_pcm_stream_t stream; /**< stream direcion; read-only */
+ snd_pcm_state_t state; /**< current PCM state; read-only */
+ volatile snd_pcm_uframes_t appl_ptr; /**< application pointer; read-only */
+ volatile snd_pcm_uframes_t hw_ptr; /**< hw pointer; read-only */
+ int nonblock; /**< non-block mode; read-only */
+
+ snd_pcm_access_t access; /**< access type; filled after hw_params is called */
+ snd_pcm_format_t format; /**< PCM format; filled after hw_params is called */
+ unsigned int channels; /**< number of channels; filled after hw_params is called */
+ unsigned int rate; /**< rate; filled after hw_params is called */
+ snd_pcm_uframes_t period_size; /**< period size; filled after hw_params is called */
+ snd_pcm_uframes_t buffer_size; /**< buffer size; filled after hw_params is called */
+};
+
+/** Callback table of ioplug */
+struct snd_pcm_ioplug_callback {
+ /**
+ * start the PCM; required, called inside mutex lock
+ */
+ int (*start)(snd_pcm_ioplug_t *io);
+ /**
+ * stop the PCM; required, called inside mutex lock
+ */
+ int (*stop)(snd_pcm_ioplug_t *io);
+ /**
+ * get the current DMA position; required, called inside mutex lock
+ */
+ snd_pcm_sframes_t (*pointer)(snd_pcm_ioplug_t *io);
+ /**
+ * transfer the data; optional, called inside mutex lock
+ */
+ snd_pcm_sframes_t (*transfer)(snd_pcm_ioplug_t *io,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size);
+ /**
+ * close the PCM; optional
+ */
+ int (*close)(snd_pcm_ioplug_t *io);
+ /**
+ * hw_params; optional
+ */
+ int (*hw_params)(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params);
+ /**
+ * hw_free; optional
+ */
+ int (*hw_free)(snd_pcm_ioplug_t *io);
+ /**
+ * sw_params; optional
+ */
+ int (*sw_params)(snd_pcm_ioplug_t *io, snd_pcm_sw_params_t *params);
+ /**
+ * prepare; optional
+ */
+ int (*prepare)(snd_pcm_ioplug_t *io);
+ /**
+ * drain; optional
+ */
+ int (*drain)(snd_pcm_ioplug_t *io);
+ /**
+ * toggle pause; optional, called inside mutex lock
+ */
+ int (*pause)(snd_pcm_ioplug_t *io, int enable);
+ /**
+ * resume; optional
+ */
+ int (*resume)(snd_pcm_ioplug_t *io);
+ /**
+ * poll descriptors count; optional
+ */
+ int (*poll_descriptors_count)(snd_pcm_ioplug_t *io);
+ /**
+ * poll descriptors; optional
+ */
+ int (*poll_descriptors)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int space);
+ /**
+ * mangle poll events; optional
+ */
+ int (*poll_revents)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int nfds, unsigned short *revents);
+ /**
+ * dump; optional
+ */
+ void (*dump)(snd_pcm_ioplug_t *io, snd_output_t *out);
+ /**
+ * get the delay for the running PCM; optional; since v1.0.1
+ */
+ int (*delay)(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp);
+ /**
+ * query the channel maps; optional; since v1.0.2
+ */
+ snd_pcm_chmap_query_t **(*query_chmaps)(snd_pcm_ioplug_t *io);
+ /**
+ * get the channel map; optional; since v1.0.2
+ */
+ snd_pcm_chmap_t *(*get_chmap)(snd_pcm_ioplug_t *io);
+ /**
+ * set the channel map; optional; since v1.0.2
+ */
+ int (*set_chmap)(snd_pcm_ioplug_t *io, const snd_pcm_chmap_t *map);
+};
+
+
+int snd_pcm_ioplug_create(snd_pcm_ioplug_t *io, const char *name,
+ snd_pcm_stream_t stream, int mode);
+int snd_pcm_ioplug_delete(snd_pcm_ioplug_t *io);
+
+/* update poll_fd and mmap_rw */
+int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug);
+
+/* get a mmap area (for mmap_rw only) */
+const snd_pcm_channel_area_t *snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t *ioplug);
+
+/* clear hw_parameter setting */
+void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *io);
+
+/* hw_parameter setting */
+int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *io, int type, unsigned int min, unsigned int max);
+int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *io, int type, unsigned int num_list, const unsigned int *list);
+
+/* change PCM status */
+int snd_pcm_ioplug_set_state(snd_pcm_ioplug_t *ioplug, snd_pcm_state_t state);
+
+/** \} */
+
+#endif /* __ALSA_PCM_IOPLUG_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/pcm_old.h b/thirdparty/linuxbsd_headers/alsa/pcm_old.h
new file mode 100644
index 0000000000..e6e050fc32
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/pcm_old.h
@@ -0,0 +1,230 @@
+/*
+ * Old ALSA 0.9.x API
+ */
+
+#ifdef ALSA_PCM_OLD_HW_PARAMS_API
+
+asm(".symver snd_pcm_hw_params_get_access,snd_pcm_hw_params_get_access@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_access_first,snd_pcm_hw_params_set_access_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_access_last,snd_pcm_hw_params_set_access_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val);
+int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val);
+snd_pcm_access_t snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
+void snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
+
+asm(".symver snd_pcm_hw_params_get_format,snd_pcm_hw_params_get_format@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_format_first,snd_pcm_hw_params_set_format_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_format_last,snd_pcm_hw_params_set_format_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
+int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
+snd_pcm_format_t snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
+void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
+
+asm(".symver snd_pcm_hw_params_get_subformat,snd_pcm_hw_params_get_subformat@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_subformat_first,snd_pcm_hw_params_set_subformat_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_subformat_last,snd_pcm_hw_params_set_subformat_last@ALSA_0.9");
+
+int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val);
+int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val);
+snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
+void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
+
+asm(".symver snd_pcm_hw_params_get_channels,snd_pcm_hw_params_get_channels@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_channels_min,snd_pcm_hw_params_get_channels_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_channels_max,snd_pcm_hw_params_get_channels_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_channels_near,snd_pcm_hw_params_set_channels_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_channels_first,snd_pcm_hw_params_set_channels_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_channels_last,snd_pcm_hw_params_set_channels_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params);
+unsigned int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params);
+unsigned int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max);
+unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+unsigned int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+unsigned int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+asm(".symver snd_pcm_hw_params_get_rate,snd_pcm_hw_params_get_rate@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_rate_min,snd_pcm_hw_params_get_rate_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_rate_max,snd_pcm_hw_params_get_rate_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_rate_near,snd_pcm_hw_params_set_rate_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_rate_first,snd_pcm_hw_params_set_rate_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_rate_last,snd_pcm_hw_params_set_rate_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+unsigned int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
+unsigned int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_get_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+
+asm(".symver snd_pcm_hw_params_get_period_time,snd_pcm_hw_params_get_period_time@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_period_time_min,snd_pcm_hw_params_get_period_time_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_period_time_max,snd_pcm_hw_params_get_period_time_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_period_time_near,snd_pcm_hw_params_set_period_time_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_period_time_first,snd_pcm_hw_params_set_period_time_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_period_time_last,snd_pcm_hw_params_set_period_time_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
+unsigned int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+
+asm(".symver snd_pcm_hw_params_get_period_size,snd_pcm_hw_params_get_period_size@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_period_size_min,snd_pcm_hw_params_get_period_size_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_period_size_max,snd_pcm_hw_params_get_period_size_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_period_size_near,snd_pcm_hw_params_set_period_size_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_period_size_first,snd_pcm_hw_params_set_period_size_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_period_size_last,snd_pcm_hw_params_set_period_size_last@ALSA_0.9");
+
+snd_pcm_sframes_t snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, int *dir);
+snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, int *dir);
+snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_test_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
+int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
+int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir);
+snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int *dir);
+snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+asm(".symver snd_pcm_hw_params_get_periods,snd_pcm_hw_params_get_periods@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_periods_min,snd_pcm_hw_params_get_periods_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_periods_max,snd_pcm_hw_params_get_periods_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_periods_near,snd_pcm_hw_params_set_periods_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_periods_first,snd_pcm_hw_params_set_periods_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_periods_last,snd_pcm_hw_params_set_periods_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+unsigned int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
+unsigned int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+asm(".symver snd_pcm_hw_params_get_buffer_time,snd_pcm_hw_params_get_buffer_time@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_buffer_time_min,snd_pcm_hw_params_get_buffer_time_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_buffer_time_max,snd_pcm_hw_params_get_buffer_time_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_buffer_time_near,snd_pcm_hw_params_set_buffer_time_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_buffer_time_first,snd_pcm_hw_params_set_buffer_time_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_buffer_time_last,snd_pcm_hw_params_set_buffer_time_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
+unsigned int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+
+asm(".symver snd_pcm_hw_params_get_buffer_size,snd_pcm_hw_params_get_buffer_size@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_buffer_size_min,snd_pcm_hw_params_get_buffer_size_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_buffer_size_max,snd_pcm_hw_params_get_buffer_size_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_buffer_size_near,snd_pcm_hw_params_set_buffer_size_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_buffer_size_first,snd_pcm_hw_params_set_buffer_size_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_buffer_size_last,snd_pcm_hw_params_set_buffer_size_last@ALSA_0.9");
+
+snd_pcm_sframes_t snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params);
+snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params);
+snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max);
+snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
+snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+asm(".symver snd_pcm_hw_params_get_tick_time,snd_pcm_hw_params_get_tick_time@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_tick_time_min,snd_pcm_hw_params_get_tick_time_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_tick_time_max,snd_pcm_hw_params_get_tick_time_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_tick_time_near,snd_pcm_hw_params_set_tick_time_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_tick_time_first,snd_pcm_hw_params_set_tick_time_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_tick_time_last,snd_pcm_hw_params_set_tick_time_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+unsigned int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
+unsigned int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+
+#endif /* ALSA_PCM_OLD_HW_PARAMS_API */
+
+
+#ifdef ALSA_PCM_OLD_SW_PARAMS_API
+
+asm(".symver snd_pcm_sw_params_get_tstamp_mode,snd_pcm_sw_params_get_tstamp_mode@ALSA_0.9");
+asm(".symver snd_pcm_sw_params_get_sleep_min,snd_pcm_sw_params_get_sleep_min@ALSA_0.9");
+asm(".symver snd_pcm_sw_params_get_avail_min,snd_pcm_sw_params_get_avail_min@ALSA_0.9");
+asm(".symver snd_pcm_sw_params_get_xfer_align,snd_pcm_sw_params_get_xfer_align@ALSA_0.9");
+asm(".symver snd_pcm_sw_params_get_start_threshold,snd_pcm_sw_params_get_start_threshold@ALSA_0.9");
+asm(".symver snd_pcm_sw_params_get_stop_threshold,snd_pcm_sw_params_get_stop_threshold@ALSA_0.9");
+asm(".symver snd_pcm_sw_params_get_silence_threshold,snd_pcm_sw_params_get_silence_threshold@ALSA_0.9");
+asm(".symver snd_pcm_sw_params_get_silence_size,snd_pcm_sw_params_get_silence_size@ALSA_0.9");
+
+int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val);
+snd_pcm_tstamp_t snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val);
+unsigned int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+snd_pcm_uframes_t snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+snd_pcm_uframes_t snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+snd_pcm_uframes_t snd_pcm_sw_params_get_start_threshold(const snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+snd_pcm_uframes_t snd_pcm_sw_params_get_stop_threshold(const snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+snd_pcm_uframes_t snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+snd_pcm_uframes_t snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *params);
+
+#endif /* ALSA_PCM_OLD_SW_PARAMS_API */
diff --git a/thirdparty/linuxbsd_headers/alsa/pcm_plugin.h b/thirdparty/linuxbsd_headers/alsa/pcm_plugin.h
new file mode 100644
index 0000000000..eea1d82d87
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/pcm_plugin.h
@@ -0,0 +1,202 @@
+/**
+ * \file include/pcm_plugin.h
+ * \brief Common PCM plugin code
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2000-2001
+ *
+ * Application interface library for the ALSA driver.
+ * See the \ref pcm_plugins page for more details.
+ *
+ * \warning Using of contents of this header file might be dangerous
+ * in the sense of compatibility reasons. The contents might be
+ * freely changed in future.
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_PCM_PLUGIN_H
+
+/**
+ * \defgroup PCM_Plugins PCM Plugins
+ * \ingroup PCM
+ * See the \ref pcm_plugins page for more details.
+ * \{
+ */
+
+#define SND_PCM_PLUGIN_RATE_MIN 4000 /**< minimal rate for the rate plugin */
+#define SND_PCM_PLUGIN_RATE_MAX 192000 /**< maximal rate for the rate plugin */
+
+/* ROUTE_FLOAT should be set to 0 for machines without FP unit - like iPAQ */
+#ifdef HAVE_SOFT_FLOAT
+#define SND_PCM_PLUGIN_ROUTE_FLOAT 0 /**< use integers for route plugin */
+#else
+#define SND_PCM_PLUGIN_ROUTE_FLOAT 1 /**< use floats for route plugin */
+#endif
+
+#define SND_PCM_PLUGIN_ROUTE_RESOLUTION 16 /**< integer resolution for route plugin */
+
+#if SND_PCM_PLUGIN_ROUTE_FLOAT
+/** route ttable entry type */
+typedef float snd_pcm_route_ttable_entry_t;
+#define SND_PCM_PLUGIN_ROUTE_HALF 0.5 /**< half value */
+#define SND_PCM_PLUGIN_ROUTE_FULL 1.0 /**< full value */
+#else
+/** route ttable entry type */
+typedef int snd_pcm_route_ttable_entry_t;
+#define SND_PCM_PLUGIN_ROUTE_HALF (SND_PCM_PLUGIN_ROUTE_RESOLUTION / 2) /**< half value */
+#define SND_PCM_PLUGIN_ROUTE_FULL SND_PCM_PLUGIN_ROUTE_RESOLUTION /**< full value */
+#endif
+
+/*
+ * Hardware plugin
+ */
+int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
+ int card, int device, int subdevice,
+ snd_pcm_stream_t stream, int mode,
+ int mmap_emulation, int sync_ptr_ioctl);
+int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Copy plugin
+ */
+int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_t *slave, int close_slave);
+int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Linear conversion plugin
+ */
+int snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, snd_pcm_t *slave,
+ int close_slave);
+int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Linear<->Float conversion plugin
+ */
+int snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, snd_pcm_t *slave,
+ int close_slave);
+int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Linear<->mu-Law conversion plugin
+ */
+int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, snd_pcm_t *slave,
+ int close_slave);
+int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Linear<->a-Law conversion plugin
+ */
+int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, snd_pcm_t *slave,
+ int close_slave);
+int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Linear<->Ima-ADPCM conversion plugin
+ */
+int snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, snd_pcm_t *slave,
+ int close_slave);
+int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Route plugin for linear formats
+ */
+int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *ttable,
+ unsigned int tt_csize, unsigned int tt_ssize,
+ unsigned int *tt_cused, unsigned int *tt_sused,
+ int schannels);
+int snd_pcm_route_determine_ttable(snd_config_t *tt,
+ unsigned int *tt_csize,
+ unsigned int *tt_ssize);
+int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, int schannels,
+ snd_pcm_route_ttable_entry_t *ttable,
+ unsigned int tt_ssize,
+ unsigned int tt_cused, unsigned int tt_sused,
+ snd_pcm_t *slave, int close_slave);
+int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Rate plugin for linear formats
+ */
+int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, unsigned int srate,
+ const snd_config_t *converter,
+ snd_pcm_t *slave, int close_slave);
+int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Hooks plugin
+ */
+int snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_t *slave, int close_slave);
+int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * LADSPA plugin
+ */
+int snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
+ const char *ladspa_path,
+ unsigned int channels,
+ snd_config_t *ladspa_pplugins,
+ snd_config_t *ladspa_cplugins,
+ snd_pcm_t *slave, int close_slave);
+int _snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Jack plugin
+ */
+int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *playback_conf,
+ snd_config_t *capture_conf,
+ snd_pcm_stream_t stream, int mode);
+int _snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+
+/** \} */
+
+#endif /* __ALSA_PCM_PLUGIN_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/pcm_rate.h b/thirdparty/linuxbsd_headers/alsa/pcm_rate.h
new file mode 100644
index 0000000000..4d70df2693
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/pcm_rate.h
@@ -0,0 +1,153 @@
+/**
+ * \file include/pcm_rate.h
+ * \brief External Rate-Converter-Plugin SDK
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2006
+ *
+ * External Rate-Converter-Plugin SDK
+ */
+
+/*
+ * ALSA external PCM rate-converter plugin SDK (draft version)
+ *
+ * Copyright (c) 2006 Takashi Iwai <tiwai@suse.de>
+ *
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_PCM_RATE_H
+#define __ALSA_PCM_RATE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Protocol version
+ */
+#define SND_PCM_RATE_PLUGIN_VERSION 0x010002
+
+/** hw_params information for a single side */
+typedef struct snd_pcm_rate_side_info {
+ snd_pcm_format_t format;
+ unsigned int rate;
+ snd_pcm_uframes_t buffer_size;
+ snd_pcm_uframes_t period_size;
+} snd_pcm_rate_side_info_t;
+
+/** hw_params information */
+typedef struct snd_pcm_rate_info {
+ struct snd_pcm_rate_side_info in;
+ struct snd_pcm_rate_side_info out;
+ unsigned int channels;
+} snd_pcm_rate_info_t;
+
+/** Callback table of rate-converter */
+typedef struct snd_pcm_rate_ops {
+ /**
+ * close the converter; optional
+ */
+ void (*close)(void *obj);
+ /**
+ * initialize the converter, called at hw_params
+ */
+ int (*init)(void *obj, snd_pcm_rate_info_t *info);
+ /**
+ * free the converter; optional
+ */
+ void (*free)(void *obj);
+ /**
+ * reset the converter, called at prepare; optional
+ */
+ void (*reset)(void *obj);
+ /**
+ * adjust the pitch, called at sw_params; optional
+ */
+ int (*adjust_pitch)(void *obj, snd_pcm_rate_info_t *info);
+ /**
+ * convert the data
+ */
+ void (*convert)(void *obj,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset, unsigned int src_frames);
+ /**
+ * convert an s16 interleaved-data array; exclusive with convert
+ */
+ void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames,
+ const int16_t *src, unsigned int src_frames);
+ /**
+ * compute the frame size for input
+ */
+ snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames);
+ /**
+ * compute the frame size for output
+ */
+ snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames);
+ /**
+ * the protocol version the plugin supports;
+ * new field since version 0x010002
+ */
+ unsigned int version;
+ /**
+ * return the supported min / max sample rates;
+ * new ops since version 0x010002
+ */
+ int (*get_supported_rates)(void *obj, unsigned int *rate_min,
+ unsigned int *rate_max);
+ /**
+ * show some status messages for verbose mode;
+ * new ops since version 0x010002
+ */
+ void (*dump)(void *obj, snd_output_t *out);
+} snd_pcm_rate_ops_t;
+
+/** open function type */
+typedef int (*snd_pcm_rate_open_func_t)(unsigned int version, void **objp,
+ snd_pcm_rate_ops_t *opsp);
+
+/**
+ * Define the object entry for external PCM rate-converter plugins
+ */
+#define SND_PCM_RATE_PLUGIN_ENTRY(name) _snd_pcm_rate_##name##_open
+
+
+#ifndef DOC_HIDDEN
+/* old rate_ops for protocol version 0x010001 */
+typedef struct snd_pcm_rate_old_ops {
+ void (*close)(void *obj);
+ int (*init)(void *obj, snd_pcm_rate_info_t *info);
+ void (*free)(void *obj);
+ void (*reset)(void *obj);
+ int (*adjust_pitch)(void *obj, snd_pcm_rate_info_t *info);
+ void (*convert)(void *obj,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset, unsigned int src_frames);
+ void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames,
+ const int16_t *src, unsigned int src_frames);
+ snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames);
+ snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames);
+} snd_pcm_rate_old_ops_t;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_PCM_RATE_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/rawmidi.h b/thirdparty/linuxbsd_headers/alsa/rawmidi.h
new file mode 100644
index 0000000000..1d8fd56276
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/rawmidi.h
@@ -0,0 +1,159 @@
+/**
+ * \file include/rawmidi.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_RAWMIDI_H
+#define __ALSA_RAWMIDI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup RawMidi RawMidi Interface
+ * The RawMidi Interface. See \ref rawmidi page for more details.
+ * \{
+ */
+
+/** dlsym version for interface entry callback */
+#define SND_RAWMIDI_DLSYM_VERSION _dlsym_rawmidi_001
+
+/** RawMidi information container */
+typedef struct _snd_rawmidi_info snd_rawmidi_info_t;
+/** RawMidi settings container */
+typedef struct _snd_rawmidi_params snd_rawmidi_params_t;
+/** RawMidi status container */
+typedef struct _snd_rawmidi_status snd_rawmidi_status_t;
+
+/** RawMidi stream (direction) */
+typedef enum _snd_rawmidi_stream {
+ /** Output stream */
+ SND_RAWMIDI_STREAM_OUTPUT = 0,
+ /** Input stream */
+ SND_RAWMIDI_STREAM_INPUT,
+ SND_RAWMIDI_STREAM_LAST = SND_RAWMIDI_STREAM_INPUT
+} snd_rawmidi_stream_t;
+
+/** Append (flag to open mode) \hideinitializer */
+#define SND_RAWMIDI_APPEND 0x0001
+/** Non blocking mode (flag to open mode) \hideinitializer */
+#define SND_RAWMIDI_NONBLOCK 0x0002
+/** Write sync mode (Flag to open mode) \hideinitializer */
+#define SND_RAWMIDI_SYNC 0x0004
+
+/** RawMidi handle */
+typedef struct _snd_rawmidi snd_rawmidi_t;
+
+/** RawMidi type */
+typedef enum _snd_rawmidi_type {
+ /** Kernel level RawMidi */
+ SND_RAWMIDI_TYPE_HW,
+ /** Shared memory client RawMidi (not yet implemented) */
+ SND_RAWMIDI_TYPE_SHM,
+ /** INET client RawMidi (not yet implemented) */
+ SND_RAWMIDI_TYPE_INET,
+ /** Virtual (sequencer) RawMidi */
+ SND_RAWMIDI_TYPE_VIRTUAL
+} snd_rawmidi_type_t;
+
+int snd_rawmidi_open(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
+ const char *name, int mode);
+int snd_rawmidi_open_lconf(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
+ const char *name, int mode, snd_config_t *lconf);
+int snd_rawmidi_close(snd_rawmidi_t *rmidi);
+int snd_rawmidi_poll_descriptors_count(snd_rawmidi_t *rmidi);
+int snd_rawmidi_poll_descriptors(snd_rawmidi_t *rmidi, struct pollfd *pfds, unsigned int space);
+int snd_rawmidi_poll_descriptors_revents(snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int nfds, unsigned short *revent);
+int snd_rawmidi_nonblock(snd_rawmidi_t *rmidi, int nonblock);
+size_t snd_rawmidi_info_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_rawmidi_info_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_rawmidi_info_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_info)
+int snd_rawmidi_info_malloc(snd_rawmidi_info_t **ptr);
+void snd_rawmidi_info_free(snd_rawmidi_info_t *obj);
+void snd_rawmidi_info_copy(snd_rawmidi_info_t *dst, const snd_rawmidi_info_t *src);
+unsigned int snd_rawmidi_info_get_device(const snd_rawmidi_info_t *obj);
+unsigned int snd_rawmidi_info_get_subdevice(const snd_rawmidi_info_t *obj);
+snd_rawmidi_stream_t snd_rawmidi_info_get_stream(const snd_rawmidi_info_t *obj);
+int snd_rawmidi_info_get_card(const snd_rawmidi_info_t *obj);
+unsigned int snd_rawmidi_info_get_flags(const snd_rawmidi_info_t *obj);
+const char *snd_rawmidi_info_get_id(const snd_rawmidi_info_t *obj);
+const char *snd_rawmidi_info_get_name(const snd_rawmidi_info_t *obj);
+const char *snd_rawmidi_info_get_subdevice_name(const snd_rawmidi_info_t *obj);
+unsigned int snd_rawmidi_info_get_subdevices_count(const snd_rawmidi_info_t *obj);
+unsigned int snd_rawmidi_info_get_subdevices_avail(const snd_rawmidi_info_t *obj);
+void snd_rawmidi_info_set_device(snd_rawmidi_info_t *obj, unsigned int val);
+void snd_rawmidi_info_set_subdevice(snd_rawmidi_info_t *obj, unsigned int val);
+void snd_rawmidi_info_set_stream(snd_rawmidi_info_t *obj, snd_rawmidi_stream_t val);
+int snd_rawmidi_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info);
+size_t snd_rawmidi_params_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_rawmidi_params_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_rawmidi_params_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_params)
+int snd_rawmidi_params_malloc(snd_rawmidi_params_t **ptr);
+void snd_rawmidi_params_free(snd_rawmidi_params_t *obj);
+void snd_rawmidi_params_copy(snd_rawmidi_params_t *dst, const snd_rawmidi_params_t *src);
+int snd_rawmidi_params_set_buffer_size(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val);
+size_t snd_rawmidi_params_get_buffer_size(const snd_rawmidi_params_t *params);
+int snd_rawmidi_params_set_avail_min(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val);
+size_t snd_rawmidi_params_get_avail_min(const snd_rawmidi_params_t *params);
+int snd_rawmidi_params_set_no_active_sensing(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, int val);
+int snd_rawmidi_params_get_no_active_sensing(const snd_rawmidi_params_t *params);
+int snd_rawmidi_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * params);
+int snd_rawmidi_params_current(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params);
+size_t snd_rawmidi_status_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_rawmidi_status_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_rawmidi_status_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_status)
+int snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr);
+void snd_rawmidi_status_free(snd_rawmidi_status_t *obj);
+void snd_rawmidi_status_copy(snd_rawmidi_status_t *dst, const snd_rawmidi_status_t *src);
+void snd_rawmidi_status_get_tstamp(const snd_rawmidi_status_t *obj, snd_htimestamp_t *ptr);
+size_t snd_rawmidi_status_get_avail(const snd_rawmidi_status_t *obj);
+size_t snd_rawmidi_status_get_xruns(const snd_rawmidi_status_t *obj);
+int snd_rawmidi_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * status);
+int snd_rawmidi_drain(snd_rawmidi_t *rmidi);
+int snd_rawmidi_drop(snd_rawmidi_t *rmidi);
+ssize_t snd_rawmidi_write(snd_rawmidi_t *rmidi, const void *buffer, size_t size);
+ssize_t snd_rawmidi_read(snd_rawmidi_t *rmidi, void *buffer, size_t size);
+const char *snd_rawmidi_name(snd_rawmidi_t *rmidi);
+snd_rawmidi_type_t snd_rawmidi_type(snd_rawmidi_t *rmidi);
+snd_rawmidi_stream_t snd_rawmidi_stream(snd_rawmidi_t *rawmidi);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __RAWMIDI_H */
+
diff --git a/thirdparty/linuxbsd_headers/alsa/seq.h b/thirdparty/linuxbsd_headers/alsa/seq.h
new file mode 100644
index 0000000000..d05940e859
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/seq.h
@@ -0,0 +1,739 @@
+/**
+ * \file include/seq.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ */
+/*
+ * Application interface library for the ALSA driver
+ *
+ *
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_SEQ_H
+#define __ALSA_SEQ_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Sequencer MIDI Sequencer
+ * MIDI Sequencer Interface.
+ * See \ref seq page for more details.
+ * \{
+ */
+
+/** dlsym version for interface entry callback */
+#define SND_SEQ_DLSYM_VERSION _dlsym_seq_001
+
+/** Sequencer handle */
+typedef struct _snd_seq snd_seq_t;
+
+/**
+ * sequencer opening stream types
+ */
+#define SND_SEQ_OPEN_OUTPUT 1 /**< open for output (write) */
+#define SND_SEQ_OPEN_INPUT 2 /**< open for input (read) */
+#define SND_SEQ_OPEN_DUPLEX (SND_SEQ_OPEN_OUTPUT|SND_SEQ_OPEN_INPUT) /**< open for both input and output (read/write) */
+
+/**
+ * sequencer opening mode
+ */
+#define SND_SEQ_NONBLOCK 0x0001 /**< non-blocking mode (flag to open mode) */
+
+/** sequencer handle type */
+typedef enum _snd_seq_type {
+ SND_SEQ_TYPE_HW, /**< hardware */
+ SND_SEQ_TYPE_SHM, /**< shared memory (NYI) */
+ SND_SEQ_TYPE_INET /**< network (NYI) */
+} snd_seq_type_t;
+
+/** special client (port) ids */
+#define SND_SEQ_ADDRESS_UNKNOWN 253 /**< unknown source */
+#define SND_SEQ_ADDRESS_SUBSCRIBERS 254 /**< send event to all subscribed ports */
+#define SND_SEQ_ADDRESS_BROADCAST 255 /**< send event to all queues/clients/ports/channels */
+
+/** known client numbers */
+#define SND_SEQ_CLIENT_SYSTEM 0 /**< system client */
+
+/*
+ */
+int snd_seq_open(snd_seq_t **handle, const char *name, int streams, int mode);
+int snd_seq_open_lconf(snd_seq_t **handle, const char *name, int streams, int mode, snd_config_t *lconf);
+const char *snd_seq_name(snd_seq_t *seq);
+snd_seq_type_t snd_seq_type(snd_seq_t *seq);
+int snd_seq_close(snd_seq_t *handle);
+int snd_seq_poll_descriptors_count(snd_seq_t *handle, short events);
+int snd_seq_poll_descriptors(snd_seq_t *handle, struct pollfd *pfds, unsigned int space, short events);
+int snd_seq_poll_descriptors_revents(snd_seq_t *seq, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+int snd_seq_nonblock(snd_seq_t *handle, int nonblock);
+int snd_seq_client_id(snd_seq_t *handle);
+
+size_t snd_seq_get_output_buffer_size(snd_seq_t *handle);
+size_t snd_seq_get_input_buffer_size(snd_seq_t *handle);
+int snd_seq_set_output_buffer_size(snd_seq_t *handle, size_t size);
+int snd_seq_set_input_buffer_size(snd_seq_t *handle, size_t size);
+
+/** system information container */
+typedef struct _snd_seq_system_info snd_seq_system_info_t;
+
+size_t snd_seq_system_info_sizeof(void);
+/** allocate a #snd_seq_system_info_t container on stack */
+#define snd_seq_system_info_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_system_info)
+int snd_seq_system_info_malloc(snd_seq_system_info_t **ptr);
+void snd_seq_system_info_free(snd_seq_system_info_t *ptr);
+void snd_seq_system_info_copy(snd_seq_system_info_t *dst, const snd_seq_system_info_t *src);
+
+int snd_seq_system_info_get_queues(const snd_seq_system_info_t *info);
+int snd_seq_system_info_get_clients(const snd_seq_system_info_t *info);
+int snd_seq_system_info_get_ports(const snd_seq_system_info_t *info);
+int snd_seq_system_info_get_channels(const snd_seq_system_info_t *info);
+int snd_seq_system_info_get_cur_clients(const snd_seq_system_info_t *info);
+int snd_seq_system_info_get_cur_queues(const snd_seq_system_info_t *info);
+
+int snd_seq_system_info(snd_seq_t *handle, snd_seq_system_info_t *info);
+
+/** \} */
+
+
+/**
+ * \defgroup SeqClient Sequencer Client Interface
+ * Sequencer Client Interface
+ * \ingroup Sequencer
+ * \{
+ */
+
+/** client information container */
+typedef struct _snd_seq_client_info snd_seq_client_info_t;
+
+/** client types */
+typedef enum snd_seq_client_type {
+ SND_SEQ_USER_CLIENT = 1, /**< user client */
+ SND_SEQ_KERNEL_CLIENT = 2 /**< kernel client */
+} snd_seq_client_type_t;
+
+size_t snd_seq_client_info_sizeof(void);
+/** allocate a #snd_seq_client_info_t container on stack */
+#define snd_seq_client_info_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_client_info)
+int snd_seq_client_info_malloc(snd_seq_client_info_t **ptr);
+void snd_seq_client_info_free(snd_seq_client_info_t *ptr);
+void snd_seq_client_info_copy(snd_seq_client_info_t *dst, const snd_seq_client_info_t *src);
+
+int snd_seq_client_info_get_client(const snd_seq_client_info_t *info);
+snd_seq_client_type_t snd_seq_client_info_get_type(const snd_seq_client_info_t *info);
+const char *snd_seq_client_info_get_name(snd_seq_client_info_t *info);
+int snd_seq_client_info_get_broadcast_filter(const snd_seq_client_info_t *info);
+int snd_seq_client_info_get_error_bounce(const snd_seq_client_info_t *info);
+int snd_seq_client_info_get_card(const snd_seq_client_info_t *info);
+int snd_seq_client_info_get_pid(const snd_seq_client_info_t *info);
+const unsigned char *snd_seq_client_info_get_event_filter(const snd_seq_client_info_t *info);
+int snd_seq_client_info_get_num_ports(const snd_seq_client_info_t *info);
+int snd_seq_client_info_get_event_lost(const snd_seq_client_info_t *info);
+
+void snd_seq_client_info_set_client(snd_seq_client_info_t *info, int client);
+void snd_seq_client_info_set_name(snd_seq_client_info_t *info, const char *name);
+void snd_seq_client_info_set_broadcast_filter(snd_seq_client_info_t *info, int val);
+void snd_seq_client_info_set_error_bounce(snd_seq_client_info_t *info, int val);
+void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsigned char *filter);
+
+void snd_seq_client_info_event_filter_clear(snd_seq_client_info_t *info);
+void snd_seq_client_info_event_filter_add(snd_seq_client_info_t *info, int event_type);
+void snd_seq_client_info_event_filter_del(snd_seq_client_info_t *info, int event_type);
+int snd_seq_client_info_event_filter_check(snd_seq_client_info_t *info, int event_type);
+
+int snd_seq_get_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
+int snd_seq_get_any_client_info(snd_seq_t *handle, int client, snd_seq_client_info_t *info);
+int snd_seq_set_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
+int snd_seq_query_next_client(snd_seq_t *handle, snd_seq_client_info_t *info);
+
+/*
+ */
+
+/** client pool information container */
+typedef struct _snd_seq_client_pool snd_seq_client_pool_t;
+
+size_t snd_seq_client_pool_sizeof(void);
+/** allocate a #snd_seq_client_pool_t container on stack */
+#define snd_seq_client_pool_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_client_pool)
+int snd_seq_client_pool_malloc(snd_seq_client_pool_t **ptr);
+void snd_seq_client_pool_free(snd_seq_client_pool_t *ptr);
+void snd_seq_client_pool_copy(snd_seq_client_pool_t *dst, const snd_seq_client_pool_t *src);
+
+int snd_seq_client_pool_get_client(const snd_seq_client_pool_t *info);
+size_t snd_seq_client_pool_get_output_pool(const snd_seq_client_pool_t *info);
+size_t snd_seq_client_pool_get_input_pool(const snd_seq_client_pool_t *info);
+size_t snd_seq_client_pool_get_output_room(const snd_seq_client_pool_t *info);
+size_t snd_seq_client_pool_get_output_free(const snd_seq_client_pool_t *info);
+size_t snd_seq_client_pool_get_input_free(const snd_seq_client_pool_t *info);
+void snd_seq_client_pool_set_output_pool(snd_seq_client_pool_t *info, size_t size);
+void snd_seq_client_pool_set_input_pool(snd_seq_client_pool_t *info, size_t size);
+void snd_seq_client_pool_set_output_room(snd_seq_client_pool_t *info, size_t size);
+
+int snd_seq_get_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);
+int snd_seq_set_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);
+
+
+/** \} */
+
+
+/**
+ * \defgroup SeqPort Sequencer Port Interface
+ * Sequencer Port Interface
+ * \ingroup Sequencer
+ * \{
+ */
+
+/** port information container */
+typedef struct _snd_seq_port_info snd_seq_port_info_t;
+
+/** known port numbers */
+#define SND_SEQ_PORT_SYSTEM_TIMER 0 /**< system timer port */
+#define SND_SEQ_PORT_SYSTEM_ANNOUNCE 1 /**< system announce port */
+
+/** port capabilities (32 bits) */
+#define SND_SEQ_PORT_CAP_READ (1<<0) /**< readable from this port */
+#define SND_SEQ_PORT_CAP_WRITE (1<<1) /**< writable to this port */
+
+#define SND_SEQ_PORT_CAP_SYNC_READ (1<<2) /**< allow read subscriptions */
+#define SND_SEQ_PORT_CAP_SYNC_WRITE (1<<3) /**< allow write subscriptions */
+
+#define SND_SEQ_PORT_CAP_DUPLEX (1<<4) /**< allow read/write duplex */
+
+#define SND_SEQ_PORT_CAP_SUBS_READ (1<<5) /**< allow read subscription */
+#define SND_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /**< allow write subscription */
+#define SND_SEQ_PORT_CAP_NO_EXPORT (1<<7) /**< routing not allowed */
+
+/* port type */
+/** Messages sent from/to this port have device-specific semantics. */
+#define SND_SEQ_PORT_TYPE_SPECIFIC (1<<0)
+/** This port understands MIDI messages. */
+#define SND_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1)
+/** This port is compatible with the General MIDI specification. */
+#define SND_SEQ_PORT_TYPE_MIDI_GM (1<<2)
+/** This port is compatible with the Roland GS standard. */
+#define SND_SEQ_PORT_TYPE_MIDI_GS (1<<3)
+/** This port is compatible with the Yamaha XG specification. */
+#define SND_SEQ_PORT_TYPE_MIDI_XG (1<<4)
+/** This port is compatible with the Roland MT-32. */
+#define SND_SEQ_PORT_TYPE_MIDI_MT32 (1<<5)
+/** This port is compatible with the General MIDI 2 specification. */
+#define SND_SEQ_PORT_TYPE_MIDI_GM2 (1<<6)
+/** This port understands SND_SEQ_EVENT_SAMPLE_xxx messages
+ (these are not MIDI messages). */
+#define SND_SEQ_PORT_TYPE_SYNTH (1<<10)
+/** Instruments can be downloaded to this port
+ (with SND_SEQ_EVENT_INSTR_xxx messages sent directly). */
+#define SND_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11)
+/** Instruments can be downloaded to this port
+ (with SND_SEQ_EVENT_INSTR_xxx messages sent directly or through a queue). */
+#define SND_SEQ_PORT_TYPE_SAMPLE (1<<12)
+/** This port is implemented in hardware. */
+#define SND_SEQ_PORT_TYPE_HARDWARE (1<<16)
+/** This port is implemented in software. */
+#define SND_SEQ_PORT_TYPE_SOFTWARE (1<<17)
+/** Messages sent to this port will generate sounds. */
+#define SND_SEQ_PORT_TYPE_SYNTHESIZER (1<<18)
+/** This port may connect to other devices
+ (whose characteristics are not known). */
+#define SND_SEQ_PORT_TYPE_PORT (1<<19)
+/** This port belongs to an application, such as a sequencer or editor. */
+#define SND_SEQ_PORT_TYPE_APPLICATION (1<<20)
+
+
+size_t snd_seq_port_info_sizeof(void);
+/** allocate a #snd_seq_port_info_t container on stack */
+#define snd_seq_port_info_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_port_info)
+int snd_seq_port_info_malloc(snd_seq_port_info_t **ptr);
+void snd_seq_port_info_free(snd_seq_port_info_t *ptr);
+void snd_seq_port_info_copy(snd_seq_port_info_t *dst, const snd_seq_port_info_t *src);
+
+int snd_seq_port_info_get_client(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_port(const snd_seq_port_info_t *info);
+const snd_seq_addr_t *snd_seq_port_info_get_addr(const snd_seq_port_info_t *info);
+const char *snd_seq_port_info_get_name(const snd_seq_port_info_t *info);
+unsigned int snd_seq_port_info_get_capability(const snd_seq_port_info_t *info);
+unsigned int snd_seq_port_info_get_type(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_midi_channels(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_midi_voices(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_synth_voices(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_read_use(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_write_use(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_port_specified(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_timestamping(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_timestamp_real(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_timestamp_queue(const snd_seq_port_info_t *info);
+
+void snd_seq_port_info_set_client(snd_seq_port_info_t *info, int client);
+void snd_seq_port_info_set_port(snd_seq_port_info_t *info, int port);
+void snd_seq_port_info_set_addr(snd_seq_port_info_t *info, const snd_seq_addr_t *addr);
+void snd_seq_port_info_set_name(snd_seq_port_info_t *info, const char *name);
+void snd_seq_port_info_set_capability(snd_seq_port_info_t *info, unsigned int capability);
+void snd_seq_port_info_set_type(snd_seq_port_info_t *info, unsigned int type);
+void snd_seq_port_info_set_midi_channels(snd_seq_port_info_t *info, int channels);
+void snd_seq_port_info_set_midi_voices(snd_seq_port_info_t *info, int voices);
+void snd_seq_port_info_set_synth_voices(snd_seq_port_info_t *info, int voices);
+void snd_seq_port_info_set_port_specified(snd_seq_port_info_t *info, int val);
+void snd_seq_port_info_set_timestamping(snd_seq_port_info_t *info, int enable);
+void snd_seq_port_info_set_timestamp_real(snd_seq_port_info_t *info, int realtime);
+void snd_seq_port_info_set_timestamp_queue(snd_seq_port_info_t *info, int queue);
+
+int snd_seq_create_port(snd_seq_t *handle, snd_seq_port_info_t *info);
+int snd_seq_delete_port(snd_seq_t *handle, int port);
+int snd_seq_get_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);
+int snd_seq_get_any_port_info(snd_seq_t *handle, int client, int port, snd_seq_port_info_t *info);
+int snd_seq_set_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);
+int snd_seq_query_next_port(snd_seq_t *handle, snd_seq_port_info_t *info);
+
+/** \} */
+
+
+/**
+ * \defgroup SeqSubscribe Sequencer Port Subscription
+ * Sequencer Port Subscription
+ * \ingroup Sequencer
+ * \{
+ */
+
+/** port subscription container */
+typedef struct _snd_seq_port_subscribe snd_seq_port_subscribe_t;
+
+size_t snd_seq_port_subscribe_sizeof(void);
+/** allocate a #snd_seq_port_subscribe_t container on stack */
+#define snd_seq_port_subscribe_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_port_subscribe)
+int snd_seq_port_subscribe_malloc(snd_seq_port_subscribe_t **ptr);
+void snd_seq_port_subscribe_free(snd_seq_port_subscribe_t *ptr);
+void snd_seq_port_subscribe_copy(snd_seq_port_subscribe_t *dst, const snd_seq_port_subscribe_t *src);
+
+const snd_seq_addr_t *snd_seq_port_subscribe_get_sender(const snd_seq_port_subscribe_t *info);
+const snd_seq_addr_t *snd_seq_port_subscribe_get_dest(const snd_seq_port_subscribe_t *info);
+int snd_seq_port_subscribe_get_queue(const snd_seq_port_subscribe_t *info);
+int snd_seq_port_subscribe_get_exclusive(const snd_seq_port_subscribe_t *info);
+int snd_seq_port_subscribe_get_time_update(const snd_seq_port_subscribe_t *info);
+int snd_seq_port_subscribe_get_time_real(const snd_seq_port_subscribe_t *info);
+
+void snd_seq_port_subscribe_set_sender(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr);
+void snd_seq_port_subscribe_set_dest(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr);
+void snd_seq_port_subscribe_set_queue(snd_seq_port_subscribe_t *info, int q);
+void snd_seq_port_subscribe_set_exclusive(snd_seq_port_subscribe_t *info, int val);
+void snd_seq_port_subscribe_set_time_update(snd_seq_port_subscribe_t *info, int val);
+void snd_seq_port_subscribe_set_time_real(snd_seq_port_subscribe_t *info, int val);
+
+int snd_seq_get_port_subscription(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
+int snd_seq_subscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
+int snd_seq_unsubscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
+
+/*
+ */
+
+/** subscription query container */
+typedef struct _snd_seq_query_subscribe snd_seq_query_subscribe_t;
+
+/** type of query subscription */
+typedef enum {
+ SND_SEQ_QUERY_SUBS_READ, /**< query read subscriptions */
+ SND_SEQ_QUERY_SUBS_WRITE /**< query write subscriptions */
+} snd_seq_query_subs_type_t;
+
+size_t snd_seq_query_subscribe_sizeof(void);
+/** allocate a #snd_seq_query_subscribe_t container on stack */
+#define snd_seq_query_subscribe_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_query_subscribe)
+int snd_seq_query_subscribe_malloc(snd_seq_query_subscribe_t **ptr);
+void snd_seq_query_subscribe_free(snd_seq_query_subscribe_t *ptr);
+void snd_seq_query_subscribe_copy(snd_seq_query_subscribe_t *dst, const snd_seq_query_subscribe_t *src);
+
+int snd_seq_query_subscribe_get_client(const snd_seq_query_subscribe_t *info);
+int snd_seq_query_subscribe_get_port(const snd_seq_query_subscribe_t *info);
+const snd_seq_addr_t *snd_seq_query_subscribe_get_root(const snd_seq_query_subscribe_t *info);
+snd_seq_query_subs_type_t snd_seq_query_subscribe_get_type(const snd_seq_query_subscribe_t *info);
+int snd_seq_query_subscribe_get_index(const snd_seq_query_subscribe_t *info);
+int snd_seq_query_subscribe_get_num_subs(const snd_seq_query_subscribe_t *info);
+const snd_seq_addr_t *snd_seq_query_subscribe_get_addr(const snd_seq_query_subscribe_t *info);
+int snd_seq_query_subscribe_get_queue(const snd_seq_query_subscribe_t *info);
+int snd_seq_query_subscribe_get_exclusive(const snd_seq_query_subscribe_t *info);
+int snd_seq_query_subscribe_get_time_update(const snd_seq_query_subscribe_t *info);
+int snd_seq_query_subscribe_get_time_real(const snd_seq_query_subscribe_t *info);
+
+void snd_seq_query_subscribe_set_client(snd_seq_query_subscribe_t *info, int client);
+void snd_seq_query_subscribe_set_port(snd_seq_query_subscribe_t *info, int port);
+void snd_seq_query_subscribe_set_root(snd_seq_query_subscribe_t *info, const snd_seq_addr_t *addr);
+void snd_seq_query_subscribe_set_type(snd_seq_query_subscribe_t *info, snd_seq_query_subs_type_t type);
+void snd_seq_query_subscribe_set_index(snd_seq_query_subscribe_t *info, int _index);
+
+int snd_seq_query_port_subscribers(snd_seq_t *seq, snd_seq_query_subscribe_t * subs);
+
+/** \} */
+
+
+/**
+ * \defgroup SeqQueue Sequencer Queue Interface
+ * Sequencer Queue Interface
+ * \ingroup Sequencer
+ * \{
+ */
+
+/** queue information container */
+typedef struct _snd_seq_queue_info snd_seq_queue_info_t;
+/** queue status container */
+typedef struct _snd_seq_queue_status snd_seq_queue_status_t;
+/** queue tempo container */
+typedef struct _snd_seq_queue_tempo snd_seq_queue_tempo_t;
+/** queue timer information container */
+typedef struct _snd_seq_queue_timer snd_seq_queue_timer_t;
+
+/** special queue ids */
+#define SND_SEQ_QUEUE_DIRECT 253 /**< direct dispatch */
+
+size_t snd_seq_queue_info_sizeof(void);
+/** allocate a #snd_seq_queue_info_t container on stack */
+#define snd_seq_queue_info_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_queue_info)
+int snd_seq_queue_info_malloc(snd_seq_queue_info_t **ptr);
+void snd_seq_queue_info_free(snd_seq_queue_info_t *ptr);
+void snd_seq_queue_info_copy(snd_seq_queue_info_t *dst, const snd_seq_queue_info_t *src);
+
+int snd_seq_queue_info_get_queue(const snd_seq_queue_info_t *info);
+const char *snd_seq_queue_info_get_name(const snd_seq_queue_info_t *info);
+int snd_seq_queue_info_get_owner(const snd_seq_queue_info_t *info);
+int snd_seq_queue_info_get_locked(const snd_seq_queue_info_t *info);
+unsigned int snd_seq_queue_info_get_flags(const snd_seq_queue_info_t *info);
+
+void snd_seq_queue_info_set_name(snd_seq_queue_info_t *info, const char *name);
+void snd_seq_queue_info_set_owner(snd_seq_queue_info_t *info, int owner);
+void snd_seq_queue_info_set_locked(snd_seq_queue_info_t *info, int locked);
+void snd_seq_queue_info_set_flags(snd_seq_queue_info_t *info, unsigned int flags);
+
+int snd_seq_create_queue(snd_seq_t *seq, snd_seq_queue_info_t *info);
+int snd_seq_alloc_named_queue(snd_seq_t *seq, const char *name);
+int snd_seq_alloc_queue(snd_seq_t *handle);
+int snd_seq_free_queue(snd_seq_t *handle, int q);
+int snd_seq_get_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info);
+int snd_seq_set_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info);
+int snd_seq_query_named_queue(snd_seq_t *seq, const char *name);
+
+int snd_seq_get_queue_usage(snd_seq_t *handle, int q);
+int snd_seq_set_queue_usage(snd_seq_t *handle, int q, int used);
+
+/*
+ */
+size_t snd_seq_queue_status_sizeof(void);
+/** allocate a #snd_seq_queue_status_t container on stack */
+#define snd_seq_queue_status_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_queue_status)
+int snd_seq_queue_status_malloc(snd_seq_queue_status_t **ptr);
+void snd_seq_queue_status_free(snd_seq_queue_status_t *ptr);
+void snd_seq_queue_status_copy(snd_seq_queue_status_t *dst, const snd_seq_queue_status_t *src);
+
+int snd_seq_queue_status_get_queue(const snd_seq_queue_status_t *info);
+int snd_seq_queue_status_get_events(const snd_seq_queue_status_t *info);
+snd_seq_tick_time_t snd_seq_queue_status_get_tick_time(const snd_seq_queue_status_t *info);
+const snd_seq_real_time_t *snd_seq_queue_status_get_real_time(const snd_seq_queue_status_t *info);
+unsigned int snd_seq_queue_status_get_status(const snd_seq_queue_status_t *info);
+
+int snd_seq_get_queue_status(snd_seq_t *handle, int q, snd_seq_queue_status_t *status);
+
+/*
+ */
+size_t snd_seq_queue_tempo_sizeof(void);
+/** allocate a #snd_seq_queue_tempo_t container on stack */
+#define snd_seq_queue_tempo_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_queue_tempo)
+int snd_seq_queue_tempo_malloc(snd_seq_queue_tempo_t **ptr);
+void snd_seq_queue_tempo_free(snd_seq_queue_tempo_t *ptr);
+void snd_seq_queue_tempo_copy(snd_seq_queue_tempo_t *dst, const snd_seq_queue_tempo_t *src);
+
+int snd_seq_queue_tempo_get_queue(const snd_seq_queue_tempo_t *info);
+unsigned int snd_seq_queue_tempo_get_tempo(const snd_seq_queue_tempo_t *info);
+int snd_seq_queue_tempo_get_ppq(const snd_seq_queue_tempo_t *info);
+unsigned int snd_seq_queue_tempo_get_skew(const snd_seq_queue_tempo_t *info);
+unsigned int snd_seq_queue_tempo_get_skew_base(const snd_seq_queue_tempo_t *info);
+void snd_seq_queue_tempo_set_tempo(snd_seq_queue_tempo_t *info, unsigned int tempo);
+void snd_seq_queue_tempo_set_ppq(snd_seq_queue_tempo_t *info, int ppq);
+void snd_seq_queue_tempo_set_skew(snd_seq_queue_tempo_t *info, unsigned int skew);
+void snd_seq_queue_tempo_set_skew_base(snd_seq_queue_tempo_t *info, unsigned int base);
+
+int snd_seq_get_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
+int snd_seq_set_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
+
+/*
+ */
+
+/** sequencer timer sources */
+typedef enum {
+ SND_SEQ_TIMER_ALSA = 0, /* ALSA timer */
+ SND_SEQ_TIMER_MIDI_CLOCK = 1, /* Midi Clock (CLOCK event) */
+ SND_SEQ_TIMER_MIDI_TICK = 2 /* Midi Timer Tick (TICK event */
+} snd_seq_queue_timer_type_t;
+
+size_t snd_seq_queue_timer_sizeof(void);
+/** allocate a #snd_seq_queue_timer_t container on stack */
+#define snd_seq_queue_timer_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_queue_timer)
+int snd_seq_queue_timer_malloc(snd_seq_queue_timer_t **ptr);
+void snd_seq_queue_timer_free(snd_seq_queue_timer_t *ptr);
+void snd_seq_queue_timer_copy(snd_seq_queue_timer_t *dst, const snd_seq_queue_timer_t *src);
+
+int snd_seq_queue_timer_get_queue(const snd_seq_queue_timer_t *info);
+snd_seq_queue_timer_type_t snd_seq_queue_timer_get_type(const snd_seq_queue_timer_t *info);
+const snd_timer_id_t *snd_seq_queue_timer_get_id(const snd_seq_queue_timer_t *info);
+unsigned int snd_seq_queue_timer_get_resolution(const snd_seq_queue_timer_t *info);
+
+void snd_seq_queue_timer_set_type(snd_seq_queue_timer_t *info, snd_seq_queue_timer_type_t type);
+void snd_seq_queue_timer_set_id(snd_seq_queue_timer_t *info, const snd_timer_id_t *id);
+void snd_seq_queue_timer_set_resolution(snd_seq_queue_timer_t *info, unsigned int resolution);
+
+int snd_seq_get_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);
+int snd_seq_set_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);
+
+/** \} */
+
+/**
+ * \defgroup SeqEvent Sequencer Event API
+ * Sequencer Event API
+ * \ingroup Sequencer
+ * \{
+ */
+
+int snd_seq_free_event(snd_seq_event_t *ev);
+ssize_t snd_seq_event_length(snd_seq_event_t *ev);
+int snd_seq_event_output(snd_seq_t *handle, snd_seq_event_t *ev);
+int snd_seq_event_output_buffer(snd_seq_t *handle, snd_seq_event_t *ev);
+int snd_seq_event_output_direct(snd_seq_t *handle, snd_seq_event_t *ev);
+int snd_seq_event_input(snd_seq_t *handle, snd_seq_event_t **ev);
+int snd_seq_event_input_pending(snd_seq_t *seq, int fetch_sequencer);
+int snd_seq_drain_output(snd_seq_t *handle);
+int snd_seq_event_output_pending(snd_seq_t *seq);
+int snd_seq_extract_output(snd_seq_t *handle, snd_seq_event_t **ev);
+int snd_seq_drop_output(snd_seq_t *handle);
+int snd_seq_drop_output_buffer(snd_seq_t *handle);
+int snd_seq_drop_input(snd_seq_t *handle);
+int snd_seq_drop_input_buffer(snd_seq_t *handle);
+
+/** event removal conditionals */
+typedef struct _snd_seq_remove_events snd_seq_remove_events_t;
+
+/** Remove conditional flags */
+#define SND_SEQ_REMOVE_INPUT (1<<0) /**< Flush input queues */
+#define SND_SEQ_REMOVE_OUTPUT (1<<1) /**< Flush output queues */
+#define SND_SEQ_REMOVE_DEST (1<<2) /**< Restrict by destination q:client:port */
+#define SND_SEQ_REMOVE_DEST_CHANNEL (1<<3) /**< Restrict by channel */
+#define SND_SEQ_REMOVE_TIME_BEFORE (1<<4) /**< Restrict to before time */
+#define SND_SEQ_REMOVE_TIME_AFTER (1<<5) /**< Restrict to time or after */
+#define SND_SEQ_REMOVE_TIME_TICK (1<<6) /**< Time is in ticks */
+#define SND_SEQ_REMOVE_EVENT_TYPE (1<<7) /**< Restrict to event type */
+#define SND_SEQ_REMOVE_IGNORE_OFF (1<<8) /**< Do not flush off events */
+#define SND_SEQ_REMOVE_TAG_MATCH (1<<9) /**< Restrict to events with given tag */
+
+size_t snd_seq_remove_events_sizeof(void);
+/** allocate a #snd_seq_remove_events_t container on stack */
+#define snd_seq_remove_events_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_remove_events)
+int snd_seq_remove_events_malloc(snd_seq_remove_events_t **ptr);
+void snd_seq_remove_events_free(snd_seq_remove_events_t *ptr);
+void snd_seq_remove_events_copy(snd_seq_remove_events_t *dst, const snd_seq_remove_events_t *src);
+
+unsigned int snd_seq_remove_events_get_condition(const snd_seq_remove_events_t *info);
+int snd_seq_remove_events_get_queue(const snd_seq_remove_events_t *info);
+const snd_seq_timestamp_t *snd_seq_remove_events_get_time(const snd_seq_remove_events_t *info);
+const snd_seq_addr_t *snd_seq_remove_events_get_dest(const snd_seq_remove_events_t *info);
+int snd_seq_remove_events_get_channel(const snd_seq_remove_events_t *info);
+int snd_seq_remove_events_get_event_type(const snd_seq_remove_events_t *info);
+int snd_seq_remove_events_get_tag(const snd_seq_remove_events_t *info);
+
+void snd_seq_remove_events_set_condition(snd_seq_remove_events_t *info, unsigned int flags);
+void snd_seq_remove_events_set_queue(snd_seq_remove_events_t *info, int queue);
+void snd_seq_remove_events_set_time(snd_seq_remove_events_t *info, const snd_seq_timestamp_t *time);
+void snd_seq_remove_events_set_dest(snd_seq_remove_events_t *info, const snd_seq_addr_t *addr);
+void snd_seq_remove_events_set_channel(snd_seq_remove_events_t *info, int channel);
+void snd_seq_remove_events_set_event_type(snd_seq_remove_events_t *info, int type);
+void snd_seq_remove_events_set_tag(snd_seq_remove_events_t *info, int tag);
+
+int snd_seq_remove_events(snd_seq_t *handle, snd_seq_remove_events_t *info);
+
+/** \} */
+
+/**
+ * \defgroup SeqMisc Sequencer Miscellaneous
+ * Sequencer Miscellaneous
+ * \ingroup Sequencer
+ * \{
+ */
+
+void snd_seq_set_bit(int nr, void *array);
+void snd_seq_unset_bit(int nr, void *array);
+int snd_seq_change_bit(int nr, void *array);
+int snd_seq_get_bit(int nr, void *array);
+
+/** \} */
+
+
+/**
+ * \defgroup SeqEvType Sequencer Event Type Checks
+ * Sequencer Event Type Checks
+ * \ingroup Sequencer
+ * \{
+ */
+
+/* event type macros */
+enum {
+ SND_SEQ_EVFLG_RESULT,
+ SND_SEQ_EVFLG_NOTE,
+ SND_SEQ_EVFLG_CONTROL,
+ SND_SEQ_EVFLG_QUEUE,
+ SND_SEQ_EVFLG_SYSTEM,
+ SND_SEQ_EVFLG_MESSAGE,
+ SND_SEQ_EVFLG_CONNECTION,
+ SND_SEQ_EVFLG_SAMPLE,
+ SND_SEQ_EVFLG_USERS,
+ SND_SEQ_EVFLG_INSTR,
+ SND_SEQ_EVFLG_QUOTE,
+ SND_SEQ_EVFLG_NONE,
+ SND_SEQ_EVFLG_RAW,
+ SND_SEQ_EVFLG_FIXED,
+ SND_SEQ_EVFLG_VARIABLE,
+ SND_SEQ_EVFLG_VARUSR
+};
+
+enum {
+ SND_SEQ_EVFLG_NOTE_ONEARG,
+ SND_SEQ_EVFLG_NOTE_TWOARG
+};
+
+enum {
+ SND_SEQ_EVFLG_QUEUE_NOARG,
+ SND_SEQ_EVFLG_QUEUE_TICK,
+ SND_SEQ_EVFLG_QUEUE_TIME,
+ SND_SEQ_EVFLG_QUEUE_VALUE
+};
+
+/**
+ * Exported event type table
+ *
+ * This table is referred by snd_seq_ev_is_xxx.
+ */
+extern const unsigned int snd_seq_event_types[];
+
+#define _SND_SEQ_TYPE(x) (1<<(x)) /**< master type - 24bit */
+#define _SND_SEQ_TYPE_OPT(x) ((x)<<24) /**< optional type - 8bit */
+
+/** check the event type */
+#define snd_seq_type_check(ev,x) (snd_seq_event_types[(ev)->type] & _SND_SEQ_TYPE(x))
+
+/** event type check: result events */
+#define snd_seq_ev_is_result_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_RESULT)
+/** event type check: note events */
+#define snd_seq_ev_is_note_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_NOTE)
+/** event type check: control events */
+#define snd_seq_ev_is_control_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_CONTROL)
+/** event type check: channel specific events */
+#define snd_seq_ev_is_channel_type(ev) \
+ (snd_seq_event_types[(ev)->type] & (_SND_SEQ_TYPE(SND_SEQ_EVFLG_NOTE) | _SND_SEQ_TYPE(SND_SEQ_EVFLG_CONTROL)))
+
+/** event type check: queue control events */
+#define snd_seq_ev_is_queue_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_QUEUE)
+/** event type check: system status messages */
+#define snd_seq_ev_is_message_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_MESSAGE)
+/** event type check: system status messages */
+#define snd_seq_ev_is_subscribe_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_CONNECTION)
+/** event type check: sample messages */
+#define snd_seq_ev_is_sample_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_SAMPLE)
+/** event type check: user-defined messages */
+#define snd_seq_ev_is_user_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_USERS)
+/** event type check: instrument layer events */
+#define snd_seq_ev_is_instr_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_INSTR)
+/** event type check: fixed length events */
+#define snd_seq_ev_is_fixed_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_FIXED)
+/** event type check: variable length events */
+#define snd_seq_ev_is_variable_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_VARIABLE)
+/** event type check: user pointer events */
+#define snd_seq_ev_is_varusr_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_VARUSR)
+/** event type check: reserved for kernel */
+#define snd_seq_ev_is_reserved(ev) \
+ (! snd_seq_event_types[(ev)->type])
+
+/**
+ * macros to check event flags
+ */
+/** prior events */
+#define snd_seq_ev_is_prior(ev) \
+ (((ev)->flags & SND_SEQ_PRIORITY_MASK) == SND_SEQ_PRIORITY_HIGH)
+
+/** get the data length type */
+#define snd_seq_ev_length_type(ev) \
+ ((ev)->flags & SND_SEQ_EVENT_LENGTH_MASK)
+/** fixed length events */
+#define snd_seq_ev_is_fixed(ev) \
+ (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_FIXED)
+/** variable length events */
+#define snd_seq_ev_is_variable(ev) \
+ (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARIABLE)
+/** variable length on user-space */
+#define snd_seq_ev_is_varusr(ev) \
+ (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARUSR)
+
+/** time-stamp type */
+#define snd_seq_ev_timestamp_type(ev) \
+ ((ev)->flags & SND_SEQ_TIME_STAMP_MASK)
+/** event is in tick time */
+#define snd_seq_ev_is_tick(ev) \
+ (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_TICK)
+/** event is in real-time */
+#define snd_seq_ev_is_real(ev) \
+ (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_REAL)
+
+/** time-mode type */
+#define snd_seq_ev_timemode_type(ev) \
+ ((ev)->flags & SND_SEQ_TIME_MODE_MASK)
+/** scheduled in absolute time */
+#define snd_seq_ev_is_abstime(ev) \
+ (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_ABS)
+/** scheduled in relative time */
+#define snd_seq_ev_is_reltime(ev) \
+ (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_REL)
+
+/** direct dispatched events */
+#define snd_seq_ev_is_direct(ev) \
+ ((ev)->queue == SND_SEQ_QUEUE_DIRECT)
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_SEQ_H */
+
diff --git a/thirdparty/linuxbsd_headers/alsa/seq_event.h b/thirdparty/linuxbsd_headers/alsa/seq_event.h
new file mode 100644
index 0000000000..6bd0de3b5b
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/seq_event.h
@@ -0,0 +1,325 @@
+/**
+ * \file include/seq_event.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_SEQ_EVENT_H
+#define __ALSA_SEQ_EVENT_H
+
+/**
+ * \defgroup SeqEvents Sequencer Event Definitions
+ * Sequencer Event Definitions
+ * \ingroup Sequencer
+ * \{
+ */
+
+/**
+ * Sequencer event data type
+ */
+typedef unsigned char snd_seq_event_type_t;
+
+/** Sequencer event type */
+enum snd_seq_event_type {
+ /** system status; event data type = #snd_seq_result_t */
+ SND_SEQ_EVENT_SYSTEM = 0,
+ /** returned result status; event data type = #snd_seq_result_t */
+ SND_SEQ_EVENT_RESULT,
+
+ /** note on and off with duration; event data type = #snd_seq_ev_note_t */
+ SND_SEQ_EVENT_NOTE = 5,
+ /** note on; event data type = #snd_seq_ev_note_t */
+ SND_SEQ_EVENT_NOTEON,
+ /** note off; event data type = #snd_seq_ev_note_t */
+ SND_SEQ_EVENT_NOTEOFF,
+ /** key pressure change (aftertouch); event data type = #snd_seq_ev_note_t */
+ SND_SEQ_EVENT_KEYPRESS,
+
+ /** controller; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_CONTROLLER = 10,
+ /** program change; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_PGMCHANGE,
+ /** channel pressure; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_CHANPRESS,
+ /** pitchwheel; event data type = #snd_seq_ev_ctrl_t; data is from -8192 to 8191) */
+ SND_SEQ_EVENT_PITCHBEND,
+ /** 14 bit controller value; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_CONTROL14,
+ /** 14 bit NRPN; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_NONREGPARAM,
+ /** 14 bit RPN; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_REGPARAM,
+
+ /** SPP with LSB and MSB values; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_SONGPOS = 20,
+ /** Song Select with song ID number; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_SONGSEL,
+ /** midi time code quarter frame; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_QFRAME,
+ /** SMF Time Signature event; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_TIMESIGN,
+ /** SMF Key Signature event; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_KEYSIGN,
+
+ /** MIDI Real Time Start message; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_START = 30,
+ /** MIDI Real Time Continue message; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_CONTINUE,
+ /** MIDI Real Time Stop message; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_STOP,
+ /** Set tick queue position; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_SETPOS_TICK,
+ /** Set real-time queue position; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_SETPOS_TIME,
+ /** (SMF) Tempo event; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_TEMPO,
+ /** MIDI Real Time Clock message; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_CLOCK,
+ /** MIDI Real Time Tick message; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_TICK,
+ /** Queue timer skew; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_QUEUE_SKEW,
+ /** Sync position changed; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_SYNC_POS,
+
+ /** Tune request; event data type = none */
+ SND_SEQ_EVENT_TUNE_REQUEST = 40,
+ /** Reset to power-on state; event data type = none */
+ SND_SEQ_EVENT_RESET,
+ /** Active sensing event; event data type = none */
+ SND_SEQ_EVENT_SENSING,
+
+ /** Echo-back event; event data type = any type */
+ SND_SEQ_EVENT_ECHO = 50,
+ /** OSS emulation raw event; event data type = any type */
+ SND_SEQ_EVENT_OSS,
+
+ /** New client has connected; event data type = #snd_seq_addr_t */
+ SND_SEQ_EVENT_CLIENT_START = 60,
+ /** Client has left the system; event data type = #snd_seq_addr_t */
+ SND_SEQ_EVENT_CLIENT_EXIT,
+ /** Client status/info has changed; event data type = #snd_seq_addr_t */
+ SND_SEQ_EVENT_CLIENT_CHANGE,
+ /** New port was created; event data type = #snd_seq_addr_t */
+ SND_SEQ_EVENT_PORT_START,
+ /** Port was deleted from system; event data type = #snd_seq_addr_t */
+ SND_SEQ_EVENT_PORT_EXIT,
+ /** Port status/info has changed; event data type = #snd_seq_addr_t */
+ SND_SEQ_EVENT_PORT_CHANGE,
+
+ /** Ports connected; event data type = #snd_seq_connect_t */
+ SND_SEQ_EVENT_PORT_SUBSCRIBED,
+ /** Ports disconnected; event data type = #snd_seq_connect_t */
+ SND_SEQ_EVENT_PORT_UNSUBSCRIBED,
+
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR0 = 90,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR1,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR2,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR3,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR4,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR5,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR6,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR7,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR8,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR9,
+
+ /** system exclusive data (variable length); event data type = #snd_seq_ev_ext_t */
+ SND_SEQ_EVENT_SYSEX = 130,
+ /** error event; event data type = #snd_seq_ev_ext_t */
+ SND_SEQ_EVENT_BOUNCE,
+ /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
+ SND_SEQ_EVENT_USR_VAR0 = 135,
+ /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
+ SND_SEQ_EVENT_USR_VAR1,
+ /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
+ SND_SEQ_EVENT_USR_VAR2,
+ /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
+ SND_SEQ_EVENT_USR_VAR3,
+ /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
+ SND_SEQ_EVENT_USR_VAR4,
+
+ /** NOP; ignored in any case */
+ SND_SEQ_EVENT_NONE = 255
+};
+
+
+/** Sequencer event address */
+typedef struct snd_seq_addr {
+ unsigned char client; /**< Client id */
+ unsigned char port; /**< Port id */
+} snd_seq_addr_t;
+
+/** Connection (subscription) between ports */
+typedef struct snd_seq_connect {
+ snd_seq_addr_t sender; /**< sender address */
+ snd_seq_addr_t dest; /**< destination address */
+} snd_seq_connect_t;
+
+
+/** Real-time data record */
+typedef struct snd_seq_real_time {
+ unsigned int tv_sec; /**< seconds */
+ unsigned int tv_nsec; /**< nanoseconds */
+} snd_seq_real_time_t;
+
+/** (MIDI) Tick-time data record */
+typedef unsigned int snd_seq_tick_time_t;
+
+/** unioned time stamp */
+typedef union snd_seq_timestamp {
+ snd_seq_tick_time_t tick; /**< tick-time */
+ struct snd_seq_real_time time; /**< real-time */
+} snd_seq_timestamp_t;
+
+
+/**
+ * Event mode flags
+ *
+ * NOTE: only 8 bits available!
+ */
+#define SND_SEQ_TIME_STAMP_TICK (0<<0) /**< timestamp in clock ticks */
+#define SND_SEQ_TIME_STAMP_REAL (1<<0) /**< timestamp in real time */
+#define SND_SEQ_TIME_STAMP_MASK (1<<0) /**< mask for timestamp bits */
+
+#define SND_SEQ_TIME_MODE_ABS (0<<1) /**< absolute timestamp */
+#define SND_SEQ_TIME_MODE_REL (1<<1) /**< relative to current time */
+#define SND_SEQ_TIME_MODE_MASK (1<<1) /**< mask for time mode bits */
+
+#define SND_SEQ_EVENT_LENGTH_FIXED (0<<2) /**< fixed event size */
+#define SND_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /**< variable event size */
+#define SND_SEQ_EVENT_LENGTH_VARUSR (2<<2) /**< variable event size - user memory space */
+#define SND_SEQ_EVENT_LENGTH_MASK (3<<2) /**< mask for event length bits */
+
+#define SND_SEQ_PRIORITY_NORMAL (0<<4) /**< normal priority */
+#define SND_SEQ_PRIORITY_HIGH (1<<4) /**< event should be processed before others */
+#define SND_SEQ_PRIORITY_MASK (1<<4) /**< mask for priority bits */
+
+
+/** Note event */
+typedef struct snd_seq_ev_note {
+ unsigned char channel; /**< channel number */
+ unsigned char note; /**< note */
+ unsigned char velocity; /**< velocity */
+ unsigned char off_velocity; /**< note-off velocity; only for #SND_SEQ_EVENT_NOTE */
+ unsigned int duration; /**< duration until note-off; only for #SND_SEQ_EVENT_NOTE */
+} snd_seq_ev_note_t;
+
+/** Controller event */
+typedef struct snd_seq_ev_ctrl {
+ unsigned char channel; /**< channel number */
+ unsigned char unused[3]; /**< reserved */
+ unsigned int param; /**< control parameter */
+ signed int value; /**< control value */
+} snd_seq_ev_ctrl_t;
+
+/** generic set of bytes (12x8 bit) */
+typedef struct snd_seq_ev_raw8 {
+ unsigned char d[12]; /**< 8 bit value */
+} snd_seq_ev_raw8_t;
+
+/** generic set of integers (3x32 bit) */
+typedef struct snd_seq_ev_raw32 {
+ unsigned int d[3]; /**< 32 bit value */
+} snd_seq_ev_raw32_t;
+
+/** external stored data */
+struct snd_seq_ev_ext {
+ unsigned int len; /**< length of data */
+ void *ptr; /**< pointer to data (note: can be 64-bit) */
+} __attribute__((packed));
+/** external stored data */
+typedef struct snd_seq_ev_ext snd_seq_ev_ext_t;
+#ifdef DOC_HIDDEN
+/* redefine typedef for stupid doxygen */
+typedef snd_seq_ev_ext snd_seq_ev_ext_t;
+#endif
+
+/** Result events */
+typedef struct snd_seq_result {
+ int event; /**< processed event type */
+ int result; /**< status */
+} snd_seq_result_t;
+
+/** Queue skew values */
+typedef struct snd_seq_queue_skew {
+ unsigned int value; /**< skew value */
+ unsigned int base; /**< skew base */
+} snd_seq_queue_skew_t;
+
+/** queue timer control */
+typedef struct snd_seq_ev_queue_control {
+ unsigned char queue; /**< affected queue */
+ unsigned char unused[3]; /**< reserved */
+ union {
+ signed int value; /**< affected value (e.g. tempo) */
+ snd_seq_timestamp_t time; /**< time */
+ unsigned int position; /**< sync position */
+ snd_seq_queue_skew_t skew; /**< queue skew */
+ unsigned int d32[2]; /**< any data */
+ unsigned char d8[8]; /**< any data */
+ } param; /**< data value union */
+} snd_seq_ev_queue_control_t;
+
+
+/** Sequencer event */
+typedef struct snd_seq_event {
+ snd_seq_event_type_t type; /**< event type */
+ unsigned char flags; /**< event flags */
+ unsigned char tag; /**< tag */
+
+ unsigned char queue; /**< schedule queue */
+ snd_seq_timestamp_t time; /**< schedule time */
+
+ snd_seq_addr_t source; /**< source address */
+ snd_seq_addr_t dest; /**< destination address */
+
+ union {
+ snd_seq_ev_note_t note; /**< note information */
+ snd_seq_ev_ctrl_t control; /**< MIDI control information */
+ snd_seq_ev_raw8_t raw8; /**< raw8 data */
+ snd_seq_ev_raw32_t raw32; /**< raw32 data */
+ snd_seq_ev_ext_t ext; /**< external data */
+ snd_seq_ev_queue_control_t queue; /**< queue control */
+ snd_seq_timestamp_t time; /**< timestamp */
+ snd_seq_addr_t addr; /**< address */
+ snd_seq_connect_t connect; /**< connect information */
+ snd_seq_result_t result; /**< operation result code */
+ } data; /**< event data... */
+} snd_seq_event_t;
+
+
+/** \} */
+
+#endif /* __ALSA_SEQ_EVENT_H */
+
diff --git a/thirdparty/linuxbsd_headers/alsa/seq_midi_event.h b/thirdparty/linuxbsd_headers/alsa/seq_midi_event.h
new file mode 100644
index 0000000000..9b8ee5963b
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/seq_midi_event.h
@@ -0,0 +1,65 @@
+/**
+ * \file include/seq_midi_event.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_SEQ_MIDI_EVENT_H
+#define __ALSA_SEQ_MIDI_EVENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup MIDI_Event Sequencer event <-> MIDI byte stream coder
+ * \ingroup Sequencer
+ * Sequencer event <-> MIDI byte stream coder
+ * \{
+ */
+
+/** container for sequencer midi event parsers */
+typedef struct snd_midi_event snd_midi_event_t;
+
+int snd_midi_event_new(size_t bufsize, snd_midi_event_t **rdev);
+int snd_midi_event_resize_buffer(snd_midi_event_t *dev, size_t bufsize);
+void snd_midi_event_free(snd_midi_event_t *dev);
+void snd_midi_event_init(snd_midi_event_t *dev);
+void snd_midi_event_reset_encode(snd_midi_event_t *dev);
+void snd_midi_event_reset_decode(snd_midi_event_t *dev);
+void snd_midi_event_no_status(snd_midi_event_t *dev, int on);
+/* encode from byte stream - return number of written bytes if success */
+long snd_midi_event_encode(snd_midi_event_t *dev, const unsigned char *buf, long count, snd_seq_event_t *ev);
+int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev);
+/* decode from event to bytes - return number of written bytes if success */
+long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, const snd_seq_event_t *ev);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_SEQ_MIDI_EVENT_H */
+
diff --git a/thirdparty/linuxbsd_headers/alsa/seqmid.h b/thirdparty/linuxbsd_headers/alsa/seqmid.h
new file mode 100644
index 0000000000..68069b2aa3
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/seqmid.h
@@ -0,0 +1,490 @@
+/**
+ * \file include/seqmid.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_SEQMID_H
+#define __ALSA_SEQMID_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup SeqMiddle Sequencer Middle Level Interface
+ * Sequencer Middle Level Interface
+ * \ingroup Sequencer
+ * \{
+ */
+
+/**
+ * \brief initialize event record
+ * \param ev event record pointer
+ *
+ * This macro clears the given event record pointer to the default status.
+ */
+#define snd_seq_ev_clear(ev) \
+ memset(ev, 0, sizeof(snd_seq_event_t))
+
+/**
+ * \brief set the tag for given event
+ * \param ev event record
+ * \param t event tag
+ *
+ * This macro sets the tag to the given event record.
+ */
+#define snd_seq_ev_set_tag(ev,t) \
+ ((ev)->tag = (t))
+
+/**
+ * \brief set the explicit destination
+ * \param ev event record
+ * \param c destination client id
+ * \param p destination port id
+ *
+ * This macro sets the client and port id numbers to the given event record.
+ *
+ * \sa snd_seq_ev_set_subs()
+ */
+#define snd_seq_ev_set_dest(ev,c,p) \
+ ((ev)->dest.client = (c), (ev)->dest.port = (p))
+
+/**
+ * \brief set broadcasting to subscribers
+ * \param ev event record
+ *
+ * This macro sets the destination as the subscribers.
+ *
+ * \sa snd_seq_ev_set_dest()
+ */
+#define snd_seq_ev_set_subs(ev) \
+ ((ev)->dest.client = SND_SEQ_ADDRESS_SUBSCRIBERS,\
+ (ev)->dest.port = SND_SEQ_ADDRESS_UNKNOWN)
+
+/**
+ * \brief set broadcasting to all clients/ports
+ * \param ev event record
+ *
+ * This macro sets the destination as the broadcasting.
+ *
+ * \sa snd_seq_ev_set_dest()
+ */
+#define snd_seq_ev_set_broadcast(ev) \
+ ((ev)->dest.client = SND_SEQ_ADDRESS_BROADCAST,\
+ (ev)->dest.port = SND_SEQ_ADDRESS_BROADCAST)
+
+/**
+ * \brief set the source port
+ * \param ev event record
+ * \param p source port id
+ *
+ * This macro sets the source port id number.
+ */
+#define snd_seq_ev_set_source(ev,p) \
+ ((ev)->source.port = (p))
+
+/**
+ * \brief set direct passing mode (without queued)
+ * \param ev event instance
+ *
+ * This macro sets the event to the direct passing mode
+ * to be delivered immediately without queueing.
+ *
+ * \sa snd_seq_ev_schedule_tick(), snd_seq_ev_schedule_real()
+ */
+#define snd_seq_ev_set_direct(ev) \
+ ((ev)->queue = SND_SEQ_QUEUE_DIRECT)
+
+/**
+ * \brief set tick-scheduling mode on queue
+ * \param ev event instance
+ * \param q queue id to schedule
+ * \param relative relative time-stamp if non-zero
+ * \param ttick tick time-stamp to be delivered
+ *
+ * This macro sets the scheduling of the event in the
+ * MIDI tick mode.
+ *
+ * \sa snd_seq_ev_schedule_real(), snd_seq_ev_set_direct()
+ */
+#define snd_seq_ev_schedule_tick(ev, q, relative, ttick) \
+ ((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
+ (ev)->flags |= SND_SEQ_TIME_STAMP_TICK,\
+ (ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
+ (ev)->time.tick = (ttick),\
+ (ev)->queue = (q))
+
+/**
+ * \brief set real-time-scheduling mode on queue
+ * \param ev event instance
+ * \param q queue id to schedule
+ * \param relative relative time-stamp if non-zero
+ * \param rtime time-stamp to be delivered
+ *
+ * This macro sets the scheduling of the event in the
+ * realtime mode.
+ *
+ * \sa snd_seq_ev_schedule_tick(), snd_seq_ev_set_direct()
+ */
+#define snd_seq_ev_schedule_real(ev, q, relative, rtime) \
+ ((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
+ (ev)->flags |= SND_SEQ_TIME_STAMP_REAL,\
+ (ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
+ (ev)->time.time = *(rtime),\
+ (ev)->queue = (q))
+
+/**
+ * \brief set event priority
+ * \param ev event instance
+ * \param high_prior 1 for high priority mode
+ */
+#define snd_seq_ev_set_priority(ev, high_prior) \
+ ((ev)->flags &= ~SND_SEQ_PRIORITY_MASK,\
+ (ev)->flags |= (high_prior) ? SND_SEQ_PRIORITY_HIGH : SND_SEQ_PRIORITY_NORMAL)
+
+/**
+ * \brief set fixed data
+ * \param ev event instance
+ *
+ * Sets the event length mode as fixed size.
+ *
+ * \sa snd_seq_ev_set_variable(), snd_seq_ev_set_varusr()
+ */
+#define snd_seq_ev_set_fixed(ev) \
+ ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
+ (ev)->flags |= SND_SEQ_EVENT_LENGTH_FIXED)
+
+/**
+ * \brief set variable data
+ * \param ev event instance
+ * \param datalen length of the external data
+ * \param dataptr pointer of the external data
+ *
+ * Sets the event length mode as variable length and stores the data.
+ *
+ * \sa snd_seq_ev_set_fixed(), snd_seq_ev_set_varusr()
+ */
+#define snd_seq_ev_set_variable(ev, datalen, dataptr) \
+ ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
+ (ev)->flags |= SND_SEQ_EVENT_LENGTH_VARIABLE,\
+ (ev)->data.ext.len = (datalen),\
+ (ev)->data.ext.ptr = (dataptr))
+
+/**
+ * \brief set varusr data
+ * \param ev event instance
+ * \param datalen length of the external data
+ * \param dataptr pointer of the external data
+ *
+ * Sets the event length mode as variable user-space data and stores the data.
+ *
+ * \sa snd_seq_ev_set_fixed(), snd_seq_ev_set_variable()
+ */
+#define snd_seq_ev_set_varusr(ev, datalen, dataptr) \
+ ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
+ (ev)->flags |= SND_SEQ_EVENT_LENGTH_VARUSR,\
+ (ev)->data.ext.len = (datalen),\
+ (ev)->data.ext.ptr = (dataptr))
+
+/**
+ * \brief set queue controls
+ * \param ev event record
+ * \param typ event type
+ * \param q queue id
+ * \param val control value
+ */
+#define snd_seq_ev_set_queue_control(ev, typ, q, val) \
+ ((ev)->type = (typ),\
+ snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
+ (ev)->data.queue.queue = (q),\
+ (ev)->data.queue.param.value = (val))
+
+/**
+ * \brief set the start queue event
+ * \param ev event record
+ * \param q queue id to start
+ *
+ * \sa snd_seq_ev_set_queue_stop(), snd_seq_ev_set_queue_continue()
+ */
+#define snd_seq_ev_set_queue_start(ev, q) \
+ snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_START, q, 0)
+
+/**
+ * \brief set the stop queue event
+ * \param ev event record
+ * \param q queue id to stop
+ *
+ * \sa snd_seq_ev_set_queue_start(), snd_seq_ev_set_queue_continue()
+ */
+#define snd_seq_ev_set_queue_stop(ev, q) \
+ snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_STOP, q, 0)
+
+/**
+ * \brief set the stop queue event
+ * \param ev event record
+ * \param q queue id to continue
+ *
+ * \sa snd_seq_ev_set_queue_start(), snd_seq_ev_set_queue_stop()
+ */
+#define snd_seq_ev_set_queue_continue(ev, q) \
+ snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_CONTINUE, q, 0)
+
+/**
+ * \brief set the stop queue event
+ * \param ev event record
+ * \param q queue id to change tempo
+ * \param val the new tempo value
+ */
+#define snd_seq_ev_set_queue_tempo(ev, q, val) \
+ snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_TEMPO, q, val)
+
+/**
+ * \brief set the real-time position of a queue
+ * \param ev event record
+ * \param q queue id to change tempo
+ * \param rtime the new real-time pointer
+ */
+#define snd_seq_ev_set_queue_pos_real(ev, q, rtime) \
+ ((ev)->type = SND_SEQ_EVENT_SETPOS_TIME,\
+ snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
+ (ev)->data.queue.queue = (q),\
+ (ev)->data.queue.param.time.time = *(rtime))
+
+/**
+ * \brief set the tick-time position of a queue
+ * \param ev event record
+ * \param q queue id to change tempo
+ * \param ttime the new tick-time
+ */
+#define snd_seq_ev_set_queue_pos_tick(ev, q, ttime) \
+ ((ev)->type = SND_SEQ_EVENT_SETPOS_TICK,\
+ snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
+ (ev)->data.queue.queue = (q),\
+ (ev)->data.queue.param.time.tick = (ttime))
+
+/* set and send a queue control event */
+int snd_seq_control_queue(snd_seq_t *seq, int q, int type, int value, snd_seq_event_t *ev);
+
+/**
+ * \brief start the specified queue
+ * \param seq sequencer handle
+ * \param q queue id to start
+ * \param ev optional event record (see #snd_seq_control_queue)
+ */
+#define snd_seq_start_queue(seq, q, ev) \
+ snd_seq_control_queue(seq, q, SND_SEQ_EVENT_START, 0, ev)
+
+/**
+ * \brief stop the specified queue
+ * \param seq sequencer handle
+ * \param q queue id to stop
+ * \param ev optional event record (see #snd_seq_control_queue)
+ */
+#define snd_seq_stop_queue(seq, q, ev) \
+ snd_seq_control_queue(seq, q, SND_SEQ_EVENT_STOP, 0, ev)
+
+/**
+ * \brief continue the specified queue
+ * \param seq sequencer handle
+ * \param q queue id to continue
+ * \param ev optional event record (see #snd_seq_control_queue)
+ */
+#define snd_seq_continue_queue(seq, q, ev) \
+ snd_seq_control_queue(seq, q, SND_SEQ_EVENT_CONTINUE, 0, ev)
+
+/**
+ * \brief change the tempo of the specified queue
+ * \param seq sequencer handle
+ * \param q queue id
+ * \param tempo the new tempo value
+ * \param ev optional event record (see #snd_seq_control_queue)
+ */
+#define snd_seq_change_queue_tempo(seq, q, tempo, ev) \
+ snd_seq_control_queue(seq, q, SND_SEQ_EVENT_TEMPO, tempo, ev)
+
+/* create a port - simple version - return the port number */
+int snd_seq_create_simple_port(snd_seq_t *seq, const char *name,
+ unsigned int caps, unsigned int type);
+/* delete the port */
+int snd_seq_delete_simple_port(snd_seq_t *seq, int port);
+
+/* simple subscription between this port and another port
+ (w/o exclusive & time conversion)
+ */
+int snd_seq_connect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
+int snd_seq_connect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
+int snd_seq_disconnect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
+int snd_seq_disconnect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
+
+/*
+ * set client information
+ */
+int snd_seq_set_client_name(snd_seq_t *seq, const char *name);
+int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type);
+int snd_seq_set_client_pool_output(snd_seq_t *seq, size_t size);
+int snd_seq_set_client_pool_output_room(snd_seq_t *seq, size_t size);
+int snd_seq_set_client_pool_input(snd_seq_t *seq, size_t size);
+/* sync output queue */
+int snd_seq_sync_output_queue(snd_seq_t *seq);
+
+/*
+ * parse the given string and get the sequencer address
+ */
+int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *str);
+
+/*
+ * reset client input/output pool
+ */
+int snd_seq_reset_pool_output(snd_seq_t *seq);
+int snd_seq_reset_pool_input(snd_seq_t *seq);
+
+/**
+ * \brief set note event
+ * \param ev event record
+ * \param ch channel number
+ * \param key note key
+ * \param vel velocity
+ * \param dur duration (in tick or msec)
+ */
+#define snd_seq_ev_set_note(ev, ch, key, vel, dur) \
+ ((ev)->type = SND_SEQ_EVENT_NOTE,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.note.channel = (ch),\
+ (ev)->data.note.note = (key),\
+ (ev)->data.note.velocity = (vel),\
+ (ev)->data.note.duration = (dur))
+
+/**
+ * \brief set note-on event
+ * \param ev event record
+ * \param ch channel number
+ * \param key note key
+ * \param vel velocity
+ */
+#define snd_seq_ev_set_noteon(ev, ch, key, vel) \
+ ((ev)->type = SND_SEQ_EVENT_NOTEON,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.note.channel = (ch),\
+ (ev)->data.note.note = (key),\
+ (ev)->data.note.velocity = (vel))
+
+/**
+ * \brief set note-off event
+ * \param ev event record
+ * \param ch channel number
+ * \param key note key
+ * \param vel velocity
+ */
+#define snd_seq_ev_set_noteoff(ev, ch, key, vel) \
+ ((ev)->type = SND_SEQ_EVENT_NOTEOFF,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.note.channel = (ch),\
+ (ev)->data.note.note = (key),\
+ (ev)->data.note.velocity = (vel))
+
+/**
+ * \brief set key-pressure event
+ * \param ev event record
+ * \param ch channel number
+ * \param key note key
+ * \param vel velocity
+ */
+#define snd_seq_ev_set_keypress(ev,ch,key,vel) \
+ ((ev)->type = SND_SEQ_EVENT_KEYPRESS,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.note.channel = (ch),\
+ (ev)->data.note.note = (key),\
+ (ev)->data.note.velocity = (vel))
+
+/**
+ * \brief set MIDI controller event
+ * \param ev event record
+ * \param ch channel number
+ * \param cc controller number
+ * \param val control value
+ */
+#define snd_seq_ev_set_controller(ev,ch,cc,val) \
+ ((ev)->type = SND_SEQ_EVENT_CONTROLLER,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.control.channel = (ch),\
+ (ev)->data.control.param = (cc),\
+ (ev)->data.control.value = (val))
+
+/**
+ * \brief set program change event
+ * \param ev event record
+ * \param ch channel number
+ * \param val program number
+ */
+#define snd_seq_ev_set_pgmchange(ev,ch,val) \
+ ((ev)->type = SND_SEQ_EVENT_PGMCHANGE,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.control.channel = (ch),\
+ (ev)->data.control.value = (val))
+
+/**
+ * \brief set pitch-bend event
+ * \param ev event record
+ * \param ch channel number
+ * \param val pitch bend; zero centered from -8192 to 8191
+ */
+#define snd_seq_ev_set_pitchbend(ev,ch,val) \
+ ((ev)->type = SND_SEQ_EVENT_PITCHBEND,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.control.channel = (ch),\
+ (ev)->data.control.value = (val))
+
+/**
+ * \brief set channel pressure event
+ * \param ev event record
+ * \param ch channel number
+ * \param val channel pressure value
+ */
+#define snd_seq_ev_set_chanpress(ev,ch,val) \
+ ((ev)->type = SND_SEQ_EVENT_CHANPRESS,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.control.channel = (ch),\
+ (ev)->data.control.value = (val))
+
+/**
+ * \brief set sysex event
+ * \param ev event record
+ * \param datalen length of sysex data
+ * \param dataptr sysex data pointer
+ *
+ * the sysex data must contain the start byte 0xf0 and the end byte 0xf7.
+ */
+#define snd_seq_ev_set_sysex(ev,datalen,dataptr) \
+ ((ev)->type = SND_SEQ_EVENT_SYSEX,\
+ snd_seq_ev_set_variable(ev, datalen, dataptr))
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_SEQMID_H */
+
diff --git a/thirdparty/linuxbsd_headers/alsa/sound/asoc.h b/thirdparty/linuxbsd_headers/alsa/sound/asoc.h
new file mode 100644
index 0000000000..082c542913
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/sound/asoc.h
@@ -0,0 +1,543 @@
+/*
+ * uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM
+ *
+ * Copyright (C) 2012 Texas Instruments Inc.
+ * Copyright (C) 2015 Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Simple file API to load FW that includes mixers, coefficients, DAPM graphs,
+ * algorithms, equalisers, DAIs, widgets etc.
+*/
+
+#ifndef __LINUX_UAPI_SND_ASOC_H
+#define __LINUX_UAPI_SND_ASOC_H
+
+/*
+ * Maximum number of channels topology kcontrol can represent.
+ */
+#define SND_SOC_TPLG_MAX_CHAN 8
+
+/*
+ * Maximum number of PCM formats capability
+ */
+#define SND_SOC_TPLG_MAX_FORMATS 16
+
+/*
+ * Maximum number of PCM stream configs
+ */
+#define SND_SOC_TPLG_STREAM_CONFIG_MAX 8
+
+/*
+ * Maximum number of physical link's hardware configs
+ */
+#define SND_SOC_TPLG_HW_CONFIG_MAX 8
+
+/* individual kcontrol info types - can be mixed with other types */
+#define SND_SOC_TPLG_CTL_VOLSW 1
+#define SND_SOC_TPLG_CTL_VOLSW_SX 2
+#define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3
+#define SND_SOC_TPLG_CTL_ENUM 4
+#define SND_SOC_TPLG_CTL_BYTES 5
+#define SND_SOC_TPLG_CTL_ENUM_VALUE 6
+#define SND_SOC_TPLG_CTL_RANGE 7
+#define SND_SOC_TPLG_CTL_STROBE 8
+
+
+/* individual widget kcontrol info types - can be mixed with other types */
+#define SND_SOC_TPLG_DAPM_CTL_VOLSW 64
+#define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 65
+#define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 66
+#define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 67
+#define SND_SOC_TPLG_DAPM_CTL_PIN 68
+
+/* DAPM widget types - add new items to the end */
+#define SND_SOC_TPLG_DAPM_INPUT 0
+#define SND_SOC_TPLG_DAPM_OUTPUT 1
+#define SND_SOC_TPLG_DAPM_MUX 2
+#define SND_SOC_TPLG_DAPM_MIXER 3
+#define SND_SOC_TPLG_DAPM_PGA 4
+#define SND_SOC_TPLG_DAPM_OUT_DRV 5
+#define SND_SOC_TPLG_DAPM_ADC 6
+#define SND_SOC_TPLG_DAPM_DAC 7
+#define SND_SOC_TPLG_DAPM_SWITCH 8
+#define SND_SOC_TPLG_DAPM_PRE 9
+#define SND_SOC_TPLG_DAPM_POST 10
+#define SND_SOC_TPLG_DAPM_AIF_IN 11
+#define SND_SOC_TPLG_DAPM_AIF_OUT 12
+#define SND_SOC_TPLG_DAPM_DAI_IN 13
+#define SND_SOC_TPLG_DAPM_DAI_OUT 14
+#define SND_SOC_TPLG_DAPM_DAI_LINK 15
+#define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DAI_LINK
+
+/* Header magic number and string sizes */
+#define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */
+
+/* string sizes */
+#define SND_SOC_TPLG_NUM_TEXTS 16
+
+/* ABI version */
+#define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */
+#define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */
+
+/* Max size of TLV data */
+#define SND_SOC_TPLG_TLV_SIZE 32
+
+/*
+ * File and Block header data types.
+ * Add new generic and vendor types to end of list.
+ * Generic types are handled by the core whilst vendors types are passed
+ * to the component drivers for handling.
+ */
+#define SND_SOC_TPLG_TYPE_MIXER 1
+#define SND_SOC_TPLG_TYPE_BYTES 2
+#define SND_SOC_TPLG_TYPE_ENUM 3
+#define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4
+#define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5
+#define SND_SOC_TPLG_TYPE_DAI_LINK 6
+#define SND_SOC_TPLG_TYPE_PCM 7
+#define SND_SOC_TPLG_TYPE_MANIFEST 8
+#define SND_SOC_TPLG_TYPE_CODEC_LINK 9
+#define SND_SOC_TPLG_TYPE_BACKEND_LINK 10
+#define SND_SOC_TPLG_TYPE_PDATA 11
+#define SND_SOC_TPLG_TYPE_DAI 12
+#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI
+
+/* vendor block IDs - please add new vendor types to end */
+#define SND_SOC_TPLG_TYPE_VENDOR_FW 1000
+#define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001
+#define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002
+#define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003
+
+#define SND_SOC_TPLG_STREAM_PLAYBACK 0
+#define SND_SOC_TPLG_STREAM_CAPTURE 1
+
+/* vendor tuple types */
+#define SND_SOC_TPLG_TUPLE_TYPE_UUID 0
+#define SND_SOC_TPLG_TUPLE_TYPE_STRING 1
+#define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2
+#define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3
+#define SND_SOC_TPLG_TUPLE_TYPE_WORD 4
+#define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5
+
+/* DAI flags */
+#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0)
+#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
+#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
+
+/* DAI physical PCM data formats.
+ * Add new formats to the end of the list.
+ */
+#define SND_SOC_DAI_FORMAT_I2S 1 /* I2S mode */
+#define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */
+#define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */
+#define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */
+#define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */
+#define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */
+#define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */
+
+/* left and right justified also known as MSB and LSB respectively */
+#define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J
+#define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J
+
+/* DAI link flags */
+#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0)
+#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
+#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
+#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3)
+
+/*
+ * Block Header.
+ * This header precedes all object and object arrays below.
+ */
+struct snd_soc_tplg_hdr {
+ __le32 magic; /* magic number */
+ __le32 abi; /* ABI version */
+ __le32 version; /* optional vendor specific version details */
+ __le32 type; /* SND_SOC_TPLG_TYPE_ */
+ __le32 size; /* size of this structure */
+ __le32 vendor_type; /* optional vendor specific type info */
+ __le32 payload_size; /* data bytes, excluding this header */
+ __le32 index; /* identifier for block */
+ __le32 count; /* number of elements in block */
+} __attribute__((packed));
+
+/* vendor tuple for uuid */
+struct snd_soc_tplg_vendor_uuid_elem {
+ __le32 token;
+ char uuid[16];
+} __attribute__((packed));
+
+/* vendor tuple for a bool/byte/short/word value */
+struct snd_soc_tplg_vendor_value_elem {
+ __le32 token;
+ __le32 value;
+} __attribute__((packed));
+
+/* vendor tuple for string */
+struct snd_soc_tplg_vendor_string_elem {
+ __le32 token;
+ char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+} __attribute__((packed));
+
+struct snd_soc_tplg_vendor_array {
+ __le32 size; /* size in bytes of the array, including all elements */
+ __le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */
+ __le32 num_elems; /* number of elements in array */
+ union {
+ struct snd_soc_tplg_vendor_uuid_elem uuid[0];
+ struct snd_soc_tplg_vendor_value_elem value[0];
+ struct snd_soc_tplg_vendor_string_elem string[0];
+ };
+} __attribute__((packed));
+
+/*
+ * Private data.
+ * All topology objects may have private data that can be used by the driver or
+ * firmware. Core will ignore this data.
+ */
+struct snd_soc_tplg_private {
+ __le32 size; /* in bytes of private data */
+ union {
+ char data[0];
+ struct snd_soc_tplg_vendor_array array[0];
+ };
+} __attribute__((packed));
+
+/*
+ * Kcontrol TLV data.
+ */
+struct snd_soc_tplg_tlv_dbscale {
+ __le32 min;
+ __le32 step;
+ __le32 mute;
+} __attribute__((packed));
+
+struct snd_soc_tplg_ctl_tlv {
+ __le32 size; /* in bytes of this structure */
+ __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */
+ union {
+ __le32 data[SND_SOC_TPLG_TLV_SIZE];
+ struct snd_soc_tplg_tlv_dbscale scale;
+ };
+} __attribute__((packed));
+
+/*
+ * Kcontrol channel data
+ */
+struct snd_soc_tplg_channel {
+ __le32 size; /* in bytes of this structure */
+ __le32 reg;
+ __le32 shift;
+ __le32 id; /* ID maps to Left, Right, LFE etc */
+} __attribute__((packed));
+
+/*
+ * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops
+ * Kcontrol ops need get/put/info.
+ * Bytes ext ops need get/put.
+ */
+struct snd_soc_tplg_io_ops {
+ __le32 get;
+ __le32 put;
+ __le32 info;
+} __attribute__((packed));
+
+/*
+ * kcontrol header
+ */
+struct snd_soc_tplg_ctl_hdr {
+ __le32 size; /* in bytes of this structure */
+ __le32 type;
+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+ __le32 access;
+ struct snd_soc_tplg_io_ops ops;
+ struct snd_soc_tplg_ctl_tlv tlv;
+} __attribute__((packed));
+
+/*
+ * Stream Capabilities
+ */
+struct snd_soc_tplg_stream_caps {
+ __le32 size; /* in bytes of this structure */
+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+ __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */
+ __le32 rates; /* supported rates SNDRV_PCM_RATE_* */
+ __le32 rate_min; /* min rate */
+ __le32 rate_max; /* max rate */
+ __le32 channels_min; /* min channels */
+ __le32 channels_max; /* max channels */
+ __le32 periods_min; /* min number of periods */
+ __le32 periods_max; /* max number of periods */
+ __le32 period_size_min; /* min period size bytes */
+ __le32 period_size_max; /* max period size bytes */
+ __le32 buffer_size_min; /* min buffer size bytes */
+ __le32 buffer_size_max; /* max buffer size bytes */
+ __le32 sig_bits; /* number of bits of content */
+} __attribute__((packed));
+
+/*
+ * FE or BE Stream configuration supported by SW/FW
+ */
+struct snd_soc_tplg_stream {
+ __le32 size; /* in bytes of this structure */
+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */
+ __le64 format; /* SNDRV_PCM_FMTBIT_* */
+ __le32 rate; /* SNDRV_PCM_RATE_* */
+ __le32 period_bytes; /* size of period in bytes */
+ __le32 buffer_bytes; /* size of buffer in bytes */
+ __le32 channels; /* channels */
+} __attribute__((packed));
+
+
+/*
+ * Describes a physical link's runtime supported hardware config,
+ * i.e. hardware audio formats.
+ */
+struct snd_soc_tplg_hw_config {
+ __le32 size; /* in bytes of this structure */
+ __le32 id; /* unique ID - - used to match */
+ __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */
+ __u8 clock_gated; /* 1 if clock can be gated to save power */
+ __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */
+ __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */
+ __u8 bclk_master; /* 1 for master of BCLK, 0 for slave */
+ __u8 fsync_master; /* 1 for master of FSYNC, 0 for slave */
+ __u8 mclk_direction; /* 0 for input, 1 for output */
+ __le16 reserved; /* for 32bit alignment */
+ __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */
+ __le32 bclk_rate; /* BCLK freqency in Hz */
+ __le32 fsync_rate; /* frame clock in Hz */
+ __le32 tdm_slots; /* number of TDM slots in use */
+ __le32 tdm_slot_width; /* width in bits for each slot */
+ __le32 tx_slots; /* bit mask for active Tx slots */
+ __le32 rx_slots; /* bit mask for active Rx slots */
+ __le32 tx_channels; /* number of Tx channels */
+ __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
+ __le32 rx_channels; /* number of Rx channels */
+ __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
+} __attribute__((packed));
+
+/*
+ * Manifest. List totals for each payload type. Not used in parsing, but will
+ * be passed to the component driver before any other objects in order for any
+ * global component resource allocations.
+ *
+ * File block representation for manifest :-
+ * +-----------------------------------+----+
+ * | struct snd_soc_tplg_hdr | 1 |
+ * +-----------------------------------+----+
+ * | struct snd_soc_tplg_manifest | 1 |
+ * +-----------------------------------+----+
+ */
+struct snd_soc_tplg_manifest {
+ __le32 size; /* in bytes of this structure */
+ __le32 control_elems; /* number of control elements */
+ __le32 widget_elems; /* number of widget elements */
+ __le32 graph_elems; /* number of graph elements */
+ __le32 pcm_elems; /* number of PCM elements */
+ __le32 dai_link_elems; /* number of DAI link elements */
+ __le32 dai_elems; /* number of physical DAI elements */
+ __le32 reserved[20]; /* reserved for new ABI element types */
+ struct snd_soc_tplg_private priv;
+} __attribute__((packed));
+
+/*
+ * Mixer kcontrol.
+ *
+ * File block representation for mixer kcontrol :-
+ * +-----------------------------------+----+
+ * | struct snd_soc_tplg_hdr | 1 |
+ * +-----------------------------------+----+
+ * | struct snd_soc_tplg_mixer_control | N |
+ * +-----------------------------------+----+
+ */
+struct snd_soc_tplg_mixer_control {
+ struct snd_soc_tplg_ctl_hdr hdr;
+ __le32 size; /* in bytes of this structure */
+ __le32 min;
+ __le32 max;
+ __le32 platform_max;
+ __le32 invert;
+ __le32 num_channels;
+ struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
+ struct snd_soc_tplg_private priv;
+} __attribute__((packed));
+
+/*
+ * Enumerated kcontrol
+ *
+ * File block representation for enum kcontrol :-
+ * +-----------------------------------+----+
+ * | struct snd_soc_tplg_hdr | 1 |
+ * +-----------------------------------+----+
+ * | struct snd_soc_tplg_enum_control | N |
+ * +-----------------------------------+----+
+ */
+struct snd_soc_tplg_enum_control {
+ struct snd_soc_tplg_ctl_hdr hdr;
+ __le32 size; /* in bytes of this structure */
+ __le32 num_channels;
+ struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
+ __le32 items;
+ __le32 mask;
+ __le32 count;
+ char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+ __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4];
+ struct snd_soc_tplg_private priv;
+} __attribute__((packed));
+
+/*
+ * Bytes kcontrol
+ *
+ * File block representation for bytes kcontrol :-
+ * +-----------------------------------+----+
+ * | struct snd_soc_tplg_hdr | 1 |
+ * +-----------------------------------+----+
+ * | struct snd_soc_tplg_bytes_control | N |
+ * +-----------------------------------+----+
+ */
+struct snd_soc_tplg_bytes_control {
+ struct snd_soc_tplg_ctl_hdr hdr;
+ __le32 size; /* in bytes of this structure */
+ __le32 max;
+ __le32 mask;
+ __le32 base;
+ __le32 num_regs;
+ struct snd_soc_tplg_io_ops ext_ops;
+ struct snd_soc_tplg_private priv;
+} __attribute__((packed));
+
+/*
+ * DAPM Graph Element
+ *
+ * File block representation for DAPM graph elements :-
+ * +-------------------------------------+----+
+ * | struct snd_soc_tplg_hdr | 1 |
+ * +-------------------------------------+----+
+ * | struct snd_soc_tplg_dapm_graph_elem | N |
+ * +-------------------------------------+----+
+ */
+struct snd_soc_tplg_dapm_graph_elem {
+ char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+ char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+ char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+} __attribute__((packed));
+
+/*
+ * DAPM Widget.
+ *
+ * File block representation for DAPM widget :-
+ * +-------------------------------------+-----+
+ * | struct snd_soc_tplg_hdr | 1 |
+ * +-------------------------------------+-----+
+ * | struct snd_soc_tplg_dapm_widget | N |
+ * +-------------------------------------+-----+
+ * | struct snd_soc_tplg_enum_control | 0|1 |
+ * | struct snd_soc_tplg_mixer_control | 0|N |
+ * +-------------------------------------+-----+
+ *
+ * Optional enum or mixer control can be appended to the end of each widget
+ * in the block.
+ */
+struct snd_soc_tplg_dapm_widget {
+ __le32 size; /* in bytes of this structure */
+ __le32 id; /* SND_SOC_DAPM_CTL */
+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+ char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+
+ __le32 reg; /* negative reg = no direct dapm */
+ __le32 shift; /* bits to shift */
+ __le32 mask; /* non-shifted mask */
+ __le32 subseq; /* sort within widget type */
+ __le32 invert; /* invert the power bit */
+ __le32 ignore_suspend; /* kept enabled over suspend */
+ __le16 event_flags;
+ __le16 event_type;
+ __le32 num_kcontrols;
+ struct snd_soc_tplg_private priv;
+ /*
+ * kcontrols that relate to this widget
+ * follow here after widget private data
+ */
+} __attribute__((packed));
+
+
+/*
+ * Describes SW/FW specific features of PCM (FE DAI & DAI link).
+ *
+ * File block representation for PCM :-
+ * +-----------------------------------+-----+
+ * | struct snd_soc_tplg_hdr | 1 |
+ * +-----------------------------------+-----+
+ * | struct snd_soc_tplg_pcm | N |
+ * +-----------------------------------+-----+
+ */
+struct snd_soc_tplg_pcm {
+ __le32 size; /* in bytes of this structure */
+ char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+ char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+ __le32 pcm_id; /* unique ID - used to match with DAI link */
+ __le32 dai_id; /* unique ID - used to match */
+ __le32 playback; /* supports playback mode */
+ __le32 capture; /* supports capture mode */
+ __le32 compress; /* 1 = compressed; 0 = PCM */
+ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
+ __le32 num_streams; /* number of streams */
+ struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
+ __le32 flag_mask; /* bitmask of flags to configure */
+ __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
+ struct snd_soc_tplg_private priv;
+} __attribute__((packed));
+
+
+/*
+ * Describes the physical link runtime supported configs or params
+ *
+ * File block representation for physical link config :-
+ * +-----------------------------------+-----+
+ * | struct snd_soc_tplg_hdr | 1 |
+ * +-----------------------------------+-----+
+ * | struct snd_soc_tplg_link_config | N |
+ * +-----------------------------------+-----+
+ */
+struct snd_soc_tplg_link_config {
+ __le32 size; /* in bytes of this structure */
+ __le32 id; /* unique ID - used to match */
+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
+ char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */
+ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
+ __le32 num_streams; /* number of streams */
+ struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */
+ __le32 num_hw_configs; /* number of hw configs */
+ __le32 default_hw_config_id; /* default hw config ID for init */
+ __le32 flag_mask; /* bitmask of flags to configure */
+ __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
+ struct snd_soc_tplg_private priv;
+} __attribute__((packed));
+
+/*
+ * Describes SW/FW specific features of physical DAI.
+ * It can be used to configure backend DAIs for DPCM.
+ *
+ * File block representation for physical DAI :-
+ * +-----------------------------------+-----+
+ * | struct snd_soc_tplg_hdr | 1 |
+ * +-----------------------------------+-----+
+ * | struct snd_soc_tplg_dai | N |
+ * +-----------------------------------+-----+
+ */
+struct snd_soc_tplg_dai {
+ __le32 size; /* in bytes of this structure */
+ char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
+ __le32 dai_id; /* unique ID - used to match */
+ __le32 playback; /* supports playback mode */
+ __le32 capture; /* supports capture mode */
+ struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
+ __le32 flag_mask; /* bitmask of flags to configure */
+ __le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */
+ struct snd_soc_tplg_private priv;
+} __attribute__((packed));
+#endif
diff --git a/thirdparty/linuxbsd_headers/alsa/sound/asound_fm.h b/thirdparty/linuxbsd_headers/alsa/sound/asound_fm.h
new file mode 100644
index 0000000000..c2a4b967d5
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/sound/asound_fm.h
@@ -0,0 +1,134 @@
+#ifndef __SOUND_ASOUND_FM_H
+#define __SOUND_ASOUND_FM_H
+
+/*
+ * Advanced Linux Sound Architecture - ALSA
+ *
+ * Interface file between ALSA driver & user space
+ * Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>,
+ * 4Front Technologies
+ *
+ * Direct FM control
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#define SNDRV_DM_FM_MODE_OPL2 0x00
+#define SNDRV_DM_FM_MODE_OPL3 0x01
+
+struct snd_dm_fm_info {
+ unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
+ unsigned char rhythm; /* percussion mode flag */
+};
+
+/*
+ * Data structure composing an FM "note" or sound event.
+ */
+
+struct snd_dm_fm_voice {
+ unsigned char op; /* operator cell (0 or 1) */
+ unsigned char voice; /* FM voice (0 to 17) */
+
+ unsigned char am; /* amplitude modulation */
+ unsigned char vibrato; /* vibrato effect */
+ unsigned char do_sustain; /* sustain phase */
+ unsigned char kbd_scale; /* keyboard scaling */
+ unsigned char harmonic; /* 4 bits: harmonic and multiplier */
+ unsigned char scale_level; /* 2 bits: decrease output freq rises */
+ unsigned char volume; /* 6 bits: volume */
+
+ unsigned char attack; /* 4 bits: attack rate */
+ unsigned char decay; /* 4 bits: decay rate */
+ unsigned char sustain; /* 4 bits: sustain level */
+ unsigned char release; /* 4 bits: release rate */
+
+ unsigned char feedback; /* 3 bits: feedback for op0 */
+ unsigned char connection; /* 0 for serial, 1 for parallel */
+ unsigned char left; /* stereo left */
+ unsigned char right; /* stereo right */
+ unsigned char waveform; /* 3 bits: waveform shape */
+};
+
+/*
+ * This describes an FM note by its voice, octave, frequency number (10bit)
+ * and key on/off.
+ */
+
+struct snd_dm_fm_note {
+ unsigned char voice; /* 0-17 voice channel */
+ unsigned char octave; /* 3 bits: what octave to play */
+ unsigned int fnum; /* 10 bits: frequency number */
+ unsigned char key_on; /* set for active, clear for silent */
+};
+
+/*
+ * FM parameters that apply globally to all voices, and thus are not "notes"
+ */
+
+struct snd_dm_fm_params {
+ unsigned char am_depth; /* amplitude modulation depth (1=hi) */
+ unsigned char vib_depth; /* vibrato depth (1=hi) */
+ unsigned char kbd_split; /* keyboard split */
+ unsigned char rhythm; /* percussion mode select */
+
+ /* This block is the percussion instrument data */
+ unsigned char bass;
+ unsigned char snare;
+ unsigned char tomtom;
+ unsigned char cymbal;
+ unsigned char hihat;
+};
+
+/*
+ * FM mode ioctl settings
+ */
+
+#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info)
+#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
+#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note)
+#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice)
+#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params)
+#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
+/* for OPL3 only */
+#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
+/* SBI patch management */
+#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40)
+
+#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20
+#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21
+#define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22
+#define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23
+#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24
+#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25
+
+/*
+ * Patch Record - fixed size for write
+ */
+
+#define FM_KEY_SBI "SBI\032"
+#define FM_KEY_2OP "2OP\032"
+#define FM_KEY_4OP "4OP\032"
+
+struct sbi_patch {
+ unsigned char prog;
+ unsigned char bank;
+ char key[4];
+ char name[25];
+ char extension[7];
+ unsigned char data[32];
+};
+
+#endif /* __SOUND_ASOUND_FM_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/sound/emu10k1.h b/thirdparty/linuxbsd_headers/alsa/sound/emu10k1.h
new file mode 100644
index 0000000000..94018b74dc
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/sound/emu10k1.h
@@ -0,0 +1,349 @@
+#ifndef __SOUND_EMU10K1_H
+#define __SOUND_EMU10K1_H
+
+/*
+ * Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
+ * Creative Labs, Inc.
+ * Definitions for EMU10K1 (SB Live!) chips
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdint.h>
+
+/*
+ * ---- FX8010 ----
+ */
+
+#define EMU10K1_CARD_CREATIVE 0x00000000
+#define EMU10K1_CARD_EMUAPS 0x00000001
+
+#define EMU10K1_FX8010_PCM_COUNT 8
+
+/* instruction set */
+#define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */
+#define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */
+#define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */
+#define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */
+#define iMACINT0 0x04 /* R = A + X * Y ; saturation */
+#define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */
+#define iACC3 0x06 /* R = A + X + Y ; saturation */
+#define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */
+#define iANDXOR 0x08 /* R = (A & X) ^ Y */
+#define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */
+#define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */
+#define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */
+#define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */
+#define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */
+#define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */
+#define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */
+
+/* GPRs */
+#define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */
+#define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */
+#define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f */
+#define C_00000000 0x40
+#define C_00000001 0x41
+#define C_00000002 0x42
+#define C_00000003 0x43
+#define C_00000004 0x44
+#define C_00000008 0x45
+#define C_00000010 0x46
+#define C_00000020 0x47
+#define C_00000100 0x48
+#define C_00010000 0x49
+#define C_00080000 0x4a
+#define C_10000000 0x4b
+#define C_20000000 0x4c
+#define C_40000000 0x4d
+#define C_80000000 0x4e
+#define C_7fffffff 0x4f
+#define C_ffffffff 0x50
+#define C_fffffffe 0x51
+#define C_c0000000 0x52
+#define C_4f1bbcdc 0x53
+#define C_5a7ef9db 0x54
+#define C_00100000 0x55 /* ?? */
+#define GPR_ACCU 0x56 /* ACCUM, accumulator */
+#define GPR_COND 0x57 /* CCR, condition register */
+#define GPR_NOISE0 0x58 /* noise source */
+#define GPR_NOISE1 0x59 /* noise source */
+#define GPR_IRQ 0x5a /* IRQ register */
+#define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */
+#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */
+#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
+#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
+#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
+#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
+
+#define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f? */
+#define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x1f? */
+#define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f? */
+#define A_GPR(x) (A_FXGPREGBASE + (x))
+
+/* cc_reg constants */
+#define CC_REG_NORMALIZED C_00000001
+#define CC_REG_BORROW C_00000002
+#define CC_REG_MINUS C_00000004
+#define CC_REG_ZERO C_00000008
+#define CC_REG_SATURATE C_00000010
+#define CC_REG_NONZERO C_00000100
+
+/* FX buses */
+#define FXBUS_PCM_LEFT 0x00
+#define FXBUS_PCM_RIGHT 0x01
+#define FXBUS_PCM_LEFT_REAR 0x02
+#define FXBUS_PCM_RIGHT_REAR 0x03
+#define FXBUS_MIDI_LEFT 0x04
+#define FXBUS_MIDI_RIGHT 0x05
+#define FXBUS_PCM_CENTER 0x06
+#define FXBUS_PCM_LFE 0x07
+#define FXBUS_PCM_LEFT_FRONT 0x08
+#define FXBUS_PCM_RIGHT_FRONT 0x09
+#define FXBUS_MIDI_REVERB 0x0c
+#define FXBUS_MIDI_CHORUS 0x0d
+#define FXBUS_PCM_LEFT_SIDE 0x0e
+#define FXBUS_PCM_RIGHT_SIDE 0x0f
+#define FXBUS_PT_LEFT 0x14
+#define FXBUS_PT_RIGHT 0x15
+
+/* Inputs */
+#define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
+#define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
+#define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */
+#define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */
+#define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */
+#define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */
+#define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */
+#define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */
+#define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */
+#define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */
+#define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */
+#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */
+#define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */
+#define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */
+
+/* Outputs */
+#define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */
+#define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */
+#define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */
+#define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */
+#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */
+#define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */
+#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */
+#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */
+#define EXTOUT_REAR_L 0x08 /* Rear channel - left */
+#define EXTOUT_REAR_R 0x09 /* Rear channel - right */
+#define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */
+#define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */
+#define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */
+#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */
+#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */
+#define EXTOUT_ACENTER 0x11 /* Analog Center */
+#define EXTOUT_ALFE 0x12 /* Analog LFE */
+
+/* Audigy Inputs */
+#define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
+#define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
+#define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */
+#define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */
+#define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */
+#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */
+#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */
+#define A_EXTIN_LINE2_R 0x09 /* right */
+#define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */
+#define A_EXTIN_ADC_R 0x0b /* right */
+#define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */
+#define A_EXTIN_AUX2_R 0x0d /* - right */
+
+/* Audigiy Outputs */
+#define A_EXTOUT_FRONT_L 0x00 /* digital front left */
+#define A_EXTOUT_FRONT_R 0x01 /* right */
+#define A_EXTOUT_CENTER 0x02 /* digital front center */
+#define A_EXTOUT_LFE 0x03 /* digital front lfe */
+#define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */
+#define A_EXTOUT_HEADPHONE_R 0x05 /* right */
+#define A_EXTOUT_REAR_L 0x06 /* digital rear left */
+#define A_EXTOUT_REAR_R 0x07 /* right */
+#define A_EXTOUT_AFRONT_L 0x08 /* analog front left */
+#define A_EXTOUT_AFRONT_R 0x09 /* right */
+#define A_EXTOUT_ACENTER 0x0a /* analog center */
+#define A_EXTOUT_ALFE 0x0b /* analog LFE */
+#define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */
+#define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */
+#define A_EXTOUT_AREAR_L 0x0e /* analog rear left */
+#define A_EXTOUT_AREAR_R 0x0f /* right */
+#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */
+#define A_EXTOUT_AC97_R 0x11 /* right */
+#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */
+#define A_EXTOUT_ADC_CAP_R 0x17 /* right */
+#define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */
+
+/* Audigy constants */
+#define A_C_00000000 0xc0
+#define A_C_00000001 0xc1
+#define A_C_00000002 0xc2
+#define A_C_00000003 0xc3
+#define A_C_00000004 0xc4
+#define A_C_00000008 0xc5
+#define A_C_00000010 0xc6
+#define A_C_00000020 0xc7
+#define A_C_00000100 0xc8
+#define A_C_00010000 0xc9
+#define A_C_00000800 0xca
+#define A_C_10000000 0xcb
+#define A_C_20000000 0xcc
+#define A_C_40000000 0xcd
+#define A_C_80000000 0xce
+#define A_C_7fffffff 0xcf
+#define A_C_ffffffff 0xd0
+#define A_C_fffffffe 0xd1
+#define A_C_c0000000 0xd2
+#define A_C_4f1bbcdc 0xd3
+#define A_C_5a7ef9db 0xd4
+#define A_C_00100000 0xd5
+#define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */
+#define A_GPR_COND 0xd7 /* CCR, condition register */
+#define A_GPR_NOISE0 0xd8 /* noise source */
+#define A_GPR_NOISE1 0xd9 /* noise source */
+#define A_GPR_IRQ 0xda /* IRQ register */
+#define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */
+#define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */
+
+/* definitions for debug register */
+#define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */
+#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */
+#define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */
+#define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */
+#define EMU10K1_DBG_STEP 0x00004000 /* start single step */
+#define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */
+#define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */
+
+/* tank memory address line */
+#ifndef __KERNEL__
+#define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */
+#define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */
+#define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */
+#define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */
+#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */
+#endif
+
+typedef struct {
+ unsigned int internal_tram_size; /* in samples */
+ unsigned int external_tram_size; /* in samples */
+ char fxbus_names[16][32]; /* names of FXBUSes */
+ char extin_names[16][32]; /* names of external inputs */
+ char extout_names[32][32]; /* names of external outputs */
+ unsigned int gpr_controls; /* count of GPR controls */
+} emu10k1_fx8010_info_t;
+
+#define EMU10K1_GPR_TRANSLATION_NONE 0
+#define EMU10K1_GPR_TRANSLATION_TABLE100 1
+#define EMU10K1_GPR_TRANSLATION_BASS 2
+#define EMU10K1_GPR_TRANSLATION_TREBLE 3
+#define EMU10K1_GPR_TRANSLATION_ONOFF 4
+
+enum emu10k1_ctl_elem_iface {
+ EMU10K1_CTL_ELEM_IFACE_MIXER = 2, /* virtual mixer device */
+ EMU10K1_CTL_ELEM_IFACE_PCM = 3, /* PCM device */
+};
+
+typedef struct {
+ unsigned int pad; /* don't use */
+ int iface; /* interface identifier */
+ unsigned int device; /* device/client number */
+ unsigned int subdevice; /* subdevice (substream) number */
+ unsigned char name[44]; /* ASCII name of item */
+ unsigned int index; /* index of item */
+} emu10k1_ctl_elem_id_t;
+
+typedef struct {
+ emu10k1_ctl_elem_id_t id; /* full control ID definition */
+ unsigned int vcount; /* visible count */
+ unsigned int count; /* count of GPR (1..16) */
+ unsigned short gpr[32]; /* GPR number(s) */
+ unsigned int value[32]; /* initial values */
+ unsigned int min; /* minimum range */
+ unsigned int max; /* maximum range */
+ unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
+ unsigned int *tlv;
+} emu10k1_fx8010_control_gpr_t;
+
+typedef struct {
+ char name[128];
+
+ unsigned long gpr_valid[0x200/(sizeof(unsigned long)*8)]; /* bitmask of valid initializers */
+ uint32_t *gpr_map; /* initializers */
+
+ unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
+ emu10k1_fx8010_control_gpr_t *gpr_add_controls; /* GPR controls to add/replace */
+
+ unsigned int gpr_del_control_count; /* count of GPR controls to remove */
+ emu10k1_ctl_elem_id_t *gpr_del_controls; /* IDs of GPR controls to remove */
+
+ unsigned int gpr_list_control_count; /* count of GPR controls to list */
+ unsigned int gpr_list_control_total; /* total count of GPR controls */
+ emu10k1_fx8010_control_gpr_t *gpr_list_controls; /* listed GPR controls */
+
+ unsigned long tram_valid[0x100/(sizeof(unsigned long)*8)]; /* bitmask of valid initializers */
+ uint32_t *tram_data_map; /* data initializers */
+ uint32_t *tram_addr_map; /* map initializers */
+
+ unsigned long code_valid[1024/(sizeof(unsigned long)*8)]; /* bitmask of valid instructions */
+ uint32_t *code; /* one instruction - 64 bits */
+} emu10k1_fx8010_code_t;
+
+typedef struct {
+ unsigned int address; /* 31.bit == 1 -> external TRAM */
+ unsigned int size; /* size in samples (4 bytes) */
+ unsigned int *samples; /* pointer to samples (20-bit) */
+ /* NULL->clear memory */
+} emu10k1_fx8010_tram_t;
+
+typedef struct {
+ unsigned int substream; /* substream number */
+ unsigned int res1; /* reserved */
+ unsigned int channels; /* 16-bit channels count, zero = remove this substream */
+ unsigned int tram_start; /* ring buffer position in TRAM (in samples) */
+ unsigned int buffer_size; /* count of buffered samples */
+ unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */
+ unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */
+ unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */
+ unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */
+ unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */
+ unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */
+ unsigned char pad; /* reserved */
+ unsigned char etram[32]; /* external TRAM address & data (one per channel) */
+ unsigned int res2; /* reserved */
+} emu10k1_fx8010_pcm_t;
+
+#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, emu10k1_fx8010_info_t)
+#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, emu10k1_fx8010_code_t)
+#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, emu10k1_fx8010_code_t)
+#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)
+#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, emu10k1_fx8010_tram_t)
+#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, emu10k1_fx8010_tram_t)
+#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, emu10k1_fx8010_pcm_t)
+#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, emu10k1_fx8010_pcm_t)
+#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int)
+#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)
+#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)
+#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
+#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)
+#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)
+
+#endif /* __SOUND_EMU10K1_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/sound/hdsp.h b/thirdparty/linuxbsd_headers/alsa/sound/hdsp.h
new file mode 100644
index 0000000000..5adaf7b0ef
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/sound/hdsp.h
@@ -0,0 +1,113 @@
+#ifndef __SOUND_HDSP_H
+#define __SOUND_HDSP_H
+
+/*
+ * Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdint.h>
+
+#define HDSP_MATRIX_MIXER_SIZE 2048
+
+typedef enum {
+ Digiface,
+ Multiface,
+ H9652,
+ H9632,
+ RPM,
+ Undefined,
+} HDSP_IO_Type;
+
+typedef struct _snd_hdsp_peak_rms hdsp_peak_rms_t;
+
+struct _snd_hdsp_peak_rms {
+ uint32_t input_peaks[26];
+ uint32_t playback_peaks[26];
+ uint32_t output_peaks[28];
+ uint64_t input_rms[26];
+ uint64_t playback_rms[26];
+ /* These are only used for H96xx cards */
+ uint64_t output_rms[26];
+};
+
+#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, hdsp_peak_rms_t)
+
+typedef struct _snd_hdsp_config_info hdsp_config_info_t;
+
+struct _snd_hdsp_config_info {
+ unsigned char pref_sync_ref;
+ unsigned char wordclock_sync_check;
+ unsigned char spdif_sync_check;
+ unsigned char adatsync_sync_check;
+ unsigned char adat_sync_check[3];
+ unsigned char spdif_in;
+ unsigned char spdif_out;
+ unsigned char spdif_professional;
+ unsigned char spdif_emphasis;
+ unsigned char spdif_nonaudio;
+ unsigned int spdif_sample_rate;
+ unsigned int system_sample_rate;
+ unsigned int autosync_sample_rate;
+ unsigned char system_clock_mode;
+ unsigned char clock_source;
+ unsigned char autosync_ref;
+ unsigned char line_out;
+ unsigned char passthru;
+ unsigned char da_gain;
+ unsigned char ad_gain;
+ unsigned char phone_gain;
+ unsigned char xlr_breakout_cable;
+ unsigned char analog_extension_board;
+};
+
+#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, hdsp_config_info_t)
+
+typedef struct _snd_hdsp_firmware hdsp_firmware_t;
+
+struct _snd_hdsp_firmware {
+ void *firmware_data; /* 24413 x 4 bytes */
+};
+
+#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, hdsp_firmware_t)
+
+typedef struct _snd_hdsp_version hdsp_version_t;
+
+struct _snd_hdsp_version {
+ HDSP_IO_Type io_type;
+ unsigned short firmware_rev;
+};
+
+#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, hdsp_version_t)
+
+typedef struct _snd_hdsp_mixer hdsp_mixer_t;
+
+struct _snd_hdsp_mixer {
+ unsigned short matrix[HDSP_MATRIX_MIXER_SIZE];
+};
+
+#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, hdsp_mixer_t)
+
+typedef struct _snd_hdsp_9632_aeb hdsp_9632_aeb_t;
+
+struct _snd_hdsp_9632_aeb {
+ int aebi;
+ int aebo;
+};
+
+#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, hdsp_9632_aeb_t)
+
+#endif /* __SOUND_HDSP_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/sound/hdspm.h b/thirdparty/linuxbsd_headers/alsa/sound/hdspm.h
new file mode 100644
index 0000000000..fe9c5f695f
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/sound/hdspm.h
@@ -0,0 +1,229 @@
+#ifndef __SOUND_HDSPM_H
+#define __SOUND_HDSPM_H
+/*
+ * Copyright (C) 2003 Winfried Ritsch (IEM)
+ * based on hdsp.h from Thomas Charbonnel (thomas@undata.org)
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
+#define HDSPM_MAX_CHANNELS 64
+
+enum hdspm_io_type {
+ MADI,
+ MADIface,
+ AIO,
+ AES32,
+ RayDAT
+};
+
+enum hdspm_speed {
+ ss,
+ ds,
+ qs
+};
+
+/* -------------------- IOCTL Peak/RMS Meters -------------------- */
+
+struct hdspm_peak_rms {
+ uint32_t input_peaks[64];
+ uint32_t playback_peaks[64];
+ uint32_t output_peaks[64];
+
+ uint64_t input_rms[64];
+ uint64_t playback_rms[64];
+ uint64_t output_rms[64];
+
+ uint8_t speed; /* enum {ss, ds, qs} */
+ int status2;
+};
+
+#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \
+ _IOR('H', 0x42, struct hdspm_peak_rms)
+
+/* ------------ CONFIG block IOCTL ---------------------- */
+
+struct hdspm_config {
+ unsigned char pref_sync_ref;
+ unsigned char wordclock_sync_check;
+ unsigned char madi_sync_check;
+ unsigned int system_sample_rate;
+ unsigned int autosync_sample_rate;
+ unsigned char system_clock_mode;
+ unsigned char clock_source;
+ unsigned char autosync_ref;
+ unsigned char line_out;
+ unsigned int passthru;
+ unsigned int analog_out;
+};
+
+#define SNDRV_HDSPM_IOCTL_GET_CONFIG \
+ _IOR('H', 0x41, struct hdspm_config)
+
+/**
+ * If there's a TCO (TimeCode Option) board installed,
+ * there are further options and status data available.
+ * The hdspm_ltc structure contains the current SMPTE
+ * timecode and some status information and can be
+ * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the
+ * hdspm_status struct.
+ **/
+
+enum hdspm_ltc_format {
+ format_invalid,
+ fps_24,
+ fps_25,
+ fps_2997,
+ fps_30
+};
+
+enum hdspm_ltc_frame {
+ frame_invalid,
+ drop_frame,
+ full_frame
+};
+
+enum hdspm_ltc_input_format {
+ ntsc,
+ pal,
+ no_video
+};
+
+struct hdspm_ltc {
+ unsigned int ltc;
+
+ enum hdspm_ltc_format format;
+ enum hdspm_ltc_frame frame;
+ enum hdspm_ltc_input_format input_format;
+};
+
+#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc)
+
+/**
+ * The status data reflects the device's current state
+ * as determined by the card's configuration and
+ * connection status.
+ **/
+
+enum hdspm_sync {
+ hdspm_sync_no_lock = 0,
+ hdspm_sync_lock = 1,
+ hdspm_sync_sync = 2
+};
+
+enum hdspm_madi_input {
+ hdspm_input_optical = 0,
+ hdspm_input_coax = 1
+};
+
+enum hdspm_madi_channel_format {
+ hdspm_format_ch_64 = 0,
+ hdspm_format_ch_56 = 1
+};
+
+enum hdspm_madi_frame_format {
+ hdspm_frame_48 = 0,
+ hdspm_frame_96 = 1
+};
+
+enum hdspm_syncsource {
+ syncsource_wc = 0,
+ syncsource_madi = 1,
+ syncsource_tco = 2,
+ syncsource_sync = 3,
+ syncsource_none = 4
+};
+
+struct hdspm_status {
+ uint8_t card_type; /* enum hdspm_io_type */
+ enum hdspm_syncsource autosync_source;
+
+ uint64_t card_clock;
+ uint32_t master_period;
+
+ union {
+ struct {
+ uint8_t sync_wc; /* enum hdspm_sync */
+ uint8_t sync_madi; /* enum hdspm_sync */
+ uint8_t sync_tco; /* enum hdspm_sync */
+ uint8_t sync_in; /* enum hdspm_sync */
+ uint8_t madi_input; /* enum hdspm_madi_input */
+ uint8_t channel_format; /* enum hdspm_madi_channel_format */
+ uint8_t frame_format; /* enum hdspm_madi_frame_format */
+ } madi;
+ } card_specific;
+};
+
+#define SNDRV_HDSPM_IOCTL_GET_STATUS \
+ _IOR('H', 0x47, struct hdspm_status)
+
+/**
+ * Get information about the card and its add-ons.
+ **/
+
+#define HDSPM_ADDON_TCO 1
+
+struct hdspm_version {
+ uint8_t card_type; /* enum hdspm_io_type */
+ char cardname[20];
+ unsigned int serial;
+ unsigned short firmware_rev;
+ int addons;
+};
+
+#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version)
+
+/* ------------- get Matrix Mixer IOCTL --------------- */
+
+/* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte =
+ * 32768 Bytes
+ */
+
+/* organisation is 64 channelfader in a continous memory block */
+/* equivalent to hardware definition, maybe for future feature of mmap of
+ * them
+ */
+/* each of 64 outputs has 64 infader and 64 outfader:
+ Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */
+
+#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
+
+struct hdspm_channelfader {
+ unsigned int in[HDSPM_MIXER_CHANNELS];
+ unsigned int pb[HDSPM_MIXER_CHANNELS];
+};
+
+struct hdspm_mixer {
+ struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS];
+};
+
+struct hdspm_mixer_ioctl {
+ struct hdspm_mixer *mixer;
+};
+
+/* use indirect access due to the limit of ioctl bit size */
+#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
+
+/* typedefs for compatibility to user-space */
+typedef struct hdspm_peak_rms hdspm_peak_rms_t;
+typedef struct hdspm_config_info hdspm_config_info_t;
+typedef struct hdspm_version hdspm_version_t;
+typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
+typedef struct hdspm_mixer hdspm_mixer_t;
+
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/alsa/sound/sb16_csp.h b/thirdparty/linuxbsd_headers/alsa/sound/sb16_csp.h
new file mode 100644
index 0000000000..78817b40c0
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/sound/sb16_csp.h
@@ -0,0 +1,115 @@
+#ifndef __SOUND_SB16_CSP_H
+#define __SOUND_SB16_CSP_H
+
+/*
+ * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
+ * Takashi Iwai <tiwai@suse.de>
+ *
+ * SB16ASP/AWE32 CSP control
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/* CSP modes */
+#define SNDRV_SB_CSP_MODE_NONE 0x00
+#define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */
+#define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */
+#define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */
+
+/* CSP load flags */
+#define SNDRV_SB_CSP_LOAD_FROMUSER 0x01
+#define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02
+
+/* CSP sample width */
+#define SNDRV_SB_CSP_SAMPLE_8BIT 0x01
+#define SNDRV_SB_CSP_SAMPLE_16BIT 0x02
+
+/* CSP channels */
+#define SNDRV_SB_CSP_MONO 0x01
+#define SNDRV_SB_CSP_STEREO 0x02
+
+/* CSP rates */
+#define SNDRV_SB_CSP_RATE_8000 0x01
+#define SNDRV_SB_CSP_RATE_11025 0x02
+#define SNDRV_SB_CSP_RATE_22050 0x04
+#define SNDRV_SB_CSP_RATE_44100 0x08
+#define SNDRV_SB_CSP_RATE_ALL 0x0f
+
+/* CSP running state */
+#define SNDRV_SB_CSP_ST_IDLE 0x00
+#define SNDRV_SB_CSP_ST_LOADED 0x01
+#define SNDRV_SB_CSP_ST_RUNNING 0x02
+#define SNDRV_SB_CSP_ST_PAUSED 0x04
+#define SNDRV_SB_CSP_ST_AUTO 0x08
+#define SNDRV_SB_CSP_ST_QSOUND 0x10
+
+/* maximum QSound value (180 degrees right) */
+#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20
+
+/* maximum microcode RIFF file size */
+#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000
+
+/* microcode header */
+typedef struct snd_sb_csp_mc_header {
+ char codec_name[16]; /* id name of codec */
+ unsigned short func_req; /* requested function */
+} snd_sb_csp_mc_header_t;
+
+/* microcode to be loaded */
+typedef struct snd_sb_csp_microcode {
+ snd_sb_csp_mc_header_t info;
+ unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
+} snd_sb_csp_microcode_t;
+
+/* start CSP with sample_width in mono/stereo */
+typedef struct snd_sb_csp_start {
+ int sample_width; /* sample width, look above */
+ int channels; /* channels, look above */
+} snd_sb_csp_start_t;
+
+/* CSP information */
+typedef struct snd_sb_csp_info {
+ char codec_name[16]; /* id name of codec */
+ unsigned short func_nr; /* function number */
+ unsigned int acc_format; /* accepted PCM formats */
+ unsigned short acc_channels; /* accepted channels */
+ unsigned short acc_width; /* accepted sample width */
+ unsigned short acc_rates; /* accepted sample rates */
+ unsigned short csp_mode; /* CSP mode, see above */
+ unsigned short run_channels; /* current channels */
+ unsigned short run_width; /* current sample width */
+ unsigned short version; /* version id: 0x10 - 0x1f */
+ unsigned short state; /* state bits */
+} snd_sb_csp_info_t;
+
+/* HWDEP controls */
+/* get CSP information */
+#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, snd_sb_csp_info_t)
+/* load microcode to CSP */
+#define SNDRV_SB_CSP_IOCTL_LOAD_CODE _IOW('H', 0x11, snd_sb_csp_microcode_t)
+/* unload microcode from CSP */
+#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
+/* start CSP */
+#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, snd_sb_csp_start_t)
+/* stop CSP */
+#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14)
+/* pause CSP and DMA transfer */
+#define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15)
+/* restart CSP and DMA transfer */
+#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16)
+
+
+#endif /* __SOUND_SB16_CSP */
diff --git a/thirdparty/linuxbsd_headers/alsa/sound/sscape_ioctl.h b/thirdparty/linuxbsd_headers/alsa/sound/sscape_ioctl.h
new file mode 100644
index 0000000000..c6653ebfb2
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/sound/sscape_ioctl.h
@@ -0,0 +1,21 @@
+#ifndef SSCAPE_IOCTL_H
+#define SSCAPE_IOCTL_H
+
+
+struct sscape_bootblock
+{
+ unsigned char code[256];
+ unsigned version;
+};
+
+#define SSCAPE_MICROCODE_SIZE 65536
+
+struct sscape_microcode
+{
+ unsigned char *code;
+};
+
+#define SND_SSCAPE_LOAD_BOOTB _IOWR('P', 100, struct sscape_bootblock)
+#define SND_SSCAPE_LOAD_MCODE _IOW ('P', 101, struct sscape_microcode)
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/alsa/sound/tlv.h b/thirdparty/linuxbsd_headers/alsa/sound/tlv.h
new file mode 100644
index 0000000000..b4df440c01
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/sound/tlv.h
@@ -0,0 +1,100 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ */
+
+#ifndef __UAPI_SOUND_TLV_H
+#define __UAPI_SOUND_TLV_H
+
+#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */
+#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */
+#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */
+#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */
+#define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */
+#define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */
+
+/*
+ * channel-mapping TLV items
+ * TLV length must match with num_channels
+ */
+#define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */
+#define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */
+#define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */
+
+/*
+ * TLV structure is right behind the struct snd_ctl_tlv:
+ * unsigned int type - see SNDRV_CTL_TLVT_*
+ * unsigned int length
+ * .... data aligned to sizeof(unsigned int), use
+ * block_length = (length + (sizeof(unsigned int) - 1)) &
+ * ~(sizeof(unsigned int) - 1)) ....
+ */
+#define SNDRV_CTL_TLVD_ITEM(type, ...) \
+ (type), SNDRV_CTL_TLVD_LENGTH(__VA_ARGS__), __VA_ARGS__
+#define SNDRV_CTL_TLVD_LENGTH(...) \
+ ((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ }))
+
+#define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \
+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__)
+#define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \
+ unsigned int name[] = { \
+ SNDRV_CTL_TLVD_CONTAINER_ITEM(__VA_ARGS__) \
+ }
+
+#define SNDRV_CTL_TLVD_DB_SCALE_MASK 0xffff
+#define SNDRV_CTL_TLVD_DB_SCALE_MUTE 0x10000
+#define SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \
+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_SCALE, \
+ (min), \
+ ((step) & SNDRV_CTL_TLVD_DB_SCALE_MASK) | \
+ ((mute) ? SNDRV_CTL_TLVD_DB_SCALE_MUTE : 0))
+#define SNDRV_CTL_TLVD_DECLARE_DB_SCALE(name, min, step, mute) \
+ unsigned int name[] = { \
+ SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \
+ }
+
+/* dB scale specified with min/max values instead of step */
+#define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \
+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB))
+#define SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \
+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX_MUTE, (min_dB), (max_dB))
+#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(name, min_dB, max_dB) \
+ unsigned int name[] = { \
+ SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \
+ }
+#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX_MUTE(name, min_dB, max_dB) \
+ unsigned int name[] = { \
+ SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \
+ }
+
+/* linear volume between min_dB and max_dB (.01dB unit) */
+#define SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \
+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_LINEAR, (min_dB), (max_dB))
+#define SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(name, min_dB, max_dB) \
+ unsigned int name[] = { \
+ SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \
+ }
+
+/* dB range container:
+ * Items in dB range container must be ordered by their values and by their
+ * dB values. This implies that larger values must correspond with larger
+ * dB values (which is also required for all other mixer controls).
+ */
+/* Each item is: <min> <max> <TLV> */
+#define SNDRV_CTL_TLVD_DB_RANGE_ITEM(...) \
+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__)
+#define SNDRV_CTL_TLVD_DECLARE_DB_RANGE(name, ...) \
+ unsigned int name[] = { \
+ SNDRV_CTL_TLVD_DB_RANGE_ITEM(__VA_ARGS__) \
+ }
+
+#define SNDRV_CTL_TLVD_DB_GAIN_MUTE -9999999
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/alsa/sound/type_compat.h b/thirdparty/linuxbsd_headers/alsa/sound/type_compat.h
new file mode 100644
index 0000000000..e973ff3139
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/sound/type_compat.h
@@ -0,0 +1,42 @@
+#ifndef __TYPE_COMPAT_H
+#define __TYPE_COMPAT_H
+
+#ifndef DOC_HIDDEN
+#include <stdint.h>
+typedef uint8_t __u8;
+typedef uint16_t __u16;
+typedef uint32_t __u32;
+typedef int8_t __s8;
+typedef int16_t __s16;
+typedef int32_t __s32;
+
+#include <endian.h>
+#include <byteswap.h>
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define __cpu_to_le32(x) (x)
+#define __cpu_to_be32(x) bswap_32(x)
+#define __cpu_to_le16(x) (x)
+#define __cpu_to_be16(x) bswap_16(x)
+#else
+#define __cpu_to_le32(x) bswap_32(x)
+#define __cpu_to_be32(x) (x)
+#define __cpu_to_le16(x) bswap_16(x)
+#define __cpu_to_be16(x) (x)
+#endif
+
+#define __le32_to_cpu __cpu_to_le32
+#define __be32_to_cpu __cpu_to_be32
+#define __le16_to_cpu __cpu_to_le16
+#define __be16_to_cpu __cpu_to_be16
+
+#define __le64 __u64
+#define __le32 __u32
+#define __le16 __u16
+#define __le8 __u8
+#define __be64 __u64
+#define __be32 __u32
+#define __be16 __u16
+#define __be8 __u8
+#endif /* DOC_HIDDEN */
+
+#endif /* __TYPE_COMPAT_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/timer.h b/thirdparty/linuxbsd_headers/alsa/timer.h
new file mode 100644
index 0000000000..2803f53273
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/timer.h
@@ -0,0 +1,259 @@
+/**
+ * \file include/timer.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_TIMER_H
+#define __ALSA_TIMER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Timer Timer Interface
+ * Timer Interface. See \ref timer page for more details.
+ * \{
+ */
+
+/** dlsym version for interface entry callback */
+#define SND_TIMER_DLSYM_VERSION _dlsym_timer_001
+/** dlsym version for interface entry callback */
+#define SND_TIMER_QUERY_DLSYM_VERSION _dlsym_timer_query_001
+
+/** timer identification structure */
+typedef struct _snd_timer_id snd_timer_id_t;
+/** timer global info structure */
+typedef struct _snd_timer_ginfo snd_timer_ginfo_t;
+/** timer global params structure */
+typedef struct _snd_timer_gparams snd_timer_gparams_t;
+/** timer global status structure */
+typedef struct _snd_timer_gstatus snd_timer_gstatus_t;
+/** timer info structure */
+typedef struct _snd_timer_info snd_timer_info_t;
+/** timer params structure */
+typedef struct _snd_timer_params snd_timer_params_t;
+/** timer status structure */
+typedef struct _snd_timer_status snd_timer_status_t;
+/** timer master class */
+typedef enum _snd_timer_class {
+ SND_TIMER_CLASS_NONE = -1, /**< invalid */
+ SND_TIMER_CLASS_SLAVE = 0, /**< slave timer */
+ SND_TIMER_CLASS_GLOBAL, /**< global timer */
+ SND_TIMER_CLASS_CARD, /**< card timer */
+ SND_TIMER_CLASS_PCM, /**< PCM timer */
+ SND_TIMER_CLASS_LAST = SND_TIMER_CLASS_PCM /**< last timer */
+} snd_timer_class_t;
+
+/** timer slave class */
+typedef enum _snd_timer_slave_class {
+ SND_TIMER_SCLASS_NONE = 0, /**< none */
+ SND_TIMER_SCLASS_APPLICATION, /**< for internal use */
+ SND_TIMER_SCLASS_SEQUENCER, /**< sequencer timer */
+ SND_TIMER_SCLASS_OSS_SEQUENCER, /**< OSS sequencer timer */
+ SND_TIMER_SCLASS_LAST = SND_TIMER_SCLASS_OSS_SEQUENCER /**< last slave timer */
+} snd_timer_slave_class_t;
+
+/** timer read event identification */
+typedef enum _snd_timer_event {
+ SND_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */
+ SND_TIMER_EVENT_TICK, /* val = ticks */
+ SND_TIMER_EVENT_START, /* val = resolution in ns */
+ SND_TIMER_EVENT_STOP, /* val = 0 */
+ SND_TIMER_EVENT_CONTINUE, /* val = resolution in ns */
+ SND_TIMER_EVENT_PAUSE, /* val = 0 */
+ SND_TIMER_EVENT_EARLY, /* val = 0 */
+ SND_TIMER_EVENT_SUSPEND, /* val = 0 */
+ SND_TIMER_EVENT_RESUME, /* val = resolution in ns */
+ /* master timer events for slave timer instances */
+ SND_TIMER_EVENT_MSTART = SND_TIMER_EVENT_START + 10,
+ SND_TIMER_EVENT_MSTOP = SND_TIMER_EVENT_STOP + 10,
+ SND_TIMER_EVENT_MCONTINUE = SND_TIMER_EVENT_CONTINUE + 10,
+ SND_TIMER_EVENT_MPAUSE = SND_TIMER_EVENT_PAUSE + 10,
+ SND_TIMER_EVENT_MSUSPEND = SND_TIMER_EVENT_SUSPEND + 10,
+ SND_TIMER_EVENT_MRESUME = SND_TIMER_EVENT_RESUME + 10
+} snd_timer_event_t;
+
+/** timer read structure */
+typedef struct _snd_timer_read {
+ unsigned int resolution; /**< tick resolution in nanoseconds */
+ unsigned int ticks; /**< count of happened ticks */
+} snd_timer_read_t;
+
+/** timer tstamp + event read structure */
+typedef struct _snd_timer_tread {
+ snd_timer_event_t event; /**< Timer event */
+ snd_htimestamp_t tstamp; /**< Time stamp of each event */
+ unsigned int val; /**< Event value */
+} snd_timer_tread_t;
+
+/** global timer - system */
+#define SND_TIMER_GLOBAL_SYSTEM 0
+/** global timer - RTC */
+#define SND_TIMER_GLOBAL_RTC 1
+/** global timer - HPET */
+#define SND_TIMER_GLOBAL_HPET 2
+/** global timer - HRTIMER */
+#define SND_TIMER_GLOBAL_HRTIMER 3
+
+/** timer open mode flag - non-blocking behaviour */
+#define SND_TIMER_OPEN_NONBLOCK (1<<0)
+/** use timestamps and event notification - enhanced read */
+#define SND_TIMER_OPEN_TREAD (1<<1)
+
+/** timer handle type */
+typedef enum _snd_timer_type {
+ /** Kernel level HwDep */
+ SND_TIMER_TYPE_HW = 0,
+ /** Shared memory client timer (not yet implemented) */
+ SND_TIMER_TYPE_SHM,
+ /** INET client timer (not yet implemented) */
+ SND_TIMER_TYPE_INET
+} snd_timer_type_t;
+
+/** timer query handle */
+typedef struct _snd_timer_query snd_timer_query_t;
+/** timer handle */
+typedef struct _snd_timer snd_timer_t;
+
+
+int snd_timer_query_open(snd_timer_query_t **handle, const char *name, int mode);
+int snd_timer_query_open_lconf(snd_timer_query_t **handle, const char *name, int mode, snd_config_t *lconf);
+int snd_timer_query_close(snd_timer_query_t *handle);
+int snd_timer_query_next_device(snd_timer_query_t *handle, snd_timer_id_t *tid);
+int snd_timer_query_info(snd_timer_query_t *handle, snd_timer_ginfo_t *info);
+int snd_timer_query_params(snd_timer_query_t *handle, snd_timer_gparams_t *params);
+int snd_timer_query_status(snd_timer_query_t *handle, snd_timer_gstatus_t *status);
+
+int snd_timer_open(snd_timer_t **handle, const char *name, int mode);
+int snd_timer_open_lconf(snd_timer_t **handle, const char *name, int mode, snd_config_t *lconf);
+int snd_timer_close(snd_timer_t *handle);
+int snd_async_add_timer_handler(snd_async_handler_t **handler, snd_timer_t *timer,
+ snd_async_callback_t callback, void *private_data);
+snd_timer_t *snd_async_handler_get_timer(snd_async_handler_t *handler);
+int snd_timer_poll_descriptors_count(snd_timer_t *handle);
+int snd_timer_poll_descriptors(snd_timer_t *handle, struct pollfd *pfds, unsigned int space);
+int snd_timer_poll_descriptors_revents(snd_timer_t *timer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+int snd_timer_info(snd_timer_t *handle, snd_timer_info_t *timer);
+int snd_timer_params(snd_timer_t *handle, snd_timer_params_t *params);
+int snd_timer_status(snd_timer_t *handle, snd_timer_status_t *status);
+int snd_timer_start(snd_timer_t *handle);
+int snd_timer_stop(snd_timer_t *handle);
+int snd_timer_continue(snd_timer_t *handle);
+ssize_t snd_timer_read(snd_timer_t *handle, void *buffer, size_t size);
+
+size_t snd_timer_id_sizeof(void);
+/** allocate #snd_timer_id_t container on stack */
+#define snd_timer_id_alloca(ptr) __snd_alloca(ptr, snd_timer_id)
+int snd_timer_id_malloc(snd_timer_id_t **ptr);
+void snd_timer_id_free(snd_timer_id_t *obj);
+void snd_timer_id_copy(snd_timer_id_t *dst, const snd_timer_id_t *src);
+
+void snd_timer_id_set_class(snd_timer_id_t *id, int dev_class);
+int snd_timer_id_get_class(snd_timer_id_t *id);
+void snd_timer_id_set_sclass(snd_timer_id_t *id, int dev_sclass);
+int snd_timer_id_get_sclass(snd_timer_id_t *id);
+void snd_timer_id_set_card(snd_timer_id_t *id, int card);
+int snd_timer_id_get_card(snd_timer_id_t *id);
+void snd_timer_id_set_device(snd_timer_id_t *id, int device);
+int snd_timer_id_get_device(snd_timer_id_t *id);
+void snd_timer_id_set_subdevice(snd_timer_id_t *id, int subdevice);
+int snd_timer_id_get_subdevice(snd_timer_id_t *id);
+
+size_t snd_timer_ginfo_sizeof(void);
+/** allocate #snd_timer_ginfo_t container on stack */
+#define snd_timer_ginfo_alloca(ptr) __snd_alloca(ptr, snd_timer_ginfo)
+int snd_timer_ginfo_malloc(snd_timer_ginfo_t **ptr);
+void snd_timer_ginfo_free(snd_timer_ginfo_t *obj);
+void snd_timer_ginfo_copy(snd_timer_ginfo_t *dst, const snd_timer_ginfo_t *src);
+
+int snd_timer_ginfo_set_tid(snd_timer_ginfo_t *obj, snd_timer_id_t *tid);
+snd_timer_id_t *snd_timer_ginfo_get_tid(snd_timer_ginfo_t *obj);
+unsigned int snd_timer_ginfo_get_flags(snd_timer_ginfo_t *obj);
+int snd_timer_ginfo_get_card(snd_timer_ginfo_t *obj);
+char *snd_timer_ginfo_get_id(snd_timer_ginfo_t *obj);
+char *snd_timer_ginfo_get_name(snd_timer_ginfo_t *obj);
+unsigned long snd_timer_ginfo_get_resolution(snd_timer_ginfo_t *obj);
+unsigned long snd_timer_ginfo_get_resolution_min(snd_timer_ginfo_t *obj);
+unsigned long snd_timer_ginfo_get_resolution_max(snd_timer_ginfo_t *obj);
+unsigned int snd_timer_ginfo_get_clients(snd_timer_ginfo_t *obj);
+
+size_t snd_timer_info_sizeof(void);
+/** allocate #snd_timer_info_t container on stack */
+#define snd_timer_info_alloca(ptr) __snd_alloca(ptr, snd_timer_info)
+int snd_timer_info_malloc(snd_timer_info_t **ptr);
+void snd_timer_info_free(snd_timer_info_t *obj);
+void snd_timer_info_copy(snd_timer_info_t *dst, const snd_timer_info_t *src);
+
+int snd_timer_info_is_slave(snd_timer_info_t * info);
+int snd_timer_info_get_card(snd_timer_info_t * info);
+const char *snd_timer_info_get_id(snd_timer_info_t * info);
+const char *snd_timer_info_get_name(snd_timer_info_t * info);
+long snd_timer_info_get_resolution(snd_timer_info_t * info);
+
+size_t snd_timer_params_sizeof(void);
+/** allocate #snd_timer_params_t container on stack */
+#define snd_timer_params_alloca(ptr) __snd_alloca(ptr, snd_timer_params)
+int snd_timer_params_malloc(snd_timer_params_t **ptr);
+void snd_timer_params_free(snd_timer_params_t *obj);
+void snd_timer_params_copy(snd_timer_params_t *dst, const snd_timer_params_t *src);
+
+int snd_timer_params_set_auto_start(snd_timer_params_t * params, int auto_start);
+int snd_timer_params_get_auto_start(snd_timer_params_t * params);
+int snd_timer_params_set_exclusive(snd_timer_params_t * params, int exclusive);
+int snd_timer_params_get_exclusive(snd_timer_params_t * params);
+int snd_timer_params_set_early_event(snd_timer_params_t * params, int early_event);
+int snd_timer_params_get_early_event(snd_timer_params_t * params);
+void snd_timer_params_set_ticks(snd_timer_params_t * params, long ticks);
+long snd_timer_params_get_ticks(snd_timer_params_t * params);
+void snd_timer_params_set_queue_size(snd_timer_params_t * params, long queue_size);
+long snd_timer_params_get_queue_size(snd_timer_params_t * params);
+void snd_timer_params_set_filter(snd_timer_params_t * params, unsigned int filter);
+unsigned int snd_timer_params_get_filter(snd_timer_params_t * params);
+
+size_t snd_timer_status_sizeof(void);
+/** allocate #snd_timer_status_t container on stack */
+#define snd_timer_status_alloca(ptr) __snd_alloca(ptr, snd_timer_status)
+int snd_timer_status_malloc(snd_timer_status_t **ptr);
+void snd_timer_status_free(snd_timer_status_t *obj);
+void snd_timer_status_copy(snd_timer_status_t *dst, const snd_timer_status_t *src);
+
+snd_htimestamp_t snd_timer_status_get_timestamp(snd_timer_status_t * status);
+long snd_timer_status_get_resolution(snd_timer_status_t * status);
+long snd_timer_status_get_lost(snd_timer_status_t * status);
+long snd_timer_status_get_overrun(snd_timer_status_t * status);
+long snd_timer_status_get_queue(snd_timer_status_t * status);
+
+/* deprecated functions, for compatibility */
+long snd_timer_info_get_ticks(snd_timer_info_t * info);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /** __ALSA_TIMER_H */
+
diff --git a/thirdparty/linuxbsd_headers/alsa/topology.h b/thirdparty/linuxbsd_headers/alsa/topology.h
new file mode 100644
index 0000000000..593eaa6155
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/topology.h
@@ -0,0 +1,1096 @@
+/*
+ *
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright (C) 2015 Intel Corporation
+ *
+ */
+
+#ifndef __ALSA_TOPOLOGY_H
+#define __ALSA_TOPOLOGY_H
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup topology Topology Interface
+ * \{
+ */
+
+/*! \page topology ALSA Topology Interface
+ *
+ * The topology interface allows developers to define DSP topologies in a text
+ * file format and to convert the text topology to a binary topology
+ * representation that can be understood by the kernel. The topology core
+ * currently recognises the following object types :-
+ *
+ * * Controls (mixer, enumerated and byte) including TLV data.
+ * * PCMs (Front End DAI & DAI link)
+ * * DAPM widgets
+ * * DAPM graph elements.
+ * * Physical DAI & DAI links
+ * * Private data for each object type.
+ * * Manifest (containing count of each object type)
+ *
+ * <h3>Topology File Format</h3>
+ *
+ * The topology text format uses the standard ALSA configuration file format to
+ * describe each topology object type. This allows topology objects to include
+ * other topology objects as part of their definition. i.e. a TLV data object
+ * can be shared amongst many control objects that use the same TLV data.
+ *
+ *
+ * <h4>Controls</h4>
+ * Topology audio controls can belong to three different types :-
+ * * Mixer control
+ * * Enumerated control
+ * * Byte control
+ *
+ * Each control type can contain TLV data, private data, operations and also
+ * belong to widget objects.<br>
+ *
+ * <h5>Control Operations</h5>
+ * Driver Kcontrol callback info(), get() and put() operations are mapped with
+ * the CTL ops section in topology configuration files. The ctl ops section can
+ * assign operations using the standard names (listed below) for the standard
+ * kcontrol types or use ID numbers (>256) to map to bespoke driver controls.<br>
+ *
+ * <pre>
+ *
+ * ops."ctl" {
+ * info "volsw"
+ * get "257"
+ * put "257"
+ * }
+ *
+ * </pre>
+ *
+ * This mapping shows info() using the standard "volsw" info callback whilst
+ * the get() and put() are mapped to bespoke driver callbacks. <br>
+ *
+ * The Standard operations names for control get(), put() and info calls
+ * are :-
+ * * volsw
+ * * volsw_sx
+ * * volsw_xr_sx
+ * * enum
+ * * bytes
+ * * enum_value
+ * * range
+ * * strobe
+ *
+* <h5>Control Access</h5>
+ * Controls access can be specified using the "access" section. If no "access"
+ * section is defined then default RW access flags are set for normal and TLV
+ * controls.
+ *
+ * <pre>
+ * access [
+ * read
+ * write
+ * tlv_command
+ * ]
+ * </pre>
+ *
+ * The standard access flags are as follows :-
+ * * read
+ * * write
+ * * read_write
+ * * volatile
+ * * timestamp
+ * * tlv_read
+ * * tlv_write
+ * * tlv_read_write
+ * * tlv_command
+ * * inactive
+ * * lock
+ * * owner
+ * * tlv_callback
+ * * user
+ *
+ * <h5>Control TLV Data</h5>
+ * Controls can also use TLV data to represent dB information. This can be done
+ * by defining a TLV section and using the TLV section within the control.
+ * The TLV data for DBScale types are defined as follows :-
+ *
+ * <pre>
+ * scale {
+ * min "-9000"
+ * step "300"
+ * mute "1"
+ * }
+ * </pre>
+ *
+ * Where the meanings and values for min, step and mute are exactly the same
+ * as defined in driver code.
+ *
+ * <h5>Control Channel Mapping</h5>
+ * Controls can also specify which channels they are mapped with. This is useful
+ * for userspace as it allows applications to determine the correct control
+ * channel for Left and Right etc. Channel maps are defined as follows :-
+ *
+ * <pre>
+ * channel."name" {
+ * reg "0"
+ * shift "0"
+ * }
+ * </pre>
+ *
+ * The channel map reg is the register offset for the control, shift is the
+ * bit shift within the register for the channel and the section name is the
+ * channel name and can be one of the following :-
+ *
+ * <pre>
+ * * mono # mono stream
+ * * fl # front left
+ * * fr # front right
+ * * rl # rear left
+ * * rr # rear right
+ * * fc # front center
+ * * lfe # LFE
+ * * sl # side left
+ * * sr # side right
+ * * rc # rear center
+ * * flc # front left center
+ * * frc # front right center
+ * * rlc # rear left center
+ * * rrc # rear right center
+ * * flw # front left wide
+ * * frw # front right wide
+ * * flh # front left high
+ * * fch # front center high
+ * * frh # front right high
+ * * tc # top center
+ * * tfl # top front left
+ * * tfr # top front right
+ * * tfc # top front center
+ * * trl # top rear left
+ * * trr # top rear right
+ * * trc # top rear center
+ * * tflc # top front left center
+ * * tfrc # top front right center
+ * * tsl # top side left
+ * * tsr # top side right
+ * * llfe # left LFE
+ * * rlfe # right LFE
+ * * bc # bottom center
+ * * blc # bottom left center
+ * * brc # bottom right center
+ * </pre>
+ *
+ * <h5>Control Private Data</h5>
+ * Controls can also have private data. This can be done by defining a private
+ * data section and including the section within the control. The private data
+ * section is defined as follows :-
+ *
+ * <pre>
+ * SectionData."pdata for EQU1" {
+ * file "/path/to/file"
+ * bytes "0x12,0x34,0x56,0x78"
+ * shorts "0x1122,0x3344,0x5566,0x7788"
+ * words "0xaabbccdd,0x11223344,0x66aa77bb,0xefef1234"
+ * tuples "section id of the vendor tuples"
+ * };
+ * </pre>
+ * The file, bytes, shorts, words and tuples keywords are all mutually
+ * exclusive as the private data should only be taken from one source.
+ * The private data can either be read from a separate file or defined in
+ * the topology file using the bytes, shorts, words or tuples keywords.
+ * The keyword tuples is to define vendor specific tuples. Please refer to
+ * section Vendor Tokens and Vendor tuples.
+ *
+ * <h5>How to define an element with private data</h5>
+ * An element can refer to a single data section or multiple data
+ * sections.
+ *
+ * <h6>To refer to a single data section:</h6>
+ * <pre>
+ * Sectionxxx."element name" {
+ * ...
+ * data "name of data section" # optional private data
+ * }
+ * </pre>
+ *
+ * <h6>To refer to multiple data sections:</h6>
+ * <pre>
+ * Sectionxxx."element name" {
+ * ...
+ * data [ # optional private data
+ * "name of 1st data section"
+ * "name of 2nd data section"
+ * ...
+ * ]
+ * }
+ * </pre>
+ * And data of these sections will be merged in the same order as they are
+ * in the list, as the element's private data for kernel.
+ *
+ * </pre>
+ *
+ * <h6>Vendor Tokens</h6>
+ * A vendor token list is defined as a new section. Each token element is
+ * a pair of string ID and integer value. And both the ID and value are
+ * vendor-specific.
+ *
+ * <pre>
+ * SectionVendorTokens."id of the vendor tokens" {
+ * comment "optional comments"
+ * VENDOR_TOKEN_ID1 "1"
+ * VENDOR_TOKEN_ID2 "2"
+ * VENDOR_TOKEN_ID3 "3"
+ * ...
+ * }
+ * </pre>
+ *
+ * <h6>Vendor Tuples</h6>
+ * Vendor tuples are defined as a new section. It contains a reference to
+ * a vendor token list and several tuple arrays.
+ * All arrays share a vendor token list, defined by the tokens keyword.
+ * Each tuple array is for a specific type, defined by the string following
+ * the tuples keyword. Supported types are: string, uuid, bool, byte,
+ * short and word.
+ *
+ * <pre>
+ * SectionVendorTuples."id of the vendor tuples" {
+ * tokens "id of the vendor tokens"
+ *
+ * tuples."string" {
+ * VENDOR_TOKEN_ID1 "character string"
+ * ...
+ * }
+ *
+ * tuples."uuid" { # 16 characters separated by commas
+ * VENDOR_TOKEN_ID2 "0x01,0x02,...,0x0f"
+ * ...
+ * }
+ *
+ * tuples."bool" {
+ * VENDOR_TOKEN_ID3 "true/false"
+ * ...
+ * }
+ *
+ * tuples."byte" {
+ * VENDOR_TOKEN_ID4 "0x11"
+ * VENDOR_TOKEN_ID5 "0x22"
+ * ...
+ * }
+ *
+ * tuples."short" {
+ * VENDOR_TOKEN_ID6 "0x1122"
+ * VENDOR_TOKEN_ID7 "0x3344"
+ * ...
+ * }
+ *
+ * tuples."word" {
+ * VENDOR_TOKEN_ID8 "0x11223344"
+ * VENDOR_TOKEN_ID9 "0x55667788"
+ * ...
+ * }
+ * }
+ * </pre>
+ * To define multiple vendor tuples of same type, please append some
+ * characters after the type string ("string", "uuid", "bool", "byte", "short"
+ * or "word"), to avoid ID duplication in the SectionVendorTuples.<br>
+ * The parser will check the first few characters in ID to get the tuple type.
+ * Here is an example:
+ * <pre>
+ * SectionVendorTuples."id of the vendor tuples" {
+ * ...
+ * tuples."word.module0" {
+ * VENDOR_TOKEN_PARAM_ID1 "0x00112233"
+ * VENDOR_TOKEN_PARAM_ID2 "0x44556677"
+ * ...
+ * }
+ *
+ * tuples."word.module2" {
+ * VENDOR_TOKEN_PARAM_ID1 "0x11223344"
+ * VENDOR_TOKEN_PARAM_ID2 "0x55667788"
+ * ...
+ * }
+ * ...
+ * }
+ *
+ * </pre>
+ *
+ * <h5>Mixer Controls</h5>
+ * A mixer control is defined as a new section that can include channel mapping,
+ * TLV data, callback operations and private data. The mixer section also
+ * includes a few other config options that are shown here :-
+ *
+ * <pre>
+ * SectionControlMixer."mixer name" {
+ * comment "optional comments"
+ *
+ * index "1" # Index number
+ *
+ * channel."name" { # Channel maps
+ * ....
+ * }
+ *
+ * ops."ctl" { # Ops callback functions
+ * ....
+ * }
+ *
+ * max "32" # Max control value
+ * invert "0" # Whether control values are inverted
+ *
+ * tlv "tld_data" # optional TLV data
+ *
+ * data "pdata for mixer1" # optional private data
+ * }
+ * </pre>
+ *
+ * The section name is used to define the mixer name. The index number can be
+ * used to identify topology objects groups. This allows driver operations on
+ * objects with index number N and can be used to add/remove pipelines of
+ * objects whilst other objects are unaffected.
+ *
+ * <h5>Byte Controls</h5>
+ * A byte control is defined as a new section that can include channel mapping,
+ * TLV data, callback operations and private data. The bytes section also
+ * includes a few other config options that are shown here :-
+ *
+ * <pre>
+ * SectionControlBytes."name" {
+ * comment "optional comments"
+ *
+ * index "1" # Index number
+ *
+ * channel."name" { # Channel maps
+ * ....
+ * }
+ *
+ * ops."ctl" { # Ops callback functions
+ * ....
+ * }
+ *
+ * base "0" # Register base
+ * num_regs "16" # Number of registers
+ * mask "0xff" # Mask
+ * max "255" # Maximum value
+ *
+ * tlv "tld_data" # optional TLV data
+ *
+ * data "pdata for mixer1" # optional private data
+ * }
+ * </pre>
+ *
+ * <h5>Enumerated Controls</h5>
+ * A enumerated control is defined as a new section (like mixer and byte) that
+ * can include channel mapping, callback operations, private data and
+ * text strings to represent the enumerated control options.<br>
+ *
+ * The text strings for the enumerated controls are defined in a separate
+ * section as follows :-
+ *
+ * <pre>
+ * SectionText."name" {
+ *
+ * Values [
+ * "value1"
+ * "value2"
+ "value3"
+ * ]
+ * }
+ * </pre>
+ *
+ * All the enumerated text values are listed in the values list.<br>
+ * The enumerated control is similar to the other controls and defined as
+ * follows :-
+ *
+ * <pre>
+ * SectionControlMixer."name" {
+ * comment "optional comments"
+ *
+ * index "1" # Index number
+ *
+ * texts "EQU1" # Enumerated text items
+ *
+ * channel."name" { # Channel maps
+ * ....
+ * }
+ *
+ * ops."ctl" { # Ops callback functions
+ * ....
+ * }
+ *
+ * data "pdata for mixer1" # optional private data
+ * }
+ * </pre>
+ *
+ * <h4>DAPM Graph</h4>
+ * DAPM graphs can easily be defined using the topology file. The format is
+ * very similar to the DAPM graph kernel format. :-
+ *
+ * <pre>
+ * SectionGraph."dsp" {
+ * index "1" # Index number
+ *
+ * lines [
+ * "sink1, control, source1"
+ * "sink2, , source2"
+ * ]
+ * }
+ * </pre>
+ *
+ * The lines in the graph are defined as a variable size list of sinks,
+ * controls and sources. The control name is optional as some graph lines have
+ * no associated controls. The section name can be used to differentiate the
+ * graph with other graphs, it's not used by the kernel atm.
+ *
+ * <h4>DAPM Widgets</h4>
+ * DAPM widgets are similar to controls in that they can include many other
+ * objects. Widgets can contain private data, mixer controls and enum controls.
+ *
+ * The following widget types are supported and match the driver types :-
+ *
+ * * input
+ * * output
+ * * mux
+ * * mixer
+ * * pga
+ * * out_drv
+ * * adc
+ * * dac
+ * * switch
+ * * pre
+ * * post
+ * * aif_in
+ * * aif_out
+ * * dai_in
+ * * dai_out
+ * * dai_link
+ *
+ * Widgets are defined as follows :-
+ *
+ * <pre>
+ * SectionWidget."name" {
+ *
+ * index "1" # Index number
+ *
+ * type "aif_in" # Widget type - detailed above
+ * stream_name "name" # Stream name
+ *
+ * no_pm "true" # No PM control bit.
+ * reg "20" # PM bit register offset
+ * shift "0" # PM bit register shift
+ * invert "1 # PM bit is inverted
+ * subseq "8" # subsequence number
+ *
+ * event_type "1" # DAPM widget event type
+ * event_flags "1" # DAPM widget event flags
+ *
+ * mixer "name" # Optional Mixer Control
+ * enum "name" # Optional Enum Control
+ *
+ * data "name" # optional private data
+ * }
+ * </pre>
+ *
+ * The section name is the widget name. The mixer and enum fields are mutually
+ * exclusive and used to include controls into the widget. The index and data
+ * fields are the same for widgets as they are for controls whilst the other
+ * fields map on very closely to the driver widget fields.
+ *
+ * <h5>Widget Private Data</h5>
+ * Widget can have private data. For the format of the private data, please
+ * refer to section Control Private Data.
+ *
+ * <h4>PCM Capabilities</h4>
+ * Topology can also define the PCM capabilities of front end or physical DAIs.
+ * Capabilities can be defined with the following section :-
+ *
+ * <pre>
+ * SectionPCMCapabilities."name" {
+ *
+ * formats "S24_LE,S16_LE" # Supported formats
+ * rate_min "48000" # Max supported sample rate
+ * rate_max "48000" # Min supported sample rate
+ * channels_min "2" # Min number of channels
+ * channels_max "2" # max number of channels
+ * }
+ * </pre>
+ * The supported formats use the same naming convention as the driver macros.
+ * The PCM capabilities name can be referred to and included by PCM and
+ * physical DAI sections.
+ *
+ * <h4>PCM Configurations</h4>
+ * PCM runtime configurations can be defined for playback and capture stream
+ * directions with the following section :-
+ *
+ * <pre>
+ * SectionPCMConfig."name" {
+ *
+ * config."playback" { # playback config
+ * format "S16_LE" # playback format
+ * rate "48000" # playback sample rate
+ * channels "2" # playback channels
+ * tdm_slot "0xf" # playback TDM slot
+ * }
+ *
+ * config."capture" { # capture config
+ * format "S16_LE" # capture format
+ * rate "48000" # capture sample rate
+ * channels "2" # capture channels
+ * tdm_slot "0xf" # capture TDM slot
+ * }
+ * }
+ * </pre>
+ *
+ * The supported formats use the same naming convention as the driver macros.
+ * The PCM configuration name can be referred to and included by PCM and
+ * physical link sections.
+ *
+ * <h4>PCM (Front-end DAI & DAI link) </h4>
+ * PCM sections define the supported capabilities and configurations for
+ * supported playback and capture streams, names and flags for front end
+ * DAI & DAI links. Topology kernel driver will use a PCM object to create
+ * a pair of FE DAI & DAI links.
+ *
+ * <pre>
+ * SectionPCM."name" {
+ *
+ * index "1" # Index number
+ *
+ * id "0" # used for binding to the PCM
+ *
+ * dai."name of front-end DAI" {
+ * id "0" # used for binding to the front-end DAI
+ * }
+ *
+ * pcm."playback" {
+ * capabilities "capabilities1" # capabilities for playback
+ *
+ * configs [ # supported configs for playback
+ * "config1"
+ * "config2"
+ * ]
+ * }
+ *
+ * pcm."capture" {
+ * capabilities "capabilities2" # capabilities for capture
+ *
+ * configs [ # supported configs for capture
+ * "config1"
+ * "config2"
+ * "config3"
+ * ]
+ * }
+ *
+ * # Optional boolean flags
+ * symmetric_rates "true"
+ * symmetric_channels "true"
+ * symmetric_sample_bits "false"
+ *
+ * data "name" # optional private data
+ * }
+ * </pre>
+ *
+ * <h4>Physical DAI Link Configurations</h4>
+ * The runtime configurations of a physical DAI link can be defined by
+ * SectionLink. <br> Backend DAI links belong to physical links, and can
+ * be configured by either SectionLink or SectionBE, with same syntax.
+ * But SectionBE is deprecated atm since the internal processing is
+ * actually same.
+ *
+ * <pre>
+ * SectionLink."name" {
+ *
+ * index "1" # Index number
+ *
+ * id "0" # used for binding to the link
+ *
+ * stream_name "name" # used for binding to the link
+ *
+ * hw_configs [ # runtime supported HW configurations, optional
+ * "config1"
+ * "config2"
+ * ...
+ * ]
+ *
+ * default_hw_conf_id "1" #default HW config ID for init
+ *
+ * # Optional boolean flags
+ * symmetric_rates "true"
+ * symmetric_channels "false"
+ * symmetric_sample_bits "true"
+ *
+ * data "name" # optional private data
+ * }
+ * </pre>
+ *
+ * A physical link can refer to multiple runtime supported hardware
+ * configurations, which is defined by SectionHWConfig.
+ *
+ * <pre>
+ * SectionHWConfig."name" {
+ *
+ * id "1" # used for binding to the config
+ * format "I2S" # physical audio format.
+ * bclk "master" # Platform is master of bit clock
+ * fsync "slave" # Platform is slave of fsync
+ * }
+ * </pre>
+ *
+ * <h4>Physical DAI</h4>
+ * A physical DAI (e.g. backend DAI for DPCM) is defined as a new section
+ * that can include a unique ID, playback and capture stream capabilities,
+ * optional flags, and private data. <br>
+ * Its PCM stream capablities are same as those for PCM objects,
+ * please refer to section 'PCM Capabilities'.
+ *
+ * <pre>
+ * SectionDAI."name" {
+ *
+ * index "1" # Index number
+ *
+ * id "0" # used for binding to the Backend DAI
+ *
+ * pcm."playback" {
+ * capabilities "capabilities1" # capabilities for playback
+ * }
+ *
+ * pcm."capture" {
+ * capabilities "capabilities2" # capabilities for capture
+ * }
+ *
+ * symmetric_rates "true" # optional flags
+ * symmetric_channels "true"
+ * symmetric_sample_bits "false"
+ *
+ * data "name" # optional private data
+ * }
+ * </pre>
+ *
+ * <h4>Manifest Private Data</h4>
+ * Manfiest may have private data. Users need to define a manifest section
+ * and add the references to 1 or multiple data sections. Please refer to
+ * section 'How to define an element with private data'. <br>
+ * And the text conf file can have at most 1 manifest section. <br><br>
+ *
+ * Manifest section is defined as follows :-
+ *
+ * <pre>
+ * SectionManifest"name" {
+ *
+ * data "name" # optional private data
+ * }
+ * </pre>
+ *
+ * <h4>Include other files</h4>
+ * Users may include other files in a text conf file via alsaconf syntax
+ * <path/to/configuration-file>. This allows users to define common info
+ * in separate files (e.g. vendor tokens, tuples) and share them for
+ * different platforms, thus save the total size of config files. <br>
+ * Users can also specifiy additional configuraiton directories relative
+ * to "/usr/share/alsa/" to search the included files, via alsaconf syntax
+ * <searchfdir:/relative-path/to/usr/share/alsa>. <br><br>
+ *
+ * For example, file A and file B are two text conf files for platform X,
+ * they will be installed to /usr/share/alsa/topology/platformx. If we
+ * need file A to include file B, in file A we can add: <br>
+ *
+ * <searchdir:topology/platformx> <br>
+ * <name-of-file-B> <br><br>
+ *
+ * ALSA conf will search and open an included file in the following order
+ * of priority:
+ * 1. directly open the file by its name;
+ * 2. search for the file name in "/usr/share/alsa";
+ * 3. search for the file name in user specified subdirectories under
+ * "/usr/share/alsa".
+ *
+ * The order of the included files need not to be same as their
+ * dependencies, since the topology library will load them all before
+ * parsing their dependencies. <br>
+ *
+ * The configuration directories defined by a file will only be used to search
+ * the files included by this file.
+ */
+
+/** Maximum number of channels supported in one control */
+#define SND_TPLG_MAX_CHAN 8
+
+/** Topology context */
+typedef struct snd_tplg snd_tplg_t;
+
+/** Topology object types */
+enum snd_tplg_type {
+ SND_TPLG_TYPE_TLV = 0, /*!< TLV Data */
+ SND_TPLG_TYPE_MIXER, /*!< Mixer control*/
+ SND_TPLG_TYPE_ENUM, /*!< Enumerated control */
+ SND_TPLG_TYPE_TEXT, /*!< Text data */
+ SND_TPLG_TYPE_DATA, /*!< Private data */
+ SND_TPLG_TYPE_BYTES, /*!< Byte control */
+ SND_TPLG_TYPE_STREAM_CONFIG, /*!< PCM Stream configuration */
+ SND_TPLG_TYPE_STREAM_CAPS, /*!< PCM Stream capabilities */
+ SND_TPLG_TYPE_PCM, /*!< PCM stream device */
+ SND_TPLG_TYPE_DAPM_WIDGET, /*!< DAPM widget */
+ SND_TPLG_TYPE_DAPM_GRAPH, /*!< DAPM graph elements */
+ SND_TPLG_TYPE_BE, /*!< BE DAI link */
+ SND_TPLG_TYPE_CC, /*!< Hostless codec <-> codec link */
+ SND_TPLG_TYPE_MANIFEST, /*!< Topology manifest */
+ SND_TPLG_TYPE_TOKEN, /*!< Vendor tokens */
+ SND_TPLG_TYPE_TUPLE, /*!< Vendor tuples */
+ SND_TPLG_TYPE_LINK, /*!< Physical DAI link */
+ SND_TPLG_TYPE_HW_CONFIG, /*!< Link HW config */
+ SND_TPLG_TYPE_DAI, /*!< Physical DAI */
+};
+
+/**
+ * \brief Create a new topology parser instance.
+ * \return New topology parser instance
+ */
+snd_tplg_t *snd_tplg_new(void);
+
+/**
+ * \brief Free a topology parser instance.
+ * \param tplg Topology parser instance
+ */
+void snd_tplg_free(snd_tplg_t *tplg);
+
+/**
+ * \brief Parse and build topology text file into binary file.
+ * \param tplg Topology instance.
+ * \param infile Topology text input file to be parsed
+ * \param outfile Binary topology output file.
+ * \return Zero on success, otherwise a negative error code
+ */
+int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile,
+ const char *outfile);
+
+/**
+ * \brief Enable verbose reporting of binary file output
+ * \param tplg Topology Instance
+ * \param verbose Enable verbose output level if non zero
+ */
+void snd_tplg_verbose(snd_tplg_t *tplg, int verbose);
+
+/** \struct snd_tplg_tlv_template
+ * \brief Template type for all TLV objects.
+ */
+struct snd_tplg_tlv_template {
+ int type; /*!< TLV type SNDRV_CTL_TLVT_ */
+};
+
+/** \struct snd_tplg_tlv_dbscale_template
+ * \brief Template type for TLV Scale objects.
+ */
+struct snd_tplg_tlv_dbscale_template {
+ struct snd_tplg_tlv_template hdr; /*!< TLV type header */
+ int min; /*!< dB minimum value in 0.1dB */
+ int step; /*!< dB step size in 0.1dB */
+ int mute; /*!< is min dB value mute ? */
+};
+
+/** \struct snd_tplg_channel_template
+ * \brief Template type for single channel mapping.
+ */
+struct snd_tplg_channel_elem {
+ int size; /*!< size in bytes of this structure */
+ int reg; /*!< channel control register */
+ int shift; /*!< channel shift for control bits */
+ int id; /*!< ID maps to Left, Right, LFE etc */
+};
+
+/** \struct snd_tplg_channel_map_template
+ * \brief Template type for channel mapping.
+ */
+struct snd_tplg_channel_map_template {
+ int num_channels; /*!< number of channel mappings */
+ struct snd_tplg_channel_elem channel[SND_TPLG_MAX_CHAN]; /*!< mapping */
+};
+
+/** \struct snd_tplg_pdata_template
+ * \brief Template type for private data objects.
+ */
+struct snd_tplg_pdata_template {
+ unsigned int length; /*!< data length */
+ const void *data; /*!< data */
+};
+
+/** \struct snd_tplg_io_ops_template
+ * \brief Template type for object operations mapping.
+ */
+struct snd_tplg_io_ops_template {
+ int get; /*!< get callback ID */
+ int put; /*!< put callback ID */
+ int info; /*!< info callback ID */
+};
+
+/** \struct snd_tplg_ctl_template
+ * \brief Template type for control objects.
+ */
+struct snd_tplg_ctl_template {
+ int type; /*!< Control type */
+ const char *name; /*!< Control name */
+ int access; /*!< Control access */
+ struct snd_tplg_io_ops_template ops; /*!< operations */
+ struct snd_tplg_tlv_template *tlv; /*!< non NULL means we have TLV data */
+};
+
+/** \struct snd_tplg_mixer_template
+ * \brief Template type for mixer control objects.
+ */
+struct snd_tplg_mixer_template {
+ struct snd_tplg_ctl_template hdr; /*!< control type header */
+ struct snd_tplg_channel_map_template *map; /*!< channel map */
+ int min; /*!< min value for mixer */
+ int max; /*!< max value for mixer */
+ int platform_max; /*!< max value for platform control */
+ int invert; /*!< whether controls bits are inverted */
+ struct snd_soc_tplg_private *priv; /*!< control private data */
+};
+
+/** \struct snd_tplg_enum_template
+ * \brief Template type for enumerated control objects.
+ */
+struct snd_tplg_enum_template {
+ struct snd_tplg_ctl_template hdr; /*!< control type header */
+ struct snd_tplg_channel_map_template *map; /*!< channel map */
+ int items; /*!< number of enumerated items in control */
+ int mask; /*!< register mask size */
+ const char **texts; /*!< control text items */
+ const int **values; /*!< control value items */
+ struct snd_soc_tplg_private *priv; /*!< control private data */
+};
+
+/** \struct snd_tplg_bytes_template
+ * \brief Template type for TLV Scale objects.
+ */
+struct snd_tplg_bytes_template {
+ struct snd_tplg_ctl_template hdr; /*!< control type header */
+ int max; /*!< max byte control value */
+ int mask; /*!< byte control mask */
+ int base; /*!< base register */
+ int num_regs; /*!< number of registers */
+ struct snd_tplg_io_ops_template ext_ops; /*!< ops mapping */
+ struct snd_soc_tplg_private *priv; /*!< control private data */
+};
+
+/** \struct snd_tplg_graph_elem
+ * \brief Template type for single DAPM graph element.
+ */
+struct snd_tplg_graph_elem {
+ const char *src; /*!< source widget name */
+ const char *ctl; /*!< control name or NULL if no control */
+ const char *sink; /*!< sink widget name */
+};
+
+/** \struct snd_tplg_graph_template
+ * \brief Template type for array of DAPM graph elements.
+ */
+struct snd_tplg_graph_template {
+ int count; /*!< Number of graph elements */
+ struct snd_tplg_graph_elem elem[0]; /*!< graph elements */
+};
+
+/** \struct snd_tplg_widget_template
+ * \brief Template type for DAPM widget objects.
+ */
+struct snd_tplg_widget_template {
+ int id; /*!< SND_SOC_DAPM_CTL */
+ const char *name; /*!< widget name */
+ const char *sname; /*!< stream name (certain widgets only) */
+ int reg; /*!< negative reg = no direct dapm */
+ int shift; /*!< bits to shift */
+ int mask; /*!< non-shifted mask */
+ int subseq; /*!< sort within widget type */
+ unsigned int invert; /*!< invert the power bit */
+ unsigned int ignore_suspend; /*!< kept enabled over suspend */
+ unsigned short event_flags; /*!< PM event sequence flags */
+ unsigned short event_type; /*!< PM event sequence type */
+ struct snd_soc_tplg_private *priv; /*!< widget private data */
+ int num_ctls; /*!< Number of controls used by widget */
+ struct snd_tplg_ctl_template *ctl[0]; /*!< array of widget controls */
+};
+
+/** \struct snd_tplg_stream_template
+ * \brief Stream configurations.
+ */
+struct snd_tplg_stream_template {
+ const char *name; /*!< name of the stream config */
+ int format; /*!< SNDRV_PCM_FMTBIT_* */
+ int rate; /*!< SNDRV_PCM_RATE_* */
+ int period_bytes; /*!< size of period in bytes */
+ int buffer_bytes; /*!< size of buffer in bytes. */
+ int channels; /*!< number of channels */
+};
+
+/** \struct snd_tplg_stream_caps_template
+ * \brief Stream Capabilities.
+ */
+struct snd_tplg_stream_caps_template {
+ const char *name; /*!< name of the stream caps */
+ uint64_t formats; /*!< supported formats SNDRV_PCM_FMTBIT_* */
+ unsigned int rates; /*!< supported rates SNDRV_PCM_RATE_* */
+ unsigned int rate_min; /*!< min rate */
+ unsigned int rate_max; /*!< max rate */
+ unsigned int channels_min; /*!< min channels */
+ unsigned int channels_max; /*!< max channels */
+ unsigned int periods_min; /*!< min number of periods */
+ unsigned int periods_max; /*!< max number of periods */
+ unsigned int period_size_min; /*!< min period size bytes */
+ unsigned int period_size_max; /*!< max period size bytes */
+ unsigned int buffer_size_min; /*!< min buffer size bytes */
+ unsigned int buffer_size_max; /*!< max buffer size bytes */
+ unsigned int sig_bits; /*!< number of bits of content */
+};
+
+/** \struct snd_tplg_pcm_template
+ * \brief Template type for PCM (FE DAI & DAI links).
+ */
+struct snd_tplg_pcm_template {
+ const char *pcm_name; /*!< PCM stream name */
+ const char *dai_name; /*!< DAI name */
+ unsigned int pcm_id; /*!< unique ID - used to match */
+ unsigned int dai_id; /*!< unique ID - used to match */
+ unsigned int playback; /*!< supports playback mode */
+ unsigned int capture; /*!< supports capture mode */
+ unsigned int compress; /*!< 1 = compressed; 0 = PCM */
+ struct snd_tplg_stream_caps_template *caps[2]; /*!< playback & capture for DAI */
+ unsigned int flag_mask; /*!< bitmask of flags to configure */
+ unsigned int flags; /*!< flag value SND_SOC_TPLG_LNK_FLGBIT_* */
+ struct snd_soc_tplg_private *priv; /*!< private data */
+ int num_streams; /*!< number of supported configs */
+ struct snd_tplg_stream_template stream[0]; /*!< supported configs */
+};
+
+ /** \struct snd_tplg_hw_config_template
+ * \brief Template type to describe a physical link runtime supported
+ * hardware config, i.e. hardware audio formats.
+ */
+struct snd_tplg_hw_config_template {
+ int id; /* unique ID - - used to match */
+ unsigned int fmt; /* SND_SOC_DAI_FORMAT_ format value */
+ unsigned char clock_gated; /* 1 if clock can be gated to save power */
+ unsigned char invert_bclk; /* 1 for inverted BCLK, 0 for normal */
+ unsigned char invert_fsync; /* 1 for inverted frame clock, 0 for normal */
+ unsigned char bclk_master; /* 1 for master of BCLK, 0 for slave */
+ unsigned char fsync_master; /* 1 for master of FSYNC, 0 for slave */
+ unsigned char mclk_direction; /* 0 for input, 1 for output */
+ unsigned short reserved; /* for 32bit alignment */
+ unsigned int mclk_rate; /* MCLK or SYSCLK freqency in Hz */
+ unsigned int bclk_rate; /* BCLK freqency in Hz */
+ unsigned int fsync_rate; /* frame clock in Hz */
+ unsigned int tdm_slots; /* number of TDM slots in use */
+ unsigned int tdm_slot_width; /* width in bits for each slot */
+ unsigned int tx_slots; /* bit mask for active Tx slots */
+ unsigned int rx_slots; /* bit mask for active Rx slots */
+ unsigned int tx_channels; /* number of Tx channels */
+ unsigned int *tx_chanmap; /* array of slot number */
+ unsigned int rx_channels; /* number of Rx channels */
+ unsigned int *rx_chanmap; /* array of slot number */
+};
+
+/** \struct snd_tplg_dai_template
+ * \brief Template type for physical DAI.
+ * It can be used to configure backend DAIs for DPCM.
+ */
+struct snd_tplg_dai_template {
+ const char *dai_name; /*!< DAI name */
+ unsigned int dai_id; /*!< unique ID - used to match */
+ unsigned int playback; /*!< supports playback mode */
+ unsigned int capture; /*!< supports capture mode */
+ struct snd_tplg_stream_caps_template *caps[2]; /*!< playback & capture for DAI */
+ unsigned int flag_mask; /*!< bitmask of flags to configure */
+ unsigned int flags; /*!< SND_SOC_TPLG_DAI_FLGBIT_* */
+ struct snd_soc_tplg_private *priv; /*!< private data */
+
+};
+
+/** \struct snd_tplg_link_template
+ * \brief Template type for physical DAI Links.
+ */
+struct snd_tplg_link_template {
+ const char *name; /*!< link name, used to match */
+ int id; /*!< unique ID - used to match with existing physical links */
+ const char *stream_name; /*!< link stream name, used to match */
+
+ int num_streams; /*!< number of configs */
+ struct snd_tplg_stream_template *stream; /*!< supported configs */
+
+ struct snd_tplg_hw_config_template *hw_config; /*!< supported HW configs */
+ int num_hw_configs; /* number of hw configs */
+ int default_hw_config_id; /* default hw config ID for init */
+
+ unsigned int flag_mask; /* bitmask of flags to configure */
+ unsigned int flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
+ struct snd_soc_tplg_private *priv; /*!< private data */
+};
+
+/** \struct snd_tplg_obj_template
+ * \brief Generic Template Object
+ */
+typedef struct snd_tplg_obj_template {
+ enum snd_tplg_type type; /*!< template object type */
+ int index; /*!< group index for object */
+ int version; /*!< optional vendor specific version details */
+ int vendor_type; /*!< optional vendor specific type info */
+ union {
+ struct snd_tplg_widget_template *widget; /*!< DAPM widget */
+ struct snd_tplg_mixer_template *mixer; /*!< Mixer control */
+ struct snd_tplg_bytes_template *bytes_ctl; /*!< Bytes control */
+ struct snd_tplg_enum_template *enum_ctl; /*!< Enum control */
+ struct snd_tplg_graph_template *graph; /*!< Graph elements */
+ struct snd_tplg_pcm_template *pcm; /*!< PCM elements */
+ struct snd_tplg_link_template *link; /*!< physical DAI Links */
+ struct snd_tplg_dai_template *dai; /*!< Physical DAI */
+ };
+} snd_tplg_obj_template_t;
+
+/**
+ * \brief Register topology template object.
+ * \param tplg Topology instance.
+ * \param t Template object.
+ * \return Zero on success, otherwise a negative error code
+ */
+int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t);
+
+/**
+ * \brief Build all registered topology data into binary file.
+ * \param tplg Topology instance.
+ * \param outfile Binary topology output file.
+ * \return Zero on success, otherwise a negative error code
+ */
+int snd_tplg_build(snd_tplg_t *tplg, const char *outfile);
+
+/**
+ * \brief Attach private data to topology manifest.
+ * \param tplg Topology instance.
+ * \param data Private data.
+ * \param len Length of data in bytes.
+ * \return Zero on success, otherwise a negative error code
+ */
+int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len);
+
+/**
+ * \brief Set an optional vendor specific version number.
+ * \param tplg Topology instance.
+ * \param version Vendor specific version number.
+ * \return Zero on success, otherwise a negative error code
+ */
+int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version);
+
+/* \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_TOPOLOGY_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/use-case.h b/thirdparty/linuxbsd_headers/alsa/use-case.h
new file mode 100644
index 0000000000..8911645b5c
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/use-case.h
@@ -0,0 +1,432 @@
+/**
+ * \file include/use-case.h
+ * \brief use case interface for the ALSA driver
+ * \author Liam Girdwood <lrg@slimlogic.co.uk>
+ * \author Stefan Schmidt <stefan@slimlogic.co.uk>
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Justin Xu <justinx@slimlogic.co.uk>
+ * \date 2008-2010
+ */
+/*
+ *
+ * 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; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright (C) 2008-2010 SlimLogic Ltd
+ * Copyright (C) 2010 Wolfson Microelectronics PLC
+ * Copyright (C) 2010 Texas Instruments Inc.
+ *
+ * Support for the verb/device/modifier core logic and API,
+ * command line tool and file parser was kindly sponsored by
+ * Texas Instruments Inc.
+ * Support for multiple active modifiers and devices,
+ * transition sequences, multiple client access and user defined use
+ * cases was kindly sponsored by Wolfson Microelectronics PLC.
+ */
+
+#ifndef __ALSA_USE_CASE_H
+#define __ALSA_USE_CASE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup ucm Use Case Interface
+ * The ALSA Use Case manager interface.
+ * See \ref Usecase page for more details.
+ * \{
+ */
+
+/*! \page Usecase ALSA Use Case Interface
+ *
+ * The use case manager works by configuring the sound card ALSA kcontrols to
+ * change the hardware digital and analog audio routing to match the requested
+ * device use case. The use case manager kcontrol configurations are stored in
+ * easy to modify text files.
+ *
+ * An audio use case can be defined by a verb and device parameter. The verb
+ * describes the use case action i.e. a phone call, listening to music, recording
+ * a conversation etc. The device describes the physical audio capture and playback
+ * hardware i.e. headphones, phone handset, bluetooth headset, etc.
+ *
+ * It's intended clients will mostly only need to set the use case verb and
+ * device for each system use case change (as the verb and device parameters
+ * cover most audio use cases).
+ *
+ * However there are times when a use case has to be modified at runtime. e.g.
+ *
+ * + Incoming phone call when the device is playing music
+ * + Recording sections of a phone call
+ * + Playing tones during a call.
+ *
+ * In order to allow asynchronous runtime use case adaptations, we have a third
+ * optional modifier parameter that can be used to further configure
+ * the use case during live audio runtime.
+ *
+ * This interface allows clients to :-
+ *
+ * + Query the supported use case verbs, devices and modifiers for the machine.
+ * + Set and Get use case verbs, devices and modifiers for the machine.
+ * + Get the ALSA PCM playback and capture device PCMs for use case verb,
+ * use case device and modifier.
+ * + Get the TQ parameter for each use case verb, use case device and
+ * modifier.
+ * + Get the ALSA master playback and capture volume/switch kcontrols
+ * for each use case.
+ */
+
+
+/*
+ * Use Case Verb.
+ *
+ * The use case verb is the main device audio action. e.g. the "HiFi" use
+ * case verb will configure the audio hardware for HiFi Music playback
+ * and capture.
+ */
+#define SND_USE_CASE_VERB_INACTIVE "Inactive" /**< Inactive Verb */
+#define SND_USE_CASE_VERB_HIFI "HiFi" /**< HiFi Verb */
+#define SND_USE_CASE_VERB_HIFI_LOW_POWER "HiFi Low Power" /**< HiFi Low Power Verb */
+#define SND_USE_CASE_VERB_VOICE "Voice" /**< Voice Verb */
+#define SND_USE_CASE_VERB_VOICE_LOW_POWER "Voice Low Power" /**< Voice Low Power Verb */
+#define SND_USE_CASE_VERB_VOICECALL "Voice Call" /**< Voice Call Verb */
+#define SND_USE_CASE_VERB_IP_VOICECALL "Voice Call IP" /**< Voice Call IP Verb */
+#define SND_USE_CASE_VERB_ANALOG_RADIO "FM Analog Radio" /**< FM Analog Radio Verb */
+#define SND_USE_CASE_VERB_DIGITAL_RADIO "FM Digital Radio" /**< FM Digital Radio Verb */
+/* add new verbs to end of list */
+
+
+/*
+ * Use Case Device.
+ *
+ * Physical system devices the render and capture audio. Devices can be OR'ed
+ * together to support audio on simultaneous devices.
+ */
+#define SND_USE_CASE_DEV_NONE "None" /**< None Device */
+#define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */
+#define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */
+#define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */
+#define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */
+#define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */
+#define SND_USE_CASE_DEV_BLUETOOTH "Bluetooth" /**< Bluetooth Device */
+#define SND_USE_CASE_DEV_EARPIECE "Earpiece" /**< Earpiece Device */
+#define SND_USE_CASE_DEV_SPDIF "SPDIF" /**< SPDIF Device */
+#define SND_USE_CASE_DEV_HDMI "HDMI" /**< HDMI Device */
+/* add new devices to end of list */
+
+
+/*
+ * Use Case Modifiers.
+ *
+ * The use case modifier allows runtime configuration changes to deal with
+ * asynchronous events.
+ *
+ * e.g. to record a voice call :-
+ * 1. Set verb to SND_USE_CASE_VERB_VOICECALL (for voice call)
+ * 2. Set modifier SND_USE_CASE_MOD_CAPTURE_VOICE when capture required.
+ * 3. Call snd_use_case_get("CapturePCM") to get ALSA source PCM name
+ * with captured voice pcm data.
+ *
+ * e.g. to play a ring tone when listenin to MP3 Music :-
+ * 1. Set verb to SND_USE_CASE_VERB_HIFI (for MP3 playback)
+ * 2. Set modifier to SND_USE_CASE_MOD_PLAY_TONE when incoming call happens.
+ * 3. Call snd_use_case_get("PlaybackPCM") to get ALSA PCM sink name for
+ * ringtone pcm data.
+ */
+#define SND_USE_CASE_MOD_CAPTURE_VOICE "Capture Voice" /**< Capture Voice Modifier */
+#define SND_USE_CASE_MOD_CAPTURE_MUSIC "Capture Music" /**< Capture Music Modifier */
+#define SND_USE_CASE_MOD_PLAY_MUSIC "Play Music" /**< Play Music Modifier */
+#define SND_USE_CASE_MOD_PLAY_VOICE "Play Voice" /**< Play Voice Modifier */
+#define SND_USE_CASE_MOD_PLAY_TONE "Play Tone" /**< Play Tone Modifier */
+#define SND_USE_CASE_MOD_ECHO_REF "Echo Reference" /**< Echo Reference Modifier */
+/* add new modifiers to end of list */
+
+
+/**
+ * TQ - Tone Quality
+ *
+ * The interface allows clients to determine the audio TQ required for each
+ * use case verb and modifier. It's intended as an optional hint to the
+ * audio driver in order to lower power consumption.
+ *
+ */
+#define SND_USE_CASE_TQ_MUSIC "Music" /**< Music Tone Quality */
+#define SND_USE_CASE_TQ_VOICE "Voice" /**< Voice Tone Quality */
+#define SND_USE_CASE_TQ_TONES "Tones" /**< Tones Tone Quality */
+
+/** use case container */
+typedef struct snd_use_case_mgr snd_use_case_mgr_t;
+
+/**
+ * \brief Create an identifier
+ * \param fmt Format (sprintf like)
+ * \param ... Optional arguments for sprintf like format
+ * \return Allocated string identifier or NULL on error
+ */
+char *snd_use_case_identifier(const char *fmt, ...);
+
+/**
+ * \brief Free a string list
+ * \param list The string list to free
+ * \param items Count of strings
+ * \return Zero if success, otherwise a negative error code
+ */
+int snd_use_case_free_list(const char *list[], int items);
+
+/**
+ * \brief Obtain a list of entries
+ * \param uc_mgr Use case manager (may be NULL - card list)
+ * \param identifier (may be NULL - card list)
+ * \param list Returned allocated list
+ * \return Number of list entries if success, otherwise a negative error code
+ *
+ * Defined identifiers:
+ * - NULL - get card list
+ * (in pair cardname+comment)
+ * - _verbs - get verb list
+ * (in pair verb+comment)
+ * - _devices[/{verb}] - get list of supported devices
+ * (in pair device+comment)
+ * - _modifiers[/{verb}] - get list of supported modifiers
+ * (in pair modifier+comment)
+ * - TQ[/{verb}] - get list of TQ identifiers
+ * - _enadevs - get list of enabled devices
+ * - _enamods - get list of enabled modifiers
+ *
+ * - _supporteddevs/{modifier}|{device}[/{verb}] - list of supported devices
+ * - _conflictingdevs/{modifier}|{device}[/{verb}] - list of conflicting devices
+ *
+ * Note that at most one of the supported/conflicting devs lists has
+ * any entries, and when neither is present, all devices are supported.
+ *
+ */
+int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
+ const char *identifier,
+ const char **list[]);
+
+
+/**
+ * \brief Get current - string
+ * \param uc_mgr Use case manager
+ * \param identifier
+ * \param value Value pointer
+ * \return Zero if success, otherwise a negative error code
+ *
+ * Note: The returned string is dynamically allocated, use free() to
+ * deallocate this string. (Yes, the value parameter shouldn't be marked as
+ * "const", but it's too late to fix it, sorry about that.)
+ *
+ * Known identifiers:
+ * - NULL - return current card
+ * - _verb - return current verb
+ *
+ * - [=]{NAME}[/[{modifier}|{/device}][/{verb}]]
+ * - value identifier {NAME}
+ * - Search starts at given modifier or device if any,
+ * else at a verb
+ * - Search starts at given verb if any,
+ * else current verb
+ * - Searches modifier/device, then verb, then defaults
+ * - Specify a leading "=" to search only the exact
+ * device/modifier/verb specified, and not search
+ * through each object in turn.
+ * - Examples:
+ * - "PlaybackPCM/Play Music"
+ * - "CapturePCM/SPDIF"
+ * - From ValueDefaults only:
+ * "=Variable"
+ * - From current active verb:
+ * "=Variable//"
+ * - From verb "Verb":
+ * "=Variable//Verb"
+ * - From "Modifier" in current active verb:
+ * "=Variable/Modifier/"
+ * - From "Modifier" in "Verb":
+ * "=Variable/Modifier/Verb"
+ *
+ * Recommended names for values:
+ * - TQ
+ * - Tone Quality
+ * - PlaybackPCM
+ * - full PCM playback device name
+ * - PlaybackPCMIsDummy
+ * - Valid values: "yes" and "no". If set to "yes", the PCM named by the
+ * PlaybackPCM value is a dummy device, meaning that opening it enables
+ * an audio path in the hardware, but writing to the PCM device has no
+ * effect.
+ * - CapturePCM
+ * - full PCM capture device name
+ * - CapturePCMIsDummy
+ * - Valid values: "yes" and "no". If set to "yes", the PCM named by the
+ * CapturePCM value is a dummy device, meaning that opening it enables
+ * an audio path in the hardware, but reading from the PCM device has no
+ * effect.
+ * - PlaybackRate
+ * - playback device sample rate
+ * - PlaybackChannels
+ * - playback device channel count
+ * - PlaybackCTL
+ * - playback control device name
+ * - PlaybackVolume
+ * - playback control volume ID string
+ * - PlaybackSwitch
+ * - playback control switch ID string
+ * - CaptureRate
+ * - capture device sample rate
+ * - CaptureChannels
+ * - capture device channel count
+ * - CaptureCTL
+ * - capture control device name
+ * - CaptureVolume
+ * - capture control volume ID string
+ * - CaptureSwitch
+ * - capture control switch ID string
+ * - PlaybackMixer
+ * - name of playback mixer
+ * - PlaybackMixerID
+ * - mixer playback ID
+ * - CaptureMixer
+ * - name of capture mixer
+ * - CaptureMixerID
+ * - mixer capture ID
+ * - JackControl, JackDev, JackHWMute
+ * - Jack information for a device. The jack status can be reported via
+ * a kcontrol and/or via an input device. **JackControl** is the
+ * kcontrol name of the jack, and **JackDev** is the input device id of
+ * the jack (if the full input device path is /dev/input/by-id/foo, the
+ * JackDev value should be "foo"). UCM configuration files should
+ * contain both JackControl and JackDev when possible, because
+ * applications are likely to support only one or the other.
+ *
+ * If **JackHWMute** is set, it indicates that when the jack is plugged
+ * in, the hardware automatically mutes some other device(s). The
+ * JackHWMute value is a space-separated list of device names (this
+ * isn't compatible with device names with spaces in them, so don't use
+ * such device names!). Note that JackHWMute should be used only when
+ * the hardware enforces the automatic muting. If the hardware doesn't
+ * enforce any muting, it may still be tempting to set JackHWMute to
+ * trick upper software layers to e.g. automatically mute speakers when
+ * headphones are plugged in, but that's application policy
+ * configuration that doesn't belong to UCM configuration files.
+ */
+int snd_use_case_get(snd_use_case_mgr_t *uc_mgr,
+ const char *identifier,
+ const char **value);
+
+/**
+ * \brief Get current - integer
+ * \param uc_mgr Use case manager
+ * \param identifier
+ * \param value result
+ * \return Zero if success, otherwise a negative error code
+ *
+ * Known identifiers:
+ * - _devstatus/{device} - return status for given device
+ * - _modstatus/{modifier} - return status for given modifier
+ */
+int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr,
+ const char *identifier,
+ long *value);
+
+/**
+ * \brief Set new
+ * \param uc_mgr Use case manager
+ * \param identifier
+ * \param value Value
+ * \return Zero if success, otherwise a negative error code
+ *
+ * Known identifiers:
+ * - _verb - set current verb = value
+ * - _enadev - enable given device = value
+ * - _disdev - disable given device = value
+ * - _swdev/{old_device} - new_device = value
+ * - disable old_device and then enable new_device
+ * - if old_device is not enabled just return
+ * - check transmit sequence firstly
+ * - _enamod - enable given modifier = value
+ * - _dismod - disable given modifier = value
+ * - _swmod/{old_modifier} - new_modifier = value
+ * - disable old_modifier and then enable new_modifier
+ * - if old_modifier is not enabled just return
+ * - check transmit sequence firstly
+ */
+int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
+ const char *identifier,
+ const char *value);
+
+/**
+ * \brief Open and initialise use case core for sound card
+ * \param uc_mgr Returned use case manager pointer
+ * \param card_name Sound card name.
+ * \return zero if success, otherwise a negative error code
+ */
+int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr, const char *card_name);
+
+
+/**
+ * \brief Reload and re-parse use case configuration files for sound card.
+ * \param uc_mgr Use case manager
+ * \return zero if success, otherwise a negative error code
+ */
+int snd_use_case_mgr_reload(snd_use_case_mgr_t *uc_mgr);
+
+/**
+ * \brief Close use case manager
+ * \param uc_mgr Use case manager
+ * \return zero if success, otherwise a negative error code
+ */
+int snd_use_case_mgr_close(snd_use_case_mgr_t *uc_mgr);
+
+/**
+ * \brief Reset use case manager verb, device, modifier to deafult settings.
+ * \param uc_mgr Use case manager
+ * \return zero if success, otherwise a negative error code
+ */
+int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr);
+
+/*
+ * helper functions
+ */
+
+/**
+ * \brief Obtain a list of cards
+ * \param list Returned allocated list
+ * \return Number of list entries if success, otherwise a negative error code
+ */
+static __inline__ int snd_use_case_card_list(const char **list[])
+{
+ return snd_use_case_get_list(NULL, NULL, list);
+}
+
+/**
+ * \brief Obtain a list of verbs
+ * \param uc_mgr Use case manager
+ * \param list Returned list of verbs
+ * \return Number of list entries if success, otherwise a negative error code
+ */
+static __inline__ int snd_use_case_verb_list(snd_use_case_mgr_t *uc_mgr,
+ const char **list[])
+{
+ return snd_use_case_get_list(uc_mgr, "_verbs", list);
+}
+
+/**
+ * \}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_USE_CASE_H */
diff --git a/thirdparty/linuxbsd_headers/alsa/version.h b/thirdparty/linuxbsd_headers/alsa/version.h
new file mode 100644
index 0000000000..661ec6c8e2
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/alsa/version.h
@@ -0,0 +1,15 @@
+/*
+ * version.h
+ */
+
+#define SND_LIB_MAJOR 1 /**< major number of library version */
+#define SND_LIB_MINOR 1 /**< minor number of library version */
+#define SND_LIB_SUBMINOR 3 /**< subminor number of library version */
+#define SND_LIB_EXTRAVER 1000000 /**< extra version number, used mainly for betas */
+/** library version */
+#define SND_LIB_VERSION ((SND_LIB_MAJOR<<16)|\
+ (SND_LIB_MINOR<<8)|\
+ SND_LIB_SUBMINOR)
+/** library version (string) */
+#define SND_LIB_VERSION_STR "1.1.3"
+
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-address.h b/thirdparty/linuxbsd_headers/dbus/dbus-address.h
new file mode 100644
index 0000000000..fefb320ea3
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-address.h
@@ -0,0 +1,86 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-address.h Server address parser.
+ *
+ * Copyright (C) 2003 CodeFactory AB
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
+#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef DBUS_ADDRESS_H
+#define DBUS_ADDRESS_H
+
+#include <dbus/dbus-types.h>
+#include <dbus/dbus-errors.h>
+
+DBUS_BEGIN_DECLS
+
+/**
+ * @addtogroup DBusAddress
+ * @{
+ */
+
+/** Opaque type representing one of the semicolon-separated items in an address */
+typedef struct DBusAddressEntry DBusAddressEntry;
+
+DBUS_EXPORT
+dbus_bool_t dbus_parse_address (const char *address,
+ DBusAddressEntry ***entry_result,
+ int *array_len,
+ DBusError *error);
+DBUS_EXPORT
+const char *dbus_address_entry_get_value (DBusAddressEntry *entry,
+ const char *key);
+DBUS_EXPORT
+const char *dbus_address_entry_get_method (DBusAddressEntry *entry);
+DBUS_EXPORT
+void dbus_address_entries_free (DBusAddressEntry **entries);
+
+DBUS_EXPORT
+char* dbus_address_escape_value (const char *value);
+DBUS_EXPORT
+char* dbus_address_unescape_value (const char *value,
+ DBusError *error);
+
+/**
+ * Clear a variable or struct member that contains an array of #DBusAddressEntry.
+ * If it does not contain #NULL, the entries that were previously
+ * there are freed with dbus_address_entries_free().
+ *
+ * This is similar to dbus_clear_connection(): see that function
+ * for more details.
+ *
+ * @param pointer_to_entries A pointer to a variable or struct member.
+ * pointer_to_entries must not be #NULL, but *pointer_to_entries
+ * may be #NULL.
+ */
+static inline void
+dbus_clear_address_entries (DBusAddressEntry ***pointer_to_entries)
+{
+ _dbus_clear_pointer_impl (DBusAddressEntry *, pointer_to_entries,
+ dbus_address_entries_free);
+}
+
+/** @} */
+
+DBUS_END_DECLS
+
+#endif /* DBUS_ADDRESS_H */
+
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-arch-deps.h b/thirdparty/linuxbsd_headers/dbus/dbus-arch-deps.h
new file mode 100644
index 0000000000..37010b3b5d
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-arch-deps.h
@@ -0,0 +1,61 @@
+/* -*- mode: C; c-file-style: "gnu" -*- */
+/* dbus-arch-deps.h Header with architecture/compiler specific information, installed to libdir
+ *
+ * Copyright (C) 2003 Red Hat, Inc.
+ *
+ * Licensed under the Academic Free License version 2.0
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
+#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef DBUS_ARCH_DEPS_H
+#define DBUS_ARCH_DEPS_H
+
+#include <dbus/dbus-macros.h>
+
+DBUS_BEGIN_DECLS
+
+/* D-Bus no longer supports platforms with no 64-bit integer type. */
+#define DBUS_HAVE_INT64 1
+_DBUS_GNUC_EXTENSION typedef long dbus_int64_t;
+_DBUS_GNUC_EXTENSION typedef unsigned long dbus_uint64_t;
+
+#define DBUS_INT64_CONSTANT(val) (_DBUS_GNUC_EXTENSION (val##L))
+#define DBUS_UINT64_CONSTANT(val) (_DBUS_GNUC_EXTENSION (val##UL))
+
+typedef int dbus_int32_t;
+typedef unsigned int dbus_uint32_t;
+
+typedef short dbus_int16_t;
+typedef unsigned short dbus_uint16_t;
+
+/* This is not really arch-dependent, but it's not worth
+ * creating an additional generated header just for this
+ */
+#define DBUS_MAJOR_VERSION 1
+#define DBUS_MINOR_VERSION 12
+#define DBUS_MICRO_VERSION 2
+
+#define DBUS_VERSION_STRING "1.12.2"
+
+#define DBUS_VERSION ((1 << 16) | (12 << 8) | (2))
+
+DBUS_END_DECLS
+
+#endif /* DBUS_ARCH_DEPS_H */
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-bus.h b/thirdparty/linuxbsd_headers/dbus/dbus-bus.h
new file mode 100644
index 0000000000..02a95711d0
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-bus.h
@@ -0,0 +1,95 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-bus.h Convenience functions for communicating with the bus.
+ *
+ * Copyright (C) 2003 CodeFactory AB
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
+#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef DBUS_BUS_H
+#define DBUS_BUS_H
+
+#include <dbus/dbus-connection.h>
+
+DBUS_BEGIN_DECLS
+
+/**
+ * @addtogroup DBusBus
+ * @{
+ */
+
+DBUS_EXPORT
+DBusConnection *dbus_bus_get (DBusBusType type,
+ DBusError *error);
+DBUS_EXPORT
+DBusConnection *dbus_bus_get_private (DBusBusType type,
+ DBusError *error);
+
+DBUS_EXPORT
+dbus_bool_t dbus_bus_register (DBusConnection *connection,
+ DBusError *error);
+DBUS_EXPORT
+dbus_bool_t dbus_bus_set_unique_name (DBusConnection *connection,
+ const char *unique_name);
+DBUS_EXPORT
+const char* dbus_bus_get_unique_name (DBusConnection *connection);
+DBUS_EXPORT
+unsigned long dbus_bus_get_unix_user (DBusConnection *connection,
+ const char *name,
+ DBusError *error);
+DBUS_EXPORT
+char* dbus_bus_get_id (DBusConnection *connection,
+ DBusError *error);
+DBUS_EXPORT
+int dbus_bus_request_name (DBusConnection *connection,
+ const char *name,
+ unsigned int flags,
+ DBusError *error);
+DBUS_EXPORT
+int dbus_bus_release_name (DBusConnection *connection,
+ const char *name,
+ DBusError *error);
+DBUS_EXPORT
+dbus_bool_t dbus_bus_name_has_owner (DBusConnection *connection,
+ const char *name,
+ DBusError *error);
+
+DBUS_EXPORT
+dbus_bool_t dbus_bus_start_service_by_name (DBusConnection *connection,
+ const char *name,
+ dbus_uint32_t flags,
+ dbus_uint32_t *reply,
+ DBusError *error);
+
+DBUS_EXPORT
+void dbus_bus_add_match (DBusConnection *connection,
+ const char *rule,
+ DBusError *error);
+DBUS_EXPORT
+void dbus_bus_remove_match (DBusConnection *connection,
+ const char *rule,
+ DBusError *error);
+
+/** @} */
+
+DBUS_END_DECLS
+
+#endif /* DBUS_BUS_H */
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-connection.h b/thirdparty/linuxbsd_headers/dbus/dbus-connection.h
new file mode 100644
index 0000000000..bed5424216
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-connection.h
@@ -0,0 +1,526 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-connection.h DBusConnection object
+ *
+ * Copyright (C) 2002, 2003 Red Hat Inc.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
+#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef DBUS_CONNECTION_H
+#define DBUS_CONNECTION_H
+
+#include <dbus/dbus-errors.h>
+#include <dbus/dbus-macros.h>
+#include <dbus/dbus-memory.h>
+#include <dbus/dbus-message.h>
+#include <dbus/dbus-shared.h>
+
+DBUS_BEGIN_DECLS
+
+/**
+ * @addtogroup DBusConnection
+ * @{
+ */
+
+/* documented in dbus-watch.c */
+typedef struct DBusWatch DBusWatch;
+/* documented in dbus-timeout.c */
+typedef struct DBusTimeout DBusTimeout;
+/** Opaque type representing preallocated resources so a message can be sent without further memory allocation. */
+typedef struct DBusPreallocatedSend DBusPreallocatedSend;
+/** Opaque type representing a method call that has not yet received a reply. */
+typedef struct DBusPendingCall DBusPendingCall;
+/** Opaque type representing a connection to a remote application and associated incoming/outgoing message queues. */
+typedef struct DBusConnection DBusConnection;
+/** Set of functions that must be implemented to handle messages sent to a particular object path. */
+typedef struct DBusObjectPathVTable DBusObjectPathVTable;
+
+/**
+ * Indicates the status of a #DBusWatch.
+ */
+typedef enum
+{
+ DBUS_WATCH_READABLE = 1 << 0, /**< As in POLLIN */
+ DBUS_WATCH_WRITABLE = 1 << 1, /**< As in POLLOUT */
+ DBUS_WATCH_ERROR = 1 << 2, /**< As in POLLERR (can't watch for
+ * this, but can be present in
+ * current state passed to
+ * dbus_watch_handle()).
+ */
+ DBUS_WATCH_HANGUP = 1 << 3 /**< As in POLLHUP (can't watch for
+ * it, but can be present in current
+ * state passed to
+ * dbus_watch_handle()).
+ */
+ /* Internal to libdbus, there is also _DBUS_WATCH_NVAL in dbus-watch.h */
+} DBusWatchFlags;
+
+/**
+ * Indicates the status of incoming data on a #DBusConnection. This determines whether
+ * dbus_connection_dispatch() needs to be called.
+ */
+typedef enum
+{
+ DBUS_DISPATCH_DATA_REMAINS, /**< There is more data to potentially convert to messages. */
+ DBUS_DISPATCH_COMPLETE, /**< All currently available data has been processed. */
+ DBUS_DISPATCH_NEED_MEMORY /**< More memory is needed to continue. */
+} DBusDispatchStatus;
+
+/** Called when libdbus needs a new watch to be monitored by the main
+ * loop. Returns #FALSE if it lacks enough memory to add the
+ * watch. Set by dbus_connection_set_watch_functions() or
+ * dbus_server_set_watch_functions().
+ */
+typedef dbus_bool_t (* DBusAddWatchFunction) (DBusWatch *watch,
+ void *data);
+/** Called when dbus_watch_get_enabled() may return a different value
+ * than it did before. Set by dbus_connection_set_watch_functions()
+ * or dbus_server_set_watch_functions().
+ */
+typedef void (* DBusWatchToggledFunction) (DBusWatch *watch,
+ void *data);
+/** Called when libdbus no longer needs a watch to be monitored by the
+ * main loop. Set by dbus_connection_set_watch_functions() or
+ * dbus_server_set_watch_functions().
+ */
+typedef void (* DBusRemoveWatchFunction) (DBusWatch *watch,
+ void *data);
+/** Called when libdbus needs a new timeout to be monitored by the main
+ * loop. Returns #FALSE if it lacks enough memory to add the
+ * watch. Set by dbus_connection_set_timeout_functions() or
+ * dbus_server_set_timeout_functions().
+ */
+typedef dbus_bool_t (* DBusAddTimeoutFunction) (DBusTimeout *timeout,
+ void *data);
+/** Called when dbus_timeout_get_enabled() may return a different
+ * value than it did before.
+ * Set by dbus_connection_set_timeout_functions() or
+ * dbus_server_set_timeout_functions().
+ */
+typedef void (* DBusTimeoutToggledFunction) (DBusTimeout *timeout,
+ void *data);
+/** Called when libdbus no longer needs a timeout to be monitored by the
+ * main loop. Set by dbus_connection_set_timeout_functions() or
+ * dbus_server_set_timeout_functions().
+ */
+typedef void (* DBusRemoveTimeoutFunction) (DBusTimeout *timeout,
+ void *data);
+/** Called when the return value of dbus_connection_get_dispatch_status()
+ * may have changed. Set with dbus_connection_set_dispatch_status_function().
+ */
+typedef void (* DBusDispatchStatusFunction) (DBusConnection *connection,
+ DBusDispatchStatus new_status,
+ void *data);
+/**
+ * Called when the main loop's thread should be notified that there's now work
+ * to do. Set with dbus_connection_set_wakeup_main_function().
+ */
+typedef void (* DBusWakeupMainFunction) (void *data);
+
+/**
+ * Called during authentication to check whether the given UNIX user
+ * ID is allowed to connect, if the client tried to auth as a UNIX
+ * user ID. Normally on Windows this would never happen. Set with
+ * dbus_connection_set_unix_user_function().
+ */
+typedef dbus_bool_t (* DBusAllowUnixUserFunction) (DBusConnection *connection,
+ unsigned long uid,
+ void *data);
+
+/**
+ * Called during authentication to check whether the given Windows user
+ * ID is allowed to connect, if the client tried to auth as a Windows
+ * user ID. Normally on UNIX this would never happen. Set with
+ * dbus_connection_set_windows_user_function().
+ */
+typedef dbus_bool_t (* DBusAllowWindowsUserFunction) (DBusConnection *connection,
+ const char *user_sid,
+ void *data);
+
+
+/**
+ * Called when a pending call now has a reply available. Set with
+ * dbus_pending_call_set_notify().
+ */
+typedef void (* DBusPendingCallNotifyFunction) (DBusPendingCall *pending,
+ void *user_data);
+
+/**
+ * Called when a message needs to be handled. The result indicates whether or
+ * not more handlers should be run. Set with dbus_connection_add_filter().
+ */
+typedef DBusHandlerResult (* DBusHandleMessageFunction) (DBusConnection *connection,
+ DBusMessage *message,
+ void *user_data);
+DBUS_EXPORT
+DBusConnection* dbus_connection_open (const char *address,
+ DBusError *error);
+DBUS_EXPORT
+DBusConnection* dbus_connection_open_private (const char *address,
+ DBusError *error);
+DBUS_EXPORT
+DBusConnection* dbus_connection_ref (DBusConnection *connection);
+DBUS_EXPORT
+void dbus_connection_unref (DBusConnection *connection);
+DBUS_EXPORT
+void dbus_connection_close (DBusConnection *connection);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_get_is_connected (DBusConnection *connection);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_get_is_authenticated (DBusConnection *connection);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_get_is_anonymous (DBusConnection *connection);
+DBUS_EXPORT
+char* dbus_connection_get_server_id (DBusConnection *connection);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_can_send_type (DBusConnection *connection,
+ int type);
+
+DBUS_EXPORT
+void dbus_connection_set_exit_on_disconnect (DBusConnection *connection,
+ dbus_bool_t exit_on_disconnect);
+DBUS_EXPORT
+void dbus_connection_flush (DBusConnection *connection);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_read_write_dispatch (DBusConnection *connection,
+ int timeout_milliseconds);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_read_write (DBusConnection *connection,
+ int timeout_milliseconds);
+DBUS_EXPORT
+DBusMessage* dbus_connection_borrow_message (DBusConnection *connection);
+DBUS_EXPORT
+void dbus_connection_return_message (DBusConnection *connection,
+ DBusMessage *message);
+DBUS_EXPORT
+void dbus_connection_steal_borrowed_message (DBusConnection *connection,
+ DBusMessage *message);
+DBUS_EXPORT
+DBusMessage* dbus_connection_pop_message (DBusConnection *connection);
+DBUS_EXPORT
+DBusDispatchStatus dbus_connection_get_dispatch_status (DBusConnection *connection);
+DBUS_EXPORT
+DBusDispatchStatus dbus_connection_dispatch (DBusConnection *connection);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_has_messages_to_send (DBusConnection *connection);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_send (DBusConnection *connection,
+ DBusMessage *message,
+ dbus_uint32_t *client_serial);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_send_with_reply (DBusConnection *connection,
+ DBusMessage *message,
+ DBusPendingCall **pending_return,
+ int timeout_milliseconds);
+DBUS_EXPORT
+DBusMessage * dbus_connection_send_with_reply_and_block (DBusConnection *connection,
+ DBusMessage *message,
+ int timeout_milliseconds,
+ DBusError *error);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_set_watch_functions (DBusConnection *connection,
+ DBusAddWatchFunction add_function,
+ DBusRemoveWatchFunction remove_function,
+ DBusWatchToggledFunction toggled_function,
+ void *data,
+ DBusFreeFunction free_data_function);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_set_timeout_functions (DBusConnection *connection,
+ DBusAddTimeoutFunction add_function,
+ DBusRemoveTimeoutFunction remove_function,
+ DBusTimeoutToggledFunction toggled_function,
+ void *data,
+ DBusFreeFunction free_data_function);
+DBUS_EXPORT
+void dbus_connection_set_wakeup_main_function (DBusConnection *connection,
+ DBusWakeupMainFunction wakeup_main_function,
+ void *data,
+ DBusFreeFunction free_data_function);
+DBUS_EXPORT
+void dbus_connection_set_dispatch_status_function (DBusConnection *connection,
+ DBusDispatchStatusFunction function,
+ void *data,
+ DBusFreeFunction free_data_function);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_get_unix_user (DBusConnection *connection,
+ unsigned long *uid);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_get_unix_process_id (DBusConnection *connection,
+ unsigned long *pid);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_get_adt_audit_session_data (DBusConnection *connection,
+ void **data,
+ dbus_int32_t *data_size);
+DBUS_EXPORT
+void dbus_connection_set_unix_user_function (DBusConnection *connection,
+ DBusAllowUnixUserFunction function,
+ void *data,
+ DBusFreeFunction free_data_function);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_get_windows_user (DBusConnection *connection,
+ char **windows_sid_p);
+DBUS_EXPORT
+void dbus_connection_set_windows_user_function (DBusConnection *connection,
+ DBusAllowWindowsUserFunction function,
+ void *data,
+ DBusFreeFunction free_data_function);
+DBUS_EXPORT
+void dbus_connection_set_allow_anonymous (DBusConnection *connection,
+ dbus_bool_t value);
+DBUS_EXPORT
+void dbus_connection_set_route_peer_messages (DBusConnection *connection,
+ dbus_bool_t value);
+
+
+/* Filters */
+
+DBUS_EXPORT
+dbus_bool_t dbus_connection_add_filter (DBusConnection *connection,
+ DBusHandleMessageFunction function,
+ void *user_data,
+ DBusFreeFunction free_data_function);
+DBUS_EXPORT
+void dbus_connection_remove_filter (DBusConnection *connection,
+ DBusHandleMessageFunction function,
+ void *user_data);
+
+
+/* Other */
+DBUS_EXPORT
+dbus_bool_t dbus_connection_allocate_data_slot (dbus_int32_t *slot_p);
+DBUS_EXPORT
+void dbus_connection_free_data_slot (dbus_int32_t *slot_p);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_set_data (DBusConnection *connection,
+ dbus_int32_t slot,
+ void *data,
+ DBusFreeFunction free_data_func);
+DBUS_EXPORT
+void* dbus_connection_get_data (DBusConnection *connection,
+ dbus_int32_t slot);
+
+DBUS_EXPORT
+void dbus_connection_set_change_sigpipe (dbus_bool_t will_modify_sigpipe);
+
+DBUS_EXPORT
+void dbus_connection_set_max_message_size (DBusConnection *connection,
+ long size);
+DBUS_EXPORT
+long dbus_connection_get_max_message_size (DBusConnection *connection);
+DBUS_EXPORT
+void dbus_connection_set_max_received_size (DBusConnection *connection,
+ long size);
+DBUS_EXPORT
+long dbus_connection_get_max_received_size (DBusConnection *connection);
+
+DBUS_EXPORT
+void dbus_connection_set_max_message_unix_fds (DBusConnection *connection,
+ long n);
+DBUS_EXPORT
+long dbus_connection_get_max_message_unix_fds (DBusConnection *connection);
+DBUS_EXPORT
+void dbus_connection_set_max_received_unix_fds(DBusConnection *connection,
+ long n);
+DBUS_EXPORT
+long dbus_connection_get_max_received_unix_fds(DBusConnection *connection);
+
+DBUS_EXPORT
+long dbus_connection_get_outgoing_size (DBusConnection *connection);
+DBUS_EXPORT
+long dbus_connection_get_outgoing_unix_fds (DBusConnection *connection);
+
+DBUS_EXPORT
+DBusPreallocatedSend* dbus_connection_preallocate_send (DBusConnection *connection);
+DBUS_EXPORT
+void dbus_connection_free_preallocated_send (DBusConnection *connection,
+ DBusPreallocatedSend *preallocated);
+DBUS_EXPORT
+void dbus_connection_send_preallocated (DBusConnection *connection,
+ DBusPreallocatedSend *preallocated,
+ DBusMessage *message,
+ dbus_uint32_t *client_serial);
+
+
+/* Object tree functionality */
+
+/**
+ * Called when a #DBusObjectPathVTable is unregistered (or its connection is freed).
+ * Found in #DBusObjectPathVTable.
+ */
+typedef void (* DBusObjectPathUnregisterFunction) (DBusConnection *connection,
+ void *user_data);
+/**
+ * Called when a message is sent to a registered object path. Found in
+ * #DBusObjectPathVTable which is registered with dbus_connection_register_object_path()
+ * or dbus_connection_register_fallback().
+ */
+typedef DBusHandlerResult (* DBusObjectPathMessageFunction) (DBusConnection *connection,
+ DBusMessage *message,
+ void *user_data);
+
+/**
+ * Virtual table that must be implemented to handle a portion of the
+ * object path hierarchy. Attach the vtable to a particular path using
+ * dbus_connection_register_object_path() or
+ * dbus_connection_register_fallback().
+ */
+struct DBusObjectPathVTable
+{
+ DBusObjectPathUnregisterFunction unregister_function; /**< Function to unregister this handler */
+ DBusObjectPathMessageFunction message_function; /**< Function to handle messages */
+
+ void (* dbus_internal_pad1) (void *); /**< Reserved for future expansion */
+ void (* dbus_internal_pad2) (void *); /**< Reserved for future expansion */
+ void (* dbus_internal_pad3) (void *); /**< Reserved for future expansion */
+ void (* dbus_internal_pad4) (void *); /**< Reserved for future expansion */
+};
+
+DBUS_EXPORT
+dbus_bool_t dbus_connection_try_register_object_path (DBusConnection *connection,
+ const char *path,
+ const DBusObjectPathVTable *vtable,
+ void *user_data,
+ DBusError *error);
+
+DBUS_EXPORT
+dbus_bool_t dbus_connection_register_object_path (DBusConnection *connection,
+ const char *path,
+ const DBusObjectPathVTable *vtable,
+ void *user_data);
+
+DBUS_EXPORT
+dbus_bool_t dbus_connection_try_register_fallback (DBusConnection *connection,
+ const char *path,
+ const DBusObjectPathVTable *vtable,
+ void *user_data,
+ DBusError *error);
+
+DBUS_EXPORT
+dbus_bool_t dbus_connection_register_fallback (DBusConnection *connection,
+ const char *path,
+ const DBusObjectPathVTable *vtable,
+ void *user_data);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_unregister_object_path (DBusConnection *connection,
+ const char *path);
+
+DBUS_EXPORT
+dbus_bool_t dbus_connection_get_object_path_data (DBusConnection *connection,
+ const char *path,
+ void **data_p);
+
+DBUS_EXPORT
+dbus_bool_t dbus_connection_list_registered (DBusConnection *connection,
+ const char *parent_path,
+ char ***child_entries);
+
+DBUS_EXPORT
+dbus_bool_t dbus_connection_get_unix_fd (DBusConnection *connection,
+ int *fd);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_get_socket (DBusConnection *connection,
+ int *fd);
+
+/**
+ * Clear a variable or struct member that contains a #DBusConnection.
+ * If it does not contain #NULL, the connection that was previously
+ * there is unreferenced with dbus_connection_unref().
+ *
+ * For example, this function and the similar functions for
+ * other reference-counted types can be used in code like this:
+ *
+ * @code
+ * DBusConnection *conn = NULL;
+ * struct { ...; DBusMessage *m; ... } *larger_structure = ...;
+ *
+ * ... code that might set conn or m to be non-NULL ...
+ *
+ * dbus_clear_connection (&conn);
+ * dbus_clear_message (&larger_structure->m);
+ * @endcode
+ *
+ * @param pointer_to_connection A pointer to a variable or struct member.
+ * pointer_to_connection must not be #NULL, but *pointer_to_connection
+ * may be #NULL.
+ */
+static inline void
+dbus_clear_connection (DBusConnection **pointer_to_connection)
+{
+ _dbus_clear_pointer_impl (DBusConnection, pointer_to_connection,
+ dbus_connection_unref);
+}
+
+/** @} */
+
+
+/**
+ * @addtogroup DBusWatch
+ * @{
+ */
+
+#ifndef DBUS_DISABLE_DEPRECATED
+DBUS_EXPORT
+DBUS_DEPRECATED int dbus_watch_get_fd (DBusWatch *watch);
+#endif
+
+DBUS_EXPORT
+int dbus_watch_get_unix_fd (DBusWatch *watch);
+DBUS_EXPORT
+int dbus_watch_get_socket (DBusWatch *watch);
+DBUS_EXPORT
+unsigned int dbus_watch_get_flags (DBusWatch *watch);
+DBUS_EXPORT
+void* dbus_watch_get_data (DBusWatch *watch);
+DBUS_EXPORT
+void dbus_watch_set_data (DBusWatch *watch,
+ void *data,
+ DBusFreeFunction free_data_function);
+DBUS_EXPORT
+dbus_bool_t dbus_watch_handle (DBusWatch *watch,
+ unsigned int flags);
+DBUS_EXPORT
+dbus_bool_t dbus_watch_get_enabled (DBusWatch *watch);
+
+/** @} */
+
+/**
+ * @addtogroup DBusTimeout
+ * @{
+ */
+
+DBUS_EXPORT
+int dbus_timeout_get_interval (DBusTimeout *timeout);
+DBUS_EXPORT
+void* dbus_timeout_get_data (DBusTimeout *timeout);
+DBUS_EXPORT
+void dbus_timeout_set_data (DBusTimeout *timeout,
+ void *data,
+ DBusFreeFunction free_data_function);
+DBUS_EXPORT
+dbus_bool_t dbus_timeout_handle (DBusTimeout *timeout);
+DBUS_EXPORT
+dbus_bool_t dbus_timeout_get_enabled (DBusTimeout *timeout);
+
+/** @} */
+
+DBUS_END_DECLS
+
+#endif /* DBUS_CONNECTION_H */
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-errors.h b/thirdparty/linuxbsd_headers/dbus/dbus-errors.h
new file mode 100644
index 0000000000..3804085b9e
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-errors.h
@@ -0,0 +1,90 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-errors.h Error reporting
+ *
+ * Copyright (C) 2002 Red Hat Inc.
+ * Copyright (C) 2003 CodeFactory AB
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
+#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef DBUS_ERROR_H
+#define DBUS_ERROR_H
+
+#include <dbus/dbus-macros.h>
+#include <dbus/dbus-types.h>
+#include <dbus/dbus-protocol.h>
+
+DBUS_BEGIN_DECLS
+
+/**
+ * @addtogroup DBusErrors
+ * @{
+ */
+
+/** Mostly-opaque type representing an error that occurred */
+typedef struct DBusError DBusError;
+
+/**
+ * Object representing an exception.
+ */
+struct DBusError
+{
+ const char *name; /**< public error name field */
+ const char *message; /**< public error message field */
+
+ unsigned int dummy1 : 1; /**< placeholder */
+ unsigned int dummy2 : 1; /**< placeholder */
+ unsigned int dummy3 : 1; /**< placeholder */
+ unsigned int dummy4 : 1; /**< placeholder */
+ unsigned int dummy5 : 1; /**< placeholder */
+
+ void *padding1; /**< placeholder */
+};
+
+#define DBUS_ERROR_INIT { NULL, NULL, TRUE, 0, 0, 0, 0, NULL }
+
+DBUS_EXPORT
+void dbus_error_init (DBusError *error);
+DBUS_EXPORT
+void dbus_error_free (DBusError *error);
+DBUS_EXPORT
+void dbus_set_error (DBusError *error,
+ const char *name,
+ const char *message,
+ ...) _DBUS_GNUC_PRINTF (3, 4);
+DBUS_EXPORT
+void dbus_set_error_const (DBusError *error,
+ const char *name,
+ const char *message);
+DBUS_EXPORT
+void dbus_move_error (DBusError *src,
+ DBusError *dest);
+DBUS_EXPORT
+dbus_bool_t dbus_error_has_name (const DBusError *error,
+ const char *name);
+DBUS_EXPORT
+dbus_bool_t dbus_error_is_set (const DBusError *error);
+
+/** @} */
+
+DBUS_END_DECLS
+
+#endif /* DBUS_ERROR_H */
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-macros.h b/thirdparty/linuxbsd_headers/dbus/dbus-macros.h
new file mode 100644
index 0000000000..2c8956e30e
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-macros.h
@@ -0,0 +1,240 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-macros.h generic macros
+ *
+ * Copyright (C) 2002 Red Hat Inc.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
+#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef DBUS_MACROS_H
+#define DBUS_MACROS_H
+
+#ifdef __cplusplus
+# define DBUS_BEGIN_DECLS extern "C" {
+# define DBUS_END_DECLS }
+#else
+# define DBUS_BEGIN_DECLS
+# define DBUS_END_DECLS
+#endif
+
+#ifndef TRUE
+# define TRUE 1
+#endif
+#ifndef FALSE
+# define FALSE 0
+#endif
+
+#ifndef NULL
+# ifdef __cplusplus
+# define NULL (0L)
+# else /* !__cplusplus */
+# define NULL ((void*) 0)
+# endif /* !__cplusplus */
+#endif
+
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
+# define DBUS_DEPRECATED __attribute__ ((__deprecated__))
+#elif defined(_MSC_VER) && (_MSC_VER >= 1300)
+# define DBUS_DEPRECATED __declspec(deprecated)
+#else
+# define DBUS_DEPRECATED
+#endif
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
+# define _DBUS_GNUC_EXTENSION __extension__
+#else
+# define _DBUS_GNUC_EXTENSION
+#endif
+
+#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)) || \
+ defined(__clang__)
+#define _DBUS_GNUC_PRINTF( format_idx, arg_idx ) \
+ __attribute__((__format__ (__printf__, format_idx, arg_idx)))
+#define _DBUS_GNUC_NORETURN \
+ __attribute__((__noreturn__))
+#define _DBUS_GNUC_UNUSED \
+ __attribute__((__unused__))
+#else /* !__GNUC__ */
+#define _DBUS_GNUC_PRINTF( format_idx, arg_idx )
+#define _DBUS_GNUC_NORETURN
+#define _DBUS_GNUC_UNUSED
+#endif /* !__GNUC__ */
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+#define DBUS_MALLOC __attribute__((__malloc__))
+#else
+#define DBUS_MALLOC
+#endif
+
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#define DBUS_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
+#define DBUS_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y)))
+#else
+#define DBUS_ALLOC_SIZE(x)
+#define DBUS_ALLOC_SIZE2(x,y)
+#endif
+
+#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#define _DBUS_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#else
+#define _DBUS_GNUC_WARN_UNUSED_RESULT
+#endif
+
+/** @def _DBUS_GNUC_PRINTF
+ * used to tell gcc about printf format strings
+ */
+/** @def _DBUS_GNUC_NORETURN
+ * used to tell gcc about functions that never return, such as _dbus_abort()
+ */
+/** @def _DBUS_GNUC_WARN_UNUSED_RESULT
+ * used to tell gcc about functions whose result must be used
+ */
+
+/* Normally docs are in .c files, but there isn't a .c file for this. */
+/**
+ * @defgroup DBusMacros Utility macros
+ * @ingroup DBus
+ * @brief #TRUE, #FALSE, #NULL, and so on
+ *
+ * Utility macros.
+ *
+ * @{
+ */
+
+/**
+ * @def DBUS_BEGIN_DECLS
+ *
+ * Macro used prior to declaring functions in the D-Bus header
+ * files. Expands to "extern "C"" when using a C++ compiler,
+ * and expands to nothing when using a C compiler.
+ *
+ * Please don't use this in your own code, consider it
+ * D-Bus internal.
+ */
+/**
+ * @def DBUS_END_DECLS
+ *
+ * Macro used after declaring functions in the D-Bus header
+ * files. Expands to "}" when using a C++ compiler,
+ * and expands to nothing when using a C compiler.
+ *
+ * Please don't use this in your own code, consider it
+ * D-Bus internal.
+ */
+/**
+ * @def TRUE
+ *
+ * Expands to "1"
+ */
+/**
+ * @def FALSE
+ *
+ * Expands to "0"
+ */
+/**
+ * @def NULL
+ *
+ * A null pointer, defined appropriately for C or C++.
+ */
+/**
+ * @def DBUS_DEPRECATED
+ *
+ * Tells the compiler to warn about a function or type if it's used.
+ * Code marked in this way should also be enclosed in
+ * @code
+ * #ifndef DBUS_DISABLE_DEPRECATED
+ * deprecated stuff here
+ * #endif
+ * @endcode
+ *
+ * Please don't use this in your own code, consider it
+ * D-Bus internal.
+ */
+/**
+ * @def _DBUS_GNUC_EXTENSION
+ *
+ * Tells gcc not to warn about extensions to the C standard in the
+ * following expression, even if compiling with -pedantic. Do not use
+ * this macro in your own code; please consider it to be internal to libdbus.
+ */
+
+/*
+ * @def DBUS_EXPORT
+ *
+ * Declare the following symbol as public. This is currently a noop on
+ * platforms other than Windows.
+ */
+
+#if defined(DBUS_EXPORT)
+ /* value forced by compiler command line, don't redefine */
+#elif defined(_WIN32)
+# if defined(DBUS_STATIC_BUILD)
+# define DBUS_EXPORT
+# elif defined(dbus_1_EXPORTS)
+# define DBUS_EXPORT __declspec(dllexport)
+# else
+# define DBUS_EXPORT __declspec(dllimport)
+# endif
+#elif defined(__GNUC__) && __GNUC__ >= 4
+# define DBUS_EXPORT __attribute__ ((__visibility__ ("default")))
+#else
+#define DBUS_EXPORT
+#endif
+
+#if defined(DBUS_PRIVATE_EXPORT)
+ /* value forced by compiler command line, don't redefine */
+#elif defined(_WIN32)
+# if defined(DBUS_STATIC_BUILD)
+# define DBUS_PRIVATE_EXPORT /* no decoration */
+# elif defined(dbus_1_EXPORTS)
+# define DBUS_PRIVATE_EXPORT __declspec(dllexport)
+# else
+# define DBUS_PRIVATE_EXPORT __declspec(dllimport)
+# endif
+#elif defined(__GNUC__) && __GNUC__ >= 4
+# define DBUS_PRIVATE_EXPORT __attribute__ ((__visibility__ ("default")))
+#else
+# define DBUS_PRIVATE_EXPORT /* no decoration */
+#endif
+
+/* Implementation for dbus_clear_message() etc. This is not API,
+ * do not use it directly.
+ *
+ * We're using a specific type (T ** and T *) instead of void ** and
+ * void * partly for type-safety, partly to be strict-aliasing-compliant,
+ * and partly to keep C++ compilers happy. This code is inlined into
+ * users of libdbus, so we can't rely on it having dbus' own compiler
+ * settings. */
+#define _dbus_clear_pointer_impl(T, pointer_to_pointer, destroy) \
+ do { \
+ T **_pp = (pointer_to_pointer); \
+ T *_value = *_pp; \
+ \
+ *_pp = NULL; \
+ \
+ if (_value != NULL) \
+ destroy (_value); \
+ } while (0)
+/* Not (destroy) (_value) in case destroy() is a function-like macro */
+
+/** @} */
+
+#endif /* DBUS_MACROS_H */
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-memory.h b/thirdparty/linuxbsd_headers/dbus/dbus-memory.h
new file mode 100644
index 0000000000..4fd56bd633
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-memory.h
@@ -0,0 +1,73 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-memory.h D-Bus memory handling
+ *
+ * Copyright (C) 2002 Red Hat Inc.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
+#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef DBUS_MEMORY_H
+#define DBUS_MEMORY_H
+
+#include <dbus/dbus-macros.h>
+#include <stddef.h>
+
+DBUS_BEGIN_DECLS
+
+/**
+ * @addtogroup DBusMemory
+ * @{
+ */
+
+DBUS_EXPORT
+DBUS_MALLOC
+DBUS_ALLOC_SIZE(1)
+void* dbus_malloc (size_t bytes);
+
+DBUS_EXPORT
+DBUS_MALLOC
+DBUS_ALLOC_SIZE(1)
+void* dbus_malloc0 (size_t bytes);
+
+DBUS_EXPORT
+DBUS_MALLOC
+DBUS_ALLOC_SIZE(2)
+void* dbus_realloc (void *memory,
+ size_t bytes);
+DBUS_EXPORT
+void dbus_free (void *memory);
+
+#define dbus_new(type, count) ((type*)dbus_malloc (sizeof (type) * (count)))
+#define dbus_new0(type, count) ((type*)dbus_malloc0 (sizeof (type) * (count)))
+
+DBUS_EXPORT
+void dbus_free_string_array (char **str_array);
+
+typedef void (* DBusFreeFunction) (void *memory);
+
+DBUS_EXPORT
+void dbus_shutdown (void);
+
+/** @} */
+
+DBUS_END_DECLS
+
+#endif /* DBUS_MEMORY_H */
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-message.h b/thirdparty/linuxbsd_headers/dbus/dbus-message.h
new file mode 100644
index 0000000000..8a9d57a0f1
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-message.h
@@ -0,0 +1,377 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-message.h DBusMessage object
+ *
+ * Copyright (C) 2002, 2003, 2005 Red Hat Inc.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
+#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef DBUS_MESSAGE_H
+#define DBUS_MESSAGE_H
+
+#include <dbus/dbus-macros.h>
+#include <dbus/dbus-types.h>
+#include <dbus/dbus-arch-deps.h>
+#include <dbus/dbus-memory.h>
+#include <dbus/dbus-errors.h>
+#include <stdarg.h>
+
+DBUS_BEGIN_DECLS
+
+/**
+ * @addtogroup DBusMessage
+ * @{
+ */
+
+typedef struct DBusMessage DBusMessage;
+/**
+ * Opaque type representing a message iterator. Can be copied by value and
+ * allocated on the stack.
+ *
+ * A DBusMessageIter usually contains no allocated memory. However, there
+ * is one special case: after a successful call to
+ * dbus_message_iter_open_container(), the caller is responsible for calling
+ * either dbus_message_iter_close_container() or
+ * dbus_message_iter_abandon_container() exactly once, with the same pair
+ * of iterators.
+ */
+typedef struct DBusMessageIter DBusMessageIter;
+
+/**
+ * DBusMessageIter struct; contains no public fields.
+ */
+struct DBusMessageIter
+{
+ void *dummy1; /**< Don't use this */
+ void *dummy2; /**< Don't use this */
+ dbus_uint32_t dummy3; /**< Don't use this */
+ int dummy4; /**< Don't use this */
+ int dummy5; /**< Don't use this */
+ int dummy6; /**< Don't use this */
+ int dummy7; /**< Don't use this */
+ int dummy8; /**< Don't use this */
+ int dummy9; /**< Don't use this */
+ int dummy10; /**< Don't use this */
+ int dummy11; /**< Don't use this */
+ int pad1; /**< Don't use this */
+ void *pad2; /**< Don't use this */
+ void *pad3; /**< Don't use this */
+};
+
+/**
+ * A message iterator for which dbus_message_iter_abandon_container_if_open()
+ * is the only valid operation.
+ */
+#define DBUS_MESSAGE_ITER_INIT_CLOSED \
+{ \
+ NULL, /* dummy1 */ \
+ NULL, /* dummy2 */ \
+ 0, /* dummy3 */ \
+ 0, /* dummy4 */ \
+ 0, /* dummy5 */ \
+ 0, /* dummy6 */ \
+ 0, /* dummy7 */ \
+ 0, /* dummy8 */ \
+ 0, /* dummy9 */ \
+ 0, /* dummy10 */ \
+ 0, /* dummy11 */ \
+ 0, /* pad1 */ \
+ NULL, /* pad2 */ \
+ NULL /* pad3 */ \
+}
+
+DBUS_EXPORT
+DBusMessage* dbus_message_new (int message_type);
+DBUS_EXPORT
+DBusMessage* dbus_message_new_method_call (const char *bus_name,
+ const char *path,
+ const char *iface,
+ const char *method);
+DBUS_EXPORT
+DBusMessage* dbus_message_new_method_return (DBusMessage *method_call);
+DBUS_EXPORT
+DBusMessage* dbus_message_new_signal (const char *path,
+ const char *iface,
+ const char *name);
+DBUS_EXPORT
+DBusMessage* dbus_message_new_error (DBusMessage *reply_to,
+ const char *error_name,
+ const char *error_message);
+DBUS_EXPORT
+DBusMessage* dbus_message_new_error_printf (DBusMessage *reply_to,
+ const char *error_name,
+ const char *error_format,
+ ...) _DBUS_GNUC_PRINTF (3, 4);
+
+DBUS_EXPORT
+DBusMessage* dbus_message_copy (const DBusMessage *message);
+
+DBUS_EXPORT
+DBusMessage* dbus_message_ref (DBusMessage *message);
+DBUS_EXPORT
+void dbus_message_unref (DBusMessage *message);
+DBUS_EXPORT
+int dbus_message_get_type (DBusMessage *message);
+DBUS_EXPORT
+dbus_bool_t dbus_message_set_path (DBusMessage *message,
+ const char *object_path);
+DBUS_EXPORT
+const char* dbus_message_get_path (DBusMessage *message);
+DBUS_EXPORT
+dbus_bool_t dbus_message_has_path (DBusMessage *message,
+ const char *object_path);
+DBUS_EXPORT
+dbus_bool_t dbus_message_set_interface (DBusMessage *message,
+ const char *iface);
+DBUS_EXPORT
+const char* dbus_message_get_interface (DBusMessage *message);
+DBUS_EXPORT
+dbus_bool_t dbus_message_has_interface (DBusMessage *message,
+ const char *iface);
+DBUS_EXPORT
+dbus_bool_t dbus_message_set_member (DBusMessage *message,
+ const char *member);
+DBUS_EXPORT
+const char* dbus_message_get_member (DBusMessage *message);
+DBUS_EXPORT
+dbus_bool_t dbus_message_has_member (DBusMessage *message,
+ const char *member);
+DBUS_EXPORT
+dbus_bool_t dbus_message_set_error_name (DBusMessage *message,
+ const char *name);
+DBUS_EXPORT
+const char* dbus_message_get_error_name (DBusMessage *message);
+DBUS_EXPORT
+dbus_bool_t dbus_message_set_destination (DBusMessage *message,
+ const char *destination);
+DBUS_EXPORT
+const char* dbus_message_get_destination (DBusMessage *message);
+DBUS_EXPORT
+dbus_bool_t dbus_message_set_sender (DBusMessage *message,
+ const char *sender);
+DBUS_EXPORT
+const char* dbus_message_get_sender (DBusMessage *message);
+DBUS_EXPORT
+const char* dbus_message_get_signature (DBusMessage *message);
+DBUS_EXPORT
+void dbus_message_set_no_reply (DBusMessage *message,
+ dbus_bool_t no_reply);
+DBUS_EXPORT
+dbus_bool_t dbus_message_get_no_reply (DBusMessage *message);
+DBUS_EXPORT
+dbus_bool_t dbus_message_is_method_call (DBusMessage *message,
+ const char *iface,
+ const char *method);
+DBUS_EXPORT
+dbus_bool_t dbus_message_is_signal (DBusMessage *message,
+ const char *iface,
+ const char *signal_name);
+DBUS_EXPORT
+dbus_bool_t dbus_message_is_error (DBusMessage *message,
+ const char *error_name);
+DBUS_EXPORT
+dbus_bool_t dbus_message_has_destination (DBusMessage *message,
+ const char *bus_name);
+DBUS_EXPORT
+dbus_bool_t dbus_message_has_sender (DBusMessage *message,
+ const char *unique_bus_name);
+DBUS_EXPORT
+dbus_bool_t dbus_message_has_signature (DBusMessage *message,
+ const char *signature);
+DBUS_EXPORT
+dbus_uint32_t dbus_message_get_serial (DBusMessage *message);
+DBUS_EXPORT
+void dbus_message_set_serial (DBusMessage *message,
+ dbus_uint32_t serial);
+DBUS_EXPORT
+dbus_bool_t dbus_message_set_reply_serial (DBusMessage *message,
+ dbus_uint32_t reply_serial);
+DBUS_EXPORT
+dbus_uint32_t dbus_message_get_reply_serial (DBusMessage *message);
+
+DBUS_EXPORT
+void dbus_message_set_auto_start (DBusMessage *message,
+ dbus_bool_t auto_start);
+DBUS_EXPORT
+dbus_bool_t dbus_message_get_auto_start (DBusMessage *message);
+
+DBUS_EXPORT
+dbus_bool_t dbus_message_get_path_decomposed (DBusMessage *message,
+ char ***path);
+
+DBUS_EXPORT
+dbus_bool_t dbus_message_append_args (DBusMessage *message,
+ int first_arg_type,
+ ...);
+DBUS_EXPORT
+dbus_bool_t dbus_message_append_args_valist (DBusMessage *message,
+ int first_arg_type,
+ va_list var_args);
+DBUS_EXPORT
+dbus_bool_t dbus_message_get_args (DBusMessage *message,
+ DBusError *error,
+ int first_arg_type,
+ ...);
+DBUS_EXPORT
+dbus_bool_t dbus_message_get_args_valist (DBusMessage *message,
+ DBusError *error,
+ int first_arg_type,
+ va_list var_args);
+
+DBUS_EXPORT
+dbus_bool_t dbus_message_contains_unix_fds (DBusMessage *message);
+
+DBUS_EXPORT
+void dbus_message_iter_init_closed (DBusMessageIter *iter);
+DBUS_EXPORT
+dbus_bool_t dbus_message_iter_init (DBusMessage *message,
+ DBusMessageIter *iter);
+DBUS_EXPORT
+dbus_bool_t dbus_message_iter_has_next (DBusMessageIter *iter);
+DBUS_EXPORT
+dbus_bool_t dbus_message_iter_next (DBusMessageIter *iter);
+DBUS_EXPORT
+char* dbus_message_iter_get_signature (DBusMessageIter *iter);
+DBUS_EXPORT
+int dbus_message_iter_get_arg_type (DBusMessageIter *iter);
+DBUS_EXPORT
+int dbus_message_iter_get_element_type (DBusMessageIter *iter);
+DBUS_EXPORT
+void dbus_message_iter_recurse (DBusMessageIter *iter,
+ DBusMessageIter *sub);
+DBUS_EXPORT
+void dbus_message_iter_get_basic (DBusMessageIter *iter,
+ void *value);
+DBUS_EXPORT
+int dbus_message_iter_get_element_count(DBusMessageIter *iter);
+
+#ifndef DBUS_DISABLE_DEPRECATED
+/* This function returns the wire protocol size of the array in bytes,
+ * you do not want to know that probably
+ */
+DBUS_EXPORT
+DBUS_DEPRECATED int dbus_message_iter_get_array_len (DBusMessageIter *iter);
+#endif
+DBUS_EXPORT
+void dbus_message_iter_get_fixed_array (DBusMessageIter *iter,
+ void *value,
+ int *n_elements);
+
+
+DBUS_EXPORT
+void dbus_message_iter_init_append (DBusMessage *message,
+ DBusMessageIter *iter);
+DBUS_EXPORT
+dbus_bool_t dbus_message_iter_append_basic (DBusMessageIter *iter,
+ int type,
+ const void *value);
+DBUS_EXPORT
+dbus_bool_t dbus_message_iter_append_fixed_array (DBusMessageIter *iter,
+ int element_type,
+ const void *value,
+ int n_elements);
+DBUS_EXPORT
+dbus_bool_t dbus_message_iter_open_container (DBusMessageIter *iter,
+ int type,
+ const char *contained_signature,
+ DBusMessageIter *sub);
+DBUS_EXPORT
+dbus_bool_t dbus_message_iter_close_container (DBusMessageIter *iter,
+ DBusMessageIter *sub);
+DBUS_EXPORT
+void dbus_message_iter_abandon_container (DBusMessageIter *iter,
+ DBusMessageIter *sub);
+
+DBUS_EXPORT
+void dbus_message_iter_abandon_container_if_open (DBusMessageIter *iter,
+ DBusMessageIter *sub);
+
+DBUS_EXPORT
+void dbus_message_lock (DBusMessage *message);
+
+DBUS_EXPORT
+dbus_bool_t dbus_set_error_from_message (DBusError *error,
+ DBusMessage *message);
+
+
+DBUS_EXPORT
+dbus_bool_t dbus_message_allocate_data_slot (dbus_int32_t *slot_p);
+DBUS_EXPORT
+void dbus_message_free_data_slot (dbus_int32_t *slot_p);
+DBUS_EXPORT
+dbus_bool_t dbus_message_set_data (DBusMessage *message,
+ dbus_int32_t slot,
+ void *data,
+ DBusFreeFunction free_data_func);
+DBUS_EXPORT
+void* dbus_message_get_data (DBusMessage *message,
+ dbus_int32_t slot);
+
+DBUS_EXPORT
+int dbus_message_type_from_string (const char *type_str);
+DBUS_EXPORT
+const char* dbus_message_type_to_string (int type);
+
+DBUS_EXPORT
+dbus_bool_t dbus_message_marshal (DBusMessage *msg,
+ char **marshalled_data_p,
+ int *len_p);
+DBUS_EXPORT
+DBusMessage* dbus_message_demarshal (const char *str,
+ int len,
+ DBusError *error);
+
+DBUS_EXPORT
+int dbus_message_demarshal_bytes_needed (const char *str,
+ int len);
+
+DBUS_EXPORT
+void dbus_message_set_allow_interactive_authorization (DBusMessage *message,
+ dbus_bool_t allow);
+
+DBUS_EXPORT
+dbus_bool_t dbus_message_get_allow_interactive_authorization (
+ DBusMessage *message);
+
+/**
+ * Clear a variable or struct member that contains a #DBusMessage.
+ * If it does not contain #NULL, the message that was previously
+ * there is unreferenced with dbus_message_unref().
+ *
+ * This is very similar to dbus_clear_connection(): see that function
+ * for more details.
+ *
+ * @param pointer_to_message A pointer to a variable or struct member.
+ * pointer_to_message must not be #NULL, but *pointer_to_message
+ * may be #NULL.
+ */
+static inline void
+dbus_clear_message (DBusMessage **pointer_to_message)
+{
+ _dbus_clear_pointer_impl (DBusMessage, pointer_to_message,
+ dbus_message_unref);
+}
+
+/** @} */
+
+DBUS_END_DECLS
+
+#endif /* DBUS_MESSAGE_H */
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-misc.h b/thirdparty/linuxbsd_headers/dbus/dbus-misc.h
new file mode 100644
index 0000000000..d78d79931e
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-misc.h
@@ -0,0 +1,59 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-misc.h A few assorted public functions that don't fit elsewhere
+ *
+ * Copyright (C) 2006 Red Hat, Inc.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
+#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef DBUS_MISC_H
+#define DBUS_MISC_H
+
+#include <dbus/dbus-types.h>
+#include <dbus/dbus-errors.h>
+
+DBUS_BEGIN_DECLS
+
+/**
+ * @addtogroup DBusMisc
+ * @{
+ */
+DBUS_EXPORT
+char* dbus_get_local_machine_id (void);
+
+DBUS_EXPORT
+void dbus_get_version (int *major_version_p,
+ int *minor_version_p,
+ int *micro_version_p);
+
+DBUS_EXPORT
+dbus_bool_t dbus_setenv (const char *variable,
+ const char *value);
+
+DBUS_EXPORT
+char *dbus_try_get_local_machine_id (DBusError *error);
+
+/** @} */
+
+DBUS_END_DECLS
+
+#endif /* DBUS_MISC_H */
+
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-pending-call.h b/thirdparty/linuxbsd_headers/dbus/dbus-pending-call.h
new file mode 100644
index 0000000000..5593397a3a
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-pending-call.h
@@ -0,0 +1,98 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-pending-call.h Object representing a call in progress.
+ *
+ * Copyright (C) 2002, 2003 Red Hat Inc.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
+#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef DBUS_PENDING_CALL_H
+#define DBUS_PENDING_CALL_H
+
+#include <dbus/dbus-macros.h>
+#include <dbus/dbus-types.h>
+#include <dbus/dbus-connection.h>
+
+DBUS_BEGIN_DECLS
+
+/**
+ * @addtogroup DBusPendingCall
+ * @{
+ */
+
+#define DBUS_TIMEOUT_INFINITE ((int) 0x7fffffff)
+#define DBUS_TIMEOUT_USE_DEFAULT (-1)
+
+DBUS_EXPORT
+DBusPendingCall* dbus_pending_call_ref (DBusPendingCall *pending);
+DBUS_EXPORT
+void dbus_pending_call_unref (DBusPendingCall *pending);
+DBUS_EXPORT
+dbus_bool_t dbus_pending_call_set_notify (DBusPendingCall *pending,
+ DBusPendingCallNotifyFunction function,
+ void *user_data,
+ DBusFreeFunction free_user_data);
+DBUS_EXPORT
+void dbus_pending_call_cancel (DBusPendingCall *pending);
+DBUS_EXPORT
+dbus_bool_t dbus_pending_call_get_completed (DBusPendingCall *pending);
+DBUS_EXPORT
+DBusMessage* dbus_pending_call_steal_reply (DBusPendingCall *pending);
+DBUS_EXPORT
+void dbus_pending_call_block (DBusPendingCall *pending);
+
+DBUS_EXPORT
+dbus_bool_t dbus_pending_call_allocate_data_slot (dbus_int32_t *slot_p);
+DBUS_EXPORT
+void dbus_pending_call_free_data_slot (dbus_int32_t *slot_p);
+DBUS_EXPORT
+dbus_bool_t dbus_pending_call_set_data (DBusPendingCall *pending,
+ dbus_int32_t slot,
+ void *data,
+ DBusFreeFunction free_data_func);
+DBUS_EXPORT
+void* dbus_pending_call_get_data (DBusPendingCall *pending,
+ dbus_int32_t slot);
+
+/**
+ * Clear a variable or struct member that contains a #DBusPendingCall.
+ * If it does not contain #NULL, the pending call that was previously
+ * there is unreferenced with dbus_pending_call_unref().
+ *
+ * This is very similar to dbus_clear_connection(): see that function
+ * for more details.
+ *
+ * @param pointer_to_pending_call A pointer to a variable or struct member.
+ * pointer_to_pending_call must not be #NULL, but *pointer_to_pending_call
+ * may be #NULL.
+ */
+static inline void
+dbus_clear_pending_call (DBusPendingCall **pointer_to_pending_call)
+{
+ _dbus_clear_pointer_impl (DBusPendingCall, pointer_to_pending_call,
+ dbus_pending_call_unref);
+}
+
+/** @} */
+
+DBUS_END_DECLS
+
+#endif /* DBUS_PENDING_CALL_H */
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-protocol.h b/thirdparty/linuxbsd_headers/dbus/dbus-protocol.h
new file mode 100644
index 0000000000..2b7fd2313a
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-protocol.h
@@ -0,0 +1,481 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-protocol.h D-Bus protocol constants
+ *
+ * Copyright (C) 2002, 2003 CodeFactory AB
+ * Copyright (C) 2004, 2005 Red Hat, Inc.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef DBUS_PROTOCOL_H
+#define DBUS_PROTOCOL_H
+
+/* Don't include anything in here from anywhere else. It's
+ * intended for use by any random library.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* avoids confusing emacs indentation */
+#endif
+#endif
+
+/* Normally docs are in .c files, but there isn't a .c file for this. */
+/**
+ * @defgroup DBusProtocol Protocol constants
+ * @ingroup DBus
+ *
+ * @brief Defines constants which are part of the D-Bus protocol
+ *
+ * This header is intended for use by any library, not only libdbus.
+ *
+ * @{
+ */
+
+
+/* Message byte order */
+#define DBUS_LITTLE_ENDIAN ('l') /**< Code marking LSB-first byte order in the wire protocol. */
+#define DBUS_BIG_ENDIAN ('B') /**< Code marking MSB-first byte order in the wire protocol. */
+
+/** Protocol version. */
+#define DBUS_MAJOR_PROTOCOL_VERSION 1
+
+/** Type code that is never equal to a legitimate type code */
+#define DBUS_TYPE_INVALID ((int) '\0')
+/** #DBUS_TYPE_INVALID as a string literal instead of a int literal */
+#define DBUS_TYPE_INVALID_AS_STRING "\0"
+
+/* Primitive types */
+/** Type code marking an 8-bit unsigned integer */
+#define DBUS_TYPE_BYTE ((int) 'y')
+/** #DBUS_TYPE_BYTE as a string literal instead of a int literal */
+#define DBUS_TYPE_BYTE_AS_STRING "y"
+/** Type code marking a boolean */
+#define DBUS_TYPE_BOOLEAN ((int) 'b')
+/** #DBUS_TYPE_BOOLEAN as a string literal instead of a int literal */
+#define DBUS_TYPE_BOOLEAN_AS_STRING "b"
+/** Type code marking a 16-bit signed integer */
+#define DBUS_TYPE_INT16 ((int) 'n')
+/** #DBUS_TYPE_INT16 as a string literal instead of a int literal */
+#define DBUS_TYPE_INT16_AS_STRING "n"
+/** Type code marking a 16-bit unsigned integer */
+#define DBUS_TYPE_UINT16 ((int) 'q')
+/** #DBUS_TYPE_UINT16 as a string literal instead of a int literal */
+#define DBUS_TYPE_UINT16_AS_STRING "q"
+/** Type code marking a 32-bit signed integer */
+#define DBUS_TYPE_INT32 ((int) 'i')
+/** #DBUS_TYPE_INT32 as a string literal instead of a int literal */
+#define DBUS_TYPE_INT32_AS_STRING "i"
+/** Type code marking a 32-bit unsigned integer */
+#define DBUS_TYPE_UINT32 ((int) 'u')
+/** #DBUS_TYPE_UINT32 as a string literal instead of a int literal */
+#define DBUS_TYPE_UINT32_AS_STRING "u"
+/** Type code marking a 64-bit signed integer */
+#define DBUS_TYPE_INT64 ((int) 'x')
+/** #DBUS_TYPE_INT64 as a string literal instead of a int literal */
+#define DBUS_TYPE_INT64_AS_STRING "x"
+/** Type code marking a 64-bit unsigned integer */
+#define DBUS_TYPE_UINT64 ((int) 't')
+/** #DBUS_TYPE_UINT64 as a string literal instead of a int literal */
+#define DBUS_TYPE_UINT64_AS_STRING "t"
+/** Type code marking an 8-byte double in IEEE 754 format */
+#define DBUS_TYPE_DOUBLE ((int) 'd')
+/** #DBUS_TYPE_DOUBLE as a string literal instead of a int literal */
+#define DBUS_TYPE_DOUBLE_AS_STRING "d"
+/** Type code marking a UTF-8 encoded, nul-terminated Unicode string */
+#define DBUS_TYPE_STRING ((int) 's')
+/** #DBUS_TYPE_STRING as a string literal instead of a int literal */
+#define DBUS_TYPE_STRING_AS_STRING "s"
+/** Type code marking a D-Bus object path */
+#define DBUS_TYPE_OBJECT_PATH ((int) 'o')
+/** #DBUS_TYPE_OBJECT_PATH as a string literal instead of a int literal */
+#define DBUS_TYPE_OBJECT_PATH_AS_STRING "o"
+/** Type code marking a D-Bus type signature */
+#define DBUS_TYPE_SIGNATURE ((int) 'g')
+/** #DBUS_TYPE_SIGNATURE as a string literal instead of a int literal */
+#define DBUS_TYPE_SIGNATURE_AS_STRING "g"
+/** Type code marking a unix file descriptor */
+#define DBUS_TYPE_UNIX_FD ((int) 'h')
+/** #DBUS_TYPE_UNIX_FD as a string literal instead of a int literal */
+#define DBUS_TYPE_UNIX_FD_AS_STRING "h"
+
+/* Compound types */
+/** Type code marking a D-Bus array type */
+#define DBUS_TYPE_ARRAY ((int) 'a')
+/** #DBUS_TYPE_ARRAY as a string literal instead of a int literal */
+#define DBUS_TYPE_ARRAY_AS_STRING "a"
+/** Type code marking a D-Bus variant type */
+#define DBUS_TYPE_VARIANT ((int) 'v')
+/** #DBUS_TYPE_VARIANT as a string literal instead of a int literal */
+#define DBUS_TYPE_VARIANT_AS_STRING "v"
+
+/** STRUCT and DICT_ENTRY are sort of special since their codes can't
+ * appear in a type string, instead
+ * DBUS_STRUCT_BEGIN_CHAR/DBUS_DICT_ENTRY_BEGIN_CHAR have to appear
+ */
+/** Type code used to represent a struct; however, this type code does not appear
+ * in type signatures, instead #DBUS_STRUCT_BEGIN_CHAR and #DBUS_STRUCT_END_CHAR will
+ * appear in a signature.
+ */
+#define DBUS_TYPE_STRUCT ((int) 'r')
+/** #DBUS_TYPE_STRUCT as a string literal instead of a int literal */
+#define DBUS_TYPE_STRUCT_AS_STRING "r"
+/** Type code used to represent a dict entry; however, this type code does not appear
+ * in type signatures, instead #DBUS_DICT_ENTRY_BEGIN_CHAR and #DBUS_DICT_ENTRY_END_CHAR will
+ * appear in a signature.
+ */
+#define DBUS_TYPE_DICT_ENTRY ((int) 'e')
+/** #DBUS_TYPE_DICT_ENTRY as a string literal instead of a int literal */
+#define DBUS_TYPE_DICT_ENTRY_AS_STRING "e"
+
+/** Does not include #DBUS_TYPE_INVALID, #DBUS_STRUCT_BEGIN_CHAR, #DBUS_STRUCT_END_CHAR,
+ * #DBUS_DICT_ENTRY_BEGIN_CHAR, or #DBUS_DICT_ENTRY_END_CHAR - i.e. it is the number of
+ * valid types, not the number of distinct characters that may appear in a type signature.
+ */
+#define DBUS_NUMBER_OF_TYPES (16)
+
+/* characters other than typecodes that appear in type signatures */
+
+/** Code marking the start of a struct type in a type signature */
+#define DBUS_STRUCT_BEGIN_CHAR ((int) '(')
+/** #DBUS_STRUCT_BEGIN_CHAR as a string literal instead of a int literal */
+#define DBUS_STRUCT_BEGIN_CHAR_AS_STRING "("
+/** Code marking the end of a struct type in a type signature */
+#define DBUS_STRUCT_END_CHAR ((int) ')')
+/** #DBUS_STRUCT_END_CHAR a string literal instead of a int literal */
+#define DBUS_STRUCT_END_CHAR_AS_STRING ")"
+/** Code marking the start of a dict entry type in a type signature */
+#define DBUS_DICT_ENTRY_BEGIN_CHAR ((int) '{')
+/** #DBUS_DICT_ENTRY_BEGIN_CHAR as a string literal instead of a int literal */
+#define DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING "{"
+/** Code marking the end of a dict entry type in a type signature */
+#define DBUS_DICT_ENTRY_END_CHAR ((int) '}')
+/** #DBUS_DICT_ENTRY_END_CHAR as a string literal instead of a int literal */
+#define DBUS_DICT_ENTRY_END_CHAR_AS_STRING "}"
+
+/** Max length in bytes of a bus name, interface, or member (not object
+ * path, paths are unlimited). This is limited because lots of stuff
+ * is O(n) in this number, plus it would be obnoxious to type in a
+ * paragraph-long method name so most likely something like that would
+ * be an exploit.
+ */
+#define DBUS_MAXIMUM_NAME_LENGTH 255
+
+/** This one is 255 so it fits in a byte */
+#define DBUS_MAXIMUM_SIGNATURE_LENGTH 255
+
+/** Max length of a match rule string; to keep people from hosing the
+ * daemon with some huge rule
+ */
+#define DBUS_MAXIMUM_MATCH_RULE_LENGTH 1024
+
+/** Max arg number you can match on in a match rule, e.g.
+ * arg0='hello' is OK, arg3489720987='hello' is not
+ */
+#define DBUS_MAXIMUM_MATCH_RULE_ARG_NUMBER 63
+
+/** Max length of a marshaled array in bytes (64M, 2^26) We use signed
+ * int for lengths so must be INT_MAX or less. We need something a
+ * bit smaller than INT_MAX because the array is inside a message with
+ * header info, etc. so an INT_MAX array wouldn't allow the message
+ * overhead. The 64M number is an attempt at a larger number than
+ * we'd reasonably ever use, but small enough that your bus would chew
+ * through it fairly quickly without locking up forever. If you have
+ * data that's likely to be larger than this, you should probably be
+ * sending it in multiple incremental messages anyhow.
+ */
+#define DBUS_MAXIMUM_ARRAY_LENGTH (67108864)
+/** Number of bits you need in an unsigned to store the max array size */
+#define DBUS_MAXIMUM_ARRAY_LENGTH_BITS 26
+
+/** The maximum total message size including header and body; similar
+ * rationale to max array size.
+ */
+#define DBUS_MAXIMUM_MESSAGE_LENGTH (DBUS_MAXIMUM_ARRAY_LENGTH * 2)
+/** Number of bits you need in an unsigned to store the max message size */
+#define DBUS_MAXIMUM_MESSAGE_LENGTH_BITS 27
+
+/** The maximum total number of unix fds in a message. Similar
+ * rationale as DBUS_MAXIMUM_MESSAGE_LENGTH. However we divide by four
+ * given that one fd is an int and hence at least 32 bits.
+ */
+#define DBUS_MAXIMUM_MESSAGE_UNIX_FDS (DBUS_MAXIMUM_MESSAGE_LENGTH/4)
+/** Number of bits you need in an unsigned to store the max message unix fds */
+#define DBUS_MAXIMUM_MESSAGE_UNIX_FDS_BITS (DBUS_MAXIMUM_MESSAGE_LENGTH_BITS-2)
+
+/** Depth of recursion in the type tree. This is automatically limited
+ * to DBUS_MAXIMUM_SIGNATURE_LENGTH since you could only have an array
+ * of array of array of ... that fit in the max signature. But that's
+ * probably a bit too large.
+ */
+#define DBUS_MAXIMUM_TYPE_RECURSION_DEPTH 32
+
+/* Types of message */
+
+/** This value is never a valid message type, see dbus_message_get_type() */
+#define DBUS_MESSAGE_TYPE_INVALID 0
+/** Message type of a method call message, see dbus_message_get_type() */
+#define DBUS_MESSAGE_TYPE_METHOD_CALL 1
+/** Message type of a method return message, see dbus_message_get_type() */
+#define DBUS_MESSAGE_TYPE_METHOD_RETURN 2
+/** Message type of an error reply message, see dbus_message_get_type() */
+#define DBUS_MESSAGE_TYPE_ERROR 3
+/** Message type of a signal message, see dbus_message_get_type() */
+#define DBUS_MESSAGE_TYPE_SIGNAL 4
+
+#define DBUS_NUM_MESSAGE_TYPES 5
+
+/* Header flags */
+
+/** If set, this flag means that the sender of a message does not care about getting
+ * a reply, so the recipient need not send one. See dbus_message_set_no_reply().
+ */
+#define DBUS_HEADER_FLAG_NO_REPLY_EXPECTED 0x1
+/**
+ * If set, this flag means that even if the message bus knows how to start an owner for
+ * the destination bus name (see dbus_message_set_destination()), it should not
+ * do so. If this flag is not set, the bus may launch a program to process the
+ * message.
+ */
+#define DBUS_HEADER_FLAG_NO_AUTO_START 0x2
+/**
+ * If set on a method call, this flag means that the caller is prepared to
+ * wait for interactive authorization.
+ */
+#define DBUS_HEADER_FLAG_ALLOW_INTERACTIVE_AUTHORIZATION 0x4
+
+/* Header fields */
+
+/** Not equal to any valid header field code */
+#define DBUS_HEADER_FIELD_INVALID 0
+/** Header field code for the path - the path is the object emitting a signal or the object receiving a method call.
+ * See dbus_message_set_path().
+ */
+#define DBUS_HEADER_FIELD_PATH 1
+/** Header field code for the interface containing a member (method or signal).
+ * See dbus_message_set_interface().
+ */
+#define DBUS_HEADER_FIELD_INTERFACE 2
+/** Header field code for a member (method or signal). See dbus_message_set_member(). */
+#define DBUS_HEADER_FIELD_MEMBER 3
+/** Header field code for an error name (found in #DBUS_MESSAGE_TYPE_ERROR messages).
+ * See dbus_message_set_error_name().
+ */
+#define DBUS_HEADER_FIELD_ERROR_NAME 4
+/** Header field code for a reply serial, used to match a #DBUS_MESSAGE_TYPE_METHOD_RETURN message with the
+ * message that it's a reply to. See dbus_message_set_reply_serial().
+ */
+#define DBUS_HEADER_FIELD_REPLY_SERIAL 5
+/**
+ * Header field code for the destination bus name of a message. See dbus_message_set_destination().
+ */
+#define DBUS_HEADER_FIELD_DESTINATION 6
+/**
+ * Header field code for the sender of a message; usually initialized by the message bus.
+ * See dbus_message_set_sender().
+ */
+#define DBUS_HEADER_FIELD_SENDER 7
+/**
+ * Header field code for the type signature of a message.
+ */
+#define DBUS_HEADER_FIELD_SIGNATURE 8
+/**
+ * Header field code for the number of unix file descriptors associated
+ * with this message.
+ */
+#define DBUS_HEADER_FIELD_UNIX_FDS 9
+
+
+/**
+ * Value of the highest-numbered header field code, can be used to determine
+ * the size of an array indexed by header field code. Remember though
+ * that unknown codes must be ignored, so check for that before
+ * indexing the array.
+ */
+#define DBUS_HEADER_FIELD_LAST DBUS_HEADER_FIELD_UNIX_FDS
+
+/** Header format is defined as a signature:
+ * byte byte order
+ * byte message type ID
+ * byte flags
+ * byte protocol version
+ * uint32 body length
+ * uint32 serial
+ * array of struct (byte,variant) (field name, value)
+ *
+ * The length of the header can be computed as the
+ * fixed size of the initial data, plus the length of
+ * the array at the end, plus padding to an 8-boundary.
+ */
+#define DBUS_HEADER_SIGNATURE \
+ DBUS_TYPE_BYTE_AS_STRING \
+ DBUS_TYPE_BYTE_AS_STRING \
+ DBUS_TYPE_BYTE_AS_STRING \
+ DBUS_TYPE_BYTE_AS_STRING \
+ DBUS_TYPE_UINT32_AS_STRING \
+ DBUS_TYPE_UINT32_AS_STRING \
+ DBUS_TYPE_ARRAY_AS_STRING \
+ DBUS_STRUCT_BEGIN_CHAR_AS_STRING \
+ DBUS_TYPE_BYTE_AS_STRING \
+ DBUS_TYPE_VARIANT_AS_STRING \
+ DBUS_STRUCT_END_CHAR_AS_STRING
+
+
+/**
+ * The smallest header size that can occur. (It won't be valid due to
+ * missing required header fields.) This is 4 bytes, two uint32, an
+ * array length. This isn't any kind of resource limit, just the
+ * necessary/logical outcome of the header signature.
+ */
+#define DBUS_MINIMUM_HEADER_SIZE 16
+
+/* Errors */
+/* WARNING these get autoconverted to an enum in dbus-glib.h. Thus,
+ * if you change the order it breaks the ABI. Keep them in order.
+ * Also, don't change the formatting since that will break the sed
+ * script.
+ */
+/** A generic error; "something went wrong" - see the error message for more. */
+#define DBUS_ERROR_FAILED "org.freedesktop.DBus.Error.Failed"
+/** There was not enough memory to complete an operation. */
+#define DBUS_ERROR_NO_MEMORY "org.freedesktop.DBus.Error.NoMemory"
+/** The bus doesn't know how to launch a service to supply the bus name you wanted. */
+#define DBUS_ERROR_SERVICE_UNKNOWN "org.freedesktop.DBus.Error.ServiceUnknown"
+/** The bus name you referenced doesn't exist (i.e. no application owns it). */
+#define DBUS_ERROR_NAME_HAS_NO_OWNER "org.freedesktop.DBus.Error.NameHasNoOwner"
+/** No reply to a message expecting one, usually means a timeout occurred. */
+#define DBUS_ERROR_NO_REPLY "org.freedesktop.DBus.Error.NoReply"
+/** Something went wrong reading or writing to a socket, for example. */
+#define DBUS_ERROR_IO_ERROR "org.freedesktop.DBus.Error.IOError"
+/** A D-Bus bus address was malformed. */
+#define DBUS_ERROR_BAD_ADDRESS "org.freedesktop.DBus.Error.BadAddress"
+/** Requested operation isn't supported (like ENOSYS on UNIX). */
+#define DBUS_ERROR_NOT_SUPPORTED "org.freedesktop.DBus.Error.NotSupported"
+/** Some limited resource is exhausted. */
+#define DBUS_ERROR_LIMITS_EXCEEDED "org.freedesktop.DBus.Error.LimitsExceeded"
+/** Security restrictions don't allow doing what you're trying to do. */
+#define DBUS_ERROR_ACCESS_DENIED "org.freedesktop.DBus.Error.AccessDenied"
+/** Authentication didn't work. */
+#define DBUS_ERROR_AUTH_FAILED "org.freedesktop.DBus.Error.AuthFailed"
+/** Unable to connect to server (probably caused by ECONNREFUSED on a socket). */
+#define DBUS_ERROR_NO_SERVER "org.freedesktop.DBus.Error.NoServer"
+/** Certain timeout errors, possibly ETIMEDOUT on a socket.
+ * Note that #DBUS_ERROR_NO_REPLY is used for message reply timeouts.
+ * @warning this is confusingly-named given that #DBUS_ERROR_TIMED_OUT also exists. We can't fix
+ * it for compatibility reasons so just be careful.
+ */
+#define DBUS_ERROR_TIMEOUT "org.freedesktop.DBus.Error.Timeout"
+/** No network access (probably ENETUNREACH on a socket). */
+#define DBUS_ERROR_NO_NETWORK "org.freedesktop.DBus.Error.NoNetwork"
+/** Can't bind a socket since its address is in use (i.e. EADDRINUSE). */
+#define DBUS_ERROR_ADDRESS_IN_USE "org.freedesktop.DBus.Error.AddressInUse"
+/** The connection is disconnected and you're trying to use it. */
+#define DBUS_ERROR_DISCONNECTED "org.freedesktop.DBus.Error.Disconnected"
+/** Invalid arguments passed to a method call. */
+#define DBUS_ERROR_INVALID_ARGS "org.freedesktop.DBus.Error.InvalidArgs"
+/** Missing file. */
+#define DBUS_ERROR_FILE_NOT_FOUND "org.freedesktop.DBus.Error.FileNotFound"
+/** Existing file and the operation you're using does not silently overwrite. */
+#define DBUS_ERROR_FILE_EXISTS "org.freedesktop.DBus.Error.FileExists"
+/** Method name you invoked isn't known by the object you invoked it on. */
+#define DBUS_ERROR_UNKNOWN_METHOD "org.freedesktop.DBus.Error.UnknownMethod"
+/** Object you invoked a method on isn't known. */
+#define DBUS_ERROR_UNKNOWN_OBJECT "org.freedesktop.DBus.Error.UnknownObject"
+/** Interface you invoked a method on isn't known by the object. */
+#define DBUS_ERROR_UNKNOWN_INTERFACE "org.freedesktop.DBus.Error.UnknownInterface"
+/** Property you tried to access isn't known by the object. */
+#define DBUS_ERROR_UNKNOWN_PROPERTY "org.freedesktop.DBus.Error.UnknownProperty"
+/** Property you tried to set is read-only. */
+#define DBUS_ERROR_PROPERTY_READ_ONLY "org.freedesktop.DBus.Error.PropertyReadOnly"
+/** Certain timeout errors, e.g. while starting a service.
+ * @warning this is confusingly-named given that #DBUS_ERROR_TIMEOUT also exists. We can't fix
+ * it for compatibility reasons so just be careful.
+ */
+#define DBUS_ERROR_TIMED_OUT "org.freedesktop.DBus.Error.TimedOut"
+/** Tried to remove or modify a match rule that didn't exist. */
+#define DBUS_ERROR_MATCH_RULE_NOT_FOUND "org.freedesktop.DBus.Error.MatchRuleNotFound"
+/** The match rule isn't syntactically valid. */
+#define DBUS_ERROR_MATCH_RULE_INVALID "org.freedesktop.DBus.Error.MatchRuleInvalid"
+/** While starting a new process, the exec() call failed. */
+#define DBUS_ERROR_SPAWN_EXEC_FAILED "org.freedesktop.DBus.Error.Spawn.ExecFailed"
+/** While starting a new process, the fork() call failed. */
+#define DBUS_ERROR_SPAWN_FORK_FAILED "org.freedesktop.DBus.Error.Spawn.ForkFailed"
+/** While starting a new process, the child exited with a status code. */
+#define DBUS_ERROR_SPAWN_CHILD_EXITED "org.freedesktop.DBus.Error.Spawn.ChildExited"
+/** While starting a new process, the child exited on a signal. */
+#define DBUS_ERROR_SPAWN_CHILD_SIGNALED "org.freedesktop.DBus.Error.Spawn.ChildSignaled"
+/** While starting a new process, something went wrong. */
+#define DBUS_ERROR_SPAWN_FAILED "org.freedesktop.DBus.Error.Spawn.Failed"
+/** We failed to setup the environment correctly. */
+#define DBUS_ERROR_SPAWN_SETUP_FAILED "org.freedesktop.DBus.Error.Spawn.FailedToSetup"
+/** We failed to setup the config parser correctly. */
+#define DBUS_ERROR_SPAWN_CONFIG_INVALID "org.freedesktop.DBus.Error.Spawn.ConfigInvalid"
+/** Bus name was not valid. */
+#define DBUS_ERROR_SPAWN_SERVICE_INVALID "org.freedesktop.DBus.Error.Spawn.ServiceNotValid"
+/** Service file not found in system-services directory. */
+#define DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND "org.freedesktop.DBus.Error.Spawn.ServiceNotFound"
+/** Permissions are incorrect on the setuid helper. */
+#define DBUS_ERROR_SPAWN_PERMISSIONS_INVALID "org.freedesktop.DBus.Error.Spawn.PermissionsInvalid"
+/** Service file invalid (Name, User or Exec missing). */
+#define DBUS_ERROR_SPAWN_FILE_INVALID "org.freedesktop.DBus.Error.Spawn.FileInvalid"
+/** Tried to get a UNIX process ID and it wasn't available. */
+#define DBUS_ERROR_SPAWN_NO_MEMORY "org.freedesktop.DBus.Error.Spawn.NoMemory"
+/** Tried to get a UNIX process ID and it wasn't available. */
+#define DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN "org.freedesktop.DBus.Error.UnixProcessIdUnknown"
+/** A type signature is not valid. */
+#define DBUS_ERROR_INVALID_SIGNATURE "org.freedesktop.DBus.Error.InvalidSignature"
+/** A file contains invalid syntax or is otherwise broken. */
+#define DBUS_ERROR_INVALID_FILE_CONTENT "org.freedesktop.DBus.Error.InvalidFileContent"
+/** Asked for SELinux security context and it wasn't available. */
+#define DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown"
+/** Asked for AppArmor security context and it wasn't available. */
+#define DBUS_ERROR_APPARMOR_SECURITY_CONTEXT_UNKNOWN "org.freedesktop.DBus.Error.AppArmorSecurityContextUnknown"
+/** Asked for ADT audit data and it wasn't available. */
+#define DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN "org.freedesktop.DBus.Error.AdtAuditDataUnknown"
+/** There's already an object with the requested object path. */
+#define DBUS_ERROR_OBJECT_PATH_IN_USE "org.freedesktop.DBus.Error.ObjectPathInUse"
+/** The message meta data does not match the payload. e.g. expected
+ number of file descriptors were not sent over the socket this message was received on. */
+#define DBUS_ERROR_INCONSISTENT_MESSAGE "org.freedesktop.DBus.Error.InconsistentMessage"
+/** The message is not allowed without performing interactive authorization,
+ * but could have succeeded if an interactive authorization step was
+ * allowed. */
+#define DBUS_ERROR_INTERACTIVE_AUTHORIZATION_REQUIRED "org.freedesktop.DBus.Error.InteractiveAuthorizationRequired"
+
+/* XML introspection format */
+
+/** XML namespace of the introspection format version 1.0 */
+#define DBUS_INTROSPECT_1_0_XML_NAMESPACE "http://www.freedesktop.org/standards/dbus"
+/** XML public identifier of the introspection format version 1.0 */
+#define DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+/** XML system identifier of the introspection format version 1.0 */
+#define DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"
+/** XML document type declaration of the introspection format version 1.0 */
+#define DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE "<!DOCTYPE node PUBLIC \"" DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER "\"\n\"" DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER "\">\n"
+
+/** @} */
+
+#ifdef __cplusplus
+#if 0
+{ /* avoids confusing emacs indentation */
+#endif
+}
+#endif
+
+#endif /* DBUS_PROTOCOL_H */
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-server.h b/thirdparty/linuxbsd_headers/dbus/dbus-server.h
new file mode 100644
index 0000000000..7d8f04e496
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-server.h
@@ -0,0 +1,125 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-server.h DBusServer object
+ *
+ * Copyright (C) 2002, 2003 Red Hat Inc.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
+#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef DBUS_SERVER_H
+#define DBUS_SERVER_H
+
+#include <dbus/dbus-errors.h>
+#include <dbus/dbus-macros.h>
+#include <dbus/dbus-message.h>
+#include <dbus/dbus-connection.h>
+#include <dbus/dbus-protocol.h>
+
+DBUS_BEGIN_DECLS
+
+/**
+ * @addtogroup DBusServer
+ * @{
+ */
+
+typedef struct DBusServer DBusServer;
+
+/** Called when a new connection to the server is available. Must reference and save the new
+ * connection, or close the new connection. Set with dbus_server_set_new_connection_function().
+ */
+typedef void (* DBusNewConnectionFunction) (DBusServer *server,
+ DBusConnection *new_connection,
+ void *data);
+
+DBUS_EXPORT
+DBusServer* dbus_server_listen (const char *address,
+ DBusError *error);
+DBUS_EXPORT
+DBusServer* dbus_server_ref (DBusServer *server);
+DBUS_EXPORT
+void dbus_server_unref (DBusServer *server);
+DBUS_EXPORT
+void dbus_server_disconnect (DBusServer *server);
+DBUS_EXPORT
+dbus_bool_t dbus_server_get_is_connected (DBusServer *server);
+DBUS_EXPORT
+char* dbus_server_get_address (DBusServer *server);
+DBUS_EXPORT
+char* dbus_server_get_id (DBusServer *server);
+DBUS_EXPORT
+void dbus_server_set_new_connection_function (DBusServer *server,
+ DBusNewConnectionFunction function,
+ void *data,
+ DBusFreeFunction free_data_function);
+DBUS_EXPORT
+dbus_bool_t dbus_server_set_watch_functions (DBusServer *server,
+ DBusAddWatchFunction add_function,
+ DBusRemoveWatchFunction remove_function,
+ DBusWatchToggledFunction toggled_function,
+ void *data,
+ DBusFreeFunction free_data_function);
+DBUS_EXPORT
+dbus_bool_t dbus_server_set_timeout_functions (DBusServer *server,
+ DBusAddTimeoutFunction add_function,
+ DBusRemoveTimeoutFunction remove_function,
+ DBusTimeoutToggledFunction toggled_function,
+ void *data,
+ DBusFreeFunction free_data_function);
+DBUS_EXPORT
+dbus_bool_t dbus_server_set_auth_mechanisms (DBusServer *server,
+ const char **mechanisms);
+
+DBUS_EXPORT
+dbus_bool_t dbus_server_allocate_data_slot (dbus_int32_t *slot_p);
+DBUS_EXPORT
+void dbus_server_free_data_slot (dbus_int32_t *slot_p);
+DBUS_EXPORT
+dbus_bool_t dbus_server_set_data (DBusServer *server,
+ int slot,
+ void *data,
+ DBusFreeFunction free_data_func);
+DBUS_EXPORT
+void* dbus_server_get_data (DBusServer *server,
+ int slot);
+
+/**
+ * Clear a variable or struct member that contains a #DBusServer.
+ * If it does not contain #NULL, the server that was previously
+ * there is unreferenced with dbus_server_unref().
+ *
+ * This is very similar to dbus_clear_connection(): see that function
+ * for more details.
+ *
+ * @param pointer_to_server A pointer to a variable or struct member.
+ * pointer_to_server must not be #NULL, but *pointer_to_server
+ * may be #NULL.
+ */
+static inline void
+dbus_clear_server (DBusServer **pointer_to_server)
+{
+ _dbus_clear_pointer_impl (DBusServer, pointer_to_server, dbus_server_unref);
+}
+
+/** @} */
+
+DBUS_END_DECLS
+
+#endif /* DBUS_SERVER_H */
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-shared.h b/thirdparty/linuxbsd_headers/dbus/dbus-shared.h
new file mode 100644
index 0000000000..7ab91035ea
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-shared.h
@@ -0,0 +1,136 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-shared.h Stuff used by both dbus/dbus.h low-level and C/C++ binding APIs
+ *
+ * Copyright (C) 2004 Red Hat, Inc.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef DBUS_SHARED_H
+#define DBUS_SHARED_H
+
+/* Don't include anything in here from anywhere else. It's
+ * intended for use by any random library.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* avoids confusing emacs indentation */
+#endif
+#endif
+
+/* Normally docs are in .c files, but there isn't a .c file for this. */
+/**
+ * @defgroup DBusShared Shared constants
+ * @ingroup DBus
+ *
+ * @brief Shared header included by both libdbus and C/C++ bindings such as the GLib bindings.
+ *
+ * Usually a C/C++ binding such as the GLib or Qt binding won't want to include dbus.h in its
+ * public headers. However, a few constants and macros may be useful to include; those are
+ * found here and in dbus-protocol.h
+ *
+ * @{
+ */
+
+
+/**
+ * Well-known bus types. See dbus_bus_get().
+ */
+typedef enum
+{
+ DBUS_BUS_SESSION, /**< The login session bus */
+ DBUS_BUS_SYSTEM, /**< The systemwide bus */
+ DBUS_BUS_STARTER /**< The bus that started us, if any */
+} DBusBusType;
+
+/**
+ * Results that a message handler can return.
+ */
+typedef enum
+{
+ DBUS_HANDLER_RESULT_HANDLED, /**< Message has had its effect - no need to run more handlers. */
+ DBUS_HANDLER_RESULT_NOT_YET_HANDLED, /**< Message has not had any effect - see if other handlers want it. */
+ DBUS_HANDLER_RESULT_NEED_MEMORY /**< Need more memory in order to return #DBUS_HANDLER_RESULT_HANDLED or #DBUS_HANDLER_RESULT_NOT_YET_HANDLED. Please try again later with more memory. */
+} DBusHandlerResult;
+
+/* Bus names */
+
+/** The bus name used to talk to the bus itself. */
+#define DBUS_SERVICE_DBUS "org.freedesktop.DBus"
+
+/* Paths */
+/** The object path used to talk to the bus itself. */
+#define DBUS_PATH_DBUS "/org/freedesktop/DBus"
+/** The object path used in local/in-process-generated messages. */
+#define DBUS_PATH_LOCAL "/org/freedesktop/DBus/Local"
+
+/* Interfaces, these #define don't do much other than
+ * catch typos at compile time
+ */
+/** The interface exported by the object with #DBUS_SERVICE_DBUS and #DBUS_PATH_DBUS */
+#define DBUS_INTERFACE_DBUS "org.freedesktop.DBus"
+/** The monitoring interface exported by the dbus-daemon */
+#define DBUS_INTERFACE_MONITORING "org.freedesktop.DBus.Monitoring"
+
+/** The verbose interface exported by the dbus-daemon */
+#define DBUS_INTERFACE_VERBOSE "org.freedesktop.DBus.Verbose"
+/** The interface supported by introspectable objects */
+#define DBUS_INTERFACE_INTROSPECTABLE "org.freedesktop.DBus.Introspectable"
+/** The interface supported by objects with properties */
+#define DBUS_INTERFACE_PROPERTIES "org.freedesktop.DBus.Properties"
+/** The interface supported by most dbus peers */
+#define DBUS_INTERFACE_PEER "org.freedesktop.DBus.Peer"
+
+/** This is a special interface whose methods can only be invoked
+ * by the local implementation (messages from remote apps aren't
+ * allowed to specify this interface).
+ */
+#define DBUS_INTERFACE_LOCAL "org.freedesktop.DBus.Local"
+
+/* Owner flags */
+#define DBUS_NAME_FLAG_ALLOW_REPLACEMENT 0x1 /**< Allow another service to become the primary owner if requested */
+#define DBUS_NAME_FLAG_REPLACE_EXISTING 0x2 /**< Request to replace the current primary owner */
+#define DBUS_NAME_FLAG_DO_NOT_QUEUE 0x4 /**< If we can not become the primary owner do not place us in the queue */
+
+/* Replies to request for a name */
+#define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1 /**< Service has become the primary owner of the requested name */
+#define DBUS_REQUEST_NAME_REPLY_IN_QUEUE 2 /**< Service could not become the primary owner and has been placed in the queue */
+#define DBUS_REQUEST_NAME_REPLY_EXISTS 3 /**< Service is already in the queue */
+#define DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER 4 /**< Service is already the primary owner */
+
+/* Replies to releasing a name */
+#define DBUS_RELEASE_NAME_REPLY_RELEASED 1 /**< Service was released from the given name */
+#define DBUS_RELEASE_NAME_REPLY_NON_EXISTENT 2 /**< The given name does not exist on the bus */
+#define DBUS_RELEASE_NAME_REPLY_NOT_OWNER 3 /**< Service is not an owner of the given name */
+
+/* Replies to service starts */
+#define DBUS_START_REPLY_SUCCESS 1 /**< Service was auto started */
+#define DBUS_START_REPLY_ALREADY_RUNNING 2 /**< Service was already running */
+
+/** @} */
+
+#ifdef __cplusplus
+#if 0
+{ /* avoids confusing emacs indentation */
+#endif
+}
+#endif
+
+#endif /* DBUS_SHARED_H */
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-signature.h b/thirdparty/linuxbsd_headers/dbus/dbus-signature.h
new file mode 100644
index 0000000000..443941c81b
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-signature.h
@@ -0,0 +1,95 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-signatures.h utility functions for D-Bus types
+ *
+ * Copyright (C) 2005 Red Hat Inc.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
+#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef DBUS_SIGNATURES_H
+#define DBUS_SIGNATURES_H
+
+#include <dbus/dbus-macros.h>
+#include <dbus/dbus-types.h>
+#include <dbus/dbus-errors.h>
+
+DBUS_BEGIN_DECLS
+
+/**
+ * @addtogroup DBusSignature
+ * @{
+ */
+
+/**
+ * DBusSignatureIter struct; contains no public fields
+ */
+typedef struct
+{
+ void *dummy1; /**< Don't use this */
+ void *dummy2; /**< Don't use this */
+ dbus_uint32_t dummy8; /**< Don't use this */
+ int dummy12; /**< Don't use this */
+ int dummy17; /**< Don't use this */
+} DBusSignatureIter;
+
+DBUS_EXPORT
+void dbus_signature_iter_init (DBusSignatureIter *iter,
+ const char *signature);
+
+DBUS_EXPORT
+int dbus_signature_iter_get_current_type (const DBusSignatureIter *iter);
+
+DBUS_EXPORT
+char * dbus_signature_iter_get_signature (const DBusSignatureIter *iter);
+
+DBUS_EXPORT
+int dbus_signature_iter_get_element_type (const DBusSignatureIter *iter);
+
+DBUS_EXPORT
+dbus_bool_t dbus_signature_iter_next (DBusSignatureIter *iter);
+
+DBUS_EXPORT
+void dbus_signature_iter_recurse (const DBusSignatureIter *iter,
+ DBusSignatureIter *subiter);
+
+DBUS_EXPORT
+dbus_bool_t dbus_signature_validate (const char *signature,
+ DBusError *error);
+
+DBUS_EXPORT
+dbus_bool_t dbus_signature_validate_single (const char *signature,
+ DBusError *error);
+
+DBUS_EXPORT
+dbus_bool_t dbus_type_is_valid (int typecode);
+
+DBUS_EXPORT
+dbus_bool_t dbus_type_is_basic (int typecode);
+DBUS_EXPORT
+dbus_bool_t dbus_type_is_container (int typecode);
+DBUS_EXPORT
+dbus_bool_t dbus_type_is_fixed (int typecode);
+
+/** @} */
+
+DBUS_END_DECLS
+
+#endif /* DBUS_SIGNATURE_H */
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-syntax.h b/thirdparty/linuxbsd_headers/dbus/dbus-syntax.h
new file mode 100644
index 0000000000..daf20f06e1
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-syntax.h
@@ -0,0 +1,58 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-syntax.h - utility functions for strings with special syntax
+ *
+ * Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+ * Copyright © 2011 Nokia Corporation
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
+#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef DBUS_SYNTAX_H
+#define DBUS_SYNTAX_H
+
+#include <dbus/dbus-macros.h>
+#include <dbus/dbus-types.h>
+#include <dbus/dbus-errors.h>
+
+DBUS_BEGIN_DECLS
+
+DBUS_EXPORT
+dbus_bool_t dbus_validate_path (const char *path,
+ DBusError *error);
+DBUS_EXPORT
+dbus_bool_t dbus_validate_interface (const char *name,
+ DBusError *error);
+DBUS_EXPORT
+dbus_bool_t dbus_validate_member (const char *name,
+ DBusError *error);
+DBUS_EXPORT
+dbus_bool_t dbus_validate_error_name (const char *name,
+ DBusError *error);
+DBUS_EXPORT
+dbus_bool_t dbus_validate_bus_name (const char *name,
+ DBusError *error);
+DBUS_EXPORT
+dbus_bool_t dbus_validate_utf8 (const char *alleged_utf8,
+ DBusError *error);
+
+DBUS_END_DECLS
+
+#endif /* multiple-inclusion guard */
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-threads.h b/thirdparty/linuxbsd_headers/dbus/dbus-threads.h
new file mode 100644
index 0000000000..6d28a0b631
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-threads.h
@@ -0,0 +1,189 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-threads.h D-Bus threads handling
+ *
+ * Copyright (C) 2002 Red Hat Inc.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
+#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef DBUS_THREADS_H
+#define DBUS_THREADS_H
+
+#include <dbus/dbus-macros.h>
+#include <dbus/dbus-types.h>
+
+DBUS_BEGIN_DECLS
+
+/**
+ * @addtogroup DBusThreads
+ * @{
+ */
+
+/** An opaque mutex type provided by the #DBusThreadFunctions implementation installed by dbus_threads_init(). */
+typedef struct DBusMutex DBusMutex;
+/** An opaque condition variable type provided by the #DBusThreadFunctions implementation installed by dbus_threads_init(). */
+typedef struct DBusCondVar DBusCondVar;
+
+/** Deprecated, provide DBusRecursiveMutexNewFunction instead. */
+typedef DBusMutex* (* DBusMutexNewFunction) (void);
+/** Deprecated, provide DBusRecursiveMutexFreeFunction instead. */
+typedef void (* DBusMutexFreeFunction) (DBusMutex *mutex);
+/** Deprecated, provide DBusRecursiveMutexLockFunction instead. Return value is lock success, but gets ignored in practice. */
+typedef dbus_bool_t (* DBusMutexLockFunction) (DBusMutex *mutex);
+/** Deprecated, provide DBusRecursiveMutexUnlockFunction instead. Return value is unlock success, but gets ignored in practice. */
+typedef dbus_bool_t (* DBusMutexUnlockFunction) (DBusMutex *mutex);
+
+/** Creates a new recursively-lockable mutex, or returns #NULL if not
+ * enough memory. Can only fail due to lack of memory. Found in
+ * #DBusThreadFunctions. Do not just use PTHREAD_MUTEX_RECURSIVE for
+ * this, because it does not save/restore the recursion count when
+ * waiting on a condition. libdbus requires the Java-style behavior
+ * where the mutex is fully unlocked to wait on a condition.
+ */
+typedef DBusMutex* (* DBusRecursiveMutexNewFunction) (void);
+/** Frees a recursively-lockable mutex. Found in #DBusThreadFunctions.
+ */
+typedef void (* DBusRecursiveMutexFreeFunction) (DBusMutex *mutex);
+/** Locks a recursively-lockable mutex. Found in #DBusThreadFunctions.
+ * Can only fail due to lack of memory.
+ */
+typedef void (* DBusRecursiveMutexLockFunction) (DBusMutex *mutex);
+/** Unlocks a recursively-lockable mutex. Found in #DBusThreadFunctions.
+ * Can only fail due to lack of memory.
+ */
+typedef void (* DBusRecursiveMutexUnlockFunction) (DBusMutex *mutex);
+
+/** Creates a new condition variable. Found in #DBusThreadFunctions.
+ * Can only fail (returning #NULL) due to lack of memory.
+ */
+typedef DBusCondVar* (* DBusCondVarNewFunction) (void);
+/** Frees a condition variable. Found in #DBusThreadFunctions.
+ */
+typedef void (* DBusCondVarFreeFunction) (DBusCondVar *cond);
+
+/** Waits on a condition variable. Found in
+ * #DBusThreadFunctions. Must work with either a recursive or
+ * nonrecursive mutex, whichever the thread implementation
+ * provides. Note that PTHREAD_MUTEX_RECURSIVE does not work with
+ * condition variables (does not save/restore the recursion count) so
+ * don't try using simply pthread_cond_wait() and a
+ * PTHREAD_MUTEX_RECURSIVE to implement this, it won't work right.
+ *
+ * Has no error conditions. Must succeed if it returns.
+ */
+typedef void (* DBusCondVarWaitFunction) (DBusCondVar *cond,
+ DBusMutex *mutex);
+
+/** Waits on a condition variable with a timeout. Found in
+ * #DBusThreadFunctions. Returns #TRUE if the wait did not
+ * time out, and #FALSE if it did.
+ *
+ * Has no error conditions. Must succeed if it returns.
+ */
+typedef dbus_bool_t (* DBusCondVarWaitTimeoutFunction) (DBusCondVar *cond,
+ DBusMutex *mutex,
+ int timeout_milliseconds);
+/** Wakes one waiting thread on a condition variable. Found in #DBusThreadFunctions.
+ *
+ * Has no error conditions. Must succeed if it returns.
+ */
+typedef void (* DBusCondVarWakeOneFunction) (DBusCondVar *cond);
+
+/** Wakes all waiting threads on a condition variable. Found in #DBusThreadFunctions.
+ *
+ * Has no error conditions. Must succeed if it returns.
+ */
+typedef void (* DBusCondVarWakeAllFunction) (DBusCondVar *cond);
+
+/**
+ * Flags indicating which functions are present in #DBusThreadFunctions. Used to allow
+ * the library to detect older callers of dbus_threads_init() if new possible functions
+ * are added to #DBusThreadFunctions.
+ */
+typedef enum
+{
+ DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK = 1 << 0,
+ DBUS_THREAD_FUNCTIONS_MUTEX_FREE_MASK = 1 << 1,
+ DBUS_THREAD_FUNCTIONS_MUTEX_LOCK_MASK = 1 << 2,
+ DBUS_THREAD_FUNCTIONS_MUTEX_UNLOCK_MASK = 1 << 3,
+ DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK = 1 << 4,
+ DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK = 1 << 5,
+ DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK = 1 << 6,
+ DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK = 1 << 7,
+ DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK = 1 << 8,
+ DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK = 1 << 9,
+ DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_NEW_MASK = 1 << 10,
+ DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_FREE_MASK = 1 << 11,
+ DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_LOCK_MASK = 1 << 12,
+ DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_UNLOCK_MASK = 1 << 13,
+ DBUS_THREAD_FUNCTIONS_ALL_MASK = (1 << 14) - 1
+} DBusThreadFunctionsMask;
+
+/**
+ * Functions that must be implemented to make the D-Bus library
+ * thread-aware.
+ *
+ * If you supply both recursive and non-recursive mutexes,
+ * libdbus will use the non-recursive version for condition variables,
+ * and the recursive version in other contexts.
+ *
+ * The condition variable functions have to work with nonrecursive
+ * mutexes if you provide those, or with recursive mutexes if you
+ * don't.
+ */
+typedef struct
+{
+ unsigned int mask; /**< Mask indicating which functions are present. */
+
+ DBusMutexNewFunction mutex_new; /**< Function to create a mutex; optional and deprecated. */
+ DBusMutexFreeFunction mutex_free; /**< Function to free a mutex; optional and deprecated. */
+ DBusMutexLockFunction mutex_lock; /**< Function to lock a mutex; optional and deprecated. */
+ DBusMutexUnlockFunction mutex_unlock; /**< Function to unlock a mutex; optional and deprecated. */
+
+ DBusCondVarNewFunction condvar_new; /**< Function to create a condition variable */
+ DBusCondVarFreeFunction condvar_free; /**< Function to free a condition variable */
+ DBusCondVarWaitFunction condvar_wait; /**< Function to wait on a condition */
+ DBusCondVarWaitTimeoutFunction condvar_wait_timeout; /**< Function to wait on a condition with a timeout */
+ DBusCondVarWakeOneFunction condvar_wake_one; /**< Function to wake one thread waiting on the condition */
+ DBusCondVarWakeAllFunction condvar_wake_all; /**< Function to wake all threads waiting on the condition */
+
+ DBusRecursiveMutexNewFunction recursive_mutex_new; /**< Function to create a recursive mutex */
+ DBusRecursiveMutexFreeFunction recursive_mutex_free; /**< Function to free a recursive mutex */
+ DBusRecursiveMutexLockFunction recursive_mutex_lock; /**< Function to lock a recursive mutex */
+ DBusRecursiveMutexUnlockFunction recursive_mutex_unlock; /**< Function to unlock a recursive mutex */
+
+ void (* padding1) (void); /**< Reserved for future expansion */
+ void (* padding2) (void); /**< Reserved for future expansion */
+ void (* padding3) (void); /**< Reserved for future expansion */
+ void (* padding4) (void); /**< Reserved for future expansion */
+
+} DBusThreadFunctions;
+
+DBUS_EXPORT
+dbus_bool_t dbus_threads_init (const DBusThreadFunctions *functions);
+DBUS_EXPORT
+dbus_bool_t dbus_threads_init_default (void);
+
+/** @} */
+
+DBUS_END_DECLS
+
+#endif /* DBUS_THREADS_H */
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus-types.h b/thirdparty/linuxbsd_headers/dbus/dbus-types.h
new file mode 100644
index 0000000000..021a55af90
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus-types.h
@@ -0,0 +1,156 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-types.h types such as dbus_bool_t
+ *
+ * Copyright (C) 2002 Red Hat Inc.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
+#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef DBUS_TYPES_H
+#define DBUS_TYPES_H
+
+#include <stddef.h>
+#include <dbus/dbus-arch-deps.h>
+
+typedef dbus_uint32_t dbus_unichar_t;
+/* boolean size must be fixed at 4 bytes due to wire protocol! */
+typedef dbus_uint32_t dbus_bool_t;
+
+/* Normally docs are in .c files, but there isn't a .c file for this. */
+/**
+ * @defgroup DBusTypes Basic types
+ * @ingroup DBus
+ * @brief dbus_bool_t, dbus_int32_t, etc.
+ *
+ * Typedefs for common primitive types.
+ *
+ * @{
+ */
+
+/**
+ * @typedef dbus_bool_t
+ *
+ * A boolean, valid values are #TRUE and #FALSE.
+ */
+
+/**
+ * @typedef dbus_uint32_t
+ *
+ * A 32-bit unsigned integer on all platforms.
+ */
+
+/**
+ * @typedef dbus_int32_t
+ *
+ * A 32-bit signed integer on all platforms.
+ */
+
+/**
+ * @typedef dbus_uint16_t
+ *
+ * A 16-bit unsigned integer on all platforms.
+ */
+
+/**
+ * @typedef dbus_int16_t
+ *
+ * A 16-bit signed integer on all platforms.
+ */
+
+
+/**
+ * @typedef dbus_uint64_t
+ *
+ * A 64-bit unsigned integer.
+ */
+
+/**
+ * @typedef dbus_int64_t
+ *
+ * A 64-bit signed integer.
+ */
+
+/**
+ * @def DBUS_HAVE_INT64
+ *
+ * Always defined.
+ *
+ * In older libdbus versions, this would be undefined if there was no
+ * 64-bit integer type on that platform. libdbus no longer supports
+ * such platforms.
+ */
+
+/**
+ * @def DBUS_INT64_CONSTANT
+ *
+ * Declare a 64-bit signed integer constant. The macro
+ * adds the necessary "LL" or whatever after the integer,
+ * giving a literal such as "325145246765LL"
+ */
+
+/**
+ * @def DBUS_UINT64_CONSTANT
+ *
+ * Declare a 64-bit unsigned integer constant. The macro
+ * adds the necessary "ULL" or whatever after the integer,
+ * giving a literal such as "325145246765ULL"
+ */
+
+/**
+ * An 8-byte struct you could use to access int64 without having
+ * int64 support. Use #dbus_int64_t or #dbus_uint64_t instead.
+ */
+typedef struct
+{
+ dbus_uint32_t first32; /**< first 32 bits in the 8 bytes (beware endian issues) */
+ dbus_uint32_t second32; /**< second 32 bits in the 8 bytes (beware endian issues) */
+} DBus8ByteStruct;
+
+/**
+ * A simple value union that lets you access bytes as if they
+ * were various types; useful when dealing with basic types via
+ * void pointers and varargs.
+ *
+ * This union also contains a pointer member (which can be used
+ * to retrieve a string from dbus_message_iter_get_basic(), for
+ * instance), so on future platforms it could conceivably be larger
+ * than 8 bytes.
+ */
+typedef union
+{
+ unsigned char bytes[8]; /**< as 8 individual bytes */
+ dbus_int16_t i16; /**< as int16 */
+ dbus_uint16_t u16; /**< as int16 */
+ dbus_int32_t i32; /**< as int32 */
+ dbus_uint32_t u32; /**< as int32 */
+ dbus_bool_t bool_val; /**< as boolean */
+ dbus_int64_t i64; /**< as int64 */
+ dbus_uint64_t u64; /**< as int64 */
+ DBus8ByteStruct eight; /**< as 8-byte struct */
+ double dbl; /**< as double */
+ unsigned char byt; /**< as byte */
+ char *str; /**< as char* (string, object path or signature) */
+ int fd; /**< as Unix file descriptor */
+} DBusBasicValue;
+
+/** @} */
+
+#endif /* DBUS_TYPES_H */
diff --git a/thirdparty/linuxbsd_headers/dbus/dbus.h b/thirdparty/linuxbsd_headers/dbus/dbus.h
new file mode 100644
index 0000000000..932ceab383
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/dbus/dbus.h
@@ -0,0 +1,104 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus.h Convenience header including all other headers
+ *
+ * Copyright (C) 2002, 2003 Red Hat Inc.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef DBUS_H
+#define DBUS_H
+
+#define DBUS_INSIDE_DBUS_H 1
+
+#include <dbus/dbus-arch-deps.h>
+#include <dbus/dbus-address.h>
+#include <dbus/dbus-bus.h>
+#include <dbus/dbus-connection.h>
+#include <dbus/dbus-errors.h>
+#include <dbus/dbus-macros.h>
+#include <dbus/dbus-message.h>
+#include <dbus/dbus-misc.h>
+#include <dbus/dbus-pending-call.h>
+#include <dbus/dbus-protocol.h>
+#include <dbus/dbus-server.h>
+#include <dbus/dbus-shared.h>
+#include <dbus/dbus-signature.h>
+#include <dbus/dbus-syntax.h>
+#include <dbus/dbus-threads.h>
+#include <dbus/dbus-types.h>
+
+#undef DBUS_INSIDE_DBUS_H
+
+/**
+ * @defgroup DBus D-Bus low-level public API
+ * @brief The low-level public API of the D-Bus library
+ *
+ * libdbus provides a low-level C API intended primarily for use by
+ * bindings to specific object systems and languages. D-Bus is most
+ * convenient when used with the GLib bindings, Python bindings, Qt
+ * bindings, Mono bindings, and so forth. This low-level API has a
+ * lot of complexity useful only for bindings.
+ *
+ * @{
+ */
+
+/** @} */
+
+/**
+ * @mainpage
+ *
+ * This manual documents the <em>low-level</em> D-Bus C API. <b>If you use
+ * this low-level API directly, you're signing up for some pain.</b>
+ *
+ * Caveats aside, you might get started learning the low-level API by reading
+ * about @ref DBusConnection and @ref DBusMessage.
+ *
+ * There are several other places to look for D-Bus information, such
+ * as the tutorial and the specification; those can be found at <a
+ * href="http://www.freedesktop.org/wiki/Software/dbus">the D-Bus
+ * website</a>. If you're interested in a sysadmin or package
+ * maintainer's perspective on the dbus-daemon itself and its
+ * configuration, be sure to check out the man pages as well.
+ *
+ * The low-level API documented in this manual deliberately lacks
+ * most convenience functions - those are left up to higher-level libraries
+ * based on frameworks such as GLib, Qt, Python, Mono, Java,
+ * etc. These higher-level libraries (often called "D-Bus bindings")
+ * have features such as object systems and main loops that allow a
+ * <em>much</em> more convenient API.
+ *
+ * The low-level API also contains plenty of clutter to support
+ * integration with arbitrary object systems, languages, main loops,
+ * and so forth. These features add a lot of noise to the API that you
+ * probably don't care about unless you're coding a binding.
+ *
+ * This manual also contains docs for @ref DBusInternals "D-Bus internals",
+ * so you can use it to get oriented to the D-Bus source code if you're
+ * interested in patching the code. You should also read the
+ * file HACKING which comes with the source code if you plan to contribute to
+ * D-Bus.
+ *
+ * As you read the code, you can identify internal D-Bus functions
+ * because they start with an underscore ('_') character. Also, any
+ * identifier or macro that lacks a DBus, dbus_, or DBUS_ namepace
+ * prefix is internal, with a couple of exceptions such as #NULL,
+ * #TRUE, and #FALSE.
+ */
+
+#endif /* DBUS_H */
diff --git a/thirdparty/linuxbsd_headers/fontconfig/fcfreetype.h b/thirdparty/linuxbsd_headers/fontconfig/fcfreetype.h
new file mode 100644
index 0000000000..753fdf9da8
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/fontconfig/fcfreetype.h
@@ -0,0 +1,59 @@
+/*
+ * fontconfig/fontconfig/fcfreetype.h
+ *
+ * Copyright © 2001 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the author(s) not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. The authors make no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _FCFREETYPE_H_
+#define _FCFREETYPE_H_
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+#ifndef FcPublic
+#define FcPublic
+#endif
+
+_FCFUNCPROTOBEGIN
+
+FcPublic FT_UInt
+FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4);
+
+FcPublic FcCharSet *
+FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing);
+
+FcPublic FcCharSet *
+FcFreeTypeCharSet (FT_Face face, FcBlanks *blanks);
+
+FcPublic FcResult
+FcPatternGetFTFace (const FcPattern *p, const char *object, int n, FT_Face *f);
+
+FcPublic FcBool
+FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f);
+
+FcPublic FcPattern *
+FcFreeTypeQueryFace (const FT_Face face,
+ const FcChar8 *file,
+ int id,
+ FcBlanks *blanks);
+
+_FCFUNCPROTOEND
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/fontconfig/fcprivate.h b/thirdparty/linuxbsd_headers/fontconfig/fcprivate.h
new file mode 100644
index 0000000000..a6ee5c2349
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/fontconfig/fcprivate.h
@@ -0,0 +1,127 @@
+/*
+ * fontconfig/fontconfig/fcprivate.h
+ *
+ * Copyright © 2001 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the author(s) not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. The authors make no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _FCPRIVATE_H_
+#define _FCPRIVATE_H_
+
+/*
+ * I tried this with functions that took va_list* arguments
+ * but portability concerns made me change these functions
+ * into macros (sigh).
+ */
+
+#define FcPatternVapBuild(result, orig, va) \
+{ \
+ FcPattern *__p__ = (orig); \
+ const char *__o__; \
+ FcValue __v__; \
+ \
+ if (!__p__) \
+ { \
+ __p__ = FcPatternCreate (); \
+ if (!__p__) \
+ goto _FcPatternVapBuild_bail0; \
+ } \
+ for (;;) \
+ { \
+ __o__ = va_arg (va, const char *); \
+ if (!__o__) \
+ break; \
+ __v__.type = va_arg (va, int); \
+ switch (__v__.type) { \
+ case FcTypeUnknown: \
+ case FcTypeVoid: \
+ goto _FcPatternVapBuild_bail1; \
+ case FcTypeInteger: \
+ __v__.u.i = va_arg (va, int); \
+ break; \
+ case FcTypeDouble: \
+ __v__.u.d = va_arg (va, double); \
+ break; \
+ case FcTypeString: \
+ __v__.u.s = va_arg (va, const FcChar8 *); \
+ break; \
+ case FcTypeBool: \
+ __v__.u.b = va_arg (va, FcBool); \
+ break; \
+ case FcTypeMatrix: \
+ __v__.u.m = va_arg (va, const FcMatrix *); \
+ break; \
+ case FcTypeCharSet: \
+ __v__.u.c = va_arg (va, const FcCharSet *); \
+ break; \
+ case FcTypeFTFace: \
+ __v__.u.f = va_arg (va, FT_Face); \
+ break; \
+ case FcTypeLangSet: \
+ __v__.u.l = va_arg (va, const FcLangSet *); \
+ break; \
+ case FcTypeRange: \
+ __v__.u.r = va_arg (va, const FcRange *); \
+ break; \
+ } \
+ if (!FcPatternAdd (__p__, __o__, __v__, FcTrue)) \
+ goto _FcPatternVapBuild_bail1; \
+ } \
+ result = __p__; \
+ goto _FcPatternVapBuild_return; \
+ \
+_FcPatternVapBuild_bail1: \
+ if (!orig) \
+ FcPatternDestroy (__p__); \
+_FcPatternVapBuild_bail0: \
+ result = (void*)0; \
+ \
+_FcPatternVapBuild_return: \
+ ; \
+}
+
+
+#define FcObjectSetVapBuild(__ret__, __first__, __va__) \
+{ \
+ FcObjectSet *__os__; \
+ const char *__ob__; \
+ \
+ __ret__ = 0; \
+ __os__ = FcObjectSetCreate (); \
+ if (!__os__) \
+ goto _FcObjectSetVapBuild_bail0; \
+ __ob__ = __first__; \
+ while (__ob__) \
+ { \
+ if (!FcObjectSetAdd (__os__, __ob__)) \
+ goto _FcObjectSetVapBuild_bail1; \
+ __ob__ = va_arg (__va__, const char *); \
+ } \
+ __ret__ = __os__; \
+ \
+_FcObjectSetVapBuild_bail1: \
+ if (!__ret__ && __os__) \
+ FcObjectSetDestroy (__os__); \
+_FcObjectSetVapBuild_bail0: \
+ ; \
+}
+
+#endif /* _FCPRIVATE_H_ */
+
diff --git a/thirdparty/linuxbsd_headers/fontconfig/fontconfig.h b/thirdparty/linuxbsd_headers/fontconfig/fontconfig.h
new file mode 100644
index 0000000000..58bc3e2a8e
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/fontconfig/fontconfig.h
@@ -0,0 +1,1067 @@
+/*
+ * fontconfig/fontconfig/fontconfig.h
+ *
+ * Copyright © 2001 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the author(s) not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. The authors make no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _FONTCONFIG_H_
+#define _FONTCONFIG_H_
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdarg.h>
+#include <limits.h>
+
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+#define FC_ATTRIBUTE_SENTINEL(x) __attribute__((__sentinel__(0)))
+#else
+#define FC_ATTRIBUTE_SENTINEL(x)
+#endif
+
+#ifndef FcPublic
+#define FcPublic
+#endif
+
+typedef unsigned char FcChar8;
+typedef unsigned short FcChar16;
+typedef unsigned int FcChar32;
+typedef int FcBool;
+
+/*
+ * Current Fontconfig version number. This same number
+ * must appear in the fontconfig configure.in file. Yes,
+ * it'a a pain to synchronize version numbers like this.
+ */
+
+#define FC_MAJOR 2
+#define FC_MINOR 12
+#define FC_REVISION 6
+
+#define FC_VERSION ((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION))
+
+/*
+ * Current font cache file format version
+ * This is appended to the cache files so that multiple
+ * versions of the library will peacefully coexist
+ *
+ * Change this value whenever the disk format for the cache file
+ * changes in any non-compatible way. Try to avoid such changes as
+ * it means multiple copies of the font information.
+ */
+
+#define FC_CACHE_VERSION_NUMBER 7
+#define _FC_STRINGIFY_(s) #s
+#define _FC_STRINGIFY(s) _FC_STRINGIFY_(s)
+#define FC_CACHE_VERSION _FC_STRINGIFY(FC_CACHE_VERSION_NUMBER)
+
+#define FcTrue 1
+#define FcFalse 0
+
+#define FC_FAMILY "family" /* String */
+#define FC_STYLE "style" /* String */
+#define FC_SLANT "slant" /* Int */
+#define FC_WEIGHT "weight" /* Int */
+#define FC_SIZE "size" /* Range (double) */
+#define FC_ASPECT "aspect" /* Double */
+#define FC_PIXEL_SIZE "pixelsize" /* Double */
+#define FC_SPACING "spacing" /* Int */
+#define FC_FOUNDRY "foundry" /* String */
+#define FC_ANTIALIAS "antialias" /* Bool (depends) */
+#define FC_HINTING "hinting" /* Bool (true) */
+#define FC_HINT_STYLE "hintstyle" /* Int */
+#define FC_VERTICAL_LAYOUT "verticallayout" /* Bool (false) */
+#define FC_AUTOHINT "autohint" /* Bool (false) */
+/* FC_GLOBAL_ADVANCE is deprecated. this is simply ignored on freetype 2.4.5 or later */
+#define FC_GLOBAL_ADVANCE "globaladvance" /* Bool (true) */
+#define FC_WIDTH "width" /* Int */
+#define FC_FILE "file" /* String */
+#define FC_INDEX "index" /* Int */
+#define FC_FT_FACE "ftface" /* FT_Face */
+#define FC_RASTERIZER "rasterizer" /* String (deprecated) */
+#define FC_OUTLINE "outline" /* Bool */
+#define FC_SCALABLE "scalable" /* Bool */
+#define FC_COLOR "color" /* Bool */
+#define FC_SCALE "scale" /* double (deprecated) */
+#define FC_SYMBOL "symbol" /* Bool */
+#define FC_DPI "dpi" /* double */
+#define FC_RGBA "rgba" /* Int */
+#define FC_MINSPACE "minspace" /* Bool use minimum line spacing */
+#define FC_SOURCE "source" /* String (deprecated) */
+#define FC_CHARSET "charset" /* CharSet */
+#define FC_LANG "lang" /* String RFC 3066 langs */
+#define FC_FONTVERSION "fontversion" /* Int from 'head' table */
+#define FC_FULLNAME "fullname" /* String */
+#define FC_FAMILYLANG "familylang" /* String RFC 3066 langs */
+#define FC_STYLELANG "stylelang" /* String RFC 3066 langs */
+#define FC_FULLNAMELANG "fullnamelang" /* String RFC 3066 langs */
+#define FC_CAPABILITY "capability" /* String */
+#define FC_FONTFORMAT "fontformat" /* String */
+#define FC_EMBOLDEN "embolden" /* Bool - true if emboldening needed*/
+#define FC_EMBEDDED_BITMAP "embeddedbitmap" /* Bool - true to enable embedded bitmaps */
+#define FC_DECORATIVE "decorative" /* Bool - true if style is a decorative variant */
+#define FC_LCD_FILTER "lcdfilter" /* Int */
+#define FC_FONT_FEATURES "fontfeatures" /* String */
+#define FC_NAMELANG "namelang" /* String RFC 3866 langs */
+#define FC_PRGNAME "prgname" /* String */
+#define FC_HASH "hash" /* String (deprecated) */
+#define FC_POSTSCRIPT_NAME "postscriptname" /* String */
+
+#define FC_CACHE_SUFFIX ".cache-" FC_CACHE_VERSION
+#define FC_DIR_CACHE_FILE "fonts.cache-" FC_CACHE_VERSION
+#define FC_USER_CACHE_FILE ".fonts.cache-" FC_CACHE_VERSION
+
+/* Adjust outline rasterizer */
+#define FC_CHARWIDTH "charwidth" /* Int */
+#define FC_CHAR_WIDTH FC_CHARWIDTH
+#define FC_CHAR_HEIGHT "charheight"/* Int */
+#define FC_MATRIX "matrix" /* FcMatrix */
+
+#define FC_WEIGHT_THIN 0
+#define FC_WEIGHT_EXTRALIGHT 40
+#define FC_WEIGHT_ULTRALIGHT FC_WEIGHT_EXTRALIGHT
+#define FC_WEIGHT_LIGHT 50
+#define FC_WEIGHT_DEMILIGHT 55
+#define FC_WEIGHT_SEMILIGHT FC_WEIGHT_DEMILIGHT
+#define FC_WEIGHT_BOOK 75
+#define FC_WEIGHT_REGULAR 80
+#define FC_WEIGHT_NORMAL FC_WEIGHT_REGULAR
+#define FC_WEIGHT_MEDIUM 100
+#define FC_WEIGHT_DEMIBOLD 180
+#define FC_WEIGHT_SEMIBOLD FC_WEIGHT_DEMIBOLD
+#define FC_WEIGHT_BOLD 200
+#define FC_WEIGHT_EXTRABOLD 205
+#define FC_WEIGHT_ULTRABOLD FC_WEIGHT_EXTRABOLD
+#define FC_WEIGHT_BLACK 210
+#define FC_WEIGHT_HEAVY FC_WEIGHT_BLACK
+#define FC_WEIGHT_EXTRABLACK 215
+#define FC_WEIGHT_ULTRABLACK FC_WEIGHT_EXTRABLACK
+
+#define FC_SLANT_ROMAN 0
+#define FC_SLANT_ITALIC 100
+#define FC_SLANT_OBLIQUE 110
+
+#define FC_WIDTH_ULTRACONDENSED 50
+#define FC_WIDTH_EXTRACONDENSED 63
+#define FC_WIDTH_CONDENSED 75
+#define FC_WIDTH_SEMICONDENSED 87
+#define FC_WIDTH_NORMAL 100
+#define FC_WIDTH_SEMIEXPANDED 113
+#define FC_WIDTH_EXPANDED 125
+#define FC_WIDTH_EXTRAEXPANDED 150
+#define FC_WIDTH_ULTRAEXPANDED 200
+
+#define FC_PROPORTIONAL 0
+#define FC_DUAL 90
+#define FC_MONO 100
+#define FC_CHARCELL 110
+
+/* sub-pixel order */
+#define FC_RGBA_UNKNOWN 0
+#define FC_RGBA_RGB 1
+#define FC_RGBA_BGR 2
+#define FC_RGBA_VRGB 3
+#define FC_RGBA_VBGR 4
+#define FC_RGBA_NONE 5
+
+/* hinting style */
+#define FC_HINT_NONE 0
+#define FC_HINT_SLIGHT 1
+#define FC_HINT_MEDIUM 2
+#define FC_HINT_FULL 3
+
+/* LCD filter */
+#define FC_LCD_NONE 0
+#define FC_LCD_DEFAULT 1
+#define FC_LCD_LIGHT 2
+#define FC_LCD_LEGACY 3
+
+typedef enum _FcType {
+ FcTypeUnknown = -1,
+ FcTypeVoid,
+ FcTypeInteger,
+ FcTypeDouble,
+ FcTypeString,
+ FcTypeBool,
+ FcTypeMatrix,
+ FcTypeCharSet,
+ FcTypeFTFace,
+ FcTypeLangSet,
+ FcTypeRange
+} FcType;
+
+typedef struct _FcMatrix {
+ double xx, xy, yx, yy;
+} FcMatrix;
+
+#define FcMatrixInit(m) ((m)->xx = (m)->yy = 1, \
+ (m)->xy = (m)->yx = 0)
+
+/*
+ * A data structure to represent the available glyphs in a font.
+ * This is represented as a sparse boolean btree.
+ */
+
+typedef struct _FcCharSet FcCharSet;
+
+typedef struct _FcObjectType {
+ char *object;
+ FcType type;
+} FcObjectType;
+
+typedef struct _FcConstant {
+ const FcChar8 *name;
+ const char *object;
+ int value;
+} FcConstant;
+
+typedef enum _FcResult {
+ FcResultMatch, FcResultNoMatch, FcResultTypeMismatch, FcResultNoId,
+ FcResultOutOfMemory
+} FcResult;
+
+typedef enum _FcValueBinding {
+ FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame,
+ /* to make sure sizeof (FcValueBinding) == 4 even with -fshort-enums */
+ FcValueBindingEnd = INT_MAX
+} FcValueBinding;
+
+typedef struct _FcPattern FcPattern;
+
+typedef struct _FcLangSet FcLangSet;
+
+typedef struct _FcRange FcRange;
+
+typedef struct _FcValue {
+ FcType type;
+ union {
+ const FcChar8 *s;
+ int i;
+ FcBool b;
+ double d;
+ const FcMatrix *m;
+ const FcCharSet *c;
+ void *f;
+ const FcLangSet *l;
+ const FcRange *r;
+ } u;
+} FcValue;
+
+typedef struct _FcFontSet {
+ int nfont;
+ int sfont;
+ FcPattern **fonts;
+} FcFontSet;
+
+typedef struct _FcObjectSet {
+ int nobject;
+ int sobject;
+ const char **objects;
+} FcObjectSet;
+
+typedef enum _FcMatchKind {
+ FcMatchPattern, FcMatchFont, FcMatchScan
+} FcMatchKind;
+
+typedef enum _FcLangResult {
+ FcLangEqual = 0,
+ FcLangDifferentCountry = 1,
+ FcLangDifferentTerritory = 1,
+ FcLangDifferentLang = 2
+} FcLangResult;
+
+typedef enum _FcSetName {
+ FcSetSystem = 0,
+ FcSetApplication = 1
+} FcSetName;
+
+typedef struct _FcAtomic FcAtomic;
+
+#if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
+#define _FCFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
+#define _FCFUNCPROTOEND }
+#else
+#define _FCFUNCPROTOBEGIN
+#define _FCFUNCPROTOEND
+#endif
+
+typedef enum { FcEndianBig, FcEndianLittle } FcEndian;
+
+typedef struct _FcConfig FcConfig;
+
+typedef struct _FcGlobalCache FcFileCache;
+
+typedef struct _FcBlanks FcBlanks;
+
+typedef struct _FcStrList FcStrList;
+
+typedef struct _FcStrSet FcStrSet;
+
+typedef struct _FcCache FcCache;
+
+_FCFUNCPROTOBEGIN
+
+/* fcblanks.c */
+FcPublic FcBlanks *
+FcBlanksCreate (void);
+
+FcPublic void
+FcBlanksDestroy (FcBlanks *b);
+
+FcPublic FcBool
+FcBlanksAdd (FcBlanks *b, FcChar32 ucs4);
+
+FcPublic FcBool
+FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4);
+
+/* fccache.c */
+
+FcPublic const FcChar8 *
+FcCacheDir(const FcCache *c);
+
+FcPublic FcFontSet *
+FcCacheCopySet(const FcCache *c);
+
+FcPublic const FcChar8 *
+FcCacheSubdir (const FcCache *c, int i);
+
+FcPublic int
+FcCacheNumSubdir (const FcCache *c);
+
+FcPublic int
+FcCacheNumFont (const FcCache *c);
+
+FcPublic FcBool
+FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config);
+
+FcPublic FcBool
+FcDirCacheValid (const FcChar8 *cache_file);
+
+FcPublic FcBool
+FcDirCacheClean (const FcChar8 *cache_dir, FcBool verbose);
+
+FcPublic void
+FcCacheCreateTagFile (const FcConfig *config);
+
+/* fccfg.c */
+FcPublic FcChar8 *
+FcConfigHome (void);
+
+FcPublic FcBool
+FcConfigEnableHome (FcBool enable);
+
+FcPublic FcChar8 *
+FcConfigFilename (const FcChar8 *url);
+
+FcPublic FcConfig *
+FcConfigCreate (void);
+
+FcPublic FcConfig *
+FcConfigReference (FcConfig *config);
+
+FcPublic void
+FcConfigDestroy (FcConfig *config);
+
+FcPublic FcBool
+FcConfigSetCurrent (FcConfig *config);
+
+FcPublic FcConfig *
+FcConfigGetCurrent (void);
+
+FcPublic FcBool
+FcConfigUptoDate (FcConfig *config);
+
+FcPublic FcBool
+FcConfigBuildFonts (FcConfig *config);
+
+FcPublic FcStrList *
+FcConfigGetFontDirs (FcConfig *config);
+
+FcPublic FcStrList *
+FcConfigGetConfigDirs (FcConfig *config);
+
+FcPublic FcStrList *
+FcConfigGetConfigFiles (FcConfig *config);
+
+FcPublic FcChar8 *
+FcConfigGetCache (FcConfig *config);
+
+FcPublic FcBlanks *
+FcConfigGetBlanks (FcConfig *config);
+
+FcPublic FcStrList *
+FcConfigGetCacheDirs (const FcConfig *config);
+
+FcPublic int
+FcConfigGetRescanInterval (FcConfig *config);
+
+FcPublic FcBool
+FcConfigSetRescanInterval (FcConfig *config, int rescanInterval);
+
+FcPublic FcFontSet *
+FcConfigGetFonts (FcConfig *config,
+ FcSetName set);
+
+FcPublic FcBool
+FcConfigAppFontAddFile (FcConfig *config,
+ const FcChar8 *file);
+
+FcPublic FcBool
+FcConfigAppFontAddDir (FcConfig *config,
+ const FcChar8 *dir);
+
+FcPublic void
+FcConfigAppFontClear (FcConfig *config);
+
+FcPublic FcBool
+FcConfigSubstituteWithPat (FcConfig *config,
+ FcPattern *p,
+ FcPattern *p_pat,
+ FcMatchKind kind);
+
+FcPublic FcBool
+FcConfigSubstitute (FcConfig *config,
+ FcPattern *p,
+ FcMatchKind kind);
+
+FcPublic const FcChar8 *
+FcConfigGetSysRoot (const FcConfig *config);
+
+FcPublic void
+FcConfigSetSysRoot (FcConfig *config,
+ const FcChar8 *sysroot);
+
+/* fccharset.c */
+FcPublic FcCharSet*
+FcCharSetCreate (void);
+
+/* deprecated alias for FcCharSetCreate */
+FcPublic FcCharSet *
+FcCharSetNew (void);
+
+FcPublic void
+FcCharSetDestroy (FcCharSet *fcs);
+
+FcPublic FcBool
+FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4);
+
+FcPublic FcBool
+FcCharSetDelChar (FcCharSet *fcs, FcChar32 ucs4);
+
+FcPublic FcCharSet*
+FcCharSetCopy (FcCharSet *src);
+
+FcPublic FcBool
+FcCharSetEqual (const FcCharSet *a, const FcCharSet *b);
+
+FcPublic FcCharSet*
+FcCharSetIntersect (const FcCharSet *a, const FcCharSet *b);
+
+FcPublic FcCharSet*
+FcCharSetUnion (const FcCharSet *a, const FcCharSet *b);
+
+FcPublic FcCharSet*
+FcCharSetSubtract (const FcCharSet *a, const FcCharSet *b);
+
+FcPublic FcBool
+FcCharSetMerge (FcCharSet *a, const FcCharSet *b, FcBool *changed);
+
+FcPublic FcBool
+FcCharSetHasChar (const FcCharSet *fcs, FcChar32 ucs4);
+
+FcPublic FcChar32
+FcCharSetCount (const FcCharSet *a);
+
+FcPublic FcChar32
+FcCharSetIntersectCount (const FcCharSet *a, const FcCharSet *b);
+
+FcPublic FcChar32
+FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b);
+
+FcPublic FcBool
+FcCharSetIsSubset (const FcCharSet *a, const FcCharSet *b);
+
+#define FC_CHARSET_MAP_SIZE (256/32)
+#define FC_CHARSET_DONE ((FcChar32) -1)
+
+FcPublic FcChar32
+FcCharSetFirstPage (const FcCharSet *a,
+ FcChar32 map[FC_CHARSET_MAP_SIZE],
+ FcChar32 *next);
+
+FcPublic FcChar32
+FcCharSetNextPage (const FcCharSet *a,
+ FcChar32 map[FC_CHARSET_MAP_SIZE],
+ FcChar32 *next);
+
+/*
+ * old coverage API, rather hard to use correctly
+ */
+
+FcPublic FcChar32
+FcCharSetCoverage (const FcCharSet *a, FcChar32 page, FcChar32 *result);
+
+/* fcdbg.c */
+FcPublic void
+FcValuePrint (const FcValue v);
+
+FcPublic void
+FcPatternPrint (const FcPattern *p);
+
+FcPublic void
+FcFontSetPrint (const FcFontSet *s);
+
+/* fcdefault.c */
+FcPublic FcStrSet *
+FcGetDefaultLangs (void);
+
+FcPublic void
+FcDefaultSubstitute (FcPattern *pattern);
+
+/* fcdir.c */
+FcPublic FcBool
+FcFileIsDir (const FcChar8 *file);
+
+FcPublic FcBool
+FcFileScan (FcFontSet *set,
+ FcStrSet *dirs,
+ FcFileCache *cache,
+ FcBlanks *blanks,
+ const FcChar8 *file,
+ FcBool force);
+
+FcPublic FcBool
+FcDirScan (FcFontSet *set,
+ FcStrSet *dirs,
+ FcFileCache *cache,
+ FcBlanks *blanks,
+ const FcChar8 *dir,
+ FcBool force);
+
+FcPublic FcBool
+FcDirSave (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir);
+
+FcPublic FcCache *
+FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file);
+
+FcPublic FcCache *
+FcDirCacheRescan (const FcChar8 *dir, FcConfig *config);
+
+FcPublic FcCache *
+FcDirCacheRead (const FcChar8 *dir, FcBool force, FcConfig *config);
+
+FcPublic FcCache *
+FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat);
+
+FcPublic void
+FcDirCacheUnload (FcCache *cache);
+
+/* fcfreetype.c */
+FcPublic FcPattern *
+FcFreeTypeQuery (const FcChar8 *file, int id, FcBlanks *blanks, int *count);
+
+/* fcfs.c */
+
+FcPublic FcFontSet *
+FcFontSetCreate (void);
+
+FcPublic void
+FcFontSetDestroy (FcFontSet *s);
+
+FcPublic FcBool
+FcFontSetAdd (FcFontSet *s, FcPattern *font);
+
+/* fcinit.c */
+FcPublic FcConfig *
+FcInitLoadConfig (void);
+
+FcPublic FcConfig *
+FcInitLoadConfigAndFonts (void);
+
+FcPublic FcBool
+FcInit (void);
+
+FcPublic void
+FcFini (void);
+
+FcPublic int
+FcGetVersion (void);
+
+FcPublic FcBool
+FcInitReinitialize (void);
+
+FcPublic FcBool
+FcInitBringUptoDate (void);
+
+/* fclang.c */
+FcPublic FcStrSet *
+FcGetLangs (void);
+
+FcPublic FcChar8 *
+FcLangNormalize (const FcChar8 *lang);
+
+FcPublic const FcCharSet *
+FcLangGetCharSet (const FcChar8 *lang);
+
+FcPublic FcLangSet*
+FcLangSetCreate (void);
+
+FcPublic void
+FcLangSetDestroy (FcLangSet *ls);
+
+FcPublic FcLangSet*
+FcLangSetCopy (const FcLangSet *ls);
+
+FcPublic FcBool
+FcLangSetAdd (FcLangSet *ls, const FcChar8 *lang);
+
+FcPublic FcBool
+FcLangSetDel (FcLangSet *ls, const FcChar8 *lang);
+
+FcPublic FcLangResult
+FcLangSetHasLang (const FcLangSet *ls, const FcChar8 *lang);
+
+FcPublic FcLangResult
+FcLangSetCompare (const FcLangSet *lsa, const FcLangSet *lsb);
+
+FcPublic FcBool
+FcLangSetContains (const FcLangSet *lsa, const FcLangSet *lsb);
+
+FcPublic FcBool
+FcLangSetEqual (const FcLangSet *lsa, const FcLangSet *lsb);
+
+FcPublic FcChar32
+FcLangSetHash (const FcLangSet *ls);
+
+FcPublic FcStrSet *
+FcLangSetGetLangs (const FcLangSet *ls);
+
+FcPublic FcLangSet *
+FcLangSetUnion (const FcLangSet *a, const FcLangSet *b);
+
+FcPublic FcLangSet *
+FcLangSetSubtract (const FcLangSet *a, const FcLangSet *b);
+
+/* fclist.c */
+FcPublic FcObjectSet *
+FcObjectSetCreate (void);
+
+FcPublic FcBool
+FcObjectSetAdd (FcObjectSet *os, const char *object);
+
+FcPublic void
+FcObjectSetDestroy (FcObjectSet *os);
+
+FcPublic FcObjectSet *
+FcObjectSetVaBuild (const char *first, va_list va);
+
+FcPublic FcObjectSet *
+FcObjectSetBuild (const char *first, ...) FC_ATTRIBUTE_SENTINEL(0);
+
+FcPublic FcFontSet *
+FcFontSetList (FcConfig *config,
+ FcFontSet **sets,
+ int nsets,
+ FcPattern *p,
+ FcObjectSet *os);
+
+FcPublic FcFontSet *
+FcFontList (FcConfig *config,
+ FcPattern *p,
+ FcObjectSet *os);
+
+/* fcatomic.c */
+
+FcPublic FcAtomic *
+FcAtomicCreate (const FcChar8 *file);
+
+FcPublic FcBool
+FcAtomicLock (FcAtomic *atomic);
+
+FcPublic FcChar8 *
+FcAtomicNewFile (FcAtomic *atomic);
+
+FcPublic FcChar8 *
+FcAtomicOrigFile (FcAtomic *atomic);
+
+FcPublic FcBool
+FcAtomicReplaceOrig (FcAtomic *atomic);
+
+FcPublic void
+FcAtomicDeleteNew (FcAtomic *atomic);
+
+FcPublic void
+FcAtomicUnlock (FcAtomic *atomic);
+
+FcPublic void
+FcAtomicDestroy (FcAtomic *atomic);
+
+/* fcmatch.c */
+FcPublic FcPattern *
+FcFontSetMatch (FcConfig *config,
+ FcFontSet **sets,
+ int nsets,
+ FcPattern *p,
+ FcResult *result);
+
+FcPublic FcPattern *
+FcFontMatch (FcConfig *config,
+ FcPattern *p,
+ FcResult *result);
+
+FcPublic FcPattern *
+FcFontRenderPrepare (FcConfig *config,
+ FcPattern *pat,
+ FcPattern *font);
+
+FcPublic FcFontSet *
+FcFontSetSort (FcConfig *config,
+ FcFontSet **sets,
+ int nsets,
+ FcPattern *p,
+ FcBool trim,
+ FcCharSet **csp,
+ FcResult *result);
+
+FcPublic FcFontSet *
+FcFontSort (FcConfig *config,
+ FcPattern *p,
+ FcBool trim,
+ FcCharSet **csp,
+ FcResult *result);
+
+FcPublic void
+FcFontSetSortDestroy (FcFontSet *fs);
+
+/* fcmatrix.c */
+FcPublic FcMatrix *
+FcMatrixCopy (const FcMatrix *mat);
+
+FcPublic FcBool
+FcMatrixEqual (const FcMatrix *mat1, const FcMatrix *mat2);
+
+FcPublic void
+FcMatrixMultiply (FcMatrix *result, const FcMatrix *a, const FcMatrix *b);
+
+FcPublic void
+FcMatrixRotate (FcMatrix *m, double c, double s);
+
+FcPublic void
+FcMatrixScale (FcMatrix *m, double sx, double sy);
+
+FcPublic void
+FcMatrixShear (FcMatrix *m, double sh, double sv);
+
+/* fcname.c */
+
+/* Deprecated. Does nothing. Returns FcFalse. */
+FcPublic FcBool
+FcNameRegisterObjectTypes (const FcObjectType *types, int ntype);
+
+/* Deprecated. Does nothing. Returns FcFalse. */
+FcPublic FcBool
+FcNameUnregisterObjectTypes (const FcObjectType *types, int ntype);
+
+FcPublic const FcObjectType *
+FcNameGetObjectType (const char *object);
+
+/* Deprecated. Does nothing. Returns FcFalse. */
+FcPublic FcBool
+FcNameRegisterConstants (const FcConstant *consts, int nconsts);
+
+/* Deprecated. Does nothing. Returns FcFalse. */
+FcPublic FcBool
+FcNameUnregisterConstants (const FcConstant *consts, int nconsts);
+
+FcPublic const FcConstant *
+FcNameGetConstant (const FcChar8 *string);
+
+FcPublic FcBool
+FcNameConstant (const FcChar8 *string, int *result);
+
+FcPublic FcPattern *
+FcNameParse (const FcChar8 *name);
+
+FcPublic FcChar8 *
+FcNameUnparse (FcPattern *pat);
+
+/* fcpat.c */
+FcPublic FcPattern *
+FcPatternCreate (void);
+
+FcPublic FcPattern *
+FcPatternDuplicate (const FcPattern *p);
+
+FcPublic void
+FcPatternReference (FcPattern *p);
+
+FcPublic FcPattern *
+FcPatternFilter (FcPattern *p, const FcObjectSet *os);
+
+FcPublic void
+FcValueDestroy (FcValue v);
+
+FcPublic FcBool
+FcValueEqual (FcValue va, FcValue vb);
+
+FcPublic FcValue
+FcValueSave (FcValue v);
+
+FcPublic void
+FcPatternDestroy (FcPattern *p);
+
+FcPublic FcBool
+FcPatternEqual (const FcPattern *pa, const FcPattern *pb);
+
+FcPublic FcBool
+FcPatternEqualSubset (const FcPattern *pa, const FcPattern *pb, const FcObjectSet *os);
+
+FcPublic FcChar32
+FcPatternHash (const FcPattern *p);
+
+FcPublic FcBool
+FcPatternAdd (FcPattern *p, const char *object, FcValue value, FcBool append);
+
+FcPublic FcBool
+FcPatternAddWeak (FcPattern *p, const char *object, FcValue value, FcBool append);
+
+FcPublic FcResult
+FcPatternGet (const FcPattern *p, const char *object, int id, FcValue *v);
+
+FcPublic FcResult
+FcPatternGetWithBinding (const FcPattern *p, const char *object, int id, FcValue *v, FcValueBinding *b);
+
+FcPublic FcBool
+FcPatternDel (FcPattern *p, const char *object);
+
+FcPublic FcBool
+FcPatternRemove (FcPattern *p, const char *object, int id);
+
+FcPublic FcBool
+FcPatternAddInteger (FcPattern *p, const char *object, int i);
+
+FcPublic FcBool
+FcPatternAddDouble (FcPattern *p, const char *object, double d);
+
+FcPublic FcBool
+FcPatternAddString (FcPattern *p, const char *object, const FcChar8 *s);
+
+FcPublic FcBool
+FcPatternAddMatrix (FcPattern *p, const char *object, const FcMatrix *s);
+
+FcPublic FcBool
+FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c);
+
+FcPublic FcBool
+FcPatternAddBool (FcPattern *p, const char *object, FcBool b);
+
+FcPublic FcBool
+FcPatternAddLangSet (FcPattern *p, const char *object, const FcLangSet *ls);
+
+FcPublic FcBool
+FcPatternAddRange (FcPattern *p, const char *object, const FcRange *r);
+
+FcPublic FcResult
+FcPatternGetInteger (const FcPattern *p, const char *object, int n, int *i);
+
+FcPublic FcResult
+FcPatternGetDouble (const FcPattern *p, const char *object, int n, double *d);
+
+FcPublic FcResult
+FcPatternGetString (const FcPattern *p, const char *object, int n, FcChar8 ** s);
+
+FcPublic FcResult
+FcPatternGetMatrix (const FcPattern *p, const char *object, int n, FcMatrix **s);
+
+FcPublic FcResult
+FcPatternGetCharSet (const FcPattern *p, const char *object, int n, FcCharSet **c);
+
+FcPublic FcResult
+FcPatternGetBool (const FcPattern *p, const char *object, int n, FcBool *b);
+
+FcPublic FcResult
+FcPatternGetLangSet (const FcPattern *p, const char *object, int n, FcLangSet **ls);
+
+FcPublic FcResult
+FcPatternGetRange (const FcPattern *p, const char *object, int id, FcRange **r);
+
+FcPublic FcPattern *
+FcPatternVaBuild (FcPattern *p, va_list va);
+
+FcPublic FcPattern *
+FcPatternBuild (FcPattern *p, ...) FC_ATTRIBUTE_SENTINEL(0);
+
+FcPublic FcChar8 *
+FcPatternFormat (FcPattern *pat, const FcChar8 *format);
+
+/* fcrange.c */
+FcPublic FcRange *
+FcRangeCreateDouble (double begin, double end);
+
+FcPublic FcRange *
+FcRangeCreateInteger (FcChar32 begin, FcChar32 end);
+
+FcPublic void
+FcRangeDestroy (FcRange *range);
+
+FcPublic FcRange *
+FcRangeCopy (const FcRange *r);
+
+FcPublic FcBool
+FcRangeGetDouble(const FcRange *range, double *begin, double *end);
+
+/* fcweight.c */
+
+FcPublic int
+FcWeightFromOpenType (int ot_weight);
+
+FcPublic int
+FcWeightToOpenType (int fc_weight);
+
+/* fcstr.c */
+
+FcPublic FcChar8 *
+FcStrCopy (const FcChar8 *s);
+
+FcPublic FcChar8 *
+FcStrCopyFilename (const FcChar8 *s);
+
+FcPublic FcChar8 *
+FcStrPlus (const FcChar8 *s1, const FcChar8 *s2);
+
+FcPublic void
+FcStrFree (FcChar8 *s);
+
+/* These are ASCII only, suitable only for pattern element names */
+#define FcIsUpper(c) ((0101 <= (c) && (c) <= 0132))
+#define FcIsLower(c) ((0141 <= (c) && (c) <= 0172))
+#define FcToLower(c) (FcIsUpper(c) ? (c) - 0101 + 0141 : (c))
+
+FcPublic FcChar8 *
+FcStrDowncase (const FcChar8 *s);
+
+FcPublic int
+FcStrCmpIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
+
+FcPublic int
+FcStrCmp (const FcChar8 *s1, const FcChar8 *s2);
+
+FcPublic const FcChar8 *
+FcStrStrIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
+
+FcPublic const FcChar8 *
+FcStrStr (const FcChar8 *s1, const FcChar8 *s2);
+
+FcPublic int
+FcUtf8ToUcs4 (const FcChar8 *src_orig,
+ FcChar32 *dst,
+ int len);
+
+FcPublic FcBool
+FcUtf8Len (const FcChar8 *string,
+ int len,
+ int *nchar,
+ int *wchar);
+
+#define FC_UTF8_MAX_LEN 6
+
+FcPublic int
+FcUcs4ToUtf8 (FcChar32 ucs4,
+ FcChar8 dest[FC_UTF8_MAX_LEN]);
+
+FcPublic int
+FcUtf16ToUcs4 (const FcChar8 *src_orig,
+ FcEndian endian,
+ FcChar32 *dst,
+ int len); /* in bytes */
+
+FcPublic FcBool
+FcUtf16Len (const FcChar8 *string,
+ FcEndian endian,
+ int len, /* in bytes */
+ int *nchar,
+ int *wchar);
+
+FcPublic FcChar8 *
+FcStrDirname (const FcChar8 *file);
+
+FcPublic FcChar8 *
+FcStrBasename (const FcChar8 *file);
+
+FcPublic FcStrSet *
+FcStrSetCreate (void);
+
+FcPublic FcBool
+FcStrSetMember (FcStrSet *set, const FcChar8 *s);
+
+FcPublic FcBool
+FcStrSetEqual (FcStrSet *sa, FcStrSet *sb);
+
+FcPublic FcBool
+FcStrSetAdd (FcStrSet *set, const FcChar8 *s);
+
+FcPublic FcBool
+FcStrSetAddFilename (FcStrSet *set, const FcChar8 *s);
+
+FcPublic FcBool
+FcStrSetDel (FcStrSet *set, const FcChar8 *s);
+
+FcPublic void
+FcStrSetDestroy (FcStrSet *set);
+
+FcPublic FcStrList *
+FcStrListCreate (FcStrSet *set);
+
+FcPublic void
+FcStrListFirst (FcStrList *list);
+
+FcPublic FcChar8 *
+FcStrListNext (FcStrList *list);
+
+FcPublic void
+FcStrListDone (FcStrList *list);
+
+/* fcxml.c */
+FcPublic FcBool
+FcConfigParseAndLoad (FcConfig *config, const FcChar8 *file, FcBool complain);
+
+FcPublic FcBool
+FcConfigParseAndLoadFromMemory (FcConfig *config,
+ const FcChar8 *buffer,
+ FcBool complain);
+
+_FCFUNCPROTOEND
+
+#undef FC_ATTRIBUTE_SENTINEL
+
+
+#ifndef _FCINT_H_
+
+/*
+ * Deprecated functions are placed here to help users fix their code without
+ * digging through documentation
+ */
+
+#define FcConfigGetRescanInverval FcConfigGetRescanInverval_REPLACE_BY_FcConfigGetRescanInterval
+#define FcConfigSetRescanInverval FcConfigSetRescanInverval_REPLACE_BY_FcConfigSetRescanInterval
+
+#endif
+
+#endif /* _FONTCONFIG_H_ */
diff --git a/thirdparty/linuxbsd_headers/pulse/cdecl.h b/thirdparty/linuxbsd_headers/pulse/cdecl.h
new file mode 100644
index 0000000000..ac817d5d03
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/cdecl.h
@@ -0,0 +1,40 @@
+#ifndef foopulsecdeclhfoo
+#define foopulsecdeclhfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+/** \file
+ * C++ compatibility support */
+
+#ifdef __cplusplus
+/** If using C++ this macro enables C mode, otherwise does nothing */
+#define PA_C_DECL_BEGIN extern "C" {
+/** If using C++ this macros switches back to C++ mode, otherwise does nothing */
+#define PA_C_DECL_END }
+
+#else
+/** If using C++ this macro enables C mode, otherwise does nothing */
+#define PA_C_DECL_BEGIN
+/** If using C++ this macros switches back to C++ mode, otherwise does nothing */
+#define PA_C_DECL_END
+
+#endif
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/channelmap.h b/thirdparty/linuxbsd_headers/pulse/channelmap.h
new file mode 100644
index 0000000000..6eabe20bad
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/channelmap.h
@@ -0,0 +1,366 @@
+#ifndef foochannelmaphfoo
+#define foochannelmaphfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2005-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/sample.h>
+#include <pulse/cdecl.h>
+#include <pulse/gccmacro.h>
+#include <pulse/version.h>
+
+/** \page channelmap Channel Maps
+ *
+ * \section overv_sec Overview
+ *
+ * Channel maps provide a way to associate channels in a stream with a
+ * specific speaker position. This relieves applications of having to
+ * make sure their channel order is identical to the final output.
+ *
+ * \section init_sec Initialisation
+ *
+ * A channel map consists of an array of \ref pa_channel_position values,
+ * one for each channel. This array is stored together with a channel count
+ * in a pa_channel_map structure.
+ *
+ * Before filling the structure, the application must initialise it using
+ * pa_channel_map_init(). There are also a number of convenience functions
+ * for standard channel mappings:
+ *
+ * \li pa_channel_map_init_mono() - Create a channel map with only mono audio.
+ * \li pa_channel_map_init_stereo() - Create a standard stereo mapping.
+ * \li pa_channel_map_init_auto() - Create a standard channel map for a specific number of channels
+ * \li pa_channel_map_init_extend() - Similar to
+ * pa_channel_map_init_auto() but synthesize a channel map if no
+ * predefined one is known for the specified number of channels.
+ *
+ * \section conv_sec Convenience Functions
+ *
+ * The library contains a number of convenience functions for dealing with
+ * channel maps:
+ *
+ * \li pa_channel_map_valid() - Tests if a channel map is valid.
+ * \li pa_channel_map_equal() - Tests if two channel maps are identical.
+ * \li pa_channel_map_snprint() - Creates a textual description of a channel
+ * map.
+ */
+
+/** \file
+ * Constants and routines for channel mapping handling
+ *
+ * See also \subpage channelmap
+ */
+
+PA_C_DECL_BEGIN
+
+/** A list of channel labels */
+typedef enum pa_channel_position {
+ PA_CHANNEL_POSITION_INVALID = -1,
+ PA_CHANNEL_POSITION_MONO = 0,
+
+ PA_CHANNEL_POSITION_FRONT_LEFT, /**< Apple, Dolby call this 'Left' */
+ PA_CHANNEL_POSITION_FRONT_RIGHT, /**< Apple, Dolby call this 'Right' */
+ PA_CHANNEL_POSITION_FRONT_CENTER, /**< Apple, Dolby call this 'Center' */
+
+/** \cond fulldocs */
+ PA_CHANNEL_POSITION_LEFT = PA_CHANNEL_POSITION_FRONT_LEFT,
+ PA_CHANNEL_POSITION_RIGHT = PA_CHANNEL_POSITION_FRONT_RIGHT,
+ PA_CHANNEL_POSITION_CENTER = PA_CHANNEL_POSITION_FRONT_CENTER,
+/** \endcond */
+
+ PA_CHANNEL_POSITION_REAR_CENTER, /**< Microsoft calls this 'Back Center', Apple calls this 'Center Surround', Dolby calls this 'Surround Rear Center' */
+ PA_CHANNEL_POSITION_REAR_LEFT, /**< Microsoft calls this 'Back Left', Apple calls this 'Left Surround' (!), Dolby calls this 'Surround Rear Left' */
+ PA_CHANNEL_POSITION_REAR_RIGHT, /**< Microsoft calls this 'Back Right', Apple calls this 'Right Surround' (!), Dolby calls this 'Surround Rear Right' */
+
+ PA_CHANNEL_POSITION_LFE, /**< Microsoft calls this 'Low Frequency', Apple calls this 'LFEScreen' */
+/** \cond fulldocs */
+ PA_CHANNEL_POSITION_SUBWOOFER = PA_CHANNEL_POSITION_LFE,
+/** \endcond */
+
+ PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, /**< Apple, Dolby call this 'Left Center' */
+ PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, /**< Apple, Dolby call this 'Right Center */
+
+ PA_CHANNEL_POSITION_SIDE_LEFT, /**< Apple calls this 'Left Surround Direct', Dolby calls this 'Surround Left' (!) */
+ PA_CHANNEL_POSITION_SIDE_RIGHT, /**< Apple calls this 'Right Surround Direct', Dolby calls this 'Surround Right' (!) */
+
+ PA_CHANNEL_POSITION_AUX0,
+ PA_CHANNEL_POSITION_AUX1,
+ PA_CHANNEL_POSITION_AUX2,
+ PA_CHANNEL_POSITION_AUX3,
+ PA_CHANNEL_POSITION_AUX4,
+ PA_CHANNEL_POSITION_AUX5,
+ PA_CHANNEL_POSITION_AUX6,
+ PA_CHANNEL_POSITION_AUX7,
+ PA_CHANNEL_POSITION_AUX8,
+ PA_CHANNEL_POSITION_AUX9,
+ PA_CHANNEL_POSITION_AUX10,
+ PA_CHANNEL_POSITION_AUX11,
+ PA_CHANNEL_POSITION_AUX12,
+ PA_CHANNEL_POSITION_AUX13,
+ PA_CHANNEL_POSITION_AUX14,
+ PA_CHANNEL_POSITION_AUX15,
+ PA_CHANNEL_POSITION_AUX16,
+ PA_CHANNEL_POSITION_AUX17,
+ PA_CHANNEL_POSITION_AUX18,
+ PA_CHANNEL_POSITION_AUX19,
+ PA_CHANNEL_POSITION_AUX20,
+ PA_CHANNEL_POSITION_AUX21,
+ PA_CHANNEL_POSITION_AUX22,
+ PA_CHANNEL_POSITION_AUX23,
+ PA_CHANNEL_POSITION_AUX24,
+ PA_CHANNEL_POSITION_AUX25,
+ PA_CHANNEL_POSITION_AUX26,
+ PA_CHANNEL_POSITION_AUX27,
+ PA_CHANNEL_POSITION_AUX28,
+ PA_CHANNEL_POSITION_AUX29,
+ PA_CHANNEL_POSITION_AUX30,
+ PA_CHANNEL_POSITION_AUX31,
+
+ PA_CHANNEL_POSITION_TOP_CENTER, /**< Apple calls this 'Top Center Surround' */
+
+ PA_CHANNEL_POSITION_TOP_FRONT_LEFT, /**< Apple calls this 'Vertical Height Left' */
+ PA_CHANNEL_POSITION_TOP_FRONT_RIGHT, /**< Apple calls this 'Vertical Height Right' */
+ PA_CHANNEL_POSITION_TOP_FRONT_CENTER, /**< Apple calls this 'Vertical Height Center' */
+
+ PA_CHANNEL_POSITION_TOP_REAR_LEFT, /**< Microsoft and Apple call this 'Top Back Left' */
+ PA_CHANNEL_POSITION_TOP_REAR_RIGHT, /**< Microsoft and Apple call this 'Top Back Right' */
+ PA_CHANNEL_POSITION_TOP_REAR_CENTER, /**< Microsoft and Apple call this 'Top Back Center' */
+
+ PA_CHANNEL_POSITION_MAX
+} pa_channel_position_t;
+
+/** \cond fulldocs */
+#define PA_CHANNEL_POSITION_INVALID PA_CHANNEL_POSITION_INVALID
+#define PA_CHANNEL_POSITION_MONO PA_CHANNEL_POSITION_MONO
+#define PA_CHANNEL_POSITION_LEFT PA_CHANNEL_POSITION_LEFT
+#define PA_CHANNEL_POSITION_RIGHT PA_CHANNEL_POSITION_RIGHT
+#define PA_CHANNEL_POSITION_CENTER PA_CHANNEL_POSITION_CENTER
+#define PA_CHANNEL_POSITION_FRONT_LEFT PA_CHANNEL_POSITION_FRONT_LEFT
+#define PA_CHANNEL_POSITION_FRONT_RIGHT PA_CHANNEL_POSITION_FRONT_RIGHT
+#define PA_CHANNEL_POSITION_FRONT_CENTER PA_CHANNEL_POSITION_FRONT_CENTER
+#define PA_CHANNEL_POSITION_REAR_CENTER PA_CHANNEL_POSITION_REAR_CENTER
+#define PA_CHANNEL_POSITION_REAR_LEFT PA_CHANNEL_POSITION_REAR_LEFT
+#define PA_CHANNEL_POSITION_REAR_RIGHT PA_CHANNEL_POSITION_REAR_RIGHT
+#define PA_CHANNEL_POSITION_LFE PA_CHANNEL_POSITION_LFE
+#define PA_CHANNEL_POSITION_SUBWOOFER PA_CHANNEL_POSITION_SUBWOOFER
+#define PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER
+#define PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER
+#define PA_CHANNEL_POSITION_SIDE_LEFT PA_CHANNEL_POSITION_SIDE_LEFT
+#define PA_CHANNEL_POSITION_SIDE_RIGHT PA_CHANNEL_POSITION_SIDE_RIGHT
+#define PA_CHANNEL_POSITION_AUX0 PA_CHANNEL_POSITION_AUX0
+#define PA_CHANNEL_POSITION_AUX1 PA_CHANNEL_POSITION_AUX1
+#define PA_CHANNEL_POSITION_AUX2 PA_CHANNEL_POSITION_AUX2
+#define PA_CHANNEL_POSITION_AUX3 PA_CHANNEL_POSITION_AUX3
+#define PA_CHANNEL_POSITION_AUX4 PA_CHANNEL_POSITION_AUX4
+#define PA_CHANNEL_POSITION_AUX5 PA_CHANNEL_POSITION_AUX5
+#define PA_CHANNEL_POSITION_AUX6 PA_CHANNEL_POSITION_AUX6
+#define PA_CHANNEL_POSITION_AUX7 PA_CHANNEL_POSITION_AUX7
+#define PA_CHANNEL_POSITION_AUX8 PA_CHANNEL_POSITION_AUX8
+#define PA_CHANNEL_POSITION_AUX9 PA_CHANNEL_POSITION_AUX9
+#define PA_CHANNEL_POSITION_AUX10 PA_CHANNEL_POSITION_AUX10
+#define PA_CHANNEL_POSITION_AUX11 PA_CHANNEL_POSITION_AUX11
+#define PA_CHANNEL_POSITION_AUX12 PA_CHANNEL_POSITION_AUX12
+#define PA_CHANNEL_POSITION_AUX13 PA_CHANNEL_POSITION_AUX13
+#define PA_CHANNEL_POSITION_AUX14 PA_CHANNEL_POSITION_AUX14
+#define PA_CHANNEL_POSITION_AUX15 PA_CHANNEL_POSITION_AUX15
+#define PA_CHANNEL_POSITION_AUX16 PA_CHANNEL_POSITION_AUX16
+#define PA_CHANNEL_POSITION_AUX17 PA_CHANNEL_POSITION_AUX17
+#define PA_CHANNEL_POSITION_AUX18 PA_CHANNEL_POSITION_AUX18
+#define PA_CHANNEL_POSITION_AUX19 PA_CHANNEL_POSITION_AUX19
+#define PA_CHANNEL_POSITION_AUX20 PA_CHANNEL_POSITION_AUX20
+#define PA_CHANNEL_POSITION_AUX21 PA_CHANNEL_POSITION_AUX21
+#define PA_CHANNEL_POSITION_AUX22 PA_CHANNEL_POSITION_AUX22
+#define PA_CHANNEL_POSITION_AUX23 PA_CHANNEL_POSITION_AUX23
+#define PA_CHANNEL_POSITION_AUX24 PA_CHANNEL_POSITION_AUX24
+#define PA_CHANNEL_POSITION_AUX25 PA_CHANNEL_POSITION_AUX25
+#define PA_CHANNEL_POSITION_AUX26 PA_CHANNEL_POSITION_AUX26
+#define PA_CHANNEL_POSITION_AUX27 PA_CHANNEL_POSITION_AUX27
+#define PA_CHANNEL_POSITION_AUX28 PA_CHANNEL_POSITION_AUX28
+#define PA_CHANNEL_POSITION_AUX29 PA_CHANNEL_POSITION_AUX29
+#define PA_CHANNEL_POSITION_AUX30 PA_CHANNEL_POSITION_AUX30
+#define PA_CHANNEL_POSITION_AUX31 PA_CHANNEL_POSITION_AUX31
+#define PA_CHANNEL_POSITION_TOP_CENTER PA_CHANNEL_POSITION_TOP_CENTER
+#define PA_CHANNEL_POSITION_TOP_FRONT_LEFT PA_CHANNEL_POSITION_TOP_FRONT_LEFT
+#define PA_CHANNEL_POSITION_TOP_FRONT_RIGHT PA_CHANNEL_POSITION_TOP_FRONT_RIGHT
+#define PA_CHANNEL_POSITION_TOP_FRONT_CENTER PA_CHANNEL_POSITION_TOP_FRONT_CENTER
+#define PA_CHANNEL_POSITION_TOP_REAR_LEFT PA_CHANNEL_POSITION_TOP_REAR_LEFT
+#define PA_CHANNEL_POSITION_TOP_REAR_RIGHT PA_CHANNEL_POSITION_TOP_REAR_RIGHT
+#define PA_CHANNEL_POSITION_TOP_REAR_CENTER PA_CHANNEL_POSITION_TOP_REAR_CENTER
+#define PA_CHANNEL_POSITION_MAX PA_CHANNEL_POSITION_MAX
+/** \endcond */
+
+/** A mask of channel positions. \since 0.9.16 */
+typedef uint64_t pa_channel_position_mask_t;
+
+/** Makes a bit mask from a channel position. \since 0.9.16 */
+#define PA_CHANNEL_POSITION_MASK(f) ((pa_channel_position_mask_t) (1ULL << (f)))
+
+/** A list of channel mapping definitions for pa_channel_map_init_auto() */
+typedef enum pa_channel_map_def {
+ PA_CHANNEL_MAP_AIFF,
+ /**< The mapping from RFC3551, which is based on AIFF-C */
+
+/** \cond fulldocs */
+ PA_CHANNEL_MAP_ALSA,
+ /**< The default mapping used by ALSA. This mapping is probably
+ * not too useful since ALSA's default channel mapping depends on
+ * the device string used. */
+/** \endcond */
+
+ PA_CHANNEL_MAP_AUX,
+ /**< Only aux channels */
+
+ PA_CHANNEL_MAP_WAVEEX,
+ /**< Microsoft's WAVEFORMATEXTENSIBLE mapping. This mapping works
+ * as if all LSBs of dwChannelMask are set. */
+
+/** \cond fulldocs */
+ PA_CHANNEL_MAP_OSS,
+ /**< The default channel mapping used by OSS as defined in the OSS
+ * 4.0 API specs. This mapping is probably not too useful since
+ * the OSS API has changed in this respect and no longer knows a
+ * default channel mapping based on the number of channels. */
+/** \endcond */
+
+ /**< Upper limit of valid channel mapping definitions */
+ PA_CHANNEL_MAP_DEF_MAX,
+
+ PA_CHANNEL_MAP_DEFAULT = PA_CHANNEL_MAP_AIFF
+ /**< The default channel map */
+} pa_channel_map_def_t;
+
+/** \cond fulldocs */
+#define PA_CHANNEL_MAP_AIFF PA_CHANNEL_MAP_AIFF
+#define PA_CHANNEL_MAP_ALSA PA_CHANNEL_MAP_ALSA
+#define PA_CHANNEL_MAP_AUX PA_CHANNEL_MAP_AUX
+#define PA_CHANNEL_MAP_WAVEEX PA_CHANNEL_MAP_WAVEEX
+#define PA_CHANNEL_MAP_OSS PA_CHANNEL_MAP_OSS
+#define PA_CHANNEL_MAP_DEF_MAX PA_CHANNEL_MAP_DEF_MAX
+#define PA_CHANNEL_MAP_DEFAULT PA_CHANNEL_MAP_DEFAULT
+/** \endcond */
+
+/** A channel map which can be used to attach labels to specific
+ * channels of a stream. These values are relevant for conversion and
+ * mixing of streams */
+typedef struct pa_channel_map {
+ uint8_t channels;
+ /**< Number of channels */
+
+ pa_channel_position_t map[PA_CHANNELS_MAX];
+ /**< Channel labels */
+} pa_channel_map;
+
+/** Initialize the specified channel map and return a pointer to
+ * it. The channel map will have a defined state but
+ * pa_channel_map_valid() will fail for it. */
+pa_channel_map* pa_channel_map_init(pa_channel_map *m);
+
+/** Initialize the specified channel map for monaural audio and return a pointer to it */
+pa_channel_map* pa_channel_map_init_mono(pa_channel_map *m);
+
+/** Initialize the specified channel map for stereophonic audio and return a pointer to it */
+pa_channel_map* pa_channel_map_init_stereo(pa_channel_map *m);
+
+/** Initialize the specified channel map for the specified number of
+ * channels using default labels and return a pointer to it. This call
+ * will fail (return NULL) if there is no default channel map known for this
+ * specific number of channels and mapping. */
+pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, pa_channel_map_def_t def);
+
+/** Similar to pa_channel_map_init_auto() but instead of failing if no
+ * default mapping is known with the specified parameters it will
+ * synthesize a mapping based on a known mapping with fewer channels
+ * and fill up the rest with AUX0...AUX31 channels \since 0.9.11 */
+pa_channel_map* pa_channel_map_init_extend(pa_channel_map *m, unsigned channels, pa_channel_map_def_t def);
+
+/** Return a text label for the specified channel position */
+const char* pa_channel_position_to_string(pa_channel_position_t pos) PA_GCC_PURE;
+
+/** The inverse of pa_channel_position_to_string(). \since 0.9.16 */
+pa_channel_position_t pa_channel_position_from_string(const char *s) PA_GCC_PURE;
+
+/** Return a human readable text label for the specified channel position. \since 0.9.7 */
+const char* pa_channel_position_to_pretty_string(pa_channel_position_t pos);
+
+/** The maximum length of strings returned by
+ * pa_channel_map_snprint(). Please note that this value can change
+ * with any release without warning and without being considered API
+ * or ABI breakage. You should not use this definition anywhere where
+ * it might become part of an ABI. */
+#define PA_CHANNEL_MAP_SNPRINT_MAX 336
+
+/** Make a human readable string from the specified channel map */
+char* pa_channel_map_snprint(char *s, size_t l, const pa_channel_map *map);
+
+/** Parse a channel position list or well-known mapping name into a
+ * channel map structure. This turns the output of
+ * pa_channel_map_snprint() and pa_channel_map_to_name() back into a
+ * pa_channel_map */
+pa_channel_map *pa_channel_map_parse(pa_channel_map *map, const char *s);
+
+/** Compare two channel maps. Return 1 if both match. */
+int pa_channel_map_equal(const pa_channel_map *a, const pa_channel_map *b) PA_GCC_PURE;
+
+/** Return non-zero if the specified channel map is considered valid */
+int pa_channel_map_valid(const pa_channel_map *map) PA_GCC_PURE;
+
+/** Return non-zero if the specified channel map is compatible with
+ * the specified sample spec. \since 0.9.12 */
+int pa_channel_map_compatible(const pa_channel_map *map, const pa_sample_spec *ss) PA_GCC_PURE;
+
+/** Returns non-zero if every channel defined in b is also defined in a. \since 0.9.15 */
+int pa_channel_map_superset(const pa_channel_map *a, const pa_channel_map *b) PA_GCC_PURE;
+
+/** Returns non-zero if it makes sense to apply a volume 'balance'
+ * with this mapping, i.e.\ if there are left/right channels
+ * available. \since 0.9.15 */
+int pa_channel_map_can_balance(const pa_channel_map *map) PA_GCC_PURE;
+
+/** Returns non-zero if it makes sense to apply a volume 'fade'
+ * (i.e.\ 'balance' between front and rear) with this mapping, i.e.\ if
+ * there are front/rear channels available. \since 0.9.15 */
+int pa_channel_map_can_fade(const pa_channel_map *map) PA_GCC_PURE;
+
+/** Returns non-zero if it makes sense to apply a volume 'lfe balance'
+ * (i.e.\ 'balance' between LFE and non-LFE channels) with this mapping,
+ * i.e.\ if there are LFE and non-LFE channels available. \since 8.0 */
+int pa_channel_map_can_lfe_balance(const pa_channel_map *map) PA_GCC_PURE;
+
+/** Tries to find a well-known channel mapping name for this channel
+ * mapping, i.e.\ "stereo", "surround-71" and so on. If the channel
+ * mapping is unknown NULL will be returned. This name can be parsed
+ * with pa_channel_map_parse() \since 0.9.15 */
+const char* pa_channel_map_to_name(const pa_channel_map *map) PA_GCC_PURE;
+
+/** Tries to find a human readable text label for this channel
+mapping, i.e.\ "Stereo", "Surround 7.1" and so on. If the channel
+mapping is unknown NULL will be returned. \since 0.9.15 */
+const char* pa_channel_map_to_pretty_name(const pa_channel_map *map) PA_GCC_PURE;
+
+/** Returns non-zero if the specified channel position is available at
+ * least once in the channel map. \since 0.9.16 */
+int pa_channel_map_has_position(const pa_channel_map *map, pa_channel_position_t p) PA_GCC_PURE;
+
+/** Generates a bit mask from a channel map. \since 0.9.16 */
+pa_channel_position_mask_t pa_channel_map_mask(const pa_channel_map *map) PA_GCC_PURE;
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/context.h b/thirdparty/linuxbsd_headers/pulse/context.h
new file mode 100644
index 0000000000..ae2a068250
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/context.h
@@ -0,0 +1,291 @@
+#ifndef foocontexthfoo
+#define foocontexthfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/sample.h>
+#include <pulse/def.h>
+#include <pulse/mainloop-api.h>
+#include <pulse/cdecl.h>
+#include <pulse/operation.h>
+#include <pulse/proplist.h>
+#include <pulse/version.h>
+
+/** \page async Asynchronous API
+ *
+ * \section overv_sec Overview
+ *
+ * The asynchronous API is the native interface to the PulseAudio library.
+ * It allows full access to all available functionality. This however means that
+ * it is rather complex and can take some time to fully master.
+ *
+ * \section mainloop_sec Main Loop Abstraction
+ *
+ * The API is based around an asynchronous event loop, or main loop,
+ * abstraction. This abstraction contains three basic elements:
+ *
+ * \li Deferred events - Events that will trigger as soon as possible. Note
+ * that some implementations may block all other events
+ * when a deferred event is active.
+ * \li I/O events - Events that trigger on file descriptor activities.
+ * \li Times events - Events that trigger after a fixed amount of time.
+ *
+ * The abstraction is represented as a number of function pointers in the
+ * pa_mainloop_api structure.
+ *
+ * To actually be able to use these functions, an implementation needs to
+ * be coupled to the abstraction. There are three of these shipped with
+ * PulseAudio, but any other can be used with a minimal amount of work,
+ * provided it supports the three basic events listed above.
+ *
+ * The implementations shipped with PulseAudio are:
+ *
+ * \li \subpage mainloop - A minimal but fast implementation based on poll().
+ * \li \subpage threaded_mainloop - A special version of the previous
+ * implementation where all of PulseAudio's
+ * internal handling runs in a separate
+ * thread.
+ * \li \subpage glib-mainloop - A wrapper around GLib's main loop.
+ *
+ * UNIX signals may be hooked to a main loop using the functions from
+ * \ref mainloop-signal.h. These rely only on the main loop abstraction
+ * and can therefore be used with any of the implementations.
+ *
+ * \section refcnt_sec Reference Counting
+ *
+ * Almost all objects in PulseAudio are reference counted. What that means
+ * is that you rarely malloc() or free() any objects. Instead you increase
+ * and decrease their reference counts. Whenever an object's reference
+ * count reaches zero, that object gets destroy and any resources it uses
+ * get freed.
+ *
+ * The benefit of this design is that an application need not worry about
+ * whether or not it needs to keep an object around in case the library is
+ * using it internally. If it is, then it has made sure it has its own
+ * reference to it.
+ *
+ * Whenever the library creates an object, it will have an initial
+ * reference count of one. Most of the time, this single reference will be
+ * sufficient for the application, so all required reference count
+ * interaction will be a single call to the object's unref function.
+ *
+ * \section context_sec Context
+ *
+ * A context is the basic object for a connection to a PulseAudio server.
+ * It multiplexes commands, data streams and events through a single
+ * channel.
+ *
+ * There is no need for more than one context per application, unless
+ * connections to multiple servers are needed.
+ *
+ * \subsection ops_subsec Operations
+ *
+ * All operations on the context are performed asynchronously. I.e. the
+ * client will not wait for the server to complete the request. To keep
+ * track of all these in-flight operations, the application is given a
+ * pa_operation object for each asynchronous operation.
+ *
+ * There are only two actions (besides reference counting) that can be
+ * performed on a pa_operation: querying its state with
+ * pa_operation_get_state() and aborting it with pa_operation_cancel().
+ *
+ * A pa_operation object is reference counted, so an application must
+ * make sure to unreference it, even if it has no intention of using it.
+ *
+ * \subsection conn_subsec Connecting
+ *
+ * A context must be connected to a server before any operation can be
+ * issued. Calling pa_context_connect() will initiate the connection
+ * procedure. Unlike most asynchronous operations, connecting does not
+ * result in a pa_operation object. Instead, the application should
+ * register a callback using pa_context_set_state_callback().
+ *
+ * \subsection disc_subsec Disconnecting
+ *
+ * When the sound support is no longer needed, the connection needs to be
+ * closed using pa_context_disconnect(). This is an immediate function that
+ * works synchronously.
+ *
+ * Since the context object has references to other objects it must be
+ * disconnected after use or there is a high risk of memory leaks. If the
+ * connection has terminated by itself, then there is no need to explicitly
+ * disconnect the context using pa_context_disconnect().
+ *
+ * \section Functions
+ *
+ * The sound server's functionality can be divided into a number of
+ * subsections:
+ *
+ * \li \subpage streams
+ * \li \subpage scache
+ * \li \subpage introspect
+ * \li \subpage subscribe
+ */
+
+/** \file
+ * Connection contexts for asynchronous communication with a
+ * server. A pa_context object wraps a connection to a PulseAudio
+ * server using its native protocol.
+ *
+ * See also \subpage async
+ */
+
+PA_C_DECL_BEGIN
+
+/** An opaque connection context to a daemon */
+typedef struct pa_context pa_context;
+
+/** Generic notification callback prototype */
+typedef void (*pa_context_notify_cb_t)(pa_context *c, void *userdata);
+
+/** A generic callback for operation completion */
+typedef void (*pa_context_success_cb_t) (pa_context *c, int success, void *userdata);
+
+/** A callback for asynchronous meta/policy event messages. The set
+ * of defined events can be extended at any time. Also, server modules
+ * may introduce additional message types so make sure that your
+ * callback function ignores messages it doesn't know. \since
+ * 0.9.15 */
+typedef void (*pa_context_event_cb_t)(pa_context *c, const char *name, pa_proplist *p, void *userdata);
+
+/** Instantiate a new connection context with an abstract mainloop API
+ * and an application name. It is recommended to use pa_context_new_with_proplist()
+ * instead and specify some initial properties.*/
+pa_context *pa_context_new(pa_mainloop_api *mainloop, const char *name);
+
+/** Instantiate a new connection context with an abstract mainloop API
+ * and an application name, and specify the initial client property
+ * list. \since 0.9.11 */
+pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *name, pa_proplist *proplist);
+
+/** Decrease the reference counter of the context by one */
+void pa_context_unref(pa_context *c);
+
+/** Increase the reference counter of the context by one */
+pa_context* pa_context_ref(pa_context *c);
+
+/** Set a callback function that is called whenever the context status changes */
+void pa_context_set_state_callback(pa_context *c, pa_context_notify_cb_t cb, void *userdata);
+
+/** Set a callback function that is called whenever a meta/policy
+ * control event is received. \since 0.9.15 */
+void pa_context_set_event_callback(pa_context *p, pa_context_event_cb_t cb, void *userdata);
+
+/** Return the error number of the last failed operation */
+int pa_context_errno(pa_context *c);
+
+/** Return non-zero if some data is pending to be written to the connection */
+int pa_context_is_pending(pa_context *c);
+
+/** Return the current context status */
+pa_context_state_t pa_context_get_state(pa_context *c);
+
+/** Connect the context to the specified server. If server is NULL,
+connect to the default server. This routine may but will not always
+return synchronously on error. Use pa_context_set_state_callback() to
+be notified when the connection is established. If flags doesn't have
+PA_CONTEXT_NOAUTOSPAWN set and no specific server is specified or
+accessible a new daemon is spawned. If api is non-NULL, the functions
+specified in the structure are used when forking a new child
+process. */
+int pa_context_connect(pa_context *c, const char *server, pa_context_flags_t flags, const pa_spawn_api *api);
+
+/** Terminate the context connection immediately */
+void pa_context_disconnect(pa_context *c);
+
+/** Drain the context. If there is nothing to drain, the function returns NULL */
+pa_operation* pa_context_drain(pa_context *c, pa_context_notify_cb_t cb, void *userdata);
+
+/** Tell the daemon to exit. The returned operation is unlikely to
+ * complete successfully, since the daemon probably died before
+ * returning a success notification */
+pa_operation* pa_context_exit_daemon(pa_context *c, pa_context_success_cb_t cb, void *userdata);
+
+/** Set the name of the default sink. */
+pa_operation* pa_context_set_default_sink(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata);
+
+/** Set the name of the default source. */
+pa_operation* pa_context_set_default_source(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata);
+
+/** Returns 1 when the connection is to a local daemon. Returns negative when no connection has been made yet. */
+int pa_context_is_local(pa_context *c);
+
+/** Set a different application name for context on the server. */
+pa_operation* pa_context_set_name(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata);
+
+/** Return the server name this context is connected to. */
+const char* pa_context_get_server(pa_context *c);
+
+/** Return the protocol version of the library. */
+uint32_t pa_context_get_protocol_version(pa_context *c);
+
+/** Return the protocol version of the connected server. */
+uint32_t pa_context_get_server_protocol_version(pa_context *c);
+
+/** Update the property list of the client, adding new entries. Please
+ * note that it is highly recommended to set as much properties
+ * initially via pa_context_new_with_proplist() as possible instead a
+ * posteriori with this function, since that information may then be
+ * used to route streams of the client to the right device. \since 0.9.11 */
+pa_operation *pa_context_proplist_update(pa_context *c, pa_update_mode_t mode, pa_proplist *p, pa_context_success_cb_t cb, void *userdata);
+
+/** Update the property list of the client, remove entries. \since 0.9.11 */
+pa_operation *pa_context_proplist_remove(pa_context *c, const char *const keys[], pa_context_success_cb_t cb, void *userdata);
+
+/** Return the client index this context is
+ * identified in the server with. This is useful for usage with the
+ * introspection functions, such as pa_context_get_client_info(). \since 0.9.11 */
+uint32_t pa_context_get_index(pa_context *s);
+
+/** Create a new timer event source for the specified time (wrapper
+ * for mainloop->time_new). \since 0.9.16 */
+pa_time_event* pa_context_rttime_new(pa_context *c, pa_usec_t usec, pa_time_event_cb_t cb, void *userdata);
+
+/** Restart a running or expired timer event source (wrapper for
+ * mainloop->time_restart). \since 0.9.16 */
+void pa_context_rttime_restart(pa_context *c, pa_time_event *e, pa_usec_t usec);
+
+/** Return the optimal block size for passing around audio buffers. It
+ * is recommended to allocate buffers of the size returned here when
+ * writing audio data to playback streams, if the latency constraints
+ * permit this. It is not recommended writing larger blocks than this
+ * because usually they will then be split up internally into chunks
+ * of this size. It is not recommended writing smaller blocks than
+ * this (unless required due to latency demands) because this
+ * increases CPU usage. If ss is NULL you will be returned the
+ * byte-exact tile size. If you pass a valid ss, then the tile size
+ * will be rounded down to multiple of the frame size. This is
+ * supposed to be used in a construct such as
+ * pa_context_get_tile_size(pa_stream_get_context(s),
+ * pa_stream_get_sample_spec(ss)); \since 0.9.20 */
+size_t pa_context_get_tile_size(pa_context *c, const pa_sample_spec *ss);
+
+/** Load the authentication cookie from a file. This function is primarily
+ * meant for PulseAudio's own tunnel modules, which need to load the cookie
+ * from a custom location. Applications don't usually need to care about the
+ * cookie at all, but if it happens that you know what the authentication
+ * cookie is and your application needs to load it from a non-standard
+ * location, feel free to use this function. \since 5.0 */
+int pa_context_load_cookie_from_file(pa_context *c, const char *cookie_file_path);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/def.h b/thirdparty/linuxbsd_headers/pulse/def.h
new file mode 100644
index 0000000000..680bdc9816
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/def.h
@@ -0,0 +1,1052 @@
+#ifndef foodefhfoo
+#define foodefhfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ PulseAudio 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 PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <inttypes.h>
+#include <sys/time.h>
+
+#include <pulse/cdecl.h>
+#include <pulse/sample.h>
+#include <pulse/version.h>
+
+/** \file
+ * Global definitions */
+
+PA_C_DECL_BEGIN
+
+/** The state of a connection context */
+typedef enum pa_context_state {
+ PA_CONTEXT_UNCONNECTED, /**< The context hasn't been connected yet */
+ PA_CONTEXT_CONNECTING, /**< A connection is being established */
+ PA_CONTEXT_AUTHORIZING, /**< The client is authorizing itself to the daemon */
+ PA_CONTEXT_SETTING_NAME, /**< The client is passing its application name to the daemon */
+ PA_CONTEXT_READY, /**< The connection is established, the context is ready to execute operations */
+ PA_CONTEXT_FAILED, /**< The connection failed or was disconnected */
+ PA_CONTEXT_TERMINATED /**< The connection was terminated cleanly */
+} pa_context_state_t;
+
+/** Return non-zero if the passed state is one of the connected states. \since 0.9.11 */
+static inline int PA_CONTEXT_IS_GOOD(pa_context_state_t x) {
+ return
+ x == PA_CONTEXT_CONNECTING ||
+ x == PA_CONTEXT_AUTHORIZING ||
+ x == PA_CONTEXT_SETTING_NAME ||
+ x == PA_CONTEXT_READY;
+}
+
+/** \cond fulldocs */
+#define PA_CONTEXT_UNCONNECTED PA_CONTEXT_UNCONNECTED
+#define PA_CONTEXT_CONNECTING PA_CONTEXT_CONNECTING
+#define PA_CONTEXT_AUTHORIZING PA_CONTEXT_AUTHORIZING
+#define PA_CONTEXT_SETTING_NAME PA_CONTEXT_SETTING_NAME
+#define PA_CONTEXT_READY PA_CONTEXT_READY
+#define PA_CONTEXT_FAILED PA_CONTEXT_FAILED
+#define PA_CONTEXT_TERMINATED PA_CONTEXT_TERMINATED
+#define PA_CONTEXT_IS_GOOD PA_CONTEXT_IS_GOOD
+/** \endcond */
+
+/** The state of a stream */
+typedef enum pa_stream_state {
+ PA_STREAM_UNCONNECTED, /**< The stream is not yet connected to any sink or source */
+ PA_STREAM_CREATING, /**< The stream is being created */
+ PA_STREAM_READY, /**< The stream is established, you may pass audio data to it now */
+ PA_STREAM_FAILED, /**< An error occurred that made the stream invalid */
+ PA_STREAM_TERMINATED /**< The stream has been terminated cleanly */
+} pa_stream_state_t;
+
+/** Return non-zero if the passed state is one of the connected states. \since 0.9.11 */
+static inline int PA_STREAM_IS_GOOD(pa_stream_state_t x) {
+ return
+ x == PA_STREAM_CREATING ||
+ x == PA_STREAM_READY;
+}
+
+/** \cond fulldocs */
+#define PA_STREAM_UNCONNECTED PA_STREAM_UNCONNECTED
+#define PA_STREAM_CREATING PA_STREAM_CREATING
+#define PA_STREAM_READY PA_STREAM_READY
+#define PA_STREAM_FAILED PA_STREAM_FAILED
+#define PA_STREAM_TERMINATED PA_STREAM_TERMINATED
+#define PA_STREAM_IS_GOOD PA_STREAM_IS_GOOD
+/** \endcond */
+
+/** The state of an operation */
+typedef enum pa_operation_state {
+ PA_OPERATION_RUNNING,
+ /**< The operation is still running */
+ PA_OPERATION_DONE,
+ /**< The operation has completed */
+ PA_OPERATION_CANCELLED
+ /**< The operation has been cancelled. Operations may get cancelled by the
+ * application, or as a result of the context getting disconneted while the
+ * operation is pending. */
+} pa_operation_state_t;
+
+/** \cond fulldocs */
+#define PA_OPERATION_RUNNING PA_OPERATION_RUNNING
+#define PA_OPERATION_DONE PA_OPERATION_DONE
+#define PA_OPERATION_CANCELED PA_OPERATION_CANCELLED
+#define PA_OPERATION_CANCELLED PA_OPERATION_CANCELLED
+/** \endcond */
+
+/** An invalid index */
+#define PA_INVALID_INDEX ((uint32_t) -1)
+
+/** Some special flags for contexts. */
+typedef enum pa_context_flags {
+ PA_CONTEXT_NOFLAGS = 0x0000U,
+ /**< Flag to pass when no specific options are needed (used to avoid casting) \since 0.9.19 */
+ PA_CONTEXT_NOAUTOSPAWN = 0x0001U,
+ /**< Disabled autospawning of the PulseAudio daemon if required */
+ PA_CONTEXT_NOFAIL = 0x0002U
+ /**< Don't fail if the daemon is not available when pa_context_connect() is called, instead enter PA_CONTEXT_CONNECTING state and wait for the daemon to appear. \since 0.9.15 */
+} pa_context_flags_t;
+
+/** \cond fulldocs */
+/* Allow clients to check with #ifdef for those flags */
+#define PA_CONTEXT_NOAUTOSPAWN PA_CONTEXT_NOAUTOSPAWN
+#define PA_CONTEXT_NOFAIL PA_CONTEXT_NOFAIL
+/** \endcond */
+
+/** Direction bitfield - while we currently do not expose anything bidirectional,
+ one should test against the bit instead of the value (e.g.\ if (d & PA_DIRECTION_OUTPUT)),
+ because we might add bidirectional stuff in the future. \since 2.0
+*/
+typedef enum pa_direction {
+ PA_DIRECTION_OUTPUT = 0x0001U, /**< Output direction */
+ PA_DIRECTION_INPUT = 0x0002U /**< Input direction */
+} pa_direction_t;
+
+/** \cond fulldocs */
+#define PA_DIRECTION_OUTPUT PA_DIRECTION_OUTPUT
+#define PA_DIRECTION_INPUT PA_DIRECTION_INPUT
+/** \endcond */
+
+/** The type of device we are dealing with */
+typedef enum pa_device_type {
+ PA_DEVICE_TYPE_SINK, /**< Playback device */
+ PA_DEVICE_TYPE_SOURCE /**< Recording device */
+} pa_device_type_t;
+
+/** \cond fulldocs */
+#define PA_DEVICE_TYPE_SINK PA_DEVICE_TYPE_SINK
+#define PA_DEVICE_TYPE_SOURCE PA_DEVICE_TYPE_SOURCE
+/** \endcond */
+
+/** The direction of a pa_stream object */
+typedef enum pa_stream_direction {
+ PA_STREAM_NODIRECTION, /**< Invalid direction */
+ PA_STREAM_PLAYBACK, /**< Playback stream */
+ PA_STREAM_RECORD, /**< Record stream */
+ PA_STREAM_UPLOAD /**< Sample upload stream */
+} pa_stream_direction_t;
+
+/** \cond fulldocs */
+#define PA_STREAM_NODIRECTION PA_STREAM_NODIRECTION
+#define PA_STREAM_PLAYBACK PA_STREAM_PLAYBACK
+#define PA_STREAM_RECORD PA_STREAM_RECORD
+#define PA_STREAM_UPLOAD PA_STREAM_UPLOAD
+/** \endcond */
+
+/** Some special flags for stream connections. */
+typedef enum pa_stream_flags {
+
+ PA_STREAM_NOFLAGS = 0x0000U,
+ /**< Flag to pass when no specific options are needed (used to avoid casting) \since 0.9.19 */
+
+ PA_STREAM_START_CORKED = 0x0001U,
+ /**< Create the stream corked, requiring an explicit
+ * pa_stream_cork() call to uncork it. */
+
+ PA_STREAM_INTERPOLATE_TIMING = 0x0002U,
+ /**< Interpolate the latency for this stream. When enabled,
+ * pa_stream_get_latency() and pa_stream_get_time() will try to
+ * estimate the current record/playback time based on the local
+ * time that passed since the last timing info update. Using this
+ * option has the advantage of not requiring a whole roundtrip
+ * when the current playback/recording time is needed. Consider
+ * using this option when requesting latency information
+ * frequently. This is especially useful on long latency network
+ * connections. It makes a lot of sense to combine this option
+ * with PA_STREAM_AUTO_TIMING_UPDATE. */
+
+ PA_STREAM_NOT_MONOTONIC = 0x0004U,
+ /**< Don't force the time to increase monotonically. If this
+ * option is enabled, pa_stream_get_time() will not necessarily
+ * return always monotonically increasing time values on each
+ * call. This may confuse applications which cannot deal with time
+ * going 'backwards', but has the advantage that bad transport
+ * latency estimations that caused the time to jump ahead can
+ * be corrected quickly, without the need to wait. (Please note
+ * that this flag was named PA_STREAM_NOT_MONOTONOUS in releases
+ * prior to 0.9.11. The old name is still defined too, for
+ * compatibility reasons. */
+
+ PA_STREAM_AUTO_TIMING_UPDATE = 0x0008U,
+ /**< If set timing update requests are issued periodically
+ * automatically. Combined with PA_STREAM_INTERPOLATE_TIMING you
+ * will be able to query the current time and latency with
+ * pa_stream_get_time() and pa_stream_get_latency() at all times
+ * without a packet round trip.*/
+
+ PA_STREAM_NO_REMAP_CHANNELS = 0x0010U,
+ /**< Don't remap channels by their name, instead map them simply
+ * by their index. Implies PA_STREAM_NO_REMIX_CHANNELS. Only
+ * supported when the server is at least PA 0.9.8. It is ignored
+ * on older servers.\since 0.9.8 */
+
+ PA_STREAM_NO_REMIX_CHANNELS = 0x0020U,
+ /**< When remapping channels by name, don't upmix or downmix them
+ * to related channels. Copy them into matching channels of the
+ * device 1:1. Only supported when the server is at least PA
+ * 0.9.8. It is ignored on older servers. \since 0.9.8 */
+
+ PA_STREAM_FIX_FORMAT = 0x0040U,
+ /**< Use the sample format of the sink/device this stream is being
+ * connected to, and possibly ignore the format the sample spec
+ * contains -- but you still have to pass a valid value in it as a
+ * hint to PulseAudio what would suit your stream best. If this is
+ * used you should query the used sample format after creating the
+ * stream by using pa_stream_get_sample_spec(). Also, if you
+ * specified manual buffer metrics it is recommended to update
+ * them with pa_stream_set_buffer_attr() to compensate for the
+ * changed frame sizes. Only supported when the server is at least
+ * PA 0.9.8. It is ignored on older servers.
+ *
+ * When creating streams with pa_stream_new_extended(), this flag has no
+ * effect. If you specify a format with PCM encoding, and you want the
+ * server to choose the sample format, then you should leave the sample
+ * format unspecified in the pa_format_info object. This also means that
+ * you can't use pa_format_info_from_sample_spec(), because that function
+ * always sets the sample format.
+ *
+ * \since 0.9.8 */
+
+ PA_STREAM_FIX_RATE = 0x0080U,
+ /**< Use the sample rate of the sink, and possibly ignore the rate
+ * the sample spec contains. Usage similar to
+ * PA_STREAM_FIX_FORMAT. Only supported when the server is at least
+ * PA 0.9.8. It is ignored on older servers.
+ *
+ * When creating streams with pa_stream_new_extended(), this flag has no
+ * effect. If you specify a format with PCM encoding, and you want the
+ * server to choose the sample rate, then you should leave the rate
+ * unspecified in the pa_format_info object. This also means that you can't
+ * use pa_format_info_from_sample_spec(), because that function always sets
+ * the sample rate.
+ *
+ * \since 0.9.8 */
+
+ PA_STREAM_FIX_CHANNELS = 0x0100,
+ /**< Use the number of channels and the channel map of the sink,
+ * and possibly ignore the number of channels and the map the
+ * sample spec and the passed channel map contains. Usage similar
+ * to PA_STREAM_FIX_FORMAT. Only supported when the server is at
+ * least PA 0.9.8. It is ignored on older servers.
+ *
+ * When creating streams with pa_stream_new_extended(), this flag has no
+ * effect. If you specify a format with PCM encoding, and you want the
+ * server to choose the channel count and/or channel map, then you should
+ * leave the channels and/or the channel map unspecified in the
+ * pa_format_info object. This also means that you can't use
+ * pa_format_info_from_sample_spec(), because that function always sets
+ * the channel count (but if you only want to leave the channel map
+ * unspecified, then pa_format_info_from_sample_spec() works, because it
+ * accepts a NULL channel map).
+ *
+ * \since 0.9.8 */
+
+ PA_STREAM_DONT_MOVE = 0x0200U,
+ /**< Don't allow moving of this stream to another
+ * sink/device. Useful if you use any of the PA_STREAM_FIX_ flags
+ * and want to make sure that resampling never takes place --
+ * which might happen if the stream is moved to another
+ * sink/source with a different sample spec/channel map. Only
+ * supported when the server is at least PA 0.9.8. It is ignored
+ * on older servers. \since 0.9.8 */
+
+ PA_STREAM_VARIABLE_RATE = 0x0400U,
+ /**< Allow dynamic changing of the sampling rate during playback
+ * with pa_stream_update_sample_rate(). Only supported when the
+ * server is at least PA 0.9.8. It is ignored on older
+ * servers. \since 0.9.8 */
+
+ PA_STREAM_PEAK_DETECT = 0x0800U,
+ /**< Find peaks instead of resampling. \since 0.9.11 */
+
+ PA_STREAM_START_MUTED = 0x1000U,
+ /**< Create in muted state. If neither PA_STREAM_START_UNMUTED nor
+ * PA_STREAM_START_MUTED it is left to the server to decide
+ * whether to create the stream in muted or in unmuted
+ * state. \since 0.9.11 */
+
+ PA_STREAM_ADJUST_LATENCY = 0x2000U,
+ /**< Try to adjust the latency of the sink/source based on the
+ * requested buffer metrics and adjust buffer metrics
+ * accordingly. Also see pa_buffer_attr. This option may not be
+ * specified at the same time as PA_STREAM_EARLY_REQUESTS. \since
+ * 0.9.11 */
+
+ PA_STREAM_EARLY_REQUESTS = 0x4000U,
+ /**< Enable compatibility mode for legacy clients that rely on a
+ * "classic" hardware device fragment-style playback model. If
+ * this option is set, the minreq value of the buffer metrics gets
+ * a new meaning: instead of just specifying that no requests
+ * asking for less new data than this value will be made to the
+ * client it will also guarantee that requests are generated as
+ * early as this limit is reached. This flag should only be set in
+ * very few situations where compatibility with a fragment-based
+ * playback model needs to be kept and the client applications
+ * cannot deal with data requests that are delayed to the latest
+ * moment possible. (Usually these are programs that use usleep()
+ * or a similar call in their playback loops instead of sleeping
+ * on the device itself.) Also see pa_buffer_attr. This option may
+ * not be specified at the same time as
+ * PA_STREAM_ADJUST_LATENCY. \since 0.9.12 */
+
+ PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND = 0x8000U,
+ /**< If set this stream won't be taken into account when it is
+ * checked whether the device this stream is connected to should
+ * auto-suspend. \since 0.9.15 */
+
+ PA_STREAM_START_UNMUTED = 0x10000U,
+ /**< Create in unmuted state. If neither PA_STREAM_START_UNMUTED
+ * nor PA_STREAM_START_MUTED it is left to the server to decide
+ * whether to create the stream in muted or in unmuted
+ * state. \since 0.9.15 */
+
+ PA_STREAM_FAIL_ON_SUSPEND = 0x20000U,
+ /**< If the sink/source this stream is connected to is suspended
+ * during the creation of this stream, cause it to fail. If the
+ * sink/source is being suspended during creation of this stream,
+ * make sure this stream is terminated. \since 0.9.15 */
+
+ PA_STREAM_RELATIVE_VOLUME = 0x40000U,
+ /**< If a volume is passed when this stream is created, consider
+ * it relative to the sink's current volume, never as absolute
+ * device volume. If this is not specified the volume will be
+ * consider absolute when the sink is in flat volume mode,
+ * relative otherwise. \since 0.9.20 */
+
+ PA_STREAM_PASSTHROUGH = 0x80000U
+ /**< Used to tag content that will be rendered by passthrough sinks.
+ * The data will be left as is and not reformatted, resampled.
+ * \since 1.0 */
+
+} pa_stream_flags_t;
+
+/** \cond fulldocs */
+
+/* English is an evil language */
+#define PA_STREAM_NOT_MONOTONOUS PA_STREAM_NOT_MONOTONIC
+
+/* Allow clients to check with #ifdef for those flags */
+#define PA_STREAM_START_CORKED PA_STREAM_START_CORKED
+#define PA_STREAM_INTERPOLATE_TIMING PA_STREAM_INTERPOLATE_TIMING
+#define PA_STREAM_NOT_MONOTONIC PA_STREAM_NOT_MONOTONIC
+#define PA_STREAM_AUTO_TIMING_UPDATE PA_STREAM_AUTO_TIMING_UPDATE
+#define PA_STREAM_NO_REMAP_CHANNELS PA_STREAM_NO_REMAP_CHANNELS
+#define PA_STREAM_NO_REMIX_CHANNELS PA_STREAM_NO_REMIX_CHANNELS
+#define PA_STREAM_FIX_FORMAT PA_STREAM_FIX_FORMAT
+#define PA_STREAM_FIX_RATE PA_STREAM_FIX_RATE
+#define PA_STREAM_FIX_CHANNELS PA_STREAM_FIX_CHANNELS
+#define PA_STREAM_DONT_MOVE PA_STREAM_DONT_MOVE
+#define PA_STREAM_VARIABLE_RATE PA_STREAM_VARIABLE_RATE
+#define PA_STREAM_PEAK_DETECT PA_STREAM_PEAK_DETECT
+#define PA_STREAM_START_MUTED PA_STREAM_START_MUTED
+#define PA_STREAM_ADJUST_LATENCY PA_STREAM_ADJUST_LATENCY
+#define PA_STREAM_EARLY_REQUESTS PA_STREAM_EARLY_REQUESTS
+#define PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND
+#define PA_STREAM_START_UNMUTED PA_STREAM_START_UNMUTED
+#define PA_STREAM_FAIL_ON_SUSPEND PA_STREAM_FAIL_ON_SUSPEND
+#define PA_STREAM_RELATIVE_VOLUME PA_STREAM_RELATIVE_VOLUME
+#define PA_STREAM_PASSTHROUGH PA_STREAM_PASSTHROUGH
+
+/** \endcond */
+
+/** Playback and record buffer metrics */
+typedef struct pa_buffer_attr {
+ uint32_t maxlength;
+ /**< Maximum length of the buffer in bytes. Setting this to (uint32_t) -1
+ * will initialize this to the maximum value supported by server,
+ * which is recommended.
+ *
+ * In strict low-latency playback scenarios you might want to set this to
+ * a lower value, likely together with the PA_STREAM_ADJUST_LATENCY flag.
+ * If you do so, you ensure that the latency doesn't grow beyond what is
+ * acceptable for the use case, at the cost of getting more underruns if
+ * the latency is lower than what the server can reliably handle. */
+
+ uint32_t tlength;
+ /**< Playback only: target length of the buffer. The server tries
+ * to assure that at least tlength bytes are always available in
+ * the per-stream server-side playback buffer. It is recommended
+ * to set this to (uint32_t) -1, which will initialize this to a
+ * value that is deemed sensible by the server. However, this
+ * value will default to something like 2s, i.e. for applications
+ * that have specific latency requirements this value should be
+ * set to the maximum latency that the application can deal
+ * with. When PA_STREAM_ADJUST_LATENCY is not set this value will
+ * influence only the per-stream playback buffer size. When
+ * PA_STREAM_ADJUST_LATENCY is set the overall latency of the sink
+ * plus the playback buffer size is configured to this value. Set
+ * PA_STREAM_ADJUST_LATENCY if you are interested in adjusting the
+ * overall latency. Don't set it if you are interested in
+ * configuring the server-side per-stream playback buffer
+ * size. */
+
+ uint32_t prebuf;
+ /**< Playback only: pre-buffering. The server does not start with
+ * playback before at least prebuf bytes are available in the
+ * buffer. It is recommended to set this to (uint32_t) -1, which
+ * will initialize this to the same value as tlength, whatever
+ * that may be. Initialize to 0 to enable manual start/stop
+ * control of the stream. This means that playback will not stop
+ * on underrun and playback will not start automatically. Instead
+ * pa_stream_cork() needs to be called explicitly. If you set
+ * this value to 0 you should also set PA_STREAM_START_CORKED. */
+
+ uint32_t minreq;
+ /**< Playback only: minimum request. The server does not request
+ * less than minreq bytes from the client, instead waits until the
+ * buffer is free enough to request more bytes at once. It is
+ * recommended to set this to (uint32_t) -1, which will initialize
+ * this to a value that is deemed sensible by the server. This
+ * should be set to a value that gives PulseAudio enough time to
+ * move the data from the per-stream playback buffer into the
+ * hardware playback buffer. */
+
+ uint32_t fragsize;
+ /**< Recording only: fragment size. The server sends data in
+ * blocks of fragsize bytes size. Large values diminish
+ * interactivity with other operations on the connection context
+ * but decrease control overhead. It is recommended to set this to
+ * (uint32_t) -1, which will initialize this to a value that is
+ * deemed sensible by the server. However, this value will default
+ * to something like 2s, i.e. for applications that have specific
+ * latency requirements this value should be set to the maximum
+ * latency that the application can deal with. If
+ * PA_STREAM_ADJUST_LATENCY is set the overall source latency will
+ * be adjusted according to this value. If it is not set the
+ * source latency is left unmodified. */
+
+} pa_buffer_attr;
+
+/** Error values as used by pa_context_errno(). Use pa_strerror() to convert these values to human readable strings */
+typedef enum pa_error_code {
+ PA_OK = 0, /**< No error */
+ PA_ERR_ACCESS, /**< Access failure */
+ PA_ERR_COMMAND, /**< Unknown command */
+ PA_ERR_INVALID, /**< Invalid argument */
+ PA_ERR_EXIST, /**< Entity exists */
+ PA_ERR_NOENTITY, /**< No such entity */
+ PA_ERR_CONNECTIONREFUSED, /**< Connection refused */
+ PA_ERR_PROTOCOL, /**< Protocol error */
+ PA_ERR_TIMEOUT, /**< Timeout */
+ PA_ERR_AUTHKEY, /**< No authentication key */
+ PA_ERR_INTERNAL, /**< Internal error */
+ PA_ERR_CONNECTIONTERMINATED, /**< Connection terminated */
+ PA_ERR_KILLED, /**< Entity killed */
+ PA_ERR_INVALIDSERVER, /**< Invalid server */
+ PA_ERR_MODINITFAILED, /**< Module initialization failed */
+ PA_ERR_BADSTATE, /**< Bad state */
+ PA_ERR_NODATA, /**< No data */
+ PA_ERR_VERSION, /**< Incompatible protocol version */
+ PA_ERR_TOOLARGE, /**< Data too large */
+ PA_ERR_NOTSUPPORTED, /**< Operation not supported \since 0.9.5 */
+ PA_ERR_UNKNOWN, /**< The error code was unknown to the client */
+ PA_ERR_NOEXTENSION, /**< Extension does not exist. \since 0.9.12 */
+ PA_ERR_OBSOLETE, /**< Obsolete functionality. \since 0.9.15 */
+ PA_ERR_NOTIMPLEMENTED, /**< Missing implementation. \since 0.9.15 */
+ PA_ERR_FORKED, /**< The caller forked without calling execve() and tried to reuse the context. \since 0.9.15 */
+ PA_ERR_IO, /**< An IO error happened. \since 0.9.16 */
+ PA_ERR_BUSY, /**< Device or resource busy. \since 0.9.17 */
+ PA_ERR_MAX /**< Not really an error but the first invalid error code */
+} pa_error_code_t;
+
+/** \cond fulldocs */
+#define PA_OK PA_OK
+#define PA_ERR_ACCESS PA_ERR_ACCESS
+#define PA_ERR_COMMAND PA_ERR_COMMAND
+#define PA_ERR_INVALID PA_ERR_INVALID
+#define PA_ERR_EXIST PA_ERR_EXIST
+#define PA_ERR_NOENTITY PA_ERR_NOENTITY
+#define PA_ERR_CONNECTIONREFUSED PA_ERR_CONNECTIONREFUSED
+#define PA_ERR_PROTOCOL PA_ERR_PROTOCOL
+#define PA_ERR_TIMEOUT PA_ERR_TIMEOUT
+#define PA_ERR_AUTHKEY PA_ERR_AUTHKEY
+#define PA_ERR_INTERNAL PA_ERR_INTERNAL
+#define PA_ERR_CONNECTIONTERMINATED PA_ERR_CONNECTIONTERMINATED
+#define PA_ERR_KILLED PA_ERR_KILLED
+#define PA_ERR_INVALIDSERVER PA_ERR_INVALIDSERVER
+#define PA_ERR_MODINITFAILED PA_ERR_MODINITFAILED
+#define PA_ERR_BADSTATE PA_ERR_BADSTATE
+#define PA_ERR_NODATA PA_ERR_NODATA
+#define PA_ERR_VERSION PA_ERR_VERSION
+#define PA_ERR_TOOLARGE PA_ERR_TOOLARGE
+#define PA_ERR_NOTSUPPORTED PA_ERR_NOTSUPPORTED
+#define PA_ERR_UNKNOWN PA_ERR_UNKNOWN
+#define PA_ERR_NOEXTENSION PA_ERR_NOEXTENSION
+#define PA_ERR_OBSOLETE PA_ERR_OBSOLETE
+#define PA_ERR_NOTIMPLEMENTED PA_ERR_NOTIMPLEMENTED
+#define PA_ERR_FORKED PA_ERR_FORKED
+#define PA_ERR_MAX PA_ERR_MAX
+/** \endcond */
+
+/** Subscription event mask, as used by pa_context_subscribe() */
+typedef enum pa_subscription_mask {
+ PA_SUBSCRIPTION_MASK_NULL = 0x0000U,
+ /**< No events */
+
+ PA_SUBSCRIPTION_MASK_SINK = 0x0001U,
+ /**< Sink events */
+
+ PA_SUBSCRIPTION_MASK_SOURCE = 0x0002U,
+ /**< Source events */
+
+ PA_SUBSCRIPTION_MASK_SINK_INPUT = 0x0004U,
+ /**< Sink input events */
+
+ PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT = 0x0008U,
+ /**< Source output events */
+
+ PA_SUBSCRIPTION_MASK_MODULE = 0x0010U,
+ /**< Module events */
+
+ PA_SUBSCRIPTION_MASK_CLIENT = 0x0020U,
+ /**< Client events */
+
+ PA_SUBSCRIPTION_MASK_SAMPLE_CACHE = 0x0040U,
+ /**< Sample cache events */
+
+ PA_SUBSCRIPTION_MASK_SERVER = 0x0080U,
+ /**< Other global server changes. */
+
+/** \cond fulldocs */
+ PA_SUBSCRIPTION_MASK_AUTOLOAD = 0x0100U,
+ /**< \deprecated Autoload table events. */
+/** \endcond */
+
+ PA_SUBSCRIPTION_MASK_CARD = 0x0200U,
+ /**< Card events. \since 0.9.15 */
+
+ PA_SUBSCRIPTION_MASK_ALL = 0x02ffU
+ /**< Catch all events */
+} pa_subscription_mask_t;
+
+/** Subscription event types, as used by pa_context_subscribe() */
+typedef enum pa_subscription_event_type {
+ PA_SUBSCRIPTION_EVENT_SINK = 0x0000U,
+ /**< Event type: Sink */
+
+ PA_SUBSCRIPTION_EVENT_SOURCE = 0x0001U,
+ /**< Event type: Source */
+
+ PA_SUBSCRIPTION_EVENT_SINK_INPUT = 0x0002U,
+ /**< Event type: Sink input */
+
+ PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT = 0x0003U,
+ /**< Event type: Source output */
+
+ PA_SUBSCRIPTION_EVENT_MODULE = 0x0004U,
+ /**< Event type: Module */
+
+ PA_SUBSCRIPTION_EVENT_CLIENT = 0x0005U,
+ /**< Event type: Client */
+
+ PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE = 0x0006U,
+ /**< Event type: Sample cache item */
+
+ PA_SUBSCRIPTION_EVENT_SERVER = 0x0007U,
+ /**< Event type: Global server change, only occurring with PA_SUBSCRIPTION_EVENT_CHANGE. */
+
+/** \cond fulldocs */
+ PA_SUBSCRIPTION_EVENT_AUTOLOAD = 0x0008U,
+ /**< \deprecated Event type: Autoload table changes. */
+/** \endcond */
+
+ PA_SUBSCRIPTION_EVENT_CARD = 0x0009U,
+ /**< Event type: Card \since 0.9.15 */
+
+ PA_SUBSCRIPTION_EVENT_FACILITY_MASK = 0x000FU,
+ /**< A mask to extract the event type from an event value */
+
+ PA_SUBSCRIPTION_EVENT_NEW = 0x0000U,
+ /**< A new object was created */
+
+ PA_SUBSCRIPTION_EVENT_CHANGE = 0x0010U,
+ /**< A property of the object was modified */
+
+ PA_SUBSCRIPTION_EVENT_REMOVE = 0x0020U,
+ /**< An object was removed */
+
+ PA_SUBSCRIPTION_EVENT_TYPE_MASK = 0x0030U
+ /**< A mask to extract the event operation from an event value */
+
+} pa_subscription_event_type_t;
+
+/** Return one if an event type t matches an event mask bitfield */
+#define pa_subscription_match_flags(m, t) (!!((m) & (1 << ((t) & PA_SUBSCRIPTION_EVENT_FACILITY_MASK))))
+
+/** \cond fulldocs */
+#define PA_SUBSCRIPTION_MASK_NULL PA_SUBSCRIPTION_MASK_NULL
+#define PA_SUBSCRIPTION_MASK_SINK PA_SUBSCRIPTION_MASK_SINK
+#define PA_SUBSCRIPTION_MASK_SOURCE PA_SUBSCRIPTION_MASK_SOURCE
+#define PA_SUBSCRIPTION_MASK_SINK_INPUT PA_SUBSCRIPTION_MASK_SINK_INPUT
+#define PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT
+#define PA_SUBSCRIPTION_MASK_MODULE PA_SUBSCRIPTION_MASK_MODULE
+#define PA_SUBSCRIPTION_MASK_CLIENT PA_SUBSCRIPTION_MASK_CLIENT
+#define PA_SUBSCRIPTION_MASK_SAMPLE_CACHE PA_SUBSCRIPTION_MASK_SAMPLE_CACHE
+#define PA_SUBSCRIPTION_MASK_SERVER PA_SUBSCRIPTION_MASK_SERVER
+#define PA_SUBSCRIPTION_MASK_AUTOLOAD PA_SUBSCRIPTION_MASK_AUTOLOAD
+#define PA_SUBSCRIPTION_MASK_CARD PA_SUBSCRIPTION_MASK_CARD
+#define PA_SUBSCRIPTION_MASK_ALL PA_SUBSCRIPTION_MASK_ALL
+#define PA_SUBSCRIPTION_EVENT_SINK PA_SUBSCRIPTION_EVENT_SINK
+#define PA_SUBSCRIPTION_EVENT_SOURCE PA_SUBSCRIPTION_EVENT_SOURCE
+#define PA_SUBSCRIPTION_EVENT_SINK_INPUT PA_SUBSCRIPTION_EVENT_SINK_INPUT
+#define PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT
+#define PA_SUBSCRIPTION_EVENT_MODULE PA_SUBSCRIPTION_EVENT_MODULE
+#define PA_SUBSCRIPTION_EVENT_CLIENT PA_SUBSCRIPTION_EVENT_CLIENT
+#define PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE
+#define PA_SUBSCRIPTION_EVENT_SERVER PA_SUBSCRIPTION_EVENT_SERVER
+#define PA_SUBSCRIPTION_EVENT_AUTOLOAD PA_SUBSCRIPTION_EVENT_AUTOLOAD
+#define PA_SUBSCRIPTION_EVENT_CARD PA_SUBSCRIPTION_EVENT_CARD
+#define PA_SUBSCRIPTION_EVENT_FACILITY_MASK PA_SUBSCRIPTION_EVENT_FACILITY_MASK
+#define PA_SUBSCRIPTION_EVENT_NEW PA_SUBSCRIPTION_EVENT_NEW
+#define PA_SUBSCRIPTION_EVENT_CHANGE PA_SUBSCRIPTION_EVENT_CHANGE
+#define PA_SUBSCRIPTION_EVENT_REMOVE PA_SUBSCRIPTION_EVENT_REMOVE
+#define PA_SUBSCRIPTION_EVENT_TYPE_MASK PA_SUBSCRIPTION_EVENT_TYPE_MASK
+/** \endcond */
+
+/** A structure for all kinds of timing information of a stream. See
+ * pa_stream_update_timing_info() and pa_stream_get_timing_info(). The
+ * total output latency a sample that is written with
+ * pa_stream_write() takes to be played may be estimated by
+ * sink_usec+buffer_usec+transport_usec. (where buffer_usec is defined
+ * as pa_bytes_to_usec(write_index-read_index)) The output buffer
+ * which buffer_usec relates to may be manipulated freely (with
+ * pa_stream_write()'s seek argument, pa_stream_flush() and friends),
+ * the buffers sink_usec and source_usec relate to are first-in
+ * first-out (FIFO) buffers which cannot be flushed or manipulated in
+ * any way. The total input latency a sample that is recorded takes to
+ * be delivered to the application is:
+ * source_usec+buffer_usec+transport_usec-sink_usec. (Take care of
+ * sign issues!) When connected to a monitor source sink_usec contains
+ * the latency of the owning sink. The two latency estimations
+ * described here are implemented in pa_stream_get_latency(). Please
+ * note that this structure can be extended as part of evolutionary
+ * API updates at any time in any new release.*/
+typedef struct pa_timing_info {
+ struct timeval timestamp;
+ /**< The time when this timing info structure was current */
+
+ int synchronized_clocks;
+ /**< Non-zero if the local and the remote machine have
+ * synchronized clocks. If synchronized clocks are detected
+ * transport_usec becomes much more reliable. However, the code
+ * that detects synchronized clocks is very limited and unreliable
+ * itself. */
+
+ pa_usec_t sink_usec;
+ /**< Time in usecs a sample takes to be played on the sink. For
+ * playback streams and record streams connected to a monitor
+ * source. */
+
+ pa_usec_t source_usec;
+ /**< Time in usecs a sample takes from being recorded to being
+ * delivered to the application. Only for record streams. */
+
+ pa_usec_t transport_usec;
+ /**< Estimated time in usecs a sample takes to be transferred
+ * to/from the daemon. For both playback and record streams. */
+
+ int playing;
+ /**< Non-zero when the stream is currently not underrun and data
+ * is being passed on to the device. Only for playback
+ * streams. This field does not say whether the data is actually
+ * already being played. To determine this check whether
+ * since_underrun (converted to usec) is larger than sink_usec.*/
+
+ int write_index_corrupt;
+ /**< Non-zero if write_index is not up-to-date because a local
+ * write command that corrupted it has been issued in the time
+ * since this latency info was current . Only write commands with
+ * SEEK_RELATIVE_ON_READ and SEEK_RELATIVE_END can corrupt
+ * write_index. */
+
+ int64_t write_index;
+ /**< Current write index into the playback buffer in bytes. Think
+ * twice before using this for seeking purposes: it might be out
+ * of date a the time you want to use it. Consider using
+ * PA_SEEK_RELATIVE instead. */
+
+ int read_index_corrupt;
+ /**< Non-zero if read_index is not up-to-date because a local
+ * pause or flush request that corrupted it has been issued in the
+ * time since this latency info was current. */
+
+ int64_t read_index;
+ /**< Current read index into the playback buffer in bytes. Think
+ * twice before using this for seeking purposes: it might be out
+ * of date a the time you want to use it. Consider using
+ * PA_SEEK_RELATIVE_ON_READ instead. */
+
+ pa_usec_t configured_sink_usec;
+ /**< The configured latency for the sink. \since 0.9.11 */
+
+ pa_usec_t configured_source_usec;
+ /**< The configured latency for the source. \since 0.9.11 */
+
+ int64_t since_underrun;
+ /**< Bytes that were handed to the sink since the last underrun
+ * happened, or since playback started again after the last
+ * underrun. playing will tell you which case it is. \since
+ * 0.9.11 */
+
+} pa_timing_info;
+
+/** A structure for the spawn api. This may be used to integrate auto
+ * spawned daemons into your application. For more information see
+ * pa_context_connect(). When spawning a new child process the
+ * waitpid() is used on the child's PID. The spawn routine will not
+ * block or ignore SIGCHLD signals, since this cannot be done in a
+ * thread compatible way. You might have to do this in
+ * prefork/postfork. */
+typedef struct pa_spawn_api {
+ void (*prefork)(void);
+ /**< Is called just before the fork in the parent process. May be
+ * NULL. */
+
+ void (*postfork)(void);
+ /**< Is called immediately after the fork in the parent
+ * process. May be NULL.*/
+
+ void (*atfork)(void);
+ /**< Is called immediately after the fork in the child
+ * process. May be NULL. It is not safe to close all file
+ * descriptors in this function unconditionally, since a UNIX
+ * socket (created using socketpair()) is passed to the new
+ * process. */
+} pa_spawn_api;
+
+/** Seek type for pa_stream_write(). */
+typedef enum pa_seek_mode {
+ PA_SEEK_RELATIVE = 0,
+ /**< Seek relatively to the write index */
+
+ PA_SEEK_ABSOLUTE = 1,
+ /**< Seek relatively to the start of the buffer queue */
+
+ PA_SEEK_RELATIVE_ON_READ = 2,
+ /**< Seek relatively to the read index. */
+
+ PA_SEEK_RELATIVE_END = 3
+ /**< Seek relatively to the current end of the buffer queue. */
+} pa_seek_mode_t;
+
+/** \cond fulldocs */
+#define PA_SEEK_RELATIVE PA_SEEK_RELATIVE
+#define PA_SEEK_ABSOLUTE PA_SEEK_ABSOLUTE
+#define PA_SEEK_RELATIVE_ON_READ PA_SEEK_RELATIVE_ON_READ
+#define PA_SEEK_RELATIVE_END PA_SEEK_RELATIVE_END
+/** \endcond */
+
+/** Special sink flags. */
+typedef enum pa_sink_flags {
+ PA_SINK_NOFLAGS = 0x0000U,
+ /**< Flag to pass when no specific options are needed (used to avoid casting) \since 0.9.19 */
+
+ PA_SINK_HW_VOLUME_CTRL = 0x0001U,
+ /**< Supports hardware volume control. This is a dynamic flag and may
+ * change at runtime after the sink has initialized */
+
+ PA_SINK_LATENCY = 0x0002U,
+ /**< Supports latency querying */
+
+ PA_SINK_HARDWARE = 0x0004U,
+ /**< Is a hardware sink of some kind, in contrast to
+ * "virtual"/software sinks \since 0.9.3 */
+
+ PA_SINK_NETWORK = 0x0008U,
+ /**< Is a networked sink of some kind. \since 0.9.7 */
+
+ PA_SINK_HW_MUTE_CTRL = 0x0010U,
+ /**< Supports hardware mute control. This is a dynamic flag and may
+ * change at runtime after the sink has initialized \since 0.9.11 */
+
+ PA_SINK_DECIBEL_VOLUME = 0x0020U,
+ /**< Volume can be translated to dB with pa_sw_volume_to_dB(). This is a
+ * dynamic flag and may change at runtime after the sink has initialized
+ * \since 0.9.11 */
+
+ PA_SINK_FLAT_VOLUME = 0x0040U,
+ /**< This sink is in flat volume mode, i.e.\ always the maximum of
+ * the volume of all connected inputs. \since 0.9.15 */
+
+ PA_SINK_DYNAMIC_LATENCY = 0x0080U,
+ /**< The latency can be adjusted dynamically depending on the
+ * needs of the connected streams. \since 0.9.15 */
+
+ PA_SINK_SET_FORMATS = 0x0100U,
+ /**< The sink allows setting what formats are supported by the connected
+ * hardware. The actual functionality to do this might be provided by an
+ * extension. \since 1.0 */
+
+#ifdef __INCLUDED_FROM_PULSE_AUDIO
+/** \cond fulldocs */
+ /* PRIVATE: Server-side values -- do not try to use these at client-side.
+ * The server will filter out these flags anyway, so you should never see
+ * these flags in sinks. */
+
+ PA_SINK_SHARE_VOLUME_WITH_MASTER = 0x1000000U,
+ /**< This sink shares the volume with the master sink (used by some filter
+ * sinks). */
+
+ PA_SINK_DEFERRED_VOLUME = 0x2000000U,
+ /**< The HW volume changes are syncronized with SW volume. */
+/** \endcond */
+#endif
+
+} pa_sink_flags_t;
+
+/** \cond fulldocs */
+#define PA_SINK_HW_VOLUME_CTRL PA_SINK_HW_VOLUME_CTRL
+#define PA_SINK_LATENCY PA_SINK_LATENCY
+#define PA_SINK_HARDWARE PA_SINK_HARDWARE
+#define PA_SINK_NETWORK PA_SINK_NETWORK
+#define PA_SINK_HW_MUTE_CTRL PA_SINK_HW_MUTE_CTRL
+#define PA_SINK_DECIBEL_VOLUME PA_SINK_DECIBEL_VOLUME
+#define PA_SINK_FLAT_VOLUME PA_SINK_FLAT_VOLUME
+#define PA_SINK_DYNAMIC_LATENCY PA_SINK_DYNAMIC_LATENCY
+#define PA_SINK_SET_FORMATS PA_SINK_SET_FORMATS
+#ifdef __INCLUDED_FROM_PULSE_AUDIO
+#define PA_SINK_CLIENT_FLAGS_MASK 0xFFFFFF
+#endif
+
+/** \endcond */
+
+/** Sink state. \since 0.9.15 */
+typedef enum pa_sink_state { /* enum serialized in u8 */
+ PA_SINK_INVALID_STATE = -1,
+ /**< This state is used when the server does not support sink state introspection \since 0.9.15 */
+
+ PA_SINK_RUNNING = 0,
+ /**< Running, sink is playing and used by at least one non-corked sink-input \since 0.9.15 */
+
+ PA_SINK_IDLE = 1,
+ /**< When idle, the sink is playing but there is no non-corked sink-input attached to it \since 0.9.15 */
+
+ PA_SINK_SUSPENDED = 2,
+ /**< When suspended, actual sink access can be closed, for instance \since 0.9.15 */
+
+/** \cond fulldocs */
+ /* PRIVATE: Server-side values -- DO NOT USE THIS ON THE CLIENT
+ * SIDE! These values are *not* considered part of the official PA
+ * API/ABI. If you use them your application might break when PA
+ * is upgraded. Also, please note that these values are not useful
+ * on the client side anyway. */
+
+ PA_SINK_INIT = -2,
+ /**< Initialization state */
+
+ PA_SINK_UNLINKED = -3
+ /**< The state when the sink is getting unregistered and removed from client access */
+/** \endcond */
+
+} pa_sink_state_t;
+
+/** Returns non-zero if sink is playing: running or idle. \since 0.9.15 */
+static inline int PA_SINK_IS_OPENED(pa_sink_state_t x) {
+ return x == PA_SINK_RUNNING || x == PA_SINK_IDLE;
+}
+
+/** Returns non-zero if sink is running. \since 1.0 */
+static inline int PA_SINK_IS_RUNNING(pa_sink_state_t x) {
+ return x == PA_SINK_RUNNING;
+}
+
+/** \cond fulldocs */
+#define PA_SINK_INVALID_STATE PA_SINK_INVALID_STATE
+#define PA_SINK_RUNNING PA_SINK_RUNNING
+#define PA_SINK_IDLE PA_SINK_IDLE
+#define PA_SINK_SUSPENDED PA_SINK_SUSPENDED
+#define PA_SINK_INIT PA_SINK_INIT
+#define PA_SINK_UNLINKED PA_SINK_UNLINKED
+#define PA_SINK_IS_OPENED PA_SINK_IS_OPENED
+/** \endcond */
+
+/** Special source flags. */
+typedef enum pa_source_flags {
+ PA_SOURCE_NOFLAGS = 0x0000U,
+ /**< Flag to pass when no specific options are needed (used to avoid casting) \since 0.9.19 */
+
+ PA_SOURCE_HW_VOLUME_CTRL = 0x0001U,
+ /**< Supports hardware volume control. This is a dynamic flag and may
+ * change at runtime after the source has initialized */
+
+ PA_SOURCE_LATENCY = 0x0002U,
+ /**< Supports latency querying */
+
+ PA_SOURCE_HARDWARE = 0x0004U,
+ /**< Is a hardware source of some kind, in contrast to
+ * "virtual"/software source \since 0.9.3 */
+
+ PA_SOURCE_NETWORK = 0x0008U,
+ /**< Is a networked source of some kind. \since 0.9.7 */
+
+ PA_SOURCE_HW_MUTE_CTRL = 0x0010U,
+ /**< Supports hardware mute control. This is a dynamic flag and may
+ * change at runtime after the source has initialized \since 0.9.11 */
+
+ PA_SOURCE_DECIBEL_VOLUME = 0x0020U,
+ /**< Volume can be translated to dB with pa_sw_volume_to_dB(). This is a
+ * dynamic flag and may change at runtime after the source has initialized
+ * \since 0.9.11 */
+
+ PA_SOURCE_DYNAMIC_LATENCY = 0x0040U,
+ /**< The latency can be adjusted dynamically depending on the
+ * needs of the connected streams. \since 0.9.15 */
+
+ PA_SOURCE_FLAT_VOLUME = 0x0080U,
+ /**< This source is in flat volume mode, i.e.\ always the maximum of
+ * the volume of all connected outputs. \since 1.0 */
+
+#ifdef __INCLUDED_FROM_PULSE_AUDIO
+/** \cond fulldocs */
+ /* PRIVATE: Server-side values -- do not try to use these at client-side.
+ * The server will filter out these flags anyway, so you should never see
+ * these flags in sources. */
+
+ PA_SOURCE_SHARE_VOLUME_WITH_MASTER = 0x1000000U,
+ /**< This source shares the volume with the master source (used by some filter
+ * sources). */
+
+ PA_SOURCE_DEFERRED_VOLUME = 0x2000000U,
+ /**< The HW volume changes are syncronized with SW volume. */
+#endif
+} pa_source_flags_t;
+
+/** \cond fulldocs */
+#define PA_SOURCE_HW_VOLUME_CTRL PA_SOURCE_HW_VOLUME_CTRL
+#define PA_SOURCE_LATENCY PA_SOURCE_LATENCY
+#define PA_SOURCE_HARDWARE PA_SOURCE_HARDWARE
+#define PA_SOURCE_NETWORK PA_SOURCE_NETWORK
+#define PA_SOURCE_HW_MUTE_CTRL PA_SOURCE_HW_MUTE_CTRL
+#define PA_SOURCE_DECIBEL_VOLUME PA_SOURCE_DECIBEL_VOLUME
+#define PA_SOURCE_DYNAMIC_LATENCY PA_SOURCE_DYNAMIC_LATENCY
+#define PA_SOURCE_FLAT_VOLUME PA_SOURCE_FLAT_VOLUME
+#ifdef __INCLUDED_FROM_PULSE_AUDIO
+#define PA_SOURCE_CLIENT_FLAGS_MASK 0xFFFFFF
+#endif
+
+/** \endcond */
+
+/** Source state. \since 0.9.15 */
+typedef enum pa_source_state {
+ PA_SOURCE_INVALID_STATE = -1,
+ /**< This state is used when the server does not support source state introspection \since 0.9.15 */
+
+ PA_SOURCE_RUNNING = 0,
+ /**< Running, source is recording and used by at least one non-corked source-output \since 0.9.15 */
+
+ PA_SOURCE_IDLE = 1,
+ /**< When idle, the source is still recording but there is no non-corked source-output \since 0.9.15 */
+
+ PA_SOURCE_SUSPENDED = 2,
+ /**< When suspended, actual source access can be closed, for instance \since 0.9.15 */
+
+/** \cond fulldocs */
+ /* PRIVATE: Server-side values -- DO NOT USE THIS ON THE CLIENT
+ * SIDE! These values are *not* considered part of the official PA
+ * API/ABI. If you use them your application might break when PA
+ * is upgraded. Also, please note that these values are not useful
+ * on the client side anyway. */
+
+ PA_SOURCE_INIT = -2,
+ /**< Initialization state */
+
+ PA_SOURCE_UNLINKED = -3
+ /**< The state when the source is getting unregistered and removed from client access */
+/** \endcond */
+
+} pa_source_state_t;
+
+/** Returns non-zero if source is recording: running or idle. \since 0.9.15 */
+static inline int PA_SOURCE_IS_OPENED(pa_source_state_t x) {
+ return x == PA_SOURCE_RUNNING || x == PA_SOURCE_IDLE;
+}
+
+/** Returns non-zero if source is running \since 1.0 */
+static inline int PA_SOURCE_IS_RUNNING(pa_source_state_t x) {
+ return x == PA_SOURCE_RUNNING;
+}
+
+/** \cond fulldocs */
+#define PA_SOURCE_INVALID_STATE PA_SOURCE_INVALID_STATE
+#define PA_SOURCE_RUNNING PA_SOURCE_RUNNING
+#define PA_SOURCE_IDLE PA_SOURCE_IDLE
+#define PA_SOURCE_SUSPENDED PA_SOURCE_SUSPENDED
+#define PA_SOURCE_INIT PA_SOURCE_INIT
+#define PA_SOURCE_UNLINKED PA_SOURCE_UNLINKED
+#define PA_SOURCE_IS_OPENED PA_SOURCE_IS_OPENED
+/** \endcond */
+
+/** A generic free() like callback prototype */
+typedef void (*pa_free_cb_t)(void *p);
+
+/** A stream policy/meta event requesting that an application should
+ * cork a specific stream. See pa_stream_event_cb_t for more
+ * information. \since 0.9.15 */
+#define PA_STREAM_EVENT_REQUEST_CORK "request-cork"
+
+/** A stream policy/meta event requesting that an application should
+ * cork a specific stream. See pa_stream_event_cb_t for more
+ * information, \since 0.9.15 */
+#define PA_STREAM_EVENT_REQUEST_UNCORK "request-uncork"
+
+/** A stream event notifying that the stream is going to be
+ * disconnected because the underlying sink changed and no longer
+ * supports the format that was originally negotiated. Clients need
+ * to connect a new stream to renegotiate a format and continue
+ * playback. \since 1.0 */
+#define PA_STREAM_EVENT_FORMAT_LOST "format-lost"
+
+#ifndef __INCLUDED_FROM_PULSE_AUDIO
+/** Port availability / jack detection status
+ * \since 2.0 */
+typedef enum pa_port_available {
+ PA_PORT_AVAILABLE_UNKNOWN = 0, /**< This port does not support jack detection \since 2.0 */
+ PA_PORT_AVAILABLE_NO = 1, /**< This port is not available, likely because the jack is not plugged in. \since 2.0 */
+ PA_PORT_AVAILABLE_YES = 2, /**< This port is available, likely because the jack is plugged in. \since 2.0 */
+} pa_port_available_t;
+
+/** \cond fulldocs */
+#define PA_PORT_AVAILABLE_UNKNOWN PA_PORT_AVAILABLE_UNKNOWN
+#define PA_PORT_AVAILABLE_NO PA_PORT_AVAILABLE_NO
+#define PA_PORT_AVAILABLE_YES PA_PORT_AVAILABLE_YES
+
+/** \endcond */
+#endif
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/direction.h b/thirdparty/linuxbsd_headers/pulse/direction.h
new file mode 100644
index 0000000000..65ece6975a
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/direction.h
@@ -0,0 +1,35 @@
+#ifndef foodirectionhfoo
+#define foodirectionhfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2014 Intel Corporation
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/def.h>
+
+/** \file
+ * Utility functions for \ref pa_direction_t. */
+
+/** Return non-zero if the given value is a valid direction (either input,
+ * output or bidirectional). \since 6.0 */
+int pa_direction_valid(pa_direction_t direction) PA_GCC_CONST;
+
+/** Return a textual representation of the direction. \since 6.0 */
+const char *pa_direction_to_string(pa_direction_t direction);
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/error.h b/thirdparty/linuxbsd_headers/pulse/error.h
new file mode 100644
index 0000000000..7b9b84ad0e
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/error.h
@@ -0,0 +1,37 @@
+#ifndef fooerrorhfoo
+#define fooerrorhfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/cdecl.h>
+#include <pulse/version.h>
+
+/** \file
+ * Error management */
+
+PA_C_DECL_BEGIN
+
+/** Return a human readable error message for the specified numeric error code */
+const char* pa_strerror(int error);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/ext-device-manager.h b/thirdparty/linuxbsd_headers/pulse/ext-device-manager.h
new file mode 100644
index 0000000000..8c05e1cc10
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/ext-device-manager.h
@@ -0,0 +1,130 @@
+#ifndef foopulseextdevicemanagerhfoo
+#define foopulseextdevicemanagerhfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2008 Lennart Poettering
+ Copyright 2009 Colin Guthrie
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/cdecl.h>
+#include <pulse/context.h>
+#include <pulse/version.h>
+
+/** \file
+ *
+ * Routines for controlling module-device-manager
+ */
+
+PA_C_DECL_BEGIN
+
+/* Don't extend this struct! It will break binary compatibility, because
+ * pa_ext_device_manager_info.role_priorities points to an array of structs
+ * instead of an array of pointers to structs. */
+typedef struct pa_ext_device_manager_role_priority_info {
+ const char *role;
+ uint32_t priority;
+} pa_ext_device_manager_role_priority_info;
+
+/** Stores information about one device in the device database that is
+ * maintained by module-device-manager. \since 0.9.21 */
+typedef struct pa_ext_device_manager_info {
+ const char *name; /**< Identifier string of the device. A string like "sink:" or similar followed by the name of the device. */
+ const char *description; /**< The description of the device when it was last seen, if applicable and saved */
+ const char *icon; /**< The icon given to the device */
+ uint32_t index; /**< The device index if it is currently available or PA_INVALID_INDEX */
+ uint32_t n_role_priorities; /**< How many role priorities do we have? */
+ pa_ext_device_manager_role_priority_info *role_priorities; /**< An array of role priority structures or NULL */
+} pa_ext_device_manager_info;
+
+/** Callback prototype for pa_ext_device_manager_test(). \since 0.9.21 */
+typedef void (*pa_ext_device_manager_test_cb_t)(
+ pa_context *c,
+ uint32_t version,
+ void *userdata);
+
+/** Test if this extension module is available in the server. \since 0.9.21 */
+pa_operation *pa_ext_device_manager_test(
+ pa_context *c,
+ pa_ext_device_manager_test_cb_t cb,
+ void *userdata);
+
+/** Callback prototype for pa_ext_device_manager_read(). \since 0.9.21 */
+typedef void (*pa_ext_device_manager_read_cb_t)(
+ pa_context *c,
+ const pa_ext_device_manager_info *info,
+ int eol,
+ void *userdata);
+
+/** Read all entries from the device database. \since 0.9.21 */
+pa_operation *pa_ext_device_manager_read(
+ pa_context *c,
+ pa_ext_device_manager_read_cb_t cb,
+ void *userdata);
+
+/** Sets the description for a device. \since 0.9.21 */
+pa_operation *pa_ext_device_manager_set_device_description(
+ pa_context *c,
+ const char* device,
+ const char* description,
+ pa_context_success_cb_t cb,
+ void *userdata);
+
+/** Delete entries from the device database. \since 0.9.21 */
+pa_operation *pa_ext_device_manager_delete(
+ pa_context *c,
+ const char *const s[],
+ pa_context_success_cb_t cb,
+ void *userdata);
+
+/** Enable the role-based device-priority routing mode. \since 0.9.21 */
+pa_operation *pa_ext_device_manager_enable_role_device_priority_routing(
+ pa_context *c,
+ int enable,
+ pa_context_success_cb_t cb,
+ void *userdata);
+
+/** Prefer a given device in the priority list. \since 0.9.21 */
+pa_operation *pa_ext_device_manager_reorder_devices_for_role(
+ pa_context *c,
+ const char* role,
+ const char** devices,
+ pa_context_success_cb_t cb,
+ void *userdata);
+
+/** Subscribe to changes in the device database. \since 0.9.21 */
+pa_operation *pa_ext_device_manager_subscribe(
+ pa_context *c,
+ int enable,
+ pa_context_success_cb_t cb,
+ void *userdata);
+
+/** Callback prototype for pa_ext_device_manager_set_subscribe_cb(). \since 0.9.21 */
+typedef void (*pa_ext_device_manager_subscribe_cb_t)(
+ pa_context *c,
+ void *userdata);
+
+/** Set the subscription callback that is called when
+ * pa_ext_device_manager_subscribe() was called. \since 0.9.21 */
+void pa_ext_device_manager_set_subscribe_cb(
+ pa_context *c,
+ pa_ext_device_manager_subscribe_cb_t cb,
+ void *userdata);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/ext-device-restore.h b/thirdparty/linuxbsd_headers/pulse/ext-device-restore.h
new file mode 100644
index 0000000000..246b06050a
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/ext-device-restore.h
@@ -0,0 +1,110 @@
+#ifndef foopulseextdevicerestorehfoo
+#define foopulseextdevicerestorehfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2008 Lennart Poettering
+ Copyright 2011 Colin Guthrie
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/context.h>
+#include <pulse/format.h>
+#include <pulse/version.h>
+
+/** \file
+ *
+ * Routines for controlling module-device-restore
+ */
+
+PA_C_DECL_BEGIN
+
+/** Stores information about one device in the device database that is
+ * maintained by module-device-manager. \since 1.0 */
+typedef struct pa_ext_device_restore_info {
+ pa_device_type_t type; /**< Device type sink or source? */
+ uint32_t index; /**< The device index */
+ uint8_t n_formats; /**< How many formats do we have? */
+ pa_format_info **formats; /**< An array of formats (may be NULL if n_formats == 0) */
+} pa_ext_device_restore_info;
+
+/** Callback prototype for pa_ext_device_restore_test(). \since 1.0 */
+typedef void (*pa_ext_device_restore_test_cb_t)(
+ pa_context *c,
+ uint32_t version,
+ void *userdata);
+
+/** Test if this extension module is available in the server. \since 1.0 */
+pa_operation *pa_ext_device_restore_test(
+ pa_context *c,
+ pa_ext_device_restore_test_cb_t cb,
+ void *userdata);
+
+/** Subscribe to changes in the device database. \since 1.0 */
+pa_operation *pa_ext_device_restore_subscribe(
+ pa_context *c,
+ int enable,
+ pa_context_success_cb_t cb,
+ void *userdata);
+
+/** Callback prototype for pa_ext_device_restore_set_subscribe_cb(). \since 1.0 */
+typedef void (*pa_ext_device_restore_subscribe_cb_t)(
+ pa_context *c,
+ pa_device_type_t type,
+ uint32_t idx,
+ void *userdata);
+
+/** Set the subscription callback that is called when
+ * pa_ext_device_restore_subscribe() was called. \since 1.0 */
+void pa_ext_device_restore_set_subscribe_cb(
+ pa_context *c,
+ pa_ext_device_restore_subscribe_cb_t cb,
+ void *userdata);
+
+/** Callback prototype for pa_ext_device_restore_read_formats(). \since 1.0 */
+typedef void (*pa_ext_device_restore_read_device_formats_cb_t)(
+ pa_context *c,
+ const pa_ext_device_restore_info *info,
+ int eol,
+ void *userdata);
+
+/** Read the formats for all present devices from the device database. \since 1.0 */
+pa_operation *pa_ext_device_restore_read_formats_all(
+ pa_context *c,
+ pa_ext_device_restore_read_device_formats_cb_t cb,
+ void *userdata);
+
+/** Read an entry from the device database. \since 1.0 */
+pa_operation *pa_ext_device_restore_read_formats(
+ pa_context *c,
+ pa_device_type_t type,
+ uint32_t idx,
+ pa_ext_device_restore_read_device_formats_cb_t cb,
+ void *userdata);
+
+/** Read an entry from the device database. \since 1.0 */
+pa_operation *pa_ext_device_restore_save_formats(
+ pa_context *c,
+ pa_device_type_t type,
+ uint32_t idx,
+ uint8_t n_formats,
+ pa_format_info **formats,
+ pa_context_success_cb_t cb,
+ void *userdata);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/ext-stream-restore.h b/thirdparty/linuxbsd_headers/pulse/ext-stream-restore.h
new file mode 100644
index 0000000000..dd7f4ae4fe
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/ext-stream-restore.h
@@ -0,0 +1,109 @@
+#ifndef foopulseextstreamrestorehfoo
+#define foopulseextstreamrestorehfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2008 Lennart Poettering
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/cdecl.h>
+#include <pulse/context.h>
+#include <pulse/version.h>
+#include <pulse/volume.h>
+#include <pulse/channelmap.h>
+
+/** \file
+ *
+ * Routines for controlling module-stream-restore
+ */
+
+PA_C_DECL_BEGIN
+
+/** Stores information about one entry in the stream database that is
+ * maintained by module-stream-restore. \since 0.9.12 */
+typedef struct pa_ext_stream_restore_info {
+ const char *name; /**< Identifier string of the stream. A string like "sink-input-by-role:" or similar followed by some arbitrary property value. */
+ pa_channel_map channel_map; /**< The channel map for the volume field, if applicable */
+ pa_cvolume volume; /**< The volume of the stream when it was seen last, if applicable and saved */
+ const char *device; /**< The sink/source of the stream when it was last seen, if applicable and saved */
+ int mute; /**< The boolean mute state of the stream when it was last seen, if applicable and saved */
+} pa_ext_stream_restore_info;
+
+/** Callback prototype for pa_ext_stream_restore_test(). \since 0.9.12 */
+typedef void (*pa_ext_stream_restore_test_cb_t)(
+ pa_context *c,
+ uint32_t version,
+ void *userdata);
+
+/** Test if this extension module is available in the server. \since 0.9.12 */
+pa_operation *pa_ext_stream_restore_test(
+ pa_context *c,
+ pa_ext_stream_restore_test_cb_t cb,
+ void *userdata);
+
+/** Callback prototype for pa_ext_stream_restore_read(). \since 0.9.12 */
+typedef void (*pa_ext_stream_restore_read_cb_t)(
+ pa_context *c,
+ const pa_ext_stream_restore_info *info,
+ int eol,
+ void *userdata);
+
+/** Read all entries from the stream database. \since 0.9.12 */
+pa_operation *pa_ext_stream_restore_read(
+ pa_context *c,
+ pa_ext_stream_restore_read_cb_t cb,
+ void *userdata);
+
+/** Store entries in the stream database. \since 0.9.12 */
+pa_operation *pa_ext_stream_restore_write(
+ pa_context *c,
+ pa_update_mode_t mode,
+ const pa_ext_stream_restore_info data[],
+ unsigned n,
+ int apply_immediately,
+ pa_context_success_cb_t cb,
+ void *userdata);
+
+/** Delete entries from the stream database. \since 0.9.12 */
+pa_operation *pa_ext_stream_restore_delete(
+ pa_context *c,
+ const char *const s[],
+ pa_context_success_cb_t cb,
+ void *userdata);
+
+/** Subscribe to changes in the stream database. \since 0.9.12 */
+pa_operation *pa_ext_stream_restore_subscribe(
+ pa_context *c,
+ int enable,
+ pa_context_success_cb_t cb,
+ void *userdata);
+
+/** Callback prototype for pa_ext_stream_restore_set_subscribe_cb(). \since 0.9.12 */
+typedef void (*pa_ext_stream_restore_subscribe_cb_t)(
+ pa_context *c,
+ void *userdata);
+
+/** Set the subscription callback that is called when
+ * pa_ext_stream_restore_subscribe() was called. \since 0.9.12 */
+void pa_ext_stream_restore_set_subscribe_cb(
+ pa_context *c,
+ pa_ext_stream_restore_subscribe_cb_t cb,
+ void *userdata);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/format.h b/thirdparty/linuxbsd_headers/pulse/format.h
new file mode 100644
index 0000000000..f606b3b5f8
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/format.h
@@ -0,0 +1,262 @@
+#ifndef fooformathfoo
+#define fooformathfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2011 Intel Corporation
+ Copyright 2011 Collabora Multimedia
+ Copyright 2011 Arun Raghavan <arun.raghavan@collabora.co.uk>
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/cdecl.h>
+#include <pulse/gccmacro.h>
+#include <pulse/proplist.h>
+#include <pulse/sample.h>
+#include <pulse/channelmap.h>
+
+/** \file
+ * Utility functions for handling a stream or sink format. */
+
+PA_C_DECL_BEGIN
+
+/** Represents the type of encoding used in a stream or accepted by a sink. \since 1.0 */
+typedef enum pa_encoding {
+ PA_ENCODING_ANY,
+ /**< Any encoding format, PCM or compressed */
+
+ PA_ENCODING_PCM,
+ /**< Any PCM format */
+
+ PA_ENCODING_AC3_IEC61937,
+ /**< AC3 data encapsulated in IEC 61937 header/padding */
+
+ PA_ENCODING_EAC3_IEC61937,
+ /**< EAC3 data encapsulated in IEC 61937 header/padding */
+
+ PA_ENCODING_MPEG_IEC61937,
+ /**< MPEG-1 or MPEG-2 (Part 3, not AAC) data encapsulated in IEC 61937 header/padding */
+
+ PA_ENCODING_DTS_IEC61937,
+ /**< DTS data encapsulated in IEC 61937 header/padding */
+
+ PA_ENCODING_MPEG2_AAC_IEC61937,
+ /**< MPEG-2 AAC data encapsulated in IEC 61937 header/padding. \since 4.0 */
+
+ PA_ENCODING_MAX,
+ /**< Valid encoding types must be less than this value */
+
+ PA_ENCODING_INVALID = -1,
+ /**< Represents an invalid encoding */
+} pa_encoding_t;
+
+/** \cond fulldocs */
+#define PA_ENCODING_ANY PA_ENCODING_ANY
+#define PA_ENCODING_PCM PA_ENCODING_PCM
+#define PA_ENCODING_AC3_IEC61937 PA_ENCODING_AC3_IEC61937
+#define PA_ENCODING_EAC3_IEC61937 PA_ENCODING_EAC3_IEC61937
+#define PA_ENCODING_MPEG_IEC61937 PA_ENCODING_MPEG_IEC61937
+#define PA_ENCODING_DTS_IEC61937 PA_ENCODING_DTS_IEC61937
+#define PA_ENCODING_MPEG2_AAC_IEC61937 PA_ENCODING_MPEG2_AAC_IEC61937
+#define PA_ENCODING_MAX PA_ENCODING_MAX
+#define PA_ENCODING_INVALID PA_ENCODING_INVALID
+/** \endcond */
+
+/** Returns a printable string representing the given encoding type. \since 1.0 */
+const char *pa_encoding_to_string(pa_encoding_t e) PA_GCC_CONST;
+
+/** Converts a string of the form returned by \a pa_encoding_to_string() back to a \a pa_encoding_t. \since 1.0 */
+pa_encoding_t pa_encoding_from_string(const char *encoding);
+
+/** Represents the format of data provided in a stream or processed by a sink. \since 1.0 */
+typedef struct pa_format_info {
+ pa_encoding_t encoding;
+ /**< The encoding used for the format */
+
+ pa_proplist *plist;
+ /**< Additional encoding-specific properties such as sample rate, bitrate, etc. */
+} pa_format_info;
+
+/** Allocates a new \a pa_format_info structure. Clients must initialise at least the encoding field themselves. \since 1.0 */
+pa_format_info* pa_format_info_new(void);
+
+/** Returns a new \a pa_format_info struct and representing the same format as \a src. \since 1.0 */
+pa_format_info* pa_format_info_copy(const pa_format_info *src);
+
+/** Frees a \a pa_format_info structure. \since 1.0 */
+void pa_format_info_free(pa_format_info *f);
+
+/** Returns non-zero when the format info structure is valid. \since 1.0 */
+int pa_format_info_valid(const pa_format_info *f);
+
+/** Returns non-zero when the format info structure represents a PCM (i.e.\ uncompressed data) format. \since 1.0 */
+int pa_format_info_is_pcm(const pa_format_info *f);
+
+/** Returns non-zero if the format represented by \a first is a subset of
+ * the format represented by \a second. This means that \a second must
+ * have all the fields that \a first does, but the reverse need not
+ * be true. This is typically expected to be used to check if a
+ * stream's format is compatible with a given sink. In such a case,
+ * \a first would be the sink's format and \a second would be the
+ * stream's. \since 1.0 */
+int pa_format_info_is_compatible(const pa_format_info *first, const pa_format_info *second);
+
+/** Maximum required string length for
+ * pa_format_info_snprint(). Please note that this value can change
+ * with any release without warning and without being considered API
+ * or ABI breakage. You should not use this definition anywhere where
+ * it might become part of an ABI. \since 1.0 */
+#define PA_FORMAT_INFO_SNPRINT_MAX 256
+
+/** Return a human-readable string representing the given format. \since 1.0 */
+char *pa_format_info_snprint(char *s, size_t l, const pa_format_info *f);
+
+/** Parse a human-readable string of the form generated by
+ * \a pa_format_info_snprint() into a pa_format_info structure. \since 1.0 */
+pa_format_info* pa_format_info_from_string(const char *str);
+
+/** Utility function to take a \a pa_sample_spec and generate the corresponding
+ * \a pa_format_info.
+ *
+ * Note that if you want the server to choose some of the stream parameters,
+ * for example the sample rate, so that they match the device parameters, then
+ * you shouldn't use this function. In order to allow the server to choose
+ * a parameter value, that parameter must be left unspecified in the
+ * pa_format_info object, and this function always specifies all parameters. An
+ * exception is the channel map: if you pass NULL for the channel map, then the
+ * channel map will be left unspecified, allowing the server to choose it.
+ *
+ * \since 2.0 */
+pa_format_info* pa_format_info_from_sample_spec(const pa_sample_spec *ss, const pa_channel_map *map);
+
+/** Utility function to generate a \a pa_sample_spec and \a pa_channel_map corresponding to a given \a pa_format_info. The
+ * conversion for PCM formats is straight-forward. For non-PCM formats, if there is a fixed size-time conversion (i.e. all
+ * IEC61937-encapsulated formats), a "fake" sample spec whose size-time conversion corresponds to this format is provided and
+ * the channel map argument is ignored. For formats with variable size-time conversion, this function will fail. Returns a
+ * negative integer if conversion failed and 0 on success. \since 2.0 */
+int pa_format_info_to_sample_spec(const pa_format_info *f, pa_sample_spec *ss, pa_channel_map *map);
+
+/** Represents the type of value type of a property on a \ref pa_format_info. \since 2.0 */
+typedef enum pa_prop_type_t {
+ PA_PROP_TYPE_INT,
+ /**< Integer property */
+
+ PA_PROP_TYPE_INT_RANGE,
+ /**< Integer range property */
+
+ PA_PROP_TYPE_INT_ARRAY,
+ /**< Integer array property */
+
+ PA_PROP_TYPE_STRING,
+ /**< String property */
+
+ PA_PROP_TYPE_STRING_ARRAY,
+ /**< String array property */
+
+ PA_PROP_TYPE_INVALID = -1,
+ /**< Represents an invalid type */
+} pa_prop_type_t;
+
+/** \cond fulldocs */
+#define PA_PROP_TYPE_INT PA_PROP_TYPE_INT
+#define PA_PROP_TYPE_INT_RANGE PA_PROP_TYPE_INT_RANGE
+#define PA_PROP_TYPE_INT_ARRAY PA_PROP_TYPE_INT_ARRAY
+#define PA_PROP_TYPE_STRING PA_PROP_TYPE_STRING
+#define PA_PROP_TYPE_STRING_ARRAY PA_PROP_TYPE_STRING_ARRAY
+#define PA_PROP_TYPE_INVALID PA_PROP_TYPE_INVALID
+/** \endcond */
+
+/** Gets the type of property \a key in a given \ref pa_format_info. \since 2.0 */
+pa_prop_type_t pa_format_info_get_prop_type(const pa_format_info *f, const char *key);
+
+/** Gets an integer property from the given format info. Returns 0 on success and a negative integer on failure. \since 2.0 */
+int pa_format_info_get_prop_int(const pa_format_info *f, const char *key, int *v);
+/** Gets an integer range property from the given format info. Returns 0 on success and a negative integer on failure.
+ * \since 2.0 */
+int pa_format_info_get_prop_int_range(const pa_format_info *f, const char *key, int *min, int *max);
+/** Gets an integer array property from the given format info. \a values contains the values and \a n_values contains the
+ * number of elements. The caller must free \a values using \ref pa_xfree. Returns 0 on success and a negative integer on
+ * failure. \since 2.0 */
+int pa_format_info_get_prop_int_array(const pa_format_info *f, const char *key, int **values, int *n_values);
+/** Gets a string property from the given format info. The caller must free the returned string using \ref pa_xfree. Returns
+ * 0 on success and a negative integer on failure. \since 2.0 */
+int pa_format_info_get_prop_string(const pa_format_info *f, const char *key, char **v);
+/** Gets a string array property from the given format info. \a values contains the values and \a n_values contains
+ * the number of elements. The caller must free \a values using \ref pa_format_info_free_string_array. Returns 0 on success and
+ * a negative integer on failure. \since 2.0 */
+int pa_format_info_get_prop_string_array(const pa_format_info *f, const char *key, char ***values, int *n_values);
+
+/** Frees a string array returned by \ref pa_format_info_get_prop_string_array. \since 2.0 */
+void pa_format_info_free_string_array(char **values, int n_values);
+
+/** Sets an integer property on the given format info. \since 1.0 */
+void pa_format_info_set_prop_int(pa_format_info *f, const char *key, int value);
+/** Sets a property with a list of integer values on the given format info. \since 1.0 */
+void pa_format_info_set_prop_int_array(pa_format_info *f, const char *key, const int *values, int n_values);
+/** Sets a property which can have any value in a given integer range on the given format info. \since 1.0 */
+void pa_format_info_set_prop_int_range(pa_format_info *f, const char *key, int min, int max);
+/** Sets a string property on the given format info. \since 1.0 */
+void pa_format_info_set_prop_string(pa_format_info *f, const char *key, const char *value);
+/** Sets a property with a list of string values on the given format info. \since 1.0 */
+void pa_format_info_set_prop_string_array(pa_format_info *f, const char *key, const char **values, int n_values);
+
+/** Convenience method to set the sample format as a property on the given
+ * format.
+ *
+ * Note for PCM: If the sample format is left unspecified in the pa_format_info
+ * object, then the server will select the stream sample format. In that case
+ * the stream sample format will most likely match the device sample format,
+ * meaning that sample format conversion will be avoided.
+ *
+ * \since 1.0 */
+void pa_format_info_set_sample_format(pa_format_info *f, pa_sample_format_t sf);
+
+/** Convenience method to set the sampling rate as a property on the given
+ * format.
+ *
+ * Note for PCM: If the sample rate is left unspecified in the pa_format_info
+ * object, then the server will select the stream sample rate. In that case the
+ * stream sample rate will most likely match the device sample rate, meaning
+ * that sample rate conversion will be avoided.
+ *
+ * \since 1.0 */
+void pa_format_info_set_rate(pa_format_info *f, int rate);
+
+/** Convenience method to set the number of channels as a property on the given
+ * format.
+ *
+ * Note for PCM: If the channel count is left unspecified in the pa_format_info
+ * object, then the server will select the stream channel count. In that case
+ * the stream channel count will most likely match the device channel count,
+ * meaning that up/downmixing will be avoided.
+ *
+ * \since 1.0 */
+void pa_format_info_set_channels(pa_format_info *f, int channels);
+
+/** Convenience method to set the channel map as a property on the given
+ * format.
+ *
+ * Note for PCM: If the channel map is left unspecified in the pa_format_info
+ * object, then the server will select the stream channel map. In that case the
+ * stream channel map will most likely match the device channel map, meaning
+ * that remixing will be avoided.
+ *
+ * \since 1.0 */
+void pa_format_info_set_channel_map(pa_format_info *f, const pa_channel_map *map);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/gccmacro.h b/thirdparty/linuxbsd_headers/pulse/gccmacro.h
new file mode 100644
index 0000000000..e5ba5bd8fc
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/gccmacro.h
@@ -0,0 +1,132 @@
+#ifndef foopulsegccmacrohfoo
+#define foopulsegccmacrohfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+/** \file
+ * GCC attribute macros */
+
+#if defined(__GNUC__)
+#ifdef __MINGW32__
+/* libintl overrides printf with a #define. As this breaks this attribute,
+ * it has a workaround. However the workaround isn't enabled for MINGW
+ * builds (only cygwin) */
+#define PA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (__printf__, a, b)))
+#else
+#define PA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b)))
+#endif
+#else
+/** If we're in GNU C, use some magic for detecting invalid format strings */
+#define PA_GCC_PRINTF_ATTR(a,b)
+#endif
+
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+#define PA_GCC_SENTINEL __attribute__ ((sentinel))
+#else
+/** Macro for usage of GCC's sentinel compilation warnings */
+#define PA_GCC_SENTINEL
+#endif
+
+#ifdef __GNUC__
+#define PA_GCC_NORETURN __attribute__((noreturn))
+#else
+/** Macro for no-return functions */
+#define PA_GCC_NORETURN
+#endif
+
+#ifdef __GNUC__
+#define PA_GCC_UNUSED __attribute__ ((unused))
+#else
+/** Macro for not used function, variable or parameter */
+#define PA_GCC_UNUSED
+#endif
+
+#ifdef __GNUC__
+#define PA_GCC_DESTRUCTOR __attribute__ ((destructor))
+#else
+/** Call this function when process terminates */
+#define PA_GCC_DESTRUCTOR
+#endif
+
+#ifndef PA_GCC_PURE
+#ifdef __GNUC__
+#define PA_GCC_PURE __attribute__ ((pure))
+#else
+/** This function's return value depends only the arguments list and global state **/
+#define PA_GCC_PURE
+#endif
+#endif
+
+#ifndef PA_GCC_CONST
+#ifdef __GNUC__
+#define PA_GCC_CONST __attribute__ ((const))
+#else
+/** This function's return value depends only the arguments list (stricter version of PA_GCC_PURE) **/
+#define PA_GCC_CONST
+#endif
+#endif
+
+#ifndef PA_GCC_DEPRECATED
+#ifdef __GNUC__
+#define PA_GCC_DEPRECATED __attribute__ ((deprecated))
+#else
+/** This function is deprecated **/
+#define PA_GCC_DEPRECATED
+#endif
+#endif
+
+#ifndef PA_GCC_PACKED
+#ifdef __GNUC__
+#define PA_GCC_PACKED __attribute__ ((packed))
+#else
+/** Structure shall be packed in memory **/
+#define PA_GCC_PACKED
+#endif
+#endif
+
+#ifndef PA_GCC_ALLOC_SIZE
+#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
+#define PA_GCC_ALLOC_SIZE(x) __attribute__ ((__alloc_size__(x)))
+#define PA_GCC_ALLOC_SIZE2(x,y) __attribute__ ((__alloc_size__(x,y)))
+#else
+/** Macro for usage of GCC's alloc_size attribute */
+#define PA_GCC_ALLOC_SIZE(x)
+/** Macro for usage of GCC's alloc_size attribute */
+#define PA_GCC_ALLOC_SIZE2(x,y)
+#endif
+#endif
+
+#ifndef PA_GCC_MALLOC
+#ifdef __GNUC__
+#define PA_GCC_MALLOC __attribute__ ((malloc))
+#else
+/** Macro for usage of GCC's malloc attribute */
+#define PA_GCC_MALLOC
+#endif
+#endif
+
+#ifndef PA_GCC_WEAKREF
+#if defined(__GNUC__) && defined(__ELF__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ > 1)) || (__GNUC__ > 4))
+/** Macro for usage of GCC's weakref attribute */
+#define PA_GCC_WEAKREF(x) __attribute__((weakref(#x)))
+#endif
+#endif
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/glib-mainloop.h b/thirdparty/linuxbsd_headers/pulse/glib-mainloop.h
new file mode 100644
index 0000000000..52d9a75f90
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/glib-mainloop.h
@@ -0,0 +1,67 @@
+#ifndef fooglibmainloophfoo
+#define fooglibmainloophfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <glib.h>
+
+#include <pulse/mainloop-api.h>
+#include <pulse/cdecl.h>
+#include <pulse/version.h>
+
+/** \page glib-mainloop GLIB Main Loop Bindings
+ *
+ * \section overv_sec Overview
+ *
+ * The GLIB main loop bindings are extremely easy to use. All that is
+ * required is to create a pa_glib_mainloop object using
+ * pa_glib_mainloop_new(). When the main loop abstraction is needed, it is
+ * provided by pa_glib_mainloop_get_api().
+ *
+ */
+
+/** \file
+ * GLIB main loop support
+ *
+ * See also \subpage glib-mainloop
+ */
+
+PA_C_DECL_BEGIN
+
+/** An opaque GLIB main loop object */
+typedef struct pa_glib_mainloop pa_glib_mainloop;
+
+/** Create a new GLIB main loop object for the specified GLIB main
+ * loop context. Takes an argument c for the
+ * GMainContext to use. If c is NULL the default context is used. */
+pa_glib_mainloop *pa_glib_mainloop_new(GMainContext *c);
+
+/** Free the GLIB main loop object */
+void pa_glib_mainloop_free(pa_glib_mainloop* g);
+
+/** Return the abstract main loop API vtable for the GLIB main loop
+ object. No need to free the API as it is owned by the loop
+ and is destroyed when the loop is freed. */
+pa_mainloop_api* pa_glib_mainloop_get_api(pa_glib_mainloop *g);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/introspect.h b/thirdparty/linuxbsd_headers/pulse/introspect.h
new file mode 100644
index 0000000000..43389b7364
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/introspect.h
@@ -0,0 +1,760 @@
+#ifndef foointrospecthfoo
+#define foointrospecthfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <inttypes.h>
+
+#include <pulse/operation.h>
+#include <pulse/context.h>
+#include <pulse/cdecl.h>
+#include <pulse/gccmacro.h>
+#include <pulse/channelmap.h>
+#include <pulse/volume.h>
+#include <pulse/proplist.h>
+#include <pulse/format.h>
+#include <pulse/version.h>
+
+/** \page introspect Server Query and Control
+ *
+ * \section overv_sec Overview
+ *
+ * Sometimes it is necessary to query and modify global settings in the
+ * server. For this, PulseAudio has the introspection API. It can list sinks,
+ * sources, samples and other aspects of the server. It can also modify the
+ * attributes of the server that will affect operations on a global level,
+ * and not just the application's context.
+ *
+ * \section query_sec Querying
+ *
+ * All querying is done through callbacks. This approach is necessary to
+ * maintain an asynchronous design. The client will request the information
+ * and some time later, the server will respond with the desired data.
+ *
+ * Some objects can have multiple instances on the server. When requesting all
+ * of these at once, the callback will be called multiple times, once for
+ * each object. When the list has been exhausted, the callback will be called
+ * without an information structure and the eol parameter set to a positive
+ * value.
+ *
+ * Note that even if a single object is requested, and not the entire list,
+ * the terminating call will still be made.
+ *
+ * If an error occurs, the callback will be invoked without an information
+ * structure and eol set to a negative value..
+ *
+ * Data members in the information structures are only valid during the
+ * duration of the callback. If they are required after the callback is
+ * finished, a deep copy of the information structure must be performed.
+ *
+ * \subsection server_subsec Server Information
+ *
+ * The server can be queried about its name, the environment it's running on
+ * and the currently active global defaults. Calling
+ * pa_context_get_server_info() provides access to a pa_server_info structure
+ * containing all of these.
+ *
+ * \subsection memstat_subsec Memory Usage
+ *
+ * Statistics about memory usage can be fetched using pa_context_stat(),
+ * giving a pa_stat_info structure.
+ *
+ * \subsection sinksrc_subsec Sinks and Sources
+ *
+ * The server can have an arbitrary number of sinks and sources. Each sink
+ * and source have both an index and a name associated with it. As such,
+ * there are three ways to get access to them:
+ *
+ * \li By index - pa_context_get_sink_info_by_index() /
+ * pa_context_get_source_info_by_index()
+ * \li By name - pa_context_get_sink_info_by_name() /
+ * pa_context_get_source_info_by_name()
+ * \li All - pa_context_get_sink_info_list() /
+ * pa_context_get_source_info_list()
+ *
+ * All three method use the same callback and will provide a pa_sink_info or
+ * pa_source_info structure.
+ *
+ * \subsection siso_subsec Sink Inputs and Source Outputs
+ *
+ * Sink inputs and source outputs are the representations of the client ends
+ * of streams inside the server. I.e. they connect a client stream to one of
+ * the global sinks or sources.
+ *
+ * Sink inputs and source outputs only have an index to identify them. As
+ * such, there are only two ways to get information about them:
+ *
+ * \li By index - pa_context_get_sink_input_info() /
+ * pa_context_get_source_output_info()
+ * \li All - pa_context_get_sink_input_info_list() /
+ * pa_context_get_source_output_info_list()
+ *
+ * The structure returned is the pa_sink_input_info or pa_source_output_info
+ * structure.
+ *
+ * \subsection samples_subsec Samples
+ *
+ * The list of cached samples can be retrieved from the server. Three methods
+ * exist for querying the sample cache list:
+ *
+ * \li By index - pa_context_get_sample_info_by_index()
+ * \li By name - pa_context_get_sample_info_by_name()
+ * \li All - pa_context_get_sample_info_list()
+ *
+ * Note that this only retrieves information about the sample, not the sample
+ * data itself.
+ *
+ * \subsection module_subsec Driver Modules
+ *
+ * PulseAudio driver modules are identified by index and are retrieved using either
+ * pa_context_get_module_info() or pa_context_get_module_info_list(). The
+ * information structure is called pa_module_info.
+ *
+ * \subsection client_subsec Clients
+ *
+ * PulseAudio clients are also identified by index and are retrieved using
+ * either pa_context_get_client_info() or pa_context_get_client_info_list().
+ * The information structure is called pa_client_info.
+ *
+ * \section ctrl_sec Control
+ *
+ * Some parts of the server are only possible to read, but most can also be
+ * modified in different ways. Note that these changes will affect all
+ * connected clients and not just the one issuing the request.
+ *
+ * \subsection sinksrc_subsec Sinks and Sources
+ *
+ * The most common change one would want to apply to sinks and sources is to
+ * modify the volume of the audio. Identically to how sinks and sources can
+ * be queried, there are two ways of identifying them:
+ *
+ * \li By index - pa_context_set_sink_volume_by_index() /
+ * pa_context_set_source_volume_by_index()
+ * \li By name - pa_context_set_sink_volume_by_name() /
+ * pa_context_set_source_volume_by_name()
+ *
+ * It is also possible to mute a sink or source:
+ *
+ * \li By index - pa_context_set_sink_mute_by_index() /
+ * pa_context_set_source_mute_by_index()
+ * \li By name - pa_context_set_sink_mute_by_name() /
+ * pa_context_set_source_mute_by_name()
+ *
+ * \subsection siso_subsec Sink Inputs and Source Outputs
+ *
+ * If an application desires to modify the volume of just a single stream
+ * (commonly one of its own streams), this can be done by setting the volume
+ * of its associated sink input or source output, using
+ * pa_context_set_sink_input_volume() or pa_context_set_source_output_volume().
+ *
+ * It is also possible to remove sink inputs and source outputs, terminating
+ * the streams associated with them:
+ *
+ * \li Sink input - pa_context_kill_sink_input()
+ * \li Source output - pa_context_kill_source_output()
+ *
+ * It is strongly recommended that all volume changes are done as a direct
+ * result of user input. With automated requests, such as those resulting
+ * from misguided attempts of crossfading, PulseAudio can store the stream
+ * volume at an inappropriate moment and restore it later. Besides, such
+ * attempts lead to OSD popups in some desktop environments.
+ *
+ * As a special case of the general rule above, it is recommended that your
+ * application leaves the task of saving and restoring the volume of its
+ * streams to PulseAudio and does not attempt to do it by itself. PulseAudio
+ * really knows better about events such as stream moving or headphone
+ * plugging that would make the volume stored by the application inapplicable
+ * to the new configuration.
+ *
+ * Another important case where setting a sink input volume may be a bad idea
+ * is related to interpreters that interpret potentially untrusted scripts.
+ * PulseAudio relies on your application not making malicious requests (such
+ * as repeatedly setting the volume to 100%). Thus, script interpreters that
+ * represent a security boundary must sandbox volume-changing requests coming
+ * from their scripts. In the worst case, it may be necessary to apply the
+ * script-requested volume to the script-produced sounds by altering the
+ * samples in the script interpreter and not touching the sink or sink input
+ * volume as seen by PulseAudio.
+ *
+ * If an application changes any volume, it should also listen to changes of
+ * the same volume originating from outside the application (e.g., from the
+ * system mixer application) and update its user interface accordingly. Use
+ * \ref subscribe to get such notifications.
+ *
+ * \subsection module_subsec Modules
+ *
+ * Server modules can be remotely loaded and unloaded using
+ * pa_context_load_module() and pa_context_unload_module().
+ *
+ * \subsection client_subsec Clients
+ *
+ * The only operation supported on clients is the possibility of kicking
+ * them off the server using pa_context_kill_client().
+ */
+
+/** \file
+ *
+ * Routines for daemon introspection.
+ *
+ * See also \subpage introspect
+ */
+
+PA_C_DECL_BEGIN
+
+/** @{ \name Sinks */
+
+/** Stores information about a specific port of a sink. Please
+ * note that this structure can be extended as part of evolutionary
+ * API updates at any time in any new release. \since 0.9.16 */
+typedef struct pa_sink_port_info {
+ const char *name; /**< Name of this port */
+ const char *description; /**< Description of this port */
+ uint32_t priority; /**< The higher this value is, the more useful this port is as a default. */
+ int available; /**< A flags (see #pa_port_available), indicating availability status of this port. \since 2.0 */
+} pa_sink_port_info;
+
+/** Stores information about sinks. Please note that this structure
+ * can be extended as part of evolutionary API updates at any time in
+ * any new release. */
+typedef struct pa_sink_info {
+ const char *name; /**< Name of the sink */
+ uint32_t index; /**< Index of the sink */
+ const char *description; /**< Description of this sink */
+ pa_sample_spec sample_spec; /**< Sample spec of this sink */
+ pa_channel_map channel_map; /**< Channel map */
+ uint32_t owner_module; /**< Index of the owning module of this sink, or PA_INVALID_INDEX. */
+ pa_cvolume volume; /**< Volume of the sink */
+ int mute; /**< Mute switch of the sink */
+ uint32_t monitor_source; /**< Index of the monitor source connected to this sink. */
+ const char *monitor_source_name; /**< The name of the monitor source. */
+ pa_usec_t latency; /**< Length of queued audio in the output buffer. */
+ const char *driver; /**< Driver name */
+ pa_sink_flags_t flags; /**< Flags */
+ pa_proplist *proplist; /**< Property list \since 0.9.11 */
+ pa_usec_t configured_latency; /**< The latency this device has been configured to. \since 0.9.11 */
+ pa_volume_t base_volume; /**< Some kind of "base" volume that refers to unamplified/unattenuated volume in the context of the output device. \since 0.9.15 */
+ pa_sink_state_t state; /**< State \since 0.9.15 */
+ uint32_t n_volume_steps; /**< Number of volume steps for sinks which do not support arbitrary volumes. \since 0.9.15 */
+ uint32_t card; /**< Card index, or PA_INVALID_INDEX. \since 0.9.15 */
+ uint32_t n_ports; /**< Number of entries in port array \since 0.9.16 */
+ pa_sink_port_info** ports; /**< Array of available ports, or NULL. Array is terminated by an entry set to NULL. The number of entries is stored in n_ports. \since 0.9.16 */
+ pa_sink_port_info* active_port; /**< Pointer to active port in the array, or NULL. \since 0.9.16 */
+ uint8_t n_formats; /**< Number of formats supported by the sink. \since 1.0 */
+ pa_format_info **formats; /**< Array of formats supported by the sink. \since 1.0 */
+} pa_sink_info;
+
+/** Callback prototype for pa_context_get_sink_info_by_name() and friends */
+typedef void (*pa_sink_info_cb_t)(pa_context *c, const pa_sink_info *i, int eol, void *userdata);
+
+/** Get information about a sink by its name */
+pa_operation* pa_context_get_sink_info_by_name(pa_context *c, const char *name, pa_sink_info_cb_t cb, void *userdata);
+
+/** Get information about a sink by its index */
+pa_operation* pa_context_get_sink_info_by_index(pa_context *c, uint32_t idx, pa_sink_info_cb_t cb, void *userdata);
+
+/** Get the complete sink list */
+pa_operation* pa_context_get_sink_info_list(pa_context *c, pa_sink_info_cb_t cb, void *userdata);
+
+/** Set the volume of a sink device specified by its index */
+pa_operation* pa_context_set_sink_volume_by_index(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
+
+/** Set the volume of a sink device specified by its name */
+pa_operation* pa_context_set_sink_volume_by_name(pa_context *c, const char *name, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
+
+/** Set the mute switch of a sink device specified by its index */
+pa_operation* pa_context_set_sink_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
+
+/** Set the mute switch of a sink device specified by its name */
+pa_operation* pa_context_set_sink_mute_by_name(pa_context *c, const char *name, int mute, pa_context_success_cb_t cb, void *userdata);
+
+/** Suspend/Resume a sink. \since 0.9.7 */
+pa_operation* pa_context_suspend_sink_by_name(pa_context *c, const char *sink_name, int suspend, pa_context_success_cb_t cb, void* userdata);
+
+/** Suspend/Resume a sink. If idx is PA_INVALID_INDEX all sinks will be suspended. \since 0.9.7 */
+pa_operation* pa_context_suspend_sink_by_index(pa_context *c, uint32_t idx, int suspend, pa_context_success_cb_t cb, void* userdata);
+
+/** Change the profile of a sink. \since 0.9.16 */
+pa_operation* pa_context_set_sink_port_by_index(pa_context *c, uint32_t idx, const char*port, pa_context_success_cb_t cb, void *userdata);
+
+/** Change the profile of a sink. \since 0.9.15 */
+pa_operation* pa_context_set_sink_port_by_name(pa_context *c, const char*name, const char*port, pa_context_success_cb_t cb, void *userdata);
+
+/** @} */
+
+/** @{ \name Sources */
+
+/** Stores information about a specific port of a source. Please
+ * note that this structure can be extended as part of evolutionary
+ * API updates at any time in any new release. \since 0.9.16 */
+typedef struct pa_source_port_info {
+ const char *name; /**< Name of this port */
+ const char *description; /**< Description of this port */
+ uint32_t priority; /**< The higher this value is, the more useful this port is as a default. */
+ int available; /**< A flags (see #pa_port_available), indicating availability status of this port. \since 2.0 */
+} pa_source_port_info;
+
+/** Stores information about sources. Please note that this structure
+ * can be extended as part of evolutionary API updates at any time in
+ * any new release. */
+typedef struct pa_source_info {
+ const char *name; /**< Name of the source */
+ uint32_t index; /**< Index of the source */
+ const char *description; /**< Description of this source */
+ pa_sample_spec sample_spec; /**< Sample spec of this source */
+ pa_channel_map channel_map; /**< Channel map */
+ uint32_t owner_module; /**< Owning module index, or PA_INVALID_INDEX. */
+ pa_cvolume volume; /**< Volume of the source */
+ int mute; /**< Mute switch of the sink */
+ uint32_t monitor_of_sink; /**< If this is a monitor source, the index of the owning sink, otherwise PA_INVALID_INDEX. */
+ const char *monitor_of_sink_name; /**< Name of the owning sink, or NULL. */
+ pa_usec_t latency; /**< Length of filled record buffer of this source. */
+ const char *driver; /**< Driver name */
+ pa_source_flags_t flags; /**< Flags */
+ pa_proplist *proplist; /**< Property list \since 0.9.11 */
+ pa_usec_t configured_latency; /**< The latency this device has been configured to. \since 0.9.11 */
+ pa_volume_t base_volume; /**< Some kind of "base" volume that refers to unamplified/unattenuated volume in the context of the input device. \since 0.9.15 */
+ pa_source_state_t state; /**< State \since 0.9.15 */
+ uint32_t n_volume_steps; /**< Number of volume steps for sources which do not support arbitrary volumes. \since 0.9.15 */
+ uint32_t card; /**< Card index, or PA_INVALID_INDEX. \since 0.9.15 */
+ uint32_t n_ports; /**< Number of entries in port array \since 0.9.16 */
+ pa_source_port_info** ports; /**< Array of available ports, or NULL. Array is terminated by an entry set to NULL. The number of entries is stored in n_ports. \since 0.9.16 */
+ pa_source_port_info* active_port; /**< Pointer to active port in the array, or NULL. \since 0.9.16 */
+ uint8_t n_formats; /**< Number of formats supported by the source. \since 1.0 */
+ pa_format_info **formats; /**< Array of formats supported by the source. \since 1.0 */
+} pa_source_info;
+
+/** Callback prototype for pa_context_get_source_info_by_name() and friends */
+typedef void (*pa_source_info_cb_t)(pa_context *c, const pa_source_info *i, int eol, void *userdata);
+
+/** Get information about a source by its name */
+pa_operation* pa_context_get_source_info_by_name(pa_context *c, const char *name, pa_source_info_cb_t cb, void *userdata);
+
+/** Get information about a source by its index */
+pa_operation* pa_context_get_source_info_by_index(pa_context *c, uint32_t idx, pa_source_info_cb_t cb, void *userdata);
+
+/** Get the complete source list */
+pa_operation* pa_context_get_source_info_list(pa_context *c, pa_source_info_cb_t cb, void *userdata);
+
+/** Set the volume of a source device specified by its index */
+pa_operation* pa_context_set_source_volume_by_index(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
+
+/** Set the volume of a source device specified by its name */
+pa_operation* pa_context_set_source_volume_by_name(pa_context *c, const char *name, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
+
+/** Set the mute switch of a source device specified by its index */
+pa_operation* pa_context_set_source_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
+
+/** Set the mute switch of a source device specified by its name */
+pa_operation* pa_context_set_source_mute_by_name(pa_context *c, const char *name, int mute, pa_context_success_cb_t cb, void *userdata);
+
+/** Suspend/Resume a source. \since 0.9.7 */
+pa_operation* pa_context_suspend_source_by_name(pa_context *c, const char *source_name, int suspend, pa_context_success_cb_t cb, void* userdata);
+
+/** Suspend/Resume a source. If idx is PA_INVALID_INDEX, all sources will be suspended. \since 0.9.7 */
+pa_operation* pa_context_suspend_source_by_index(pa_context *c, uint32_t idx, int suspend, pa_context_success_cb_t cb, void* userdata);
+
+/** Change the profile of a source. \since 0.9.16 */
+pa_operation* pa_context_set_source_port_by_index(pa_context *c, uint32_t idx, const char*port, pa_context_success_cb_t cb, void *userdata);
+
+/** Change the profile of a source. \since 0.9.15 */
+pa_operation* pa_context_set_source_port_by_name(pa_context *c, const char*name, const char*port, pa_context_success_cb_t cb, void *userdata);
+
+/** @} */
+
+/** @{ \name Server */
+
+/** Server information. Please note that this structure can be
+ * extended as part of evolutionary API updates at any time in any new
+ * release. */
+typedef struct pa_server_info {
+ const char *user_name; /**< User name of the daemon process */
+ const char *host_name; /**< Host name the daemon is running on */
+ const char *server_version; /**< Version string of the daemon */
+ const char *server_name; /**< Server package name (usually "pulseaudio") */
+ pa_sample_spec sample_spec; /**< Default sample specification */
+ const char *default_sink_name; /**< Name of default sink. */
+ const char *default_source_name; /**< Name of default source. */
+ uint32_t cookie; /**< A random cookie for identifying this instance of PulseAudio. */
+ pa_channel_map channel_map; /**< Default channel map. \since 0.9.15 */
+} pa_server_info;
+
+/** Callback prototype for pa_context_get_server_info() */
+typedef void (*pa_server_info_cb_t) (pa_context *c, const pa_server_info*i, void *userdata);
+
+/** Get some information about the server */
+pa_operation* pa_context_get_server_info(pa_context *c, pa_server_info_cb_t cb, void *userdata);
+
+/** @} */
+
+/** @{ \name Modules */
+
+/** Stores information about modules. Please note that this structure
+ * can be extended as part of evolutionary API updates at any time in
+ * any new release. */
+typedef struct pa_module_info {
+ uint32_t index; /**< Index of the module */
+ const char*name, /**< Name of the module */
+ *argument; /**< Argument string of the module */
+ uint32_t n_used; /**< Usage counter or PA_INVALID_INDEX */
+/** \cond fulldocs */
+ int auto_unload; /**< \deprecated Non-zero if this is an autoloaded module. */
+/** \endcond */
+ pa_proplist *proplist; /**< Property list \since 0.9.15 */
+} pa_module_info;
+
+/** Callback prototype for pa_context_get_module_info() and friends */
+typedef void (*pa_module_info_cb_t) (pa_context *c, const pa_module_info*i, int eol, void *userdata);
+
+/** Get some information about a module by its index */
+pa_operation* pa_context_get_module_info(pa_context *c, uint32_t idx, pa_module_info_cb_t cb, void *userdata);
+
+/** Get the complete list of currently loaded modules */
+pa_operation* pa_context_get_module_info_list(pa_context *c, pa_module_info_cb_t cb, void *userdata);
+
+/** Callback prototype for pa_context_load_module() */
+typedef void (*pa_context_index_cb_t)(pa_context *c, uint32_t idx, void *userdata);
+
+/** Load a module. */
+pa_operation* pa_context_load_module(pa_context *c, const char*name, const char *argument, pa_context_index_cb_t cb, void *userdata);
+
+/** Unload a module. */
+pa_operation* pa_context_unload_module(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
+
+/** @} */
+
+/** @{ \name Clients */
+
+/** Stores information about clients. Please note that this structure
+ * can be extended as part of evolutionary API updates at any time in
+ * any new release. */
+typedef struct pa_client_info {
+ uint32_t index; /**< Index of this client */
+ const char *name; /**< Name of this client */
+ uint32_t owner_module; /**< Index of the owning module, or PA_INVALID_INDEX. */
+ const char *driver; /**< Driver name */
+ pa_proplist *proplist; /**< Property list \since 0.9.11 */
+} pa_client_info;
+
+/** Callback prototype for pa_context_get_client_info() and friends */
+typedef void (*pa_client_info_cb_t) (pa_context *c, const pa_client_info*i, int eol, void *userdata);
+
+/** Get information about a client by its index */
+pa_operation* pa_context_get_client_info(pa_context *c, uint32_t idx, pa_client_info_cb_t cb, void *userdata);
+
+/** Get the complete client list */
+pa_operation* pa_context_get_client_info_list(pa_context *c, pa_client_info_cb_t cb, void *userdata);
+
+/** Kill a client. */
+pa_operation* pa_context_kill_client(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
+
+/** @} */
+
+/** @{ \name Cards */
+
+/** \deprecated Superseded by pa_card_profile_info2 \since 0.9.15 */
+typedef struct pa_card_profile_info {
+ const char *name; /**< Name of this profile */
+ const char *description; /**< Description of this profile */
+ uint32_t n_sinks; /**< Number of sinks this profile would create */
+ uint32_t n_sources; /**< Number of sources this profile would create */
+ uint32_t priority; /**< The higher this value is, the more useful this profile is as a default. */
+} pa_card_profile_info;
+
+/** Stores information about a specific profile of a card. Please
+ * note that this structure can be extended as part of evolutionary
+ * API updates at any time in any new release. \since 5.0 */
+typedef struct pa_card_profile_info2 {
+ const char *name; /**< Name of this profile */
+ const char *description; /**< Description of this profile */
+ uint32_t n_sinks; /**< Number of sinks this profile would create */
+ uint32_t n_sources; /**< Number of sources this profile would create */
+ uint32_t priority; /**< The higher this value is, the more useful this profile is as a default. */
+ int available;
+ /**< Is this profile available? If this is zero, meaning "unavailable",
+ * then it makes no sense to try to activate this profile. If this is
+ * non-zero, it's still not a guarantee that activating the profile will
+ * result in anything useful, it just means that the server isn't aware of
+ * any reason why the profile would definitely be useless. \since 5.0 */
+} pa_card_profile_info2;
+
+/** Stores information about a specific port of a card. Please
+ * note that this structure can be extended as part of evolutionary
+ * API updates at any time in any new release. \since 2.0 */
+typedef struct pa_card_port_info {
+ const char *name; /**< Name of this port */
+ const char *description; /**< Description of this port */
+ uint32_t priority; /**< The higher this value is, the more useful this port is as a default. */
+ int available; /**< A #pa_port_available enum, indicating availability status of this port. */
+ int direction; /**< A #pa_direction enum, indicating the direction of this port. */
+ uint32_t n_profiles; /**< Number of entries in profile array */
+ pa_card_profile_info** profiles; /**< \deprecated Superseded by profiles2 */
+ pa_proplist *proplist; /**< Property list */
+ int64_t latency_offset; /**< Latency offset of the port that gets added to the sink/source latency when the port is active. \since 3.0 */
+ pa_card_profile_info2** profiles2; /**< Array of pointers to available profiles, or NULL. Array is terminated by an entry set to NULL. \since 5.0 */
+} pa_card_port_info;
+
+/** Stores information about cards. Please note that this structure
+ * can be extended as part of evolutionary API updates at any time in
+ * any new release. \since 0.9.15 */
+typedef struct pa_card_info {
+ uint32_t index; /**< Index of this card */
+ const char *name; /**< Name of this card */
+ uint32_t owner_module; /**< Index of the owning module, or PA_INVALID_INDEX. */
+ const char *driver; /**< Driver name */
+ uint32_t n_profiles; /**< Number of entries in profile array */
+ pa_card_profile_info* profiles; /**< \deprecated Superseded by profiles2 */
+ pa_card_profile_info* active_profile; /**< \deprecated Superseded by active_profile2 */
+ pa_proplist *proplist; /**< Property list */
+ uint32_t n_ports; /**< Number of entries in port array */
+ pa_card_port_info **ports; /**< Array of pointers to ports, or NULL. Array is terminated by an entry set to NULL. */
+ pa_card_profile_info2** profiles2; /**< Array of pointers to available profiles, or NULL. Array is terminated by an entry set to NULL. \since 5.0 */
+ pa_card_profile_info2* active_profile2; /**< Pointer to active profile in the array, or NULL. \since 5.0 */
+} pa_card_info;
+
+/** Callback prototype for pa_context_get_card_info_...() \since 0.9.15 */
+typedef void (*pa_card_info_cb_t) (pa_context *c, const pa_card_info*i, int eol, void *userdata);
+
+/** Get information about a card by its index \since 0.9.15 */
+pa_operation* pa_context_get_card_info_by_index(pa_context *c, uint32_t idx, pa_card_info_cb_t cb, void *userdata);
+
+/** Get information about a card by its name \since 0.9.15 */
+pa_operation* pa_context_get_card_info_by_name(pa_context *c, const char *name, pa_card_info_cb_t cb, void *userdata);
+
+/** Get the complete card list \since 0.9.15 */
+pa_operation* pa_context_get_card_info_list(pa_context *c, pa_card_info_cb_t cb, void *userdata);
+
+/** Change the profile of a card. \since 0.9.15 */
+pa_operation* pa_context_set_card_profile_by_index(pa_context *c, uint32_t idx, const char*profile, pa_context_success_cb_t cb, void *userdata);
+
+/** Change the profile of a card. \since 0.9.15 */
+pa_operation* pa_context_set_card_profile_by_name(pa_context *c, const char*name, const char*profile, pa_context_success_cb_t cb, void *userdata);
+
+/** Set the latency offset of a port. \since 3.0 */
+pa_operation* pa_context_set_port_latency_offset(pa_context *c, const char *card_name, const char *port_name, int64_t offset, pa_context_success_cb_t cb, void *userdata);
+
+/** @} */
+
+/** @{ \name Sink Inputs */
+
+/** Stores information about sink inputs. Please note that this structure
+ * can be extended as part of evolutionary API updates at any time in
+ * any new release. */
+typedef struct pa_sink_input_info {
+ uint32_t index; /**< Index of the sink input */
+ const char *name; /**< Name of the sink input */
+ uint32_t owner_module; /**< Index of the module this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any module. */
+ uint32_t client; /**< Index of the client this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any client. */
+ uint32_t sink; /**< Index of the connected sink */
+ pa_sample_spec sample_spec; /**< The sample specification of the sink input. */
+ pa_channel_map channel_map; /**< Channel map */
+ pa_cvolume volume; /**< The volume of this sink input. */
+ pa_usec_t buffer_usec; /**< Latency due to buffering in sink input, see pa_timing_info for details. */
+ pa_usec_t sink_usec; /**< Latency of the sink device, see pa_timing_info for details. */
+ const char *resample_method; /**< The resampling method used by this sink input. */
+ const char *driver; /**< Driver name */
+ int mute; /**< Stream muted \since 0.9.7 */
+ pa_proplist *proplist; /**< Property list \since 0.9.11 */
+ int corked; /**< Stream corked \since 1.0 */
+ int has_volume; /**< Stream has volume. If not set, then the meaning of this struct's volume member is unspecified. \since 1.0 */
+ int volume_writable; /**< The volume can be set. If not set, the volume can still change even though clients can't control the volume. \since 1.0 */
+ pa_format_info *format; /**< Stream format information. \since 1.0 */
+} pa_sink_input_info;
+
+/** Callback prototype for pa_context_get_sink_input_info() and friends */
+typedef void (*pa_sink_input_info_cb_t) (pa_context *c, const pa_sink_input_info *i, int eol, void *userdata);
+
+/** Get some information about a sink input by its index */
+pa_operation* pa_context_get_sink_input_info(pa_context *c, uint32_t idx, pa_sink_input_info_cb_t cb, void *userdata);
+
+/** Get the complete sink input list */
+pa_operation* pa_context_get_sink_input_info_list(pa_context *c, pa_sink_input_info_cb_t cb, void *userdata);
+
+/** Move the specified sink input to a different sink. \since 0.9.5 */
+pa_operation* pa_context_move_sink_input_by_name(pa_context *c, uint32_t idx, const char *sink_name, pa_context_success_cb_t cb, void* userdata);
+
+/** Move the specified sink input to a different sink. \since 0.9.5 */
+pa_operation* pa_context_move_sink_input_by_index(pa_context *c, uint32_t idx, uint32_t sink_idx, pa_context_success_cb_t cb, void* userdata);
+
+/** Set the volume of a sink input stream */
+pa_operation* pa_context_set_sink_input_volume(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
+
+/** Set the mute switch of a sink input stream \since 0.9.7 */
+pa_operation* pa_context_set_sink_input_mute(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
+
+/** Kill a sink input. */
+pa_operation* pa_context_kill_sink_input(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
+
+/** @} */
+
+/** @{ \name Source Outputs */
+
+/** Stores information about source outputs. Please note that this structure
+ * can be extended as part of evolutionary API updates at any time in
+ * any new release. */
+typedef struct pa_source_output_info {
+ uint32_t index; /**< Index of the source output */
+ const char *name; /**< Name of the source output */
+ uint32_t owner_module; /**< Index of the module this source output belongs to, or PA_INVALID_INDEX when it does not belong to any module. */
+ uint32_t client; /**< Index of the client this source output belongs to, or PA_INVALID_INDEX when it does not belong to any client. */
+ uint32_t source; /**< Index of the connected source */
+ pa_sample_spec sample_spec; /**< The sample specification of the source output */
+ pa_channel_map channel_map; /**< Channel map */
+ pa_usec_t buffer_usec; /**< Latency due to buffering in the source output, see pa_timing_info for details. */
+ pa_usec_t source_usec; /**< Latency of the source device, see pa_timing_info for details. */
+ const char *resample_method; /**< The resampling method used by this source output. */
+ const char *driver; /**< Driver name */
+ pa_proplist *proplist; /**< Property list \since 0.9.11 */
+ int corked; /**< Stream corked \since 1.0 */
+ pa_cvolume volume; /**< The volume of this source output \since 1.0 */
+ int mute; /**< Stream muted \since 1.0 */
+ int has_volume; /**< Stream has volume. If not set, then the meaning of this struct's volume member is unspecified. \since 1.0 */
+ int volume_writable; /**< The volume can be set. If not set, the volume can still change even though clients can't control the volume. \since 1.0 */
+ pa_format_info *format; /**< Stream format information. \since 1.0 */
+} pa_source_output_info;
+
+/** Callback prototype for pa_context_get_source_output_info() and friends */
+typedef void (*pa_source_output_info_cb_t) (pa_context *c, const pa_source_output_info *i, int eol, void *userdata);
+
+/** Get information about a source output by its index */
+pa_operation* pa_context_get_source_output_info(pa_context *c, uint32_t idx, pa_source_output_info_cb_t cb, void *userdata);
+
+/** Get the complete list of source outputs */
+pa_operation* pa_context_get_source_output_info_list(pa_context *c, pa_source_output_info_cb_t cb, void *userdata);
+
+/** Move the specified source output to a different source. \since 0.9.5 */
+pa_operation* pa_context_move_source_output_by_name(pa_context *c, uint32_t idx, const char *source_name, pa_context_success_cb_t cb, void* userdata);
+
+/** Move the specified source output to a different source. \since 0.9.5 */
+pa_operation* pa_context_move_source_output_by_index(pa_context *c, uint32_t idx, uint32_t source_idx, pa_context_success_cb_t cb, void* userdata);
+
+/** Set the volume of a source output stream \since 1.0 */
+pa_operation* pa_context_set_source_output_volume(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
+
+/** Set the mute switch of a source output stream \since 1.0 */
+pa_operation* pa_context_set_source_output_mute(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
+
+/** Kill a source output. */
+pa_operation* pa_context_kill_source_output(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
+
+/** @} */
+
+/** @{ \name Statistics */
+
+/** Memory block statistics. Please note that this structure
+ * can be extended as part of evolutionary API updates at any time in
+ * any new release. */
+typedef struct pa_stat_info {
+ uint32_t memblock_total; /**< Currently allocated memory blocks */
+ uint32_t memblock_total_size; /**< Current total size of allocated memory blocks */
+ uint32_t memblock_allocated; /**< Allocated memory blocks during the whole lifetime of the daemon. */
+ uint32_t memblock_allocated_size; /**< Total size of all memory blocks allocated during the whole lifetime of the daemon. */
+ uint32_t scache_size; /**< Total size of all sample cache entries. */
+} pa_stat_info;
+
+/** Callback prototype for pa_context_stat() */
+typedef void (*pa_stat_info_cb_t) (pa_context *c, const pa_stat_info *i, void *userdata);
+
+/** Get daemon memory block statistics */
+pa_operation* pa_context_stat(pa_context *c, pa_stat_info_cb_t cb, void *userdata);
+
+/** @} */
+
+/** @{ \name Cached Samples */
+
+/** Stores information about sample cache entries. Please note that this structure
+ * can be extended as part of evolutionary API updates at any time in
+ * any new release. */
+typedef struct pa_sample_info {
+ uint32_t index; /**< Index of this entry */
+ const char *name; /**< Name of this entry */
+ pa_cvolume volume; /**< Default volume of this entry */
+ pa_sample_spec sample_spec; /**< Sample specification of the sample */
+ pa_channel_map channel_map; /**< The channel map */
+ pa_usec_t duration; /**< Duration of this entry */
+ uint32_t bytes; /**< Length of this sample in bytes. */
+ int lazy; /**< Non-zero when this is a lazy cache entry. */
+ const char *filename; /**< In case this is a lazy cache entry, the filename for the sound file to be loaded on demand. */
+ pa_proplist *proplist; /**< Property list for this sample. \since 0.9.11 */
+} pa_sample_info;
+
+/** Callback prototype for pa_context_get_sample_info_by_name() and friends */
+typedef void (*pa_sample_info_cb_t)(pa_context *c, const pa_sample_info *i, int eol, void *userdata);
+
+/** Get information about a sample by its name */
+pa_operation* pa_context_get_sample_info_by_name(pa_context *c, const char *name, pa_sample_info_cb_t cb, void *userdata);
+
+/** Get information about a sample by its index */
+pa_operation* pa_context_get_sample_info_by_index(pa_context *c, uint32_t idx, pa_sample_info_cb_t cb, void *userdata);
+
+/** Get the complete list of samples stored in the daemon. */
+pa_operation* pa_context_get_sample_info_list(pa_context *c, pa_sample_info_cb_t cb, void *userdata);
+
+/** @} */
+
+/** \cond fulldocs */
+
+/** @{ \name Autoload Entries */
+
+/** \deprecated Type of an autoload entry. */
+typedef enum pa_autoload_type {
+ PA_AUTOLOAD_SINK = 0,
+ PA_AUTOLOAD_SOURCE = 1
+} pa_autoload_type_t;
+
+/** \deprecated Stores information about autoload entries. Please note that this structure
+ * can be extended as part of evolutionary API updates at any time in
+ * any new release. */
+typedef struct pa_autoload_info {
+ uint32_t index; /**< Index of this autoload entry */
+ const char *name; /**< Name of the sink or source */
+ pa_autoload_type_t type; /**< Type of the autoload entry */
+ const char *module; /**< Module name to load */
+ const char *argument; /**< Argument string for module */
+} pa_autoload_info;
+
+/** \deprecated Callback prototype for pa_context_get_autoload_info_by_name() and friends */
+typedef void (*pa_autoload_info_cb_t)(pa_context *c, const pa_autoload_info *i, int eol, void *userdata);
+
+/** \deprecated Get info about a specific autoload entry. */
+pa_operation* pa_context_get_autoload_info_by_name(pa_context *c, const char *name, pa_autoload_type_t type, pa_autoload_info_cb_t cb, void *userdata) PA_GCC_DEPRECATED;
+
+/** \deprecated Get info about a specific autoload entry. */
+pa_operation* pa_context_get_autoload_info_by_index(pa_context *c, uint32_t idx, pa_autoload_info_cb_t cb, void *userdata) PA_GCC_DEPRECATED;
+
+/** \deprecated Get the complete list of autoload entries. */
+pa_operation* pa_context_get_autoload_info_list(pa_context *c, pa_autoload_info_cb_t cb, void *userdata) PA_GCC_DEPRECATED;
+
+/** \deprecated Add a new autoload entry. */
+pa_operation* pa_context_add_autoload(pa_context *c, const char *name, pa_autoload_type_t type, const char *module, const char*argument, pa_context_index_cb_t, void* userdata) PA_GCC_DEPRECATED;
+
+/** \deprecated Remove an autoload entry. */
+pa_operation* pa_context_remove_autoload_by_name(pa_context *c, const char *name, pa_autoload_type_t type, pa_context_success_cb_t cb, void* userdata) PA_GCC_DEPRECATED;
+
+/** \deprecated Remove an autoload entry. */
+pa_operation* pa_context_remove_autoload_by_index(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void* userdata) PA_GCC_DEPRECATED;
+
+/** @} */
+
+/** \endcond */
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/mainloop-api.h b/thirdparty/linuxbsd_headers/pulse/mainloop-api.h
new file mode 100644
index 0000000000..4d847313a4
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/mainloop-api.h
@@ -0,0 +1,124 @@
+#ifndef foomainloopapihfoo
+#define foomainloopapihfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ PulseAudio 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 PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <sys/time.h>
+
+#include <pulse/cdecl.h>
+#include <pulse/version.h>
+
+/** \file
+ *
+ * Main loop abstraction layer. Both the PulseAudio core and the
+ * PulseAudio client library use a main loop abstraction layer. Due to
+ * this it is possible to embed PulseAudio into other
+ * applications easily. Two main loop implementations are
+ * currently available:
+ * \li A minimal implementation based on the C library's poll() function (See \ref mainloop.h)
+ * \li A wrapper around the GLIB main loop. Use this to embed PulseAudio into your GLIB/GTK+/GNOME programs (See \ref glib-mainloop.h)
+ *
+ * The structure pa_mainloop_api is used as vtable for the main loop abstraction.
+ *
+ * This mainloop abstraction layer has no direct support for UNIX signals. Generic, mainloop implementation agnostic support is available through \ref mainloop-signal.h.
+ * */
+
+PA_C_DECL_BEGIN
+
+/** An abstract mainloop API vtable */
+typedef struct pa_mainloop_api pa_mainloop_api;
+
+/** A bitmask for IO events */
+typedef enum pa_io_event_flags {
+ PA_IO_EVENT_NULL = 0, /**< No event */
+ PA_IO_EVENT_INPUT = 1, /**< Input event */
+ PA_IO_EVENT_OUTPUT = 2, /**< Output event */
+ PA_IO_EVENT_HANGUP = 4, /**< Hangup event */
+ PA_IO_EVENT_ERROR = 8 /**< Error event */
+} pa_io_event_flags_t;
+
+/** An opaque IO event source object */
+typedef struct pa_io_event pa_io_event;
+/** An IO event callback prototype \since 0.9.3 */
+typedef void (*pa_io_event_cb_t)(pa_mainloop_api*ea, pa_io_event* e, int fd, pa_io_event_flags_t events, void *userdata);
+/** A IO event destroy callback prototype \since 0.9.3 */
+typedef void (*pa_io_event_destroy_cb_t)(pa_mainloop_api*a, pa_io_event *e, void *userdata);
+
+/** An opaque timer event source object */
+typedef struct pa_time_event pa_time_event;
+/** A time event callback prototype \since 0.9.3 */
+typedef void (*pa_time_event_cb_t)(pa_mainloop_api*a, pa_time_event* e, const struct timeval *tv, void *userdata);
+/** A time event destroy callback prototype \since 0.9.3 */
+typedef void (*pa_time_event_destroy_cb_t)(pa_mainloop_api*a, pa_time_event *e, void *userdata);
+
+/** An opaque deferred event source object. Events of this type are triggered once in every main loop iteration */
+typedef struct pa_defer_event pa_defer_event;
+/** A defer event callback prototype \since 0.9.3 */
+typedef void (*pa_defer_event_cb_t)(pa_mainloop_api*a, pa_defer_event* e, void *userdata);
+/** A defer event destroy callback prototype \since 0.9.3 */
+typedef void (*pa_defer_event_destroy_cb_t)(pa_mainloop_api*a, pa_defer_event *e, void *userdata);
+
+/** An abstract mainloop API vtable */
+struct pa_mainloop_api {
+ /** A pointer to some private, arbitrary data of the main loop implementation */
+ void *userdata;
+
+ /** Create a new IO event source object */
+ pa_io_event* (*io_new)(pa_mainloop_api*a, int fd, pa_io_event_flags_t events, pa_io_event_cb_t cb, void *userdata);
+ /** Enable or disable IO events on this object */
+ void (*io_enable)(pa_io_event* e, pa_io_event_flags_t events);
+ /** Free a IO event source object */
+ void (*io_free)(pa_io_event* e);
+ /** Set a function that is called when the IO event source is destroyed. Use this to free the userdata argument if required */
+ void (*io_set_destroy)(pa_io_event *e, pa_io_event_destroy_cb_t cb);
+
+ /** Create a new timer event source object for the specified Unix time */
+ pa_time_event* (*time_new)(pa_mainloop_api*a, const struct timeval *tv, pa_time_event_cb_t cb, void *userdata);
+ /** Restart a running or expired timer event source with a new Unix time */
+ void (*time_restart)(pa_time_event* e, const struct timeval *tv);
+ /** Free a deferred timer event source object */
+ void (*time_free)(pa_time_event* e);
+ /** Set a function that is called when the timer event source is destroyed. Use this to free the userdata argument if required */
+ void (*time_set_destroy)(pa_time_event *e, pa_time_event_destroy_cb_t cb);
+
+ /** Create a new deferred event source object */
+ pa_defer_event* (*defer_new)(pa_mainloop_api*a, pa_defer_event_cb_t cb, void *userdata);
+ /** Enable or disable a deferred event source temporarily */
+ void (*defer_enable)(pa_defer_event* e, int b);
+ /** Free a deferred event source object */
+ void (*defer_free)(pa_defer_event* e);
+ /** Set a function that is called when the deferred event source is destroyed. Use this to free the userdata argument if required */
+ void (*defer_set_destroy)(pa_defer_event *e, pa_defer_event_destroy_cb_t cb);
+
+ /** Exit the main loop and return the specified retval*/
+ void (*quit)(pa_mainloop_api*a, int retval);
+};
+
+/** Run the specified callback function once from the main loop using an
+ * anonymous defer event. If the mainloop runs in a different thread, you need
+ * to follow the mainloop implementation's rules regarding how to safely create
+ * defer events. In particular, if you're using \ref pa_threaded_mainloop, you
+ * must lock the mainloop before calling this function. */
+void pa_mainloop_api_once(pa_mainloop_api*m, void (*callback)(pa_mainloop_api*m, void *userdata), void *userdata);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/mainloop-signal.h b/thirdparty/linuxbsd_headers/pulse/mainloop-signal.h
new file mode 100644
index 0000000000..0a7bdeb5c7
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/mainloop-signal.h
@@ -0,0 +1,64 @@
+#ifndef foomainloopsignalhfoo
+#define foomainloopsignalhfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2008 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/mainloop-api.h>
+#include <pulse/cdecl.h>
+
+PA_C_DECL_BEGIN
+
+/** \file
+ * UNIX signal support for main loops. In contrast to other
+ * main loop event sources such as timer and IO events, UNIX signal
+ * support requires modification of the global process
+ * environment. Due to this the generic main loop abstraction layer as
+ * defined in \ref mainloop-api.h doesn't have direct support for UNIX
+ * signals. However, you may hook signal support into an abstract main loop via the routines defined herein.
+ */
+
+/** An opaque UNIX signal event source object */
+typedef struct pa_signal_event pa_signal_event;
+
+/** Callback prototype for signal events */
+typedef void (*pa_signal_cb_t) (pa_mainloop_api *api, pa_signal_event*e, int sig, void *userdata);
+
+/** Destroy callback prototype for signal events */
+typedef void (*pa_signal_destroy_cb_t) (pa_mainloop_api *api, pa_signal_event*e, void *userdata);
+
+/** Initialize the UNIX signal subsystem and bind it to the specified main loop */
+int pa_signal_init(pa_mainloop_api *api);
+
+/** Cleanup the signal subsystem */
+void pa_signal_done(void);
+
+/** Create a new UNIX signal event source object */
+pa_signal_event* pa_signal_new(int sig, pa_signal_cb_t callback, void *userdata);
+
+/** Free a UNIX signal event source object */
+void pa_signal_free(pa_signal_event *e);
+
+/** Set a function that is called when the signal event source is destroyed. Use this to free the userdata argument if required */
+void pa_signal_set_destroy(pa_signal_event *e, pa_signal_destroy_cb_t callback);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/mainloop.h b/thirdparty/linuxbsd_headers/pulse/mainloop.h
new file mode 100644
index 0000000000..6e2ca5f9bf
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/mainloop.h
@@ -0,0 +1,131 @@
+#ifndef foomainloophfoo
+#define foomainloophfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/mainloop-api.h>
+#include <pulse/cdecl.h>
+
+PA_C_DECL_BEGIN
+
+struct pollfd;
+
+/** \page mainloop Main Loop
+ *
+ * \section overv_sec Overview
+ *
+ * The built-in main loop implementation is based on the poll() system call.
+ * It supports the functions defined in the main loop abstraction and very
+ * little else.
+ *
+ * The main loop is created using pa_mainloop_new() and destroyed using
+ * pa_mainloop_free(). To get access to the main loop abstraction,
+ * pa_mainloop_get_api() is used.
+ *
+ * \section iter_sec Iteration
+ *
+ * The main loop is designed around the concept of iterations. Each iteration
+ * consists of three steps that repeat during the application's entire
+ * lifetime:
+ *
+ * -# Prepare - Build a list of file descriptors
+ * that need to be monitored and calculate the next timeout.
+ * -# Poll - Execute the actual poll() system call.
+ * -# Dispatch - Dispatch any events that have fired.
+ *
+ * When using the main loop, the application can either execute each
+ * iteration, one at a time, using pa_mainloop_iterate(), or let the library
+ * iterate automatically using pa_mainloop_run().
+ *
+ * \section thread_sec Threads
+ *
+ * The main loop functions are designed to be thread safe, but the objects
+ * are not. What this means is that multiple main loops can be used, but only
+ * one object per thread.
+ *
+ */
+
+/** \file
+ *
+ * A minimal main loop implementation based on the C library's poll()
+ * function. Using the routines defined herein you may create a simple
+ * main loop supporting the generic main loop abstraction layer as
+ * defined in \ref mainloop-api.h. This implementation is thread safe
+ * as long as you access the main loop object from a single thread only.
+ *
+ * See also \subpage mainloop
+ */
+
+/** An opaque main loop object */
+typedef struct pa_mainloop pa_mainloop;
+
+/** Allocate a new main loop object */
+pa_mainloop *pa_mainloop_new(void);
+
+/** Free a main loop object */
+void pa_mainloop_free(pa_mainloop* m);
+
+/** Prepare for a single iteration of the main loop. Returns a negative value
+on error or exit request. timeout specifies a maximum timeout for the subsequent
+poll, or -1 for blocking behaviour. .*/
+int pa_mainloop_prepare(pa_mainloop *m, int timeout);
+
+/** Execute the previously prepared poll. Returns a negative value on error.*/
+int pa_mainloop_poll(pa_mainloop *m);
+
+/** Dispatch timeout, io and deferred events from the previously executed poll. Returns
+a negative value on error. On success returns the number of source dispatched. */
+int pa_mainloop_dispatch(pa_mainloop *m);
+
+/** Return the return value as specified with the main loop's quit() routine. */
+int pa_mainloop_get_retval(pa_mainloop *m);
+
+/** Run a single iteration of the main loop. This is a convenience function
+for pa_mainloop_prepare(), pa_mainloop_poll() and pa_mainloop_dispatch().
+Returns a negative value on error or exit request. If block is nonzero,
+block for events if none are queued. Optionally return the return value as
+specified with the main loop's quit() routine in the integer variable retval points
+to. On success returns the number of sources dispatched in this iteration. */
+int pa_mainloop_iterate(pa_mainloop *m, int block, int *retval);
+
+/** Run unlimited iterations of the main loop object until the main loop's quit() routine is called. */
+int pa_mainloop_run(pa_mainloop *m, int *retval);
+
+/** Return the abstract main loop abstraction layer vtable for this
+ main loop. No need to free the API as it is owned by the loop
+ and is destroyed when the loop is freed. */
+pa_mainloop_api* pa_mainloop_get_api(pa_mainloop*m);
+
+/** Shutdown the main loop with the specified return value */
+void pa_mainloop_quit(pa_mainloop *m, int retval);
+
+/** Interrupt a running poll (for threaded systems) */
+void pa_mainloop_wakeup(pa_mainloop *m);
+
+/** Generic prototype of a poll() like function */
+typedef int (*pa_poll_func)(struct pollfd *ufds, unsigned long nfds, int timeout, void*userdata);
+
+/** Change the poll() implementation */
+void pa_mainloop_set_poll_func(pa_mainloop *m, pa_poll_func poll_func, void *userdata);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/operation.h b/thirdparty/linuxbsd_headers/pulse/operation.h
new file mode 100644
index 0000000000..edd7d76e54
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/operation.h
@@ -0,0 +1,64 @@
+#ifndef foooperationhfoo
+#define foooperationhfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/cdecl.h>
+#include <pulse/def.h>
+#include <pulse/version.h>
+
+/** \file
+ * Asynchronous operations */
+
+PA_C_DECL_BEGIN
+
+/** An asynchronous operation object */
+typedef struct pa_operation pa_operation;
+
+/** A callback for operation state changes */
+typedef void (*pa_operation_notify_cb_t) (pa_operation *o, void *userdata);
+
+/** Increase the reference count by one */
+pa_operation *pa_operation_ref(pa_operation *o);
+
+/** Decrease the reference count by one */
+void pa_operation_unref(pa_operation *o);
+
+/** Cancel the operation. Beware! This will not necessarily cancel the
+ * execution of the operation on the server side. However it will make
+ * sure that the callback associated with this operation will not be
+ * called anymore, effectively disabling the operation from the client
+ * side's view. */
+void pa_operation_cancel(pa_operation *o);
+
+/** Return the current status of the operation */
+pa_operation_state_t pa_operation_get_state(pa_operation *o);
+
+/** Set the callback function that is called when the operation state
+ * changes. Usually this is not necessary, since the functions that
+ * create pa_operation objects already take a callback that is called
+ * when the operation finishes. Registering a state change callback is
+ * mainly useful, if you want to get called back also if the operation
+ * gets cancelled. \since 4.0 */
+void pa_operation_set_state_callback(pa_operation *o, pa_operation_notify_cb_t cb, void *userdata);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/proplist.h b/thirdparty/linuxbsd_headers/pulse/proplist.h
new file mode 100644
index 0000000000..bc9e8f8ef3
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/proplist.h
@@ -0,0 +1,409 @@
+#ifndef foopulseproplisthfoo
+#define foopulseproplisthfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2007 Lennart Poettering
+
+ PulseAudio 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; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ PulseAudio 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 PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <sys/types.h>
+
+#include <pulse/cdecl.h>
+#include <pulse/gccmacro.h>
+#include <pulse/version.h>
+
+/** \file
+ * Property list constants and functions */
+
+PA_C_DECL_BEGIN
+
+/** For streams: localized media name, formatted as UTF-8. E.g. "Guns'N'Roses: Civil War".*/
+#define PA_PROP_MEDIA_NAME "media.name"
+
+/** For streams: localized media title if applicable, formatted as UTF-8. E.g. "Civil War" */
+#define PA_PROP_MEDIA_TITLE "media.title"
+
+/** For streams: localized media artist if applicable, formatted as UTF-8. E.g. "Guns'N'Roses" */
+#define PA_PROP_MEDIA_ARTIST "media.artist"
+
+/** For streams: localized media copyright string if applicable, formatted as UTF-8. E.g. "Evil Record Corp." */
+#define PA_PROP_MEDIA_COPYRIGHT "media.copyright"
+
+/** For streams: localized media generator software string if applicable, formatted as UTF-8. E.g. "Foocrop AudioFrobnicator" */
+#define PA_PROP_MEDIA_SOFTWARE "media.software"
+
+/** For streams: media language if applicable, in standard POSIX format. E.g. "de_DE" */
+#define PA_PROP_MEDIA_LANGUAGE "media.language"
+
+/** For streams: source filename if applicable, in URI format or local path. E.g. "/home/lennart/music/foobar.ogg" */
+#define PA_PROP_MEDIA_FILENAME "media.filename"
+
+/** \cond fulldocs */
+/** For streams: icon for the media. A binary blob containing PNG image data */
+#define PA_PROP_MEDIA_ICON "media.icon"
+/** \endcond */
+
+/** For streams: an XDG icon name for the media. E.g. "audio-x-mp3" */
+#define PA_PROP_MEDIA_ICON_NAME "media.icon_name"
+
+/** For streams: logic role of this media. One of the strings "video", "music", "game", "event", "phone", "animation", "production", "a11y", "test" */
+#define PA_PROP_MEDIA_ROLE "media.role"
+
+/** For streams: the name of a filter that is desired, e.g.\ "echo-cancel" or "equalizer-sink". PulseAudio may choose to not apply the filter if it does not make sense (for example, applying echo-cancellation on a Bluetooth headset probably does not make sense. \since 1.0 */
+#define PA_PROP_FILTER_WANT "filter.want"
+
+/** For streams: the name of a filter that is desired, e.g.\ "echo-cancel" or "equalizer-sink". Differs from PA_PROP_FILTER_WANT in that it forces PulseAudio to apply the filter, regardless of whether PulseAudio thinks it makes sense to do so or not. If this is set, PA_PROP_FILTER_WANT is ignored. In other words, you almost certainly do not want to use this. \since 1.0 */
+#define PA_PROP_FILTER_APPLY "filter.apply"
+
+/** For streams: the name of a filter that should specifically suppressed (i.e.\ overrides PA_PROP_FILTER_WANT). Useful for the times that PA_PROP_FILTER_WANT is automatically added (e.g. echo-cancellation for phone streams when $VOIP_APP does its own, internal AEC) \since 1.0 */
+#define PA_PROP_FILTER_SUPPRESS "filter.suppress"
+
+/** For event sound streams: XDG event sound name. e.g.\ "message-new-email" (Event sound streams are those with media.role set to "event") */
+#define PA_PROP_EVENT_ID "event.id"
+
+/** For event sound streams: localized human readable one-line description of the event, formatted as UTF-8. E.g. "Email from lennart@example.com received." */
+#define PA_PROP_EVENT_DESCRIPTION "event.description"
+
+/** For event sound streams: absolute horizontal mouse position on the screen if the event sound was triggered by a mouse click, integer formatted as text string. E.g. "865" */
+#define PA_PROP_EVENT_MOUSE_X "event.mouse.x"
+
+/** For event sound streams: absolute vertical mouse position on the screen if the event sound was triggered by a mouse click, integer formatted as text string. E.g. "432" */
+#define PA_PROP_EVENT_MOUSE_Y "event.mouse.y"
+
+/** For event sound streams: relative horizontal mouse position on the screen if the event sound was triggered by a mouse click, float formatted as text string, ranging from 0.0 (left side of the screen) to 1.0 (right side of the screen). E.g. "0.65" */
+#define PA_PROP_EVENT_MOUSE_HPOS "event.mouse.hpos"
+
+/** For event sound streams: relative vertical mouse position on the screen if the event sound was triggered by a mouse click, float formatted as text string, ranging from 0.0 (top of the screen) to 1.0 (bottom of the screen). E.g. "0.43" */
+#define PA_PROP_EVENT_MOUSE_VPOS "event.mouse.vpos"
+
+/** For event sound streams: mouse button that triggered the event if applicable, integer formatted as string with 0=left, 1=middle, 2=right. E.g. "0" */
+#define PA_PROP_EVENT_MOUSE_BUTTON "event.mouse.button"
+
+/** For streams that belong to a window on the screen: localized window title. E.g. "Totem Music Player" */
+#define PA_PROP_WINDOW_NAME "window.name"
+
+/** For streams that belong to a window on the screen: a textual id for identifying a window logically. E.g. "org.gnome.Totem.MainWindow" */
+#define PA_PROP_WINDOW_ID "window.id"
+
+/** \cond fulldocs */
+/** For streams that belong to a window on the screen: window icon. A binary blob containing PNG image data */
+#define PA_PROP_WINDOW_ICON "window.icon"
+/** \endcond */
+
+/** For streams that belong to a window on the screen: an XDG icon name for the window. E.g. "totem" */
+#define PA_PROP_WINDOW_ICON_NAME "window.icon_name"
+
+/** For streams that belong to a window on the screen: absolute horizontal window position on the screen, integer formatted as text string. E.g. "865". \since 0.9.17 */
+#define PA_PROP_WINDOW_X "window.x"
+
+/** For streams that belong to a window on the screen: absolute vertical window position on the screen, integer formatted as text string. E.g. "343". \since 0.9.17 */
+#define PA_PROP_WINDOW_Y "window.y"
+
+/** For streams that belong to a window on the screen: window width on the screen, integer formatted as text string. e.g. "365". \since 0.9.17 */
+#define PA_PROP_WINDOW_WIDTH "window.width"
+
+/** For streams that belong to a window on the screen: window height on the screen, integer formatted as text string. E.g. "643". \since 0.9.17 */
+#define PA_PROP_WINDOW_HEIGHT "window.height"
+
+/** For streams that belong to a window on the screen: relative position of the window center on the screen, float formatted as text string, ranging from 0.0 (left side of the screen) to 1.0 (right side of the screen). E.g. "0.65". \since 0.9.17 */
+#define PA_PROP_WINDOW_HPOS "window.hpos"
+
+/** For streams that belong to a window on the screen: relative position of the window center on the screen, float formatted as text string, ranging from 0.0 (top of the screen) to 1.0 (bottom of the screen). E.g. "0.43". \since 0.9.17 */
+#define PA_PROP_WINDOW_VPOS "window.vpos"
+
+/** For streams that belong to a window on the screen: if the windowing system supports multiple desktops, a comma separated list of indexes of the desktops this window is visible on. If this property is an empty string, it is visible on all desktops (i.e. 'sticky'). The first desktop is 0. E.g. "0,2,3" \since 0.9.18 */
+#define PA_PROP_WINDOW_DESKTOP "window.desktop"
+
+/** For streams that belong to an X11 window on the screen: the X11 display string. E.g. ":0.0" */
+#define PA_PROP_WINDOW_X11_DISPLAY "window.x11.display"
+
+/** For streams that belong to an X11 window on the screen: the X11 screen the window is on, an integer formatted as string. E.g. "0" */
+#define PA_PROP_WINDOW_X11_SCREEN "window.x11.screen"
+
+/** For streams that belong to an X11 window on the screen: the X11 monitor the window is on, an integer formatted as string. E.g. "0" */
+#define PA_PROP_WINDOW_X11_MONITOR "window.x11.monitor"
+
+/** For streams that belong to an X11 window on the screen: the window XID, an integer formatted as string. E.g. "25632" */
+#define PA_PROP_WINDOW_X11_XID "window.x11.xid"
+
+/** For clients/streams: localized human readable application name. E.g. "Totem Music Player" */
+#define PA_PROP_APPLICATION_NAME "application.name"
+
+/** For clients/streams: a textual id for identifying an application logically. E.g. "org.gnome.Totem" */
+#define PA_PROP_APPLICATION_ID "application.id"
+
+/** For clients/streams: a version string, e.g.\ "0.6.88" */
+#define PA_PROP_APPLICATION_VERSION "application.version"
+
+/** \cond fulldocs */
+/** For clients/streams: application icon. A binary blob containing PNG image data */
+#define PA_PROP_APPLICATION_ICON "application.icon"
+/** \endcond */
+
+/** For clients/streams: an XDG icon name for the application. E.g. "totem" */
+#define PA_PROP_APPLICATION_ICON_NAME "application.icon_name"
+
+/** For clients/streams: application language if applicable, in standard POSIX format. E.g. "de_DE" */
+#define PA_PROP_APPLICATION_LANGUAGE "application.language"
+
+/** For clients/streams on UNIX: application process PID, an integer formatted as string. E.g. "4711" */
+#define PA_PROP_APPLICATION_PROCESS_ID "application.process.id"
+
+/** For clients/streams: application process name. E.g. "totem" */
+#define PA_PROP_APPLICATION_PROCESS_BINARY "application.process.binary"
+
+/** For clients/streams: application user name. E.g. "lennart" */
+#define PA_PROP_APPLICATION_PROCESS_USER "application.process.user"
+
+/** For clients/streams: host name the application runs on. E.g. "omega" */
+#define PA_PROP_APPLICATION_PROCESS_HOST "application.process.host"
+
+/** For clients/streams: the D-Bus host id the application runs on. E.g. "543679e7b01393ed3e3e650047d78f6e" */
+#define PA_PROP_APPLICATION_PROCESS_MACHINE_ID "application.process.machine_id"
+
+/** For clients/streams: an id for the login session the application runs in. On Unix the value of $XDG_SESSION_ID. E.g. "5" */
+#define PA_PROP_APPLICATION_PROCESS_SESSION_ID "application.process.session_id"
+
+/** For devices: device string in the underlying audio layer's format. E.g. "surround51:0" */
+#define PA_PROP_DEVICE_STRING "device.string"
+
+/** For devices: API this device is access with. E.g. "alsa" */
+#define PA_PROP_DEVICE_API "device.api"
+
+/** For devices: localized human readable device one-line description. E.g. "Foobar Industries USB Headset 2000+ Ultra" */
+#define PA_PROP_DEVICE_DESCRIPTION "device.description"
+
+/** For devices: bus path to the device in the OS' format. E.g. "/sys/bus/pci/devices/0000:00:1f.2" */
+#define PA_PROP_DEVICE_BUS_PATH "device.bus_path"
+
+/** For devices: serial number if applicable. E.g. "4711-0815-1234" */
+#define PA_PROP_DEVICE_SERIAL "device.serial"
+
+/** For devices: vendor ID if applicable. E.g. 1274 */
+#define PA_PROP_DEVICE_VENDOR_ID "device.vendor.id"
+
+/** For devices: vendor name if applicable. E.g. "Foocorp Heavy Industries" */
+#define PA_PROP_DEVICE_VENDOR_NAME "device.vendor.name"
+
+/** For devices: product ID if applicable. E.g. 4565 */
+#define PA_PROP_DEVICE_PRODUCT_ID "device.product.id"
+
+/** For devices: product name if applicable. E.g. "SuperSpeakers 2000 Pro" */
+#define PA_PROP_DEVICE_PRODUCT_NAME "device.product.name"
+
+/** For devices: device class. One of "sound", "modem", "monitor", "filter" */
+#define PA_PROP_DEVICE_CLASS "device.class"
+
+/** For devices: form factor if applicable. One of "internal", "speaker", "handset", "tv", "webcam", "microphone", "headset", "headphone", "hands-free", "car", "hifi", "computer", "portable" */
+#define PA_PROP_DEVICE_FORM_FACTOR "device.form_factor"
+
+/** For devices: bus of the device if applicable. One of "isa", "pci", "usb", "firewire", "bluetooth" */
+#define PA_PROP_DEVICE_BUS "device.bus"
+
+/** \cond fulldocs */
+/** For devices: icon for the device. A binary blob containing PNG image data */
+#define PA_PROP_DEVICE_ICON "device.icon"
+/** \endcond */
+
+/** For devices: an XDG icon name for the device. E.g. "sound-card-speakers-usb" */
+#define PA_PROP_DEVICE_ICON_NAME "device.icon_name"
+
+/** For devices: access mode of the device if applicable. One of "mmap", "mmap_rewrite", "serial" */
+#define PA_PROP_DEVICE_ACCESS_MODE "device.access_mode"
+
+/** For filter devices: master device id if applicable. */
+#define PA_PROP_DEVICE_MASTER_DEVICE "device.master_device"
+
+/** For devices: buffer size in bytes, integer formatted as string. */
+#define PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE "device.buffering.buffer_size"
+
+/** For devices: fragment size in bytes, integer formatted as string. */
+#define PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE "device.buffering.fragment_size"
+
+/** For devices: profile identifier for the profile this devices is in. E.g. "analog-stereo", "analog-surround-40", "iec958-stereo", ...*/
+#define PA_PROP_DEVICE_PROFILE_NAME "device.profile.name"
+
+/** For devices: intended use. A space separated list of roles (see PA_PROP_MEDIA_ROLE) this device is particularly well suited for, due to latency, quality or form factor. \since 0.9.16 */
+#define PA_PROP_DEVICE_INTENDED_ROLES "device.intended_roles"
+
+/** For devices: human readable one-line description of the profile this device is in. E.g. "Analog Stereo", ... */
+#define PA_PROP_DEVICE_PROFILE_DESCRIPTION "device.profile.description"
+
+/** For modules: the author's name, formatted as UTF-8 string. E.g. "Lennart Poettering" */
+#define PA_PROP_MODULE_AUTHOR "module.author"
+
+/** For modules: a human readable one-line description of the module's purpose formatted as UTF-8. E.g. "Frobnicate sounds with a flux compensator" */
+#define PA_PROP_MODULE_DESCRIPTION "module.description"
+
+/** For modules: a human readable usage description of the module's arguments formatted as UTF-8. */
+#define PA_PROP_MODULE_USAGE "module.usage"
+
+/** For modules: a version string for the module. E.g. "0.9.15" */
+#define PA_PROP_MODULE_VERSION "module.version"
+
+/** For PCM formats: the sample format used as returned by pa_sample_format_to_string() \since 1.0 */
+#define PA_PROP_FORMAT_SAMPLE_FORMAT "format.sample_format"
+
+/** For all formats: the sample rate (unsigned integer) \since 1.0 */
+#define PA_PROP_FORMAT_RATE "format.rate"
+
+/** For all formats: the number of channels (unsigned integer) \since 1.0 */
+#define PA_PROP_FORMAT_CHANNELS "format.channels"
+
+/** For PCM formats: the channel map of the stream as returned by pa_channel_map_snprint() \since 1.0 */
+#define PA_PROP_FORMAT_CHANNEL_MAP "format.channel_map"
+
+/** A property list object. Basically a dictionary with ASCII strings
+ * as keys and arbitrary data as values. \since 0.9.11 */
+typedef struct pa_proplist pa_proplist;
+
+/** Allocate a property list. \since 0.9.11 */
+pa_proplist* pa_proplist_new(void);
+
+/** Free the property list. \since 0.9.11 */
+void pa_proplist_free(pa_proplist* p);
+
+/** Returns a non-zero value if the key is valid. \since 3.0 */
+int pa_proplist_key_valid(const char *key);
+
+/** Append a new string entry to the property list, possibly
+ * overwriting an already existing entry with the same key. An
+ * internal copy of the data passed is made. Will accept only valid
+ * UTF-8. \since 0.9.11 */
+int pa_proplist_sets(pa_proplist *p, const char *key, const char *value);
+
+/** Append a new string entry to the property list, possibly
+ * overwriting an already existing entry with the same key. An
+ * internal copy of the data passed is made. Will accept only valid
+ * UTF-8. The string passed in must contain a '='. Left hand side of
+ * the '=' is used as key name, the right hand side as string
+ * data. \since 0.9.16 */
+int pa_proplist_setp(pa_proplist *p, const char *pair);
+
+/** Append a new string entry to the property list, possibly
+ * overwriting an already existing entry with the same key. An
+ * internal copy of the data passed is made. Will accept only valid
+ * UTF-8. The data can be passed as printf()-style format string with
+ * arguments. \since 0.9.11 */
+int pa_proplist_setf(pa_proplist *p, const char *key, const char *format, ...) PA_GCC_PRINTF_ATTR(3,4);
+
+/** Append a new arbitrary data entry to the property list, possibly
+ * overwriting an already existing entry with the same key. An
+ * internal copy of the data passed is made. \since 0.9.11 */
+int pa_proplist_set(pa_proplist *p, const char *key, const void *data, size_t nbytes);
+
+/** Return a string entry for the specified key. Will return NULL if
+ * the data is not valid UTF-8. Will return a NUL-terminated string in
+ * an internally allocated buffer. The caller should make a copy of
+ * the data before accessing the property list again. \since 0.9.11 */
+const char *pa_proplist_gets(pa_proplist *p, const char *key);
+
+/** Store the value for the specified key in \a data. Will store a
+ * NUL-terminated string for string entries. The \a data pointer returned will
+ * point to an internally allocated buffer. The caller should make a
+ * copy of the data before the property list is accessed again. \since
+ * 0.9.11 */
+int pa_proplist_get(pa_proplist *p, const char *key, const void **data, size_t *nbytes);
+
+/** Update mode enum for pa_proplist_update(). \since 0.9.11 */
+typedef enum pa_update_mode {
+ PA_UPDATE_SET
+ /**< Replace the entire property list with the new one. Don't keep
+ * any of the old data around. */,
+
+ PA_UPDATE_MERGE
+ /**< Merge new property list into the existing one, not replacing
+ * any old entries if they share a common key with the new
+ * property list. */,
+
+ PA_UPDATE_REPLACE
+ /**< Merge new property list into the existing one, replacing all
+ * old entries that share a common key with the new property
+ * list. */
+} pa_update_mode_t;
+
+/** \cond fulldocs */
+#define PA_UPDATE_SET PA_UPDATE_SET
+#define PA_UPDATE_MERGE PA_UPDATE_MERGE
+#define PA_UPDATE_REPLACE PA_UPDATE_REPLACE
+/** \endcond */
+
+/** Merge property list "other" into "p", adhering the merge mode as
+ * specified in "mode". \since 0.9.11 */
+void pa_proplist_update(pa_proplist *p, pa_update_mode_t mode, const pa_proplist *other);
+
+/** Removes a single entry from the property list, identified be the
+ * specified key name. \since 0.9.11 */
+int pa_proplist_unset(pa_proplist *p, const char *key);
+
+/** Similar to pa_proplist_unset() but takes an array of keys to
+ * remove. The array should be terminated by a NULL pointer. Returns -1
+ * on failure, otherwise the number of entries actually removed (which
+ * might even be 0, if there were no matching entries to
+ * remove). \since 0.9.11 */
+int pa_proplist_unset_many(pa_proplist *p, const char * const keys[]);
+
+/** Iterate through the property list. The user should allocate a
+ * state variable of type void* and initialize it with NULL. A pointer
+ * to this variable should then be passed to pa_proplist_iterate()
+ * which should be called in a loop until it returns NULL which
+ * signifies EOL. The property list should not be modified during
+ * iteration through the list -- with the exception of deleting the
+ * current entry. On each invocation this function will return the
+ * key string for the next entry. The keys in the property list do not
+ * have any particular order. \since 0.9.11 */
+const char *pa_proplist_iterate(pa_proplist *p, void **state);
+
+/** Format the property list nicely as a human readable string. This
+ * works very much like pa_proplist_to_string_sep() and uses a newline
+ * as separator and appends one final one. Call pa_xfree() on the
+ * result. \since 0.9.11 */
+char *pa_proplist_to_string(pa_proplist *p);
+
+/** Format the property list nicely as a human readable string and
+ * choose the separator. Call pa_xfree() on the result. \since
+ * 0.9.15 */
+char *pa_proplist_to_string_sep(pa_proplist *p, const char *sep);
+
+/** Allocate a new property list and assign key/value from a human
+ * readable string. \since 0.9.15 */
+pa_proplist *pa_proplist_from_string(const char *str);
+
+/** Returns 1 if an entry for the specified key exists in the
+ * property list. \since 0.9.11 */
+int pa_proplist_contains(pa_proplist *p, const char *key);
+
+/** Remove all entries from the property list object. \since 0.9.11 */
+void pa_proplist_clear(pa_proplist *p);
+
+/** Allocate a new property list and copy over every single entry from
+ * the specified list. \since 0.9.11 */
+pa_proplist* pa_proplist_copy(const pa_proplist *p);
+
+/** Return the number of entries in the property list. \since 0.9.15 */
+unsigned pa_proplist_size(pa_proplist *p);
+
+/** Returns 0 when the proplist is empty, positive otherwise \since 0.9.15 */
+int pa_proplist_isempty(pa_proplist *p);
+
+/** Return non-zero when a and b have the same keys and values.
+ * \since 0.9.16 */
+int pa_proplist_equal(pa_proplist *a, pa_proplist *b);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/pulseaudio.h b/thirdparty/linuxbsd_headers/pulse/pulseaudio.h
new file mode 100644
index 0000000000..063d5e230f
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/pulseaudio.h
@@ -0,0 +1,180 @@
+#ifndef foopulseaudiohfoo
+#define foopulseaudiohfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ PulseAudio 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 PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/direction.h>
+#include <pulse/mainloop-api.h>
+#include <pulse/sample.h>
+#include <pulse/format.h>
+#include <pulse/def.h>
+#include <pulse/context.h>
+#include <pulse/stream.h>
+#include <pulse/introspect.h>
+#include <pulse/subscribe.h>
+#include <pulse/scache.h>
+#include <pulse/version.h>
+#include <pulse/error.h>
+#include <pulse/operation.h>
+#include <pulse/channelmap.h>
+#include <pulse/volume.h>
+#include <pulse/xmalloc.h>
+#include <pulse/utf8.h>
+#include <pulse/thread-mainloop.h>
+#include <pulse/mainloop.h>
+#include <pulse/mainloop-signal.h>
+#include <pulse/util.h>
+#include <pulse/timeval.h>
+#include <pulse/proplist.h>
+#include <pulse/rtclock.h>
+
+/** \file
+ * Include all libpulse header files at once. The following files are
+ * included: \ref direction.h, \ref mainloop-api.h, \ref sample.h, \ref def.h,
+ * \ref context.h, \ref stream.h, \ref introspect.h, \ref subscribe.h, \ref
+ * scache.h, \ref version.h, \ref error.h, \ref channelmap.h, \ref
+ * operation.h,\ref volume.h, \ref xmalloc.h, \ref utf8.h, \ref
+ * thread-mainloop.h, \ref mainloop.h, \ref util.h, \ref proplist.h,
+ * \ref timeval.h, \ref rtclock.h and \ref mainloop-signal.h at
+ * once */
+
+/** \mainpage
+ *
+ * \section intro_sec Introduction
+ *
+ * This document describes the client API for the PulseAudio sound
+ * server. The API comes in two flavours to accommodate different styles
+ * of applications and different needs in complexity:
+ *
+ * \li The complete but somewhat complicated to use asynchronous API
+ * \li The simplified, easy to use, but limited synchronous API
+ *
+ * All strings in PulseAudio are in the UTF-8 encoding, regardless of current
+ * locale. Some functions will filter invalid sequences from the string, some
+ * will simply fail. To ensure reliable behaviour, make sure everything you
+ * pass to the API is already in UTF-8.
+
+ * \section simple_sec Simple API
+ *
+ * Use this if you develop your program in synchronous style and just
+ * need a way to play or record data on the sound server. See
+ * \subpage simple for more details.
+ *
+ * \section async_sec Asynchronous API
+ *
+ * Use this if you develop your programs in asynchronous, event loop
+ * based style or if you want to use the advanced features of the
+ * PulseAudio API. A guide can be found in \subpage async.
+ *
+ * By using the built-in threaded main loop, it is possible to achieve a
+ * pseudo-synchronous API, which can be useful in synchronous applications
+ * where the simple API is insufficient. See the \ref async page for
+ * details.
+ *
+ * \section thread_sec Threads
+ *
+ * The PulseAudio client libraries are not designed to be directly
+ * thread-safe. They are however designed to be reentrant and
+ * threads-aware.
+ *
+ * To use the libraries in a threaded environment, you must assure that
+ * all objects are only used in one thread at a time. Normally, this means
+ * that all objects belonging to a single context must be accessed from the
+ * same thread.
+ *
+ * The included main loop implementation is also not thread safe. Take care
+ * to make sure event objects are not manipulated when any other code is
+ * using the main loop.
+ *
+ * \section error_sec Error Handling
+ *
+ * Every function should explicitly document how errors are reported to
+ * the caller. Unfortunately, currently a lot of that documentation is
+ * missing. Here is an overview of the general conventions used.
+ *
+ * The PulseAudio API indicates error conditions by returning a negative
+ * integer value or a NULL pointer. On success, zero or a positive integer
+ * value or a valid pointer is returned.
+ *
+ * Functions of the \ref simple generally return -1 or NULL on failure and
+ * can optionally store an error code (see ::pa_error_code) using a pointer
+ * argument.
+ *
+ * Functions of the \ref async return an negative error code or NULL on
+ * failure (see ::pa_error_code). In the later case, pa_context_errno()
+ * can be used to obtain the error code of the last failed operation.
+ *
+ * An error code can be turned into a human readable message using
+ * pa_strerror().
+ *
+ * \section logging_sec Logging
+ *
+ * You can configure different logging parameters for the PulseAudio client
+ * libraries. The following environment variables are recognized:
+ *
+ * - `PULSE_LOG`: Maximum log level required. Bigger values result in a
+ * more verbose logging output. The following values are recognized:
+ * + `0`: Error messages
+ * + `1`: Warning messages
+ * + `2`: Notice messages
+ * + `3`: Info messages
+ * + `4`: Debug messages
+ * - `PULSE_LOG_SYSLOG`: If defined, force all client libraries to log
+ * their output using the syslog(3) mechanism. Default behavior is to
+ * log all output to stderr.
+ * - `PULSE_LOG_JOURNAL`: If defined, force all client libraries to log
+ * their output using the systemd journal. If both `PULSE_LOG_JOURNAL`
+ * and `PULSE_LOG_SYSLOG` are defined, logging to the systemd journal
+ * takes a higher precedence. Each message originating library file name
+ * and function are included by default through the journal fields
+ * `CODE_FILE`, `CODE_FUNC`, and `CODE_LINE`. Any backtrace attached to
+ * the logging message is sent through the PulseAudio-specific journal
+ * field `PULSE_BACKTRACE`. This environment variable has no effect if
+ * PulseAudio was compiled without systemd journal support.
+ * - `PULSE_LOG_COLORS`: If defined, enables colored logging output.
+ * - `PULSE_LOG_TIME`: If defined, include timestamps with each message.
+ * - `PULSE_LOG_FILE`: If defined, include each message originating file
+ * name.
+ * - `PULSE_LOG_META`: If defined, include each message originating file
+ * name and path relative to the PulseAudio source tree root.
+ * - `PULSE_LOG_LEVEL`: If defined, include a log level prefix with each
+ * message. Respectively, the prefixes "E", "W", "N", "I", "D" stands
+ * for Error, Warning, Notice, Info, and Debugging.
+ * - `PULSE_LOG_BACKTRACE`: Number of functions to display in the backtrace.
+ * If this variable is not defined, or has a value of zero, no backtrace
+ * is shown.
+ * - `PULSE_LOG_BACKTRACE_SKIP`: Number of backtrace levels to skip, from
+ * the function printing the log message downwards.
+ * - `PULSE_LOG_NO_RATE_LIMIT`: If defined, do not rate limit the logging
+ * output. Rate limiting skips certain log messages when their frequency
+ * is considered too high.
+ *
+ * \section pkgconfig pkg-config
+ *
+ * The PulseAudio libraries provide pkg-config snippets for the different
+ * modules:
+ *
+ * \li libpulse - The asynchronous API and the internal main loop implementation.
+ * \li libpulse-mainloop-glib - GLIB 2.x main loop bindings.
+ * \li libpulse-simple - The simple PulseAudio API.
+ */
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/rtclock.h b/thirdparty/linuxbsd_headers/pulse/rtclock.h
new file mode 100644
index 0000000000..da65076464
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/rtclock.h
@@ -0,0 +1,38 @@
+#ifndef foortclockfoo
+#define foortclockfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2009 Lennart Poettering
+
+ PulseAudio 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; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ PulseAudio 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 PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/cdecl.h>
+#include <pulse/sample.h>
+
+/** \file
+ * Monotonic clock utilities. */
+
+PA_C_DECL_BEGIN
+
+/** Return the current monotonic system time in usec, if such a clock
+ * is available. If it is not available this will return the
+ * wallclock time instead. \since 0.9.16 */
+pa_usec_t pa_rtclock_now(void);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/sample.h b/thirdparty/linuxbsd_headers/pulse/sample.h
new file mode 100644
index 0000000000..4299eecff1
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/sample.h
@@ -0,0 +1,354 @@
+#ifndef foosamplehfoo
+#define foosamplehfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <inttypes.h>
+#include <sys/types.h>
+#include <sys/param.h>
+
+#include <pulse/gccmacro.h>
+#include <pulse/cdecl.h>
+#include <pulse/version.h>
+
+/** \page sample Sample Format Specifications
+ *
+ * \section overv_sec Overview
+ *
+ * PulseAudio is capable of handling a multitude of sample formats, rates
+ * and channels, transparently converting and mixing them as needed.
+ *
+ * \section format_sec Sample Format
+ *
+ * PulseAudio supports the following sample formats:
+ *
+ * \li PA_SAMPLE_U8 - Unsigned 8 bit integer PCM.
+ * \li PA_SAMPLE_S16LE - Signed 16 integer bit PCM, little endian.
+ * \li PA_SAMPLE_S16BE - Signed 16 integer bit PCM, big endian.
+ * \li PA_SAMPLE_FLOAT32LE - 32 bit IEEE floating point PCM, little endian.
+ * \li PA_SAMPLE_FLOAT32BE - 32 bit IEEE floating point PCM, big endian.
+ * \li PA_SAMPLE_ALAW - 8 bit a-Law.
+ * \li PA_SAMPLE_ULAW - 8 bit mu-Law.
+ * \li PA_SAMPLE_S32LE - Signed 32 bit integer PCM, little endian.
+ * \li PA_SAMPLE_S32BE - Signed 32 bit integer PCM, big endian.
+ * \li PA_SAMPLE_S24LE - Signed 24 bit integer PCM packed, little endian.
+ * \li PA_SAMPLE_S24BE - Signed 24 bit integer PCM packed, big endian.
+ * \li PA_SAMPLE_S24_32LE - Signed 24 bit integer PCM in LSB of 32 bit words, little endian.
+ * \li PA_SAMPLE_S24_32BE - Signed 24 bit integer PCM in LSB of 32 bit words, big endian.
+ *
+ * The floating point sample formats have the range from -1.0 to 1.0.
+ *
+ * The sample formats that are sensitive to endianness have convenience
+ * macros for native endian (NE), and reverse endian (RE).
+ *
+ * \section rate_sec Sample Rates
+ *
+ * PulseAudio supports any sample rate between 1 Hz and 192000 Hz. There is no
+ * point trying to exceed the sample rate of the output device though as the
+ * signal will only get downsampled, consuming CPU on the machine running the
+ * server.
+ *
+ * \section chan_sec Channels
+ *
+ * PulseAudio supports up to 32 individual channels. The order of the
+ * channels is up to the application, but they must be continuous. To map
+ * channels to speakers, see \ref channelmap.
+ *
+ * \section calc_sec Calculations
+ *
+ * The PulseAudio library contains a number of convenience functions to do
+ * calculations on sample formats:
+ *
+ * \li pa_bytes_per_second() - The number of bytes one second of audio will
+ * take given a sample format.
+ * \li pa_frame_size() - The size, in bytes, of one frame (i.e. one set of
+ * samples, one for each channel).
+ * \li pa_sample_size() - The size, in bytes, of one sample.
+ * \li pa_bytes_to_usec() - Calculate the time it would take to play a buffer
+ * of a certain size.
+ *
+ * \section util_sec Convenience Functions
+ *
+ * The library also contains a couple of other convenience functions:
+ *
+ * \li pa_sample_spec_valid() - Tests if a sample format specification is
+ * valid.
+ * \li pa_sample_spec_equal() - Tests if the sample format specifications are
+ * identical.
+ * \li pa_sample_format_to_string() - Return a textual description of a
+ * sample format.
+ * \li pa_parse_sample_format() - Parse a text string into a sample format.
+ * \li pa_sample_spec_snprint() - Create a textual description of a complete
+ * sample format specification.
+ * \li pa_bytes_snprint() - Pretty print a byte value (e.g. 2.5 MiB).
+ */
+
+/** \file
+ * Constants and routines for sample type handling
+ *
+ * See also \subpage sample
+ */
+
+PA_C_DECL_BEGIN
+
+#if !defined(WORDS_BIGENDIAN)
+
+#if defined(__BYTE_ORDER)
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define WORDS_BIGENDIAN
+#endif
+#endif
+
+/* On Sparc, WORDS_BIGENDIAN needs to be set if _BIG_ENDIAN is defined. */
+#if defined(__sparc__) && defined(_BIG_ENDIAN)
+#define WORDS_BIGENDIAN
+#endif
+
+#endif
+
+/** Maximum number of allowed channels */
+#define PA_CHANNELS_MAX 32U
+
+/** Maximum allowed sample rate */
+#define PA_RATE_MAX (48000U*8U)
+
+/** Sample format */
+typedef enum pa_sample_format {
+ PA_SAMPLE_U8,
+ /**< Unsigned 8 Bit PCM */
+
+ PA_SAMPLE_ALAW,
+ /**< 8 Bit a-Law */
+
+ PA_SAMPLE_ULAW,
+ /**< 8 Bit mu-Law */
+
+ PA_SAMPLE_S16LE,
+ /**< Signed 16 Bit PCM, little endian (PC) */
+
+ PA_SAMPLE_S16BE,
+ /**< Signed 16 Bit PCM, big endian */
+
+ PA_SAMPLE_FLOAT32LE,
+ /**< 32 Bit IEEE floating point, little endian (PC), range -1.0 to 1.0 */
+
+ PA_SAMPLE_FLOAT32BE,
+ /**< 32 Bit IEEE floating point, big endian, range -1.0 to 1.0 */
+
+ PA_SAMPLE_S32LE,
+ /**< Signed 32 Bit PCM, little endian (PC) */
+
+ PA_SAMPLE_S32BE,
+ /**< Signed 32 Bit PCM, big endian */
+
+ PA_SAMPLE_S24LE,
+ /**< Signed 24 Bit PCM packed, little endian (PC). \since 0.9.15 */
+
+ PA_SAMPLE_S24BE,
+ /**< Signed 24 Bit PCM packed, big endian. \since 0.9.15 */
+
+ PA_SAMPLE_S24_32LE,
+ /**< Signed 24 Bit PCM in LSB of 32 Bit words, little endian (PC). \since 0.9.15 */
+
+ PA_SAMPLE_S24_32BE,
+ /**< Signed 24 Bit PCM in LSB of 32 Bit words, big endian. \since 0.9.15 */
+
+ PA_SAMPLE_MAX,
+ /**< Upper limit of valid sample types */
+
+ PA_SAMPLE_INVALID = -1
+ /**< An invalid value */
+} pa_sample_format_t;
+
+#ifdef WORDS_BIGENDIAN
+/** Signed 16 Bit PCM, native endian */
+#define PA_SAMPLE_S16NE PA_SAMPLE_S16BE
+/** 32 Bit IEEE floating point, native endian */
+#define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32BE
+/** Signed 32 Bit PCM, native endian */
+#define PA_SAMPLE_S32NE PA_SAMPLE_S32BE
+/** Signed 24 Bit PCM packed, native endian. \since 0.9.15 */
+#define PA_SAMPLE_S24NE PA_SAMPLE_S24BE
+/** Signed 24 Bit PCM in LSB of 32 Bit words, native endian. \since 0.9.15 */
+#define PA_SAMPLE_S24_32NE PA_SAMPLE_S24_32BE
+
+/** Signed 16 Bit PCM reverse endian */
+#define PA_SAMPLE_S16RE PA_SAMPLE_S16LE
+/** 32 Bit IEEE floating point, reverse endian */
+#define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32LE
+/** Signed 32 Bit PCM, reverse endian */
+#define PA_SAMPLE_S32RE PA_SAMPLE_S32LE
+/** Signed 24 Bit PCM, packed reverse endian. \since 0.9.15 */
+#define PA_SAMPLE_S24RE PA_SAMPLE_S24LE
+/** Signed 24 Bit PCM, in LSB of 32 Bit words, reverse endian. \since 0.9.15 */
+#define PA_SAMPLE_S24_32RE PA_SAMPLE_S24_32LE
+#else
+/** Signed 16 Bit PCM, native endian */
+#define PA_SAMPLE_S16NE PA_SAMPLE_S16LE
+/** 32 Bit IEEE floating point, native endian */
+#define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32LE
+/** Signed 32 Bit PCM, native endian */
+#define PA_SAMPLE_S32NE PA_SAMPLE_S32LE
+/** Signed 24 Bit PCM packed, native endian. \since 0.9.15 */
+#define PA_SAMPLE_S24NE PA_SAMPLE_S24LE
+/** Signed 24 Bit PCM in LSB of 32 Bit words, native endian. \since 0.9.15 */
+#define PA_SAMPLE_S24_32NE PA_SAMPLE_S24_32LE
+
+/** Signed 16 Bit PCM, reverse endian */
+#define PA_SAMPLE_S16RE PA_SAMPLE_S16BE
+/** 32 Bit IEEE floating point, reverse endian */
+#define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32BE
+/** Signed 32 Bit PCM, reverse endian */
+#define PA_SAMPLE_S32RE PA_SAMPLE_S32BE
+/** Signed 24 Bit PCM, packed reverse endian. \since 0.9.15 */
+#define PA_SAMPLE_S24RE PA_SAMPLE_S24BE
+/** Signed 24 Bit PCM, in LSB of 32 Bit words, reverse endian. \since 0.9.15 */
+#define PA_SAMPLE_S24_32RE PA_SAMPLE_S24_32BE
+#endif
+
+/** A Shortcut for PA_SAMPLE_FLOAT32NE */
+#define PA_SAMPLE_FLOAT32 PA_SAMPLE_FLOAT32NE
+
+/** \cond fulldocs */
+/* Allow clients to check with #ifdef for these sample formats */
+#define PA_SAMPLE_U8 PA_SAMPLE_U8
+#define PA_SAMPLE_ALAW PA_SAMPLE_ALAW
+#define PA_SAMPLE_ULAW PA_SAMPLE_ULAW
+#define PA_SAMPLE_S16LE PA_SAMPLE_S16LE
+#define PA_SAMPLE_S16BE PA_SAMPLE_S16BE
+#define PA_SAMPLE_FLOAT32LE PA_SAMPLE_FLOAT32LE
+#define PA_SAMPLE_FLOAT32BE PA_SAMPLE_FLOAT32BE
+#define PA_SAMPLE_S32LE PA_SAMPLE_S32LE
+#define PA_SAMPLE_S32BE PA_SAMPLE_S32BE
+#define PA_SAMPLE_S24LE PA_SAMPLE_S24LE
+#define PA_SAMPLE_S24BE PA_SAMPLE_S24BE
+#define PA_SAMPLE_S24_32LE PA_SAMPLE_S24_32LE
+#define PA_SAMPLE_S24_32BE PA_SAMPLE_S24_32BE
+/** \endcond */
+
+/** A sample format and attribute specification */
+typedef struct pa_sample_spec {
+ pa_sample_format_t format;
+ /**< The sample format */
+
+ uint32_t rate;
+ /**< The sample rate. (e.g. 44100) */
+
+ uint8_t channels;
+ /**< Audio channels. (1 for mono, 2 for stereo, ...) */
+} pa_sample_spec;
+
+/** Type for usec specifications (unsigned). Always 64 bit. */
+typedef uint64_t pa_usec_t;
+
+/** Return the amount of bytes playback of a second of audio with the specified sample type takes */
+size_t pa_bytes_per_second(const pa_sample_spec *spec) PA_GCC_PURE;
+
+/** Return the size of a frame with the specific sample type */
+size_t pa_frame_size(const pa_sample_spec *spec) PA_GCC_PURE;
+
+/** Return the size of a sample with the specific sample type */
+size_t pa_sample_size(const pa_sample_spec *spec) PA_GCC_PURE;
+
+/** Similar to pa_sample_size() but take a sample format instead of a
+ * full sample spec. \since 0.9.15 */
+size_t pa_sample_size_of_format(pa_sample_format_t f) PA_GCC_PURE;
+
+/** Calculate the time the specified bytes take to play with the
+ * specified sample type. The return value will always be rounded
+ * down for non-integral return values. */
+pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec) PA_GCC_PURE;
+
+/** Calculates the number of bytes that are required for the specified
+ * time. The return value will always be rounded down for non-integral
+ * return values. \since 0.9 */
+size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec) PA_GCC_PURE;
+
+/** Initialize the specified sample spec and return a pointer to
+ * it. The sample spec will have a defined state but
+ * pa_sample_spec_valid() will fail for it. \since 0.9.13 */
+pa_sample_spec* pa_sample_spec_init(pa_sample_spec *spec);
+
+/** Return non-zero if the given integer is a valid sample format. \since 5.0 */
+int pa_sample_format_valid(unsigned format) PA_GCC_PURE;
+
+/** Return non-zero if the rate is within the supported range. \since 5.0 */
+int pa_sample_rate_valid(uint32_t rate) PA_GCC_PURE;
+
+/** Return non-zero if the channel count is within the supported range.
+ * \since 5.0 */
+int pa_channels_valid(uint8_t channels) PA_GCC_PURE;
+
+/** Return non-zero when the sample type specification is valid */
+int pa_sample_spec_valid(const pa_sample_spec *spec) PA_GCC_PURE;
+
+/** Return non-zero when the two sample type specifications match */
+int pa_sample_spec_equal(const pa_sample_spec*a, const pa_sample_spec*b) PA_GCC_PURE;
+
+/** Return a descriptive string for the specified sample format. \since 0.8 */
+const char *pa_sample_format_to_string(pa_sample_format_t f) PA_GCC_PURE;
+
+/** Parse a sample format text. Inverse of pa_sample_format_to_string() */
+pa_sample_format_t pa_parse_sample_format(const char *format) PA_GCC_PURE;
+
+/** Maximum required string length for
+ * pa_sample_spec_snprint(). Please note that this value can change
+ * with any release without warning and without being considered API
+ * or ABI breakage. You should not use this definition anywhere where
+ * it might become part of an ABI. */
+#define PA_SAMPLE_SPEC_SNPRINT_MAX 32
+
+/** Pretty print a sample type specification to a string */
+char* pa_sample_spec_snprint(char *s, size_t l, const pa_sample_spec *spec);
+
+/** Maximum required string length for pa_bytes_snprint(). Please note
+ * that this value can change with any release without warning and
+ * without being considered API or ABI breakage. You should not use
+ * this definition anywhere where it might become part of an
+ * ABI. \since 0.9.16 */
+#define PA_BYTES_SNPRINT_MAX 11
+
+/** Pretty print a byte size value (i.e.\ "2.5 MiB") */
+char* pa_bytes_snprint(char *s, size_t l, unsigned v);
+
+/** Return 1 when the specified format is little endian, return -1
+ * when endianness does not apply to this format. \since 0.9.16 */
+int pa_sample_format_is_le(pa_sample_format_t f) PA_GCC_PURE;
+
+/** Return 1 when the specified format is big endian, return -1 when
+ * endianness does not apply to this format. \since 0.9.16 */
+int pa_sample_format_is_be(pa_sample_format_t f) PA_GCC_PURE;
+
+#ifdef WORDS_BIGENDIAN
+#define pa_sample_format_is_ne(f) pa_sample_format_is_be(f)
+#define pa_sample_format_is_re(f) pa_sample_format_is_le(f)
+#else
+/** Return 1 when the specified format is native endian, return -1
+ * when endianness does not apply to this format. \since 0.9.16 */
+#define pa_sample_format_is_ne(f) pa_sample_format_is_le(f)
+/** Return 1 when the specified format is reverse endian, return -1
+ * when endianness does not apply to this format. \since 0.9.16 */
+#define pa_sample_format_is_re(f) pa_sample_format_is_be(f)
+#endif
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/scache.h b/thirdparty/linuxbsd_headers/pulse/scache.h
new file mode 100644
index 0000000000..e799b1d140
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/scache.h
@@ -0,0 +1,124 @@
+#ifndef fooscachehfoo
+#define fooscachehfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <sys/types.h>
+
+#include <pulse/context.h>
+#include <pulse/stream.h>
+#include <pulse/cdecl.h>
+#include <pulse/version.h>
+
+/** \page scache Sample Cache
+ *
+ * \section overv_sec Overview
+ *
+ * The sample cache provides a simple way of overcoming high network latencies
+ * and reducing bandwidth. Instead of streaming a sound precisely when it
+ * should be played, it is stored on the server and only the command to start
+ * playing it needs to be sent.
+ *
+ * \section create_sec Creation
+ *
+ * To create a sample, the normal stream API is used (see \ref streams). The
+ * function pa_stream_connect_upload() will make sure the stream is stored as
+ * a sample on the server.
+ *
+ * To complete the upload, pa_stream_finish_upload() is called and the sample
+ * will receive the same name as the stream. If the upload should be aborted,
+ * simply call pa_stream_disconnect().
+ *
+ * \section play_sec Playing samples
+ *
+ * To play back a sample, simply call pa_context_play_sample():
+ *
+ * \code
+ * pa_operation *o;
+ *
+ * o = pa_context_play_sample(my_context,
+ * "sample2", // Name of my sample
+ * NULL, // Use default sink
+ * PA_VOLUME_NORM, // Full volume
+ * NULL, // Don't need a callback
+ * NULL
+ * );
+ * if (o)
+ * pa_operation_unref(o);
+ * \endcode
+ *
+ * \section rem_sec Removing samples
+ *
+ * When a sample is no longer needed, it should be removed on the server to
+ * save resources. The sample is deleted using pa_context_remove_sample().
+ */
+
+/** \file
+ * All sample cache related routines
+ *
+ * See also \subpage scache
+ */
+
+PA_C_DECL_BEGIN
+
+/** Callback prototype for pa_context_play_sample_with_proplist(). The
+ * idx value is the index of the sink input object, or
+ * PA_INVALID_INDEX on failure. \since 0.9.11 */
+typedef void (*pa_context_play_sample_cb_t)(pa_context *c, uint32_t idx, void *userdata);
+
+/** Make this stream a sample upload stream */
+int pa_stream_connect_upload(pa_stream *s, size_t length);
+
+/** Finish the sample upload, the stream name will become the sample
+ * name. You cancel a sample upload by issuing
+ * pa_stream_disconnect() */
+int pa_stream_finish_upload(pa_stream *s);
+
+/** Remove a sample from the sample cache. Returns an operation object which may be used to cancel the operation while it is running */
+pa_operation* pa_context_remove_sample(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata);
+
+/** Play a sample from the sample cache to the specified device. If
+ * the latter is NULL use the default sink. Returns an operation
+ * object */
+pa_operation* pa_context_play_sample(
+ pa_context *c /**< Context */,
+ const char *name /**< Name of the sample to play */,
+ const char *dev /**< Sink to play this sample on */,
+ pa_volume_t volume /**< Volume to play this sample with. Starting with 0.9.15 you may pass here PA_VOLUME_INVALID which will leave the decision about the volume to the server side which is a good idea. */ ,
+ pa_context_success_cb_t cb /**< Call this function after successfully starting playback, or NULL */,
+ void *userdata /**< Userdata to pass to the callback */);
+
+/** Play a sample from the sample cache to the specified device,
+ * allowing specification of a property list for the playback
+ * stream. If the latter is NULL use the default sink. Returns an
+ * operation object. \since 0.9.11 */
+pa_operation* pa_context_play_sample_with_proplist(
+ pa_context *c /**< Context */,
+ const char *name /**< Name of the sample to play */,
+ const char *dev /**< Sink to play this sample on */,
+ pa_volume_t volume /**< Volume to play this sample with. Starting with 0.9.15 you may pass here PA_VOLUME_INVALID which will leave the decision about the volume to the server side which is a good idea. */ ,
+ pa_proplist *proplist /**< Property list for this sound. The property list of the cached entry will be merged into this property list */,
+ pa_context_play_sample_cb_t cb /**< Call this function after successfully starting playback, or NULL */,
+ void *userdata /**< Userdata to pass to the callback */);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/simple.h b/thirdparty/linuxbsd_headers/pulse/simple.h
new file mode 100644
index 0000000000..7b84f71b55
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/simple.h
@@ -0,0 +1,159 @@
+#ifndef foosimplehfoo
+#define foosimplehfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <sys/types.h>
+
+#include <pulse/sample.h>
+#include <pulse/channelmap.h>
+#include <pulse/def.h>
+#include <pulse/cdecl.h>
+#include <pulse/version.h>
+
+/** \page simple Simple API
+ *
+ * \section overv_sec Overview
+ *
+ * The simple API is designed for applications with very basic sound
+ * playback or capture needs. It can only support a single stream per
+ * connection and has no support for handling of complex features like
+ * events, channel mappings and volume control. It is, however, very simple
+ * to use and quite sufficient for many programs.
+ *
+ * \section conn_sec Connecting
+ *
+ * The first step before using the sound system is to connect to the
+ * server. This is normally done this way:
+ *
+ * \code
+ * pa_simple *s;
+ * pa_sample_spec ss;
+ *
+ * ss.format = PA_SAMPLE_S16NE;
+ * ss.channels = 2;
+ * ss.rate = 44100;
+ *
+ * s = pa_simple_new(NULL, // Use the default server.
+ * "Fooapp", // Our application's name.
+ * PA_STREAM_PLAYBACK,
+ * NULL, // Use the default device.
+ * "Music", // Description of our stream.
+ * &ss, // Our sample format.
+ * NULL, // Use default channel map
+ * NULL, // Use default buffering attributes.
+ * NULL, // Ignore error code.
+ * );
+ * \endcode
+ *
+ * At this point a connected object is returned, or NULL if there was a
+ * problem connecting.
+ *
+ * \section transfer_sec Transferring data
+ *
+ * Once the connection is established to the server, data can start flowing.
+ * Using the connection is very similar to the normal read() and write()
+ * system calls. The main difference is that they're called pa_simple_read()
+ * and pa_simple_write(). Note that these operations always block.
+ *
+ * \section ctrl_sec Buffer control
+ *
+ * \li pa_simple_get_latency() - Will return the total latency of
+ * the playback or record pipeline, respectively.
+ * \li pa_simple_flush() - Will throw away all data currently in buffers.
+ *
+ * If a playback stream is used then the following operation is available:
+ *
+ * \li pa_simple_drain() - Will wait for all sent data to finish playing.
+ *
+ * \section cleanup_sec Cleanup
+ *
+ * Once playback or capture is complete, the connection should be closed
+ * and resources freed. This is done through:
+ *
+ * \code
+ * pa_simple_free(s);
+ * \endcode
+ */
+
+/** \file
+ * A simple but limited synchronous playback and recording
+ * API. This is a synchronous, simplified wrapper around the standard
+ * asynchronous API.
+ *
+ * See also \subpage simple
+ */
+
+/** \example pacat-simple.c
+ * A simple playback tool using the simple API */
+
+/** \example parec-simple.c
+ * A simple recording tool using the simple API */
+
+PA_C_DECL_BEGIN
+
+/** \struct pa_simple
+ * An opaque simple connection object */
+typedef struct pa_simple pa_simple;
+
+/** Create a new connection to the server. */
+pa_simple* pa_simple_new(
+ const char *server, /**< Server name, or NULL for default */
+ const char *name, /**< A descriptive name for this client (application name, ...) */
+ pa_stream_direction_t dir, /**< Open this stream for recording or playback? */
+ const char *dev, /**< Sink (resp. source) name, or NULL for default */
+ const char *stream_name, /**< A descriptive name for this stream (application name, song title, ...) */
+ const pa_sample_spec *ss, /**< The sample type to use */
+ const pa_channel_map *map, /**< The channel map to use, or NULL for default */
+ const pa_buffer_attr *attr, /**< Buffering attributes, or NULL for default */
+ int *error /**< A pointer where the error code is stored when the routine returns NULL. It is OK to pass NULL here. */
+ );
+
+/** Close and free the connection to the server. The connection object becomes invalid when this is called. */
+void pa_simple_free(pa_simple *s);
+
+/** Write some data to the server. */
+int pa_simple_write(pa_simple *s, const void *data, size_t bytes, int *error);
+
+/** Wait until all data already written is played by the daemon. */
+int pa_simple_drain(pa_simple *s, int *error);
+
+/** Read some data from the server. This function blocks until \a bytes amount
+ * of data has been received from the server, or until an error occurs.
+ * Returns a negative value on failure. */
+int pa_simple_read(
+ pa_simple *s, /**< The connection object. */
+ void *data, /**< A pointer to a buffer. */
+ size_t bytes, /**< The number of bytes to read. */
+ int *error
+ /**< A pointer where the error code is stored when the function returns
+ * a negative value. It is OK to pass NULL here. */
+ );
+
+/** Return the playback or record latency. */
+pa_usec_t pa_simple_get_latency(pa_simple *s, int *error);
+
+/** Flush the playback or record buffer. This discards any audio in the buffer. */
+int pa_simple_flush(pa_simple *s, int *error);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/stream.h b/thirdparty/linuxbsd_headers/pulse/stream.h
new file mode 100644
index 0000000000..5dfdee1a02
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/stream.h
@@ -0,0 +1,831 @@
+#ifndef foostreamhfoo
+#define foostreamhfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <sys/types.h>
+
+#include <pulse/sample.h>
+#include <pulse/format.h>
+#include <pulse/channelmap.h>
+#include <pulse/volume.h>
+#include <pulse/def.h>
+#include <pulse/cdecl.h>
+#include <pulse/operation.h>
+#include <pulse/context.h>
+#include <pulse/proplist.h>
+
+/** \page streams Audio Streams
+ *
+ * \section overv_sec Overview
+ *
+ * Audio streams form the central functionality of the sound server. Data is
+ * routed, converted and mixed from several sources before it is passed along
+ * to a final output. Currently, there are three forms of audio streams:
+ *
+ * \li Playback streams - Data flows from the client to the server.
+ * \li Record streams - Data flows from the server to the client.
+ * \li Upload streams - Similar to playback streams, but the data is stored in
+ * the sample cache. See \ref scache for more information
+ * about controlling the sample cache.
+ *
+ * \section create_sec Creating
+ *
+ * To access a stream, a pa_stream object must be created using
+ * pa_stream_new() or pa_stream_new_extended(). pa_stream_new() is for PCM
+ * streams only, while pa_stream_new_extended() can be used for both PCM and
+ * compressed audio streams. At this point the application must specify what
+ * stream format(s) it supports. See \ref sample and \ref channelmap for more
+ * information on the stream format parameters. FIXME: Those references only
+ * talk about PCM parameters, we should also have an overview page for how the
+ * pa_format_info based stream format configuration works. Bug filed:
+ * https://bugs.freedesktop.org/show_bug.cgi?id=72265
+ *
+ * This first step will only create a client-side object, representing the
+ * stream. To use the stream, a server-side object must be created and
+ * associated with the local object. Depending on which type of stream is
+ * desired, a different function is needed:
+ *
+ * \li Playback stream - pa_stream_connect_playback()
+ * \li Record stream - pa_stream_connect_record()
+ * \li Upload stream - pa_stream_connect_upload() (see \ref scache)
+ *
+ * Similar to how connections are done in contexts, connecting a stream will
+ * not generate a pa_operation object. Also like contexts, the application
+ * should register a state change callback, using
+ * pa_stream_set_state_callback(), and wait for the stream to enter an active
+ * state.
+ *
+ * Note: there is a user-controllable slider in mixer applications such as
+ * pavucontrol corresponding to each of the created streams. Multiple
+ * (especially identically named) volume sliders for the same application might
+ * confuse the user. Also, the server supports only a limited number of
+ * simultaneous streams. Because of this, it is not always appropriate to
+ * create multiple streams in one application that needs to output multiple
+ * sounds. The rough guideline is: if there is no use case that would require
+ * separate user-initiated volume changes for each stream, perform the mixing
+ * inside the application.
+ *
+ * \subsection bufattr_subsec Buffer Attributes
+ *
+ * Playback and record streams always have a server-side buffer as
+ * part of the data flow. The size of this buffer needs to be chosen
+ * in a compromise between low latency and sensitivity for buffer
+ * overflows/underruns.
+ *
+ * The buffer metrics may be controlled by the application. They are
+ * described with a pa_buffer_attr structure which contains a number
+ * of fields:
+ *
+ * \li maxlength - The absolute maximum number of bytes that can be
+ * stored in the buffer. If this value is exceeded
+ * then data will be lost. It is recommended to pass
+ * (uint32_t) -1 here which will cause the server to
+ * fill in the maximum possible value.
+ *
+ * \li tlength - The target fill level of the playback buffer. The
+ * server will only send requests for more data as long
+ * as the buffer has less than this number of bytes of
+ * data. If you pass (uint32_t) -1 (which is
+ * recommended) here the server will choose the longest
+ * target buffer fill level possible to minimize the
+ * number of necessary wakeups and maximize drop-out
+ * safety. This can exceed 2s of buffering. For
+ * low-latency applications or applications where
+ * latency matters you should pass a proper value here.
+ *
+ * \li prebuf - Number of bytes that need to be in the buffer before
+ * playback will commence. Start of playback can be
+ * forced using pa_stream_trigger() even though the
+ * prebuffer size hasn't been reached. If a buffer
+ * underrun occurs, this prebuffering will be again
+ * enabled. If the playback shall never stop in case of a
+ * buffer underrun, this value should be set to 0. In
+ * that case the read index of the output buffer
+ * overtakes the write index, and hence the fill level of
+ * the buffer is negative. If you pass (uint32_t) -1 here
+ * (which is recommended) the server will choose the same
+ * value as tlength here.
+ *
+ * \li minreq - Minimum number of free bytes in the playback
+ * buffer before the server will request more data. It is
+ * recommended to fill in (uint32_t) -1 here. This value
+ * influences how much time the sound server has to move
+ * data from the per-stream server-side playback buffer
+ * to the hardware playback buffer.
+ *
+ * \li fragsize - Maximum number of bytes that the server will push in
+ * one chunk for record streams. If you pass (uint32_t)
+ * -1 (which is recommended) here, the server will
+ * choose the longest fragment setting possible to
+ * minimize the number of necessary wakeups and
+ * maximize drop-out safety. This can exceed 2s of
+ * buffering. For low-latency applications or
+ * applications where latency matters you should pass a
+ * proper value here.
+ *
+ * If PA_STREAM_ADJUST_LATENCY is set, then the tlength/fragsize
+ * parameters will be interpreted slightly differently than described
+ * above when passed to pa_stream_connect_record() and
+ * pa_stream_connect_playback(): the overall latency that is comprised
+ * of both the server side playback buffer length, the hardware
+ * playback buffer length and additional latencies will be adjusted in
+ * a way that it matches tlength resp. fragsize. Set
+ * PA_STREAM_ADJUST_LATENCY if you want to control the overall
+ * playback latency for your stream. Unset it if you want to control
+ * only the latency induced by the server-side, rewritable playback
+ * buffer. The server will try to fulfill the client's latency requests
+ * as good as possible. However if the underlying hardware cannot
+ * change the hardware buffer length or only in a limited range, the
+ * actually resulting latency might be different from what the client
+ * requested. Thus, for synchronization clients always need to check
+ * the actual measured latency via pa_stream_get_latency() or a
+ * similar call, and not make any assumptions about the latency
+ * available. The function pa_stream_get_buffer_attr() will always
+ * return the actual size of the server-side per-stream buffer in
+ * tlength/fragsize, regardless whether PA_STREAM_ADJUST_LATENCY is
+ * set or not.
+ *
+ * The server-side per-stream playback buffers are indexed by a write and a read
+ * index. The application writes to the write index and the sound
+ * device reads from the read index. The read index is increased
+ * monotonically, while the write index may be freely controlled by
+ * the application. Subtracting the read index from the write index
+ * will give you the current fill level of the buffer. The read/write
+ * indexes are 64bit values and measured in bytes, they will never
+ * wrap. The current read/write index may be queried using
+ * pa_stream_get_timing_info() (see below for more information). In
+ * case of a buffer underrun the read index is equal or larger than
+ * the write index. Unless the prebuf value is 0, PulseAudio will
+ * temporarily pause playback in such a case, and wait until the
+ * buffer is filled up to prebuf bytes again. If prebuf is 0, the
+ * read index may be larger than the write index, in which case
+ * silence is played. If the application writes data to indexes lower
+ * than the read index, the data is immediately lost.
+ *
+ * \section transfer_sec Transferring Data
+ *
+ * Once the stream is up, data can start flowing between the client and the
+ * server. Two different access models can be used to transfer the data:
+ *
+ * \li Asynchronous - The application register a callback using
+ * pa_stream_set_write_callback() and
+ * pa_stream_set_read_callback() to receive notifications
+ * that data can either be written or read.
+ * \li Polled - Query the library for available data/space using
+ * pa_stream_writable_size() and pa_stream_readable_size() and
+ * transfer data as needed. The sizes are stored locally, in the
+ * client end, so there is no delay when reading them.
+ *
+ * It is also possible to mix the two models freely.
+ *
+ * Once there is data/space available, it can be transferred using either
+ * pa_stream_write() for playback, or pa_stream_peek() / pa_stream_drop() for
+ * record. Make sure you do not overflow the playback buffers as data will be
+ * dropped.
+ *
+ * \section bufctl_sec Buffer Control
+ *
+ * The transfer buffers can be controlled through a number of operations:
+ *
+ * \li pa_stream_cork() - Start or stop the playback or recording.
+ * \li pa_stream_trigger() - Start playback immediately and do not wait for
+ * the buffer to fill up to the set trigger level.
+ * \li pa_stream_prebuf() - Reenable the playback trigger level.
+ * \li pa_stream_drain() - Wait for the playback buffer to go empty. Will
+ * return a pa_operation object that will indicate when
+ * the buffer is completely drained.
+ * \li pa_stream_flush() - Drop all data from the playback or record buffer. Do not
+ * wait for it to finish playing.
+ *
+ * \section seek_modes Seeking in the Playback Buffer
+ *
+ * A client application may freely seek in the playback buffer. To
+ * accomplish that the pa_stream_write() function takes a seek mode
+ * and an offset argument. The seek mode is one of:
+ *
+ * \li PA_SEEK_RELATIVE - seek relative to the current write index
+ * \li PA_SEEK_ABSOLUTE - seek relative to the beginning of the playback buffer, (i.e. the first that was ever played in the stream)
+ * \li PA_SEEK_RELATIVE_ON_READ - seek relative to the current read index. Use this to write data to the output buffer that should be played as soon as possible
+ * \li PA_SEEK_RELATIVE_END - seek relative to the last byte ever written.
+ *
+ * If an application just wants to append some data to the output
+ * buffer, PA_SEEK_RELATIVE and an offset of 0 should be used.
+ *
+ * After a call to pa_stream_write() the write index will be left at
+ * the position right after the last byte of the written data.
+ *
+ * \section latency_sec Latency
+ *
+ * A major problem with networked audio is the increased latency caused by
+ * the network. To remedy this, PulseAudio supports an advanced system of
+ * monitoring the current latency.
+ *
+ * To get the raw data needed to calculate latencies, call
+ * pa_stream_get_timing_info(). This will give you a pa_timing_info
+ * structure that contains everything that is known about the server
+ * side buffer transport delays and the backend active in the
+ * server. (Besides other things it contains the write and read index
+ * values mentioned above.)
+ *
+ * This structure is updated every time a
+ * pa_stream_update_timing_info() operation is executed. (i.e. before
+ * the first call to this function the timing information structure is
+ * not available!) Since it is a lot of work to keep this structure
+ * up-to-date manually, PulseAudio can do that automatically for you:
+ * if PA_STREAM_AUTO_TIMING_UPDATE is passed when connecting the
+ * stream PulseAudio will automatically update the structure every
+ * 100ms and every time a function is called that might invalidate the
+ * previously known timing data (such as pa_stream_write() or
+ * pa_stream_flush()). Please note however, that there always is a
+ * short time window when the data in the timing information structure
+ * is out-of-date. PulseAudio tries to mark these situations by
+ * setting the write_index_corrupt and read_index_corrupt fields
+ * accordingly.
+ *
+ * The raw timing data in the pa_timing_info structure is usually hard
+ * to deal with. Therefore a simpler interface is available:
+ * you can call pa_stream_get_time() or pa_stream_get_latency(). The
+ * former will return the current playback time of the hardware since
+ * the stream has been started. The latter returns the overall time a sample
+ * that you write now takes to be played by the hardware. These two
+ * functions base their calculations on the same data that is returned
+ * by pa_stream_get_timing_info(). Hence the same rules for keeping
+ * the timing data up-to-date apply here. In case the write or read
+ * index is corrupted, these two functions will fail with
+ * -PA_ERR_NODATA set.
+ *
+ * Since updating the timing info structure usually requires a full
+ * network round trip and some applications monitor the timing very
+ * often PulseAudio offers a timing interpolation system. If
+ * PA_STREAM_INTERPOLATE_TIMING is passed when connecting the stream,
+ * pa_stream_get_time() and pa_stream_get_latency() will try to
+ * interpolate the current playback time/latency by estimating the
+ * number of samples that have been played back by the hardware since
+ * the last regular timing update. It is especially useful to combine
+ * this option with PA_STREAM_AUTO_TIMING_UPDATE, which will enable
+ * you to monitor the current playback time/latency very precisely and
+ * very frequently without requiring a network round trip every time.
+ *
+ * \section flow_sec Overflow and underflow
+ *
+ * Even with the best precautions, buffers will sometime over - or
+ * underflow. To handle this gracefully, the application can be
+ * notified when this happens. Callbacks are registered using
+ * pa_stream_set_overflow_callback() and
+ * pa_stream_set_underflow_callback().
+ *
+ * \section sync_streams Synchronizing Multiple Playback Streams
+ *
+ * PulseAudio allows applications to fully synchronize multiple
+ * playback streams that are connected to the same output device. That
+ * means the streams will always be played back sample-by-sample
+ * synchronously. If stream operations like pa_stream_cork() are
+ * issued on one of the synchronized streams, they are simultaneously
+ * issued on the others.
+ *
+ * To synchronize a stream to another, just pass the "master" stream
+ * as last argument to pa_stream_connect_playback(). To make sure that
+ * the freshly created stream doesn't start playback right-away, make
+ * sure to pass PA_STREAM_START_CORKED and -- after all streams have
+ * been created -- uncork them all with a single call to
+ * pa_stream_cork() for the master stream.
+ *
+ * To make sure that a particular stream doesn't stop to play when a
+ * server side buffer underrun happens on it while the other
+ * synchronized streams continue playing and hence deviate, you need to
+ * pass a "prebuf" pa_buffer_attr of 0 when connecting it.
+ *
+ * \section disc_sec Disconnecting
+ *
+ * When a stream has served is purpose it must be disconnected with
+ * pa_stream_disconnect(). If you only unreference it, then it will live on
+ * and eat resources both locally and on the server until you disconnect the
+ * context.
+ *
+ */
+
+/** \file
+ * Audio streams for input, output and sample upload
+ *
+ * See also \subpage streams
+ */
+
+PA_C_DECL_BEGIN
+
+/** An opaque stream for playback or recording */
+typedef struct pa_stream pa_stream;
+
+/** A generic callback for operation completion */
+typedef void (*pa_stream_success_cb_t) (pa_stream*s, int success, void *userdata);
+
+/** A generic request callback */
+typedef void (*pa_stream_request_cb_t)(pa_stream *p, size_t nbytes, void *userdata);
+
+/** A generic notification callback */
+typedef void (*pa_stream_notify_cb_t)(pa_stream *p, void *userdata);
+
+/** A callback for asynchronous meta/policy event messages. Well known
+ * event names are PA_STREAM_EVENT_REQUEST_CORK and
+ * PA_STREAM_EVENT_REQUEST_UNCORK. The set of defined events can be
+ * extended at any time. Also, server modules may introduce additional
+ * message types so make sure that your callback function ignores messages
+ * it doesn't know. \since 0.9.15 */
+typedef void (*pa_stream_event_cb_t)(pa_stream *p, const char *name, pa_proplist *pl, void *userdata);
+
+/** Create a new, unconnected stream with the specified name and
+ * sample type. It is recommended to use pa_stream_new_with_proplist()
+ * instead and specify some initial properties. */
+pa_stream* pa_stream_new(
+ pa_context *c /**< The context to create this stream in */,
+ const char *name /**< A name for this stream */,
+ const pa_sample_spec *ss /**< The desired sample format */,
+ const pa_channel_map *map /**< The desired channel map, or NULL for default */);
+
+/** Create a new, unconnected stream with the specified name and
+ * sample type, and specify the initial stream property
+ * list. \since 0.9.11 */
+pa_stream* pa_stream_new_with_proplist(
+ pa_context *c /**< The context to create this stream in */,
+ const char *name /**< A name for this stream */,
+ const pa_sample_spec *ss /**< The desired sample format */,
+ const pa_channel_map *map /**< The desired channel map, or NULL for default */,
+ pa_proplist *p /**< The initial property list */);
+
+/** Create a new, unconnected stream with the specified name, the set of formats
+ * this client can provide, and an initial list of properties. While
+ * connecting, the server will select the most appropriate format which the
+ * client must then provide. \since 1.0 */
+pa_stream *pa_stream_new_extended(
+ pa_context *c /**< The context to create this stream in */,
+ const char *name /**< A name for this stream */,
+ pa_format_info * const * formats /**< The list of formats that can be provided */,
+ unsigned int n_formats /**< The number of formats being passed in */,
+ pa_proplist *p /**< The initial property list */);
+
+/** Decrease the reference counter by one. */
+void pa_stream_unref(pa_stream *s);
+
+/** Increase the reference counter by one. */
+pa_stream *pa_stream_ref(pa_stream *s);
+
+/** Return the current state of the stream. */
+pa_stream_state_t pa_stream_get_state(pa_stream *p);
+
+/** Return the context this stream is attached to. */
+pa_context* pa_stream_get_context(pa_stream *p);
+
+/** Return the sink input resp.\ source output index this stream is
+ * identified in the server with. This is useful with the
+ * introspection functions such as pa_context_get_sink_input_info()
+ * or pa_context_get_source_output_info(). */
+uint32_t pa_stream_get_index(pa_stream *s);
+
+/** Return the index of the sink or source this stream is connected to
+ * in the server. This is useful with the introspection
+ * functions such as pa_context_get_sink_info_by_index() or
+ * pa_context_get_source_info_by_index().
+ *
+ * Please note that streams may be moved between sinks/sources and thus
+ * it is recommended to use pa_stream_set_moved_callback() to be notified
+ * about this. This function will return with -PA_ERR_NOTSUPPORTED when the
+ * server is older than 0.9.8. \since 0.9.8 */
+uint32_t pa_stream_get_device_index(pa_stream *s);
+
+/** Return the name of the sink or source this stream is connected to
+ * in the server. This is useful with the introspection
+ * functions such as pa_context_get_sink_info_by_name()
+ * or pa_context_get_source_info_by_name().
+ *
+ * Please note that streams may be moved between sinks/sources and thus
+ * it is recommended to use pa_stream_set_moved_callback() to be notified
+ * about this. This function will return with -PA_ERR_NOTSUPPORTED when the
+ * server is older than 0.9.8. \since 0.9.8 */
+const char *pa_stream_get_device_name(pa_stream *s);
+
+/** Return 1 if the sink or source this stream is connected to has
+ * been suspended. This will return 0 if not, and a negative value on
+ * error. This function will return with -PA_ERR_NOTSUPPORTED when the
+ * server is older than 0.9.8. \since 0.9.8 */
+int pa_stream_is_suspended(pa_stream *s);
+
+/** Return 1 if the this stream has been corked. This will return 0 if
+ * not, and a negative value on error. \since 0.9.11 */
+int pa_stream_is_corked(pa_stream *s);
+
+/** Connect the stream to a sink. It is strongly recommended to pass
+ * NULL in both \a dev and \a volume and to set neither
+ * PA_STREAM_START_MUTED nor PA_STREAM_START_UNMUTED -- unless these
+ * options are directly dependent on user input or configuration.
+ *
+ * If you follow this rule then the sound server will have the full
+ * flexibility to choose the device, volume and mute status
+ * automatically, based on server-side policies, heuristics and stored
+ * information from previous uses. Also the server may choose to
+ * reconfigure audio devices to make other sinks/sources or
+ * capabilities available to be able to accept the stream.
+ *
+ * Before 0.9.20 it was not defined whether the \a volume parameter was
+ * interpreted relative to the sink's current volume or treated as
+ * an absolute device volume. Since 0.9.20 it is an absolute volume when
+ * the sink is in flat volume mode, and relative otherwise, thus
+ * making sure the volume passed here has always the same semantics as
+ * the volume passed to pa_context_set_sink_input_volume(). It is possible
+ * to figure out whether flat volume mode is in effect for a given sink
+ * by calling pa_context_get_sink_info_by_name().
+ *
+ * Since 5.0, it's possible to specify a single-channel volume even if the
+ * stream has multiple channels. In that case the same volume is applied to all
+ * channels. */
+int pa_stream_connect_playback(
+ pa_stream *s /**< The stream to connect to a sink */,
+ const char *dev /**< Name of the sink to connect to, or NULL for default */ ,
+ const pa_buffer_attr *attr /**< Buffering attributes, or NULL for default */,
+ pa_stream_flags_t flags /**< Additional flags, or 0 for default */,
+ const pa_cvolume *volume /**< Initial volume, or NULL for default */,
+ pa_stream *sync_stream /**< Synchronize this stream with the specified one, or NULL for a standalone stream */);
+
+/** Connect the stream to a source. */
+int pa_stream_connect_record(
+ pa_stream *s /**< The stream to connect to a source */ ,
+ const char *dev /**< Name of the source to connect to, or NULL for default */,
+ const pa_buffer_attr *attr /**< Buffer attributes, or NULL for default */,
+ pa_stream_flags_t flags /**< Additional flags, or 0 for default */);
+
+/** Disconnect a stream from a source/sink. */
+int pa_stream_disconnect(pa_stream *s);
+
+/** Prepare writing data to the server (for playback streams). This
+ * function may be used to optimize the number of memory copies when
+ * doing playback ("zero-copy"). It is recommended to call this
+ * function before each call to pa_stream_write().
+ *
+ * Pass in the address to a pointer and an address of the number of
+ * bytes you want to write. On return the two values will contain a
+ * pointer where you can place the data to write and the maximum number
+ * of bytes you can write. \a *nbytes can be smaller or have the same
+ * value as you passed in. You need to be able to handle both cases.
+ * Accessing memory beyond the returned \a *nbytes value is invalid.
+ * Accessing the memory returned after the following pa_stream_write()
+ * or pa_stream_cancel_write() is invalid.
+ *
+ * On invocation only \a *nbytes needs to be initialized, on return both
+ * *data and *nbytes will be valid. If you place (size_t) -1 in *nbytes
+ * on invocation the memory size will be chosen automatically (which is
+ * recommended to do). After placing your data in the memory area
+ * returned, call pa_stream_write() with \a data set to an address
+ * within this memory area and an \a nbytes value that is smaller or
+ * equal to what was returned by this function to actually execute the
+ * write.
+ *
+ * An invocation of pa_stream_write() should follow "quickly" on
+ * pa_stream_begin_write(). It is not recommended letting an unbounded
+ * amount of time pass after calling pa_stream_begin_write() and
+ * before calling pa_stream_write(). If you want to cancel a
+ * previously called pa_stream_begin_write() without calling
+ * pa_stream_write() use pa_stream_cancel_write(). Calling
+ * pa_stream_begin_write() twice without calling pa_stream_write() or
+ * pa_stream_cancel_write() in between will return exactly the same
+ * \a data pointer and \a nbytes values. \since 0.9.16 */
+int pa_stream_begin_write(
+ pa_stream *p,
+ void **data,
+ size_t *nbytes);
+
+/** Reverses the effect of pa_stream_begin_write() dropping all data
+ * that has already been placed in the memory area returned by
+ * pa_stream_begin_write(). Only valid to call if
+ * pa_stream_begin_write() was called before and neither
+ * pa_stream_cancel_write() nor pa_stream_write() have been called
+ * yet. Accessing the memory previously returned by
+ * pa_stream_begin_write() after this call is invalid. Any further
+ * explicit freeing of the memory area is not necessary. \since
+ * 0.9.16 */
+int pa_stream_cancel_write(
+ pa_stream *p);
+
+/** Write some data to the server (for playback streams).
+ * If \a free_cb is non-NULL this routine is called when all data has
+ * been written out. An internal reference to the specified data is
+ * kept, the data is not copied. If NULL, the data is copied into an
+ * internal buffer.
+ *
+ * The client may freely seek around in the output buffer. For
+ * most applications it is typical to pass 0 and PA_SEEK_RELATIVE
+ * as values for the arguments \a offset and \a seek. After the write
+ * call succeeded the write index will be at the position after where
+ * this chunk of data has been written to.
+ *
+ * As an optimization for avoiding needless memory copies you may call
+ * pa_stream_begin_write() before this call and then place your audio
+ * data directly in the memory area returned by that call. Then, pass
+ * a pointer to that memory area to pa_stream_write(). After the
+ * invocation of pa_stream_write() the memory area may no longer be
+ * accessed. Any further explicit freeing of the memory area is not
+ * necessary. It is OK to write the memory area returned by
+ * pa_stream_begin_write() only partially with this call, skipping
+ * bytes both at the end and at the beginning of the reserved memory
+ * area.*/
+int pa_stream_write(
+ pa_stream *p /**< The stream to use */,
+ const void *data /**< The data to write */,
+ size_t nbytes /**< The length of the data to write in bytes, must be in multiples of the stream's sample spec frame size */,
+ pa_free_cb_t free_cb /**< A cleanup routine for the data or NULL to request an internal copy */,
+ int64_t offset /**< Offset for seeking, must be 0 for upload streams, must be in multiples of the stream's sample spec frame size */,
+ pa_seek_mode_t seek /**< Seek mode, must be PA_SEEK_RELATIVE for upload streams */);
+
+/** Function does exactly the same as pa_stream_write() with the difference
+ * that free_cb_data is passed to free_cb instead of data. \since 6.0 */
+int pa_stream_write_ext_free(
+ pa_stream *p /**< The stream to use */,
+ const void *data /**< The data to write */,
+ size_t nbytes /**< The length of the data to write in bytes */,
+ pa_free_cb_t free_cb /**< A cleanup routine for the data or NULL to request an internal copy */,
+ void *free_cb_data /**< Argument passed to free_cb function */,
+ int64_t offset /**< Offset for seeking, must be 0 for upload streams */,
+ pa_seek_mode_t seek /**< Seek mode, must be PA_SEEK_RELATIVE for upload streams */);
+
+/** Read the next fragment from the buffer (for recording streams).
+ * If there is data at the current read index, \a data will point to
+ * the actual data and \a nbytes will contain the size of the data in
+ * bytes (which can be less or more than a complete fragment).
+ *
+ * If there is no data at the current read index, it means that either
+ * the buffer is empty or it contains a hole (that is, the write index
+ * is ahead of the read index but there's no data where the read index
+ * points at). If the buffer is empty, \a data will be NULL and
+ * \a nbytes will be 0. If there is a hole, \a data will be NULL and
+ * \a nbytes will contain the length of the hole.
+ *
+ * Use pa_stream_drop() to actually remove the data from the buffer
+ * and move the read index forward. pa_stream_drop() should not be
+ * called if the buffer is empty, but it should be called if there is
+ * a hole. */
+int pa_stream_peek(
+ pa_stream *p /**< The stream to use */,
+ const void **data /**< Pointer to pointer that will point to data */,
+ size_t *nbytes /**< The length of the data read in bytes */);
+
+/** Remove the current fragment on record streams. It is invalid to do this without first
+ * calling pa_stream_peek(). */
+int pa_stream_drop(pa_stream *p);
+
+/** Return the number of bytes requested by the server that have not yet
+ * been written.
+ *
+ * It is possible to write more than this amount, up to the stream's
+ * buffer_attr.maxlength bytes. This is usually not desirable, though, as
+ * it would increase stream latency to be higher than requested
+ * (buffer_attr.tlength).
+ */
+size_t pa_stream_writable_size(pa_stream *p);
+
+/** Return the number of bytes that may be read using pa_stream_peek(). */
+size_t pa_stream_readable_size(pa_stream *p);
+
+/** Drain a playback stream. Use this for notification when the
+ * playback buffer is empty after playing all the audio in the buffer.
+ * Please note that only one drain operation per stream may be issued
+ * at a time. */
+pa_operation* pa_stream_drain(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
+
+/** Request a timing info structure update for a stream. Use
+ * pa_stream_get_timing_info() to get access to the raw timing data,
+ * or pa_stream_get_time() or pa_stream_get_latency() to get cleaned
+ * up values. */
+pa_operation* pa_stream_update_timing_info(pa_stream *p, pa_stream_success_cb_t cb, void *userdata);
+
+/** Set the callback function that is called whenever the state of the stream changes. */
+void pa_stream_set_state_callback(pa_stream *s, pa_stream_notify_cb_t cb, void *userdata);
+
+/** Set the callback function that is called when new data may be
+ * written to the stream. */
+void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+
+/** Set the callback function that is called when new data is available from the stream. */
+void pa_stream_set_read_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+
+/** Set the callback function that is called when a buffer overflow happens. (Only for playback streams) */
+void pa_stream_set_overflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
+
+/** Return at what position the latest underflow occurred, or -1 if this information is not
+ * known (e.g.\ if no underflow has occurred, or server is older than 1.0).
+ * Can be used inside the underflow callback to get information about the current underflow.
+ * (Only for playback streams) \since 1.0 */
+int64_t pa_stream_get_underflow_index(pa_stream *p);
+
+/** Set the callback function that is called when a buffer underflow happens. (Only for playback streams) */
+void pa_stream_set_underflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
+
+/** Set the callback function that is called when a the server starts
+ * playback after an underrun or on initial startup. This only informs
+ * that audio is flowing again, it is no indication that audio started
+ * to reach the speakers already. (Only for playback streams) \since
+ * 0.9.11 */
+void pa_stream_set_started_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
+
+/** Set the callback function that is called whenever a latency
+ * information update happens. Useful on PA_STREAM_AUTO_TIMING_UPDATE
+ * streams only. */
+void pa_stream_set_latency_update_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
+
+/** Set the callback function that is called whenever the stream is
+ * moved to a different sink/source. Use pa_stream_get_device_name() or
+ * pa_stream_get_device_index() to query the new sink/source. This
+ * notification is only generated when the server is at least
+ * 0.9.8. \since 0.9.8 */
+void pa_stream_set_moved_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
+
+/** Set the callback function that is called whenever the sink/source
+ * this stream is connected to is suspended or resumed. Use
+ * pa_stream_is_suspended() to query the new suspend status. Please
+ * note that the suspend status might also change when the stream is
+ * moved between devices. Thus if you call this function you very
+ * likely want to call pa_stream_set_moved_callback() too. This
+ * notification is only generated when the server is at least
+ * 0.9.8. \since 0.9.8 */
+void pa_stream_set_suspended_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
+
+/** Set the callback function that is called whenever a meta/policy
+ * control event is received. \since 0.9.15 */
+void pa_stream_set_event_callback(pa_stream *p, pa_stream_event_cb_t cb, void *userdata);
+
+/** Set the callback function that is called whenever the buffer
+ * attributes on the server side change. Please note that the buffer
+ * attributes can change when moving a stream to a different
+ * sink/source too, hence if you use this callback you should use
+ * pa_stream_set_moved_callback() as well. \since 0.9.15 */
+void pa_stream_set_buffer_attr_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
+
+/** Pause (or resume) playback of this stream temporarily. Available
+ * on both playback and recording streams. If \a b is 1 the stream is
+ * paused. If \a b is 0 the stream is resumed. The pause/resume operation
+ * is executed as quickly as possible. If a cork is very quickly
+ * followed by an uncork or the other way round, this might not
+ * actually have any effect on the stream that is output. You can use
+ * pa_stream_is_corked() to find out whether the stream is currently
+ * paused or not. Normally a stream will be created in uncorked
+ * state. If you pass PA_STREAM_START_CORKED as a flag when connecting
+ * the stream, it will be created in corked state. */
+pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, void *userdata);
+
+/** Flush the playback or record buffer of this stream. This discards any audio data
+ * in the buffer. Most of the time you're better off using the parameter
+ * \a seek of pa_stream_write() instead of this function. */
+pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
+
+/** Reenable prebuffering if specified in the pa_buffer_attr
+ * structure. Available for playback streams only. */
+pa_operation* pa_stream_prebuf(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
+
+/** Request immediate start of playback on this stream. This disables
+ * prebuffering temporarily if specified in the pa_buffer_attr structure.
+ * Available for playback streams only. */
+pa_operation* pa_stream_trigger(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
+
+/** Rename the stream. */
+pa_operation* pa_stream_set_name(pa_stream *s, const char *name, pa_stream_success_cb_t cb, void *userdata);
+
+/** Return the current playback/recording time. This is based on the
+ * data in the timing info structure returned by
+ * pa_stream_get_timing_info().
+ *
+ * This function will usually only return new data if a timing info
+ * update has been received. Only if timing interpolation has been
+ * requested (PA_STREAM_INTERPOLATE_TIMING) the data from the last
+ * timing update is used for an estimation of the current
+ * playback/recording time based on the local time that passed since
+ * the timing info structure has been acquired.
+ *
+ * The time value returned by this function is guaranteed to increase
+ * monotonically (the returned value is always greater
+ * or equal to the value returned by the last call). This behaviour
+ * can be disabled by using PA_STREAM_NOT_MONOTONIC. This may be
+ * desirable to better deal with bad estimations of transport
+ * latencies, but may have strange effects if the application is not
+ * able to deal with time going 'backwards'.
+ *
+ * The time interpolator activated by PA_STREAM_INTERPOLATE_TIMING
+ * favours 'smooth' time graphs over accurate ones to improve the
+ * smoothness of UI operations that are tied to the audio clock. If
+ * accuracy is more important to you, you might need to estimate your
+ * timing based on the data from pa_stream_get_timing_info() yourself
+ * or not work with interpolated timing at all and instead always
+ * query the server side for the most up to date timing with
+ * pa_stream_update_timing_info().
+ *
+ * If no timing information has been
+ * received yet this call will return -PA_ERR_NODATA. For more details
+ * see pa_stream_get_timing_info(). */
+int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec);
+
+/** Determine the total stream latency. This function is based on
+ * pa_stream_get_time().
+ *
+ * The latency is stored in \a *r_usec. In case the stream is a
+ * monitoring stream the result can be negative, i.e. the captured
+ * samples are not yet played. In this case \a *negative is set to 1.
+ *
+ * If no timing information has been received yet, this call will
+ * return -PA_ERR_NODATA. On success, it will return 0.
+ *
+ * For more details see pa_stream_get_timing_info() and
+ * pa_stream_get_time(). */
+int pa_stream_get_latency(pa_stream *s, pa_usec_t *r_usec, int *negative);
+
+/** Return the latest raw timing data structure. The returned pointer
+ * refers to an internal read-only instance of the timing
+ * structure. The user should make a copy of this structure if he
+ * wants to modify it. An in-place update to this data structure may
+ * be requested using pa_stream_update_timing_info().
+ *
+ * If no timing information has been received before (i.e. by
+ * requesting pa_stream_update_timing_info() or by using
+ * PA_STREAM_AUTO_TIMING_UPDATE), this function will fail with
+ * -PA_ERR_NODATA.
+ *
+ * Please note that the write_index member field (and only this field)
+ * is updated on each pa_stream_write() call, not just when a timing
+ * update has been received. */
+const pa_timing_info* pa_stream_get_timing_info(pa_stream *s);
+
+/** Return a pointer to the stream's sample specification. */
+const pa_sample_spec* pa_stream_get_sample_spec(pa_stream *s);
+
+/** Return a pointer to the stream's channel map. */
+const pa_channel_map* pa_stream_get_channel_map(pa_stream *s);
+
+/** Return a pointer to the stream's format. \since 1.0 */
+const pa_format_info* pa_stream_get_format_info(pa_stream *s);
+
+/** Return the per-stream server-side buffer metrics of the
+ * stream. Only valid after the stream has been connected successfully
+ * and if the server is at least PulseAudio 0.9. This will return the
+ * actual configured buffering metrics, which may differ from what was
+ * requested during pa_stream_connect_record() or
+ * pa_stream_connect_playback(). This call will always return the
+ * actual per-stream server-side buffer metrics, regardless whether
+ * PA_STREAM_ADJUST_LATENCY is set or not. \since 0.9.0 */
+const pa_buffer_attr* pa_stream_get_buffer_attr(pa_stream *s);
+
+/** Change the buffer metrics of the stream during playback. The
+ * server might have chosen different buffer metrics then
+ * requested. The selected metrics may be queried with
+ * pa_stream_get_buffer_attr() as soon as the callback is called. Only
+ * valid after the stream has been connected successfully and if the
+ * server is at least PulseAudio 0.9.8. Please be aware of the
+ * slightly different semantics of the call depending whether
+ * PA_STREAM_ADJUST_LATENCY is set or not. \since 0.9.8 */
+pa_operation *pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr, pa_stream_success_cb_t cb, void *userdata);
+
+/** Change the stream sampling rate during playback. You need to pass
+ * PA_STREAM_VARIABLE_RATE in the flags parameter of
+ * pa_stream_connect_playback() if you plan to use this function. Only valid
+ * after the stream has been connected successfully and if the server
+ * is at least PulseAudio 0.9.8. \since 0.9.8 */
+pa_operation *pa_stream_update_sample_rate(pa_stream *s, uint32_t rate, pa_stream_success_cb_t cb, void *userdata);
+
+/** Update the property list of the sink input/source output of this
+ * stream, adding new entries. Please note that it is highly
+ * recommended to set as many properties initially via
+ * pa_stream_new_with_proplist() as possible instead a posteriori with
+ * this function, since that information may be used to route
+ * this stream to the right device. \since 0.9.11 */
+pa_operation *pa_stream_proplist_update(pa_stream *s, pa_update_mode_t mode, pa_proplist *p, pa_stream_success_cb_t cb, void *userdata);
+
+/** Update the property list of the sink input/source output of this
+ * stream, remove entries. \since 0.9.11 */
+pa_operation *pa_stream_proplist_remove(pa_stream *s, const char *const keys[], pa_stream_success_cb_t cb, void *userdata);
+
+/** For record streams connected to a monitor source: monitor only a
+ * very specific sink input of the sink. This function needs to be
+ * called before pa_stream_connect_record() is called. \since
+ * 0.9.11 */
+int pa_stream_set_monitor_stream(pa_stream *s, uint32_t sink_input_idx);
+
+/** Return the sink input index previously set with
+ * pa_stream_set_monitor_stream().
+ * \since 0.9.11 */
+uint32_t pa_stream_get_monitor_stream(pa_stream *s);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/subscribe.h b/thirdparty/linuxbsd_headers/pulse/subscribe.h
new file mode 100644
index 0000000000..b43c8ea44e
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/subscribe.h
@@ -0,0 +1,83 @@
+#ifndef foosubscribehfoo
+#define foosubscribehfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <inttypes.h>
+
+#include <pulse/def.h>
+#include <pulse/context.h>
+#include <pulse/cdecl.h>
+#include <pulse/version.h>
+
+/** \page subscribe Event Subscription
+ *
+ * \section overv_sec Overview
+ *
+ * The application can be notified, asynchronously, whenever the internal
+ * layout of the server changes. Possible notifications are described in the
+ * \ref pa_subscription_event_type and \ref pa_subscription_mask
+ * enumerations.
+ *
+ * The application sets the notification mask using pa_context_subscribe()
+ * and the function that will be called whenever a notification occurs using
+ * pa_context_set_subscribe_callback().
+ *
+ * The callback will be called with a \ref pa_subscription_event_type_t
+ * representing the event that caused the callback. Clients can examine what
+ * object changed using \ref PA_SUBSCRIPTION_EVENT_FACILITY_MASK. The actual
+ * event type can then be extracted with \ref PA_SUBSCRIPTION_EVENT_TYPE_MASK.
+ * Please note that the masked values are integers, not flags (so you will
+ * check the object/event type using a comparison not a binary AND). For
+ * example, the callback might look something like:
+ *
+@verbatim
+void my_subscription_callback(pa_context *c, pa_subscription_event_type_t t,
+ uint32_t idx, void *userdata) {
+ if ((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SOURCE) {
+ if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW) {
+ ... a source was added, let's do stuff! ...
+ }
+ }
+}
+@endverbatim
+ */
+
+/** \file
+ * Daemon introspection event subscription subsystem.
+ *
+ * See also \subpage subscribe
+ */
+
+PA_C_DECL_BEGIN
+
+/** Subscription event callback prototype */
+typedef void (*pa_context_subscribe_cb_t)(pa_context *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata);
+
+/** Enable event notification */
+pa_operation* pa_context_subscribe(pa_context *c, pa_subscription_mask_t m, pa_context_success_cb_t cb, void *userdata);
+
+/** Set the context specific call back function that is called whenever the state of the daemon changes */
+void pa_context_set_subscribe_callback(pa_context *c, pa_context_subscribe_cb_t cb, void *userdata);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/thread-mainloop.h b/thirdparty/linuxbsd_headers/pulse/thread-mainloop.h
new file mode 100644
index 0000000000..e69298aa07
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/thread-mainloop.h
@@ -0,0 +1,317 @@
+#ifndef foothreadmainloophfoo
+#define foothreadmainloophfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/mainloop-api.h>
+#include <pulse/cdecl.h>
+#include <pulse/version.h>
+
+PA_C_DECL_BEGIN
+
+/** \page threaded_mainloop Threaded Main Loop
+ *
+ * \section overv_sec Overview
+ *
+ * The threaded main loop implementation is a special version of the primary
+ * main loop implementation (see \ref mainloop). For the basic design, see
+ * its documentation.
+ *
+ * The added feature in the threaded main loop is that it spawns a new thread
+ * that runs the real main loop. This allows a synchronous application to use
+ * the asynchronous API without risking to stall the PulseAudio library.
+ *
+ * \section creat_sec Creation
+ *
+ * A pa_threaded_mainloop object is created using pa_threaded_mainloop_new().
+ * This will only allocate the required structures though, so to use it the
+ * thread must also be started. This is done through
+ * pa_threaded_mainloop_start(), after which you can start using the main loop.
+ *
+ * \section destr_sec Destruction
+ *
+ * When the PulseAudio connection has been terminated, the thread must be
+ * stopped and the resources freed. Stopping the thread is done using
+ * pa_threaded_mainloop_stop(), which must be called without the lock (see
+ * below) held. When that function returns, the thread is stopped and the
+ * pa_threaded_mainloop object can be freed using pa_threaded_mainloop_free().
+ *
+ * \section lock_sec Locking
+ *
+ * Since the PulseAudio API doesn't allow concurrent accesses to objects,
+ * a locking scheme must be used to guarantee safe usage. The threaded main
+ * loop API provides such a scheme through the functions
+ * pa_threaded_mainloop_lock() and pa_threaded_mainloop_unlock().
+ *
+ * The lock is recursive, so it's safe to use it multiple times from the same
+ * thread. Just make sure you call pa_threaded_mainloop_unlock() the same
+ * number of times you called pa_threaded_mainloop_lock().
+ *
+ * The lock needs to be held whenever you call any PulseAudio function that
+ * uses an object associated with this main loop. Make sure you do not hold
+ * on to the lock more than necessary though, as the threaded main loop stops
+ * while the lock is held.
+ *
+ * Example:
+ *
+ * \code
+ * void my_check_stream_func(pa_threaded_mainloop *m, pa_stream *s) {
+ * pa_stream_state_t state;
+ *
+ * pa_threaded_mainloop_lock(m);
+ *
+ * state = pa_stream_get_state(s);
+ *
+ * pa_threaded_mainloop_unlock(m);
+ *
+ * if (state == PA_STREAM_READY)
+ * printf("Stream is ready!");
+ * else
+ * printf("Stream is not ready!");
+ * }
+ * \endcode
+ *
+ * \section cb_sec Callbacks
+ *
+ * Callbacks in PulseAudio are asynchronous, so they require extra care when
+ * using them together with a threaded main loop.
+ *
+ * The easiest way to turn the callback based operations into synchronous
+ * ones, is to simply wait for the callback to be called and continue from
+ * there. This is the approach chosen in PulseAudio's threaded API.
+ *
+ * \subsection basic_subsec Basic callbacks
+ *
+ * For the basic case, where all that is required is to wait for the callback
+ * to be invoked, the code should look something like this:
+ *
+ * Example:
+ *
+ * \code
+ * static void my_drain_callback(pa_stream *s, int success, void *userdata) {
+ * pa_threaded_mainloop *m;
+ *
+ * m = userdata;
+ * assert(m);
+ *
+ * pa_threaded_mainloop_signal(m, 0);
+ * }
+ *
+ * void my_drain_stream_func(pa_threaded_mainloop *m, pa_stream *s) {
+ * pa_operation *o;
+ *
+ * pa_threaded_mainloop_lock(m);
+ *
+ * o = pa_stream_drain(s, my_drain_callback, m);
+ * assert(o);
+ *
+ * while (pa_operation_get_state(o) == PA_OPERATION_RUNNING)
+ * pa_threaded_mainloop_wait(m);
+ *
+ * pa_operation_unref(o);
+ *
+ * pa_threaded_mainloop_unlock(m);
+ * }
+ * \endcode
+ *
+ * The main function, my_drain_stream_func(), will wait for the callback to
+ * be called using pa_threaded_mainloop_wait().
+ *
+ * If your application is multi-threaded, then this waiting must be
+ * done inside a while loop. The reason for this is that multiple
+ * threads might be using pa_threaded_mainloop_wait() at the same
+ * time. Each thread must therefore verify that it was its callback
+ * that was invoked. Also the underlying OS synchronization primitives
+ * are usually not free of spurious wake-ups, so a
+ * pa_threaded_mainloop_wait() must be called within a loop even if
+ * you have only one thread waiting.
+ *
+ * The callback, my_drain_callback(), indicates to the main function that it
+ * has been called using pa_threaded_mainloop_signal().
+ *
+ * As you can see, pa_threaded_mainloop_wait() may only be called with
+ * the lock held. The same thing is true for pa_threaded_mainloop_signal(),
+ * but as the lock is held before the callback is invoked, you do not have to
+ * deal with that.
+ *
+ * The functions will not dead lock because the wait function will release
+ * the lock before waiting and then regrab it once it has been signalled.
+ * For those of you familiar with threads, the behaviour is that of a
+ * condition variable.
+ *
+ * \subsection data_subsec Data callbacks
+ *
+ * For many callbacks, simply knowing that they have been called is
+ * insufficient. The callback also receives some data that is desired. To
+ * access this data safely, we must extend our example a bit:
+ *
+ * \code
+ * static int * volatile drain_result = NULL;
+ *
+ * static void my_drain_callback(pa_stream*s, int success, void *userdata) {
+ * pa_threaded_mainloop *m;
+ *
+ * m = userdata;
+ * assert(m);
+ *
+ * drain_result = &success;
+ *
+ * pa_threaded_mainloop_signal(m, 1);
+ * }
+ *
+ * void my_drain_stream_func(pa_threaded_mainloop *m, pa_stream *s) {
+ * pa_operation *o;
+ *
+ * pa_threaded_mainloop_lock(m);
+ *
+ * o = pa_stream_drain(s, my_drain_callback, m);
+ * assert(o);
+ *
+ * while (drain_result == NULL)
+ * pa_threaded_mainloop_wait(m);
+ *
+ * pa_operation_unref(o);
+ *
+ * if (*drain_result)
+ * printf("Success!");
+ * else
+ * printf("Bitter defeat...");
+ *
+ * pa_threaded_mainloop_accept(m);
+ *
+ * pa_threaded_mainloop_unlock(m);
+ * }
+ * \endcode
+ *
+ * The example is a bit silly as it would probably have been easier to just
+ * copy the contents of success, but for larger data structures this can be
+ * wasteful.
+ *
+ * The difference here compared to the basic callback is the value 1 passed
+ * to pa_threaded_mainloop_signal() and the call to
+ * pa_threaded_mainloop_accept(). What will happen is that
+ * pa_threaded_mainloop_signal() will signal the main function and then wait.
+ * The main function is then free to use the data in the callback until
+ * pa_threaded_mainloop_accept() is called, which will allow the callback
+ * to continue.
+ *
+ * Note that pa_threaded_mainloop_accept() must be called some time between
+ * exiting the while loop and unlocking the main loop! Failure to do so will
+ * result in a race condition. I.e. it is not ok to release the lock and
+ * regrab it before calling pa_threaded_mainloop_accept().
+ *
+ * \subsection async_subsec Asynchronous callbacks
+ *
+ * PulseAudio also has callbacks that are completely asynchronous, meaning
+ * that they can be called at any time. The threaded main loop API provides
+ * the locking mechanism to handle concurrent accesses, but nothing else.
+ * Applications will have to handle communication from the callback to the
+ * main program through their own mechanisms.
+ *
+ * The callbacks that are completely asynchronous are:
+ *
+ * \li State callbacks for contexts, streams, etc.
+ * \li Subscription notifications
+ */
+
+/** \file
+ *
+ * A thread based event loop implementation based on pa_mainloop. The
+ * event loop is run in a helper thread in the background. A few
+ * synchronization primitives are available to access the objects
+ * attached to the event loop safely.
+ *
+ * See also \subpage threaded_mainloop
+ */
+
+/** An opaque threaded main loop object */
+typedef struct pa_threaded_mainloop pa_threaded_mainloop;
+
+/** Allocate a new threaded main loop object. You have to call
+ * pa_threaded_mainloop_start() before the event loop thread starts
+ * running. */
+pa_threaded_mainloop *pa_threaded_mainloop_new(void);
+
+/** Free a threaded main loop object. If the event loop thread is
+ * still running, terminate it with pa_threaded_mainloop_stop()
+ * first. */
+void pa_threaded_mainloop_free(pa_threaded_mainloop* m);
+
+/** Start the event loop thread. */
+int pa_threaded_mainloop_start(pa_threaded_mainloop *m);
+
+/** Terminate the event loop thread cleanly. Make sure to unlock the
+ * mainloop object before calling this function. */
+void pa_threaded_mainloop_stop(pa_threaded_mainloop *m);
+
+/** Lock the event loop object, effectively blocking the event loop
+ * thread from processing events. You can use this to enforce
+ * exclusive access to all objects attached to the event loop. This
+ * lock is recursive. This function may not be called inside the event
+ * loop thread. Events that are dispatched from the event loop thread
+ * are executed with this lock held. */
+void pa_threaded_mainloop_lock(pa_threaded_mainloop *m);
+
+/** Unlock the event loop object, inverse of pa_threaded_mainloop_lock(). */
+void pa_threaded_mainloop_unlock(pa_threaded_mainloop *m);
+
+/** Wait for an event to be signalled by the event loop thread. You
+ * can use this to pass data from the event loop thread to the main
+ * thread in a synchronized fashion. This function may not be called
+ * inside the event loop thread. Prior to this call the event loop
+ * object needs to be locked using pa_threaded_mainloop_lock(). While
+ * waiting the lock will be released. Immediately before returning it
+ * will be acquired again. This function may spuriously wake up even
+ * without pa_threaded_mainloop_signal() being called. You need to
+ * make sure to handle that! */
+void pa_threaded_mainloop_wait(pa_threaded_mainloop *m);
+
+/** Signal all threads waiting for a signalling event in
+ * pa_threaded_mainloop_wait(). If wait_for_accept is non-zero, do
+ * not return before the signal was accepted by a
+ * pa_threaded_mainloop_accept() call. While waiting for that condition
+ * the event loop object is unlocked. */
+void pa_threaded_mainloop_signal(pa_threaded_mainloop *m, int wait_for_accept);
+
+/** Accept a signal from the event thread issued with
+ * pa_threaded_mainloop_signal(). This call should only be used in
+ * conjunction with pa_threaded_mainloop_signal() with a non-zero
+ * wait_for_accept value. */
+void pa_threaded_mainloop_accept(pa_threaded_mainloop *m);
+
+/** Return the return value as specified with the main loop's
+ * pa_mainloop_quit() routine. */
+int pa_threaded_mainloop_get_retval(pa_threaded_mainloop *m);
+
+/** Return the main loop abstraction layer vtable for this main loop.
+ * There is no need to free this object as it is owned by the loop
+ * and is destroyed when the loop is freed. */
+pa_mainloop_api* pa_threaded_mainloop_get_api(pa_threaded_mainloop*m);
+
+/** Returns non-zero when called from within the event loop thread. \since 0.9.7 */
+int pa_threaded_mainloop_in_thread(pa_threaded_mainloop *m);
+
+/** Sets the name of the thread. \since 5.0 */
+void pa_threaded_mainloop_set_name(pa_threaded_mainloop *m, const char *name);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/timeval.h b/thirdparty/linuxbsd_headers/pulse/timeval.h
new file mode 100644
index 0000000000..9ecf791127
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/timeval.h
@@ -0,0 +1,87 @@
+#ifndef footimevalhfoo
+#define footimevalhfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ PulseAudio 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 PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/cdecl.h>
+#include <pulse/gccmacro.h>
+#include <pulse/sample.h>
+#include <pulse/version.h>
+
+/** \file
+ * Utility functions for handling timeval calculations */
+
+PA_C_DECL_BEGIN
+
+/** The number of milliseconds in a second */
+#define PA_MSEC_PER_SEC ((pa_usec_t) 1000ULL)
+
+/** The number of microseconds in a second */
+#define PA_USEC_PER_SEC ((pa_usec_t) 1000000ULL)
+
+/** The number of nanoseconds in a second */
+#define PA_NSEC_PER_SEC ((unsigned long long) 1000000000ULL)
+
+/** The number of microseconds in a millisecond */
+#define PA_USEC_PER_MSEC ((pa_usec_t) 1000ULL)
+
+/** The number of nanoseconds in a millisecond */
+#define PA_NSEC_PER_MSEC ((unsigned long long) 1000000ULL)
+
+/** The number of nanoseconds in a microsecond */
+#define PA_NSEC_PER_USEC ((unsigned long long) 1000ULL)
+
+/** Invalid time in usec. \since 0.9.15 */
+#define PA_USEC_INVALID ((pa_usec_t) -1)
+
+/** Biggest time in usec. \since 0.9.18 */
+#define PA_USEC_MAX ((pa_usec_t) -2)
+
+struct timeval;
+
+/** Return the current wallclock timestamp, just like UNIX gettimeofday(). */
+struct timeval *pa_gettimeofday(struct timeval *tv);
+
+/** Calculate the difference between the two specified timeval
+ * structs. */
+pa_usec_t pa_timeval_diff(const struct timeval *a, const struct timeval *b) PA_GCC_PURE;
+
+/** Compare the two timeval structs and return 0 when equal, negative when a < b, positive otherwise */
+int pa_timeval_cmp(const struct timeval *a, const struct timeval *b) PA_GCC_PURE;
+
+/** Return the time difference between now and the specified timestamp */
+pa_usec_t pa_timeval_age(const struct timeval *tv);
+
+/** Add the specified time in microseconds to the specified timeval structure */
+struct timeval* pa_timeval_add(struct timeval *tv, pa_usec_t v);
+
+/** Subtract the specified time in microseconds to the specified timeval structure. \since 0.9.11 */
+struct timeval* pa_timeval_sub(struct timeval *tv, pa_usec_t v);
+
+/** Store the specified usec value in the timeval struct. \since 0.9.7 */
+struct timeval* pa_timeval_store(struct timeval *tv, pa_usec_t v);
+
+/** Load the specified tv value and return it in usec. \since 0.9.7 */
+pa_usec_t pa_timeval_load(const struct timeval *tv);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/utf8.h b/thirdparty/linuxbsd_headers/pulse/utf8.h
new file mode 100644
index 0000000000..a72097ad51
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/utf8.h
@@ -0,0 +1,54 @@
+#ifndef fooutf8hfoo
+#define fooutf8hfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ PulseAudio 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 PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pulse/cdecl.h>
+#include <pulse/gccmacro.h>
+#include <pulse/version.h>
+
+/** \file
+ * UTF-8 validation functions
+ */
+
+PA_C_DECL_BEGIN
+
+/** Test if the specified strings qualifies as valid UTF8. Return the string if so, otherwise NULL */
+char *pa_utf8_valid(const char *str) PA_GCC_PURE;
+
+/** Test if the specified strings qualifies as valid 7-bit ASCII. Return the string if so, otherwise NULL. \since 0.9.15 */
+char *pa_ascii_valid(const char *str) PA_GCC_PURE;
+
+/** Filter all invalid UTF8 characters from the specified string, returning a new fully UTF8 valid string. Don't forget to free the returned string with pa_xfree() */
+char *pa_utf8_filter(const char *str);
+
+/** Filter all invalid ASCII characters from the specified string, returning a new fully ASCII valid string. Don't forget to free the returned string with pa_xfree(). \since 0.9.15 */
+char *pa_ascii_filter(const char *str);
+
+/** Convert a UTF-8 string to the current locale. Free the string using pa_xfree(). */
+char* pa_utf8_to_locale (const char *str);
+
+/** Convert a string in the current locale to UTF-8. Free the string using pa_xfree(). */
+char* pa_locale_to_utf8 (const char *str);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/util.h b/thirdparty/linuxbsd_headers/pulse/util.h
new file mode 100644
index 0000000000..e4a62da65b
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/util.h
@@ -0,0 +1,59 @@
+#ifndef fooutilhfoo
+#define fooutilhfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ PulseAudio 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 PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <stddef.h>
+
+#include <pulse/cdecl.h>
+#include <pulse/version.h>
+
+/** \file
+ * Assorted utility functions */
+
+PA_C_DECL_BEGIN
+
+/** Return the current username in the specified string buffer. */
+char *pa_get_user_name(char *s, size_t l);
+
+/** Return the current hostname in the specified buffer. */
+char *pa_get_host_name(char *s, size_t l);
+
+/** Return the fully qualified domain name in s */
+char *pa_get_fqdn(char *s, size_t l);
+
+/** Return the home directory of the current user */
+char *pa_get_home_dir(char *s, size_t l);
+
+/** Return the binary file name of the current process. This is not
+ * supported on all architectures, in which case NULL is returned. */
+char *pa_get_binary_name(char *s, size_t l);
+
+/** Return a pointer to the filename inside a path (which is the last
+ * component). If passed NULL will return NULL. */
+char *pa_path_get_filename(const char *p);
+
+/** Wait t milliseconds */
+int pa_msleep(unsigned long t);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/version.h b/thirdparty/linuxbsd_headers/pulse/version.h
new file mode 100644
index 0000000000..2738cfe902
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/version.h
@@ -0,0 +1,70 @@
+#ifndef fooversionhfoo /*-*-C-*-*/
+#define fooversionhfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+/* WARNING: Make sure to edit the real source file version.h.in! */
+
+#include <pulse/cdecl.h>
+
+/** \file
+ * Define header version */
+
+PA_C_DECL_BEGIN
+
+/** Return the version of the header files. Keep in mind that this is
+a macro and not a function, so it is impossible to get the pointer of
+it. */
+#define pa_get_headers_version() ("11.1.0")
+
+/** Return the version of the library the current application is
+ * linked to. */
+const char* pa_get_library_version(void);
+
+/** The current API version. Version 6 relates to Polypaudio
+ * 0.6. Prior versions (i.e. Polypaudio 0.5.1 and older) have
+ * PA_API_VERSION undefined. Please note that this is only ever
+ * increased on incompatible API changes! */
+#define PA_API_VERSION 12
+
+/** The current protocol version. Version 8 relates to Polypaudio
+ * 0.8/PulseAudio 0.9. */
+#define PA_PROTOCOL_VERSION 32
+
+/** The major version of PA. \since 0.9.15 */
+#define PA_MAJOR 11
+
+/** The minor version of PA. \since 0.9.15 */
+#define PA_MINOR 1
+
+/** The micro version of PA (will always be 0 from v1.0 onwards). \since 0.9.15 */
+#define PA_MICRO 0
+
+/** Evaluates to TRUE if the PulseAudio library version is equal or
+ * newer than the specified. \since 0.9.16 */
+#define PA_CHECK_VERSION(major,minor,micro) \
+ ((PA_MAJOR > (major)) || \
+ (PA_MAJOR == (major) && PA_MINOR > (minor)) || \
+ (PA_MAJOR == (major) && PA_MINOR == (minor) && PA_MICRO >= (micro)))
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/volume.h b/thirdparty/linuxbsd_headers/pulse/volume.h
new file mode 100644
index 0000000000..8cf4fa45b6
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/volume.h
@@ -0,0 +1,436 @@
+#ifndef foovolumehfoo
+#define foovolumehfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <inttypes.h>
+#include <limits.h>
+
+#include <pulse/cdecl.h>
+#include <pulse/gccmacro.h>
+#include <pulse/sample.h>
+#include <pulse/channelmap.h>
+#include <pulse/version.h>
+
+/** \page volume Volume Control
+ *
+ * \section overv_sec Overview
+ *
+ * Sinks, sources, sink inputs and samples can all have their own volumes.
+ * To deal with these, The PulseAudio library contains a number of functions
+ * that ease handling.
+ *
+ * The basic volume type in PulseAudio is the \ref pa_volume_t type. Most of
+ * the time, applications will use the aggregated pa_cvolume structure that
+ * can store the volume of all channels at once.
+ *
+ * Volumes commonly span between muted (0%), and normal (100%). It is possible
+ * to set volumes to higher than 100%, but clipping might occur.
+ *
+ * There is no single well-defined meaning attached to the 100% volume for a
+ * sink input. In fact, it depends on the server configuration. With flat
+ * volumes enabled (the default in most Linux distributions), it means the
+ * maximum volume that the sound hardware is capable of, which is usually so
+ * high that you absolutely must not set sink input volume to 100% unless the
+ * the user explicitly requests that (note that usually you shouldn't set the
+ * volume anyway if the user doesn't explicitly request it, instead, let
+ * PulseAudio decide the volume for the sink input). With flat volumes disabled
+ * (the default in Ubuntu), the sink input volume is relative to the sink
+ * volume, so 100% sink input volume means that the sink input is played at the
+ * current sink volume level. In this case 100% is often a good default volume
+ * for a sink input, although you still should let PulseAudio decide the
+ * default volume. It is possible to figure out whether flat volume mode is in
+ * effect for a given sink by calling pa_context_get_sink_info_by_name().
+ *
+ * \section calc_sec Calculations
+ *
+ * The volumes in PulseAudio are logarithmic in nature and applications
+ * shouldn't perform calculations with them directly. Instead, they should
+ * be converted to and from either dB or a linear scale:
+ *
+ * \li dB - pa_sw_volume_from_dB() / pa_sw_volume_to_dB()
+ * \li Linear - pa_sw_volume_from_linear() / pa_sw_volume_to_linear()
+ *
+ * For simple multiplication, pa_sw_volume_multiply() and
+ * pa_sw_cvolume_multiply() can be used.
+ *
+ * Calculations can only be reliably performed on software volumes
+ * as it is commonly unknown what scale hardware volumes relate to.
+ *
+ * The functions described above are only valid when used with
+ * software volumes. Hence it is usually a better idea to treat all
+ * volume values as opaque with a range from PA_VOLUME_MUTED (0%) to
+ * PA_VOLUME_NORM (100%) and to refrain from any calculations with
+ * them.
+ *
+ * \section conv_sec Convenience Functions
+ *
+ * To handle the pa_cvolume structure, the PulseAudio library provides a
+ * number of convenience functions:
+ *
+ * \li pa_cvolume_valid() - Tests if a pa_cvolume structure is valid.
+ * \li pa_cvolume_equal() - Tests if two pa_cvolume structures are identical.
+ * \li pa_cvolume_channels_equal_to() - Tests if all channels of a pa_cvolume
+ * structure have a given volume.
+ * \li pa_cvolume_is_muted() - Tests if all channels of a pa_cvolume
+ * structure are muted.
+ * \li pa_cvolume_is_norm() - Tests if all channels of a pa_cvolume structure
+ * are at a normal volume.
+ * \li pa_cvolume_set() - Set the first n channels of a pa_cvolume structure to
+ * a certain volume.
+ * \li pa_cvolume_reset() - Set the first n channels of a pa_cvolume structure
+ * to a normal volume.
+ * \li pa_cvolume_mute() - Set the first n channels of a pa_cvolume structure
+ * to a muted volume.
+ * \li pa_cvolume_avg() - Return the average volume of all channels.
+ * \li pa_cvolume_snprint() - Pretty print a pa_cvolume structure.
+ */
+
+/** \file
+ * Constants and routines for volume handling
+ *
+ * See also \subpage volume
+ */
+
+PA_C_DECL_BEGIN
+
+/** Volume specification:
+ * PA_VOLUME_MUTED: silence;
+ * < PA_VOLUME_NORM: decreased volume;
+ * PA_VOLUME_NORM: normal volume;
+ * > PA_VOLUME_NORM: increased volume */
+typedef uint32_t pa_volume_t;
+
+/** Normal volume (100%, 0 dB) */
+#define PA_VOLUME_NORM ((pa_volume_t) 0x10000U)
+
+/** Muted (minimal valid) volume (0%, -inf dB) */
+#define PA_VOLUME_MUTED ((pa_volume_t) 0U)
+
+/** Maximum valid volume we can store. \since 0.9.15 */
+#define PA_VOLUME_MAX ((pa_volume_t) UINT32_MAX/2)
+
+/** Recommended maximum volume to show in user facing UIs.
+ * Note: UIs should deal gracefully with volumes greater than this value
+ * and not cause feedback loops etc. - i.e. if the volume is more than
+ * this, the UI should not limit it and push the limited value back to
+ * the server. \since 0.9.23 */
+#define PA_VOLUME_UI_MAX (pa_sw_volume_from_dB(+11.0))
+
+/** Special 'invalid' volume. \since 0.9.16 */
+#define PA_VOLUME_INVALID ((pa_volume_t) UINT32_MAX)
+
+/** Check if volume is valid. \since 1.0 */
+#define PA_VOLUME_IS_VALID(v) ((v) <= PA_VOLUME_MAX)
+
+/** Clamp volume to the permitted range. \since 1.0 */
+#define PA_CLAMP_VOLUME(v) (PA_CLAMP_UNLIKELY((v), PA_VOLUME_MUTED, PA_VOLUME_MAX))
+
+/** A structure encapsulating a per-channel volume */
+typedef struct pa_cvolume {
+ uint8_t channels; /**< Number of channels */
+ pa_volume_t values[PA_CHANNELS_MAX]; /**< Per-channel volume */
+} pa_cvolume;
+
+/** Return non-zero when *a == *b */
+int pa_cvolume_equal(const pa_cvolume *a, const pa_cvolume *b) PA_GCC_PURE;
+
+/** Initialize the specified volume and return a pointer to
+ * it. The sample spec will have a defined state but
+ * pa_cvolume_valid() will fail for it. \since 0.9.13 */
+pa_cvolume* pa_cvolume_init(pa_cvolume *a);
+
+/** Set the volume of the first n channels to PA_VOLUME_NORM */
+#define pa_cvolume_reset(a, n) pa_cvolume_set((a), (n), PA_VOLUME_NORM)
+
+/** Set the volume of the first n channels to PA_VOLUME_MUTED */
+#define pa_cvolume_mute(a, n) pa_cvolume_set((a), (n), PA_VOLUME_MUTED)
+
+/** Set the volume of the specified number of channels to the volume v */
+pa_cvolume* pa_cvolume_set(pa_cvolume *a, unsigned channels, pa_volume_t v);
+
+/** Maximum length of the strings returned by
+ * pa_cvolume_snprint(). Please note that this value can change with
+ * any release without warning and without being considered API or ABI
+ * breakage. You should not use this definition anywhere where it
+ * might become part of an ABI.*/
+#define PA_CVOLUME_SNPRINT_MAX 320
+
+/** Pretty print a volume structure */
+char *pa_cvolume_snprint(char *s, size_t l, const pa_cvolume *c);
+
+/** Maximum length of the strings returned by
+ * pa_sw_cvolume_snprint_dB(). Please note that this value can change with
+ * any release without warning and without being considered API or ABI
+ * breakage. You should not use this definition anywhere where it
+ * might become part of an ABI. \since 0.9.13 */
+#define PA_SW_CVOLUME_SNPRINT_DB_MAX 448
+
+/** Pretty print a volume structure but show dB values. \since 0.9.13 */
+char *pa_sw_cvolume_snprint_dB(char *s, size_t l, const pa_cvolume *c);
+
+/** Maximum length of the strings returned by pa_cvolume_snprint_verbose().
+ * Please note that this value can change with any release without warning and
+ * without being considered API or ABI breakage. You should not use this
+ * definition anywhere where it might become part of an ABI. \since 5.0 */
+#define PA_CVOLUME_SNPRINT_VERBOSE_MAX 1984
+
+/** Pretty print a volume structure in a verbose way. The volume for each
+ * channel is printed in several formats: the raw pa_volume_t value,
+ * percentage, and if print_dB is non-zero, also the dB value. If map is not
+ * NULL, the channel names will be printed. \since 5.0 */
+char *pa_cvolume_snprint_verbose(char *s, size_t l, const pa_cvolume *c, const pa_channel_map *map, int print_dB);
+
+/** Maximum length of the strings returned by
+ * pa_volume_snprint(). Please note that this value can change with
+ * any release without warning and without being considered API or ABI
+ * breakage. You should not use this definition anywhere where it
+ * might become part of an ABI. \since 0.9.15 */
+#define PA_VOLUME_SNPRINT_MAX 10
+
+/** Pretty print a volume \since 0.9.15 */
+char *pa_volume_snprint(char *s, size_t l, pa_volume_t v);
+
+/** Maximum length of the strings returned by
+ * pa_sw_volume_snprint_dB(). Please note that this value can change with
+ * any release without warning and without being considered API or ABI
+ * breakage. You should not use this definition anywhere where it
+ * might become part of an ABI. \since 0.9.15 */
+#define PA_SW_VOLUME_SNPRINT_DB_MAX 11
+
+/** Pretty print a volume but show dB values. \since 0.9.15 */
+char *pa_sw_volume_snprint_dB(char *s, size_t l, pa_volume_t v);
+
+/** Maximum length of the strings returned by pa_volume_snprint_verbose().
+ * Please note that this value can change with any release without warning and
+ * withou being considered API or ABI breakage. You should not use this
+ * definition anywhere where it might become part of an ABI. \since 5.0 */
+#define PA_VOLUME_SNPRINT_VERBOSE_MAX 35
+
+/** Pretty print a volume in a verbose way. The volume is printed in several
+ * formats: the raw pa_volume_t value, percentage, and if print_dB is non-zero,
+ * also the dB value. \since 5.0 */
+char *pa_volume_snprint_verbose(char *s, size_t l, pa_volume_t v, int print_dB);
+
+/** Return the average volume of all channels */
+pa_volume_t pa_cvolume_avg(const pa_cvolume *a) PA_GCC_PURE;
+
+/** Return the average volume of all channels that are included in the
+ * specified channel map with the specified channel position mask. If
+ * cm is NULL this call is identical to pa_cvolume_avg(). If no
+ * channel is selected the returned value will be
+ * PA_VOLUME_MUTED. \since 0.9.16 */
+pa_volume_t pa_cvolume_avg_mask(const pa_cvolume *a, const pa_channel_map *cm, pa_channel_position_mask_t mask) PA_GCC_PURE;
+
+/** Return the maximum volume of all channels. \since 0.9.12 */
+pa_volume_t pa_cvolume_max(const pa_cvolume *a) PA_GCC_PURE;
+
+/** Return the maximum volume of all channels that are included in the
+ * specified channel map with the specified channel position mask. If
+ * cm is NULL this call is identical to pa_cvolume_max(). If no
+ * channel is selected the returned value will be PA_VOLUME_MUTED.
+ * \since 0.9.16 */
+pa_volume_t pa_cvolume_max_mask(const pa_cvolume *a, const pa_channel_map *cm, pa_channel_position_mask_t mask) PA_GCC_PURE;
+
+/** Return the minimum volume of all channels. \since 0.9.16 */
+pa_volume_t pa_cvolume_min(const pa_cvolume *a) PA_GCC_PURE;
+
+/** Return the minimum volume of all channels that are included in the
+ * specified channel map with the specified channel position mask. If
+ * cm is NULL this call is identical to pa_cvolume_min(). If no
+ * channel is selected the returned value will be PA_VOLUME_MUTED.
+ * \since 0.9.16 */
+pa_volume_t pa_cvolume_min_mask(const pa_cvolume *a, const pa_channel_map *cm, pa_channel_position_mask_t mask) PA_GCC_PURE;
+
+/** Return non-zero when the passed cvolume structure is valid */
+int pa_cvolume_valid(const pa_cvolume *v) PA_GCC_PURE;
+
+/** Return non-zero if the volume of all channels is equal to the specified value */
+int pa_cvolume_channels_equal_to(const pa_cvolume *a, pa_volume_t v) PA_GCC_PURE;
+
+/** Return 1 if the specified volume has all channels muted */
+#define pa_cvolume_is_muted(a) pa_cvolume_channels_equal_to((a), PA_VOLUME_MUTED)
+
+/** Return 1 if the specified volume has all channels on normal level */
+#define pa_cvolume_is_norm(a) pa_cvolume_channels_equal_to((a), PA_VOLUME_NORM)
+
+/** Multiply two volume specifications, return the result. This uses
+ * PA_VOLUME_NORM as neutral element of multiplication. This is only
+ * valid for software volumes! */
+pa_volume_t pa_sw_volume_multiply(pa_volume_t a, pa_volume_t b) PA_GCC_CONST;
+
+/** Multiply two per-channel volumes and return the result in
+ * *dest. This is only valid for software volumes! a, b and dest may
+ * point to the same structure. */
+pa_cvolume *pa_sw_cvolume_multiply(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b);
+
+/** Multiply a per-channel volume with a scalar volume and return the
+ * result in *dest. This is only valid for software volumes! a
+ * and dest may point to the same structure. \since
+ * 0.9.16 */
+pa_cvolume *pa_sw_cvolume_multiply_scalar(pa_cvolume *dest, const pa_cvolume *a, pa_volume_t b);
+
+/** Divide two volume specifications, return the result. This uses
+ * PA_VOLUME_NORM as neutral element of division. This is only valid
+ * for software volumes! If a division by zero is tried the result
+ * will be 0. \since 0.9.13 */
+pa_volume_t pa_sw_volume_divide(pa_volume_t a, pa_volume_t b) PA_GCC_CONST;
+
+/** Divide two per-channel volumes and return the result in
+ * *dest. This is only valid for software volumes! a, b
+ * and dest may point to the same structure. \since 0.9.13 */
+pa_cvolume *pa_sw_cvolume_divide(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b);
+
+/** Divide a per-channel volume by a scalar volume and return the
+ * result in *dest. This is only valid for software volumes! a
+ * and dest may point to the same structure. \since
+ * 0.9.16 */
+pa_cvolume *pa_sw_cvolume_divide_scalar(pa_cvolume *dest, const pa_cvolume *a, pa_volume_t b);
+
+/** Convert a decibel value to a volume (amplitude, not power). This is only valid for software volumes! */
+pa_volume_t pa_sw_volume_from_dB(double f) PA_GCC_CONST;
+
+/** Convert a volume to a decibel value (amplitude, not power). This is only valid for software volumes! */
+double pa_sw_volume_to_dB(pa_volume_t v) PA_GCC_CONST;
+
+/** Convert a linear factor to a volume. 0.0 and less is muted while
+ * 1.0 is PA_VOLUME_NORM. This is only valid for software volumes! */
+pa_volume_t pa_sw_volume_from_linear(double v) PA_GCC_CONST;
+
+/** Convert a volume to a linear factor. This is only valid for software volumes! */
+double pa_sw_volume_to_linear(pa_volume_t v) PA_GCC_CONST;
+
+#ifdef INFINITY
+#define PA_DECIBEL_MININFTY ((double) -INFINITY)
+#else
+/** This floor value is used as minus infinity when using pa_sw_volume_to_dB() / pa_sw_volume_from_dB(). */
+#define PA_DECIBEL_MININFTY ((double) -200.0)
+#endif
+
+/** Remap a volume from one channel mapping to a different channel mapping. \since 0.9.12 */
+pa_cvolume *pa_cvolume_remap(pa_cvolume *v, const pa_channel_map *from, const pa_channel_map *to);
+
+/** Return non-zero if the specified volume is compatible with the
+ * specified sample spec. \since 0.9.13 */
+int pa_cvolume_compatible(const pa_cvolume *v, const pa_sample_spec *ss) PA_GCC_PURE;
+
+/** Return non-zero if the specified volume is compatible with the
+ * specified sample spec. \since 0.9.15 */
+int pa_cvolume_compatible_with_channel_map(const pa_cvolume *v, const pa_channel_map *cm) PA_GCC_PURE;
+
+/** Calculate a 'balance' value for the specified volume with the
+ * specified channel map. The return value will range from -1.0f
+ * (left) to +1.0f (right). If no balance value is applicable to this
+ * channel map the return value will always be 0.0f. See
+ * pa_channel_map_can_balance(). \since 0.9.15 */
+float pa_cvolume_get_balance(const pa_cvolume *v, const pa_channel_map *map) PA_GCC_PURE;
+
+/** Adjust the 'balance' value for the specified volume with the
+ * specified channel map. v will be modified in place and
+ * returned. The balance is a value between -1.0f and +1.0f. This
+ * operation might not be reversible! Also, after this call
+ * pa_cvolume_get_balance() is not guaranteed to actually return the
+ * requested balance value (e.g. when the input volume was zero anyway for
+ * all channels). If no balance value is applicable to
+ * this channel map the volume will not be modified. See
+ * pa_channel_map_can_balance(). \since 0.9.15 */
+pa_cvolume* pa_cvolume_set_balance(pa_cvolume *v, const pa_channel_map *map, float new_balance);
+
+/** Calculate a 'fade' value (i.e.\ 'balance' between front and rear)
+ * for the specified volume with the specified channel map. The return
+ * value will range from -1.0f (rear) to +1.0f (left). If no fade
+ * value is applicable to this channel map the return value will
+ * always be 0.0f. See pa_channel_map_can_fade(). \since 0.9.15 */
+float pa_cvolume_get_fade(const pa_cvolume *v, const pa_channel_map *map) PA_GCC_PURE;
+
+/** Adjust the 'fade' value (i.e.\ 'balance' between front and rear)
+ * for the specified volume with the specified channel map. v will be
+ * modified in place and returned. The balance is a value between
+ * -1.0f and +1.0f. This operation might not be reversible! Also,
+ * after this call pa_cvolume_get_fade() is not guaranteed to actually
+ * return the requested fade value (e.g. when the input volume was
+ * zero anyway for all channels). If no fade value is applicable to
+ * this channel map the volume will not be modified. See
+ * pa_channel_map_can_fade(). \since 0.9.15 */
+pa_cvolume* pa_cvolume_set_fade(pa_cvolume *v, const pa_channel_map *map, float new_fade);
+
+/** Calculate a 'lfe balance' value for the specified volume with
+ * the specified channel map. The return value will range from
+ * -1.0f (no lfe) to +1.0f (only lfe), where 0.0f is balanced.
+ * If no value is applicable to this channel map the return value
+ * will always be 0.0f. See pa_channel_map_can_lfe_balance(). \since 8.0 */
+float pa_cvolume_get_lfe_balance(const pa_cvolume *v, const pa_channel_map *map) PA_GCC_PURE;
+
+/** Adjust the 'lfe balance' value for the specified volume with
+ * the specified channel map. v will be modified in place and returned.
+ * The balance is a value between -1.0f (no lfe) and +1.0f (only lfe).
+ * This operation might not be reversible! Also, after this call
+ * pa_cvolume_get_lfe_balance() is not guaranteed to actually
+ * return the requested value (e.g. when the input volume was
+ * zero anyway for all channels). If no lfe balance value is applicable to
+ * this channel map the volume will not be modified. See
+ * pa_channel_map_can_lfe_balance(). \since 8.0 */
+pa_cvolume* pa_cvolume_set_lfe_balance(pa_cvolume *v, const pa_channel_map *map, float new_balance);
+
+/** Scale the passed pa_cvolume structure so that the maximum volume
+ * of all channels equals max. The proportions between the channel
+ * volumes are kept. \since 0.9.15 */
+pa_cvolume* pa_cvolume_scale(pa_cvolume *v, pa_volume_t max);
+
+/** Scale the passed pa_cvolume structure so that the maximum volume
+ * of all channels selected via cm/mask equals max. This also modifies
+ * the volume of those channels that are unmasked. The proportions
+ * between the channel volumes are kept. \since 0.9.16 */
+pa_cvolume* pa_cvolume_scale_mask(pa_cvolume *v, pa_volume_t max, pa_channel_map *cm, pa_channel_position_mask_t mask);
+
+/** Set the passed volume to all channels at the specified channel
+ * position. Will return the updated volume struct, or NULL if there
+ * is no channel at the position specified. You can check if a channel
+ * map includes a specific position by calling
+ * pa_channel_map_has_position(). \since 0.9.16 */
+pa_cvolume* pa_cvolume_set_position(pa_cvolume *cv, const pa_channel_map *map, pa_channel_position_t t, pa_volume_t v);
+
+/** Get the maximum volume of all channels at the specified channel
+ * position. Will return 0 if there is no channel at the position
+ * specified. You can check if a channel map includes a specific
+ * position by calling pa_channel_map_has_position(). \since 0.9.16 */
+pa_volume_t pa_cvolume_get_position(pa_cvolume *cv, const pa_channel_map *map, pa_channel_position_t t) PA_GCC_PURE;
+
+/** This goes through all channels in a and b and sets the
+ * corresponding channel in dest to the greater volume of both. a, b
+ * and dest may point to the same structure. \since 0.9.16 */
+pa_cvolume* pa_cvolume_merge(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b);
+
+/** Increase the volume passed in by 'inc', but not exceeding 'limit'.
+ * The proportions between the channels are kept. \since 0.9.19 */
+pa_cvolume* pa_cvolume_inc_clamp(pa_cvolume *v, pa_volume_t inc, pa_volume_t limit);
+
+/** Increase the volume passed in by 'inc'. The proportions between
+ * the channels are kept. \since 0.9.16 */
+pa_cvolume* pa_cvolume_inc(pa_cvolume *v, pa_volume_t inc);
+
+/** Decrease the volume passed in by 'dec'. The proportions between
+ * the channels are kept. \since 0.9.16 */
+pa_cvolume* pa_cvolume_dec(pa_cvolume *v, pa_volume_t dec);
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/pulse/xmalloc.h b/thirdparty/linuxbsd_headers/pulse/xmalloc.h
new file mode 100644
index 0000000000..d1d6968a3f
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/pulse/xmalloc.h
@@ -0,0 +1,105 @@
+#ifndef foomemoryhfoo
+#define foomemoryhfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+
+ PulseAudio 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; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <sys/types.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <assert.h>
+
+#include <pulse/cdecl.h>
+#include <pulse/gccmacro.h>
+#include <pulse/version.h>
+
+/** \file
+ * Memory allocation functions.
+ */
+
+PA_C_DECL_BEGIN
+
+/** Allocate the specified number of bytes, just like malloc() does. However, in case of OOM, terminate */
+void* pa_xmalloc(size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(1);
+
+/** Same as pa_xmalloc(), but initialize allocated memory to 0 */
+void *pa_xmalloc0(size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(1);
+
+/** The combination of pa_xmalloc() and realloc() */
+void *pa_xrealloc(void *ptr, size_t size) PA_GCC_ALLOC_SIZE(2);
+
+/** Free allocated memory */
+void pa_xfree(void *p);
+
+/** Duplicate the specified string, allocating memory with pa_xmalloc() */
+char *pa_xstrdup(const char *s) PA_GCC_MALLOC;
+
+/** Duplicate the specified string, but truncate after l characters */
+char *pa_xstrndup(const char *s, size_t l) PA_GCC_MALLOC;
+
+/** Duplicate the specified memory block */
+void* pa_xmemdup(const void *p, size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(2);
+
+/** Internal helper for pa_xnew() */
+static void* _pa_xnew_internal(size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(1,2);
+
+static inline void* _pa_xnew_internal(size_t n, size_t k) {
+ assert(n < INT_MAX/k);
+ return pa_xmalloc(n*k);
+}
+
+/** Allocate n new structures of the specified type. */
+#define pa_xnew(type, n) ((type*) _pa_xnew_internal((n), sizeof(type)))
+
+/** Internal helper for pa_xnew0() */
+static void* _pa_xnew0_internal(size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(1,2);
+
+static inline void* _pa_xnew0_internal(size_t n, size_t k) {
+ assert(n < INT_MAX/k);
+ return pa_xmalloc0(n*k);
+}
+
+/** Same as pa_xnew() but set the memory to zero */
+#define pa_xnew0(type, n) ((type*) _pa_xnew0_internal((n), sizeof(type)))
+
+/** Internal helper for pa_xnew0() */
+static void* _pa_xnewdup_internal(const void *p, size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(2,3);
+
+static inline void* _pa_xnewdup_internal(const void *p, size_t n, size_t k) {
+ assert(n < INT_MAX/k);
+ return pa_xmemdup(p, n*k);
+}
+
+/** Same as pa_xnew() but duplicate the specified data */
+#define pa_xnewdup(type, p, n) ((type*) _pa_xnewdup_internal((p), (n), sizeof(type)))
+
+/** Internal helper for pa_xrenew() */
+static void* _pa_xrenew_internal(void *p, size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(2,3);
+
+static inline void* _pa_xrenew_internal(void *p, size_t n, size_t k) {
+ assert(n < INT_MAX/k);
+ return pa_xrealloc(p, n*k);
+}
+
+/** Reallocate n new structures of the specified type. */
+#define pa_xrenew(type, p, n) ((type*) _pa_xrenew_internal(p, (n), sizeof(type)))
+
+PA_C_DECL_END
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/speechd/libspeechd.h b/thirdparty/linuxbsd_headers/speechd/libspeechd.h
new file mode 100644
index 0000000000..21b9313cae
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/speechd/libspeechd.h
@@ -0,0 +1,248 @@
+/*
+ * libspeechd.h - Shared library for easy acces to Speech Dispatcher functions (header)
+ *
+ * Copyright (C) 2001, 2002, 2003, 2004 Brailcom, o.p.s.
+ *
+ * This 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; either version 2.1, or (at your option)
+ * any later version.
+ *
+ * This software 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 package; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $Id: libspeechd.h,v 1.29 2008-07-30 09:47:00 hanke Exp $
+ */
+
+#ifndef _LIBSPEECHD_H
+#define _LIBSPEECHD_H
+
+#include <stdio.h>
+#include <stddef.h>
+#include <pthread.h>
+
+#include "libspeechd_version.h"
+#include "speechd_types.h"
+
+/* *INDENT-OFF* */
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* *INDENT-ON* */
+ /* Speech Dispatcher's default port for inet communication */
+#define SPEECHD_DEFAULT_PORT 6560
+
+ /* Arguments for spd_send_data() */
+#define SPD_WAIT_REPLY 1 /* Wait for reply */
+#define SPD_NO_REPLY 0 /* No reply requested */
+
+ /* --------------------- Public data types ------------------------ */
+
+typedef enum {
+ SPD_MODE_SINGLE = 0,
+ SPD_MODE_THREADED = 1
+} SPDConnectionMode;
+
+typedef enum {
+ SPD_METHOD_UNIX_SOCKET = 0,
+ SPD_METHOD_INET_SOCKET = 1,
+} SPDConnectionMethod;
+
+typedef struct {
+ SPDConnectionMethod method;
+ char *unix_socket_name;
+ char *inet_socket_host;
+ int inet_socket_port;
+ char *dbus_bus;
+} SPDConnectionAddress;
+
+void SPDConnectionAddress__free(SPDConnectionAddress * address);
+
+typedef void (*SPDCallback) (size_t msg_id, size_t client_id,
+ SPDNotificationType state);
+typedef void (*SPDCallbackIM) (size_t msg_id, size_t client_id,
+ SPDNotificationType state, char *index_mark);
+
+typedef struct {
+
+ /* PUBLIC */
+ SPDCallback callback_begin;
+ SPDCallback callback_end;
+ SPDCallback callback_cancel;
+ SPDCallback callback_pause;
+ SPDCallback callback_resume;
+ SPDCallbackIM callback_im;
+
+ /* PRIVATE */
+ int socket;
+ FILE *stream;
+ SPDConnectionMode mode;
+
+ pthread_mutex_t *ssip_mutex;
+
+ pthread_t *events_thread;
+ pthread_mutex_t *comm_mutex;
+ pthread_cond_t *cond_reply_ready;
+ pthread_mutex_t *mutex_reply_ready;
+ pthread_cond_t *cond_reply_ack;
+ pthread_mutex_t *mutex_reply_ack;
+
+ char *reply;
+
+} SPDConnection;
+
+/* -------------- Public functions --------------------------*/
+
+/* Opening and closing Speech Dispatcher connection */
+SPDConnectionAddress *spd_get_default_address(char **error);
+SPDConnection *spd_open(const char *client_name, const char *connection_name,
+ const char *user_name, SPDConnectionMode mode);
+SPDConnection *spd_open2(const char *client_name, const char *connection_name,
+ const char *user_name, SPDConnectionMode mode,
+ SPDConnectionAddress * address, int autospawn,
+ char **error_result);
+
+void spd_close(SPDConnection * connection);
+
+/* Speaking */
+int spd_say(SPDConnection * connection, SPDPriority priority, const char *text);
+int spd_sayf(SPDConnection * connection, SPDPriority priority,
+ const char *format, ...);
+
+/* Speech flow */
+int spd_stop(SPDConnection * connection);
+int spd_stop_all(SPDConnection * connection);
+int spd_stop_uid(SPDConnection * connection, int target_uid);
+
+int spd_cancel(SPDConnection * connection);
+int spd_cancel_all(SPDConnection * connection);
+int spd_cancel_uid(SPDConnection * connection, int target_uid);
+
+int spd_pause(SPDConnection * connection);
+int spd_pause_all(SPDConnection * connection);
+int spd_pause_uid(SPDConnection * connection, int target_uid);
+
+int spd_resume(SPDConnection * connection);
+int spd_resume_all(SPDConnection * connection);
+int spd_resume_uid(SPDConnection * connection, int target_uid);
+
+/* Characters and keys */
+int spd_key(SPDConnection * connection, SPDPriority priority,
+ const char *key_name);
+int spd_char(SPDConnection * connection, SPDPriority priority,
+ const char *character);
+int spd_wchar(SPDConnection * connection, SPDPriority priority,
+ wchar_t wcharacter);
+
+/* Sound icons */
+int spd_sound_icon(SPDConnection * connection, SPDPriority priority,
+ const char *icon_name);
+
+/* Setting parameters */
+int spd_set_voice_type(SPDConnection *, SPDVoiceType type);
+int spd_set_voice_type_all(SPDConnection *, SPDVoiceType type);
+int spd_set_voice_type_uid(SPDConnection *, SPDVoiceType type,
+ unsigned int uid);
+SPDVoiceType spd_get_voice_type(SPDConnection *);
+
+int spd_set_synthesis_voice(SPDConnection *, const char *voice_name);
+int spd_set_synthesis_voice_all(SPDConnection *, const char *voice_name);
+int spd_set_synthesis_voice_uid(SPDConnection *, const char *voice_name,
+ unsigned int uid);
+
+int spd_set_data_mode(SPDConnection * connection, SPDDataMode mode);
+
+int spd_set_notification_on(SPDConnection * connection,
+ SPDNotification notification);
+int spd_set_notification_off(SPDConnection * connection,
+ SPDNotification notification);
+int spd_set_notification(SPDConnection * connection,
+ SPDNotification notification, const char *state);
+
+int spd_set_voice_rate(SPDConnection * connection, signed int rate);
+int spd_set_voice_rate_all(SPDConnection * connection, signed int rate);
+int spd_set_voice_rate_uid(SPDConnection * connection, signed int rate,
+ unsigned int uid);
+int spd_get_voice_rate(SPDConnection * connection);
+
+int spd_set_voice_pitch(SPDConnection * connection, signed int pitch);
+int spd_set_voice_pitch_all(SPDConnection * connection, signed int pitch);
+int spd_set_voice_pitch_uid(SPDConnection * connection, signed int pitch,
+ unsigned int uid);
+int spd_get_voice_pitch(SPDConnection * connection);
+
+int spd_set_volume(SPDConnection * connection, signed int volume);
+int spd_set_volume_all(SPDConnection * connection, signed int volume);
+int spd_set_volume_uid(SPDConnection * connection, signed int volume,
+ unsigned int uid);
+int spd_get_volume(SPDConnection * connection);
+
+int spd_set_punctuation(SPDConnection * connection, SPDPunctuation type);
+int spd_set_punctuation_all(SPDConnection * connection, SPDPunctuation type);
+int spd_set_punctuation_uid(SPDConnection * connection, SPDPunctuation type,
+ unsigned int uid);
+
+int spd_set_capital_letters(SPDConnection * connection, SPDCapitalLetters type);
+int spd_set_capital_letters_all(SPDConnection * connection,
+ SPDCapitalLetters type);
+int spd_set_capital_letters_uid(SPDConnection * connection,
+ SPDCapitalLetters type, unsigned int uid);
+
+int spd_set_spelling(SPDConnection * connection, SPDSpelling type);
+int spd_set_spelling_all(SPDConnection * connection, SPDSpelling type);
+int spd_set_spelling_uid(SPDConnection * connection, SPDSpelling type,
+ unsigned int uid);
+
+int spd_set_language(SPDConnection * connection, const char *language);
+int spd_set_language_all(SPDConnection * connection, const char *language);
+int spd_set_language_uid(SPDConnection * connection, const char *language,
+ unsigned int uid);
+char *spd_get_language(SPDConnection * connection);
+
+int spd_set_output_module(SPDConnection * connection,
+ const char *output_module);
+int spd_set_output_module_all(SPDConnection * connection,
+ const char *output_module);
+int spd_set_output_module_uid(SPDConnection * connection,
+ const char *output_module, unsigned int uid);
+
+int spd_get_client_list(SPDConnection * connection, char **client_names,
+ int *client_ids, int *active);
+int spd_get_message_list_fd(SPDConnection * connection, int target,
+ int *msg_ids, char **client_names);
+
+char **spd_list_modules(SPDConnection * connection);
+void free_spd_modules(char **);
+char *spd_get_output_module(SPDConnection * connection);
+
+char **spd_list_voices(SPDConnection * connection);
+SPDVoice **spd_list_synthesis_voices(SPDConnection * connection);
+void free_spd_voices(SPDVoice ** voices);
+char **spd_execute_command_with_list_reply(SPDConnection * connection,
+ char *command);
+
+/* Direct SSIP communication */
+int spd_execute_command(SPDConnection * connection, char *command);
+int spd_execute_command_with_reply(SPDConnection * connection, char *command,
+ char **reply);
+int spd_execute_command_wo_mutex(SPDConnection * connection, char *command);
+char *spd_send_data(SPDConnection * connection, const char *message, int wfr);
+char *spd_send_data_wo_mutex(SPDConnection * connection, const char *message,
+ int wfr);
+
+
+
+/* *INDENT-OFF* */
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+/* *INDENT-ON* */
+
+#endif /* ifndef _LIBSPEECHD_H */
diff --git a/thirdparty/linuxbsd_headers/speechd/libspeechd_version.h b/thirdparty/linuxbsd_headers/speechd/libspeechd_version.h
new file mode 100644
index 0000000000..bfe4d6bc21
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/speechd/libspeechd_version.h
@@ -0,0 +1,31 @@
+/*
+ * libspeechd_version.h - Shared library for easy access to Speech Dispatcher functions (header)
+ *
+ * Copyright (C) 2001, 2002, 2003, 2004 Brailcom, o.p.s.
+ *
+ * This 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; either version 2.1, or (at your option)
+ * any later version.
+ *
+ * This software 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 package; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $Id: libspeechd.h,v 1.29 2008-07-30 09:47:00 hanke Exp $
+ */
+
+#ifndef _LIBSPEECHD_VERSION_H
+#define _LIBSPEECHD_VERSION_H
+
+#define LIBSPEECHD_MAJOR_VERSION 0
+#define LIBSPEECHD_MINOR_VERSION 8
+#define LIBSPEECHD_MICRO_VERSION 8
+
+#endif /* ifndef _LIBSPEECHD_VERSION_H */
diff --git a/thirdparty/linuxbsd_headers/speechd/spd_audio_plugin.h b/thirdparty/linuxbsd_headers/speechd/spd_audio_plugin.h
new file mode 100644
index 0000000000..85f2850972
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/speechd/spd_audio_plugin.h
@@ -0,0 +1,75 @@
+/*
+ * spd_audio_plugin.h -- The SPD Audio Plugin Header
+ *
+ * Copyright (C) 2004 Brailcom, o.p.s.
+ *
+ * This 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; either version 2.1, or (at your option) any later
+ * version.
+ *
+ * This software 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this package; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ */
+
+#ifndef __SPD_AUDIO_PLUGIN_H
+#define __SPD_AUDIO_PLUGIN_H
+
+#define SPD_AUDIO_PLUGIN_ENTRY_STR "spd_audio_plugin_get"
+
+/* *INDENT-OFF* */
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* *INDENT-ON* */
+
+typedef enum { SPD_AUDIO_LE, SPD_AUDIO_BE } AudioFormat;
+
+typedef struct {
+ int bits;
+ int num_channels;
+ int sample_rate;
+
+ int num_samples;
+ signed short *samples;
+} AudioTrack;
+
+struct spd_audio_plugin;
+
+typedef struct {
+
+ int volume;
+ AudioFormat format;
+
+ struct spd_audio_plugin const *function;
+ void *private_data;
+
+ int working;
+} AudioID;
+
+typedef struct spd_audio_plugin {
+ const char *name;
+ AudioID *(*open) (void **pars);
+ int (*play) (AudioID * id, AudioTrack track);
+ int (*stop) (AudioID * id);
+ int (*close) (AudioID * id);
+ int (*set_volume) (AudioID * id, int);
+ void (*set_loglevel) (int level);
+ char const *(*get_playcmd) (void);
+} spd_audio_plugin_t;
+
+/* *INDENT-OFF* */
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+/* *INDENT-ON* */
+
+#endif /* ifndef #__SPD_AUDIO_PLUGIN_H */
diff --git a/thirdparty/linuxbsd_headers/speechd/speechd_defines.h b/thirdparty/linuxbsd_headers/speechd/speechd_defines.h
new file mode 100644
index 0000000000..f1cd195339
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/speechd/speechd_defines.h
@@ -0,0 +1,34 @@
+/*
+ * speechd_defines.h - macros for Speech Dispatcher
+ *
+ * Copyright (C) 2015 Brailcom, o.p.s.
+ *
+ * This 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; either version 2.1, or (at your option)
+ * any later version.
+ *
+ * This software 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 package; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SPEECHD_DEFINES_H
+#define SPEECHD_DEFINES_H
+
+#define SPD_ALLCLIENTS "ALL"
+#define SPD_SELF "SELF"
+#define SPD_VOLUME "VOLUME"
+#define SPD_PITCH "PITCH"
+#define SPD_RATE "RATE"
+#define SPD_LANGUAGE "LANGUAGE"
+#define SPD_OUTPUT_MODULE "OUTPUT_MODULE"
+#define SPD_SYNTHESIS_VOICE "SYNTHESIS_VOICE"
+
+#endif /* not ifndef SPEECHD_DEFINES_H */
diff --git a/thirdparty/linuxbsd_headers/speechd/speechd_types.h b/thirdparty/linuxbsd_headers/speechd/speechd_types.h
new file mode 100644
index 0000000000..07c1974ff0
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/speechd/speechd_types.h
@@ -0,0 +1,119 @@
+
+/*
+ * speechd_types.h - types for Speech Dispatcher
+ *
+ * Copyright (C) 2001, 2002, 2003 Brailcom, o.p.s.
+ *
+ * This 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; either version 2.1, or (at your option)
+ * any later version.
+ *
+ * This software 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 package; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SPEECHD_TYPES_H
+#define SPEECHD_TYPES_H
+
+typedef enum {
+ SPD_PUNCT_ALL = 0,
+ SPD_PUNCT_NONE = 1,
+ SPD_PUNCT_SOME = 2
+} SPDPunctuation;
+
+typedef enum {
+ SPD_CAP_NONE = 0,
+ SPD_CAP_SPELL = 1,
+ SPD_CAP_ICON = 2
+} SPDCapitalLetters;
+
+typedef enum {
+ SPD_SPELL_OFF = 0,
+ SPD_SPELL_ON = 1
+} SPDSpelling;
+
+typedef enum {
+ SPD_MALE1 = 1,
+ SPD_MALE2 = 2,
+ SPD_MALE3 = 3,
+ SPD_FEMALE1 = 4,
+ SPD_FEMALE2 = 5,
+ SPD_FEMALE3 = 6,
+ SPD_CHILD_MALE = 7,
+ SPD_CHILD_FEMALE = 8
+} SPDVoiceType;
+
+typedef struct {
+ char *name; /* Name of the voice (id) */
+ char *language; /* 2-letter ISO language code */
+ char *variant; /* a not-well defined string describing dialect etc. */
+} SPDVoice;
+
+typedef enum {
+ SPD_DATA_TEXT = 0,
+ SPD_DATA_SSML = 1
+} SPDDataMode;
+
+typedef enum {
+ SPD_IMPORTANT = 1,
+ SPD_MESSAGE = 2,
+ SPD_TEXT = 3,
+ SPD_NOTIFICATION = 4,
+ SPD_PROGRESS = 5
+} SPDPriority;
+
+typedef enum {
+ SPD_BEGIN = 1,
+ SPD_END = 2,
+ SPD_INDEX_MARKS = 4,
+ SPD_CANCEL = 8,
+ SPD_PAUSE = 16,
+ SPD_RESUME = 32,
+
+ SPD_ALL = 0x3f
+} SPDNotification;
+
+typedef enum {
+ SPD_EVENT_BEGIN,
+ SPD_EVENT_END,
+ SPD_EVENT_INDEX_MARK,
+ SPD_EVENT_CANCEL,
+ SPD_EVENT_PAUSE,
+ SPD_EVENT_RESUME
+} SPDNotificationType;
+
+typedef enum {
+ SORT_BY_TIME = 0,
+ SORT_BY_ALPHABET = 1
+} ESort;
+
+typedef enum {
+ SPD_MSGTYPE_TEXT = 0,
+ SPD_MSGTYPE_SOUND_ICON = 1,
+ SPD_MSGTYPE_CHAR = 2,
+ SPD_MSGTYPE_KEY = 3,
+ SPD_MSGTYPE_SPELL = 99
+} SPDMessageType;
+
+typedef struct {
+ signed int rate;
+ signed int pitch;
+ signed int volume;
+
+ SPDPunctuation punctuation_mode;
+ SPDSpelling spelling_mode;
+ SPDCapitalLetters cap_let_recogn;
+
+ SPDVoiceType voice_type;
+ SPDVoice voice;
+} SPDMsgSettings;
+
+#endif /* not ifndef SPEECHD_TYPES */
diff --git a/thirdparty/linuxbsd_headers/udev/libudev.h b/thirdparty/linuxbsd_headers/udev/libudev.h
new file mode 100644
index 0000000000..be465a0043
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/udev/libudev.h
@@ -0,0 +1,208 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+/***
+ This file is part of systemd.
+
+ Copyright 2008-2012 Kay Sievers <kay@vrfy.org>
+
+ systemd 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; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd 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 systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#ifndef _LIBUDEV_H_
+#define _LIBUDEV_H_
+
+#include <stdarg.h>
+#include <sys/sysmacros.h>
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * udev - library context
+ *
+ * reads the udev config and system environment
+ * allows custom logging
+ */
+struct udev;
+struct udev *udev_ref(struct udev *udev);
+struct udev *udev_unref(struct udev *udev);
+struct udev *udev_new(void);
+void udev_set_log_fn(struct udev *udev,
+ void (*log_fn)(struct udev *udev,
+ int priority, const char *file, int line, const char *fn,
+ const char *format, va_list args)) __attribute__ ((deprecated));
+int udev_get_log_priority(struct udev *udev) __attribute__ ((deprecated));
+void udev_set_log_priority(struct udev *udev, int priority) __attribute__ ((deprecated));
+void *udev_get_userdata(struct udev *udev);
+void udev_set_userdata(struct udev *udev, void *userdata);
+
+/*
+ * udev_list
+ *
+ * access to libudev generated lists
+ */
+struct udev_list_entry;
+struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry);
+struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name);
+const char *udev_list_entry_get_name(struct udev_list_entry *list_entry);
+const char *udev_list_entry_get_value(struct udev_list_entry *list_entry);
+/**
+ * udev_list_entry_foreach:
+ * @list_entry: entry to store the current position
+ * @first_entry: first entry to start with
+ *
+ * Helper to iterate over all entries of a list.
+ */
+#define udev_list_entry_foreach(list_entry, first_entry) \
+ for (list_entry = first_entry; \
+ list_entry != NULL; \
+ list_entry = udev_list_entry_get_next(list_entry))
+
+/*
+ * udev_device
+ *
+ * access to sysfs/kernel devices
+ */
+struct udev_device;
+struct udev_device *udev_device_ref(struct udev_device *udev_device);
+struct udev_device *udev_device_unref(struct udev_device *udev_device);
+struct udev *udev_device_get_udev(struct udev_device *udev_device);
+struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath);
+struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum);
+struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname);
+struct udev_device *udev_device_new_from_device_id(struct udev *udev, const char *id);
+struct udev_device *udev_device_new_from_environment(struct udev *udev);
+/* udev_device_get_parent_*() does not take a reference on the returned device, it is automatically unref'd with the parent */
+struct udev_device *udev_device_get_parent(struct udev_device *udev_device);
+struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device,
+ const char *subsystem, const char *devtype);
+/* retrieve device properties */
+const char *udev_device_get_devpath(struct udev_device *udev_device);
+const char *udev_device_get_subsystem(struct udev_device *udev_device);
+const char *udev_device_get_devtype(struct udev_device *udev_device);
+const char *udev_device_get_syspath(struct udev_device *udev_device);
+const char *udev_device_get_sysname(struct udev_device *udev_device);
+const char *udev_device_get_sysnum(struct udev_device *udev_device);
+const char *udev_device_get_devnode(struct udev_device *udev_device);
+int udev_device_get_is_initialized(struct udev_device *udev_device);
+struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device);
+struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device);
+struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device);
+struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device);
+const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key);
+const char *udev_device_get_driver(struct udev_device *udev_device);
+dev_t udev_device_get_devnum(struct udev_device *udev_device);
+const char *udev_device_get_action(struct udev_device *udev_device);
+unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device);
+unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device);
+const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr);
+int udev_device_set_sysattr_value(struct udev_device *udev_device, const char *sysattr, char *value);
+int udev_device_has_tag(struct udev_device *udev_device, const char *tag);
+
+/*
+ * udev_monitor
+ *
+ * access to kernel uevents and udev events
+ */
+struct udev_monitor;
+struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor);
+struct udev_monitor *udev_monitor_unref(struct udev_monitor *udev_monitor);
+struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor);
+/* kernel and udev generated events over netlink */
+struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name);
+/* bind socket */
+int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor);
+int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size);
+int udev_monitor_get_fd(struct udev_monitor *udev_monitor);
+struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor);
+/* in-kernel socket filters to select messages that get delivered to a listener */
+int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor,
+ const char *subsystem, const char *devtype);
+int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag);
+int udev_monitor_filter_update(struct udev_monitor *udev_monitor);
+int udev_monitor_filter_remove(struct udev_monitor *udev_monitor);
+
+/*
+ * udev_enumerate
+ *
+ * search sysfs for specific devices and provide a sorted list
+ */
+struct udev_enumerate;
+struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate);
+struct udev_enumerate *udev_enumerate_unref(struct udev_enumerate *udev_enumerate);
+struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate);
+struct udev_enumerate *udev_enumerate_new(struct udev *udev);
+/* device properties filter */
+int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem);
+int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem);
+int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value);
+int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value);
+int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value);
+int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname);
+int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag);
+int udev_enumerate_add_match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *parent);
+int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate);
+int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath);
+/* run enumeration with active filters */
+int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate);
+int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate);
+/* return device list */
+struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate);
+
+/*
+ * udev_queue
+ *
+ * access to the currently running udev events
+ */
+struct udev_queue;
+struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue);
+struct udev_queue *udev_queue_unref(struct udev_queue *udev_queue);
+struct udev *udev_queue_get_udev(struct udev_queue *udev_queue);
+struct udev_queue *udev_queue_new(struct udev *udev);
+unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) __attribute__ ((deprecated));
+unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) __attribute__ ((deprecated));
+int udev_queue_get_udev_is_active(struct udev_queue *udev_queue);
+int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue);
+int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) __attribute__ ((deprecated));
+int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue,
+ unsigned long long int start, unsigned long long int end) __attribute__ ((deprecated));
+int udev_queue_get_fd(struct udev_queue *udev_queue);
+int udev_queue_flush(struct udev_queue *udev_queue);
+struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) __attribute__ ((deprecated));
+
+/*
+ * udev_hwdb
+ *
+ * access to the static hardware properties database
+ */
+struct udev_hwdb;
+struct udev_hwdb *udev_hwdb_new(struct udev *udev);
+struct udev_hwdb *udev_hwdb_ref(struct udev_hwdb *hwdb);
+struct udev_hwdb *udev_hwdb_unref(struct udev_hwdb *hwdb);
+struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev_hwdb *hwdb, const char *modalias, unsigned int flags);
+
+/*
+ * udev_util
+ *
+ * udev specific utilities
+ */
+int udev_util_encode_string(const char *str, char *str_enc, size_t len);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-compat.h b/thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-compat.h
new file mode 100644
index 0000000000..299732fdc3
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-compat.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright © 2012 Daniel Stone
+ *
+ * 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 (including the next
+ * paragraph) 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.
+ *
+ * Author: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifndef _XKBCOMMON_COMPAT_H
+#define _XKBCOMMON_COMPAT_H
+
+/**
+ * Renamed keymap API.
+ */
+#define xkb_group_index_t xkb_layout_index_t
+#define xkb_group_mask_t xkb_layout_mask_t
+#define xkb_map_compile_flags xkb_keymap_compile_flags
+#define XKB_GROUP_INVALID XKB_LAYOUT_INVALID
+
+#define XKB_STATE_DEPRESSED \
+ (XKB_STATE_MODS_DEPRESSED | XKB_STATE_LAYOUT_DEPRESSED)
+#define XKB_STATE_LATCHED \
+ (XKB_STATE_MODS_LATCHED | XKB_STATE_LAYOUT_LATCHED)
+#define XKB_STATE_LOCKED \
+ (XKB_STATE_MODS_LOCKED | XKB_STATE_LAYOUT_LOCKED)
+#define XKB_STATE_EFFECTIVE \
+ (XKB_STATE_DEPRESSED | XKB_STATE_LATCHED | XKB_STATE_LOCKED | \
+ XKB_STATE_MODS_EFFECTIVE | XKB_STATE_LAYOUT_EFFECTIVE)
+
+#define xkb_map_new_from_names(context, names, flags) \
+ xkb_keymap_new_from_names(context, names, flags)
+#define xkb_map_new_from_file(context, file, format, flags) \
+ xkb_keymap_new_from_file(context, file, format, flags)
+#define xkb_map_new_from_string(context, string, format, flags) \
+ xkb_keymap_new_from_string(context, string, format, flags)
+#define xkb_map_get_as_string(keymap) \
+ xkb_keymap_get_as_string(keymap, XKB_KEYMAP_FORMAT_TEXT_V1)
+#define xkb_map_ref(keymap) xkb_keymap_ref(keymap)
+#define xkb_map_unref(keymap) xkb_keymap_unref(keymap)
+
+#define xkb_map_num_mods(keymap) xkb_keymap_num_mods(keymap)
+#define xkb_map_mod_get_name(keymap, idx) xkb_keymap_mod_get_name(keymap, idx)
+#define xkb_map_mod_get_index(keymap, str) xkb_keymap_mod_get_index(keymap, str)
+#define xkb_key_mod_index_is_consumed(state, key, mod) \
+ xkb_state_mod_index_is_consumed(state, key, mod)
+#define xkb_key_mod_mask_remove_consumed(state, key, modmask) \
+ xkb_state_mod_mask_remove_consumed(state, key, modmask)
+
+#define xkb_map_num_groups(keymap) xkb_keymap_num_layouts(keymap)
+#define xkb_key_num_groups(keymap, key) \
+ xkb_keymap_num_layouts_for_key(keymap, key)
+#define xkb_map_group_get_name(keymap, idx) \
+ xkb_keymap_layout_get_name(keymap, idx)
+#define xkb_map_group_get_index(keymap, str) \
+ xkb_keymap_layout_get_index(keymap, str)
+
+#define xkb_map_num_leds(keymap) xkb_keymap_num_leds(keymap)
+#define xkb_map_led_get_name(keymap, idx) xkb_keymap_led_get_name(keymap, idx)
+#define xkb_map_led_get_index(keymap, str) \
+ xkb_keymap_led_get_index(keymap, str)
+
+#define xkb_key_repeats(keymap, key) xkb_keymap_key_repeats(keymap, key)
+
+#define xkb_key_get_syms(state, key, syms_out) \
+ xkb_state_key_get_syms(state, key, syms_out)
+
+#define xkb_state_group_name_is_active(state, name, type) \
+ xkb_state_layout_name_is_active(state, name, type)
+#define xkb_state_group_index_is_active(state, idx, type) \
+ xkb_state_layout_index_is_active(state, idx, type)
+
+#define xkb_state_serialize_group(state, component) \
+ xkb_state_serialize_layout(state, component)
+
+#define xkb_state_get_map(state) xkb_state_get_keymap(state)
+
+/* Not needed anymore, since there's NO_FLAGS. */
+#define XKB_MAP_COMPILE_PLACEHOLDER XKB_KEYMAP_COMPILE_NO_FLAGS
+#define XKB_MAP_COMPILE_NO_FLAGS XKB_KEYMAP_COMPILE_NO_FLAGS
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-compose.h b/thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-compose.h
new file mode 100644
index 0000000000..8b41b987aa
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-compose.h
@@ -0,0 +1,500 @@
+/*
+ * Copyright © 2013 Ran Benita
+ *
+ * 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 (including the next
+ * paragraph) 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 _XKBCOMMON_COMPOSE_H
+#define _XKBCOMMON_COMPOSE_H
+
+#include <xkbcommon/xkbcommon.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file
+ * libxkbcommon Compose API - support for Compose and dead-keys.
+ */
+
+/**
+ * @defgroup compose Compose and dead-keys support
+ * Support for Compose and dead-keys.
+ * @since 0.5.0
+ *
+ * @{
+ */
+
+/**
+ * @page compose-overview Overview
+ * @parblock
+ *
+ * Compose and dead-keys are a common feature of many keyboard input
+ * systems. They extend the range of the keysysm that can be produced
+ * directly from a keyboard by using a sequence of key strokes, instead
+ * of just one.
+ *
+ * Here are some example sequences, in the libX11 Compose file format:
+ *
+ * <dead_acute> <a> : "á" aacute # LATIN SMALL LETTER A WITH ACUTE
+ * <Multi_key> <A> <T> : "@" at # COMMERCIAL AT
+ *
+ * When the user presses a key which produces the `<dead_acute>` keysym,
+ * nothing initially happens (thus the key is dubbed a "dead-key"). But
+ * when the user enters `<a>`, "á" is "composed", in place of "a". If
+ * instead the user had entered a keysym which does not follow
+ * `<dead_acute>` in any compose sequence, the sequence is said to be
+ * "cancelled".
+ *
+ * Compose files define many such sequences. For a description of the
+ * common file format for Compose files, see the Compose(5) man page.
+ *
+ * A successfuly-composed sequence has two results: a keysym and a UTF-8
+ * string. At least one of the two is defined for each sequence. If only
+ * a keysym is given, the keysym's string representation is used for the
+ * result string (using xkb_keysym_to_utf8()).
+ *
+ * This library provides low-level support for Compose file parsing and
+ * processing. Higher-level APIs (such as libX11's `Xutf8LookupString`(3))
+ * may be built upon it, or it can be used directly.
+ *
+ * @endparblock
+ */
+
+/**
+ * @page compose-conflicting Conflicting Sequences
+ * @parblock
+ *
+ * To avoid ambiguity, a sequence is not allowed to be a prefix of another.
+ * In such a case, the conflict is resolved thus:
+ *
+ * 1. A longer sequence overrides a shorter one.
+ * 2. An equal sequence overrides an existing one.
+ * 3. A shorter sequence does not override a longer one.
+ *
+ * Sequences of length 1 are allowed.
+ *
+ * @endparblock
+ */
+
+/**
+ * @page compose-cancellation Cancellation Behavior
+ * @parblock
+ *
+ * What should happen when a sequence is cancelled? For example, consider
+ * there are only the above sequences, and the input keysyms are
+ * `<dead_acute> <b>`. There are a few approaches:
+ *
+ * 1. Swallow the cancelling keysym; that is, no keysym is produced.
+ * This is the approach taken by libX11.
+ * 2. Let the cancelling keysym through; that is, `<b>` is produced.
+ * 3. Replay the entire sequence; that is, `<dead_acute> <b>` is produced.
+ * This is the approach taken by Microsoft Windows (approximately;
+ * instead of `<dead_acute>`, the underlying key is used. This is
+ * difficult to simulate with XKB keymaps).
+ *
+ * You can program whichever approach best fits users' expectations.
+ *
+ * @endparblock
+ */
+
+/**
+ * @struct xkb_compose_table
+ * Opaque Compose table object.
+ *
+ * The compose table holds the definitions of the Compose sequences, as
+ * gathered from Compose files. It is immutable.
+ */
+struct xkb_compose_table;
+
+/**
+ * @struct xkb_compose_state
+ * Opaque Compose state object.
+ *
+ * The compose state maintains state for compose sequence matching, such
+ * as which possible sequences are being matched, and the position within
+ * these sequences. It acts as a simple state machine wherein keysyms are
+ * the input, and composed keysyms and strings are the output.
+ *
+ * The compose state is usually associated with a keyboard device.
+ */
+struct xkb_compose_state;
+
+/** Flags affecting Compose file compilation. */
+enum xkb_compose_compile_flags {
+ /** Do not apply any flags. */
+ XKB_COMPOSE_COMPILE_NO_FLAGS = 0
+};
+
+/** The recognized Compose file formats. */
+enum xkb_compose_format {
+ /** The classic libX11 Compose text format, described in Compose(5). */
+ XKB_COMPOSE_FORMAT_TEXT_V1 = 1
+};
+
+/**
+ * @page compose-locale Compose Locale
+ * @parblock
+ *
+ * Compose files are locale dependent:
+ * - Compose files are written for a locale, and the locale is used when
+ * searching for the appropriate file to use.
+ * - Compose files may reference the locale internally, with directives
+ * such as \%L.
+ *
+ * As such, functions like xkb_compose_table_new_from_locale() require
+ * a `locale` parameter. This will usually be the current locale (see
+ * locale(7) for more details). You may also want to allow the user to
+ * explicitly configure it, so he can use the Compose file of a given
+ * locale, but not use that locale for other things.
+ *
+ * You may query the current locale as follows:
+ * @code
+ * const char *locale;
+ * locale = setlocale(LC_CTYPE, NULL);
+ * @endcode
+ *
+ * This will only give useful results if the program had previously set
+ * the current locale using setlocale(3), with `LC_CTYPE` or `LC_ALL`
+ * and a non-NULL argument.
+ *
+ * If you prefer not to use the locale system of the C runtime library,
+ * you may nevertheless obtain the user's locale directly using
+ * environment variables, as described in locale(7). For example,
+ * @code
+ * const char *locale;
+ * locale = getenv("LC_ALL");
+ * if (!locale || !*locale)
+ * locale = getenv("LC_CTYPE");
+ * if (!locale || !*locale)
+ * locale = getenv("LANG");
+ * if (!locale || !*locale)
+ * locale = "C";
+ * @endcode
+ *
+ * Note that some locales supported by the C standard library may not
+ * have a Compose file assigned.
+ *
+ * @endparblock
+ */
+
+/**
+ * Create a compose table for a given locale.
+ *
+ * The locale is used for searching the file-system for an appropriate
+ * Compose file. The search order is described in Compose(5). It is
+ * affected by the following environment variables:
+ *
+ * 1. `XCOMPOSEFILE` - see Compose(5).
+ * 2. `XDG_CONFIG_HOME` - before `$HOME/.XCompose` is checked,
+ * `$XDG_CONFIG_HOME/XCompose` is checked (with a fall back to
+ * `$HOME/.config/XCompose` if `XDG_CONFIG_HOME` is not defined).
+ * This is a libxkbcommon extension to the search procedure in
+ * Compose(5) (since libxkbcommon 1.0.0). Note that other
+ * implementations, such as libX11, might not find a Compose file in
+ * this path.
+ * 3. `HOME` - see Compose(5).
+ * 4. `XLOCALEDIR` - if set, used as the base directory for the system's
+ * X locale files, e.g. `/usr/share/X11/locale`, instead of the
+ * preconfigured directory.
+ *
+ * @param context
+ * The library context in which to create the compose table.
+ * @param locale
+ * The current locale. See @ref compose-locale.
+ * \n
+ * The value is copied, so it is safe to pass the result of getenv(3)
+ * (or similar) without fear of it being invalidated by a subsequent
+ * setenv(3) (or similar).
+ * @param flags
+ * Optional flags for the compose table, or 0.
+ *
+ * @returns A compose table for the given locale, or NULL if the
+ * compilation failed or a Compose file was not found.
+ *
+ * @memberof xkb_compose_table
+ */
+struct xkb_compose_table *
+xkb_compose_table_new_from_locale(struct xkb_context *context,
+ const char *locale,
+ enum xkb_compose_compile_flags flags);
+
+/**
+ * Create a new compose table from a Compose file.
+ *
+ * @param context
+ * The library context in which to create the compose table.
+ * @param file
+ * The Compose file to compile.
+ * @param locale
+ * The current locale. See @ref compose-locale.
+ * @param format
+ * The text format of the Compose file to compile.
+ * @param flags
+ * Optional flags for the compose table, or 0.
+ *
+ * @returns A compose table compiled from the given file, or NULL if
+ * the compilation failed.
+ *
+ * @memberof xkb_compose_table
+ */
+struct xkb_compose_table *
+xkb_compose_table_new_from_file(struct xkb_context *context,
+ FILE *file,
+ const char *locale,
+ enum xkb_compose_format format,
+ enum xkb_compose_compile_flags flags);
+
+/**
+ * Create a new compose table from a memory buffer.
+ *
+ * This is just like xkb_compose_table_new_from_file(), but instead of
+ * a file, gets the table as one enormous string.
+ *
+ * @see xkb_compose_table_new_from_file()
+ * @memberof xkb_compose_table
+ */
+struct xkb_compose_table *
+xkb_compose_table_new_from_buffer(struct xkb_context *context,
+ const char *buffer, size_t length,
+ const char *locale,
+ enum xkb_compose_format format,
+ enum xkb_compose_compile_flags flags);
+
+/**
+ * Take a new reference on a compose table.
+ *
+ * @returns The passed in object.
+ *
+ * @memberof xkb_compose_table
+ */
+struct xkb_compose_table *
+xkb_compose_table_ref(struct xkb_compose_table *table);
+
+/**
+ * Release a reference on a compose table, and possibly free it.
+ *
+ * @param table The object. If it is NULL, this function does nothing.
+ *
+ * @memberof xkb_compose_table
+ */
+void
+xkb_compose_table_unref(struct xkb_compose_table *table);
+
+/** Flags for compose state creation. */
+enum xkb_compose_state_flags {
+ /** Do not apply any flags. */
+ XKB_COMPOSE_STATE_NO_FLAGS = 0
+};
+
+/**
+ * Create a new compose state object.
+ *
+ * @param table
+ * The compose table the state will use.
+ * @param flags
+ * Optional flags for the compose state, or 0.
+ *
+ * @returns A new compose state, or NULL on failure.
+ *
+ * @memberof xkb_compose_state
+ */
+struct xkb_compose_state *
+xkb_compose_state_new(struct xkb_compose_table *table,
+ enum xkb_compose_state_flags flags);
+
+/**
+ * Take a new reference on a compose state object.
+ *
+ * @returns The passed in object.
+ *
+ * @memberof xkb_compose_state
+ */
+struct xkb_compose_state *
+xkb_compose_state_ref(struct xkb_compose_state *state);
+
+/**
+ * Release a reference on a compose state object, and possibly free it.
+ *
+ * @param state The object. If NULL, do nothing.
+ *
+ * @memberof xkb_compose_state
+ */
+void
+xkb_compose_state_unref(struct xkb_compose_state *state);
+
+/**
+ * Get the compose table which a compose state object is using.
+ *
+ * @returns The compose table which was passed to xkb_compose_state_new()
+ * when creating this state object.
+ *
+ * This function does not take a new reference on the compose table; you
+ * must explicitly reference it yourself if you plan to use it beyond the
+ * lifetime of the state.
+ *
+ * @memberof xkb_compose_state
+ */
+struct xkb_compose_table *
+xkb_compose_state_get_compose_table(struct xkb_compose_state *state);
+
+/** Status of the Compose sequence state machine. */
+enum xkb_compose_status {
+ /** The initial state; no sequence has started yet. */
+ XKB_COMPOSE_NOTHING,
+ /** In the middle of a sequence. */
+ XKB_COMPOSE_COMPOSING,
+ /** A complete sequence has been matched. */
+ XKB_COMPOSE_COMPOSED,
+ /** The last sequence was cancelled due to an unmatched keysym. */
+ XKB_COMPOSE_CANCELLED
+};
+
+/** The effect of a keysym fed to xkb_compose_state_feed(). */
+enum xkb_compose_feed_result {
+ /** The keysym had no effect - it did not affect the status. */
+ XKB_COMPOSE_FEED_IGNORED,
+ /** The keysym started, advanced or cancelled a sequence. */
+ XKB_COMPOSE_FEED_ACCEPTED
+};
+
+/**
+ * Feed one keysym to the Compose sequence state machine.
+ *
+ * This function can advance into a compose sequence, cancel a sequence,
+ * start a new sequence, or do nothing in particular. The resulting
+ * status may be observed with xkb_compose_state_get_status().
+ *
+ * Some keysyms, such as keysyms for modifier keys, are ignored - they
+ * have no effect on the status or otherwise.
+ *
+ * The following is a description of the possible status transitions, in
+ * the format CURRENT STATUS => NEXT STATUS, given a non-ignored input
+ * keysym `keysym`:
+ *
+ @verbatim
+ NOTHING or CANCELLED or COMPOSED =>
+ NOTHING if keysym does not start a sequence.
+ COMPOSING if keysym starts a sequence.
+ COMPOSED if keysym starts and terminates a single-keysym sequence.
+
+ COMPOSING =>
+ COMPOSING if keysym advances any of the currently possible
+ sequences but does not terminate any of them.
+ COMPOSED if keysym terminates one of the currently possible
+ sequences.
+ CANCELLED if keysym does not advance any of the currently
+ possible sequences.
+ @endverbatim
+ *
+ * The current Compose formats do not support multiple-keysyms.
+ * Therefore, if you are using a function such as xkb_state_key_get_syms()
+ * and it returns more than one keysym, consider feeding XKB_KEY_NoSymbol
+ * instead.
+ *
+ * @param state
+ * The compose state object.
+ * @param keysym
+ * A keysym, usually obtained after a key-press event, with a
+ * function such as xkb_state_key_get_one_sym().
+ *
+ * @returns Whether the keysym was ignored. This is useful, for example,
+ * if you want to keep a record of the sequence matched thus far.
+ *
+ * @memberof xkb_compose_state
+ */
+enum xkb_compose_feed_result
+xkb_compose_state_feed(struct xkb_compose_state *state,
+ xkb_keysym_t keysym);
+
+/**
+ * Reset the Compose sequence state machine.
+ *
+ * The status is set to XKB_COMPOSE_NOTHING, and the current sequence
+ * is discarded.
+ *
+ * @memberof xkb_compose_state
+ */
+void
+xkb_compose_state_reset(struct xkb_compose_state *state);
+
+/**
+ * Get the current status of the compose state machine.
+ *
+ * @see xkb_compose_status
+ * @memberof xkb_compose_state
+ **/
+enum xkb_compose_status
+xkb_compose_state_get_status(struct xkb_compose_state *state);
+
+/**
+ * Get the result Unicode/UTF-8 string for a composed sequence.
+ *
+ * See @ref compose-overview for more details. This function is only
+ * useful when the status is XKB_COMPOSE_COMPOSED.
+ *
+ * @param[in] state
+ * The compose state.
+ * @param[out] buffer
+ * A buffer to write the string into.
+ * @param[in] size
+ * Size of the buffer.
+ *
+ * @warning If the buffer passed is too small, the string is truncated
+ * (though still NUL-terminated).
+ *
+ * @returns
+ * The number of bytes required for the string, excluding the NUL byte.
+ * If the sequence is not complete, or does not have a viable result
+ * string, returns 0, and sets `buffer` to the empty string (if possible).
+ * @returns
+ * You may check if truncation has occurred by comparing the return value
+ * with the size of `buffer`, similarly to the `snprintf`(3) function.
+ * You may safely pass NULL and 0 to `buffer` and `size` to find the
+ * required size (without the NUL-byte).
+ *
+ * @memberof xkb_compose_state
+ **/
+int
+xkb_compose_state_get_utf8(struct xkb_compose_state *state,
+ char *buffer, size_t size);
+
+/**
+ * Get the result keysym for a composed sequence.
+ *
+ * See @ref compose-overview for more details. This function is only
+ * useful when the status is XKB_COMPOSE_COMPOSED.
+ *
+ * @returns The result keysym. If the sequence is not complete, or does
+ * not specify a result keysym, returns XKB_KEY_NoSymbol.
+ *
+ * @memberof xkb_compose_state
+ **/
+xkb_keysym_t
+xkb_compose_state_get_one_sym(struct xkb_compose_state *state);
+
+/** @} */
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _XKBCOMMON_COMPOSE_H */
diff --git a/thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-keysyms.h b/thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-keysyms.h
new file mode 100644
index 0000000000..7c75c29711
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-keysyms.h
@@ -0,0 +1,3248 @@
+#ifndef _XKBCOMMON_KEYSYMS_H
+#define _XKBCOMMON_KEYSYMS_H
+
+/* This file is autogenerated; please do not commit directly. */
+
+#define XKB_KEY_NoSymbol 0x000000 /* Special KeySym */
+
+/***********************************************************
+Copyright 1987, 1994, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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 OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * The "X11 Window System Protocol" standard defines in Appendix A the
+ * keysym codes. These 29-bit integer values identify characters or
+ * functions associated with each key (e.g., via the visible
+ * engraving) of a keyboard layout. This file assigns mnemonic macro
+ * names for these keysyms.
+ *
+ * This file is also compiled (by src/util/makekeys.c in libX11) into
+ * hash tables that can be accessed with X11 library functions such as
+ * XStringToKeysym() and XKeysymToString().
+ *
+ * Where a keysym corresponds one-to-one to an ISO 10646 / Unicode
+ * character, this is noted in a comment that provides both the U+xxxx
+ * Unicode position, as well as the official Unicode name of the
+ * character.
+ *
+ * Where the correspondence is either not one-to-one or semantically
+ * unclear, the Unicode position and name are enclosed in
+ * parentheses. Such legacy keysyms should be considered deprecated
+ * and are not recommended for use in future keyboard mappings.
+ *
+ * For any future extension of the keysyms with characters already
+ * found in ISO 10646 / Unicode, the following algorithm shall be
+ * used. The new keysym code position will simply be the character's
+ * Unicode number plus 0x01000000. The keysym values in the range
+ * 0x01000100 to 0x0110ffff are reserved to represent Unicode
+ * characters in the range U+0100 to U+10FFFF.
+ *
+ * While most newer Unicode-based X11 clients do already accept
+ * Unicode-mapped keysyms in the range 0x01000100 to 0x0110ffff, it
+ * will remain necessary for clients -- in the interest of
+ * compatibility with existing servers -- to also understand the
+ * existing legacy keysym values in the range 0x0100 to 0x20ff.
+ *
+ * Where several mnemonic names are defined for the same keysym in this
+ * file, all but the first one listed should be considered deprecated.
+ *
+ * Mnemonic names for keysyms are defined in this file with lines
+ * that match one of these Perl regular expressions:
+ *
+ * /^\#define XKB_KEY_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\* U\+([0-9A-F]{4,6}) (.*) \*\/\s*$/
+ * /^\#define XKB_KEY_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\*\(U\+([0-9A-F]{4,6}) (.*)\)\*\/\s*$/
+ * /^\#define XKB_KEY_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*(\/\*\s*(.*)\s*\*\/)?\s*$/
+ *
+ * Before adding new keysyms, please do consider the following: In
+ * addition to the keysym names defined in this file, the
+ * XStringToKeysym() and XKeysymToString() functions will also handle
+ * any keysym string of the form "U0020" to "U007E" and "U00A0" to
+ * "U10FFFF" for all possible Unicode characters. In other words,
+ * every possible Unicode character has already a keysym string
+ * defined algorithmically, even if it is not listed here. Therefore,
+ * defining an additional keysym macro is only necessary where a
+ * non-hexadecimal mnemonic name is needed, or where the new keysym
+ * does not represent any existing Unicode character.
+ *
+ * When adding new keysyms to this file, do not forget to also update the
+ * following as needed:
+ *
+ * - the mappings in src/KeyBind.c in the libX11 repo
+ * https://gitlab.freedesktop.org/xorg/lib/libx11
+ *
+ * - the protocol specification in specs/keysyms.xml in this repo
+ * https://gitlab.freedesktop.org/xorg/proto/xorgproto
+ *
+ */
+
+#define XKB_KEY_VoidSymbol 0xffffff /* Void symbol */
+
+/*
+ * TTY function keys, cleverly chosen to map to ASCII, for convenience of
+ * programming, but could have been arbitrary (at the cost of lookup
+ * tables in client code).
+ */
+
+#define XKB_KEY_BackSpace 0xff08 /* Back space, back char */
+#define XKB_KEY_Tab 0xff09
+#define XKB_KEY_Linefeed 0xff0a /* Linefeed, LF */
+#define XKB_KEY_Clear 0xff0b
+#define XKB_KEY_Return 0xff0d /* Return, enter */
+#define XKB_KEY_Pause 0xff13 /* Pause, hold */
+#define XKB_KEY_Scroll_Lock 0xff14
+#define XKB_KEY_Sys_Req 0xff15
+#define XKB_KEY_Escape 0xff1b
+#define XKB_KEY_Delete 0xffff /* Delete, rubout */
+
+
+
+/* International & multi-key character composition */
+
+#define XKB_KEY_Multi_key 0xff20 /* Multi-key character compose */
+#define XKB_KEY_Codeinput 0xff37
+#define XKB_KEY_SingleCandidate 0xff3c
+#define XKB_KEY_MultipleCandidate 0xff3d
+#define XKB_KEY_PreviousCandidate 0xff3e
+
+/* Japanese keyboard support */
+
+#define XKB_KEY_Kanji 0xff21 /* Kanji, Kanji convert */
+#define XKB_KEY_Muhenkan 0xff22 /* Cancel Conversion */
+#define XKB_KEY_Henkan_Mode 0xff23 /* Start/Stop Conversion */
+#define XKB_KEY_Henkan 0xff23 /* Alias for Henkan_Mode */
+#define XKB_KEY_Romaji 0xff24 /* to Romaji */
+#define XKB_KEY_Hiragana 0xff25 /* to Hiragana */
+#define XKB_KEY_Katakana 0xff26 /* to Katakana */
+#define XKB_KEY_Hiragana_Katakana 0xff27 /* Hiragana/Katakana toggle */
+#define XKB_KEY_Zenkaku 0xff28 /* to Zenkaku */
+#define XKB_KEY_Hankaku 0xff29 /* to Hankaku */
+#define XKB_KEY_Zenkaku_Hankaku 0xff2a /* Zenkaku/Hankaku toggle */
+#define XKB_KEY_Touroku 0xff2b /* Add to Dictionary */
+#define XKB_KEY_Massyo 0xff2c /* Delete from Dictionary */
+#define XKB_KEY_Kana_Lock 0xff2d /* Kana Lock */
+#define XKB_KEY_Kana_Shift 0xff2e /* Kana Shift */
+#define XKB_KEY_Eisu_Shift 0xff2f /* Alphanumeric Shift */
+#define XKB_KEY_Eisu_toggle 0xff30 /* Alphanumeric toggle */
+#define XKB_KEY_Kanji_Bangou 0xff37 /* Codeinput */
+#define XKB_KEY_Zen_Koho 0xff3d /* Multiple/All Candidate(s) */
+#define XKB_KEY_Mae_Koho 0xff3e /* Previous Candidate */
+
+/* 0xff31 thru 0xff3f are under XK_KOREAN */
+
+/* Cursor control & motion */
+
+#define XKB_KEY_Home 0xff50
+#define XKB_KEY_Left 0xff51 /* Move left, left arrow */
+#define XKB_KEY_Up 0xff52 /* Move up, up arrow */
+#define XKB_KEY_Right 0xff53 /* Move right, right arrow */
+#define XKB_KEY_Down 0xff54 /* Move down, down arrow */
+#define XKB_KEY_Prior 0xff55 /* Prior, previous */
+#define XKB_KEY_Page_Up 0xff55
+#define XKB_KEY_Next 0xff56 /* Next */
+#define XKB_KEY_Page_Down 0xff56
+#define XKB_KEY_End 0xff57 /* EOL */
+#define XKB_KEY_Begin 0xff58 /* BOL */
+
+
+/* Misc functions */
+
+#define XKB_KEY_Select 0xff60 /* Select, mark */
+#define XKB_KEY_Print 0xff61
+#define XKB_KEY_Execute 0xff62 /* Execute, run, do */
+#define XKB_KEY_Insert 0xff63 /* Insert, insert here */
+#define XKB_KEY_Undo 0xff65
+#define XKB_KEY_Redo 0xff66 /* Redo, again */
+#define XKB_KEY_Menu 0xff67
+#define XKB_KEY_Find 0xff68 /* Find, search */
+#define XKB_KEY_Cancel 0xff69 /* Cancel, stop, abort, exit */
+#define XKB_KEY_Help 0xff6a /* Help */
+#define XKB_KEY_Break 0xff6b
+#define XKB_KEY_Mode_switch 0xff7e /* Character set switch */
+#define XKB_KEY_script_switch 0xff7e /* Alias for mode_switch */
+#define XKB_KEY_Num_Lock 0xff7f
+
+/* Keypad functions, keypad numbers cleverly chosen to map to ASCII */
+
+#define XKB_KEY_KP_Space 0xff80 /* Space */
+#define XKB_KEY_KP_Tab 0xff89
+#define XKB_KEY_KP_Enter 0xff8d /* Enter */
+#define XKB_KEY_KP_F1 0xff91 /* PF1, KP_A, ... */
+#define XKB_KEY_KP_F2 0xff92
+#define XKB_KEY_KP_F3 0xff93
+#define XKB_KEY_KP_F4 0xff94
+#define XKB_KEY_KP_Home 0xff95
+#define XKB_KEY_KP_Left 0xff96
+#define XKB_KEY_KP_Up 0xff97
+#define XKB_KEY_KP_Right 0xff98
+#define XKB_KEY_KP_Down 0xff99
+#define XKB_KEY_KP_Prior 0xff9a
+#define XKB_KEY_KP_Page_Up 0xff9a
+#define XKB_KEY_KP_Next 0xff9b
+#define XKB_KEY_KP_Page_Down 0xff9b
+#define XKB_KEY_KP_End 0xff9c
+#define XKB_KEY_KP_Begin 0xff9d
+#define XKB_KEY_KP_Insert 0xff9e
+#define XKB_KEY_KP_Delete 0xff9f
+#define XKB_KEY_KP_Equal 0xffbd /* Equals */
+#define XKB_KEY_KP_Multiply 0xffaa
+#define XKB_KEY_KP_Add 0xffab
+#define XKB_KEY_KP_Separator 0xffac /* Separator, often comma */
+#define XKB_KEY_KP_Subtract 0xffad
+#define XKB_KEY_KP_Decimal 0xffae
+#define XKB_KEY_KP_Divide 0xffaf
+
+#define XKB_KEY_KP_0 0xffb0
+#define XKB_KEY_KP_1 0xffb1
+#define XKB_KEY_KP_2 0xffb2
+#define XKB_KEY_KP_3 0xffb3
+#define XKB_KEY_KP_4 0xffb4
+#define XKB_KEY_KP_5 0xffb5
+#define XKB_KEY_KP_6 0xffb6
+#define XKB_KEY_KP_7 0xffb7
+#define XKB_KEY_KP_8 0xffb8
+#define XKB_KEY_KP_9 0xffb9
+
+
+
+/*
+ * Auxiliary functions; note the duplicate definitions for left and right
+ * function keys; Sun keyboards and a few other manufacturers have such
+ * function key groups on the left and/or right sides of the keyboard.
+ * We've not found a keyboard with more than 35 function keys total.
+ */
+
+#define XKB_KEY_F1 0xffbe
+#define XKB_KEY_F2 0xffbf
+#define XKB_KEY_F3 0xffc0
+#define XKB_KEY_F4 0xffc1
+#define XKB_KEY_F5 0xffc2
+#define XKB_KEY_F6 0xffc3
+#define XKB_KEY_F7 0xffc4
+#define XKB_KEY_F8 0xffc5
+#define XKB_KEY_F9 0xffc6
+#define XKB_KEY_F10 0xffc7
+#define XKB_KEY_F11 0xffc8
+#define XKB_KEY_L1 0xffc8
+#define XKB_KEY_F12 0xffc9
+#define XKB_KEY_L2 0xffc9
+#define XKB_KEY_F13 0xffca
+#define XKB_KEY_L3 0xffca
+#define XKB_KEY_F14 0xffcb
+#define XKB_KEY_L4 0xffcb
+#define XKB_KEY_F15 0xffcc
+#define XKB_KEY_L5 0xffcc
+#define XKB_KEY_F16 0xffcd
+#define XKB_KEY_L6 0xffcd
+#define XKB_KEY_F17 0xffce
+#define XKB_KEY_L7 0xffce
+#define XKB_KEY_F18 0xffcf
+#define XKB_KEY_L8 0xffcf
+#define XKB_KEY_F19 0xffd0
+#define XKB_KEY_L9 0xffd0
+#define XKB_KEY_F20 0xffd1
+#define XKB_KEY_L10 0xffd1
+#define XKB_KEY_F21 0xffd2
+#define XKB_KEY_R1 0xffd2
+#define XKB_KEY_F22 0xffd3
+#define XKB_KEY_R2 0xffd3
+#define XKB_KEY_F23 0xffd4
+#define XKB_KEY_R3 0xffd4
+#define XKB_KEY_F24 0xffd5
+#define XKB_KEY_R4 0xffd5
+#define XKB_KEY_F25 0xffd6
+#define XKB_KEY_R5 0xffd6
+#define XKB_KEY_F26 0xffd7
+#define XKB_KEY_R6 0xffd7
+#define XKB_KEY_F27 0xffd8
+#define XKB_KEY_R7 0xffd8
+#define XKB_KEY_F28 0xffd9
+#define XKB_KEY_R8 0xffd9
+#define XKB_KEY_F29 0xffda
+#define XKB_KEY_R9 0xffda
+#define XKB_KEY_F30 0xffdb
+#define XKB_KEY_R10 0xffdb
+#define XKB_KEY_F31 0xffdc
+#define XKB_KEY_R11 0xffdc
+#define XKB_KEY_F32 0xffdd
+#define XKB_KEY_R12 0xffdd
+#define XKB_KEY_F33 0xffde
+#define XKB_KEY_R13 0xffde
+#define XKB_KEY_F34 0xffdf
+#define XKB_KEY_R14 0xffdf
+#define XKB_KEY_F35 0xffe0
+#define XKB_KEY_R15 0xffe0
+
+/* Modifiers */
+
+#define XKB_KEY_Shift_L 0xffe1 /* Left shift */
+#define XKB_KEY_Shift_R 0xffe2 /* Right shift */
+#define XKB_KEY_Control_L 0xffe3 /* Left control */
+#define XKB_KEY_Control_R 0xffe4 /* Right control */
+#define XKB_KEY_Caps_Lock 0xffe5 /* Caps lock */
+#define XKB_KEY_Shift_Lock 0xffe6 /* Shift lock */
+
+#define XKB_KEY_Meta_L 0xffe7 /* Left meta */
+#define XKB_KEY_Meta_R 0xffe8 /* Right meta */
+#define XKB_KEY_Alt_L 0xffe9 /* Left alt */
+#define XKB_KEY_Alt_R 0xffea /* Right alt */
+#define XKB_KEY_Super_L 0xffeb /* Left super */
+#define XKB_KEY_Super_R 0xffec /* Right super */
+#define XKB_KEY_Hyper_L 0xffed /* Left hyper */
+#define XKB_KEY_Hyper_R 0xffee /* Right hyper */
+
+/*
+ * Keyboard (XKB) Extension function and modifier keys
+ * (from Appendix C of "The X Keyboard Extension: Protocol Specification")
+ * Byte 3 = 0xfe
+ */
+
+#define XKB_KEY_ISO_Lock 0xfe01
+#define XKB_KEY_ISO_Level2_Latch 0xfe02
+#define XKB_KEY_ISO_Level3_Shift 0xfe03
+#define XKB_KEY_ISO_Level3_Latch 0xfe04
+#define XKB_KEY_ISO_Level3_Lock 0xfe05
+#define XKB_KEY_ISO_Level5_Shift 0xfe11
+#define XKB_KEY_ISO_Level5_Latch 0xfe12
+#define XKB_KEY_ISO_Level5_Lock 0xfe13
+#define XKB_KEY_ISO_Group_Shift 0xff7e /* Alias for mode_switch */
+#define XKB_KEY_ISO_Group_Latch 0xfe06
+#define XKB_KEY_ISO_Group_Lock 0xfe07
+#define XKB_KEY_ISO_Next_Group 0xfe08
+#define XKB_KEY_ISO_Next_Group_Lock 0xfe09
+#define XKB_KEY_ISO_Prev_Group 0xfe0a
+#define XKB_KEY_ISO_Prev_Group_Lock 0xfe0b
+#define XKB_KEY_ISO_First_Group 0xfe0c
+#define XKB_KEY_ISO_First_Group_Lock 0xfe0d
+#define XKB_KEY_ISO_Last_Group 0xfe0e
+#define XKB_KEY_ISO_Last_Group_Lock 0xfe0f
+
+#define XKB_KEY_ISO_Left_Tab 0xfe20
+#define XKB_KEY_ISO_Move_Line_Up 0xfe21
+#define XKB_KEY_ISO_Move_Line_Down 0xfe22
+#define XKB_KEY_ISO_Partial_Line_Up 0xfe23
+#define XKB_KEY_ISO_Partial_Line_Down 0xfe24
+#define XKB_KEY_ISO_Partial_Space_Left 0xfe25
+#define XKB_KEY_ISO_Partial_Space_Right 0xfe26
+#define XKB_KEY_ISO_Set_Margin_Left 0xfe27
+#define XKB_KEY_ISO_Set_Margin_Right 0xfe28
+#define XKB_KEY_ISO_Release_Margin_Left 0xfe29
+#define XKB_KEY_ISO_Release_Margin_Right 0xfe2a
+#define XKB_KEY_ISO_Release_Both_Margins 0xfe2b
+#define XKB_KEY_ISO_Fast_Cursor_Left 0xfe2c
+#define XKB_KEY_ISO_Fast_Cursor_Right 0xfe2d
+#define XKB_KEY_ISO_Fast_Cursor_Up 0xfe2e
+#define XKB_KEY_ISO_Fast_Cursor_Down 0xfe2f
+#define XKB_KEY_ISO_Continuous_Underline 0xfe30
+#define XKB_KEY_ISO_Discontinuous_Underline 0xfe31
+#define XKB_KEY_ISO_Emphasize 0xfe32
+#define XKB_KEY_ISO_Center_Object 0xfe33
+#define XKB_KEY_ISO_Enter 0xfe34
+
+#define XKB_KEY_dead_grave 0xfe50
+#define XKB_KEY_dead_acute 0xfe51
+#define XKB_KEY_dead_circumflex 0xfe52
+#define XKB_KEY_dead_tilde 0xfe53
+#define XKB_KEY_dead_perispomeni 0xfe53 /* alias for dead_tilde */
+#define XKB_KEY_dead_macron 0xfe54
+#define XKB_KEY_dead_breve 0xfe55
+#define XKB_KEY_dead_abovedot 0xfe56
+#define XKB_KEY_dead_diaeresis 0xfe57
+#define XKB_KEY_dead_abovering 0xfe58
+#define XKB_KEY_dead_doubleacute 0xfe59
+#define XKB_KEY_dead_caron 0xfe5a
+#define XKB_KEY_dead_cedilla 0xfe5b
+#define XKB_KEY_dead_ogonek 0xfe5c
+#define XKB_KEY_dead_iota 0xfe5d
+#define XKB_KEY_dead_voiced_sound 0xfe5e
+#define XKB_KEY_dead_semivoiced_sound 0xfe5f
+#define XKB_KEY_dead_belowdot 0xfe60
+#define XKB_KEY_dead_hook 0xfe61
+#define XKB_KEY_dead_horn 0xfe62
+#define XKB_KEY_dead_stroke 0xfe63
+#define XKB_KEY_dead_abovecomma 0xfe64
+#define XKB_KEY_dead_psili 0xfe64 /* alias for dead_abovecomma */
+#define XKB_KEY_dead_abovereversedcomma 0xfe65
+#define XKB_KEY_dead_dasia 0xfe65 /* alias for dead_abovereversedcomma */
+#define XKB_KEY_dead_doublegrave 0xfe66
+#define XKB_KEY_dead_belowring 0xfe67
+#define XKB_KEY_dead_belowmacron 0xfe68
+#define XKB_KEY_dead_belowcircumflex 0xfe69
+#define XKB_KEY_dead_belowtilde 0xfe6a
+#define XKB_KEY_dead_belowbreve 0xfe6b
+#define XKB_KEY_dead_belowdiaeresis 0xfe6c
+#define XKB_KEY_dead_invertedbreve 0xfe6d
+#define XKB_KEY_dead_belowcomma 0xfe6e
+#define XKB_KEY_dead_currency 0xfe6f
+
+/* extra dead elements for German T3 layout */
+#define XKB_KEY_dead_lowline 0xfe90
+#define XKB_KEY_dead_aboveverticalline 0xfe91
+#define XKB_KEY_dead_belowverticalline 0xfe92
+#define XKB_KEY_dead_longsolidusoverlay 0xfe93
+
+/* dead vowels for universal syllable entry */
+#define XKB_KEY_dead_a 0xfe80
+#define XKB_KEY_dead_A 0xfe81
+#define XKB_KEY_dead_e 0xfe82
+#define XKB_KEY_dead_E 0xfe83
+#define XKB_KEY_dead_i 0xfe84
+#define XKB_KEY_dead_I 0xfe85
+#define XKB_KEY_dead_o 0xfe86
+#define XKB_KEY_dead_O 0xfe87
+#define XKB_KEY_dead_u 0xfe88
+#define XKB_KEY_dead_U 0xfe89
+#define XKB_KEY_dead_small_schwa 0xfe8a
+#define XKB_KEY_dead_capital_schwa 0xfe8b
+
+#define XKB_KEY_dead_greek 0xfe8c
+
+#define XKB_KEY_First_Virtual_Screen 0xfed0
+#define XKB_KEY_Prev_Virtual_Screen 0xfed1
+#define XKB_KEY_Next_Virtual_Screen 0xfed2
+#define XKB_KEY_Last_Virtual_Screen 0xfed4
+#define XKB_KEY_Terminate_Server 0xfed5
+
+#define XKB_KEY_AccessX_Enable 0xfe70
+#define XKB_KEY_AccessX_Feedback_Enable 0xfe71
+#define XKB_KEY_RepeatKeys_Enable 0xfe72
+#define XKB_KEY_SlowKeys_Enable 0xfe73
+#define XKB_KEY_BounceKeys_Enable 0xfe74
+#define XKB_KEY_StickyKeys_Enable 0xfe75
+#define XKB_KEY_MouseKeys_Enable 0xfe76
+#define XKB_KEY_MouseKeys_Accel_Enable 0xfe77
+#define XKB_KEY_Overlay1_Enable 0xfe78
+#define XKB_KEY_Overlay2_Enable 0xfe79
+#define XKB_KEY_AudibleBell_Enable 0xfe7a
+
+#define XKB_KEY_Pointer_Left 0xfee0
+#define XKB_KEY_Pointer_Right 0xfee1
+#define XKB_KEY_Pointer_Up 0xfee2
+#define XKB_KEY_Pointer_Down 0xfee3
+#define XKB_KEY_Pointer_UpLeft 0xfee4
+#define XKB_KEY_Pointer_UpRight 0xfee5
+#define XKB_KEY_Pointer_DownLeft 0xfee6
+#define XKB_KEY_Pointer_DownRight 0xfee7
+#define XKB_KEY_Pointer_Button_Dflt 0xfee8
+#define XKB_KEY_Pointer_Button1 0xfee9
+#define XKB_KEY_Pointer_Button2 0xfeea
+#define XKB_KEY_Pointer_Button3 0xfeeb
+#define XKB_KEY_Pointer_Button4 0xfeec
+#define XKB_KEY_Pointer_Button5 0xfeed
+#define XKB_KEY_Pointer_DblClick_Dflt 0xfeee
+#define XKB_KEY_Pointer_DblClick1 0xfeef
+#define XKB_KEY_Pointer_DblClick2 0xfef0
+#define XKB_KEY_Pointer_DblClick3 0xfef1
+#define XKB_KEY_Pointer_DblClick4 0xfef2
+#define XKB_KEY_Pointer_DblClick5 0xfef3
+#define XKB_KEY_Pointer_Drag_Dflt 0xfef4
+#define XKB_KEY_Pointer_Drag1 0xfef5
+#define XKB_KEY_Pointer_Drag2 0xfef6
+#define XKB_KEY_Pointer_Drag3 0xfef7
+#define XKB_KEY_Pointer_Drag4 0xfef8
+#define XKB_KEY_Pointer_Drag5 0xfefd
+
+#define XKB_KEY_Pointer_EnableKeys 0xfef9
+#define XKB_KEY_Pointer_Accelerate 0xfefa
+#define XKB_KEY_Pointer_DfltBtnNext 0xfefb
+#define XKB_KEY_Pointer_DfltBtnPrev 0xfefc
+
+/* Single-Stroke Multiple-Character N-Graph Keysyms For The X Input Method */
+
+#define XKB_KEY_ch 0xfea0
+#define XKB_KEY_Ch 0xfea1
+#define XKB_KEY_CH 0xfea2
+#define XKB_KEY_c_h 0xfea3
+#define XKB_KEY_C_h 0xfea4
+#define XKB_KEY_C_H 0xfea5
+
+
+/*
+ * 3270 Terminal Keys
+ * Byte 3 = 0xfd
+ */
+
+#define XKB_KEY_3270_Duplicate 0xfd01
+#define XKB_KEY_3270_FieldMark 0xfd02
+#define XKB_KEY_3270_Right2 0xfd03
+#define XKB_KEY_3270_Left2 0xfd04
+#define XKB_KEY_3270_BackTab 0xfd05
+#define XKB_KEY_3270_EraseEOF 0xfd06
+#define XKB_KEY_3270_EraseInput 0xfd07
+#define XKB_KEY_3270_Reset 0xfd08
+#define XKB_KEY_3270_Quit 0xfd09
+#define XKB_KEY_3270_PA1 0xfd0a
+#define XKB_KEY_3270_PA2 0xfd0b
+#define XKB_KEY_3270_PA3 0xfd0c
+#define XKB_KEY_3270_Test 0xfd0d
+#define XKB_KEY_3270_Attn 0xfd0e
+#define XKB_KEY_3270_CursorBlink 0xfd0f
+#define XKB_KEY_3270_AltCursor 0xfd10
+#define XKB_KEY_3270_KeyClick 0xfd11
+#define XKB_KEY_3270_Jump 0xfd12
+#define XKB_KEY_3270_Ident 0xfd13
+#define XKB_KEY_3270_Rule 0xfd14
+#define XKB_KEY_3270_Copy 0xfd15
+#define XKB_KEY_3270_Play 0xfd16
+#define XKB_KEY_3270_Setup 0xfd17
+#define XKB_KEY_3270_Record 0xfd18
+#define XKB_KEY_3270_ChangeScreen 0xfd19
+#define XKB_KEY_3270_DeleteWord 0xfd1a
+#define XKB_KEY_3270_ExSelect 0xfd1b
+#define XKB_KEY_3270_CursorSelect 0xfd1c
+#define XKB_KEY_3270_PrintScreen 0xfd1d
+#define XKB_KEY_3270_Enter 0xfd1e
+
+/*
+ * Latin 1
+ * (ISO/IEC 8859-1 = Unicode U+0020..U+00FF)
+ * Byte 3 = 0
+ */
+#define XKB_KEY_space 0x0020 /* U+0020 SPACE */
+#define XKB_KEY_exclam 0x0021 /* U+0021 EXCLAMATION MARK */
+#define XKB_KEY_quotedbl 0x0022 /* U+0022 QUOTATION MARK */
+#define XKB_KEY_numbersign 0x0023 /* U+0023 NUMBER SIGN */
+#define XKB_KEY_dollar 0x0024 /* U+0024 DOLLAR SIGN */
+#define XKB_KEY_percent 0x0025 /* U+0025 PERCENT SIGN */
+#define XKB_KEY_ampersand 0x0026 /* U+0026 AMPERSAND */
+#define XKB_KEY_apostrophe 0x0027 /* U+0027 APOSTROPHE */
+#define XKB_KEY_quoteright 0x0027 /* deprecated */
+#define XKB_KEY_parenleft 0x0028 /* U+0028 LEFT PARENTHESIS */
+#define XKB_KEY_parenright 0x0029 /* U+0029 RIGHT PARENTHESIS */
+#define XKB_KEY_asterisk 0x002a /* U+002A ASTERISK */
+#define XKB_KEY_plus 0x002b /* U+002B PLUS SIGN */
+#define XKB_KEY_comma 0x002c /* U+002C COMMA */
+#define XKB_KEY_minus 0x002d /* U+002D HYPHEN-MINUS */
+#define XKB_KEY_period 0x002e /* U+002E FULL STOP */
+#define XKB_KEY_slash 0x002f /* U+002F SOLIDUS */
+#define XKB_KEY_0 0x0030 /* U+0030 DIGIT ZERO */
+#define XKB_KEY_1 0x0031 /* U+0031 DIGIT ONE */
+#define XKB_KEY_2 0x0032 /* U+0032 DIGIT TWO */
+#define XKB_KEY_3 0x0033 /* U+0033 DIGIT THREE */
+#define XKB_KEY_4 0x0034 /* U+0034 DIGIT FOUR */
+#define XKB_KEY_5 0x0035 /* U+0035 DIGIT FIVE */
+#define XKB_KEY_6 0x0036 /* U+0036 DIGIT SIX */
+#define XKB_KEY_7 0x0037 /* U+0037 DIGIT SEVEN */
+#define XKB_KEY_8 0x0038 /* U+0038 DIGIT EIGHT */
+#define XKB_KEY_9 0x0039 /* U+0039 DIGIT NINE */
+#define XKB_KEY_colon 0x003a /* U+003A COLON */
+#define XKB_KEY_semicolon 0x003b /* U+003B SEMICOLON */
+#define XKB_KEY_less 0x003c /* U+003C LESS-THAN SIGN */
+#define XKB_KEY_equal 0x003d /* U+003D EQUALS SIGN */
+#define XKB_KEY_greater 0x003e /* U+003E GREATER-THAN SIGN */
+#define XKB_KEY_question 0x003f /* U+003F QUESTION MARK */
+#define XKB_KEY_at 0x0040 /* U+0040 COMMERCIAL AT */
+#define XKB_KEY_A 0x0041 /* U+0041 LATIN CAPITAL LETTER A */
+#define XKB_KEY_B 0x0042 /* U+0042 LATIN CAPITAL LETTER B */
+#define XKB_KEY_C 0x0043 /* U+0043 LATIN CAPITAL LETTER C */
+#define XKB_KEY_D 0x0044 /* U+0044 LATIN CAPITAL LETTER D */
+#define XKB_KEY_E 0x0045 /* U+0045 LATIN CAPITAL LETTER E */
+#define XKB_KEY_F 0x0046 /* U+0046 LATIN CAPITAL LETTER F */
+#define XKB_KEY_G 0x0047 /* U+0047 LATIN CAPITAL LETTER G */
+#define XKB_KEY_H 0x0048 /* U+0048 LATIN CAPITAL LETTER H */
+#define XKB_KEY_I 0x0049 /* U+0049 LATIN CAPITAL LETTER I */
+#define XKB_KEY_J 0x004a /* U+004A LATIN CAPITAL LETTER J */
+#define XKB_KEY_K 0x004b /* U+004B LATIN CAPITAL LETTER K */
+#define XKB_KEY_L 0x004c /* U+004C LATIN CAPITAL LETTER L */
+#define XKB_KEY_M 0x004d /* U+004D LATIN CAPITAL LETTER M */
+#define XKB_KEY_N 0x004e /* U+004E LATIN CAPITAL LETTER N */
+#define XKB_KEY_O 0x004f /* U+004F LATIN CAPITAL LETTER O */
+#define XKB_KEY_P 0x0050 /* U+0050 LATIN CAPITAL LETTER P */
+#define XKB_KEY_Q 0x0051 /* U+0051 LATIN CAPITAL LETTER Q */
+#define XKB_KEY_R 0x0052 /* U+0052 LATIN CAPITAL LETTER R */
+#define XKB_KEY_S 0x0053 /* U+0053 LATIN CAPITAL LETTER S */
+#define XKB_KEY_T 0x0054 /* U+0054 LATIN CAPITAL LETTER T */
+#define XKB_KEY_U 0x0055 /* U+0055 LATIN CAPITAL LETTER U */
+#define XKB_KEY_V 0x0056 /* U+0056 LATIN CAPITAL LETTER V */
+#define XKB_KEY_W 0x0057 /* U+0057 LATIN CAPITAL LETTER W */
+#define XKB_KEY_X 0x0058 /* U+0058 LATIN CAPITAL LETTER X */
+#define XKB_KEY_Y 0x0059 /* U+0059 LATIN CAPITAL LETTER Y */
+#define XKB_KEY_Z 0x005a /* U+005A LATIN CAPITAL LETTER Z */
+#define XKB_KEY_bracketleft 0x005b /* U+005B LEFT SQUARE BRACKET */
+#define XKB_KEY_backslash 0x005c /* U+005C REVERSE SOLIDUS */
+#define XKB_KEY_bracketright 0x005d /* U+005D RIGHT SQUARE BRACKET */
+#define XKB_KEY_asciicircum 0x005e /* U+005E CIRCUMFLEX ACCENT */
+#define XKB_KEY_underscore 0x005f /* U+005F LOW LINE */
+#define XKB_KEY_grave 0x0060 /* U+0060 GRAVE ACCENT */
+#define XKB_KEY_quoteleft 0x0060 /* deprecated */
+#define XKB_KEY_a 0x0061 /* U+0061 LATIN SMALL LETTER A */
+#define XKB_KEY_b 0x0062 /* U+0062 LATIN SMALL LETTER B */
+#define XKB_KEY_c 0x0063 /* U+0063 LATIN SMALL LETTER C */
+#define XKB_KEY_d 0x0064 /* U+0064 LATIN SMALL LETTER D */
+#define XKB_KEY_e 0x0065 /* U+0065 LATIN SMALL LETTER E */
+#define XKB_KEY_f 0x0066 /* U+0066 LATIN SMALL LETTER F */
+#define XKB_KEY_g 0x0067 /* U+0067 LATIN SMALL LETTER G */
+#define XKB_KEY_h 0x0068 /* U+0068 LATIN SMALL LETTER H */
+#define XKB_KEY_i 0x0069 /* U+0069 LATIN SMALL LETTER I */
+#define XKB_KEY_j 0x006a /* U+006A LATIN SMALL LETTER J */
+#define XKB_KEY_k 0x006b /* U+006B LATIN SMALL LETTER K */
+#define XKB_KEY_l 0x006c /* U+006C LATIN SMALL LETTER L */
+#define XKB_KEY_m 0x006d /* U+006D LATIN SMALL LETTER M */
+#define XKB_KEY_n 0x006e /* U+006E LATIN SMALL LETTER N */
+#define XKB_KEY_o 0x006f /* U+006F LATIN SMALL LETTER O */
+#define XKB_KEY_p 0x0070 /* U+0070 LATIN SMALL LETTER P */
+#define XKB_KEY_q 0x0071 /* U+0071 LATIN SMALL LETTER Q */
+#define XKB_KEY_r 0x0072 /* U+0072 LATIN SMALL LETTER R */
+#define XKB_KEY_s 0x0073 /* U+0073 LATIN SMALL LETTER S */
+#define XKB_KEY_t 0x0074 /* U+0074 LATIN SMALL LETTER T */
+#define XKB_KEY_u 0x0075 /* U+0075 LATIN SMALL LETTER U */
+#define XKB_KEY_v 0x0076 /* U+0076 LATIN SMALL LETTER V */
+#define XKB_KEY_w 0x0077 /* U+0077 LATIN SMALL LETTER W */
+#define XKB_KEY_x 0x0078 /* U+0078 LATIN SMALL LETTER X */
+#define XKB_KEY_y 0x0079 /* U+0079 LATIN SMALL LETTER Y */
+#define XKB_KEY_z 0x007a /* U+007A LATIN SMALL LETTER Z */
+#define XKB_KEY_braceleft 0x007b /* U+007B LEFT CURLY BRACKET */
+#define XKB_KEY_bar 0x007c /* U+007C VERTICAL LINE */
+#define XKB_KEY_braceright 0x007d /* U+007D RIGHT CURLY BRACKET */
+#define XKB_KEY_asciitilde 0x007e /* U+007E TILDE */
+
+#define XKB_KEY_nobreakspace 0x00a0 /* U+00A0 NO-BREAK SPACE */
+#define XKB_KEY_exclamdown 0x00a1 /* U+00A1 INVERTED EXCLAMATION MARK */
+#define XKB_KEY_cent 0x00a2 /* U+00A2 CENT SIGN */
+#define XKB_KEY_sterling 0x00a3 /* U+00A3 POUND SIGN */
+#define XKB_KEY_currency 0x00a4 /* U+00A4 CURRENCY SIGN */
+#define XKB_KEY_yen 0x00a5 /* U+00A5 YEN SIGN */
+#define XKB_KEY_brokenbar 0x00a6 /* U+00A6 BROKEN BAR */
+#define XKB_KEY_section 0x00a7 /* U+00A7 SECTION SIGN */
+#define XKB_KEY_diaeresis 0x00a8 /* U+00A8 DIAERESIS */
+#define XKB_KEY_copyright 0x00a9 /* U+00A9 COPYRIGHT SIGN */
+#define XKB_KEY_ordfeminine 0x00aa /* U+00AA FEMININE ORDINAL INDICATOR */
+#define XKB_KEY_guillemotleft 0x00ab /* U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */
+#define XKB_KEY_notsign 0x00ac /* U+00AC NOT SIGN */
+#define XKB_KEY_hyphen 0x00ad /* U+00AD SOFT HYPHEN */
+#define XKB_KEY_registered 0x00ae /* U+00AE REGISTERED SIGN */
+#define XKB_KEY_macron 0x00af /* U+00AF MACRON */
+#define XKB_KEY_degree 0x00b0 /* U+00B0 DEGREE SIGN */
+#define XKB_KEY_plusminus 0x00b1 /* U+00B1 PLUS-MINUS SIGN */
+#define XKB_KEY_twosuperior 0x00b2 /* U+00B2 SUPERSCRIPT TWO */
+#define XKB_KEY_threesuperior 0x00b3 /* U+00B3 SUPERSCRIPT THREE */
+#define XKB_KEY_acute 0x00b4 /* U+00B4 ACUTE ACCENT */
+#define XKB_KEY_mu 0x00b5 /* U+00B5 MICRO SIGN */
+#define XKB_KEY_paragraph 0x00b6 /* U+00B6 PILCROW SIGN */
+#define XKB_KEY_periodcentered 0x00b7 /* U+00B7 MIDDLE DOT */
+#define XKB_KEY_cedilla 0x00b8 /* U+00B8 CEDILLA */
+#define XKB_KEY_onesuperior 0x00b9 /* U+00B9 SUPERSCRIPT ONE */
+#define XKB_KEY_masculine 0x00ba /* U+00BA MASCULINE ORDINAL INDICATOR */
+#define XKB_KEY_guillemotright 0x00bb /* U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */
+#define XKB_KEY_onequarter 0x00bc /* U+00BC VULGAR FRACTION ONE QUARTER */
+#define XKB_KEY_onehalf 0x00bd /* U+00BD VULGAR FRACTION ONE HALF */
+#define XKB_KEY_threequarters 0x00be /* U+00BE VULGAR FRACTION THREE QUARTERS */
+#define XKB_KEY_questiondown 0x00bf /* U+00BF INVERTED QUESTION MARK */
+#define XKB_KEY_Agrave 0x00c0 /* U+00C0 LATIN CAPITAL LETTER A WITH GRAVE */
+#define XKB_KEY_Aacute 0x00c1 /* U+00C1 LATIN CAPITAL LETTER A WITH ACUTE */
+#define XKB_KEY_Acircumflex 0x00c2 /* U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */
+#define XKB_KEY_Atilde 0x00c3 /* U+00C3 LATIN CAPITAL LETTER A WITH TILDE */
+#define XKB_KEY_Adiaeresis 0x00c4 /* U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS */
+#define XKB_KEY_Aring 0x00c5 /* U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE */
+#define XKB_KEY_AE 0x00c6 /* U+00C6 LATIN CAPITAL LETTER AE */
+#define XKB_KEY_Ccedilla 0x00c7 /* U+00C7 LATIN CAPITAL LETTER C WITH CEDILLA */
+#define XKB_KEY_Egrave 0x00c8 /* U+00C8 LATIN CAPITAL LETTER E WITH GRAVE */
+#define XKB_KEY_Eacute 0x00c9 /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+#define XKB_KEY_Ecircumflex 0x00ca /* U+00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX */
+#define XKB_KEY_Ediaeresis 0x00cb /* U+00CB LATIN CAPITAL LETTER E WITH DIAERESIS */
+#define XKB_KEY_Igrave 0x00cc /* U+00CC LATIN CAPITAL LETTER I WITH GRAVE */
+#define XKB_KEY_Iacute 0x00cd /* U+00CD LATIN CAPITAL LETTER I WITH ACUTE */
+#define XKB_KEY_Icircumflex 0x00ce /* U+00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX */
+#define XKB_KEY_Idiaeresis 0x00cf /* U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS */
+#define XKB_KEY_ETH 0x00d0 /* U+00D0 LATIN CAPITAL LETTER ETH */
+#define XKB_KEY_Eth 0x00d0 /* deprecated */
+#define XKB_KEY_Ntilde 0x00d1 /* U+00D1 LATIN CAPITAL LETTER N WITH TILDE */
+#define XKB_KEY_Ograve 0x00d2 /* U+00D2 LATIN CAPITAL LETTER O WITH GRAVE */
+#define XKB_KEY_Oacute 0x00d3 /* U+00D3 LATIN CAPITAL LETTER O WITH ACUTE */
+#define XKB_KEY_Ocircumflex 0x00d4 /* U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */
+#define XKB_KEY_Otilde 0x00d5 /* U+00D5 LATIN CAPITAL LETTER O WITH TILDE */
+#define XKB_KEY_Odiaeresis 0x00d6 /* U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS */
+#define XKB_KEY_multiply 0x00d7 /* U+00D7 MULTIPLICATION SIGN */
+#define XKB_KEY_Oslash 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+#define XKB_KEY_Ooblique 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+#define XKB_KEY_Ugrave 0x00d9 /* U+00D9 LATIN CAPITAL LETTER U WITH GRAVE */
+#define XKB_KEY_Uacute 0x00da /* U+00DA LATIN CAPITAL LETTER U WITH ACUTE */
+#define XKB_KEY_Ucircumflex 0x00db /* U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX */
+#define XKB_KEY_Udiaeresis 0x00dc /* U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS */
+#define XKB_KEY_Yacute 0x00dd /* U+00DD LATIN CAPITAL LETTER Y WITH ACUTE */
+#define XKB_KEY_THORN 0x00de /* U+00DE LATIN CAPITAL LETTER THORN */
+#define XKB_KEY_Thorn 0x00de /* deprecated */
+#define XKB_KEY_ssharp 0x00df /* U+00DF LATIN SMALL LETTER SHARP S */
+#define XKB_KEY_agrave 0x00e0 /* U+00E0 LATIN SMALL LETTER A WITH GRAVE */
+#define XKB_KEY_aacute 0x00e1 /* U+00E1 LATIN SMALL LETTER A WITH ACUTE */
+#define XKB_KEY_acircumflex 0x00e2 /* U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX */
+#define XKB_KEY_atilde 0x00e3 /* U+00E3 LATIN SMALL LETTER A WITH TILDE */
+#define XKB_KEY_adiaeresis 0x00e4 /* U+00E4 LATIN SMALL LETTER A WITH DIAERESIS */
+#define XKB_KEY_aring 0x00e5 /* U+00E5 LATIN SMALL LETTER A WITH RING ABOVE */
+#define XKB_KEY_ae 0x00e6 /* U+00E6 LATIN SMALL LETTER AE */
+#define XKB_KEY_ccedilla 0x00e7 /* U+00E7 LATIN SMALL LETTER C WITH CEDILLA */
+#define XKB_KEY_egrave 0x00e8 /* U+00E8 LATIN SMALL LETTER E WITH GRAVE */
+#define XKB_KEY_eacute 0x00e9 /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
+#define XKB_KEY_ecircumflex 0x00ea /* U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX */
+#define XKB_KEY_ediaeresis 0x00eb /* U+00EB LATIN SMALL LETTER E WITH DIAERESIS */
+#define XKB_KEY_igrave 0x00ec /* U+00EC LATIN SMALL LETTER I WITH GRAVE */
+#define XKB_KEY_iacute 0x00ed /* U+00ED LATIN SMALL LETTER I WITH ACUTE */
+#define XKB_KEY_icircumflex 0x00ee /* U+00EE LATIN SMALL LETTER I WITH CIRCUMFLEX */
+#define XKB_KEY_idiaeresis 0x00ef /* U+00EF LATIN SMALL LETTER I WITH DIAERESIS */
+#define XKB_KEY_eth 0x00f0 /* U+00F0 LATIN SMALL LETTER ETH */
+#define XKB_KEY_ntilde 0x00f1 /* U+00F1 LATIN SMALL LETTER N WITH TILDE */
+#define XKB_KEY_ograve 0x00f2 /* U+00F2 LATIN SMALL LETTER O WITH GRAVE */
+#define XKB_KEY_oacute 0x00f3 /* U+00F3 LATIN SMALL LETTER O WITH ACUTE */
+#define XKB_KEY_ocircumflex 0x00f4 /* U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX */
+#define XKB_KEY_otilde 0x00f5 /* U+00F5 LATIN SMALL LETTER O WITH TILDE */
+#define XKB_KEY_odiaeresis 0x00f6 /* U+00F6 LATIN SMALL LETTER O WITH DIAERESIS */
+#define XKB_KEY_division 0x00f7 /* U+00F7 DIVISION SIGN */
+#define XKB_KEY_oslash 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */
+#define XKB_KEY_ooblique 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */
+#define XKB_KEY_ugrave 0x00f9 /* U+00F9 LATIN SMALL LETTER U WITH GRAVE */
+#define XKB_KEY_uacute 0x00fa /* U+00FA LATIN SMALL LETTER U WITH ACUTE */
+#define XKB_KEY_ucircumflex 0x00fb /* U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX */
+#define XKB_KEY_udiaeresis 0x00fc /* U+00FC LATIN SMALL LETTER U WITH DIAERESIS */
+#define XKB_KEY_yacute 0x00fd /* U+00FD LATIN SMALL LETTER Y WITH ACUTE */
+#define XKB_KEY_thorn 0x00fe /* U+00FE LATIN SMALL LETTER THORN */
+#define XKB_KEY_ydiaeresis 0x00ff /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+
+/*
+ * Latin 2
+ * Byte 3 = 1
+ */
+
+#define XKB_KEY_Aogonek 0x01a1 /* U+0104 LATIN CAPITAL LETTER A WITH OGONEK */
+#define XKB_KEY_breve 0x01a2 /* U+02D8 BREVE */
+#define XKB_KEY_Lstroke 0x01a3 /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+#define XKB_KEY_Lcaron 0x01a5 /* U+013D LATIN CAPITAL LETTER L WITH CARON */
+#define XKB_KEY_Sacute 0x01a6 /* U+015A LATIN CAPITAL LETTER S WITH ACUTE */
+#define XKB_KEY_Scaron 0x01a9 /* U+0160 LATIN CAPITAL LETTER S WITH CARON */
+#define XKB_KEY_Scedilla 0x01aa /* U+015E LATIN CAPITAL LETTER S WITH CEDILLA */
+#define XKB_KEY_Tcaron 0x01ab /* U+0164 LATIN CAPITAL LETTER T WITH CARON */
+#define XKB_KEY_Zacute 0x01ac /* U+0179 LATIN CAPITAL LETTER Z WITH ACUTE */
+#define XKB_KEY_Zcaron 0x01ae /* U+017D LATIN CAPITAL LETTER Z WITH CARON */
+#define XKB_KEY_Zabovedot 0x01af /* U+017B LATIN CAPITAL LETTER Z WITH DOT ABOVE */
+#define XKB_KEY_aogonek 0x01b1 /* U+0105 LATIN SMALL LETTER A WITH OGONEK */
+#define XKB_KEY_ogonek 0x01b2 /* U+02DB OGONEK */
+#define XKB_KEY_lstroke 0x01b3 /* U+0142 LATIN SMALL LETTER L WITH STROKE */
+#define XKB_KEY_lcaron 0x01b5 /* U+013E LATIN SMALL LETTER L WITH CARON */
+#define XKB_KEY_sacute 0x01b6 /* U+015B LATIN SMALL LETTER S WITH ACUTE */
+#define XKB_KEY_caron 0x01b7 /* U+02C7 CARON */
+#define XKB_KEY_scaron 0x01b9 /* U+0161 LATIN SMALL LETTER S WITH CARON */
+#define XKB_KEY_scedilla 0x01ba /* U+015F LATIN SMALL LETTER S WITH CEDILLA */
+#define XKB_KEY_tcaron 0x01bb /* U+0165 LATIN SMALL LETTER T WITH CARON */
+#define XKB_KEY_zacute 0x01bc /* U+017A LATIN SMALL LETTER Z WITH ACUTE */
+#define XKB_KEY_doubleacute 0x01bd /* U+02DD DOUBLE ACUTE ACCENT */
+#define XKB_KEY_zcaron 0x01be /* U+017E LATIN SMALL LETTER Z WITH CARON */
+#define XKB_KEY_zabovedot 0x01bf /* U+017C LATIN SMALL LETTER Z WITH DOT ABOVE */
+#define XKB_KEY_Racute 0x01c0 /* U+0154 LATIN CAPITAL LETTER R WITH ACUTE */
+#define XKB_KEY_Abreve 0x01c3 /* U+0102 LATIN CAPITAL LETTER A WITH BREVE */
+#define XKB_KEY_Lacute 0x01c5 /* U+0139 LATIN CAPITAL LETTER L WITH ACUTE */
+#define XKB_KEY_Cacute 0x01c6 /* U+0106 LATIN CAPITAL LETTER C WITH ACUTE */
+#define XKB_KEY_Ccaron 0x01c8 /* U+010C LATIN CAPITAL LETTER C WITH CARON */
+#define XKB_KEY_Eogonek 0x01ca /* U+0118 LATIN CAPITAL LETTER E WITH OGONEK */
+#define XKB_KEY_Ecaron 0x01cc /* U+011A LATIN CAPITAL LETTER E WITH CARON */
+#define XKB_KEY_Dcaron 0x01cf /* U+010E LATIN CAPITAL LETTER D WITH CARON */
+#define XKB_KEY_Dstroke 0x01d0 /* U+0110 LATIN CAPITAL LETTER D WITH STROKE */
+#define XKB_KEY_Nacute 0x01d1 /* U+0143 LATIN CAPITAL LETTER N WITH ACUTE */
+#define XKB_KEY_Ncaron 0x01d2 /* U+0147 LATIN CAPITAL LETTER N WITH CARON */
+#define XKB_KEY_Odoubleacute 0x01d5 /* U+0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */
+#define XKB_KEY_Rcaron 0x01d8 /* U+0158 LATIN CAPITAL LETTER R WITH CARON */
+#define XKB_KEY_Uring 0x01d9 /* U+016E LATIN CAPITAL LETTER U WITH RING ABOVE */
+#define XKB_KEY_Udoubleacute 0x01db /* U+0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */
+#define XKB_KEY_Tcedilla 0x01de /* U+0162 LATIN CAPITAL LETTER T WITH CEDILLA */
+#define XKB_KEY_racute 0x01e0 /* U+0155 LATIN SMALL LETTER R WITH ACUTE */
+#define XKB_KEY_abreve 0x01e3 /* U+0103 LATIN SMALL LETTER A WITH BREVE */
+#define XKB_KEY_lacute 0x01e5 /* U+013A LATIN SMALL LETTER L WITH ACUTE */
+#define XKB_KEY_cacute 0x01e6 /* U+0107 LATIN SMALL LETTER C WITH ACUTE */
+#define XKB_KEY_ccaron 0x01e8 /* U+010D LATIN SMALL LETTER C WITH CARON */
+#define XKB_KEY_eogonek 0x01ea /* U+0119 LATIN SMALL LETTER E WITH OGONEK */
+#define XKB_KEY_ecaron 0x01ec /* U+011B LATIN SMALL LETTER E WITH CARON */
+#define XKB_KEY_dcaron 0x01ef /* U+010F LATIN SMALL LETTER D WITH CARON */
+#define XKB_KEY_dstroke 0x01f0 /* U+0111 LATIN SMALL LETTER D WITH STROKE */
+#define XKB_KEY_nacute 0x01f1 /* U+0144 LATIN SMALL LETTER N WITH ACUTE */
+#define XKB_KEY_ncaron 0x01f2 /* U+0148 LATIN SMALL LETTER N WITH CARON */
+#define XKB_KEY_odoubleacute 0x01f5 /* U+0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE */
+#define XKB_KEY_rcaron 0x01f8 /* U+0159 LATIN SMALL LETTER R WITH CARON */
+#define XKB_KEY_uring 0x01f9 /* U+016F LATIN SMALL LETTER U WITH RING ABOVE */
+#define XKB_KEY_udoubleacute 0x01fb /* U+0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE */
+#define XKB_KEY_tcedilla 0x01fe /* U+0163 LATIN SMALL LETTER T WITH CEDILLA */
+#define XKB_KEY_abovedot 0x01ff /* U+02D9 DOT ABOVE */
+
+/*
+ * Latin 3
+ * Byte 3 = 2
+ */
+
+#define XKB_KEY_Hstroke 0x02a1 /* U+0126 LATIN CAPITAL LETTER H WITH STROKE */
+#define XKB_KEY_Hcircumflex 0x02a6 /* U+0124 LATIN CAPITAL LETTER H WITH CIRCUMFLEX */
+#define XKB_KEY_Iabovedot 0x02a9 /* U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE */
+#define XKB_KEY_Gbreve 0x02ab /* U+011E LATIN CAPITAL LETTER G WITH BREVE */
+#define XKB_KEY_Jcircumflex 0x02ac /* U+0134 LATIN CAPITAL LETTER J WITH CIRCUMFLEX */
+#define XKB_KEY_hstroke 0x02b1 /* U+0127 LATIN SMALL LETTER H WITH STROKE */
+#define XKB_KEY_hcircumflex 0x02b6 /* U+0125 LATIN SMALL LETTER H WITH CIRCUMFLEX */
+#define XKB_KEY_idotless 0x02b9 /* U+0131 LATIN SMALL LETTER DOTLESS I */
+#define XKB_KEY_gbreve 0x02bb /* U+011F LATIN SMALL LETTER G WITH BREVE */
+#define XKB_KEY_jcircumflex 0x02bc /* U+0135 LATIN SMALL LETTER J WITH CIRCUMFLEX */
+#define XKB_KEY_Cabovedot 0x02c5 /* U+010A LATIN CAPITAL LETTER C WITH DOT ABOVE */
+#define XKB_KEY_Ccircumflex 0x02c6 /* U+0108 LATIN CAPITAL LETTER C WITH CIRCUMFLEX */
+#define XKB_KEY_Gabovedot 0x02d5 /* U+0120 LATIN CAPITAL LETTER G WITH DOT ABOVE */
+#define XKB_KEY_Gcircumflex 0x02d8 /* U+011C LATIN CAPITAL LETTER G WITH CIRCUMFLEX */
+#define XKB_KEY_Ubreve 0x02dd /* U+016C LATIN CAPITAL LETTER U WITH BREVE */
+#define XKB_KEY_Scircumflex 0x02de /* U+015C LATIN CAPITAL LETTER S WITH CIRCUMFLEX */
+#define XKB_KEY_cabovedot 0x02e5 /* U+010B LATIN SMALL LETTER C WITH DOT ABOVE */
+#define XKB_KEY_ccircumflex 0x02e6 /* U+0109 LATIN SMALL LETTER C WITH CIRCUMFLEX */
+#define XKB_KEY_gabovedot 0x02f5 /* U+0121 LATIN SMALL LETTER G WITH DOT ABOVE */
+#define XKB_KEY_gcircumflex 0x02f8 /* U+011D LATIN SMALL LETTER G WITH CIRCUMFLEX */
+#define XKB_KEY_ubreve 0x02fd /* U+016D LATIN SMALL LETTER U WITH BREVE */
+#define XKB_KEY_scircumflex 0x02fe /* U+015D LATIN SMALL LETTER S WITH CIRCUMFLEX */
+
+
+/*
+ * Latin 4
+ * Byte 3 = 3
+ */
+
+#define XKB_KEY_kra 0x03a2 /* U+0138 LATIN SMALL LETTER KRA */
+#define XKB_KEY_kappa 0x03a2 /* deprecated */
+#define XKB_KEY_Rcedilla 0x03a3 /* U+0156 LATIN CAPITAL LETTER R WITH CEDILLA */
+#define XKB_KEY_Itilde 0x03a5 /* U+0128 LATIN CAPITAL LETTER I WITH TILDE */
+#define XKB_KEY_Lcedilla 0x03a6 /* U+013B LATIN CAPITAL LETTER L WITH CEDILLA */
+#define XKB_KEY_Emacron 0x03aa /* U+0112 LATIN CAPITAL LETTER E WITH MACRON */
+#define XKB_KEY_Gcedilla 0x03ab /* U+0122 LATIN CAPITAL LETTER G WITH CEDILLA */
+#define XKB_KEY_Tslash 0x03ac /* U+0166 LATIN CAPITAL LETTER T WITH STROKE */
+#define XKB_KEY_rcedilla 0x03b3 /* U+0157 LATIN SMALL LETTER R WITH CEDILLA */
+#define XKB_KEY_itilde 0x03b5 /* U+0129 LATIN SMALL LETTER I WITH TILDE */
+#define XKB_KEY_lcedilla 0x03b6 /* U+013C LATIN SMALL LETTER L WITH CEDILLA */
+#define XKB_KEY_emacron 0x03ba /* U+0113 LATIN SMALL LETTER E WITH MACRON */
+#define XKB_KEY_gcedilla 0x03bb /* U+0123 LATIN SMALL LETTER G WITH CEDILLA */
+#define XKB_KEY_tslash 0x03bc /* U+0167 LATIN SMALL LETTER T WITH STROKE */
+#define XKB_KEY_ENG 0x03bd /* U+014A LATIN CAPITAL LETTER ENG */
+#define XKB_KEY_eng 0x03bf /* U+014B LATIN SMALL LETTER ENG */
+#define XKB_KEY_Amacron 0x03c0 /* U+0100 LATIN CAPITAL LETTER A WITH MACRON */
+#define XKB_KEY_Iogonek 0x03c7 /* U+012E LATIN CAPITAL LETTER I WITH OGONEK */
+#define XKB_KEY_Eabovedot 0x03cc /* U+0116 LATIN CAPITAL LETTER E WITH DOT ABOVE */
+#define XKB_KEY_Imacron 0x03cf /* U+012A LATIN CAPITAL LETTER I WITH MACRON */
+#define XKB_KEY_Ncedilla 0x03d1 /* U+0145 LATIN CAPITAL LETTER N WITH CEDILLA */
+#define XKB_KEY_Omacron 0x03d2 /* U+014C LATIN CAPITAL LETTER O WITH MACRON */
+#define XKB_KEY_Kcedilla 0x03d3 /* U+0136 LATIN CAPITAL LETTER K WITH CEDILLA */
+#define XKB_KEY_Uogonek 0x03d9 /* U+0172 LATIN CAPITAL LETTER U WITH OGONEK */
+#define XKB_KEY_Utilde 0x03dd /* U+0168 LATIN CAPITAL LETTER U WITH TILDE */
+#define XKB_KEY_Umacron 0x03de /* U+016A LATIN CAPITAL LETTER U WITH MACRON */
+#define XKB_KEY_amacron 0x03e0 /* U+0101 LATIN SMALL LETTER A WITH MACRON */
+#define XKB_KEY_iogonek 0x03e7 /* U+012F LATIN SMALL LETTER I WITH OGONEK */
+#define XKB_KEY_eabovedot 0x03ec /* U+0117 LATIN SMALL LETTER E WITH DOT ABOVE */
+#define XKB_KEY_imacron 0x03ef /* U+012B LATIN SMALL LETTER I WITH MACRON */
+#define XKB_KEY_ncedilla 0x03f1 /* U+0146 LATIN SMALL LETTER N WITH CEDILLA */
+#define XKB_KEY_omacron 0x03f2 /* U+014D LATIN SMALL LETTER O WITH MACRON */
+#define XKB_KEY_kcedilla 0x03f3 /* U+0137 LATIN SMALL LETTER K WITH CEDILLA */
+#define XKB_KEY_uogonek 0x03f9 /* U+0173 LATIN SMALL LETTER U WITH OGONEK */
+#define XKB_KEY_utilde 0x03fd /* U+0169 LATIN SMALL LETTER U WITH TILDE */
+#define XKB_KEY_umacron 0x03fe /* U+016B LATIN SMALL LETTER U WITH MACRON */
+
+/*
+ * Latin 8
+ */
+#define XKB_KEY_Wcircumflex 0x1000174 /* U+0174 LATIN CAPITAL LETTER W WITH CIRCUMFLEX */
+#define XKB_KEY_wcircumflex 0x1000175 /* U+0175 LATIN SMALL LETTER W WITH CIRCUMFLEX */
+#define XKB_KEY_Ycircumflex 0x1000176 /* U+0176 LATIN CAPITAL LETTER Y WITH CIRCUMFLEX */
+#define XKB_KEY_ycircumflex 0x1000177 /* U+0177 LATIN SMALL LETTER Y WITH CIRCUMFLEX */
+#define XKB_KEY_Babovedot 0x1001e02 /* U+1E02 LATIN CAPITAL LETTER B WITH DOT ABOVE */
+#define XKB_KEY_babovedot 0x1001e03 /* U+1E03 LATIN SMALL LETTER B WITH DOT ABOVE */
+#define XKB_KEY_Dabovedot 0x1001e0a /* U+1E0A LATIN CAPITAL LETTER D WITH DOT ABOVE */
+#define XKB_KEY_dabovedot 0x1001e0b /* U+1E0B LATIN SMALL LETTER D WITH DOT ABOVE */
+#define XKB_KEY_Fabovedot 0x1001e1e /* U+1E1E LATIN CAPITAL LETTER F WITH DOT ABOVE */
+#define XKB_KEY_fabovedot 0x1001e1f /* U+1E1F LATIN SMALL LETTER F WITH DOT ABOVE */
+#define XKB_KEY_Mabovedot 0x1001e40 /* U+1E40 LATIN CAPITAL LETTER M WITH DOT ABOVE */
+#define XKB_KEY_mabovedot 0x1001e41 /* U+1E41 LATIN SMALL LETTER M WITH DOT ABOVE */
+#define XKB_KEY_Pabovedot 0x1001e56 /* U+1E56 LATIN CAPITAL LETTER P WITH DOT ABOVE */
+#define XKB_KEY_pabovedot 0x1001e57 /* U+1E57 LATIN SMALL LETTER P WITH DOT ABOVE */
+#define XKB_KEY_Sabovedot 0x1001e60 /* U+1E60 LATIN CAPITAL LETTER S WITH DOT ABOVE */
+#define XKB_KEY_sabovedot 0x1001e61 /* U+1E61 LATIN SMALL LETTER S WITH DOT ABOVE */
+#define XKB_KEY_Tabovedot 0x1001e6a /* U+1E6A LATIN CAPITAL LETTER T WITH DOT ABOVE */
+#define XKB_KEY_tabovedot 0x1001e6b /* U+1E6B LATIN SMALL LETTER T WITH DOT ABOVE */
+#define XKB_KEY_Wgrave 0x1001e80 /* U+1E80 LATIN CAPITAL LETTER W WITH GRAVE */
+#define XKB_KEY_wgrave 0x1001e81 /* U+1E81 LATIN SMALL LETTER W WITH GRAVE */
+#define XKB_KEY_Wacute 0x1001e82 /* U+1E82 LATIN CAPITAL LETTER W WITH ACUTE */
+#define XKB_KEY_wacute 0x1001e83 /* U+1E83 LATIN SMALL LETTER W WITH ACUTE */
+#define XKB_KEY_Wdiaeresis 0x1001e84 /* U+1E84 LATIN CAPITAL LETTER W WITH DIAERESIS */
+#define XKB_KEY_wdiaeresis 0x1001e85 /* U+1E85 LATIN SMALL LETTER W WITH DIAERESIS */
+#define XKB_KEY_Ygrave 0x1001ef2 /* U+1EF2 LATIN CAPITAL LETTER Y WITH GRAVE */
+#define XKB_KEY_ygrave 0x1001ef3 /* U+1EF3 LATIN SMALL LETTER Y WITH GRAVE */
+
+/*
+ * Latin 9
+ * Byte 3 = 0x13
+ */
+
+#define XKB_KEY_OE 0x13bc /* U+0152 LATIN CAPITAL LIGATURE OE */
+#define XKB_KEY_oe 0x13bd /* U+0153 LATIN SMALL LIGATURE OE */
+#define XKB_KEY_Ydiaeresis 0x13be /* U+0178 LATIN CAPITAL LETTER Y WITH DIAERESIS */
+
+/*
+ * Katakana
+ * Byte 3 = 4
+ */
+
+#define XKB_KEY_overline 0x047e /* U+203E OVERLINE */
+#define XKB_KEY_kana_fullstop 0x04a1 /* U+3002 IDEOGRAPHIC FULL STOP */
+#define XKB_KEY_kana_openingbracket 0x04a2 /* U+300C LEFT CORNER BRACKET */
+#define XKB_KEY_kana_closingbracket 0x04a3 /* U+300D RIGHT CORNER BRACKET */
+#define XKB_KEY_kana_comma 0x04a4 /* U+3001 IDEOGRAPHIC COMMA */
+#define XKB_KEY_kana_conjunctive 0x04a5 /* U+30FB KATAKANA MIDDLE DOT */
+#define XKB_KEY_kana_middledot 0x04a5 /* deprecated */
+#define XKB_KEY_kana_WO 0x04a6 /* U+30F2 KATAKANA LETTER WO */
+#define XKB_KEY_kana_a 0x04a7 /* U+30A1 KATAKANA LETTER SMALL A */
+#define XKB_KEY_kana_i 0x04a8 /* U+30A3 KATAKANA LETTER SMALL I */
+#define XKB_KEY_kana_u 0x04a9 /* U+30A5 KATAKANA LETTER SMALL U */
+#define XKB_KEY_kana_e 0x04aa /* U+30A7 KATAKANA LETTER SMALL E */
+#define XKB_KEY_kana_o 0x04ab /* U+30A9 KATAKANA LETTER SMALL O */
+#define XKB_KEY_kana_ya 0x04ac /* U+30E3 KATAKANA LETTER SMALL YA */
+#define XKB_KEY_kana_yu 0x04ad /* U+30E5 KATAKANA LETTER SMALL YU */
+#define XKB_KEY_kana_yo 0x04ae /* U+30E7 KATAKANA LETTER SMALL YO */
+#define XKB_KEY_kana_tsu 0x04af /* U+30C3 KATAKANA LETTER SMALL TU */
+#define XKB_KEY_kana_tu 0x04af /* deprecated */
+#define XKB_KEY_prolongedsound 0x04b0 /* U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK */
+#define XKB_KEY_kana_A 0x04b1 /* U+30A2 KATAKANA LETTER A */
+#define XKB_KEY_kana_I 0x04b2 /* U+30A4 KATAKANA LETTER I */
+#define XKB_KEY_kana_U 0x04b3 /* U+30A6 KATAKANA LETTER U */
+#define XKB_KEY_kana_E 0x04b4 /* U+30A8 KATAKANA LETTER E */
+#define XKB_KEY_kana_O 0x04b5 /* U+30AA KATAKANA LETTER O */
+#define XKB_KEY_kana_KA 0x04b6 /* U+30AB KATAKANA LETTER KA */
+#define XKB_KEY_kana_KI 0x04b7 /* U+30AD KATAKANA LETTER KI */
+#define XKB_KEY_kana_KU 0x04b8 /* U+30AF KATAKANA LETTER KU */
+#define XKB_KEY_kana_KE 0x04b9 /* U+30B1 KATAKANA LETTER KE */
+#define XKB_KEY_kana_KO 0x04ba /* U+30B3 KATAKANA LETTER KO */
+#define XKB_KEY_kana_SA 0x04bb /* U+30B5 KATAKANA LETTER SA */
+#define XKB_KEY_kana_SHI 0x04bc /* U+30B7 KATAKANA LETTER SI */
+#define XKB_KEY_kana_SU 0x04bd /* U+30B9 KATAKANA LETTER SU */
+#define XKB_KEY_kana_SE 0x04be /* U+30BB KATAKANA LETTER SE */
+#define XKB_KEY_kana_SO 0x04bf /* U+30BD KATAKANA LETTER SO */
+#define XKB_KEY_kana_TA 0x04c0 /* U+30BF KATAKANA LETTER TA */
+#define XKB_KEY_kana_CHI 0x04c1 /* U+30C1 KATAKANA LETTER TI */
+#define XKB_KEY_kana_TI 0x04c1 /* deprecated */
+#define XKB_KEY_kana_TSU 0x04c2 /* U+30C4 KATAKANA LETTER TU */
+#define XKB_KEY_kana_TU 0x04c2 /* deprecated */
+#define XKB_KEY_kana_TE 0x04c3 /* U+30C6 KATAKANA LETTER TE */
+#define XKB_KEY_kana_TO 0x04c4 /* U+30C8 KATAKANA LETTER TO */
+#define XKB_KEY_kana_NA 0x04c5 /* U+30CA KATAKANA LETTER NA */
+#define XKB_KEY_kana_NI 0x04c6 /* U+30CB KATAKANA LETTER NI */
+#define XKB_KEY_kana_NU 0x04c7 /* U+30CC KATAKANA LETTER NU */
+#define XKB_KEY_kana_NE 0x04c8 /* U+30CD KATAKANA LETTER NE */
+#define XKB_KEY_kana_NO 0x04c9 /* U+30CE KATAKANA LETTER NO */
+#define XKB_KEY_kana_HA 0x04ca /* U+30CF KATAKANA LETTER HA */
+#define XKB_KEY_kana_HI 0x04cb /* U+30D2 KATAKANA LETTER HI */
+#define XKB_KEY_kana_FU 0x04cc /* U+30D5 KATAKANA LETTER HU */
+#define XKB_KEY_kana_HU 0x04cc /* deprecated */
+#define XKB_KEY_kana_HE 0x04cd /* U+30D8 KATAKANA LETTER HE */
+#define XKB_KEY_kana_HO 0x04ce /* U+30DB KATAKANA LETTER HO */
+#define XKB_KEY_kana_MA 0x04cf /* U+30DE KATAKANA LETTER MA */
+#define XKB_KEY_kana_MI 0x04d0 /* U+30DF KATAKANA LETTER MI */
+#define XKB_KEY_kana_MU 0x04d1 /* U+30E0 KATAKANA LETTER MU */
+#define XKB_KEY_kana_ME 0x04d2 /* U+30E1 KATAKANA LETTER ME */
+#define XKB_KEY_kana_MO 0x04d3 /* U+30E2 KATAKANA LETTER MO */
+#define XKB_KEY_kana_YA 0x04d4 /* U+30E4 KATAKANA LETTER YA */
+#define XKB_KEY_kana_YU 0x04d5 /* U+30E6 KATAKANA LETTER YU */
+#define XKB_KEY_kana_YO 0x04d6 /* U+30E8 KATAKANA LETTER YO */
+#define XKB_KEY_kana_RA 0x04d7 /* U+30E9 KATAKANA LETTER RA */
+#define XKB_KEY_kana_RI 0x04d8 /* U+30EA KATAKANA LETTER RI */
+#define XKB_KEY_kana_RU 0x04d9 /* U+30EB KATAKANA LETTER RU */
+#define XKB_KEY_kana_RE 0x04da /* U+30EC KATAKANA LETTER RE */
+#define XKB_KEY_kana_RO 0x04db /* U+30ED KATAKANA LETTER RO */
+#define XKB_KEY_kana_WA 0x04dc /* U+30EF KATAKANA LETTER WA */
+#define XKB_KEY_kana_N 0x04dd /* U+30F3 KATAKANA LETTER N */
+#define XKB_KEY_voicedsound 0x04de /* U+309B KATAKANA-HIRAGANA VOICED SOUND MARK */
+#define XKB_KEY_semivoicedsound 0x04df /* U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */
+#define XKB_KEY_kana_switch 0xff7e /* Alias for mode_switch */
+
+/*
+ * Arabic
+ * Byte 3 = 5
+ */
+
+#define XKB_KEY_Farsi_0 0x10006f0 /* U+06F0 EXTENDED ARABIC-INDIC DIGIT ZERO */
+#define XKB_KEY_Farsi_1 0x10006f1 /* U+06F1 EXTENDED ARABIC-INDIC DIGIT ONE */
+#define XKB_KEY_Farsi_2 0x10006f2 /* U+06F2 EXTENDED ARABIC-INDIC DIGIT TWO */
+#define XKB_KEY_Farsi_3 0x10006f3 /* U+06F3 EXTENDED ARABIC-INDIC DIGIT THREE */
+#define XKB_KEY_Farsi_4 0x10006f4 /* U+06F4 EXTENDED ARABIC-INDIC DIGIT FOUR */
+#define XKB_KEY_Farsi_5 0x10006f5 /* U+06F5 EXTENDED ARABIC-INDIC DIGIT FIVE */
+#define XKB_KEY_Farsi_6 0x10006f6 /* U+06F6 EXTENDED ARABIC-INDIC DIGIT SIX */
+#define XKB_KEY_Farsi_7 0x10006f7 /* U+06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN */
+#define XKB_KEY_Farsi_8 0x10006f8 /* U+06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT */
+#define XKB_KEY_Farsi_9 0x10006f9 /* U+06F9 EXTENDED ARABIC-INDIC DIGIT NINE */
+#define XKB_KEY_Arabic_percent 0x100066a /* U+066A ARABIC PERCENT SIGN */
+#define XKB_KEY_Arabic_superscript_alef 0x1000670 /* U+0670 ARABIC LETTER SUPERSCRIPT ALEF */
+#define XKB_KEY_Arabic_tteh 0x1000679 /* U+0679 ARABIC LETTER TTEH */
+#define XKB_KEY_Arabic_peh 0x100067e /* U+067E ARABIC LETTER PEH */
+#define XKB_KEY_Arabic_tcheh 0x1000686 /* U+0686 ARABIC LETTER TCHEH */
+#define XKB_KEY_Arabic_ddal 0x1000688 /* U+0688 ARABIC LETTER DDAL */
+#define XKB_KEY_Arabic_rreh 0x1000691 /* U+0691 ARABIC LETTER RREH */
+#define XKB_KEY_Arabic_comma 0x05ac /* U+060C ARABIC COMMA */
+#define XKB_KEY_Arabic_fullstop 0x10006d4 /* U+06D4 ARABIC FULL STOP */
+#define XKB_KEY_Arabic_0 0x1000660 /* U+0660 ARABIC-INDIC DIGIT ZERO */
+#define XKB_KEY_Arabic_1 0x1000661 /* U+0661 ARABIC-INDIC DIGIT ONE */
+#define XKB_KEY_Arabic_2 0x1000662 /* U+0662 ARABIC-INDIC DIGIT TWO */
+#define XKB_KEY_Arabic_3 0x1000663 /* U+0663 ARABIC-INDIC DIGIT THREE */
+#define XKB_KEY_Arabic_4 0x1000664 /* U+0664 ARABIC-INDIC DIGIT FOUR */
+#define XKB_KEY_Arabic_5 0x1000665 /* U+0665 ARABIC-INDIC DIGIT FIVE */
+#define XKB_KEY_Arabic_6 0x1000666 /* U+0666 ARABIC-INDIC DIGIT SIX */
+#define XKB_KEY_Arabic_7 0x1000667 /* U+0667 ARABIC-INDIC DIGIT SEVEN */
+#define XKB_KEY_Arabic_8 0x1000668 /* U+0668 ARABIC-INDIC DIGIT EIGHT */
+#define XKB_KEY_Arabic_9 0x1000669 /* U+0669 ARABIC-INDIC DIGIT NINE */
+#define XKB_KEY_Arabic_semicolon 0x05bb /* U+061B ARABIC SEMICOLON */
+#define XKB_KEY_Arabic_question_mark 0x05bf /* U+061F ARABIC QUESTION MARK */
+#define XKB_KEY_Arabic_hamza 0x05c1 /* U+0621 ARABIC LETTER HAMZA */
+#define XKB_KEY_Arabic_maddaonalef 0x05c2 /* U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE */
+#define XKB_KEY_Arabic_hamzaonalef 0x05c3 /* U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE */
+#define XKB_KEY_Arabic_hamzaonwaw 0x05c4 /* U+0624 ARABIC LETTER WAW WITH HAMZA ABOVE */
+#define XKB_KEY_Arabic_hamzaunderalef 0x05c5 /* U+0625 ARABIC LETTER ALEF WITH HAMZA BELOW */
+#define XKB_KEY_Arabic_hamzaonyeh 0x05c6 /* U+0626 ARABIC LETTER YEH WITH HAMZA ABOVE */
+#define XKB_KEY_Arabic_alef 0x05c7 /* U+0627 ARABIC LETTER ALEF */
+#define XKB_KEY_Arabic_beh 0x05c8 /* U+0628 ARABIC LETTER BEH */
+#define XKB_KEY_Arabic_tehmarbuta 0x05c9 /* U+0629 ARABIC LETTER TEH MARBUTA */
+#define XKB_KEY_Arabic_teh 0x05ca /* U+062A ARABIC LETTER TEH */
+#define XKB_KEY_Arabic_theh 0x05cb /* U+062B ARABIC LETTER THEH */
+#define XKB_KEY_Arabic_jeem 0x05cc /* U+062C ARABIC LETTER JEEM */
+#define XKB_KEY_Arabic_hah 0x05cd /* U+062D ARABIC LETTER HAH */
+#define XKB_KEY_Arabic_khah 0x05ce /* U+062E ARABIC LETTER KHAH */
+#define XKB_KEY_Arabic_dal 0x05cf /* U+062F ARABIC LETTER DAL */
+#define XKB_KEY_Arabic_thal 0x05d0 /* U+0630 ARABIC LETTER THAL */
+#define XKB_KEY_Arabic_ra 0x05d1 /* U+0631 ARABIC LETTER REH */
+#define XKB_KEY_Arabic_zain 0x05d2 /* U+0632 ARABIC LETTER ZAIN */
+#define XKB_KEY_Arabic_seen 0x05d3 /* U+0633 ARABIC LETTER SEEN */
+#define XKB_KEY_Arabic_sheen 0x05d4 /* U+0634 ARABIC LETTER SHEEN */
+#define XKB_KEY_Arabic_sad 0x05d5 /* U+0635 ARABIC LETTER SAD */
+#define XKB_KEY_Arabic_dad 0x05d6 /* U+0636 ARABIC LETTER DAD */
+#define XKB_KEY_Arabic_tah 0x05d7 /* U+0637 ARABIC LETTER TAH */
+#define XKB_KEY_Arabic_zah 0x05d8 /* U+0638 ARABIC LETTER ZAH */
+#define XKB_KEY_Arabic_ain 0x05d9 /* U+0639 ARABIC LETTER AIN */
+#define XKB_KEY_Arabic_ghain 0x05da /* U+063A ARABIC LETTER GHAIN */
+#define XKB_KEY_Arabic_tatweel 0x05e0 /* U+0640 ARABIC TATWEEL */
+#define XKB_KEY_Arabic_feh 0x05e1 /* U+0641 ARABIC LETTER FEH */
+#define XKB_KEY_Arabic_qaf 0x05e2 /* U+0642 ARABIC LETTER QAF */
+#define XKB_KEY_Arabic_kaf 0x05e3 /* U+0643 ARABIC LETTER KAF */
+#define XKB_KEY_Arabic_lam 0x05e4 /* U+0644 ARABIC LETTER LAM */
+#define XKB_KEY_Arabic_meem 0x05e5 /* U+0645 ARABIC LETTER MEEM */
+#define XKB_KEY_Arabic_noon 0x05e6 /* U+0646 ARABIC LETTER NOON */
+#define XKB_KEY_Arabic_ha 0x05e7 /* U+0647 ARABIC LETTER HEH */
+#define XKB_KEY_Arabic_heh 0x05e7 /* deprecated */
+#define XKB_KEY_Arabic_waw 0x05e8 /* U+0648 ARABIC LETTER WAW */
+#define XKB_KEY_Arabic_alefmaksura 0x05e9 /* U+0649 ARABIC LETTER ALEF MAKSURA */
+#define XKB_KEY_Arabic_yeh 0x05ea /* U+064A ARABIC LETTER YEH */
+#define XKB_KEY_Arabic_fathatan 0x05eb /* U+064B ARABIC FATHATAN */
+#define XKB_KEY_Arabic_dammatan 0x05ec /* U+064C ARABIC DAMMATAN */
+#define XKB_KEY_Arabic_kasratan 0x05ed /* U+064D ARABIC KASRATAN */
+#define XKB_KEY_Arabic_fatha 0x05ee /* U+064E ARABIC FATHA */
+#define XKB_KEY_Arabic_damma 0x05ef /* U+064F ARABIC DAMMA */
+#define XKB_KEY_Arabic_kasra 0x05f0 /* U+0650 ARABIC KASRA */
+#define XKB_KEY_Arabic_shadda 0x05f1 /* U+0651 ARABIC SHADDA */
+#define XKB_KEY_Arabic_sukun 0x05f2 /* U+0652 ARABIC SUKUN */
+#define XKB_KEY_Arabic_madda_above 0x1000653 /* U+0653 ARABIC MADDAH ABOVE */
+#define XKB_KEY_Arabic_hamza_above 0x1000654 /* U+0654 ARABIC HAMZA ABOVE */
+#define XKB_KEY_Arabic_hamza_below 0x1000655 /* U+0655 ARABIC HAMZA BELOW */
+#define XKB_KEY_Arabic_jeh 0x1000698 /* U+0698 ARABIC LETTER JEH */
+#define XKB_KEY_Arabic_veh 0x10006a4 /* U+06A4 ARABIC LETTER VEH */
+#define XKB_KEY_Arabic_keheh 0x10006a9 /* U+06A9 ARABIC LETTER KEHEH */
+#define XKB_KEY_Arabic_gaf 0x10006af /* U+06AF ARABIC LETTER GAF */
+#define XKB_KEY_Arabic_noon_ghunna 0x10006ba /* U+06BA ARABIC LETTER NOON GHUNNA */
+#define XKB_KEY_Arabic_heh_doachashmee 0x10006be /* U+06BE ARABIC LETTER HEH DOACHASHMEE */
+#define XKB_KEY_Farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */
+#define XKB_KEY_Arabic_farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */
+#define XKB_KEY_Arabic_yeh_baree 0x10006d2 /* U+06D2 ARABIC LETTER YEH BARREE */
+#define XKB_KEY_Arabic_heh_goal 0x10006c1 /* U+06C1 ARABIC LETTER HEH GOAL */
+#define XKB_KEY_Arabic_switch 0xff7e /* Alias for mode_switch */
+
+/*
+ * Cyrillic
+ * Byte 3 = 6
+ */
+#define XKB_KEY_Cyrillic_GHE_bar 0x1000492 /* U+0492 CYRILLIC CAPITAL LETTER GHE WITH STROKE */
+#define XKB_KEY_Cyrillic_ghe_bar 0x1000493 /* U+0493 CYRILLIC SMALL LETTER GHE WITH STROKE */
+#define XKB_KEY_Cyrillic_ZHE_descender 0x1000496 /* U+0496 CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER */
+#define XKB_KEY_Cyrillic_zhe_descender 0x1000497 /* U+0497 CYRILLIC SMALL LETTER ZHE WITH DESCENDER */
+#define XKB_KEY_Cyrillic_KA_descender 0x100049a /* U+049A CYRILLIC CAPITAL LETTER KA WITH DESCENDER */
+#define XKB_KEY_Cyrillic_ka_descender 0x100049b /* U+049B CYRILLIC SMALL LETTER KA WITH DESCENDER */
+#define XKB_KEY_Cyrillic_KA_vertstroke 0x100049c /* U+049C CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE */
+#define XKB_KEY_Cyrillic_ka_vertstroke 0x100049d /* U+049D CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE */
+#define XKB_KEY_Cyrillic_EN_descender 0x10004a2 /* U+04A2 CYRILLIC CAPITAL LETTER EN WITH DESCENDER */
+#define XKB_KEY_Cyrillic_en_descender 0x10004a3 /* U+04A3 CYRILLIC SMALL LETTER EN WITH DESCENDER */
+#define XKB_KEY_Cyrillic_U_straight 0x10004ae /* U+04AE CYRILLIC CAPITAL LETTER STRAIGHT U */
+#define XKB_KEY_Cyrillic_u_straight 0x10004af /* U+04AF CYRILLIC SMALL LETTER STRAIGHT U */
+#define XKB_KEY_Cyrillic_U_straight_bar 0x10004b0 /* U+04B0 CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE */
+#define XKB_KEY_Cyrillic_u_straight_bar 0x10004b1 /* U+04B1 CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE */
+#define XKB_KEY_Cyrillic_HA_descender 0x10004b2 /* U+04B2 CYRILLIC CAPITAL LETTER HA WITH DESCENDER */
+#define XKB_KEY_Cyrillic_ha_descender 0x10004b3 /* U+04B3 CYRILLIC SMALL LETTER HA WITH DESCENDER */
+#define XKB_KEY_Cyrillic_CHE_descender 0x10004b6 /* U+04B6 CYRILLIC CAPITAL LETTER CHE WITH DESCENDER */
+#define XKB_KEY_Cyrillic_che_descender 0x10004b7 /* U+04B7 CYRILLIC SMALL LETTER CHE WITH DESCENDER */
+#define XKB_KEY_Cyrillic_CHE_vertstroke 0x10004b8 /* U+04B8 CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE */
+#define XKB_KEY_Cyrillic_che_vertstroke 0x10004b9 /* U+04B9 CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE */
+#define XKB_KEY_Cyrillic_SHHA 0x10004ba /* U+04BA CYRILLIC CAPITAL LETTER SHHA */
+#define XKB_KEY_Cyrillic_shha 0x10004bb /* U+04BB CYRILLIC SMALL LETTER SHHA */
+
+#define XKB_KEY_Cyrillic_SCHWA 0x10004d8 /* U+04D8 CYRILLIC CAPITAL LETTER SCHWA */
+#define XKB_KEY_Cyrillic_schwa 0x10004d9 /* U+04D9 CYRILLIC SMALL LETTER SCHWA */
+#define XKB_KEY_Cyrillic_I_macron 0x10004e2 /* U+04E2 CYRILLIC CAPITAL LETTER I WITH MACRON */
+#define XKB_KEY_Cyrillic_i_macron 0x10004e3 /* U+04E3 CYRILLIC SMALL LETTER I WITH MACRON */
+#define XKB_KEY_Cyrillic_O_bar 0x10004e8 /* U+04E8 CYRILLIC CAPITAL LETTER BARRED O */
+#define XKB_KEY_Cyrillic_o_bar 0x10004e9 /* U+04E9 CYRILLIC SMALL LETTER BARRED O */
+#define XKB_KEY_Cyrillic_U_macron 0x10004ee /* U+04EE CYRILLIC CAPITAL LETTER U WITH MACRON */
+#define XKB_KEY_Cyrillic_u_macron 0x10004ef /* U+04EF CYRILLIC SMALL LETTER U WITH MACRON */
+
+#define XKB_KEY_Serbian_dje 0x06a1 /* U+0452 CYRILLIC SMALL LETTER DJE */
+#define XKB_KEY_Macedonia_gje 0x06a2 /* U+0453 CYRILLIC SMALL LETTER GJE */
+#define XKB_KEY_Cyrillic_io 0x06a3 /* U+0451 CYRILLIC SMALL LETTER IO */
+#define XKB_KEY_Ukrainian_ie 0x06a4 /* U+0454 CYRILLIC SMALL LETTER UKRAINIAN IE */
+#define XKB_KEY_Ukranian_je 0x06a4 /* deprecated */
+#define XKB_KEY_Macedonia_dse 0x06a5 /* U+0455 CYRILLIC SMALL LETTER DZE */
+#define XKB_KEY_Ukrainian_i 0x06a6 /* U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */
+#define XKB_KEY_Ukranian_i 0x06a6 /* deprecated */
+#define XKB_KEY_Ukrainian_yi 0x06a7 /* U+0457 CYRILLIC SMALL LETTER YI */
+#define XKB_KEY_Ukranian_yi 0x06a7 /* deprecated */
+#define XKB_KEY_Cyrillic_je 0x06a8 /* U+0458 CYRILLIC SMALL LETTER JE */
+#define XKB_KEY_Serbian_je 0x06a8 /* deprecated */
+#define XKB_KEY_Cyrillic_lje 0x06a9 /* U+0459 CYRILLIC SMALL LETTER LJE */
+#define XKB_KEY_Serbian_lje 0x06a9 /* deprecated */
+#define XKB_KEY_Cyrillic_nje 0x06aa /* U+045A CYRILLIC SMALL LETTER NJE */
+#define XKB_KEY_Serbian_nje 0x06aa /* deprecated */
+#define XKB_KEY_Serbian_tshe 0x06ab /* U+045B CYRILLIC SMALL LETTER TSHE */
+#define XKB_KEY_Macedonia_kje 0x06ac /* U+045C CYRILLIC SMALL LETTER KJE */
+#define XKB_KEY_Ukrainian_ghe_with_upturn 0x06ad /* U+0491 CYRILLIC SMALL LETTER GHE WITH UPTURN */
+#define XKB_KEY_Byelorussian_shortu 0x06ae /* U+045E CYRILLIC SMALL LETTER SHORT U */
+#define XKB_KEY_Cyrillic_dzhe 0x06af /* U+045F CYRILLIC SMALL LETTER DZHE */
+#define XKB_KEY_Serbian_dze 0x06af /* deprecated */
+#define XKB_KEY_numerosign 0x06b0 /* U+2116 NUMERO SIGN */
+#define XKB_KEY_Serbian_DJE 0x06b1 /* U+0402 CYRILLIC CAPITAL LETTER DJE */
+#define XKB_KEY_Macedonia_GJE 0x06b2 /* U+0403 CYRILLIC CAPITAL LETTER GJE */
+#define XKB_KEY_Cyrillic_IO 0x06b3 /* U+0401 CYRILLIC CAPITAL LETTER IO */
+#define XKB_KEY_Ukrainian_IE 0x06b4 /* U+0404 CYRILLIC CAPITAL LETTER UKRAINIAN IE */
+#define XKB_KEY_Ukranian_JE 0x06b4 /* deprecated */
+#define XKB_KEY_Macedonia_DSE 0x06b5 /* U+0405 CYRILLIC CAPITAL LETTER DZE */
+#define XKB_KEY_Ukrainian_I 0x06b6 /* U+0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */
+#define XKB_KEY_Ukranian_I 0x06b6 /* deprecated */
+#define XKB_KEY_Ukrainian_YI 0x06b7 /* U+0407 CYRILLIC CAPITAL LETTER YI */
+#define XKB_KEY_Ukranian_YI 0x06b7 /* deprecated */
+#define XKB_KEY_Cyrillic_JE 0x06b8 /* U+0408 CYRILLIC CAPITAL LETTER JE */
+#define XKB_KEY_Serbian_JE 0x06b8 /* deprecated */
+#define XKB_KEY_Cyrillic_LJE 0x06b9 /* U+0409 CYRILLIC CAPITAL LETTER LJE */
+#define XKB_KEY_Serbian_LJE 0x06b9 /* deprecated */
+#define XKB_KEY_Cyrillic_NJE 0x06ba /* U+040A CYRILLIC CAPITAL LETTER NJE */
+#define XKB_KEY_Serbian_NJE 0x06ba /* deprecated */
+#define XKB_KEY_Serbian_TSHE 0x06bb /* U+040B CYRILLIC CAPITAL LETTER TSHE */
+#define XKB_KEY_Macedonia_KJE 0x06bc /* U+040C CYRILLIC CAPITAL LETTER KJE */
+#define XKB_KEY_Ukrainian_GHE_WITH_UPTURN 0x06bd /* U+0490 CYRILLIC CAPITAL LETTER GHE WITH UPTURN */
+#define XKB_KEY_Byelorussian_SHORTU 0x06be /* U+040E CYRILLIC CAPITAL LETTER SHORT U */
+#define XKB_KEY_Cyrillic_DZHE 0x06bf /* U+040F CYRILLIC CAPITAL LETTER DZHE */
+#define XKB_KEY_Serbian_DZE 0x06bf /* deprecated */
+#define XKB_KEY_Cyrillic_yu 0x06c0 /* U+044E CYRILLIC SMALL LETTER YU */
+#define XKB_KEY_Cyrillic_a 0x06c1 /* U+0430 CYRILLIC SMALL LETTER A */
+#define XKB_KEY_Cyrillic_be 0x06c2 /* U+0431 CYRILLIC SMALL LETTER BE */
+#define XKB_KEY_Cyrillic_tse 0x06c3 /* U+0446 CYRILLIC SMALL LETTER TSE */
+#define XKB_KEY_Cyrillic_de 0x06c4 /* U+0434 CYRILLIC SMALL LETTER DE */
+#define XKB_KEY_Cyrillic_ie 0x06c5 /* U+0435 CYRILLIC SMALL LETTER IE */
+#define XKB_KEY_Cyrillic_ef 0x06c6 /* U+0444 CYRILLIC SMALL LETTER EF */
+#define XKB_KEY_Cyrillic_ghe 0x06c7 /* U+0433 CYRILLIC SMALL LETTER GHE */
+#define XKB_KEY_Cyrillic_ha 0x06c8 /* U+0445 CYRILLIC SMALL LETTER HA */
+#define XKB_KEY_Cyrillic_i 0x06c9 /* U+0438 CYRILLIC SMALL LETTER I */
+#define XKB_KEY_Cyrillic_shorti 0x06ca /* U+0439 CYRILLIC SMALL LETTER SHORT I */
+#define XKB_KEY_Cyrillic_ka 0x06cb /* U+043A CYRILLIC SMALL LETTER KA */
+#define XKB_KEY_Cyrillic_el 0x06cc /* U+043B CYRILLIC SMALL LETTER EL */
+#define XKB_KEY_Cyrillic_em 0x06cd /* U+043C CYRILLIC SMALL LETTER EM */
+#define XKB_KEY_Cyrillic_en 0x06ce /* U+043D CYRILLIC SMALL LETTER EN */
+#define XKB_KEY_Cyrillic_o 0x06cf /* U+043E CYRILLIC SMALL LETTER O */
+#define XKB_KEY_Cyrillic_pe 0x06d0 /* U+043F CYRILLIC SMALL LETTER PE */
+#define XKB_KEY_Cyrillic_ya 0x06d1 /* U+044F CYRILLIC SMALL LETTER YA */
+#define XKB_KEY_Cyrillic_er 0x06d2 /* U+0440 CYRILLIC SMALL LETTER ER */
+#define XKB_KEY_Cyrillic_es 0x06d3 /* U+0441 CYRILLIC SMALL LETTER ES */
+#define XKB_KEY_Cyrillic_te 0x06d4 /* U+0442 CYRILLIC SMALL LETTER TE */
+#define XKB_KEY_Cyrillic_u 0x06d5 /* U+0443 CYRILLIC SMALL LETTER U */
+#define XKB_KEY_Cyrillic_zhe 0x06d6 /* U+0436 CYRILLIC SMALL LETTER ZHE */
+#define XKB_KEY_Cyrillic_ve 0x06d7 /* U+0432 CYRILLIC SMALL LETTER VE */
+#define XKB_KEY_Cyrillic_softsign 0x06d8 /* U+044C CYRILLIC SMALL LETTER SOFT SIGN */
+#define XKB_KEY_Cyrillic_yeru 0x06d9 /* U+044B CYRILLIC SMALL LETTER YERU */
+#define XKB_KEY_Cyrillic_ze 0x06da /* U+0437 CYRILLIC SMALL LETTER ZE */
+#define XKB_KEY_Cyrillic_sha 0x06db /* U+0448 CYRILLIC SMALL LETTER SHA */
+#define XKB_KEY_Cyrillic_e 0x06dc /* U+044D CYRILLIC SMALL LETTER E */
+#define XKB_KEY_Cyrillic_shcha 0x06dd /* U+0449 CYRILLIC SMALL LETTER SHCHA */
+#define XKB_KEY_Cyrillic_che 0x06de /* U+0447 CYRILLIC SMALL LETTER CHE */
+#define XKB_KEY_Cyrillic_hardsign 0x06df /* U+044A CYRILLIC SMALL LETTER HARD SIGN */
+#define XKB_KEY_Cyrillic_YU 0x06e0 /* U+042E CYRILLIC CAPITAL LETTER YU */
+#define XKB_KEY_Cyrillic_A 0x06e1 /* U+0410 CYRILLIC CAPITAL LETTER A */
+#define XKB_KEY_Cyrillic_BE 0x06e2 /* U+0411 CYRILLIC CAPITAL LETTER BE */
+#define XKB_KEY_Cyrillic_TSE 0x06e3 /* U+0426 CYRILLIC CAPITAL LETTER TSE */
+#define XKB_KEY_Cyrillic_DE 0x06e4 /* U+0414 CYRILLIC CAPITAL LETTER DE */
+#define XKB_KEY_Cyrillic_IE 0x06e5 /* U+0415 CYRILLIC CAPITAL LETTER IE */
+#define XKB_KEY_Cyrillic_EF 0x06e6 /* U+0424 CYRILLIC CAPITAL LETTER EF */
+#define XKB_KEY_Cyrillic_GHE 0x06e7 /* U+0413 CYRILLIC CAPITAL LETTER GHE */
+#define XKB_KEY_Cyrillic_HA 0x06e8 /* U+0425 CYRILLIC CAPITAL LETTER HA */
+#define XKB_KEY_Cyrillic_I 0x06e9 /* U+0418 CYRILLIC CAPITAL LETTER I */
+#define XKB_KEY_Cyrillic_SHORTI 0x06ea /* U+0419 CYRILLIC CAPITAL LETTER SHORT I */
+#define XKB_KEY_Cyrillic_KA 0x06eb /* U+041A CYRILLIC CAPITAL LETTER KA */
+#define XKB_KEY_Cyrillic_EL 0x06ec /* U+041B CYRILLIC CAPITAL LETTER EL */
+#define XKB_KEY_Cyrillic_EM 0x06ed /* U+041C CYRILLIC CAPITAL LETTER EM */
+#define XKB_KEY_Cyrillic_EN 0x06ee /* U+041D CYRILLIC CAPITAL LETTER EN */
+#define XKB_KEY_Cyrillic_O 0x06ef /* U+041E CYRILLIC CAPITAL LETTER O */
+#define XKB_KEY_Cyrillic_PE 0x06f0 /* U+041F CYRILLIC CAPITAL LETTER PE */
+#define XKB_KEY_Cyrillic_YA 0x06f1 /* U+042F CYRILLIC CAPITAL LETTER YA */
+#define XKB_KEY_Cyrillic_ER 0x06f2 /* U+0420 CYRILLIC CAPITAL LETTER ER */
+#define XKB_KEY_Cyrillic_ES 0x06f3 /* U+0421 CYRILLIC CAPITAL LETTER ES */
+#define XKB_KEY_Cyrillic_TE 0x06f4 /* U+0422 CYRILLIC CAPITAL LETTER TE */
+#define XKB_KEY_Cyrillic_U 0x06f5 /* U+0423 CYRILLIC CAPITAL LETTER U */
+#define XKB_KEY_Cyrillic_ZHE 0x06f6 /* U+0416 CYRILLIC CAPITAL LETTER ZHE */
+#define XKB_KEY_Cyrillic_VE 0x06f7 /* U+0412 CYRILLIC CAPITAL LETTER VE */
+#define XKB_KEY_Cyrillic_SOFTSIGN 0x06f8 /* U+042C CYRILLIC CAPITAL LETTER SOFT SIGN */
+#define XKB_KEY_Cyrillic_YERU 0x06f9 /* U+042B CYRILLIC CAPITAL LETTER YERU */
+#define XKB_KEY_Cyrillic_ZE 0x06fa /* U+0417 CYRILLIC CAPITAL LETTER ZE */
+#define XKB_KEY_Cyrillic_SHA 0x06fb /* U+0428 CYRILLIC CAPITAL LETTER SHA */
+#define XKB_KEY_Cyrillic_E 0x06fc /* U+042D CYRILLIC CAPITAL LETTER E */
+#define XKB_KEY_Cyrillic_SHCHA 0x06fd /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+#define XKB_KEY_Cyrillic_CHE 0x06fe /* U+0427 CYRILLIC CAPITAL LETTER CHE */
+#define XKB_KEY_Cyrillic_HARDSIGN 0x06ff /* U+042A CYRILLIC CAPITAL LETTER HARD SIGN */
+
+/*
+ * Greek
+ * (based on an early draft of, and not quite identical to, ISO/IEC 8859-7)
+ * Byte 3 = 7
+ */
+
+#define XKB_KEY_Greek_ALPHAaccent 0x07a1 /* U+0386 GREEK CAPITAL LETTER ALPHA WITH TONOS */
+#define XKB_KEY_Greek_EPSILONaccent 0x07a2 /* U+0388 GREEK CAPITAL LETTER EPSILON WITH TONOS */
+#define XKB_KEY_Greek_ETAaccent 0x07a3 /* U+0389 GREEK CAPITAL LETTER ETA WITH TONOS */
+#define XKB_KEY_Greek_IOTAaccent 0x07a4 /* U+038A GREEK CAPITAL LETTER IOTA WITH TONOS */
+#define XKB_KEY_Greek_IOTAdieresis 0x07a5 /* U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */
+#define XKB_KEY_Greek_IOTAdiaeresis 0x07a5 /* old typo */
+#define XKB_KEY_Greek_OMICRONaccent 0x07a7 /* U+038C GREEK CAPITAL LETTER OMICRON WITH TONOS */
+#define XKB_KEY_Greek_UPSILONaccent 0x07a8 /* U+038E GREEK CAPITAL LETTER UPSILON WITH TONOS */
+#define XKB_KEY_Greek_UPSILONdieresis 0x07a9 /* U+03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */
+#define XKB_KEY_Greek_OMEGAaccent 0x07ab /* U+038F GREEK CAPITAL LETTER OMEGA WITH TONOS */
+#define XKB_KEY_Greek_accentdieresis 0x07ae /* U+0385 GREEK DIALYTIKA TONOS */
+#define XKB_KEY_Greek_horizbar 0x07af /* U+2015 HORIZONTAL BAR */
+#define XKB_KEY_Greek_alphaaccent 0x07b1 /* U+03AC GREEK SMALL LETTER ALPHA WITH TONOS */
+#define XKB_KEY_Greek_epsilonaccent 0x07b2 /* U+03AD GREEK SMALL LETTER EPSILON WITH TONOS */
+#define XKB_KEY_Greek_etaaccent 0x07b3 /* U+03AE GREEK SMALL LETTER ETA WITH TONOS */
+#define XKB_KEY_Greek_iotaaccent 0x07b4 /* U+03AF GREEK SMALL LETTER IOTA WITH TONOS */
+#define XKB_KEY_Greek_iotadieresis 0x07b5 /* U+03CA GREEK SMALL LETTER IOTA WITH DIALYTIKA */
+#define XKB_KEY_Greek_iotaaccentdieresis 0x07b6 /* U+0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */
+#define XKB_KEY_Greek_omicronaccent 0x07b7 /* U+03CC GREEK SMALL LETTER OMICRON WITH TONOS */
+#define XKB_KEY_Greek_upsilonaccent 0x07b8 /* U+03CD GREEK SMALL LETTER UPSILON WITH TONOS */
+#define XKB_KEY_Greek_upsilondieresis 0x07b9 /* U+03CB GREEK SMALL LETTER UPSILON WITH DIALYTIKA */
+#define XKB_KEY_Greek_upsilonaccentdieresis 0x07ba /* U+03B0 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */
+#define XKB_KEY_Greek_omegaaccent 0x07bb /* U+03CE GREEK SMALL LETTER OMEGA WITH TONOS */
+#define XKB_KEY_Greek_ALPHA 0x07c1 /* U+0391 GREEK CAPITAL LETTER ALPHA */
+#define XKB_KEY_Greek_BETA 0x07c2 /* U+0392 GREEK CAPITAL LETTER BETA */
+#define XKB_KEY_Greek_GAMMA 0x07c3 /* U+0393 GREEK CAPITAL LETTER GAMMA */
+#define XKB_KEY_Greek_DELTA 0x07c4 /* U+0394 GREEK CAPITAL LETTER DELTA */
+#define XKB_KEY_Greek_EPSILON 0x07c5 /* U+0395 GREEK CAPITAL LETTER EPSILON */
+#define XKB_KEY_Greek_ZETA 0x07c6 /* U+0396 GREEK CAPITAL LETTER ZETA */
+#define XKB_KEY_Greek_ETA 0x07c7 /* U+0397 GREEK CAPITAL LETTER ETA */
+#define XKB_KEY_Greek_THETA 0x07c8 /* U+0398 GREEK CAPITAL LETTER THETA */
+#define XKB_KEY_Greek_IOTA 0x07c9 /* U+0399 GREEK CAPITAL LETTER IOTA */
+#define XKB_KEY_Greek_KAPPA 0x07ca /* U+039A GREEK CAPITAL LETTER KAPPA */
+#define XKB_KEY_Greek_LAMDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */
+#define XKB_KEY_Greek_LAMBDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */
+#define XKB_KEY_Greek_MU 0x07cc /* U+039C GREEK CAPITAL LETTER MU */
+#define XKB_KEY_Greek_NU 0x07cd /* U+039D GREEK CAPITAL LETTER NU */
+#define XKB_KEY_Greek_XI 0x07ce /* U+039E GREEK CAPITAL LETTER XI */
+#define XKB_KEY_Greek_OMICRON 0x07cf /* U+039F GREEK CAPITAL LETTER OMICRON */
+#define XKB_KEY_Greek_PI 0x07d0 /* U+03A0 GREEK CAPITAL LETTER PI */
+#define XKB_KEY_Greek_RHO 0x07d1 /* U+03A1 GREEK CAPITAL LETTER RHO */
+#define XKB_KEY_Greek_SIGMA 0x07d2 /* U+03A3 GREEK CAPITAL LETTER SIGMA */
+#define XKB_KEY_Greek_TAU 0x07d4 /* U+03A4 GREEK CAPITAL LETTER TAU */
+#define XKB_KEY_Greek_UPSILON 0x07d5 /* U+03A5 GREEK CAPITAL LETTER UPSILON */
+#define XKB_KEY_Greek_PHI 0x07d6 /* U+03A6 GREEK CAPITAL LETTER PHI */
+#define XKB_KEY_Greek_CHI 0x07d7 /* U+03A7 GREEK CAPITAL LETTER CHI */
+#define XKB_KEY_Greek_PSI 0x07d8 /* U+03A8 GREEK CAPITAL LETTER PSI */
+#define XKB_KEY_Greek_OMEGA 0x07d9 /* U+03A9 GREEK CAPITAL LETTER OMEGA */
+#define XKB_KEY_Greek_alpha 0x07e1 /* U+03B1 GREEK SMALL LETTER ALPHA */
+#define XKB_KEY_Greek_beta 0x07e2 /* U+03B2 GREEK SMALL LETTER BETA */
+#define XKB_KEY_Greek_gamma 0x07e3 /* U+03B3 GREEK SMALL LETTER GAMMA */
+#define XKB_KEY_Greek_delta 0x07e4 /* U+03B4 GREEK SMALL LETTER DELTA */
+#define XKB_KEY_Greek_epsilon 0x07e5 /* U+03B5 GREEK SMALL LETTER EPSILON */
+#define XKB_KEY_Greek_zeta 0x07e6 /* U+03B6 GREEK SMALL LETTER ZETA */
+#define XKB_KEY_Greek_eta 0x07e7 /* U+03B7 GREEK SMALL LETTER ETA */
+#define XKB_KEY_Greek_theta 0x07e8 /* U+03B8 GREEK SMALL LETTER THETA */
+#define XKB_KEY_Greek_iota 0x07e9 /* U+03B9 GREEK SMALL LETTER IOTA */
+#define XKB_KEY_Greek_kappa 0x07ea /* U+03BA GREEK SMALL LETTER KAPPA */
+#define XKB_KEY_Greek_lamda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */
+#define XKB_KEY_Greek_lambda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */
+#define XKB_KEY_Greek_mu 0x07ec /* U+03BC GREEK SMALL LETTER MU */
+#define XKB_KEY_Greek_nu 0x07ed /* U+03BD GREEK SMALL LETTER NU */
+#define XKB_KEY_Greek_xi 0x07ee /* U+03BE GREEK SMALL LETTER XI */
+#define XKB_KEY_Greek_omicron 0x07ef /* U+03BF GREEK SMALL LETTER OMICRON */
+#define XKB_KEY_Greek_pi 0x07f0 /* U+03C0 GREEK SMALL LETTER PI */
+#define XKB_KEY_Greek_rho 0x07f1 /* U+03C1 GREEK SMALL LETTER RHO */
+#define XKB_KEY_Greek_sigma 0x07f2 /* U+03C3 GREEK SMALL LETTER SIGMA */
+#define XKB_KEY_Greek_finalsmallsigma 0x07f3 /* U+03C2 GREEK SMALL LETTER FINAL SIGMA */
+#define XKB_KEY_Greek_tau 0x07f4 /* U+03C4 GREEK SMALL LETTER TAU */
+#define XKB_KEY_Greek_upsilon 0x07f5 /* U+03C5 GREEK SMALL LETTER UPSILON */
+#define XKB_KEY_Greek_phi 0x07f6 /* U+03C6 GREEK SMALL LETTER PHI */
+#define XKB_KEY_Greek_chi 0x07f7 /* U+03C7 GREEK SMALL LETTER CHI */
+#define XKB_KEY_Greek_psi 0x07f8 /* U+03C8 GREEK SMALL LETTER PSI */
+#define XKB_KEY_Greek_omega 0x07f9 /* U+03C9 GREEK SMALL LETTER OMEGA */
+#define XKB_KEY_Greek_switch 0xff7e /* Alias for mode_switch */
+
+/*
+ * Technical
+ * (from the DEC VT330/VT420 Technical Character Set, http://vt100.net/charsets/technical.html)
+ * Byte 3 = 8
+ */
+
+#define XKB_KEY_leftradical 0x08a1 /* U+23B7 RADICAL SYMBOL BOTTOM */
+#define XKB_KEY_topleftradical 0x08a2 /*(U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT)*/
+#define XKB_KEY_horizconnector 0x08a3 /*(U+2500 BOX DRAWINGS LIGHT HORIZONTAL)*/
+#define XKB_KEY_topintegral 0x08a4 /* U+2320 TOP HALF INTEGRAL */
+#define XKB_KEY_botintegral 0x08a5 /* U+2321 BOTTOM HALF INTEGRAL */
+#define XKB_KEY_vertconnector 0x08a6 /*(U+2502 BOX DRAWINGS LIGHT VERTICAL)*/
+#define XKB_KEY_topleftsqbracket 0x08a7 /* U+23A1 LEFT SQUARE BRACKET UPPER CORNER */
+#define XKB_KEY_botleftsqbracket 0x08a8 /* U+23A3 LEFT SQUARE BRACKET LOWER CORNER */
+#define XKB_KEY_toprightsqbracket 0x08a9 /* U+23A4 RIGHT SQUARE BRACKET UPPER CORNER */
+#define XKB_KEY_botrightsqbracket 0x08aa /* U+23A6 RIGHT SQUARE BRACKET LOWER CORNER */
+#define XKB_KEY_topleftparens 0x08ab /* U+239B LEFT PARENTHESIS UPPER HOOK */
+#define XKB_KEY_botleftparens 0x08ac /* U+239D LEFT PARENTHESIS LOWER HOOK */
+#define XKB_KEY_toprightparens 0x08ad /* U+239E RIGHT PARENTHESIS UPPER HOOK */
+#define XKB_KEY_botrightparens 0x08ae /* U+23A0 RIGHT PARENTHESIS LOWER HOOK */
+#define XKB_KEY_leftmiddlecurlybrace 0x08af /* U+23A8 LEFT CURLY BRACKET MIDDLE PIECE */
+#define XKB_KEY_rightmiddlecurlybrace 0x08b0 /* U+23AC RIGHT CURLY BRACKET MIDDLE PIECE */
+#define XKB_KEY_topleftsummation 0x08b1
+#define XKB_KEY_botleftsummation 0x08b2
+#define XKB_KEY_topvertsummationconnector 0x08b3
+#define XKB_KEY_botvertsummationconnector 0x08b4
+#define XKB_KEY_toprightsummation 0x08b5
+#define XKB_KEY_botrightsummation 0x08b6
+#define XKB_KEY_rightmiddlesummation 0x08b7
+#define XKB_KEY_lessthanequal 0x08bc /* U+2264 LESS-THAN OR EQUAL TO */
+#define XKB_KEY_notequal 0x08bd /* U+2260 NOT EQUAL TO */
+#define XKB_KEY_greaterthanequal 0x08be /* U+2265 GREATER-THAN OR EQUAL TO */
+#define XKB_KEY_integral 0x08bf /* U+222B INTEGRAL */
+#define XKB_KEY_therefore 0x08c0 /* U+2234 THEREFORE */
+#define XKB_KEY_variation 0x08c1 /* U+221D PROPORTIONAL TO */
+#define XKB_KEY_infinity 0x08c2 /* U+221E INFINITY */
+#define XKB_KEY_nabla 0x08c5 /* U+2207 NABLA */
+#define XKB_KEY_approximate 0x08c8 /* U+223C TILDE OPERATOR */
+#define XKB_KEY_similarequal 0x08c9 /* U+2243 ASYMPTOTICALLY EQUAL TO */
+#define XKB_KEY_ifonlyif 0x08cd /* U+21D4 LEFT RIGHT DOUBLE ARROW */
+#define XKB_KEY_implies 0x08ce /* U+21D2 RIGHTWARDS DOUBLE ARROW */
+#define XKB_KEY_identical 0x08cf /* U+2261 IDENTICAL TO */
+#define XKB_KEY_radical 0x08d6 /* U+221A SQUARE ROOT */
+#define XKB_KEY_includedin 0x08da /* U+2282 SUBSET OF */
+#define XKB_KEY_includes 0x08db /* U+2283 SUPERSET OF */
+#define XKB_KEY_intersection 0x08dc /* U+2229 INTERSECTION */
+#define XKB_KEY_union 0x08dd /* U+222A UNION */
+#define XKB_KEY_logicaland 0x08de /* U+2227 LOGICAL AND */
+#define XKB_KEY_logicalor 0x08df /* U+2228 LOGICAL OR */
+#define XKB_KEY_partialderivative 0x08ef /* U+2202 PARTIAL DIFFERENTIAL */
+#define XKB_KEY_function 0x08f6 /* U+0192 LATIN SMALL LETTER F WITH HOOK */
+#define XKB_KEY_leftarrow 0x08fb /* U+2190 LEFTWARDS ARROW */
+#define XKB_KEY_uparrow 0x08fc /* U+2191 UPWARDS ARROW */
+#define XKB_KEY_rightarrow 0x08fd /* U+2192 RIGHTWARDS ARROW */
+#define XKB_KEY_downarrow 0x08fe /* U+2193 DOWNWARDS ARROW */
+
+/*
+ * Special
+ * (from the DEC VT100 Special Graphics Character Set)
+ * Byte 3 = 9
+ */
+
+#define XKB_KEY_blank 0x09df
+#define XKB_KEY_soliddiamond 0x09e0 /* U+25C6 BLACK DIAMOND */
+#define XKB_KEY_checkerboard 0x09e1 /* U+2592 MEDIUM SHADE */
+#define XKB_KEY_ht 0x09e2 /* U+2409 SYMBOL FOR HORIZONTAL TABULATION */
+#define XKB_KEY_ff 0x09e3 /* U+240C SYMBOL FOR FORM FEED */
+#define XKB_KEY_cr 0x09e4 /* U+240D SYMBOL FOR CARRIAGE RETURN */
+#define XKB_KEY_lf 0x09e5 /* U+240A SYMBOL FOR LINE FEED */
+#define XKB_KEY_nl 0x09e8 /* U+2424 SYMBOL FOR NEWLINE */
+#define XKB_KEY_vt 0x09e9 /* U+240B SYMBOL FOR VERTICAL TABULATION */
+#define XKB_KEY_lowrightcorner 0x09ea /* U+2518 BOX DRAWINGS LIGHT UP AND LEFT */
+#define XKB_KEY_uprightcorner 0x09eb /* U+2510 BOX DRAWINGS LIGHT DOWN AND LEFT */
+#define XKB_KEY_upleftcorner 0x09ec /* U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT */
+#define XKB_KEY_lowleftcorner 0x09ed /* U+2514 BOX DRAWINGS LIGHT UP AND RIGHT */
+#define XKB_KEY_crossinglines 0x09ee /* U+253C BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */
+#define XKB_KEY_horizlinescan1 0x09ef /* U+23BA HORIZONTAL SCAN LINE-1 */
+#define XKB_KEY_horizlinescan3 0x09f0 /* U+23BB HORIZONTAL SCAN LINE-3 */
+#define XKB_KEY_horizlinescan5 0x09f1 /* U+2500 BOX DRAWINGS LIGHT HORIZONTAL */
+#define XKB_KEY_horizlinescan7 0x09f2 /* U+23BC HORIZONTAL SCAN LINE-7 */
+#define XKB_KEY_horizlinescan9 0x09f3 /* U+23BD HORIZONTAL SCAN LINE-9 */
+#define XKB_KEY_leftt 0x09f4 /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */
+#define XKB_KEY_rightt 0x09f5 /* U+2524 BOX DRAWINGS LIGHT VERTICAL AND LEFT */
+#define XKB_KEY_bott 0x09f6 /* U+2534 BOX DRAWINGS LIGHT UP AND HORIZONTAL */
+#define XKB_KEY_topt 0x09f7 /* U+252C BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */
+#define XKB_KEY_vertbar 0x09f8 /* U+2502 BOX DRAWINGS LIGHT VERTICAL */
+
+/*
+ * Publishing
+ * (these are probably from a long forgotten DEC Publishing
+ * font that once shipped with DECwrite)
+ * Byte 3 = 0x0a
+ */
+
+#define XKB_KEY_emspace 0x0aa1 /* U+2003 EM SPACE */
+#define XKB_KEY_enspace 0x0aa2 /* U+2002 EN SPACE */
+#define XKB_KEY_em3space 0x0aa3 /* U+2004 THREE-PER-EM SPACE */
+#define XKB_KEY_em4space 0x0aa4 /* U+2005 FOUR-PER-EM SPACE */
+#define XKB_KEY_digitspace 0x0aa5 /* U+2007 FIGURE SPACE */
+#define XKB_KEY_punctspace 0x0aa6 /* U+2008 PUNCTUATION SPACE */
+#define XKB_KEY_thinspace 0x0aa7 /* U+2009 THIN SPACE */
+#define XKB_KEY_hairspace 0x0aa8 /* U+200A HAIR SPACE */
+#define XKB_KEY_emdash 0x0aa9 /* U+2014 EM DASH */
+#define XKB_KEY_endash 0x0aaa /* U+2013 EN DASH */
+#define XKB_KEY_signifblank 0x0aac /*(U+2423 OPEN BOX)*/
+#define XKB_KEY_ellipsis 0x0aae /* U+2026 HORIZONTAL ELLIPSIS */
+#define XKB_KEY_doubbaselinedot 0x0aaf /* U+2025 TWO DOT LEADER */
+#define XKB_KEY_onethird 0x0ab0 /* U+2153 VULGAR FRACTION ONE THIRD */
+#define XKB_KEY_twothirds 0x0ab1 /* U+2154 VULGAR FRACTION TWO THIRDS */
+#define XKB_KEY_onefifth 0x0ab2 /* U+2155 VULGAR FRACTION ONE FIFTH */
+#define XKB_KEY_twofifths 0x0ab3 /* U+2156 VULGAR FRACTION TWO FIFTHS */
+#define XKB_KEY_threefifths 0x0ab4 /* U+2157 VULGAR FRACTION THREE FIFTHS */
+#define XKB_KEY_fourfifths 0x0ab5 /* U+2158 VULGAR FRACTION FOUR FIFTHS */
+#define XKB_KEY_onesixth 0x0ab6 /* U+2159 VULGAR FRACTION ONE SIXTH */
+#define XKB_KEY_fivesixths 0x0ab7 /* U+215A VULGAR FRACTION FIVE SIXTHS */
+#define XKB_KEY_careof 0x0ab8 /* U+2105 CARE OF */
+#define XKB_KEY_figdash 0x0abb /* U+2012 FIGURE DASH */
+#define XKB_KEY_leftanglebracket 0x0abc /*(U+2329 LEFT-POINTING ANGLE BRACKET)*/
+#define XKB_KEY_decimalpoint 0x0abd /*(U+002E FULL STOP)*/
+#define XKB_KEY_rightanglebracket 0x0abe /*(U+232A RIGHT-POINTING ANGLE BRACKET)*/
+#define XKB_KEY_marker 0x0abf
+#define XKB_KEY_oneeighth 0x0ac3 /* U+215B VULGAR FRACTION ONE EIGHTH */
+#define XKB_KEY_threeeighths 0x0ac4 /* U+215C VULGAR FRACTION THREE EIGHTHS */
+#define XKB_KEY_fiveeighths 0x0ac5 /* U+215D VULGAR FRACTION FIVE EIGHTHS */
+#define XKB_KEY_seveneighths 0x0ac6 /* U+215E VULGAR FRACTION SEVEN EIGHTHS */
+#define XKB_KEY_trademark 0x0ac9 /* U+2122 TRADE MARK SIGN */
+#define XKB_KEY_signaturemark 0x0aca /*(U+2613 SALTIRE)*/
+#define XKB_KEY_trademarkincircle 0x0acb
+#define XKB_KEY_leftopentriangle 0x0acc /*(U+25C1 WHITE LEFT-POINTING TRIANGLE)*/
+#define XKB_KEY_rightopentriangle 0x0acd /*(U+25B7 WHITE RIGHT-POINTING TRIANGLE)*/
+#define XKB_KEY_emopencircle 0x0ace /*(U+25CB WHITE CIRCLE)*/
+#define XKB_KEY_emopenrectangle 0x0acf /*(U+25AF WHITE VERTICAL RECTANGLE)*/
+#define XKB_KEY_leftsinglequotemark 0x0ad0 /* U+2018 LEFT SINGLE QUOTATION MARK */
+#define XKB_KEY_rightsinglequotemark 0x0ad1 /* U+2019 RIGHT SINGLE QUOTATION MARK */
+#define XKB_KEY_leftdoublequotemark 0x0ad2 /* U+201C LEFT DOUBLE QUOTATION MARK */
+#define XKB_KEY_rightdoublequotemark 0x0ad3 /* U+201D RIGHT DOUBLE QUOTATION MARK */
+#define XKB_KEY_prescription 0x0ad4 /* U+211E PRESCRIPTION TAKE */
+#define XKB_KEY_permille 0x0ad5 /* U+2030 PER MILLE SIGN */
+#define XKB_KEY_minutes 0x0ad6 /* U+2032 PRIME */
+#define XKB_KEY_seconds 0x0ad7 /* U+2033 DOUBLE PRIME */
+#define XKB_KEY_latincross 0x0ad9 /* U+271D LATIN CROSS */
+#define XKB_KEY_hexagram 0x0ada
+#define XKB_KEY_filledrectbullet 0x0adb /*(U+25AC BLACK RECTANGLE)*/
+#define XKB_KEY_filledlefttribullet 0x0adc /*(U+25C0 BLACK LEFT-POINTING TRIANGLE)*/
+#define XKB_KEY_filledrighttribullet 0x0add /*(U+25B6 BLACK RIGHT-POINTING TRIANGLE)*/
+#define XKB_KEY_emfilledcircle 0x0ade /*(U+25CF BLACK CIRCLE)*/
+#define XKB_KEY_emfilledrect 0x0adf /*(U+25AE BLACK VERTICAL RECTANGLE)*/
+#define XKB_KEY_enopencircbullet 0x0ae0 /*(U+25E6 WHITE BULLET)*/
+#define XKB_KEY_enopensquarebullet 0x0ae1 /*(U+25AB WHITE SMALL SQUARE)*/
+#define XKB_KEY_openrectbullet 0x0ae2 /*(U+25AD WHITE RECTANGLE)*/
+#define XKB_KEY_opentribulletup 0x0ae3 /*(U+25B3 WHITE UP-POINTING TRIANGLE)*/
+#define XKB_KEY_opentribulletdown 0x0ae4 /*(U+25BD WHITE DOWN-POINTING TRIANGLE)*/
+#define XKB_KEY_openstar 0x0ae5 /*(U+2606 WHITE STAR)*/
+#define XKB_KEY_enfilledcircbullet 0x0ae6 /*(U+2022 BULLET)*/
+#define XKB_KEY_enfilledsqbullet 0x0ae7 /*(U+25AA BLACK SMALL SQUARE)*/
+#define XKB_KEY_filledtribulletup 0x0ae8 /*(U+25B2 BLACK UP-POINTING TRIANGLE)*/
+#define XKB_KEY_filledtribulletdown 0x0ae9 /*(U+25BC BLACK DOWN-POINTING TRIANGLE)*/
+#define XKB_KEY_leftpointer 0x0aea /*(U+261C WHITE LEFT POINTING INDEX)*/
+#define XKB_KEY_rightpointer 0x0aeb /*(U+261E WHITE RIGHT POINTING INDEX)*/
+#define XKB_KEY_club 0x0aec /* U+2663 BLACK CLUB SUIT */
+#define XKB_KEY_diamond 0x0aed /* U+2666 BLACK DIAMOND SUIT */
+#define XKB_KEY_heart 0x0aee /* U+2665 BLACK HEART SUIT */
+#define XKB_KEY_maltesecross 0x0af0 /* U+2720 MALTESE CROSS */
+#define XKB_KEY_dagger 0x0af1 /* U+2020 DAGGER */
+#define XKB_KEY_doubledagger 0x0af2 /* U+2021 DOUBLE DAGGER */
+#define XKB_KEY_checkmark 0x0af3 /* U+2713 CHECK MARK */
+#define XKB_KEY_ballotcross 0x0af4 /* U+2717 BALLOT X */
+#define XKB_KEY_musicalsharp 0x0af5 /* U+266F MUSIC SHARP SIGN */
+#define XKB_KEY_musicalflat 0x0af6 /* U+266D MUSIC FLAT SIGN */
+#define XKB_KEY_malesymbol 0x0af7 /* U+2642 MALE SIGN */
+#define XKB_KEY_femalesymbol 0x0af8 /* U+2640 FEMALE SIGN */
+#define XKB_KEY_telephone 0x0af9 /* U+260E BLACK TELEPHONE */
+#define XKB_KEY_telephonerecorder 0x0afa /* U+2315 TELEPHONE RECORDER */
+#define XKB_KEY_phonographcopyright 0x0afb /* U+2117 SOUND RECORDING COPYRIGHT */
+#define XKB_KEY_caret 0x0afc /* U+2038 CARET */
+#define XKB_KEY_singlelowquotemark 0x0afd /* U+201A SINGLE LOW-9 QUOTATION MARK */
+#define XKB_KEY_doublelowquotemark 0x0afe /* U+201E DOUBLE LOW-9 QUOTATION MARK */
+#define XKB_KEY_cursor 0x0aff
+
+/*
+ * APL
+ * Byte 3 = 0x0b
+ */
+
+#define XKB_KEY_leftcaret 0x0ba3 /*(U+003C LESS-THAN SIGN)*/
+#define XKB_KEY_rightcaret 0x0ba6 /*(U+003E GREATER-THAN SIGN)*/
+#define XKB_KEY_downcaret 0x0ba8 /*(U+2228 LOGICAL OR)*/
+#define XKB_KEY_upcaret 0x0ba9 /*(U+2227 LOGICAL AND)*/
+#define XKB_KEY_overbar 0x0bc0 /*(U+00AF MACRON)*/
+#define XKB_KEY_downtack 0x0bc2 /* U+22A4 DOWN TACK */
+#define XKB_KEY_upshoe 0x0bc3 /*(U+2229 INTERSECTION)*/
+#define XKB_KEY_downstile 0x0bc4 /* U+230A LEFT FLOOR */
+#define XKB_KEY_underbar 0x0bc6 /*(U+005F LOW LINE)*/
+#define XKB_KEY_jot 0x0bca /* U+2218 RING OPERATOR */
+#define XKB_KEY_quad 0x0bcc /* U+2395 APL FUNCTIONAL SYMBOL QUAD */
+#define XKB_KEY_uptack 0x0bce /* U+22A5 UP TACK */
+#define XKB_KEY_circle 0x0bcf /* U+25CB WHITE CIRCLE */
+#define XKB_KEY_upstile 0x0bd3 /* U+2308 LEFT CEILING */
+#define XKB_KEY_downshoe 0x0bd6 /*(U+222A UNION)*/
+#define XKB_KEY_rightshoe 0x0bd8 /*(U+2283 SUPERSET OF)*/
+#define XKB_KEY_leftshoe 0x0bda /*(U+2282 SUBSET OF)*/
+#define XKB_KEY_lefttack 0x0bdc /* U+22A3 LEFT TACK */
+#define XKB_KEY_righttack 0x0bfc /* U+22A2 RIGHT TACK */
+
+/*
+ * Hebrew
+ * Byte 3 = 0x0c
+ */
+
+#define XKB_KEY_hebrew_doublelowline 0x0cdf /* U+2017 DOUBLE LOW LINE */
+#define XKB_KEY_hebrew_aleph 0x0ce0 /* U+05D0 HEBREW LETTER ALEF */
+#define XKB_KEY_hebrew_bet 0x0ce1 /* U+05D1 HEBREW LETTER BET */
+#define XKB_KEY_hebrew_beth 0x0ce1 /* deprecated */
+#define XKB_KEY_hebrew_gimel 0x0ce2 /* U+05D2 HEBREW LETTER GIMEL */
+#define XKB_KEY_hebrew_gimmel 0x0ce2 /* deprecated */
+#define XKB_KEY_hebrew_dalet 0x0ce3 /* U+05D3 HEBREW LETTER DALET */
+#define XKB_KEY_hebrew_daleth 0x0ce3 /* deprecated */
+#define XKB_KEY_hebrew_he 0x0ce4 /* U+05D4 HEBREW LETTER HE */
+#define XKB_KEY_hebrew_waw 0x0ce5 /* U+05D5 HEBREW LETTER VAV */
+#define XKB_KEY_hebrew_zain 0x0ce6 /* U+05D6 HEBREW LETTER ZAYIN */
+#define XKB_KEY_hebrew_zayin 0x0ce6 /* deprecated */
+#define XKB_KEY_hebrew_chet 0x0ce7 /* U+05D7 HEBREW LETTER HET */
+#define XKB_KEY_hebrew_het 0x0ce7 /* deprecated */
+#define XKB_KEY_hebrew_tet 0x0ce8 /* U+05D8 HEBREW LETTER TET */
+#define XKB_KEY_hebrew_teth 0x0ce8 /* deprecated */
+#define XKB_KEY_hebrew_yod 0x0ce9 /* U+05D9 HEBREW LETTER YOD */
+#define XKB_KEY_hebrew_finalkaph 0x0cea /* U+05DA HEBREW LETTER FINAL KAF */
+#define XKB_KEY_hebrew_kaph 0x0ceb /* U+05DB HEBREW LETTER KAF */
+#define XKB_KEY_hebrew_lamed 0x0cec /* U+05DC HEBREW LETTER LAMED */
+#define XKB_KEY_hebrew_finalmem 0x0ced /* U+05DD HEBREW LETTER FINAL MEM */
+#define XKB_KEY_hebrew_mem 0x0cee /* U+05DE HEBREW LETTER MEM */
+#define XKB_KEY_hebrew_finalnun 0x0cef /* U+05DF HEBREW LETTER FINAL NUN */
+#define XKB_KEY_hebrew_nun 0x0cf0 /* U+05E0 HEBREW LETTER NUN */
+#define XKB_KEY_hebrew_samech 0x0cf1 /* U+05E1 HEBREW LETTER SAMEKH */
+#define XKB_KEY_hebrew_samekh 0x0cf1 /* deprecated */
+#define XKB_KEY_hebrew_ayin 0x0cf2 /* U+05E2 HEBREW LETTER AYIN */
+#define XKB_KEY_hebrew_finalpe 0x0cf3 /* U+05E3 HEBREW LETTER FINAL PE */
+#define XKB_KEY_hebrew_pe 0x0cf4 /* U+05E4 HEBREW LETTER PE */
+#define XKB_KEY_hebrew_finalzade 0x0cf5 /* U+05E5 HEBREW LETTER FINAL TSADI */
+#define XKB_KEY_hebrew_finalzadi 0x0cf5 /* deprecated */
+#define XKB_KEY_hebrew_zade 0x0cf6 /* U+05E6 HEBREW LETTER TSADI */
+#define XKB_KEY_hebrew_zadi 0x0cf6 /* deprecated */
+#define XKB_KEY_hebrew_qoph 0x0cf7 /* U+05E7 HEBREW LETTER QOF */
+#define XKB_KEY_hebrew_kuf 0x0cf7 /* deprecated */
+#define XKB_KEY_hebrew_resh 0x0cf8 /* U+05E8 HEBREW LETTER RESH */
+#define XKB_KEY_hebrew_shin 0x0cf9 /* U+05E9 HEBREW LETTER SHIN */
+#define XKB_KEY_hebrew_taw 0x0cfa /* U+05EA HEBREW LETTER TAV */
+#define XKB_KEY_hebrew_taf 0x0cfa /* deprecated */
+#define XKB_KEY_Hebrew_switch 0xff7e /* Alias for mode_switch */
+
+/*
+ * Thai
+ * Byte 3 = 0x0d
+ */
+
+#define XKB_KEY_Thai_kokai 0x0da1 /* U+0E01 THAI CHARACTER KO KAI */
+#define XKB_KEY_Thai_khokhai 0x0da2 /* U+0E02 THAI CHARACTER KHO KHAI */
+#define XKB_KEY_Thai_khokhuat 0x0da3 /* U+0E03 THAI CHARACTER KHO KHUAT */
+#define XKB_KEY_Thai_khokhwai 0x0da4 /* U+0E04 THAI CHARACTER KHO KHWAI */
+#define XKB_KEY_Thai_khokhon 0x0da5 /* U+0E05 THAI CHARACTER KHO KHON */
+#define XKB_KEY_Thai_khorakhang 0x0da6 /* U+0E06 THAI CHARACTER KHO RAKHANG */
+#define XKB_KEY_Thai_ngongu 0x0da7 /* U+0E07 THAI CHARACTER NGO NGU */
+#define XKB_KEY_Thai_chochan 0x0da8 /* U+0E08 THAI CHARACTER CHO CHAN */
+#define XKB_KEY_Thai_choching 0x0da9 /* U+0E09 THAI CHARACTER CHO CHING */
+#define XKB_KEY_Thai_chochang 0x0daa /* U+0E0A THAI CHARACTER CHO CHANG */
+#define XKB_KEY_Thai_soso 0x0dab /* U+0E0B THAI CHARACTER SO SO */
+#define XKB_KEY_Thai_chochoe 0x0dac /* U+0E0C THAI CHARACTER CHO CHOE */
+#define XKB_KEY_Thai_yoying 0x0dad /* U+0E0D THAI CHARACTER YO YING */
+#define XKB_KEY_Thai_dochada 0x0dae /* U+0E0E THAI CHARACTER DO CHADA */
+#define XKB_KEY_Thai_topatak 0x0daf /* U+0E0F THAI CHARACTER TO PATAK */
+#define XKB_KEY_Thai_thothan 0x0db0 /* U+0E10 THAI CHARACTER THO THAN */
+#define XKB_KEY_Thai_thonangmontho 0x0db1 /* U+0E11 THAI CHARACTER THO NANGMONTHO */
+#define XKB_KEY_Thai_thophuthao 0x0db2 /* U+0E12 THAI CHARACTER THO PHUTHAO */
+#define XKB_KEY_Thai_nonen 0x0db3 /* U+0E13 THAI CHARACTER NO NEN */
+#define XKB_KEY_Thai_dodek 0x0db4 /* U+0E14 THAI CHARACTER DO DEK */
+#define XKB_KEY_Thai_totao 0x0db5 /* U+0E15 THAI CHARACTER TO TAO */
+#define XKB_KEY_Thai_thothung 0x0db6 /* U+0E16 THAI CHARACTER THO THUNG */
+#define XKB_KEY_Thai_thothahan 0x0db7 /* U+0E17 THAI CHARACTER THO THAHAN */
+#define XKB_KEY_Thai_thothong 0x0db8 /* U+0E18 THAI CHARACTER THO THONG */
+#define XKB_KEY_Thai_nonu 0x0db9 /* U+0E19 THAI CHARACTER NO NU */
+#define XKB_KEY_Thai_bobaimai 0x0dba /* U+0E1A THAI CHARACTER BO BAIMAI */
+#define XKB_KEY_Thai_popla 0x0dbb /* U+0E1B THAI CHARACTER PO PLA */
+#define XKB_KEY_Thai_phophung 0x0dbc /* U+0E1C THAI CHARACTER PHO PHUNG */
+#define XKB_KEY_Thai_fofa 0x0dbd /* U+0E1D THAI CHARACTER FO FA */
+#define XKB_KEY_Thai_phophan 0x0dbe /* U+0E1E THAI CHARACTER PHO PHAN */
+#define XKB_KEY_Thai_fofan 0x0dbf /* U+0E1F THAI CHARACTER FO FAN */
+#define XKB_KEY_Thai_phosamphao 0x0dc0 /* U+0E20 THAI CHARACTER PHO SAMPHAO */
+#define XKB_KEY_Thai_moma 0x0dc1 /* U+0E21 THAI CHARACTER MO MA */
+#define XKB_KEY_Thai_yoyak 0x0dc2 /* U+0E22 THAI CHARACTER YO YAK */
+#define XKB_KEY_Thai_rorua 0x0dc3 /* U+0E23 THAI CHARACTER RO RUA */
+#define XKB_KEY_Thai_ru 0x0dc4 /* U+0E24 THAI CHARACTER RU */
+#define XKB_KEY_Thai_loling 0x0dc5 /* U+0E25 THAI CHARACTER LO LING */
+#define XKB_KEY_Thai_lu 0x0dc6 /* U+0E26 THAI CHARACTER LU */
+#define XKB_KEY_Thai_wowaen 0x0dc7 /* U+0E27 THAI CHARACTER WO WAEN */
+#define XKB_KEY_Thai_sosala 0x0dc8 /* U+0E28 THAI CHARACTER SO SALA */
+#define XKB_KEY_Thai_sorusi 0x0dc9 /* U+0E29 THAI CHARACTER SO RUSI */
+#define XKB_KEY_Thai_sosua 0x0dca /* U+0E2A THAI CHARACTER SO SUA */
+#define XKB_KEY_Thai_hohip 0x0dcb /* U+0E2B THAI CHARACTER HO HIP */
+#define XKB_KEY_Thai_lochula 0x0dcc /* U+0E2C THAI CHARACTER LO CHULA */
+#define XKB_KEY_Thai_oang 0x0dcd /* U+0E2D THAI CHARACTER O ANG */
+#define XKB_KEY_Thai_honokhuk 0x0dce /* U+0E2E THAI CHARACTER HO NOKHUK */
+#define XKB_KEY_Thai_paiyannoi 0x0dcf /* U+0E2F THAI CHARACTER PAIYANNOI */
+#define XKB_KEY_Thai_saraa 0x0dd0 /* U+0E30 THAI CHARACTER SARA A */
+#define XKB_KEY_Thai_maihanakat 0x0dd1 /* U+0E31 THAI CHARACTER MAI HAN-AKAT */
+#define XKB_KEY_Thai_saraaa 0x0dd2 /* U+0E32 THAI CHARACTER SARA AA */
+#define XKB_KEY_Thai_saraam 0x0dd3 /* U+0E33 THAI CHARACTER SARA AM */
+#define XKB_KEY_Thai_sarai 0x0dd4 /* U+0E34 THAI CHARACTER SARA I */
+#define XKB_KEY_Thai_saraii 0x0dd5 /* U+0E35 THAI CHARACTER SARA II */
+#define XKB_KEY_Thai_saraue 0x0dd6 /* U+0E36 THAI CHARACTER SARA UE */
+#define XKB_KEY_Thai_sarauee 0x0dd7 /* U+0E37 THAI CHARACTER SARA UEE */
+#define XKB_KEY_Thai_sarau 0x0dd8 /* U+0E38 THAI CHARACTER SARA U */
+#define XKB_KEY_Thai_sarauu 0x0dd9 /* U+0E39 THAI CHARACTER SARA UU */
+#define XKB_KEY_Thai_phinthu 0x0dda /* U+0E3A THAI CHARACTER PHINTHU */
+#define XKB_KEY_Thai_maihanakat_maitho 0x0dde
+#define XKB_KEY_Thai_baht 0x0ddf /* U+0E3F THAI CURRENCY SYMBOL BAHT */
+#define XKB_KEY_Thai_sarae 0x0de0 /* U+0E40 THAI CHARACTER SARA E */
+#define XKB_KEY_Thai_saraae 0x0de1 /* U+0E41 THAI CHARACTER SARA AE */
+#define XKB_KEY_Thai_sarao 0x0de2 /* U+0E42 THAI CHARACTER SARA O */
+#define XKB_KEY_Thai_saraaimaimuan 0x0de3 /* U+0E43 THAI CHARACTER SARA AI MAIMUAN */
+#define XKB_KEY_Thai_saraaimaimalai 0x0de4 /* U+0E44 THAI CHARACTER SARA AI MAIMALAI */
+#define XKB_KEY_Thai_lakkhangyao 0x0de5 /* U+0E45 THAI CHARACTER LAKKHANGYAO */
+#define XKB_KEY_Thai_maiyamok 0x0de6 /* U+0E46 THAI CHARACTER MAIYAMOK */
+#define XKB_KEY_Thai_maitaikhu 0x0de7 /* U+0E47 THAI CHARACTER MAITAIKHU */
+#define XKB_KEY_Thai_maiek 0x0de8 /* U+0E48 THAI CHARACTER MAI EK */
+#define XKB_KEY_Thai_maitho 0x0de9 /* U+0E49 THAI CHARACTER MAI THO */
+#define XKB_KEY_Thai_maitri 0x0dea /* U+0E4A THAI CHARACTER MAI TRI */
+#define XKB_KEY_Thai_maichattawa 0x0deb /* U+0E4B THAI CHARACTER MAI CHATTAWA */
+#define XKB_KEY_Thai_thanthakhat 0x0dec /* U+0E4C THAI CHARACTER THANTHAKHAT */
+#define XKB_KEY_Thai_nikhahit 0x0ded /* U+0E4D THAI CHARACTER NIKHAHIT */
+#define XKB_KEY_Thai_leksun 0x0df0 /* U+0E50 THAI DIGIT ZERO */
+#define XKB_KEY_Thai_leknung 0x0df1 /* U+0E51 THAI DIGIT ONE */
+#define XKB_KEY_Thai_leksong 0x0df2 /* U+0E52 THAI DIGIT TWO */
+#define XKB_KEY_Thai_leksam 0x0df3 /* U+0E53 THAI DIGIT THREE */
+#define XKB_KEY_Thai_leksi 0x0df4 /* U+0E54 THAI DIGIT FOUR */
+#define XKB_KEY_Thai_lekha 0x0df5 /* U+0E55 THAI DIGIT FIVE */
+#define XKB_KEY_Thai_lekhok 0x0df6 /* U+0E56 THAI DIGIT SIX */
+#define XKB_KEY_Thai_lekchet 0x0df7 /* U+0E57 THAI DIGIT SEVEN */
+#define XKB_KEY_Thai_lekpaet 0x0df8 /* U+0E58 THAI DIGIT EIGHT */
+#define XKB_KEY_Thai_lekkao 0x0df9 /* U+0E59 THAI DIGIT NINE */
+
+/*
+ * Korean
+ * Byte 3 = 0x0e
+ */
+
+
+#define XKB_KEY_Hangul 0xff31 /* Hangul start/stop(toggle) */
+#define XKB_KEY_Hangul_Start 0xff32 /* Hangul start */
+#define XKB_KEY_Hangul_End 0xff33 /* Hangul end, English start */
+#define XKB_KEY_Hangul_Hanja 0xff34 /* Start Hangul->Hanja Conversion */
+#define XKB_KEY_Hangul_Jamo 0xff35 /* Hangul Jamo mode */
+#define XKB_KEY_Hangul_Romaja 0xff36 /* Hangul Romaja mode */
+#define XKB_KEY_Hangul_Codeinput 0xff37 /* Hangul code input mode */
+#define XKB_KEY_Hangul_Jeonja 0xff38 /* Jeonja mode */
+#define XKB_KEY_Hangul_Banja 0xff39 /* Banja mode */
+#define XKB_KEY_Hangul_PreHanja 0xff3a /* Pre Hanja conversion */
+#define XKB_KEY_Hangul_PostHanja 0xff3b /* Post Hanja conversion */
+#define XKB_KEY_Hangul_SingleCandidate 0xff3c /* Single candidate */
+#define XKB_KEY_Hangul_MultipleCandidate 0xff3d /* Multiple candidate */
+#define XKB_KEY_Hangul_PreviousCandidate 0xff3e /* Previous candidate */
+#define XKB_KEY_Hangul_Special 0xff3f /* Special symbols */
+#define XKB_KEY_Hangul_switch 0xff7e /* Alias for mode_switch */
+
+/* Hangul Consonant Characters */
+#define XKB_KEY_Hangul_Kiyeog 0x0ea1 /* U+3131 HANGUL LETTER KIYEOK */
+#define XKB_KEY_Hangul_SsangKiyeog 0x0ea2 /* U+3132 HANGUL LETTER SSANGKIYEOK */
+#define XKB_KEY_Hangul_KiyeogSios 0x0ea3 /* U+3133 HANGUL LETTER KIYEOK-SIOS */
+#define XKB_KEY_Hangul_Nieun 0x0ea4 /* U+3134 HANGUL LETTER NIEUN */
+#define XKB_KEY_Hangul_NieunJieuj 0x0ea5 /* U+3135 HANGUL LETTER NIEUN-CIEUC */
+#define XKB_KEY_Hangul_NieunHieuh 0x0ea6 /* U+3136 HANGUL LETTER NIEUN-HIEUH */
+#define XKB_KEY_Hangul_Dikeud 0x0ea7 /* U+3137 HANGUL LETTER TIKEUT */
+#define XKB_KEY_Hangul_SsangDikeud 0x0ea8 /* U+3138 HANGUL LETTER SSANGTIKEUT */
+#define XKB_KEY_Hangul_Rieul 0x0ea9 /* U+3139 HANGUL LETTER RIEUL */
+#define XKB_KEY_Hangul_RieulKiyeog 0x0eaa /* U+313A HANGUL LETTER RIEUL-KIYEOK */
+#define XKB_KEY_Hangul_RieulMieum 0x0eab /* U+313B HANGUL LETTER RIEUL-MIEUM */
+#define XKB_KEY_Hangul_RieulPieub 0x0eac /* U+313C HANGUL LETTER RIEUL-PIEUP */
+#define XKB_KEY_Hangul_RieulSios 0x0ead /* U+313D HANGUL LETTER RIEUL-SIOS */
+#define XKB_KEY_Hangul_RieulTieut 0x0eae /* U+313E HANGUL LETTER RIEUL-THIEUTH */
+#define XKB_KEY_Hangul_RieulPhieuf 0x0eaf /* U+313F HANGUL LETTER RIEUL-PHIEUPH */
+#define XKB_KEY_Hangul_RieulHieuh 0x0eb0 /* U+3140 HANGUL LETTER RIEUL-HIEUH */
+#define XKB_KEY_Hangul_Mieum 0x0eb1 /* U+3141 HANGUL LETTER MIEUM */
+#define XKB_KEY_Hangul_Pieub 0x0eb2 /* U+3142 HANGUL LETTER PIEUP */
+#define XKB_KEY_Hangul_SsangPieub 0x0eb3 /* U+3143 HANGUL LETTER SSANGPIEUP */
+#define XKB_KEY_Hangul_PieubSios 0x0eb4 /* U+3144 HANGUL LETTER PIEUP-SIOS */
+#define XKB_KEY_Hangul_Sios 0x0eb5 /* U+3145 HANGUL LETTER SIOS */
+#define XKB_KEY_Hangul_SsangSios 0x0eb6 /* U+3146 HANGUL LETTER SSANGSIOS */
+#define XKB_KEY_Hangul_Ieung 0x0eb7 /* U+3147 HANGUL LETTER IEUNG */
+#define XKB_KEY_Hangul_Jieuj 0x0eb8 /* U+3148 HANGUL LETTER CIEUC */
+#define XKB_KEY_Hangul_SsangJieuj 0x0eb9 /* U+3149 HANGUL LETTER SSANGCIEUC */
+#define XKB_KEY_Hangul_Cieuc 0x0eba /* U+314A HANGUL LETTER CHIEUCH */
+#define XKB_KEY_Hangul_Khieuq 0x0ebb /* U+314B HANGUL LETTER KHIEUKH */
+#define XKB_KEY_Hangul_Tieut 0x0ebc /* U+314C HANGUL LETTER THIEUTH */
+#define XKB_KEY_Hangul_Phieuf 0x0ebd /* U+314D HANGUL LETTER PHIEUPH */
+#define XKB_KEY_Hangul_Hieuh 0x0ebe /* U+314E HANGUL LETTER HIEUH */
+
+/* Hangul Vowel Characters */
+#define XKB_KEY_Hangul_A 0x0ebf /* U+314F HANGUL LETTER A */
+#define XKB_KEY_Hangul_AE 0x0ec0 /* U+3150 HANGUL LETTER AE */
+#define XKB_KEY_Hangul_YA 0x0ec1 /* U+3151 HANGUL LETTER YA */
+#define XKB_KEY_Hangul_YAE 0x0ec2 /* U+3152 HANGUL LETTER YAE */
+#define XKB_KEY_Hangul_EO 0x0ec3 /* U+3153 HANGUL LETTER EO */
+#define XKB_KEY_Hangul_E 0x0ec4 /* U+3154 HANGUL LETTER E */
+#define XKB_KEY_Hangul_YEO 0x0ec5 /* U+3155 HANGUL LETTER YEO */
+#define XKB_KEY_Hangul_YE 0x0ec6 /* U+3156 HANGUL LETTER YE */
+#define XKB_KEY_Hangul_O 0x0ec7 /* U+3157 HANGUL LETTER O */
+#define XKB_KEY_Hangul_WA 0x0ec8 /* U+3158 HANGUL LETTER WA */
+#define XKB_KEY_Hangul_WAE 0x0ec9 /* U+3159 HANGUL LETTER WAE */
+#define XKB_KEY_Hangul_OE 0x0eca /* U+315A HANGUL LETTER OE */
+#define XKB_KEY_Hangul_YO 0x0ecb /* U+315B HANGUL LETTER YO */
+#define XKB_KEY_Hangul_U 0x0ecc /* U+315C HANGUL LETTER U */
+#define XKB_KEY_Hangul_WEO 0x0ecd /* U+315D HANGUL LETTER WEO */
+#define XKB_KEY_Hangul_WE 0x0ece /* U+315E HANGUL LETTER WE */
+#define XKB_KEY_Hangul_WI 0x0ecf /* U+315F HANGUL LETTER WI */
+#define XKB_KEY_Hangul_YU 0x0ed0 /* U+3160 HANGUL LETTER YU */
+#define XKB_KEY_Hangul_EU 0x0ed1 /* U+3161 HANGUL LETTER EU */
+#define XKB_KEY_Hangul_YI 0x0ed2 /* U+3162 HANGUL LETTER YI */
+#define XKB_KEY_Hangul_I 0x0ed3 /* U+3163 HANGUL LETTER I */
+
+/* Hangul syllable-final (JongSeong) Characters */
+#define XKB_KEY_Hangul_J_Kiyeog 0x0ed4 /* U+11A8 HANGUL JONGSEONG KIYEOK */
+#define XKB_KEY_Hangul_J_SsangKiyeog 0x0ed5 /* U+11A9 HANGUL JONGSEONG SSANGKIYEOK */
+#define XKB_KEY_Hangul_J_KiyeogSios 0x0ed6 /* U+11AA HANGUL JONGSEONG KIYEOK-SIOS */
+#define XKB_KEY_Hangul_J_Nieun 0x0ed7 /* U+11AB HANGUL JONGSEONG NIEUN */
+#define XKB_KEY_Hangul_J_NieunJieuj 0x0ed8 /* U+11AC HANGUL JONGSEONG NIEUN-CIEUC */
+#define XKB_KEY_Hangul_J_NieunHieuh 0x0ed9 /* U+11AD HANGUL JONGSEONG NIEUN-HIEUH */
+#define XKB_KEY_Hangul_J_Dikeud 0x0eda /* U+11AE HANGUL JONGSEONG TIKEUT */
+#define XKB_KEY_Hangul_J_Rieul 0x0edb /* U+11AF HANGUL JONGSEONG RIEUL */
+#define XKB_KEY_Hangul_J_RieulKiyeog 0x0edc /* U+11B0 HANGUL JONGSEONG RIEUL-KIYEOK */
+#define XKB_KEY_Hangul_J_RieulMieum 0x0edd /* U+11B1 HANGUL JONGSEONG RIEUL-MIEUM */
+#define XKB_KEY_Hangul_J_RieulPieub 0x0ede /* U+11B2 HANGUL JONGSEONG RIEUL-PIEUP */
+#define XKB_KEY_Hangul_J_RieulSios 0x0edf /* U+11B3 HANGUL JONGSEONG RIEUL-SIOS */
+#define XKB_KEY_Hangul_J_RieulTieut 0x0ee0 /* U+11B4 HANGUL JONGSEONG RIEUL-THIEUTH */
+#define XKB_KEY_Hangul_J_RieulPhieuf 0x0ee1 /* U+11B5 HANGUL JONGSEONG RIEUL-PHIEUPH */
+#define XKB_KEY_Hangul_J_RieulHieuh 0x0ee2 /* U+11B6 HANGUL JONGSEONG RIEUL-HIEUH */
+#define XKB_KEY_Hangul_J_Mieum 0x0ee3 /* U+11B7 HANGUL JONGSEONG MIEUM */
+#define XKB_KEY_Hangul_J_Pieub 0x0ee4 /* U+11B8 HANGUL JONGSEONG PIEUP */
+#define XKB_KEY_Hangul_J_PieubSios 0x0ee5 /* U+11B9 HANGUL JONGSEONG PIEUP-SIOS */
+#define XKB_KEY_Hangul_J_Sios 0x0ee6 /* U+11BA HANGUL JONGSEONG SIOS */
+#define XKB_KEY_Hangul_J_SsangSios 0x0ee7 /* U+11BB HANGUL JONGSEONG SSANGSIOS */
+#define XKB_KEY_Hangul_J_Ieung 0x0ee8 /* U+11BC HANGUL JONGSEONG IEUNG */
+#define XKB_KEY_Hangul_J_Jieuj 0x0ee9 /* U+11BD HANGUL JONGSEONG CIEUC */
+#define XKB_KEY_Hangul_J_Cieuc 0x0eea /* U+11BE HANGUL JONGSEONG CHIEUCH */
+#define XKB_KEY_Hangul_J_Khieuq 0x0eeb /* U+11BF HANGUL JONGSEONG KHIEUKH */
+#define XKB_KEY_Hangul_J_Tieut 0x0eec /* U+11C0 HANGUL JONGSEONG THIEUTH */
+#define XKB_KEY_Hangul_J_Phieuf 0x0eed /* U+11C1 HANGUL JONGSEONG PHIEUPH */
+#define XKB_KEY_Hangul_J_Hieuh 0x0eee /* U+11C2 HANGUL JONGSEONG HIEUH */
+
+/* Ancient Hangul Consonant Characters */
+#define XKB_KEY_Hangul_RieulYeorinHieuh 0x0eef /* U+316D HANGUL LETTER RIEUL-YEORINHIEUH */
+#define XKB_KEY_Hangul_SunkyeongeumMieum 0x0ef0 /* U+3171 HANGUL LETTER KAPYEOUNMIEUM */
+#define XKB_KEY_Hangul_SunkyeongeumPieub 0x0ef1 /* U+3178 HANGUL LETTER KAPYEOUNPIEUP */
+#define XKB_KEY_Hangul_PanSios 0x0ef2 /* U+317F HANGUL LETTER PANSIOS */
+#define XKB_KEY_Hangul_KkogjiDalrinIeung 0x0ef3 /* U+3181 HANGUL LETTER YESIEUNG */
+#define XKB_KEY_Hangul_SunkyeongeumPhieuf 0x0ef4 /* U+3184 HANGUL LETTER KAPYEOUNPHIEUPH */
+#define XKB_KEY_Hangul_YeorinHieuh 0x0ef5 /* U+3186 HANGUL LETTER YEORINHIEUH */
+
+/* Ancient Hangul Vowel Characters */
+#define XKB_KEY_Hangul_AraeA 0x0ef6 /* U+318D HANGUL LETTER ARAEA */
+#define XKB_KEY_Hangul_AraeAE 0x0ef7 /* U+318E HANGUL LETTER ARAEAE */
+
+/* Ancient Hangul syllable-final (JongSeong) Characters */
+#define XKB_KEY_Hangul_J_PanSios 0x0ef8 /* U+11EB HANGUL JONGSEONG PANSIOS */
+#define XKB_KEY_Hangul_J_KkogjiDalrinIeung 0x0ef9 /* U+11F0 HANGUL JONGSEONG YESIEUNG */
+#define XKB_KEY_Hangul_J_YeorinHieuh 0x0efa /* U+11F9 HANGUL JONGSEONG YEORINHIEUH */
+
+/* Korean currency symbol */
+#define XKB_KEY_Korean_Won 0x0eff /*(U+20A9 WON SIGN)*/
+
+
+/*
+ * Armenian
+ */
+
+#define XKB_KEY_Armenian_ligature_ew 0x1000587 /* U+0587 ARMENIAN SMALL LIGATURE ECH YIWN */
+#define XKB_KEY_Armenian_full_stop 0x1000589 /* U+0589 ARMENIAN FULL STOP */
+#define XKB_KEY_Armenian_verjaket 0x1000589 /* U+0589 ARMENIAN FULL STOP */
+#define XKB_KEY_Armenian_separation_mark 0x100055d /* U+055D ARMENIAN COMMA */
+#define XKB_KEY_Armenian_but 0x100055d /* U+055D ARMENIAN COMMA */
+#define XKB_KEY_Armenian_hyphen 0x100058a /* U+058A ARMENIAN HYPHEN */
+#define XKB_KEY_Armenian_yentamna 0x100058a /* U+058A ARMENIAN HYPHEN */
+#define XKB_KEY_Armenian_exclam 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */
+#define XKB_KEY_Armenian_amanak 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */
+#define XKB_KEY_Armenian_accent 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */
+#define XKB_KEY_Armenian_shesht 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */
+#define XKB_KEY_Armenian_question 0x100055e /* U+055E ARMENIAN QUESTION MARK */
+#define XKB_KEY_Armenian_paruyk 0x100055e /* U+055E ARMENIAN QUESTION MARK */
+#define XKB_KEY_Armenian_AYB 0x1000531 /* U+0531 ARMENIAN CAPITAL LETTER AYB */
+#define XKB_KEY_Armenian_ayb 0x1000561 /* U+0561 ARMENIAN SMALL LETTER AYB */
+#define XKB_KEY_Armenian_BEN 0x1000532 /* U+0532 ARMENIAN CAPITAL LETTER BEN */
+#define XKB_KEY_Armenian_ben 0x1000562 /* U+0562 ARMENIAN SMALL LETTER BEN */
+#define XKB_KEY_Armenian_GIM 0x1000533 /* U+0533 ARMENIAN CAPITAL LETTER GIM */
+#define XKB_KEY_Armenian_gim 0x1000563 /* U+0563 ARMENIAN SMALL LETTER GIM */
+#define XKB_KEY_Armenian_DA 0x1000534 /* U+0534 ARMENIAN CAPITAL LETTER DA */
+#define XKB_KEY_Armenian_da 0x1000564 /* U+0564 ARMENIAN SMALL LETTER DA */
+#define XKB_KEY_Armenian_YECH 0x1000535 /* U+0535 ARMENIAN CAPITAL LETTER ECH */
+#define XKB_KEY_Armenian_yech 0x1000565 /* U+0565 ARMENIAN SMALL LETTER ECH */
+#define XKB_KEY_Armenian_ZA 0x1000536 /* U+0536 ARMENIAN CAPITAL LETTER ZA */
+#define XKB_KEY_Armenian_za 0x1000566 /* U+0566 ARMENIAN SMALL LETTER ZA */
+#define XKB_KEY_Armenian_E 0x1000537 /* U+0537 ARMENIAN CAPITAL LETTER EH */
+#define XKB_KEY_Armenian_e 0x1000567 /* U+0567 ARMENIAN SMALL LETTER EH */
+#define XKB_KEY_Armenian_AT 0x1000538 /* U+0538 ARMENIAN CAPITAL LETTER ET */
+#define XKB_KEY_Armenian_at 0x1000568 /* U+0568 ARMENIAN SMALL LETTER ET */
+#define XKB_KEY_Armenian_TO 0x1000539 /* U+0539 ARMENIAN CAPITAL LETTER TO */
+#define XKB_KEY_Armenian_to 0x1000569 /* U+0569 ARMENIAN SMALL LETTER TO */
+#define XKB_KEY_Armenian_ZHE 0x100053a /* U+053A ARMENIAN CAPITAL LETTER ZHE */
+#define XKB_KEY_Armenian_zhe 0x100056a /* U+056A ARMENIAN SMALL LETTER ZHE */
+#define XKB_KEY_Armenian_INI 0x100053b /* U+053B ARMENIAN CAPITAL LETTER INI */
+#define XKB_KEY_Armenian_ini 0x100056b /* U+056B ARMENIAN SMALL LETTER INI */
+#define XKB_KEY_Armenian_LYUN 0x100053c /* U+053C ARMENIAN CAPITAL LETTER LIWN */
+#define XKB_KEY_Armenian_lyun 0x100056c /* U+056C ARMENIAN SMALL LETTER LIWN */
+#define XKB_KEY_Armenian_KHE 0x100053d /* U+053D ARMENIAN CAPITAL LETTER XEH */
+#define XKB_KEY_Armenian_khe 0x100056d /* U+056D ARMENIAN SMALL LETTER XEH */
+#define XKB_KEY_Armenian_TSA 0x100053e /* U+053E ARMENIAN CAPITAL LETTER CA */
+#define XKB_KEY_Armenian_tsa 0x100056e /* U+056E ARMENIAN SMALL LETTER CA */
+#define XKB_KEY_Armenian_KEN 0x100053f /* U+053F ARMENIAN CAPITAL LETTER KEN */
+#define XKB_KEY_Armenian_ken 0x100056f /* U+056F ARMENIAN SMALL LETTER KEN */
+#define XKB_KEY_Armenian_HO 0x1000540 /* U+0540 ARMENIAN CAPITAL LETTER HO */
+#define XKB_KEY_Armenian_ho 0x1000570 /* U+0570 ARMENIAN SMALL LETTER HO */
+#define XKB_KEY_Armenian_DZA 0x1000541 /* U+0541 ARMENIAN CAPITAL LETTER JA */
+#define XKB_KEY_Armenian_dza 0x1000571 /* U+0571 ARMENIAN SMALL LETTER JA */
+#define XKB_KEY_Armenian_GHAT 0x1000542 /* U+0542 ARMENIAN CAPITAL LETTER GHAD */
+#define XKB_KEY_Armenian_ghat 0x1000572 /* U+0572 ARMENIAN SMALL LETTER GHAD */
+#define XKB_KEY_Armenian_TCHE 0x1000543 /* U+0543 ARMENIAN CAPITAL LETTER CHEH */
+#define XKB_KEY_Armenian_tche 0x1000573 /* U+0573 ARMENIAN SMALL LETTER CHEH */
+#define XKB_KEY_Armenian_MEN 0x1000544 /* U+0544 ARMENIAN CAPITAL LETTER MEN */
+#define XKB_KEY_Armenian_men 0x1000574 /* U+0574 ARMENIAN SMALL LETTER MEN */
+#define XKB_KEY_Armenian_HI 0x1000545 /* U+0545 ARMENIAN CAPITAL LETTER YI */
+#define XKB_KEY_Armenian_hi 0x1000575 /* U+0575 ARMENIAN SMALL LETTER YI */
+#define XKB_KEY_Armenian_NU 0x1000546 /* U+0546 ARMENIAN CAPITAL LETTER NOW */
+#define XKB_KEY_Armenian_nu 0x1000576 /* U+0576 ARMENIAN SMALL LETTER NOW */
+#define XKB_KEY_Armenian_SHA 0x1000547 /* U+0547 ARMENIAN CAPITAL LETTER SHA */
+#define XKB_KEY_Armenian_sha 0x1000577 /* U+0577 ARMENIAN SMALL LETTER SHA */
+#define XKB_KEY_Armenian_VO 0x1000548 /* U+0548 ARMENIAN CAPITAL LETTER VO */
+#define XKB_KEY_Armenian_vo 0x1000578 /* U+0578 ARMENIAN SMALL LETTER VO */
+#define XKB_KEY_Armenian_CHA 0x1000549 /* U+0549 ARMENIAN CAPITAL LETTER CHA */
+#define XKB_KEY_Armenian_cha 0x1000579 /* U+0579 ARMENIAN SMALL LETTER CHA */
+#define XKB_KEY_Armenian_PE 0x100054a /* U+054A ARMENIAN CAPITAL LETTER PEH */
+#define XKB_KEY_Armenian_pe 0x100057a /* U+057A ARMENIAN SMALL LETTER PEH */
+#define XKB_KEY_Armenian_JE 0x100054b /* U+054B ARMENIAN CAPITAL LETTER JHEH */
+#define XKB_KEY_Armenian_je 0x100057b /* U+057B ARMENIAN SMALL LETTER JHEH */
+#define XKB_KEY_Armenian_RA 0x100054c /* U+054C ARMENIAN CAPITAL LETTER RA */
+#define XKB_KEY_Armenian_ra 0x100057c /* U+057C ARMENIAN SMALL LETTER RA */
+#define XKB_KEY_Armenian_SE 0x100054d /* U+054D ARMENIAN CAPITAL LETTER SEH */
+#define XKB_KEY_Armenian_se 0x100057d /* U+057D ARMENIAN SMALL LETTER SEH */
+#define XKB_KEY_Armenian_VEV 0x100054e /* U+054E ARMENIAN CAPITAL LETTER VEW */
+#define XKB_KEY_Armenian_vev 0x100057e /* U+057E ARMENIAN SMALL LETTER VEW */
+#define XKB_KEY_Armenian_TYUN 0x100054f /* U+054F ARMENIAN CAPITAL LETTER TIWN */
+#define XKB_KEY_Armenian_tyun 0x100057f /* U+057F ARMENIAN SMALL LETTER TIWN */
+#define XKB_KEY_Armenian_RE 0x1000550 /* U+0550 ARMENIAN CAPITAL LETTER REH */
+#define XKB_KEY_Armenian_re 0x1000580 /* U+0580 ARMENIAN SMALL LETTER REH */
+#define XKB_KEY_Armenian_TSO 0x1000551 /* U+0551 ARMENIAN CAPITAL LETTER CO */
+#define XKB_KEY_Armenian_tso 0x1000581 /* U+0581 ARMENIAN SMALL LETTER CO */
+#define XKB_KEY_Armenian_VYUN 0x1000552 /* U+0552 ARMENIAN CAPITAL LETTER YIWN */
+#define XKB_KEY_Armenian_vyun 0x1000582 /* U+0582 ARMENIAN SMALL LETTER YIWN */
+#define XKB_KEY_Armenian_PYUR 0x1000553 /* U+0553 ARMENIAN CAPITAL LETTER PIWR */
+#define XKB_KEY_Armenian_pyur 0x1000583 /* U+0583 ARMENIAN SMALL LETTER PIWR */
+#define XKB_KEY_Armenian_KE 0x1000554 /* U+0554 ARMENIAN CAPITAL LETTER KEH */
+#define XKB_KEY_Armenian_ke 0x1000584 /* U+0584 ARMENIAN SMALL LETTER KEH */
+#define XKB_KEY_Armenian_O 0x1000555 /* U+0555 ARMENIAN CAPITAL LETTER OH */
+#define XKB_KEY_Armenian_o 0x1000585 /* U+0585 ARMENIAN SMALL LETTER OH */
+#define XKB_KEY_Armenian_FE 0x1000556 /* U+0556 ARMENIAN CAPITAL LETTER FEH */
+#define XKB_KEY_Armenian_fe 0x1000586 /* U+0586 ARMENIAN SMALL LETTER FEH */
+#define XKB_KEY_Armenian_apostrophe 0x100055a /* U+055A ARMENIAN APOSTROPHE */
+
+/*
+ * Georgian
+ */
+
+#define XKB_KEY_Georgian_an 0x10010d0 /* U+10D0 GEORGIAN LETTER AN */
+#define XKB_KEY_Georgian_ban 0x10010d1 /* U+10D1 GEORGIAN LETTER BAN */
+#define XKB_KEY_Georgian_gan 0x10010d2 /* U+10D2 GEORGIAN LETTER GAN */
+#define XKB_KEY_Georgian_don 0x10010d3 /* U+10D3 GEORGIAN LETTER DON */
+#define XKB_KEY_Georgian_en 0x10010d4 /* U+10D4 GEORGIAN LETTER EN */
+#define XKB_KEY_Georgian_vin 0x10010d5 /* U+10D5 GEORGIAN LETTER VIN */
+#define XKB_KEY_Georgian_zen 0x10010d6 /* U+10D6 GEORGIAN LETTER ZEN */
+#define XKB_KEY_Georgian_tan 0x10010d7 /* U+10D7 GEORGIAN LETTER TAN */
+#define XKB_KEY_Georgian_in 0x10010d8 /* U+10D8 GEORGIAN LETTER IN */
+#define XKB_KEY_Georgian_kan 0x10010d9 /* U+10D9 GEORGIAN LETTER KAN */
+#define XKB_KEY_Georgian_las 0x10010da /* U+10DA GEORGIAN LETTER LAS */
+#define XKB_KEY_Georgian_man 0x10010db /* U+10DB GEORGIAN LETTER MAN */
+#define XKB_KEY_Georgian_nar 0x10010dc /* U+10DC GEORGIAN LETTER NAR */
+#define XKB_KEY_Georgian_on 0x10010dd /* U+10DD GEORGIAN LETTER ON */
+#define XKB_KEY_Georgian_par 0x10010de /* U+10DE GEORGIAN LETTER PAR */
+#define XKB_KEY_Georgian_zhar 0x10010df /* U+10DF GEORGIAN LETTER ZHAR */
+#define XKB_KEY_Georgian_rae 0x10010e0 /* U+10E0 GEORGIAN LETTER RAE */
+#define XKB_KEY_Georgian_san 0x10010e1 /* U+10E1 GEORGIAN LETTER SAN */
+#define XKB_KEY_Georgian_tar 0x10010e2 /* U+10E2 GEORGIAN LETTER TAR */
+#define XKB_KEY_Georgian_un 0x10010e3 /* U+10E3 GEORGIAN LETTER UN */
+#define XKB_KEY_Georgian_phar 0x10010e4 /* U+10E4 GEORGIAN LETTER PHAR */
+#define XKB_KEY_Georgian_khar 0x10010e5 /* U+10E5 GEORGIAN LETTER KHAR */
+#define XKB_KEY_Georgian_ghan 0x10010e6 /* U+10E6 GEORGIAN LETTER GHAN */
+#define XKB_KEY_Georgian_qar 0x10010e7 /* U+10E7 GEORGIAN LETTER QAR */
+#define XKB_KEY_Georgian_shin 0x10010e8 /* U+10E8 GEORGIAN LETTER SHIN */
+#define XKB_KEY_Georgian_chin 0x10010e9 /* U+10E9 GEORGIAN LETTER CHIN */
+#define XKB_KEY_Georgian_can 0x10010ea /* U+10EA GEORGIAN LETTER CAN */
+#define XKB_KEY_Georgian_jil 0x10010eb /* U+10EB GEORGIAN LETTER JIL */
+#define XKB_KEY_Georgian_cil 0x10010ec /* U+10EC GEORGIAN LETTER CIL */
+#define XKB_KEY_Georgian_char 0x10010ed /* U+10ED GEORGIAN LETTER CHAR */
+#define XKB_KEY_Georgian_xan 0x10010ee /* U+10EE GEORGIAN LETTER XAN */
+#define XKB_KEY_Georgian_jhan 0x10010ef /* U+10EF GEORGIAN LETTER JHAN */
+#define XKB_KEY_Georgian_hae 0x10010f0 /* U+10F0 GEORGIAN LETTER HAE */
+#define XKB_KEY_Georgian_he 0x10010f1 /* U+10F1 GEORGIAN LETTER HE */
+#define XKB_KEY_Georgian_hie 0x10010f2 /* U+10F2 GEORGIAN LETTER HIE */
+#define XKB_KEY_Georgian_we 0x10010f3 /* U+10F3 GEORGIAN LETTER WE */
+#define XKB_KEY_Georgian_har 0x10010f4 /* U+10F4 GEORGIAN LETTER HAR */
+#define XKB_KEY_Georgian_hoe 0x10010f5 /* U+10F5 GEORGIAN LETTER HOE */
+#define XKB_KEY_Georgian_fi 0x10010f6 /* U+10F6 GEORGIAN LETTER FI */
+
+/*
+ * Azeri (and other Turkic or Caucasian languages)
+ */
+
+/* latin */
+#define XKB_KEY_Xabovedot 0x1001e8a /* U+1E8A LATIN CAPITAL LETTER X WITH DOT ABOVE */
+#define XKB_KEY_Ibreve 0x100012c /* U+012C LATIN CAPITAL LETTER I WITH BREVE */
+#define XKB_KEY_Zstroke 0x10001b5 /* U+01B5 LATIN CAPITAL LETTER Z WITH STROKE */
+#define XKB_KEY_Gcaron 0x10001e6 /* U+01E6 LATIN CAPITAL LETTER G WITH CARON */
+#define XKB_KEY_Ocaron 0x10001d1 /* U+01D1 LATIN CAPITAL LETTER O WITH CARON */
+#define XKB_KEY_Obarred 0x100019f /* U+019F LATIN CAPITAL LETTER O WITH MIDDLE TILDE */
+#define XKB_KEY_xabovedot 0x1001e8b /* U+1E8B LATIN SMALL LETTER X WITH DOT ABOVE */
+#define XKB_KEY_ibreve 0x100012d /* U+012D LATIN SMALL LETTER I WITH BREVE */
+#define XKB_KEY_zstroke 0x10001b6 /* U+01B6 LATIN SMALL LETTER Z WITH STROKE */
+#define XKB_KEY_gcaron 0x10001e7 /* U+01E7 LATIN SMALL LETTER G WITH CARON */
+#define XKB_KEY_ocaron 0x10001d2 /* U+01D2 LATIN SMALL LETTER O WITH CARON */
+#define XKB_KEY_obarred 0x1000275 /* U+0275 LATIN SMALL LETTER BARRED O */
+#define XKB_KEY_SCHWA 0x100018f /* U+018F LATIN CAPITAL LETTER SCHWA */
+#define XKB_KEY_schwa 0x1000259 /* U+0259 LATIN SMALL LETTER SCHWA */
+#define XKB_KEY_EZH 0x10001b7 /* U+01B7 LATIN CAPITAL LETTER EZH */
+#define XKB_KEY_ezh 0x1000292 /* U+0292 LATIN SMALL LETTER EZH */
+/* those are not really Caucasus */
+/* For Inupiak */
+#define XKB_KEY_Lbelowdot 0x1001e36 /* U+1E36 LATIN CAPITAL LETTER L WITH DOT BELOW */
+#define XKB_KEY_lbelowdot 0x1001e37 /* U+1E37 LATIN SMALL LETTER L WITH DOT BELOW */
+
+/*
+ * Vietnamese
+ */
+
+#define XKB_KEY_Abelowdot 0x1001ea0 /* U+1EA0 LATIN CAPITAL LETTER A WITH DOT BELOW */
+#define XKB_KEY_abelowdot 0x1001ea1 /* U+1EA1 LATIN SMALL LETTER A WITH DOT BELOW */
+#define XKB_KEY_Ahook 0x1001ea2 /* U+1EA2 LATIN CAPITAL LETTER A WITH HOOK ABOVE */
+#define XKB_KEY_ahook 0x1001ea3 /* U+1EA3 LATIN SMALL LETTER A WITH HOOK ABOVE */
+#define XKB_KEY_Acircumflexacute 0x1001ea4 /* U+1EA4 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE */
+#define XKB_KEY_acircumflexacute 0x1001ea5 /* U+1EA5 LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE */
+#define XKB_KEY_Acircumflexgrave 0x1001ea6 /* U+1EA6 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE */
+#define XKB_KEY_acircumflexgrave 0x1001ea7 /* U+1EA7 LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE */
+#define XKB_KEY_Acircumflexhook 0x1001ea8 /* U+1EA8 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XKB_KEY_acircumflexhook 0x1001ea9 /* U+1EA9 LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XKB_KEY_Acircumflextilde 0x1001eaa /* U+1EAA LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE */
+#define XKB_KEY_acircumflextilde 0x1001eab /* U+1EAB LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE */
+#define XKB_KEY_Acircumflexbelowdot 0x1001eac /* U+1EAC LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW */
+#define XKB_KEY_acircumflexbelowdot 0x1001ead /* U+1EAD LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW */
+#define XKB_KEY_Abreveacute 0x1001eae /* U+1EAE LATIN CAPITAL LETTER A WITH BREVE AND ACUTE */
+#define XKB_KEY_abreveacute 0x1001eaf /* U+1EAF LATIN SMALL LETTER A WITH BREVE AND ACUTE */
+#define XKB_KEY_Abrevegrave 0x1001eb0 /* U+1EB0 LATIN CAPITAL LETTER A WITH BREVE AND GRAVE */
+#define XKB_KEY_abrevegrave 0x1001eb1 /* U+1EB1 LATIN SMALL LETTER A WITH BREVE AND GRAVE */
+#define XKB_KEY_Abrevehook 0x1001eb2 /* U+1EB2 LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE */
+#define XKB_KEY_abrevehook 0x1001eb3 /* U+1EB3 LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE */
+#define XKB_KEY_Abrevetilde 0x1001eb4 /* U+1EB4 LATIN CAPITAL LETTER A WITH BREVE AND TILDE */
+#define XKB_KEY_abrevetilde 0x1001eb5 /* U+1EB5 LATIN SMALL LETTER A WITH BREVE AND TILDE */
+#define XKB_KEY_Abrevebelowdot 0x1001eb6 /* U+1EB6 LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW */
+#define XKB_KEY_abrevebelowdot 0x1001eb7 /* U+1EB7 LATIN SMALL LETTER A WITH BREVE AND DOT BELOW */
+#define XKB_KEY_Ebelowdot 0x1001eb8 /* U+1EB8 LATIN CAPITAL LETTER E WITH DOT BELOW */
+#define XKB_KEY_ebelowdot 0x1001eb9 /* U+1EB9 LATIN SMALL LETTER E WITH DOT BELOW */
+#define XKB_KEY_Ehook 0x1001eba /* U+1EBA LATIN CAPITAL LETTER E WITH HOOK ABOVE */
+#define XKB_KEY_ehook 0x1001ebb /* U+1EBB LATIN SMALL LETTER E WITH HOOK ABOVE */
+#define XKB_KEY_Etilde 0x1001ebc /* U+1EBC LATIN CAPITAL LETTER E WITH TILDE */
+#define XKB_KEY_etilde 0x1001ebd /* U+1EBD LATIN SMALL LETTER E WITH TILDE */
+#define XKB_KEY_Ecircumflexacute 0x1001ebe /* U+1EBE LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE */
+#define XKB_KEY_ecircumflexacute 0x1001ebf /* U+1EBF LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE */
+#define XKB_KEY_Ecircumflexgrave 0x1001ec0 /* U+1EC0 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE */
+#define XKB_KEY_ecircumflexgrave 0x1001ec1 /* U+1EC1 LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE */
+#define XKB_KEY_Ecircumflexhook 0x1001ec2 /* U+1EC2 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XKB_KEY_ecircumflexhook 0x1001ec3 /* U+1EC3 LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XKB_KEY_Ecircumflextilde 0x1001ec4 /* U+1EC4 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE */
+#define XKB_KEY_ecircumflextilde 0x1001ec5 /* U+1EC5 LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE */
+#define XKB_KEY_Ecircumflexbelowdot 0x1001ec6 /* U+1EC6 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW */
+#define XKB_KEY_ecircumflexbelowdot 0x1001ec7 /* U+1EC7 LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW */
+#define XKB_KEY_Ihook 0x1001ec8 /* U+1EC8 LATIN CAPITAL LETTER I WITH HOOK ABOVE */
+#define XKB_KEY_ihook 0x1001ec9 /* U+1EC9 LATIN SMALL LETTER I WITH HOOK ABOVE */
+#define XKB_KEY_Ibelowdot 0x1001eca /* U+1ECA LATIN CAPITAL LETTER I WITH DOT BELOW */
+#define XKB_KEY_ibelowdot 0x1001ecb /* U+1ECB LATIN SMALL LETTER I WITH DOT BELOW */
+#define XKB_KEY_Obelowdot 0x1001ecc /* U+1ECC LATIN CAPITAL LETTER O WITH DOT BELOW */
+#define XKB_KEY_obelowdot 0x1001ecd /* U+1ECD LATIN SMALL LETTER O WITH DOT BELOW */
+#define XKB_KEY_Ohook 0x1001ece /* U+1ECE LATIN CAPITAL LETTER O WITH HOOK ABOVE */
+#define XKB_KEY_ohook 0x1001ecf /* U+1ECF LATIN SMALL LETTER O WITH HOOK ABOVE */
+#define XKB_KEY_Ocircumflexacute 0x1001ed0 /* U+1ED0 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE */
+#define XKB_KEY_ocircumflexacute 0x1001ed1 /* U+1ED1 LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE */
+#define XKB_KEY_Ocircumflexgrave 0x1001ed2 /* U+1ED2 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE */
+#define XKB_KEY_ocircumflexgrave 0x1001ed3 /* U+1ED3 LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE */
+#define XKB_KEY_Ocircumflexhook 0x1001ed4 /* U+1ED4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XKB_KEY_ocircumflexhook 0x1001ed5 /* U+1ED5 LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */
+#define XKB_KEY_Ocircumflextilde 0x1001ed6 /* U+1ED6 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE */
+#define XKB_KEY_ocircumflextilde 0x1001ed7 /* U+1ED7 LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE */
+#define XKB_KEY_Ocircumflexbelowdot 0x1001ed8 /* U+1ED8 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW */
+#define XKB_KEY_ocircumflexbelowdot 0x1001ed9 /* U+1ED9 LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW */
+#define XKB_KEY_Ohornacute 0x1001eda /* U+1EDA LATIN CAPITAL LETTER O WITH HORN AND ACUTE */
+#define XKB_KEY_ohornacute 0x1001edb /* U+1EDB LATIN SMALL LETTER O WITH HORN AND ACUTE */
+#define XKB_KEY_Ohorngrave 0x1001edc /* U+1EDC LATIN CAPITAL LETTER O WITH HORN AND GRAVE */
+#define XKB_KEY_ohorngrave 0x1001edd /* U+1EDD LATIN SMALL LETTER O WITH HORN AND GRAVE */
+#define XKB_KEY_Ohornhook 0x1001ede /* U+1EDE LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE */
+#define XKB_KEY_ohornhook 0x1001edf /* U+1EDF LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE */
+#define XKB_KEY_Ohorntilde 0x1001ee0 /* U+1EE0 LATIN CAPITAL LETTER O WITH HORN AND TILDE */
+#define XKB_KEY_ohorntilde 0x1001ee1 /* U+1EE1 LATIN SMALL LETTER O WITH HORN AND TILDE */
+#define XKB_KEY_Ohornbelowdot 0x1001ee2 /* U+1EE2 LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW */
+#define XKB_KEY_ohornbelowdot 0x1001ee3 /* U+1EE3 LATIN SMALL LETTER O WITH HORN AND DOT BELOW */
+#define XKB_KEY_Ubelowdot 0x1001ee4 /* U+1EE4 LATIN CAPITAL LETTER U WITH DOT BELOW */
+#define XKB_KEY_ubelowdot 0x1001ee5 /* U+1EE5 LATIN SMALL LETTER U WITH DOT BELOW */
+#define XKB_KEY_Uhook 0x1001ee6 /* U+1EE6 LATIN CAPITAL LETTER U WITH HOOK ABOVE */
+#define XKB_KEY_uhook 0x1001ee7 /* U+1EE7 LATIN SMALL LETTER U WITH HOOK ABOVE */
+#define XKB_KEY_Uhornacute 0x1001ee8 /* U+1EE8 LATIN CAPITAL LETTER U WITH HORN AND ACUTE */
+#define XKB_KEY_uhornacute 0x1001ee9 /* U+1EE9 LATIN SMALL LETTER U WITH HORN AND ACUTE */
+#define XKB_KEY_Uhorngrave 0x1001eea /* U+1EEA LATIN CAPITAL LETTER U WITH HORN AND GRAVE */
+#define XKB_KEY_uhorngrave 0x1001eeb /* U+1EEB LATIN SMALL LETTER U WITH HORN AND GRAVE */
+#define XKB_KEY_Uhornhook 0x1001eec /* U+1EEC LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE */
+#define XKB_KEY_uhornhook 0x1001eed /* U+1EED LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE */
+#define XKB_KEY_Uhorntilde 0x1001eee /* U+1EEE LATIN CAPITAL LETTER U WITH HORN AND TILDE */
+#define XKB_KEY_uhorntilde 0x1001eef /* U+1EEF LATIN SMALL LETTER U WITH HORN AND TILDE */
+#define XKB_KEY_Uhornbelowdot 0x1001ef0 /* U+1EF0 LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW */
+#define XKB_KEY_uhornbelowdot 0x1001ef1 /* U+1EF1 LATIN SMALL LETTER U WITH HORN AND DOT BELOW */
+#define XKB_KEY_Ybelowdot 0x1001ef4 /* U+1EF4 LATIN CAPITAL LETTER Y WITH DOT BELOW */
+#define XKB_KEY_ybelowdot 0x1001ef5 /* U+1EF5 LATIN SMALL LETTER Y WITH DOT BELOW */
+#define XKB_KEY_Yhook 0x1001ef6 /* U+1EF6 LATIN CAPITAL LETTER Y WITH HOOK ABOVE */
+#define XKB_KEY_yhook 0x1001ef7 /* U+1EF7 LATIN SMALL LETTER Y WITH HOOK ABOVE */
+#define XKB_KEY_Ytilde 0x1001ef8 /* U+1EF8 LATIN CAPITAL LETTER Y WITH TILDE */
+#define XKB_KEY_ytilde 0x1001ef9 /* U+1EF9 LATIN SMALL LETTER Y WITH TILDE */
+#define XKB_KEY_Ohorn 0x10001a0 /* U+01A0 LATIN CAPITAL LETTER O WITH HORN */
+#define XKB_KEY_ohorn 0x10001a1 /* U+01A1 LATIN SMALL LETTER O WITH HORN */
+#define XKB_KEY_Uhorn 0x10001af /* U+01AF LATIN CAPITAL LETTER U WITH HORN */
+#define XKB_KEY_uhorn 0x10001b0 /* U+01B0 LATIN SMALL LETTER U WITH HORN */
+#define XKB_KEY_combining_tilde 0x1000303 /* U+0303 COMBINING TILDE */
+#define XKB_KEY_combining_grave 0x1000300 /* U+0300 COMBINING GRAVE ACCENT */
+#define XKB_KEY_combining_acute 0x1000301 /* U+0301 COMBINING ACUTE ACCENT */
+#define XKB_KEY_combining_hook 0x1000309 /* U+0309 COMBINING HOOK ABOVE */
+#define XKB_KEY_combining_belowdot 0x1000323 /* U+0323 COMBINING DOT BELOW */
+
+
+#define XKB_KEY_EcuSign 0x10020a0 /* U+20A0 EURO-CURRENCY SIGN */
+#define XKB_KEY_ColonSign 0x10020a1 /* U+20A1 COLON SIGN */
+#define XKB_KEY_CruzeiroSign 0x10020a2 /* U+20A2 CRUZEIRO SIGN */
+#define XKB_KEY_FFrancSign 0x10020a3 /* U+20A3 FRENCH FRANC SIGN */
+#define XKB_KEY_LiraSign 0x10020a4 /* U+20A4 LIRA SIGN */
+#define XKB_KEY_MillSign 0x10020a5 /* U+20A5 MILL SIGN */
+#define XKB_KEY_NairaSign 0x10020a6 /* U+20A6 NAIRA SIGN */
+#define XKB_KEY_PesetaSign 0x10020a7 /* U+20A7 PESETA SIGN */
+#define XKB_KEY_RupeeSign 0x10020a8 /* U+20A8 RUPEE SIGN */
+#define XKB_KEY_WonSign 0x10020a9 /* U+20A9 WON SIGN */
+#define XKB_KEY_NewSheqelSign 0x10020aa /* U+20AA NEW SHEQEL SIGN */
+#define XKB_KEY_DongSign 0x10020ab /* U+20AB DONG SIGN */
+#define XKB_KEY_EuroSign 0x20ac /* U+20AC EURO SIGN */
+
+/* one, two and three are defined above. */
+#define XKB_KEY_zerosuperior 0x1002070 /* U+2070 SUPERSCRIPT ZERO */
+#define XKB_KEY_foursuperior 0x1002074 /* U+2074 SUPERSCRIPT FOUR */
+#define XKB_KEY_fivesuperior 0x1002075 /* U+2075 SUPERSCRIPT FIVE */
+#define XKB_KEY_sixsuperior 0x1002076 /* U+2076 SUPERSCRIPT SIX */
+#define XKB_KEY_sevensuperior 0x1002077 /* U+2077 SUPERSCRIPT SEVEN */
+#define XKB_KEY_eightsuperior 0x1002078 /* U+2078 SUPERSCRIPT EIGHT */
+#define XKB_KEY_ninesuperior 0x1002079 /* U+2079 SUPERSCRIPT NINE */
+#define XKB_KEY_zerosubscript 0x1002080 /* U+2080 SUBSCRIPT ZERO */
+#define XKB_KEY_onesubscript 0x1002081 /* U+2081 SUBSCRIPT ONE */
+#define XKB_KEY_twosubscript 0x1002082 /* U+2082 SUBSCRIPT TWO */
+#define XKB_KEY_threesubscript 0x1002083 /* U+2083 SUBSCRIPT THREE */
+#define XKB_KEY_foursubscript 0x1002084 /* U+2084 SUBSCRIPT FOUR */
+#define XKB_KEY_fivesubscript 0x1002085 /* U+2085 SUBSCRIPT FIVE */
+#define XKB_KEY_sixsubscript 0x1002086 /* U+2086 SUBSCRIPT SIX */
+#define XKB_KEY_sevensubscript 0x1002087 /* U+2087 SUBSCRIPT SEVEN */
+#define XKB_KEY_eightsubscript 0x1002088 /* U+2088 SUBSCRIPT EIGHT */
+#define XKB_KEY_ninesubscript 0x1002089 /* U+2089 SUBSCRIPT NINE */
+#define XKB_KEY_partdifferential 0x1002202 /* U+2202 PARTIAL DIFFERENTIAL */
+#define XKB_KEY_emptyset 0x1002205 /* U+2205 NULL SET */
+#define XKB_KEY_elementof 0x1002208 /* U+2208 ELEMENT OF */
+#define XKB_KEY_notelementof 0x1002209 /* U+2209 NOT AN ELEMENT OF */
+#define XKB_KEY_containsas 0x100220B /* U+220B CONTAINS AS MEMBER */
+#define XKB_KEY_squareroot 0x100221A /* U+221A SQUARE ROOT */
+#define XKB_KEY_cuberoot 0x100221B /* U+221B CUBE ROOT */
+#define XKB_KEY_fourthroot 0x100221C /* U+221C FOURTH ROOT */
+#define XKB_KEY_dintegral 0x100222C /* U+222C DOUBLE INTEGRAL */
+#define XKB_KEY_tintegral 0x100222D /* U+222D TRIPLE INTEGRAL */
+#define XKB_KEY_because 0x1002235 /* U+2235 BECAUSE */
+#define XKB_KEY_approxeq 0x1002248 /*(U+2248 ALMOST EQUAL TO)*/
+#define XKB_KEY_notapproxeq 0x1002247 /*(U+2247 NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO)*/
+#define XKB_KEY_notidentical 0x1002262 /* U+2262 NOT IDENTICAL TO */
+#define XKB_KEY_stricteq 0x1002263 /* U+2263 STRICTLY EQUIVALENT TO */
+
+#define XKB_KEY_braille_dot_1 0xfff1
+#define XKB_KEY_braille_dot_2 0xfff2
+#define XKB_KEY_braille_dot_3 0xfff3
+#define XKB_KEY_braille_dot_4 0xfff4
+#define XKB_KEY_braille_dot_5 0xfff5
+#define XKB_KEY_braille_dot_6 0xfff6
+#define XKB_KEY_braille_dot_7 0xfff7
+#define XKB_KEY_braille_dot_8 0xfff8
+#define XKB_KEY_braille_dot_9 0xfff9
+#define XKB_KEY_braille_dot_10 0xfffa
+#define XKB_KEY_braille_blank 0x1002800 /* U+2800 BRAILLE PATTERN BLANK */
+#define XKB_KEY_braille_dots_1 0x1002801 /* U+2801 BRAILLE PATTERN DOTS-1 */
+#define XKB_KEY_braille_dots_2 0x1002802 /* U+2802 BRAILLE PATTERN DOTS-2 */
+#define XKB_KEY_braille_dots_12 0x1002803 /* U+2803 BRAILLE PATTERN DOTS-12 */
+#define XKB_KEY_braille_dots_3 0x1002804 /* U+2804 BRAILLE PATTERN DOTS-3 */
+#define XKB_KEY_braille_dots_13 0x1002805 /* U+2805 BRAILLE PATTERN DOTS-13 */
+#define XKB_KEY_braille_dots_23 0x1002806 /* U+2806 BRAILLE PATTERN DOTS-23 */
+#define XKB_KEY_braille_dots_123 0x1002807 /* U+2807 BRAILLE PATTERN DOTS-123 */
+#define XKB_KEY_braille_dots_4 0x1002808 /* U+2808 BRAILLE PATTERN DOTS-4 */
+#define XKB_KEY_braille_dots_14 0x1002809 /* U+2809 BRAILLE PATTERN DOTS-14 */
+#define XKB_KEY_braille_dots_24 0x100280a /* U+280a BRAILLE PATTERN DOTS-24 */
+#define XKB_KEY_braille_dots_124 0x100280b /* U+280b BRAILLE PATTERN DOTS-124 */
+#define XKB_KEY_braille_dots_34 0x100280c /* U+280c BRAILLE PATTERN DOTS-34 */
+#define XKB_KEY_braille_dots_134 0x100280d /* U+280d BRAILLE PATTERN DOTS-134 */
+#define XKB_KEY_braille_dots_234 0x100280e /* U+280e BRAILLE PATTERN DOTS-234 */
+#define XKB_KEY_braille_dots_1234 0x100280f /* U+280f BRAILLE PATTERN DOTS-1234 */
+#define XKB_KEY_braille_dots_5 0x1002810 /* U+2810 BRAILLE PATTERN DOTS-5 */
+#define XKB_KEY_braille_dots_15 0x1002811 /* U+2811 BRAILLE PATTERN DOTS-15 */
+#define XKB_KEY_braille_dots_25 0x1002812 /* U+2812 BRAILLE PATTERN DOTS-25 */
+#define XKB_KEY_braille_dots_125 0x1002813 /* U+2813 BRAILLE PATTERN DOTS-125 */
+#define XKB_KEY_braille_dots_35 0x1002814 /* U+2814 BRAILLE PATTERN DOTS-35 */
+#define XKB_KEY_braille_dots_135 0x1002815 /* U+2815 BRAILLE PATTERN DOTS-135 */
+#define XKB_KEY_braille_dots_235 0x1002816 /* U+2816 BRAILLE PATTERN DOTS-235 */
+#define XKB_KEY_braille_dots_1235 0x1002817 /* U+2817 BRAILLE PATTERN DOTS-1235 */
+#define XKB_KEY_braille_dots_45 0x1002818 /* U+2818 BRAILLE PATTERN DOTS-45 */
+#define XKB_KEY_braille_dots_145 0x1002819 /* U+2819 BRAILLE PATTERN DOTS-145 */
+#define XKB_KEY_braille_dots_245 0x100281a /* U+281a BRAILLE PATTERN DOTS-245 */
+#define XKB_KEY_braille_dots_1245 0x100281b /* U+281b BRAILLE PATTERN DOTS-1245 */
+#define XKB_KEY_braille_dots_345 0x100281c /* U+281c BRAILLE PATTERN DOTS-345 */
+#define XKB_KEY_braille_dots_1345 0x100281d /* U+281d BRAILLE PATTERN DOTS-1345 */
+#define XKB_KEY_braille_dots_2345 0x100281e /* U+281e BRAILLE PATTERN DOTS-2345 */
+#define XKB_KEY_braille_dots_12345 0x100281f /* U+281f BRAILLE PATTERN DOTS-12345 */
+#define XKB_KEY_braille_dots_6 0x1002820 /* U+2820 BRAILLE PATTERN DOTS-6 */
+#define XKB_KEY_braille_dots_16 0x1002821 /* U+2821 BRAILLE PATTERN DOTS-16 */
+#define XKB_KEY_braille_dots_26 0x1002822 /* U+2822 BRAILLE PATTERN DOTS-26 */
+#define XKB_KEY_braille_dots_126 0x1002823 /* U+2823 BRAILLE PATTERN DOTS-126 */
+#define XKB_KEY_braille_dots_36 0x1002824 /* U+2824 BRAILLE PATTERN DOTS-36 */
+#define XKB_KEY_braille_dots_136 0x1002825 /* U+2825 BRAILLE PATTERN DOTS-136 */
+#define XKB_KEY_braille_dots_236 0x1002826 /* U+2826 BRAILLE PATTERN DOTS-236 */
+#define XKB_KEY_braille_dots_1236 0x1002827 /* U+2827 BRAILLE PATTERN DOTS-1236 */
+#define XKB_KEY_braille_dots_46 0x1002828 /* U+2828 BRAILLE PATTERN DOTS-46 */
+#define XKB_KEY_braille_dots_146 0x1002829 /* U+2829 BRAILLE PATTERN DOTS-146 */
+#define XKB_KEY_braille_dots_246 0x100282a /* U+282a BRAILLE PATTERN DOTS-246 */
+#define XKB_KEY_braille_dots_1246 0x100282b /* U+282b BRAILLE PATTERN DOTS-1246 */
+#define XKB_KEY_braille_dots_346 0x100282c /* U+282c BRAILLE PATTERN DOTS-346 */
+#define XKB_KEY_braille_dots_1346 0x100282d /* U+282d BRAILLE PATTERN DOTS-1346 */
+#define XKB_KEY_braille_dots_2346 0x100282e /* U+282e BRAILLE PATTERN DOTS-2346 */
+#define XKB_KEY_braille_dots_12346 0x100282f /* U+282f BRAILLE PATTERN DOTS-12346 */
+#define XKB_KEY_braille_dots_56 0x1002830 /* U+2830 BRAILLE PATTERN DOTS-56 */
+#define XKB_KEY_braille_dots_156 0x1002831 /* U+2831 BRAILLE PATTERN DOTS-156 */
+#define XKB_KEY_braille_dots_256 0x1002832 /* U+2832 BRAILLE PATTERN DOTS-256 */
+#define XKB_KEY_braille_dots_1256 0x1002833 /* U+2833 BRAILLE PATTERN DOTS-1256 */
+#define XKB_KEY_braille_dots_356 0x1002834 /* U+2834 BRAILLE PATTERN DOTS-356 */
+#define XKB_KEY_braille_dots_1356 0x1002835 /* U+2835 BRAILLE PATTERN DOTS-1356 */
+#define XKB_KEY_braille_dots_2356 0x1002836 /* U+2836 BRAILLE PATTERN DOTS-2356 */
+#define XKB_KEY_braille_dots_12356 0x1002837 /* U+2837 BRAILLE PATTERN DOTS-12356 */
+#define XKB_KEY_braille_dots_456 0x1002838 /* U+2838 BRAILLE PATTERN DOTS-456 */
+#define XKB_KEY_braille_dots_1456 0x1002839 /* U+2839 BRAILLE PATTERN DOTS-1456 */
+#define XKB_KEY_braille_dots_2456 0x100283a /* U+283a BRAILLE PATTERN DOTS-2456 */
+#define XKB_KEY_braille_dots_12456 0x100283b /* U+283b BRAILLE PATTERN DOTS-12456 */
+#define XKB_KEY_braille_dots_3456 0x100283c /* U+283c BRAILLE PATTERN DOTS-3456 */
+#define XKB_KEY_braille_dots_13456 0x100283d /* U+283d BRAILLE PATTERN DOTS-13456 */
+#define XKB_KEY_braille_dots_23456 0x100283e /* U+283e BRAILLE PATTERN DOTS-23456 */
+#define XKB_KEY_braille_dots_123456 0x100283f /* U+283f BRAILLE PATTERN DOTS-123456 */
+#define XKB_KEY_braille_dots_7 0x1002840 /* U+2840 BRAILLE PATTERN DOTS-7 */
+#define XKB_KEY_braille_dots_17 0x1002841 /* U+2841 BRAILLE PATTERN DOTS-17 */
+#define XKB_KEY_braille_dots_27 0x1002842 /* U+2842 BRAILLE PATTERN DOTS-27 */
+#define XKB_KEY_braille_dots_127 0x1002843 /* U+2843 BRAILLE PATTERN DOTS-127 */
+#define XKB_KEY_braille_dots_37 0x1002844 /* U+2844 BRAILLE PATTERN DOTS-37 */
+#define XKB_KEY_braille_dots_137 0x1002845 /* U+2845 BRAILLE PATTERN DOTS-137 */
+#define XKB_KEY_braille_dots_237 0x1002846 /* U+2846 BRAILLE PATTERN DOTS-237 */
+#define XKB_KEY_braille_dots_1237 0x1002847 /* U+2847 BRAILLE PATTERN DOTS-1237 */
+#define XKB_KEY_braille_dots_47 0x1002848 /* U+2848 BRAILLE PATTERN DOTS-47 */
+#define XKB_KEY_braille_dots_147 0x1002849 /* U+2849 BRAILLE PATTERN DOTS-147 */
+#define XKB_KEY_braille_dots_247 0x100284a /* U+284a BRAILLE PATTERN DOTS-247 */
+#define XKB_KEY_braille_dots_1247 0x100284b /* U+284b BRAILLE PATTERN DOTS-1247 */
+#define XKB_KEY_braille_dots_347 0x100284c /* U+284c BRAILLE PATTERN DOTS-347 */
+#define XKB_KEY_braille_dots_1347 0x100284d /* U+284d BRAILLE PATTERN DOTS-1347 */
+#define XKB_KEY_braille_dots_2347 0x100284e /* U+284e BRAILLE PATTERN DOTS-2347 */
+#define XKB_KEY_braille_dots_12347 0x100284f /* U+284f BRAILLE PATTERN DOTS-12347 */
+#define XKB_KEY_braille_dots_57 0x1002850 /* U+2850 BRAILLE PATTERN DOTS-57 */
+#define XKB_KEY_braille_dots_157 0x1002851 /* U+2851 BRAILLE PATTERN DOTS-157 */
+#define XKB_KEY_braille_dots_257 0x1002852 /* U+2852 BRAILLE PATTERN DOTS-257 */
+#define XKB_KEY_braille_dots_1257 0x1002853 /* U+2853 BRAILLE PATTERN DOTS-1257 */
+#define XKB_KEY_braille_dots_357 0x1002854 /* U+2854 BRAILLE PATTERN DOTS-357 */
+#define XKB_KEY_braille_dots_1357 0x1002855 /* U+2855 BRAILLE PATTERN DOTS-1357 */
+#define XKB_KEY_braille_dots_2357 0x1002856 /* U+2856 BRAILLE PATTERN DOTS-2357 */
+#define XKB_KEY_braille_dots_12357 0x1002857 /* U+2857 BRAILLE PATTERN DOTS-12357 */
+#define XKB_KEY_braille_dots_457 0x1002858 /* U+2858 BRAILLE PATTERN DOTS-457 */
+#define XKB_KEY_braille_dots_1457 0x1002859 /* U+2859 BRAILLE PATTERN DOTS-1457 */
+#define XKB_KEY_braille_dots_2457 0x100285a /* U+285a BRAILLE PATTERN DOTS-2457 */
+#define XKB_KEY_braille_dots_12457 0x100285b /* U+285b BRAILLE PATTERN DOTS-12457 */
+#define XKB_KEY_braille_dots_3457 0x100285c /* U+285c BRAILLE PATTERN DOTS-3457 */
+#define XKB_KEY_braille_dots_13457 0x100285d /* U+285d BRAILLE PATTERN DOTS-13457 */
+#define XKB_KEY_braille_dots_23457 0x100285e /* U+285e BRAILLE PATTERN DOTS-23457 */
+#define XKB_KEY_braille_dots_123457 0x100285f /* U+285f BRAILLE PATTERN DOTS-123457 */
+#define XKB_KEY_braille_dots_67 0x1002860 /* U+2860 BRAILLE PATTERN DOTS-67 */
+#define XKB_KEY_braille_dots_167 0x1002861 /* U+2861 BRAILLE PATTERN DOTS-167 */
+#define XKB_KEY_braille_dots_267 0x1002862 /* U+2862 BRAILLE PATTERN DOTS-267 */
+#define XKB_KEY_braille_dots_1267 0x1002863 /* U+2863 BRAILLE PATTERN DOTS-1267 */
+#define XKB_KEY_braille_dots_367 0x1002864 /* U+2864 BRAILLE PATTERN DOTS-367 */
+#define XKB_KEY_braille_dots_1367 0x1002865 /* U+2865 BRAILLE PATTERN DOTS-1367 */
+#define XKB_KEY_braille_dots_2367 0x1002866 /* U+2866 BRAILLE PATTERN DOTS-2367 */
+#define XKB_KEY_braille_dots_12367 0x1002867 /* U+2867 BRAILLE PATTERN DOTS-12367 */
+#define XKB_KEY_braille_dots_467 0x1002868 /* U+2868 BRAILLE PATTERN DOTS-467 */
+#define XKB_KEY_braille_dots_1467 0x1002869 /* U+2869 BRAILLE PATTERN DOTS-1467 */
+#define XKB_KEY_braille_dots_2467 0x100286a /* U+286a BRAILLE PATTERN DOTS-2467 */
+#define XKB_KEY_braille_dots_12467 0x100286b /* U+286b BRAILLE PATTERN DOTS-12467 */
+#define XKB_KEY_braille_dots_3467 0x100286c /* U+286c BRAILLE PATTERN DOTS-3467 */
+#define XKB_KEY_braille_dots_13467 0x100286d /* U+286d BRAILLE PATTERN DOTS-13467 */
+#define XKB_KEY_braille_dots_23467 0x100286e /* U+286e BRAILLE PATTERN DOTS-23467 */
+#define XKB_KEY_braille_dots_123467 0x100286f /* U+286f BRAILLE PATTERN DOTS-123467 */
+#define XKB_KEY_braille_dots_567 0x1002870 /* U+2870 BRAILLE PATTERN DOTS-567 */
+#define XKB_KEY_braille_dots_1567 0x1002871 /* U+2871 BRAILLE PATTERN DOTS-1567 */
+#define XKB_KEY_braille_dots_2567 0x1002872 /* U+2872 BRAILLE PATTERN DOTS-2567 */
+#define XKB_KEY_braille_dots_12567 0x1002873 /* U+2873 BRAILLE PATTERN DOTS-12567 */
+#define XKB_KEY_braille_dots_3567 0x1002874 /* U+2874 BRAILLE PATTERN DOTS-3567 */
+#define XKB_KEY_braille_dots_13567 0x1002875 /* U+2875 BRAILLE PATTERN DOTS-13567 */
+#define XKB_KEY_braille_dots_23567 0x1002876 /* U+2876 BRAILLE PATTERN DOTS-23567 */
+#define XKB_KEY_braille_dots_123567 0x1002877 /* U+2877 BRAILLE PATTERN DOTS-123567 */
+#define XKB_KEY_braille_dots_4567 0x1002878 /* U+2878 BRAILLE PATTERN DOTS-4567 */
+#define XKB_KEY_braille_dots_14567 0x1002879 /* U+2879 BRAILLE PATTERN DOTS-14567 */
+#define XKB_KEY_braille_dots_24567 0x100287a /* U+287a BRAILLE PATTERN DOTS-24567 */
+#define XKB_KEY_braille_dots_124567 0x100287b /* U+287b BRAILLE PATTERN DOTS-124567 */
+#define XKB_KEY_braille_dots_34567 0x100287c /* U+287c BRAILLE PATTERN DOTS-34567 */
+#define XKB_KEY_braille_dots_134567 0x100287d /* U+287d BRAILLE PATTERN DOTS-134567 */
+#define XKB_KEY_braille_dots_234567 0x100287e /* U+287e BRAILLE PATTERN DOTS-234567 */
+#define XKB_KEY_braille_dots_1234567 0x100287f /* U+287f BRAILLE PATTERN DOTS-1234567 */
+#define XKB_KEY_braille_dots_8 0x1002880 /* U+2880 BRAILLE PATTERN DOTS-8 */
+#define XKB_KEY_braille_dots_18 0x1002881 /* U+2881 BRAILLE PATTERN DOTS-18 */
+#define XKB_KEY_braille_dots_28 0x1002882 /* U+2882 BRAILLE PATTERN DOTS-28 */
+#define XKB_KEY_braille_dots_128 0x1002883 /* U+2883 BRAILLE PATTERN DOTS-128 */
+#define XKB_KEY_braille_dots_38 0x1002884 /* U+2884 BRAILLE PATTERN DOTS-38 */
+#define XKB_KEY_braille_dots_138 0x1002885 /* U+2885 BRAILLE PATTERN DOTS-138 */
+#define XKB_KEY_braille_dots_238 0x1002886 /* U+2886 BRAILLE PATTERN DOTS-238 */
+#define XKB_KEY_braille_dots_1238 0x1002887 /* U+2887 BRAILLE PATTERN DOTS-1238 */
+#define XKB_KEY_braille_dots_48 0x1002888 /* U+2888 BRAILLE PATTERN DOTS-48 */
+#define XKB_KEY_braille_dots_148 0x1002889 /* U+2889 BRAILLE PATTERN DOTS-148 */
+#define XKB_KEY_braille_dots_248 0x100288a /* U+288a BRAILLE PATTERN DOTS-248 */
+#define XKB_KEY_braille_dots_1248 0x100288b /* U+288b BRAILLE PATTERN DOTS-1248 */
+#define XKB_KEY_braille_dots_348 0x100288c /* U+288c BRAILLE PATTERN DOTS-348 */
+#define XKB_KEY_braille_dots_1348 0x100288d /* U+288d BRAILLE PATTERN DOTS-1348 */
+#define XKB_KEY_braille_dots_2348 0x100288e /* U+288e BRAILLE PATTERN DOTS-2348 */
+#define XKB_KEY_braille_dots_12348 0x100288f /* U+288f BRAILLE PATTERN DOTS-12348 */
+#define XKB_KEY_braille_dots_58 0x1002890 /* U+2890 BRAILLE PATTERN DOTS-58 */
+#define XKB_KEY_braille_dots_158 0x1002891 /* U+2891 BRAILLE PATTERN DOTS-158 */
+#define XKB_KEY_braille_dots_258 0x1002892 /* U+2892 BRAILLE PATTERN DOTS-258 */
+#define XKB_KEY_braille_dots_1258 0x1002893 /* U+2893 BRAILLE PATTERN DOTS-1258 */
+#define XKB_KEY_braille_dots_358 0x1002894 /* U+2894 BRAILLE PATTERN DOTS-358 */
+#define XKB_KEY_braille_dots_1358 0x1002895 /* U+2895 BRAILLE PATTERN DOTS-1358 */
+#define XKB_KEY_braille_dots_2358 0x1002896 /* U+2896 BRAILLE PATTERN DOTS-2358 */
+#define XKB_KEY_braille_dots_12358 0x1002897 /* U+2897 BRAILLE PATTERN DOTS-12358 */
+#define XKB_KEY_braille_dots_458 0x1002898 /* U+2898 BRAILLE PATTERN DOTS-458 */
+#define XKB_KEY_braille_dots_1458 0x1002899 /* U+2899 BRAILLE PATTERN DOTS-1458 */
+#define XKB_KEY_braille_dots_2458 0x100289a /* U+289a BRAILLE PATTERN DOTS-2458 */
+#define XKB_KEY_braille_dots_12458 0x100289b /* U+289b BRAILLE PATTERN DOTS-12458 */
+#define XKB_KEY_braille_dots_3458 0x100289c /* U+289c BRAILLE PATTERN DOTS-3458 */
+#define XKB_KEY_braille_dots_13458 0x100289d /* U+289d BRAILLE PATTERN DOTS-13458 */
+#define XKB_KEY_braille_dots_23458 0x100289e /* U+289e BRAILLE PATTERN DOTS-23458 */
+#define XKB_KEY_braille_dots_123458 0x100289f /* U+289f BRAILLE PATTERN DOTS-123458 */
+#define XKB_KEY_braille_dots_68 0x10028a0 /* U+28a0 BRAILLE PATTERN DOTS-68 */
+#define XKB_KEY_braille_dots_168 0x10028a1 /* U+28a1 BRAILLE PATTERN DOTS-168 */
+#define XKB_KEY_braille_dots_268 0x10028a2 /* U+28a2 BRAILLE PATTERN DOTS-268 */
+#define XKB_KEY_braille_dots_1268 0x10028a3 /* U+28a3 BRAILLE PATTERN DOTS-1268 */
+#define XKB_KEY_braille_dots_368 0x10028a4 /* U+28a4 BRAILLE PATTERN DOTS-368 */
+#define XKB_KEY_braille_dots_1368 0x10028a5 /* U+28a5 BRAILLE PATTERN DOTS-1368 */
+#define XKB_KEY_braille_dots_2368 0x10028a6 /* U+28a6 BRAILLE PATTERN DOTS-2368 */
+#define XKB_KEY_braille_dots_12368 0x10028a7 /* U+28a7 BRAILLE PATTERN DOTS-12368 */
+#define XKB_KEY_braille_dots_468 0x10028a8 /* U+28a8 BRAILLE PATTERN DOTS-468 */
+#define XKB_KEY_braille_dots_1468 0x10028a9 /* U+28a9 BRAILLE PATTERN DOTS-1468 */
+#define XKB_KEY_braille_dots_2468 0x10028aa /* U+28aa BRAILLE PATTERN DOTS-2468 */
+#define XKB_KEY_braille_dots_12468 0x10028ab /* U+28ab BRAILLE PATTERN DOTS-12468 */
+#define XKB_KEY_braille_dots_3468 0x10028ac /* U+28ac BRAILLE PATTERN DOTS-3468 */
+#define XKB_KEY_braille_dots_13468 0x10028ad /* U+28ad BRAILLE PATTERN DOTS-13468 */
+#define XKB_KEY_braille_dots_23468 0x10028ae /* U+28ae BRAILLE PATTERN DOTS-23468 */
+#define XKB_KEY_braille_dots_123468 0x10028af /* U+28af BRAILLE PATTERN DOTS-123468 */
+#define XKB_KEY_braille_dots_568 0x10028b0 /* U+28b0 BRAILLE PATTERN DOTS-568 */
+#define XKB_KEY_braille_dots_1568 0x10028b1 /* U+28b1 BRAILLE PATTERN DOTS-1568 */
+#define XKB_KEY_braille_dots_2568 0x10028b2 /* U+28b2 BRAILLE PATTERN DOTS-2568 */
+#define XKB_KEY_braille_dots_12568 0x10028b3 /* U+28b3 BRAILLE PATTERN DOTS-12568 */
+#define XKB_KEY_braille_dots_3568 0x10028b4 /* U+28b4 BRAILLE PATTERN DOTS-3568 */
+#define XKB_KEY_braille_dots_13568 0x10028b5 /* U+28b5 BRAILLE PATTERN DOTS-13568 */
+#define XKB_KEY_braille_dots_23568 0x10028b6 /* U+28b6 BRAILLE PATTERN DOTS-23568 */
+#define XKB_KEY_braille_dots_123568 0x10028b7 /* U+28b7 BRAILLE PATTERN DOTS-123568 */
+#define XKB_KEY_braille_dots_4568 0x10028b8 /* U+28b8 BRAILLE PATTERN DOTS-4568 */
+#define XKB_KEY_braille_dots_14568 0x10028b9 /* U+28b9 BRAILLE PATTERN DOTS-14568 */
+#define XKB_KEY_braille_dots_24568 0x10028ba /* U+28ba BRAILLE PATTERN DOTS-24568 */
+#define XKB_KEY_braille_dots_124568 0x10028bb /* U+28bb BRAILLE PATTERN DOTS-124568 */
+#define XKB_KEY_braille_dots_34568 0x10028bc /* U+28bc BRAILLE PATTERN DOTS-34568 */
+#define XKB_KEY_braille_dots_134568 0x10028bd /* U+28bd BRAILLE PATTERN DOTS-134568 */
+#define XKB_KEY_braille_dots_234568 0x10028be /* U+28be BRAILLE PATTERN DOTS-234568 */
+#define XKB_KEY_braille_dots_1234568 0x10028bf /* U+28bf BRAILLE PATTERN DOTS-1234568 */
+#define XKB_KEY_braille_dots_78 0x10028c0 /* U+28c0 BRAILLE PATTERN DOTS-78 */
+#define XKB_KEY_braille_dots_178 0x10028c1 /* U+28c1 BRAILLE PATTERN DOTS-178 */
+#define XKB_KEY_braille_dots_278 0x10028c2 /* U+28c2 BRAILLE PATTERN DOTS-278 */
+#define XKB_KEY_braille_dots_1278 0x10028c3 /* U+28c3 BRAILLE PATTERN DOTS-1278 */
+#define XKB_KEY_braille_dots_378 0x10028c4 /* U+28c4 BRAILLE PATTERN DOTS-378 */
+#define XKB_KEY_braille_dots_1378 0x10028c5 /* U+28c5 BRAILLE PATTERN DOTS-1378 */
+#define XKB_KEY_braille_dots_2378 0x10028c6 /* U+28c6 BRAILLE PATTERN DOTS-2378 */
+#define XKB_KEY_braille_dots_12378 0x10028c7 /* U+28c7 BRAILLE PATTERN DOTS-12378 */
+#define XKB_KEY_braille_dots_478 0x10028c8 /* U+28c8 BRAILLE PATTERN DOTS-478 */
+#define XKB_KEY_braille_dots_1478 0x10028c9 /* U+28c9 BRAILLE PATTERN DOTS-1478 */
+#define XKB_KEY_braille_dots_2478 0x10028ca /* U+28ca BRAILLE PATTERN DOTS-2478 */
+#define XKB_KEY_braille_dots_12478 0x10028cb /* U+28cb BRAILLE PATTERN DOTS-12478 */
+#define XKB_KEY_braille_dots_3478 0x10028cc /* U+28cc BRAILLE PATTERN DOTS-3478 */
+#define XKB_KEY_braille_dots_13478 0x10028cd /* U+28cd BRAILLE PATTERN DOTS-13478 */
+#define XKB_KEY_braille_dots_23478 0x10028ce /* U+28ce BRAILLE PATTERN DOTS-23478 */
+#define XKB_KEY_braille_dots_123478 0x10028cf /* U+28cf BRAILLE PATTERN DOTS-123478 */
+#define XKB_KEY_braille_dots_578 0x10028d0 /* U+28d0 BRAILLE PATTERN DOTS-578 */
+#define XKB_KEY_braille_dots_1578 0x10028d1 /* U+28d1 BRAILLE PATTERN DOTS-1578 */
+#define XKB_KEY_braille_dots_2578 0x10028d2 /* U+28d2 BRAILLE PATTERN DOTS-2578 */
+#define XKB_KEY_braille_dots_12578 0x10028d3 /* U+28d3 BRAILLE PATTERN DOTS-12578 */
+#define XKB_KEY_braille_dots_3578 0x10028d4 /* U+28d4 BRAILLE PATTERN DOTS-3578 */
+#define XKB_KEY_braille_dots_13578 0x10028d5 /* U+28d5 BRAILLE PATTERN DOTS-13578 */
+#define XKB_KEY_braille_dots_23578 0x10028d6 /* U+28d6 BRAILLE PATTERN DOTS-23578 */
+#define XKB_KEY_braille_dots_123578 0x10028d7 /* U+28d7 BRAILLE PATTERN DOTS-123578 */
+#define XKB_KEY_braille_dots_4578 0x10028d8 /* U+28d8 BRAILLE PATTERN DOTS-4578 */
+#define XKB_KEY_braille_dots_14578 0x10028d9 /* U+28d9 BRAILLE PATTERN DOTS-14578 */
+#define XKB_KEY_braille_dots_24578 0x10028da /* U+28da BRAILLE PATTERN DOTS-24578 */
+#define XKB_KEY_braille_dots_124578 0x10028db /* U+28db BRAILLE PATTERN DOTS-124578 */
+#define XKB_KEY_braille_dots_34578 0x10028dc /* U+28dc BRAILLE PATTERN DOTS-34578 */
+#define XKB_KEY_braille_dots_134578 0x10028dd /* U+28dd BRAILLE PATTERN DOTS-134578 */
+#define XKB_KEY_braille_dots_234578 0x10028de /* U+28de BRAILLE PATTERN DOTS-234578 */
+#define XKB_KEY_braille_dots_1234578 0x10028df /* U+28df BRAILLE PATTERN DOTS-1234578 */
+#define XKB_KEY_braille_dots_678 0x10028e0 /* U+28e0 BRAILLE PATTERN DOTS-678 */
+#define XKB_KEY_braille_dots_1678 0x10028e1 /* U+28e1 BRAILLE PATTERN DOTS-1678 */
+#define XKB_KEY_braille_dots_2678 0x10028e2 /* U+28e2 BRAILLE PATTERN DOTS-2678 */
+#define XKB_KEY_braille_dots_12678 0x10028e3 /* U+28e3 BRAILLE PATTERN DOTS-12678 */
+#define XKB_KEY_braille_dots_3678 0x10028e4 /* U+28e4 BRAILLE PATTERN DOTS-3678 */
+#define XKB_KEY_braille_dots_13678 0x10028e5 /* U+28e5 BRAILLE PATTERN DOTS-13678 */
+#define XKB_KEY_braille_dots_23678 0x10028e6 /* U+28e6 BRAILLE PATTERN DOTS-23678 */
+#define XKB_KEY_braille_dots_123678 0x10028e7 /* U+28e7 BRAILLE PATTERN DOTS-123678 */
+#define XKB_KEY_braille_dots_4678 0x10028e8 /* U+28e8 BRAILLE PATTERN DOTS-4678 */
+#define XKB_KEY_braille_dots_14678 0x10028e9 /* U+28e9 BRAILLE PATTERN DOTS-14678 */
+#define XKB_KEY_braille_dots_24678 0x10028ea /* U+28ea BRAILLE PATTERN DOTS-24678 */
+#define XKB_KEY_braille_dots_124678 0x10028eb /* U+28eb BRAILLE PATTERN DOTS-124678 */
+#define XKB_KEY_braille_dots_34678 0x10028ec /* U+28ec BRAILLE PATTERN DOTS-34678 */
+#define XKB_KEY_braille_dots_134678 0x10028ed /* U+28ed BRAILLE PATTERN DOTS-134678 */
+#define XKB_KEY_braille_dots_234678 0x10028ee /* U+28ee BRAILLE PATTERN DOTS-234678 */
+#define XKB_KEY_braille_dots_1234678 0x10028ef /* U+28ef BRAILLE PATTERN DOTS-1234678 */
+#define XKB_KEY_braille_dots_5678 0x10028f0 /* U+28f0 BRAILLE PATTERN DOTS-5678 */
+#define XKB_KEY_braille_dots_15678 0x10028f1 /* U+28f1 BRAILLE PATTERN DOTS-15678 */
+#define XKB_KEY_braille_dots_25678 0x10028f2 /* U+28f2 BRAILLE PATTERN DOTS-25678 */
+#define XKB_KEY_braille_dots_125678 0x10028f3 /* U+28f3 BRAILLE PATTERN DOTS-125678 */
+#define XKB_KEY_braille_dots_35678 0x10028f4 /* U+28f4 BRAILLE PATTERN DOTS-35678 */
+#define XKB_KEY_braille_dots_135678 0x10028f5 /* U+28f5 BRAILLE PATTERN DOTS-135678 */
+#define XKB_KEY_braille_dots_235678 0x10028f6 /* U+28f6 BRAILLE PATTERN DOTS-235678 */
+#define XKB_KEY_braille_dots_1235678 0x10028f7 /* U+28f7 BRAILLE PATTERN DOTS-1235678 */
+#define XKB_KEY_braille_dots_45678 0x10028f8 /* U+28f8 BRAILLE PATTERN DOTS-45678 */
+#define XKB_KEY_braille_dots_145678 0x10028f9 /* U+28f9 BRAILLE PATTERN DOTS-145678 */
+#define XKB_KEY_braille_dots_245678 0x10028fa /* U+28fa BRAILLE PATTERN DOTS-245678 */
+#define XKB_KEY_braille_dots_1245678 0x10028fb /* U+28fb BRAILLE PATTERN DOTS-1245678 */
+#define XKB_KEY_braille_dots_345678 0x10028fc /* U+28fc BRAILLE PATTERN DOTS-345678 */
+#define XKB_KEY_braille_dots_1345678 0x10028fd /* U+28fd BRAILLE PATTERN DOTS-1345678 */
+#define XKB_KEY_braille_dots_2345678 0x10028fe /* U+28fe BRAILLE PATTERN DOTS-2345678 */
+#define XKB_KEY_braille_dots_12345678 0x10028ff /* U+28ff BRAILLE PATTERN DOTS-12345678 */
+
+/*
+ * Sinhala (http://unicode.org/charts/PDF/U0D80.pdf)
+ * http://www.nongnu.org/sinhala/doc/transliteration/sinhala-transliteration_6.html
+ */
+
+#define XKB_KEY_Sinh_ng 0x1000d82 /* U+0D82 SINHALA ANUSVARAYA */
+#define XKB_KEY_Sinh_h2 0x1000d83 /* U+0D83 SINHALA VISARGAYA */
+#define XKB_KEY_Sinh_a 0x1000d85 /* U+0D85 SINHALA AYANNA */
+#define XKB_KEY_Sinh_aa 0x1000d86 /* U+0D86 SINHALA AAYANNA */
+#define XKB_KEY_Sinh_ae 0x1000d87 /* U+0D87 SINHALA AEYANNA */
+#define XKB_KEY_Sinh_aee 0x1000d88 /* U+0D88 SINHALA AEEYANNA */
+#define XKB_KEY_Sinh_i 0x1000d89 /* U+0D89 SINHALA IYANNA */
+#define XKB_KEY_Sinh_ii 0x1000d8a /* U+0D8A SINHALA IIYANNA */
+#define XKB_KEY_Sinh_u 0x1000d8b /* U+0D8B SINHALA UYANNA */
+#define XKB_KEY_Sinh_uu 0x1000d8c /* U+0D8C SINHALA UUYANNA */
+#define XKB_KEY_Sinh_ri 0x1000d8d /* U+0D8D SINHALA IRUYANNA */
+#define XKB_KEY_Sinh_rii 0x1000d8e /* U+0D8E SINHALA IRUUYANNA */
+#define XKB_KEY_Sinh_lu 0x1000d8f /* U+0D8F SINHALA ILUYANNA */
+#define XKB_KEY_Sinh_luu 0x1000d90 /* U+0D90 SINHALA ILUUYANNA */
+#define XKB_KEY_Sinh_e 0x1000d91 /* U+0D91 SINHALA EYANNA */
+#define XKB_KEY_Sinh_ee 0x1000d92 /* U+0D92 SINHALA EEYANNA */
+#define XKB_KEY_Sinh_ai 0x1000d93 /* U+0D93 SINHALA AIYANNA */
+#define XKB_KEY_Sinh_o 0x1000d94 /* U+0D94 SINHALA OYANNA */
+#define XKB_KEY_Sinh_oo 0x1000d95 /* U+0D95 SINHALA OOYANNA */
+#define XKB_KEY_Sinh_au 0x1000d96 /* U+0D96 SINHALA AUYANNA */
+#define XKB_KEY_Sinh_ka 0x1000d9a /* U+0D9A SINHALA KAYANNA */
+#define XKB_KEY_Sinh_kha 0x1000d9b /* U+0D9B SINHALA MAHA. KAYANNA */
+#define XKB_KEY_Sinh_ga 0x1000d9c /* U+0D9C SINHALA GAYANNA */
+#define XKB_KEY_Sinh_gha 0x1000d9d /* U+0D9D SINHALA MAHA. GAYANNA */
+#define XKB_KEY_Sinh_ng2 0x1000d9e /* U+0D9E SINHALA KANTAJA NAASIKYAYA */
+#define XKB_KEY_Sinh_nga 0x1000d9f /* U+0D9F SINHALA SANYAKA GAYANNA */
+#define XKB_KEY_Sinh_ca 0x1000da0 /* U+0DA0 SINHALA CAYANNA */
+#define XKB_KEY_Sinh_cha 0x1000da1 /* U+0DA1 SINHALA MAHA. CAYANNA */
+#define XKB_KEY_Sinh_ja 0x1000da2 /* U+0DA2 SINHALA JAYANNA */
+#define XKB_KEY_Sinh_jha 0x1000da3 /* U+0DA3 SINHALA MAHA. JAYANNA */
+#define XKB_KEY_Sinh_nya 0x1000da4 /* U+0DA4 SINHALA TAALUJA NAASIKYAYA */
+#define XKB_KEY_Sinh_jnya 0x1000da5 /* U+0DA5 SINHALA TAALUJA SANYOOGA NAASIKYAYA */
+#define XKB_KEY_Sinh_nja 0x1000da6 /* U+0DA6 SINHALA SANYAKA JAYANNA */
+#define XKB_KEY_Sinh_tta 0x1000da7 /* U+0DA7 SINHALA TTAYANNA */
+#define XKB_KEY_Sinh_ttha 0x1000da8 /* U+0DA8 SINHALA MAHA. TTAYANNA */
+#define XKB_KEY_Sinh_dda 0x1000da9 /* U+0DA9 SINHALA DDAYANNA */
+#define XKB_KEY_Sinh_ddha 0x1000daa /* U+0DAA SINHALA MAHA. DDAYANNA */
+#define XKB_KEY_Sinh_nna 0x1000dab /* U+0DAB SINHALA MUURDHAJA NAYANNA */
+#define XKB_KEY_Sinh_ndda 0x1000dac /* U+0DAC SINHALA SANYAKA DDAYANNA */
+#define XKB_KEY_Sinh_tha 0x1000dad /* U+0DAD SINHALA TAYANNA */
+#define XKB_KEY_Sinh_thha 0x1000dae /* U+0DAE SINHALA MAHA. TAYANNA */
+#define XKB_KEY_Sinh_dha 0x1000daf /* U+0DAF SINHALA DAYANNA */
+#define XKB_KEY_Sinh_dhha 0x1000db0 /* U+0DB0 SINHALA MAHA. DAYANNA */
+#define XKB_KEY_Sinh_na 0x1000db1 /* U+0DB1 SINHALA DANTAJA NAYANNA */
+#define XKB_KEY_Sinh_ndha 0x1000db3 /* U+0DB3 SINHALA SANYAKA DAYANNA */
+#define XKB_KEY_Sinh_pa 0x1000db4 /* U+0DB4 SINHALA PAYANNA */
+#define XKB_KEY_Sinh_pha 0x1000db5 /* U+0DB5 SINHALA MAHA. PAYANNA */
+#define XKB_KEY_Sinh_ba 0x1000db6 /* U+0DB6 SINHALA BAYANNA */
+#define XKB_KEY_Sinh_bha 0x1000db7 /* U+0DB7 SINHALA MAHA. BAYANNA */
+#define XKB_KEY_Sinh_ma 0x1000db8 /* U+0DB8 SINHALA MAYANNA */
+#define XKB_KEY_Sinh_mba 0x1000db9 /* U+0DB9 SINHALA AMBA BAYANNA */
+#define XKB_KEY_Sinh_ya 0x1000dba /* U+0DBA SINHALA YAYANNA */
+#define XKB_KEY_Sinh_ra 0x1000dbb /* U+0DBB SINHALA RAYANNA */
+#define XKB_KEY_Sinh_la 0x1000dbd /* U+0DBD SINHALA DANTAJA LAYANNA */
+#define XKB_KEY_Sinh_va 0x1000dc0 /* U+0DC0 SINHALA VAYANNA */
+#define XKB_KEY_Sinh_sha 0x1000dc1 /* U+0DC1 SINHALA TAALUJA SAYANNA */
+#define XKB_KEY_Sinh_ssha 0x1000dc2 /* U+0DC2 SINHALA MUURDHAJA SAYANNA */
+#define XKB_KEY_Sinh_sa 0x1000dc3 /* U+0DC3 SINHALA DANTAJA SAYANNA */
+#define XKB_KEY_Sinh_ha 0x1000dc4 /* U+0DC4 SINHALA HAYANNA */
+#define XKB_KEY_Sinh_lla 0x1000dc5 /* U+0DC5 SINHALA MUURDHAJA LAYANNA */
+#define XKB_KEY_Sinh_fa 0x1000dc6 /* U+0DC6 SINHALA FAYANNA */
+#define XKB_KEY_Sinh_al 0x1000dca /* U+0DCA SINHALA AL-LAKUNA */
+#define XKB_KEY_Sinh_aa2 0x1000dcf /* U+0DCF SINHALA AELA-PILLA */
+#define XKB_KEY_Sinh_ae2 0x1000dd0 /* U+0DD0 SINHALA AEDA-PILLA */
+#define XKB_KEY_Sinh_aee2 0x1000dd1 /* U+0DD1 SINHALA DIGA AEDA-PILLA */
+#define XKB_KEY_Sinh_i2 0x1000dd2 /* U+0DD2 SINHALA IS-PILLA */
+#define XKB_KEY_Sinh_ii2 0x1000dd3 /* U+0DD3 SINHALA DIGA IS-PILLA */
+#define XKB_KEY_Sinh_u2 0x1000dd4 /* U+0DD4 SINHALA PAA-PILLA */
+#define XKB_KEY_Sinh_uu2 0x1000dd6 /* U+0DD6 SINHALA DIGA PAA-PILLA */
+#define XKB_KEY_Sinh_ru2 0x1000dd8 /* U+0DD8 SINHALA GAETTA-PILLA */
+#define XKB_KEY_Sinh_e2 0x1000dd9 /* U+0DD9 SINHALA KOMBUVA */
+#define XKB_KEY_Sinh_ee2 0x1000dda /* U+0DDA SINHALA DIGA KOMBUVA */
+#define XKB_KEY_Sinh_ai2 0x1000ddb /* U+0DDB SINHALA KOMBU DEKA */
+#define XKB_KEY_Sinh_o2 0x1000ddc /* U+0DDC SINHALA KOMBUVA HAA AELA-PILLA*/
+#define XKB_KEY_Sinh_oo2 0x1000ddd /* U+0DDD SINHALA KOMBUVA HAA DIGA AELA-PILLA*/
+#define XKB_KEY_Sinh_au2 0x1000dde /* U+0DDE SINHALA KOMBUVA HAA GAYANUKITTA */
+#define XKB_KEY_Sinh_lu2 0x1000ddf /* U+0DDF SINHALA GAYANUKITTA */
+#define XKB_KEY_Sinh_ruu2 0x1000df2 /* U+0DF2 SINHALA DIGA GAETTA-PILLA */
+#define XKB_KEY_Sinh_luu2 0x1000df3 /* U+0DF3 SINHALA DIGA GAYANUKITTA */
+#define XKB_KEY_Sinh_kunddaliya 0x1000df4 /* U+0DF4 SINHALA KUNDDALIYA */
+/*
+ * XFree86 vendor specific keysyms.
+ *
+ * The XFree86 keysym range is 0x10080001 - 0x1008FFFF.
+ *
+ * The XF86 set of keysyms is a catch-all set of defines for keysyms found
+ * on various multimedia keyboards. Originally specific to XFree86 they have
+ * been been adopted over time and are considered a "standard" part of X
+ * keysym definitions.
+ * XFree86 never properly commented these keysyms, so we have done our
+ * best to explain the semantic meaning of these keys.
+ *
+ * XFree86 has removed their mail archives of the period, that might have
+ * shed more light on some of these definitions. Until/unless we resurrect
+ * these archives, these are from memory and usage.
+ */
+
+/*
+ * ModeLock
+ *
+ * This one is old, and not really used any more since XKB offers this
+ * functionality.
+ */
+
+#define XKB_KEY_XF86ModeLock 0x1008FF01 /* Mode Switch Lock */
+
+/* Backlight controls. */
+#define XKB_KEY_XF86MonBrightnessUp 0x1008FF02 /* Monitor/panel brightness */
+#define XKB_KEY_XF86MonBrightnessDown 0x1008FF03 /* Monitor/panel brightness */
+#define XKB_KEY_XF86KbdLightOnOff 0x1008FF04 /* Keyboards may be lit */
+#define XKB_KEY_XF86KbdBrightnessUp 0x1008FF05 /* Keyboards may be lit */
+#define XKB_KEY_XF86KbdBrightnessDown 0x1008FF06 /* Keyboards may be lit */
+#define XKB_KEY_XF86MonBrightnessCycle 0x1008FF07 /* Monitor/panel brightness */
+
+/*
+ * Keys found on some "Internet" keyboards.
+ */
+#define XKB_KEY_XF86Standby 0x1008FF10 /* System into standby mode */
+#define XKB_KEY_XF86AudioLowerVolume 0x1008FF11 /* Volume control down */
+#define XKB_KEY_XF86AudioMute 0x1008FF12 /* Mute sound from the system */
+#define XKB_KEY_XF86AudioRaiseVolume 0x1008FF13 /* Volume control up */
+#define XKB_KEY_XF86AudioPlay 0x1008FF14 /* Start playing of audio > */
+#define XKB_KEY_XF86AudioStop 0x1008FF15 /* Stop playing audio */
+#define XKB_KEY_XF86AudioPrev 0x1008FF16 /* Previous track */
+#define XKB_KEY_XF86AudioNext 0x1008FF17 /* Next track */
+#define XKB_KEY_XF86HomePage 0x1008FF18 /* Display user's home page */
+#define XKB_KEY_XF86Mail 0x1008FF19 /* Invoke user's mail program */
+#define XKB_KEY_XF86Start 0x1008FF1A /* Start application */
+#define XKB_KEY_XF86Search 0x1008FF1B /* Search */
+#define XKB_KEY_XF86AudioRecord 0x1008FF1C /* Record audio application */
+
+/* These are sometimes found on PDA's (e.g. Palm, PocketPC or elsewhere) */
+#define XKB_KEY_XF86Calculator 0x1008FF1D /* Invoke calculator program */
+#define XKB_KEY_XF86Memo 0x1008FF1E /* Invoke Memo taking program */
+#define XKB_KEY_XF86ToDoList 0x1008FF1F /* Invoke To Do List program */
+#define XKB_KEY_XF86Calendar 0x1008FF20 /* Invoke Calendar program */
+#define XKB_KEY_XF86PowerDown 0x1008FF21 /* Deep sleep the system */
+#define XKB_KEY_XF86ContrastAdjust 0x1008FF22 /* Adjust screen contrast */
+#define XKB_KEY_XF86RockerUp 0x1008FF23 /* Rocker switches exist up */
+#define XKB_KEY_XF86RockerDown 0x1008FF24 /* and down */
+#define XKB_KEY_XF86RockerEnter 0x1008FF25 /* and let you press them */
+
+/* Some more "Internet" keyboard symbols */
+#define XKB_KEY_XF86Back 0x1008FF26 /* Like back on a browser */
+#define XKB_KEY_XF86Forward 0x1008FF27 /* Like forward on a browser */
+#define XKB_KEY_XF86Stop 0x1008FF28 /* Stop current operation */
+#define XKB_KEY_XF86Refresh 0x1008FF29 /* Refresh the page */
+#define XKB_KEY_XF86PowerOff 0x1008FF2A /* Power off system entirely */
+#define XKB_KEY_XF86WakeUp 0x1008FF2B /* Wake up system from sleep */
+#define XKB_KEY_XF86Eject 0x1008FF2C /* Eject device (e.g. DVD) */
+#define XKB_KEY_XF86ScreenSaver 0x1008FF2D /* Invoke screensaver */
+#define XKB_KEY_XF86WWW 0x1008FF2E /* Invoke web browser */
+#define XKB_KEY_XF86Sleep 0x1008FF2F /* Put system to sleep */
+#define XKB_KEY_XF86Favorites 0x1008FF30 /* Show favorite locations */
+#define XKB_KEY_XF86AudioPause 0x1008FF31 /* Pause audio playing */
+#define XKB_KEY_XF86AudioMedia 0x1008FF32 /* Launch media collection app */
+#define XKB_KEY_XF86MyComputer 0x1008FF33 /* Display "My Computer" window */
+#define XKB_KEY_XF86VendorHome 0x1008FF34 /* Display vendor home web site */
+#define XKB_KEY_XF86LightBulb 0x1008FF35 /* Light bulb keys exist */
+#define XKB_KEY_XF86Shop 0x1008FF36 /* Display shopping web site */
+#define XKB_KEY_XF86History 0x1008FF37 /* Show history of web surfing */
+#define XKB_KEY_XF86OpenURL 0x1008FF38 /* Open selected URL */
+#define XKB_KEY_XF86AddFavorite 0x1008FF39 /* Add URL to favorites list */
+#define XKB_KEY_XF86HotLinks 0x1008FF3A /* Show "hot" links */
+#define XKB_KEY_XF86BrightnessAdjust 0x1008FF3B /* Invoke brightness adj. UI */
+#define XKB_KEY_XF86Finance 0x1008FF3C /* Display financial site */
+#define XKB_KEY_XF86Community 0x1008FF3D /* Display user's community */
+#define XKB_KEY_XF86AudioRewind 0x1008FF3E /* "rewind" audio track */
+#define XKB_KEY_XF86BackForward 0x1008FF3F /* ??? */
+#define XKB_KEY_XF86Launch0 0x1008FF40 /* Launch Application */
+#define XKB_KEY_XF86Launch1 0x1008FF41 /* Launch Application */
+#define XKB_KEY_XF86Launch2 0x1008FF42 /* Launch Application */
+#define XKB_KEY_XF86Launch3 0x1008FF43 /* Launch Application */
+#define XKB_KEY_XF86Launch4 0x1008FF44 /* Launch Application */
+#define XKB_KEY_XF86Launch5 0x1008FF45 /* Launch Application */
+#define XKB_KEY_XF86Launch6 0x1008FF46 /* Launch Application */
+#define XKB_KEY_XF86Launch7 0x1008FF47 /* Launch Application */
+#define XKB_KEY_XF86Launch8 0x1008FF48 /* Launch Application */
+#define XKB_KEY_XF86Launch9 0x1008FF49 /* Launch Application */
+#define XKB_KEY_XF86LaunchA 0x1008FF4A /* Launch Application */
+#define XKB_KEY_XF86LaunchB 0x1008FF4B /* Launch Application */
+#define XKB_KEY_XF86LaunchC 0x1008FF4C /* Launch Application */
+#define XKB_KEY_XF86LaunchD 0x1008FF4D /* Launch Application */
+#define XKB_KEY_XF86LaunchE 0x1008FF4E /* Launch Application */
+#define XKB_KEY_XF86LaunchF 0x1008FF4F /* Launch Application */
+
+#define XKB_KEY_XF86ApplicationLeft 0x1008FF50 /* switch to application, left */
+#define XKB_KEY_XF86ApplicationRight 0x1008FF51 /* switch to application, right*/
+#define XKB_KEY_XF86Book 0x1008FF52 /* Launch bookreader */
+#define XKB_KEY_XF86CD 0x1008FF53 /* Launch CD/DVD player */
+#define XKB_KEY_XF86Calculater 0x1008FF54 /* Launch Calculater */
+#define XKB_KEY_XF86Clear 0x1008FF55 /* Clear window, screen */
+#define XKB_KEY_XF86Close 0x1008FF56 /* Close window */
+#define XKB_KEY_XF86Copy 0x1008FF57 /* Copy selection */
+#define XKB_KEY_XF86Cut 0x1008FF58 /* Cut selection */
+#define XKB_KEY_XF86Display 0x1008FF59 /* Output switch key */
+#define XKB_KEY_XF86DOS 0x1008FF5A /* Launch DOS (emulation) */
+#define XKB_KEY_XF86Documents 0x1008FF5B /* Open documents window */
+#define XKB_KEY_XF86Excel 0x1008FF5C /* Launch spread sheet */
+#define XKB_KEY_XF86Explorer 0x1008FF5D /* Launch file explorer */
+#define XKB_KEY_XF86Game 0x1008FF5E /* Launch game */
+#define XKB_KEY_XF86Go 0x1008FF5F /* Go to URL */
+#define XKB_KEY_XF86iTouch 0x1008FF60 /* Logitech iTouch- don't use */
+#define XKB_KEY_XF86LogOff 0x1008FF61 /* Log off system */
+#define XKB_KEY_XF86Market 0x1008FF62 /* ?? */
+#define XKB_KEY_XF86Meeting 0x1008FF63 /* enter meeting in calendar */
+#define XKB_KEY_XF86MenuKB 0x1008FF65 /* distinguish keyboard from PB */
+#define XKB_KEY_XF86MenuPB 0x1008FF66 /* distinguish PB from keyboard */
+#define XKB_KEY_XF86MySites 0x1008FF67 /* Favourites */
+#define XKB_KEY_XF86New 0x1008FF68 /* New (folder, document... */
+#define XKB_KEY_XF86News 0x1008FF69 /* News */
+#define XKB_KEY_XF86OfficeHome 0x1008FF6A /* Office home (old Staroffice)*/
+#define XKB_KEY_XF86Open 0x1008FF6B /* Open */
+#define XKB_KEY_XF86Option 0x1008FF6C /* ?? */
+#define XKB_KEY_XF86Paste 0x1008FF6D /* Paste */
+#define XKB_KEY_XF86Phone 0x1008FF6E /* Launch phone; dial number */
+#define XKB_KEY_XF86Q 0x1008FF70 /* Compaq's Q - don't use */
+#define XKB_KEY_XF86Reply 0x1008FF72 /* Reply e.g., mail */
+#define XKB_KEY_XF86Reload 0x1008FF73 /* Reload web page, file, etc. */
+#define XKB_KEY_XF86RotateWindows 0x1008FF74 /* Rotate windows e.g. xrandr */
+#define XKB_KEY_XF86RotationPB 0x1008FF75 /* don't use */
+#define XKB_KEY_XF86RotationKB 0x1008FF76 /* don't use */
+#define XKB_KEY_XF86Save 0x1008FF77 /* Save (file, document, state */
+#define XKB_KEY_XF86ScrollUp 0x1008FF78 /* Scroll window/contents up */
+#define XKB_KEY_XF86ScrollDown 0x1008FF79 /* Scrool window/contentd down */
+#define XKB_KEY_XF86ScrollClick 0x1008FF7A /* Use XKB mousekeys instead */
+#define XKB_KEY_XF86Send 0x1008FF7B /* Send mail, file, object */
+#define XKB_KEY_XF86Spell 0x1008FF7C /* Spell checker */
+#define XKB_KEY_XF86SplitScreen 0x1008FF7D /* Split window or screen */
+#define XKB_KEY_XF86Support 0x1008FF7E /* Get support (??) */
+#define XKB_KEY_XF86TaskPane 0x1008FF7F /* Show tasks */
+#define XKB_KEY_XF86Terminal 0x1008FF80 /* Launch terminal emulator */
+#define XKB_KEY_XF86Tools 0x1008FF81 /* toolbox of desktop/app. */
+#define XKB_KEY_XF86Travel 0x1008FF82 /* ?? */
+#define XKB_KEY_XF86UserPB 0x1008FF84 /* ?? */
+#define XKB_KEY_XF86User1KB 0x1008FF85 /* ?? */
+#define XKB_KEY_XF86User2KB 0x1008FF86 /* ?? */
+#define XKB_KEY_XF86Video 0x1008FF87 /* Launch video player */
+#define XKB_KEY_XF86WheelButton 0x1008FF88 /* button from a mouse wheel */
+#define XKB_KEY_XF86Word 0x1008FF89 /* Launch word processor */
+#define XKB_KEY_XF86Xfer 0x1008FF8A
+#define XKB_KEY_XF86ZoomIn 0x1008FF8B /* zoom in view, map, etc. */
+#define XKB_KEY_XF86ZoomOut 0x1008FF8C /* zoom out view, map, etc. */
+
+#define XKB_KEY_XF86Away 0x1008FF8D /* mark yourself as away */
+#define XKB_KEY_XF86Messenger 0x1008FF8E /* as in instant messaging */
+#define XKB_KEY_XF86WebCam 0x1008FF8F /* Launch web camera app. */
+#define XKB_KEY_XF86MailForward 0x1008FF90 /* Forward in mail */
+#define XKB_KEY_XF86Pictures 0x1008FF91 /* Show pictures */
+#define XKB_KEY_XF86Music 0x1008FF92 /* Launch music application */
+
+#define XKB_KEY_XF86Battery 0x1008FF93 /* Display battery information */
+#define XKB_KEY_XF86Bluetooth 0x1008FF94 /* Enable/disable Bluetooth */
+#define XKB_KEY_XF86WLAN 0x1008FF95 /* Enable/disable WLAN */
+#define XKB_KEY_XF86UWB 0x1008FF96 /* Enable/disable UWB */
+
+#define XKB_KEY_XF86AudioForward 0x1008FF97 /* fast-forward audio track */
+#define XKB_KEY_XF86AudioRepeat 0x1008FF98 /* toggle repeat mode */
+#define XKB_KEY_XF86AudioRandomPlay 0x1008FF99 /* toggle shuffle mode */
+#define XKB_KEY_XF86Subtitle 0x1008FF9A /* cycle through subtitle */
+#define XKB_KEY_XF86AudioCycleTrack 0x1008FF9B /* cycle through audio tracks */
+#define XKB_KEY_XF86CycleAngle 0x1008FF9C /* cycle through angles */
+#define XKB_KEY_XF86FrameBack 0x1008FF9D /* video: go one frame back */
+#define XKB_KEY_XF86FrameForward 0x1008FF9E /* video: go one frame forward */
+#define XKB_KEY_XF86Time 0x1008FF9F /* display, or shows an entry for time seeking */
+#define XKB_KEY_XF86Select 0x1008FFA0 /* Select button on joypads and remotes */
+#define XKB_KEY_XF86View 0x1008FFA1 /* Show a view options/properties */
+#define XKB_KEY_XF86TopMenu 0x1008FFA2 /* Go to a top-level menu in a video */
+
+#define XKB_KEY_XF86Red 0x1008FFA3 /* Red button */
+#define XKB_KEY_XF86Green 0x1008FFA4 /* Green button */
+#define XKB_KEY_XF86Yellow 0x1008FFA5 /* Yellow button */
+#define XKB_KEY_XF86Blue 0x1008FFA6 /* Blue button */
+
+#define XKB_KEY_XF86Suspend 0x1008FFA7 /* Sleep to RAM */
+#define XKB_KEY_XF86Hibernate 0x1008FFA8 /* Sleep to disk */
+#define XKB_KEY_XF86TouchpadToggle 0x1008FFA9 /* Toggle between touchpad/trackstick */
+#define XKB_KEY_XF86TouchpadOn 0x1008FFB0 /* The touchpad got switched on */
+#define XKB_KEY_XF86TouchpadOff 0x1008FFB1 /* The touchpad got switched off */
+
+#define XKB_KEY_XF86AudioMicMute 0x1008FFB2 /* Mute the Mic from the system */
+
+#define XKB_KEY_XF86Keyboard 0x1008FFB3 /* User defined keyboard related action */
+
+#define XKB_KEY_XF86WWAN 0x1008FFB4 /* Toggle WWAN (LTE, UMTS, etc.) radio */
+#define XKB_KEY_XF86RFKill 0x1008FFB5 /* Toggle radios on/off */
+
+#define XKB_KEY_XF86AudioPreset 0x1008FFB6 /* Select equalizer preset, e.g. theatre-mode */
+
+#define XKB_KEY_XF86RotationLockToggle 0x1008FFB7 /* Toggle screen rotation lock on/off */
+
+#define XKB_KEY_XF86FullScreen 0x1008FFB8 /* Toggle fullscreen */
+
+/* Keys for special action keys (hot keys) */
+/* Virtual terminals on some operating systems */
+#define XKB_KEY_XF86Switch_VT_1 0x1008FE01
+#define XKB_KEY_XF86Switch_VT_2 0x1008FE02
+#define XKB_KEY_XF86Switch_VT_3 0x1008FE03
+#define XKB_KEY_XF86Switch_VT_4 0x1008FE04
+#define XKB_KEY_XF86Switch_VT_5 0x1008FE05
+#define XKB_KEY_XF86Switch_VT_6 0x1008FE06
+#define XKB_KEY_XF86Switch_VT_7 0x1008FE07
+#define XKB_KEY_XF86Switch_VT_8 0x1008FE08
+#define XKB_KEY_XF86Switch_VT_9 0x1008FE09
+#define XKB_KEY_XF86Switch_VT_10 0x1008FE0A
+#define XKB_KEY_XF86Switch_VT_11 0x1008FE0B
+#define XKB_KEY_XF86Switch_VT_12 0x1008FE0C
+
+#define XKB_KEY_XF86Ungrab 0x1008FE20 /* force ungrab */
+#define XKB_KEY_XF86ClearGrab 0x1008FE21 /* kill application with grab */
+#define XKB_KEY_XF86Next_VMode 0x1008FE22 /* next video mode available */
+#define XKB_KEY_XF86Prev_VMode 0x1008FE23 /* prev. video mode available */
+#define XKB_KEY_XF86LogWindowTree 0x1008FE24 /* print window tree to log */
+#define XKB_KEY_XF86LogGrabInfo 0x1008FE25 /* print all active grabs to log */
+
+
+/*
+ * Reserved range for evdev symbols: 0x10081000-0x10081FFF
+ *
+ * Key syms within this range must match the Linux kernel
+ * input-event-codes.h file in the format:
+ * XF86XK_CamelCaseKernelName _EVDEVK(kernel value)
+ * For example, the kernel
+ * #define KEY_MACRO_RECORD_START 0x2b0
+ * effectively ends up as:
+ * #define XKB_KEY_XF86MacroRecordStart 0x100812b0
+ *
+ * For historical reasons, some keysyms within the reserved range will be
+ * missing, most notably all "normal" keys that are mapped through default
+ * XKB layouts (e.g. KEY_Q).
+ *
+ * CamelCasing is done with a human control as last authority, e.g. see VOD
+ * instead of Vod for the Video on Demand key.
+ *
+ * The format for #defines is strict:
+ *
+ * #define XKB_KEY_XF86FOO<tab...>_EVDEVK(0xABC)<tab><tab> |* kver KEY_FOO *|
+ *
+ * Where
+ * - alignment by tabs
+ * - the _EVDEVK macro must be used
+ * - the hex code must be in uppercase hex
+ * - the kernel version (kver) is in the form v5.10
+ * - kver and key name are within a slash-star comment (a pipe is used in
+ * this example for technical reasons)
+ * These #defines are parsed by scripts. Do not stray from the given format.
+ *
+ * Where the evdev keycode is mapped to a different symbol, please add a
+ * comment line starting with Use: but otherwise the same format, e.g.
+ * Use: XF86XK_RotationLockToggle _EVDEVK(0x231) v4.16 KEY_ROTATE_LOCK_TOGGLE
+ *
+ */
+/* Use: XF86XK_Eject _EVDEVK(0x0A2) KEY_EJECTCLOSECD */
+/* Use: XF86XK_New _EVDEVK(0x0B5) v2.6.14 KEY_NEW */
+/* Use: XK_Redo _EVDEVK(0x0B6) v2.6.14 KEY_REDO */
+/* KEY_DASHBOARD has been mapped to LaunchB in xkeyboard-config since 2011 */
+/* Use: XF86XK_LaunchB _EVDEVK(0x0CC) v2.6.28 KEY_DASHBOARD */
+/* Use: XF86XK_Display _EVDEVK(0x0E3) v2.6.12 KEY_SWITCHVIDEOMODE */
+/* Use: XF86XK_KbdLightOnOff _EVDEVK(0x0E4) v2.6.12 KEY_KBDILLUMTOGGLE */
+/* Use: XF86XK_KbdBrightnessDown _EVDEVK(0x0E5) v2.6.12 KEY_KBDILLUMDOWN */
+/* Use: XF86XK_KbdBrightnessUp _EVDEVK(0x0E6) v2.6.12 KEY_KBDILLUMUP */
+/* Use: XF86XK_Send _EVDEVK(0x0E7) v2.6.14 KEY_SEND */
+/* Use: XF86XK_Reply _EVDEVK(0x0E8) v2.6.14 KEY_REPLY */
+/* Use: XF86XK_MailForward _EVDEVK(0x0E9) v2.6.14 KEY_FORWARDMAIL */
+/* Use: XF86XK_Save _EVDEVK(0x0EA) v2.6.14 KEY_SAVE */
+/* Use: XF86XK_Documents _EVDEVK(0x0EB) v2.6.14 KEY_DOCUMENTS */
+/* Use: XF86XK_Battery _EVDEVK(0x0EC) v2.6.17 KEY_BATTERY */
+/* Use: XF86XK_Bluetooth _EVDEVK(0x0ED) v2.6.19 KEY_BLUETOOTH */
+/* Use: XF86XK_WLAN _EVDEVK(0x0EE) v2.6.19 KEY_WLAN */
+/* Use: XF86XK_UWB _EVDEVK(0x0EF) v2.6.24 KEY_UWB */
+/* Use: XF86XK_Next_VMode _EVDEVK(0x0F1) v2.6.23 KEY_VIDEO_NEXT */
+/* Use: XF86XK_Prev_VMode _EVDEVK(0x0F2) v2.6.23 KEY_VIDEO_PREV */
+/* Use: XF86XK_MonBrightnessCycle _EVDEVK(0x0F3) v2.6.23 KEY_BRIGHTNESS_CYCLE */
+#define XKB_KEY_XF86BrightnessAuto 0x100810f4 /* v3.16 KEY_BRIGHTNESS_AUTO */
+#define XKB_KEY_XF86DisplayOff 0x100810f5 /* v2.6.23 KEY_DISPLAY_OFF */
+/* Use: XF86XK_WWAN _EVDEVK(0x0F6) v3.13 KEY_WWAN */
+/* Use: XF86XK_RFKill _EVDEVK(0x0F7) v2.6.33 KEY_RFKILL */
+/* Use: XF86XK_AudioMicMute _EVDEVK(0x0F8) v3.1 KEY_MICMUTE */
+#define XKB_KEY_XF86Info 0x10081166 /* KEY_INFO */
+/* Use: XF86XK_CycleAngle _EVDEVK(0x173) KEY_ANGLE */
+/* Use: XF86XK_FullScreen _EVDEVK(0x174) v5.1 KEY_FULL_SCREEN */
+#define XKB_KEY_XF86AspectRatio 0x10081177 /* v5.1 KEY_ASPECT_RATIO */
+#define XKB_KEY_XF86DVD 0x10081185 /* KEY_DVD */
+#define XKB_KEY_XF86Audio 0x10081188 /* KEY_AUDIO */
+/* Use: XF86XK_Video _EVDEVK(0x189) KEY_VIDEO */
+/* Use: XF86XK_Calendar _EVDEVK(0x18D) KEY_CALENDAR */
+#define XKB_KEY_XF86ChannelUp 0x10081192 /* KEY_CHANNELUP */
+#define XKB_KEY_XF86ChannelDown 0x10081193 /* KEY_CHANNELDOWN */
+/* Use: XF86XK_AudioRandomPlay _EVDEVK(0x19A) KEY_SHUFFLE */
+#define XKB_KEY_XF86Break 0x1008119b /* KEY_BREAK */
+#define XKB_KEY_XF86VideoPhone 0x100811a0 /* v2.6.20 KEY_VIDEOPHONE */
+/* Use: XF86XK_Game _EVDEVK(0x1A1) v2.6.20 KEY_GAMES */
+/* Use: XF86XK_ZoomIn _EVDEVK(0x1A2) v2.6.20 KEY_ZOOMIN */
+/* Use: XF86XK_ZoomOut _EVDEVK(0x1A3) v2.6.20 KEY_ZOOMOUT */
+#define XKB_KEY_XF86ZoomReset 0x100811a4 /* v2.6.20 KEY_ZOOMRESET */
+/* Use: XF86XK_Word _EVDEVK(0x1A5) v2.6.20 KEY_WORDPROCESSOR */
+#define XKB_KEY_XF86Editor 0x100811a6 /* v2.6.20 KEY_EDITOR */
+/* Use: XF86XK_Excel _EVDEVK(0x1A7) v2.6.20 KEY_SPREADSHEET */
+#define XKB_KEY_XF86GraphicsEditor 0x100811a8 /* v2.6.20 KEY_GRAPHICSEDITOR */
+#define XKB_KEY_XF86Presentation 0x100811a9 /* v2.6.20 KEY_PRESENTATION */
+#define XKB_KEY_XF86Database 0x100811aa /* v2.6.20 KEY_DATABASE */
+/* Use: XF86XK_News _EVDEVK(0x1AB) v2.6.20 KEY_NEWS */
+#define XKB_KEY_XF86Voicemail 0x100811ac /* v2.6.20 KEY_VOICEMAIL */
+#define XKB_KEY_XF86Addressbook 0x100811ad /* v2.6.20 KEY_ADDRESSBOOK */
+/* Use: XF86XK_Messenger _EVDEVK(0x1AE) v2.6.20 KEY_MESSENGER */
+#define XKB_KEY_XF86DisplayToggle 0x100811af /* v2.6.20 KEY_DISPLAYTOGGLE */
+#define XKB_KEY_XF86SpellCheck 0x100811b0 /* v2.6.24 KEY_SPELLCHECK */
+/* Use: XF86XK_LogOff _EVDEVK(0x1B1) v2.6.24 KEY_LOGOFF */
+/* Use: XK_dollar _EVDEVK(0x1B2) v2.6.24 KEY_DOLLAR */
+/* Use: XK_EuroSign _EVDEVK(0x1B3) v2.6.24 KEY_EURO */
+/* Use: XF86XK_FrameBack _EVDEVK(0x1B4) v2.6.24 KEY_FRAMEBACK */
+/* Use: XF86XK_FrameForward _EVDEVK(0x1B5) v2.6.24 KEY_FRAMEFORWARD */
+#define XKB_KEY_XF86ContextMenu 0x100811b6 /* v2.6.24 KEY_CONTEXT_MENU */
+#define XKB_KEY_XF86MediaRepeat 0x100811b7 /* v2.6.26 KEY_MEDIA_REPEAT */
+#define XKB_KEY_XF8610ChannelsUp 0x100811b8 /* v2.6.38 KEY_10CHANNELSUP */
+#define XKB_KEY_XF8610ChannelsDown 0x100811b9 /* v2.6.38 KEY_10CHANNELSDOWN */
+#define XKB_KEY_XF86Images 0x100811ba /* v2.6.39 KEY_IMAGES */
+#define XKB_KEY_XF86NotificationCenter 0x100811bc /* v5.10 KEY_NOTIFICATION_CENTER */
+#define XKB_KEY_XF86PickupPhone 0x100811bd /* v5.10 KEY_PICKUP_PHONE */
+#define XKB_KEY_XF86HangupPhone 0x100811be /* v5.10 KEY_HANGUP_PHONE */
+#define XKB_KEY_XF86Fn 0x100811d0 /* KEY_FN */
+#define XKB_KEY_XF86Fn_Esc 0x100811d1 /* KEY_FN_ESC */
+#define XKB_KEY_XF86FnRightShift 0x100811e5 /* v5.10 KEY_FN_RIGHT_SHIFT */
+/* Use: XK_braille_dot_1 _EVDEVK(0x1F1) v2.6.17 KEY_BRL_DOT1 */
+/* Use: XK_braille_dot_2 _EVDEVK(0x1F2) v2.6.17 KEY_BRL_DOT2 */
+/* Use: XK_braille_dot_3 _EVDEVK(0x1F3) v2.6.17 KEY_BRL_DOT3 */
+/* Use: XK_braille_dot_4 _EVDEVK(0x1F4) v2.6.17 KEY_BRL_DOT4 */
+/* Use: XK_braille_dot_5 _EVDEVK(0x1F5) v2.6.17 KEY_BRL_DOT5 */
+/* Use: XK_braille_dot_6 _EVDEVK(0x1F6) v2.6.17 KEY_BRL_DOT6 */
+/* Use: XK_braille_dot_7 _EVDEVK(0x1F7) v2.6.17 KEY_BRL_DOT7 */
+/* Use: XK_braille_dot_8 _EVDEVK(0x1F8) v2.6.17 KEY_BRL_DOT8 */
+/* Use: XK_braille_dot_9 _EVDEVK(0x1F9) v2.6.23 KEY_BRL_DOT9 */
+/* Use: XK_braille_dot_1 _EVDEVK(0x1FA) v2.6.23 KEY_BRL_DOT10 */
+#define XKB_KEY_XF86Numeric0 0x10081200 /* v2.6.28 KEY_NUMERIC_0 */
+#define XKB_KEY_XF86Numeric1 0x10081201 /* v2.6.28 KEY_NUMERIC_1 */
+#define XKB_KEY_XF86Numeric2 0x10081202 /* v2.6.28 KEY_NUMERIC_2 */
+#define XKB_KEY_XF86Numeric3 0x10081203 /* v2.6.28 KEY_NUMERIC_3 */
+#define XKB_KEY_XF86Numeric4 0x10081204 /* v2.6.28 KEY_NUMERIC_4 */
+#define XKB_KEY_XF86Numeric5 0x10081205 /* v2.6.28 KEY_NUMERIC_5 */
+#define XKB_KEY_XF86Numeric6 0x10081206 /* v2.6.28 KEY_NUMERIC_6 */
+#define XKB_KEY_XF86Numeric7 0x10081207 /* v2.6.28 KEY_NUMERIC_7 */
+#define XKB_KEY_XF86Numeric8 0x10081208 /* v2.6.28 KEY_NUMERIC_8 */
+#define XKB_KEY_XF86Numeric9 0x10081209 /* v2.6.28 KEY_NUMERIC_9 */
+#define XKB_KEY_XF86NumericStar 0x1008120a /* v2.6.28 KEY_NUMERIC_STAR */
+#define XKB_KEY_XF86NumericPound 0x1008120b /* v2.6.28 KEY_NUMERIC_POUND */
+#define XKB_KEY_XF86NumericA 0x1008120c /* v4.1 KEY_NUMERIC_A */
+#define XKB_KEY_XF86NumericB 0x1008120d /* v4.1 KEY_NUMERIC_B */
+#define XKB_KEY_XF86NumericC 0x1008120e /* v4.1 KEY_NUMERIC_C */
+#define XKB_KEY_XF86NumericD 0x1008120f /* v4.1 KEY_NUMERIC_D */
+#define XKB_KEY_XF86CameraFocus 0x10081210 /* v2.6.33 KEY_CAMERA_FOCUS */
+#define XKB_KEY_XF86WPSButton 0x10081211 /* v2.6.34 KEY_WPS_BUTTON */
+/* Use: XF86XK_TouchpadToggle _EVDEVK(0x212) v2.6.37 KEY_TOUCHPAD_TOGGLE */
+/* Use: XF86XK_TouchpadOn _EVDEVK(0x213) v2.6.37 KEY_TOUCHPAD_ON */
+/* Use: XF86XK_TouchpadOff _EVDEVK(0x214) v2.6.37 KEY_TOUCHPAD_OFF */
+#define XKB_KEY_XF86CameraZoomIn 0x10081215 /* v2.6.39 KEY_CAMERA_ZOOMIN */
+#define XKB_KEY_XF86CameraZoomOut 0x10081216 /* v2.6.39 KEY_CAMERA_ZOOMOUT */
+#define XKB_KEY_XF86CameraUp 0x10081217 /* v2.6.39 KEY_CAMERA_UP */
+#define XKB_KEY_XF86CameraDown 0x10081218 /* v2.6.39 KEY_CAMERA_DOWN */
+#define XKB_KEY_XF86CameraLeft 0x10081219 /* v2.6.39 KEY_CAMERA_LEFT */
+#define XKB_KEY_XF86CameraRight 0x1008121a /* v2.6.39 KEY_CAMERA_RIGHT */
+#define XKB_KEY_XF86AttendantOn 0x1008121b /* v3.10 KEY_ATTENDANT_ON */
+#define XKB_KEY_XF86AttendantOff 0x1008121c /* v3.10 KEY_ATTENDANT_OFF */
+#define XKB_KEY_XF86AttendantToggle 0x1008121d /* v3.10 KEY_ATTENDANT_TOGGLE */
+#define XKB_KEY_XF86LightsToggle 0x1008121e /* v3.10 KEY_LIGHTS_TOGGLE */
+#define XKB_KEY_XF86ALSToggle 0x10081230 /* v3.13 KEY_ALS_TOGGLE */
+/* Use: XF86XK_RotationLockToggle _EVDEVK(0x231) v4.16 KEY_ROTATE_LOCK_TOGGLE */
+#define XKB_KEY_XF86Buttonconfig 0x10081240 /* v3.16 KEY_BUTTONCONFIG */
+#define XKB_KEY_XF86Taskmanager 0x10081241 /* v3.16 KEY_TASKMANAGER */
+#define XKB_KEY_XF86Journal 0x10081242 /* v3.16 KEY_JOURNAL */
+#define XKB_KEY_XF86ControlPanel 0x10081243 /* v3.16 KEY_CONTROLPANEL */
+#define XKB_KEY_XF86AppSelect 0x10081244 /* v3.16 KEY_APPSELECT */
+#define XKB_KEY_XF86Screensaver 0x10081245 /* v3.16 KEY_SCREENSAVER */
+#define XKB_KEY_XF86VoiceCommand 0x10081246 /* v3.16 KEY_VOICECOMMAND */
+#define XKB_KEY_XF86Assistant 0x10081247 /* v4.13 KEY_ASSISTANT */
+/* Use: XK_ISO_Next_Group _EVDEVK(0x248) v5.2 KEY_KBD_LAYOUT_NEXT */
+#define XKB_KEY_XF86BrightnessMin 0x10081250 /* v3.16 KEY_BRIGHTNESS_MIN */
+#define XKB_KEY_XF86BrightnessMax 0x10081251 /* v3.16 KEY_BRIGHTNESS_MAX */
+#define XKB_KEY_XF86KbdInputAssistPrev 0x10081260 /* v3.18 KEY_KBDINPUTASSIST_PREV */
+#define XKB_KEY_XF86KbdInputAssistNext 0x10081261 /* v3.18 KEY_KBDINPUTASSIST_NEXT */
+#define XKB_KEY_XF86KbdInputAssistPrevgroup 0x10081262 /* v3.18 KEY_KBDINPUTASSIST_PREVGROUP */
+#define XKB_KEY_XF86KbdInputAssistNextgroup 0x10081263 /* v3.18 KEY_KBDINPUTASSIST_NEXTGROUP */
+#define XKB_KEY_XF86KbdInputAssistAccept 0x10081264 /* v3.18 KEY_KBDINPUTASSIST_ACCEPT */
+#define XKB_KEY_XF86KbdInputAssistCancel 0x10081265 /* v3.18 KEY_KBDINPUTASSIST_CANCEL */
+#define XKB_KEY_XF86RightUp 0x10081266 /* v4.7 KEY_RIGHT_UP */
+#define XKB_KEY_XF86RightDown 0x10081267 /* v4.7 KEY_RIGHT_DOWN */
+#define XKB_KEY_XF86LeftUp 0x10081268 /* v4.7 KEY_LEFT_UP */
+#define XKB_KEY_XF86LeftDown 0x10081269 /* v4.7 KEY_LEFT_DOWN */
+#define XKB_KEY_XF86RootMenu 0x1008126a /* v4.7 KEY_ROOT_MENU */
+#define XKB_KEY_XF86MediaTopMenu 0x1008126b /* v4.7 KEY_MEDIA_TOP_MENU */
+#define XKB_KEY_XF86Numeric11 0x1008126c /* v4.7 KEY_NUMERIC_11 */
+#define XKB_KEY_XF86Numeric12 0x1008126d /* v4.7 KEY_NUMERIC_12 */
+#define XKB_KEY_XF86AudioDesc 0x1008126e /* v4.7 KEY_AUDIO_DESC */
+#define XKB_KEY_XF863DMode 0x1008126f /* v4.7 KEY_3D_MODE */
+#define XKB_KEY_XF86NextFavorite 0x10081270 /* v4.7 KEY_NEXT_FAVORITE */
+#define XKB_KEY_XF86StopRecord 0x10081271 /* v4.7 KEY_STOP_RECORD */
+#define XKB_KEY_XF86PauseRecord 0x10081272 /* v4.7 KEY_PAUSE_RECORD */
+#define XKB_KEY_XF86VOD 0x10081273 /* v4.7 KEY_VOD */
+#define XKB_KEY_XF86Unmute 0x10081274 /* v4.7 KEY_UNMUTE */
+#define XKB_KEY_XF86FastReverse 0x10081275 /* v4.7 KEY_FASTREVERSE */
+#define XKB_KEY_XF86SlowReverse 0x10081276 /* v4.7 KEY_SLOWREVERSE */
+#define XKB_KEY_XF86Data 0x10081277 /* v4.7 KEY_DATA */
+#define XKB_KEY_XF86OnScreenKeyboard 0x10081278 /* v4.12 KEY_ONSCREEN_KEYBOARD */
+#define XKB_KEY_XF86PrivacyScreenToggle 0x10081279 /* v5.5 KEY_PRIVACY_SCREEN_TOGGLE */
+#define XKB_KEY_XF86SelectiveScreenshot 0x1008127a /* v5.6 KEY_SELECTIVE_SCREENSHOT */
+#define XKB_KEY_XF86Macro1 0x10081290 /* v5.5 KEY_MACRO1 */
+#define XKB_KEY_XF86Macro2 0x10081291 /* v5.5 KEY_MACRO2 */
+#define XKB_KEY_XF86Macro3 0x10081292 /* v5.5 KEY_MACRO3 */
+#define XKB_KEY_XF86Macro4 0x10081293 /* v5.5 KEY_MACRO4 */
+#define XKB_KEY_XF86Macro5 0x10081294 /* v5.5 KEY_MACRO5 */
+#define XKB_KEY_XF86Macro6 0x10081295 /* v5.5 KEY_MACRO6 */
+#define XKB_KEY_XF86Macro7 0x10081296 /* v5.5 KEY_MACRO7 */
+#define XKB_KEY_XF86Macro8 0x10081297 /* v5.5 KEY_MACRO8 */
+#define XKB_KEY_XF86Macro9 0x10081298 /* v5.5 KEY_MACRO9 */
+#define XKB_KEY_XF86Macro10 0x10081299 /* v5.5 KEY_MACRO10 */
+#define XKB_KEY_XF86Macro11 0x1008129a /* v5.5 KEY_MACRO11 */
+#define XKB_KEY_XF86Macro12 0x1008129b /* v5.5 KEY_MACRO12 */
+#define XKB_KEY_XF86Macro13 0x1008129c /* v5.5 KEY_MACRO13 */
+#define XKB_KEY_XF86Macro14 0x1008129d /* v5.5 KEY_MACRO14 */
+#define XKB_KEY_XF86Macro15 0x1008129e /* v5.5 KEY_MACRO15 */
+#define XKB_KEY_XF86Macro16 0x1008129f /* v5.5 KEY_MACRO16 */
+#define XKB_KEY_XF86Macro17 0x100812a0 /* v5.5 KEY_MACRO17 */
+#define XKB_KEY_XF86Macro18 0x100812a1 /* v5.5 KEY_MACRO18 */
+#define XKB_KEY_XF86Macro19 0x100812a2 /* v5.5 KEY_MACRO19 */
+#define XKB_KEY_XF86Macro20 0x100812a3 /* v5.5 KEY_MACRO20 */
+#define XKB_KEY_XF86Macro21 0x100812a4 /* v5.5 KEY_MACRO21 */
+#define XKB_KEY_XF86Macro22 0x100812a5 /* v5.5 KEY_MACRO22 */
+#define XKB_KEY_XF86Macro23 0x100812a6 /* v5.5 KEY_MACRO23 */
+#define XKB_KEY_XF86Macro24 0x100812a7 /* v5.5 KEY_MACRO24 */
+#define XKB_KEY_XF86Macro25 0x100812a8 /* v5.5 KEY_MACRO25 */
+#define XKB_KEY_XF86Macro26 0x100812a9 /* v5.5 KEY_MACRO26 */
+#define XKB_KEY_XF86Macro27 0x100812aa /* v5.5 KEY_MACRO27 */
+#define XKB_KEY_XF86Macro28 0x100812ab /* v5.5 KEY_MACRO28 */
+#define XKB_KEY_XF86Macro29 0x100812ac /* v5.5 KEY_MACRO29 */
+#define XKB_KEY_XF86Macro30 0x100812ad /* v5.5 KEY_MACRO30 */
+#define XKB_KEY_XF86MacroRecordStart 0x100812b0 /* v5.5 KEY_MACRO_RECORD_START */
+#define XKB_KEY_XF86MacroRecordStop 0x100812b1 /* v5.5 KEY_MACRO_RECORD_STOP */
+#define XKB_KEY_XF86MacroPresetCycle 0x100812b2 /* v5.5 KEY_MACRO_PRESET_CYCLE */
+#define XKB_KEY_XF86MacroPreset1 0x100812b3 /* v5.5 KEY_MACRO_PRESET1 */
+#define XKB_KEY_XF86MacroPreset2 0x100812b4 /* v5.5 KEY_MACRO_PRESET2 */
+#define XKB_KEY_XF86MacroPreset3 0x100812b5 /* v5.5 KEY_MACRO_PRESET3 */
+#define XKB_KEY_XF86KbdLcdMenu1 0x100812b8 /* v5.5 KEY_KBD_LCD_MENU1 */
+#define XKB_KEY_XF86KbdLcdMenu2 0x100812b9 /* v5.5 KEY_KBD_LCD_MENU2 */
+#define XKB_KEY_XF86KbdLcdMenu3 0x100812ba /* v5.5 KEY_KBD_LCD_MENU3 */
+#define XKB_KEY_XF86KbdLcdMenu4 0x100812bb /* v5.5 KEY_KBD_LCD_MENU4 */
+#define XKB_KEY_XF86KbdLcdMenu5 0x100812bc /* v5.5 KEY_KBD_LCD_MENU5 */
+#undef _EVDEVK
+/*
+ * Copyright (c) 1991, Oracle and/or its affiliates. All rights reserved.
+ *
+ * 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 (including the next
+ * paragraph) 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.
+ */
+/************************************************************
+
+Copyright 1991, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+***********************************************************/
+
+/*
+ * Floating Accent
+ */
+
+#define XKB_KEY_SunFA_Grave 0x1005FF00
+#define XKB_KEY_SunFA_Circum 0x1005FF01
+#define XKB_KEY_SunFA_Tilde 0x1005FF02
+#define XKB_KEY_SunFA_Acute 0x1005FF03
+#define XKB_KEY_SunFA_Diaeresis 0x1005FF04
+#define XKB_KEY_SunFA_Cedilla 0x1005FF05
+
+/*
+ * Miscellaneous Functions
+ */
+
+#define XKB_KEY_SunF36 0x1005FF10 /* Labeled F11 */
+#define XKB_KEY_SunF37 0x1005FF11 /* Labeled F12 */
+
+#define XKB_KEY_SunSys_Req 0x1005FF60
+#define XKB_KEY_SunPrint_Screen 0x0000FF61 /* Same as XK_Print */
+
+/*
+ * International & Multi-Key Character Composition
+ */
+
+#define XKB_KEY_SunCompose 0x0000FF20 /* Same as XK_Multi_key */
+#define XKB_KEY_SunAltGraph 0x0000FF7E /* Same as XK_Mode_switch */
+
+/*
+ * Cursor Control
+ */
+
+#define XKB_KEY_SunPageUp 0x0000FF55 /* Same as XK_Prior */
+#define XKB_KEY_SunPageDown 0x0000FF56 /* Same as XK_Next */
+
+/*
+ * Open Look Functions
+ */
+
+#define XKB_KEY_SunUndo 0x0000FF65 /* Same as XK_Undo */
+#define XKB_KEY_SunAgain 0x0000FF66 /* Same as XK_Redo */
+#define XKB_KEY_SunFind 0x0000FF68 /* Same as XK_Find */
+#define XKB_KEY_SunStop 0x0000FF69 /* Same as XK_Cancel */
+#define XKB_KEY_SunProps 0x1005FF70
+#define XKB_KEY_SunFront 0x1005FF71
+#define XKB_KEY_SunCopy 0x1005FF72
+#define XKB_KEY_SunOpen 0x1005FF73
+#define XKB_KEY_SunPaste 0x1005FF74
+#define XKB_KEY_SunCut 0x1005FF75
+
+#define XKB_KEY_SunPowerSwitch 0x1005FF76
+#define XKB_KEY_SunAudioLowerVolume 0x1005FF77
+#define XKB_KEY_SunAudioMute 0x1005FF78
+#define XKB_KEY_SunAudioRaiseVolume 0x1005FF79
+#define XKB_KEY_SunVideoDegauss 0x1005FF7A
+#define XKB_KEY_SunVideoLowerBrightness 0x1005FF7B
+#define XKB_KEY_SunVideoRaiseBrightness 0x1005FF7C
+#define XKB_KEY_SunPowerSwitchShift 0x1005FF7D
+/***********************************************************
+
+Copyright 1988, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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
+OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * DEC private keysyms
+ * (29th bit set)
+ */
+
+/* two-key compose sequence initiators, chosen to map to Latin1 characters */
+
+#define XKB_KEY_Dring_accent 0x1000FEB0
+#define XKB_KEY_Dcircumflex_accent 0x1000FE5E
+#define XKB_KEY_Dcedilla_accent 0x1000FE2C
+#define XKB_KEY_Dacute_accent 0x1000FE27
+#define XKB_KEY_Dgrave_accent 0x1000FE60
+#define XKB_KEY_Dtilde 0x1000FE7E
+#define XKB_KEY_Ddiaeresis 0x1000FE22
+
+/* special keysym for LK2** "Remove" key on editing keypad */
+
+#define XKB_KEY_DRemove 0x1000FF00 /* Remove */
+/*
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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 OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Hewlett Packard
+or Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFTWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+*/
+
+
+
+#define XKB_KEY_hpClearLine 0x1000FF6F
+#define XKB_KEY_hpInsertLine 0x1000FF70
+#define XKB_KEY_hpDeleteLine 0x1000FF71
+#define XKB_KEY_hpInsertChar 0x1000FF72
+#define XKB_KEY_hpDeleteChar 0x1000FF73
+#define XKB_KEY_hpBackTab 0x1000FF74
+#define XKB_KEY_hpKP_BackTab 0x1000FF75
+#define XKB_KEY_hpModelock1 0x1000FF48
+#define XKB_KEY_hpModelock2 0x1000FF49
+#define XKB_KEY_hpReset 0x1000FF6C
+#define XKB_KEY_hpSystem 0x1000FF6D
+#define XKB_KEY_hpUser 0x1000FF6E
+#define XKB_KEY_hpmute_acute 0x100000A8
+#define XKB_KEY_hpmute_grave 0x100000A9
+#define XKB_KEY_hpmute_asciicircum 0x100000AA
+#define XKB_KEY_hpmute_diaeresis 0x100000AB
+#define XKB_KEY_hpmute_asciitilde 0x100000AC
+#define XKB_KEY_hplira 0x100000AF
+#define XKB_KEY_hpguilder 0x100000BE
+#define XKB_KEY_hpYdiaeresis 0x100000EE
+#define XKB_KEY_hpIO 0x100000EE
+#define XKB_KEY_hplongminus 0x100000F6
+#define XKB_KEY_hpblock 0x100000FC
+
+
+
+#define XKB_KEY_osfCopy 0x1004FF02
+#define XKB_KEY_osfCut 0x1004FF03
+#define XKB_KEY_osfPaste 0x1004FF04
+#define XKB_KEY_osfBackTab 0x1004FF07
+#define XKB_KEY_osfBackSpace 0x1004FF08
+#define XKB_KEY_osfClear 0x1004FF0B
+#define XKB_KEY_osfEscape 0x1004FF1B
+#define XKB_KEY_osfAddMode 0x1004FF31
+#define XKB_KEY_osfPrimaryPaste 0x1004FF32
+#define XKB_KEY_osfQuickPaste 0x1004FF33
+#define XKB_KEY_osfPageLeft 0x1004FF40
+#define XKB_KEY_osfPageUp 0x1004FF41
+#define XKB_KEY_osfPageDown 0x1004FF42
+#define XKB_KEY_osfPageRight 0x1004FF43
+#define XKB_KEY_osfActivate 0x1004FF44
+#define XKB_KEY_osfMenuBar 0x1004FF45
+#define XKB_KEY_osfLeft 0x1004FF51
+#define XKB_KEY_osfUp 0x1004FF52
+#define XKB_KEY_osfRight 0x1004FF53
+#define XKB_KEY_osfDown 0x1004FF54
+#define XKB_KEY_osfEndLine 0x1004FF57
+#define XKB_KEY_osfBeginLine 0x1004FF58
+#define XKB_KEY_osfEndData 0x1004FF59
+#define XKB_KEY_osfBeginData 0x1004FF5A
+#define XKB_KEY_osfPrevMenu 0x1004FF5B
+#define XKB_KEY_osfNextMenu 0x1004FF5C
+#define XKB_KEY_osfPrevField 0x1004FF5D
+#define XKB_KEY_osfNextField 0x1004FF5E
+#define XKB_KEY_osfSelect 0x1004FF60
+#define XKB_KEY_osfInsert 0x1004FF63
+#define XKB_KEY_osfUndo 0x1004FF65
+#define XKB_KEY_osfMenu 0x1004FF67
+#define XKB_KEY_osfCancel 0x1004FF69
+#define XKB_KEY_osfHelp 0x1004FF6A
+#define XKB_KEY_osfSelectAll 0x1004FF71
+#define XKB_KEY_osfDeselectAll 0x1004FF72
+#define XKB_KEY_osfReselect 0x1004FF73
+#define XKB_KEY_osfExtend 0x1004FF74
+#define XKB_KEY_osfRestore 0x1004FF78
+#define XKB_KEY_osfDelete 0x1004FFFF
+
+
+
+/**************************************************************
+ * The use of the following macros is deprecated.
+ * They are listed below only for backwards compatibility.
+ */
+#define XKB_KEY_Reset 0x1000FF6C
+#define XKB_KEY_System 0x1000FF6D
+#define XKB_KEY_User 0x1000FF6E
+#define XKB_KEY_ClearLine 0x1000FF6F
+#define XKB_KEY_InsertLine 0x1000FF70
+#define XKB_KEY_DeleteLine 0x1000FF71
+#define XKB_KEY_InsertChar 0x1000FF72
+#define XKB_KEY_DeleteChar 0x1000FF73
+#define XKB_KEY_BackTab 0x1000FF74
+#define XKB_KEY_KP_BackTab 0x1000FF75
+#define XKB_KEY_Ext16bit_L 0x1000FF76
+#define XKB_KEY_Ext16bit_R 0x1000FF77
+#define XKB_KEY_mute_acute 0x100000a8
+#define XKB_KEY_mute_grave 0x100000a9
+#define XKB_KEY_mute_asciicircum 0x100000aa
+#define XKB_KEY_mute_diaeresis 0x100000ab
+#define XKB_KEY_mute_asciitilde 0x100000ac
+#define XKB_KEY_lira 0x100000af
+#define XKB_KEY_guilder 0x100000be
+#define XKB_KEY_IO 0x100000ee
+#define XKB_KEY_longminus 0x100000f6
+#define XKB_KEY_block 0x100000fc
+
+
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-names.h b/thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-names.h
new file mode 100644
index 0000000000..ecb551ff10
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-names.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ *
+ * 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 (including the next
+ * paragraph) 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.
+ *
+ * Author: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifndef _XKBCOMMON_NAMES_H
+#define _XKBCOMMON_NAMES_H
+
+/**
+ * @file
+ * @brief Predefined names for common modifiers and LEDs.
+ */
+
+#define XKB_MOD_NAME_SHIFT "Shift"
+#define XKB_MOD_NAME_CAPS "Lock"
+#define XKB_MOD_NAME_CTRL "Control"
+#define XKB_MOD_NAME_ALT "Mod1"
+#define XKB_MOD_NAME_NUM "Mod2"
+#define XKB_MOD_NAME_LOGO "Mod4"
+
+#define XKB_LED_NAME_CAPS "Caps Lock"
+#define XKB_LED_NAME_NUM "Num Lock"
+#define XKB_LED_NAME_SCROLL "Scroll Lock"
+
+#endif
diff --git a/thirdparty/linuxbsd_headers/xkbcommon/xkbcommon.h b/thirdparty/linuxbsd_headers/xkbcommon/xkbcommon.h
new file mode 100644
index 0000000000..f52dcfab24
--- /dev/null
+++ b/thirdparty/linuxbsd_headers/xkbcommon/xkbcommon.h
@@ -0,0 +1,1954 @@
+/*
+ * Copyright 1985, 1987, 1990, 1998 The Open Group
+ * Copyright 2008 Dan Nicholson
+ *
+ * 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 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.
+ *
+ * Except as contained in this notice, the names of the authors or their
+ * institutions shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization from the authors.
+ */
+
+/************************************************************
+ * Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting
+ * documentation, and that the name of Silicon Graphics not be
+ * used in advertising or publicity pertaining to distribution
+ * of the software without specific prior written permission.
+ * Silicon Graphics makes no representation about the suitability
+ * of this software for any purpose. It is provided "as is"
+ * without any express or implied warranty.
+ *
+ * SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+ * GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+ * THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ ********************************************************/
+
+/*
+ * Copyright © 2009-2012 Daniel Stone
+ * Copyright © 2012 Intel Corporation
+ * Copyright © 2012 Ran Benita
+ *
+ * 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 (including the next
+ * paragraph) 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.
+ *
+ * Author: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifndef _XKBCOMMON_H_
+#define _XKBCOMMON_H_
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#include <xkbcommon/xkbcommon-names.h>
+#include <xkbcommon/xkbcommon-keysyms.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file
+ * Main libxkbcommon API.
+ */
+
+/**
+ * @struct xkb_context
+ * Opaque top level library context object.
+ *
+ * The context contains various general library data and state, like
+ * logging level and include paths.
+ *
+ * Objects are created in a specific context, and multiple contexts may
+ * coexist simultaneously. Objects from different contexts are completely
+ * separated and do not share any memory or state.
+ */
+struct xkb_context;
+
+/**
+ * @struct xkb_keymap
+ * Opaque compiled keymap object.
+ *
+ * The keymap object holds all of the static keyboard information obtained
+ * from compiling XKB files.
+ *
+ * A keymap is immutable after it is created (besides reference counts, etc.);
+ * if you need to change it, you must create a new one.
+ */
+struct xkb_keymap;
+
+/**
+ * @struct xkb_state
+ * Opaque keyboard state object.
+ *
+ * State objects contain the active state of a keyboard (or keyboards), such
+ * as the currently effective layout and the active modifiers. It acts as a
+ * simple state machine, wherein key presses and releases are the input, and
+ * key symbols (keysyms) are the output.
+ */
+struct xkb_state;
+
+/**
+ * A number used to represent a physical key on a keyboard.
+ *
+ * A standard PC-compatible keyboard might have 102 keys. An appropriate
+ * keymap would assign each of them a keycode, by which the user should
+ * refer to the key throughout the library.
+ *
+ * Historically, the X11 protocol, and consequentially the XKB protocol,
+ * assign only 8 bits for keycodes. This limits the number of different
+ * keys that can be used simultaneously in a single keymap to 256
+ * (disregarding other limitations). This library does not share this limit;
+ * keycodes beyond 255 ('extended keycodes') are not treated specially.
+ * Keymaps and applications which are compatible with X11 should not use
+ * these keycodes.
+ *
+ * The values of specific keycodes are determined by the keymap and the
+ * underlying input system. For example, with an X11-compatible keymap
+ * and Linux evdev scan codes (see linux/input.h), a fixed offset is used:
+ *
+ * The keymap defines a canonical name for each key, plus possible aliases.
+ * Historically, the XKB protocol restricts these names to at most 4 (ASCII)
+ * characters, but this library does not share this limit.
+ *
+ * @code
+ * xkb_keycode_t keycode_A = KEY_A + 8;
+ * @endcode
+ *
+ * @sa xkb_keycode_is_legal_ext() xkb_keycode_is_legal_x11()
+ */
+typedef uint32_t xkb_keycode_t;
+
+/**
+ * A number used to represent the symbols generated from a key on a keyboard.
+ *
+ * A key, represented by a keycode, may generate different symbols according
+ * to keyboard state. For example, on a QWERTY keyboard, pressing the key
+ * labled \<A\> generates the symbol 'a'. If the Shift key is held, it
+ * generates the symbol 'A'. If a different layout is used, say Greek,
+ * it generates the symbol 'α'. And so on.
+ *
+ * Each such symbol is represented by a keysym. Note that keysyms are
+ * somewhat more general, in that they can also represent some "function",
+ * such as "Left" or "Right" for the arrow keys. For more information,
+ * see:
+ * https://www.x.org/releases/current/doc/xproto/x11protocol.html#keysym_encoding
+ *
+ * Specifically named keysyms can be found in the
+ * xkbcommon/xkbcommon-keysyms.h header file. Their name does not include
+ * the XKB_KEY_ prefix.
+ *
+ * Besides those, any Unicode/ISO 10646 character in the range U0100 to
+ * U10FFFF can be represented by a keysym value in the range 0x01000100 to
+ * 0x0110FFFF. The name of Unicode keysyms is "U<codepoint>", e.g. "UA1B2".
+ *
+ * The name of other unnamed keysyms is the hexadecimal representation of
+ * their value, e.g. "0xabcd1234".
+ *
+ * Keysym names are case-sensitive.
+ */
+typedef uint32_t xkb_keysym_t;
+
+/**
+ * Index of a keyboard layout.
+ *
+ * The layout index is a state component which detemines which <em>keyboard
+ * layout</em> is active. These may be different alphabets, different key
+ * arrangements, etc.
+ *
+ * Layout indices are consecutive. The first layout has index 0.
+ *
+ * Each layout is not required to have a name, and the names are not
+ * guaranteed to be unique (though they are usually provided and unique).
+ * Therefore, it is not safe to use the name as a unique identifier for a
+ * layout. Layout names are case-sensitive.
+ *
+ * Layout names are specified in the layout's definition, for example
+ * "English (US)". These are different from the (conventionally) short names
+ * which are used to locate the layout, for example "us" or "us(intl)". These
+ * names are not present in a compiled keymap.
+ *
+ * If the user selects layouts from a list generated from the XKB registry
+ * (using libxkbregistry or directly), and this metadata is needed later on, it
+ * is recommended to store it along with the keymap.
+ *
+ * Layouts are also called "groups" by XKB.
+ *
+ * @sa xkb_keymap_num_layouts() xkb_keymap_num_layouts_for_key()
+ */
+typedef uint32_t xkb_layout_index_t;
+/** A mask of layout indices. */
+typedef uint32_t xkb_layout_mask_t;
+
+/**
+ * Index of a shift level.
+ *
+ * Any key, in any layout, can have several <em>shift levels</em>. Each
+ * shift level can assign different keysyms to the key. The shift level
+ * to use is chosen according to the current keyboard state; for example,
+ * if no keys are pressed, the first level may be used; if the Left Shift
+ * key is pressed, the second; if Num Lock is pressed, the third; and
+ * many such combinations are possible (see xkb_mod_index_t).
+ *
+ * Level indices are consecutive. The first level has index 0.
+ */
+typedef uint32_t xkb_level_index_t;
+
+/**
+ * Index of a modifier.
+ *
+ * A @e modifier is a state component which changes the way keys are
+ * interpreted. A keymap defines a set of modifiers, such as Alt, Shift,
+ * Num Lock or Meta, and specifies which keys may @e activate which
+ * modifiers (in a many-to-many relationship, i.e. a key can activate
+ * several modifiers, and a modifier may be activated by several keys.
+ * Different keymaps do this differently).
+ *
+ * When retrieving the keysyms for a key, the active modifier set is
+ * consulted; this detemines the correct shift level to use within the
+ * currently active layout (see xkb_level_index_t).
+ *
+ * Modifier indices are consecutive. The first modifier has index 0.
+ *
+ * Each modifier must have a name, and the names are unique. Therefore, it
+ * is safe to use the name as a unique identifier for a modifier. The names
+ * of some common modifiers are provided in the xkbcommon/xkbcommon-names.h
+ * header file. Modifier names are case-sensitive.
+ *
+ * @sa xkb_keymap_num_mods()
+ */
+typedef uint32_t xkb_mod_index_t;
+/** A mask of modifier indices. */
+typedef uint32_t xkb_mod_mask_t;
+
+/**
+ * Index of a keyboard LED.
+ *
+ * LEDs are logical objects which may be @e active or @e inactive. They
+ * typically correspond to the lights on the keyboard. Their state is
+ * determined by the current keyboard state.
+ *
+ * LED indices are non-consecutive. The first LED has index 0.
+ *
+ * Each LED must have a name, and the names are unique. Therefore,
+ * it is safe to use the name as a unique identifier for a LED. The names
+ * of some common LEDs are provided in the xkbcommon/xkbcommon-names.h
+ * header file. LED names are case-sensitive.
+ *
+ * @warning A given keymap may specify an exact index for a given LED.
+ * Therefore, LED indexing is not necessarily sequential, as opposed to
+ * modifiers and layouts. This means that when iterating over the LEDs
+ * in a keymap using e.g. xkb_keymap_num_leds(), some indices might be
+ * invalid. Given such an index, functions like xkb_keymap_led_get_name()
+ * will return NULL, and xkb_state_led_index_is_active() will return -1.
+ *
+ * LEDs are also called "indicators" by XKB.
+ *
+ * @sa xkb_keymap_num_leds()
+ */
+typedef uint32_t xkb_led_index_t;
+/** A mask of LED indices. */
+typedef uint32_t xkb_led_mask_t;
+
+#define XKB_KEYCODE_INVALID (0xffffffff)
+#define XKB_LAYOUT_INVALID (0xffffffff)
+#define XKB_LEVEL_INVALID (0xffffffff)
+#define XKB_MOD_INVALID (0xffffffff)
+#define XKB_LED_INVALID (0xffffffff)
+
+#define XKB_KEYCODE_MAX (0xffffffff - 1)
+
+/**
+ * Test whether a value is a valid extended keycode.
+ * @sa xkb_keycode_t
+ **/
+#define xkb_keycode_is_legal_ext(key) (key <= XKB_KEYCODE_MAX)
+
+/**
+ * Test whether a value is a valid X11 keycode.
+ * @sa xkb_keycode_t
+ */
+#define xkb_keycode_is_legal_x11(key) (key >= 8 && key <= 255)
+
+/**
+ * Names to compile a keymap with, also known as RMLVO.
+ *
+ * The names are the common configuration values by which a user picks
+ * a keymap.
+ *
+ * If the entire struct is NULL, then each field is taken to be NULL.
+ * You should prefer passing NULL instead of choosing your own defaults.
+ */
+struct xkb_rule_names {
+ /**
+ * The rules file to use. The rules file describes how to interpret
+ * the values of the model, layout, variant and options fields.
+ *
+ * If NULL or the empty string "", a default value is used.
+ * If the XKB_DEFAULT_RULES environment variable is set, it is used
+ * as the default. Otherwise the system default is used.
+ */
+ const char *rules;
+ /**
+ * The keyboard model by which to interpret keycodes and LEDs.
+ *
+ * If NULL or the empty string "", a default value is used.
+ * If the XKB_DEFAULT_MODEL environment variable is set, it is used
+ * as the default. Otherwise the system default is used.
+ */
+ const char *model;
+ /**
+ * A comma separated list of layouts (languages) to include in the
+ * keymap.
+ *
+ * If NULL or the empty string "", a default value is used.
+ * If the XKB_DEFAULT_LAYOUT environment variable is set, it is used
+ * as the default. Otherwise the system default is used.
+ */
+ const char *layout;
+ /**
+ * A comma separated list of variants, one per layout, which may
+ * modify or augment the respective layout in various ways.
+ *
+ * Generally, should either be empty or have the same number of values
+ * as the number of layouts. You may use empty values as in "intl,,neo".
+ *
+ * If NULL or the empty string "", and a default value is also used
+ * for the layout, a default value is used. Otherwise no variant is
+ * used.
+ * If the XKB_DEFAULT_VARIANT environment variable is set, it is used
+ * as the default. Otherwise the system default is used.
+ */
+ const char *variant;
+ /**
+ * A comma separated list of options, through which the user specifies
+ * non-layout related preferences, like which key combinations are used
+ * for switching layouts, or which key is the Compose key.
+ *
+ * If NULL, a default value is used. If the empty string "", no
+ * options are used.
+ * If the XKB_DEFAULT_OPTIONS environment variable is set, it is used
+ * as the default. Otherwise the system default is used.
+ */
+ const char *options;
+};
+
+/**
+ * @defgroup keysyms Keysyms
+ * Utility functions related to keysyms.
+ *
+ * @{
+ */
+
+/**
+ * @page keysym-transformations Keysym Transformations
+ *
+ * Keysym translation is subject to several "keysym transformations",
+ * as described in the XKB specification. These are:
+ *
+ * - Capitalization transformation. If the Caps Lock modifier is
+ * active and was not consumed by the translation process, a single
+ * keysym is transformed to its upper-case form (if applicable).
+ * Similarly, the UTF-8/UTF-32 string produced is capitalized.
+ *
+ * This is described in:
+ * https://www.x.org/releases/current/doc/kbproto/xkbproto.html#Interpreting_the_Lock_Modifier
+ *
+ * - Control transformation. If the Control modifier is active and
+ * was not consumed by the translation process, the string produced
+ * is transformed to its matching ASCII control character (if
+ * applicable). Keysyms are not affected.
+ *
+ * This is described in:
+ * https://www.x.org/releases/current/doc/kbproto/xkbproto.html#Interpreting_the_Control_Modifier
+ *
+ * Each relevant function discusses which transformations it performs.
+ *
+ * These transformations are not applicable when a key produces multiple
+ * keysyms.
+ */
+
+
+/**
+ * Get the name of a keysym.
+ *
+ * For a description of how keysyms are named, see @ref xkb_keysym_t.
+ *
+ * @param[in] keysym The keysym.
+ * @param[out] buffer A string buffer to write the name into.
+ * @param[in] size Size of the buffer.
+ *
+ * @warning If the buffer passed is too small, the string is truncated
+ * (though still NUL-terminated); a size of at least 64 bytes is recommended.
+ *
+ * @returns The number of bytes in the name, excluding the NUL byte. If
+ * the keysym is invalid, returns -1.
+ *
+ * You may check if truncation has occurred by comparing the return value
+ * with the length of buffer, similarly to the snprintf(3) function.
+ *
+ * @sa xkb_keysym_t
+ */
+int
+xkb_keysym_get_name(xkb_keysym_t keysym, char *buffer, size_t size);
+
+/** Flags for xkb_keysym_from_name(). */
+enum xkb_keysym_flags {
+ /** Do not apply any flags. */
+ XKB_KEYSYM_NO_FLAGS = 0,
+ /** Find keysym by case-insensitive search. */
+ XKB_KEYSYM_CASE_INSENSITIVE = (1 << 0)
+};
+
+/**
+ * Get a keysym from its name.
+ *
+ * @param name The name of a keysym. See remarks in xkb_keysym_get_name();
+ * this function will accept any name returned by that function.
+ * @param flags A set of flags controlling how the search is done. If
+ * invalid flags are passed, this will fail with XKB_KEY_NoSymbol.
+ *
+ * If you use the XKB_KEYSYM_CASE_INSENSITIVE flag and two keysym names
+ * differ only by case, then the lower-case keysym is returned. For
+ * instance, for KEY_a and KEY_A, this function would return KEY_a for the
+ * case-insensitive search. If this functionality is needed, it is
+ * recommended to first call this function without this flag; and if that
+ * fails, only then to try with this flag, while possibly warning the user
+ * he had misspelled the name, and might get wrong results.
+ *
+ * Case folding is done according to the C locale; the current locale is not
+ * consulted.
+ *
+ * @returns The keysym. If the name is invalid, returns XKB_KEY_NoSymbol.
+ *
+ * @sa xkb_keysym_t
+ */
+xkb_keysym_t
+xkb_keysym_from_name(const char *name, enum xkb_keysym_flags flags);
+
+/**
+ * Get the Unicode/UTF-8 representation of a keysym.
+ *
+ * @param[in] keysym The keysym.
+ * @param[out] buffer A buffer to write the UTF-8 string into.
+ * @param[in] size The size of buffer. Must be at least 7.
+ *
+ * @returns The number of bytes written to the buffer (including the
+ * terminating byte). If the keysym does not have a Unicode
+ * representation, returns 0. If the buffer is too small, returns -1.
+ *
+ * This function does not perform any @ref keysym-transformations.
+ * Therefore, prefer to use xkb_state_key_get_utf8() if possible.
+ *
+ * @sa xkb_state_key_get_utf8()
+ */
+int
+xkb_keysym_to_utf8(xkb_keysym_t keysym, char *buffer, size_t size);
+
+/**
+ * Get the Unicode/UTF-32 representation of a keysym.
+ *
+ * @returns The Unicode/UTF-32 representation of keysym, which is also
+ * compatible with UCS-4. If the keysym does not have a Unicode
+ * representation, returns 0.
+ *
+ * This function does not perform any @ref keysym-transformations.
+ * Therefore, prefer to use xkb_state_key_get_utf32() if possible.
+ *
+ * @sa xkb_state_key_get_utf32()
+ */
+uint32_t
+xkb_keysym_to_utf32(xkb_keysym_t keysym);
+
+/**
+ * Get the keysym corresponding to a Unicode/UTF-32 codepoint.
+ *
+ * @returns The keysym corresponding to the specified Unicode
+ * codepoint, or XKB_KEY_NoSymbol if there is none.
+ *
+ * This function is the inverse of @ref xkb_keysym_to_utf32. In cases
+ * where a single codepoint corresponds to multiple keysyms, returns
+ * the keysym with the lowest value.
+ *
+ * Unicode codepoints which do not have a special (legacy) keysym
+ * encoding use a direct encoding scheme. These keysyms don't usually
+ * have an associated keysym constant (XKB_KEY_*).
+ *
+ * For noncharacter Unicode codepoints and codepoints outside of the
+ * defined Unicode planes this function returns XKB_KEY_NoSymbol.
+ *
+ * @sa xkb_keysym_to_utf32()
+ * @since 1.0.0
+ */
+xkb_keysym_t
+xkb_utf32_to_keysym(uint32_t ucs);
+
+/**
+ * Convert a keysym to its uppercase form.
+ *
+ * If there is no such form, the keysym is returned unchanged.
+ *
+ * The conversion rules may be incomplete; prefer to work with the Unicode
+ * representation instead, when possible.
+ */
+xkb_keysym_t
+xkb_keysym_to_upper(xkb_keysym_t ks);
+
+/**
+ * Convert a keysym to its lowercase form.
+ *
+ * The conversion rules may be incomplete; prefer to work with the Unicode
+ * representation instead, when possible.
+ */
+xkb_keysym_t
+xkb_keysym_to_lower(xkb_keysym_t ks);
+
+/** @} */
+
+/**
+ * @defgroup context Library Context
+ * Creating, destroying and using library contexts.
+ *
+ * Every keymap compilation request must have a context associated with
+ * it. The context keeps around state such as the include path.
+ *
+ * @{
+ */
+
+/**
+ * @page envvars Environment Variables
+ *
+ * The user may set some environment variables which affect the library:
+ *
+ * - `XKB_CONFIG_ROOT`, `XKB_CONFIG_EXTRA_PATH`, `XDG_CONFIG_DIR`, `HOME` - see @ref include-path.
+ * - `XKB_LOG_LEVEL` - see xkb_context_set_log_level().
+ * - `XKB_LOG_VERBOSITY` - see xkb_context_set_log_verbosity().
+ * - `XKB_DEFAULT_RULES`, `XKB_DEFAULT_MODEL`, `XKB_DEFAULT_LAYOUT`,
+ * `XKB_DEFAULT_VARIANT`, `XKB_DEFAULT_OPTIONS` - see xkb_rule_names.
+ */
+
+/** Flags for context creation. */
+enum xkb_context_flags {
+ /** Do not apply any context flags. */
+ XKB_CONTEXT_NO_FLAGS = 0,
+ /** Create this context with an empty include path. */
+ XKB_CONTEXT_NO_DEFAULT_INCLUDES = (1 << 0),
+ /**
+ * Don't take RMLVO names from the environment.
+ * @since 0.3.0
+ */
+ XKB_CONTEXT_NO_ENVIRONMENT_NAMES = (1 << 1)
+};
+
+/**
+ * Create a new context.
+ *
+ * @param flags Optional flags for the context, or 0.
+ *
+ * @returns A new context, or NULL on failure.
+ *
+ * @memberof xkb_context
+ */
+struct xkb_context *
+xkb_context_new(enum xkb_context_flags flags);
+
+/**
+ * Take a new reference on a context.
+ *
+ * @returns The passed in context.
+ *
+ * @memberof xkb_context
+ */
+struct xkb_context *
+xkb_context_ref(struct xkb_context *context);
+
+/**
+ * Release a reference on a context, and possibly free it.
+ *
+ * @param context The context. If it is NULL, this function does nothing.
+ *
+ * @memberof xkb_context
+ */
+void
+xkb_context_unref(struct xkb_context *context);
+
+/**
+ * Store custom user data in the context.
+ *
+ * This may be useful in conjunction with xkb_context_set_log_fn() or other
+ * callbacks.
+ *
+ * @memberof xkb_context
+ */
+void
+xkb_context_set_user_data(struct xkb_context *context, void *user_data);
+
+/**
+ * Retrieves stored user data from the context.
+ *
+ * @returns The stored user data. If the user data wasn't set, or the
+ * passed in context is NULL, returns NULL.
+ *
+ * This may be useful to access private user data from callbacks like a
+ * custom logging function.
+ *
+ * @memberof xkb_context
+ **/
+void *
+xkb_context_get_user_data(struct xkb_context *context);
+
+/** @} */
+
+/**
+ * @defgroup include-path Include Paths
+ * Manipulating the include paths in a context.
+ *
+ * The include paths are the file-system paths that are searched when an
+ * include statement is encountered during keymap compilation.
+ *
+ * The default include paths are, in that lookup order:
+ * - The path `$XDG_CONFIG_HOME/xkb`, with the usual `XDG_CONFIG_HOME`
+ * fallback to `$HOME/.config/` if unset.
+ * - The path `$HOME/.xkb`, where $HOME is the value of the environment
+ * variable `HOME`.
+ * - The `XKB_CONFIG_EXTRA_PATH` environment variable, if defined, otherwise the
+ * system configuration directory, defined at library configuration time
+ * (usually `/etc/xkb`).
+ * - The `XKB_CONFIG_ROOT` environment variable, if defined, otherwise
+ * the system XKB root, defined at library configuration time.
+ *
+ * @{
+ */
+
+/**
+ * Append a new entry to the context's include path.
+ *
+ * @returns 1 on success, or 0 if the include path could not be added or is
+ * inaccessible.
+ *
+ * @memberof xkb_context
+ */
+int
+xkb_context_include_path_append(struct xkb_context *context, const char *path);
+
+/**
+ * Append the default include paths to the context's include path.
+ *
+ * @returns 1 on success, or 0 if the primary include path could not be added.
+ *
+ * @memberof xkb_context
+ */
+int
+xkb_context_include_path_append_default(struct xkb_context *context);
+
+/**
+ * Reset the context's include path to the default.
+ *
+ * Removes all entries from the context's include path, and inserts the
+ * default paths.
+ *
+ * @returns 1 on success, or 0 if the primary include path could not be added.
+ *
+ * @memberof xkb_context
+ */
+int
+xkb_context_include_path_reset_defaults(struct xkb_context *context);
+
+/**
+ * Remove all entries from the context's include path.
+ *
+ * @memberof xkb_context
+ */
+void
+xkb_context_include_path_clear(struct xkb_context *context);
+
+/**
+ * Get the number of paths in the context's include path.
+ *
+ * @memberof xkb_context
+ */
+unsigned int
+xkb_context_num_include_paths(struct xkb_context *context);
+
+/**
+ * Get a specific include path from the context's include path.
+ *
+ * @returns The include path at the specified index. If the index is
+ * invalid, returns NULL.
+ *
+ * @memberof xkb_context
+ */
+const char *
+xkb_context_include_path_get(struct xkb_context *context, unsigned int index);
+
+/** @} */
+
+/**
+ * @defgroup logging Logging Handling
+ * Manipulating how logging from this library is handled.
+ *
+ * @{
+ */
+
+/** Specifies a logging level. */
+enum xkb_log_level {
+ XKB_LOG_LEVEL_CRITICAL = 10, /**< Log critical internal errors only. */
+ XKB_LOG_LEVEL_ERROR = 20, /**< Log all errors. */
+ XKB_LOG_LEVEL_WARNING = 30, /**< Log warnings and errors. */
+ XKB_LOG_LEVEL_INFO = 40, /**< Log information, warnings, and errors. */
+ XKB_LOG_LEVEL_DEBUG = 50 /**< Log everything. */
+};
+
+/**
+ * Set the current logging level.
+ *
+ * @param context The context in which to set the logging level.
+ * @param level The logging level to use. Only messages from this level
+ * and below will be logged.
+ *
+ * The default level is XKB_LOG_LEVEL_ERROR. The environment variable
+ * XKB_LOG_LEVEL, if set in the time the context was created, overrides the
+ * default value. It may be specified as a level number or name.
+ *
+ * @memberof xkb_context
+ */
+void
+xkb_context_set_log_level(struct xkb_context *context,
+ enum xkb_log_level level);
+
+/**
+ * Get the current logging level.
+ *
+ * @memberof xkb_context
+ */
+enum xkb_log_level
+xkb_context_get_log_level(struct xkb_context *context);
+
+/**
+ * Sets the current logging verbosity.
+ *
+ * The library can generate a number of warnings which are not helpful to
+ * ordinary users of the library. The verbosity may be increased if more
+ * information is desired (e.g. when developing a new keymap).
+ *
+ * The default verbosity is 0. The environment variable XKB_LOG_VERBOSITY,
+ * if set in the time the context was created, overrides the default value.
+ *
+ * @param context The context in which to use the set verbosity.
+ * @param verbosity The verbosity to use. Currently used values are
+ * 1 to 10, higher values being more verbose. 0 would result in no verbose
+ * messages being logged.
+ *
+ * Most verbose messages are of level XKB_LOG_LEVEL_WARNING or lower.
+ *
+ * @memberof xkb_context
+ */
+void
+xkb_context_set_log_verbosity(struct xkb_context *context, int verbosity);
+
+/**
+ * Get the current logging verbosity of the context.
+ *
+ * @memberof xkb_context
+ */
+int
+xkb_context_get_log_verbosity(struct xkb_context *context);
+
+/**
+ * Set a custom function to handle logging messages.
+ *
+ * @param context The context in which to use the set logging function.
+ * @param log_fn The function that will be called for logging messages.
+ * Passing NULL restores the default function, which logs to stderr.
+ *
+ * By default, log messages from this library are printed to stderr. This
+ * function allows you to replace the default behavior with a custom
+ * handler. The handler is only called with messages which match the
+ * current logging level and verbosity settings for the context.
+ * level is the logging level of the message. @a format and @a args are
+ * the same as in the vprintf(3) function.
+ *
+ * You may use xkb_context_set_user_data() on the context, and then call
+ * xkb_context_get_user_data() from within the logging function to provide
+ * it with additional private context.
+ *
+ * @memberof xkb_context
+ */
+void
+xkb_context_set_log_fn(struct xkb_context *context,
+ void (*log_fn)(struct xkb_context *context,
+ enum xkb_log_level level,
+ const char *format, va_list args));
+
+/** @} */
+
+/**
+ * @defgroup keymap Keymap Creation
+ * Creating and destroying keymaps.
+ *
+ * @{
+ */
+
+/** Flags for keymap compilation. */
+enum xkb_keymap_compile_flags {
+ /** Do not apply any flags. */
+ XKB_KEYMAP_COMPILE_NO_FLAGS = 0
+};
+
+/**
+ * Create a keymap from RMLVO names.
+ *
+ * The primary keymap entry point: creates a new XKB keymap from a set of
+ * RMLVO (Rules + Model + Layouts + Variants + Options) names.
+ *
+ * @param context The context in which to create the keymap.
+ * @param names The RMLVO names to use. See xkb_rule_names.
+ * @param flags Optional flags for the keymap, or 0.
+ *
+ * @returns A keymap compiled according to the RMLVO names, or NULL if
+ * the compilation failed.
+ *
+ * @sa xkb_rule_names
+ * @memberof xkb_keymap
+ */
+struct xkb_keymap *
+xkb_keymap_new_from_names(struct xkb_context *context,
+ const struct xkb_rule_names *names,
+ enum xkb_keymap_compile_flags flags);
+
+/** The possible keymap formats. */
+enum xkb_keymap_format {
+ /** The current/classic XKB text format, as generated by xkbcomp -xkb. */
+ XKB_KEYMAP_FORMAT_TEXT_V1 = 1
+};
+
+/**
+ * Create a keymap from a keymap file.
+ *
+ * @param context The context in which to create the keymap.
+ * @param file The keymap file to compile.
+ * @param format The text format of the keymap file to compile.
+ * @param flags Optional flags for the keymap, or 0.
+ *
+ * @returns A keymap compiled from the given XKB keymap file, or NULL if
+ * the compilation failed.
+ *
+ * The file must contain a complete keymap. For example, in the
+ * XKB_KEYMAP_FORMAT_TEXT_V1 format, this means the file must contain one
+ * top level '%xkb_keymap' section, which in turn contains other required
+ * sections.
+ *
+ * @memberof xkb_keymap
+ */
+struct xkb_keymap *
+xkb_keymap_new_from_file(struct xkb_context *context, FILE *file,
+ enum xkb_keymap_format format,
+ enum xkb_keymap_compile_flags flags);
+
+/**
+ * Create a keymap from a keymap string.
+ *
+ * This is just like xkb_keymap_new_from_file(), but instead of a file, gets
+ * the keymap as one enormous string.
+ *
+ * @see xkb_keymap_new_from_file()
+ * @memberof xkb_keymap
+ */
+struct xkb_keymap *
+xkb_keymap_new_from_string(struct xkb_context *context, const char *string,
+ enum xkb_keymap_format format,
+ enum xkb_keymap_compile_flags flags);
+
+/**
+ * Create a keymap from a memory buffer.
+ *
+ * This is just like xkb_keymap_new_from_string(), but takes a length argument
+ * so the input string does not have to be zero-terminated.
+ *
+ * @see xkb_keymap_new_from_string()
+ * @memberof xkb_keymap
+ * @since 0.3.0
+ */
+struct xkb_keymap *
+xkb_keymap_new_from_buffer(struct xkb_context *context, const char *buffer,
+ size_t length, enum xkb_keymap_format format,
+ enum xkb_keymap_compile_flags flags);
+
+/**
+ * Take a new reference on a keymap.
+ *
+ * @returns The passed in keymap.
+ *
+ * @memberof xkb_keymap
+ */
+struct xkb_keymap *
+xkb_keymap_ref(struct xkb_keymap *keymap);
+
+/**
+ * Release a reference on a keymap, and possibly free it.
+ *
+ * @param keymap The keymap. If it is NULL, this function does nothing.
+ *
+ * @memberof xkb_keymap
+ */
+void
+xkb_keymap_unref(struct xkb_keymap *keymap);
+
+/**
+ * Get the keymap as a string in the format from which it was created.
+ * @sa xkb_keymap_get_as_string()
+ **/
+#define XKB_KEYMAP_USE_ORIGINAL_FORMAT ((enum xkb_keymap_format) -1)
+
+/**
+ * Get the compiled keymap as a string.
+ *
+ * @param keymap The keymap to get as a string.
+ * @param format The keymap format to use for the string. You can pass
+ * in the special value XKB_KEYMAP_USE_ORIGINAL_FORMAT to use the format
+ * from which the keymap was originally created.
+ *
+ * @returns The keymap as a NUL-terminated string, or NULL if unsuccessful.
+ *
+ * The returned string may be fed back into xkb_keymap_new_from_string() to get
+ * the exact same keymap (possibly in another process, etc.).
+ *
+ * The returned string is dynamically allocated and should be freed by the
+ * caller.
+ *
+ * @memberof xkb_keymap
+ */
+char *
+xkb_keymap_get_as_string(struct xkb_keymap *keymap,
+ enum xkb_keymap_format format);
+
+/** @} */
+
+/**
+ * @defgroup components Keymap Components
+ * Enumeration of state components in a keymap.
+ *
+ * @{
+ */
+
+/**
+ * Get the minimum keycode in the keymap.
+ *
+ * @sa xkb_keycode_t
+ * @memberof xkb_keymap
+ * @since 0.3.1
+ */
+xkb_keycode_t
+xkb_keymap_min_keycode(struct xkb_keymap *keymap);
+
+/**
+ * Get the maximum keycode in the keymap.
+ *
+ * @sa xkb_keycode_t
+ * @memberof xkb_keymap
+ * @since 0.3.1
+ */
+xkb_keycode_t
+xkb_keymap_max_keycode(struct xkb_keymap *keymap);
+
+/**
+ * The iterator used by xkb_keymap_key_for_each().
+ *
+ * @sa xkb_keymap_key_for_each
+ * @memberof xkb_keymap
+ * @since 0.3.1
+ */
+typedef void
+(*xkb_keymap_key_iter_t)(struct xkb_keymap *keymap, xkb_keycode_t key,
+ void *data);
+
+/**
+ * Run a specified function for every valid keycode in the keymap. If a
+ * keymap is sparse, this function may be called fewer than
+ * (max_keycode - min_keycode + 1) times.
+ *
+ * @sa xkb_keymap_min_keycode() xkb_keymap_max_keycode() xkb_keycode_t
+ * @memberof xkb_keymap
+ * @since 0.3.1
+ */
+void
+xkb_keymap_key_for_each(struct xkb_keymap *keymap, xkb_keymap_key_iter_t iter,
+ void *data);
+
+/**
+ * Find the name of the key with the given keycode.
+ *
+ * This function always returns the canonical name of the key (see
+ * description in xkb_keycode_t).
+ *
+ * @returns The key name. If no key with this keycode exists,
+ * returns NULL.
+ *
+ * @sa xkb_keycode_t
+ * @memberof xkb_keymap
+ * @since 0.6.0
+ */
+const char *
+xkb_keymap_key_get_name(struct xkb_keymap *keymap, xkb_keycode_t key);
+
+/**
+ * Find the keycode of the key with the given name.
+ *
+ * The name can be either a canonical name or an alias.
+ *
+ * @returns The keycode. If no key with this name exists,
+ * returns XKB_KEYCODE_INVALID.
+ *
+ * @sa xkb_keycode_t
+ * @memberof xkb_keymap
+ * @since 0.6.0
+ */
+xkb_keycode_t
+xkb_keymap_key_by_name(struct xkb_keymap *keymap, const char *name);
+
+/**
+ * Get the number of modifiers in the keymap.
+ *
+ * @sa xkb_mod_index_t
+ * @memberof xkb_keymap
+ */
+xkb_mod_index_t
+xkb_keymap_num_mods(struct xkb_keymap *keymap);
+
+/**
+ * Get the name of a modifier by index.
+ *
+ * @returns The name. If the index is invalid, returns NULL.
+ *
+ * @sa xkb_mod_index_t
+ * @memberof xkb_keymap
+ */
+const char *
+xkb_keymap_mod_get_name(struct xkb_keymap *keymap, xkb_mod_index_t idx);
+
+/**
+ * Get the index of a modifier by name.
+ *
+ * @returns The index. If no modifier with this name exists, returns
+ * XKB_MOD_INVALID.
+ *
+ * @sa xkb_mod_index_t
+ * @memberof xkb_keymap
+ */
+xkb_mod_index_t
+xkb_keymap_mod_get_index(struct xkb_keymap *keymap, const char *name);
+
+/**
+ * Get the number of layouts in the keymap.
+ *
+ * @sa xkb_layout_index_t xkb_rule_names xkb_keymap_num_layouts_for_key()
+ * @memberof xkb_keymap
+ */
+xkb_layout_index_t
+xkb_keymap_num_layouts(struct xkb_keymap *keymap);
+
+/**
+ * Get the name of a layout by index.
+ *
+ * @returns The name. If the index is invalid, or the layout does not have
+ * a name, returns NULL.
+ *
+ * @sa xkb_layout_index_t
+ * For notes on layout names.
+ * @memberof xkb_keymap
+ */
+const char *
+xkb_keymap_layout_get_name(struct xkb_keymap *keymap, xkb_layout_index_t idx);
+
+/**
+ * Get the index of a layout by name.
+ *
+ * @returns The index. If no layout exists with this name, returns
+ * XKB_LAYOUT_INVALID. If more than one layout in the keymap has this name,
+ * returns the lowest index among them.
+ *
+ * @sa xkb_layout_index_t
+ * For notes on layout names.
+ * @memberof xkb_keymap
+ */
+xkb_layout_index_t
+xkb_keymap_layout_get_index(struct xkb_keymap *keymap, const char *name);
+
+/**
+ * Get the number of LEDs in the keymap.
+ *
+ * @warning The range [ 0...xkb_keymap_num_leds() ) includes all of the LEDs
+ * in the keymap, but may also contain inactive LEDs. When iterating over
+ * this range, you need the handle this case when calling functions such as
+ * xkb_keymap_led_get_name() or xkb_state_led_index_is_active().
+ *
+ * @sa xkb_led_index_t
+ * @memberof xkb_keymap
+ */
+xkb_led_index_t
+xkb_keymap_num_leds(struct xkb_keymap *keymap);
+
+/**
+ * Get the name of a LED by index.
+ *
+ * @returns The name. If the index is invalid, returns NULL.
+ *
+ * @memberof xkb_keymap
+ */
+const char *
+xkb_keymap_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx);
+
+/**
+ * Get the index of a LED by name.
+ *
+ * @returns The index. If no LED with this name exists, returns
+ * XKB_LED_INVALID.
+ *
+ * @memberof xkb_keymap
+ */
+xkb_led_index_t
+xkb_keymap_led_get_index(struct xkb_keymap *keymap, const char *name);
+
+/**
+ * Get the number of layouts for a specific key.
+ *
+ * This number can be different from xkb_keymap_num_layouts(), but is always
+ * smaller. It is the appropriate value to use when iterating over the
+ * layouts of a key.
+ *
+ * @sa xkb_layout_index_t
+ * @memberof xkb_keymap
+ */
+xkb_layout_index_t
+xkb_keymap_num_layouts_for_key(struct xkb_keymap *keymap, xkb_keycode_t key);
+
+/**
+ * Get the number of shift levels for a specific key and layout.
+ *
+ * If @c layout is out of range for this key (that is, larger or equal to
+ * the value returned by xkb_keymap_num_layouts_for_key()), it is brought
+ * back into range in a manner consistent with xkb_state_key_get_layout().
+ *
+ * @sa xkb_level_index_t
+ * @memberof xkb_keymap
+ */
+xkb_level_index_t
+xkb_keymap_num_levels_for_key(struct xkb_keymap *keymap, xkb_keycode_t key,
+ xkb_layout_index_t layout);
+
+/**
+ * Retrieves every possible modifier mask that produces the specified
+ * shift level for a specific key and layout.
+ *
+ * This API is useful for inverse key transformation; i.e. finding out
+ * which modifiers need to be active in order to be able to type the
+ * keysym(s) corresponding to the specific key code, layout and level.
+ *
+ * @warning It returns only up to masks_size modifier masks. If the
+ * buffer passed is too small, some of the possible modifier combinations
+ * will not be returned.
+ *
+ * @param[in] keymap The keymap.
+ * @param[in] key The keycode of the key.
+ * @param[in] layout The layout for which to get modifiers.
+ * @param[in] level The shift level in the layout for which to get the
+ * modifiers. This should be smaller than:
+ * @code xkb_keymap_num_levels_for_key(keymap, key) @endcode
+ * @param[out] masks_out A buffer in which the requested masks should be
+ * stored.
+ * @param[out] masks_size The size of the buffer pointed to by masks_out.
+ *
+ * If @c layout is out of range for this key (that is, larger or equal to
+ * the value returned by xkb_keymap_num_layouts_for_key()), it is brought
+ * back into range in a manner consistent with xkb_state_key_get_layout().
+ *
+ * @returns The number of modifier masks stored in the masks_out array.
+ * If the key is not in the keymap or if the specified shift level cannot
+ * be reached it returns 0 and does not modify the masks_out buffer.
+ *
+ * @sa xkb_level_index_t
+ * @sa xkb_mod_mask_t
+ * @memberof xkb_keymap
+ * @since 1.0.0
+ */
+size_t
+xkb_keymap_key_get_mods_for_level(struct xkb_keymap *keymap,
+ xkb_keycode_t key,
+ xkb_layout_index_t layout,
+ xkb_level_index_t level,
+ xkb_mod_mask_t *masks_out,
+ size_t masks_size);
+
+/**
+ * Get the keysyms obtained from pressing a key in a given layout and
+ * shift level.
+ *
+ * This function is like xkb_state_key_get_syms(), only the layout and
+ * shift level are not derived from the keyboard state but are instead
+ * specified explicitly.
+ *
+ * @param[in] keymap The keymap.
+ * @param[in] key The keycode of the key.
+ * @param[in] layout The layout for which to get the keysyms.
+ * @param[in] level The shift level in the layout for which to get the
+ * keysyms. This should be smaller than:
+ * @code xkb_keymap_num_levels_for_key(keymap, key) @endcode
+ * @param[out] syms_out An immutable array of keysyms corresponding to the
+ * key in the given layout and shift level.
+ *
+ * If @c layout is out of range for this key (that is, larger or equal to
+ * the value returned by xkb_keymap_num_layouts_for_key()), it is brought
+ * back into range in a manner consistent with xkb_state_key_get_layout().
+ *
+ * @returns The number of keysyms in the syms_out array. If no keysyms
+ * are produced by the key in the given layout and shift level, returns 0
+ * and sets syms_out to NULL.
+ *
+ * @sa xkb_state_key_get_syms()
+ * @memberof xkb_keymap
+ */
+int
+xkb_keymap_key_get_syms_by_level(struct xkb_keymap *keymap,
+ xkb_keycode_t key,
+ xkb_layout_index_t layout,
+ xkb_level_index_t level,
+ const xkb_keysym_t **syms_out);
+
+/**
+ * Determine whether a key should repeat or not.
+ *
+ * A keymap may specify different repeat behaviors for different keys.
+ * Most keys should generally exhibit repeat behavior; for example, holding
+ * the 'a' key down in a text editor should normally insert a single 'a'
+ * character every few milliseconds, until the key is released. However,
+ * there are keys which should not or do not need to be repeated. For
+ * example, repeating modifier keys such as Left/Right Shift or Caps Lock
+ * is not generally useful or desired.
+ *
+ * @returns 1 if the key should repeat, 0 otherwise.
+ *
+ * @memberof xkb_keymap
+ */
+int
+xkb_keymap_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t key);
+
+/** @} */
+
+/**
+ * @defgroup state Keyboard State
+ * Creating, destroying and manipulating keyboard state objects.
+ *
+ * @{
+ */
+
+/**
+ * Create a new keyboard state object.
+ *
+ * @param keymap The keymap which the state will use.
+ *
+ * @returns A new keyboard state object, or NULL on failure.
+ *
+ * @memberof xkb_state
+ */
+struct xkb_state *
+xkb_state_new(struct xkb_keymap *keymap);
+
+/**
+ * Take a new reference on a keyboard state object.
+ *
+ * @returns The passed in object.
+ *
+ * @memberof xkb_state
+ */
+struct xkb_state *
+xkb_state_ref(struct xkb_state *state);
+
+/**
+ * Release a reference on a keybaord state object, and possibly free it.
+ *
+ * @param state The state. If it is NULL, this function does nothing.
+ *
+ * @memberof xkb_state
+ */
+void
+xkb_state_unref(struct xkb_state *state);
+
+/**
+ * Get the keymap which a keyboard state object is using.
+ *
+ * @returns The keymap which was passed to xkb_state_new() when creating
+ * this state object.
+ *
+ * This function does not take a new reference on the keymap; you must
+ * explicitly reference it yourself if you plan to use it beyond the
+ * lifetime of the state.
+ *
+ * @memberof xkb_state
+ */
+struct xkb_keymap *
+xkb_state_get_keymap(struct xkb_state *state);
+
+/** Specifies the direction of the key (press / release). */
+enum xkb_key_direction {
+ XKB_KEY_UP, /**< The key was released. */
+ XKB_KEY_DOWN /**< The key was pressed. */
+};
+
+/**
+ * Modifier and layout types for state objects. This enum is bitmaskable,
+ * e.g. (XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED) is valid to
+ * exclude locked modifiers.
+ *
+ * In XKB, the DEPRESSED components are also known as 'base'.
+ */
+enum xkb_state_component {
+ /** Depressed modifiers, i.e. a key is physically holding them. */
+ XKB_STATE_MODS_DEPRESSED = (1 << 0),
+ /** Latched modifiers, i.e. will be unset after the next non-modifier
+ * key press. */
+ XKB_STATE_MODS_LATCHED = (1 << 1),
+ /** Locked modifiers, i.e. will be unset after the key provoking the
+ * lock has been pressed again. */
+ XKB_STATE_MODS_LOCKED = (1 << 2),
+ /** Effective modifiers, i.e. currently active and affect key
+ * processing (derived from the other state components).
+ * Use this unless you explicitly care how the state came about. */
+ XKB_STATE_MODS_EFFECTIVE = (1 << 3),
+ /** Depressed layout, i.e. a key is physically holding it. */
+ XKB_STATE_LAYOUT_DEPRESSED = (1 << 4),
+ /** Latched layout, i.e. will be unset after the next non-modifier
+ * key press. */
+ XKB_STATE_LAYOUT_LATCHED = (1 << 5),
+ /** Locked layout, i.e. will be unset after the key provoking the lock
+ * has been pressed again. */
+ XKB_STATE_LAYOUT_LOCKED = (1 << 6),
+ /** Effective layout, i.e. currently active and affects key processing
+ * (derived from the other state components).
+ * Use this unless you explicitly care how the state came about. */
+ XKB_STATE_LAYOUT_EFFECTIVE = (1 << 7),
+ /** LEDs (derived from the other state components). */
+ XKB_STATE_LEDS = (1 << 8)
+};
+
+/**
+ * Update the keyboard state to reflect a given key being pressed or
+ * released.
+ *
+ * This entry point is intended for programs which track the keyboard state
+ * explicitly (like an evdev client). If the state is serialized to you by
+ * a master process (like a Wayland compositor) using functions like
+ * xkb_state_serialize_mods(), you should use xkb_state_update_mask() instead.
+ * The two functions should not generally be used together.
+ *
+ * A series of calls to this function should be consistent; that is, a call
+ * with XKB_KEY_DOWN for a key should be matched by an XKB_KEY_UP; if a key
+ * is pressed twice, it should be released twice; etc. Otherwise (e.g. due
+ * to missed input events), situations like "stuck modifiers" may occur.
+ *
+ * This function is often used in conjunction with the function
+ * xkb_state_key_get_syms() (or xkb_state_key_get_one_sym()), for example,
+ * when handling a key event. In this case, you should prefer to get the
+ * keysyms *before* updating the key, such that the keysyms reported for
+ * the key event are not affected by the event itself. This is the
+ * conventional behavior.
+ *
+ * @returns A mask of state components that have changed as a result of
+ * the update. If nothing in the state has changed, returns 0.
+ *
+ * @memberof xkb_state
+ *
+ * @sa xkb_state_update_mask()
+ */
+enum xkb_state_component
+xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
+ enum xkb_key_direction direction);
+
+/**
+ * Update a keyboard state from a set of explicit masks.
+ *
+ * This entry point is intended for window systems and the like, where a
+ * master process holds an xkb_state, then serializes it over a wire
+ * protocol, and clients then use the serialization to feed in to their own
+ * xkb_state.
+ *
+ * All parameters must always be passed, or the resulting state may be
+ * incoherent.
+ *
+ * The serialization is lossy and will not survive round trips; it must only
+ * be used to feed slave state objects, and must not be used to update the
+ * master state.
+ *
+ * If you do not fit the description above, you should use
+ * xkb_state_update_key() instead. The two functions should not generally be
+ * used together.
+ *
+ * @returns A mask of state components that have changed as a result of
+ * the update. If nothing in the state has changed, returns 0.
+ *
+ * @memberof xkb_state
+ *
+ * @sa xkb_state_component
+ * @sa xkb_state_update_key
+ */
+enum xkb_state_component
+xkb_state_update_mask(struct xkb_state *state,
+ xkb_mod_mask_t depressed_mods,
+ xkb_mod_mask_t latched_mods,
+ xkb_mod_mask_t locked_mods,
+ xkb_layout_index_t depressed_layout,
+ xkb_layout_index_t latched_layout,
+ xkb_layout_index_t locked_layout);
+
+/**
+ * Get the keysyms obtained from pressing a particular key in a given
+ * keyboard state.
+ *
+ * Get the keysyms for a key according to the current active layout,
+ * modifiers and shift level for the key, as determined by a keyboard
+ * state.
+ *
+ * @param[in] state The keyboard state object.
+ * @param[in] key The keycode of the key.
+ * @param[out] syms_out An immutable array of keysyms corresponding the
+ * key in the given keyboard state.
+ *
+ * As an extension to XKB, this function can return more than one keysym.
+ * If you do not want to handle this case, you can use
+ * xkb_state_key_get_one_sym() for a simpler interface.
+ *
+ * This function does not perform any @ref keysym-transformations.
+ * (This might change).
+ *
+ * @returns The number of keysyms in the syms_out array. If no keysyms
+ * are produced by the key in the given keyboard state, returns 0 and sets
+ * syms_out to NULL.
+ *
+ * @memberof xkb_state
+ */
+int
+xkb_state_key_get_syms(struct xkb_state *state, xkb_keycode_t key,
+ const xkb_keysym_t **syms_out);
+
+/**
+ * Get the Unicode/UTF-8 string obtained from pressing a particular key
+ * in a given keyboard state.
+ *
+ * @param[in] state The keyboard state object.
+ * @param[in] key The keycode of the key.
+ * @param[out] buffer A buffer to write the string into.
+ * @param[in] size Size of the buffer.
+ *
+ * @warning If the buffer passed is too small, the string is truncated
+ * (though still NUL-terminated).
+ *
+ * @returns The number of bytes required for the string, excluding the
+ * NUL byte. If there is nothing to write, returns 0.
+ *
+ * You may check if truncation has occurred by comparing the return value
+ * with the size of @p buffer, similarly to the snprintf(3) function.
+ * You may safely pass NULL and 0 to @p buffer and @p size to find the
+ * required size (without the NUL-byte).
+ *
+ * This function performs Capitalization and Control @ref
+ * keysym-transformations.
+ *
+ * @memberof xkb_state
+ * @since 0.4.1
+ */
+int
+xkb_state_key_get_utf8(struct xkb_state *state, xkb_keycode_t key,
+ char *buffer, size_t size);
+
+/**
+ * Get the Unicode/UTF-32 codepoint obtained from pressing a particular
+ * key in a a given keyboard state.
+ *
+ * @returns The UTF-32 representation for the key, if it consists of only
+ * a single codepoint. Otherwise, returns 0.
+ *
+ * This function performs Capitalization and Control @ref
+ * keysym-transformations.
+ *
+ * @memberof xkb_state
+ * @since 0.4.1
+ */
+uint32_t
+xkb_state_key_get_utf32(struct xkb_state *state, xkb_keycode_t key);
+
+/**
+ * Get the single keysym obtained from pressing a particular key in a
+ * given keyboard state.
+ *
+ * This function is similar to xkb_state_key_get_syms(), but intended
+ * for users which cannot or do not want to handle the case where
+ * multiple keysyms are returned (in which case this function is
+ * preferred).
+ *
+ * @returns The keysym. If the key does not have exactly one keysym,
+ * returns XKB_KEY_NoSymbol
+ *
+ * This function performs Capitalization @ref keysym-transformations.
+ *
+ * @sa xkb_state_key_get_syms()
+ * @memberof xkb_state
+ */
+xkb_keysym_t
+xkb_state_key_get_one_sym(struct xkb_state *state, xkb_keycode_t key);
+
+/**
+ * Get the effective layout index for a key in a given keyboard state.
+ *
+ * @returns The layout index for the key in the given keyboard state. If
+ * the given keycode is invalid, or if the key is not included in any
+ * layout at all, returns XKB_LAYOUT_INVALID.
+ *
+ * @invariant If the returned layout is valid, the following always holds:
+ * @code
+ * xkb_state_key_get_layout(state, key) < xkb_keymap_num_layouts_for_key(keymap, key)
+ * @endcode
+ *
+ * @memberof xkb_state
+ */
+xkb_layout_index_t
+xkb_state_key_get_layout(struct xkb_state *state, xkb_keycode_t key);
+
+/**
+ * Get the effective shift level for a key in a given keyboard state and
+ * layout.
+ *
+ * @param state The keyboard state.
+ * @param key The keycode of the key.
+ * @param layout The layout for which to get the shift level. This must be
+ * smaller than:
+ * @code xkb_keymap_num_layouts_for_key(keymap, key) @endcode
+ * usually it would be:
+ * @code xkb_state_key_get_layout(state, key) @endcode
+ *
+ * @return The shift level index. If the key or layout are invalid,
+ * returns XKB_LEVEL_INVALID.
+ *
+ * @invariant If the returned level is valid, the following always holds:
+ * @code
+ * xkb_state_key_get_level(state, key, layout) < xkb_keymap_num_levels_for_key(keymap, key, layout)
+ * @endcode
+ *
+ * @memberof xkb_state
+ */
+xkb_level_index_t
+xkb_state_key_get_level(struct xkb_state *state, xkb_keycode_t key,
+ xkb_layout_index_t layout);
+
+/**
+ * Match flags for xkb_state_mod_indices_are_active() and
+ * xkb_state_mod_names_are_active(), specifying the conditions for a
+ * successful match. XKB_STATE_MATCH_NON_EXCLUSIVE is bitmaskable with
+ * the other modes.
+ */
+enum xkb_state_match {
+ /** Returns true if any of the modifiers are active. */
+ XKB_STATE_MATCH_ANY = (1 << 0),
+ /** Returns true if all of the modifiers are active. */
+ XKB_STATE_MATCH_ALL = (1 << 1),
+ /** Makes matching non-exclusive, i.e. will not return false if a
+ * modifier not specified in the arguments is active. */
+ XKB_STATE_MATCH_NON_EXCLUSIVE = (1 << 16)
+};
+
+/**
+ * The counterpart to xkb_state_update_mask for modifiers, to be used on
+ * the server side of serialization.
+ *
+ * @param state The keyboard state.
+ * @param components A mask of the modifier state components to serialize.
+ * State components other than XKB_STATE_MODS_* are ignored.
+ * If XKB_STATE_MODS_EFFECTIVE is included, all other state components are
+ * ignored.
+ *
+ * @returns A xkb_mod_mask_t representing the given components of the
+ * modifier state.
+ *
+ * This function should not be used in regular clients; please use the
+ * xkb_state_mod_*_is_active API instead.
+ *
+ * @memberof xkb_state
+ */
+xkb_mod_mask_t
+xkb_state_serialize_mods(struct xkb_state *state,
+ enum xkb_state_component components);
+
+/**
+ * The counterpart to xkb_state_update_mask for layouts, to be used on
+ * the server side of serialization.
+ *
+ * @param state The keyboard state.
+ * @param components A mask of the layout state components to serialize.
+ * State components other than XKB_STATE_LAYOUT_* are ignored.
+ * If XKB_STATE_LAYOUT_EFFECTIVE is included, all other state components are
+ * ignored.
+ *
+ * @returns A layout index representing the given components of the
+ * layout state.
+ *
+ * This function should not be used in regular clients; please use the
+ * xkb_state_layout_*_is_active API instead.
+ *
+ * @memberof xkb_state
+ */
+xkb_layout_index_t
+xkb_state_serialize_layout(struct xkb_state *state,
+ enum xkb_state_component components);
+
+/**
+ * Test whether a modifier is active in a given keyboard state by name.
+ *
+ * @returns 1 if the modifier is active, 0 if it is not. If the modifier
+ * name does not exist in the keymap, returns -1.
+ *
+ * @memberof xkb_state
+ */
+int
+xkb_state_mod_name_is_active(struct xkb_state *state, const char *name,
+ enum xkb_state_component type);
+
+/**
+ * Test whether a set of modifiers are active in a given keyboard state by
+ * name.
+ *
+ * @param state The keyboard state.
+ * @param type The component of the state against which to match the
+ * given modifiers.
+ * @param match The manner by which to match the state against the
+ * given modifiers.
+ * @param ... The set of of modifier names to test, terminated by a NULL
+ * argument (sentinel).
+ *
+ * @returns 1 if the modifiers are active, 0 if they are not. If any of
+ * the modifier names do not exist in the keymap, returns -1.
+ *
+ * @memberof xkb_state
+ */
+int
+xkb_state_mod_names_are_active(struct xkb_state *state,
+ enum xkb_state_component type,
+ enum xkb_state_match match,
+ ...);
+
+/**
+ * Test whether a modifier is active in a given keyboard state by index.
+ *
+ * @returns 1 if the modifier is active, 0 if it is not. If the modifier
+ * index is invalid in the keymap, returns -1.
+ *
+ * @memberof xkb_state
+ */
+int
+xkb_state_mod_index_is_active(struct xkb_state *state, xkb_mod_index_t idx,
+ enum xkb_state_component type);
+
+/**
+ * Test whether a set of modifiers are active in a given keyboard state by
+ * index.
+ *
+ * @param state The keyboard state.
+ * @param type The component of the state against which to match the
+ * given modifiers.
+ * @param match The manner by which to match the state against the
+ * given modifiers.
+ * @param ... The set of of modifier indices to test, terminated by a
+ * XKB_MOD_INVALID argument (sentinel).
+ *
+ * @returns 1 if the modifiers are active, 0 if they are not. If any of
+ * the modifier indices are invalid in the keymap, returns -1.
+ *
+ * @memberof xkb_state
+ */
+int
+xkb_state_mod_indices_are_active(struct xkb_state *state,
+ enum xkb_state_component type,
+ enum xkb_state_match match,
+ ...);
+
+/**
+ * @page consumed-modifiers Consumed Modifiers
+ * @parblock
+ *
+ * Some functions, like xkb_state_key_get_syms(), look at the state of
+ * the modifiers in the keymap and derive from it the correct shift level
+ * to use for the key. For example, in a US layout, pressing the key
+ * labeled \<A\> while the Shift modifier is active, generates the keysym
+ * 'A'. In this case, the Shift modifier is said to be "consumed".
+ * However, the Num Lock modifier does not affect this translation at all,
+ * even if it is active, so it is not consumed by this translation.
+ *
+ * It may be desirable for some application to not reuse consumed modifiers
+ * for further processing, e.g. for hotkeys or keyboard shortcuts. To
+ * understand why, consider some requirements from a standard shortcut
+ * mechanism, and how they are implemented:
+ *
+ * 1. The shortcut's modifiers must match exactly to the state. For
+ * example, it is possible to bind separate actions to \<Alt\>\<Tab\>
+ * and to \<Alt\>\<Shift\>\<Tab\>. Further, if only \<Alt\>\<Tab\> is
+ * bound to an action, pressing \<Alt\>\<Shift\>\<Tab\> should not
+ * trigger the shortcut.
+ * Effectively, this means that the modifiers are compared using the
+ * equality operator (==).
+ *
+ * 2. Only relevant modifiers are considered for the matching. For example,
+ * Caps Lock and Num Lock should not generally affect the matching, e.g.
+ * when matching \<Alt\>\<Tab\> against the state, it does not matter
+ * whether Num Lock is active or not. These relevant, or "significant",
+ * modifiers usually include Alt, Control, Shift, Super and similar.
+ * Effectively, this means that non-significant modifiers are masked out,
+ * before doing the comparison as described above.
+ *
+ * 3. The matching must be independent of the layout/keymap. For example,
+ * the \<Plus\> (+) symbol is found on the first level on some layouts,
+ * but requires holding Shift on others. If you simply bind the action
+ * to the \<Plus\> keysym, it would work for the unshifted kind, but
+ * not for the others, because the match against Shift would fail. If
+ * you bind the action to \<Shift\>\<Plus\>, only the shifted kind would
+ * work. So what is needed is to recognize that Shift is used up in the
+ * translation of the keysym itself, and therefore should not be included
+ * in the matching.
+ * Effectively, this means that consumed modifiers (Shift in this example)
+ * are masked out as well, before doing the comparison.
+ *
+ * In summary, this is approximately how the matching would be performed:
+ * @code
+ * (keysym == shortcut_keysym) &&
+ * ((state_mods & ~consumed_mods & significant_mods) == shortcut_mods)
+ * @endcode
+ *
+ * @c state_mods are the modifiers reported by
+ * xkb_state_mod_index_is_active() and similar functions.
+ * @c consumed_mods are the modifiers reported by
+ * xkb_state_mod_index_is_consumed() and similar functions.
+ * @c significant_mods are decided upon by the application/toolkit/user;
+ * it is up to them to decide whether these are configurable or hard-coded.
+ *
+ * @endparblock
+ */
+
+/**
+ * Consumed modifiers mode.
+ *
+ * There are several possible methods for deciding which modifiers are
+ * consumed and which are not, each applicable for different systems or
+ * situations. The mode selects the method to use.
+ *
+ * Keep in mind that in all methods, the keymap may decide to "preserve"
+ * a modifier, meaning it is not reported as consumed even if it would
+ * have otherwise.
+ */
+enum xkb_consumed_mode {
+ /**
+ * This is the mode defined in the XKB specification and used by libX11.
+ *
+ * A modifier is consumed if and only if it *may affect* key translation.
+ *
+ * For example, if `Control+Alt+<Backspace>` produces some assigned keysym,
+ * then when pressing just `<Backspace>`, `Control` and `Alt` are consumed,
+ * even though they are not active, since if they *were* active they would
+ * have affected key translation.
+ */
+ XKB_CONSUMED_MODE_XKB,
+ /**
+ * This is the mode used by the GTK+ toolkit.
+ *
+ * The mode consists of the following two independent heuristics:
+ *
+ * - The currently active set of modifiers, excluding modifiers which do
+ * not affect the key (as described for @ref XKB_CONSUMED_MODE_XKB), are
+ * considered consumed, if the keysyms produced when all of them are
+ * active are different from the keysyms produced when no modifiers are
+ * active.
+ *
+ * - A single modifier is considered consumed if the keysyms produced for
+ * the key when it is the only active modifier are different from the
+ * keysyms produced when no modifiers are active.
+ */
+ XKB_CONSUMED_MODE_GTK
+};
+
+/**
+ * Get the mask of modifiers consumed by translating a given key.
+ *
+ * @param state The keyboard state.
+ * @param key The keycode of the key.
+ * @param mode The consumed modifiers mode to use; see enum description.
+ *
+ * @returns a mask of the consumed modifiers.
+ *
+ * @memberof xkb_state
+ * @since 0.7.0
+ */
+xkb_mod_mask_t
+xkb_state_key_get_consumed_mods2(struct xkb_state *state, xkb_keycode_t key,
+ enum xkb_consumed_mode mode);
+
+/**
+ * Same as xkb_state_key_get_consumed_mods2() with mode XKB_CONSUMED_MODE_XKB.
+ *
+ * @memberof xkb_state
+ * @since 0.4.1
+ */
+xkb_mod_mask_t
+xkb_state_key_get_consumed_mods(struct xkb_state *state, xkb_keycode_t key);
+
+/**
+ * Test whether a modifier is consumed by keyboard state translation for
+ * a key.
+ *
+ * @param state The keyboard state.
+ * @param key The keycode of the key.
+ * @param idx The index of the modifier to check.
+ * @param mode The consumed modifiers mode to use; see enum description.
+ *
+ * @returns 1 if the modifier is consumed, 0 if it is not. If the modifier
+ * index is not valid in the keymap, returns -1.
+ *
+ * @sa xkb_state_mod_mask_remove_consumed()
+ * @sa xkb_state_key_get_consumed_mods()
+ * @memberof xkb_state
+ * @since 0.7.0
+ */
+int
+xkb_state_mod_index_is_consumed2(struct xkb_state *state,
+ xkb_keycode_t key,
+ xkb_mod_index_t idx,
+ enum xkb_consumed_mode mode);
+
+/**
+ * Same as xkb_state_mod_index_is_consumed2() with mode XKB_CONSUMED_MOD_XKB.
+ *
+ * @memberof xkb_state
+ * @since 0.4.1
+ */
+int
+xkb_state_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t key,
+ xkb_mod_index_t idx);
+
+/**
+ * Remove consumed modifiers from a modifier mask for a key.
+ *
+ * @deprecated Use xkb_state_key_get_consumed_mods2() instead.
+ *
+ * Takes the given modifier mask, and removes all modifiers which are
+ * consumed for that particular key (as in xkb_state_mod_index_is_consumed()).
+ *
+ * @sa xkb_state_mod_index_is_consumed()
+ * @memberof xkb_state
+ */
+xkb_mod_mask_t
+xkb_state_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t key,
+ xkb_mod_mask_t mask);
+
+/**
+ * Test whether a layout is active in a given keyboard state by name.
+ *
+ * @returns 1 if the layout is active, 0 if it is not. If no layout with
+ * this name exists in the keymap, return -1.
+ *
+ * If multiple layouts in the keymap have this name, the one with the lowest
+ * index is tested.
+ *
+ * @sa xkb_layout_index_t
+ * @memberof xkb_state
+ */
+int
+xkb_state_layout_name_is_active(struct xkb_state *state, const char *name,
+ enum xkb_state_component type);
+
+/**
+ * Test whether a layout is active in a given keyboard state by index.
+ *
+ * @returns 1 if the layout is active, 0 if it is not. If the layout index
+ * is not valid in the keymap, returns -1.
+ *
+ * @sa xkb_layout_index_t
+ * @memberof xkb_state
+ */
+int
+xkb_state_layout_index_is_active(struct xkb_state *state,
+ xkb_layout_index_t idx,
+ enum xkb_state_component type);
+
+/**
+ * Test whether a LED is active in a given keyboard state by name.
+ *
+ * @returns 1 if the LED is active, 0 if it not. If no LED with this name
+ * exists in the keymap, returns -1.
+ *
+ * @sa xkb_led_index_t
+ * @memberof xkb_state
+ */
+int
+xkb_state_led_name_is_active(struct xkb_state *state, const char *name);
+
+/**
+ * Test whether a LED is active in a given keyboard state by index.
+ *
+ * @returns 1 if the LED is active, 0 if it not. If the LED index is not
+ * valid in the keymap, returns -1.
+ *
+ * @sa xkb_led_index_t
+ * @memberof xkb_state
+ */
+int
+xkb_state_led_index_is_active(struct xkb_state *state, xkb_led_index_t idx);
+
+/** @} */
+
+/* Leave this include last, so it can pick up our types, etc. */
+#include <xkbcommon/xkbcommon-compat.h>
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _XKBCOMMON_H_ */